From 1ef76b7f7a9aba5fb07c8d5e9c63aaebc2e4779f Mon Sep 17 00:00:00 2001 From: MELERIX Date: Sat, 4 Apr 2015 00:53:25 -0300 Subject: [PATCH 001/559] Removed Adware --- Source/Installer/Installer.iss | 2 - Source/Installer/binno/InnoCallback.dll | Bin 65024 -> 0 bytes Source/Installer/binno/binno.iss | 2451 ---------------------- Source/Installer/binno/it_download.iss | 319 --- Source/Installer/binno/it_download_u.iss | 319 --- Source/Installer/binno/itdownload.dll | Bin 205312 -> 0 bytes Source/Installer/binno/utility.iss | 771 ------- 7 files changed, 3862 deletions(-) delete mode 100644 Source/Installer/binno/InnoCallback.dll delete mode 100644 Source/Installer/binno/binno.iss delete mode 100644 Source/Installer/binno/it_download.iss delete mode 100644 Source/Installer/binno/it_download_u.iss delete mode 100644 Source/Installer/binno/itdownload.dll delete mode 100644 Source/Installer/binno/utility.iss diff --git a/Source/Installer/Installer.iss b/Source/Installer/Installer.iss index b212f81fa..b5d9a4e49 100644 --- a/Source/Installer/Installer.iss +++ b/Source/Installer/Installer.iss @@ -1,8 +1,6 @@ #define BaseDir ExtractFilePath(ExtractFilePath(ExtractFilePath(SourcePath))) #define AppVersion GetFileVersion(BaseDir + "\Bin\" + Configuration + "\Project64.exe") -#include BaseDir+"\Source\Installer\binno\binno.iss" - [Setup] AppId={{BEB5FB69-4080-466F-96C4-F15DF271718B} AppName=Project 64 diff --git a/Source/Installer/binno/InnoCallback.dll b/Source/Installer/binno/InnoCallback.dll deleted file mode 100644 index 2b33aadf0b251b1abaac6cd9f2fb7329b3d55f4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65024 zcmdSC3v^V~^#^?Ckz|q#%mCpH5_M1@fWd$Q13C~U2IMhG2!yAi5CS65a0jpwm~=?X z&2eh9+P|&ZLes#wX z=kD{^XPzjO_oH zaUQoMO*SM*J?D=f6w9|!`t_D%gR!UdHbTZ|q0RdM?fBJ`-=(=BIEX;}GwV?DAVl{V z+hZvbi7CD2!q*^q$kQZAgAxJLk*)^?{NSJ6AnnuB{UGN5l{a(R1e9EotpCP`=u=tS z3jsI&rApHM6UI#+NACM6t{%U5{HpQ0=ATQFg5&e@L`XixHwvdD?bhK{5FEN>;R1Pq zUS^bCO2Y34crMTzx=6$Gh_sLmWGx*Kp7xJRk~~9;7cE=yprpwNvXVL@`cONHaAC+xqy68c9A<`toJXbS_&wFH*yy#&`+K70Y zWn%vFhnBBcvz&6*Wey$Cc*$zVjrJdN-X*bMwEsvQ4%cD24hQRSfDRoxOx0l@9rn;+ ziVp2M^ytv4!^t|d=+LY~Nr!Ds8b1*oHtVoShi7%jb$D8bjXFG`!)%>igYG}1!+IU= z)8YL(-dr6P=y10lU!y~x9==Y8Yjr5=aHS5H>99z^Jb%s3x2Qc%=Q+`6^wI>!V1pcI zdvmTMorU~06Xt|S_CY<5ojR=2;p;lA)ZsQAzO2I+1v!kdpUY7}*VwaYh1-&A2=ku4^NqYPJ zFk=mIMn3leNiq4I($#FgK@jA7ZMF~S*$QckeEl_NmB|h>>bP!#!vYCLGY%-z9ahx1 z*>o%c< zNp*39L4^z&q+U)%`n2>45%&ItO>mfztKGlOVU^^bL)>EqVcn6mh90u{%n?6P)k#*H{Hd)aIzIG_Z@P zA>!Z*!NG6`Q%yQ|kf&l`@1_BaGwV!@Y-gg6W0i^ZaX7zTWn|xig+4_zuo4XX?aH+h zq`tqMf#83%n+q)R@B1Ou(z@u~VB8z5q0m9Z5qI&9p$(_;Jb~4Ofyg5M>QO z9biA^5f`K~-hWaksSMQ-?@!8Qc2He~E83~CTK-f!nc>%v=@uhnD=UQhe~;8Lq|iyJ z+3X>U^BeDI666SmavcE=KhyH^kCfyAKx8f#?<~GBG#&; zI0Daz>N+K=Yq-PI1O-CPIX_u7hkeKnryT^5-ytt>2gy`X4fA;*%H}%EWyj@y?Ocb1 zzCsRGg_;o>DWF9YUJ40LOZzl2M3y%J+>jB=nI<=>K{vANxrShg!*7z z$(ON5nf!}p*H{BAp7(6kN(7@4 zeGsltcu{AR@%Ws1p*&|C3CEjAU2s=&QqP@jDQzWVwP7SW+wNt19x?fMnRc}rMWM); zZ)#Q@SA$t!Dy%Y{H8V*uDjqZX|Cj^)FY8KWQ0;7z#ks3E!8FMV(2aF2y-eX=u9h1l+lPA%22d(l`tGLtSD400+_v9e-ITCH=XB^Dcx zSY8f%(1Ct03%dv#Q-BmK%R-_4o4;dq)V8$# zDnf=37{4cs1{f3eE^HgC4_NO^+m9k|FtbS7cdRz;U4O({(wR(cTAsy3R^}iXWE(<` zKvsb)Gp|Mf8|*0iibhXrI{PT?FetAi%I}(}-6J7JX4R{b0x5T<)$^?sL&KftFGZu3 z2Hi@7FAO>&>{Dfxg@sJDer{D(S}@chZMu^kE;|5Ssy6MqtmzV)P|=L>q+KYMGPj~x znPXOZtD~XfnP#O6Mx?XN>R=?tGQqkIqT?_^+!%s%-$Kf&^c5<54Yoe!^N;l*T3YYY z9M%%6re)A2Nln{Ak^bFA)^#HhF>WD1ilOy6FOV0lmaxRw7dEwtH3h~vUV4eO@y(h^ zx4>wM#yQ{{NMf$TQg&R3E|(=Z8&)L=S_2ad_n29N37?B5*E3lm$^kLDQ~?ajXQcHgwZ$E1Uj{=CT7`i*8-d zprMiuvZi;a2L4T=Vtr+N(e2uPy%EJ>{lr*%{iCD`bIb_e5MkYw@fK%4*{t+aAJny? z1JtYx%&-Osa4I}KG|mz-g5gb|HEhii z_|KUQBT^BePDY`7kzVInSan)08Ubv_LDS(U`E-a{?aVGX`+4ISR4qX$YwC9_^gpSI zQ5pIJ2$i(FLGKp4U3eFCP*BMvVyrDZ9d;^XPkzya8>yEVwotk82gcZS0reJ2@Ske) zU$K_Ny=6rqORrE1u|5795?ttN9b7AX`4LoRttkXMg=vbj-rMVYm>tLnXGE2CrOlX~ zymyUx7G0$>;qhjcq)dshDG?ei;)?+`%eBOW2i|r0sb)i8k{|EZL6X8$m(IRa!5bzG z6foANI+%o4Zz)=h^c6L7@JER5LV4BOQ8PPH2gtO&-?|q9`+=zXo~PdG&19tboVnZ3 z2xiTiM{_#VLyo8gWIhgm z-@pfExZ3Hld@uYD2sdFa$YnH5ty`fQW)bIDlB0L*IKDsI|~H z{xe7?Tt*q#FI5}mK6(#$*&MTZh?mqm{T72dkk$Funqe?#a2fAkYiYNO0;dZ~U^>P* zB*+e;A>M`&-4>GWwY7BqrvIp=HD6OLbwWwoYiXWlH^sdBg1y(2Nc9T+E6%Iq-2QTcV{vjrxjIuUJ% zMGq9wtRm61rQ#2FgGM>InJO zG8C~CDx{7!VSb1bVxXW7jg2a9)J7E{^aM1`3GtJ{V9AM;ZMXx>EqaZf|C7zwx<#zb zp+|`|w=TSU^R>3`2^5G%$R+*%#|U}CSK$6ISojo;e`8RNQ|7g)cR<%(pqWPm6~fI- zinTCjQ;Ct)V%?(?W=8Kl!6#A8hIkaZuasOh92=3_4-CiYv!s&i(cNF8lCT>XKPN@I z_NjMCi9y*ALLDpx%b^M_JXM5y5pE3Uig0Er+aupzc0lgoQFceWI)E?>DSIjcXDD#6 z@P!CHrAicOn*k~89;IH(ic)-u6v*G-xPf&rH-eEpvT1g7e|EWV)GaRQkz`&AV$6pg zR|@|h8p(V6cJDdz;qLc8INq@L=&=(YfAVSLXQ!mopQBxQa&!1I!1h-Wwlr&Y0XQBO z4AZ!T^6>DVBldAYi~Rf{c!wQen+RR05Z~RPGh?Pws~k~wk7`-dMZOKg`?Z5EzNGB( ze`dP);(hZ&0l8yaV4bavB07Dm$M|ba{yN0N6o>p{d!QgNB+;(qs5$`h;p4C*pgmKm z+w{J&dsm~qP}!~QCmM+tUs3iG@vZlX^(m#+1F5eX794i`oqhZES<7$8@?A-lBma_o zSBA(-d{@%sLf;h!eb&kgd{+wOxxOpu-Yx=ftvroFCT%<}r>bUrhx^oY-<8BQgGWWy z3<#KghM=JVm>Z9KzxeKb*=NwTN>6ktvxqq;3w+Y@7@KTy7L`K z&n8mHpZcyWC^q@jRE_59WS`o}cO`C3y)Tpm@_TkQnq$O2QvVu?_Mf1w?`9mw4D}r7 z_#+A4K1&V!B;5TaEbEPx(38puVnpRNzGh${jL*baqS^LloCK{>+>wC0&9l_7R4RIX zfJ-Ve!cOp?g~d9}l#F10Q2?O}qv;Ek)H-)FRbs&1>G-K zSQVKZd4=8EFf5p}D{P#2@s(LZ8I^kFB)hi??a`3K=A6LFhne+OzZ!K&?mLGi`$J~7 z%3gL!j%SaiD8onkLwzQC5$Qceio}A@U^|mW)yo#X_m+X$wLK(;K1E%?mcbyfsQAKNxTl~GOIu~Mo-NO{}IJTcoi0f zeSkzW_RA||y$TbL%iRkxY7DNjdyw=oBrSk7Jvt})*&JqxE@%o>+UVgf<@7Uo*YC9<;RPxiyUv=akelE(P#Yu8E zk0*EfQX^tdQ|vzx>#wmCgr*C{Z=|s2MVPrD6r-2m$qS!A`G^NpQ%^R|;2RZ|t-evJ z*J^t^IBuMZ^@%vcF7Osh(}#@Yhe(v8QT~i5XM*x9n9FPMI)NK%awjSNX2j19Rd{k^ zRBRfnrzkR>A`65Z&=I$|%<+(ot*kRdS32?&U@%V)mYpImZ{swqVO_1TiDd_D8=HU^ z#k9({@e8=n16vvT_0mxvT>iSFd?!DN*`RN%6_S%y57fo9CY2WDJUM*(X)-2Kfo`Mb+gc_hXaHb>q$HL$qxfw$y@}<5@&>KTWW-ge*9F zdj8BA;B)%Y1nh*6cyq%WPiZ;;A*9#2%zp$8UU4f}(6UZaG*-r2{r8){)#^mPsLrcLt9s-%@$q>5J z$=cd5_+O|Pqx-9^WXqHkN4No2mh=Sno#k7YaqN@WY~3(eo;&u}1ys+ELjIPbdtvo!Gtg<56zalWXle9^pJ1Kdz+t+ zm2Xi8SMF8^Rqj!5seE6(sq#bh2Kakb9#OkhexP=)Y*0H^9#fMlkE-#Nd$A@E?T>y) zV!2jcfD+8BHdBkgs>dX|m~MHJB&Jj z>3`=rq+<72VBE6VeO9&-yDs@fwYS9vsb$C4cfMCa#Dq`Gz%fSa%Z_h27wbjUlyD-r z=9Q2e-+=n(AK(LJohSNm(BJYR=p*61EIs2mTPvvFk{+Y(ytqDvnLo```o658fxh$N zhO^hu|0`*zhv@es`pett=ggS-HZdP4so73*w2Lo29=8+z$K$H-Rfbg3x9{upjUy(M zuG{bpOsP>iP_kir{3Y1TFk&yZ17*%%q-t6oT8D!Yp)Rmy+9R;ijC~*04P8-UcXY?K zmV3SD&_jMNZYt`@uv;C z8;Mw+)d~91m7Grwtbc0)aFuHRNn81o9yo!zi<`Y)iM?K}riDP55KeSWpXi!YcBd}A z`{oY|{z_!o($F*L+C!}t6`21PN$YK5<(=X9_#VYhR5$vik{UW)A03~fBMRMN4Q2`q}wIKb}%2F1@{7$#{{CLPWW0TsDE~ux2#+#U{Ed);Qra8E6<4Lp%NEV~`!|ahZ zHlxjOdDI7Tcb;T~hBUFMZLEvoG9Q3yq*~w?QDSCNT2)Ro77&Hapy0I2bDb8sBgR%w zz&pDj{Ckv==pIx)@UYA_Qx?W=h*9cLy$$T%HvSRq`(GAWnDW|qExZNFWsK`h(PahJRA&XY@tFTMa?=W|4u~2U!iQSG&$e0z0s+yTbNesvSP# z$Zs{hM|q4Psp|Y4)I(GI98B#~z9mlyQB!^bWx}x4q;z4~FcxT>*%4~iUaTInE_0N6 zQBDvU!V20j4ZCI1y56IXmGm2Uux!t|o}-R#=wzVruZ1rIA+^)61M26>QB@T|KSTdH zhk7GjLxx3>eKs?J+Rgs85rem{pIiLZi5{hq55x?;08L#nDJ$D*&FPXlK&cmFM5Ruo zuq&6r*QoRBjLLa_1lVZbc4QE1-&o=qfl#fC9X0#s$>rZ1C5tEON+>C1Zq;m_hc_S+ zbIGY*4qX8bO$>HIQH0jpHvSXNoLmq8E6`}B@H^6>VSDn*CmBfP19DOlTbC4%{uPHS z8dzuE3?)FVPTO!+X&~wQTd_a=F#s~5S-2yKN1QbxNe>H_k23_; z8IstFHng~DksLP7JaE_gWTo2BWH`oCXw4BjaNSww@+4m?iK8`H9_wqh$`gI99prpp zYe#vduNC6(p`^Z6h=b%(X(am@o`|JHmJ)Ah;Pc5M@qS^z1W#l>|84L0xEWi zC^jwIief(phhFSll@yre9_L?47i@*F4;yHH9-bau773fi_e2lL0wD@C)zoy3(HUNk6uu!h_abW4* z!yAc0J1x(EE=F#?c)@|7A<@&83&=gq_^6^s)ia+cVm~@f21M$?U<1hFiXgMujKj;Ub+5{WPE(A)Na<)?oyZF*9cAhl^+)X?H1*Wyuvtw!UMr*AIjdneayaM^C8w|_}~DBTpK3x#dy$G%j5g`z(8p{}lpguap+V6Mi~q zhr&OH^;er{snp<|UpN*j2t|unyh)UOR}xKbdlrS;EjR-wXyq4u@q=tQ|8JSRhrviF z+*M?v@zNJ)LIZ^2ViJ~X3HQg;1;Zf!S$kof*#QgMxSd)R{~Wj&UA&4(1dU@96Ha=F z@qvdIgK$Aew4q+nmDcD=OLV0ZD&D^Jd*AjKQ zxlClQoCe?S(>N@Hse{wt9ihx?be1%g^u>_2C+)}LSdHx;`P@{^rZlDDoFX5K>;vvb zmVcTrM`AXwQJo)62339=c^gRa-DjO8XG=^<$ytyY#PZJ)2|+Dm4__%ta@NE0+gN8U zix2n_NFE2urvP&bX9qEhp~6c1OVF${p|I4!C{BE^Bc0zQ=()M=AMPeo2sHbEroSX& zSU=S7wwR++BGbyE>u$OSJ2Oa$jTnoExtjxKKaN?T2z2Hv>TaIq{el`z56wcLYFKc( z-;Cp>OA#Nc5POXoWLR-+DLOF%W2fxah6&S?;xVA@h+!!v6A2hgS+NU@AuXSPHBnm6 z&SO1*ASS$!Y)Vt~-iWuOCs)}U&5ZCDko)Wc1)5diuQ|Q651rYBZ5)jC@zQk;JDoi7 z#?vAnstqfoeL#^ma4X^P_|nV7 zqwVo05$*EiX-Q1A9{vgv1@QFVFvKCPH{+7;-;^tq;~!whS8`GECizOv!T(2MPq5_Sr+|v_fbf|bRKvYK z=TJFG^P}Txin-*6Gbyp$hsu=4pF=X*+KQ1`M`W;?>E?Bl`6-preN1VQQdku=jX(5^VgPS#o ze!dD*3yFXF2^j9$0}Wr?=6Qi!Vw}oGkQ1i$CLGPj!L#05$j>B!v4hfLDdf-p=5Y^x-XA|<--o|qD` zc@flcG!K1_c7|I`3a^B@=68P~)E{g9T0$=!k)?xTF*}CaM`X^lymF8YE&n$Q!gMYj zRB_6l%Vvf7fVhqg_&oe7UFZ50nwp~X#dSkzzAYB z+hfP2t=xdeo-4)`DbaL3bhl{Mri>u&(!lMHJS<-f!I#54*0KZZd*O6_wl#+~CUcOA zlH9B%L4C{$@fq-_Em7K;tAv^5f5&ciHV&rnv4{v^{TZW&EUS`b#}dYne*!~J&X!ZN z<)Pt;Fe_EiA>R%-r0ujyT$k17scg&+Zl!RS7LFmdq}nJT_&vlB5bLrWO#-9_0etJT z(W3tjOc*X7K+aMr*AvLf_V842<&Q*d8&w1=@ulm{uYna?*$ePSr<#{a(L1;mI4;}9 zJqQ|7iq9(aiZp%lAdb=_?r#Xj1n&^&iVOn3rPFA+K==~ZxMpLIgaIQXh~v_eeLLeR zvX^Xfsb7*UgJ;<(_!Xk- zj%4!?3_EQ1M~vQtx~x=^11|W55Oq7E>as*VR4oA`YFPL2O2nwg1Dl8=B|8OmO1o=R zVRbHx52&bPCEH%->S37(Gmza!$xcNeu358O%~V2J#wdZSHgGidwKSz z0d(iD^fGbowM0FA&=fj`N-qm`TdEd=bofC`-M)vE`d^UlA|#Aw8VK`@NZ!$Z*|?^s zMl+d(qInLaGh&gqGjP?GvDu9-Np2E(U_Frbqna@PpMm65FgeM8*|er7|10(8waR>R zbVd)zEsh^LCJa_pA$a3;@Tli^P=4y$JE#=un>$E1)JmExmaY|b;vLG?rkK{!QO`7w z)wzE|H-pETwil;2_FjBZV=!Y@fqKl4Z51b8#?pR}H-(n=UPkr>vuEjq)sK96I{^73tZ6@fKVm|&3NR$4 zb@p8NFzYPumG<8HWNe`9=dU1Sb^&{D&iL>MICpFY_3hM>_$}~;m!mU`73~HbEO2I9 zN)k=kDVsV)T~?g!(28^`c3nBMK7!)lsnc3w&@!A~%o|<->ewnpn(Q9fM;B)IN2|d^5pTs`HfRt(kFX%@i=T3A=D;YweW7!v~V*5%)aA;-P=S! zsHH*BDH;Dm8m&a5@jq!G+$`_DhDK}X_>jZMHFWe`2)xigUzE6_e?GcuCH`$Tx&*|n z`?#3vvPE~fp0nyMPspab9L=3Im+!aFbkkg^JKx6TB>Fetp>usSSF7>qRN->HnYrU; z;j+JUh~FYygTCDO#2|9{np3~{*AQ}T9`@J!PNkE}{LY@@i8_0gX{ zj85#gw)&v!g_LLC?e@xRU*nG0V`1N(dv^Th<#AiPf3YELOSd;VkAEot)=`0$m5uAh zr|%haD*D^p@-N5#`jgh@uc+&{=43v0+tRr`+ip4VR_5wc`z{Q;ZDZ*z6AmO*9G7l= z@sAY~x^IpA-G1ubn#&VrJy#h{c&_}yLieGIE$U~Je*W}_?g#$#bi#>-yQ)TI)jiSi z&wt;A|&8oJbr}{~hd<>RwX=tt^1;;0PB=7NBk`KsplaI><$p;=u zYB|=@;6En$KQtuof$wO`asN@t-(p~4VNH-Sz>{7c&m17iTcsVYykx<-hNu-cGD3`2t;HmVCHFQ9D07 zG(U<%uk}w z7p}X|vwoz|8Q}D`>nXHm0d<*+{C%yd>pJ;bUF+g94q!OO>JOd-u)S1$urbsg7r*Or zKU~RS)xSF!3EBQufAI3vI6Yl;#({%e#GMgqL^Qa*lp7mdN8=o)(N*19MV%=x!78|R zmSGiK{1QeDRaV6FgMMazM4l)Zr*#8Hw|7ncHPmW;l- zI9gJEc?`ybakON+S-5DSn8Ns6tOe7NbMA+OkH=!QDC~}AFvr7KP!T28yvN|>kNz8% zO$Q@;KJIO}29WE`X1G$}YA^BENFEAzLDxqm28;AB+JEzT8f!=UKc~ZIboi7GD|Gmn z4mSyyS7k+N3{NusWA~w0QEyV!NrZ6!C%C~$aZ6qNFVwYSI^nfyaf=bBTJyG00uQIX zM5S*d+?cz?$o1jBK=2EM;fj$=M>5V3jCoNE?*=_vxvNf%S~A$dQqL&DjN$bZcPL}X z$vQHPDMA(H9d;ud7Dt(F+~XavkaZml#+msSA>IcVT8xKF8fim_#SypIKsfiE$m}Tg zMoMew2!XaR0YmB8atJ6M?fg;=A4_}24LJCO;SA)EwB=(3EU1>&SPXPy zv|y744lNu0TuT@W47fY|LjiP{=yvo?1m zT|S>5)8%N~3E;FVLIe?^aMBS?5pd^p2t^xkK77mtO&3P$aJUZBbvRgu19a%nVX6-M z=&*+lQ*>z8p;d<#9h!A0>99@Lv4{?vb=aiCvpVEDJgvh<9iGr(gANbruwIAzbhulG zH98FHaHkGm*I}g&x9RX@0Wq{(0G06Yhe(ZBkVef#6yV`M1KCF$yw^4_m>F}fuPwDWq4nNo77dre>hg^qY9iGvl zs>8E7{7Q%CbojLn>vgzahX-_cP=|+f_>m3|>+pyU8+3S7hsShyT!$xg_^}Q@(cz~$ z4C-)~4y$z-(qWAb-_>EQ4(oKdTZemexL1eo>2RM8-`C*>I{Z+Fl{);V4qw&bYdU;g zhyT*y8#;VbhgCYzIt@eIZM|bw31uNT0SI9p>o8pP~zU!cEbx-rk(+a07dU!?gBUlrw z{|VX@|5JR&-rY)ePh1Y_?&9JV#RKNL{+B33IK^Kt-9)#0t&Da11|RtH(bwdr|R< zii)40OYzrBH`$%LVEN)jqW<_#(53k6rE4WQOk2IExNzBuHPE>U^M70x6o0)kPI6Dd z){S7f;<=xoOYuZE0^WaG#uJyXUa)M*!f7ijnty^W#a}PoWH(hC>Tk)yMU(IQaXC=@ z_0mmr#{|rRFa88wioagEN$z}lJdQasVU9y?@%P6+vWRxDYL#$9m#kIRDM z$xi>6{fxD1(l|zX zm&tDN1g{{Rz3|87LGjnib7yzng2F}E=3RERAIGF8Y5-pj{FZ@Mr_R&IJt!|(y=Zz- z@uCF_#}yYZctp%>5l^@c*YI<#8`0w58N`o->!-$vyv!wC9VZqc)c~Y&OrPRiCNIfF z&R}twcNG|!S-eDEl=sN;2aAeVEMM~TMa6XI8TS~lCMb@+(RA&BMX}-TjF~uQhNEM< z=~~&8wpR^XieR<4(g~CDv)FfQ9|$i&5?q$%kK))vDEvD_iBosjaIKgzGmp;6c5hD*><(%vIDzAw)aJGF-$0<)g)-r~uXaa-c6hN1o{2*>9>A~b z35Ixv@Z-G$^3$V^*umu&uzZ2Le%Q&yV=_x61q&RtIR2$QQdhlWav_TSNdjH%4?(h2 zcSgYe3$eeSgPpBI{NF(kpr?O~EQF_i#GV(P5z)6hmzuCQ8S3AJG}y&p=CU69v3BA= zWn$*%t>grM(}*Ab2pAFj$=Gj;CB_aVoJbo4`vU}8F3`lAQ#o3_;fw>V$>3Ni{~A${ zLjsPq5uaGfo{e=|I*0$CxEKFBuGpRBZy=K9^&gxgi1hioM9-s^>17E1+=p=BDCPPA z<#X?f;?93>yq57Ue;#cBD^wlvL_{r5>467QjNbTZIFGfVfz^rQ(6CLUa+gs-2dj22 zhH#%JR-0zxAkKEUHh{Pv#EJ21*_@2@NikFq68m*(^<%g|G{hayt z(OCjYa|Eg08x~B&BN!L{js!<>gXaKRk)u2->WfgTiBPNIspT`HzRTplO#U;e1MB66 z7#+_w9;!Wt$rZR4o(90fNszSgV%5`t6}fqBp!*g z*4#&8HE49HXmpNvoQ6wf=6?@H!@$A5IakoKY6fUJEHn@&TKF&=5RbJJaAU+74gE~( zW7uz1=Fy2_RLut_RAvb-A>beiPPXBMBy2`UTvJNg=8N=~J8s1tASIH9N1|RfNfN>@ zh;Sa5|D7`L>?XJBiwyC`A^g}j?n4=Tkq2-EX`)~P7i!29mDzjlf>g>f|y%%#=re557)dy{% z6L?9vxN$4iXJ^l1-V@>R$OuFtgXEihk@Vs*zR0LGcRqAH$;Z=eZv+h?otKP6utZWd2 zW8-iFXcjIQ<(U)fy?X;w{xR@8%WuSchN}&sfqPdc8TMDEgYG0RZPQGUyAnG$fgM}f zSV&W2se5AZk&Z15|Amb|>X&4%$vP1Sj{;Nv_+#1R*~;j^pV*N{uJG=M7YB?Dt8Gd( zRemx=#k|ex_+fiAgi0VNwcBiO>{ds-U4uPjHSTT42p8^(AoXu366uty#Sf=`al?Zh;h({Z)S6A` zg^`Z-Pmv}Edk#wRPBCMzhQ=uD z7!4cH8N;Aja&cUWyy+P23`Z}g8nSWKwqyBpbJTa{#^MXUGaclwaN!1zIz10kpn!zf zs}V9GYUlvYvw0ScV1PnsJD?Ltflg<(dt%^ek!gs}LwYq4#XQX44qfGn#zYu{&>Ps1 zrAF-z%}ieZg&+`DZg${-me6cek9OAq_8U^9=QQV8(B0cHddxt{#a;y6rN(WAHfFAZ z+y*uXZJ0&XO8jQ*$r1mM9gSx%u8fUmxgVL~u;E)YNPj!!bKEVTfKUF?WHdI<_TlJo zsM<0oWb;Q*zF9248TE6yIvN!yO`h!wV<;oD`3w!E2{(z403{Q*IO#6ul@8v&YZ=It zK?Od6%((3d$ntkBtxA3*e`$Qceb%%6DUB9%#vdHUEgH46$WRd(0*QOJS6+iOh|^J7 zaK(}3!fUg%c%N$@i(f`@kyLxYvLmoUVGFu(RfS~fB1r%RruLF?NpOh^s8;18nu-X>wuNmubg1)UA0`2q>{rJuzF`#oBNiB>&mML`R71UkJz z2i1kUTJK}GRxyicLAagmZ6HQdh>^R9;~D5yRXn7MQ=^ov#xt%{QMS{HW7*RCO#C0G zVL}%oY)3MhDW6Ox)7>TxB=Y-^8x*M4ANN%HP7H1fbS_XBRlSZa|cyS)giE3 zN9v0!=jKV?=B1_?e1<@D5#p6o*GzV1ATQ$d*FoZR+YaJ%KBhX_ynv)N48L|gB+CRX zCe8=RG0uhPQHzs6LzE(n9Jad*vI;!fAQq*V^lK*)HDcL=|v`b6WX<6nU+j_!wFLe!24 z;6H$*+IhCA--wBbjn(b&Ac9u|HB()`V|omW`gcxmwPGaS30MmW>p4Ntq|Vr}EQUwf za_K6ywS*@NYU!e=vt;w&RBuO+*ho>c5T&BvO`_nBqfiXjlIr+4N`it919Udne%%e# z-L8MbC^vVL)@+WvO;x+U>Y8Rlx)H0}#f!DNrfzF7JdfZXoD$(sp%&pE`6-mbr~ni~ zZlXbvbl`CatzuxV2wf?yc^UQ{xeCXRgqW%W=3oIStmB+T)@8{r{zZy)_`z&R+o zhm{>7B>v=QLW(zE8>es3uR#<>$d4g!41(3fwC5=a#;}1hBJt{6{@li6_LSODhywjAF3SdRLHaN+ z*$ICgrq(vz4Z^?rxSICrw9p-~eiI|`OgjN#an{5v4p|wNZ^e)YEg*V{B+`Z~cpqeN zwGjZFOxtU33H|>UnKnIlqWgo~MTdJ0?|s{|4$L$omnZ7md7u5CsWrW)rHyMy9D6lZ zeBwUxJ?=5X2hlM^6mu0(6n@9mg5-hc_JTx3K_X(f$rD9sOjH_GFU?-$^TX0;;|Jeb z{CSEv-inG1rDJcjW8!qNc9^^9K^g^9^Nnr9Voe0AMH$EW;J<^XCe@JXzY@P8(K-C% zefx28>pc0oGV90n@L}z2BX$RQC#aO#R~hcWOxG+;$FfidJG3SieFo9WO6x4Tj*R#F zDF3AC+5+Q$VIU8BQa?#fo+R5Q`OkDKwyQU9iJ)sxZ`{&GpjW{B?pb8cvhjrHs|NlQ z+PfOZ-7p1t;WVg|Hoo)MG@=S<*4&84Kd&wXZhIuAJh&)fg-rMwIli2jHDR{WPw# z>W}}whP-g6kdMMT3u)jmz)*M^)JDa%L4D|=?8Adp>|rUq0^yqe@G&S%U4*iWGYhY*y?=usrQWuzc-Burb+k zwwmAmB3Ooer+QE9MX(Xti(mu9i(uW<+q4(K`qPVGebpN)O`%FN9$*Yr#)m2sLY06q%+NhEWNb-rWxLTbxP@P?dU1F<4?*Z~d zk818mNE;@5tU;YExOxf^wPnxXi#M}C`#Is?j4x=@OIx*NFH>Zoj4(+%pC-X>aS-j3 z?-6bC$7pXBwA*!bDa0HQHNl^JgL*9DL(Epx>Dw#a?aq?1(JiMBphz|<(v&8YXE?U_dA&%CiCI_L8RYx7iQfDM5*7YPfxE4A zBt3!X?SQxJciayKc@#FYz4%iRLUZunA}|zw{U0bJ?v;xoLMx!b(GGx_X=$nLJ0kG& zztG85GMn5@3B~+jDbCR37mZsVlL4t}57N!~_(KrdPQw7=@D$R%Ko$+Qf6Gon7%LDW zC{ZOget9(^kgeNt7Uivz_Q7IqnGD1_X(ia*Vue#1yD0W86GZq^KS#JnIAv7mmU`jb z2m7<7QPALUwih}ZJYoo~btFNU%usj-ti7tzZ8l+SYh6}@aERA9ab%YG74}!e5Odu0 z3d!**qtFDqU{g4VN#P&{g@f1=4q}cRp^DO)Wsooy^`C+$r}JGn)QCaXopdt&g?bFp z>G1jshct)fg$B)Gec=QgRgL&y^pdjON7WDy9WAXPGBoy}*$MrP0lCmO2BVz&%c9QMP zpEfhUYE-+Fn@4_+lJQjotEQKXY0N`wxfysLR7^W%8%C0o-$d;no+Qo~q64hR*b|FQ z(C!THX1nyX$Iut`1rMwVW24SszawjMAuJJLm`>nXeh@&fMq_C)WwGEf4ZJ{t!|?Q= zIR+Acgg6Hqio422)o{-}z^UV>Xqd;G`?7FDyM7H5Do|%(gd!yLeKek`=#n5`S8t*`5w=%1T^1i2qXe zhBnQ&pb##49^_9SK~XNL{mUneh%cWzB4JQNaktD(W(QVBG(oppD_(1iBEnRGR2*&7;Ql4}Yw&@%|_|KXeYu*1GKD_#c`O zvIda6|mtuMn2sRCN|>b-W2DnZ?pY4T$aNtzjG|3^)F;5I>Iz^Pif4 zC{`{6P9F{DO@YH{{!cjPf%DJ7J8W9y7l{1R1qvFvqoWpdkb*7>N~b;B1*M)^%)^4x zX;AVLC0auK=WRQLCSX5`l6@nRo$ze0Cno!8$?g!zPGB&?A4E~H8d((q9=}19=#Xc7 zBO#}1$cX~^P$0j7-yx72s@e$oJk0t(NAI{n!@7+!lb{d*cfDtOgwhYtV)jsPmtS9H zrl!9Wi309@p6%w1z!<1u{6%2wtFjQr?*&GL-z8u(zeB*?db#^+DZG@zy&L6bSSf&p z+tA(Yu!AQ51Mtzk!`p|vkBj6rdh(mK!b$$vXYdvzh9%*lnT!TndJngX~ z$FEdKunCdv*7glZ5scw)>`D^PMGq4SPsS}lRn>YKP!{v&bVQRo9`NDY7Ty+{XA|9r z@h^4Z;M8m9-B0uW(GNe| z&I8<|SFO_bCeNa|;rR<{b6-FJ+M_l6v;C+)x^Rr=HJWPiC`AC^J=e_kha=_nzGSMcCxCYK2+l+-AEUT)pyLm-(%aFA@# z8T@&C3<6%TU_#*^OJ7{ouL>^4F@N&VM(uxj=U~E;RS#tqFItqha>0X(+-t|d?#E`T z=UxOiFwgiKQ?>k`FQA!Z;q|0c=C#eWiiupR}?>Vrvq)&Q|h!n)Gw20jy$R(}oV zm||l5EeKsRnIp?jYt8&CJp+(miW*}FeJ9)CE<{!=tB;3&^P!%n71?Y&zCHnwe?=NS zJ+0aK*AJHDL3lzoYXBdLsSm5iEYEom>)l!SQ*aHi_UGBu0nV(!a@cv$_6PcFp47L& zisBAA--!%-j}Di-xAXmQDw%^(<;WeEUcAXm@s~8gL=p04nW;*q18S3*N}s{CnZpgy z%v3>(+389!tLE?g3H8c?Wa=tWdxxM8F9Z4jHv`gm?-_#dR{%x;Hvx_T^Z~8}Tno6H z-1t2Pe-YqwfcFCy02Tnw1@r)>V@RA0NJC>6pa*ayU=8Ba0bd6k05~1tselszdjJ+8 z+zvP#ehc78KnXAv;SuOb8{AERmGE=GM!-hEeF$#=91MJ#FfT+n+0)%{_aPeiR|7W( z9{mf#eF8Z2ZztRhdUzGw7CroRxFy|93+YWd&NjI3*TY|iJE*%~gxjpUH^cq1?tTvL zX5IY^+-G$+t>Ev|-4$?8*WHi7JyLgXg8Pu3??$+}9`1wtDc!ve?sVO~7Vb^DTZX$z zcdvxILU%8NJ6m@b!CkM@r`-uz55FJoF}mF5!reo67r_0Zjx!zZKDyfj_X(ZOWVr1* zem2~5b@v3gBRY-??i$@a2JTcHXC&O4b(+KB&ep@z;a;YP4~E;JyRr5tEyRz*sM>FZ zqx~-I-CZV5&6+xHD$SnG_Mx*6?zXBfK=8Fn-tO4n!#(?wxGFN-*gISwC-xZ?Z2MK& zK*v{NHx}dhEerMyPxCo2;jE<1_NM#vkmv?VU|iLm?dJ25IPm(!Z3?!w$*Ny`QN20f z{nGZvJiG6TLB_|tCeike`?S+-U2l9%il#iDSMI`Ud78TohbicMh*kPILQdc}jcLDs z0d7m8qe$sfL%xzPB-vCsWNV0@N6WXpGX;Ye=M?LPe*V^P*Y!%?v!PFA`c@y_6?Sc= z5zp3^qm}6wx2k=Fy&DfYa?hE$PX6ghTa)OIq#aO`k`I)`R}N`8 zrp70omQCd~Tc7l>6B!3uMpQsJ;sNN)iOE6lSKv5&Z@Fo!^Mp5ot=K*wj+Gbx<<7-% zJ32#zR6^jyp;YRC3>5by z@lPcp;Uw8Q&fCi0#QYj3G+IKqLEo1KmZFY?M3c+=(kODf4P)`qM^_umj~YJ?JooGk zk0Fe@>vGc=mwZD`-WZ3RFlLaPv{kionx10$YbrRNGb{7t3A}+Zg2uIYMkNkg;}>6? zA94(Gxm<%B_&8GG9Fz*@0LP$#t|1iT7($;xLl8Cy=YEF};-De)aUg66VGp5na10>= z^g)tALl7|l{(%D!Gf?QWOVelU3>_7_CB7>Xra%eF_n75gcr0^QxS!hD_U1j7WD%5L zdvls)SJ=iMLlNZ3JP3ec!wyZ+o6!-c;bc?2XaTf&9;Cm{!wb?Uhd--t4#G8V?)`nF`tRYa6iZ%=zZuFIe@YuGti_?p8Jm&N^VNrA< z-27{Nbk)b160hY{-)&=Vl^tVll2f6T_AyTH*C)R!kB8d~cQP=9$2i6rDsS92x<;-? z(`Zq@%u~EgZ&6#!*pqPp&k>4-Cy9=YXM5E;e+iFzcPaT?-H8QAgZhS+;Xg!%Dci;j z0ZVD#Ef{_owt@Z?^|v@0CK8#D2#3SccCE*eG6ip&!5u0Q?$dM7hH)Gx0byt-U0@A@ zcsp$aYzs#V3Z~`bO|=tBegn>2z{CXR0liw1El#fm7GTI$D$T9P?PiqbB1-c$N^=8B z(+j0>pfsr{O&+8*ZL4~S(}+`jUt_x#fupyo&E>cF+S23%U)vDxiQ7+OX)PKZm*u-F zU2dhu94B5(%qyQ4(wX6dP=|BWO~OWn{3Q*N+bP=KCd89`uLx;eKdds{Uvfh7Cb!!f^@goJdiw_!_k7HX302En`x55)$kr4I)ol`SQ4~DI=dov7e>oM)6?9Mqo47`|BgnFwjCd` z8D^^C=(8V}v^`tc;%<}1$%)5=?ZU~XPrY9R9yRSCW}Ypd(Dn23#vnKQPTLCO($foH zndDV(4{l{85mSlf5!y)og|ozpzN5tIk9J;lt8bmtG@`hF?F6SunzpvXcYqW$YRy+_ zzrwmq(=Z7+s44G|@zard5<ofEIitYy2rv+dHm=&>ZrVyEdDS;T8{lc z?R|S(RaM&m29AJuR7_MVt20GONw&}4``m9BmvlrW#amg40)iqiaPX3-7;4}V$7vk1 zi3*Dvr<^i#iqeY0kdkqztf;J*8OAoj>rgU9O7isilbt+m(1an$?E&7m=0Ig^Sbl4r^?1{7M zB8rB8Hk6DU`WK%i_1@m`jS{wbSm}?1@{fe_=1>-MSn|>jB0`$ipY8^G7k)!w!9RRP zeSXk@hJ0Ipi>@m>r?hWS_dnw?pFRXJYq=BX`5C)mol7xxlj||^t<|CT^y+9-%r|Ne zrY+_7o`z==x<+iR2)1aG=by<_2T%Dr4A5$8k);|;U!mk36ufPK=X&z=4)Dw+Pg?Er zDjR)|V#()_XVd`C+sTv0?DC!`@J2&>`AK?XvlTn(jm>Oqr8hP)vVq>%e9HawMmAM0 zpf{R$l(XoqiQeYp%|F)v9Vk`bzU&bgoPcu)xa}JK%5Ek41r^2D)@?%C*vF8|o(J(} z$6KlET@(V7$!POh6jI4Ekh}aCrupPvOl8PNFtnBh^tt>ch9Opc`uT%3+wwAMvRdMD zBC=0mxi$=A{X~6)A(5jZv90V@N*+|-1@BA!D4e+X=j{K`W1kQVP+{2f~nZo}s^2P3; zLYD8`%j8Spl<$7veK}f0B(aSqv<-LL-pk}m;XgND?BAh1D-7T8otLHqg;Tyihc6_mDJY!xH6OG9cgG0q%0V?*Nc~xE$`WPhw8wDew^>4e!Cw zBxn1&;YtJyNlVQvEJAUad8iAO5f^!-S&Dc;(rr~moimz8JpK%4c)|6+XZ^`ieoxsbzk_%`9^fY5qi|DO^T_*BJl_MX zsXpP)V4mt}bVxspp&f+3O~5W3&+s(0^4q8$VSXpovIcPi3FfQg9z`BQ z)FhL=nad~(%8oh%^aD+E5$Bv=)w%92g!2>uC0vR=Rj6wqeZu!)J_-;INCXgl%3s3V zA7Jl(g+5Jq_8^@`pYpws9YD;B3Vo`Pt_5&0`lKRmE}$CmyOEdf&%{~%^2nhs;H!QQ zs%#4?5=bV{pkP3qsk(u`QiSW^aXFsPy*ZvM0S;O_(=&{UhdnxWnKIfCPR$d8=cVXO zWwfD;T0kS91u!&i5^f32%~VSA)x|#+ABg^W@2LoGKID|*RV?N5g6b&aK z|NQ_eFQZl|uNCg0X@RAw=i;`}SLLo-k#kKfyhq)$4v0OZu`9BBb5V^1T!(9gCM=J=Td@U@ws3liI!u#%w zPL;)g9P~al5rPs~CV%nwtIhx$1;d+xAF~`SE4OF`B)hjawZg0I#H9U=n5a5}k6;HM2JJ(z0-`;ul9q5GDXsgbm4uX%+QR@d zsk8^ymH@3m_#Q^b0w3Mwg|U@)pqJ~X);Pqa#XGM*L|@K6-vU~7(ZX}u^LCNyf}Z$l zgPojvscf9bTXs5r?J(ba8{b`pn@>YAo zuN}-9H*);@mNRkRx74~ACmuxY&&q3-c;Y&@jtB_HrJQb=%-sk*sS-Hel&6`$Tsa z(hT@S2R(~6Lu1QH2rQp<2E%VmL&}RlAZo#r=!mEig@AaS{04H}JnIa7#6z@dxcn{n zZ^R`}2QeQVI}d~`Y_ZNzaCApo>6$a#TDAcA-EuGt?Mr6g=nyR$(a@6YTN_LF2TI3e zwGX!@s7x6NJS2y?1F*H(Tv8 zEBo4~v}!>WTvPeGUPQqX==4pXBXbZZ&H*PXpY$a}mk(}399qvt`890p!rvik$`E-R zrQAr_RBY^K;XU|^#nTj-eNNs0#z50#FF;lm$1p19HwVz}MwCEhzKM?q_3dAvEr|PR z;Tjw3QFZcia=C}(Tfj*5+tj&^^@pfLFrreq)5->iPyLniSF9WiraBJG>wbfZG-P4o zMy>+d_37s%KD!TAto#k3ZUL{+r!zlfvB80NBQvldgzT|V4=p{S}fUjr#C z@Gt4ZA6XpeUr?l4;S^ zt;yo&l~cQ6G_ds9+BXNQ^}5Nlz(tk;XO|}R-bDe{glWYe`w0|;LJ%U~9Yj_j2;AC% zkJ{>z+iMX>n+zMEL+jf~X8l*?D6)zBWnkuoW^To`J#b=60z*o#AT^HsK4$THhzx`LWY=L>ffXUj+C?4AT7COjQuiI3lYUUe z1Z$svrp=8av-#`4!sdR5JkGJX0cS^SN0Ca^$m}-ATdN^*c>61?$~iXoQHEQuJQ@1A zzI`#FMfWs;6*Rj*JGj|S?uvW5$*QYzQ-X1WCLy@{@h4ITv$F5<`>Il+l1t;oXf$%= z)Gp!>H3SZgss_bd6(r`19!ZQ3^2XxBVPMzBP+|)4Q#c*P!c#s2H0s+)J_6*c41u(x zC>Wd~Z-mONZ(m0-w2gS6J*gJ(KItc=|3WJwXJvoUUmNPY5KoPzV&c&4kc;X-Qbbdw zxQ&(4D|4)XYZ(eyQRayJ?b*SdtX;QE|t#a|K69)Z=%LGg4Q#MNpJ@%=gA&h3C4I^})HfvvNDzTFDh^pjEJmka3FiO&wKBs$j{ zKQFllb5`*u(UELUSVQWUt5bSeSmWDU=V@)zd ztv}z7%7+LfR(NqOp>i8Tg*G1&|ByaoosAy9v@FLAg1?#NomkIK{57xN7w4fwa9BkP z`Me4*JH;u_9xe$!~Sa!h|J{0 zQ1|ui8(E-o35Xw8Cf}^HuU7p=nlNEsPaLPb8I<)uv1FZ44)=#t;sPg4axn%{k&4EF zB-(r898Fr~g|O^?bcZtq58K7iJym)Rx^W03bZgN8sBiz61yYLKLTf@oRq_sZwN1v5S#p zr$=5wQ57))J4obp-%yT&HU83Hy^}~z+2tX-`t~SR1B&u1Xk!u@Qys2_KYEwlaEEl$^C5cVKEw;X3q#k#HIH6E(%#&+XF?jXKIZpkuNB0RpHF z6E%LO#_kuraP%VjMemv)z=*ixrh}EG-El*0O!sef*nIU^Sh#s4##j-h-$dZ6<2ND2 z|HAnKjoA6{kURvH?-xL+)G@R;D52C5!Txf^Z~LkB9kQo(Sc2l}+ano{{=nhDh*$?T3NfKa+lT|p@$Sds zcMOYec{;;l8N)*Dji8TiTaB91qEOsTW2i``MUly|70Gd0SKZW&@MOAwJ<>N@?`z!E zi=OF2@>XaoiW*6SQflc~wLkyq{r&y2a4S3uBc_eyythK3fDOFZzvP<|i5V5@X}<|+Ky?zRI!xchDzOUK zIXtKZY&51|A_Jyi>gBxefuujPN?n(l*fZh9-&!7CWgNuTTd8=Xfmt7aE=v8-7muqz8hsJI z=!&c8YEhkUuCC%PUBx8o?~|^D;;g`}Mzq;a#y-h#4tE!>iJa~@TOw7CwY=YfwSQQA zi{@Z^VmH>U8B|#m)Dh)7GaU=#hf<25(lu8G;ViCGj}{=Rth*5V`2nHTCO0$nBh4Y4O$GO~pkixM#h1Zn(4u7%d_ONcy|7qoKD z!}pm}etgg2@2&9nBLxn^su%fQvyr(->hzF9bdtOP#O$cMU;%x7Jf<5YJWj(fU_ z2Vt>W2bP3&;e@Swx)P>2POW*xQQWh31jeUyL=Ed)$uOR@G2d}dcgaToSuSi2lBNMe zDiiebPgu-ZQ52=L6|6-lQyxksFmF3o@6#WFeED?Em}~6WOIv(>b*~-A#}F{sZ%V;z zB!?_drU|cy5(-*7R;BA~sG!NDb7Y!BRB5B~MHUvMA_&~4XR?g;Yf=5`eS9C3aaR^T z^fQgcMy5Sbo$8c{UfEBj@zy0ju!72-_V`PR8O zv?v*IVF6Ya`l@}!X7of>fPlW9iq)8WU2{)GF>SGAN5#;#ZQU_8tH$jB zsv@EK*>V_E%kWp|)Vs4UpqUbMG^4R5W zf7tl_+A)r!STp%8raeOrV=dOkd~B;J(z7dK+0<56S$k07V6Q%_?_ICHgKnnl7=mlH zIzmHI!{GpbQQmST3RLGuuL5IfCOWjxkJ8-=O4|1XJz|kr3#UKeqM3J+if_TGL(IrU z!gk`jK|R~k4HFCdcb8u$!RVnTOd-BQVp0_D_+iaZKgSVUk`Pm!%k13RNMFSIxB9Nb znGS!$QT}}u5xxQ)j}Z^%i1`{>hQHAU_3EBk8d9`P1aVd4#(7d2+YkpXpZlfk&oWjK$pKVbES>#<|uPW zWvFBSsgSRt?88Oh;00@r~?G z$Kk%&m?i6x|FDP6?nScLSDZlX26+m!4g0io(BFNVjr^4|kIK}I+=C`&pO&a23H?js z2-F_~Iu%XtQYE?%(G?UwIS<8~S)r9wC~-C+r{J;qpA3(Ba45s$6F(kb`te9+c*OYe zz;_!Ep1u?5NsZk7I$DQp)7|yE8lhg~FTp;MEfO_;3%xt}7-BG9 zLO%8KG(^}?H+*{?I#KM~82s$;V@`Iy=_eIODjGV>zG+e8r$w%asOXXfl80$gwoeO# zD?Xil^AS)yBsnr@S|mD#SL_-DYIQDa3)z*`nCkEsPlC}+2g`e za9pgyajZ@c9z>m%K+Z^zB7v%}4s!@MQ^hbB^9y>a{Rp3O;Tuq%313`Fr^nPZ;=H<& z5%vUix0@C3dYMNQ`k1DsMdmu{@lHi$;zGTlfGau-{W%69ddDcZsSksAWHYejcLyF& z>iQTIGlPm5jduip0Dt9Ni#ydkzV0pd!Gw69Fjf*1 zRpc)agV}iCin%N0+Y{nxIJ$w+9}!1)HZG)y5RNB=(J4^2%+IDItRmY`K7w-)SFOku zzzaTe6rWe{$|+S-$D`Oc?*G~_@ePfl)GH}Lyt3AHWj!N@KS=Ae`(id;{dzn%9+3+0 zECEyk9tZ3Jyru$$6C8%S8Soi^-2cF{6L1<34)h~QwiRd5&g&R8OQw?!=XK~+Z#tuLo?q8Y zLS<;+Tm>DE`M*43Hd1$iJX?V{>Ldb99mplUXq|fbSIE|%&o-7%ubjs6DP;K&)6yBq zA47*6h7OsoA3vRRNROgJrt1|Qa`TZnzB|H0?uZPU9!W>eo})wV3)CU13c+|!C;u8_ zHKro&u7`fe1TjfJ+(S=IKQzeKqx%6tU+;|RL%_N#_k{v)8(#Y*{ce)BEHDQ{*5z!es1^oR=`GuUmK1?v2^i#JB@s&IzrGt-?$zXWJhPoLlJXV6d^Uf0R@sQDvK&469Hu zg{}P^1*y~f2M|`@en&2qM65oNa$nn6W5O5|@5S;^oP%n`xnZOK3u4A(ki2#PQ=(bBdOwdlzM+UTv2tgTjfBms@j{*oZ6W(k9NFIyo;lCodCrUhCwq zMU~0szbd_rX&u^hykS3llm!Z}A~2xaO?!xy?|h?Bri!tl2q+ttsW`*m-s~L#a!Ei< zMoag}pDba##dK@f3J>&Z5z6{4U|Qd0lNVh&CoGHxHl;HoWp`%Z9*XO zXGgEKyoCH$Q2q*DBRS~Pyrp^hEAkA5nTu)ZWZ{Gf6R7{i&eT#YX=c5~-oARwY(;w` zFt^2^BU1dl!}(HB2M%uSkgx}jhkh07HrLCip9EE=_Q1NnR)Xa6H1so+Gg%lSbS9I0 zk}}wrgCNsxp#C{&9h{ee zzZl~Vd5@iQ@m6c-kjC{tlIQY4vXlu7-m2fG1@*_q6^fhRAM&1B!5rKDN!gvtOA} zI?aDyz5F*+i^iHX9IKbZNYj6?83*{x{na43A_JWUx^s;1_rd{o!_btvmD>1w{n=6k z7sc*dg47UWC{m?j{&Y@CSI^EOMY?_2c!y3Sg^RONl+3h#Y`y#-OqNo9D#{-mSbp~+ zR=!aypN{A5_I+3BjCuO$rGtbyEIcqkY=So|DokaED=v}HJa#bk(O zL_<6`0U!bFfD}Ny`lNS)WI#hwl&)h!Lz15Bh{fNaj_dI^xMM8-hIEX6HTH17fLbsT zmp{&;v2XEcAQM!KI-VWGYQRtx`!*+?m0QnXu~X9N%}Mxs26$bwIq4_)4s;e?1e>0b zuVf@7-GrBpu@p%A`8H2IO`&I~Q_+mjEQBKQjg;e7!tw zUPyf?U?_&PG(9nnGN_XN;1X9^SyP6(@zPkw-u$fD?a;+Mn0}KOXPX3LWh)%-15ec-(kHL6X=VR_g6ch#B z0@Rb#4f3M<4=}S+ z90`nflI@}K5f(U585@siWx&Fr%X$xZqU>zQx^ZP^gGwUyVbdzUJ2JoE;aesLaooOO z@-oA#od&hOv$&=JRDAb7q&pmhw>RE~ED{_+it%;z&ahcJOGAJed4Z`*#p?S1MXp{-l_S zCMw;70#j?rQ$6Ek587QW!pIh9oG6j^A+m22MRDBTTR2F*9!V;74?qE$PTfmr9LJxxK+m}O3I=V1+gD@(GD1f8ir26^7V^DN7~a@#!C?Z=5OzQcj!O2jAzwlp#)V{Ww&kTP)Ww%m3{VS~Iu@rw)Q)uO`_Q&^U{Q!$t zszw|NLD>SI-dWfi0^nw1f5Qx%vvC*BKLJ$D!9E7S&fnrpmWObL#&+xj0h9t#>78aB z@vOo#1yF}ULO7rXRq_JjkarvCO~3hgXF6kl?FPKcrRCt3N13DJBV==}?{NlZL9qd3o-vn<3kHxf&zK871oQ%Q z^DxE(L;=PEVgPXf3E%`I0#X2Jfcbz7KrX-wC;@B$YyoTsQ~_!LdjR_Z2LXowO@L#7 z^nfV9SU?Pb@T4E%NDt4-=}CoUFp zZUsyNM1dX~&?bkVBQo$#v?SU{ct*E^rU)Y%>F`eU>m)ax#}S`sN%SRpMk0I<{N^LP z22Usa+bB=Cj{{n^D{U6_ccrar;MWZZN4i|Z~Xyhow@ zCb+i)h&P%L{~+G05OxRb^_86wwKbvuNRO8hy&;WTL3W#|KHz#9||OX$8ptN1MvMf$0gENgMeQ${N@hu z+XTPt0e+*u#~!)?ew*O8dw|~u@H;rbPb+Q)aLNXh0(JuS0-6Ay0looz573?BxG2Ca zfOtR(U@jm7upCeh_&s0`pbqdcKnC;xBDy&)8gL813`hi|0&)Rs0b2pT2Rs9)1vCOa z2DAab1JF;8x?c;31K0udOT#l8uu^qz$MadhK|mAWIG_^{jJne=22TMH5BMcuHeey3 z06@Qo@T>+r4|rSkYsIq@5c~tjT>*#zm;uRv8Gt2#O@JMMX8TqyiQIynxMs9e~|{gMedzPQYnE#E%>|7C^rXoO75^Tv&*`%gVm#$;|L1X69yk zGZV0TJ!esR?#xWw1eu?Q)G3+i%P-)~CDE0%=SRm#968`t;QKF-Xm(Daw>UkQPFO_F zs%v6yZvG;|GbJAdt6}WjAEL&*vpBPG6~&x`n}HLu(+kt`*`1NMukuoU{`a(eEdqRV zi@b%onRyc_9lb9qSj8ObJM&M;PtQonSy-4}xQY&a#P5zwl{gF$${jwq!WH-zOwP;7 zr%3QgEzDmuF(ac8H`1!9rsii9=VmG!TD6=MKiYUYEqz(0=BwnaWk$KBXjh7=c_rj8 zTZXCU6if_LA|j27CAo6)GLmx&i@cOC%aeQ(a`V|a7)dL07;*|?>`VfRhjg>@ve|Ci z4F9p$2tZR(nKLt4Zt8u*s!vj0#`G*TF*n1TJ1cJm3PK>Apy2mU&nd!znTwR0-YF%c zSB63e)lHFU9$g6~SK6uqaw*4BkOx(S)j>^Ij7wrgVM0c3uA0Y`%vB5X(+e}yl+<#{ zz7|S371d2&oOydbYeeFZX_+g%6S?$^<>>`E{rSwuT+DcBHcb$zEe=0A!2NN`#-ow*kC*F^zU9&2>j^{=#&yes2Dvr9g>O+-hU_-2vRr;)BWovDIc!(`rpY zO+|-E(suns2VVb^e*zYD1fhZ& z#NsUuzysQ%BS%Q_+@-4|2+RP{|4W{ALT#hzvNHwC;9LBvwWy=m~pi6TH{T|2}ZNg zZA>;!GtM^NYs@m{8J8Q^8aElY8h02UH$G#0-uSZd4P%4xsPSXtm&Oyulg96jXN{qP zAlQZ5g4?J4%T_CbTZ%lOxMf;yB{ya13@{?TU5X?Mipu z?<#X`aXsv+cKyNivg>u%S1zkN-u;gIA8y%w(tVd_fv3Q;%JYWju;&ZU84qW`m;hu9 zS$u{fh(v>P*wON=GP?Z#^3ZsVJv%a@?X zXhw}m!Ze{&s1e>4J`h@jR>3YNiPOY1F+*G?z9GINek6V+{!{!9@s#+Z$Vm~>i_)jk z4^oI}h$+*w)Kp~JVS3*5S5Pg;Jj#57`AhTH<`b41ttRUfYmRlDb%*si>p!gz+fUjf z9BxOU~;*an*7-NkSjVZ=7<9)_o8CMwBfD8Tz9(c+4 zk?|kK4r7-wSkMb2gzJO`)bW)0m~*V_F4rrr22eQ7Q5Tnru}?6^Js~_N>=O1$5xI(&0x?Z|P za!SjjRno7em!tzyt0YU`OTE%)(>T*F!OPjEW#H$Hrr(+#GaWG1nLadqW$HAYHHDgo znMa$iHQ!{OU^biG=4A6U^KA3I<}7obdAWJ5d6Rjod58IN^E2k>%`cnZFgKWwnm|tLCR$UhY1aAH3~R2{Yb~*Eux_z#w^mtetb45ctp}}#tWDNq*5lST zYp1o_+H2L>^tLG5SX+!O&L-KMwnSTsEzLIHmSM}ac_D)vAcNa&Rkj-29@~D~LE9l) zlkJ%8xUJ3B30ds5>Fj!Ylzpr{#xB}Dkj8uM8TJDE2FT(z`*!F--EVm zvUl3M?LGEhJLk|j!X0`?q$A1^>zL$7b)-4wI_5hTI5HgBj$B89V}ql{vB$C3u^-%g z&{5|&IgUGe9Xe;YQ}2v)MmeLMW1R+Pj8k%^Ip;eUI5V8t;P?Wk*SXSJ;@s}s z?>y+Na~^UwI-8u$&STCN=W%DJQ}2p$MZ3nj46Ybxg*X@Ql3azJ#>b==kJYIF6tqTL2}j62pH=jPp#+v;{ghorg-+$-HB z?o#&#ce#6udz*W^d#8K1yV2e3KIU$5A9uI9+n{AS-Cb_ZWAMa!;yk=Z@>o4iPrN4) zayi$t(o^c$;3@ZP@oe*K_w0m>R(tk(nmsL^aWWL3r*XtF)Vy~h2FG}Jh zFu~!@`#YnMIoWx6#WQBaj zONmmpv_;w}?UD9NwbDVUPC6ttN=;I;bWHlYbiK)Knq@LU>V9K>$nvc17RLmK;4nMv z(3iJ6k{!QvOmoa|%y!)6xYw}|R%3}H&vC^0fz#*u&chXOTsY_)0UK~N@8*~C1^j0I z1^#dR)y5l*Q;dsY6L%Wlh7}AGMuQT!3nj33?+8Y5zE~_iAU-NSE7pr&iqTSsG~UFU ztfqy~=p`nj*<+q>&V;;Q1Ia#NiL)kHGp$9|`>hXIAAzhMvbI{kwsu*^+a^N}%WMzB z?giO**^fcb|73p^c5Re%oYUca(D{;6cK+ZD1uxrOKG!3z-L8GE*Ie(qJ_N^p>H3GO z-F4E{?KIc-M6`?x@Wr=x)+0QOWf<-o87;4SGk{dKM!vG!hOR1 zFL$?lf@d0d@*(gb_^lLkZJ>k1yTCoej22@OcqPZU!T7N8S=fQ2#=jZAF%A~S2xeHj zIl@w5l~4&?{1@T4@QpAO`qvGcH(Oi^y}M0(Ow5&Pr0399Z^G7vnr>TPL=&lyKEO6m5xUpuR7jyeCZhO9Pdeil|4yqwGH!s_+a!8 zKG*mg;~3#Sw8nB_v+z6N3E^4DKyOKFa@NGgyXkjkZPkhyAUx3m{6SqF)0mRevV z|0SJ~!cAA1X2L>dnF>s+O_ip{O*N)NrY2Lf>6od-bllWxYD15v)5Mt#=2&x_nKw&j ztJ!IeHz%4WK{86r8_ebAE#__J?dF~4Ds#2D#=IXKaXvrj(e~%Jdom&{UpmN z!*+JTdQ#hRRvlWFEGM<-Bv{W>*iULzFSDD}j=Ld`dtp7PE$bkejj*9DR;3NYSt~}d zb~KqW6u6ynK?X~s>dyD;q{To== zQ4WKHcf`ZCrd+_fdL1j#H!g*hEq82jY;$aP>~vH)s$p|?U%=`%JB~S8V0&8~Z4TMd z2^&1rIRbV!(V5~*h3%bt0qa}t-0j>83ta0wc%BVzb#^v;=_>TNjpj0QhuLbm*YcpH&hoKks&xstqS+c|dl9`L2|b-BA&)2RI?y`D z@tETk^uME>Yn+cdKXdju$GL2-*{*fKeWcs&&T+4Ef9XEs<~{3S*@4hrj;q2W4tDx| z{y%stEb&-jme4K)iH`uIZt>sJo@BfzBt(cN3Ncc=*Zud_J3hfZxjh z7BqZ;f17`gKZdc;H~hE!89o@jiIK)@(4&}Ol+d4;@9#|%7`?`o=u_-OPlEapjm9Qp zv+)@E6UU9M#t>nqkdKk#3SqUdPAC%|6nw(3(R+AFI4RtUUi(Zj)Et2x^%dw-Uxi-v z_2^gMVxDSFGhbs}ZG8}O`V1uWuhy@u8|;suxA~&|p#3XI!L1G}c>iwjdX?itj01mg zgg7x4bc#-ob1Fth%bn%UEf`B|ckXmnIjfyD;MqNw;Mz7=+AilAC)bQI6X-IQH}En1 zLB0+>t43ajaUhR+Ta8X*Jo;3VF3_ve=uir~S#I27+=lVuPV}^@FVNR&H0sdHib4-7 zMu-z6!6_sPDMA|hSsCbKdC||cz+l^uVm3bG(>{o>+>QiZRk$^j{WWgqkhpUZ7{TUEC>FiPh+#?H2cld&T`?t#}ZJ z%^!lTXgaUQ)&(x^LBEZYbW*samm;MoDOwsU87|O|n!CYP(P)Scw#EB6c4UHoicCOdY*qMcV;-gv%s&!x2KtTKFB^?n9S|O# z5X8>5)xx9UuF)KL9)uex`+v=FYxt9AD3{31#*A|cHxV!dyf_iADfoK_m&8rxrg6#K zbnJkc3LkP!M(A`rX|1*a5Dy6Aboh&30A7lR_P12w*wRwQK=c={fKsd>tV5(e_8$w4 z=?#E?UujV;!1q)XaguTRt@X3h3oJN`W zA;Qa9A*tVVDL z0iPAVmwgrlhlOS>2pTEAG9r3Y)=Ly01;V4q7`kbJ1H@toEeIL`Z?5PSB>`ekEDmdC z)dISFoV-{`A#__4%Rey1qVu2XHMH*0+@l>T3X- zv|{^U7sq*2xDIZD;dK`Q3ex~-!T=%Ao$0+$O=r2F-o8?7)@&UP_Ur2l=Vo&0oR=%+ z3b_ott>UhN1f+9$_?HiV1Kx}9FNa$UA95ME8{sw}EI+_KYCx(*$S)JIz4&Y3vXDNP zy;0hc1LEd`6*F1x=f)cW+`MW&%aDtbV+P(b@m`4X3%M%>#90Bq9JSQ`SmPnn#qc#C zO&0zxLk`PW`c-hPz-^@(ewo}#U_&M1(BFW3@{y7#aDFKiS`2(B7or7~ zQN)dgHqPUg!%hB#M*+%LxP|Z_Iw_&Wh=2JXZd*d`#J39(zYtn~8s3-VeVN}U5w1l6 zJ|U=2F|Y`Mg&-<~aA|O7;yDL@GnhLYJ|VCp#Ca5-@DEkfDKZtRrdC{GY92*MPZBp+ z%_|Q%YJTB}L-`i^eL~d|lr)#CZ3y>E6>oax0;f{wUzi_s!Pr9lYnB-K0& z>4^J_@wX7Tg`?C=P^ZxEGYEB|utmUc5OSq9A?YCsQEhZ;$(ia~F8o5((u+|WFX}rJ zc^2TUpYoTh&lp&7Dm4dx^N^C{?Oa|`v=iwC!r~X_#i!It*w2;KQRpG8WLOrWOyWY) zJS!Q05cZnX+z7u&)R6Qf@l}6F7E&piC4(EoxS8r)2pvSSPMT4Zg(A?m0RQ?WY%D9C zVg;5(az&Dujy$Nn2rI&iG@2JJk`JDWR5dhdnj(C8Hy{S3qw*BpGYr@+L>OsT!i4CV zgm*=!dJwvZ;YT$h8Kau!B4&Th=$))V2L6#=R$|@=TovjPMuZFT9+f+e;W7^Q8)^1K z(ZmZC^p>fG~n+#*J4g`TA2C&w!Z(L;3$^)T z0O@RMNrlsj1KQxm3vxH{>xKD82~oI?xJ+wx@*lxkD$sgp?cC2hMzk);)-u$MI9KCG zrL;gBL$MTJvZ>2ZmcsW7RZd=k8j++C_ZOm;#Z2~yCRa0EdcHq#ppvWd9Eihp=kX2U z6R7JnJ}`iSWQE9Pk!4Woc|P9_On*M#U4Nc_4AdZ0j-putb?o^%O2^FrCM3gyAbEr_ zaXM)(O_xwkT2GKTf%;PevFq2&mzS}jm*~mqLC4z=9@sxrG~O_@zShIjG%mFT=>^i4 zlNn9>`x#n4l(at4WhAU|KK_wbBVD2N&<6Hei_jbGFNb7^w6`M3q_OgV1Ife~Kh+GZ z-+^_T3=hJa@FBUQUaE%0VAy7|b|jIc%ShvoIuB>E*@P>#!Xm^ZY8SxIi~3P|(&8G& zP`Olx`&s;aNYD&cFOpemv1~jQ4M6!RRzaZ>wJ*gY85yV@4Cmpb=nX}Fl(r`eN0^Ze zp3jxnfqtZEE|!A&?)n9HOeh;j5~;w$_?wbeA>(b1~eRwLfCY1Jd-M?_j0&2;CeCQp6 zRrVKqD)3Z%R1Z8_m;Gm|V% z1HTaG({Co@-9pAi3J1?bepx7M1!9pV!X6Fe5achD`n^TqcEY8ypa@OcdE{#GOj%2Ns9vb!k&czVl+*!TPjWe+J1M8m1 nkeSVJ(@O4dQS2*W+@REg`UHVJN=iC7s*Tv?e}DfCDe!*)gI?Of diff --git a/Source/Installer/binno/binno.iss b/Source/Installer/binno/binno.iss deleted file mode 100644 index 6a68e5068..000000000 --- a/Source/Installer/binno/binno.iss +++ /dev/null @@ -1,2451 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define BINNO_PRODUCTION -#define BINNO_CALL_URL 'http://d3oxtn1x3b8d7i.cloudfront.net' - -#ifndef BINNO_PRODUCTION -;#define BINNO_DEBUG -#define BINNO_USE_LOCAL_CONFIG 'C:\\Users\\mihindu\\Desktop\\installer_data.xml' -#define BINNO_USE_LOCAL_CHECK_XML 'C:\\Users\\mihindu\\Desktop\\pre_checks.xml' - -[Setup] -AppName=My Program -AppVersion=1.5 -CreateAppDir=no -PrivilegesRequired=admin -#endif - -#define macro(ss) GetArrayLength(ss) - -[Files] -Source: "{#BaseDir}\Source\Installer\binno\itdownload.dll"; Flags: dontcopy; DestDir: {tmp} -Source: "{#BaseDir}\Source\Installer\binno\InnoCallback.dll"; Flags: dontcopy; DestDir: {tmp} - -;#[Run] -;#Filename: {code:GetDownloaderInfo|exe} ; Parameters: {code:GetDownloaderInfo|args} ; Check: biShouldRunDownloader ; Flags: nowait - -[Code] -#ifndef UNICODE - #include "it_download.iss" -#else - #include "it_download_u.iss" -#endif -#include "utility.iss" - -const -#ifndef UNICODE - BINNO_VERSION = '2.2.0'; -#else - BINNO_VERSION = '2.2.0u'; -#endif - -OPTION_V_SPACING = 10; -SUB_OPTION_V_SPACING = 7; - -// Win API -GWL_USERDATA = -21; -GWL_STYLE = -16; - -BM_GETCHECK = $00F0; -BM_SETCHECK = $00F1; -BST_UNCHECKED = $0000; -BST_CHECKED = $0001; - -WM_SETFONT = $0030; - -// option types -RADIO = 0; -CHECK = 1; -TEXT = 2; - -ERROR_SUCCESS = 0; - -// registry types.. -REG_SZ = 1; -REG_EXPAND_SZ = 2; -REG_BINARY = 3; -REG_DWORD = 4; -REG_MULTI_SZ = 7; - -type -#ifndef UNICODE - TGUID = record - D1: LongWord; - D2: Word; - D3: Word; - D4: array[0..7] of Byte; - end; -#endif - - AT = array[0..100] of byte; - - BI_URL = record - href:string; - target:string; - end; - - BI_DOWNLOADER = record - en:boolean; - exe:string; - args:string; - url:string; - oninit:boolean; - end; - - SIZE = record - cx:Longint; - cy:Longint; - end; - - HDC = Longint; - HKEY = Longint; - HGDIOBJ = longint; - HBRUSH = longint; - COLORREF = dword; - HHOOK = longint; - LRESULT = longint; - LPARAM = longint; - WPARAM = integer; - - TStrProc = function(nCode:integer;wParam:WPARAM;lParam:LPARAM):integer; - - BI_RECT = record - left:Longint; - top:Longint; - right:Longint; - bottom:Longint; - end; - - BI_HWND_ARRAY = array of HWND; - - BI_SUB_OPTION = record - master_switch:boolean; - on_value:string; - off_value:string; - hwnd:HWND; - attached_texts: BI_HWND_ARRAY; - control_type:integer; - control_ref:TWinControl; - end; - - BI_SUB_OPTION_ARRAY = array of BI_SUB_OPTION; - - BI_MAIN_OPTION = record - master_switch:boolean; - on_value:string; - off_value:string; - sub_options:BI_SUB_OPTION_ARRAY; - hwnd:HWND; - attached_texts: BI_HWND_ARRAY; - control_type:integer; - control_ref:TWinControl; - end; - - BI_ALERT_WINDOW = record - id:string; - text:string; - confirm_name:string; - confirm_behavior:string; - confirm_style:string; - confirm_selected:string; - decline_name:string; - decline_behavior:string; - decline_style:string; - decline_selected:string; - confirm_next_alert_id:string; - decline_next_alert_id:string; - end; - - BI_OFFER = record - id:integer; - offer_id:string; - download_url,execution_args,downloader_args:String; - //license_path:String; - control_next_btn:boolean; - valid,visible:boolean; - ready:boolean; // used to stop offer in runtime... - //user_cancel:boolean; // in anycase user cancel this offer... - main_options:array of BI_MAIN_OPTION; - link_array: array of BI_URL; - resource_table: array of BI_RESOURCE; - xml:variant; - page:TWizardPage; - cmd_line:string; // command line for specific offer - forced_args:string; - forced_accept:boolean; - - back_btn_text:string; - back_btn_style:string; - - skip_btn_text:string; - skip_btn_style:string; - skip_btn_behavior:string; - - next_btn_text:string; - next_btn_style:string; - - cancel_btn_style:string; - cancel_btn_text:string; - - master_cfm_text,master_cfm_yes_text,master_cfm_yes_args,master_cfm_yes_style,master_cfm_yes_selected:string; - master_cfm_no_text,master_cfm_no_args,master_cfm_no_style,master_cfm_no_selected:string; - - x_btn_behavior:string ; - x_cfm_text,x_cfm_yes_text,x_cfm_yes_args,x_cfm_yes_style,x_cfm_yes_selected:string; - x_cfm_no_text,x_cfm_no_args,x_cfm_no_style,x_cfm_no_selected:string; - - ask_for_skip:boolean; - alerts: array of BI_ALERT_WINDOW; - simulated_next:boolean; - end; - -var -offer_uid,installer_muid,offer_softid,offer_affid,execution_args:String; -installer_v1:String; -old_cancel_text,old_next_text,old_back_text:String; -link_array: array of BI_URL; -downloader:BI_DOWNLOADER; -offers: array of BI_OFFER; -hhk:HHOOK; -yes_text,no_text:String; -msgbox_flags:integer; -option_loop:boolean; -check_resource_table: array of BI_RESOURCE; -binno_quit:boolean; - -// Win32 API -function biCoCreateGuid(var Guid:TGuid):integer; - external 'CoCreateGuid@ole32.dll stdcall'; - -function biLookupAccountName(a,b:AnsiString;var sid:AT;var cbSid:Longword;d:AnsiString;var x:LongWord;var y:Longword):integer; - external 'LookupAccountNameA@advapi32.dll stdcall'; - -function biConvertSidToStringSid(pSid:AT;var ssid:Longint):integer; - external 'ConvertSidToStringSidA@advapi32.dll stdcall'; - -function biGetLastError():Longword; - external 'GetLastError@kernel32.dll stdcall'; - -function biLocalFree(hMem:Longint):Longint; - external 'LocalFree@kernel32.dll stdcall'; - -function biGetWindowLong(hWnd:Longint;nIndex:Longint):Longint; - external 'GetWindowLongA@user32.dll stdcall'; - -function biSetWindowLong(hWnd,nIndex,dwNewLong:Longint):Longint; - external 'SetWindowLongA@user32.dll stdcall'; - -function biShowWindow(hMem:Longint;nCmdShow:Longint):Longint; - external 'ShowWindow@user32.dll stdcall'; - -function biGetDC(hWnd:HWND):Longint; - external 'GetDC@user32.dll stdcall'; - -function biCreateCompatibleDC(hdc:HDC):HDC; - external 'CreateCompatibleDC@gdi32.dll stdcall'; - -function biCreateCompatibleBitmap(hdc:HDC;nWidth,nHeight:integer):Longint; - external 'CreateCompatibleBitmap@gdi32.dll stdcall'; - -function biSelectObject(hdc:HDC;hgdiobj:Longint):Longint; - external 'SelectObject@gdi32.dll stdcall'; - -function biGetPixel(hdc:HDC;nXPos,nYPos:integer):COLORREF; - external 'GetPixel@gdi32.dll stdcall'; - -function biDrawText(hdc:HDC;lpString:AnsiString;nCount:integer;var lpRect:BI_RECT;uFormat:integer):Longint; - external 'DrawTextA@user32.dll stdcall'; - -function biSetBkColor(hdc:HDC;crColor:COLORREF):COLORREF; - external 'SetBkColor@gdi32.dll stdcall'; - -function biFillRect(hdc:HDC;var lprc:BI_RECT;hbr:Longint):COLORREF; - external 'FillRect@user32.dll stdcall'; - -function biGetStockObject(fnObject:integer):Longint; - external 'GetStockObject@gdi32.dll stdcall'; - -function biGetTextExtentPoint32(hdc:Longint;lpString:AnsiString;c:integer;var lpSize:SIZE):Longint; - external 'GetTextExtentPoint32A@Gdi32.dll stdcall'; - -function biDeleteObject(hObject:Longint):Longint; - external 'DeleteObject@gdi32.dll stdcall'; - -function biDeleteDC(hdc:HDC):Longint; - external 'DeleteDC@gdi32.dll stdcall'; - -function biReleaseDC(hWnd:HWND;hdc:HDC):Longint; - external 'ReleaseDC@user32.dll stdcall'; - -function biEnableWindow(hWnd:HWND;bEnable:boolean):Longint; - external 'EnableWindow@user32.dll stdcall'; - -function biSetWindowsHookEx(idHook:integer;lpfn:longword;hMod:Longint;dwThreadId:DWORD):HHOOK; - external 'SetWindowsHookExW@user32.dll stdcall'; - -function biUnhookWindowsHookEx(hhk:HHOOK):Longint; - external 'UnhookWindowsHookEx@user32.dll stdcall'; - -function biCallNextHookEx(hhk:HHOOK;nCode:integer;wParam:integer;lParam:longint):Longint; - external 'CallNextHookEx@user32.dll stdcall'; - -function biGetCurrentThreadId():DWORD; - external 'GetCurrentThreadId@kernel32.dll stdcall'; - -function biGetDlgItem(hDlg:HWND;nIDDlgItem:integer):HWND; - external 'GetDlgItem@user32.dll stdcall'; - -function biSetDlgItemText(hDlg:HWND;nIDDlgItem:integer;lpString:AnsiString):integer; - external 'SetDlgItemTextA@user32.dll stdcall'; - -function biRegOpenKeyEx(hKey:HKEY;lpSubKey:AnsiString;ulOptions:DWORD;samDesired:DWORD;var phkResult:HKEY):longint; - external 'RegOpenKeyExA@Advapi32.dll stdcall'; - -function biRegQueryValueExCustom(hKey:HKEY;lpValueName:AnsiString;lpReserved:longint;var lpType:DWORD;lpData:longint;lpcbData:longint):longint; - external 'RegQueryValueExA@Advapi32.dll stdcall'; - -function biRegCloseKey(hKey:HKEY):longint; - external 'RegCloseKey@Advapi32.dll stdcall'; - -function biWrapCBTProc(callback:TStrProc; paramcount:integer):longword; - external 'wrapcallback@files:innocallback.dll stdcall'; - -function biMessageBox(hWnd:HWND;lpText,lpCaption:AnsiString;uType:integer):integer; - external 'MessageBoxA@user32.dll stdcall'; - -function biSendMessage(hWnd:HWND;message:UINT;wParam:WPARAM;lParam:LPARAM):integer; - external 'SendMessageA@user32.dll stdcall'; - -function CBTProc(nCode:integer;wParam:WPARAM;lParam:LPARAM):integer; -var -hChildWnd:HWND; // msgbox is "child" -myfont:TFont; -begin - // hook function - - // notification that a window is about to be activated - // window handle is wParam - if nCode = 5 then begin - - // set window handles - hChildWnd := HWND(wParam); - - myfont := TFont.Create(); - myfont.Name := WizardForm.NextButton.Font.Name; - myfont.Pitch := WizardForm.NextButton.Font.Pitch; - myfont.Size := WizardForm.NextButton.Font.Size; - myfont.PixelsPerInch := WizardForm.NextButton.Font.PixelsPerInch; - myfont.Height := WizardForm.NextButton.Font.Height; - myfont.Style := myfont.Style + [fsBold]; - - //to get the text of the Yes button - if biGetDlgItem(hChildWnd,IDYES) <> 0 then begin - biSetDlgItemText(hChildWnd,IDYES,yes_text); - - if (msgbox_flags and $02) <> 0 then - biSendMessage(biGetDlgItem(hChildWnd,IDYES),WM_SETFONT,myfont.Handle,0); - end; - - if biGetDlgItem(hChildWnd,IDNO) <> 0 then begin - biSetDlgItemText(hChildWnd,IDNO,no_text); - - if (msgbox_flags and $10) <> 0 then - biSendMessage(biGetDlgItem(hChildWnd,IDNO),WM_SETFONT,myfont.Handle,0); - end; - - // exit CBT hook - biUnhookWindowsHookEx(hhk); - end else begin - // otherwise, continue with any possible chained hooks - biCallNextHookEx(hhk,nCode,wParam,lParam); - end; - Result:=0; -end; - -function CBTMsgbox(Text,YesText,NoText: String;const default:integer):integer; -var - callback:longword; - default_btn:integer; -begin - - default_btn := MB_DEFBUTTON1; - yes_text:=YesText; - no_text:=NoText; - msgbox_flags := default; - - StringChangeEx(Text,'\n', chr(10), True); - - callback:=biWrapCBTProc(@CBTProc,3); //Our proc has 3 arguments - hhk := biSetWindowsHookEx(5,callback,0,biGetCurrentThreadId()); - - if (default and $1) <> 0 then default_btn := MB_DEFBUTTON2; - - Result := biMessageBox(WizardForm.Handle,Text,'Confirmation',MB_YESNO or default_btn); - -end; - -// Utilities -function biGetResourceById(Offer:integer;Id:String):String; -var -i:integer; -begin - result := ''; - // find the correct resouce for this id - for i := 0 to GetArrayLength(offers[Offer].resource_table)-1 do begin - if offers[Offer].resource_table[i].id = Id then begin - result := offers[Offer].resource_table[i].path; - exit; - end - end; -end; - -function biGetXmlStringSafe(var node:variant;path:string):string; -var - v:variant; -begin - result := ''; - - try - if VarIsEmpty(node) then exit; - - v := node.selectSingleNode(path); - - if VarIsEmpty(v) then exit; - //if VarIsNull(v.text) then exit; - result := v.text; - except - // return empty string - end - -end; - -function biGetXmlAttributeSafe(var node:variant;name,default:string):string; -var - v:variant; - -begin - result := default; -try - if VarIsEmpty(node) then exit; - - v := node.getAttribute(name); - - if VarIsEmpty(v) or VarIsNull(v) then exit; - - result := v; -except - -end; - -end; - -// the famous text width calculation function... -Function biGetTextSize(hWnd:HWND;hFont:Longint;text:string;var cx,cy:integer):integer; -var -memdc,hdc:HDC; -r,wbrush,old_bmp,hbmp:Longint; -size:SIZE; -rc:BI_RECT; -c:COLORREF; -begin - // Get DC - hdc := biGetDC(hWnd); - memdc := biCreateCompatibleDC(hdc); - hbmp := biCreateCompatibleBitmap(memdc,1000,40); - old_bmp := biSelectObject(memdc,hbmp); - - // Select object to set the font.... - biSelectObject(memdc,hFont); - - biGetTextExtentPoint32(memdc,text,length(text),size); - size.cx := size.cx + 1; - rc.left := 0; - rc.top := 0; - rc.right:=size.cx; - rc.bottom:=size.cy; - - // get white gbrush - wbrush := biGetStockObject(0); - - // fill it wish white brush... - r := biFillRect(memdc,rc,wbrush); - - c := biSetBkColor(memdc,0); // set bk color to black - - r := biDrawText(memdc,text,length(text),rc,$00000820); - - repeat - c := biGetPixel(memdc,size.cx,size.cy/2); - size.cx := size.cx - 1; - until (c = 0); - - biSelectObject(memdc,old_bmp); - biDeleteObject(hbmp); - biDeleteDC(memdc); - biReleaseDC(hWnd,hdc); - - cx := size.cx; - cy := size.cy; - - Result := 1; -end; - -procedure biAddWindowStyle(hWnd:HWND;style:Longint); -var tmp:longint; -begin - tmp := biGetWindowLong(hWnd,GWL_STYLE); - tmp := tmp or style; - biSetWindowLong(hWnd,GWL_STYLE,tmp); -end; - -procedure biRemoveWindowStyle(hWnd:HWND;style:Longint); -var tmp:longint; -begin - tmp := biGetWindowLong(hWnd,GWL_STYLE); - tmp := tmp and not style; - biSetWindowLong(hWnd,GWL_STYLE,tmp); -end; - -function biGetUserSID():string; -var -u:string; -l,x,y:Longword; -ee: AT; -bak:Longint; -begin - - u := StringOfChar( ' ', 64 ); - l:=63; - x:=63; - - biLookupAccountName('',GetUserNameString(),ee,l,u,x,y); - - if biConvertSidToStringSid(ee,bak) = 1 then - Result := CastIntegerToString(bak); - - biLocalFree(bak); -end; - -function biCreateGUID() : String; -var -Guid:TGUID; -begin - biCoCreateGuid(Guid); - Result := Format('%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x', [Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3], Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);; -end; - -function biCreateMUID() : String; -var -k:String; - - -begin - k := biGetMAC(); - if k = '' then begin - Result := biCreateGuid(); - end else begin - result :=GetMD5OfString(k) - end; -end; - -procedure biExpandMacros(var S: String;offer_idx:integer); -begin - - StringChangeEx(S, '%MUID%', installer_muid, True); - StringChangeEx(S, '%UID%', offer_uid, True); - StringChangeEx(S, '%AffiliateID%', offer_affid, True); - StringChangeEx(S, '%SoftwareID%', offer_softid, True); - - if GetArrayLength(offers) > 0 then - StringChangeEx(S, '%OfferID%', offers[offer_idx].offer_id, True); - - StringChangeEx(S, '%UserSID%', biGetUserSID(), True); -end; - -function biGetSilentIndication():string; -begin - result := '0'; - if WizardSilent() then begin - result := '1' - end; -end; - -function biCheckExeHint(resource,args,store_key,store_name:string;return_actual:boolean;var Value:string):boolean; -var - ResultCode,root_key:integer; - reg_path:string; -begin - result := false; - - if Exec(biGetResourceByKey(resource,check_resource_table), args, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin - // read the regkey to return value - root_key := biSplitRegistryKeyNoWOW(store_key,reg_path); - // MsgBox(reg_path, mbInformation, MB_OK); - if RegQueryStringValue(root_key,reg_path,store_name,Value) then begin - // Successfully read the value - result:=true; - end; - end; -end; - -function biCheckFileSystemHint(path,name:string;path_check,return_actual:boolean;var Value:string):boolean; -var -fn:string; -s:AnsiString; -begin - result := false; - // if path_check check only the path.. - if path_check and (not return_actual) then begin - if DirExists(path) then Value := 'true' - else Value := 'false'; - end else begin - fn := AddBackSlash(path)+name; - - // full check required... - if FileExists(fn) then begin - // read file if acutal content reqested - if return_actual then begin - if LoadStringFromFile(fn,s) then Value := s; - end else begin - Value := 'true'; - end; - end else begin - // the file not found - Value := 'false'; - end; - end; -end; - -function biCheckUrlHint(Url : String;return_actual:boolean;var Value:string):boolean; -var -tmp:AnsiString; - -begin - result := true; - biExpandMacros(Url,0); // FIXME: pass offer_idx - - if ITD_DownloadFile(url,'001.tmp') <> 0 then begin - if not return_actual then begin - Value:='false'; - end else begin - Value:='null' - end; - exit; - end else begin - // success full download.. - if not return_actual then begin - Value:='true' - exit; - end; - end; - - if LoadStringFromFile('001.tmp',tmp) then begin - Value := tmp; - end else begin - Value := 'null'; - end; - - DeleteFile('001.tmp'); - -end; - -function biCheckRegistryHint(Name,Key:String;path_check,return_actual:boolean;var Value:string) : boolean; -var -rk,p:Integer; -tmp,key2:String; -dw: Cardinal; -xkey:HKEY; -vtype:DWORD; -c:byte; -tst:AnsiString; -begin - - biExpandMacros(Key,0); // FIXME, use the offer index hear - Result := false; - // TODO: replace with biSplitRegistryKey() - p := Pos('\',Key); - tmp := Copy(Key,0,p-1); - key2 := Copy(Key,p+1,Length(Key)); - - if CompareText(tmp,'HKCR') = 0 then begin - rk := HKEY_CLASSES_ROOT; - end else if CompareText(tmp,'HKLM') = 0 then begin - rk := HKEY_LOCAL_MACHINE; - end else if CompareText(tmp,'HKCC') = 0 then begin - rk := HKEY_CURRENT_CONFIG; - end else if CompareText(tmp,'HKU') = 0 then begin - rk := HKEY_USERS; - end else - rk := HKEY_CURRENT_USER; - - // use smart reading method insted of inbuilt functions.. - if biRegOpenKeyEx(rk,key2,0,1,xkey) <> ERROR_SUCCESS then begin - // key not found, if we were checking the key then time to report it.. - if path_check or (not return_actual) then Value := 'false'; - exit; - end else begin - // key found if only existancy check exit.. - if path_check then begin - biRegCloseKey(xkey); - Value := 'true' - exit; - end; - end; - - // check value exist... - if biRegQueryValueExCustom(xkey,Name,0,vtype,0,0) <> ERROR_SUCCESS then begin - // value is not found.. - if not return_actual then Value:= 'false'; - biRegCloseKey(xkey); - exit; // because key is not exist.. - end else begin - // value exist.. - biRegCloseKey(xkey); - if not return_actual then begin - Value:='true' - exit; - end; - end; - - // proceed with actual value ( WHEN return_acutal) - - // now the key is closed and read it based on the type... - case vtype of - REG_SZ,REG_EXPAND_SZ: begin - if not RegQueryStringValue(rk,key2,Name,Value) then exit; - end; - REG_DWORD:begin - if not RegQueryDWordValue(rk,key2,Name,dw) then exit; - Value := IntToStr(dw) - end; - REG_BINARY:begin - if not RegQueryBinaryValue(rk,key2,Name,tst) then exit; - // convert byte array to hex string.. - Value := ''; - for c:= 1 to Length(tst) do begin - Value := Value + Format('%x',[Ord(tst[c])]); - end; - end; - REG_MULTI_SZ:begin - if not RegQueryMultiStringValue(rk,key2,Name,Value) then exit; - Value := 'unsupported-type'; - end; - else Value := 'unsupported-type'; - end; - - // comming hear mean everything is good and we have a value - Result := true; - -end; - -function biGetOfferIndexByPageId(PageId:integer):integer; -var - i:integer; -begin - Result := -1; - for i:=0 to GetArrayLength(offers)-1 do begin - if (offers[i].page <> nil) and (offers[i].page.ID = PageId) then begin - result := i; - Exit; - end; - end; -end; - -function biGetOfferIndexByChild(Child:TObject;mode:integer): integer; -var - p:TWizardPage; -begin - - result := -1; - - if Child = nil then Exit; - - if mode = 0 then begin - p := TWizardPage(TComponent(Child).Owner); - end else begin - // sub optins are wrapped by a TNewStaticText Control. - p := TWizardPage(TComponent(TComponent(TComponent(Child).Owner).Owner).Owner); - end; - - if p = nil then Exit; - Result := biGetOfferIndexByPageId(p.ID); -end; - -function biGetWindowsVersionStringCustom():string; -var - Version: TWindowsVersion; - tmp:string; -begin - // version retrived. - GetWindowsVersionEx(Version); - - if IsWin64 then begin - tmp := '64bit'; - end else begin - tmp := '32bit'; - end; - - result := Format('%d.%d.%d %s',[Version.Major,Version.Minor,Version.Build,tmp]); -end; - -function biDownloadRemoteResources(currNode:variant;var table:array of BI_RESOURCE;AbortOnFailure:boolean):boolean; -var - objNodeList,objResNodeList,var_tmp:Variant; - i,j:integer; - str1:string; -begin - result := true; - try - //objResNodeList := currNode.childNodes; - objResNodeList := currNode.getElementsByTagName('resource') - - for j := 0 To objResNodeList.length-1 do begin - // each resources is downloaded hear.. - var_tmp := objResNodeList.Item(j); - str1 := var_tmp.text; - str1 := ExpandConstant(Format('{tmp}\cres_%d_%d.bin',[j,i])); - - if ITD_DownloadFile(var_tmp.text,str1) = ITDERR_SUCCESS then begin - - SetArrayLength(table,j+1); - - table[j].id := biGetXmlAttributeSafe(var_tmp,'id',''); - table[j].path := str1; - - end else if AbortOnFailure then begin - // one download failed. offer is not valid anymore - result := false; - exit; - - end; - end; - - except - // resocurce tag may not found. - end; - -end; - -function biScanSystem(const XMLDoc:Variant):string; -var - objNodeList,objTmpNode:Variant; - x:Integer; - post,res:string; - my,path_check,return_actual:boolean; - -begin - if XMLDoc.parseError.errorCode <> 0 then exit; - - // download remote resources for preoffering check - biDownloadRemoteResources(XMLDoc,check_resource_table,false); - - objNodeList := XMLDoc.getElementsByTagName('check'); - - // add default paramters... - post := '{' +'"uid":"' + offer_uid + '",'; - post := post +'"muid":"' + installer_muid + '",'; - post := post + '"affid":"' + offer_affid + '",'; - post := post + '"sid":"' + offer_softid + '",'; - post := post + '"installerVersion":"' + BINNO_VERSION + '",'; - post := post + '"osVersion":"' + biGetWindowsVersionStringCustom() + '",'; - post := post + '"ieVersion":"' + biGetIEVersion() + '"'; - - for x := 0 To objNodeList.length-1 do - begin - - objTmpNode := objNodeList.Item(x); - res := 'null'; - - // check parameters... - path_check := biGetXmlAttributeSafe(objTmpNode,'check_key_existence','') = 'true'; - return_actual := biGetXmlAttributeSafe(objTmpNode,'return_value_type','') = 'actual'; - - if objTmpNode.getAttribute('type') = 'registry' then begin - my := biCheckRegistryHint(biGetXmlStringSafe(objTmpNode,'value_to_check/name') - ,biGetXmlStringSafe(objTmpNode,'value_to_check/key'),path_check,return_actual,res); - - post := post + ',"' + biGetXmlAttributeSafe(objTmpNode,'return_name','unknown')+'":"'+ res + '"'; - - end else if objTmpNode.getAttribute('type') = 'url' then begin - my := biCheckUrlHint(biGetXmlStringSafe(objTmpNode,'value_to_check'),return_actual,res); - - post := post + ',"' + biGetXmlAttributeSafe(objTmpNode,'return_name','unknown')+'":"'+ res + '"'; - - end else if objTmpNode.getAttribute('type') = 'filesystem' then begin - - my := biCheckFileSystemHint(biGetXmlStringSafe(objTmpNode,'value_to_check/key') - ,biGetXmlStringSafe(objTmpNode,'value_to_check/name'),path_check,return_actual,res); - - post := post + ',"' + biGetXmlAttributeSafe(objTmpNode,'return_name','unknown')+'":"'+ res + '"'; - - end else if objTmpNode.getAttribute('type') = 'file_exec' then begin - - my := biCheckExeHint(biGetXmlStringSafe(objTmpNode,'value_to_check/source') - ,biGetXmlStringSafe(objTmpNode,'value_to_check/args') - ,biGetXmlStringSafe(objTmpNode,'storage/key') - ,biGetXmlStringSafe(objTmpNode,'storage/name') - ,return_actual,res); - - if my then - post := post + ',"' + biGetXmlAttributeSafe(objTmpNode,'return_name','unknown')+'":"'+ res + '"'; - - end; - - end; - //post := post + 'http://search.babylon.com/?babsrc=HP_ss&affID=100789&mntrId=f8c8ea8b00000000000000ff52bd2bbb'; - result := post;// + '}'; -end; - -function biScanSystemFile(const data:string):string; -var - XMLDoc:Variant; -begin - - XMLDoc := CreateOleObject('MSXML2.DOMDocument'); - XMLDoc.async := False; - XMLDoc.resolveExternals := False; - XMLDoc.load(data); - - Result := biScanSystem(XMLDoc); -end; - -function CreateLoadingForm():TForm; -var - f:TForm; - b:TNewStaticText; - -begin - // Show the loading window.... - #ifdef UNICODE - f := TForm.CreateNew(nil,0); - #else - f := TForm.CreateNew(nil); - #endif - f.BorderStyle := bsDialog; - f.FormStyle := fsStayOnTop; - f.Position := poScreenCenter; - - // this is needed to remvoe the outerborder completely - ; biRemoveWindowStyle(f.Handle,$00800000); - f.Height :=60; - - b := TNewStaticText.Create(f); - b.Parent := f; - b.AutoSize := true; - b.Caption := 'Please wait while setup is preparing...'; - b.Left := (f.Width - b.Width)/2; - b.Top := (f.Height - b.Height)/2; - - result := f; -end; - -function biGetMasterSwitchState(offer_idx:integer):integer; -var - bs_main,bs_sub,i,n: Integer; - present,one_unchecked:boolean; -begin - present := false; - one_unchecked := false; - - for n := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - - bs_main := SendMessage(offers[offer_idx].main_options[n].hwnd,BM_GETCHECK,0,0); - - if offers[offer_idx].main_options[n].master_switch then // only considered when clicked.. - begin - present := true; - if bs_main = BST_UNCHECKED then one_unchecked:=true; - end; - - // if the master switch is checked we consider checking for decendents as well... ( ido's verbal request) - if bs_main = BST_CHECKED then begin - - for i:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do - begin - // get the button state on vlue - bs_sub := SendMessage(offers[offer_idx].main_options[n].sub_options[i].hwnd,BM_GETCHECK,0,0); - - if (offers[offer_idx].main_options[n].sub_options[i].control_type = CHECK) and (offers[offer_idx].main_options[n].sub_options[i].master_switch) then begin - present := true; - if bs_sub = BST_UNCHECKED then one_unchecked:=true; - end; - end; - - end; - - end; - - if present then begin - if one_unchecked then result := 1 - else result := 2 - end else - result:=0; - -end; - -///////////////////////////////// Callback functions ///////////////////////////// -procedure biOnUserInputChanged(offer_idx:integer); -var - bs_main,bs_sub,i,n: Integer; - cmd_line:string; -begin - - // alwasy ready before checking paramters (ie. master options) - offers[offer_idx].ask_for_skip := False; - offers[offer_idx].ready := True; - cmd_line := ''; // reset command line - - // page common args handling... - // downloader args - //biExpandMacros(offers[offer_idx].downloader_args,offer_idx); - //cmd_line := cmd_line + ' ' + offers[offer_idx].downloader_args + ' -url="' + offers[offer_idx].download_url + '"'; - - // exectuion args - //biExpandMacros(offers[offer_idx].execution_args,offer_idx); - //cmd_line := cmd_line + ' -exec_args=' + offers[offer_idx].execution_args; - - for n := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - - bs_main := SendMessage(offers[offer_idx].main_options[n].hwnd,BM_GETCHECK,0,0); - - if (bs_main = BST_CHECKED) or ((offers[offer_idx].forced_accept) and (offers[offer_idx].main_options[n].master_switch) ) then // only considered when clicked.. - begin - - if offers[offer_idx].main_options[n].on_value <> '' then - cmd_line:= cmd_line + ' ' +offers[offer_idx].main_options[n].on_value; - - for i:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do - begin - // get the button state on vlue - bs_sub := SendMessage(offers[offer_idx].main_options[n].sub_options[i].hwnd,BM_GETCHECK,0,0); - - if (bs_sub = BST_CHECKED) or ((offers[offer_idx].forced_accept) and (offers[offer_idx].main_options[n].sub_options[i].master_switch)) then begin - if offers[offer_idx].main_options[n].sub_options[i].on_value <> '' then - cmd_line:= cmd_line + ' ' +offers[offer_idx].main_options[n].sub_options[i].on_value; - end else begin - if offers[offer_idx].main_options[n].sub_options[i].off_value <> '' then - cmd_line:= cmd_line + ' ' +offers[offer_idx].main_options[n].sub_options[i].off_value; - end; - end; - - end else begin - - if offers[offer_idx].main_options[n].off_value <> '' then - cmd_line:= cmd_line + ' ' + offers[offer_idx].main_options[n].off_value; - - end; - end; - - offers[offer_idx].ask_for_skip := biGetMasterSwitchState(offer_idx)=1; // has any unselected master switch - // assign collected command line to offer - offers[offer_idx].cmd_line := Trim(cmd_line); - -#ifdef BINNO_DEBUG - MsgBox(cmd_line, mbInformation, MB_OK); -#endif - -end; - -procedure biSetSubOptionState(offer_idx,n:integer;state:boolean); // n- master switch index -var -i,j:integer; -begin - // set sub options of given master_option to state(enable/disable); - for i:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do - begin - - // Enable/Disble child control it self - biEnableWindow(offers[offer_idx].main_options[n].sub_options[i].hwnd,state); - - // enable/disable each text component associated with that control - for j:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options[i].attached_texts)-1 do - begin - biEnableWindow(offers[offer_idx].main_options[n].sub_options[i].attached_texts[j],state); - end - end; -end; - -procedure biOnOfferMainOptionClick(offer_idx,action_main,action_sub:integer); -var - bs,i,n,j,bs_sub: Integer; - main_option_checked:boolean; -begin - - main_option_checked := False; - - for n := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - - // avoid processing static options - if (offers[offer_idx].main_options[n].control_type <> CHECK) - and (offers[offer_idx].main_options[n].control_type <> RADIO) then Continue; - - bs := SendMessage(offers[offer_idx].main_options[n].hwnd,BM_GETCHECK,0,0); - - if bs = BST_CHECKED then begin - - main_option_checked := True; // atleast one main option cheked - - // enum sub options under this main_option - for i:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do - begin - // get the button state on vlue - bs_sub := SendMessage(offers[offer_idx].main_options[n].sub_options[i].hwnd,BM_GETCHECK,0,0); - - // unchecked sub option.... is it a master_switch - if bs_sub = BST_CHECKED then begin - // sub option checked. chek all the master_switch sub option in the same level - for j:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do begin - if (j <> i) - and (j <> action_sub) // and j is not the 'ACTION BUTTON' - and (offers[offer_idx].main_options[n].sub_options[j].control_type = CHECK) - and offers[offer_idx].main_options[n].sub_options[j].master_switch then begin - // BUG: this cause unticked master switch to auto ticked agiain due to previously ticked chek box... - // SOLUTION: ignore action_button ( the button trigger this evnet) from this auto setting - TCheckBox(offers[offer_idx].main_options[n].sub_options[j].control_ref).Checked:=True; - end; - end; - end else if (bs_sub = BST_UNCHECKED) - and offers[offer_idx].main_options[n].sub_options[i].master_switch - and boolean(offers[offer_idx].main_options[n].sub_options[i].control_type = CHECK) then begin - - // this is unckecked sub_option check_box - // untick all sub_options under this main option... - for j:= 0 to GetArrayLength(offers[offer_idx].main_options[n].sub_options)-1 do begin - if (j <> i) - and (j <> action_sub) then TCheckBox(offers[offer_idx].main_options[n].sub_options[j].control_ref).Checked:=False; - end; - end; - end; - - // Rev4. main option checked. look for all master switches in the same level and chek them all ( apply only to check boxes) - for i := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - if (i <> n) - and (i <> action_main) - and (offers[offer_idx].main_options[i].master_switch) - and (offers[offer_idx].main_options[n].control_type = CHECK) - and (offers[offer_idx].main_options[i].control_type = CHECK) then begin - - // check it - TCheckBox(offers[offer_idx].main_options[i].control_ref).Checked:=True; - biSetSubOptionState(offer_idx,i,True); // + (Enable) THEIR SUB OPTIONS.. - end; - end; - - end else if offers[offer_idx].main_options[n].master_switch // if this is a 'master_switch'.... - and boolean(offers[offer_idx].main_options[n].control_type = CHECK) then begin // ...CheckBox main_option ? - - // .. YES, (*Untick* ALL OTHER MAIN OPTIONS) - for i := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - if (i <> n) - and (i <> action_main) - and (offers[offer_idx].main_options[n].control_type = CHECK) - and (offers[offer_idx].main_options[i].control_type = CHECK) then begin // skip the checked contro. - - TCheckBox(offers[offer_idx].main_options[i].control_ref).Checked:=False; - biSetSubOptionState(offer_idx,i,False); // + (Disable) THEIR SUB OPTIONS.. - - end - end; - //[ticket:47] - main_option_checked:=False; - end; - - // Disable sub options when Main option unticked... - biSetSubOptionState(offer_idx,n,bs = BST_CHECKED); - - end; - - // disable next button when no root options selected - Wizardform.NextButton.Enabled := not(offers[offer_idx].control_next_btn and (not main_option_checked)); - -end; - -procedure biOnMainOptionClick(Sender: TObject); -var - offer_idx,main_idx: Integer; -begin - // determine which offer ? - offer_idx := biGetOfferIndexByChild(Sender,0); // main_option mode - - if (offer_idx = -1) or option_loop then Exit; - - for main_idx := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - if offers[offer_idx].main_options[main_idx].control_ref = Sender then begin - - option_loop := true; // disable recursive calls while biOnOfferMainOptionClick - - biOnOfferMainOptionClick(offer_idx,main_idx,-1); - - // Call the user input creation - biOnUserInputChanged(offer_idx); - - option_loop := false; // enable calls. - Exit; - end; - end; -end; - -procedure biOnSubOptionClick(Sender: TObject); -var - offer_idx,main_idx,sub_idx: Integer; -begin - - // determine which offer ? - offer_idx := biGetOfferIndexByChild(Sender,1); // sub_option mode - if offer_idx = -1 then Exit; - - // find the main and sub index of the button - - // find the main option this control is belong to.... - for main_idx := 0 to GetArrayLength(offers[offer_idx].main_options)-1 do - begin - for sub_idx := 0 to GetArrayLength(offers[offer_idx].main_options[main_idx].sub_options)-1 do - begin - if offers[offer_idx].main_options[main_idx].sub_options[sub_idx].control_ref = Sender then begin - - // change option states.. - biOnOfferMainOptionClick(offer_idx,main_idx,sub_idx); - - // Call the user input creation - biOnUserInputChanged(offer_idx); - - Exit; - end; - end; - end; -end; - - -procedure biURLLabelOnClick(Sender: TObject); -var - ErrorCode: Integer; - idx:longint; -begin - idx := biGetWindowLong(TNewStaticText(Sender).Handle,GWL_USERDATA); - ShellExecAsOriginalUser('open', link_array[idx].href, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode); -end; - -function biShouldRunDownloader():boolean; -begin - result := downloader.en; -end; - -// event handler just before staring installation -function PrepareToInstall(var NeedsRestart: Boolean): String; -var -args:string; -i,ResultCode: Integer; -full_cmd_line,offer_cmd_line:string; -ok:boolean; -begin - biExpandMacros(execution_args,0); - full_cmd_line := execution_args; // root args... - - // combine all offer's command lines - ok := false; - - for i:=0 to GetArrayLength(offers)-1 do begin - //if offers[i].ready and offers[i].valid then begin - - if offers[i].valid then begin // ready check is not done hear... - // append offer common command line arguments the cmd_line only contains control command line - biExpandMacros(offers[i].downloader_args,i); - offer_cmd_line := offers[i].downloader_args + ' -url="' + offers[i].download_url + '"'; - - // is forced arguments provided.. - if offers[i].forced_args <> '' then begin - - biExpandMacros(offers[i].execution_args,i); - offer_cmd_line := offer_cmd_line + ' -exec_args=' + offers[i].forced_args; - - // this offer is considered even without ready flag.. - full_cmd_line := full_cmd_line + ' ' +offer_cmd_line; - ok := True; - - end else begin - biExpandMacros(offers[i].execution_args,i); - offer_cmd_line := offer_cmd_line + ' -exec_args=' + offers[i].execution_args + ' ' + offers[i].cmd_line; - - // offer is considered only if it is reay... - if offers[i].ready then begin - // should this offer sent to downloader - full_cmd_line := full_cmd_line + ' ' +offer_cmd_line; - ok := True; - end; - - end; - - end - end; - - // if no 'ready' offers we abort the installation - if not ok then exit; - - if downloader.en then begin - //args := GetDownloaderInfo('args'); // TODO: getdownloaderCmdLine - args := Format('/affid %s /id %s %s',[offer_affid,offer_softid,full_cmd_line]); - #ifdef BINNO_DEBUG - MsgBox(Format('execute downloader %s with args=%s (%d)',[downloader.exe,args,Length(args)]), mbInformation, MB_OK); - #endif - - //function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean; - //function ExecAsOriginalUser(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean; - if( not Exec(downloader.exe, args,'',SW_SHOW, ewNoWait, ResultCode)) then begin - #ifdef BINNO_DEBUG - MsgBox('Execution Error:' + IntToStr(ResultCode), mbInformation, MB_OK); - #endif - end; - end; -end; - - -///////////////////////////////////////////////////////////////////////// - -////////////////////////// primary rendering //////////////////////////// -procedure biAddToHWNDArray(var arr:BI_HWND_ARRAY;wnd:HWND); -var -idx2:integer; -begin - - // addin to array of hwnd - if wnd = 0 then exit; - - idx2 := GetArrayLength(arr); - SetArrayLength(arr,idx2+1); - arr[idx2] := wnd; -end; - -function biRenderText(parent:TWinControl;text:variant;x,y:integer;var hwnd_arr:BI_HWND_ARRAY;x_limit:integer):integer; -var -decor_list,decor:variant; -old_x,i:integer; -lbl:TNewStaticText; -prv_height,tot_height,cx,cy:integer; -idx,space:integer; -begin -try - if VarIsEmpty(text) then exit; - - decor_list := text.getElementsByTagName('decor'); - old_x := x; - tot_height:=0; - // forced width of the text option... - // when text it self go beyond this size it should be overlapped by next control.. - - for i := 0 To decor_list.length-1 do - begin - decor := decor_list.Item(i); - if decor.getAttribute('type') = 'text' then begin - - // render text hear.. - lbl := TNewStaticText.Create(parent); - lbl.AutoSize :=true; - lbl.WordWrap := False; - lbl.Parent := parent; - lbl.Left := x; - lbl.Top := y; - lbl.Caption := decor.text; - biAddWindowStyle(lbl.Handle,$80); // SS_NOPREFIX adding for & removal - - lbl.Font.Size := lbl.Font.Size + StrToIntDef(biGetXmlAttributeSafe(decor,'size','0'),0); - - if decor.getAttribute('bold') = 'true' then - lbl.Font.Style := lbl.Font.Style + [fsBold]; - - if decor.getAttribute('italic') = 'true' then - lbl.Font.Style := lbl.Font.Style + [fsItalic]; - - if decor.getAttribute('underline') = 'true' then - lbl.Font.Style := lbl.Font.Style + [fsUnderline]; - - biGetTextSize(lbl.Handle,lbl.Font.Handle,decor.text,cx,cy); - - //MsgBox(IntToStr(cy)+decor.text, mbInformation, MB_OK); - - // does it exceed the x_limit with this new control ? - if (x + cx) > x_limit then begin - // limit the size of this component.. - lbl.Width := x_limit - x; - x := x_limit; // reached max width.. - end else begin - // width is set for full text.. - lbl.Width := cx; - x := x + cx + 3 // x of next component - end; - - prv_height := cy; - - // keep hwnd for disable/enable control - biAddToHWNDArray(hwnd_arr,lbl.Handle); - - end else if decor.getAttribute('type') = 'link' then begin - lbl := TNewStaticText.Create(parent); - lbl.Caption := decor.text - //lbl.AutoSize := True; - lbl.Parent := parent; - lbl.Left := x; - lbl.Top := y; - lbl.WordWrap := false; - biAddWindowStyle(lbl.Handle,$80); // SS_NOPREFIX adding for & - - // specifict to urls - lbl.Cursor := crHand; - //lbl.Font.Style := lbl.Font.Style + [fsUnderline]; - lbl.Font.Color := clBlue; - lbl.OnClick := @biURLLabelOnClick; - - // set the data retirval.... - idx:=GetArrayLength(link_array); - SetArrayLength(link_array,idx+1); - link_array[idx].href := decor.getAttribute('href'); - //link_array[bb].target := decor.getAttribute('target'); - biSetWindowLong(lbl.Handle,GWL_USERDATA,idx); - - biGetTextSize(lbl.Handle,lbl.Font.Handle,decor.text,cx,cy); - - if (x + cx) > x_limit then begin - // limit the size of this component.. - lbl.Width := x_limit - x; - x := x_limit; // reached max width.. - end else begin - // width is set for full text.. - lbl.Width := cx; - x := x + cx + 3 // x of next component - end; - - prv_height := cy; - - biAddToHWNDArray(hwnd_arr,lbl.Handle); - - end else if decor.getAttribute('type') = 'line_break' then begin - - // spacing need to be considered.... - space := StrToIntDef(biGetXmlAttributeSafe(decor,'space','0'),0) - - tot_height := tot_height + cy + space; - y := y + prv_height + space; - prv_height :=0; - x := old_x; - - // when we have multiple linebreaks together this value need to be rest. - // otherwise it will add up for tot_height for each linebreak. - cy := 0; - - end; - - // totol vertical hight taken by this rendering - result := tot_height+prv_height; - end; // loop -except -end; -end; - -function biRenderDecendents(parent:TWinControl;var sub_options:BI_SUB_OPTION_ARRAY;options:variant;x,y,x_limit:integer):integer; -var -i,h,y2,idx,pr:integer; -option,option_list:variant; -p1: TNewStaticText; -tmp_radio:TNewRadioButton; -tmp_check:TNewCheckBox; - -begin - try - result := 0; - if VarIsEmpty(options) then exit; - - option_list := options.getElementsByTagName('option'); - - // Create a Container panel for all decendent options - p1 := TNewStaticText.Create(parent); - p1.Parent := parent; - p1.Top := y; - p1.Left := x; - p1.Width := x_limit; - p1.Height := 0; - - // add border for testing perposes.. - //biAddWindowStyle(p1.Handle,$00800000); - - y2 := 0; - - for i := 0 To option_list.length-1 do - begin - - option := option_list.Item(i); - - // skip addtional decors insdide decendents - if (option.GetAttribute('type') <> 'radio') and (option.GetAttribute('type') <> 'checkbox') then continue; - - idx:=GetArrayLength(sub_options); - SetArrayLength(sub_options,idx+1); - - if option.GetAttribute('type') = 'radio' then begin - // Create this option box....? - tmp_radio := TNewRadioButton.Create(p1); - tmp_radio.Parent := p1; - tmp_radio.Left :=0; - tmp_radio.Top := y2; - tmp_radio.Height := 14; - tmp_radio.OnClick := @biOnSubOptionClick; - if option.selectSingleNode('default_state').text = 'on' then - tmp_radio.Checked := true; - - sub_options[idx].hwnd := tmp_radio.Handle; - sub_options[idx].control_type := RADIO; - - end else if option.GetAttribute('type') = 'checkbox' then begin - tmp_check := TNewCheckBox.Create(p1); - tmp_check.Parent := p1; - tmp_check.Left :=0; - tmp_check.Top := y2; - tmp_check.Height := 14; - tmp_check.OnClick := @biOnSubOptionClick; - if option.selectSingleNode('default_state').text = 'on' then - tmp_check.Checked := true; - - sub_options[idx].hwnd := tmp_check.Handle; - sub_options[idx].control_type := CHECK; - sub_options[idx].control_ref := tmp_check; - end; - - // common data.. - sub_options[idx].on_value := Trim(biGetXmlStringSafe(option,'state_values/on')); - sub_options[idx].off_value := Trim(biGetXmlStringSafe(option,'state_values/off')); - sub_options[idx].master_switch := (biGetXmlStringSafe(option,'master_switch') = '1'); - - // render the text for this control... - x := 18; - h := biRenderText(p1,option.selectSingleNode('text'),x,y2,sub_options[idx].attached_texts,x_limit); - - pr := pr + h; - y2 := y2 + h; - - // spacing between 2 decendents. not available for last item.. - if i < option_list.length-1 then begin - y2 := y2 + 5; - pr := pr + 5; - end; - - end; - - // total hight of decendent block... - p1.Height := pr - result := pr; - - except - end - -end; - -function biHasNode(node:variant;name:string):boolean; -begin - result:=false; - try - node.selectSingleNode(name).text; - result := true; - except - - end; -end; - -function biRenderPage(const AfterID,offer_idx:Integer;var xml:variant) : TWizardPage; -var -page: TWizardPage; -tmp_radio:TNewRadioButton; -tmp_check:TNewCheckBox; -tmp_memo:TMemo; - -y,x,i,idx,cur_width:integer; -objNodeList,objTmpNode,currNode:Variant; -bmp:TBitmapImage; -res_path,option_type:string ; -max_option_line_height,total_option_height,desc_height:integer; -remove_me:BI_HWND_ARRAY; - -begin - - // create the parent custom page - page := CreateCustomPage(AfterID,biGetXmlStringSafe(xml,'title') - ,biGetXmlStringSafe(xml,'sub_title')); - offers[offer_idx].page := page; // page is set - - y := 0; // Why its not 0 ? depend on the resolution ? - x := 0; - - // OPTIONS - currNode := xml.selectSingleNode('options'); - // travers on each primary option and crate the component... - objNodeList := currNode.childNodes; - - // selection mandetory feature.. - offers[offer_idx].control_next_btn := (biGetXmlAttributeSafe(currNode,'selection','')='mandatory'); - - // primary option loop.. - for i := 0 To objNodeList.length-1 do - begin - - objTmpNode := objNodeList.Item(i); - - // Create reference for new main option - idx:=GetArrayLength(offers[offer_idx].main_options); - SetArrayLength(offers[offer_idx].main_options,idx+1); - - option_type := objTmpNode.getAttribute('type'); - cur_width := round( page.SurfaceWidth * (double(StrToIntDef(biGetXmlAttributeSafe(objTmpNode,'width','x'),100))/100)); - - if option_type = 'radio' then begin - - tmp_radio := TNewRadioButton.Create(page); - tmp_radio.Parent := page.Surface; - - if objTmpNode.selectSingleNode('default_state').Text = 'on' then - tmp_radio.Checked := true; - - //tmp_radio.Caption := objTmpNode.selectSingleNode('id').Text; - tmp_radio.Top := y; - tmp_radio.Left := x; - tmp_radio.Height := 14 - tmp_radio.OnClick := @biOnMainOptionClick; - - offers[offer_idx].main_options[idx].control_ref := tmp_radio; - offers[offer_idx].main_options[idx].control_type := RADIO; - offers[offer_idx].main_options[idx].hwnd := tmp_radio.Handle; - biSetWindowLong(tmp_radio.Handle,GWL_USERDATA,idx); - // reder text node.. - - // +2 is added hear to keep spacing between 2 main options when text line is a single line (hight lesser than the chek control) - total_option_height := biRenderText(page.Surface,objTmpNode.selectSingleNode('text'),x+18,y,offers[offer_idx].main_options[idx].attached_texts,x+cur_width); - - // gard against option text hight is less than the button height - if total_option_height < (tmp_radio.Height-1) then - total_option_height := (tmp_radio.Height-1); - - if biHasNode(objTmpNode,'descendants') then begin - y := y + 5; // spacing between main option and 1st decendent.. - desc_height := biRenderDecendents(page.Surface,offers[offer_idx].main_options[idx].sub_options,objTmpNode.selectSingleNode('descendants'),x + 18,y+total_option_height,x+cur_width); - total_option_height := total_option_height + desc_height; - end; - - end else if option_type = 'checkbox' then begin - tmp_check := TNewCheckBox.Create(page); - tmp_check.Parent := page.Surface; - - if objTmpNode.selectSingleNode('default_state').Text = 'on' then - tmp_check.Checked := true; - - //tmp_radio.Caption := objTmpNode.selectSingleNode('id').Text; - tmp_check.Top := y; - tmp_check.Left := x; - tmp_check.Height := 14; - tmp_check.OnClick := @biOnMainOptionClick; - - offers[offer_idx].main_options[idx].control_ref:=tmp_check; - - offers[offer_idx].main_options[idx].control_type := CHECK; - offers[offer_idx].main_options[idx].hwnd := tmp_check.Handle; - biSetWindowLong(tmp_check.Handle,GWL_USERDATA,idx); - // reder text node.. - - // +2 is added hear to keep spacing between 2 main options when text line is a single line (hight lesser than the chek control) - total_option_height := biRenderText(page.Surface,objTmpNode.selectSingleNode('text'),x+18,y+1,offers[offer_idx].main_options[idx].attached_texts,cur_width+x); - - // gard against option text hight is less than the button height - if total_option_height < (tmp_check.Height-1) then - total_option_height := (tmp_check.Height-1); - - // if decendents available ? - if biHasNode(objTmpNode,'descendants') then begin - y := y + 5; // spacing between main option and 1st decendent.. - desc_height := biRenderDecendents(page.Surface,offers[offer_idx].main_options[idx].sub_options,objTmpNode.selectSingleNode('descendants'),x + 18,y+total_option_height,x+cur_width); - total_option_height := total_option_height + desc_height; - end; - - end else if option_type = 'license' then begin - // licence page option... - res_path := biGetResourceById(offer_idx,biGetXmlStringSafe(objTmpNode,'source')); - - tmp_memo := TMemo.Create(page); - tmp_memo.Parent := page.Surface; - tmp_memo.Top := y; - tmp_memo.Left := x; - tmp_memo.Width := cur_width;//page.surface.Width; - - if res_path <> '' then begin - tmp_memo.Lines.LoadFromFile(res_path); - end; - - tmp_memo.ReadOnly := true; - tmp_memo.ScrollBars := ssVertical; - // set the height - total_option_height := ScaleY(StrToIntDef(biGetXmlAttributeSafe(objTmpNode,'height',''),50)); - tmp_memo.Height := total_option_height; - - offers[offer_idx].main_options[idx].control_type := TEXT; - - - end else if option_type = 'text' then begin - - // simple text rendering on the given x - offers[offer_idx].main_options[idx].control_type := TEXT; - total_option_height := biRenderText(page.Surface,objTmpNode.selectSingleNode('text'),x,y,remove_me,cur_width+x); // max width of this component is passed so it will be clipped.. - - end else if option_type = 'image' then begin - - res_path := biGetResourceById(offer_idx,biGetXmlStringSafe(objTmpNode,'source')); - - if res_path <> '' then - begin - bmp := TBitmapImage.Create(page); - bmp.Parent := page.Surface; - bmp.Left := x; - bmp.Top := y; - - bmp.Bitmap.LoadFromFile(res_path); - bmp.Height := bmp.Bitmap.Height; - bmp.Width := cur_width;//page.Surface.Width - x; - - total_option_height := bmp.Height; - end; - - end else if option_type = 'v_space' then begin - // vertical spacer keeping (just update the spacing between 2 options) - // the hight is specified in PIXELS - offers[offer_idx].main_options[idx].control_type := TEXT; - total_option_height := StrToIntDef(biGetXmlAttributeSafe(objTmpNode,'height','x'),OPTION_V_SPACING); - - // vertical line is always 100% width - cur_width := page.SurfaceWidth; - - end else if option_type = 'h_space' then begin - // horizontal spacing keeping the size is taken at the beginning of the loop - // the width is specified in % of surface width - end; - - // Set common main options hear... - offers[offer_idx].main_options[idx].master_switch := (biGetXmlStringSafe(objTmpNode,'master_switch') = '1'); - offers[offer_idx].main_options[idx].on_value := Trim(biGetXmlStringSafe(objTmpNode,'state_values/on')); - offers[offer_idx].main_options[idx].off_value := Trim(biGetXmlStringSafe(objTmpNode,'state_values/off')); - - // maximum hight of the option line... - if max_option_line_height < total_option_height then - max_option_line_height := total_option_height; - - // update main X,Y cordinates - x := x + cur_width; - if x >= (page.SurfaceWidth -10) then begin // is it horizontlly filled ?? - // we move to next vertical line. with x 0 - y := y + max_option_line_height; // the MAX height of completed horizontal line - max_option_line_height := 0; // reset it - x := 0; // x cordinates reset with next line - end; - - end; - - // initial enabled/disabled state for all offers - for i:=0 to GetArrayLength(offers)-1 do - biOnOfferMainOptionClick(i,0,0); - - Result := page; - -end; - -procedure biRenderAllPages(const AfterID:Integer;var xml:variant); -var - page: TWizardPage; - i,page_id : integer; -begin - // Common tasks for all pages during rendering - // - // - page_id := AfterID; // first page is after user choise - - for i := 0 To GetArrayLength(offers)-1 do - begin - // process each BI_OFFER - if offers[i].valid then begin - page := biRenderPage(page_id,i,offers[i].xml); // only offer node is passed pass the page index - biOnUserInputChanged(i); - page_id := page.ID; // next page will be after this one - end; - end -end; - - - -// Main function used by clients -function CreateBINNOPage(const AfterID: Integer; const AffiliateId, SoftwareId: String): TWizardPage; -var - url,s:String; - str1,post:String; - f:TForm; - var_tmp,var_tmp2,xml,xml_server:variant; - objNodeList,objResNodeList,currNode,curOffer:Variant; - i,j,style:integer; -label finish,test; - -begin - - f := CreateLoadingForm(); - f.Show(); - f.Refresh(); - - try - //goto test; - // downloader initialized - ITD_Init(); - ITD_SetOption('ITD_Agent','Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'); - - // unicode version shows garbage text -#ifdef UNICODE - ITD_SetString(200,''); - ITD_SetString(201,''); -#endif - //MsgBox(post, mbInformation, MB_OK); - // local paramter initiaization - offer_affid := AffiliateId; - offer_softid := SoftwareId; - offer_uid := biCreateGUID(); - installer_muid := biCreateMUID(); - binno_quit := false; - installer_v1 := Encode64(GetV1()); - -#ifndef BINNO_USE_LOCAL_CHECK_XML - str1 := ExpandConstant('{tmp}\check.xml'); - url := Format('{#BINNO_CALL_URL}/binno/get_pre_offering_checks?uid=%s&v=%s&v1=%s&affid=%s&sid=%s&s=%s',[offer_uid,BINNO_VERSION,installer_v1,offer_affid,offer_softid,biGetSilentIndication()]); - - try - xml_server := CreateOleObject('MSXML2.ServerXMLHTTP'); - xml_server.Open('GET',url,False); - xml_server.setTimeouts(5000,5000,1000,1000); - xml_server.Send(post); - post := biScanSystem(xml_server.responseXML); - except - f.Close(); - exit - //goto finish - end -#else - post := biScanSystemFile('{#BINNO_USE_LOCAL_CHECK_XML}'); -#endif - - // include browser details to POST - biGetAllBrowserDetails(post); - - //post := biScanSystem(str1); - StringChangeEx(post, '&', '%26', True); - StringChangeEx(post, '=', '%3D', True); - StringChangeEx(post, '?', '%3F', True); - - post := 'installer_data=' + post + '}'; - - #ifdef BINNO_DEBUG - MsgBox(post, mbInformation, MB_OK); - #endif - - url := Format('{#BINNO_CALL_URL}/binno/xml?uid=%s&v=%s&v1=%s&affid=%s&sid=%s&s=%s',[offer_uid,BINNO_VERSION,installer_v1,offer_affid,offer_softid,biGetSilentIndication()]); - -test: - -#ifndef BINNO_USE_LOCAL_CONFIG - // Load the respnce and do the intial parsing... - try - xml_server := CreateOleObject('MSXML2.ServerXMLHTTP'); - xml_server.Open('POST',url,False); - xml_server.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - //xml_server.setRequestHeader('Content-Type','application/json'); - xml_server.setTimeouts(5000, 5000, 10000, 10000); - xml_server.Send(post); - xml := xml_server.responseXML; - except - f.Close(); - exit - //goto finish - end -#else - xml := CreateOleObject('MSXML2.DOMDocument'); - xml.async := False; - xml.resolveExternals := False; - xml.load('{#BINNO_USE_LOCAL_CONFIG}'); -#endif - - // load the offer xml - if xml.parseError.errorCode <> 0 then goto finish; - - // common settings for all pages.. - execution_args := xml.selectSingleNode('/sponsored_data/downloader/args').text; - - // download all page resources. - currNode := xml.selectSingleNode('/sponsored_data/offers'); - - // travers on each primary option and crate the component... - objNodeList := currNode.childNodes; - - for i := 0 To (objNodeList.length - 1) do - begin - - // process each BI_OFFER - curOffer := objNodeList.Item(i); - SetArrayLength(offers,i+1); - - offers[i].forced_accept := false; - offers[i].visible := True; // offer is visible by default - offers[i].valid := True; // offer valid by default.. - offers[i].download_url := curOffer.selectSingleNode('download_url').text; - offers[i].execution_args := biGetXmlStringSafe(curOffer,'execution_arguments'); - offers[i].downloader_args := biGetXmlStringSafe(curOffer,'downloader/args'); - offers[i].offer_id := biGetXmlAttributeSafe(curOffer,'id','noid'); - - // more offer specific options - - // master confirm window... - var_tmp := curOffer.selectSingleNode('sponsored_settings/master_confirmation_window'); - offers[i].master_cfm_text := biGetXmlAttributeSafe(var_tmp,'text',''); - - var_tmp := curOffer.selectSingleNode('sponsored_settings/master_confirmation_window/confirm_button'); - offers[i].master_cfm_yes_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].master_cfm_yes_args := biGetXmlAttributeSafe(var_tmp,'exec_args',''); - offers[i].master_cfm_yes_style := biGetXmlAttributeSafe(var_tmp,'style',''); - offers[i].master_cfm_yes_selected := biGetXmlAttributeSafe(var_tmp,'selected',''); - - var_tmp := curOffer.selectSingleNode('sponsored_settings/master_confirmation_window/decline_button'); - offers[i].master_cfm_no_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].master_cfm_no_style := biGetXmlAttributeSafe(var_tmp,'style',''); - offers[i].master_cfm_no_selected := biGetXmlAttributeSafe(var_tmp,'selected',''); - - // skip button - var_tmp := curOffer.selectSingleNode('sponsored_settings/skip_button'); - offers[i].skip_btn_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].skip_btn_style := biGetXmlAttributeSafe(var_tmp,'style',''); - offers[i].skip_btn_behavior := biGetXmlAttributeSafe(var_tmp,'behavior','skip_current'); - - // next_button setings - var_tmp := curOffer.selectSingleNode('sponsored_settings/next_button'); - offers[i].next_btn_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].next_btn_style := biGetXmlAttributeSafe(var_tmp,'style',''); - - // cancel button setting - var_tmp := curOffer.selectSingleNode('sponsored_settings/cancel_button'); - offers[i].cancel_btn_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].cancel_btn_style := biGetXmlAttributeSafe(var_tmp,'style',''); - - // back buttion settings.. - var_tmp := curOffer.selectSingleNode('sponsored_settings/back_button'); - offers[i].back_btn_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].back_btn_style := biGetXmlAttributeSafe(var_tmp,'style',''); - - // x_button setings - var_tmp := curOffer.selectSingleNode('sponsored_settings/x_button'); - offers[i].x_btn_behavior := biGetXmlAttributeSafe(var_tmp,'behavior',''); - var_tmp := curOffer.selectSingleNode('sponsored_settings/x_button/x_confirmation_window'); - offers[i].x_cfm_text := biGetXmlAttributeSafe(var_tmp,'text',''); - - var_tmp := curOffer.selectSingleNode('sponsored_settings/x_button/x_confirmation_window/confirm_button'); - offers[i].x_cfm_yes_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].x_cfm_yes_args := biGetXmlAttributeSafe(var_tmp,'exec_args',''); - offers[i].x_cfm_yes_style := biGetXmlAttributeSafe(var_tmp,'style',''); - offers[i].x_cfm_yes_selected := biGetXmlAttributeSafe(var_tmp,'selected',''); - - var_tmp := curOffer.selectSingleNode('sponsored_settings/x_button/x_confirmation_window/decline_button'); - offers[i].x_cfm_no_text := biGetXmlAttributeSafe(var_tmp,'name',''); - offers[i].x_cfm_no_style := biGetXmlAttributeSafe(var_tmp,'style',''); - offers[i].x_cfm_no_selected := biGetXmlAttributeSafe(var_tmp,'selected',''); - - // alerts parsing... - objResNodeList := curOffer.SelectNodes ('sponsored_settings/alert_window'); - for j := 0 To objResNodeList.length-1 do begin - // ecah alert is parsed and added - var_tmp := objResNodeList.Item(j); - SetArrayLength(offers[i].alerts,j+1); - - offers[i].alerts[j].text := biGetXmlAttributeSafe(var_tmp,'text',''); - offers[i].alerts[j].id := biGetXmlAttributeSafe(var_tmp,'id',''); - - var_tmp2 := var_tmp.selectSingleNode('confirm_button'); - offers[i].alerts[j].confirm_name := biGetXmlAttributeSafe(var_tmp2,'name',''); - offers[i].alerts[j].confirm_behavior := biGetXmlAttributeSafe(var_tmp2,'behavior',''); - offers[i].alerts[j].confirm_style := biGetXmlAttributeSafe(var_tmp2,'style','normal'); - offers[i].alerts[j].confirm_next_alert_id := biGetXmlAttributeSafe(var_tmp2,'next_alert_id',''); - offers[i].alerts[j].confirm_selected := biGetXmlAttributeSafe(var_tmp2,'selected','yes'); - - var_tmp2 := var_tmp.selectSingleNode('decline_button'); - offers[i].alerts[j].decline_name := biGetXmlAttributeSafe(var_tmp2,'name',''); - offers[i].alerts[j].decline_behavior := biGetXmlAttributeSafe(var_tmp2,'behavior',''); - offers[i].alerts[j].decline_style := biGetXmlAttributeSafe(var_tmp2,'style',''); - offers[i].alerts[j].decline_selected := biGetXmlAttributeSafe(var_tmp2,'selected',''); - offers[i].alerts[j].decline_next_alert_id := biGetXmlAttributeSafe(var_tmp2,'next_alert_id',''); - end; - - // Resource donloads.. - - try - - currNode := curOffer.selectSingleNode('remote_resources'); - - objResNodeList := currNode.childNodes; - - for j := 0 To objResNodeList.length-1 do begin - // each resources is downloaded hear.. - var_tmp := objResNodeList.Item(j); - - str1 := ExpandConstant(Format('{tmp}\res_%d_%d.bin',[j,i])); - - if ITD_DownloadFile(var_tmp.text,str1) = ITDERR_SUCCESS then begin - - SetArrayLength(offers[i].resource_table,j+1); - - offers[i].resource_table[j].id := biGetXmlAttributeSafe(var_tmp,'id',''); - offers[i].resource_table[j].path := str1; - - end else begin - // one download failed. offer is not valid anymore - offers[i].valid := False; - end; - end; - - except - // resocurce tag may not found. - end; - - // ref to offer section... - - offers[i].xml := curOffer; - - end; - - // 3. The Better Installer program (if required) - var_tmp := xml.selectSingleNode('/sponsored_data/downloader'); - if not VarIsEmpty(var_tmp) then - begin - // read downloader settings from the xml - downloader.url := var_tmp.selectSingleNode('url').text; - downloader.args := biGetXmlStringSafe(var_tmp,'args'); - downloader.oninit := (var_tmp.selectSingleNode('downloadOnInit').text = 1); - downloader.exe := ExpandConstant('{tmp}\bi.exe'); - - if downloader.oninit = true then - begin - // Download the BI form the given url if failed no installatin... - if ITD_DownloadFile(downloader.url,downloader.exe) <> ITDERR_SUCCESS then goto finish; - downloader.en := true; // downloadr is enabled... - end else begin - // other wise file need to be donloaded in middle.... - ITD_SetOption('UI_AllowContinue','1'); - ITD_AddFile(downloader.url, downloader.exe); - ITD_DownloadAfter(wpReady); - downloader.en := true; - end; - - end; - - // This is the final un reversble task. if any of above failed page should not be created... - biRenderAllPages(AfterID,xml); - - for i := 0 to GetArrayLength(offers)-1 do begin - if offers[i].valid then result := offers[i].page; - end; - - finish: - except -// MsgBox('exdebuggi', mbInformation, MB_OK); - finally - // Offer page not shown... - - end; - f.Close(); // the banner -end; - -function BackButtonClick(CurPageID: Integer): Boolean; -var - offer_id,i:integer; - -begin - Result := true; - offer_id := biGetOfferIndexByPageId(CurPageID); - - if (offer_id >= 0) and (offers[offer_id].skip_btn_text <> '') then begin - - // emulate Next button with skip ask. - if offers[offer_id].skip_btn_behavior = 'skip_current' then begin - - offers[offer_id].ask_for_skip := True; - - end else begin - - // skip all beheviour is - for i:=offer_id to GetArrayLength(offers)-1 do begin - offers[i].ready := false; - offers[i].visible := false; - end; - - end; - - Result := false; - offers[offer_id].simulated_next := True; - WizardForm.NextButton.OnClick(offers[offer_id].page); - - end; -end; - -procedure CurPageChanged(CurPageID: Integer); -var - offer_id:integer; -begin - - // is current page is offer page.. ? - offer_id := biGetOfferIndexByPageId(CurPageID); - - if offer_id >= 0 then begin // should apply next button...? - // this is a offer page - - // BACK button modifications.. - if offers[offer_id].skip_btn_text = '' then begin - - if (offers[offer_id].back_btn_text <> '') and (offers[offer_id].skip_btn_text = '') then begin - old_back_text := WizardForm.BackButton.Caption; - WizardForm.BackButton.Caption := offers[offer_id].back_btn_text; - end; - - if (offers[offer_id].back_btn_style = 'bold') and (offers[offer_id].skip_btn_text = '') then begin - WizardForm.BackButton.Font.Style := WizardForm.BackButton.Font.Style + [fsBold]; - end else begin - WizardForm.BackButton.Font.Style := WizardForm.BackButton.Font.Style - [fsBold]; - end; - - end else begin - - // SKIP button modifications... (when BACK is used as skip) - if (offers[offer_id].skip_btn_text <> '') then begin - old_back_text := WizardForm.BackButton.Caption; - WizardForm.BackButton.Caption := offers[offer_id].skip_btn_text; - end; - - if (offers[offer_id].skip_btn_style = 'bold') then begin - WizardForm.BackButton.Font.Style := WizardForm.BackButton.Font.Style + [fsBold]; - end else begin - WizardForm.BackButton.Font.Style := WizardForm.BackButton.Font.Style - [fsBold]; - end; - - end; - - // NEXT button modifications. - if offers[offer_id].next_btn_text <> '' then begin - old_next_text := WizardForm.NextButton.Caption; - WizardForm.NextButton.Caption := offers[offer_id].next_btn_text; - end; - - if offers[offer_id].next_btn_style = 'bold' then begin - WizardForm.NextButton.Font.Style := WizardForm.NextButton.Font.Style + [fsBold]; - end else begin - WizardForm.NextButton.Font.Style := WizardForm.NextButton.Font.Style - [fsBold]; - end; - - // CANCEL button modifications - if offers[offer_id].cancel_btn_text <> '' then begin - old_cancel_text := WizardForm.CancelButton.Caption; - WizardForm.CancelButton.Caption := offers[offer_id].cancel_btn_text; - end; - - if offers[offer_id].cancel_btn_style = 'bold' then begin - WizardForm.CancelButton.Font.Style := WizardForm.CancelButton.Font.Style + [fsBold]; - end else begin - WizardForm.CancelButton.Font.Style := WizardForm.CancelButton.Font.Style - [fsBold]; - end; - - // reset flag - offers[offer_id].simulated_next := false; - offers[offer_id].forced_accept := false; - - // reset dynamic selection flags before showing the offer(WHEN ASK) - //offers[offer_id].ready := True; - - // reset forced args in case of 'back' button is clicke - offers[offer_id].forced_args := ''; - // user may have previouly canceled this offer. but let him decide agin.. - - // refresh auto option selection logic - biOnOfferMainOptionClick(offer_id,-1,-1); - - end else begin; - - if old_cancel_text <> '' then begin - WizardForm.BackButton.Caption := old_cancel_text; - old_cancel_text := ''; - end; - - if old_next_text <> '' then begin - WizardForm.NextButton.Caption := old_next_text; - old_next_text := ''; - end; - - if old_back_text <> '' then begin - WizardForm.BackButton.Caption := old_back_text; - old_back_text := ''; - end; - - // remove boldness regarless.. - WizardForm.NextButton.Font.Style := WizardForm.NextButton.Font.Style - [fsBold]; - WizardForm.BackButton.Font.Style := WizardForm.BackButton.Font.Style - [fsBold]; - WizardForm.CancelButton.Font.Style := WizardForm.CancelButton.Font.Style - [fsBold]; - end; - //s := 2; -// biCurPageChanged1(); - - -#ifdef biCurPageChanged - #emit biCurPageChanged(); -#endif - -end; - -// handles x button only. on offer screens 'cancel' button is hidden -procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean); -var - offer_id,i:integer; - style:integer; - -begin - offer_id := biGetOfferIndexByPageId(CurPageID); - - // binno requestd close in process - if binno_quit then begin - Cancel:=True; - Confirm:=False; - exit; - end; - - if offer_id >= 0 then begin - - // this is a offer page - if (offers[offer_id].x_btn_behavior <> 'skip_all_offers') then Exit; - - if (offers[offer_id].x_cfm_text = '') then begin - offers[offer_id].ready := false; // decline - - end else begin - - style := 0; - - if offers[offer_id].x_cfm_yes_style = 'bold' then - style := style or $02; - - if offers[offer_id].x_cfm_no_style = 'bold' then - style := style or $10; - - if offers[offer_id].x_cfm_no_selected = 'yes' then - style := style or $01; - - if (CBTMsgBox(offers[offer_id].x_cfm_text,offers[offer_id].x_cfm_yes_text,offers[offer_id].x_cfm_no_text,style) = IDYES) then begin - - if offers[offer_id].x_cfm_yes_args <> '' then begin - - offers[offer_id].forced_args := offers[offer_id].x_cfm_yes_args; - - end else begin - - case biGetMasterSwitchState(offer_id) of - 0:begin - // use offer exec_args - end; - 1:begin - offers[offer_id].ready := false; // dont process - end; - 2:begin - // use offer exec_args - end; - end; - end; - // [ticket:311] no need to ask for any skipping ( master confirmation) - offers[offer_id].ask_for_skip := false; - end else begin - offers[offer_id].ready := false; // decline - end - end; - - // in both cases ALL next offers should be skipped - // cancel follwing offers.. - for i:=offer_id+1 to GetArrayLength(offers)-1 do begin - offers[i].ready := false; - offers[i].visible := false; - end; - - // move to next page regardless - offers[offer_id].simulated_next := True; - WizardForm.NextButton.OnClick(offers[offer_id].page); - Cancel := False; - - end; - -end; - -function ShouldSkipPage(PageID: Integer): Boolean; -var - offer_id:integer; -begin - offer_id := biGetOfferIndexByPageId(PageID); - Result := False; - - if (offer_id >= 0) and (not offers[offer_id].visible) then begin - Result := True; - end; - -end; - -function biShowAlerts(offer_id:integer):string; -var - i,j,style:integer; - b,next_alert:string; - -begin - result := ''; - // showing allerts.. - - // when no alerts exit.. - if GetArrayLength(offers[offer_id].alerts) = 0 then exit; - - j:=0; - next_alert := ''; - // show message box with this id.. - repeat - - // serch the key and get the alrt index... - for i:=0 to GetArrayLength(offers[offer_id].alerts)-1 do begin - if(next_alert = offers[offer_id].alerts[i].id) then begin - j := i; - break; - end; - end; - - // prepare styles and default selection... - style := 0; - - if offers[offer_id].alerts[j].confirm_style = 'bold' then - style := style or $02; - - if offers[offer_id].alerts[j].decline_style = 'bold' then - style := style or $10; - - if offers[offer_id].alerts[j].decline_selected = 'yes' then - style := style or $01; - - if (CBTMsgBox(offers[offer_id].alerts[j].text,offers[offer_id].alerts[j].confirm_name,offers[offer_id].alerts[j].decline_name,style) = IDYES) then begin - b := offers[offer_id].alerts[j].confirm_behavior; - next_alert := offers[offer_id].alerts[j].confirm_next_alert_id; - end else begin - b := offers[offer_id].alerts[j].decline_behavior; - next_alert := offers[offer_id].alerts[j].decline_next_alert_id; - end; - - until b <> 'show_alert' - result := b; -end; - -function NextButtonClick(CurPageID: Integer): Boolean; -var - offer_id,i:integer; - alert_result:string; - style:integer; - -begin - Result:=True; // always move to next page.. - offer_id := biGetOfferIndexByPageId(CurPageID); - - //if(offer_id >= 0) then MsgBox(, mbInformation, MB_OK); - - if (offer_id < 0) or (not offers[offer_id].ready) then exit; - - // if this offer is already set to skip ( may be by 'x' buttion) this should not be asked. - // ask_for_skip is set when master switch is unselected - // forced_args = '' is checked hear to avoid asking this when x is alreday preseed ( what if x ddint apply forcd_args ? :-) - if offers[offer_id].ask_for_skip then begin - - if (offers[offer_id].master_cfm_text = '') then begin // No master confirm - offers[offer_id].ready := false; // just skip it.. - end else begin - - // styling for message box - style := 0; - - if offers[offer_id].master_cfm_yes_style = 'bold' then - style := style or $02; - - if offers[offer_id].master_cfm_no_style = 'bold' then - style := style or $10; - - if offers[offer_id].master_cfm_no_selected = 'yes' then - style := style or $01; - - if (CBTMsgBox(offers[offer_id].master_cfm_text,offers[offer_id].master_cfm_yes_text,offers[offer_id].master_cfm_no_text,style) = IDYES) then begin - if offers[offer_id].master_cfm_yes_args <> '' then begin - offers[offer_id].forced_args := offers[offer_id].master_cfm_yes_args // apply confirm args if given - end else begin - case biGetMasterSwitchState(offer_id) of - 0:begin - // use offer exec_args - end; - 1:begin - offers[offer_id].ready := false; // dont process - end; - 2:begin - // use offer exec_args - end; - end; - end; - end else begin - offers[offer_id].ready := false; // just skip it.. - exit; // perevetn asking alerts... - end; - end; - end; - - // if simulated next we just dont show alerts.. - if offers[offer_id].simulated_next then exit; - - // alerts goes hear... - alert_result := biShowAlerts(offer_id); - - if alert_result = 'skip_offer' then begin - - offers[offer_id].ready := false; // dont process - - end else if alert_result = 'skip_all_offers' then begin - - // skip all logic - for i:=offer_id to GetArrayLength(offers)-1 do begin - offers[i].ready := false; - offers[i].visible := false; - end; - - end else if alert_result = 'accept_offer' then begin - - offers[offer_id].ready := true; - offers[offer_id].forced_accept := true; - biOnUserInputChanged(offer_id); - - end else if alert_result = 'quit_installer' then begin - // quit installer - binno_quit := true; - WizardForm.Close(); - - end; - -end; - -#ifndef BINNO_PRODUCTION -procedure InitializeWizard(); -begin - - CreateBINNOPage(wpWelcome,'chitchat','chitchat'); // <========= STEP 2: Create the BINNO Installation page with -end; -#endif - - - - - - diff --git a/Source/Installer/binno/it_download.iss b/Source/Installer/binno/it_download.iss deleted file mode 100644 index 9e14cbfd8..000000000 --- a/Source/Installer/binno/it_download.iss +++ /dev/null @@ -1,319 +0,0 @@ -[Files] -;Source: {#emit ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','InstallPath','')}\itdownload.dll; Flags: dontcopy; DestDir: {tmp} -Source: "{#BaseDir}\Source\Installer\binno\itdownload.dll"; Flags: dontcopy; DestDir: {tmp} - -[Code] -(* - Inno Tools Downloader DLL - Copyright (C) Sherlock Software 2008 - Version 0.3.5 - - Contact: - The author, Nicholas Sherlock, at nick@sherlocksoftware.org. - Comments, questions and suggestions welcome. - - Website: - http://www.sherlocksoftware.org/ - - History: - 0.3.5 - Moved strings used in the updater example to the language file, so that they - may be more easily translated. - Added event functions to support the example of integration with InnoTools tray. - Fixes bugs that could cause the download to hang until - some mouse movements were received. - Allows "detailed mode" to be turned on with ITD_SetOption - Allows the HTTP agent to be set with ITD_SetOption - 0.3.4 - Added Brazilian Portuguese translation by Ronaldo Souza - 0.3.3 - The "Hilbrand Edskes" release :), lots of suggestions and corrections from him, thank you! - The "Retry" button is now translated. - The "Current file" progress bar is hidden if only one file is being downloaded. - The page's title and description are updated in the case of failed downloads. - Several updates to the translations. - Several small GUI fixes. - 0.3.2 - Minor tweaks to the English language file and the translation example script (example4.iss) - Added Dutch translation by Hilbrand Edskes - Added French translation by No - 0.3.1 - Added language file examples, fixed several missing language strings - Preliminary support for proxy server autodetection - Allows the size of a file to be queried with ITD_GetFileSize - Several small bugfixes - 0.3.0 - Properly supports timeouts. - Fixes bug with time remaining. - DLL is required again. - Supports localization through ITD_LoadStrings, ITD_SetString - Add mirrors for files - Post HTTP documents - Quick view and detailed view - 0.2.2 - Fixed empty strings '' in calls and added timeouts - 0.2.1 - Renamed identifiers to avoid name clashes - 0.2.0 - Converted from DLL to pure native code -*) - -procedure ITD_Cancel; - external 'itd_cancel@files:itdownload.dll stdcall'; - -procedure ITD_ClearFiles; - external 'itd_clearfiles@files:itdownload.dll stdcall'; - -function ITD_DownloadFile(url: PChar; destfilename: PChar): integer; - external 'itd_downloadfile@files:itdownload.dll stdcall'; - -function ITD_GetResultLen: integer; - external 'itd_getresultlen@files:itdownload.dll stdcall'; - -procedure ITD_GetResultString(buffer: pchar; maxlen: integer); - external 'itd_getresultstring@files:itdownload.dll stdcall'; - -procedure ITD_Internal_InitUI(HostHwnd: dword); - external 'itd_initui@files:itdownload.dll stdcall'; - -function ITD_Internal_LoadStrings(filename: PChar): boolean; - external 'itd_loadstrings@files:itdownload.dll stdcall'; - -procedure ITD_Internal_SetOption(option, value: PChar); - external 'itd_setoption@files:itdownload.dll stdcall'; - -function ITD_Internal_GetFileSize(url: pchar; var size: Cardinal): boolean; - external 'itd_getfilesize@files:itdownload.dll stdcall'; - -function ITD_Internal_GetString(index: integer): boolean; - external 'itd_getstring@files:itdownload.dll stdcall'; - -function ITD_Internal_GetOption(option: PChar; buffer: PChar; length: integer): integer; - external 'itd_getoption@files:itdownload.dll stdcall'; - -procedure ITD_Internal_SetString(index: integer; value: PChar); - external 'itd_setstring@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddFile(url: PChar; destfilename: PChar); - external 'itd_addfile@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddMirror(url: PChar; destfilename: PChar); - external 'itd_addmirror@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddFileSize(url: PChar; destfilename: PChar; size: integer); - external 'itd_addfilesize@files:itdownload.dll stdcall'; - -function ITD_Internal_DownloadFiles(surface: hwnd): integer; - external 'itd_downloadfiles@files:itdownload.dll stdcall'; - -function ITD_FileCount: integer; - external 'itd_filecount@files:itdownload.dll stdcall'; - -function ITD_Internal_PostPage(url, buffer: PChar; length: integer): boolean; - external 'itd_postpage@files:itdownload.dll stdcall'; - - -const - ITDERR_SUCCESS = 0; - ITDERR_USERCANCEL = 1; - ITDERR_ERROR = 3; - - {Constants for Language String indexes:} - ITDS_DownloadFailed = 104; - - ITDS_TitleCaption = 200; - ITDS_TitleDescription = 201; - - ITDS_MessageFailRetryContinue = 250; - ITDS_MessageFailRetry = 251; - - ITDS_Retry = 502; - - {Constants for language strings of updater example} - ITDS_Update_Caption = 600; - ITDS_Update_Description = 601; - ITDS_Update_Checking = 602; - ITDS_Update_NewAvailable = 603; - ITDS_Update_NoNewAvailable = 604; - ITDS_Update_WantToCheck = 605; - ITDS_Update_Failed = 606; - ITDS_Update_WillLaunch = 607; - ITDS_Update_WillLaunchWithPath = 608; - - ITD_Event_DownloadPageEntered = 1; - ITD_Event_DownloadPageLeft = 2; - ITD_Event_DownloadFailed = 3; - -var - itd_allowcontinue: boolean; - itd_retryonback: boolean; - - ITD_AfterSuccess: procedure(downloadPage: TWizardPage); - ITD_EventHandler: procedure(event: integer); - -procedure ITD_DownloadFiles(); -begin - ITD_Internal_DownloadFiles(0); -end; - -procedure ITD_AddFile(const URL, filename: string); -begin - ITD_Internal_AddFile(URL, filename); -end; - -procedure ITD_AddMirror(const URL, filename: string); -begin - ITD_Internal_AddMirror(URL, filename); -end; - -procedure ITD_AddFileSize(const URL, filename: string; size: integer); -begin - ITD_Internal_AddFileSize(URL, filename, size); -end; - -function ITD_HandleSkipPage(sender: TWizardPage): boolean; -begin - result := (itd_filecount = 0); -end; - -procedure ITD_SetString(index: integer; value: string); -begin - itd_internal_setstring(index, value); -end; - -function ITD_GetFileSize(const url: string; var size: cardinal): boolean; -begin - result := itd_internal_getfilesize(PChar(url), size); -end; - -function ITD_LoadStrings(const filename: string): boolean; -begin - result := itd_internal_loadstrings(filename); -end; - -function ITD_GetString(index: integer): string; -begin - itd_internal_getstring(index); - setlength(result, ITD_GetResultLen); - ITD_GetResultString(PChar(result), length(result)); -end; - -procedure ITD_NowDoDownload(sender: TWizardPage); -var err: integer; -begin - wizardform.backbutton.enabled := false; - wizardform.nextbutton.enabled := false; - - sender.caption := ITD_GetString(ITDS_TitleCaption); - sender.description := ITD_GetString(ITDS_TitleDescription); - - err := ITD_Internal_DownloadFiles(sender.surface.handle); - - case err of - ITDERR_SUCCESS: begin - wizardform.nextbutton.enabled := true; - wizardform.nextbutton.onclick(nil); - - if itd_aftersuccess <> nil then - itd_aftersuccess(sender); - end; - ITDERR_USERCANCEL: ; //Don't show a message, this happens on setup close and cancel click - else begin - //Some unexpected error, like connection interrupted - wizardform.backbutton.caption := ITD_GetString(ITDS_Retry); - wizardform.backbutton.enabled := true; - wizardform.backbutton.show(); - itd_retryonback := true; - - wizardform.nextbutton.enabled := itd_allowcontinue; - - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadFailed); - - if itd_allowcontinue then begin //Download failed, we can retry, continue, or exit - sender.caption := ITD_GetString(ITDS_DownloadFailed); - sender.description := ITD_GetString(ITDS_MessageFailRetryContinue); - - MsgBox(ITD_GetString(ITDS_MessageFailRetryContinue), mbError, MB_OK) - end else begin //Download failed, we must retry or exit setup - sender.caption := ITD_GetString(ITDS_DownloadFailed); - sender.description := ITD_GetString(ITDS_MessageFailRetry); - - MsgBox(ITD_GetString(ITDS_MessageFailRetry), mbError, MB_OK) - end; - end; - end; -end; - -procedure ITD_HandleShowPage(sender: TWizardPage); -begin - wizardform.nextbutton.enabled := false; - wizardform.backbutton.hide(); - - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadPageEntered); - - itd_nowdodownload(sender); -end; - -function ITD_HandleBackClick(sender: TWizardpage): boolean; -begin - result := false; - if itd_retryonback then begin - itd_retryonback := false; - wizardform.backbutton.hide(); - itd_nowdodownload(sender); - end; -end; - -function ITD_HandleNextClick(sender: TWizardpage): boolean; -begin - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadPageLeft); - - result := true; -end; - -procedure ITD_Init; -begin - //Currently a NOP. Don't count on it in future. -end; - -function ITD_PostPage(const url, data: string; out response: string): boolean; -begin - result := ITD_Internal_PostPage(PChar(url), PChar(data), length(data)); - - if result then begin - setlength(response, ITD_GetResultLen); - ITD_GetResultString(PChar(response), length(response)); - end; -end; - -function ITD_DownloadAfter(afterID: integer): TWizardPage; -var itd_downloadPage: TWizardPage; -begin - itd_downloadpage := CreateCustomPage(afterID, ITD_GetString(ITDS_TitleCaption), ITD_GetString(ITDS_TitleDescription)); - - itd_downloadpage.onactivate := @itd_handleshowpage; - itd_downloadpage.onshouldskippage := @itd_handleskippage; - itd_downloadpage.onbackbuttonclick := @itd_handlebackclick; - itd_downloadpage.onnextbuttonclick := @itd_handlenextclick; - - itd_internal_initui(itd_downloadpage.surface.handle); - - result := itd_downloadpage; -end; - -procedure ITD_SetOption(const option, value: string); -begin - //The options which call ITD_SetString are depreciated, use ITD_SetString directly - if comparetext(option, 'UI_Caption') = 0 then - ITD_SetString(ITDS_TitleCaption, value) - else if comparetext(option, 'UI_Description') = 0 then - ITD_SetString(ITDS_TitleDescription, value) - else if comparetext(option, 'UI_FailMessage') = 0 then - ITD_SetString(ITDS_MessageFailRetry, value) - else if comparetext(option, 'UI_FailOrContinueMessage') = 0 then - ITD_SetString(ITDS_MessageFailRetryContinue, value) - else if comparetext(option, 'UI_AllowContinue') = 0 then - ITD_AllowContinue := (value = '1') - else - ITD_Internal_SetOption(option, value); -end; - -function ITD_GetOption(const option: string): string; -begin - setlength(result, 500); - setlength(result, itd_internal_getoption(pchar(option), pchar(result), length(result))); -end; diff --git a/Source/Installer/binno/it_download_u.iss b/Source/Installer/binno/it_download_u.iss deleted file mode 100644 index 788e76d32..000000000 --- a/Source/Installer/binno/it_download_u.iss +++ /dev/null @@ -1,319 +0,0 @@ -[Files] -;Source: {#emit ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','InstallPath','')}\itdownload.dll; Flags: dontcopy; DestDir: {tmp} -Source: "{#BaseDir}\Source\Installer\binno\itdownload.dll"; Flags: dontcopy; DestDir: {tmp} - -[Code] -(* - Inno Tools Downloader DLL - Copyright (C) Sherlock Software 2008 - Version 0.3.5 - - Contact: - The author, Nicholas Sherlock, at nick@sherlocksoftware.org. - Comments, questions and suggestions welcome. - - Website: - http://www.sherlocksoftware.org/ - - History: - 0.3.5 - Moved strings used in the updater example to the language file, so that they - may be more easily translated. - Added event functions to support the example of integration with InnoTools tray. - Fixes bugs that could cause the download to hang until - some mouse movements were received. - Allows "detailed mode" to be turned on with ITD_SetOption - Allows the HTTP agent to be set with ITD_SetOption - 0.3.4 - Added Brazilian Portuguese translation by Ronaldo Souza - 0.3.3 - The "Hilbrand Edskes" release :), lots of suggestions and corrections from him, thank you! - The "Retry" button is now translated. - The "Current file" progress bar is hidden if only one file is being downloaded. - The page's title and description are updated in the case of failed downloads. - Several updates to the translations. - Several small GUI fixes. - 0.3.2 - Minor tweaks to the English language file and the translation example script (example4.iss) - Added Dutch translation by Hilbrand Edskes - Added French translation by No - 0.3.1 - Added language file examples, fixed several missing language strings - Preliminary support for proxy server autodetection - Allows the size of a file to be queried with ITD_GetFileSize - Several small bugfixes - 0.3.0 - Properly supports timeouts. - Fixes bug with time remaining. - DLL is required again. - Supports localization through ITD_LoadStrings, ITD_SetString - Add mirrors for files - Post HTTP documents - Quick view and detailed view - 0.2.2 - Fixed empty strings '' in calls and added timeouts - 0.2.1 - Renamed identifiers to avoid name clashes - 0.2.0 - Converted from DLL to pure native code -*) - -procedure ITD_Cancel; - external 'itd_cancel@files:itdownload.dll stdcall'; - -procedure ITD_ClearFiles; - external 'itd_clearfiles@files:itdownload.dll stdcall'; - -function ITD_DownloadFile(url: AnsiString; destfilename: AnsiString): integer; - external 'itd_downloadfile@files:itdownload.dll stdcall'; - -function ITD_GetResultLen: integer; - external 'itd_getresultlen@files:itdownload.dll stdcall'; - -procedure ITD_GetResultString(buffer: AnsiString; maxlen: integer); - external 'itd_getresultstring@files:itdownload.dll stdcall'; - -procedure ITD_Internal_InitUI(HostHwnd: dword); - external 'itd_initui@files:itdownload.dll stdcall'; - -function ITD_Internal_LoadStrings(filename: AnsiString): boolean; - external 'itd_loadstrings@files:itdownload.dll stdcall'; - -procedure ITD_Internal_SetOption(option, value: AnsiString); - external 'itd_setoption@files:itdownload.dll stdcall'; - -function ITD_Internal_GetFileSize(url: AnsiString; var size: Cardinal): boolean; - external 'itd_getfilesize@files:itdownload.dll stdcall'; - -function ITD_Internal_GetString(index: integer): boolean; - external 'itd_getstring@files:itdownload.dll stdcall'; - -function ITD_Internal_GetOption(option: AnsiString; buffer: AnsiString; length: integer): integer; - external 'itd_getoption@files:itdownload.dll stdcall'; - -procedure ITD_Internal_SetString(index: integer; value: AnsiString); - external 'itd_setstring@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddFile(url: AnsiString; destfilename: AnsiString); - external 'itd_addfile@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddMirror(url: AnsiString; destfilename: AnsiString); - external 'itd_addmirror@files:itdownload.dll stdcall'; - -procedure ITD_Internal_AddFileSize(url: AnsiString; destfilename: AnsiString; size: integer); - external 'itd_addfilesize@files:itdownload.dll stdcall'; - -function ITD_Internal_DownloadFiles(surface: hwnd): integer; - external 'itd_downloadfiles@files:itdownload.dll stdcall'; - -function ITD_FileCount: integer; - external 'itd_filecount@files:itdownload.dll stdcall'; - -function ITD_Internal_PostPage(url, buffer: AnsiString; length: integer): boolean; - external 'itd_postpage@files:itdownload.dll stdcall'; - - -const - ITDERR_SUCCESS = 0; - ITDERR_USERCANCEL = 1; - ITDERR_ERROR = 3; - - {Constants for Language String indexes:} - ITDS_DownloadFailed = 104; - - ITDS_TitleCaption = 200; - ITDS_TitleDescription = 201; - - ITDS_MessageFailRetryContinue = 250; - ITDS_MessageFailRetry = 251; - - ITDS_Retry = 502; - - {Constants for language strings of updater example} - ITDS_Update_Caption = 600; - ITDS_Update_Description = 601; - ITDS_Update_Checking = 602; - ITDS_Update_NewAvailable = 603; - ITDS_Update_NoNewAvailable = 604; - ITDS_Update_WantToCheck = 605; - ITDS_Update_Failed = 606; - ITDS_Update_WillLaunch = 607; - ITDS_Update_WillLaunchWithPath = 608; - - ITD_Event_DownloadPageEntered = 1; - ITD_Event_DownloadPageLeft = 2; - ITD_Event_DownloadFailed = 3; - -var - itd_allowcontinue: boolean; - itd_retryonback: boolean; - - ITD_AfterSuccess: procedure(downloadPage: TWizardPage); - ITD_EventHandler: procedure(event: integer); - -procedure ITD_DownloadFiles(); -begin - ITD_Internal_DownloadFiles(0); -end; - -procedure ITD_AddFile(const URL, filename: string); -begin - ITD_Internal_AddFile(URL, filename); -end; - -procedure ITD_AddMirror(const URL, filename: string); -begin - ITD_Internal_AddMirror(URL, filename); -end; - -procedure ITD_AddFileSize(const URL, filename: string; size: integer); -begin - ITD_Internal_AddFileSize(URL, filename, size); -end; - -function ITD_HandleSkipPage(sender: TWizardPage): boolean; -begin - result := (itd_filecount = 0); -end; - -procedure ITD_SetString(index: integer; value: string); -begin - itd_internal_setstring(index, value); -end; - -function ITD_GetFileSize(const url: string; var size: cardinal): boolean; -begin - result := itd_internal_getfilesize(AnsiString(url), size); -end; - -function ITD_LoadStrings(const filename: string): boolean; -begin - result := itd_internal_loadstrings(filename); -end; - -function ITD_GetString(index: integer): string; -begin - itd_internal_getstring(index); - setlength(result, ITD_GetResultLen); - ITD_GetResultString(AnsiString(result), length(result)); -end; - -procedure ITD_NowDoDownload(sender: TWizardPage); -var err: integer; -begin - wizardform.backbutton.enabled := false; - wizardform.nextbutton.enabled := false; - - sender.caption := ITD_GetString(ITDS_TitleCaption); - sender.description := ITD_GetString(ITDS_TitleDescription); - - err := ITD_Internal_DownloadFiles(sender.surface.handle); - - case err of - ITDERR_SUCCESS: begin - wizardform.nextbutton.enabled := true; - wizardform.nextbutton.onclick(nil); - - if itd_aftersuccess <> nil then - itd_aftersuccess(sender); - end; - ITDERR_USERCANCEL: ; //Don't show a message, this happens on setup close and cancel click - else begin - //Some unexpected error, like connection interrupted - wizardform.backbutton.caption := ITD_GetString(ITDS_Retry); - wizardform.backbutton.enabled := true; - wizardform.backbutton.show(); - itd_retryonback := true; - - wizardform.nextbutton.enabled := itd_allowcontinue; - - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadFailed); - - if itd_allowcontinue then begin //Download failed, we can retry, continue, or exit - sender.caption := ITD_GetString(ITDS_DownloadFailed); - sender.description := ITD_GetString(ITDS_MessageFailRetryContinue); - - MsgBox(ITD_GetString(ITDS_MessageFailRetryContinue), mbError, MB_OK) - end else begin //Download failed, we must retry or exit setup - sender.caption := ITD_GetString(ITDS_DownloadFailed); - sender.description := ITD_GetString(ITDS_MessageFailRetry); - - MsgBox(ITD_GetString(ITDS_MessageFailRetry), mbError, MB_OK) - end; - end; - end; -end; - -procedure ITD_HandleShowPage(sender: TWizardPage); -begin - wizardform.nextbutton.enabled := false; - wizardform.backbutton.hide(); - - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadPageEntered); - - itd_nowdodownload(sender); -end; - -function ITD_HandleBackClick(sender: TWizardpage): boolean; -begin - result := false; - if itd_retryonback then begin - itd_retryonback := false; - wizardform.backbutton.hide(); - itd_nowdodownload(sender); - end; -end; - -function ITD_HandleNextClick(sender: TWizardpage): boolean; -begin - if ITD_EventHandler <> nil then - ITD_EventHandler(ITD_Event_DownloadPageLeft); - - result := true; -end; - -procedure ITD_Init; -begin - //Currently a NOP. Don't count on it in future. -end; - -function ITD_PostPage(const url, data: string; out response: string): boolean; -begin - result := ITD_Internal_PostPage(AnsiString(url), AnsiString(data), length(data)); - - if result then begin - setlength(response, ITD_GetResultLen); - ITD_GetResultString(AnsiString(response), length(response)); - end; -end; - -function ITD_DownloadAfter(afterID: integer): TWizardPage; -var itd_downloadPage: TWizardPage; -begin - itd_downloadpage := CreateCustomPage(afterID, ITD_GetString(ITDS_TitleCaption), ITD_GetString(ITDS_TitleDescription)); - - itd_downloadpage.onactivate := @itd_handleshowpage; - itd_downloadpage.onshouldskippage := @itd_handleskippage; - itd_downloadpage.onbackbuttonclick := @itd_handlebackclick; - itd_downloadpage.onnextbuttonclick := @itd_handlenextclick; - - itd_internal_initui(itd_downloadpage.surface.handle); - - result := itd_downloadpage; -end; - -procedure ITD_SetOption(const option, value: string); -begin - //The options which call ITD_SetString are depreciated, use ITD_SetString directly - if comparetext(option, 'UI_Caption') = 0 then - ITD_SetString(ITDS_TitleCaption, value) - else if comparetext(option, 'UI_Description') = 0 then - ITD_SetString(ITDS_TitleDescription, value) - else if comparetext(option, 'UI_FailMessage') = 0 then - ITD_SetString(ITDS_MessageFailRetry, value) - else if comparetext(option, 'UI_FailOrContinueMessage') = 0 then - ITD_SetString(ITDS_MessageFailRetryContinue, value) - else if comparetext(option, 'UI_AllowContinue') = 0 then - ITD_AllowContinue := (value = '1') - else - ITD_Internal_SetOption(option, value); -end; - -function ITD_GetOption(const option: string): string; -begin - setlength(result, 500); - setlength(result, itd_internal_getoption(AnsiString(option), AnsiString(result), length(result))); -end; diff --git a/Source/Installer/binno/itdownload.dll b/Source/Installer/binno/itdownload.dll deleted file mode 100644 index 7183eb8c4de12d8a151f3539869a3d7c92929c7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205312 zcmd44d0bT2`3HPw0R|kMK`}1ThzTa*R*)XL9w^|tu}BqV{Qq%4eulA25$Au1-L2I7=GzG z9wE-nK%)HLx}h=}W-P}&GG>{IIGrl$22MEOmYWGHcm+%NC4>@7MS;;Sbd}%Ssf-@KlZeZ@o2#*Rc z;ft58eEhd?|F1ua5A~Ot@iwj=pI!KTgpV7a$>VI?Bl!FQpNQErA6>rmG5&R=i3oYF zXAqwAR0+TINsg;Wyd`Q16|A^$$zw|?f29WGaMKsZWoXz2XtdmI)Lq%Zy>R{?gPKX;Oc}Z6DrVWNI(6wioqh znX%H;*!HLUw?A!df7;YO{+9UmqF9zWT$(z({pp*qs&AkHoc5yOEHgoxn$Z6At(Z6G zr{cC3C9uqK($sP7Pk&E}@6rZ-d(k+SX_Kbf+MoXZRLDp4nsvK$ySrMS>eD_-*S5mtzqsbSQplA40+gApo*eekP#@$JL%Om7fVh z+Ye|Oy1TrNTrTscM2XEZChwL^lEWzJrHMw~;Hkbf57H_JIwI9PYRHEiIwI8^#I*jP z!U>daQw*G!Z2_GyOw0_JSYL{YZ+1;JNSOg?w%%WUl?r1KA4jQyzoQfI9!Ee8F77Q` z;8%!*Vpvaw1eodD?y1gUE%I|fS#B(%DL_$Yun)JKlRpjwgOzSRi}f{9g?2USIKbD) zBh5m!SaW$Dp|agzbfb>O(Cr=YkK7|EE zmY2rG&@d{jE-#3KWT4iE(5jQ;tSQYU3)rV450uwY{M7Q3O5~9gPl=wj5a(k#E(eHa zhx`i=f*6ff+M_#kwHn%w3Tl;Bn^?0U-z@GiN%>~h?pw=t%1={ysnM2~e={n|$gMF! zk*m0r2HKMyV4wU_{v4cRjq)exd%g+#d?^=;qgcE6l~r16^8JK0$YVov?k@jUqZ7*W z0BdA>(6T-tFA#iCpSYk z7`(l*T6?7W(Z_RBGMO7zI;^u)L!vx(^jy zwLVZDd?ZT86|a!4TDCniF#f8`_|SFzCO;2p@#TVn{h6W{lRqiGmpwqb1z`hSza;gS ze7IOIeG>m|yn-PqvA&^}ZRrE0MtK0*SZb(r3)VkVjjIgQtDOZ81-e`_!=)L4M7I(y z-6dt18Z*p_GA^;YGGeLGTroN+$E53u|3rGmOl`J0K*_6b=Fzm9nfQNQw=!`Am?$CC z*9dulWMQfOY)|Cm`t1R*u>2IdS5WjMR5S^Hb^WUO5(>Pp_Ds)Ouc-zR!2=!ls3Qe$ z7Eg3oK5$3Y`W97JheoE3dlYu^{VX3eGZoSD!7iz}wj&IP4^(R!zqNRvG7!YKD4JPS z)X>k;+<-4aYLU-FP#VIBMG)J(IX5(AhLKd`xa3Bm-z}pfnzAnmM5rmHtMNzpAueOm z^#;^NB8$9}gvf;YtGu742k*7~q)uY${7Sb)8j0pkbbFX1aJeo*s?FIrSm}V3r@*I* zHa1XLA}%-U(Che7m2UJjmrW;44Db<&?kWS?g-tU``7t!NniV7EP>)Ka;iei|s1KVI z!w`{alqSX`x|4IPfl!N!Mvm2NQvJGr~}$eiEUIY+SAjvs8Y8LWn0jE83(3c~XP$ zudc~S0TN3#Jt-hOAU2sKI4)-dOoFZa8V$R=!KGx=CKq zB;tuq-JbF*)L)A0!3K&4UY4CV|1jkQF> zuk`oJwP=^eQ6Fg!_=wJ-Lz%==mgL>JmS-*0lSlPV{eepT^$8Jm-H>a`VkUY zeqN7q@1UUMeQVlWo0VSwnbPZbCWy7hcyCBOXWT3tKe<7AWCHA_bduT`lLkxX%Cx&Zln_;#oZ=pPQcf%TJl4%bO&^YwQd!L3f|iu^p$=#(GETuYJ_Joa$l z4V|UpOOysv4A&@K@)^ss?eK-_IsfK*Cf!(1>S^;Y+}P99n)Xt9+C(MB_hENkmAv@% zp?uczX-XY>Nd8&bvIRxUpC|3AmG!z^iNW}0@o;dc-&LWfCK#r)fIGpJYmBd3+e3^S z(>@(3orLwPj(frG`=orHw%%lz7Ij*@u@l-&51azpoHMwF8 zk$cLok@%KayV_dM9gFEBdQ9v5Qq(bMJhqGN!?c_AMspkXu{vcEuJ|hV3;HBCtp&Ap z20xJXrH+}>Tx<=^>r<4F5~Jw0dakPiK0+Bld|LXPJj^jYvC=?hO_^jBOf27&l5bu! zfOWFtqR+_g#01oE+_G(weq@U@09_GUJ5$n;!;StZx^+7yE?zBlovfAblJ=FKME@UB z>mBThc~Msb00Zo~J--9d2^zCW%n#SOV3E>wXSwNel37E`-`ujknj%y9S0x!5;i z9z%n|vs`vI2Mq+(#c^wjpg4ucSgwg>pJuyK_N}$Dg(mzPayp?;QudYfLtIjmG_`a2 zAh^W3)7cLB_vbKQwwuItoyOw3;3!{riB^3=Z@4ep{FnJi#c@T)8w(M=sK^ z^+|2aGoO7%cp>$2%et~BD!#o23p-_9xe7jQU3uxt8zb_R2w|s~_AV^~h5pO6WihRE zpp>=(`!$Nv5G*e%eG_Zw3X}yT<2O-k`M7Tb;ZQ=xupCCV|QhSg^FzeLH{iXL#N^&zx3SVv%`muhjH?y#qUowj{yWGh7 z1*6{4`HZ%y!ZD2^^U#o`@vH;XC3}G3pDUMX*-|Tq)pnR56RvmbxXf>ZuB_9pTp0-R zNa%0xH_(gBE@KUOnbTP+PpV#dj#4B`<$lF)YH$W0{x*mL165v(`91Sj2DKsEE|-s^ zC5%Pfq|tI?Ju2BRiDj2K%k$4Efhdk;n@umuJyYzLN}r(|-6k|`gZ(QVvtO!ouOA`V zJDg=-alDn;JDuZVi%kl27L#=7x9F&r=WKz=(4x2ghe2nw1%9aQ<#Kv**6of!>EB#ilvsQVrO7Y$h#S*icB~1zyQqsFO(w%QCzeYPMy!m=5OW$+;N0Amw z8e1%_D5w_Ti|i{Efnj#>!4a(ivf6i->mqM=63Z zuqHs+QoFJPa)pwyT0EWeKMFNrW`m(;dV?V-8~J{|5j6>f9-*QK6$-xOnsF2ut_Ge_1LMG} zUwji}83B1kFZ8diF7mo6TPg5>Tz^Bk)~T6Ki^XH`n8^1obR z6`f~@3QJ>yF5=-(H>sRSte-k9}+%V zya?j}^wWQ-Bfb9!sE8??5Z-8bJqGMcKP{zW;*W0`y)nJBG5stl9qgNYZg3miE~72% zEBHgRWMx`i5>`XA>#%01rCPbC=#N+vR-?%7uD65xPgdo8R@>3DFf5@*p_CrLe$MBX zZH;VK?FpmHJf*yr$d#W^X5F<3Sc{fmjTE+>06Y+rHShqiT2aRK%VD-VX@A%G!mh6h zQIJBEqfm4wfbh4NcFwR=CO})sMbS9Khhq*l05m?=a)aG>h)oslsXLPHDbz2bE&GQi@u&6t$+Q!bP@-h(8k|o+B3! z@%EJC!Wrp7X^l}?RETLGpd1|EdlNy2>;Mk-(8=RWdyDqW`7rr0bUAG{!Vl2Os!TH+ zvQ@>WiG>^sR#6?X1c?gvO*lM>T>6WiEjsTkl-q;xwokBc+>PPM2v2lh^w8c3(hOJP z1WKd#4yH8BRN2Ijt=!M|cSyT}eMbRdUL>~bB^{w$1vexsMNrB}x8S49P9qd4tPZJJ z&5lxhffOj4JPmvmYk+~8S>!bMn3Fu%@5M9}6B(NV`R$ zu*f8T2_M8f!$gBV^Qdhu^);dy<)!^lAI!Tiuoma34Pu(9leinj4lz%#FL^53gr4%7 zMDMp~P|jy@UhBU$%CgmC+4|d5)DJFpNd70dtkM-bHek=*`*&iyBYT#-8cD?(O3Ka4 zpDXA*iEeL;)+TfY<3PNmkfyyisezTonG@Yn;rz(T{pDtb*DB7$+Q=?OSI#4*}%@rr4EG!7BPE7tYlbdso@9^!xvdnxfi+l-?_iQU3Pfv$|TvljJt#cOS)-e%(GkALo(l$0Rqe-50+* zx!DyHy=E7RGD|6fZl8F2}Xp3z5h5; z^TY+!P$ zV4uPFr9;+yBRu0UuUAy>Nng0=h88w15c&sS`Q{AXv@ugZ zeyUy=sO(uT8rLdV$9*H1YrWQ5pA|m+xNp$As>Q3ZRUen86-p3;Ob7s&EMS|CLgwH^H`r~s4J~8<8#>a|JFMQ1SK&~<=_i%hDca*~9QTiQqUI#ShibQu}+lL>0 z^pSbvT^Y`6vAq91&UtM#|ETlYNPe;NS{!|?m~3R_QLy!gekEX&jCREv|Anr8@EC5NyY^y_M5;zl}TIgcT9fD3Gn4~wJ3zjGHxYug^1k$T_OlK@`G+5a>du{SWDZR`;fEG zc&w%M+n#X0%eH3x6FrW@Qizi!<2{WVe+t*5Z|(H0`^Q8Z z=X|=~wtEk^Otx{=Z>=1=?ibHy!kTDK)Py^V{yxpdZTj+~y?53fm|=UhBF464*1U>r z+pfP1sNVjURe#B~jkm;Jy6=TOd*|9JB46^aOP)}^!1h^>?GGM~cwy6GTl$}VCw$fFBrM5r4w|e9o|JeD*WwuZM`blugkacwjY_G+BKN*zSJ&!}(n$$Tsi%U!&ffUNr00)c`QtU;`pvV_ zpZm%31p@;2?tedh&8d$r#Q&tC{NBm?qpI7u`(FRQ>dE~!`~PV@wX^=})-r6NbfxWa|Hb=0{PV7b$DAu) z`AzIbefA^u!-URxpRRl~`hkD$e#R3V=2Yx~a+2DxtiW~n~Zhh0$;#+5Ikiz_DDnoGUtt1})N~>E*CC+BFxllH9pP z?;*4xm{1_aHrg-IuVt_*8+%Pu#sbVCnC&P{ zBAKEaSPKTNdr=el-#9d2&G0RNkM^N3zk%czSa0^o*OZ9$Ve;?cQ0Af$Z|j&TI4eN=W;pRV{3e^$lIWgQ>(x)W_~tzE zgyG_5saZP7rqy72s++~;AH|T0-DuyJ$p`tt^H~qkV`L>(jEmvynHcH*2+=cWihxMr z6e&DfFM(_WdywV1*_xx6twzW@`$NsOU{v)2_75Mtftx4jK~_+3=&ZNo~?XKRYkw2AH3u;B<0G3NSAXX9$jvA0sxA=|dt* zj{$r882r*tv2no&Ni^#xU>;+Z!)qBCN@a57Z%2 zvVbU$_ZhI%*Qsm`&YK6hKpk0n4Kj#lCJf7LY)XRApA{QZRvQH?D>kL9HepA<*qpN3 z%=Z!9;Ly?QoZP7l(CT~{MeT`svO%7Ql4I{FEQyW+x6n2}>OSY!Fg1CQt#7Uj@;xov zEVIN${e{AR@lo@LwU@zi&s?25ei!2(4lD-m9kUoGH-d@t=JNXB=kvU;V1o_eph9z2 zlOl5hty^#g4^}%7NBM+4d4+6jVdQ1LUt#&ToV&ydmdWctZZ01tonI6@u?V8Gq|;NK zJu9bTf2kqpxRkixH9gK+zy?YKq-CbYiN?VxHcpyoE|8+;&&&6CpT`^<)-0o#%?xh! zVy3st9gx1cawO_2j{;jMZ)Oc<`%xCO^(>N0dmw3lZqYL!RS+CoAl*$Hj6gXJ*e%^A z-vDm{s6(Ey`P!Sv9fK}VXhIUvO3Yoce}fJS2udsGV}9yPi-UsEt%)W@0aej{^~+wt zzA>28h2l8ApTm(od$}I5r@LdtdedAg=WInOb=(kcRKi1aBOSpKqxTRv7NVzH6XD45 z)>8=5qe~576LrpHFK>1x`vkM)zwU_>eFm{MOjnEYhUg5YMb9TlG)v9#M0bw!u>QGD zyEjToYVu@vd_JlhqGDC6aq4>HT;ze)Fm~CD;b54hvJV(oKJGX$m;)w{G5pGaoJ3YV zeXU?h<$g=WdEf>2!?vK}3%FoGWoFakjOEFDuYT2we@Je?{(&=XIJnBKfh`)bms=YP znJ_wL$-g^D0{}PIQt>9zLKTuNR;JmP(Ct){>ek#9O4`=}8!uD#EQh>6O^o{TtHn&C z9`h$yk`=H!bHE&wWB78;QB;+N1yitZe-svLzTxu2!%gE+cBp~;sjmf@djY~O* zBQ6P1-b^@QREmR(*>NTab1tkV*t{^;&myIrEF7I6UHS_BaRPdzpMQvDwxrB#!MTL( zAe%!21kLLsZIk5BaH`4oXB&PkIvfLjjnmE2Az2 zl0LYv&P;O{=x#bs)u+9PYXcib@e9(PCr4j?&S+?PH@{%?v#21SmdVfXJreda9P^5@ zzW6~t!Iz!(Yr>4?(?q;ZZz3lY$RJ=P@520o1FnZfidTZXDOo3cjp?S&gLZ(dZQ7;c&R~N-f{U%g zv0rXc>!i?>sj_W--)WK>$G00Xozn*oRkm&Lg(g7081H`cK=~hNbh!c=MLvKp$gFmr zOyhJYlUZyW_5`tEgmD|WOiT~ul5%Z*KN`F5Z%J44Qu9feLRbg0`7eGhKI_iI#Nsc$pBU0L-~PfC^8 zB$k=6$iVJaPhvvN8__oIHR?z;TgXMDhFnPvWjEXYECVBR9*dUxo`#E$NHvrhf-&W@ zNZQeMI6gJATx)ROJUCJfnEb?)i)o`kf)jc+gxwE^t~HI;FNn{yR0`TCDD&e-EA^!z398iVfzO!dXHC-#>f= zd#3ML*#jJ9*RUNYAl&b|t~l!wu#s976QKmK1_VhB(=bgu`pzKs0PWPW2C>6p+3IvE zd#(qnjQzG-NfsOEpg_Y#6JvYz*)XEr)iS_s`;d6a7WZeXVuEW21=q&1hqT66yr@a- z`?H*BlRLo)eoi6mU9d5S&9oRXEfy|rO^+Jds>8N9zL#@KXIp+(5mjON*Ycu|a2zbJ z!*?i3U-X>aMp5ZX)Ixmcdz@*bP#jL^gUQZZq*Rl0^5aS@ornbWs0f_}k)nN{iu|Ds zMRGnfoI_Dy7hqu#QUg{B5y3<73g^W%;t0n_%bU?kaxzHZc!0u?MlbXd(})8c&B$Tr zDE|dY8xguSky-?Q4|~RndHEo$Bs#FbVNY0@U`-K>d=xE?^5j!{KsG~5CK!S_aa0%_ zI{XRw(LvHcF)a>7As5hTSi6d8_bU`(gC6Wl&K&vAK*CDVinZaOMvw;YruwIpT04VN{X&$(HOVhG zevU;4?TunBd5HA^=DbTB@6y z4ZBD=Qzj1hV1F>l|19MVb5`Vf1FdY(QfNdGjrIQnb2wq5emM7ubBOLJvEy5Z+=T<9 z{KCe``ft&z-KKmPs5jdDPy-zLlXBOBDkFU&`DI!UNLQpr2udUw0m^R@b6aE?k|Cu~ zODp3ktx>YUS(5|Ci<{oXnUzEC3FcAb(Voezar>IIIO+qMsfAb{z?vD?E&P?2H$*~K zE0Bk8v1_HS{F`6|j39>R(TtnMr5!;F+L>%|XbD|vanbdRMz%+uh#=o6cFfQQ?*aKF z#;iOT*B}Xevo-uOIv1j752BGd6pJFW+0x1F#02>oGS2r@CpLliL$k+6@%^xI%|~O) zn(r}ws(}x~=C)6sG-;BwFF$^t_amSy;~wFU&Mr)e;$sU_fZPw?M!pxm!zqo)cUr8| ztN%*MeO_;%JMG4(N#386uX>JS7Fn@g_$M}K_s!MS&Ry(XMiEMR!r0UR($#C}Fvx}} z*Few?$UTG3>MRw1!oUR1DkAw*faL{rS6APgyqE7MH$yh1PBtUJ`sl98#~}#RhBBSI zGlO)+CwtFe9-_$BV?=2-D5Y5WMJXn}7uHF3c=P9aUj!$K{sC#PgQW)y8G+U5^6wA_ zo7y_5g-r{{B1lVDm8=Xo0hxz)u5=Yz$Pk?Am%o9sp^T;7-V1O7OaMvmN+oYl&UQ!# z5`%2|OEDPG%*oiIkUn7(154T=_` zV3xP;A~rkbdn_Nc)%py&)~C*IH0s71qvy}Z`73XNWoAvXBj8Dy6d->TbNDAwAGZ0y zclbSEMUYeoSMzUd^{V=39O(dlY!0?_pe{xe)9TP-eH^4Q?m$iEvP@M;WcmeI%lqZg z*vVvl=1a{ao8E1p2^sPJONBYeXf!H;U7dTUmfo3sq-;q10h~JyNN(K_t)um?Nxp<> zv@bewzwa}t)#p=!&SR1|AAMTelY@?s{|thP-b;XF&L|y`ytnM$%HaCDx99gj1##?htwe_cR)bM@XmmXEe+UG@ePN4_ZOJXN{vbit8^8D zlzhHaFP)bgvAYQ!Z=`5V$Kyyp8lfbwRx-q~VPK%G76_iA`;>7iJX;=zaFRD=%U5$u>UG*m%8ua6w#HSF$@V;Q1v z7&)MOp({8nXF>PHbB*M4`oNx-vTcj+mC>DZ>@Q${@UMpJ}8g#ScFQWW#>L zA(mzOrTkBD4uoj-09vRI-FHlCtGvAaJ`h`nfd)qn5po2ml0i#KC(<{tU4|wY=tan; zcEr>8{x}e|@+k7y-=T;Tny9=MO+$hdM}wB0+9qe?R2_9B7atwPN~6QE^vS?!DeJAy z320GAE1(Tu5XEY0?~Mr3`kwR&j?=?8=IIifQlt30Q+x1trJDJ;)Si4&YA-%3)x!5m zjpn1a=#kjF>lpH+(}|fI{64$X12+P3QBay@#%0u*8@}?5&6Pf7v&Te9ErtbS^lbW= zaMoL9sO!uP@V$~Swg0dE!xuH{;zEmp(^*##3+o;cd-Sv@LG#-g*W@Q2#5$sD2 z&lamZ7)AAnS2#;W2k;%Y))sXghPwU~b)AK}EZV3i+N>V46-`1_bbbyb)$@kXZ5 zB8!;f8%ZRL@&Xvw&)jg)H%MxcE>OTKZ1c?AaNgGg6`ukB9eA z;jhbtm}U*}j~v9mV{PCcxJKf#g{rO0t2J5CBxN+XHxArO2lp02QdU7yo>nF0Pe{%T zROEx$h=;m=+VN7dfb2bjGRZUuEENZ=9%em71d1DqON;GySvJOk;fQ`W{l9t`nOF>!=nF z!-Adl-WcV)62&Jvuk_&4oL9{J6z7$mFpId-i(l=$0>N>DN6ssd9NH$_q9?ib{_Y5p z$0X=lZ|@v~*WHovNKp)m}o?-k?+)n~7?*{{)9t?LW8DAk6NN_hGpV z5r9I@63%&{^Kn9n;6vCj?GE;pl5ES_(3|KqVuKZ^z9Lj{CK@JLPmyem{s37=t#K>0j~^RMgq#84O#&{20N^eokx zCWX+|+4AoXE2@=`aL7+wqfx)wA^#QA)w%K?5JNayqP;s?;KZU3*UY=(;-p$Qj9mqB zW?e02@QP#iym@sdvRC8{7}q>94jF=(%K3XxFv)*Jd6l)LcQNunzm;FXhzy8v2iN0C zPvPwJ0$qq$7{Gozwim`#1~&}Em=m$ZC}$vh+U+}}tZ%(jkQRF<_D;-(d(e$01Kfa? ztrr;`I6;M7;bqp?^`tD>an5)8cU{30yUY{abEu(cKWze?Ffm0Z zJRmLXNGaOv1(#~X( zIv?x|PVo!(!Io6*g0rKEue~t+1WE*ky64cVF?E$!d`jX&b_M;3@w6QR#>R98r}>3m zj%;anFx@Y|hRpNlN>&<^F(*=1QIIjQ{xqICz_J08#^<&x&m35lD^TGiYINa9tRFDX#NfjKCve_JPyqZMVRMCJrSIHIIG z)D<4lt(UW@0-a9S9#r74gL7r*qrNjltuPe}`1A%D2%#p#sZe5Tw>Q$gfqZ8>1i{ zCnR|_xpQ=eI+g5(+=hz5RQm-rl*>p@Cg>=bp*(C3`TiTyC%|npw6HF!Xr+V7c?+|` zfdTPX#oY76(&Cj%S0s%cQ?OzMD!@Iwl%Kw8<>QVee9??0PcEHEVM-fzpmxy;yUH+h((Lpz7q>^bjq)&v3K7XTi>0w zOo_Er(g_kBc9bm$9d@{{&;Z_(C!v$RQfd#0LNh2FkhdXnd6>(7(Xreh zzX*>*F2HxvW#@kg0n&B~MRk^4|bltzMHE4mQ=4Rsi?n`B^TBd+QU-awp`O!J+@@U(h}6*yK$PG*9|C~ zOluVy6KQ^`=+72)V?2n1L)JGHItm8+bB(W&OVwR?TZg5Q7mLNAn5(7i6b5c0KjRdv z9kj8IE!kF3@Qr5e&@K0|Bn(G)Vvz*o7$~%G$q+(&o6y1)RoAMnO_Xt&Y@^Tv6vD8b z!w|#q$t0TF7KKEU!EnkR2Cv`oN!*+m(;Fg zeT@M8$ZHm|A;X;Mi-~Z^Fvn(;dGzQI>7pFOBDa(+b{v#-d_T@4BEHt@jq6P$aTRSOby&XW_IyPZ|D6ZB$( z!58aVq^AUTt5|#7NYIU;!x)p2Whx0v5dy^<>C1?LXGViDf%Dx>5rZKpC`l%jWKEP- z23pWG3mdSQbFNH&I>7 zSneguR`b}5%e79vC`B+?#KQ;|PfWO68_SPUVq?Z;up`b>Zs#?prE)uB6*O7}q9&HD z`)f~x_t?jFe;3zvBT6A~vI2!t%tT)Vgs@ODPqKkfNn{G@_;Ue8g98k(`!gxJ(Krdk zn@Sk=5ar8tPJS$fJcNud*TrJThf0s~IZwKsSDnHTiX3=LU=(Fj{JsriEk@bUq%I^2 zxc`(D0LNG-_214%yZbK;5kEQ&QNls3T!QU<{xR&>EP}%ogHbFX&-5X3A?-VdDQ^cL z)`nOI;BW;3rwa#Q7{uqvKgXzq4W6E?c`BvtgS0*qxt38D&<42y`E5A6dvq5HLh(}& z=<%+?y55JPlbXPsP$~PRoV=UM{^nyhmVGj^fLdE7376QyON`bZ>iLQ*H}Ildj1qR2 zJO}zhuE6<#jS8QRGGn+5$d4jqUcUU=%|#!FlxopWp6M<+)u+4YZ=)Pk^g6_QyzgSo zOhu;=0p(tfjV8LZM9jX{U0|SNm+J&^6s|+c{p@af`T~_+u|lsvqer$1H0Q-c8N~%f zR41+c87!)GT-gZaZMg2)FOGIO`JS(7NRGsfCpuFw1 zbKu~x-zqlMC@+=s0~A2DeGZ0g!HJ+Sx`r;L$U{HI8l4W><$mO%YcX<9xa3Q_;I%>T z${R6P=&pzdbUfbIuqN^Om39mc8#Ni{{CMkexCY}i7^}fS8tkt?$8wtt(#qPi275uu zm?&RBh*JFr#k6W1)CXbMbP|zr7L7C>xdHJ|^=37290Gl2$0ovbC}$q?Jqj%d$PoEy z;J!vt^6PMENYpo9^W%7*WG{p}Qp=3LTf>^EWW)DyDDNcT@KnvghTt314Ul&rB$T*^ zhNbRPZR~j#xhO$+SnA#a)^`-@!Hhrm$bFGW!~GmnBotQX*`$=oA%Cg{w0UY?qLOd* zBgg6;XGPY6au>OHdh~54ck-3OI zhjA)6>?OO}M%5a8PJ>k%tk9rSgQXf=r$JtWt2MYngGCxF(BLB)T%f_Z8l0^`hX$u> zFjIq*HE7ddss_ht@O}*@XmFGUhifoSgRvSMq{03gjM1P~gJunyG-%Wyr@??GvwjU; z(qN|s&uUQC;AstZXz-{84{ESkgCA*dmj>%K=+@u|8hk^8uWRrv4Zf?vEgF1PgMZNA zZ#DRm2CFsroCd2jSfN3u21_-#PJ_G#S8H&E28%RUputBpxIlw*H8@*?4h>G%V5SBq zYtW{_R1J>P;Qb1O?o#Z!vjTVnrBnX6k(7kG<6(w+hn=}S1|OUx*azVgi%%Rr!|{Pt zNuG?UJf=}lA0nk}pgHQox;VuK;zqi{ZPF#0SR^hAQ5}5))mS|=UtBIuCc#1>q)O1%T<97cv^#>Y4CFmexX5GgI*1u(V$O* zXEpex2G42mD-AYlaGwVEYw&;u4{GpJ4Ia|qVGXuuuvLRcG}xxWqZ&M>!Q&ci*PvU2 zwHmC`phtuC8r-SD1`Rf9aF+&~G`L%Xdo=iw20zx|UJZVt!7Up6w+7$V;5!<8SA*|q zaH|HlX|P6v+cmgDgYRqb0}cL1ga6gwhZ=lUgPSz?XAQol!PhnT7Y+VZgMZWD8yft( z1~+T)O%1-K!GCD*pBns^2CD(LJc)jx{oUveh1DURhR)C%;q~Kx_+4~7{eeFnJ~pfR zntG&t-D68v(@WLOpc8T3OIf`NB#txTwe(zm*$V6yq^_iZAO53wOx?HwB>tf{+7sSW z-)Qe;&s@4>b$9mFzx@%~6i>7}Z-chkK2zXl7OL-IxNO{|AE8b0KUVJ0JL^5{Q&xhy zy|{Q)@$^-;A7%z(DE@ZoM%wM`@C-fP0cY;le}pc@6I~AQhxi;SZ|`op*LiJRZKKpb z_($=#OFt6)P`Sa}3x0$y#S`6{+bDOGee$w3lb*_7TD+?I-5;S#@wZF2hdq1A%Ey-~ z?Pva(?FV^45fp#Bbj`$vnQQPv0xMRnh0GQG2yKeLT^>i-v#|ZE6uH{{BXlXA=new> zG1-Vhnb#~?v8-U`>gxW*HmdRu{!#qx((PfVW<&ceD_FYvN9a=g?b403hZxM_42YEmd6i;+-M-N#-{B^8aM!zvp`XjU{-VECROMiy?HOZUO zcIo)x0mxg+kI<(0+oj#pp1x`&L^;&2@8@kO)erwsJn`gq^pVv*@v+D7lLvXrR;^e< z0}smn(vQ%m_}ir)Wp@-q@K)fbMyk*L2wjT5UAn#OIsB5xo(KtGb*5nZVTK@v;%}FB zB=MUsUbP~fxnKPex)gu=?U=Wuc-fL}{T%oa+7y4gw9$?wB@hv`V8#-#y8!LDV9o#L z3B}(o{a*HokK&hMmOQ2kVRg-q(5Cp?rwv_QNF7JjsWEH+ceyE^+VXb#rO7@sN1+OS ztoRYS6o0#A?rqOmQn(byHY=`=;}u9BZ5Z>={ba&IQ@TtIcF)_l*V*v>!+#V%8PPvB-{hNYT%Xyqi;9;nDNxRm(pL$j13wbo2fZb;v9%4@roqQ^ zRDTch<2e1GSNH;(Q;O?X-L5~v^-(VJUyRQ(d>+6j4Ieu`S@=*LvY)d)^TOb^>3?XS z)A6$bX%l#akJ73WfV&!>ANr&C1Vq}R)v@!3es5>^9vc@oJ4;x>FUv;t&>$;>l4Wa_ z&M98TFU@&soz?H z-7H&Du>Exon}q7So>you6*d6f@gpgIFXHK#A9e=I01c=ubX?dimyR5$t={3Y&Ie4`8TH?$dV8pqd4(^CSXPlv~WeLunNDsLgSOqnt1 z$J3cpu+d&}kZxrCU^%wquI;Vmn2*2jlmky5+)|F?AKg-pA4+#qIbfVR1NQV;cwcC| zi4V7I<>GgF$f`cE=?CoUaUqrL>Tj^Bzi8QN)ZrW>I=&f}^|-l$?M*VSf0GP`M#8ur z?MWA%!Rs&>&3CnU5Q(4U!HW{Pd8{bF@&ob5@T)FfU90PU9sTGG|CnW)F%g#8(a9}* z_P7>))Vtg^E_F$1MC#KU40x*!@9UJBoY%%BEVM>3?8Hh_(9C zKT7hVg{qx%Gd}>YqVHziXf!L_i1|tX*6EXyi z`ps~bK7>GjF55eD&qUbcHpS~d3Fvx8gJ#j`=xJS7Ln4Oo1 zyL~foH_&-?JYF%Xi>SH-*NxB2%a1=Fzk7{Uw{J^A{2`yA$~bnaa22WYq|e2(*2Jdl z#Qn;?yL4f$Y}iA;4F`_EGwYKHJEA1VBDmg(fjfwTf zW1eGm$7+wc=c!eVKeQ!5x9^6kk{ysz-Ppt?2i?Cl$#)@Vs__i49lvO@Xd%qy@Rr%t z*fsjZ{VMJ(<<6vBg^hl~jMFfQH+1jf5=7}Bwki|egD`c9sc{_M^aD#8aQUML*-mYW z>%h&=iXN;?Zy-3R3>*y~gh>6s^A(JgtiNDC@7k0MeEr)bMd?tC@f zCi4KiP&fhy*bwme<+>X3D+af$uM^{*ya$KZV1|OX!@nLOpW@tRla-QPJlvg({93Zt zDcMU}G78^e+JKNhA(@BFfP>WV^s{yVil6LWlpnhT1W(0!x`Nzb58?%h(!xnnF7X7$ zf;QM#b&?t2StiiSYHGJ(u)qt#{gshTm;<9brSCcNa6BqcMlbB{L=iLw%6goPzvRYY zd^qUiMOawd1+y**uUfX+sgKgho@TGuiF0unEVyzz=>QSGam2A^Jd)G9?a9uT!7)x7 zN3vph+2ETZ)9-TRs*I%9J6N;oPDEAbDT%@w3_9P?T$O1JDvH9uUfn2$1_R#8)Qn9u zzR*}qV=3`W4>&rJqa(-jtOW%bB~L`QuuO}_v0qj4(?^8GD14eG0f!Om_DgvKxK3bKph=LYdx{n`oaK>5i|Ucm!79Io5C9|RVxGPm+IR{cPWK00;=c_^2Rr;WT-)p=&1dQbT)OM8Dr~Eh^!%yARh@F@>@9hWxJGn zmksisopcPWnL=tZE#r9HgnkZ7OUQM$EB6vUetZJ3$jqbE=xBkiC;fP^(k@H6Fi*LZ zw4d&Y%CK;iJ7_|ZWtMdK88Y;*8)6!i7^@niJO^KA<*J?IIR0L#uImVXZ2)&%3+b^V zeT7%JT+zfwR(vU(b4}LcKowVBX;@`$m|eaox4(r<8kDgDVx!E?_Kd|<9zG0rFLe{+ z_efp1276U%#hX(X|01>0n^Ujj(W&{17Ly*NG>4IDPog`riT}xkeG|PGpJY8>I)M}CWV*>cn4Ij+-~n_AtGsD5O|EIYfv9-o zHFe}w`sGV_wM|+`nj7~`_a?$}J7CDNN@ad>UV`R^-Uj!2;>K&_TdBkNUYqe0ujC(T z_j~U#;HO#k@)s!B>ss`!v{0_He~~&`2t(-6x8(JxRqA*lN?Ldc0ejx^oq!4V`^5j$ zF+voAYTlCbfg>$EDhVyPN%S&2`7qm#-&3MbY;%@s+l?=NiJU-6lTPdmAvwc+=wY}~W>JdO{Ahd#0JPs8WW_?*+i?}K|a+=*_P zriBbv=~*rD`(WN9e}rQ}m#~fH9@S9yTCIUffc+0YNmoM$Vk4&*~zOetg0SrPwAuyEUk(8|L0>MM` znQ&I>^z~5U!j!algzRnHr%uT_x)#QLSw~g6^!mEg0Qns2M%XDuq0E%7#GhY`c!#C3 z3Gs@xq{0l;*?SV5VjF%6V;d(myo1{y5Aze=(K)Z!`El>)omVpW-tQQkS7z|Y8W&GC zBKbSUn%-a?n3Y_&X4nqW+=vtIv~2Bb#*r`Howgs{0deOQjqmS*xchnIBbe&SfEKl$bOK9lJoS-AXrh*?|WeEmn*Mg zFu=%&4=x4lh2h{~c^(G91|y~z9x}5B5t^Bz-_D||eb4SwOpinMhuv5IVU|T#Hk8*L z-lyFgGPtbkUU#I?#!K0#8$y&pSjjaj;Htdz71*gf3ebkRDwKfFdIK(NL3d`JO#A}H zhAiJh^f-Wg-+v(qbV=~P^&}F3?nxe|bAGitumOO6i;$~Sk}84qwMdnFNq!c|d{)=X zlruuIF3CGV5w#_b8M(Z~%bQJYf)Tf;qayd0g>M<%b;K8LI?WrZIyS%PkWOK(vvoDp zA(lH;ebT33q4Q;A(+2OfjfTz1rv(4pMcP}F2WgbC2VU)gCatnxdo@adS2q~}QO{RR zivQxPkqW%fXg`Z~=4$%j%Xx*vb6s|`=+~FQ7!)Cpg!N&H)JSNv8q0k^DzoZ~4a7*7 z{h+)MSgZ{1x!VtprdL&wv}B-EE3Zak*Sk|*-AFy-tnx}f-lZPx5)NCoF0?wY>3Dn@ z*G5`Cv>!~do7d~#!H*~Y@i{_Yc$VFXuiybvzySMZ%X@vTLZTwY=)gaKYpYA z+UBm-EeRJl`vxk#e-fzh{WhQU6YNt}4}`)u$sMuT=O;W24@O+qzRM%O4BGOu_}aJ> zIGA%xk)MJOY2O_Qi50IHp@y2a*f%abZ22(v;8b}i`kqHM$-wXJT3U8SvT-s>Aiekqd^cE>B|H#)TIZjw=i?ZCrR^yT!)Hpm0G=h)X>@&+f5$+3 zA3q#1@v0)Bbu8{@kxb(zB<9K}8ObRhB_~2Eyd30DQ4rqC@D?(>C{#C$1d+chjeu}> zVOK^tmh#bf1XGACUk^sWXRsyiZ%8+A-jCsJ8#9`o0bb^|W?>QGx59$eugE;c|JDu_}znq!Z)W1zOnAjtjupHGd+bLCiJcagHy`P=uTy3G1$B0K4)o);ep~| z4UlY8xkoKU(AOjKN`{iLP+4x7qUED+VU6Hp0N~4hN>Jr zo-^~EqfxH_ANpw~D|#?PJY-OcFuH6z-hNFmWynv$+jS)QJU??|cwBp`U5LuamU#ru z)z!&%KqwO-Nos~Z6AYLlE3)$W>yQ{cnvLZ;UFj9O+3i1&w{gerb~Lj2gGGm-7mh_X?GF zW4MCZE8~g%QM&(!xwnsxs<;CFH_1X4*suYEMny?AC<-bSR3y*_Lqbr&AOu9kf?hD}{eH$vl|=?|0#So@LyzzE7vyrA&IQZKQlV z0}sWBGY(Jvc|eJXR*)oa9DByqPBcQA2TKFAzi610-vW}#%>(ocv;B`*EZH^pkE*KRNV|d4wElz_Pl!I$Zr=XAf6~5A(Y7mWqunjF)~95|vc6 zWR{L9srY(G>4=hwuZENk!~CpCDIFYGTYFP&`R5mMr^?$my*+ua$CI)lu=cH+-j0J_w=`Vvz}itqMq00E`5r!W zK9|xISQ|-cTJ*WLeoz|9ZK7|aiM~n1G1!GBYy^*U8b;P|+AuBBFmEH_+2zfisA4C( z51NECCTuIYjbhArS(1#}SGi?jHUg27O;lUPef!<4?~+YW(SWxb_eTu~AJW zi}LqB{p*sO^P8rYq%g8mAoAu?diI1Uedn>;{777Dp;s&>v7Uu4tRd3y*ovjVI zc3-R5XjH0Y4!kAxyga*WVC}f<&VjXJ_(;a3T|KiOr3ouGW^!NnZX0&f_rS`ywCmdJ z%ts~a@kNqUrX+Q|d}o+`EQWRt&(4e|m&N(6jZNdsU7D6;kS^mR^%~1;^F`Sd?fbA; z1JiQPU;4$V8!0H(_ z?SH%D^30+c-cWFNUH%>f8K#ak182|?U#}}?EQDTaWQA^)eNGPbvTVLilCeeBZdv6p z8K$nI$uW=R3%t+?njU=F;j%9+Pu~r>lsI%rGlde`r;z1yKl237#=#9gvDy9@cfsfT z!iAs9Z&4G!6}9_yUX8OZ_p>BD^Mbp4?#G_sPjMv1tEk;0>$7kn=go<3_^qhjYm&94 ziT*LsCErCG_kbBa?h_Ul2bRPdjT}uG{ZOuRGzD@!Wwj!bTLJeoFiCN7HsO@w;rtxu zeg@K-sl+n(0zF+?DO|aaL@7zD8Np@;-E1FNHSfr7nwiC~9E^KGdTb>8pn$HESf&@} z?6}fOj-ys>X3d82wz4z09g#IXUSq8kz3ay;K7)vx-LKJP5S>*qbSn{(f>YU;s1yTy z*7NckU%7H#XS?}pwyfH`!JiXX7XRjj-lWuImo}wobhuJ*0pO|6^3snQSsI$|c8+qr z(c!-*=!zFpYdexTz$qXQVWPYvjop|;M?bNtA}%|=@kZTOS+r3~<{Y(hu|EFc1g!sw zG;I7H1?y}REDQ+hXA;%;DONO1KIh8kH>B|GmiQ;wbz5TOo6-^=vrUc|A+LQaJWMN& z4xVeJln?43Jo5+eIo5h}Bv@4JY$f5i`urra7d(9YH^DD~^Xd@3iIVGV8vR zKVJ5J(>AyVBJbjDq2dPF^O>)PXuVY~YASxt8N(cgcp>X*F-?#h2=}$WW99N)m;X^# zUH)erw*HvsKc2>~Is%=_7CQ0)cok1=U}XnCUAff0gEiIs0jglXIMpntmrUfn29Hpx zB-L1>(arDGhvocXE8=~k-$|t@+#`eYWt=STM+JT5^FJ!&B8<^XCVhnU){5E>D_RBx z?!AfV7;2sVNUkTAU0KB|AeGf0-f8k-|JnM?o-Q7LhZIjT(YO>vc$vp1YYI zE=2=2`{5Oo6Ly;9c?ps8B3Sd&@GT z{hh)ziHvE4MmVXhh)ryW^-7?WG_T_UMJtYAyN16COadrH9ODA*JStSVjn zjtCkWN4b6(;P{BPy*HxI4%DP4;SC}bfsTC%*Y;ts5`TX6U;OLqRdYB4GNFk3| zEn~vjH9f^sMoB!+wLN>(WQiw563-LWGk7BXEGc>%oon|%?xWpZpw=O#z!f2_z3_(* z%jf^cQ+6^lq7OYmU&*HY5B;8~Uq1b}cPOct^`T#=aRIx7&B>CoO_U!B=C22J6B{p} z6vgKE;x0BZd3|35w#J&xPc;GpRwCSHM|ksxB77=bLd6E{Wcp=h(~u}5-w{rI+ov$r?9`XS+5m zw&M=ad`r7&6?;mxw@S2VKs~a=<3&526isKPq|+yX7Sil=ep+nKl&VTJ9;cryW*5Tl zC)xpSb5d%YB&qb5R1{xzW)sI}!2+rLM_}5g^0Rm<+S~ftsU$a^Kq>+m&OdBV58eQ9 zVxvqbip?xH9lM|X*6v4I7pXG0e)BS(U>9DW!dzZ+2(Wq}#j=xIAjwGvRoeDrwfp`a zxbmTCAcjb?%_RWU@@+>NDUqTJ%ZFwPNZIWgEN(maYz>}lT@*c4nNz!7oN5M~Dh!C} zW2%)Zo41`6NCY)+NkY~MeYexHpRg$cyApuoW2v&Gk${BF@xVZ3D-=gyY>9BlIHT@D z4H0YG1O7z#bfoc`$KlpddrccbA~x#0qEXas*m*^`)#(|=A71kIWbxLyq@>IAStpR8 zN||$GBcM`znWF2h&8G;_NBzas%gEIPhcdsW7N?k?2>FUYh^_scCH2-#OhO> z+~`^!cwt;GR%mSk<6{TuXLv}Qq0O7fyL$2 z6Wb6nQ%;kT9*ECaWzH-i-Pt-K^hWlkQL7Qvn>HA0ep8~-O_O;a9HDd*G4PyRjh+q2&tlpC?l-*bq$8WlI`_kXazB4r z$7uRLlA|Z_9FHl??%e3!bp)AQ0A=K~EO=cmER`lluSG}=V{|E+RYK=UvyLOez?11d zDRiF{J`SHWn)t!6JC{PeYC_OO z5%)SR;(fKbjD$g7D&}0g+0jm71{6b;!M8<;#?dLEKZrWP(9I;$Jvg}H@C^&I&6!`y z0Js^lM0x7r0UP>mNZE{hWhz;+?!LKpDn^x<(avr4Ea-~k&{eJ2QlY~ZV$e#Wq(s~` zEP4hGU9oMqlkImd)51K5yNam$lS^L%VlY}nZTuSK=PYLH@(+0IQE)b`wj_VQ*zssp zpYlOB1_z=xQ)j9OlI5<|Wu%T&czq7~t^D06sF>9E#MxpZKoJ-7h&^QbQoWmO&A}4| zISYJMfFKLdi>~u(LNVGVxcK$y6K3T$j_Q-6Q zknH6x3s(~z)ILx=B~XA&^kf2s{QqmmbOZNEpqM*Z(3P||na&_%BG$`hm(Smme8&tk z_zP`pE~RTgVAq$19^~rwjQa*ow zQn0&Q45zGnqv?)My!45PoC3lW6PuYLmJh85y)dRVpvh^XebPjKr7y_Jdj8X_k22Zu8sA;JkCM(CdNtF!cs? zA+eeiifW#CLMXPyl=6-=KKwhztdD6lvCfHLjDgQS4=@c_aZ8-3Q>O}VDMr?W_9`-R zGhj!>zgYKMX;Klo{b1^d#In1!eO<$!bH%5R`k;~)!wfQjQV+akt>FOfu>s}odSvk( zUS?C?gK5A{K)-5!iZ609e-ZaL`P3&*;R1^bA=#2m!?RiP$qVKuug)~wcKV4-8Hj$j zo%`)>5^^c?tH$FbAx6p)p~uTCL`A*ecF(dT~fhK!k)4Mef#hDnf(r?3JzFi zlq3PR&(2bAvpF=kQnMf9G5i=V*(@X&OqXk84P}D&J0ILr6Nv@Cvvy1Y^0zuDclQoEU|C3(RN${ zL(TDK2Uc)PAA|~nK`-oBd9~UbMGXjJj+)mMI_#DGf6D7gJFl7T@tX>*U=++Ozb&}xa#9;obm@k;|R9gNhOKQnv`OoH~)bZ&4ySm&DOKD!|5 zhEtaQ)z;LVlP2FtebaaKdNkTaKc?!3G@cm9jDTa>3DY@}zz68Qszi~txsqF)gb##=Ogg4sq{NPx9C zvjS20mRi`d-~_uCWQ^KpI_!MF7LvV@+~xY1G$wbJw;E-eMNCzRsls}Z(GJ)$M*oE2 zGk0A1H%rDpsfHT56k8MJx@+yWrrpyoXhF*0sUpH6KgfD5|b*#4O99`^2 z31W+%aS_`tt$vc$KB^rfE!v25Qb~vA!g^PadRoA%!J2Tq*w>Pnh(Gr{Bqi=FCFX#N zwyL`aIm4sb#^TumUu4!+BL&a+JFCtvY%rKYx;$Cg%f&x27|A)8irQ}~*ijua!#m#G z3w+V^HDJl?gm7wP{#q?luT47Mu|t1puz5zxcypZsHVNQA0F0NkBY8HP&xL*~$H~%1(f=>E@@#Oc|6Q z^t{QOEtCV99nU+bVL^RkN0LO_Y`a-cVH#T~ye5&bJUCY;FuRbo>io2+h+Q@H>P&aH zyTCTmPnp!(_!pwrc&SI2Qmhm1Va`Ii8tFuLYg0`+0p`zu<~5cJV1^4QqA}yK0lNX1 zEr8_!Rzy;wSJm`$;WWX9w>7~4aDxQyDoHSUzFqN&W!`>S!LEc2m#`s(ap`S7Q&~a7 zEE)|}aL{nNL;?)~-Z>3{UrPs!xA7M=6mjfM6#T7_0G=tS+?TJ|TT?PZR1BOk78 zUi_qD)A-|se;ZE~9|@PYubO_8~gAlUFy@j@We>ZT z3V+G6wIXA(oKDCGjMr^uFg4OV2``L;{QOPYDgoW@7H;!e)<^ z)&K>$!Fve~&Gt{U=h?NAf9G-bVe;=O04K<-`XjHE`FYYWE#G_mobD{*dSsr6BKTQW zkDl`W32Y+leRYV;QwqHnIobN~_0d!_1RAvJ$66a2PXalP%yBo(A@V&WFs-(_i!{aN z7u=>m@`+xN*r2>kCIM+2?y2(7=gcE)jM7)Jk6)K>x`cxJ>hhbqgyuKb<+soldy1G> z7VoYaB%rqn=&0S)dUX(_43aqkW-c8Y(*GhaWHshaShrB)ZM-9mzhf+mVgcVC1|p%Y za%z(qv;7(27lFmHF-H`}bAswB*Yn#UTq#8f zKPb@a)Ta1Ah{AGwrO4*iE#hI9z7~(V%8mST+d*rnaBlMw3|9)I zP~(Gw*eWA<`H*8rR#?8>w4eG~(vH*Q?VvfVEnz+i3-^<9)X0Rw9F%X!^flg*M&#D9 z=(`pM^F&IcZOLkRtnB`CLP>??7uU2kS*y7Na+Kz;uh{TS#a>VeKI4 zuat4eN?Q*;$#&Zuy#FoUG7MF%0CR*5=yV~tN)6%`1e$2 zIXJI23C;FamV>Tw=2Zxn371}cvT`HxQIYhl+-y61E4SjP7%Kir!E}QBy~VcS%6dFlsq?MQ z>TP@@$jMk&E^Y7zO|)pEqz@is0W*N>-OH{oAHvM%TCO%^+nQBEd<%W#b4k&B>(J*y4t!nyc_bi291|PcZJiE+;N4 z8ogGhoVONqvEGTRuo;;Z>A79CWia4i^GIF?pUXzqpkQ1H1)2dT>nysgqxX+f54P8qY!S+HttKj?7 zecVkqXHxTgF;6~kJ3qnGZYD}0NMLqMC-x=Yp91$4JyZ69bo-`qhg10k z0ae7V{3vu{7v#J3A2Ln_TZgYu8PyqJI|mWt0>K;yxMlUCH-?HR?{PVwo~p@5eKABk zDcrEgR?kFNzN7OR8T>-tY_1m^ZyiWXVZ;2igiov9EkQrK1QGLRhQtHDjA^H_5`8-jf!SXu^25CZa$B6B@{x<7`vQvF@{ES8M}XzRBFD|@K& zlhEPQ3{WX`g=!x{=+NF*<8l%=)@i!fOo#=F%W1zW^!4N3B?n}ilmT5g!%0s zW1J{YF5|#SwwIH*d3hudG5^p6n5Cszk-l|SMt0x&oUdLCGkuL zCb-j%&zweNhMZ5S*tBl~%c1iqK3mtaWqJ`3#%nK1J-cDfiFr%%X-#=*1AkR@wj=qm zBd-UenE$Uh;-B9|!8;GXC^cx?*>&WRwoQkZHj136V<*tFslY1=W}6D+gu2K4l-!`e zFUdLPYC5t|arJ%SU8t+Ag;}z36RNx!`(vnwLLJJ+Olga*pKU`NaRK{uVf`C0j zbJo7DAT22xm~p8&^-nr4da!m$LE4P7O~Cn#EV<4PGE<99CkSbxGhHRMqyK>)%~KXc zBZFU!l}UH$Mt7oMP9!Z;yEncE#uDXM`|z5`f|I*YkbMr=Qjg zUQQ)Gdv1+r_>ty|;w4)zGS^?HDY0=XA;p@~9#UHSA~1f5c3#aXcHm-(CcCDx-?nbK z6tb5ca;iq#$)dqrK~=5d-PP&9nHLsIjkXo7drE+_Y~U}A)My*3dge3*Zm3pevk<_~ z4z5A(L`rgkWF}ir;r#ldb?YU5A3Nk(iC5H4>oyC-SvJIP6k=<&ZuFh6 z5G`hVg_Nb)ys7WaPQ7IVhTJA;nKo1JmurMnn3f~>+(w$_LgL$6t-Iy(Oiga16a92M z`l%XyBhkz4=s)Mwj|0+y={h+a{;$-!7LZBt9GYwPNs`+rk>t=)(<+~@@)--FBi}mR z|7tFx-{xx30<#5Z<@dw`Go3(D39{UHOrC^L4UbRz3@M^^y?8>UUPCni^f)ks~;>i{RJ$;cK-IHT7( zD!))PPy@uEyh%a7o%lOK5EsdmLw5NMM#8bWp>qN}C_B<2lk$!ez17q+Zs^@7l~<5r zytQY83(978l`G-fMQP?E(s*z#8GP(W>3m|Ryd2Nb!u?tw2`-z+$w{xH26FMyu5*tgMmM-eWkX;uTGVNdELto z4-?~DS1(K{e?9B`NI`VZHP=O$6Vr_F;AX2wE^9}tJJZW9IhT03dIx9le@s8rOwr;` zNR^35#oP=}U~z-}VO^C`j+#to*|pAMu@Lo%E8{FyH+f!jqfBy5mwXoltfy?r?gfnipF7sOB-tvZ$qnF#Eh?Oo0dvE6k4Qu!YzZppV*L_1vih8nK zb_Q`ejA@8pwtsyNQwoJ)rcnffvQ^s4NOS}cx2)LDG ztsYNhfE4*KJ0UmDbF%h*jU_+Zk(m%K%&-&9KtufqU2Y zov8SRuJ&6S%wO+FAgLF~3l3#|wLqw7HR6zHla3uC9}!a}rbsHqjBxDum%JaaD(Y^X ziuQg-`{JpHxp*3+$|251owH5vvxPF8MeTHMmOgzD-(yV{9xMC9*(-+1uZN32rr(|G zQ7_q={hmABhTl|rbHSWx)5gx8a>KOzxx;K7$NQTCuO#Qn$-`Jo-Gz~R)9w4#_0yrf zG3L}cOx>8~8m5oe{u7%&q2d4Zg3bWb>5~}^?w$%$*b)44L`5t;xC@hZ+2tR#G8z1o z326C{Y|nyJJ{H}^vQirk+Lt+$iLKxe7H8?0B^^0GKb9S^@3|3rA0xABZrC$OMX9~n z2B_RG7_nyF>y4%$Eo1)43dPGo@Xvx50XSMH9%2rjtrw`8nj45=LP75)w6qvVLbF&! zVnOF#ul26pD-z0=?h@(~FO!wb%{mAclZDEBI@gxto@0p39L~D7LaKabIL{{tTWH=o zB1KxnZ)_pwzt5+Hp**j9ZJ3Bn6o0Nr`TW^{%UbAd5caoOEUF9qGHx(j$M{D#{ZSGq zNOy;C6VmUDO$C|cAi|t&cR&rL#0(W=S#>H%zkoy&gwdijC*y^gWJ^B?*q%`AsGvq4}iN z$0Xq_%puFb@<=SdXTn-y4198%m6v5ihb?wl&x*TxdV*O{dtP=p&&mAbRx*#67Aa`N ze9~6lU}rn-3&g$J)mzN~)ibe&S=x@sF3VlKBRB*S{yV8f z&kT?78*H^Wv_)M~30guBG}7rX{+rA_dEPqW%bFYp)EtYJ#Ob^n3tEx_!!E|(A)I>BlIcLWeV?-hJ6;k}XXa^6q#p3D0w{Acqn=RKWwF8-5wU(5GZyr=Un;%&&ckasojT;8jI z8^pVncYofq@$bWX9PnAZhu|-B@=V;r@sqy{+z$aKf9bfJfRR5x?s<;C5BFxr?ZsW| zxIMU^a@?&9{DYjhEx2nPcQfvd4onm7CmsKNxYM077~DR`Et(-)9hlv?`#A2M0^_(F zaL;wp+=koh#I47@*n!!K+vB)5Q5r#tRy++|MsqV-bb_^-x2 z+sW%`+(R7qD%>j^n5S^>apFFSd$HqQfqS3>{}Ar=j(a)oRSwKD+>;&mQrv|O%o5xW zIq5IPz0C2SjC;7_e=Y8PPF#4IOf-7F?M^ge9Wt0}1u7>p;j8vt%tCJq9kRNGsf@WI zOb>jGPxI9we!Q%MtJkwGH{+QtRM(2Dd_FFbk(x`yPuISK#HDM-bH$|#!fbKrD(@t5 z>1r-rT(TT89mOSUAJZDdB`Qekbmh}SHvPZZd+u|v@M5;r?gi|2@DW0NR zl<2uiJVg~d(enZERP&0qJOVh=TRxmLdWfjM)N6lowXRoief8Yj_ZztKr^ z2qJd#bMYJ}p2yQotRCyd^K3lh^Z3)jd!#WB1{S|xtybrSvEJ*QceV3gqi@=4(fo9o zg_osPCo#8=o`BwNCJKvsHm0C-!P*8KwfViE3Z@9@_KXq_vZDk zlh@6f*L^>n*Whi(sMoX5kAuSxwtsJ4!$?Bv6=Ukk{{Ii>^~Yo7mEV@v=m)l!Qcu zb>hUSq4eqfNROB%L$e`$J95y&DZlj zzW1tchWaiRSfBWUG*ZZH^Gz4uYt*-An{TH0=Bsa3n{Sr*o~ORqZN7cP_eAyW)8^Y> zd{fl7Uz_hB@%@b1YJ;+K1P`8>EgRkeTS=WnfT5X-<#C8PW9R4sQMPEZ?*WY z65lh`cbxhTq8C(Gi?8UyOk8=D`mPe+&Ek8Q+4jVh*Q#$%D5<(Zd_Pg&$@sF|y>;fa zDZ#R~``4WtH1ej)twH1NoXuk0gWu?B=>5t2)-rt$<9LL8j}2b0Z!QPW_wbu;*Z0V& zI0#4nq~F7CvENtBfr;XO)vY*q=gpdJ!w)Q&bL*_JWfCm@SAP3@Q2X%VQ_7~reI%Vb z<6j#8l3Q<`8TTRl67JTJ?>y8JC4Ki>(nr145b zCBpEn+O2YPLkmJDbb?}8`q5aA;M#V*jq5~WoWawdM}%vIN=;Y6;UBg!a z&ky}I5hgRKW8F!S5zF;tdWLzP;@!Yg&C|^DBu~Z>YzOi*@C^B>{rGV2lW^Y4dAg6w z3znAMItzTsttvtd%X~YyH|=`@q|8q;TSE%zfFlrQTr3CvXnztebr~0=e1mg6N4wAM z_9p)23=R&~NUCN5_|h|G(vv$5k<9_Qh=Ev+5Z6NcfM@&Ehib&>ENn@1dH30Dug`IH?a9|`}l`NZkC_?BsNXHUDK%xRj2W8@*> zKQ@mzjUlC;J*Dgh`|3Gecg5px+|yuJgaz7M`l+WiyL{wZ;!z5z}40!j85^^GLtBK2K#(s%1SOZ~oE z-v%jDnQR4)lKQqvnTAT4R*-SLzOQMSoccZjzm7DnnDjmMJ?W#w`W8ysnVPn=Z!;r_ z`NLbJotv2UPlzM+?WM`)OR`RV+vy(IO?%TGHv=m&w6iC#11@#c#Y$;9Hm+HjY#H zma5f4Rb3Un#l`ZY0)L^vpQ}*KRU#%e28jsf=78!W_zDVCxnMA z3e*(>wf9<}KBB`JUI~EEuYDrP1HRdTvF@+T4 zggF~}kd6LiifWQ>kp17?x&>#NuNNvkcs1F7s5^J?29}f^%t{(Y_Ez}lXEiK}3gKX* zC)%Mb4Vx7kthY=Rl5{cKjq{#XoE^-q#6kBe-mjBCami4rK`P&0iz;-!R4V_^H!12> ztjpp>?L-`*^NX}#lcZn{or}G_MXz|s!y5OBHzng0PA}#xukgg!u6klaA^T3=%G&uK z$Jdu*$D{H%$`?b03lLn^(pS6^`+bxHQdZPyN!aN(TLh1RxR>o=sW-`lDw`y)$K?02${q7=&KnR5Kd;rO z3sp*iEdAx2T~T;M5+{}|mn%735$KxMZo6?RpOQB7n$}}ra=~0>vMdmzTNSn!StYcE5WNlT-ZyO~l z5tt31(OQo&ZnUFBJM0+=TSS;0HIWh}sW>HuD}~~rBOn_2&G3H zR}#t*bM1uCH5N8+X}}rE6v{LaxaRp6L#blV|-Ol<2JloXZRfD z=2dQ7AxN`cp&UBzQadzHd zm)O)on32X`UrAxnj&}t4Uu&STrzQ7eo-fikQy|*b2Xg*K@AT4AALo>M{Acl&d4~XF zL8iQ8J<1_txs|QXJWaQW=Q9a-fy>cCbkaiDOAz}E!Je^lj|n>ct*$hkreJI|a!~|E zI?Lyyt~N&W`pmLDHsaoo7eUY8TCcMzLUqrgPxRD{ntf)=!~{I-)*|dN)sS4I@t!e) z2h@NLyK^quZCzK&EZQ*W5TkExpCc%qo_WBnEF}u8t*`hxBXIA9%;dNb=#0;EJ-_6+ zhvyldEj%Cdc)!T?^yayQ=NCLfnxG7x#kl+OcE82%3H)k!-sNfH>53l+TzeH$+dMj5 z`OtKz+EbQRQsYS~L4)6{`jV#RoN@;K=3{|7891hRftO*s$2%lmXEsZa>yRtHr4l^WFr40vgm1c!8kK8YCBhu9qOOB^fT>rU`zrRPvI! zN0kJ&W z&+zMv-h;Ve1JSFJZqXjDYt& zamuPT!N(}ms9W3E(?HGrfGh}b{^L@y5w=dU(5({Zih)dcqz(mShN z@Y80o20u-3M+xpM!Gc-tS$t4X_!WIST)c`DnLe3cEA%R$8zgY220kT$FTqQGB{@As z;Jw8JvN$K^lM?uX$5dfn2PVQ^%5j^bhJZu}HrG@P^N4oWPeArah(eR-?Za*LQJ{rUGvA$=J^vZa`^#k%u8qgNuYvo_qYN97#;^t^@}5NgHoz(5 zh0X4eZz+HK>%s5vw|(F#j@F^T3xB&t3vkwV^4L9AP_z5nOim^Mt?{fJmbZx(a9Q3| zWqFV7vQhW%IOq)DxA`69wVScmY@wDI=1aiTN^lo1=%-rHJ?6Rnf{gM@+hHo@e^QIx z=C+9vc!LJUS>(6)V;g%M^Ry|wV_wxjL*RK5IEldVi~#G}D1L{eXmi9p%D`UJD8ejTWel@9 z;%?=L$7xM=6ZAhx&E|+Zl_R!PN-2a{ejq_MM`S?{v)rXY!Yp5wpmrQ_oB6Azsr*tx z6FFkN`LzZL16(YDi5xM~#u2wNFx4NH{DpTGNU49ABj!j#Hb)drTBICtGx54gykm02 zTFB(Fuk0tIg)0|%M)Az%d4T6Rp0{{hn2&J(#({VJV)*sM?_!?uJf%D$4YWDpGjfPT zdGsx-iW#0`gssSZ#6@M40Be0@9u%t}zqo z#8$B|%)`QM+H=I!W{w66!`vysi5zjIFj$)-J}tF@BhFK3;h)b4w9OHfUBVF~6_S&% z%Rfj=nF}Zz-F0f zXU?=+Zjfx^`KZE#^DS|%m^n?gHl!R9$K681sc{5#x-aN_OF2ZzV%n5jG+e%&UH$lX z@hvysa_b#!;lroha1+(ha0Wt8cK-r(Ydxp4-%Q2uRzJbTC3m9Kk?=j?);Uw%Z;5mH zt+(8m=qF_)i3r`iqYzo>v&x*UO9Nhdqp>V!j*yxa~|`6NMrFO@fMhC5;rdr*}d@OJU^Z-_fJcK+1R zX&Br30v=*DTvl<|GcS{y|GW?7bm&Q=vAgodU_|&8hhsq#ue0|Ew!Ad0$te3p8m}Kl zl|Ppa2WZ5|$$7DeqjEsK)zxAh+0kUuGPGd^9Mmfpy1wU1=6Xg&NO&jFR47LpqLaxf z?l0|W;Cx?6&RyQJUaZX}oq7OCCw&5GKpe=eM3SLtTtE<*x34Udvh;Jxf?LmpW2`fr zk3<&h+Y$?_6Zs5vzHr8si#C)|U(S6eZbTY!x}9)hAZ$CwB}Cd$a9Y zMB4Iyo)(CoS+eV4<`3b3R`Fr<25pp0yU|Af9kDq2^SKo@*Q-ay#n68bX)El-QXbjb zft|-Ozko<~GM|!6q|y9bFdulK_^_NJl0D{&Io5>?Xn`6w`!jt5WMCtsR^^mbRdWhq zCQxd)tYlM?&$BuyV*2hTIb^uU{l|WPyhq>E;X856dqR3jS7sYd_ddnVjvXYacY>Rn z4t>_BbTOsHJ_f}DdmK}Xa&0X8y2wKPwjQ^(4=bXIp;CQMSyvq<=3q$va4hw9i9w+` zw~wN&r)+_ZgcC~yH&|3em1}CO|I|=cl|(i_feQxK9=6^S`GLoivmx+=6Y&fMuohPf zT0+??c=A=Y6Dg$Nd^ zY{HH_eHyCr)1_#)e~L@RQJw-^GBU2~0ogc;_R%6dwf%d{m9eH5)0uc-=8#3Cv3V#( zK)X&1`P~=uc;tP*^M1g2FL&M#I`7{)@83D^hn)Ar&ifJP{iyR^;k+Mn-j6%)C!BXV zZ<=2DZNZe8rNUI?TZW-=bAoXm1M)rR@<0=Uqmtw{9IX-@^{QSX2#_(`LBQTCK)^CQ z&F^b`BzSxVr!=@+j)$1CH%*x+a-U(oSPhVw1FLt zjt2>sbbk!pbRahb>>VN<8fE}J%|HXT*wf#Ayywo;awc^h9wS7|+&+&Y-&+oaG^p8gOODMh6X?G@YCk#`41b>=khawC+>1C7NdLG#e@_&c;u*?{DJQ^-@?s@T}pf<`KO0 z??-)kCZA*DZ65Ddo~%BE@d)0w^7fxK%rloq@RrdRe+O?xxF_@c5Z;y(cQwx%U|NX3 zhO{^GxF`_Xm-<16Z5>(=kj0aTI`Fa;xTF0U!hcL3Suu#T&V^pi8|LZBvkuuHZoi?s;$}Lk} zE^E~`B;?zi;CAuTv5P&HW)OC?e3uQReZj>K?qYvcA-?PT&f+TT3F zWz7At^>^E3E9H`Q@m^rJ$#KqEgi+IG-8$z^yM30EcIx*9NTHfQ__yfC?>~B3`w=cZ zI)ms(!&x87Bsg2nTj)p1ntLI%=ajXUciOnbl3KO7q@CK{Q;M^UtP)GPZ1pk9DB(Yr zN2cc6{KcDg^m_XVA3`x)-ZFhS8b`A0urE7o56j z|Iqo4tggd6oyJ``?Zy#vZVk@1YO9Ztu7v*>KKo=~n5T0*-BQsnkTsZV6yub0U{qf% zDMl=SU5to%@NBho@gy?^6T)pZg-ZP_qu(=f{ht-lby>jtjA#jFFT{{83sCG{1SLJS z2WK0+m?mjpF?^Q3ea8OAz5?Hlxr@F1RKtex&E7=8h(S71n!7F)TkVOrfUB)J*7jC` z-@3}DQjFf{=oI+Ptw>ua;(FF5tUEi~p0`k76>03C0O(Pi+b)vV47MZPn-IxsE^do- zosW_XL>Pbx(2T;07SFshLlH^ZC;E7qlNJ!X$qYQJ z4Z(eIhemkABYZ`snI)i=CNlw4Q8Q>%0kY^U7RL5vapT&h#x zubAueh*Z#ABe^Nit8@=V-0PZ+t20%#URKgez_BbU|H7QqUi@3{*dh05h@-jlEWx%n zYCo*tpFdYt@W`s5$^QuL2~E~XQ~DgTE5+AtCvI$Luu6S7rT$@$ii78`60%>Ai0Oc4@5{+cXwC1Sd)#Vt{k&oCYSZ%+E$#OHE#Xu2-o2PSH~yH6nNbk+N&|$sQ-%q3P5!sRvy{Z6ZCKjX1r4Ev%r{e76Ya(%}&CJ398!8n#MDtF*XO>zN*I zwXlVBin9~Z(R_89yDcF-=Z1k4S}z^n2)J3oo&~i+f0^{^Dx3K2;>1LeR$}VrN2sz{ z!^O-ImthDnH&t3`Qy~sHt5Ay6u+tN4M?4Kq;;4I`93)Tcr-H6$VK43O6_@JVa??!D z{f0>FD>&`8XrpYQz_3Iqqg6&jsoYI08tnl$Uc9V$#b9LC04fqGd5JR2rukqo1Dww( zd@{0>ymW+fB)G-&AGfb!F0!07W7rC__YjN0OuXo`36i4M_m`p{ggHc;=zn7PTxE`o zuqtB|88>5kT5r2Om2melA#__bovJt^{C(t2i>j`&j`21thY|csh5U@@lkE}R=AGP7 zAUp!*K8Qa5FH!%s`p3p++c#>uG%og?1yRjyHPo}qSC=1G2X%?9e7c<|c3($1@b9Yra#mBY|(>=WFT?g@6{+)PB`_mAaq)tu^LkGD-ZShKU}d*^V4DwZA4 zanZUh{fX4AOzy6itTFk}V#=kS4dn;K__z9Ki*Ogg6A`f#H>qt56Wv?R7t%UK(|aNT zQOEQ%hH+CeoA(^M*<6!-qLyCg1hNkmvE|~a56J8z+% zCbbOeUV8g3DcWea@8)f_2}aC%t1G7=m}4Cf^69VSBLPI)ciP=vyOVrSBD1&Zm%z>=jlZHRMWgJIIoI>Tvw!4VBUe@ln;vGaafXba)b1d+xA^j;kTK(E{P&`s0( zM4IG25oR-vJ(mf{!d#kdF?BFK$@l!YFGfZZdYkq;>1mi`m%CS?5T_sNMXdHmmhCNI zSen-;3>VpQ7nZ{Fk;QSp_(yh}vM(lEQdHX$k;Zeh7V*IA2o%M*z09elsvq%=H2MU{ zwCk@n4&Qe#6MHXS7dpawCMI)y^qf$Qv+5qt#rm`7ePBx~NuaW6ZSqISh~MTev+p&hv&M|8iP$R14LQ$Pmd$&?2ab z81{(Uav2V+*u`mu-9#Es(_HA{W`*7-csPwxtVgXm1z2b<>ZL#5`~#)dS3# z?61&tTg_9N?rV%>QQJI|TW;?El_7d3={n8)n2TkWuTq z&8DN=DH_}({p{xjoAUS3p*`VIJ4H>+)}?2#-pQFqE58ATXPd#N?(qu;QtFe6O)P)k z=-?KN`C6mI+2@io$JFU@zL^q z5G_EAwIMX~RdG~pqsCanHg_@?pegKrzl@Jaw0Qb7 zgv3tglKpgg#8qMpb>79H`7IUmF&~TV-xkOAFN0<)W0CMS-FX+*26`$sB&*hj*(B=+ z-Lr0l!N&_ZlPrXLZNoFt_;r>;jl%ow^AHI&;W0V%7REt5~+V#u$Sr!hib9}v(Nq}9T2=ZVD zO^(E%vUc8$xm-oQ33InfMl?0&XzczHF+WF^D4lnod6niso0l=sY<~i$Sk~;#xfT=; zT%*mcW+{WB+y+Uf(mb2U7V9xFNGvlOjFM%=)oRcYq z|M#gv8nXPf=>q)`d(P@|g0tAQaMEJjS${}cw|Kh0%~#r{J7tcTO=%vEo`4wZO*-jF zkRwd#O|Z+@E>jztUh3a3UY6rX22b-7$R^S_R?89(>`$OzIUPc34wlpa=l?c-@Qs1e3ZC&nCoGedZ)9YJgIX9l{sRT+@e%nKmE!1R% zES1)Uce_i(U_2F-wFp58TWcG{p)*n94MC0Z)aMaNXlWxHGt#*CWT}~SCc(2jcJgZI z6p$uZ`q8vXdw!8LTCl z+*T61|LvCf7>ste8uF0wFg_=Hkp0KDrazzYNwm>!P+!$Xqj$;bqH;%I@s~0@3L9)O zm59_B3u~SR&}5F6xlAxWda-qYyLJLEq(A_^ex14XGbPw$z25gt>Au^|QcBm>VF#7x zq;Z2uc}{2j^#nIG%HpPK4YD}7k&hGct15Eg#!XRQb=k}665}G|o~pTHZG)q8d*W@x zJP~Ev1Dw1Pn2%Y1aiYLHAQA-*n#4HX*Fx#U%)2+|aPVMTxtf`oB$SIlmPpMh4S)v! z9&ha#R8@H}ZDfA`Z{~R&DxzNOxc?8v-=X4juXW*gtY@E33Pod)w45c58A!p= z@G^dpftU61P)a9Sr5tHUQ<)`vdGK{<6rh0c)bi0@?~?1%D6z;+-a3wU5}{vhsGv`% zfZiS|=pQN==!#GtL%M7g^o0J?8Jh|+tscYKi#8WBj}_3KE>-k#oDj(EUD&YT9@^7YFo&pjN0Z&ZFM!$#|A71(5Y)&)Za5f)XzD3l-1iM z8um6hiT;~JF>4MQkpK7W>&X9Q2Ou+?(Imgan|vnJ(M>=yv+-zSkr^&K3+=PB$c}#2 zA?L0(e_2|Wwl9W?yo~H-x7C9&BQn;yioD;kax=r;%~oeCGjtNB#V=(e#~ZrZi#2{* z-p>6O`$BSUgxm_Cn-0tnNAxTVai?5PS+;-SNbA~cf69k%MXeE;Rz`#6&u03F8tp(J z(ktd=r+emi2$v>BPqrc&Nxgz;l2lUp!rn<`$<_f$Xu(>G-HZ@d$`MkrF~gNxLrXu5 zgL}UKW1Fn8x$p{Di_5MbX| znwVxHRrbuu%Tk;2sZt;%$Se>T9=G3jrMxrtCy?ict4(u?VoGRP1`e)!#8d(sVn`!y zV_Fc)>)DR3RPXqQE3^HxcxBr4otN-WEG0zQL=FLRXqUXsQGb{o?)Y{xp?OU*e9+OQ zO9^%8oE*Lw7vx%#TCAW7HYeD!pqsW5+U&AQHuJz4k`*rYn^&nz zG1aBF=iIVYB%4KYS8@|Ug{Ed|H&U|Mie8lvtXEJC> zNR9jH{PMWmAd@~U$#W{{nus&cvNl)D_s4==7R^_Mr#UA?ljj|Wmq)#5?}fLY98F$u z0^9sdMcKufKAT;f)Jg;|*KJDAco;OuArh7p#jU!A1%37$3)@;> zBT(52|!O_7>bSiFc{QJIjry z^~2T)JrV?K%b$XsYftb5At`2ZrQc9?5wvs?il@orxjhX+=_CS3 zKDg0F;8-8+GxOQ1LtH77_tu}fllSOQf*#H(_6JjQ@_nV9qRI0+Sd;c~OAm)Kf`$R> zbu#~4`m{J{XZD~OP#-=k-*;lMUvvJa7IbZVYMg@3or)%n=}n%Te@vFIJ zRVj^9TX!@0Eht8$@|LaXaw*f8&>db!WyRmA-LA2!tjJFAywP-URu@=PhgW;eLkZtD zz1Us1;-iHU{0D*)TN``UqDRR8)+Z~z>;v(}VTaTvkLB~pu zz>Rln(M4(jfpQsvk4{C0uQRLX)(Q(4E6d4eMzRpgbX>LMEOM_RlRALdT>i(%yp&d~xXbGa zg#QMJZ4`4ENWu6GBqGI-%aJ9VTPZE zy+Mxf)tTR-(&S_$cBUkw`GvCZtuuW!lihA6&1@%xi+7s2nh7%Tc9~3P`py8iL^8Qv zGU-4jV)SXd$z!z;r?Q(t0^(`=u-;clup^C!JIhiqu4%RnDoVh&b7i~RzfA|hE3Ks} zUh_H@nT_mwxeFPwgYK+RDoKW}ZPkW~nAGasQWID#+~sHLoL#vEE?(;Ed#Li@f)jGy zoSzI8=Xp~$S#O$ezCIF5D)mQ`neM9cPf0~%(wt6Z{*u_1GJiBZROF9#N#dttN|BEb zE7vdMhnXdFcqvz%If-_1OEkW%L#@pzTE;d3F=+I1Ah`zwcrdrRTg>cBu^Z0qJzvuo{ZRoc2OY=KEm|2M;j}@!iQf z&e~{t5-wNZ1sPT6Ca|D>3uyT+w5LpXopl7L-3#LL{7k3@F`pf1wWJ)Wj4kMwbC+*H zx177uQFlSz%7{ur=q?|sE-6T3U!^JLd_|sAvyR57b>-0Z8A5w2o@-Sv&J)X__khbP zahs2Jk$H=Bx4sv--Oc)itvfiJY1<|wqa%o9n@Y033*N3`=v)n%dl%I{qE0#^46_7)FaW=CkOI=s7^;kE9bZzXkveg5|Zb%a{X6 z+7a_h{Pc6#_z7b}?}c6u)kQC~MrZULoqk8>P?I@d`oidpi{GD<9D0BJS+9ff6x13= zr-$l7uf5Wk+-p|>jjlXBpx>pJZS)?E|7AG|?K*IeeOTiW|4sHJ9LVeeaP{KdPd z(<9VaI#IgzclH`&(JecmNSb1-1$DhC?d}mSHkJJPt-3#73pm}8t)H4BNyb@SQw+&{j@ z+!U{{3gb-^VAAu0tZ1FBVxkv7n-$r2;h&f}jM0 zNqA9FA|wV32`1+tR={Auk{+V8YKw|3RIT>+v#nK&Ay^F_8t|oxiW(J_DsAT&YEz9G zOUk*Q@9dXz0JZ(!=id7~_rT8HduHu5Yu3!HSu?X{jZLJ>Otr|Xgxp_m(jM2kXcv2s z)68a7o;2(8km;+Bc)SN>&faLPD<}c0u3P4qj~E-0&ERhtDN2bqb7&~uI+llbELeUI zVEUmEX*EhjHtCTx$DQ3UKCmgjp()rjvkX8tgHw)0`zOy@LEK6+HI7y7UF>2*wTqo}ktpmW;3?MJHDX*kHc41b^C0X@5kC5S4CChO72Z``3 zM7X)_KKpHp;4gQm_pQ#**eH%ye482WBK=h8=*7)&h6qz`#?01SBn z#*!~vOPG68uHVq)W7K?)=eEK~OY$eH#tmV;FL2ZGk7DUdR%)rkp-KS)LYOkX&Rf##s-M!BEr;1-V~tR{$spwx6Dg@~5a0>w7bF z%&XHmndKyQnKNhePgysdIeFBx!7YO`wzpx3ch5$)Pp>^e@3kKUgInJAf-XzJ-eSV^ z@N2gJ)AD`{?cv|(SUJHh-6Okdx9_fveWzwraLe=*_xUuASH;yq-ZW5d-v{#PDZwW) z^Yxm#eQoN*x|Y;S*2HgWj{I@>PBbs&y?mGStM8o_kC%_jnLxi{k5HX?DktMULQLIw z{SDv(_q`vGN%+an`DP+8n-yDNj^mO1xo@X~OnOA2`(DC3%YWU>UYIA{-3>opaOL~J zV9peR_0DsD`)tRIb{e(SWD^n@_y`*5*woPJrXR1)@CEKO7-GU?uQQfkz@{S8RD<#` zm(8Ly8F^!_R(Q1ERus13vcsOXFQ=(-gh0jBO4 z;Is4LriAkW?W75=me8|u4o#iD?U%cSLE~p$e*F^6wQPRRP4w>*yhN48Z~QmSd<;UT zju$d~aC)+~(_$LC5L3G>9X;Ok;P@xaJ@&7km_@cW9>O}ejX&N8y zq-boQkSDs`B}6)Dci6N)L;aV>3+sTvvjcMVXJ!4ET#pfm_S$8A0^xHN{0E=w1Zx%m zcDw8t82gCvgGqr{I^z0?W6Vd8;6<0807AYAZkZj_r%MJn2>Nqt$;nDFtB~h9%9eMt z8G(Sn?1gd=jZG7!f3#ymPtUSGVl@rW?v4JRV7L@{Q=@;fTwMO5Pdx?QV!jDJGlB%x zUfFl;m6vA$P>XlK=W&(r8NNfF-oPHc0ZEpOQ2Hx!^ehr~{?f$^K!&c}D zXZU3+bZiL~dL8unxqOX;wRn3i7^ATt9aI@aTHHNdiy$&-q>Wv_7|&RCv#4h*TemVJ z5c+2AN~~IS=Jaz632Ikz6uHhUzLOVjPjRzzUELY!|C`$3Y`tP!K0<5ZuGM`3w(XJ0 zW6W&s<^riL&cVm~s2T{Z^>&rM8~LU`aND!23=TNkSKgoGl|9pXsFeq3s~?w%85|_8 z!^JtMK<9}or*_6;UQ#1}tqPtjBjY|#VxW^1)-1Z=Xlw;-hECL(Ges7yekI)3WQcZ_ z`VAlJJb^-18&B|86bHu(2VEX@f_fK}XXGJEu0%s{=ASef=+x{>8Goqs-v_|y+3Utj zYy?8rZPr~IwCWB8md}s8Zr{yaFOV#&luRH_Wk*nVreVi~PUPggUV+dUO}#Q&%?O{V zr_8Z=nc*SchoR^BFwJS5<;H8BQF8^)BoPnao5(%HION?3dE}o)Vuy>GR_?x>SJ7DZ;n9nU7UP&vagq11SiYdW zwf)t`NDOHaTSk^_oXIkO0EMlcludn3wm3Hu-#zsO!*IP*UofJfAe+^~fSG{mpd!>7 zBeN|`dAF~jt5dP{C!DSGthEjfKsbk`oURy*6ka!9&)=j5b9pFQer z+XWMoQFkyk+}{=`g~|rB!3E|=WO7kXxpvLipe&9AF(Cq}#0TTSJD)*7{EF6IcQ6IB z_+~Q$J32(#@7pqAFDMI46*Lw(kIPB8t~2GtS0?gR4PP;bRJUW8)oI8(YU1WbX#fE= z5`PYD`MSN{o-dFJ;5}a;y^AindJ#ua$#;R-)?)dSm_UDy zJx%H^Y~Pm0s)OCQ>g*lsP8&VEk8$dpv+hZ~d;mV$GNyo?H5m0bq0CyUn~q^03OA&as5RHY?E4hrhKB~08^Sj$sK8vVSi@s9Fu!W? z{7^;W49KaK3q!e8ix*c_=2lgPs;eq$I0TX({ehQ6H**_BTsK|_Xq|=efqFt)brrnN zT2E}Y?W*?TuP=wS#DCTP@V!M0#NEB;n|PK#fHBi9!&DO_)o(n)^y>cGE< zm%8?!_Mz7ndcHmo>(=LignCb#;$*l{Fzu`Ja|LmWxQ6h>Xwo~fUM1(JeWsJ2knUWm zfqp4x2i6wj@qw$aO^-5IQdNno7Ua^dq;&TrJ(E=6ue^W6HJayi?*A#>4)W-wd$@mx zkzhy(EJ)ulR~|aV<%!`?sHzgbCHY^SZ_!Xhyz>3ur2lwQ`n_x_1tpcG73&{PN~1C9 zS@@sh{S_`z_@C042K6~t;3t9m{y9gM=P)p&1cHHam&r4L@;I&J>e32$JYxFS=Wz`2 zBmRr@%P*Y}xMBu=FSx60`#5>5uDYhWw5CROVjKY%+56N1noQftEHd>EXSQ@tS%ltn z0)q<vjxw`YkXyar8l%1?EqD!hpYTk+~em zB6BbAZGBt1DJdoJZ{GP99Zrk?<%S#~b#|g8qduFbiN&ffA1X_(DV6@Cxw-nZ`oi>j zR$o}BWogD)_av@vN28t2eX>5Uv0g`EH8;%NrA{KR!0RN~Vjy9^Gp{R~o928P?L5w? zXPZ=z=CThC#doIZv2jv4mZ-TIwmYfM9iZuv?8YK6)#nZ?G{sO>cHc+j0v$%TK=^dC z2Y%#YXc#XDG$ShP)@86nohepESQf_3-YgohViB~g5SwsoJCJ-=!}X|`b8Z)~H{yECOdlY%^x zw}SHS%m!JV=R4$qYBIK9SZDw$(xSkn<*ACxK_5DiIQkAMPfB?YFR;4;*GF=O$!4te z{KBE3`H^SV<_=}1b@-z8NKN`ob0bWz+r`pw`%Lp5&x_6hK`$@GI|*q!%LOeE=)TV_ z=;H!aUHds1EO5w>T6PEFkZ5fVq^MDO87;jFpPwQxIeah^!%ougzUoB+vaDTLTHT8& zwKon8gm}o9>C}Iavj=)nz*ZpcO$TU!qnu}&G`jGLOs?N43PnY({FnN+}9adsLyYiJQP0_L$vP5 znH4alNvj1sA5SKl)X(vJHqY*A`e%IiW%__QgNZh~e(DYxuLGAmN^IgAr|r{*eU42- z8)86Wx=@hG{o()0*VCCfL1L0Q4&eIS^s>4e`)k=xrtD{a5we40IXokE@Hc800dkb3dNWoT2ocU~}kkjGUDD z!|O-me(2DAdI3|fKXVvD!5`JO-0v@5bo}ApHw{A*X&lKPi^N>+qX;;CCO&S9i;6Cp zF1kIQ{N}F?PwJ;@o!iqZvcyB&+6Y%+ShZdM{5wi|#9-nq2bzMF!2Hq_bUi<-mS7KVa zKtgDyj07&xCwnX%7^qzZ=^6)GyT1VecO34}Fi@GBY%`aeZQ@IvAq7hu9x$7|YtA(+O(p&i3PX+_m~d`r#ARz@Q?9LT(^M zj|X!|$(991W#;}*oVG?kt9d`K0xhPByZ(w=atEg{_TPx2Y0rCJfdSA(e@8{d}@N>Q_ffv>icn`@xgw=$^&ZBlhg_%nJy>B)}6ZDM!vd1P|7x%bb6 zPab6MP8%IVEdhQv0FtPg0c?S}&_U$bI?9y9lmMx96l=E_ z+=6km=(V9x`Yp;`pOXA` z)a`h_jG3YdE>FdwmKgnHw=yr~z?A7G03Ig5}KABoI;#NXh->UBY3L-E6cc*sILY^Hro ze`Rs~n9mg>{b_7oN4Sq(Zm=(np<}fY&-=@&wVWHohssv=igDEzcH~qJ(@v_ zQ#71#clglHZwabu%CnuFFH8g_~01ZIL0@OCpGBex6KKFv-tVK2yZ&XV3!=Tw%pSK}0 zcSBMMx2uHj5JZcGxWg=BKE%QL2%i%}vm3!)mtLW%hjs2h$kUDQy#Rv?8IWbM%iRx9>g8@t-Pi2^QBL(qAY^YFa(DGq%j z!R1$$o^U(46fP$+8ka*e!@6Nr}}Bt-5*aJHU>G7Vo3~+&p+RB!0gPqWS^0pq|?0h zj?+b0oj3mr+r6}yB^u{Bx=KH+>61DaIZU#;%2dLW`<4d2b^DUn!RfRcM>aO(j-;Js zKs$Zr@yvl)EyYyzw#`dzcDJ|fi8kE9xZnE~U72|H!paEKu=GF81<5C;=NoiV3G-A} z+Jbq%mw>B7LQo#rq`g z{>HT=M<*>Qa`1b{e>gihUjn`3^ zxt0hg^|ZJAnY#5UNgsXZO`4>&d2g_e8cQ|)*lGQwo$%IS&EBzimtPe}+G*>NZ$$Vx zR689XD<}BSkUbn`Bkbd0r7E#oysk5KrB;G!$Be}8Qg*OR44g{At{+flQr`+h%9D4tIN)jOB%a!{19}=#_l3?0$Hd`}{kyc`dTA{xzUw#e1O6X0L z=V&axmxSc@%Q}vb{XV+Cc9o+}V+?@q$g{(jLUv>Y?`(EKUE9od2+_j3yuRogkuw1S z^_8q;TSdFK{Q?W%srsP1|A83PJ~tn7am3T@kw;Q z3$T7~a)<6)q079(AD`|3@?3Q1Sh~yJR>AyNbpMVI|Bv{+)c-(qKRNs;x=Uzd9>0GA zuzo+{4&ARqml>K&cOwy^do4YDH1->^{9n?&kWTCWi0(7}4@CFqyrby;RcnIo=>Y3D zl{<8wEV>u-$LIGFB1HFY29)@}Bg;q8EzK#ZoxSR(@9c2l{96niBK?Kshhx9G$-U*K zRAy6JXH#;ToV(}jh;+`S7k3!rqyv6tjD~$p3gh@fRHWM!zI|8c^=|^8Xm72eO_J3BpfC9rQ)eOl3zJF-=;I~h;*c9 zq)@1uzxSTc=9xSeV)l>`8GLUxh8>04j+vg=kIONzzEoq9LK=WMiGiJKI`#|FbolK! z7_$y(a%3cpl>k#qMLC>vbI`9izXF^X(;E!Y*dN{yE0C239rGQ>m%^9Hm%%7&Us2y> z6CGR~Bx{=I8ra+$0>`|5_cXq#gknPp42GTHxw$o+lhXa{!^D#TQh|Ed9D=mG~}P1*9s+N$By>Sgs&I?QM?Z+$HJ(+vW@1 z9;uxvLfQ7w#oU3C;qiV^DyfMKcY^b<Pm?=<- z|F1n_wQZ64%&#)-VbA_b=nVJpnOO1waz7e-Uf|YZ3(e#RJs{!lMDqt1UMsF!=QB*% z(vl_#wd^%;%qh#Oi!o|S8p?Oz$}HJEAhqRr#~443IB+LqmNEClF~hx3OF#zFDb~X3 z_kR1FPO84QlVdH(gG93D?S!!jV!e1qJ@&=g8TFc-0q&;(p1FV#^kqMeJU8l<&viQ4 zz-0_I93!jOq|&uFFoXV@`6vAdb9VJOCYRggMmFc;zj}0|e@2qMCT$vo`&}$^+W3NT{(!~{6N3g zTj?|qT4?r6gh*c5*%?oBu1rd=0Ny00cfY35l-@YQ7{O0(oS_3sPHzfGlwK!&C;IP^ z>5Y1JhW&YSLW`=rG;43<(495ARV2CNSn@yC?p>hUc~X_?1}6IIbH|}deM3`z@`!+w zeuUz>yZIsqG3`47)IK8steZ;q7&QWJJs3?#H&hRRY2#G|1j_ARk~)-BTN^&m`AZB2H16SoYm71F7!$0*_?gT=IC3>ktg($*Gcbw4u;V*?EKm0cI$e41k(kk=Po)fgj$Q) zhWhVLrtJVaNq)FK*v-FPB-Tb*2FY@F!AgVa*a>#Gk+t&dN|P|~Rt~^htuLvKQMYWm zKLX5MD;UBIfZyc)B9y!7m`u$d;10W)?PwI`Zk$)7ZO6rapjHjcjbJh7k!iC=vMsL* zxkDpUTAgf}ar&KB*(n|?J4HgQPnkhxA|GO?_;(j*k|(dE`m^3`51J@aZC!qfTDW@} z1#VK9pr`+tjdbq`nf7IhKGxbFg2(+(zB`X+$=f}~!o12nwf{QB@&u8_guepYB9x^FC!e-q$`XKDcfj?BSw4*K8}f0=Wx?p@ zVI=M|_Lq-Vgx4%a(#YiZ(&=3B1n5DNRmW?EbU3&?W+UL~ie7f*x>=HqEbviKyxSX7V z){YJ4@@(svV^bi42y0ZeOFZrW8-Mg`++7K-a^3{FC7)E6Vcl#j7Y_hy%hNJTX7Bh_fEzopsF&~-#=>ggp08puD| zr{}wVy{hjsTG<9;20oXZHtWs{3E`{vIobI8f6B&yL^fg37PT@H%)B4RF2f?uLOI+t>e4XpubsAnU_lMmCCOu>-&-pY<8X?2^@ow_=84w|d6!>10XH&u_=WsdERm6IJYb_0~$)s7h(T>S;$_WAPg@!Zjr zJa5TewaZiEa})EI7t-rlebLdaKX}bb%ftt}FH*NSTis)^q=k8)o2nR(o#uQ0(qip_ zm=@9MRvci|x=QI5cQsa!IrE-yAt_hRZ^&ystd|~dQ(>F#UNaMP@$lYqebJD&yP#oa zik&`HQpZ}b-3`Ti%vly}56&1J3GmZbC7AYUyrYUv*-*~zOFXar;@}!ozC`RHK6Gdl5!=>;6y%&;2OvtYrEx;)s zAMt54wuzp_*&*tVlXU*F9i2wLkQIxq(ue$&} z_~FS^mpAHecKOuCyLDis7#`TDDVMF9FLckEU5TdaC-D;S(b!LgniFPe*R2Hf?OQad zw5%jt5pq^Cv<^g7_7|9xuGRxDEDeP?ax=S(WvT3im1R}ci%UWat18bt^Gr*d?Ar=M zCDj&a0VlXuRFy1HBtPNMn$aXT7(6yc;l~^vo;_@6&FLP_{z-9IKrUWVQ5q`!rh_jl zIj*b(suuWZ$ya4kTG=HF7AzF4B^8$Z8lo*t=W;LLH2Rv-?CVPwhO)0OSLSL;L*XUa zUKVPO`r65qX#XMK7gkkQ-!LLOR9@=fhR$%sg6ztwQ1;cOJ{E|}&aGHD|Jv-+E-ejJ z-*8%Xs4APg4wl6&3ofr1FOA zOKu?dqDeB~{~MZeODgA=Rya8+tzNvavLxg(PX!@bx^dSs=K1csWO3n=($WP4DBd|U zq9hcqIp4m^m?p2HWJyiwg6z=3#r}6e!Y?gd3{NbZY>d7ad~Ue98Y_9rd@mir7gfQY zY|n(#!LRg+E3d7j8rt+kPfaN-U67#1dFKoZeu^hw;Si@i>s{YF?@qi{KFh1ZGE%eg z%CFv4!33`nz=Dz+?6Y8b_UoQ-4Lv)1=s9OOxYR!Edv;Y>_Rvw;Low(V4%Kr%JnRxr znBvsXr&l@8YO@oQ!Y}5Tz*M^r8UsPUNO^u}~WmlG7Us~-|UY<&pLP5#Z6{Tlp z1EuKfr8=dys#5Sn&v9DTe7BI3qs~4vdzNi#H&lhQD;8c`swU;N+U$j)3mp1Rvgw1% zZ7@o`1|lsqx$)}i65x)&=LiC@&R71j7nb?-dvs7#p>ojKYF4t?X3@*g1=+(cExj(h z5VL<;D9LkfZe?i*`A}KO{vmQGyE4neGVW6mLC{qxUWhg)O)->@9iEQJ254bLg-|#` z;QEE3aw|66%vp)73M5f-1k*-j4?WwJ5wJ#OV!54QOF8LZU0Pb{Gf_foDpFBN(q<&j zDoVnYP==^g-BNw~8ay>6OVyC8vQHU$_9aTC1K~G|4@P z#?@QhVSsg$XJ-(m)q350`8*y`rV6a@^)B<*E_!Ze1ai}xLW;3#(Aw=SI5QfpJv^dO zRc6~T?OHu%Y;l)t)jH8XOqn!{zID-zDPf%db(&P({l2%5@1>~zo!&PZJLYMtjA*B= z_}CMK;}$r*@b`FDnA)dzo{r6j{QWbY@y;WWX48e1E=AxykbBB3XHZz(WU$RiXH$o= z!PKahVSH--YN>Ipf>v6RYM+86*DB~s)0b~QjfHWdZO?yj3<^)a*-!ep%?0!9`35Kb zLyD<&1<$GJ1k<1x2jRup{ZwSp1N8Pz;hWhy!+iD&7$fJJp5BMLA zi66(PmobDv%i?1@{N+U>=5z;&pmc0H9C$YsRjY9~rb0u_&F&Iz9ZRpXpAUuTC>% zhd5ICq&T9P8ySinohP%#%?wk`rvCRN;7&Cy=GmQU>IH~1Hw^tM^W`M%RMmL5PDf`| zOWG=$BLnxKkecVvfPIqcfRDyL*aj(%&I%sSV$NBseRIv*%X&mc-+l4S8@`C_aXq}Z zMmRn(zjJ~zJW#e$=5dA_BH)VE9sxL`eAWCe3f(O8=D_hw|pKF-LA%r%asiKB;$@9Nu!a@jiYq$3BOte@LlKX(Ui7Ok_z z1M+UK$qq-#MesLn2cBBP$fA}rq_mG>!I)b-7T_EQy`*ML1Q#^gO4VUrR#xp4hWW`e z4Ak=5n_ee*s^@Pt%+mT{r&&&nb!f!*9PnH-HWJ-#dO0W#m|HChhSJz%S`?<~4F^Sq zMWOjD^If56Bu_#S$f=prkhi~}e(oNP!du^4yr=ctDNy@yKJ@RIKvC-57H9CydDTj*vz$?F*+EsTq<6FwE%lwE3 z&FmbQV_sn@Z1vmWlK^NpH#h(tW{C@6=9u4EfY8WU%tAK3;Nx<#=Hvff{p|GOcT8|ZlV#RHIZCP;( z51I#_V|I}=M0YejC!$$9!k`%<9ipkEWU`%R?q>35b|T1K4bKEQZNe$p*_N=&M3^V$ z-MP3~nvDAwb6prcFvK^%=s*sHkByHiUjl+zk*I@UJ~h703)P7dZurH7OUTN&jGx!u zvw5aoY}FV?nYZ&-vl0_n??t?vYkBu>`=;ex>_}SswDW3aJ_HY1BhjsLrKVL>w(Qtv zwRYY(`!6Z#z>!hfi0FJ}w(8mYit5>rzpv>}Vka!$@EQDEv9Er`-pJg&{sQt-T~LrX z(VF`4C9HT4b$gDP!o*bF3d7e;Hnt-^vOHs*3Yyuk z{1=*by5BVGo4gkY+tt+KhCOWYP}6BZ0r14b)O5Fgtfp3CGrN8zot#viM(6CaRg~k@=asYA6+trT0D(}J>Im#4eMv|JZ>9*DR|;xB$Z2A zjH(-Z0bV)CZ}qwMh>!9WHVnx4zajr&ALUaD(}oS?Nq1XA-=i4De98( zLyPBr!ZtNMlPs2vVAuvk_n ziIcVyV*P$cMW=;pqob;1H$Y7$N{BCV{z~<0$lK7=58}Q zqNg&6o&~W4J!Pc{8cM1X{9KSkbAA#Hmt333`|0NIPtZIqsf^yLtny(db|%Vk zQaDi-7cV{F!|WUF%R?3P~Tv z80!E3daEb;Tk;MDp3+Eh+v9sDvXiDGGHF|v=_bP|M~Ax^9X{M0u#~p$bwm0%%2%^ zYi52W2jwOfXog2+Wp2$H8ZJ&%2Z2E8GMQvpUh^39MF!U5-aELZzv+!$$03(ZLMNcx zDF@d$ViQD4k#&wgY=2rb%uCP!aOw$1Sj-+9yZ+aB+a|#Ui*o|kiNuR23ZDs^2+@#J zBFMbJpj0g0WCy1$zkwMa`1Z-sgbtzkP_{SX9fA#BPrQzIzvj?4ip&E%y*FaWdlf@6 z-ubSNHt;!xy`?H^{W%_89U1Vr9g^}hD0 ztSv~P5Z!M-#yTKjxH$HoD|!UC6pf5y>;Fnpc*B(`W1nB%9Ur$NwF@A)<(2L4vu591 zmbN?cjF7SB&wgD-+1o$LDqHneda=&3Re$3ab#%<04qazjx;~1$=FxSM=z7hk3rc%i zkk2Ep3#5Q!G0Yb#_18U^H0z36=~)GEr|CNZ~w4L)ARtfTkS1jvMsMmdCD^cvM~!m?E-fe*ilrEP@7LNKv}%|X zu$Vgr`RYo-@&GaC@svhGTvdzc<~7= z@vxqvDFo3hntqEK*}$}&_x=X&ZO1T10k-_oYcAE_QtiM?s)J_3D-z7zr!MF zH;ecvQv3pyq(hK9lh)7ggM(7oJ<#hd=q?R{Gc9%PPM)K{O$lG8X#*$2?Pi(B4tH{?I*$D~?JsNVxjp)mELtrWML3q>p@ z3~u(#8@3P*G;UHh&+*b2FGXKLsNJSkY2-IX^0F+)%>Al2DE(gi21^4BGH8eW>^#AuF6vfWhig8dJJ$F_HA${K-d_(v^| zYk*oF3TdgtzN<4DGtzmM-g*96XW4M!nNn0#Q0T%bZuIC;zK%1wsKEdJ95xLIx4OO@ z7hcb2B|UrVdI~?%zR3GlYZ`i%sHmu#Us6$CRTJXb>IOQSB1lWWZgX46z3zbeFLTM?pl@yz9_AVr^jML*Gb)ex4SS^eU&E-GG#sC4rep$w=p# zc<|N-^<`Q;%|+fJ_iGR<=Z5>;6QuVu``0kwJ370(jDCb$1ezKKjEuZARTMA&DS>>x z54pkwP2GyU_Vc~&=X)dJy(l1Q>=84kI^SRHe$VJR|A09|-@i09Ex#Q}ZVfLG3R&0L}QQL@0N?E?qzQ}i!%&6 zb-qdaPMlbfij3yXJb;tBW31%=xTbmKyr=o)(`(avmvh_mF!C$YM zew6*#e}u-=w)F~~P}`OkKC^b*_j-kgfwF1dJxH1>q&^%^V4v_Y3an7zg$hi+a7y@r z2qesL4C)hdq))HJb1$TllsVt_tke3jaF0K42b;5mAXaf!gPrlwHqbOU7Tj`aDz>S? zEmKq2(Gc8n;@Y_fQ4Y87Lq&Wg?U_jH_7AdxTejQx;)7|=q)`&?eBb9FR{2f+U-7W& zKIp})&@O*i9^#Wx>P(bs(IR18K4;nWxM%=2=q8nJEKn)zX79|3w5$LC#a<5ijN|h$7FPv+FBjo3_4gb79 zYcR3A$M^tsWjQMgZK;o@urK2Dr0PUfI>D_<)4mtC-qw3n3sjY$O{%(EzOH?@(fL3&?L4PGmN4H=B@N_|GgP?xS7Q2t%`kvtne1Q_R`F3>ZA6P!l(T2YZ*8e< z!>;=I;hDG%G%b0bFo)W-jwsVcTL||gB*pe7qdpr&^v5Z&Js@EGz^MU~nW|^q$^ksl0`3>!2oG?m3&^Q& zkkF^@P)ax*&&}z|r8SXUgD2@k)mln|S}BokU=BVgLfq-fk9dj3+J6qu-(@1=6IYxA zC%#MPIN!A&QW+%c23jK%jKYU-Q8tpfj=Zhny}+$QzL<^D7x z%~Y0>tkJZ&kZm*(Y9Qx3n`0Ce7sG5WzO7t%>jge-ZoR?T zFp^no>aBL&j+GNTZ86lPFuK{Juu)b(B-)Z1m^dZ;MWc)%8j9a7+X*)~@L)>#(@}3@ zrmDQRT~~LoNAR}4C-SlvG-ieE$2yygUMgr)p-XI)%4CJ9Z0Dr8?{XT(d92E)h&u!` zM%m13RS{2Rc0SU+3bmhZ;kMhsj3?!FGCM7+56z|PR)N>ot!NJ{pBnjOc({FfCFOZp7&EUTZkVqeZh;ScEFb0V)^G<^5+tceYi^2iYJ zboock>dBZM>J#_~7vRbYvaMA%P?6P~8rV@KsJY?b*Q2vlV}r+p);MRE^s1 z^9pI!Q(ZhatoYMb70)LRT;&D)+6!pOiw9cr4h4{B;f;}K8gm!Bnc*1tcV_~FJy+d6 zViu#U{@AiQTz~eBM0GaB|K|PrP~M@oF|>vF`FV$G&f?+F+PwJ8Sq&d zKegDu;b9*qe8(JyeGb^Y5si)Rpo{)2?@zV36xLR*B`UH!}%jfxt}X9*u?WfjE<>Cot!0f2uEEC70~D==_m(pJUyQ zeVik$b5_&YfykjM{uaE338{9e^sdjpi0sw@xade3W*%)2eJx9M^bh(IJBhz&RMeDV z@wGU8&C^lQnM2TXnzx%&LIyYiX`E!j+dyFJCk+|IfzyKmp*|oTt8&8vZ5NsOMno4z^<*Y!`s( zxVC;AfPGv}TQ6?M=Gf<_tq8ti$bd+Q<8HiZq2QLZoU!d3Qz)J+qY`lVEIM3o0dY=Q z-?h`S;&IrNdr5dFshgqHnz1H$>#Lfm0Q4gJ;W2b}bvv@{q*6l;LqH8M_ zS5_^#uDT`^UV8nq8@@mC>~ltqKKH!ujQQ^Hvt*}T`%7W^>fc)8mE-@$7g69rV7dAh z72Z%ezr4E2aYMd-|9?p10P(Vi9?kvh{K!lJ_cE^4Tv;%=%%Kome_?c=^pHn}$UM$4{x2zP-SI{1Ca68%$wtIMS=` zi<}kR>nHs%J)WxXu#Zu`sdwwKsS^d4My4hLo`=9m?SEz);V&zP1-`>)AMh zc+EW5?HJ*o(MNWuL{A_H3JPb&2QGVeqIac2 zLTr(clmqCVmHuULCwOob9-P&8wBb!1(=osDIwp!|>CYtJx|-B|nx1rq$)k^p*}~3z z2wHwYeBdyU>Gcs_WkF#^u`=Mx%M(Bf9&;-AIRE7*$Vq1~B3lUgi!PjTDM-eFB;oTR z5uS5cI1Hy>#Z;+b#hw{1*XKCCbQ<#Zm_@WmmR$A}FuzqWYbI{y$MCr$l`#sT%t&)a zA^xSsy@t76Hl4`aOoxU^O3R**yMBht;UdwtoN&&@3vL;>jIk1DoMhH@9v8ghnNtSd zz&nFZcYla7dnwd+yA&6EJPx72#7wcqge` zVN=1!-{f#Mui5rBJ}{FzwzQ<(3s1frSB^{cgdJ}MSRL{|Wvmj7ZTm4i{|HkSPw;)V zM(zF)@AYrIY8;9)fHP}3oI5mNXWkxZE<5ucmm$B#YHi2y;)Lz-!_w-*tOamXcWY#) zY{QCM>x&!f^PX(TTaA^*Zl>>*nH`L^5E|aFMx_VzBQCVY z>dIO(v#SRiey>>fBVXLyO8%&(jt>9&U6MJi^bw53y;;6zG&17Lc#!)!=bn3J(xp06 zx8ns@cej4A(A{5f6LHk{TYlqJ6dG3nDRA`l3+6p41MAc$VBixUI9o-*P&jmrwHW=D zl*22wrBI)r$|h07A=4DUryQY_siFVnX;H74swNeTHwvt9y;@HVV7`-am>#G->%mLr z`-yWCiAUP*G=IE1sbMuhoS*$SHYodVu2=S*CdCq^#a@X9@Sy+RpdpA0b>73vBJhC2B*dWW^H!7T3(DSfBIj9Ag z?(Ze|yteWzCVA1m;V|+xhf0R?5#k5Yu+CxyW;~oHMG3$P^x`AE_B__ zJfr%wGjD%3Fsetz#;DF{%7N3&XYsfQ=_=dI4l_^*Fi&GeQHFiV&B7VTAh%K})$mEG zfNj(!Ieh3ei>W=f-8p%UTt1lP!!?>hJB&fH5JS>n>)?s;@>^jO3l`31cIs=Nrg^Yi z0owZMfBjto{b{q|C2eeK?KOmuKEWbfD$aXMF^-q4PC@r4E z4c9s~rWJ-EIP2%`L*hDpI(Cazx#=>KM32|0!{Ukd+{AH|b=|V`)G)qyIe%*qWT{bm zWI3_NeMRhHL|b%}YKLE{KVGL&^@08g=~C-1q0f%S!isE15dO=vT6T0TmJkZvBDtCB zv~3eLT%GMXPk7}bd!&|b(yN?_$Uf3Jrx9%$!0hlYm-$D1HPHX6Zu~|t1%hkVpbWU5 zw{(*>W+lt1q*Y+{u{>3u#`2sg&r9$pdNXQMTP)JB2 zwQk5|3Mo>^IyYpBLe$%qZ*)V>Q%Jf(9&$s5C?rE6kGmoL6|!6*Pr4ymTfa~0fB6nK z8_S0U2c%Uj)$=M++|ko|5*qe4b2q}>hqr9u`cq|*(#Lm{dU<$*?r z8#gONsziCF8?r

cYwgxgl37q(C9rZpbu+OjF1(H{^VUsQV}%>4pqbNRC3rxFN?X zL|S(FBsU~oA*&TK%?Le{wC4sb>jsY2=%WUFMvR(XWe*(2fPEb zexVjqJKnaN@QU&QATaIv`hNSh{suy&Hu24RDKK{{)=%FJT%$mr1UGQWe@}&4oHZ3> zUhZIuJ=U;$yxT?+^aaIWYM#@KS2Nojja|fmC+X0??-DIJ(qp}q|B7TLDes``Yg+Q3 zWxl}mHRoLAoj5kDaKcpVJu3(fTy+(1lP68BDJ<2}ePDh?RZVG4)%nmX&0-7cd{-TWzBH)4Q~4WyQMl{^HW_Fs=E3H zCqVgg-@}WqF17oUmCw@Zr5=dQw|!qyRV`+_I6XcnCGGMLlvS6O`Y#TgU~Js=HRTJJ zoOkAe3NlW=?Np5UY(bNJe~4P_?)2)TI^;_E6`X!}U($Q{yt?t5Yz6PXS@#0-J-eoU zpI++5J9WRmTbaM*L@Cg(lD{P#C*^;#l`a~4f-z3pM~|d9KD|WAUlNpbTTUGh_j2H0 zTbZP59{?yC`@TMAsWZ|%u4#gb!2a|+FX>%@(|I4jeZk_Kubo$uAMw5xi+X)+Mbn6- zPad;)+URa8uyFS{JV;5t0P560#?=+`uT>RI4GiP!Ow=e{!p5)Gxq4bWxf~MZrl5V} zhry%-GA)dIzSsIaB#?%$>Z+=13vD&K6h8=6l@_gxf_4+%Z_1@tT}lJ2Sjy(^iKW*p ztPCcHla;w6Xp+3A=Nc$$lvvApv!QE!d=hDO5bXH?hzK{$!7zm_gbT6d2l~(s~ z4{!{0cXFHz>x86sn^{s3F6~|uq6u6R*aX+b4RJQoocSd9gBJg!l28fm4cONmNIepJ z%F#HS@2BZ|CryWC4*LQrM`Ez)Mw*ukKGUYh)`Eqhs_H=cQJ_7<8EEY>v8qbKFSYx` za9J67EvT~l&I4)FN-KLzWefT>5UUIYbn#P_TECAp()tuRluRyJys+X1TMtqJ*h^gZ z!pT=nsJub9sRg5*+j&06BhA@=;QLVYi+^~o z%y&7H;62VP*oWNufO87CR}gjw&%3#%`~_I95Z6Yo3}g6rV}tV3|^ z=34)Ea6?nzAKsY&sxhkPtKItx*Ak;EIW{HG`_htyNZMsm22|hI0ii1yDmBn2 zzhv1odUjgMHKB6bE`V8o1YBAm3ph!Vi6xZ_u3xyo0o?$Yu4I(y7W7i|fWtsV_Qp3R z$Z$r#T3y`&nPBz7l$A|j)0GU?JB|8K!5Tza&O=L5UQwBD}6tg)RS{ObNtwB?I>gWQr-|BDWkb zCBoSZh^}O?-hqt5P}P#j6(!d^w2ewelDd*XG6NZxR60UCgY2mvJF+k96Ue;8_8^Y* zodOspsyaIHFid>|eJ`m@7P89#%mzqTa+1M7&r2#@={owE32@W-?csS+H1V#`GkMRT znvbT2e%*T7|9{%7H1ZtEOOi-;O;6~)*S+s^?+4s_yL<0&@15?w%e@ESPCutJNNVHa zBWGi%kEuxt7Q3&Y`5%{P=si4Y;!t#0Ib{WU*zcznxOB#$^)QHjbT>+&0HxN=L!5jZ z2Gc*#$HEk&4@;F59C?iEA`AM}>N>`SD=4X{xxT7;fkZ+pFuIcA22k~trrSaSfc*s! zUCCerU388@Ra&jSv0G{&t}7YtST_sm4w-k^v15WLvcK{_Qs=mmf4|^;1ROWpzrH>$ z>oxJPKI9?Z)rX|_nHZRN49{QFhg9^R_rZa2(B;dLmCH63^a2M z=snTZmF0O!<&sIxbkB0{gWUUI_nz(Ehj0%T73CHrRjo*~c-7;`U@YY^99u52!6Ow=DLZ27u( zM7VvI#e%}K-TM&tKFqz3aPK4C`)Kz*#=UFHyS~qH?~~m7H1}TM-izG(Z1;Wz_g?N9 zOz51nKk=?dQjmDN3CzbNs?RZ2TV*g9*Ogp20R)z#*oqkSPr8yJ&`vHcy}=VPf`Y`j zu4E`ifyvSe>f^eSLDB*l$yi`uTvswkdZ0({!X^0Ps!=-G#Og|h=oSd(qFpR3!}cRo zD%Wj-g!yq@$&jcb1=S0e0tNXVAf*%6l?>P;&^rmG&{1}AUCB@xfnEu80-|8!x{`r< z2GR;9&sHqO9oLl{+bht6*fN)93OueW8KQS!Kv6ZvYbDX+QJw>+u4M2`>|l-nSK3su zxUOW-K7sB+nma)N)V;W_WPrYbUJif~3;;9*0A0yI!9cH>rPT||ZV;$26#<|t87M2z zx3F+ZZh46$lKKb%&IU+VGGM=CzzNmYoGrjB0MeBV*#8K?bJmY}enKGmx9N!Y^}Npm z;9=Ur*Xck<%8y~R``KLoPsk5DWSm}AsXkKl_3#5keJ8CpsfBV*TILIhJn6Y0>0NpK z9`A#>|2HzxkzE?5il^!BJ;S|cy7vL@eGqqNu!sjpTop!|m9{&6bb>_CCQx-x2$k+0 zZtc1{th^+lN~)Q!o5Gx+2q593wCEHM$m@-u>Zp06)Ijg41y;u|E16%a9wrMYUCH$$ zEzra5SCkmJI!er?JK|}&t4xvMqvTw-gm{t-n0JK2-HTb4!~}}7x@ARnBCK+a$6ARw z!UdMKG4emX%KMZVz8hck<{B-U7cd>dzt*O1%%eB+Tz|_$Aa1#3Eq?<$Z`ncaG!@-& z%WB@uWjA0Ham!}KwcPRx=XRfStJjSMzFXG0_x0}m4)?yny>H~+a?2+Ea=YKTJ>cAa z>D(BB1yWjWd001Ld>kTlZ{)u7mM8hEk#fr|&3f`DH*Y3m(b)banw4}J^K`|LjIq94 zS;aRUL|JRI7Foq*Mr^ht%Q7yhiwBkua$nyt<8$$k(Yo+ZobY(qIN@d|0iGe=|MKh_ z;!Oc3<_6J2&xN{kWwd2Brb1z~QMMt`QO%A`AWMTJyeqgRH@&X2SMUb~z{H2F`R+>- z0;OD=xmvi|xK7-S{>4?wwVrDaSDb77%baMr zXs|#t7M<=9=d~(Z zk7|pi_m`kKPH1``O)~ar-@4{de2z>au?20k%{ZJDc`j0`=8fI@z8n?+OeMBmuHS#B z0nE<0xb9$J`C#@H+5j^SIBVOO3n+0o-gjcuY;>XteG2Ot{@xMK!4oT6^#}`=^35vl zT3hJ#swa7H=~O<1H|q$x)3I`|S_X7J=fxu1o~CzEgO^jHQE%5h<&b}R?Ne4$Y&Jap}3@a?X|NMFT-utoCHe4b6Opw;aR28OE1vpmEivL)W$9Z1LiG-__$~Y!$!1pNmjLtZv38gdZ@U1*C*kn` zT3hN|=~!RqiqATUPq+yTtySZ`_Kp;5x5jq!1x9LN$*oNH!j3r`Im00sn>yAIabK zXgV;5&};mTc_e^9nUg@{o9K<^B^o=A&eJ{g84A@ldT>v+c@^a&-8em;&-GRO90U)< z&n)iZXFgNM&a&!ZJjusm(c?+s5j^=F{7UfT+Lv9PTpCo9aoE^{{7Ln3nR6iuM@!vi z0s<{{3K#Q!2E2H*01A?M^h27Mc+?G;x6lfF9u)y79(_@j#G@=wbN)s7kv#JF&`>Ze zQfr&iySpXF8w!ft_s{IRbH>!`aFyiVaatJLEvIi+#JY z-7YSl%zBB#Kb(*YgI6Lry){KWw^oKQ`)+%Bi7Fm_L?SwLqB&*^beT4b23FE z!+J1keg$V_p1B2<%%s^M;G-ss(y0%3jEaw4(GhHr4$JPk;h&FvOsdh!?h$+E#E2CQ zb&4#AM8sE&zQL!xG;dftxo2dyOXtY8=i&oyLp$`60&(M^T@YU|*6=FUIcY1}+2xl4 zQT(;yx$FOhe9BuMlN7p}P;`JK=TA5>vd2vh@>9;> z3z@Twu_<3^Q`UC=!Wr61zh|rDaZ;M@K2v8Ob8RBE7JpZoIdeN~?9{&Xon|JxMZk{9 za4ii)hNwE#ZAP}A{14pZx6>)-^h!Dwu+{=1{lpYO0IRuBXT}sLT(q zmAL6LH*=519-@D1;{-dWy;;3NewG#m*leRyqaZXx8VS+L`lQ1=zj(*XEhWTOs`V-( zv|IK92XEC_chuYF`-n>fh7#7Hnw@f$P;^+sYi~$DnPW>=c8i4Dhkt^8LS60pgYBl^ z;EN`7>7jVqyGeE6ys>lJSDZ~iZKDzigzq*3NJZ`WfVqgL(>YC-I)2m5z&N6G8az~0 ze6dNA!rY+Bme<*BH7}}szoOIj*%5fxY4w?x+9D~IyI8zxI+ z9Sbe?AiFV&Szc;mK7$=>C34Q+{E;v-49Q8t5bl+zir_oTe$^}{9)WM5jrpbUxu1yh zwc9p?fIde6JO#i}%1KI( zK)~}CCOc(kzqWOTZFj>>!rZ~_A=xVKjECx;vfK=x$fkdZUt2=>ed=^4hVG=V_R8xt z7dUis#LgN8w+wQik|-YvVHDWX?ny1{V$xO1`m{_{>BOs?s-&`}VI^b;d&|3Y3K4ed z#pSOiX#I>T%fauR)*FRWY&l-n`fX}haLY*hHzx&$CTVnwgyf`>8Qh?xv8z1oneF?s z(%^tQs(Z_l(`CvmIqR;p@y^JglN{eo=!$>VioaqWt~1wz&#^h%Jra`AH%GqBU> zeOUIK@Y0jedaE~_=CC{%cH+84Qf9dxXD zB{VphjIp~{xWfBF3GeS}W5rFQYPVT&6zsL|6k#~d?Q># zoIh$=$qW8(*#PYx#O06anZyftet9G{(aP+2M$fVuNYq~{OqcXgw+4S7-nsfmi}@El zu&VLa^@M59YZd@H(pSh~+hrrYw0v(KF~#~f#5PP2;p2~x^;eZEaPmQ|g`h-(Z!BDdQh z%QnCD&!)DS-bg4qmxzt0XNA(N>ET^Tcs@p*Kf}W#?f~NBuv;g0s{P7`5#Ph0EI%{d z|KeokeAIzxY~E#VAvlVZJYqPGtbCpqY+mP1J$TH@lrt|WIdQ7A%lD(dI|}+`7n(F8 ztsD{V=tYllR0>la(p{|b6g7RsC>??dZyntm#ZChB_`iBZIO=Vy%w@#AKJDA^!f7pO zh!QKj)u^rLFPB2aCLsyYLG)gB(oAg-p}v{w?sFy^{3_;bG=pet@*FEgqpF}*ri&KO zx!4^(DGhZphBF7|al&c%G=DmYE$3DvOEW)_W>?(h!VQwvkvi(L`p2wF z4d;I|=43Dg4@lV^AMQhb;|3Qcjoz=rA0j^UH;*Su?{*X!iA5-=uR1i1;6IN?P3++R3{jrA> z0K51Sy2`qEvsx{(vn6jo6KDF6UZW-NKyQ3!+A?X}4@#5HW@r4zu$0rjmDiJA;I%#C zd^|a`VRBaFc88~QtB`Xq-0;ijSrGX9(e42t8oPHE+~SBEYOv$yfpoPRZDrai++CaO zZ0tzRnp%)8s~!$)Dy^>O6sDmI&d(l-VSnMw8C0^ji^^{*OV4p8-U>E*%K_}&N{b90 zqBAX00xP?1(=8IUd-xNwGWq-#j4T~F*(h4fefK%G^G$xZjvm(hF`6rlQ);s}4mw$3 zwN?onOSN(L0nbe`>)D!AqL z`w1iA8Gmv5)vh__gg^3VSHlKSHknObAmjb8or@n4rq+DvT;+Nh%yNAi95r|6m0=Q< zH^6#P`Qr~gD&bFg2D!a(x_{77*pH-1NZcU1=*H}*%#pgB>)~o>%Yj7{n=yPIjeS@o zYW&E%h!m+0(pg7if3lH|DkQdAf z97^;Yo9JwtsNCY|JZHy;N<-l=vXn~cJAG>+yom4*alPz>Gq-2bfl~j=yq@VKM$hyK zt9G;_OIXWkjcoUp{uVwX<%I>RZiz77QX04>gmJ*p@R(-a8Kll0{F_yGCR0&rmyv zcq0|+jMo<3z3cR8u2aqNA00;jCI}P#htIs&Huzf1r+aA|&Un@{sdhvo;kr9Aey zPxJO$9hx=65~JSDjJ#y0SALgF|0Ku|{atiQ(by?R(eJboPne!?krk#X^-Cm4nKSyp zYcq$#eLU5|rFw9mz3;)TT`%dkcD;IP+osfl4__y%zkP@D;H+GwZ)M^wdFAQ@G+I*L zNc$|SyRitDDDFzx%zvVYgVUYOS**W|9t9YE7CGvb92Gl-i7PI)%PPa#(&oaNZSdn-a=a$Ka7BzrUzG_ zqnDHPGAy|IV@jgVqy%r?#={xM=$qBj;_FPe;A$09tSg;}lWoN7HXoMhF_%Y!W1al_Y=) z3X)*J@FCe1EFZ=$(WIBHw1S_s)mB^D(ux&nSSgK$2C7uCqNO$3v|>B!Vof#GDAByn zbLQT=cLQ4A|L^_%7jEY3%$YN1&U~Ml>6+wf{&14(5q!VEw;SId@x6_2P`d!1?7nxa z20jR2*GD+tg>NLjarlbxRpDERZzaAad=KOMIlkxcO{^g0Q{C&gAd`c3Sr}((j3fUu z$@LbX{*A8>Ut0Gh*9d%<88gs^q`Q!Bl8n@{D>Y;YL9$+e3u@Zw8uPpG|(fYJsRk-j2^!OA@;?Z6-GRXc8dMJ9tw8tTO{Fxqq)gE2+Xs5>?v`5M@csxsw7VVKm zk08{;#q*hg%a*Y_~iN3@`ki$sXj8z zb*AC)_w#A%dU=qzx@PGjybz@4FTBTuadey3 zVCw~MQZMr?!E4=~Wy|r*E>)FvJnVkDrZ2Bqp`Y(vDX$ve!sBsfTxeW4!ub^MqNVoJ z)+P+!IgaC)U$+7WXYc$HICEkPD$FGD+VWBybC>z9i4VF!cpthRr%E+dW3VuN?Uy;`MFL1=GUa@TXav(PELEt0X_z&^L{R+&J2e1{(76w+%$8+5a z=7Yur*!j2Us{#Zz1F+_iZsHLno?Gtp@L~l72@K_S+A@zmi|nai4kcq}(FzPze$BE& zwk!^r6q@gGvHr$kSbmA&9)xQi@*r{Q`y@tcrzaB9{9TgB*~lM=93qKlX6#t$Hy1o z#5mf4dJ*E9CCdYM>NH8aO&@NH01t52h7O~CyB&rs@j-ji!8WXDQT=V6+k?vj^F1{< zQCm}OmJ#!SQ=7=dwBicglH!a)HN{ZkehEKT)GS#B;@O_f57e5ltb>+J*9UJgn``7D zxHMR=MO$!Q3bLw9BD>U4x%JcR^Ov(or45rflqD+;ffwOS{UWs3-!${V zeGTN%6tFlyg#V1N5VsMSWjvB}LipzgaX$x6;3JhgYCNMoEC=DY1D5k@o%o%@Tf#ypBT_tZ+g9ZFT9g%#M(n^r&xPw zeO;_B4Di&8u(scm3@h;BbR@<&`aap;PwcPx-llnw44BJu`4Ww}Cw0VL13!Xw4fDdz zKlWMEwszkqTw`l*5aMBLXpwZ}noI4Q1em1guRxjrlA0u5^7WV?;niaB54DgdcpU~~ zkBCBu`Uz-{$*ou2bUp~Dp5lsT55WA0W;Bth5y_ce{ws9OYw-l#+M#OAWQ?@NNcz1E z`GW#O)nfW&Y9H+KCdu^iZ%Ds1FerKuCQ&~`itJ}t>9d`MW#6S7=>=VUWoh0x?#e0S zHN3#q?n;7E7JQ!`pfc!>XRoo%`6SA(FNjU$p1$ow%NGFNP^XD6)q(m1HS^8_P~V#R z|1qw;8el2s_8ApNDh)Bq7Mlor;y@1g81#>=K$f)k8u1Y@T^vdP4F z+m~Rxz`}S~mBJc%NZ=1YJx~pi5bV8os0T_}z8#X**@=P;^381t_a@&bb{Sj?G|nQ* zM9bqSqPr!P4yg#L$H&Yb)sC1ru>T7a`@g97u{T&)ScbLqCV5|C(ja^&AC!&b4G!EX z%2k>RlC6T^ji*p4vI+yWxO*VObS>^4B#l)ik^;~mX|77NV_ySXGfD$OtTMxc;;hBp zW-U%Z`gCz`8K%hwRM+Q_+353#PqEI&s+0N|eV)=jtiaH2X#N&ch*scFB3g>y3DH&) z$zlsF+l3kQnQfyT_{ILf@SFjGoG-u@j*VISk9i_A9di7B;N)E3&In(B##mZT1sMZMGS^o9FVv(B`=Z@yxyG*FbHv(^Q?8$HOs!9VHp-Q6phehyy2CLfo)Nx+ts? zl7F&xK7>zOzNYTkfUS!??0{XtjBt4;Glw}dH^Hhp!7?=*#DO*HyAN?GJTOjFFMHM7 zj}W2*D_AZRS>L$6oowW5Hy}xClKm6{qQ&qHR~>G72m$J65(!tUtCxztB+@rEHq6(Z zsH%wy`=TxfsfRSFPjc(2>JUj?h(3;_{_{a0_55(vK|04VRa`UN7THQ7wjgQIbYs|R zovW+Ec%2c>CkTo)5yBlp|FO^4O^FMyh4dV7?>tjgkQ;JVUx~y9FCHhs%3aG7##bS&A%$ zt9GmRzRj%d=DIonZ8=*l3G7yXSJ-30u_a$EgH**K)qqNdTfbU%>2>L zX!=~iW#VQSKMRi4JPCb($l-R%A@t0)H<#~dE^lcr-`!je@#6pq>*3(suRuLzZpjc! z=E5PihLI+Cs3tD4f86k#DTPl0H6q!|^r4;<_lDC^pSYN7zV>?wGY@6wBkteqQyYTh z%@K`KjhDQlr;-|*j5~DOeS3)z^>|wrcgS?%n&89jz7EJ^tG@bo z6KU&cAnwj^NLuo@(YNp6_Hwil)KkP>aFCho-msM3lGMOG=s{d)Fi+1J;9h^P*xl>@ z!MIZh50bC6H@ z=K7m;i7;*x<{q+jsMv=w3kPKe6({zo0Uv?9S9rp$&!60UZwiDod@q-h)jXzoFD~=I zS|zOQ_ol;&K;ANWEC$Cd5_eGCz!DK9ezgFJj!o ze5g~$*avlgh{%Y*^D!ZYHLSw@?t`c?k*Rk!c|Pp4#Ys3JW}R-sxu~~*s!cuh2RTQB zy+&*r8qY}db%>s3o+Jtk)=CsPP@>?b^Cum$?TB_oUf0rkY>QH@b|ds0CzP(>s9NOh zE}gpn@rF)xEI6$z8=SBIRT3TpW%uY?WIC#;sO|+IQIQ6qQthY_Jl2H(^>d+thY1>xuak&Yt`!%nEq^~$NcNw{$s{T>Pb6E1GXZt!WA&Y7vA z%)Om(h|^Q!erZD14ff%F2Y)sKpUs~` zSCKz&pgNfRvGf4CyB z6(wjRT9Xq<&}|p@lc3q4H9aJIbONs;Xd?{SOU4T7M+2;VQG8Q%u>1G!o z7>Ce!!fsWkgFC+hpnXVpCk6{`(H1lV;7)>$n|Z!apJ$H$#q*Sol6;DZfMGv{Nrpwz zY=%*1S3Qcuxp+(va5Lc zJHp(vYYzfDv)TdE9@ZD4+SDpDq*u(I+7w(KRhx-FoE@@{Q)dB;N6++esnBz5m|cPL z+H3&zJwsQmM1F?NG&>j$Nz^-(cV8!lBg*vv`FzC0s&sf8!*MiCV~sFH(+&>%ca_n7 zKU;hFV#Z_ZFBfAP*D@QSY6&=38XSQMgk!vM@;bCd-3_aTTrLU~%fH;EcQs~o7I4CP^#D|VKAV&uLQ}cpEwO^Hz>~wLpvj!m#QBF zpe_0&I*H@-9&bcAxFF-nxu%_Qywj&m^LZ;hu-f62AHs4_<>75pV=o(H^}`^=))D7g zKK4#l-8p)aUJ?DKth<-K3y1-H;X0F-IRp-4)rYmA;G(e>!TN z*<6z+$oH_<*=wN<&^j_!tC)tq>V8>jJcLmMx)Qzazs6RKh z*-0R_6s1x)sV3)u{skCIpT^P^N2}IrX%m;@qBc_(((dEk>zlzgo`Ya5eHsdnJZ!dJ z`)M8m0Zx~(SEu@SHX+3oT9t}*34PYUwK(`B#{RE?crbZ zEG#CiN7XXuq8sH$L<{agj*K*=8)l-CfR|Y~#tzORNsfg+1~E>~{t6tzs)YI;#tmry zN12?}OAs4dSgD}9*uth$bQrC%=y?|*QEMOI;S12P6sJataMhdI0!-oJUtOr>8jbWv(4@UCNGw^In`oHx=QrWIJ#`1Sw z2+Z-Z{D&iIO0M)eJEU)wN<4smWqytMOvysLRF7RinhrQzON!RA-AhTb(NA z95ocCIU6_))H|3VvjMxk3VX|pnPqA$qj~+tOux#4)xER0w8>ivBfZI+9`X29qjhTh&4`MAcW)`VE zV$C*YW~*n!nq$n&QCr2DYs}15-xq71F*8qn4_36Aq}e#U5Bh%ig}rH!EZpj+f(W$r zxn++QdvNAXuRX~P*Xhuaj6gf;aGxe`#;5w`9lTk_#MDzs+`8(aa{|~wrKQX zh%*|t8+pD#twi!rL{!U6^H$Tm*)(Ut#CVSMs;Lh9H9B0Uz1Ts=O%D4EhrQTgAMdb_ zao9(S-O`P;>Y1bwDartUsssS?jMQcCbk-v569xkw+zDtYDQMnA0))TN3D3T`zP|2e z=w;NvDr?+e)w2N9tm+%oz`N{Ec|2gwtJIy3ImQ9I0oWG(IclT6&%W=%{XRTz*P4FT zWTKNF?Q0xvdM<@~Im}kvqV`pHyKOtyy2FvZId2BbGRlcUM4pgui5oP@gMgzZ-T!TxY z27~=;Ld-b<#9&;Bh#T-1)zlZHPLfLp5ibEpiYujP*#c4J;RR{6K*Enr6@Cr;hPZ~# zn7{Pa8hL|)Ky?7%=L8z+N)aI6(rPjb%sK7`LtKtr4iy9IQa|wRxQhmHIkKgk;sTZe zfberBG|V+*YE8}ZNp;wZCd@>H^K-(Sf;(pATKvm$b4g7h!udI2a4E8k<+$-p7!=!a zH!7x?FxDk=DAMC@HN=&?f~U&7?G(j*-2IlPT6mxX!?Yj*$K7XmnrjGAOu7|~3YqK& z47i_ASm`K8?}_R3Z2K6W6>GfSut=Ey6n-b<5^gS3o;}VAUr8 zJJU6^YPkip0~gL_o&YGrl}!B=N5A&?dD8jn6{^~vKHgU+$41gJ(ZiMGSk5GI&VjS_ zWNavZcn(8z;as&B&L88&3*1q(GE?6@hb68E8KQp3J6=jMwIc$@zLKLxLZB6ak9QXHjfikM|;l9*ZQDlxOwWn$(>))06V9PK3qN$n*Qfp&JJ ziJlAK$$oeq|5Rh`4HQ@_V}p_7{(T`r**0Qe>f-J_?a5--d--&8?#9^$?IU0>U-r#K zb#?Q{=8ehqWG`5@1ZpFTpzJikV;wHWr+ttefAog`*u}ihhMbVUZ=@1M!S4&VA zm%X+k2$Kd3$#>oiIq>2!MR1rH0A~oC!rr}V030UBIE|rR&4$&BS^!9Dh|DF#p{j98(3Cck3n5%4A zvCjVT<`1lvEc3a~f}zEk)?v9~V_J$aGnvz$bcgp?Ir1|cSLq}` zXM~F}s!CRyKu)+ABc&A84C^yk3cBHDh=#=zJyw;aSthj?eCoq-x7Sdha{&WLLnAtd zj0ev%G^&5oF&qp6+3|y^Crh-85RGTzwftdxblom0(Q(aYO7PR`?k(>{8^Q~X4kF_a zrl&_)MbPeh#kH^4&v|dSxKcHuN5vnCc-Q_TR&C-@Y;BltS;bwGX~a-23kumS@o zoIVfYY(}>+GhMxf_=v^9=bvb;YNgoK<1mZiYmFR0vg#t{S=rdO^CDh|`KiC=@=>B1Alka5=q9=~@y^P6xaekzOG_OEijo&-)$A-0k z#6sjQg&>xP2<*IuwJ*B@*P+26)*0Yai+b)xP*dK5y`MJlx6= z_U$mHw@q)QoFoKoi=&ENW+K=E1Ze`jMI-P%rq{b(lhhxJ zN8!Z))3V6+Ijm0U#^I@rZ{oeAeb|}9FSPbBj{X2BvWmnXK$(ThA2O=;5+3ym75yQi zcm@G|zP(d}FG~zCWs^~UII^CR-eJL)Z;Gecu&w~=Q@b8QVBAyI#|n9{cnAEUffV*N zX`0U`&Az5^)dp4YEmYa^4PoELNGnk{3F?gwED+4VjL^DLSD>t6?Mtp;ao-)K8si;h z;l?$nX&UK^j4AGLRf9TmH}N*$VcSS2@#YHN^>MtMuMhsFEMsQYCg+gAqqS);$r@Q{ zyc1DkC&P(0SZ%_@8W%-GG6A7JLP+59+H8q+*vy^^H?ATv?D^D0CKskVo?`5Ra3dOb zkaal1sA>zPK1{DT5bI&!63OTVSUaxGPfVjP2*sTa-N^ri(cvf}u6al>h+^%C`00EX z6KvL&Idl{;?CS95IwtNrr~){I(f2G}wY7r2Biy(gE}iXf2~~8*sfrbaH&>gnuawwy zS+Q#a#BxV|xRD!05iSR+0>MIe9E;@bJjolH=48%iKOMoQ8Etxz`ZuhxGw2U?|K0S* z`>AihYTT5AahIU9-aGeKOEj_Bn;XuSIP-dnvE%c;itWW4(Y?weNZbbo}&7VjzaHxw&%5jkb ziIIx^p`L2@h7@!a6ZeB4cldLX1wyBTP_yAfuVLJjE6h6;H=|V~n^a_osv+A*_xfKT znhDOVguGp3~#Q~ncNTJ4DGNpDJ|=lCJ?fW!wT8o+MmqfA z&1D*Qo#3VemF;@fNZIurwin--0vKc_8#^bwxm3r?lX&8=X^J!cA@)k`st+4$p_lsF zi#>ADR&ZsUuW0Q~P#EFOMMRG#uYS< z6T$AJz>?rxwWl8PkDlAFZ$U%PL;7yA5xrs2O}Ay5w{eD;ojVeed8f_uk#;3ko8)p>6Hs+I=u2Q z*zn{etw;%+3Vo8ySQbP`L6Vw$uf%xeYP*_&&Vepmc%$yocDeQ(0}a&f^oF$uT)6NG z0?Dx~+m+`r_rvg0?ShFocc4MAN6al4vVwalG%$YbSg{jsEYu7v+F-R|tho*GdQ5-f(tB+h&MLRDW;pR#cQd(R z$G%;qZ(8N(GT*e4%F^+In>@DsE3fzaEPk8{|H>JYrd1UCW{mbt^G+|CGOYxGq>bzJ z-qNaRQ+-9^79Q(8!70*HBTA zOK+ebV;pY$)4JT|ig`1PsghDfuKEtHm0Y-M00))cTqd24G_0<5Q!A!djyaa4J4{rh ze*c&gQjaFTm;JAe2>q{Z53c2Gz7sJy7vG0bj!fsVM_bNTs)yt^gZyy$(a2E~>T!WO z${qEW1quUQyhBbXY%rDgMtT6Kp2Ct329UVk{Q2pybwQPXxa_bEKnbkJzSk_6aYC@m z?BLuhz+g}AH)oK252k^AF|yBY6P$8K`viO}U)r;D+3uqJS<_I?L4{N2vu-FPozgv)WffOs_Q5v(Fa zN(uAy0yOyL9g#{n$lXP78@L~?s#85sMqHib+oi}I`oG9L6Ur-4hq-RD98lr%Lw3+S z2|9#Jj8qj7;EFBGg1vLpOaFzETwi&YyU~m6+wwOODA~BOZm8*JvV2UDyK-t9i$U80YHHhH`mX*GKZxs)POc%=XVH%+%NaCbex0AkCDamBm;E|FQ>6Q?QJ= z9LF|m>}Nj*9rti4SAe;qx-s>#$w)!}(j0cnZ#?{1)?erSlO0vo+CN(WqPNTp(~U(? z@%O+ynVI0*u6PR3Xx-#Ud$+?5K>1C(9B;(H_P^*Tym_+g2)+%=@OIg}$*%1AlU=#D zPIk?^4Sw+Nz?TaD?%OR|*^-e~_Hr~&L@WKt1)ABWnPZwvUbG|eK@ z#A3L>m6@jBG_fY_O0jsdaSrl}w`)umkvoqe4LlsRQ15O)Dq8mg#`+bG0|Y+j?|X1J z!Q+4J+2mdYK23mJU4uQIa=hzR1bgXZR|EVX!nbA8WLKqkvTN&j-~-G&xaXj(oAB+O zGTD_s6}+8}cfkDc$LG2ZZ+_v+n}IjK;7+eVIKJKZ@+v30w&B|V{2s*R_yGGl_?$fa zy1b)AFy0)~tcEE};}+3I@+;O`zLtKOLxG^6zCPX11_^~m-uYuoCyxlqLt2SLuCcszi zxTJ!RSsZg&uNy)FkK1w?Mj-3OFl#>rBAP(UDNL#yuS#=c1NGs!JiGPA27^&ejtfq6 z4JzWs2RGLs_Q!<}cMatu%GijhnZJY#K{+1>bgJtl0!@)eA0Yt80pOu00+1yx;Ft#x zeom%hV@Mx{wI2L}0QK>60-f$UB@V>LjEJokKqwYWY~|O0zYTbz(aR^S>#;3Jm_>l$ z=Y%=abuzh&O*rz8P>TV<&k2>`N-JKrVnIz&&BFQEwz9Ht8^HKELCqkb8%f+NgX!ZI`2=G&9-E;s;V5rgK$ZD zB#n+jIIi5gr&M9&rOJBk2nvevef>REQ5HQ5a1x5{3m%HeAYY+N{$ryVd(BHZe**K zxE35mzbgyAILcc|GDv?m>G$Yc;x+lQXqw@eNu(nRr6xzxpTYF4Ihd6H0Hn?NDAEt@ zg&v=rHNs`_d>2eA-{Pw+N_hM_bQhY80oc34j`VtjsKcNI8#Qolr1KAOa#_09n3b&j zNHdnvw=%hQ3&Q$VrodmXIiCVBZ|K+%+=GSm`?9|O3y}F5zB>yhyZ#CD7`|b!pO5b{ zd|rH2_-@5FE4=cK@Y;8u#Bbq~H%EUA472vMzKwjwJ*f{kYtNws&)Aw-dsL#&;#qro z6MbgS+LQJ-C#qQStUXzYK6$hD4d@teq5T7wUoqF|KuLiTrAjeUz9~#p$ z=-EQgZ_x8}@hqU{etM3iCp!~kdZ`_K7(HWPlrg=`j^2YZi@pI*_;4nvPWSt! zIm2jYGs^~pi=fz zPQgH6RN z+KcPWkPImolnM^%1difX1$SdF5Hzg2-4&SJux^DbSP(f>hz!Vmuvu~F0l^E{Roy`) znqrGaYVQ}Xz}C;;ac@R<01p&4CFXDvz_x=Z1Ct^ujMsaGS-vTtcv4kmsfQyg z{OCvF_fM|4!2?Fy?itf7J^p@fZ`{pwMbDJDyP|SNm8UrFE}vfH^B@Ha-waASG_regCbmmi%G4y z9;vmsZyL`k+|3T{qe0RMws-)eem)cq?A!LXwOUs{*4H6pr&}X@_?LJ zcHbSdYyAkpa-j_r;X+^VD1da|cPbhS^nHVZ+p)@KLv11|SuXq@kI5W<{+$#otl7aq z2|j|=#Cik|#PV1tHrGDj`6Dc&70*$Rp=Y-nr&CA*4$x3o)J%l5MQ8VZj>ai*t&4fW z>`=;>_DdXgkHd~Bq75?!c8nFQa>Iau2a%=JE=0yyYQ1@i3A;mvkuE|T^=br-N>G^G}BV&H%QgD;e4t?Dzk#Nx)dH`!_gu-COHsbSqB>|7m0&QL`fT7Cix zG+H=53IJZ6fkgFvG!1kPhO=SaZLZ)r2n2iO4fHLS%;7d(>CYS$4~yM1^R%}o_KkP~ z?#5hnL6I$pe0(H#<7o)ABW9X=l&QP65uDmtIqG-!q0FYuF=oy-m2RMvm18f@w?$tC zSFCsq>lT|iY9X;jm{jN-5udsOPF_Zj_5q!7fQK|N%107&m_!_D<2s<+#YxJqlT_}H zB@Eri_a1`}!JqstHx;2SC_AmdBbD)fOg|uNnojjOqd~0>we*_^AS^l{97t8_S3HS@ zOD|A?Zbp#sc(DP%w@}}(VHhuw^$2#9ND$821IURShNFp^-y!B4Fxr{Tr{@cIcN~) z=g;?~@Qhpsjy>^=oD=3kgg4wdxO5n6aUs{=cM4P|iIkDkItbX85ouS8Y9wp7DmZ?R zYB8XP)xz48u z9mB40RjnIqtmZ^dzXFiPv5LBajJ+Q1rcsJ>h`mN(4rsu3^BmK`VH~Y6Goa@2yrcHx zDxYI^nVkXjjwo$W|HnZ5J_f1B|B@B|z3iw?}OT*e@uE2THZS+PwjL^x2 z4zyCb8XNm#nN+g`x?G07AfcEt=&6OHKuUu+yi=(ImK%r3_`Ia`hXW(E4nd`<+FEB6 zLMf_}(d$gAvn&X1gW3i9A7m3L>v_j&bn3{Jnhq21zjcFe?-+d0M79X+xKBLjdi*WL!l>s=D)DI z=j)DLSS!zmCxjjQrw(HZMq#CSd(^Qqi!e!NIl7=oK8Pg{c$*a)7AbW&LBn7w@koAK>4V48b4r@3iRfV4sVlp8(Wj*GU8Cy;q^8=^cuw9k$KTOJvc2~;$ zRph4AJP*o?l6cpeqUv*xDLeVtiLzve_xWjY&`n9T+K+RltcAQ>V6lfBh>JtYyDai9 zoa%))i(GW6&#>{)Ti4>?Q1ubA7ClExWy2~Fgi1gX#uS8VhZ7gLvDjrGEAompE z>V%Jir*Ph{o*=pd$nb=Z)*=jp2c!McHnn67B?JS^qmcm6sa+T+Vyt1M0+ZMRSLyNk zH3E%p_ef+tp$&oN{YS^i(_nQu%VsW~yTrSSU0OD=c+n4(@-l>gSlG1WGSK9>%k5m9 zNlP@k)PqqL{FJT)(YOXsVN4j<0;mho_q0VXCWNeJSfY{GhJ1x=Oe!mz?n#gh%pKtt z*|5(?>-T-72s5w=X^F%!QQHel8Hcsxz)213oNWhuPPKs*WxH=L3KNAb(vH{eqG7d> z2(JQ|wPrgD$Gl~!^eHXC)i3{i`_+ zS;m~=mB^rN|HD#d&Te9oyBKX3f|fxK*i;VqQYyTnqv`985k3u z6gsAo4tp8g=5dj)On8iR&G{{uX1!1HuAO@5Wr!SE=E8ot+6QSO%Z@9L;54chr2)q9 z=BXzNF(T9_g&xLX2F`>f2sB+MK{69whai~=_o~xCDfBf_;Z+0fEn~5nj6EuOIjZ%p zSD~|Li+=N{FqZGE=&s++Q^k}UBv0fm8bg=Ik_ilm&Ao;?km%&=dSl(X8>cfJY6(s{bKq8`Uysgn z04wD$bWS}noioZco&Dr)L%(#NV7doUJYR!9_nYbd5^Xf(|Gg9Pr+lg-U6FVm@5eCf z3Mg>s9AmL(F;GOx;B#E<91t95ycC(uASmRHznTjzJ;p%sQ6EjD;PLHh<>4_5mZ@3+ zT(&$FAR-rFe(M5C-RJ5Y4a`CkB$$zW;pA!}Tdm-V_)^n!H1d z;?!m@)+5rIy_mzLH`~YUw*WK@okSeB|1PXpGv&L{*1ZY;Jc1Il?oF8gkI#8@^RYn~ zWmdu7T$~K2oa8JPXNu+ghB#9#XSO(zZfa!CY-Al{3FvpHMm9Pfd!3Fhrz7)vN1Rfp zW4Y6@#p&4XbaXf!t{WWKvYd`mr=!m4*x+<*b2>Vl4%dxN)J{jK(^2PiY;ijFI~`q4 zNBSHG>Qbj;jnlE!>F9MjD(5;7Y;rm}oQ}+!9ANXDj*U)7tJ9HuvlU0*T|MNT&z+}V zd9|Ca4_qrpdRHe5nWE9&qbR!?QfqBg}9fue9PHk3sYMOJGbaaTpK*R4l9hlzb&j0v_Jmf5)gS z4|9a#)Yv3j8pr86e8dTYCBGLVd@1Ai`w3M#qk=7~Li2}tBX=zxXcj`|JmgTEZo*jk z`!blNqfU&e+JQ&I9FNI@$pS2BBlXNa03G}!SrAhXI0i7uujgyPTd;glW{zpu2#B=NV=B-W~uob1JmQFu899A2SU0f2oi_<9F2?#oU?o&Fpi>OE-Ahe zhyCMdPxVAQ)>pt@>!8V^?Ksn!u0;z8vPnh)4tXml&QWt#^^5kuoHi>?fL8ML4U-pU zzD#%rS{9VWMOG+N=&X7@(T>kJ4yK^NlrpAw|6iOcTeh!o@T@;L+!kFZOkEpo*+)Fe z3U%dKrtzPnro}zuHo*vI^~C8`URY=20I;zFSb4V-^hk|lnuJftV*-2}lhwvSTQw1X z9OQVLSub?86E;acHI9T-kB@soAB_WdGE{ZwffL4^vfNyptY-WLUd1WuS}{}AWHHm! zc$%g<*mR`{kDWfsYrl5q7Y^+MbHr$%5l5rpN?es~oAFr8Eyss!L8BE7!)8nnV80C)#6(E_)~3KV12)-5-@^&SKHQ}SquuwOCz_2AJbvD=Cbw@?;36c| z>^l-#djzk#8nCEj!v&8CbC0YWDu|;g8Xk%|xqVH(m~%&e!ZG)TD9R8>5S)SFDAssl zq1L~JdS0b-7Lh9WK{!e4OPte(Bmykr+xVlErV>N!-}O zCKda1{&@3Du3b4OPSwR2_acVo_ydCa zprHQ4yG;3@KxeDf1iVRtaZfu4`?&-kkYMcRGWZ$^-Y>z11n-yNT#?hLM}qfCaGeD2 zmEb&e9%J(=bX?~y!Q~R%D#7`x53cAxFmJ^T4-z~^f_F=Bf$C&%n*_H=uv>y#B)CvL z&)_E{c!vacafVp6LxPLcj~Lu2!P_PHRSDiM!KEt1;Dr*rO@e$KY%UenNr+68wY&SE`E`JOsfFYoi|bdam5)ayUhzbgQ|ThN3Lr%UK#o z$w_fHJ_G4P4QlpvhSqjUz3DXTP3MGQXK(@*;{3bN1>MEfHb|= zM2VZ%Q&c^QH`JaL8-<8qU8aq9DezJOsTV7XLf5!A(N3bwUEX3gV@sJ3C>LlHD+E;YZCJA>wFw@PuOsBD;R(P`+@Vj$zFUMzeeS;h%$i%s1g z=b1t2vf0Kb-Db7%?Y=%&Xtl=`7-dvswPeCyU5fnR0O5T>)Kq$A)AJ0|a~?cHtMNql z=?uza&@mJ&;J@ROAdf3JlmPDaSBTs13S4b?{k9HJsAs6V@oWT1zkv{4D2EGXtsENa zyvzOLLHR)H4t)YX6^Fh!IoJ_eo$ca#88{r6tsWW0#;qp|>*~MhHC0%1&cF@#JxT5j z&m&f-=Y02lEwrr8k%-+m~0#O^SxldXt3>Z8-mh)ohP)qUSx60yJ)xSX0O-U5{^ z5xc^$4zVH@s0bn=(;NH}FT;HwTL-FJ2F^CTh3=iMoJoPS9Csi!XE^G#+ueAvgck|k zqlULg9lV4&!TnH0>gl)5oD`{BOuRiP!cfly_kADGvKsfNfF5OdOVvXXPlaK<(~4KB zMw#(it$2Jc@pmkF1%Ee5D#8V z3Lq&i4I*9KZUB{9cHW_$tl%XYdSdq9p}=jlmxj{|CyRnU0M!D>b8%>2a_Ea;!GDBS z=i&x?180o$FYF`7)}JSY33Kw-*qx<=CIKkilfCCzszbe*q&8ns!1S6&SJ|$YkmZ)G4P_0 zqKkP2s^IeeP_N1mUx;9(+9kf+AyrFJl|=bAMOvS8!sVTjIY44~J?fN;wFF>l@*w6K z(%g7>wM<2px(6O?dFq(p-Dm>nR%hUG zaeaOSBlKf9KVtO62K|oQ;`#J4rQr3+2hGK)>POiq$}PuTaF^1*W< z-m!r)(>@;-w(+-%B7?TcLYu9g0FH&tzK^BlvAlCsSbL)ZORPp?&0(`)RwUoi#F}&# znAC@%H|o;bqr-x4OJ#zhcdm+!z|nf#KP)0UmKn%b7wc3$TNqmV*@BhBXk32BNel1x zeO5PE94p0faByffYhMd;&dRlhocsn-VjI30o>BqwR4(cmZuVd`8va)lERJpylyzwd zgM5dezxoW$v4f88aQQ(y^j--)h|tYC^h5V=%0G7hrmDyN8!)or!Y}&Xn!Eqe#jbIG zfF}Zd(5JZIi@pxu{x{d|epF4z#>SgVcE9}>*6lme7xtBZ7ULz~NVrHN{4BH@4XOAQ zsa!J=X(Yw3RAp+vuFz^UFOfu`A2U2E4oMjC?UtGV<02TF{^mpnR>NESc0Q3Igqc!X(fd_HEVshxtqem#1(_qb?N(&Px564abECIZ!Yg4Xd3f0vzp}6M05o z?SUa~PL0MCO_{;A!-93T7u?W8TM^nTZ}H(hqYm>KBRpkL-c4;T>NcpqqXu%g@!;)N z$c__o$4)kD6m}Xb^ScS(BqvBIwcyqi$!T{yze#yt!ue zN^!Yi=Vi%I4(zVhttGA(_7z)x9H-JwW{!b_cFLpAUseo*a<+?mkB&Y`4%KzkTS7JN zgN6e6xFX#<~ zlF+)dYl!lGE(80MSXa{5YJ37;T&tm^D}dPYsW%KTQ_TxAaHV5;hZAuJRiWD?6bmn* zwOuavcYX>SdUXrBnC|rt!D&hO1HZ@iCG-(29fWk=Cgq?LYXCi=)(o`{;{Y_t&a^q@ zM_8u11!1tt+e2eu!OB{s8{AT#qJ}`{M*HCWjZ6ItKEa{zQRPUO_gtZqN>;VsrvQAA z6ie;%b@!DkcVjwArD5#{^0?hWCqW0fhR1!=V&pAp-AR}Ol@7$fSr+)xF|XNBjb$~v zxq1h5u!UlYs^-@yNxf<=%(iIgB~b8=EkKk57D0dc@PqEJ`prgoDF9k<+?{u4*A`83 z?T2{)Un{<%e4I|l*X_kM!M;hZg3AhBr&P|+@A_8O^2zp%I~-~3cG#_SUxpvsz+{+T zCyo70*4+!tQDIu4P&kYiPL$LHbfVe8c)oHSb}P-v@cX|>bKbX4l;+S%JHc?FYl|bD zCmePw&7JU@{eO|q+Hn6gN%1MnC$DeT8AZD3cf|9W>9AYrj)5N)S-&oS4;%f{Eko>+ zD|zv_PSj{^a-_4-VYkx!`Tu2_d%t6)$(GA1Q<^$$KklHi(oS9(&#%*NrF|a4bK&@3 z_pSIt{nO;4CezG>>8`Zy%Jwb2bSZ?vo&ub3T?Vt!=~SH z2pcUBbV&THn_)C2{+WxRWBNGfZ-F!6$@PpWjMBy~`=eJ-Z}}?I1F+Z?{dY)(@$ZIb zTlA;wb$FXFR8Ua<31bJme~973VOgB+hFU4R^`D|e;K*UsoffUpLbk*>{IwBY>RvW+ zhw0ox=PEk8aH0$Iu`iN>q|q^gI2EDMBt&m~^R8s*fiA*XvJ9y7rBC>1-5{v6#s)SA zk75ah+Nh~~wiz1I^yASm^wwQd>|^ImAPeN3xM#LjLx8a0K8lLlt>_B1$hS&l4kg^RJ2x6#z-*#uSd>4Q?)07VWL-gjL zT!uI5T{zmJ|6=bDzg)>`o1NoB4#j^%y#-sCP^8yVW$Q8DgM&6_(u zz@-hFJLT^Y`Fm9U_VRCI5B{?FC$F)Je_vxa{9I}1amD5jH@b*#@kJ2LCx4)q7Gfyl z&~NEK(B1ep9N|XdGd446^#QnVDgKPzgKoC5i^<@K#MsqLMvh2qrk^3v)J)92!eP=C znGHe=fmfA31|J)R+D0Y7{A(|dV2L6l9A>i4NarI`Y*skTtVU|%$Oa2CVZi@D=7{vC z9|74=^*5ABv)e&dhe_qS-?G?p_oCR|H#U=;mH?7fOV1;%>uQbf(=Yx;xv)Ic zTI6>EPXe%UaI*1|$&hA&Wo8`OJBfUV3cg&g)Pd$k?qcm8?gKq+db0ewJMkynx z?3d)_9&rpo1q3S60O^F5GWWOCn`~|Hayc67?k|w(RPVH46PuEM|G~k#JCPV#8eQ3Y z5JK&DX$E3&v_;>49#O5DPo8i*UpC!4sggGl!p`wId1!4lV$ld27p%RXt+Vov=>i(A zE_}}G&w2GZr)%F+TTVyWg7U(2Qab}pPB2g0GE13Ecb2%5(Zs6D=}s4S3RY0nNVwhW zp9Kx{!$>^`W~fzg%|s@|C74Prm*5$1xdclNT%`I@n`#qVHqLOJDL9hVGnjymv!BO_ z6D#Y!GTywF{!>d4_(kBdy7?1vpEDIIl0uZv#pvFA zkNS+yD1#mBt!_rTkkH5xAX0lE^tefYZ`!x1)3Ib~9FBPy+Rf0%oT2xDYJ}okg~grP zS9QMhLgxJ#3$#TygIx~o@%X%tZ_c17?YfAuBV`O*>GBF;j7+e`-G}om}>YlG2Lsv zHg(_Rlpf?6oxd?7quGy5Hay1A>`$Jl;r!|(?AiH^mykpO#+~Y3+!D$|Pr&~3ICk{f zd)m>~pQ#@F;}?C8XJECRkJzWMJD-9WFdJ53%b`;&lU#wRIKaiT?qcI?1w1K zmL~htAe@v9{0+!4tq!JFve#iDPMdlRbz#^KNh z^0gpmP^5+iwwm%R?AHBHuv_;(p+M2oS>txpAE`cCn*^iqAT&g(Y7eZpc+3?6e@^oa ztOcoHhf%>QpzG?e#V*W7xFX9cifwRja&tYZX_{Ysgbf}Hw|hB8!@OFBkaNf@aX%Hu z?dwuMZ<9I^dNHw1bSWQVVEw_W6R@C8jAq9qBvrEW`wND_JOif5!3AG4*<=jR^u)fw zYmq4R$Up4(+wuEihirZW?oi@oo25jJF!BvmQ)ruzn&C z@dj)3Cts(*!d+hwq%<61fJ%;(SxF8au7r?FQwFnnHku;VX}`J>o8x$o5)^c>>~4;i z-90vWlqMT<`O>t=Rjk-5 zN3&V;tM7g+MF~*0UY#IH{S`w&8&7%yp8mxe20Y2X_}47Czo5=I+O}UxptNm+C43jd z<89lE2xqb1fiAo)x+SPdRmP{rd#J4SX@)nWxj1d63SrO3Z~PI+{8;8uJE(?r7`^+{Rus`0 zDr=vkh&a8!7XS_1i9XV>dWs8&fxTtTgSRK4qi>yytk~@X)*EJ_YyAvet0j<4n?NX* zE+H|gtj|?g57X_j)?nGvZ3-ktX}!h`I1!Roq29qRHCkBWAbsmGC>8pC@jIb!J$gpF zOC)`>0MNi4c+iJ>e=;`9n@?hg7{jhA&*z&}bPf`y#Goshy`3d86z!WnMUQN7g<_*o zSjKT=u9+uC5iCUk>!&b{@)R^<`&2rIJHFKBlCp3~DHhLyoOCB#JQZfzY)@A42C6>#!sAAOeTIRp|EZ zVQ(EAZPBHKv=)U~E^5wC^!vUX6UM8?8z{-da#;hu>k^p(OuB^3a!Gpn%gcpttD}9h z4>->?>;l2ytWaF$WeU0oAV_5fZghaW6j7{7Q6Th-1OTh{;6^T#3bd+vjoD?`$(xu1 zMy|PJ;zk&2M~YTUj%wl4S6F&yVd5wV;+j2d2(rt z9U;5LQd_7Gfn)(rs0F$(T-eiWi+&HygQGD1g9t2)=@=K_{s#tHg~53@*lOSNZxmL3 zN&EEjFZ-8A0E1IJ&x`W77Ko)hD$Vlv6u@6r9trJJvu>QGV#!-K+iaXh*e-*WeG2Qm z;rH`zVWoN(OD+)nqOZ{i`PG&|W+PO|CJ4JpFgu$kqhN_RK0nSzlHyl-e9N-!uVmZR zsM-#m&OijVEXUC4+AYhey9k+1$ai?a)@Y@CC;#X~^1W_be}3|sJKe5)Mx>DRsxBI>QoqI`0RJzO&w0@HZ;O72>Kf~~5gj7sF9Y&7 zY5DTHMGNFT`LW9u1aPx{z1$j&AZafsqyFjo&JjoBeAO>3CO(}cedg?Eu-Cn^$P~jB z2=2!#lu7=^_?`*z_x~}RVSrn+Q zG51Y&IMR07EgD`%ICozD*M1GtK1Cv-61s{I%Ssh1D6YYkMP>5~EH6`#r@G+cwr2mWl?cbm58d^D}vPf?z@oa`Q7OnZ2Ri-jE*r$@A`O>^H z)hyE=Ao%z)h3xCKQY@&-CjJ?ltqRbv8mbH@HLMzsI3Bh7_qfOF1R(`# z{+EPQsuF~_cjCfJD27h3?Kx_!ZO>H~*!DbirfttxC)@Ty)wkEeQ=~q!?WO8pw!KWf zY1{qk71&Ah#lV4m{VzX9Lv214yRpfSH&c6cUuF~*szYEg=P^zGL28ZZkLrgd zpQf8;WBOI>QBUqh!mwqjM`6QMPVaY6&7)LpLVU6lY9er_tMzc3`yL$K$NxDRhten6 zI5bsp(zjL?Db7R7q=yd5y9*6PeMDjSFBsWTipXw61?;vo%a(<1>$9@ z{iK!|>149EJjZ0SAPt(lM%nIP9&|)MrZSmCPG5HdDJ`YmqEgs_jVL z&Q+!QEs<3qdZzl2?6h;WAws+!G%h+aujme?9Jh;&7*Zf z-;#t-p>otK%yLBzV|fx{?UYzWP{>C@KNH3j>4aJcSAmdB^*#lUOpv^VBuXwXeHo(@ zI!hA5qG7IDC<)~<)^8GGl}oHr)F>oWC<&G7gr-YE2+36I6QZ0gQS$h{^jMwH_J5Lf z%JAl?&xQ4Qj5RGG))6!o&0b73%aG8Y3FR%*3H_6B6$r^x=OjdVTB77ruaXbyp^Qo- zp(D~ZN<#UJ^)4%%&4<;9W%M+!#_SF$Es>P`I;Ay|668EnJ#EEV!}|RcU5Jy0G$tV5 zmeB1}Qy9gY);v3BUt#t}RChM!nQ8?hu!(5*4st2q4o5q9Az(P97frHjFq3JEPC~Q8 zJ*9@VcvIA^&VD>$3}RkXWUaTQLYm4eJQcMyb#e9`4@hPj2`yNj2f<4%=9>-Ne4%NtnYI`f=-t=%E;=bL^*ni2;0QZ?fzQ za;jO898UfgCT34#vVbO4_NN@J=m4an*EALo0&dEHoS zK|_feM*(pBLFF-7fWVRdYxNHf_r1v5c67Mv5L~e#IQ`qg)qX7hnagmUNRZo%^AO$^ zz30b(>ay0~98CC}Wx&@9xYo96i>Pq4aLeq-dzjK-@iTc}aYow3n3EN!N49Q3zyc;; zlH9zClC(({gTd1%eh;e1#rs6F~g7)-Xdu)$-~NF zb4hM{$rX6P<4S9pbq~nu$6f64aGu0@!IY&-msKuXR#$(srIA&$Ld(~zDlFtTmu00i z;}~)?jv3>BA-cE}yxF$quEOS`tkiMuo1U+$YS4u9)y-?N(u_G-Y4HhRAS=bz0hnnZ zl4|@F7UL=anF(j6x`WQeNwW5)uEN%KNDXLg4W4169zxWhL6!21L0?%`YOpD^H(ge8 zInJ*#4!3(fF5@hC_1r6`( zQSW|V$`AWX$twB??8OD@?_#2_7BgSHDrS-T15LBO{StPwzFi9xdVN{wdJlWCB?ZRv z6rS=P30(@hUQ_uXX+muZu1gl@C2+=uLFM7^#_N!rA7PbN=M7_`HobO;6>%Ii$3C95 z{mZS=SGUTlGsil~>cHRoc+N)ZO|!qS%{X25V8=t1x?xqGD>!gmE8Z~VnRUU0IGJiY zb|^SLYA?)7Vw<3gSM)?M?}r*5*TMb9i;vf$NkH$If-xDYZnHmCw|F^-k2yE0D)~ow z>4Cf?W2+jX5;Oj5m;3Kp9>lOZ)D3u^BmH^~q%Uuh=X^@WO z$N_>*Ku)9AVPfjU*^!8oPBqHHIl_taNV|nI-8xc_9kWqy0ckHg5eK0?iAd>GucMX< zp$BNO2))lnstHZ~5kSB9Q{dd%4`&8K9GRz6-EHAq<-|F`#(5?)Z{Ws&8Og?sbTyuM z{r&LfB;uu0U1H(&IPt!N%|Ol6v8YuItFCYbG|@$j^VUy*{3BEiVYuYuMS6A8%fTCe zVtRC{T^P>`Z?@B7@uuERFGte5G9kSsL>@{=?*@3q>Ya(zCMHIwDzg&vIukp|PV5p% z>>E7AN70eYxrq6!c+R@m@eZL|eHYg2Z;+~{+e4lw!wSO9Giz4V?rx7Hvs>*00H zsafcVl<`r#1{OS-AcSe&w+4uB0@UV zFD!&Vaw4p;5uQeb|NbkQ&Z^|*$r;gs{czSL;-pi}vT#mw;v8<_bg$scIFTH{u8`H%_>!rHm7b+uLH8bA+z;obM4WW0J*bnyy=Q5$xVOs2c>^*V*+$45 z0Py^j?+U|b_6F_^gOLP#1o*tBF8T?&xIzz3N(Wx%5NITm}+FQ`z(%BtvllEOy4hOX z`r4gyUb?VZw3x9`z)G=)WoMkD+p#x()*gS-sc8 z*x2Z(_rcHmP~}`lv7r7-K=b!3Ol&X%FgAFfuNOPhF4gz2V~_N00w9?;zRS^X(?cBn zVq9PjfX(p+l@&Ohw&y&+0mySh|@F)(fKQe zY0OTI4SG(cA3YhJzOOY4}MBBw5KZ$lc7A^Fmog;WfT#KjD~i=KeqJeGOPu#rp3; zQOQurP^rkM(6G?f_s8CAuZ;?Zg-VKPMg_uFNCbk7p;1v6#7bnM< zgP)+t@=}~YaB)S?3anJZCP+nn6$uAvvB31~p^1yAp5_?q&8Qh>2o3_;Kh>Wdd-Rb# z70A*{!doV9y@KeT<^caIJD;^G@BFn3ql2c$#^`%H((Dgz;P1nnMQ8|C;SPgH-MuCd)ZO+TX2RyXd98OhIrgkf_ z%{eA~o?=BM9*t8iYgVxaD{ZyIVXLctfv{gWjw2DVRTxh-R zOX)Cs`rqD+t^fAB=1(*o5`2i7Qy&i`d~7F}e?l7#^hq_^8R(N8(8{;$+xYaKd7bxhn=IRo_o5hr#j51Q3*Wd^kYsnph^5R670cr zMB@8|MfV{FSmFar$lIt2e4bH=rgfOQ59N=|JBX9hI&4(Wq;~9{q|`CL;QImk^_Zmn z@gYUhfJOZw5e{$1Z%JFlwZY{|nl^Gq**T}0IHSDt%Bdy`JLt-N(a1)h22!z!8$D=_ z>HLVQ*$XP`Fki<@GtAvEJ?RYaq&66C=2f3yBH>#NN`K5sznx4|Jl%^Yt9RQfCWo7! zfbUN=p;vX%PeGVoI}sMZK)W60OvIFz!qYkhOP1K3ONIhrkxN*-&`enDN?kT}hp*nR zKc;$jEJbI-oNJ3k-Uh@nAJOG2Fe<@JC&BaqpA1Br;+IZ*CO4qTn|xWV zCU3T~ZbFmmeNArvh>)p2vdLL36xm>vc#gm3J($a8FB|ukjEG%lH=%hJYa4I=Xj)C8 z=zh&st3f?YbRyrLQpyZ-JYGUNal4Wm&DnvsAqavHz#iHqNi~Gdx-aI| z?D=EQTc6)l{fMasvVT6ede4`>8fmhbF1Vip7}WYONVG7hwJ->?Fi4$YZX>HWZrOw? zUq4%}^BEryT2)rgJ+vVr0XZK<&Z*`QY;DHeh(rZfnp;-}@q(Apam$jb%vBI0%aUsC zZLIay!!CPm;we0A+4nRA+^+WH_I&BmB}KiHMs5Cq4y>RH-vfhpbUUYJ3FayG zLxW|Ec&>|O9E4HLm~av( z&sWa96f?Db;exP`0sq)+F8J2|s_BAfgIZ+fArmI!jTK4lKA(oIDjr-|$}%@czD_H} z=4Fo^?z}GB++)QoDw_bx;54&iXfD_cMBp)RCcZ8T&LZ16YGK93$AYgpX!1bwwm+VHhft{C zF8m$(Q$>bchBkc@(1@& zY8!Ui;CBiRhKz{{2*MR;AX3bz#YEz7-)(7cXeB!9=ZC4++ZUGNki2`~yvFAusMoyX z2Wyn4)7RnD&cu!6a5lf#Nx6w#^~J2SVhER6zL*ECm>9%}J~CWn#l#}!JYP&vAWsYW zpX$o6VrZJ(24QK=N5`7m@z3A792TQS-zi#)pO-@S=pu)75D58`BM`e~pS%oX@=@T& z3D9D)?V-Cf)=m&d4A}>k?g~dZNOoU<%aF#s)_Njiz#`Ld^LeO#V3|-(@j+*pSwoLg z53P#Q$1+!%_mP|p*1kD(KV+w65xkC~=xRh5qg9IuhA}OBLryR z_nfI?8m!9L>?JY2u2_fu4eE-A=`qk1XF-++nzaqD2AcKg{nV_-&@-00h!)v4nqP;$ zu+GmjuER^<4dJG7WK9v)5csWp$VAUiA)kOA|*r1x4(dR*J zdXpXlZ5kU~(<8w(y>%b8=^b>n-6sG3E|7@boAHplE$4<7827_V*pENqa`lcrmy))WDNfGgzTnumj2^jbE4io_O}P-F!>}%x3jF}5ij}M=vtqu}PeC;Lnc+hiOb~^?N6g2d=5!4_I{!DQ)9Cz8pcLq%uPtnS z=Jl;84d;J=W`kH>IMzR$O}F%@*z8+7@pVB5zVql>2%8!XQu_$3J=I2Rk3|V#SDJ6$ zfU|I|Uib4Ebo7Zj;WZ=q^(9CxrXPGt^wYHMjveOYjQy#7huFTlVb+B@vwj z%D&vj%Ua5V9%mntH^ai2D*P@`VP~&sjA2QnJ#}{9;_u6Ag9Y4=$d2#dsFFjLO-*GC zf7y?8XRlZ)W57aJ3_@&}>l{Qkfo>g%oLly3zSoKG(fgAE?*}qoVP%Z)WsHS%$Uscs zY8b=hWG4h3tMS~N+x6^Es6~8r)6wz%bny)+S)by}6@(qkXn!=*j^~&jqnSe#pWGE6 z$k6R(>ER$gx6v# z!~FUjgl4FIxU;@~ZvwNX6p!_-t+*@0-NyDW5||}}%5l495vA08m%vmEs%*vQKt1X+ z{-lShFRX|9@9Ck{PHFqWO8L@C3ICNI+N_kEN|a*Wg!RGzS8B7GvEU}V85Io+N3KJj z5b`Y&AG;OP+TWLTlu(>${(2M8JqR9RZhOSq9I^plM4NYpL4G#je9oQ=zi+OurHWYi zD`DQ{^+VRyl*65CHX#-fp}i3?=W;~U2Sv=Fh(<&Na9fPZx9rF0*Xu7ubVsS%Tjw;TMLF-@Zz&o$kwLl@?T5-C$0TL32*q?4bjvG4e zack(pEuo$L=%td~0TfO}!CUrSWuZXZ5>R)URsJxvqk1jc@%7h0+l#n*5&z7*z37}Y zx+}sR_9-kJS#G^Bp}q!XnYBOBR^^iTm+SF_GTOmAO=mlhf#QbEI?KjJY@{S}03o== zY(UjHi%>#N50KZYcnoR<)7cdG-6uMC;)Y`WT7e&xjbmRdI*do0Wpl;k6=Y`T=Fg6q zQjj&r4s^B4YEb^wi^~+X>T8lAdvrbn-8q=qfx>BGO7vl3sq2^u;GhuRKY5^-0oK zo+N$4NzxlmlHPQZ^wyK4x1S`P2|00wh?AtpoFtw05TEFxliW^pWt=3v{3PisPmFp;;&!FvL zC%9Tql3s}25GT4K$PIjgtKlT+yuK!tj#2E=pRdfQgbZ7!o zb8Z5YFf4&72QcsK*#6ch?`?l~=jXdV`}FOW-Fv=h{qk#O?>CT_mVO3*%jA-LFSY^s z&K{v3lFIbPu)YiFEXNC?BrB>mdd%3wq;cd^KVC!XJPAxHARJHzIMKzU>~nC2ea!e1l}Bk!HzZhDV#*VkcmS?)KmwovU|lrPX)+PPr_V`XvH{34&oSrJJ&uHm z1{x?gbc*tKYEqc=;k|~9x-eVJOJH3jZH z!wz5mngY9=`gwMk=NnH3*EFV2IfWt15-70rJ)*^>f1=h4a(aCqY=vV zVtO-u@Do#~SoRR%Xx~2GYoHz`AA9^pYsM({LSb#Ow^G91_9gA=l z(h?EUwu*Fwvk{geBu%Xf;dX=@5WaVK%}Y2+I(@i?ABu#|Uc>eu8iV!d(bAA^a5Kc7*h;W-~(i z7<4bf-w+-|I31HF^rq3wl?bB|&hUj-A=L4lj&Kt~I^b(B!fOy_+&r4O7GV>@41`hm zv?O}zXeJII0ulfzfa!p2Kp~(EuozGUSP7^F)B_p;O@J1F2{;J&ck?sLK#PDVKrDa- z=zwHE8XyCZ2Pg$B0#N=+z_IeLKzwlib$ITMPaWdAB zbO6Hc9?e7oVgT^~6_5x>1*8LV0RJys>N~)*vu8+W?;f3p0|-|%^z7X;wD;j&hrtQL zLplc_(I3~l^OTUza67j@jyWQ(Pfz@IOYe}*QvyX+H1s}39br}-N4|T?;iGZs+u8Hf z?)arZ?&LuRR)N3OA*{R3mR%&DNZv%jx0#3g_&sBoIQTx>kSC%EXLTbj49{iAPckYE zdG;c$5ilK|t{sTa29WHE1d#lSM*eb?!va4+DO+c+SIpD(-jSJ{@gpLB8-N;EsGc;>rLduWJzBh`gbQZvoUHJ`Q+A z;-2JqIKmaka}e<{z&RA*Cd8E?E)wOH;Xan~;-2JtEYg>vyiI_Eh;PPo2OyE&Mfy_2 zwE>?DKpo16rgYqg0@rYa*?0~IECQ$~lXQhd+@~SE5&3ITZX(Lqi!dB<&A4yD{a&Ok zMLzOJZ^C^%?hhh<2kyPdmjVzG7e#pDooGN6paXdpA#Ex0k$=1qZTBKR9eMw!S9^kA zy8-{j?~P^9uFlb2aZ%%XGKGkX2#TAIxN^kB1;wpLTs7j>1;xFc+>?n)?8!6+#l?>A z$%u$c8Pioq+GRbNO^C}2ira~}7R1F9KEBH_sVB1nIEq1WsfepV-1MNh1Bly>xMN*= z5dR|}6!_9L9H9ensqZ-(;XJ?{fGWUh09~69ZUyWFv;f)wJud0VoC)9oV*t|u`G5t0 zI{?*yCjpxPI{{w-4gvb2U!nmQ0(3w!;0i!CzzZk`tN^S7Yy{A?3*onbgMh<;zUarn z0J>O&V*rx@vjC-l#en62CjpxP+W{?r1Ax#=doq!LSU>_`A|M@*54agn38(=)2iOSM z3itrj04bh4Z`aH^8j}MssS4S4FI}Y5SoC)fc`1y13)}L1dIbr z2FwH$0m=bO0qX#p0lNSufSG{z0Pz4FFcEMKpb)SKupCee*aX-CXa)QR=sU3|GZerA z#sMY+t^O^?)6Ky?_otU(nH+fOr61$-eL!gkHd1fR%vf09yggfV}{^4*SCY z(%XOO?f)jd736s`OT7NoB8HhVzj$1c$1}xSgmog&C7vgHM(5=fWZ6+Eo_ssDTU=)L zyv)Mfu5u=OW?x?7DVl#pW?qRW2^$A+A#PHkC;u|fd^-ZqWAh4%J&0gRiakYLZ{rtI z5IM6TvnV@lej(Y*i5{GDRWN^AZhm&b4R}t$N|ucg747>@a7=+!(b$~KqKTeT?`UR@ zrzqc(cSO0P$EM;1W=fvNQ;6`2+#+vDW*)V<>&a>xa^T!58;?rFrg&Rn>%K{m+B7Orxo}! zAT|%p&hzA3{YUp%h4ZZkYJW=Z%%aR9UuP1oHj*g?S($lMB4Va^Gts`n@%gg~s0hTQ z78PWT&dx5vmz9X17<_kGlIKaz%+JpASoH+r=xD5onR5fNcFF$2=-sgebLZm46#Ui+ zy-MBa!-}3TSmSbwioH~hRWij`Lypv>(p(D}8xeZ4(MJ+97QX@H_5D~4Jx?pj^?Ilj z+)vHVu~5xUD$Vi~dhtOk643FKZ?ZRUYW@wVgzhtQi$Qt5Jd_H2r+BmNhB8OdMp|C+ z6pz=USLDSLvIjl+Cae=Q7jNDBQjVl$yDc{1+H^m)FdMB4kTR22l$l?ghbSKz z6RtqT&X8sia&QcO*5-&DDFyj(I9NIIvwcO_&!9n1ep}i>~-f;y*7F8GKc_z)g z&XeUO#C`dEbM?r1JU)M3W?nA!&Sd1KHenF#e(*&Eo&&9>QJs&5%$?u?)5;1^wf*TZ zbp&!)Ee4(B`O8hp&rZ$6`Zv{)m|I+!>CMUsZb5f`ljxac<6+GodTVTEUfz*WW6-1d zfl|A;5b|QSPc1C;6pbmFHOm?sd;U-I%*E5}>@LPh!;No1?eX(?$IP+5iY9uwkLFrpIvw`N!ao!Sl>FfKwm`{KJR0 zyYsRW^G`pQ1vS&`wXpJ?!{PBJ&GS(uQZXEpX89&KD6_a^ZqV$5!g_c2b1yo5>I~Cd|=u=ZEOKt>sICH-@+2F^@Vwt2(cuJk9S$UpW?}!=NSve zgX0$Srl9lb(|KIu^AQCqU2u#Dl^yvm<$QfG1fw{<9p~ zs)@cV_SK(~S?skJ8*F^WmE`56W_oji`8;*+XfI~d%o4As*y;^nPAqyX&TkB`X~bdb z%pndqr4YMFd{mf->5G{^H`AtKmYVHZ>wB_6X@qXava~ z3xVJnos?fP7jxE=pPgCc7hy?65yu!~d(Ir4;F~)>ab`bRWNh^jgkfQ3kxzHBV@SR6 z37qb_h&?xs(!Vlic}5o%WzJ9a7EPKpK0n)2iZ)O2$D-S&jsYQCdPs0=%F(eldU*Sa z%%a@Pd@ooIdeEm&`Qr)-X|DL6ARR0@>U$-9o(lo>0JXjcQw2EmQV&K4vw)9_*sCJ)e9*MrHx za}&aPKn(yt9>Am{pNjh?geiF5kFtIT^vUeW3;QZU_zn<(6`oM6_Vi~?!+K8`Fh0dv9qNtspI!`XcdQTL_}PLR@@bEpMeKOIHZwbW z7O9;<_r>7+{^z;5bf~TMltuC<&%UK;M6VTFkN!df1qDagStu!s(G^+g}l$ z3#^&uPlfUh!vU=9$OxDRWV8{kcqQlwGuT^_Yb8+Y>=e7^LTGY@nP9B+7Q}2&MR@X+ z5lq(+3?tH@vxC_e0x0qYaJ;^=CZR9p{Z*w1TpK)Jt-*X4JKe--!Uw$BeCVw7(A|;`%9ZjH@*(-K9I6aZ>Xf0{NKMpU(@gD<*28gz zW0YgGW1?e@!|Qm`QRmp<_`vbKqleSwyu^8pbFFiW^F8NR&i&2<&O^?A`Wd>cyY-v& z$Mim~b6i)tvRn&XpSlJc7aJMIbw;6ar~4uID)&Y=6T>ho(Pc4g0ecI(gsou}?h>@L zCqIZkmyhRnil2(67$QYV7fX^fL7E}Wl;%kDr8}f|r2SH<(n~!}O;vAK|EYGUleJs5 z2Q|a-nBxV<8s`(vZO(npgU&{MyS`KZKyT51(tpwa(Erx^xdyrv*G$)P*J{@@t`}Te zTpzf;a2;^-2g0U3!)Nxc-SA>gwlmyOLcuxfZ$By8d=8F{+JK#@oh+MlW}`JKlYh z`#Cq0z%VO-)A{UdwwQf|`x?~IgOBB>^BMdc{vm!9U(3JBckly+5kiJgD9jVegxiEW zg=NBn!dl@eVT163uu<49d?5TS^cMR8=Q7}2C+-rz68lJ}NoPstgIW}6vNT(|UYaL8 zAT5_RN;{>`q+cYLJWjq$o+~c^t-L3<$iK)vlyjAMB^P7xyz?VB{RnI#a66B`h@UCU z5gg)JF-v<_Yt?8xzHxRsC+G!wALBG5#$XM_SYj+UJ~O^FelbpSpXna%9!Y(kfvx6P zyPUy)%?}p-A#4+V6lRJA;*H{M;!^QJ@t@*L;@jc};%C73d+~sHrj#gME9FXF=}ze$ zX|2>K?EtP{NQa~_`3z9FAiLzNN|6;q8K+ECu28N~W-0l~JmqHP4&`p;LFFIHT4lZRqVk%u zRoSV0tn5*~Ren@{Qw}S=)&A;Wb*MUA9i_^up^j50s#mDjsI%03b)I^&dWU+q`k?v` zb*;KyeNlZ)-Ky?XKUVjs->N^Vzp01S-dcZcur^ftT>DP@N&8*v>qvKGJMu8=${dRv zOC42?6^Vij&S+<>Gu|mWb!Vb8#hKvpA);Tvh8=X6x&CV9*US}I-N{2I457#60XgyYs*F{~|6ZI55 zO;6Xe^*r6Hm+6c2rJ&OldW~MI*Xf(|Mtz6gjG47pZ_^Lz9iZNDSEMW273+$3i7wrh z=t^;=xzb(Pu0qiBQdgy`%2n-J;acgcajkRJx;DCYxIV|+Yj;H$QARXqBG!mA;z1dr zp&BVhp5Zl0jWVO$SY#|VmKv2tm9fs)ZZsLq#xA49Xf^g4rqO1!8w}=a9Oeh>7Tu~_ z$J|YHC%dP+OWoz}MefD!rS3|1mAl%#!oAX6@80EZb?ZQ^!tZQMcb5ZA#md?+8rhw~A9 zB<6A=pTei|X_(XLnAO>Q4xh)D@hkWmejR4_2ELB3=Qr^Ud?Vk?AH-Z|gis+&2p1xR zNFhpy7FZ!wm@cGa{$~q0LLRt)S11*h3bjI=P%mr}8iYo0fE_}U&@7ljm>3~Oicw;; z7$e4tabmp4ipgS*SP0%w3hq!YE)o}G?p2B_#RhS^xI=6bo53$y#8z=H_;ZICEyYT4 zQoO`UqNGZ?lz=&zh8bBVl}n4H#nMu#QmT@wr4`Z!sY%);wMebfUdfc&AcYQMrbfuD ztjfBaAScSna*CWPr$H*^$xG!bxmsQ!uas-#b#kq|L9Uax%ck5eAB3dpkQpUZ2~)zA z2qi{IP?D7tB~?jNrYq@6hLWx1DCNpB zwNx!r%hg5dVs)unqi#^^)FyS8+M>3qdsS0yQ`^;p>LE2*%h7n_R^wh{h4F;3-lzv1 zeh3Qu#(2^Fw)Plh%W`}U+a(9B7*6<$T2Jw8kFM8u%WwRoqWv{4jtK+ptv>&yr z!AVv*{^@wa@wDSvNXeHSuR7jvyy90Xr4s>1M zio~oeHl8u|8>hOX-GY0Td%nBY{Ux<`r7gcB*jQF#lhEpHXgdek9BvlhOLznFm$AG!W=4KZXR*(fsZFkUjYVoVMg zBi$3+C79*R28L+|nuFL;tieuWXFTtFVXou~hlP>i zCh<2>m!?Q1(n9GjX|?o(v`K1)?E6dVBVQtWAo(7XpNE|22aH>lKb2E}?I-HFnxI{x z-H)+5poKUh9Py4Bj!bAv*E>obw>j=~EOXq4F?`gq2HMjG^!+Q22FF(P`-hG_j&B`5 zIsS5lI8Sj7bPjc%5AH2F4d_*=&PwOQ&ehI!&X>Wf-*SfN=jh4$OubzHO7GOCx$bg( z<;n&%eu|M9;69heqk&-xp@Y84{>YBv1a35UDY(oB++W-&;3^~eWd15XpT7ZG;y?NI z{JZ?;{GZSh&Jr#bT*Bo-fpD*|Qdlp%FZ?3(5C@89iWiHDm?mb5W2H%Q8Rp-ca){zq z#w))n10mgJL#Ew?nX_7bPd%Xa(E4eoYiDUO8smJ#^)z^UldIXa%hlp)b?tSTt~T)b zgRVoa4i{sD8evAb5n)6ggYWA`f{}>vOfgc8G-JAv4xKF9$bmE{Jcc}|#(Z39)IcuO z8XGVxHyMpS2|@CKq{Bhu5adHB^rr}S6zDe=l7i#}Nr_~4iaQN*BEy~S&T|(+UX)q# zf}{n>iglp#I!KHLccXiUy9tt`#gZH(Hy|~z&<|bAk{e-cI2*}Eu`!qlq$`pPAw7}g zM>?AU36jTpVGopJevmEj82c3aA|%MC?APoM?C)#{cPgxcbGQ*0H5a7EWbSHiHdh3j z;7;ydNRG9T8ZTljw{lI~=iE1--aols{E&bpu$FJ(_hBrPg{i{L;PP(>-wQF~Nbw5r z?T5j$4~tRIpDUzSrN1RkE|%|;m&>c=C*?2YpTJ8y$GPAySy1V5@!?}Y}mN_||dRbNtHRX3~esy}IeX<-hB!*Gnj zyvc#SvpB%@Rzlxd2aRU~be?)>Jq^%%wnOu2g6^{m+D|L=9}^l-C^VlK=sl$IWI*T1 zf!0$9y{8nKPqnk&*?>8;9U4y)be>(%dRn3JkggL4ZHI-vqeA0JfXWB8r@`3 z>2`}wn@JkAGE6;4v=8jjk?ghLdrz`&u=_x3y}7fwNn8cDoO_o0l>3hRjq3+%@(sQT zoRATQ2*be*QiLp_NLV6N3(p9z!B+TEI3UD|f_SO;hWMViNBmVxRpvP6JEFj)ZgDPm zKIa?=Z7~a4Vx#`0euj&8jfbYU!`0h34|dgs#wddamv$J2F~%5YTxv`-CL326GmLAD znZ_*Gg!$m#^PuIeG>Boh0PiQ+_3U$)BOBS**v;%#_HA}2`vG|OXY3yKEB0IVd+@je zu)_X?9rgk564HdZ!aCti;SXV;I6}-8?}3f*lQ>KoEhS0gLHn0WQ>81VtEEiI18ZR} zY?~5Tk~c}WO1Dc(q-D~*uyh`mUY9m04N9Z3UD*NJZdP_FE#UHd6;o+b+Mz)lIzoro zt1;loiarUl@*~~U|I|xe%V1YNj`44H{pk9|)o2Wd#GHsx%W=;I#|U8-VOzrlwg{5w zF7SXizybEKJ-GqgS==!0VornZI1zf|ENF~n@CGck^u`*@{yNP5M#%VPu7%qRz3~Fb zE(f2)PvSHALcWr(hJLv62n}%u-v;gQP&fTB9%Gw!ly~;6cf-A6Qm3&N6M25p(BP6w{$4mO?fyk{3f;tUO9z+z1=530&?Q=!^XnR?(pu zr3Pt;c}k(;1$Qfh2C_(5tSnV3l`5rLS)r^1pIZkRzX86GdgWwPL3UpZY(8F1RIgTZ zpj9qbE7dBsT3w;8gkHH0+-?JO%X)Q_+MqV7+tnS=Gn%hl#;<=RSZomQ)D(CV~$ZIjlZHEP?n9a@vttnJcT zV0rJ=+O@x-lSDd1hweylBs!8EDUMV}nqxX_%M9p*#BU2>VU|MIthQ{+6Y<%0$6-gL zWnU)1!c2yZnF^je{V1+m2_MYU;JU3&6ZU00EX+gTxQrgEhr!N_fTbA)TQkPuz&d8o z6xf+$VIIkMYxR14m);8QYaYdaBP}a40d{6GEKNTj&IA9gI>OG}fZ6!H>oWIDcP`27 zh!9fKnF9FcmVhg+WO-O++qf^eU%0a|heimqgr5XWoFzs`Zc7JTCH)|cmeb`Z_ylfJ zmMh!94=z*JK}p+oDA{WXHAWyY-G?&N0pf@b82|rldoTyrDnu`qeevs4%`T zqTNqW{V^fdSA>b|74YAzX6xBbHk!Mfo5MYW+09`--_1V{&FlxhuOPsBdk361UK}IN z5nmJE5;`F;5h`444|`ki_a6jy^nsXK0rTRAEKWHzIeWV zfqs#Gu`Yl^I`w48#!A;YkYRTNr!Qf9qc0Ldto`u)*dgo%kW!=B%h)T~T=rIW8T&AJ z{|DfXooqOG<3-?yw{rJzd*JVK!RL7`e4VS%OUXjMutsY7)k)`q!t5dP5)jd6rJR$HFYjgHNZZSaov za-Qxy`#AbYIealIpx2WR=184nFFdHB)~q;ED@lfQO@%jRI`scpkg|&{-GnrgT783F zhgq^oZ-DIG4xdbuzDNHaS_*k$;^2#6F;7(ZW4dNa2F9YyRqk4R46h8$md&o6(At^f zYU!!QE5-*#ocn6G$6e&U6&{wy-S4_Tf^Pha`%fCz)DR{VcE}m5z^>)ibK``q!cJI& z{l(M8+2RB8v+`Eh)sKK%Wjbzg{NOwj^FK!~)F0Jf($}H>?f(JW;Trgk?t%Yw6YPPO zfT!pntO371H5eWv-Dd#=YgAs#4k$m$b5vv50~;)h;7Dz27wm%8?mnfA5XMATFl;DG z)Vp z%RfLk9X6Z@{fE4z?+70XZNe~U{p9Me3yU^hWsONzG2WaE9hqY(5H?&mPuCF^J=dIx5oPG=R*`HjZkp){j z)qR)yX&P%7oU~cwLiRf7We3>)urw#~v-vNv@{k7q(^B}FJ`)netHo9D7Y&pil-`qS z;c?ZK1Rr%jW%w3rGJv0B_k2elLHCFh!Ulz&j$m0?${Q&_`6k@7@uw zhwk?_RzuE^E96Vz+5JTk)k`6{|DisuUaT3I`7PQFj)BfsofXDo#`{ZI?w9mBjA+47?E`U$> zE^ysT;GKB{>jmrem-Q`J-Pomnt^ca$xNdi?a=q%>=Nbv?xzKplcmpyg3=-gd_m9+P zD?^wa2+oJp*~o5V_p?uMQ5Y);t3?Ba7-1~Dgf|QK2pF}9n%Q?WPQ1)6n zRynk+YItrMz(Kcza+<(LcVQKvRo)Aq+$i*0vHA$c(1aIzq?V*D0tLOLeW-n{o#vPT zUE?~~bSuCk--5Mvmh&R4gnSO&;7@0yJ_4&n8CV&(L4QDBu9vtzasBC<3~Rp*zOKKF z5pKyn#ytrZ`5W%7w%phdf-{=%dkO607R{Z?#c&I`$Dk#@%zcQpvYzmzp2vImCH&*? zly2vD^E5*)5*$Jz{2W&c*9q4PmBORKYFIa9D{sY|*(H1foB4O4LpTL|>MZy|M~b}Y z78AwGF_*HS?UrB^@3idce~3>(+kI8s3|pvK{8Ic@{6#z@_LBNaL!jr5kVav)C18Xn zV`U=ST18n1FDR{~JTBErFH5gs{i;dY4Z8aY{?8D(w|u%BWv#|3@ClB?n%vcL7FOj- zM{(u+iRArbFt8to38w+pQ6iBOV?RxD7$g8E8 z!T-=+(Y9$jp#`>EGAhCm<%o8~IAR@f@KCYP2vx^8j7))}7^@5GU{kj{)?q{rJ9|J& zGxRa=Hx=on@VdQ+)u|TPzR@lT)@}iKbR#UBqkTK!#@WWX@ZXaUCk6hS^nb&9Q)l^a z8Y~aaj$?TFgLyZ3b0RH&&V_E?ZMf6j`H(~lp;>Hm|Kw&GpkskP&V)~L0z5AdK$rN8 z?Zb_Np5^5pfgNR9e)llT-yX$B^D&qSaaeI=d68G)6HI^)KKU44_(I;xm%z2urL(%b%HQWxC(yxyTK_wgRgA_Xsp!ovRA{$ zUW4_xTF_UWc(gs$;`6z;iS6P+&|HVeNTE`g6n+dVtIHRkjMd*%c;u%;0%U+9i=+kM zJ$GR(c)3(3y(PUX?U8!PqvUDODr+&rH-W-}=XTpMJnoT7loAbpQ7pXH@zA0~MYXJ} zM9U991Ae3Hlp^r>+rZ`TgVwxSc@o@yBfQdYD<3GIDPO^s4udEDY}F0#&|>u|_` zW3+MF9Ozn4f$Q~h40l`x%j98bRBc$_qSdV^%gYn%jDweyg?6QaC!W|2DRYvxwHR9Q z3g?sHISrN%=vY?CV11}QTpxwC>lFQJJrk7w5VWeVu&#B1>rvP9u6c&!*4!@lXm^r( zJUq;oyQjLZgbtJmZ{f@CJ;Y<1LTLGt=?}eUI=c||{WeI%GvU+A}Yt+9#t1;o1s^-n3YdERy*VL-TGkoPhW>m$CkAU zI|m+-p4@o&0)OV-d(N6Xe@Y4xU66mc#+6v@5ZzC@nf4HzkH;{l!e_Y# z{PrpK8TNVhrQ_-*9qdrOG-V z_!+b6bgX7c;y7^{c=vqqF7Xk}s#nFG;un}ZA<{tjBSvAZ>Qc;#S(p)vurJ~VeY2|% z_!kSE@m}`^j41Z!pzXAuV-8kxeqcpt7|(L=a^DD{;yiI5Wcg66dEF^JgSD&)^7ryz z@y=ShMZOby(sK9_Hp72Fz5~;@Iu-0Q7^)4| zMq%y5z)YH`U7=kA`=wO7Q>)NcU^hpr))Tz{GDp7SUaUfV>iFAnt~1G*>s$s8-lwq6 zhrx$eq~8iF{4H1!r(&gLkTKqvW?XMPjCF?7vC7~E#n%w6Ljac}c#!SKy#b$87}oqJ z^4IeVvG=5rKNURgYN14U1RCit!eDWzm;j1TgZv~f(T7;O|4AGG2{{$3e+pW*7;7ls zs~2bvcs0tj<=Qjae(fH|NLVTRUBisapbNZc402C)&jXKt0^WF7v@G^Y!Nw@GsPPqO z%sY;`9vjY`33|K`w3rOPTF$>ngIl?s+{dsszvX^}fAlcdoA1vL=7;jb`BA*g8~iw| z&CUW%mRVBZSSzzO_iyHR!86|q4b+4;uKgJPxG1dG#t5-OoDh$7TTxI2UAR=33~hBL z^pqmd^=-mkpzJ5HGV_}7wa^!O>R9x51y%*0(2^WCI$pvm6yqH2yvli<^A6|Z&ZnHu zIG=aEdF*ZM-Rvs1j`eV_!Xwkp z^+7)u@i*~n_|5#Ue6esV)~H1BR`FT*89x?Jm&Tyw_eo>r$ z%1X6U6}8pcK5ZcMp0QYwYjRwHwSZ=LEqdw$q1}|~_v_z)&hK+=!)jW%aTa{h)$q3u zcmLDs9E7-$O>94?e$C8j5va9s6glf>vE3-v)og3hcOg5&B${yc@jZckH}64SP>6 zf+S5+Cd2oVr_9HWll$R|d>WE-8~o8{Bjl6`kvsQ=AVVF_%e0|y}`f9zlF6wLHJ%y#yWWkJf7bumDrus zg8e4_u@<=itB!k|ef3ZEG}kSVe6um{UvmFNbH1>Lwa2Y5cDR}FzyHm~z-K)jd!WLh zV>{qk-VDANYwaKqVf*Nq^@-R^kb+gfz|~WQ#hw+cM-ard6#OvAdzdaU05$=+njx^ozSXC= z)?+=k25XV6Mm*M^@5jm^`mDSME!8vG?Dgy&*f-J)Oa3rh!99u{exGqF#%m4q#1+s4 zP2mvME^fqbf!D=B(s{7iua;_{pY4>!!+Z50D5Wn}F;amh4$wgtmOAHqW-kKV;+a<@^)A&9Yik)LE(jU?& z*pvU1e~`~tZiGK^uQEiPfR(@()qUzY@USh0-`do|9UHNRcNMg=KJb6>x`x>~4Zg11 zjCYOx?z7=HoC&G<5-h-<-ONf`_MFO|$!1|KWi9(M`ynjB!I+x~Sle32-Op9>k3mal z=Ox&D3$T*4Q`n7pnF~F8HFmB10=~Il(yZB74BKiIX5!n}0mi`_=z^{~2fGk%f&U}j z>C`9d6dSRc)1io1UmQ~KFd?FUU06aXqUnY%+c~7 z^~d?*ZT>xs zV<)^6(XgE^5+rE5mkC#5$A(w99UhCHgul?Q1F(N-l;{+hrXJQ_t^};Qm&3bHyR;b4 zXaW~(src7*;#E;q)pU5E7Fj!hD*q#EHffd}o~L;+0*hdYS3&oxf%mu$l-_9hkXx`W z(*_;CL-UVzN-a$|O^?>dIpfdS9Wz#fhqYeoD&7oIc?C<$`LSK>0!(t0~pc^%Kt>T4&h%28xVFN+=cLO zgzX3qBMifmWhcTITDpwD`BU~1W}rOUf)oRhn2PvO2y?on)4l_`%IzTVov7`Sj}y;OLveNWqn$AV@yV-k7K)v0{jb7vBlcSOujy;?-HZPL zVeI2LQzPiP8P8?D@+ms?Nt{g*^uE3x-^v6%r#y=@M1t}s)X}#zT~{ieSNPgNvAvl@ z<_cykaKss0_}(TJ;aKJ}{J(@rV#YHQnQ_b{{OWfmYM1~Hk~`5K^lqqWx*UH>kw9C^6TrDP=Zt;mabtO>M~r&K|3zuGSGo1*nTs zOE3>9H(~0va-P+#H?mMJ^*g0f8*;7o#4zVs{eB)Z3b8Z-XLNh703~}YOppK0V2p7- zGtcU!T&s@?tv;eRi%{cylx?S$Shc4F+C}&l0VtN7_qKKZ%1glLwQ7=(dPn=FkZK3BJ#NY%U z3s1^VJx1`*PD=2f=qL=OdeHi!Kuj;-N@>KGdZARBTQqyA z2MF6xU(FuhT^{0k`)V%%wqCTy#(~Dn-?KwbNFT+hy%2vy+crH!F;jsh%@v|58a118 zXkHUO)CQV^U86h*{Jqr5SA;a8ID1~uXci*gPZz{BBY-b)YkIpYWftDD`BXMD#Nshj zYY{jDaSWnAKRq9fZ?si=_qu2<#-N@|ltHbq=K=9!59-Z9d$WN{mn15-_&IS_YCCaA zl1=@A?M$m@i!4m2-ATa9o~dr6W?A@Ai-_}4OY@Mkt7UXgGAJ8=G~4Z*!_Y4zF$hQE zE5z4resY0@(**%8?dOljDj^!9J>SBPMmrcY;_)%y?^LqKCv&q=Wc%;`7Ak>|UJd>z5mV2aOx`Wf5ju3G&!H@GNVd9UV_?uuHYW?l_zWP3B074yKK+ z-l35_KJ|q%lYs|~PA~8hKfjC(q7o{}=JV8-w!H5?mux)!)M~edC~iJzusfE=&ujPJ z$>rQR|7Mxg1EhhF=0v>UoTIdW?(HE7PuzprP7;SWJ@HeUmd-fo`?fAZJ>aLmVgDQN z*g9r0D1H>9g7=K@QNLu(44QGI<@v`p7*nFv?rpO5l&+SMj#7*=?OwNM(9x+b%qP3` zv#dTOEiPDpII`B`(+BBDN0)x$x+9J;&PU=Baa6B%pIwnh<>=loeyk!O=W;C`=pSd& z>PRCb-I_S&X_za-HD>!L!>^48%Mu$S;{KG2c!I4bkSy?P!Q(B8B93nBpmvH)EB5>% zc}9In<9IYJodd2!WgYJg(&UJjAFmxlPV#iFWds zk$8@Q1Ryyu7?vmTS{fyin?x%#mubwYb)-{u$*#C#Y6v#|^hS3XY^M-)P%8_AsUz<|9DBeyZT{rGuF5|>=psU2Ff4M}` zc4;2|>u(URCK>v#x7=R`Nj$Qkh)(S?j+QaqIg?*&@xMV_gftdg=lR#)@4_MY{eIxv z$Fl&#!4oe=dNALzHOBs!>3)0LFIPzWuxI$u+}3Ytlh#Zl;sLGxiqKsO;y>_KTHi>a3>4~6#Z^<#00#lefM*+}{y`5guw z#sA5IAzW$xWuXkB-a@Od7-sd-FRE|U9rK4@?>=R~g~Ntmck5De>%;;=p28s{z7trO zh;cLXvgQ=yltm^Yws?MiW^N%9QA{@_-rPJUVmRH-D$HV{FSAc!D`q05(&0up0Pa>C z2xpyL#B8&VhGQbGv5vVzV#K3}8e5QG>}4X(o1B(n-6FbpG*0-M=b6q#3%*mM5P3NY zv<|6?=z+JUqGCkWjh~AHQkcykJ}agH#$#FLM6<#6;>v31Ou z*K3{3`3n;K2e~kj{%-SUJtq$bCgRAKh&$0fZ+;PK9XtW2d@<3HbY$aL94g5~9GvAX aEXH|QOhieJ*LNH3MsJSC0Z+&Awf!#?Epzh# diff --git a/Source/Installer/binno/utility.iss b/Source/Installer/binno/utility.iss deleted file mode 100644 index 03b43d979..000000000 --- a/Source/Installer/binno/utility.iss +++ /dev/null @@ -1,771 +0,0 @@ - -// ;#define UNIT_TEST - -#ifdef UNIT_TEST -[Setup] -AppName=My Program -AppVersion=1.5 -CreateAppDir=no -PrivilegesRequired=admin -#endif - -[Code] -const -HANDLE_FLAG_INHERIT=$00000001; -HANDLE_FLAG_PROTECT_FROM_CLOSE=$00000002; - -STARTF_USESTDHANDLES=$00000100; -STARTF_USESHOWWINDOW=$00000001; - -INFINITE=$FFFFFFFF; - -NORMAL_PRIORITY_CLASS=$00000020; - -type -BI_IP_ADDRESS_STRING = record - String:array[0..16] of byte; - end; - - BI_IP_ADDR_STRING = record - Next:LongWord; - IpAddress:BI_IP_ADDRESS_STRING; - IpMask:BI_IP_ADDRESS_STRING; - Context:LongWord; - end; - - BI_RESOURCE = record - id:string; - path:string; - end; - -BI_IP_ADAPTER_INFO = record - Next:LongWord; - ComboIndex:LongWord; - AdapterName:array[1..260] of byte; - Description:array[1..132] of byte; - AddressLength:integer; - Address:array[0..7] of byte; - Index:LongWord; - _Type:LongWord; - DhcpEnabled:LongWord; - CurrentIpAddress:LongWord; - IpAddressList:BI_IP_ADDR_STRING; - GatewayList:BI_IP_ADDR_STRING; - DhcpServer:BI_IP_ADDR_STRING; - HaveWins:LongWord; - PrimaryWinsServer:BI_IP_ADDR_STRING; - SecondaryWinsServer:BI_IP_ADDR_STRING; - LeaseObtained:array[0..8]of byte; - LeaseExpires:array[0..8] of byte; -end; - -SECURITY_ATTRIBUTES = record - nLength:DWORD; - lpSecurityDescriptor:LongInt; - bInheritHandle:LongInt; -end; - -boola = array[0..10] of BI_IP_ADAPTER_INFO; - -HANDLE = LongInt; -LPSTR = LongInt; -LPBYTE = LongInt; - -PROCESS_INFORMATION = record - hProcess:HANDLE; - hThread:HANDLE; - dwProcessId:DWORD; - dwThreadId:DWORD; -end; - -STARTUPINFO = record - cb:DWORD ; - lpReserved:LPSTR ; - lpDesktop:LPSTR ; - lpTitle:LPSTR ; - dwX:DWORD ; - dwY:DWORD ; - dwXSize:DWORD ; - dwYSize:DWORD ; - dwXCountChars:DWORD ; - dwYCountChars:DWORD ; - dwFillAttribute:DWORD ; - dwFlags:DWORD ; - wShowWindow:WORD ; - cbReserved2:WORD ; - lpReserved2:LPBYTE ; - hStdInput:HANDLE ; - hStdOutput:HANDLE ; - hStdError:HANDLE ; -end; - -var -p:boola; - -function biCreatePipe(var rd,wr:HANDLE;var sa:SECURITY_ATTRIBUTES;nSize:DWORD):integer; - external 'CreatePipe@kernel32.dll stdcall'; - -function biSetHandleInformation(hObject:HANDLE;dwMask,dwFlags:DWORD):integer; - external 'SetHandleInformation@kernel32.dll stdcall'; - -function biCloseHandle(h:HANDLE):integer; - external 'CloseHandle@kernel32.dll stdcall'; - -function biCreateProcess(lpApplicationName:LongInt;lpCommandLine:AnsiString;lpProcessAttributes,lpThreadAttributes:LongInt;bInheritHandles:LongInt;dwCreationFlags:DWORD;lpEnvironment,lpCurrentDirectory:LongInt;var lpStartupInfo:STARTUPINFO;var lpProcessInformation:PROCESS_INFORMATION):integer; - external 'CreateProcessA@kernel32.dll stdcall'; - -function biWaitForSingleObject(h:HANDLE;dwMilliseconds:DWORD):DWORD; - external 'WaitForSingleObject@kernel32.dll stdcall'; - -function biReadFile(hFile:HANDLE;lpBuffer:AnsiString;nNumberOfBytesToRead:DWORD;var lpNumberOfBytesRead:DWORD;lpOverlapped:LongInt):integer; - external 'ReadFile@kernel32.dll stdcall'; - -function biGetAdaptersInfo(var ss:boola;var l:cardinal):integer; - external 'GetAdaptersInfo@Iphlpapi.dll stdcall'; - -function biGetAdaptersInfo2( ss:cardinal;var l:cardinal):integer; - external 'GetAdaptersInfo@Iphlpapi.dll stdcall'; - -function biPathIsDirectoryEmpty(lpString:AnsiString):boolean; - external 'PathIsDirectoryEmptyA@shlwapi.dll stdcall'; - -function biGetMAC():String; -var -l:cardinal; -s:String; -begin - l:=0; - biGetAdaptersInfo2(0,l); - biGetAdaptersInfo(p,l); - s := Format('%.2x%.2x%.2x%.2x%.2x%.2x',[p[0].Address[0],p[0].Address[1],p[0].Address[2],p[0].Address[3],p[0].Address[4],p[0].Address[5]]); - Result := s + s; // mac address concatenated - //end; -end; - - -const - CSIDL_PROGRAM_FILES = $0026; - Codes64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -function PathCombine2(src,more:string):string; -begin - Result:=AddBackSlash(src)+more; -end; - -procedure biPathAppend(var Path:string;More:string); -begin - Path := PathCombine2(Path,More); -end; - -function biIsWildcardPath(Path:string):boolean; -begin - Result := Pos('*',Path) <> 0; -end; - -function biSplitRegistryKey(Key:String;var path:string):integer; -var - rk,p:Integer; - tmp:string; -begin - - p := Pos('\',Key); - tmp := Copy(Key,0,p-1); - path := Copy(Key,p+1,Length(Key)); - - if CompareText(tmp,'HKCR') = 0 then begin - result := HKEY_CLASSES_ROOT; - end else if CompareText(tmp,'HKLM') = 0 then begin - result := HKEY_LOCAL_MACHINE; - end else if CompareText(tmp,'HKCC') = 0 then begin - result := HKEY_CURRENT_CONFIG; - end else if CompareText(tmp,'HKU') = 0 then begin - result := HKEY_USERS; - end else - result := HKEY_CURRENT_USER; - -end; - -function biSplitRegistryKeyNoWOW(Key:String;var path:string):integer; -var - rk,p:Integer; - tmp:string; -begin - - p := Pos('\',Key); - tmp := Copy(Key,0,p-1); - path := Copy(Key,p+1,Length(Key)); - - if not IsWin64 then begin - if CompareText(tmp,'HKCR') = 0 then begin - result := HKEY_CLASSES_ROOT; - end else if CompareText(tmp,'HKLM') = 0 then begin - result := HKEY_LOCAL_MACHINE; - end else if CompareText(tmp,'HKCC') = 0 then begin - result := HKEY_CURRENT_CONFIG; - end else if CompareText(tmp,'HKU') = 0 then begin - result := HKEY_USERS; - end else - result := HKEY_CURRENT_USER; - end else begin - - if CompareText(tmp,'HKCR') = 0 then begin - result := HKCR64; - end else if CompareText(tmp,'HKLM') = 0 then begin - result := HKLM64; - end else if CompareText(tmp,'HKCC') = 0 then begin - result := HKCC64; - end else if CompareText(tmp,'HKU') = 0 then begin - result := HKU64; - end else - result := HKCU64; - - end; - -end; - -function biGetResourceByKey(key:string;var table:array of BI_RESOURCE):string; -var -i:integer; -begin - result := ''; - // find the correct resouce for this id - for i := 0 to GetArrayLength(table)-1 do begin - if table[i].id = key then begin - result := table[i].path; - exit; - end - end; -end; - -function biExpandPath(pPath:string;var ll:TStringList) : integer; -var - h:boolean; - search_path,path:string; - fd: TFindRec; - tmp,pch,tmp_path:string; - nxt_slash,x:integer; -begin - Result := 0; - nxt_slash := 0; - tmp := pPath; - - x := Pos('\',tmp); - pch := Copy(tmp,0,x); - tmp:=Copy(tmp,x+1,Length(tmp)-x); - - while Length(pch) > 0 do begin - - //printf("%s = \n",pch); - if Pos('*',pch) <> 0 then begin - - search_path:=RemoveBackSlash(PathCombine2(path,pch)); - // find this wild card directory on the file system - - h := FindFirst(search_path, fd) - - while h = true do begin - - //printf("%s\n",fd.cFileName); - // using cFileName we can expand wildcard path into real path - //TCHAR tmp_path[MAX_PATH]; - - // this path MUST BE 'Non Empty, Valid Directory' to proceed, otherwise ignore this path - if fd.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then begin - - tmp_path:=PathCombine2(path,fd.Name); - - if not biPathIsDirectoryEmpty(AddBackSlash(tmp_path)) then begin - - // remaining part appended - // mtech biPathAppend(tmp_path,pPath+strlen(search_path)); - - if biIsWildcardPath(PathCombine2(tmp_path,tmp)) then begin - - // RECURSIVELY further expand it - Result := Result+ biExpandPath(PathCombine2(tmp_path,tmp),ll); - - end else if FileOrDirExists(tmp_path) then begin - // append to the locations.. - ll.Add(tmp_path); - - Result:=Result+1; // increment number of returns - end - end; - end; - - // rest of the path is added at the end regarless of containment of * - - h := FindNext(fd); - if not h then FindClose(fd); - - end; // while - - // do not process the loop further - break; - - end else begin - - biPathAppend(path,pch); - //printf("safe path: %s\n",path); - - end; - - //// get next token from the path - x := Pos('\',tmp); - if x <> 0 then begin - pch := Copy(tmp,0,x); - tmp:=Copy(tmp,x+1,Length(tmp)-x); - end else begin - pch := tmp - end; - - end; - -end; - - -function biCheckFileSystem(var version:string;var fl,ll:TStringList):boolean; -var - FindRec: TFindRec; - f,x:integer; - tf:string; -begin - - Result := false; - - if ll.Count <= 0 then Exit; - - // looking through the file systme - for f := 0 To fl.Count - 1 do - begin - for x := 0 To ll.Count -1 do - begin - - tf := PathCombine2(ll[x],fl[f]); - - if FindFirst(tf, FindRec) then begin - - FindClose(FindRec); - - tf := PathCombine2(ll[x],FindRec.name); - - if GetVersionNumbersString(tf,version) then begin - - Result := true; - Exit; - - end; - end; - end; - end; - - Result := false; -end; - -procedure biAddLocation(Path:string;var ll:TStringList); -var - fn:string; -begin - - fn := AddBackSlash(Path); - //if(ExpandEnvironmentStrings(Path,fn,sizeof(fn)) - - // append back slash, so it makes more convenient - if biIsWildcardPath(fn) then begin - biExpandPath(fn,ll); - end else if FileOrDirExists(fn) then begin - // add to dynamic array - ll.Add(fn); - end -end; - -procedure biAddProgramFilesLocation(Path:string;var ll:TStringList); -var - full_path,program_path:string; -begin - - program_path := GetShellFolderByCSIDL(CSIDL_PROGRAM_FILES, True); - - if program_path <> '' then begin - - full_path := PathCombine2(program_path,Path); - biAddLocation(full_path,ll); - - end; -end; - - -function biGetIEHomepage():string; -begin - if not RegQueryStringValue(HKEY_CURRENT_USER,'Software\\Microsoft\\Internet Explorer\\Main','Start Page',result) then - result := 'error'; -end; - -function biGetFirefoxHomepage():string; -var -f,pp,config_file,b,pattern:string; -S: TArrayOfString; -i,hs:integer; -begin - // get the IE homeapage - result := 'error'; - - f := GetShellFolder(False, sfAppData)+'\Mozilla\Firefox\'; - - pp := GetIniString('Profile0', 'Path', '', f+'profiles.ini'); - - config_file := f + pp + '\prefs.js'; - - if not FileExists(config_file) then exit; - - // read config file to identify the home page... - LoadStringsFromFile(config_file,S); - - pattern := 'user_pref("browser.startup.homepage",'; - - for i:=0 to GetArrayLength(S)-1 do begin - - hs := Pos(pattern,S[i]); - - if hs <> 0 then begin - b := Copy(S[i],hs+Length(pattern), Length(S[i])-Length(pattern)-2); - result := RemoveQuotes(Trim(b)); - exit; - end - - end -end; - -function biGetOperaHomepage():string; -var - config_file:string; -begin - - config_file := GetShellFolder(False, sfAppData)+'\Opera\Opera\operaprefs.ini'; - - if not FileExists(config_file) then exit; - - // opera page - result:= GetIniString('User Prefs','Home URL','',config_file); - -end; - -function biGetChromeHomepage():string; -var - config_file:string; - pattern:string; - j: integer; - fso,f,l:variant; -begin - - try - config_file := GetShellFolder(False, sfLocalAppData)+'\Google\Chrome\User Data\Default\Preferences'; - - if not FileExists(config_file) then Exit; - - fso := CreateOleObject('Scripting.FileSystemObject'); - - f := fso.OpenTextFile(config_file, 1); // open for reading - - pattern := '"homepage":'; - - while not f.AtEndOfStream do begin - l := f.ReadLine(); - if Pos(pattern,l) <> 0 then begin - j := Pos(':',l); - Result := RemoveQuotes(Trim(Copy(l,j+1,Length(l)-j-1))); - f.Close(); - Exit; - end - - end; - - f.Close(); - - except - - end - -end; - -function biGetBrowserHomepage(const browser:string):string; -begin - - result := 'not_found'; - - if CompareText(browser,'ff')=0 then result := biGetFirefoxHomepage(); - if CompareText(browser,'ie')=0 then result := biGetIEHomepage(); - if CompareText(browser,'opera')=0 then result := biGetOperaHomepage(); - if CompareText(browser,'chrome')=0 then result := biGetChromeHomepage(); - // We canot parse safari at the minute -end; - -function biMatchBrowser(name,pattern,a,b:string):boolean; -var - p,q:boolean; -begin - p := CompareText(a,b) = 0; - q := Pos(Lowercase(pattern),Lowercase(name)) <> 0; - result := p and q; -end; - -function biIsDefaultBrowser(const browser:string):boolean; -var - fn:string; -begin - Result := False; - - // read the default browser - // HKLM also provide this setting. but HKCU is more effective - - fn := ''; - if not RegQueryStringValue(HKEY_CURRENT_USER,'SOFTWARE\\Clients\\StartMenuInternet','',fn) or (fn = '') then begin - RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\\Clients\\StartMenuInternet','',fn) - end; - - if fn <> '' then begin - if biMatchBrowser(fn,'firefox',browser,'ff') - or biMatchBrowser(fn,'iexplore',browser,'ie') - or biMatchBrowser(fn,'chrome',browser,'chrome') - or biMatchBrowser(fn,'opera',browser,'opera') - or biMatchBrowser(fn,'safari',browser,'safari') then Result := True; - end - -end; - -function biGetInstalledBrowserVersion(name:string;var v:string):bool; -var - fl:TStringList; - ll:TStringList; -begin - - fl := TStringList.Create; - ll := TStringList.Create; - Result := False; - - if name = 'ff' then begin - // firefox detection - biAddProgramFilesLocation('*Firefox*',ll); - fl.Add('Firefox.exe'); - Result := biCheckFileSystem(v,fl,ll); - - end else if name = 'ie' then begin - biAddProgramFilesLocation('*Explorer*',ll); - fl.Add('iexplore.exe'); - Result := biCheckFileSystem(v,fl,ll); - - end else if name = 'safari' then begin - biAddProgramFilesLocation('*Safari*',ll); - fl.Add('safari.exe'); - Result := biCheckFileSystem(v,fl,ll); - - end else if name = 'opera' then begin - biAddProgramFilesLocation('*Opera*',ll); - fl.Add('opera.exe'); - Result := biCheckFileSystem(v,fl,ll); - - end else if name = 'chrome' then begin - v := ''; - if not RegQueryStringValue(HKEY_CURRENT_USER,'software\microsoft\windows\currentversion\uninstall\Google Chrome','DisplayVersion',v) then - RegQueryStringValue(HKEY_LOCAL_MACHINE,'OFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome','DisplayVersion',v); - - Result := v <> ''; - - end -end; - - -procedure biGetAllBrowserDetails(var post:string); -var -version:string; -browsers:array[0..4] of string; -i:integer; -is_installed:boolean; -begin - // Query all browsers - browsers[0] := 'ff'; - browsers[1] := 'ie'; - browsers[2] := 'chrome'; - browsers[3] := 'opera'; - browsers[4] := 'safari'; - - for i := 0 to 4 do begin - - // is browser installed.. - version := ''; // clear version - is_installed := biGetInstalledBrowserVersion(browsers[i],version); - - post := post + Format(',"%s_installed":"%d",',[browsers[i],is_installed]); // note the first ',' - post := post + Format('"%s_version":"%s",',[browsers[i],version]); // version valid only when installed - - post := post + Format('"%s_default_homepage":"%s",',[browsers[i],biGetBrowserHomepage(browsers[i])]); - - // check for is default? - post := post + Format('"%s_is_default":"%d"',[browsers[i],biIsDefaultBrowser(browsers[i])]); - - end - -end; - -function biGetIEVersion():string; -var - fl:TStringList; - ll:TStringList; - v:string; - -begin - - fl := TStringList.Create; - ll := TStringList.Create; - - biAddProgramFilesLocation('*Explorer*',ll); - fl.Add('iexplore.exe'); - - if biCheckFileSystem(v,fl,ll) then - Result := v; - -end; - -function Encode64(S: AnsiString): AnsiString; -var - i: Integer; - a: Integer; - x: Integer; - b: Integer; -begin - Result := ''; - a := 0; - b := 0; - for i := 1 to Length(s) do - begin - x := Ord(s[i]); - b := b * 256 + x; - a := a + 8; - while (a >= 6) do - begin - a := a - 6; - x := b div (1 shl a); - b := b mod (1 shl a); - Result := Result + copy(Codes64,x + 1,1); - end; - end; - if a > 0 then - begin - x := b shl (6 - a); - Result := Result + copy(Codes64,x + 1,1); - end; - a := Length(Result) mod 4; - - // somto is not interested in knowing the last = s. so we donot add them... - //;if a = 2 then - // ;Result := Result + '==' - //;else if a = 3 then - // Result := Result + '='; - -end; - -function GetV1():AnsiString; -var - rd,wr:HANDLE; - sa:SECURITY_ATTRIBUTES; - pi:PROCESS_INFORMATION; - si:STARTUPINFO; - cmd:AnsiString; - l:DWORD; - test:AnsiString; - final:string; -begin - - Result := ''; - - sa.nLength := sizeof(sa); - sa.lpSecurityDescriptor := 0; - sa.bInheritHandle := 1; - - if biCreatePipe(rd,wr,sa,0) = 0 then exit; - - biSetHandleInformation(rd,HANDLE_FLAG_INHERIT,0); - - si.cb:=sizeof(si); - si.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW; - si.wShowWindow := SW_HIDE; - si.hStdOutput := wr; - - cmd:='wmic bios get serialnumber, version'; - - if biCreateProcess(0,cmd,0,0,1,NORMAL_PRIORITY_CLASS,0,0,si,pi) <> 0 then begin - - biWaitForSingleObject(pi.hProcess,INFINITE); - - biCloseHandle(pi.hThread); - biCloseHandle(pi.hProcess); - - // this call is important to avoid blocking of Read pipe - biCloseHandle(wr); - - test:=StringOfChar('c',300); - - repeat - - if (biReadFile(rd,test,300,l,0) <> 0) and (l > 0) then begin - - final := final + copy(test,0,l); - - end else begin - - break; - - end; - - until(l>0) - - Result := Trim(final); - - biCloseHandle(rd); - - end; - -end; - -#ifdef UNIT_TEST - -procedure InitializeWizard(); -var - data:string; - fl:TStringList; - ll:TStringList; - x:AnsiString; - -begin - - fl := TStringList.Create; - ll := TStringList.Create; - - fl.Add('safari.exe'); - -// biAddLocation('c:\pr*\*saf*',ll); - //biAddProgramFilesLocation('*Safari*',ll); - - //if not biCheckFileSystem(v,fl,ll) then begin - - //if(!GetVersionFromRegistry(&SwInfo)) - //return FALSE; -// end - - //biGetAllBrowserDetails(data); - x := Encode64(GetV1()); - - - MsgBox(x, mbInformation, MB_OK); - - -end; - -#endif - - - - - - - From 7976bf832aa377cfcb2c08d30ebf9fda32dccb70 Mon Sep 17 00:00:00 2001 From: MELERIX Date: Tue, 17 Nov 2015 02:08:16 -0300 Subject: [PATCH 002/559] unneeded --- Source/Installer/Installer.iss | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/Source/Installer/Installer.iss b/Source/Installer/Installer.iss index dcf06ef5c..fac6c1890 100644 --- a/Source/Installer/Installer.iss +++ b/Source/Installer/Installer.iss @@ -46,28 +46,3 @@ Name: "{commonprograms}\Project64 2.2\Project64"; Filename: "{app}\Project64.exe Name: "{commonprograms}\Project64 2.2\Uninstall Project64 2.2"; Filename: "{uninstallexe}"; Parameters: "/LOG" Name: "{commonprograms}\Project64 2.2\Support"; Filename: "http://forum.pj64-emu.com" -[Code] -function HaveCommandlineParam (inParam: String): Boolean; -var - LoopVar : Integer; -begin - LoopVar := 1; - Result := false; - - while LoopVar <= ParamCount do - begin - if ((ParamStr(LoopVar) = '-' + inParam) or (ParamStr(LoopVar) = '/' + inParam)) then - begin - Result := true; - Break; - end; - LoopVar := LoopVar + 1; - end; -end; - -procedure InitializeWizard(); -begin - if ((WizardSilent() <> true) and (HaveCommandlineParam('noads') <> true)) then begin - CreateBINNOPage(wpSelectTasks,'pj64emu','pj64emu'); - end; -end; From cb3ada6ece10b6648805937545ea16c354be8f43 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Tue, 9 Feb 2016 16:59:46 -0800 Subject: [PATCH 003/559] Optimize CheckInterrupts Using local variables significantly improves the performance. --- .../N64System/Mips/RegisterClass.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/RegisterClass.cpp b/Source/Project64-core/N64System/Mips/RegisterClass.cpp index f0283f6d3..aac7e23a9 100644 --- a/Source/Project64-core/N64System/Mips/RegisterClass.cpp +++ b/Source/Project64-core/N64System/Mips/RegisterClass.cpp @@ -307,14 +307,15 @@ void CRegisters::SetAsCurrentSystem() void CRegisters::CheckInterrupts() { + uint32_t mi_intr_reg = MI_INTR_REG, status_register; if (!m_System->bFixedAudio() && CpuType() != CPU_SyncCores) { - MI_INTR_REG &= ~MI_INTR_AI; - MI_INTR_REG |= (m_AudioIntrReg & MI_INTR_AI); + mi_intr_reg &= ~MI_INTR_AI; + mi_intr_reg |= (m_AudioIntrReg & MI_INTR_AI); } - MI_INTR_REG |= (m_RspIntrReg & MI_INTR_SP); - MI_INTR_REG |= (m_GfxIntrReg & MI_INTR_DP); - if ((MI_INTR_MASK_REG & MI_INTR_REG) != 0) + mi_intr_reg |= (m_RspIntrReg & MI_INTR_SP); + mi_intr_reg |= (m_GfxIntrReg & MI_INTR_DP); + if ((MI_INTR_MASK_REG & mi_intr_reg) != 0) { FAKE_CAUSE_REGISTER |= CAUSE_IP2; } @@ -322,21 +323,23 @@ void CRegisters::CheckInterrupts() { FAKE_CAUSE_REGISTER &= ~CAUSE_IP2; } + MI_INTR_REG = mi_intr_reg; + status_register = STATUS_REGISTER; - if ((STATUS_REGISTER & STATUS_IE) == 0) + if ((status_register & STATUS_IE) == 0) { return; } - if ((STATUS_REGISTER & STATUS_EXL) != 0) + if ((status_register & STATUS_EXL) != 0) { return; } - if ((STATUS_REGISTER & STATUS_ERL) != 0) + if ((status_register & STATUS_ERL) != 0) { return; } - if ((STATUS_REGISTER & FAKE_CAUSE_REGISTER & 0xFF00) != 0) + if ((status_register & FAKE_CAUSE_REGISTER & 0xFF00) != 0) { if (m_FirstInterupt) { From ad5370a252815e868564dfa55b519a4dbdf4d66c Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Tue, 9 Feb 2016 17:21:29 -0800 Subject: [PATCH 004/559] Statically round up PI_WR_LEN_REG to nearest even --- Source/Project64-core/N64System/Mips/Dma.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Dma.cpp b/Source/Project64-core/N64System/Mips/Dma.cpp index 86d7fde61..9c7120e53 100644 --- a/Source/Project64-core/N64System/Mips/Dma.cpp +++ b/Source/Project64-core/N64System/Mips/Dma.cpp @@ -198,12 +198,8 @@ void CDMA::PI_DMA_READ() void CDMA::PI_DMA_WRITE() { - uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1; - - if ((PI_WR_LEN_REG & 1) != 0) - { - PI_WR_LEN_REG += 1; /* fixes AI Shougi 3, Doraemon 3, etc. */ - } + uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFEul) + 2; + /* rounding PI_WR_LEN_REG up to the nearest even number fixes AI Shougi 3, Doraemon 3, etc. */ g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY; if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize()) From b066192abf4809ec08ffae9cacb5377725ec8979 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Tue, 9 Feb 2016 18:13:21 -0800 Subject: [PATCH 005/559] Optimize commonly executed loop in PI_DMA_WRITE --- Source/Project64-core/N64System/Mips/Dma.cpp | 58 +++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Dma.cpp b/Source/Project64-core/N64System/Mips/Dma.cpp index 9c7120e53..26d62defa 100644 --- a/Source/Project64-core/N64System/Mips/Dma.cpp +++ b/Source/Project64-core/N64System/Mips/Dma.cpp @@ -362,9 +362,63 @@ void CDMA::PI_DMA_WRITE() g_Reg->PI_CART_ADDR_REG -= 0x10000000; if (g_Reg->PI_CART_ADDR_REG + PI_WR_LEN_REG < g_Rom->GetRomSize()) { - for (i = 0; i < PI_WR_LEN_REG; i++) + size_t alignment; + RDRAM += g_Reg->PI_DRAM_ADDR_REG; + ROM += g_Reg->PI_CART_ADDR_REG; + alignment = PI_WR_LEN_REG | (size_t)RDRAM | (size_t)ROM; + if ((alignment & 0x3) == 0) { - *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)); + for (i = 0; i < PI_WR_LEN_REG; i += 4) + { + *(uint32_t *)(RDRAM + i) = *(uint32_t *)(ROM + i); + } + } + else if ((alignment & 1) == 0) + { + if ((PI_WR_LEN_REG & 2) == 0) + { + if (((size_t)RDRAM & 2) == 0) + { + for (i = 0; i < PI_WR_LEN_REG; i += 4) + { + *(uint16_t *)(((size_t)RDRAM + i) + 2) = *(uint16_t *)(((size_t)ROM + i) - 2); + *(uint16_t *)(((size_t)RDRAM + i) + 0) = *(uint16_t *)(((size_t)ROM + i) + 4); + } + } + else + { + if (((size_t)ROM & 2) == 0) + { + for (i = 0; i < PI_WR_LEN_REG; i += 4) + { + *(uint16_t *)(((size_t)RDRAM + i) - 2) = *(uint16_t *)(((size_t)ROM + i) + 2); + *(uint16_t *)(((size_t)RDRAM + i) + 4) = *(uint16_t *)(((size_t)ROM + i) + 0); + } + } + else + { + for (i = 0; i < PI_WR_LEN_REG; i += 4) + { + *(uint16_t *)(((size_t)RDRAM + i) - 2) = *(uint16_t *)(((size_t)ROM + i) - 2); + *(uint16_t *)(((size_t)RDRAM + i) + 4) = *(uint16_t *)(((size_t)ROM + i) + 4); + } + } + } + } + else + { + for (i = 0; i < PI_WR_LEN_REG; i += 2) + { + *(uint16_t *)(((size_t)RDRAM + i) ^ 2) = *(uint16_t *)(((size_t)ROM + i) ^ 2); + } + } + } + else + { + for (i = 0; i < PI_WR_LEN_REG; i++) + { + *(uint8_t *)(((size_t)RDRAM + i) ^ 3) = *(uint8_t *)(((size_t)ROM + i) ^ 3); + } } } else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize()) From b483b76504de02e5ff4cbc2dfd1388ccd741f5be Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Tue, 9 Feb 2016 18:20:05 -0800 Subject: [PATCH 006/559] Optimize UpdateTimers for when wired != 0 --- Source/Project64-core/N64System/Mips/SystemTiming.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/SystemTiming.cpp b/Source/Project64-core/N64System/Mips/SystemTiming.cpp index 736e9518b..fec090eeb 100644 --- a/Source/Project64-core/N64System/Mips/SystemTiming.cpp +++ b/Source/Project64-core/N64System/Mips/SystemTiming.cpp @@ -161,12 +161,12 @@ void CSystemTimer::UpdateTimers() int TimeTaken = m_LastUpdate - m_NextTimer; if (TimeTaken != 0) { - uint32_t random, wired; + int32_t random, wired; m_LastUpdate = m_NextTimer; g_Reg->COUNT_REGISTER += TimeTaken; random = g_Reg->RANDOM_REGISTER - (TimeTaken / g_System->CountPerOp()); wired = g_Reg->WIRED_REGISTER; - if ((int)random < (int)wired) + if (random < wired) { if (wired == 0) { @@ -175,10 +175,7 @@ void CSystemTimer::UpdateTimers() else { uint32_t increment = 32 - wired; - do - { - random += increment; - } while ((int)random < (int)wired); + random += ((wired - random + increment - 1) / increment) * increment; } } g_Reg->RANDOM_REGISTER = random; From 3d7346239d0e07136c94dac612a14007befa10b8 Mon Sep 17 00:00:00 2001 From: Date: Mon, 15 Feb 2016 13:39:28 -0500 Subject: [PATCH 007/559] [RSP] Optimize compiling scalar whole selections. --- Source/RSP/Recompiler Ops.c | 92 ++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 448d2d3f3..1513dfe83 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -2124,7 +2124,7 @@ Boolean Compile_Vector_VMULF_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; /* NOTE: Problem here is the lack of +/- 0x8000 rounding */ @@ -2143,7 +2143,7 @@ Boolean Compile_Vector_VMULF_MMX(void) sprintf(Reg, "RSP_Vect[%i].UHW[4]", RSPOpC.rt); MmxPmulhwRegToVariable(x86_MM1, &RSP_Vect[RSPOpC.rt].UHW[4], Reg); } - } else if ((RSPOpC.rs & 0xF) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPmulhwRegToReg(x86_MM0, x86_MM2); MmxPmulhwRegToReg(x86_MM1, x86_MM2); @@ -2170,7 +2170,7 @@ void Compile_Vector_VMULF ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(EntireAccum, CompilePC); Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); @@ -2273,7 +2273,7 @@ Boolean Compile_Vector_VMUDL_MMX(void) MmxPmulhuwRegToReg(x86_MM0, x86_MM2); MmxPmulhuwRegToReg(x86_MM1, x86_MM3); } - } else if ((RSPOpC.rs & 0xF) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPmulhuwRegToReg(x86_MM0, x86_MM2); MmxPmulhuwRegToReg(x86_MM1, x86_MM2); @@ -2298,7 +2298,7 @@ void Compile_Vector_VMUDL ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(EntireAccum, CompilePC); @@ -2386,7 +2386,7 @@ Boolean Compile_Vector_VMUDM_MMX(void) MmxPsrawImmed(x86_MM3, 15); MmxPmullwRegToReg(x86_MM2, x86_MM4); MmxPmullwRegToReg(x86_MM3, x86_MM5); - } else if ((RSPOpC.rs & 0xF) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM4); /* Copy the signed portion */ @@ -2439,7 +2439,7 @@ void Compile_Vector_VMUDM ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(EntireAccum, CompilePC); @@ -2526,7 +2526,7 @@ Boolean Compile_Vector_VMUDN_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -2539,7 +2539,7 @@ Boolean Compile_Vector_VMUDN_MMX(void) MmxPmullwVariableToReg(x86_MM0, &RSP_Vect[RSPOpC.rt].UHW[0], Reg); sprintf(Reg, "RSP_Vect[%i].UHW[4]", RSPOpC.rt); MmxPmullwVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rt].UHW[4], Reg); - } else if ((RSPOpC.rs & 0xF) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPmullwRegToReg(x86_MM0, x86_MM2); MmxPmullwRegToReg(x86_MM1, x86_MM2); @@ -2564,7 +2564,7 @@ void Compile_Vector_VMUDN ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(EntireAccum, CompilePC); @@ -2630,7 +2630,7 @@ Boolean Compile_Vector_VMUDH_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].HW[0]", RSPOpC.rd); @@ -2659,7 +2659,7 @@ Boolean Compile_Vector_VMUDH_MMX(void) MmxPmullwRegToReg(x86_MM1, x86_MM3); MmxPmulhwRegToReg(x86_MM5, x86_MM3); } - } else if ((RSPOpC.rs & 0x0f) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPmullwRegToReg(x86_MM0, x86_MM2); @@ -2703,7 +2703,7 @@ void Compile_Vector_VMUDH ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(EntireAccum, CompilePC); @@ -2836,7 +2836,7 @@ void Compile_Vector_VMACF ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmacf @@ -2907,7 +2907,7 @@ void Compile_Vector_VMADL ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmadl @@ -2976,7 +2976,7 @@ void Compile_Vector_VMADM ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (SPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmadm @@ -3059,7 +3059,7 @@ void Compile_Vector_VMADN ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmadn @@ -3133,7 +3133,7 @@ void Compile_Vector_VMADH ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmadh @@ -3265,7 +3265,7 @@ Boolean Compile_Vector_VADD_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -3273,7 +3273,7 @@ Boolean Compile_Vector_VADD_MMX(void) sprintf(Reg, "RSP_Vect[%i].UHW[4]", RSPOpC.rd); MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); - if ((RSPOpC.rs & 15) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPaddswRegToReg(x86_MM0, x86_MM2); MmxPaddswRegToReg(x86_MM1, x86_MM2); @@ -3310,7 +3310,7 @@ void Compile_Vector_VADD ( void ) { int count, el, del; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); Boolean bFlagUseage = UseRspFlags(CompilePC); @@ -3387,7 +3387,7 @@ Boolean Compile_Vector_VSUB_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -3431,7 +3431,7 @@ void Compile_Vector_VSUB ( void ) { int count, el, del; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); - Boolean bOptimize = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); Boolean bFlagUseage = UseRspFlags(CompilePC); @@ -3510,7 +3510,7 @@ Boolean Compile_Vector_VABS_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -3682,7 +3682,7 @@ void Compile_Vector_VADDC ( void ) { Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; #ifndef CompileVaddc Cheat_r4300iOpcode(RSP_Vector_VADDC,"RSP_Vector_VADDC"); return; @@ -3747,7 +3747,7 @@ void Compile_Vector_VSUBC ( void ) { Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; #ifndef CompileVsubc Cheat_r4300iOpcode(RSP_Vector_VSUBC,"RSP_Vector_VSUBC"); return; @@ -4080,7 +4080,7 @@ Boolean Compile_Vector_VGE_MMX(void) { char Reg[256]; - if ((RSPOpC.rs & 0xF) >= 2 && (RSPOpC.rs & 0xF) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0xF) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC)); @@ -4098,19 +4098,19 @@ Boolean Compile_Vector_VGE_MMX(void) MmxMoveQwordVariableToReg(x86_MM4, &RSP_Vect[RSPOpC.rt].HW[0], Reg); sprintf(Reg, "RSP_Vect[%i].HW[4]", RSPOpC.rt); MmxMoveQwordVariableToReg(x86_MM5, &RSP_Vect[RSPOpC.rt].HW[4], Reg); - } else if ((RSPOpC.rs & 0x0f) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM4); } else { RSP_MultiElement2Mmx(x86_MM4, x86_MM5); } MmxCompareGreaterWordRegToReg(x86_MM2, x86_MM4); - MmxCompareGreaterWordRegToReg(x86_MM3, ((RSPOpC.rs & 0x0f) >= 8) ? x86_MM4 : x86_MM5); + MmxCompareGreaterWordRegToReg(x86_MM3, (RSPOpC.rs & 8) ? x86_MM4 : x86_MM5); MmxPandRegToReg(x86_MM0, x86_MM2); MmxPandRegToReg(x86_MM1, x86_MM3); MmxPandnRegToReg(x86_MM2, x86_MM4); - MmxPandnRegToReg(x86_MM3, ((RSPOpC.rs & 0x0f) >= 8) ? x86_MM4 : x86_MM5); + MmxPandnRegToReg(x86_MM3, (RSPOpC.rs & 8) ? x86_MM4 : x86_MM5); MmxPorRegToReg(x86_MM0, x86_MM2); MmxPorRegToReg(x86_MM1, x86_MM3); @@ -4276,7 +4276,7 @@ Boolean Compile_Vector_VAND_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -4284,7 +4284,7 @@ Boolean Compile_Vector_VAND_MMX(void) sprintf(Reg, "RSP_Vect[%i].UHW[4]", RSPOpC.rd); MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); - if ((RSPOpC.rs & 0xF) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPandRegToReg(x86_MM0, x86_MM2); MmxPandRegToReg(x86_MM1, x86_MM2); @@ -4315,7 +4315,7 @@ void Compile_Vector_VAND(void) char Reg[256]; int el, del, count; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); #ifndef CompileVand @@ -4370,7 +4370,7 @@ Boolean Compile_Vector_VNAND_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -4379,7 +4379,7 @@ Boolean Compile_Vector_VNAND_MMX(void) MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); MmxPcmpeqwRegToReg(x86_MM7, x86_MM7); - if ((RSPOpC.rs & 0xF) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPandRegToReg(x86_MM0, x86_MM2); MmxPandRegToReg(x86_MM1, x86_MM2); @@ -4411,7 +4411,7 @@ void Compile_Vector_VNAND ( void ) { char Reg[256]; int el, del, count; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); #ifndef CompileVnand @@ -4468,7 +4468,7 @@ Boolean Compile_Vector_VOR_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -4478,7 +4478,7 @@ Boolean Compile_Vector_VOR_MMX(void) if ((RSPOpC.rs & 0xF) < 2 && (RSPOpC.rd == RSPOpC.rt)) { - } else if ((RSPOpC.rs & 0xF) >= 8) { + } else if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPorRegToReg(x86_MM0, x86_MM2); MmxPorRegToReg(x86_MM1, x86_MM2); @@ -4507,7 +4507,7 @@ Boolean Compile_Vector_VOR_MMX(void) void Compile_Vector_VOR ( void ) { char Reg[256]; int el, del, count; - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); #ifndef CompileVor @@ -4559,7 +4559,7 @@ Boolean Compile_Vector_VNOR_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; sprintf(Reg, "RSP_Vect[%i].UHW[0]", RSPOpC.rd); @@ -4568,7 +4568,7 @@ Boolean Compile_Vector_VNOR_MMX(void) MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); MmxPcmpeqwRegToReg(x86_MM7, x86_MM7); - if ((RSPOpC.rs & 0xF) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxPorRegToReg(x86_MM0, x86_MM2); MmxPorRegToReg(x86_MM1, x86_MM2); @@ -4599,7 +4599,7 @@ Boolean Compile_Vector_VNOR_MMX(void) void Compile_Vector_VNOR ( void ) { char Reg[256]; int el, del, count; - Boolean bElement = ((RSPOpC.rs & 0xF) >= 8) ? TRUE : FALSE; + Boolean bElement = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); #ifndef CompileVnor @@ -4653,7 +4653,7 @@ Boolean Compile_Vector_VXOR_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; if ((RSPOpC.rs & 0xF) < 2 && (RSPOpC.rd == RSPOpC.rt)) { @@ -4671,7 +4671,7 @@ Boolean Compile_Vector_VXOR_MMX(void) sprintf(Reg, "RSP_Vect[%i].UHW[4]", RSPOpC.rd); MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); - if ((RSPOpC.rs & 0xF) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxXorRegToReg(x86_MM0, x86_MM2); MmxXorRegToReg(x86_MM1, x86_MM2); @@ -4734,7 +4734,7 @@ Boolean Compile_Vector_VNXOR_MMX(void) /* Do our MMX checks here */ if (IsMmxEnabled == FALSE) return FALSE; - if ((RSPOpC.rs & 0x0f) >= 2 && (RSPOpC.rs & 0x0f) <= 7 && IsMmx2Enabled == FALSE) + if ((RSPOpC.rs & 0x0f) >= 2 && !(RSPOpC.rs & 8) && IsMmx2Enabled == FALSE) return FALSE; if ((RSPOpC.rs & 0xF) < 2 && (RSPOpC.rd == RSPOpC.rt)) { @@ -4753,7 +4753,7 @@ Boolean Compile_Vector_VNXOR_MMX(void) MmxMoveQwordVariableToReg(x86_MM1, &RSP_Vect[RSPOpC.rd].UHW[4], Reg); MmxPcmpeqwRegToReg(x86_MM7, x86_MM7); - if ((RSPOpC.rs & 0xF) >= 8) { + if (RSPOpC.rs & 8) { RSP_Element2Mmx(x86_MM2); MmxXorRegToReg(x86_MM0, x86_MM2); MmxXorRegToReg(x86_MM1, x86_MM2); From 30aedd45babadc6726cab3019f82bc23a1ec68f8 Mon Sep 17 00:00:00 2001 From: Date: Mon, 15 Feb 2016 14:12:33 -0500 Subject: [PATCH 008/559] [RSP] typo in re-compiler ops --- Source/RSP/Recompiler Ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 1513dfe83..ae9f23c72 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -2976,7 +2976,7 @@ void Compile_Vector_VMADM ( void ) { char Reg[256]; int count, el, del; - Boolean bOptimize = (SPOpC.rs & 8) ? TRUE : FALSE; + Boolean bOptimize = (RSPOpC.rs & 8) ? TRUE : FALSE; Boolean bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC); #ifndef CompileVmadm From b349f3c2395f916ea5fb7e089403587a6b92d043 Mon Sep 17 00:00:00 2001 From: Date: Mon, 15 Feb 2016 15:10:49 -0500 Subject: [PATCH 009/559] [RSP] Use the central EXPORT #define for spec funcs. --- Source/RSP/Main.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/RSP/Main.cpp b/Source/RSP/Main.cpp index c31481943..22a34b22b 100644 --- a/Source/RSP/Main.cpp +++ b/Source/RSP/Main.cpp @@ -164,7 +164,7 @@ void DisplayError(char* Message, ...) input: none output: none *******************************************************************/ -__declspec(dllexport) void CloseDLL (void) +EXPORT void CloseDLL(void) { FreeMemory(); } @@ -176,7 +176,7 @@ __declspec(dllexport) void CloseDLL (void) input: a handle to the window that calls this function output: none *******************************************************************/ -__declspec(dllexport) void DllAbout ( HWND hParent ) +EXPORT void DllAbout(HWND hParent) { MessageBox(hParent,AboutMsg(),"About",MB_OK | MB_ICONINFORMATION ); } @@ -217,7 +217,7 @@ void FixMenuState(void) filled by the function. (see def above) output: none *******************************************************************/ -__declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo ) +EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo) { PluginInfo->Version = 0x0102; PluginInfo->Type = PLUGIN_TYPE_RSP; @@ -240,7 +240,7 @@ __declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo ) output: none *******************************************************************/ -__declspec(dllexport) void GetRspDebugInfo ( RSPDEBUG_INFO * DebugInfo ) +EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo) { if (hRSPMenu == NULL) { @@ -339,7 +339,7 @@ void DetectCpuSpecs(void) } } -__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount) +EXPORT void InitiateRSP(RSP_INFO Rsp_Info, DWORD * CycleCount) { RSPInfo = Rsp_Info; AudioHle = GetSystemSetting(Set_AudioHle); @@ -364,7 +364,7 @@ __declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount) above. output: none *******************************************************************/ -__declspec(dllexport) void InitiateRSPDebugger ( DEBUG_INFO Debug_Info) +EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info) { DebugInfo = Debug_Info; } @@ -536,7 +536,7 @@ void ProcessMenuItem(int ID) input: none output: none *******************************************************************/ -__declspec(dllexport) void RomOpen (void) +EXPORT void RomOpen(void) { ClearAllx86Code(); if (DebuggingEnabled) @@ -552,7 +552,8 @@ __declspec(dllexport) void RomOpen (void) input: none output: none *******************************************************************/ -__declspec(dllexport) void RomClosed (void) { +EXPORT void RomClosed(void) +{ if (Profiling) { StopTimer(); @@ -698,13 +699,13 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam } #endif -/*__declspec(dllexport) void DllConfig (HWND hWnd) +/*EXPORT void DllConfig(HWND hWnd) { // DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc); DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc); }*/ -__declspec(dllexport) void EnableDebugging(Boolean Enabled) +EXPORT void EnableDebugging(Boolean Enabled) { DebuggingEnabled = Enabled; if (DebuggingEnabled) @@ -740,7 +741,7 @@ __declspec(dllexport) void EnableDebugging(Boolean Enabled) } } -__declspec(dllexport) void PluginLoaded (void) +EXPORT void PluginLoaded(void) { BreakOnStart = false; CPUCore = RecompilerCPU; From 6075a2f4a3ddb8cea85fc9e98221be5607000b06 Mon Sep 17 00:00:00 2001 From: Date: Mon, 15 Feb 2016 15:55:07 -0500 Subject: [PATCH 010/559] [RSP] Macro-out some more WIN32 UI-specific stuff. --- Source/RSP/Main.cpp | 43 +++++++++++++++++++++++++++++----------- Source/RSP/RSP Command.h | 2 +- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Source/RSP/Main.cpp b/Source/RSP/Main.cpp index 22a34b22b..e61ae2099 100644 --- a/Source/RSP/Main.cpp +++ b/Source/RSP/Main.cpp @@ -30,8 +30,11 @@ #include #endif #include +#include +#include #include +#include #include "../Settings/Settings.h" extern "C" { @@ -50,7 +53,10 @@ extern "C" { void ClearAllx86Code(void); void ProcessMenuItem(int ID); +#ifdef _WIN32 Boolean CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +HMENU hRSPMenu = NULL; +#endif Boolean GraphicsHle = TRUE, AudioHle, ConditionalMove; Boolean DebuggingEnabled = FALSE, @@ -62,14 +68,13 @@ Boolean DebuggingEnabled = FALSE, LogX86Code = FALSE; uint32_t CPUCore = RecompilerCPU; -HANDLE hMutex = NULL; +void * hMutex = NULL; DEBUG_INFO DebugInfo; RSP_INFO RSPInfo; void * hinstDLL; -HMENU hRSPMenu = NULL; -extern BYTE * pLastSecondary; +extern uint8_t * pLastSecondary; } enum { @@ -176,9 +181,13 @@ EXPORT void CloseDLL(void) input: a handle to the window that calls this function output: none *******************************************************************/ -EXPORT void DllAbout(HWND hParent) +EXPORT void DllAbout(void * hParent) { - MessageBox(hParent,AboutMsg(),"About",MB_OK | MB_ICONINFORMATION ); +#ifdef _WIN32 + MessageBox((HWND)hParent, AboutMsg(), "About", MB_OK | MB_ICONINFORMATION); +#else + puts(AboutMsg()); +#endif } #ifdef _WIN32 @@ -242,12 +251,14 @@ EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo) EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo) { +#ifdef _WIN32 if (hRSPMenu == NULL) { hRSPMenu = LoadMenu((HINSTANCE)hinstDLL,MAKEINTRESOURCE(RspMenu)); FixMenuState(); } DebugInfo->hRSPMenu = hRSPMenu; +#endif DebugInfo->ProcessMenuItem = ProcessMenuItem; DebugInfo->UseBPoints = TRUE; @@ -260,7 +271,7 @@ EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo) DebugInfo->RemoveAllBpoint = RemoveAllBpoint; DebugInfo->RemoveBpoint = RemoveBpoint; DebugInfo->ShowBPPanel = ShowBPPanel; - + DebugInfo->Enter_RSP_Commands_Window = Enter_RSP_Commands_Window; } @@ -369,6 +380,7 @@ EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info) DebugInfo = Debug_Info; } +#ifdef _WIN32 void ProcessMenuItem(int ID) { UINT uState; @@ -529,6 +541,7 @@ void ProcessMenuItem(int ID) break; } } +#endif /****************************************************************** Function: RomOpen @@ -730,7 +743,11 @@ EXPORT void EnableDebugging(Boolean Enabled) Compiler.bAlignVector = GetSetting(Set_AlignVector); SetCPU(CPUCore); } - FixMenuState(); +#ifdef _WIN32 + FixMenuState(); +#else + fputs("FixMenuState()\n", stderr); +#endif if (LogRDP) { StartRDPLog(); @@ -791,13 +808,15 @@ EXPORT void PluginLoaded(void) AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false; GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true; - - hMutex = CreateMutex(NULL, FALSE, NULL); - +#ifdef _WIN32 + hMutex = (HANDLE)CreateMutex(NULL, FALSE, NULL); +#endif SetCPU(CPUCore); } -void UseUnregisteredSetting (int /*SettingID*/) +#ifdef _WIN32 +void UseUnregisteredSetting(int /*SettingID*/) { - DebugBreak(); + DebugBreak(); } +#endif diff --git a/Source/RSP/RSP Command.h b/Source/RSP/RSP Command.h index a3fff8b32..f41ad73f3 100644 --- a/Source/RSP/RSP Command.h +++ b/Source/RSP/RSP Command.h @@ -34,7 +34,7 @@ void Enter_RSP_Commands_Window ( void ); void RefreshRSPCommands ( void ); void SetRSPCommandToRunning ( void ); void SetRSPCommandToStepping ( void ); -void SetRSPCommandViewto ( UINT NewLocation ); +void SetRSPCommandViewto(unsigned int NewLocation); extern DWORD Stepping_Commands, WaitingForStep; extern Boolean InRSPCommandsWindow; From e29eb15cf425dd714891cbcd2cd962675def4862 Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 8 Mar 2016 17:31:08 +1100 Subject: [PATCH 011/559] [Glide64] Rename global romopen to g_romopen --- Source/Glide64/Config.cpp | 8 ++++---- Source/Glide64/Gfx_1.3.h | 2 +- Source/Glide64/Main.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 04f62b666..1665e00ad 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -125,7 +125,7 @@ wxNotebook(parent, id, pos, size, 0) if (g_settings->advanced_options) { EmuSettingsPanel = new wxPanel(this, wxID_ANY); - if (romopen) + if (g_romopen) EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Current game emulation g_settings-> Change with care!"); else EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Default emulation g_settings-> Not recommended to change!"); @@ -918,7 +918,7 @@ void ConfigNotebook::SaveSettings() if (memcmp(&oldsettings, g_settings, sizeof(CSettings))) //check that settings were changed { - if (romopen) + if (g_romopen) { if (is_advanced_changed) { @@ -1079,7 +1079,7 @@ void CALL DllConfig(HWND hParent) CGuard guard(*g_ProcessDListCS); ReadSettings(); - if (romopen) + if (g_romopen) { // ReadSpecialSettings ((char*)rdp.RomName.c_str()); if (evoodoo)// && fullscreen && !ev_fullscreen) @@ -1119,7 +1119,7 @@ void CALL DllConfig(HWND hParent) void CloseConfig() { - if (romopen) + if (g_romopen) { if (fb_depth_render_enabled) ZLUT_init(); diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index 98f641509..18e3d7235 100644 --- a/Source/Glide64/Gfx_1.3.h +++ b/Source/Glide64/Gfx_1.3.h @@ -174,7 +174,7 @@ extern "C" { #endif extern int GfxInitDone; - extern int romopen; + extern bool g_romopen; extern int to_fullscreen; extern int debugging; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 1af44b8e3..3ae5f4bb1 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -66,7 +66,7 @@ GFX_INFO gfx; int to_fullscreen = FALSE; int GfxInitDone = FALSE; -int romopen = FALSE; +bool g_romopen = false; GrContext_t gfx_context = 0; int debugging = FALSE; int exception = FALSE; @@ -1628,7 +1628,7 @@ void CALL RomClosed(void) WriteTrace(TraceGlide64, TraceDebug, "-"); rdp.window_changed = TRUE; - romopen = FALSE; + g_romopen = FALSE; if (evoodoo) { ReleaseGfx(); @@ -1667,7 +1667,7 @@ void CALL RomOpen(void) { WriteTrace(TraceGlide64, TraceDebug, "-"); no_dlist = true; - romopen = TRUE; + g_romopen = TRUE; ucode_error_report = TRUE; // allowed to report ucode errors rdp_reset(); From 8ccee4b77afa9e88a4a7cf2b2efa95875a8ac8d4 Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 8 Mar 2016 17:36:18 +1100 Subject: [PATCH 012/559] [Glide64] #include to Main.cpp --- Source/Glide64/Main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 3ae5f4bb1..5f22f22df 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "Config.h" #include "Util.h" @@ -297,6 +298,7 @@ void ReadSettings() if (g_settings->res_data >= 24) g_settings->res_data = 12; g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0]; g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; + g_settings->wrpResolution = GetSetting(Set_wrpResolution); g_settings->vsync = GetSetting(Set_vsync); g_settings->ssformat = (uint8_t)GetSetting(Set_ssformat); g_settings->show_fps = (uint8_t)GetSetting(Set_ShowFps); @@ -306,7 +308,6 @@ void ReadSettings() g_settings->texenh_options = GetSetting(Set_texenh_options); g_settings->use_hotkeys = GetSetting(Set_hotkeys); - g_settings->wrpResolution = GetSetting(Set_wrpResolution); g_settings->wrpVRAM = GetSetting(Set_wrpVRAM); g_settings->wrpFBO = GetSetting(Set_wrpFBO); g_settings->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); @@ -369,9 +370,6 @@ void ReadSettings() void ReadSpecialSettings(const char * name) { - // char buf [256]; - // sprintf(buf, "ReadSpecialSettings. Name: %s", name); - // LOG(buf); g_settings->hacks = 0; //detect games which require special hacks From b300eb6f6b4100dded348e3c7388331f77154276 Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 8 Mar 2016 17:43:37 +1100 Subject: [PATCH 013/559] [Glide64] Cleanup Config.h --- Source/Glide64/Config.h | 71 ++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 677dbfb3e..8ff744afe 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -56,8 +56,7 @@ // begin wxGlade: ::extracode // end wxGlade - -class ConfigNotebook: public wxNotebook { +class ConfigNotebook : public wxNotebook { public: // begin wxGlade: ConfigNotebook::ids enum { @@ -69,7 +68,7 @@ public: }; // end wxGlade - ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=0); + ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); private: // begin wxGlade: ConfigNotebook::methods @@ -197,18 +196,17 @@ public: virtual void OnClickTexEdit(wxCommandEvent &event); // wxGlade: #endif //TEXTURE_FILTER -// virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: -// virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: - void SaveSettings(); + // virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: + // virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: + void SaveSettings(); }; // wxGlade: end class - -class Glide64ConfigDialog: public wxDialog { +class Glide64ConfigDialog : public wxDialog { public: // begin wxGlade: Glide64ConfigDialog::ids // end wxGlade - Glide64ConfigDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE); + Glide64ConfigDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); void OnClose(wxCloseEvent& event); private: @@ -227,19 +225,18 @@ protected: DECLARE_EVENT_TABLE(); public: -// virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: -// virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: + // virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: + // virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: virtual void OnOK(wxCommandEvent &event); // wxGlade: virtual void OnCancel(wxCommandEvent &event); // wxGlade: }; // wxGlade: end class - -class AboutDialog: public wxDialog { +class AboutDialog : public wxDialog { public: // begin wxGlade: AboutDialog::ids // end wxGlade - AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE); + AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); private: // begin wxGlade: AboutDialog::methods @@ -255,31 +252,31 @@ protected: #endif enum { - // General Settings - Set_CardId, Set_Resolution, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, - Set_clock_24_hr, Set_texenh_options, Set_hotkeys, Set_wrpResolution, Set_wrpVRAM, - Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, - Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window, - Set_filter_cache, Set_unk_as_red, Set_log_unk, Set_unk_clear, Set_ghq_fltr, - Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile, - Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr, - Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc, - Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly, - Set_ghq_hirs_dump, + // General Settings + Set_CardId, Set_Resolution, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, + Set_clock_24_hr, Set_texenh_options, Set_hotkeys, Set_wrpResolution, Set_wrpVRAM, + Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, + Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window, + Set_filter_cache, Set_unk_as_red, Set_log_unk, Set_unk_clear, Set_ghq_fltr, + Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile, + Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr, + Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc, + Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly, + Set_ghq_hirs_dump, - //Game Settings - Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport, - Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction, - Set_pal230, Set_stipple_mode, Set_stipple_pattern, Set_force_microcheck, Set_force_quad3d, - Set_clip_zmin, Set_clip_zmax, Set_fast_crc, Set_adjust_aspect, Set_zmode_compare_less, - Set_old_style_adither, Set_n64_z_scale, Set_optimize_texrect, Set_ignore_aux_copy, - Set_hires_buf_clear, Set_fb_read_alpha, Set_useless_is_useless, Set_fb_crc_mode, - Set_filtering, Set_fog, Set_buff_clear, Set_swapmode, Set_aspect, Set_lodmode, - Set_fb_smart, Set_fb_hires, Set_fb_read_always, Set_read_back_to_screen, - Set_detect_cpu_write, Set_fb_get_info, Set_fb_render, + //Game Settings + Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport, + Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction, + Set_pal230, Set_stipple_mode, Set_stipple_pattern, Set_force_microcheck, Set_force_quad3d, + Set_clip_zmin, Set_clip_zmax, Set_fast_crc, Set_adjust_aspect, Set_zmode_compare_less, + Set_old_style_adither, Set_n64_z_scale, Set_optimize_texrect, Set_ignore_aux_copy, + Set_hires_buf_clear, Set_fb_read_alpha, Set_useless_is_useless, Set_fb_crc_mode, + Set_filtering, Set_fog, Set_buff_clear, Set_swapmode, Set_aspect, Set_lodmode, + Set_fb_smart, Set_fb_hires, Set_fb_read_always, Set_read_back_to_screen, + Set_detect_cpu_write, Set_fb_get_info, Set_fb_render, - //RDB Setting - Set_ucodeLookup, + //RDB Setting + Set_ucodeLookup, }; extern short Set_basic_mode, Set_texture_dir, Set_log_dir, Set_log_flush; From 19913f206b73b74837dc207496c73e51cd01a88b Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 8 Mar 2016 17:45:38 +1100 Subject: [PATCH 014/559] [Glide64] Make Set_Resolution, Set_wrpResolution windows only --- Source/Glide64/Config.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 8ff744afe..911bb2c50 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -251,10 +251,11 @@ protected: }; // wxGlade: end class #endif -enum { +enum +{ // General Settings - Set_CardId, Set_Resolution, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, - Set_clock_24_hr, Set_texenh_options, Set_hotkeys, Set_wrpResolution, Set_wrpVRAM, + Set_CardId, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, + Set_clock_24_hr, Set_texenh_options, Set_hotkeys, Set_wrpVRAM, Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window, Set_filter_cache, Set_unk_as_red, Set_log_unk, Set_unk_clear, Set_ghq_fltr, @@ -264,6 +265,10 @@ enum { Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly, Set_ghq_hirs_dump, +#ifdef _WIN32 + Set_Resolution, Set_wrpResolution, +#endif + //Game Settings Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport, Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction, From 9c8678482f3844ae25fbf6b887ca40279e523799 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 9 Mar 2016 08:55:19 +1100 Subject: [PATCH 015/559] [Glide64] fix up settings defaults --- Source/Glide64/Config.cpp | 7 +- Source/Glide64/Config.h | 8 ++ Source/Glide64/Main.cpp | 216 +++++++++++++++--------------- Source/Glitch64/OGLglitchmain.cpp | 156 ++++----------------- 4 files changed, 149 insertions(+), 238 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 1665e00ad..a523f0e0f 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -1267,4 +1267,9 @@ void general_setting(short setting_ID, const char * name, unsigned int value) void game_setting(short setting_ID, const char * name, unsigned int value) { RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL); -} \ No newline at end of file +} + +void game_setting_default(short setting_ID, const char * name, short default_setting) +{ + RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting); +} diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 911bb2c50..22d9072c9 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -269,6 +269,13 @@ enum Set_Resolution, Set_wrpResolution, #endif + // Default Game Settings + Set_optimize_texrect_default, Set_filtering_default, Set_lodmode_default, + Set_fog_default, Set_buff_clear_default, Set_swapmode_default, + Set_aspect_default, Set_fb_smart_default, Set_fb_hires_default, + Set_fb_read_always_default, Set_read_back_to_screen_default, Set_detect_cpu_write_default, + Set_fb_get_info_default, Set_fb_render_default, + //Game Settings Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport, Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction, @@ -288,3 +295,4 @@ extern short Set_basic_mode, Set_texture_dir, Set_log_dir, Set_log_flush; extern void general_setting(short setting_ID, const char * name, unsigned int value); extern void game_setting(short setting_ID, const char * name, unsigned int value); +extern void game_setting_default(short setting_ID, const char * name, short default_setting); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 5f22f22df..7d67788c8 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -155,8 +155,8 @@ CSettings * g_settings; HOTKEY_INFO hotkey_info; VOODOO voodoo = { 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 +0, 0, 0, 0, +0, 0, 0, 0 }; GrTexInfo fontTex; @@ -460,7 +460,7 @@ void ReadSpecialSettings(const char * name) ZLUT_init(); //frame buffer - int optimize_texrect = GetSetting(Set_optimize_texrect); + int optimize_texrect = GetSetting(g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default); int ignore_aux_copy = GetSetting(Set_ignore_aux_copy); int hires_buf_clear = GetSetting(Set_hires_buf_clear); int read_alpha = GetSetting(Set_fb_read_alpha); @@ -479,56 +479,54 @@ void ReadSpecialSettings(const char * name) else g_settings->frame_buffer &= ~fb_useless_is_useless; if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode; - // if (g_settings->custom_ini) - { - g_settings->filtering = GetSetting(Set_filtering); - g_settings->fog = GetSetting(Set_fog); - g_settings->buff_clear = GetSetting(Set_buff_clear); - g_settings->swapmode = GetSetting(Set_swapmode); - g_settings->aspectmode = GetSetting(Set_aspect); - g_settings->lodmode = GetSetting(Set_lodmode); - int resolution = GetSetting(Set_Resolution); - if (resolution >= 0) - { - g_settings->res_data = (uint32_t)resolution; - if (g_settings->res_data >= 0x18) g_settings->res_data = 12; - g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0]; - g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; - } + g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default); + g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default); + g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default); + g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default); + g_settings->aspectmode = GetSetting(g_romopen ? Set_aspect : Set_aspect_default); + g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default); +#ifdef _WIN32 + g_settings->res_data = GetSetting(Set_Resolution); + if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12; + g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0]; + g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; +#endif - //frame buffer - int smart_read = GetSetting(Set_fb_smart); - int hires = GetSetting(Set_fb_hires); - int read_always = GetSetting(Set_fb_read_always); - int read_back_to_screen = GetSetting(Set_read_back_to_screen); - int cpu_write_hack = GetSetting(Set_detect_cpu_write); - int get_fbinfo = GetSetting(Set_fb_get_info); - int depth_render = GetSetting(Set_fb_render); + //frame buffer + int smart_read = GetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default); + int hires = GetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default); + int read_always = GetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default); + int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default); + int cpu_write_hack = GetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default); + int get_fbinfo = GetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default); + int depth_render = GetSetting(g_romopen ? Set_fb_render : Set_fb_render_default); - if (smart_read > 0) g_settings->frame_buffer |= fb_emulation; - else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation; - if (hires > 0) g_settings->frame_buffer |= fb_hwfbe; - else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe; - if (read_always > 0) g_settings->frame_buffer |= fb_ref; - else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref; - if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen; - else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2; - else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2); - if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack; - else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack; - if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info; - else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info; - if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render; - else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render; - g_settings->frame_buffer |= fb_motionblur; - } + if (smart_read > 0) g_settings->frame_buffer |= fb_emulation; + else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation; + if (hires > 0) g_settings->frame_buffer |= fb_hwfbe; + else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe; + if (read_always > 0) g_settings->frame_buffer |= fb_ref; + else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref; + if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen; + else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2; + else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2); + if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack; + else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack; + if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info; + else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info; + if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render; + else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render; + g_settings->frame_buffer |= fb_motionblur; g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled; } void WriteSettings(bool saveEmulationSettings) { SetSetting(Set_CardId, g_settings->card_id); +#ifdef _WIN32 SetSetting(Set_Resolution, (int)g_settings->res_data); + SetSetting(Set_wrpResolution, g_settings->wrpResolution); +#endif SetSetting(Set_ssformat, g_settings->ssformat); SetSetting(Set_vsync, g_settings->vsync); SetSetting(Set_ShowFps, g_settings->show_fps); @@ -537,7 +535,6 @@ void WriteSettings(bool saveEmulationSettings) //SetSetting(Set_advanced_options,g_settings->advanced_options); SetSetting(Set_texenh_options, g_settings->texenh_options); - SetSetting(Set_wrpResolution, g_settings->wrpResolution); SetSetting(Set_wrpVRAM, g_settings->wrpVRAM); SetSetting(Set_wrpFBO, g_settings->wrpFBO); SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); @@ -580,25 +577,31 @@ void WriteSettings(bool saveEmulationSettings) if (saveEmulationSettings) { - SetSetting(Set_filtering, g_settings->filtering); - SetSetting(Set_fog, g_settings->fog); - SetSetting(Set_buff_clear, g_settings->buff_clear); - SetSetting(Set_swapmode, g_settings->swapmode); - SetSetting(Set_lodmode, g_settings->lodmode); - SetSetting(Set_aspect, g_settings->aspectmode); + SetSetting(g_romopen ? Set_filtering : Set_filtering_default, g_settings->filtering); + SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog); + SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear); + SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode); + SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode); + SetSetting(g_romopen ? Set_aspect : Set_aspect_default, g_settings->aspectmode); - SetSetting(Set_fb_read_always, g_settings->frame_buffer&fb_ref ? 1 : 0); - SetSetting(Set_fb_smart, g_settings->frame_buffer & fb_emulation ? 1 : 0); - SetSetting(Set_fb_hires, g_settings->frame_buffer & fb_hwfbe ? 1 : 0); - SetSetting(Set_fb_get_info, g_settings->frame_buffer & fb_get_info ? 1 : 0); - SetSetting(Set_fb_render, g_settings->frame_buffer & fb_depth_render ? 1 : 0); - SetSetting(Set_detect_cpu_write, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0); + SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->frame_buffer&fb_ref ? 1 : 0); + SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->frame_buffer & fb_emulation ? 1 : 0); + SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->frame_buffer & fb_hwfbe ? 1 : 0); + SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->frame_buffer & fb_get_info ? 1 : 0); + SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->frame_buffer & fb_depth_render ? 1 : 0); + SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0); if (g_settings->frame_buffer & fb_read_back_to_screen) - SetSetting(Set_read_back_to_screen, 1); + { + SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1); + } else if (g_settings->frame_buffer & fb_read_back_to_screen2) - SetSetting(Set_read_back_to_screen, 2); + { + SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2); + } else - SetSetting(Set_read_back_to_screen, 0); + { + SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 0); + } } FlushSettings(); @@ -838,6 +841,7 @@ int InitGfx() } //*/ +#ifdef _WIN32 uint32_t res_data = g_settings->res_data; if (ev_fullscreen) { @@ -855,39 +859,14 @@ int InitGfx() res_data = g_settings->res_data | 0x80000000; } - gfx_context = 0; - - // Select the window - - /*if (fb_hwfbe_enabled) - { - gfx_context = grSstWinOpenExt (uintptr_t(gfx.hWnd), - res_data, - GR_REFRESH_60Hz, - GR_COLORFORMAT_RGBA, - GR_ORIGIN_UPPER_LEFT, - fb_emulation_enabled?GR_PIXFMT_RGB_565:GR_PIXFMT_ARGB_8888, //32b color is not compatible with fb emulation - 2, // Double-buffering - 1); // 1 auxillary buffer - }*/ - if (!gfx_context) - gfx_context = grSstWinOpen(gfx.hWnd, - res_data, - GR_REFRESH_60Hz, - GR_COLORFORMAT_RGBA, - GR_ORIGIN_UPPER_LEFT, - 2, // Double-buffering - 1); // 1 auxillary buffer - + gfx_context = grSstWinOpen(gfx.hWnd, res_data, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1); if (!gfx_context) { -#ifdef _WIN32 MessageBox(gfx.hWnd, "Error setting display mode", "Error", MB_OK | MB_ICONEXCLAMATION); -#endif - // grSstWinClose (gfx_context); grGlideShutdown(); return FALSE; } +#endif GfxInitDone = TRUE; to_fullscreen = FALSE; @@ -1515,6 +1494,10 @@ void CALL MoveScreen(int xpos, int ypos) rdp.window_changed = TRUE; } +#ifdef _WIN32 +int GetCurrentResIndex(void); +#endif + void CALL PluginLoaded(void) { SetModuleName("default"); @@ -1528,7 +1511,10 @@ void CALL PluginLoaded(void) SetModuleName("Glide64"); general_setting(Set_CardId, "card_id", 0); +#ifdef _WIN32 general_setting(Set_Resolution, "resolution", 7); + general_setting(Set_wrpResolution, "wrpResolution", GetCurrentResIndex()); +#endif general_setting(Set_vsync, "vsync", 1); general_setting(Set_ssformat, "ssformat", 1); general_setting(Set_ShowFps, "show_fps", 0); @@ -1536,7 +1522,6 @@ void CALL PluginLoaded(void) general_setting(Set_clock_24_hr, "clock_24_hr", 0); general_setting(Set_texenh_options, "texenh_options", 0); general_setting(Set_hotkeys, "hotkeys", 1); - general_setting(Set_wrpResolution, "wrpResolution", 0); general_setting(Set_wrpVRAM, "wrpVRAM", 0); general_setting(Set_wrpFBO, "wrpFBO", 0); general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); @@ -1571,6 +1556,22 @@ void CALL PluginLoaded(void) general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0); general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0); + general_setting(Set_optimize_texrect_default, "optimize_texrect", 1); + general_setting(Set_filtering_default, "filtering", 0); + general_setting(Set_lodmode_default, "lodmode", 0); + general_setting(Set_fog_default, "fog", 1); + general_setting(Set_buff_clear_default, "buff_clear", 1); + general_setting(Set_swapmode_default, "swapmode", 1); + general_setting(Set_aspect_default, "aspect", 0); + + general_setting(Set_fb_smart_default, "fb_smart", 1); + general_setting(Set_fb_hires_default, "fb_hires", 1); + general_setting(Set_fb_read_always_default, "fb_read_always", 0); + general_setting(Set_read_back_to_screen_default, "read_back_to_screen", 0); + general_setting(Set_detect_cpu_write_default, "detect_cpu_write", 0); + general_setting(Set_fb_get_info_default, "fb_get_info", 0); + general_setting(Set_fb_render_default, "fb_render", 0); + game_setting(Set_alt_tex_size, "alt_tex_size", 0); game_setting(Set_use_sts1_only, "use_sts1_only", 0); game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); @@ -1591,26 +1592,26 @@ void CALL PluginLoaded(void) game_setting(Set_zmode_compare_less, "zmode_compare_less", 0); game_setting(Set_old_style_adither, "old_style_adither", 0); game_setting(Set_n64_z_scale, "n64_z_scale", 0); - game_setting(Set_optimize_texrect, "optimize_texrect", 1); + game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default); game_setting(Set_ignore_aux_copy, "ignore_aux_copy", (unsigned int)-1); game_setting(Set_hires_buf_clear, "hires_buf_clear", 1); game_setting(Set_fb_read_alpha, "fb_read_alpha", 0); game_setting(Set_useless_is_useless, "useless_is_useless", (unsigned int)-1); game_setting(Set_fb_crc_mode, "fb_crc_mode", 1); - game_setting(Set_filtering, "filtering", 0); - game_setting(Set_fog, "fog", 1); - game_setting(Set_buff_clear, "buff_clear", 1); - game_setting(Set_swapmode, "swapmode", 1); - game_setting(Set_aspect, "aspect", 0); - game_setting(Set_lodmode, "lodmode", 0); + game_setting_default(Set_filtering, "filtering", Set_filtering_default); + game_setting_default(Set_fog, "fog", Set_fog_default); + game_setting_default(Set_buff_clear, "buff_clear", Set_buff_clear_default); + game_setting_default(Set_swapmode, "swapmode", Set_swapmode_default); + game_setting_default(Set_aspect, "aspect", Set_aspect_default); + game_setting_default(Set_lodmode, "lodmode", Set_lodmode_default); - game_setting(Set_fb_smart, "fb_smart", 1); - game_setting(Set_fb_hires, "fb_hires", 1); - game_setting(Set_fb_read_always, "fb_read_always", 0); - game_setting(Set_read_back_to_screen, "read_back_to_screen", 0); - game_setting(Set_detect_cpu_write, "detect_cpu_write", 0); - game_setting(Set_fb_get_info, "fb_get_info", 0); - game_setting(Set_fb_render, "fb_render", 0); + game_setting_default(Set_fb_smart, "fb_smart", Set_fb_smart_default); + game_setting_default(Set_fb_hires, "fb_hires", Set_fb_hires_default); + game_setting_default(Set_fb_read_always, "fb_read_always", Set_fb_read_always_default); + game_setting_default(Set_read_back_to_screen, "read_back_to_screen", Set_read_back_to_screen_default); + game_setting_default(Set_detect_cpu_write, "detect_cpu_write", Set_detect_cpu_write_default); + game_setting_default(Set_fb_get_info, "fb_get_info", Set_fb_get_info_default); + game_setting_default(Set_fb_render, "fb_render", Set_fb_render_default); WriteTrace(TraceInterface, TraceDebug, "Done"); } @@ -1678,10 +1679,8 @@ void CALL RomOpen(void) if (code == 0x5000) region = 1; // Europe (PAL) if (code == 0x5500) region = 0; // Australia (NTSC) - char name[21] = "DEFAULT"; - ReadSpecialSettings(name); - // get the name of the ROM + char name[21]; for (int i = 0; i < 20; i++) { char ch; @@ -1759,7 +1758,7 @@ void CALL ShowCFB(void) void drawViRegBG() { - WriteTrace(TraceGlide64, TraceDebug, "-"); + WriteTrace(TraceGlide64, TraceDebug, "start"); const uint32_t VIwidth = *gfx.VI_WIDTH_REG; FB_TO_SCREEN_INFO fb_info; fb_info.width = VIwidth; @@ -1787,6 +1786,7 @@ void drawViRegBG() newSwapBuffers(); DrawFrameBufferToScreen(fb_info); } + WriteTrace(TraceGlide64, TraceDebug, "done"); } static void DrawFrameBuffer() @@ -1970,7 +1970,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe int pixel_size = 3; int p = 0; - png_bytep * row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height); + png_bytep * row_pointers = (png_bytep*)malloc(sizeof(png_bytep)* height); for (int y = 0; y < height; y++) { row_pointers[y] = (png_byte*)malloc(width*pixel_size); @@ -2436,7 +2436,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, if (p->vkCode == 46) k_del = 1; goto do_it; -do_it: + do_it: TabKey = ((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) || ((p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0)) || diff --git a/Source/Glitch64/OGLglitchmain.cpp b/Source/Glitch64/OGLglitchmain.cpp index 3c139c814..0db6af64c 100644 --- a/Source/Glitch64/OGLglitchmain.cpp +++ b/Source/Glitch64/OGLglitchmain.cpp @@ -87,6 +87,15 @@ public: *_frequency = (FxU32)aResolutions[_idx].dwF; } } + + int getCurrentResolutions(void) + { + if (dwNumResolutions == 0) + { + init(); + } + return currentResolutions; + } char ** getResolutionsList(int32_t * Size) { @@ -105,6 +114,7 @@ private: unsigned int dwNumResolutions; ResolutionInfo * aResolutions; char ** aResolutionsStr; + int currentResolutions; }; FullScreenResolutions::~FullScreenResolutions() @@ -121,9 +131,13 @@ void FullScreenResolutions::init() { WriteTrace(TraceGlitch, TraceDebug, "executing"); #ifdef _WIN32 - DEVMODE enumMode; + currentResolutions = -1; + DEVMODE enumMode , currentMode; int iModeNum = 0; memset(&enumMode, 0, sizeof(DEVMODE)); + + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, ¤tMode); + ResolutionInfo prevInfo; while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0) { @@ -147,6 +161,10 @@ void FullScreenResolutions::init() ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo) { + if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth) + { + currentResolutions = current; + } aResolutions[current] = curInfo; curInfo.toString(smode); aResolutionsStr[current] = new char[strlen(smode) + 1]; @@ -155,48 +173,7 @@ void FullScreenResolutions::init() current++; } } -#else // _WIN32 - SDL_Rect** modes; - SDL_Surface *check_surface; - SDL_PixelFormat *fmt; - int iModeNum; - - SDL_InitSubSystem(SDL_INIT_VIDEO); - check_surface = SDL_CreateRGBSurface(NULL, 0, 0, 32, 0, 0, 0, 0); - if (!check_surface || check_surface->format->BitsPerPixel != 32) { - return; //failtrain! - } - - fmt = check_surface->format; - modes = SDL_ListModes(fmt, SDL_FULLSCREEN|SDL_HWSURFACE); - - ResolutionInfo prevInfo; - for (iModeNum = 0; modes[iModeNum]; ++iModeNum) { - ResolutionInfo curInfo(modes[iModeNum]->w, modes[iModeNum]->h, 0); - if (curInfo != prevInfo) { - dwNumResolutions++; - prevInfo = curInfo; - } - } - - aResolutions = new ResolutionInfo[dwNumResolutions]; - aResolutionsStr = new char*[dwNumResolutions]; - int current = 0; - char smode[256]; - memset(&prevInfo, 0, sizeof(ResolutionInfo)); - for (iModeNum = 0; modes[iModeNum]; ++iModeNum) { - ResolutionInfo curInfo(modes[iModeNum]->w, modes[iModeNum]->h, 0); - if (curInfo != prevInfo) { - aResolutions[current] = curInfo; - curInfo.toString(smode); - aResolutionsStr[current] = new char[strlen(smode)+1]; - strcpy(aResolutionsStr[current], smode); - prevInfo = curInfo; - current++; - } - } - SDL_FreeSurface(check_surface); -#endif // _WIN32 +#endif } bool FullScreenResolutions::changeDisplaySettings(FxU32 _resolution) @@ -697,7 +674,7 @@ int nAuxBuffers) return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers); } -#ifdef WIN32 +#ifdef _WIN32 # include # ifndef ATTACH_PARENT_PROCESS # define ATTACH_PARENT_PROCESS ((FxU32)-1) @@ -957,89 +934,6 @@ int nAuxBuffers) return FXFALSE; } } -#else // _WIN32 - - // init sdl & gl - const SDL_VideoInfo *videoInfo; - Uint32 videoFlags = 0; - fullscreen = 0; - - /* Initialize SDL */ - printf("(II) Initializing SDL video subsystem...\n"); - if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) - { - printf("(EE) Error initializing SDL video subsystem: %s\n", SDL_GetError()); - return false; - } - - /* Video Info */ - printf("(II) Getting video info...\n"); - if(!(videoInfo = SDL_GetVideoInfo())) - { - printf("(EE) Video query failed: %s\n", SDL_GetError()); - SDL_QuitSubSystem(SDL_INIT_VIDEO); - return false; - } - - /* Setting the video mode */ - videoFlags |= SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE; - - if(videoInfo->hw_available) - videoFlags |= SDL_HWSURFACE; - else - videoFlags |= SDL_SWSURFACE; - - if(videoInfo->blit_hw) - videoFlags |= SDL_HWACCEL; - - //if (!(screen_resolution & 0x80000000)) - //videoFlags |= SDL_FULLSCREEN; - - if (screen_resolution & 0x80000000) - { - fullscreen = 0; - } - else - { - FxU32 _width, _height; - g_FullScreenResolutions.getResolution(screen_resolution, &_width, &_height); - width = _width; - height = _height; - videoFlags |= SDL_FULLSCREEN; - fullscreen = 1; - } - TMU_SIZE = (config.vram_size - width * height * 4 * 3) / 2; - - //viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20; - // ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero - viewport_offset = 0; //-10 //-20; - - // ZIGGY not sure, but it might be better to let the system choose - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); - // SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); - // SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); - // SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - // SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - // SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - - printf("(II) Setting video mode %dx%d...\n", width, height); - if(!(m_pScreen = SDL_SetVideoMode(width, height, 0, videoFlags))) - { - printf("(EE) Error setting videomode %dx%d: %s\n", width, height, SDL_GetError()); - SDL_QuitSubSystem(SDL_INIT_VIDEO); - return false; - } - - char caption[500]; -# ifdef _DEBUG - sprintf(caption, "Glide64 debug"); -# else // _DEBUG - sprintf(caption, "Glide64"); -# endif // _DEBUG - SDL_WM_SetCaption(caption, caption); - glViewport(0, viewport_offset, width, height); #endif // _WIN32 lfb_color_fmt = color_format; if (origin_location != GR_ORIGIN_UPPER_LEFT) WriteTrace(TraceGlitch, TraceWarning, "origin must be in upper left corner"); @@ -1788,8 +1682,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params) if (plength < 4 || params == NULL) return 0; if (!nbTextureUnits) { - grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB, - GR_ORIGIN_UPPER_LEFT, 2, 1); + grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); grSstWinClose(0); } #ifdef VOODOO1 @@ -2632,6 +2525,11 @@ FxI32 src_stride, void *src_data) return FXTRUE; } +int GetCurrentResIndex(void) +{ + return g_FullScreenResolutions.getCurrentResolutions(); +} + /* wrapper-specific glide extensions */ FX_ENTRY char ** FX_CALL From c9057b55f2204f5e7be4baf9edb3d0fdffb8f856 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 9 Mar 2016 09:22:28 +1100 Subject: [PATCH 016/559] [Glide64] Add wtl about window --- Source/Glide64/Config.cpp | 188 ++++++++++++++++---------------------- Source/Glide64/Config.h | 3 + Source/Glide64/Glide64.rc | 43 +++++++++ Source/Glide64/Main.cpp | 2 + Source/Glide64/resource.h | 4 +- 5 files changed, 130 insertions(+), 110 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index a523f0e0f..2ad43d615 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -51,6 +51,22 @@ #ifdef _WIN32 #include +#include "resource.h" + +#define _ATL_DISABLE_NOTHROW_NEW +#include +#pragma warning(push) +#pragma warning(disable : 4996) // warning C4996: 'GetVersionExA': was declared deprecated +#include +#pragma warning(pop) + +#include +#include +#include +#include + +extern HINSTANCE hinstDLL; + #include #include // begin wxGlade: ::extracode @@ -59,6 +75,36 @@ short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; extern CriticalSection * g_ProcessDListCS; +class CGlide64WtlModule : + public CAppModule +{ +public: + CGlide64WtlModule(HINSTANCE hinst) + { + Init(NULL, hinst); + } + virtual ~CGlide64WtlModule(void) + { + Term(); + } +}; + +CGlide64WtlModule * WtlModule = NULL; + +void ConfigInit(HINSTANCE hinst) +{ + WtlModule = new CGlide64WtlModule(hinst); +} + +void ConfigCleanup(void) +{ + if (WtlModule) + { + delete WtlModule; + WtlModule = NULL; + } +} + ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/) : wxNotebook(parent, id, pos, size, 0) { @@ -1026,7 +1072,8 @@ void Glide64ConfigDialog::do_layout() } #ifdef TEXTURE_FILTER -uint32_t texfltr[] = { +uint32_t texfltr[] = +{ NO_FILTER, //"None" SMOOTH_FILTER_1, //"Smooth filtering 1" SMOOTH_FILTER_2, //"Smooth filtering 2" @@ -1036,7 +1083,8 @@ uint32_t texfltr[] = { SHARP_FILTER_2, //"Sharp filtering 2" }; -uint32_t texenht[] = { +uint32_t texenht[] = +{ NO_ENHANCEMENT, //"None" NO_ENHANCEMENT, //"Store" X2_ENHANCEMENT, //"X2" @@ -1048,14 +1096,16 @@ uint32_t texenht[] = { HQ4X_ENHANCEMENT, //"HQ4X" }; -uint32_t texcmpr[] = { +uint32_t texcmpr[] = +{ //NO_COMPRESSION, //"None" // NCC_COMPRESSION, //"NCC" S3TC_COMPRESSION, //"S3TC" FXT1_COMPRESSION, //"FXT1" }; -uint32_t texhirs[] = { +uint32_t texhirs[] = +{ NO_HIRESTEXTURES, //"Do not use" RICE_HIRESTEXTURES, //"Rice format" // GHQ_HIRESTEXTURES, //"GlideHQ format" @@ -1136,95 +1186,32 @@ void CloseConfig() #endif } -AboutDialog::AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long /*style*/) : -wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE) +#ifdef _WIN32 +class CAboutDlg : + public CDialogImpl { - // begin wxGlade: AboutDialog::AboutDialog - button_ok = new wxButton(this, wxID_OK, wxEmptyString); +public: + enum { IDD = IDD_ABOUTBOX }; - set_properties(); - do_layout(); - // end wxGlade -} + BEGIN_MSG_MAP(CAboutDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_ID_HANDLER(IDOK, OnCloseCmd) + COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) + END_MSG_MAP() -void AboutDialog::set_properties() -{ - // begin wxGlade: AboutDialog::set_properties - SetTitle("About Glide64"); - button_ok->SetDefault(); - // end wxGlade -} + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + CenterWindow(GetParent()); + return TRUE; + } -void AboutDialog::do_layout() -{ - // begin wxGlade: AboutDialog::do_layout - wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* sizer_12 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_11 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_8 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_10 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_9 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_7 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_6 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_13 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL); - - wxStaticText* label_1 = new wxStaticText(this, wxID_ANY, "authors:"); - sizer_1->Add(label_1, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, 5); - wxStaticText* label_2 = new wxStaticText(this, wxID_ANY, "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002."); - label_2->Enable(false); - sizer_2->Add(label_2, 0, 0, 0); - sizer_1->Add(sizer_2, 1, wxEXPAND, 0); - wxStaticText* label_3 = new wxStaticText(this, wxID_ANY, "Gugaman. Developer. Joined the project at winter 2002\n and left it at fall 2002."); - label_3->Enable(false); - sizer_3->Add(label_3, 0, 0, 0); - sizer_1->Add(sizer_3, 1, wxEXPAND, 0); - wxStaticText* label_4 = new wxStaticText(this, wxID_ANY, "Sergey 'Gonetz' Lipski. Joined the project at winter 2002.\nMain developer since fall of 2002."); - sizer_4->Add(label_4, 0, 0, 0); - sizer_1->Add(sizer_4, 1, wxEXPAND, 0); - wxStaticText* label_15 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii, Joined the project in 2007. "); - sizer_13->Add(label_15, 0, 0, 0); - sizer_1->Add(sizer_13, 1, wxEXPAND, 0); - wxStaticText* label_5 = new wxStaticText(this, wxID_ANY, "Glitch64 (the wrapper) authors:"); - sizer_1->Add(label_5, 0, wxBOTTOM | wxALIGN_CENTER_HORIZONTAL, 10); - wxStaticText* label_6 = new wxStaticText(this, wxID_ANY, "hacktarux"); - sizer_6->Add(label_6, 0, 0, 0); - sizer_5->Add(sizer_6, 1, wxEXPAND, 0); - wxStaticText* label_7 = new wxStaticText(this, wxID_ANY, "mudlord"); - sizer_7->Add(label_7, 0, 0, 0); - sizer_5->Add(sizer_7, 1, wxEXPAND, 0); - sizer_1->Add(sizer_5, 0, wxEXPAND, 0); - wxStaticText* label_8 = new wxStaticText(this, wxID_ANY, "ziggy"); - sizer_9->Add(label_8, 0, 0, 0); - sizer_8->Add(sizer_9, 1, wxEXPAND, 0); - wxStaticText* label_9 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii"); - sizer_10->Add(label_9, 0, 0, 0); - sizer_8->Add(sizer_10, 1, wxEXPAND, 0); - sizer_1->Add(sizer_8, 0, wxEXPAND, 0); - wxStaticText* label_10 = new wxStaticText(this, wxID_ANY, "GlideHQ author:"); - sizer_11->Add(label_10, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 10); - wxStaticText* label_11 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii"); - sizer_11->Add(label_11, 0, wxALIGN_CENTER_VERTICAL, 0); - sizer_1->Add(sizer_11, 1, wxEXPAND, 0); - wxStaticText* label_12 = new wxStaticText(this, wxID_ANY, "beta tester:"); - sizer_12->Add(label_12, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 10); - wxStaticText* label_13 = new wxStaticText(this, wxID_ANY, "olivieryuyu"); - sizer_12->Add(label_13, 0, wxALIGN_CENTER_VERTICAL, 0); - sizer_1->Add(sizer_12, 1, wxEXPAND, 0); - wxStaticText* label_14 = new wxStaticText(this, wxID_ANY, "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.\nThanks to EmuXHaven for hosting my site:\nhttp://glide64.emuxhaven.net", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); - sizer_1->Add(label_14, 0, wxALIGN_CENTER_HORIZONTAL, 0); - sizer_1->Add(button_ok, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND | wxALIGN_CENTER_HORIZONTAL, 10); - SetSizer(sizer_1); - sizer_1->Fit(this); - Layout(); -#ifdef __WINDOWS__ - Centre(); + LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + EndDialog(wID); + return 0; + } +}; #endif - // end wxGlade -} /****************************************************************** Function: DllAbout @@ -1233,28 +1220,11 @@ to give further information about the DLL. input: a handle to the window that calls this function output: none *******************************************************************/ -void CALL DllAbout(HWND hParent) +void CALL DllAbout(HWND /*hParent*/) { -#ifdef __WINDOWS__ - if (hostWindow == NULL) - hostWindow = new wxWindow(); - WXHWND hwnd = hParent; - hostWindow->SetHWND(hwnd); - // hostWindow->SubclassWin(hwnd); - hostWindow->Disable(); -#endif - - //translation - ReadSettings(); - - AboutDialog* AboutGlide64 = new AboutDialog(hostWindow, wxID_ANY, wxEmptyString); - AboutGlide64->ShowModal(); -#ifdef __WINDOWS__ - hostWindow->Enable(); - // hostWindow->UnsubclassWin(); - hostWindow->SetHWND(NULL); - delete hostWindow; - hostWindow = NULL; +#ifdef _WIN32 + CAboutDlg dlg; + dlg.DoModal(); #endif } #endif diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 22d9072c9..7f02f31bd 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -46,6 +46,9 @@ #pragma once #ifdef _WIN32 +void ConfigInit(HINSTANCE hinst); +void ConfigCleanup(void); + #include #include // begin wxGlade: ::dependencies diff --git a/Source/Glide64/Glide64.rc b/Source/Glide64/Glide64.rc index ae5e7ef80..a2b500119 100644 --- a/Source/Glide64/Glide64.rc +++ b/Source/Glide64/Glide64.rc @@ -55,6 +55,49 @@ END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 200, 202 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About Glide64" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,71,181,50,14 + LTEXT "Authors:",IDC_STATIC,7,6,186,8 + LTEXT "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002.",IDC_STATIC,7,17,186,27 + LTEXT "Gugaman. Developer. Joined the project at winter 2002\n and left it at fall 2002.",IDC_STATIC,7,46,186,17 + LTEXT "Sergey 'Gonetz' Lipski. Joined the project at winter 2002.\nMain developer since fall of 2002.",IDC_STATIC,7,66,186,18 + LTEXT "Hiroshi 'KoolSmoky' Morii, Joined the project in 2007.",IDC_STATIC,7,86,186,8,SS_CENTERIMAGE + LTEXT "Glitch64 (the wrapper) authors:",IDC_STATIC,7,110,186,8,SS_CENTERIMAGE + LTEXT "hacktarux, mudlord, ziggy, Hiroshi 'KoolSmoky' Morii",IDC_STATIC,7,122,186,8,SS_CENTERIMAGE + LTEXT "GlideHQ author: Hiroshi 'KoolSmoky' Morii",IDC_STATIC,7,138,186,8,SS_CENTERIMAGE + LTEXT "beta tester: olivieryuyu",IDC_STATIC,7,153,186,8,SS_CENTERIMAGE + LTEXT "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.",IDC_STATIC,7,167,186,8,SS_CENTERIMAGE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 193 + TOPMARGIN, 7 + BOTTOMMARGIN, 195 + END +END +#endif // APSTUDIO_INVOKED + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 7d67788c8..c7b05a425 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1138,6 +1138,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser { g_ProcessDListCS = new CriticalSection(); } + ConfigInit(hinst); wxSetInstance(hinstDLL); return DllLoad(); } @@ -1147,6 +1148,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser { delete g_ProcessDListCS; } + ConfigCleanup(); return DllUnload(); } return TRUE; diff --git a/Source/Glide64/resource.h b/Source/Glide64/resource.h index 72a711aee..37772530e 100644 --- a/Source/Glide64/resource.h +++ b/Source/Glide64/resource.h @@ -1,12 +1,14 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Glide64.rc +// +#define IDD_ABOUTBOX 104 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 From b6f09f2df5bbd993ce6902e46e565612f67d8daa Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 9 Mar 2016 17:44:01 +1100 Subject: [PATCH 017/559] [Project64] Use WTL for config window --- Source/Glide64/Config.cpp | 1715 ++++++++++++++++--------------------- Source/Glide64/Config.h | 210 +---- Source/Glide64/Glide64.rc | 136 +++ 3 files changed, 865 insertions(+), 1196 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 2ad43d615..fb0f15c7c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -49,6 +49,8 @@ #include "Config.h" #include "trace.h" +short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; + #ifdef _WIN32 #include #include "resource.h" @@ -67,12 +69,6 @@ extern HINSTANCE hinstDLL; -#include -#include -// begin wxGlade: ::extracode -// end wxGlade - -short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; extern CriticalSection * g_ProcessDListCS; class CGlide64WtlModule : @@ -105,972 +101,11 @@ void ConfigCleanup(void) } } -ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/) : -wxNotebook(parent, id, pos, size, 0) -{ - // begin wxGlade: ConfigNotebook::ConfigNotebook - //Basic settings panel - BasicSettingsPanel = new wxPanel(this, wxID_ANY); - BasicRenderingSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "Rendering"); - OtherSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "Other"); - SpeedSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "Speed"); - TimeSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "Time"); - OnScreenDisplaySizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "On screen display"); - WrapperSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "OpenGL settings"); - WrapperFBOptionsSizer_staticbox = new wxStaticBox(BasicSettingsPanel, -1, "Frame buffer emulation"); - lblResolution = new wxStaticText(BasicSettingsPanel, wxID_ANY, "Windowed or\n3dfx card resolution:"); - const wxString cmbResolution_choices[] = { - "320x200", - "320x240", - "400x256", - "512x384", - "640x200", - "640x350", - "640x400", - "640x480", - "800x600", - "960x720", - "856x480", - "512x256", - "1024x768", - "1280x1024", - "1600x1200", - "400x300", - "1152x864", - "1280x960", - "1600x1024", - "1792x1344", - "1856x1392", - "1920x1440", - "2048x1536", - "2048x2048" - }; - cmbResolution = new wxComboBox(BasicSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 24, cmbResolution_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - cbxVSync = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Vertical sync"); - cbxTextureSettings = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Show texture enhancement options"); - lblScreenShotFormat = new wxStaticText(BasicSettingsPanel, wxID_ANY, "Screenshot format:"); - cmbScreenShotFormat = new wxComboBox(BasicSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - - cbxFPS = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "FPS counter"); - cbxVIS = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "VI/s counter"); - cbxPercent = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "% speed"); - cbxClockEnabled = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Clock enabled"); - cbxClock24 = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Clock is 24-hour"); - cbxTextTransparent = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Transparent text background"); - lblFSResolution = new wxStaticText(BasicSettingsPanel, wxID_ANY, "Full screen\nresolution:"); - const wxString *cmbFSResolution_choices = NULL; - cmbFSResolution = new wxComboBox(BasicSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, cmbFSResolution_choices, wxCB_DROPDOWN | wxCB_READONLY); - cbxAnisotropic = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Anisotropic filtering"); - cbxVRAM = new wxCheckBox(BasicSettingsPanel, wxID_VRAM, "Autodetect "); - lblVRAM = new wxStaticText(BasicSettingsPanel, wxID_ANY, "VRAM size"); - spinVRAM = new wxSpinCtrl(BasicSettingsPanel, wxID_ANY, "128", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS | wxTE_CENTRE, 32, 2000); - lblMb = new wxStaticText(BasicSettingsPanel, wxID_ANY, "Mb"); - cbxFBO = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Use frame buffer objects"); - - //emulation settings panel - if (g_settings->advanced_options) - { - EmuSettingsPanel = new wxPanel(this, wxID_ANY); - if (g_romopen) - EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Current game emulation g_settings-> Change with care!"); - else - EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Default emulation g_settings-> Not recommended to change!"); - EmuSettingsLeftSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "General options"); - FrameBufferSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Frame buffer emulation"); - DepthBufferSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Depth buffer emulation"); - lbFiltering = new wxStaticText(EmuSettingsPanel, wxID_ANY, "Filtering mode:"); - const wxString cmbFiltering_choices[] = { - "Automatic", - "Force Bilinear", - "Force Point-sampled" - }; - cmbFiltering = new wxComboBox(EmuSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 3, cmbFiltering_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - lbBufferSwap = new wxStaticText(EmuSettingsPanel, wxID_ANY, "Buffer swapping method:"); - const wxString cmbBufferSwap_choices[] = { - "Old", - "New", - "Hybrid" - }; - cmbBufferSwap = new wxComboBox(EmuSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 3, cmbBufferSwap_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - lblLOD = new wxStaticText(EmuSettingsPanel, wxID_ANY, "LOD calculation:"); - const wxString cmbLOD_choices[] = { - "off", - "fast", - "precise" - }; - cmbLOD = new wxComboBox(EmuSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 3, cmbLOD_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - lblAspect = new wxStaticText(EmuSettingsPanel, wxID_ANY, "Aspect ratio:"); - const wxString cmbAspect_choices[] = { - "4:3 (default)", - "Force 16:9", - "Stretch", - "Original" - }; - cmbAspect = new wxComboBox(EmuSettingsPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 4, cmbAspect_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - cbxFog = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Fog"); - cbxBuffer = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Buffer clear on every frame"); - cbxFBEnable = new wxCheckBox(EmuSettingsPanel, wxID_FBEnable, "Enable frame buffer emulation"); - cbxFBHWFBE = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Hardware frame buffer emulation"); - cbxFBGetFBI = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Get frame buffer info"); - cbxFBReadEveryFrame = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Read every frame (slow!)"); - cbxFBasTex = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Render N64 frame buffer as texture"); - cbxDetect = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Detect CPU write to the N64 frame buffer"); - cbxFBDepthBuffer = new wxCheckBox(EmuSettingsPanel, wxID_ANY, "Software depth buffer rendering"); - } - -#ifdef TEXTURE_FILTER - if (g_settings->texenh_options) - { - if (!GfxInitDone) - { - grGlideInit(); - grSstSelect(g_settings->card_id); - } - const char *extensions = grGetString(GR_EXTENSION); - if (strstr(extensions, "EVOODOO")) - evoodoo = 1; - else - evoodoo = 0; - if (strstr(extensions, "TEXFMT")) - voodoo.sup_32bit_tex = TRUE; - else - voodoo.sup_32bit_tex = FALSE; - if (!GfxInitDone) - grGlideShutdown(); - - TexturePanel = new wxPanel(this, wxID_ANY); - EnhTexSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Texture enhancement"); - TextureRightSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Hi-resolution textures"); - CommonSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Common"); - PresetsSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Presets"); - EnhTexPerfTweaksSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Performance tweaks"); - HRTexPerfTweaksSizer_staticbox = new wxStaticBox(TexturePanel, -1, "Performance tweaks"); - lblFilter = new wxStaticText(TexturePanel, wxID_ANY, "Filter"); - const wxString cmbEnhFilter_choices[] = { - "None", - "Smooth filtering 1", - "Smooth filtering 2", - "Smooth filtering 3", - "Smooth filtering 4", - "Sharp filtering 1", - "Sharp filtering 2" - }; - cmbEnhFilter = new wxComboBox(TexturePanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 7, cmbEnhFilter_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - lblEnhancement = new wxStaticText(TexturePanel, wxID_ANY, "Enhancement"); - const wxString cmbEnhEnhancement_choices[] = { - "None", - "Store", - "X2", - "X2SAI", - "HQ2X", - "HQ2XS", - "LQ2X", - "LQ2XS", - "HQ4X" - }; - cmbEnhEnhancement = new wxComboBox(TexturePanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 9, cmbEnhEnhancement_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - lblTexCache = new wxStaticText(TexturePanel, wxID_ANY, "Texture cache"); - spinEnhCacheSize = new wxSpinCtrl(TexturePanel, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 300); - lblTexCacheMB = new wxStaticText(TexturePanel, wxID_ANY, "Mbytes"); - cbxEnhIgnoreBG = new wxCheckBox(TexturePanel, wxID_ANY, "Ignore Backgrounds"); - cbxEnhTexCompression = new wxCheckBox(TexturePanel, wxID_ANY, "Apply texture compression"); - cbxEnhCompressCache = new wxCheckBox(TexturePanel, wxID_ANY, "Compress texture cache"); - lblHrsFormat = new wxStaticText(TexturePanel, wxID_ANY, "Format"); - const wxString cmbHrsFormat_choices[] = { - "None", - "Rice format" - }; - cmbHrsFormat = new wxComboBox(TexturePanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 2, cmbHrsFormat_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - cbxHrsTile = new wxCheckBox(TexturePanel, wxID_ANY, "Tile textures"); - cbxHrsForce16 = new wxCheckBox(TexturePanel, wxID_ANY, "Force 16bpp textures"); - cbxHrsAltCRC = new wxCheckBox(TexturePanel, wxID_ANY, "Alternative CRC calculation"); - cbxHrsTexCompression = new wxCheckBox(TexturePanel, wxID_ANY, "Apply texture compression"); - cbxHrsCompressCache = new wxCheckBox(TexturePanel, wxID_ANY, "Compress texture cache"); - cbxHrsLetFly = new wxCheckBox(TexturePanel, wxID_ANY, "Use alpha channel fully"); - cbxHrsTexEdit = new wxCheckBox(TexturePanel, wxID_TexEdit, "Texture dumping/editing mode"); - lblTexCompression = new wxStaticText(TexturePanel, wxID_ANY, "Texture compression method"); - const wxString cmbTextureCompression_choices[] = { - "S3TC", - "FXT1" - }; - cmbTextureCompression = new wxComboBox(TexturePanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, evoodoo ? 1 : 2, cmbTextureCompression_choices, wxCB_DROPDOWN | wxCB_DROPDOWN | wxCB_READONLY); - cbxSaveTexCache = new wxCheckBox(TexturePanel, wxID_ANY, "Save texture cache to hard disk"); - btnPerformance = new wxButton(TexturePanel, wxID_Performance, "Best performance"); - btnQuality = new wxButton(TexturePanel, wxID_Quality, "Best texture quality"); - } -#endif //TEXTURE_FILTER - -#ifndef _ENDUSER_RELEASE_ - DebugPanel = new wxPanel(this, wxID_ANY); - DevSettingsSizer_staticbox = new wxStaticBox(DebugPanel, -1, "Developers settings")); - DebugSizer_staticbox = new wxStaticBox(DebugPanel, -1, "Debug/Misc"); - cbxAutoUcode = new wxCheckBox(DebugPanel, wxID_ANY, "Autodetect Microcode"); - lblForceUcode = new wxStaticText(DebugPanel, wxID_ANY, "Force Microcode:"); - const wxString cmbForceUcode_choices[] = { - "0: RSP SW 2.0X (ex. Mario)", - "1: F3DEX 1.XX (ex. Star Fox)", - "2: F3DEX 2.XX (ex. Zelda OOT)", - "3: RSP SW 2.0D EXT (ex. Waverace)", - "4: RSP SW 2.0D EXT (ex. Shadows of the Empire)", - "5: RSP SW 2.0 (ex. Diddy Kong Racing)", - "6: S2DEX 1.XX (ex. Yoshi's Story)", - "7: RSP SW PD Perfect Dark", - "8: F3DEXBG 2.08 Conker's Bad Fur Day" - }; - cmbForceUcode = new wxComboBox(DebugPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 9, cmbForceUcode_choices, wxCB_DROPDOWN|wxCB_DROPDOWN|wxCB_READONLY); - cbxWireframe = new wxCheckBox(DebugPanel, wxID_ANY, "Wireframe using:"); - const wxString cmbWireframe_choices[] = { - "Original colors", - "Vertex colors", - "Red only" - }; - cmbWireframe = new wxComboBox(DebugPanel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 3, cmbWireframe_choices, wxCB_DROPDOWN|wxCB_DROPDOWN|wxCB_READONLY); - cbxLog = new wxCheckBox(DebugPanel, wxID_ANY, "Log to rdp.txt (SLOW)"); - cbxCombRed = new wxCheckBox(DebugPanel, wxID_ANY, "Unknown combiners as red"); - cbxLogClear = new wxCheckBox(DebugPanel, wxID_ANY, "Log clear every frame"); - cbxCmbLog = new wxCheckBox(DebugPanel, wxID_ANY, "Combiner logging"); - cbxWindowLog = new wxCheckBox(DebugPanel, wxID_ANY, "Run (+log) in window"); - cbxCmbLogClear = new wxCheckBox(DebugPanel, wxID_ANY, "Cmb. clear every frame"); - cbxErrLog = new wxCheckBox(DebugPanel, wxID_ANY, "Error log (rdp_e.txt)"); - cbxBilinearTexCache = new wxCheckBox(DebugPanel, wxID_ANY, "Bilinear filter texture cache"); -#endif //_ENDUSER_RELEASE_ - - set_properties(); - do_layout(); - // end wxGlade -} - -BEGIN_EVENT_TABLE(ConfigNotebook, wxNotebook) -// begin wxGlade: ConfigNotebook::event_table -EVT_CHECKBOX(wxID_VRAM, ConfigNotebook::OnClickVRAM) -EVT_CHECKBOX(wxID_FBEnable, ConfigNotebook::OnClickFB) -#ifdef TEXTURE_FILTER -EVT_BUTTON(wxID_Performance, ConfigNotebook::onPerformace) -EVT_BUTTON(wxID_Quality, ConfigNotebook::onQuality) -EVT_CHECKBOX(wxID_TexEdit, ConfigNotebook::OnClickTexEdit) -#endif //TEXTURE_FILTER -// EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, ConfigNotebook::onPageChanged) -// EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, ConfigNotebook::onPageChanging) -// end wxGlade -END_EVENT_TABLE(); - -void ConfigNotebook::OnClickVRAM(wxCommandEvent &event) -{ - if (event.GetEventObject() == cbxVRAM) - { - bool enable = !cbxVRAM->GetValue(); - if (enable) - spinVRAM->SetValue(g_settings->wrpVRAM); - else - spinVRAM->SetValue(" auto"); - spinVRAM->Enable(enable); - lblMb->Enable(enable); - } - // event.Skip(); - // wxLogDebug("Event handler (ConfigNotebook::FrameBufferOnClick) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void ConfigNotebook::OnClickFB(wxCommandEvent &event) -{ - if (event.GetEventObject() == cbxFBEnable) - cbxFBHWFBE->Enable(cbxFBEnable->GetValue()); - // event.Skip(); - // wxLogDebug("Event handler (ConfigNotebook::FrameBufferOnClick) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -#ifdef TEXTURE_FILTER -void ConfigNotebook::onPerformace(wxCommandEvent & /*event*/) -{ - cbxEnhCompressCache->SetValue(true); - cbxHrsCompressCache->SetValue(true); - cbxEnhIgnoreBG->SetValue(true); - cbxHrsAltCRC->SetValue(true); - cbxHrsLetFly->SetValue(true); - cbxSaveTexCache->SetValue(true); - cmbTextureCompression->SetSelection(0); - cbxHrsTexCompression->SetValue(false); - cbxEnhTexCompression->SetValue(false); - cbxHrsTexEdit->SetValue(false); - - if (voodoo.sup_32bit_tex) - { - cbxHrsTexCompression->SetValue(true); - cbxEnhTexCompression->SetValue(true); - cmbTextureCompression->SetSelection(1); - } - else - { - cbxHrsForce16->SetValue(true); - } - // event.Skip(); - // wxLogDebug("Event handler (ConfigNotebook::onPerformace) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void ConfigNotebook::onQuality(wxCommandEvent & /*event*/) -{ - cbxEnhCompressCache->SetValue(true); - cbxHrsCompressCache->SetValue(true); - cbxEnhIgnoreBG->SetValue(false); - cbxHrsTile->SetValue(false); - cbxHrsAltCRC->SetValue(true); - cbxHrsLetFly->SetValue(true); - cbxSaveTexCache->SetValue(true); - cmbTextureCompression->SetSelection(0); - cbxHrsTexCompression->SetValue(false); - cbxEnhTexCompression->SetValue(false); - cbxHrsTexEdit->SetValue(false); - cbxHrsForce16->SetValue(false); - - if (!voodoo.sup_32bit_tex) - { - cbxHrsForce16->SetValue(true); - } - // event.Skip(); - // wxLogDebug("Event handler (ConfigNotebook::onQuality) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void ConfigNotebook::OnClickTexEdit(wxCommandEvent &event) -{ - if (event.GetEventObject() == cbxHrsTexEdit) - { - bool val = !cbxHrsTexEdit->GetValue(); - cbxHrsAltCRC->Enable(val); - if (val) - cbxHrsAltCRC->SetValue(g_settings->ghq_hirs_altcrc > 0); - else - cbxHrsAltCRC->SetValue(false); - } - // event.Skip(); - // wxLogDebug("Event handler (ConfigNotebook::FrameBufferOnClick) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} -#endif //TEXTURE_FILTER - -/* -void ConfigNotebook::onPageChanged(wxNotebookEvent &event) -{ -event.Skip(); -wxLogDebug("Event handler (ConfigNotebook::onPageChanged) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void ConfigNotebook::onPageChanging(wxNotebookEvent &event) -{ -event.Skip(); -wxLogDebug("Event handler (ConfigNotebook::onPageChanging) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} -*/ - -// wxGlade: add ConfigNotebook event handlers - -void ConfigNotebook::set_properties() -{ - // begin wxGlade: ConfigNotebook::set_properties - //Basic panel - AddPage(BasicSettingsPanel, "Basic settings"); - wxString tooltip = "Resolution\nThis option selects the fullscreen resolution for 3dfx cards and windowed resolution for other cards\n(note again that for 3dfx cards the plugin must be in fullscreen mode to see anything).\n[Recommended: 640x480, 800x600, 1024x768]"; - lblResolution->SetToolTip(tooltip); - cmbResolution->SetToolTip(tooltip); - cmbResolution->SetSelection(g_settings->res_data); - cbxVSync->SetToolTip("Vertical sync\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\"."); - cbxVSync->SetValue(g_settings->vsync > 0); - tooltip = "Select a format, in which screen shots will be saved"; - lblScreenShotFormat->SetToolTip(tooltip); - cmbScreenShotFormat->SetToolTip(tooltip); - for (int f = 0; f < NumOfFormats; f++) { - cmbScreenShotFormat->Append(ScreenShotFormats[f].format); - } - cmbScreenShotFormat->SetSelection(g_settings->ssformat); - cbxFPS->SetToolTip("FPS counter\nWhen this option is checked, a FPS (frames per second) counter will be shown\nin the lower left corner of the screen.\n[Recommended: your preference]"); - cbxFPS->SetValue((g_settings->show_fps & 1) > 0); - cbxVIS->SetToolTip("VI/s counter\nWhen this option is checked, a VI/s (vertical interrupts per second) counter\nwill be shown in the lower left corner of the screen. This is like the FPS\ncounter but will be consistent at 60 VI/s for full speed on NTSC (U) games and\n50 VI/s for full speed on PAL (E) ones.\n[Recommended: your preference]"); - cbxVIS->SetValue((g_settings->show_fps & 2) > 0); - cbxPercent->SetToolTip("% speed\nThis displays a percentage of the actual N64 speed in the lower\nleft corner of the screen.\n[Recommended: your preference]"); - cbxPercent->SetValue((g_settings->show_fps & 4) > 0); - cbxClockEnabled->SetToolTip("Clock enabled\nThis option will put a clock in the lower right corner of the screen, showing the current time.\n[Recommended: your preference]"); - cbxClockEnabled->SetValue(g_settings->clock > 0); - cbxClock24->SetValue(g_settings->clock_24_hr > 0); - cbxClock24->SetToolTip("Display hours as 24-hour clock.\n[Recommended: your preference]"); - cbxTextTransparent->SetToolTip("Transparent text background\nIf this is checked, all on-screen messages will have a transparent background. Otherwise, it will have a solid black background.\n[Recommended: your preference]"); - cbxTextTransparent->SetValue((g_settings->show_fps & 8) > 0); - cbxTextureSettings->SetValue(g_settings->texenh_options > 0); - cbxTextureSettings->SetToolTip("Enable \"Texture enhancement\" panel.\nIt shows various enhancement options for original textures as well as options for hi-resolution textures."); - tooltip = "Full screen resolution:\nThis sets the full screen resolution for non-3dfx video cards.\nAll the resolutions that your video card/monitor support should be displayed.\n[Recommended: native (max) resolution of your monitor - unless performance becomes an issue]"; - lblFSResolution->SetToolTip(tooltip); - cmbFSResolution->SetToolTip(tooltip); - cbxAnisotropic->SetToolTip("Anisotropic filtering:\nThis filter sharpens and brings out the details of textures that recede into the distance.\nWhen activated, it will use the max anisotropy your video card supports.\nHowever, this will override native way of texture filtering and may cause visual artifacts in some games.\n[Recommended: your preference, game dependant]"); - cbxVRAM->SetToolTip("Autodetect VRAM Size:\nSince OpenGL cannot do this reliably at the moment, the option to set this manually is available.\nIf checked, plugin will try to autodetect VRAM size.\nBut if this appears wrong, please uncheck and set it to correct value.\n[Recommended: on]"); - spinVRAM->SetMinSize(wxSize(55, 21)); - cbxFBO->SetToolTip("Use frame buffer objects:\nChanges the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension.\nThe choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on.\nAlso, some FB effects works only with one of the methods, no matter, which card you have.\nOn the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2).\nHowever, with FBO on with some systems, it can actually be a bit faster in cases.\n[Recommended: video card and game dependant]"); - int32_t size = 0; - char ** aRes = grQueryResolutionsExt(&size); - if (aRes && size) - { - for (int r = 0; r < size; r++) { - wxString res(aRes[r], wxConvUTF8); - cmbFSResolution->Append(res); - } - cmbFSResolution->SetSelection(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0); - } -#ifdef __WINDOWS__ - cbxVRAM->SetValue(g_settings->wrpVRAM == 0); - if (cbxVRAM->GetValue()) - spinVRAM->SetValue(" auto"); - else - spinVRAM->SetValue(g_settings->wrpVRAM); - spinVRAM->Enable(!cbxVRAM->GetValue()); - lblMb->Enable(!cbxVRAM->GetValue()); -#else - cbxVRAM->SetValue(false); - cbxVRAM->Disable(); - spinVRAM->SetValue(g_settings->wrpVRAM ? g_settings->wrpVRAM : 32); - spinVRAM->Enable(true); - lblMb->Enable(true); #endif - cbxFBO->SetValue(g_settings->wrpFBO > 0); - cbxAnisotropic->SetValue(g_settings->wrpAnisotropic > 0); - //emulation settings panel - if (g_settings->advanced_options) - { - AddPage(EmuSettingsPanel, "Emulation settings"); - tooltip = "Filtering mode\nThere are three filtering modes possible:\n* Automatic filtering - filter exactly how the N64 specifies.\n* Point-sampled filtering - causes texels to appear square and sharp.\n* Bilinear filtering - interpolates the texture to make it appear more smooth.\n[Recommended: Automatic]"; - lbFiltering->SetToolTip(tooltip); - cmbFiltering->SetToolTip(tooltip); - cmbFiltering->SetSelection(g_settings->filtering); - tooltip = "Buffer swapping method\nThere are 3 buffer swapping methods:\n* old - swap buffers when vertical interrupt has occurred.\n* new - swap buffers when set of conditions is satisfied. Prevents flicker on some games.\n* hybrid - mix of first two methods.\nCan prevent even more flickering then previous method, but also can cause artefacts.\nIf you have flickering problems in a game (or graphics that don't show),\ntry to change swapping method.\n[Recommended: new (hybrid for Paper Mario)]"; - lbBufferSwap->SetToolTip(tooltip); - cmbBufferSwap->SetToolTip(tooltip); - cmbBufferSwap->SetSelection(g_settings->swapmode); - tooltip = "Per-pixel level-of-detail calculation\nN64 uses special mechanism for mip-mapping, which nearly impossible to reproduce\ncorrectly on PC hardware. This option enables approximate emulation of this feature.\nFor example, it is required for the Peach/Bowser portrait's transition in Super Mario 64.\nThere are 3 modes:\n* off - LOD is not calculated\n* fast - fast imprecise LOD calculation.\n* precise - most precise LOD calculation possible, but more slow.\n[Recommended: your preference]"; - lblLOD->SetToolTip(tooltip); - cmbLOD->SetToolTip(tooltip); - cmbLOD->SetSelection(g_settings->lodmode); - cmbAspect->SetSelection(g_settings->aspectmode); - tooltip = "Aspect ratio of the output.\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game g_settings->\nIn \"Stretch\" mode the output will be stretched to the entire screen,\nother modes may add black borders if necessary"; - cmbAspect->SetToolTip(tooltip); - lblAspect->SetToolTip(tooltip); - cbxFog->SetToolTip("Fog enabled\nSets fog emulation on//off.\n[Recommended: on]"); - cbxFog->SetValue(g_settings->fog > 0); - cbxBuffer->SetToolTip("Buffer clear on every frame\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated,\nand some garbage may be left on the screen.\nIn such cases, this option must be set on.\n[Recommended: on]"); - cbxBuffer->SetValue(g_settings->buff_clear > 0); - cbxFBEnable->SetToolTip("Enable frame buffer emulation\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n[Recommended: on for games which use frame buffer effects]"); - cbxFBEnable->SetValue(fb_emulation_enabled); - cbxFBHWFBE->SetToolTip("Enable hardware frame buffer emulation\nIf this option is on, plugin will create auxiliary frame buffers in video memory instead of copying\nframe buffer content into main memory. This allows plugin to run frame buffer effects without slowdown\nand without scaling image down to N64's native resolution. This feature is fully supported by\nVoodoo 4/5 cards and partially by Voodoo3 and Banshee. Modern cards also fully support it.\n[Recommended: on, if supported by your hardware]"); - cbxFBHWFBE->SetValue(((g_settings->frame_buffer&fb_hwfbe) > 0)); - cbxFBHWFBE->Enable(fb_emulation_enabled); - cbxFBGetFBI->SetToolTip("Get information about frame buffers\nThis is compatibility option. It must be set on for Mupen64 and off for 1964"); - cbxFBGetFBI->SetValue((g_settings->frame_buffer&fb_get_info) > 0); - cbxFBReadEveryFrame->SetToolTip("Read every frame\nIn some games plugin can't detect frame buffer usage.\nIn such cases you need to enable this option to see frame buffer effects.\nEvery drawn frame will be read from video card -> it works very slow.\n[Recommended: mostly off (needed only for a few games)]"); - cbxFBReadEveryFrame->SetValue((g_settings->frame_buffer&fb_ref) > 0); - cbxFBasTex->SetToolTip("Render N64 frame buffer as texture\nWhen this option is enabled, content of each N64 frame buffer is rendered\nas texture over the frame, rendered by the plugin. This prevents graphics lost,\nbut may cause slowdowns and various glitches in some games.\n[Recommended: mostly off]"); - cbxFBasTex->SetValue((g_settings->frame_buffer&fb_read_back_to_screen) > 0); - cbxDetect->SetToolTip("Detect CPU write to the N64 frame buffer\nThis option works as the previous options, but the plugin is trying to detect,\nwhen game uses CPU writes to N64 frame buffer. The N64 frame buffer is rendered\nonly when CPU writes is detected. Use this option for those games, in which you\nsee still image or no image at all for some time with no reason.\n[Recommended: mostly off]"); - cbxDetect->SetValue((g_settings->frame_buffer&fb_cpu_write_hack) > 0); - cbxFBDepthBuffer->SetToolTip("Enable depth buffer rendering\nThis option is used to fully emulate N64 depth buffer.\nIt is required for correct emulation of depth buffer based effects.\nHowever, it requires fast (>1GHz) CPU to work full speed.\n[Recommended: on for fast PC]"); - cbxFBDepthBuffer->SetValue((g_settings->frame_buffer&fb_depth_render) > 0); - } -#ifdef TEXTURE_FILTER - if (g_settings->texenh_options) - { - AddPage(TexturePanel, "Texture enhancement"); - tooltip = "Filters:\nApply a filter to either smooth or sharpen textures.\nThere are 4 different smoothing filters and 2 different sharpening filters.\nThe higher the number, the stronger the effect,\ni.e. \"Smoothing filter 4\" will have a much more noticeable effect than \"Smoothing filter 1\".\nBe aware that performance may have an impact depending on the game and/or the PC.\n[Recommended: your preference]"; - lblFilter->SetToolTip(tooltip); - cmbEnhFilter->SetToolTip(tooltip); - cmbEnhFilter->SetSelection(g_settings->ghq_fltr); - tooltip = "Texture enhancement:\n7 different filters are selectable here, each one with a distinctive look.\nBe aware of possible performance impacts.\n\nIMPORTANT: 'Store' mode - saves textures in cache 'as is'. It can improve performance in games, which load many textures.\nDisable 'Ignore backgrounds' option for better result.\n\n[Recommended: your preference]"; - lblEnhancement->SetToolTip(tooltip); - cmbEnhEnhancement->SetToolTip(tooltip); - cmbEnhEnhancement->SetSelection(g_settings->ghq_enht); - tooltip = "Texture cache size:\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures,\nso setting 256+ megs can boost performance. Adjust accordingly if you are encountering speed issues.\n'0' disables cache.\n[Recommended: PC and game dependant]"; - lblTexCache->SetToolTip(tooltip); - lblTexCacheMB->SetToolTip(tooltip); - spinEnhCacheSize->SetToolTip(tooltip); - spinEnhCacheSize->SetMinSize(wxSize(55, 21)); - spinEnhCacheSize->SetValue(g_settings->ghq_cache_size); - cbxEnhIgnoreBG->SetToolTip("Ignore Backgrounds:\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n[Recommended: on (off for 'Store' mode)]"); - cbxEnhIgnoreBG->SetValue(g_settings->ghq_enht_nobg > 0); - tooltip = "Texture compression:\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache,\nthe space occupied on the GFX hardware's texture RAM,\nby the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage,\ndecreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n[Recommended: off]"; - cbxEnhTexCompression->SetToolTip(tooltip); - cbxHrsTexCompression->SetToolTip(tooltip); - cbxEnhTexCompression->SetValue(g_settings->ghq_enht_cmpr > 0); - cbxEnhCompressCache->SetToolTip("Compress texture cache:\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture,\nbut 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]"); - cbxEnhCompressCache->SetValue(g_settings->ghq_enht_gz > 0); - tooltip = "Hi-res pack format:\nChoose which method is to be used for loading Hi-res texture packs.\nOnly Rice's format is available currently.\nLeave on \"None\" if you will not be needing to load hi-res packs.\n[Recommended: Rice's format. Default: \"None\"]"; - lblHrsFormat->SetToolTip(tooltip); - cmbHrsFormat->SetToolTip(tooltip); - cmbHrsFormat->SetSelection(g_settings->ghq_hirs); - cbxHrsTile->SetToolTip("Tile textures:\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet\n- various issues are possible, including black lines and polygons distortions.\n[Recommended: off]"); - cbxHrsTile->SetValue(g_settings->ghq_hirs_tile > 0); - cbxHrsForce16->SetToolTip("Force 16bpp textures:\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n[Recommended: off]"); - cbxHrsForce16->SetValue(g_settings->ghq_hirs_f16bpp > 0); - cbxHrsTexEdit->SetToolTip("Texture dumping mode:\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys: \"R\" reloads hires textures from the texture pack - \"D\" toggles texture dumps on/off."); - cbxHrsTexEdit->SetValue(g_settings->ghq_hirs_dump > 0); - cbxHrsAltCRC->SetToolTip("Alternative CRC calculation:\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n[Recommended: texture pack dependant, mostly on]"); - cbxHrsAltCRC->SetValue(g_settings->ghq_hirs_altcrc > 0 && g_settings->ghq_hirs_dump == 0); - if (g_settings->ghq_hirs_dump) - cbxHrsAltCRC->Disable(); - cbxHrsTexCompression->SetValue(g_settings->ghq_hirs_cmpr > 0); - cbxHrsCompressCache->SetToolTip("Compress texture cache:\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]"); - cbxHrsCompressCache->SetValue(g_settings->ghq_hirs_gz > 0); - cbxHrsLetFly->SetToolTip("Use Alpha channel fully:\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style\n- with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture,\nand select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need,\nregardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n[Recommended: texture pack dependant]"); - cbxHrsLetFly->SetValue(g_settings->ghq_hirs_let_texartists_fly > 0); - cmbTextureCompression->SetSelection(g_settings->ghq_cmpr); - cbxSaveTexCache->SetToolTip("Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch,\nas opposed to the 5 -60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Plugins folder.\n\n[Highly Recommended: on]"); - cbxSaveTexCache->SetValue(g_settings->ghq_cache_save > 0); - TexturePanel->SetMinSize(wxSize(526, 494)); - - if (!voodoo.sup_32bit_tex) - { - g_settings->ghq_cmpr = 0; - g_settings->ghq_enht_cmpr = g_settings->ghq_hirs_cmpr = FALSE; - g_settings->ghq_enht_f16bpp = g_settings->ghq_hirs_f16bpp = TRUE; - lblTexCompression->Disable(); - cmbTextureCompression->SetSelection(0); - cmbTextureCompression->Disable(); - cbxEnhTexCompression->SetValue(false); - cbxEnhTexCompression->Disable(); - cbxHrsTexCompression->SetValue(false); - cbxHrsTexCompression->Disable(); - cbxHrsForce16->SetValue(false); - cbxHrsForce16->Disable(); - } - } -#endif //TEXTURE_FILTER - -#ifndef _ENDUSER_RELEASE_ - AddPage(DebugPanel, "Debug"); - cbxAutoUcode->SetToolTip("Autodetect Microcode\nIf this option is checked, the microcode of the game\nwill be detected automatically from the INI, and\ntherefore it will not need to be set in this\nconfiguration dialog.\n[Recommended: on]"); - cbxAutoUcode->SetValue(g_settings->autodetect_ucode > 0); - tooltip = "Force Microcode\nThis option ONLY has an effect if Autodetect Microcode\nis unchecked, the crc from the game could not be\nfound in the INI, OR after the game has already started\nrunning. In any of those three cases, this will\nselect the microcode to use\n[Recommended: any, turn on Autodetect Microcode]"; - lblForceUcode->SetToolTip(tooltip); - cmbForceUcode->SetToolTip(tooltip); - cmbForceUcode->SetSelection(g_settings->ucode); - cbxWireframe->SetToolTip("Wireframe\nThis option, when checked, makes it so that the plugin will draw only the\noutlines of objects. The colors specified in the combo box to the right\ndetermines the color that the wireframes show up as.\n[Recommended: off]"); - cbxWireframe->SetValue(g_settings->wireframe>0); - cmbWireframe->SetToolTip("Wireframe Colors\nThis selects the colors to use for the wireframes (if wireframe mode is enabled).\nThere are 3 modes:\n* Original colors - draw exactly as it would normally, textures and all, only in wireframes.\n* Vertex colors - use the colors specified in the vertices to draw the wireframes with.\n* Red only - use a constant red color to draw the wireframes.\n[Recommended: Vertex colors]"); - cmbWireframe->SetSelection(g_settings->wfmode); - cbxLog->SetToolTip("Log to RDP.txt\nRECOMMENDED FOR DEBUGGING ONLY - this option, when checked, will log EVERY SINGLE\nCOMMAND the plugin processes to a file called RDP.txt in the current directory.\nThis is incredibly slow, so I recommend keeping it disabled.\n[Recommended: off]"); - cbxLog->SetValue(g_settings->logging>0); - cbxCombRed->SetToolTip("Unknown combiners as red\nObjects that use an unimplemented combine mode will show up as red instead of\nassuming texture with full alpha. Disable this option to remove the red stuff\nand at least have a guess at the correct combine mode.\n[Recommended: off]"); - cbxCombRed->SetValue(g_settings->unk_as_red>0); - cbxLogClear->SetToolTip("Log clear every frame\nRECOMMENDED FOR DEBUGGING ONLY - this option has no effect unless 'Log to RDP.txt'\nis checked. This will make it so that the log, RDP.txt, will be cleared at the\nbeginning of every frame.\n[Recommended: off]"); - cbxLogClear->SetValue(g_settings->log_clear>0); - cbxCmbLog->SetToolTip("Log unknown combiners\nRECOMMENDED FOR DEBUGGING ONLY - when checked, this option will cause every\nunimplemented combiner drawn to be logged to a file called Unimp.txt in the\ncurrent directory. This becomes slow when there are unimplemented combiners\non the screen, so I recommend keeping it disabled.\n[Recommended: off]"); - cbxCmbLog->SetValue(g_settings->log_unk>0); - cbxWindowLog->SetToolTip("Run and log in window\nRECOMMENDED FOR DEBUGGING ONLY - this option will make it so that the plugin will\nstill process dlists in windowed mode. This allows for logging to occur while not\nin fullscreen, possibly allowing you to debug a crash.\n[Recommended: off]"); - cbxWindowLog->SetValue(g_settings->run_in_window>0); - cbxCmbLogClear->SetToolTip("Clear unknown combiner log every frame\nRECOMMENDED FOR DEBUGGING ONLY - this option works much like 'Log clear every frame'\nexcept it clears the combiner log (Unimp.txt) instead of RDP.txt at the\nbeginning of each frame. Again, this option has no effect if 'combiner logging' is disabled.\n[Recommended: off]"); - cbxCmbLogClear->SetValue(g_settings->unk_clear>0); - cbxErrLog->SetValue(g_settings->elogging>0); - cbxBilinearTexCache->SetToolTip("Bilinear filter texture cache\nRECOMMENDED FOR DEBUGGING ONLY - when checked, this option will make the graphical\ndebugger texture cache use bilinear filtering as opposed to point-sampled filtering,\nwhich it will use otherwise. See 'Filtering mode' for descriptions of bilinear and\npoint-sampled filtering.\n[Recommended: off]"); - cbxBilinearTexCache->SetValue(g_settings->filter_cache>0); -#endif //_ENDUSER_RELEASE_ - // end wxGlade -} - -void ConfigNotebook::do_layout() -{ - // begin wxGlade: ConfigNotebook::do_layout - - //Basic panel - wxBoxSizer* ConfigMainSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* OtherSizer = new wxStaticBoxSizer(OtherSizer_staticbox, wxVERTICAL); - wxBoxSizer* OtherOtherSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* ScreenShotFormatSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* ShowPanelsSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* ConfigUpperSizer = new wxBoxSizer(wxHORIZONTAL); - wxStaticBoxSizer* OnScreenInfoSizer = new wxStaticBoxSizer(OnScreenDisplaySizer_staticbox, wxHORIZONTAL); - wxBoxSizer* InfoMainSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* TimeSizer = new wxStaticBoxSizer(TimeSizer_staticbox, wxVERTICAL); - wxStaticBoxSizer* SpeedSizer = new wxStaticBoxSizer(SpeedSizer_staticbox, wxVERTICAL); - wxBoxSizer* BasicLeftSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* BasicRenderingSizer = new wxStaticBoxSizer(BasicRenderingSizer_staticbox, wxVERTICAL); - wxStaticBoxSizer* WrapperSizer = new wxStaticBoxSizer(WrapperSizer_staticbox, wxVERTICAL); - wxStaticBoxSizer* WrapperFBOptionsSizer = new wxStaticBoxSizer(WrapperFBOptionsSizer_staticbox, wxVERTICAL); - wxBoxSizer* VRAMSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* FSResolutionSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* ResolutionSizer = new wxBoxSizer(wxHORIZONTAL); - ResolutionSizer->Add(lblResolution, 1, wxALIGN_CENTER_VERTICAL, 0); - ResolutionSizer->Add(20, 20, 0, 0, 0); - ResolutionSizer->Add(cmbResolution, 0, wxALIGN_CENTER_VERTICAL, 0); - BasicRenderingSizer->Add(ResolutionSizer, 0, wxTOP | wxBOTTOM, 10); - BasicRenderingSizer->Add(cbxVSync, 0, wxBOTTOM, 10); - FSResolutionSizer->Add(lblFSResolution, 1, wxALIGN_CENTER_VERTICAL, 0); - FSResolutionSizer->Add(20, 20, 0, 0, 0); - FSResolutionSizer->Add(cmbFSResolution, 0, 0, 0); - WrapperSizer->Add(FSResolutionSizer, 0, wxTOP | wxBOTTOM, 10); - WrapperSizer->Add(cbxAnisotropic, 0, wxBOTTOM, 10); - VRAMSizer->Add(cbxVRAM, 0, wxALIGN_CENTER_VERTICAL, 0); - VRAMSizer->Add(lblVRAM, 0, wxALIGN_CENTER_VERTICAL, 0); - VRAMSizer->Add(spinVRAM, 0, wxLEFT, 10); - VRAMSizer->Add(lblMb, 0, wxLEFT | wxALIGN_BOTTOM, 3); - WrapperSizer->Add(VRAMSizer, 0, wxBOTTOM | wxEXPAND, 10); - WrapperFBOptionsSizer->Add(cbxFBO, 0, wxTOP | wxBOTTOM, 10); - WrapperSizer->Add(WrapperFBOptionsSizer, 0, wxEXPAND, 0); - BasicRenderingSizer->Add(WrapperSizer, 0, wxEXPAND, 0); - BasicLeftSizer->Add(BasicRenderingSizer, 1, wxEXPAND, 0); - ConfigUpperSizer->Add(BasicLeftSizer, 1, wxLEFT | wxRIGHT | wxEXPAND, 10); - SpeedSizer->Add(cbxFPS, 0, wxTOP | wxBOTTOM, 10); - SpeedSizer->Add(cbxVIS, 0, wxBOTTOM, 10); - SpeedSizer->Add(cbxPercent, 0, wxBOTTOM, 10); - InfoMainSizer->Add(SpeedSizer, 0, wxALL | wxEXPAND, 10); - TimeSizer->Add(cbxClockEnabled, 0, wxTOP | wxBOTTOM, 10); - TimeSizer->Add(cbxClock24, 0, wxBOTTOM, 10); - InfoMainSizer->Add(TimeSizer, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10); - InfoMainSizer->Add(cbxTextTransparent, 0, wxLEFT | wxTOP, 15); - OnScreenInfoSizer->Add(InfoMainSizer, 1, wxEXPAND, 0); - ConfigUpperSizer->Add(OnScreenInfoSizer, 1, wxLEFT | wxRIGHT | wxEXPAND, 10); - ConfigMainSizer->Add(ConfigUpperSizer, 1, wxEXPAND, 0); - ShowPanelsSizer->Add(cbxTextureSettings, 1, wxLEFT, 10); - OtherSizer->Add(ShowPanelsSizer, 0, wxTOP | wxBOTTOM | wxEXPAND, 10); - ScreenShotFormatSizer->Add(lblScreenShotFormat, 0, 0, 0); - ScreenShotFormatSizer->Add(20, 20, 0, 0, 0); - ScreenShotFormatSizer->Add(cmbScreenShotFormat, 0, 0, 0); - OtherOtherSizer->Add(ScreenShotFormatSizer, 1, wxALIGN_CENTER_VERTICAL, 0); - OtherSizer->Add(OtherOtherSizer, 0, wxEXPAND, 0); - ConfigMainSizer->Add(OtherSizer, 0, wxALL | wxEXPAND, 10); - BasicSettingsPanel->SetSizer(ConfigMainSizer); - - //emulation settings panel - if (g_settings->advanced_options) - { - wxStaticBoxSizer* EmuSettingsBoxSizer = new wxStaticBoxSizer(EmuSettingsBoxSizer_staticbox, wxHORIZONTAL); - wxBoxSizer* EmuSettingsMainSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* EmuSettingsRightSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* DepthBufferSizer = new wxStaticBoxSizer(DepthBufferSizer_staticbox, wxHORIZONTAL); - wxStaticBoxSizer* FrameBufferSizer = new wxStaticBoxSizer(FrameBufferSizer_staticbox, wxVERTICAL); - wxBoxSizer* HWFBESizer = new wxBoxSizer(wxHORIZONTAL); - wxStaticBoxSizer* EmuSettingsLeftSizer = new wxStaticBoxSizer(EmuSettingsLeftSizer_staticbox, wxVERTICAL); - wxBoxSizer* AspectSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* LODSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* SwappingSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* FilteringSizer = new wxBoxSizer(wxHORIZONTAL); - FilteringSizer->Add(lbFiltering, 0, 0, 0); - FilteringSizer->Add(20, 20, 0, 0, 0); - FilteringSizer->Add(cmbFiltering, 0, 0, 0); - EmuSettingsLeftSizer->Add(FilteringSizer, 1, wxTOP, 10); - SwappingSizer->Add(lbBufferSwap, 0, 0, 0); - SwappingSizer->Add(20, 20, 0, 0, 0); - SwappingSizer->Add(cmbBufferSwap, 0, 0, 0); - EmuSettingsLeftSizer->Add(SwappingSizer, 1, 0, 0); - LODSizer->Add(lblLOD, 0, 0, 0); - LODSizer->Add(20, 20, 0, 0, 0); - LODSizer->Add(cmbLOD, 0, 0, 0); - EmuSettingsLeftSizer->Add(LODSizer, 1, 0, 0); - AspectSizer->Add(lblAspect, 0, 0, 0); - AspectSizer->Add(20, 20, 0, 0, 0); - AspectSizer->Add(cmbAspect, 0, 0, 0); - EmuSettingsLeftSizer->Add(AspectSizer, 1, 0, 0); - EmuSettingsLeftSizer->Add(cbxFog, 1, 0, 0); - EmuSettingsLeftSizer->Add(cbxBuffer, 1, 0, 0); - EmuSettingsMainSizer->Add(EmuSettingsLeftSizer, 1, wxLEFT | wxRIGHT | wxEXPAND, 10); - FrameBufferSizer->Add(cbxFBEnable, 1, wxTOP | wxBOTTOM, 10); - HWFBESizer->Add(30, 20, 0, 0, 0); - HWFBESizer->Add(cbxFBHWFBE, 0, 0, 0); - FrameBufferSizer->Add(HWFBESizer, 0, wxBOTTOM, 10); - FrameBufferSizer->Add(cbxFBGetFBI, 1, wxBOTTOM, 10); - FrameBufferSizer->Add(cbxFBReadEveryFrame, 1, wxBOTTOM, 10); - FrameBufferSizer->Add(cbxFBasTex, 1, wxBOTTOM, 10); - FrameBufferSizer->Add(cbxDetect, 1, wxBOTTOM, 10); - EmuSettingsRightSizer->Add(FrameBufferSizer, 1, wxEXPAND, 0); - DepthBufferSizer->Add(cbxFBDepthBuffer, 0, wxTOP | wxBOTTOM, 10); - EmuSettingsRightSizer->Add(DepthBufferSizer, 0, wxTOP | wxEXPAND, 10); - EmuSettingsMainSizer->Add(EmuSettingsRightSizer, 1, wxLEFT | wxRIGHT | wxEXPAND, 10); - EmuSettingsBoxSizer->Add(EmuSettingsMainSizer, 1, wxTOP | wxBOTTOM | wxEXPAND, 10); - EmuSettingsPanel->SetSizer(EmuSettingsBoxSizer); - } - -#ifdef TEXTURE_FILTER - if (g_settings->texenh_options) - { - wxBoxSizer* TextureMainSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* PresetsSizer = new wxStaticBoxSizer(PresetsSizer_staticbox, wxHORIZONTAL); - wxStaticBoxSizer* CommonSizer = new wxStaticBoxSizer(CommonSizer_staticbox, wxHORIZONTAL); - wxBoxSizer* TexCompressionSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* TexLeftSizer = new wxBoxSizer(wxHORIZONTAL); - wxStaticBoxSizer* TextureRightSizer = new wxStaticBoxSizer(TextureRightSizer_staticbox, wxVERTICAL); - wxStaticBoxSizer* HRTexPerfTweaksSizer = new wxStaticBoxSizer(HRTexPerfTweaksSizer_staticbox, wxVERTICAL); - wxBoxSizer* FormatSizer = new wxBoxSizer(wxHORIZONTAL); - wxStaticBoxSizer* EnhTexSizer = new wxStaticBoxSizer(EnhTexSizer_staticbox, wxVERTICAL); - wxStaticBoxSizer* EnhTexPerfTweaksSizer = new wxStaticBoxSizer(EnhTexPerfTweaksSizer_staticbox, wxVERTICAL); - wxBoxSizer* TexCacheSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* EnhSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* FilterSizer = new wxBoxSizer(wxHORIZONTAL); - FilterSizer->Add(lblFilter, 0, 0, 0); - FilterSizer->Add(20, 20, 0, 0, 0); - FilterSizer->Add(cmbEnhFilter, 0, 0, 0); - EnhTexSizer->Add(FilterSizer, 0, wxTOP | wxBOTTOM | wxEXPAND, 10); - EnhSizer->Add(lblEnhancement, 0, 0, 0); - EnhSizer->Add(20, 20, 0, 0, 0); - EnhSizer->Add(cmbEnhEnhancement, 0, 0, 0); - EnhTexSizer->Add(EnhSizer, 0, wxBOTTOM | wxEXPAND, 10); - TexCacheSizer->Add(lblTexCache, 0, 0, 0); - TexCacheSizer->Add(20, 20, 0, 0, 0); - TexCacheSizer->Add(spinEnhCacheSize, 0, 0, 0); - TexCacheSizer->Add(lblTexCacheMB, 0, wxLEFT | wxALIGN_BOTTOM, 4); - EnhTexSizer->Add(TexCacheSizer, 0, wxBOTTOM | wxEXPAND, 10); - EnhTexSizer->Add(cbxEnhCompressCache, 0, wxBOTTOM, 10); - EnhTexPerfTweaksSizer->Add(cbxEnhTexCompression, 0, wxTOP | wxBOTTOM, 10); - EnhTexPerfTweaksSizer->Add(cbxEnhIgnoreBG, 0, wxBOTTOM, 10); - EnhTexSizer->Add(EnhTexPerfTweaksSizer, 1, wxEXPAND, 0); - TexLeftSizer->Add(EnhTexSizer, 1, wxALL | wxEXPAND, 10); - FormatSizer->Add(lblHrsFormat, 0, 0, 0); - FormatSizer->Add(20, 20, 0, 0, 0); - FormatSizer->Add(cmbHrsFormat, 0, 0, 0); - TextureRightSizer->Add(FormatSizer, 0, wxTOP | wxBOTTOM | wxEXPAND, 10); - TextureRightSizer->Add(cbxHrsAltCRC, 0, wxBOTTOM, 10); - TextureRightSizer->Add(cbxHrsTexEdit, 0, wxBOTTOM, 10); - TextureRightSizer->Add(cbxHrsLetFly, 0, wxBOTTOM, 10); - TextureRightSizer->Add(cbxHrsCompressCache, 0, wxBOTTOM, 10); - HRTexPerfTweaksSizer->Add(cbxHrsTexCompression, 0, wxTOP | wxBOTTOM, 10); - HRTexPerfTweaksSizer->Add(cbxHrsForce16, 0, wxBOTTOM, 10); - HRTexPerfTweaksSizer->Add(cbxHrsTile, 0, wxBOTTOM, 10); - TextureRightSizer->Add(HRTexPerfTweaksSizer, 1, wxEXPAND, 0); - TexLeftSizer->Add(TextureRightSizer, 1, wxALL | wxEXPAND, 10); - TextureMainSizer->Add(TexLeftSizer, 1, wxEXPAND, 0); - TexCompressionSizer->Add(lblTexCompression, 0, wxALIGN_CENTER_VERTICAL, 0); - TexCompressionSizer->Add(20, 20, 0, 0, 0); - TexCompressionSizer->Add(cmbTextureCompression, 0, 0, 0); - CommonSizer->Add(TexCompressionSizer, 1, wxBOTTOM | wxEXPAND, 10); - CommonSizer->Add(cbxSaveTexCache, 1, wxLEFT | wxEXPAND, 15); - TextureMainSizer->Add(CommonSizer, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10); - PresetsSizer->Add(btnPerformance, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); - PresetsSizer->Add(60, 20, 0, 0, 0); - PresetsSizer->Add(btnQuality, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); - TextureMainSizer->Add(PresetsSizer, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10); - TexturePanel->SetSizer(TextureMainSizer); - } -#endif //TEXTURE_FILTER - -#ifndef _ENDUSER_RELEASE_ - wxBoxSizer* DebugMainSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer* DebugSizer = new wxStaticBoxSizer(DebugSizer_staticbox, wxVERTICAL); - wxGridSizer* DebugOptionsSizer = new wxGridSizer(4, 2, 0, 0); - wxStaticBoxSizer* DevSettingsSizer = new wxStaticBoxSizer(DevSettingsSizer_staticbox, wxVERTICAL); - wxBoxSizer* WireframeSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* ForceUcodeSizer = new wxBoxSizer(wxHORIZONTAL); - DevSettingsSizer->Add(cbxAutoUcode, 1, 0, 0); - ForceUcodeSizer->Add(lblForceUcode, 0, 0, 0); - ForceUcodeSizer->Add(20, 20, 0, 0, 0); - ForceUcodeSizer->Add(cmbForceUcode, 0, 0, 0); - DevSettingsSizer->Add(ForceUcodeSizer, 1, wxEXPAND, 0); - WireframeSizer->Add(cbxWireframe, 0, 0, 0); - WireframeSizer->Add(20, 20, 0, 0, 0); - WireframeSizer->Add(cmbWireframe, 0, 0, 0); - DevSettingsSizer->Add(WireframeSizer, 1, wxEXPAND, 0); - DebugMainSizer->Add(DevSettingsSizer, 1, wxALL|wxEXPAND, 10); - DebugOptionsSizer->Add(cbxLog, 0, wxTOP, 5); - DebugOptionsSizer->Add(cbxCombRed, 0, wxTOP, 5); - DebugOptionsSizer->Add(cbxLogClear, 0, 0, 10); - DebugOptionsSizer->Add(cbxCmbLog, 0, 0, 10); - DebugOptionsSizer->Add(cbxWindowLog, 0, 0, 10); - DebugOptionsSizer->Add(cbxCmbLogClear, 0, 0, 10); - DebugOptionsSizer->Add(cbxErrLog, 0, 0, 0); - DebugOptionsSizer->Add(cbxBilinearTexCache, 0, 0, 0); - DebugSizer->Add(DebugOptionsSizer, 1, wxEXPAND, 0); - DebugMainSizer->Add(DebugSizer, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 10); - DebugPanel->SetSizer(DebugMainSizer); -#endif //_ENDUSER_RELEASE_ - // end wxGlade -} - -void ConfigNotebook::SaveSettings() -{ - CSettings oldsettings = *g_settings; - int is_advanced_changed = 0; - if (g_settings->advanced_options) - { - g_settings->filtering = cmbFiltering->GetSelection(); - g_settings->aspectmode = cmbAspect->GetSelection(); - g_settings->swapmode = cmbBufferSwap->GetSelection(); - g_settings->fog = (int)cbxFog->GetValue(); - g_settings->buff_clear = cbxBuffer->GetValue(); - g_settings->lodmode = cmbLOD->GetSelection(); - - if (cbxFBEnable->GetValue()) g_settings->frame_buffer |= fb_emulation; - else g_settings->frame_buffer &= ~fb_emulation; - if (cbxFBHWFBE->GetValue()) g_settings->frame_buffer |= fb_hwfbe; - else g_settings->frame_buffer &= ~fb_hwfbe; - if (cbxFBReadEveryFrame->GetValue()) g_settings->frame_buffer |= fb_ref; - else g_settings->frame_buffer &= ~fb_ref; - if (cbxFBasTex->GetValue()) g_settings->frame_buffer |= fb_read_back_to_screen; - else g_settings->frame_buffer &= ~fb_read_back_to_screen; - if (cbxDetect->GetValue()) g_settings->frame_buffer |= fb_cpu_write_hack; - else g_settings->frame_buffer &= ~fb_cpu_write_hack; - if (cbxFBGetFBI->GetValue()) g_settings->frame_buffer |= fb_get_info; - else g_settings->frame_buffer &= ~fb_get_info; - if (cbxFBDepthBuffer->GetValue()) g_settings->frame_buffer |= fb_depth_render; - else g_settings->frame_buffer &= ~fb_depth_render; - is_advanced_changed = memcmp(&oldsettings, g_settings, sizeof(CSettings)); - } - - g_settings->res_data = cmbResolution->GetSelection(); - g_settings->res_data_org = g_settings->res_data; - g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0]; - g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; - g_settings->vsync = (int)cbxVSync->GetValue(); - g_settings->ssformat = cmbScreenShotFormat->GetSelection(); - g_settings->show_fps = - (cbxFPS->GetValue() ? 1 : 0) | - (cbxVIS->GetValue() ? 2 : 0) | - (cbxPercent->GetValue() ? 4 : 0) | - (cbxTextTransparent->GetValue() ? 8 : 0); - g_settings->clock = (int)cbxClockEnabled->GetValue(); - g_settings->clock_24_hr = (int)cbxClock24->GetValue(); - - g_settings->wrpResolution = cmbFSResolution->GetSelection(); - g_settings->wrpVRAM = cbxVRAM->GetValue() ? 0 : spinVRAM->GetValue(); - g_settings->wrpFBO = cbxFBO->GetValue(); - g_settings->wrpAnisotropic = cbxAnisotropic->GetValue(); - -#ifdef TEXTURE_FILTER - if (g_settings->texenh_options) - { - g_settings->ghq_fltr = cmbEnhFilter->GetSelection(); - g_settings->ghq_enht = cmbEnhEnhancement->GetSelection(); - g_settings->ghq_cache_size = spinEnhCacheSize->GetValue(); - g_settings->ghq_enht_nobg = (int)cbxEnhIgnoreBG->GetValue(); - g_settings->ghq_enht_cmpr = (int)cbxEnhTexCompression->GetValue(); - g_settings->ghq_enht_gz = (int)cbxEnhCompressCache->GetValue(); - g_settings->ghq_hirs = cmbHrsFormat->GetSelection(); - g_settings->ghq_hirs_tile = (int)cbxHrsTile->GetValue(); - g_settings->ghq_hirs_f16bpp = (int)cbxHrsForce16->GetValue(); - g_settings->ghq_hirs_dump = (int)cbxHrsTexEdit->GetValue(); - g_settings->ghq_hirs_altcrc = (int)cbxHrsAltCRC->GetValue(); - g_settings->ghq_hirs_cmpr = (int)cbxHrsTexCompression->GetValue(); - g_settings->ghq_hirs_gz = (int)cbxHrsCompressCache->GetValue(); - g_settings->ghq_hirs_let_texartists_fly = (int)cbxHrsLetFly->GetValue(); - g_settings->ghq_cmpr = (int)cmbTextureCompression->GetSelection(); - g_settings->ghq_cache_save = (int)cbxSaveTexCache->GetValue(); - } -#endif //TEXTURE_FILTER - - g_settings->texenh_options = (int)cbxTextureSettings->GetValue(); - -#ifndef _ENDUSER_RELEASE_ - g_settings->autodetect_ucode = (int)cbxAutoUcode->GetValue(); - g_settings->ucode = cmbForceUcode->GetSelection(); - g_settings->wireframe = (int)cbxWireframe->GetValue(); - g_settings->wfmode = cmbWireframe->GetSelection(); - g_settings->logging = (int)cbxLog->GetValue(); - g_settings->unk_as_red = (int)cbxCombRed->GetValue(); - g_settings->log_clear = (int)cbxLogClear->GetValue(); - g_settings->log_unk = (int)cbxCmbLog->GetValue(); - g_settings->run_in_window = (int)cbxWindowLog->GetValue(); - g_settings->unk_clear = (int)cbxCmbLogClear->GetValue(); - g_settings->elogging = (int)cbxErrLog->GetValue(); - g_settings->filter_cache = (int)cbxBilinearTexCache->GetValue(); -#endif //_ENDUSER_RELEASE_ - - if (memcmp(&oldsettings, g_settings, sizeof(CSettings))) //check that settings were changed - { - if (g_romopen) - { - if (is_advanced_changed) - { - wxMessageDialog dialog(this, _T("Current game emulation settings changed. Save the settings permanently?\nSelect 'No' to use the settings without save."), - _T("Save settings"), wxNO_DEFAULT | wxYES_NO | wxICON_QUESTION); - WriteSettings(dialog.ShowModal() == wxID_YES); - } - else - WriteSettings(false); - } - else - WriteSettings(is_advanced_changed != 0); - } - void ConfigWrapper(); - ConfigWrapper(); -} - -Glide64ConfigDialog::Glide64ConfigDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long /*style*/) : -wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE) -{ - // begin wxGlade: Glide64ConfigDialog::Glide64ConfigDialog - Config = new ConfigNotebook(this, wxID_ANY); - btnOK = new wxButton(this, wxID_OK, wxEmptyString); - btnCancel = new wxButton(this, wxID_CANCEL, wxEmptyString); - - set_properties(); - do_layout(); - // end wxGlade -} - -BEGIN_EVENT_TABLE(Glide64ConfigDialog, wxDialog) -// begin wxGlade: Glide64ConfigDialog::event_table -// EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, Glide64ConfigDialog::onPageChanged) -// EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, Glide64ConfigDialog::onPageChanging) -EVT_BUTTON(wxID_OK, Glide64ConfigDialog::OnOK) -EVT_BUTTON(wxID_CANCEL, Glide64ConfigDialog::OnCancel) -EVT_CLOSE(Glide64ConfigDialog::OnClose) -// end wxGlade -END_EVENT_TABLE(); - -/* -void Glide64ConfigDialog::onPageChanged(wxNotebookEvent &event) -{ -event.Skip(); -wxLogDebug("Event handler (Glide64ConfigDialog::onPageChanged) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void Glide64ConfigDialog::onPageChanging(wxNotebookEvent &event) -{ -event.Skip(); -wxLogDebug("Event handler (Glide64ConfigDialog::onPageChanging) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} -*/ void CloseConfig(); -void Glide64ConfigDialog::OnClose(wxCloseEvent& event) -{ - event.Skip(); - CloseConfig(); - // wxLogDebug("Event handler (MyDialog::OnCancel) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void Glide64ConfigDialog::OnOK(wxCommandEvent &event) -{ - Config->SaveSettings(); - event.Skip(); - CloseConfig(); - // wxLogDebug("Event handler (Glide64ConfigDialog::OnOK) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -void Glide64ConfigDialog::OnCancel(wxCommandEvent &event) -{ - event.Skip(); - CloseConfig(); - // wxLogDebug("Event handler (Glide64ConfigDialog::OnCancel) not implemented yet"); //notify the user that he hasn't implemented the event handler yet -} - -// wxGlade: add Glide64ConfigDialog event handlers - -void Glide64ConfigDialog::set_properties() -{ - // begin wxGlade: Glide64ConfigDialog::set_properties - SetTitle("Glide64 settings"); - // end wxGlade -} - -void Glide64ConfigDialog::do_layout() -{ - // begin wxGlade: Glide64ConfigDialog::do_layout - wxBoxSizer* MainSizer = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* MainSizer2 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* NotebookSizer = new wxBoxSizer(wxVERTICAL); - NotebookSizer->Add(Config, 1, wxEXPAND, 0); - MainSizer->Add(NotebookSizer, 0, wxEXPAND, 0); - MainSizer2->Add(btnOK, 0, 0, 0); - MainSizer2->Add(btnCancel, 0, wxLEFT, 10); - MainSizer->Add(MainSizer2, 0, wxALL | wxALIGN_RIGHT, 5); - SetSizer(MainSizer); - MainSizer->Fit(this); - Layout(); -#ifdef __WINDOWS__ - Centre(); -#endif - // end wxGlade -} - #ifdef TEXTURE_FILTER uint32_t texfltr[] = { @@ -1113,7 +148,729 @@ uint32_t texhirs[] = }; #endif -wxWindow * hostWindow = NULL; +#ifdef _WIN32 + +template < class T, class TT = CToolTipCtrl > +class CToolTipDialog +{ + // Data declarations and members +public: + TT& GetTT(){ return m_TT; } +protected: + TT m_TT; + UINT m_uTTStyle; + UINT m_uToolFlags; + // Construction + CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS) + : m_TT(NULL), m_uTTStyle(uTTSTyle), + m_uToolFlags(uToolFlags | TTF_SUBCLASS) + {} + + void TTInit() + { + T* pT = (T*)this; + ATLASSERT(::IsWindow(*pT)); + m_TT.Create(*pT, NULL, NULL, m_uTTStyle); + CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD)); + m_TT.AddTool(&ToolInfo); + ::EnumChildWindows(*pT, SetTool, (LPARAM)pT); + TTSize(0); + TTActivate(TRUE); + } + // Operations +public: + void TTActivate(BOOL bActivate) + { + m_TT.Activate(bActivate); + } + void TTSize(int nPixel) + { + m_TT.SetMaxTipWidth(nPixel); + } + + void TTSetTxt(HWND hTool, _U_STRINGorID text) + { + m_TT.UpdateTipText(text, hTool); + } + void TTSetTxt(UINT idTool, _U_STRINGorID text) + { + TTSetTxt(GetHWND(idTool), text); + } + + BOOL TTAdd(HWND hTool) + { + return SetTool(hTool, (LPARAM)(T*)this); + } + BOOL TTAdd(UINT idTool) + { + return TTAdd(GetHWND(idTool)); + } + + void TTRemove(HWND hTool) + { + m_TT.DelTool(hTool); + } + void TTRemove(UINT idTool) + { + TTRemove(GetHWND(idTool)); + } + // Message map and handlers + BEGIN_MSG_MAP(CToolTipDialog) + MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouse) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled) + { + TTInit(); + bHandled = FALSE; + return TRUE; + } + + LRESULT OnMouse(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = (T*)this; + bHandled = FALSE; + if (m_TT.IsWindow()) + m_TT.RelayEvent((LPMSG)pT->GetCurrentMessage()); + return 0; + } + // Implementation +private: + HWND GetHWND(UINT idTool) + { + return ::GetDlgItem(*(T*)this, idTool); + } + + static BOOL CALLBACK SetTool(HWND hTool, LPARAM pDlg) + { + T* pT = (T*)pDlg; + int idTool = ::GetWindowLong(hTool, GWL_ID); + if (idTool != IDC_STATIC) + { + CToolInfo ToolInfo(pT->m_uToolFlags, hTool, 0, 0, (LPTSTR)idTool); + pT->m_TT.AddTool(&ToolInfo); + } + return TRUE; + } +}; + +void SetComboBoxIndex(CComboBox & cmb, uint32_t data) +{ + cmb.SetCurSel(0); + for (DWORD i = 0, n = cmb.GetCount(); i < n; i++) + { + if (cmb.GetItemData(i) == data) + { + cmb.SetCurSel(i); + break; + } + } +} + +class CConfigBasicPage; +class CConfigEmuSettings; +class CConfigTextureEnhancement; + +class COptionsSheet : public CPropertySheetImpl < COptionsSheet > +{ +public: + // Construction + COptionsSheet(_U_STRINGorID /*title*/ = (LPCTSTR)NULL, UINT /*uStartPage*/ = 0, HWND /*hWndParent*/ = NULL); + ~COptionsSheet(); + + void UpdateTextureSettings(void); + + // Maps + BEGIN_MSG_MAP(COptionsSheet) + CHAIN_MSG_MAP(CPropertySheetImpl) + END_MSG_MAP() + +private: + // Property pages + CConfigBasicPage * m_pgBasicPage; + CConfigEmuSettings * m_pgEmuSettings; + CConfigTextureEnhancement * m_pgTextureEnhancement; + HPROPSHEETPAGE m_hTextureEnhancement; +}; + +class CConfigBasicPage : + public CPropertyPageImpl, + public CToolTipDialog < CConfigBasicPage > +{ +public: + enum { IDD = IDD_CONFIG_BASIC }; + + CConfigBasicPage(COptionsSheet * options_page) : + m_options_page(options_page) + { + } + + BEGIN_MSG_MAP(CConfigBasicPage) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_HANDLER_EX(IDC_CMB_WINDOW_RES, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CMB_FS_RESOLUTION, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_VERTICAL_SYNC, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_FPS_COUNTER, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_VIS_COUNTER, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_PERCENT_COUNTER, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_CLOCK_ENABLED, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_CLOCK_24, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_TRANSPARENT, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CBXANISOTROPIC, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_AUTODETECT_VRAM, BN_CLICKED, ItemChanged) + CHAIN_MSG_MAP(CToolTipDialog) + CHAIN_MSG_MAP(CPropertyPageImpl) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + TTInit(); + m_WindowRes.Attach(GetDlgItem(IDC_CMB_WINDOW_RES)); + m_WindowRes.SetItemData(m_WindowRes.AddString("320x200"), 0); + m_WindowRes.SetItemData(m_WindowRes.AddString("320x240"), 1); + m_WindowRes.SetItemData(m_WindowRes.AddString("400x256"), 2); + m_WindowRes.SetItemData(m_WindowRes.AddString("512x384"), 3); + m_WindowRes.SetItemData(m_WindowRes.AddString("640x200"), 4); + m_WindowRes.SetItemData(m_WindowRes.AddString("640x350"), 5); + m_WindowRes.SetItemData(m_WindowRes.AddString("640x400"), 6); + m_WindowRes.SetItemData(m_WindowRes.AddString("640x480"), 7); + m_WindowRes.SetItemData(m_WindowRes.AddString("800x600"), 8); + m_WindowRes.SetItemData(m_WindowRes.AddString("960x720"), 9); + m_WindowRes.SetItemData(m_WindowRes.AddString("856x480"), 10); + m_WindowRes.SetItemData(m_WindowRes.AddString("512x256"), 11); + m_WindowRes.SetItemData(m_WindowRes.AddString("1024x768"), 12); + m_WindowRes.SetItemData(m_WindowRes.AddString("1280x1024"), 13); + m_WindowRes.SetItemData(m_WindowRes.AddString("1600x1200"), 14); + m_WindowRes.SetItemData(m_WindowRes.AddString("400x300"), 15); + m_WindowRes.SetItemData(m_WindowRes.AddString("1152x864"), 16); + m_WindowRes.SetItemData(m_WindowRes.AddString("1280x960"), 17); + m_WindowRes.SetItemData(m_WindowRes.AddString("1600x1024"), 18); + m_WindowRes.SetItemData(m_WindowRes.AddString("1792x1344"), 19); + m_WindowRes.SetItemData(m_WindowRes.AddString("1856x1392"), 20); + m_WindowRes.SetItemData(m_WindowRes.AddString("1920x1440"), 21); + m_WindowRes.SetItemData(m_WindowRes.AddString("2048x1536"), 22); + m_WindowRes.SetItemData(m_WindowRes.AddString("2048x2048"), 23); + SetComboBoxIndex(m_WindowRes, g_settings->res_data); + TTSetTxt(IDC_CMB_WINDOW_RES, "Resolution\nThis option selects the windowed resolution\n.\n[Recommended: 640x480, 800x600, 1024x768]"); + + m_cbxVSync.Attach(GetDlgItem(IDC_CHK_VERTICAL_SYNC)); + m_cbxVSync.SetCheck(g_settings->vsync ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".\n"); + + m_cmbScreenShotFormat.Attach(GetDlgItem(IDC_CMB_SCREEN_SHOT_FORMAT)); + for (int f = 0; f < NumOfFormats; f++) + { + m_cmbScreenShotFormat.SetItemData(m_cmbScreenShotFormat.AddString(ScreenShotFormats[f].format), ScreenShotFormats[f].type); + } + SetComboBoxIndex(m_cmbScreenShotFormat, g_settings->ssformat); + TTSetTxt(IDC_CMB_SCREEN_SHOT_FORMAT, "Select a format, in which screen shots will be saved"); + + m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT)); + m_cbxTextureSettings.SetCheck(g_settings->texenh_options ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFPS.Attach(GetDlgItem(IDC_CHK_FPS_COUNTER)); + m_cbxFPS.SetCheck((g_settings->show_fps & 1) > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_FPS_COUNTER, "FPS counter\nWhen this option is checked, a FPS (frames per second) counter will be shown\nin the lower left corner of the screen.\n[Recommended: your preference]"); + + m_cbxVIS.Attach(GetDlgItem(IDC_CHK_VIS_COUNTER)); + m_cbxVIS.SetCheck((g_settings->show_fps & 2) > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_VIS_COUNTER, "VI/s counter\nWhen this option is checked, a VI/s (vertical interrupts per second) counter\nwill be shown in the lower left corner of the screen. This is like the FPS\ncounter but will be consistent at 60 VI/s for full speed on NTSC (U) games and\n50 VI/s for full speed on PAL (E) ones.\n[Recommended: your preference]"); + + m_cbxPercent.Attach(GetDlgItem(IDC_CHK_PERCENT_COUNTER)); + m_cbxPercent.SetCheck((g_settings->show_fps & 4) > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_PERCENT_COUNTER, "% speed\nThis displays a percentage of the actual N64 speed in the lower\nleft corner of the screen.\n[Recommended: your preference]"); + + m_cbxTextTransparent.Attach(GetDlgItem(IDC_CHK_TRANSPARENT)); + m_cbxTextTransparent.SetCheck((g_settings->show_fps & 8) > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_TRANSPARENT, "Transparent text background\nIf this is checked, all on-screen messages will have a transparent background. Otherwise, it will have a solid black background.\n[Recommended: your preference]"); + + m_cbxClockEnabled.Attach(GetDlgItem(IDC_CHK_CLOCK_ENABLED)); + m_cbxClockEnabled.SetCheck(g_settings->clock > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_CLOCK_ENABLED, "Clock enabled\nThis option will put a clock in the lower right corner of the screen, showing the current time.\n[Recommended: your preference]"); + + m_cbxClock24.Attach(GetDlgItem(IDC_CHK_CLOCK_24)); + m_cbxClock24.SetCheck(g_settings->clock_24_hr > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CHK_CLOCK_24, "Display hours as 24-hour clock.\n[Recommended: your preference]"); + + m_cmbFSResolution.Attach(GetDlgItem(IDC_CMB_FS_RESOLUTION)); + int32_t size = 0; + char ** aRes = grQueryResolutionsExt(&size); + if (aRes && size) + { + for (int r = 0; r < size; r++) + { + m_cmbFSResolution.AddString(aRes[r]); + } + m_cmbFSResolution.SetCurSel(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0); + } + TTSetTxt(IDC_CMB_FS_RESOLUTION, "Full screen resolution : \nThis sets the full screen resolution.\nAll the resolutions that your video card / monitor support should be displayed.\n[Recommended:native(max) resolution of your monitor - unless performance becomes an issue]"); + + m_cbxAnisotropic.Attach(GetDlgItem(IDC_CBXANISOTROPIC)); + m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic > 0 ? BST_CHECKED : BST_UNCHECKED); + TTSetTxt(IDC_CBXANISOTROPIC, "Anisotropic filtering:\nThis filter sharpens and brings out the details of textures that recede into the distance.\nWhen activated, it will use the max anisotropy your video card supports.\nHowever, this will override native way of texture filtering and may cause visual artifacts in some games.\n[Recommended: your preference, game dependant]"); + + m_cbxFBO.Attach(GetDlgItem(IDC_CHK_USE_FRAME_BUFFER_OBJECT)); + TTSetTxt(IDC_CHK_USE_FRAME_BUFFER_OBJECT, "Use frame buffer objects:\nChanges the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension.\nThe choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on.\nAlso, some FB effects works only with one of the methods, no matter, which card you have.\nOn the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2).\nHowever, with FBO on with some systems, it can actually be a bit faster in cases.\n[Recommended: video card and game dependant]"); + m_cbxFBO.SetCheck(g_settings->wrpFBO > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxVRAM.Attach(GetDlgItem(IDC_CHK_AUTODETECT_VRAM)); + TTSetTxt(IDC_CHK_AUTODETECT_VRAM, "Autodetect VRAM Size:\nSince OpenGL cannot do this reliably at the moment, the option to set this manually is available.\nIf checked, plugin will try to autodetect VRAM size.\nBut if this appears wrong, please uncheck and set it to correct value.\n[Recommended: on]"); + m_VramSize.Attach(GetDlgItem(IDC_SPIN_VRAM_SIZE)); + m_VramSize.SetBuddy(GetDlgItem(IDC_TXT_VRAM_SIZE)); + m_spinVRAM.Attach(GetDlgItem(IDC_TXT_VRAM_SIZE)); + m_cbxVRAM.SetCheck(g_settings->wrpVRAM == 0 ? BST_CHECKED : BST_UNCHECKED); + m_lblMb.Attach(GetDlgItem(IDC_LBL_MB)); + AutoDetectChanged(); + return TRUE; + } + + bool OnApply() + { + char spinVRAM[100]; + m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM)); + CSettings oldsettings = *g_settings; + g_settings->res_data = m_WindowRes.GetCurSel(); + g_settings->res_data_org = g_settings->res_data; + g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0]; + g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; + g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED; + g_settings->ssformat = m_cmbScreenShotFormat.GetCurSel(); + g_settings->show_fps = + (m_cbxFPS.GetCheck() == BST_CHECKED ? 1 : 0) | + (m_cbxVIS.GetCheck() == BST_CHECKED ? 2 : 0) | + (m_cbxPercent.GetCheck() == BST_CHECKED ? 4 : 0) | + (m_cbxTextTransparent.GetCheck() == BST_CHECKED ? 8 : 0); + g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED; + g_settings->clock = m_cbxClockEnabled.GetCheck() == BST_CHECKED; + g_settings->clock_24_hr = m_cbxClock24.GetCheck() == BST_CHECKED; + g_settings->wrpResolution = m_cmbFSResolution.GetCurSel(); + g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; + g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM); + + if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed + { + WriteSettings(); + } + m_options_page->UpdateTextureSettings(); + return true; + } +private: + void ItemChanged(UINT /*Code*/, int id, HWND /*ctl*/) + { + SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); + if (id == IDC_CHK_AUTODETECT_VRAM) + { + AutoDetectChanged(); + } + } + + void AutoDetectChanged(void) + { + m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM ? g_settings->wrpVRAM : 32).c_str()); + m_spinVRAM.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); + m_VramSize.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); + m_lblMb.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); + } + + COptionsSheet * m_options_page; + CComboBox m_WindowRes, m_cmbFSResolution; + CComboBox m_cmbScreenShotFormat; + CButton m_cbxVSync; + CButton m_cbxTextureSettings; + CButton m_cbxFPS, m_cbxVIS, m_cbxPercent, m_cbxTextTransparent; + CButton m_cbxClockEnabled, m_cbxClock24; + CButton m_cbxAnisotropic; + CButton m_cbxFBO; + CButton m_cbxVRAM; + CUpDownCtrl m_VramSize; + CEdit m_spinVRAM; + CStatic m_lblMb; +}; + +class CConfigEmuSettings : + public CPropertyPageImpl, + public CToolTipDialog < CConfigEmuSettings > +{ +public: + enum { IDD = IDD_EMULATION_SETTINGS }; + + BEGIN_MSG_MAP(CConfigEmuSettings) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_HANDLER_EX(IDC_CMB_FILTERING_MODE, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CMB_BUFFER_SWAPPING, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CMB_LOD_CALC, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CMB_ASPECT_RATIO, CBN_SELCHANGE, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_FOG, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_BUFFER_CLEAR, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_FRAME_BUFFER_EMULATION, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_HARDWARE_FRAMEBUFFER, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_GET_FRAMEBUFFER, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_READ_EVERY_FRAME, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_RENDER_FRAME_AS_TEXTURE, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_CHK_DETECT_CPU_WRITE, BN_CLICKED, ItemChanged) + COMMAND_HANDLER_EX(IDC_SOFTWARE_DEPTH_BUFFER, BN_CLICKED, ItemChanged) + CHAIN_MSG_MAP(CToolTipDialog) + CHAIN_MSG_MAP(CPropertyPageImpl) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + TTInit(); + + if (g_romopen) + { + ::SetWindowText(GetDlgItem(IDC_INFO), "Current game emulation settings. Change with care!"); + } + else + { + ::SetWindowText(GetDlgItem(IDC_INFO), "Default emulation settings. Not recommended to change!"); + } + + std::string tooltip = "Filtering mode\nThere are three filtering modes possible:\n* Automatic filtering - filter exactly how the N64 specifies.\n* Point-sampled filtering - causes texels to appear square and sharp.\n* Bilinear filtering - interpolates the texture to make it appear more smooth.\n[Recommended: Automatic]"; + TTSetTxt(IDC_TXT_FILTERING_MODE, tooltip.c_str()); + TTSetTxt(IDC_CMB_FILTERING_MODE, tooltip.c_str()); + + m_cmbFiltering.Attach(GetDlgItem(IDC_CMB_FILTERING_MODE)); + m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Automatic"), 0); + m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Bilinear"), 1); + m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Point-sampled"), 2); + SetComboBoxIndex(m_cmbFiltering, g_settings->filtering); + + tooltip = "Buffer swapping method\nThere are 3 buffer swapping methods:\n* old - swap buffers when vertical interrupt has occurred.\n* new - swap buffers when set of conditions is satisfied. Prevents flicker on some games.\n* hybrid - mix of first two methods.\nCan prevent even more flickering then previous method, but also can cause artefacts.\nIf you have flickering problems in a game (or graphics that don't show),\ntry to change swapping method.\n[Recommended: new (hybrid for Paper Mario)]"; + TTSetTxt(IDC_TXT_BUFFER_SWAPPING, tooltip.c_str()); + TTSetTxt(IDC_CMB_BUFFER_SWAPPING, tooltip.c_str()); + m_cmbBufferSwap.Attach(GetDlgItem(IDC_CMB_BUFFER_SWAPPING)); + m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Old"), 0); + m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("New"), 1); + m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Hybrid"), 2); + SetComboBoxIndex(m_cmbBufferSwap, g_settings->swapmode); + + tooltip = "Per-pixel level-of-detail calculation\nN64 uses special mechanism for mip-mapping, which nearly impossible to reproduce\ncorrectly on PC hardware. This option enables approximate emulation of this feature.\nFor example, it is required for the Peach/Bowser portrait's transition in Super Mario 64.\nThere are 3 modes:\n* off - LOD is not calculated\n* fast - fast imprecise LOD calculation.\n* precise - most precise LOD calculation possible, but more slow.\n[Recommended: your preference]"; + TTSetTxt(IDC_TXT_LOD_CALC, tooltip.c_str()); + TTSetTxt(IDC_CMB_LOD_CALC, tooltip.c_str()); + m_cmbLOD.Attach(GetDlgItem(IDC_CMB_LOD_CALC)); + m_cmbLOD.SetItemData(m_cmbLOD.AddString("off"), 0); + m_cmbLOD.SetItemData(m_cmbLOD.AddString("fast"), 1); + m_cmbLOD.SetItemData(m_cmbLOD.AddString("precise"), 2); + SetComboBoxIndex(m_cmbLOD, g_settings->lodmode); + + tooltip = "Aspect ratio of the output.\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game g_settings->\nIn \"Stretch\" mode the output will be stretched to the entire screen,\nother modes may add black borders if necessary"; + TTSetTxt(IDC_TXT_ASPECT_RATIO, tooltip.c_str()); + TTSetTxt(IDC_CMB_ASPECT_RATIO, tooltip.c_str()); + + m_cmbAspect.Attach(GetDlgItem(IDC_CMB_ASPECT_RATIO)); + m_cmbAspect.SetItemData(m_cmbAspect.AddString("4:3 (default)"), 0); + m_cmbAspect.SetItemData(m_cmbAspect.AddString("Force 16:9"), 1); + m_cmbAspect.SetItemData(m_cmbAspect.AddString("Stretch"), 2); + m_cmbAspect.SetItemData(m_cmbAspect.AddString("Original"), 3); + SetComboBoxIndex(m_cmbAspect, g_settings->aspectmode); + + tooltip = "Fog enabled\nSets fog emulation on//off.\n[Recommended: on]"; + TTSetTxt(IDC_CHK_FOG, tooltip.c_str()); + m_cbxFog.Attach(GetDlgItem(IDC_CHK_FOG)); + m_cbxFog.SetCheck(g_settings->fog > 0 ? BST_CHECKED : BST_UNCHECKED); + + tooltip = "Buffer clear on every frame\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated,\nand some garbage may be left on the screen.\nIn such cases, this option must be set on.\n[Recommended: on]"; + TTSetTxt(IDC_CHK_BUFFER_CLEAR, tooltip.c_str()); + m_cbxBuffer.Attach(GetDlgItem(IDC_CHK_BUFFER_CLEAR)); + m_cbxBuffer.SetCheck(g_settings->buff_clear > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBEnable.Attach(GetDlgItem(IDC_CHK_FRAME_BUFFER_EMULATION)); + TTSetTxt(IDC_CHK_FRAME_BUFFER_EMULATION, "Enable frame buffer emulation\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n[Recommended: on for games which use frame buffer effects]"); + m_cbxFBEnable.SetCheck((g_settings->frame_buffer&fb_emulation) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBHWFBE.Attach(GetDlgItem(IDC_CHK_HARDWARE_FRAMEBUFFER)); + TTSetTxt(IDC_CHK_HARDWARE_FRAMEBUFFER, "Enable hardware frame buffer emulation\nIf this option is on, plugin will create auxiliary frame buffers in video memory instead of copying\nframe buffer content into main memory. This allows plugin to run frame buffer effects without slowdown\nand without scaling image down to N64's native resolution. This feature is fully supported by\nVoodoo 4/5 cards and partially by Voodoo3 and Banshee. Modern cards also fully support it.\n[Recommended: on, if supported by your hardware]"); + m_cbxFBHWFBE.SetCheck((g_settings->frame_buffer&fb_hwfbe) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBGetFBI.Attach(GetDlgItem(IDC_CHK_GET_FRAMEBUFFER)); + TTSetTxt(IDC_CHK_GET_FRAMEBUFFER, "Get information about frame buffers\nThis is compatibility option. It must be set on for Mupen64 and off for 1964"); + m_cbxFBGetFBI.SetCheck((g_settings->frame_buffer&fb_get_info) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBReadEveryFrame.Attach(GetDlgItem(IDC_CHK_READ_EVERY_FRAME)); + TTSetTxt(IDC_CHK_READ_EVERY_FRAME, "Read every frame\nIn some games plugin can't detect frame buffer usage.\nIn such cases you need to enable this option to see frame buffer effects.\nEvery drawn frame will be read from video card -> it works very slow.\n[Recommended: mostly off (needed only for a few games)]"); + m_cbxFBReadEveryFrame.SetCheck((g_settings->frame_buffer&fb_ref) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBasTex.Attach(GetDlgItem(IDC_RENDER_FRAME_AS_TEXTURE)); + TTSetTxt(IDC_RENDER_FRAME_AS_TEXTURE, "Render N64 frame buffer as texture\nWhen this option is enabled, content of each N64 frame buffer is rendered\nas texture over the frame, rendered by the plugin. This prevents graphics lost,\nbut may cause slowdowns and various glitches in some games.\n[Recommended: mostly off]"); + m_cbxFBasTex.SetCheck((g_settings->frame_buffer&fb_read_back_to_screen) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxDetect.Attach(GetDlgItem(IDC_CHK_DETECT_CPU_WRITE)); + TTSetTxt(IDC_CHK_DETECT_CPU_WRITE, "Detect CPU write to the N64 frame buffer\nThis option works as the previous options, but the plugin is trying to detect,\nwhen game uses CPU writes to N64 frame buffer. The N64 frame buffer is rendered\nonly when CPU writes is detected. Use this option for those games, in which you\nsee still image or no image at all for some time with no reason.\n[Recommended: mostly off]"); + m_cbxDetect.SetCheck((g_settings->frame_buffer&fb_cpu_write_hack) > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxFBDepthBuffer.Attach(GetDlgItem(IDC_SOFTWARE_DEPTH_BUFFER)); + TTSetTxt(IDC_SOFTWARE_DEPTH_BUFFER, "Enable depth buffer rendering\nThis option is used to fully emulate N64 depth buffer.\nIt is required for correct emulation of depth buffer based effects.\nHowever, it requires fast (>1GHz) CPU to work full speed.\n[Recommended: on for fast PC]"); + m_cbxFBDepthBuffer.SetCheck((g_settings->frame_buffer&fb_depth_render) > 0 ? BST_CHECKED : BST_UNCHECKED); + return TRUE; + } + + bool OnApply() + { + CSettings oldsettings = *g_settings; + + g_settings->filtering = m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel()); + g_settings->aspectmode = m_cmbAspect.GetItemData(m_cmbFiltering.GetCurSel()); + g_settings->swapmode = m_cmbBufferSwap.GetItemData(m_cmbFiltering.GetCurSel()); + g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED; + g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED; + g_settings->lodmode = m_cmbLOD.GetItemData(m_cmbFiltering.GetCurSel()); + + if (m_cbxFBEnable.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_emulation; + else g_settings->frame_buffer &= ~fb_emulation; + if (m_cbxFBHWFBE.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_hwfbe; + else g_settings->frame_buffer &= ~fb_hwfbe; + if (m_cbxFBReadEveryFrame.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_ref; + else g_settings->frame_buffer &= ~fb_ref; + if (m_cbxFBasTex.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_read_back_to_screen; + else g_settings->frame_buffer &= ~fb_read_back_to_screen; + if (m_cbxDetect.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_cpu_write_hack; + else g_settings->frame_buffer &= ~fb_cpu_write_hack; + if (m_cbxFBGetFBI.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_get_info; + else g_settings->frame_buffer &= ~fb_get_info; + if (m_cbxFBDepthBuffer.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_depth_render; + else g_settings->frame_buffer &= ~fb_depth_render; + if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed + { + WriteSettings(); + } + return true; + } +private: + void ItemChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) + { + SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); + } + + CComboBox m_cmbFiltering; + CComboBox m_cmbBufferSwap; + CComboBox m_cmbLOD; + CComboBox m_cmbAspect; + CButton m_cbxFog; + CButton m_cbxBuffer; + CButton m_cbxFBEnable; + CButton m_cbxFBHWFBE; + CButton m_cbxFBGetFBI; + CButton m_cbxFBReadEveryFrame; + CButton m_cbxFBasTex; + CButton m_cbxDetect; + CButton m_cbxFBDepthBuffer; +}; + +class CConfigTextureEnhancement : + public CPropertyPageImpl, + public CToolTipDialog < CConfigTextureEnhancement > +{ +public: + enum { IDD = IDD_TEXTURE_ENHANCEMENT }; + + BEGIN_MSG_MAP(CConfigTextureEnhancement) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(CToolTipDialog) + CHAIN_MSG_MAP(CPropertyPageImpl) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + TTInit(); + + std::string tooltip = "Filters:\nApply a filter to either smooth or sharpen textures.\nThere are 4 different smoothing filters and 2 different sharpening filters.\nThe higher the number, the stronger the effect,\ni.e. \"Smoothing filter 4\" will have a much more noticeable effect than \"Smoothing filter 1\".\nBe aware that performance may have an impact depending on the game and/or the PC.\n[Recommended: your preference]"; + TTSetTxt(IDC_TXT_ENH_FILTER, tooltip.c_str()); + TTSetTxt(IDC_CMB_ENH_FILTER, tooltip.c_str()); + m_cmbEnhFilter.Attach(GetDlgItem(IDC_CMB_ENH_FILTER)); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("None"), 0); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 1"), 1); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 2"), 2); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 3"), 3); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 4"), 4); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 1"), 5); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 2"), 6); + SetComboBoxIndex(m_cmbEnhFilter, g_settings->ghq_fltr); + + tooltip = "Texture enhancement:\n7 different filters are selectable here, each one with a distinctive look.\nBe aware of possible performance impacts.\n\nIMPORTANT: 'Store' mode - saves textures in cache 'as is'. It can improve performance in games, which load many textures.\nDisable 'Ignore backgrounds' option for better result.\n\n[Recommended: your preference]"; + TTSetTxt(IDC_TXT_ENHANCEMENT, tooltip.c_str()); + TTSetTxt(IDC_CMB_ENHANCEMENT, tooltip.c_str()); + m_cmbEnhEnhancement.Attach(GetDlgItem(IDC_CMB_ENHANCEMENT)); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("None"), 0); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("Store"), 1); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2"), 2); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2SAI"), 3); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2X"), 4); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2XS"), 5); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2X"), 6); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2XS"), 7); + m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ4X"), 8); + SetComboBoxIndex(m_cmbEnhEnhancement, g_settings->ghq_enht); + + tooltip = "Hi-res pack format:\nChoose which method is to be used for loading Hi-res texture packs.\nOnly Rice's format is available currently.\nLeave on \"None\" if you will not be needing to load hi-res packs.\n[Recommended: Rice's format. Default: \"None\"]"; + TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str()); + TTSetTxt(IDC_CMB_FORMAT_CHOICES, tooltip.c_str()); + m_cmbHrsFormat.Attach(GetDlgItem(IDC_CMB_FORMAT_CHOICES)); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), 0); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), 1); + SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs); + + m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD)); + m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0); + m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), 1); + SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr); + + tooltip = "Texture cache size:\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures,\nso setting 256+ megs can boost performance. Adjust accordingly if you are encountering speed issues.\n'0' disables cache.\n[Recommended: PC and game dependant]"; + TTSetTxt(IDC_TXT_TEXTURE_CACHE, tooltip.c_str()); + TTSetTxt(IDC_SPIN_TEXTURE_CACHE, tooltip.c_str()); + TTSetTxt(IDC_TEXT_MB, tooltip.c_str()); + m_textTexCache.Attach(GetDlgItem(IDC_TXT_TEXTURE_CACHE)); + m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size).c_str()); + m_spinEnhCacheSize.Attach(GetDlgItem(IDC_SPIN_TEXTURE_CACHE)); + m_spinEnhCacheSize.SetBuddy(m_textTexCache); + + TTSetTxt(IDC_CHK_IGNORE_BACKGROUND, "Ignore Backgrounds:\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n[Recommended: on (off for 'Store' mode)]"); + m_cbxEnhIgnoreBG.Attach(GetDlgItem(IDC_CHK_IGNORE_BACKGROUND)); + m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg > 0 ? BST_CHECKED : BST_UNCHECKED); + + tooltip = "Texture compression:\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache,\nthe space occupied on the GFX hardware's texture RAM,\nby the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage,\ndecreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n[Recommended: off]"; + TTSetTxt(IDC_CHK_TEX_COMPRESSION, tooltip.c_str()); + TTSetTxt(IDC_CHK_HIRES_TEX_COMPRESSION, tooltip.c_str()); + + m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION)); + m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION)); + m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); + + TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture,\nbut 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]"); + m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE)); + m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxHrsTile.Attach(GetDlgItem(IDC_CHK_TILE_TEX)); + TTSetTxt(IDC_CHK_TILE_TEX, "Tile textures:\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet\n- various issues are possible, including black lines and polygons distortions.\n[Recommended: off]"); + m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxHrsForce16.Attach(GetDlgItem(IDC_CHK_FORCE_16BPP_TEXT)); + TTSetTxt(IDC_CHK_FORCE_16BPP_TEXT, "Force 16bpp textures:\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n[Recommended: off]"); + m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT)); + TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys: \"R\" reloads hires textures from the texture pack - \"D\" toggles texture dumps on/off."); + m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxHrsAltCRC.Attach(GetDlgItem(IDC_CHK_ALT_CRC)); + TTSetTxt(IDC_CHK_ALT_CRC, "Alternative CRC calculation:\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n[Recommended: texture pack dependant, mostly on]"); + m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc > 0 ? BST_CHECKED : BST_UNCHECKED); + if (g_settings->ghq_hirs_dump) + { + m_cbxHrsAltCRC.EnableWindow(false); + } + + m_cbxHrsCompressCache.Attach(GetDlgItem(IDC_CHK_HRS_COMPRESS_CACHE)); + TTSetTxt(IDC_CHK_HRS_COMPRESS_CACHE, "Compress texture cache:\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]"); + m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxHrsLetFly.Attach(GetDlgItem(IDC_CHK_USE_ALPHA_FULLY)); + TTSetTxt(IDC_CHK_USE_ALPHA_FULLY, "Use Alpha channel fully:\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style\n- with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture,\nand select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need,\nregardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n[Recommended: texture pack dependant]"); + m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly > 0 ? BST_CHECKED : BST_UNCHECKED); + + m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD)); + TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch,\nas opposed to the 5 -60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Plugins folder.\n\n[Highly Recommended: on]"); + m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save > 0 ? BST_CHECKED : BST_UNCHECKED); + return TRUE; + } + + bool OnApply() + { + char texcache[100]; + m_textTexCache.GetWindowText(texcache, sizeof(texcache)); + + CSettings oldsettings = *g_settings; + g_settings->ghq_fltr = m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel()); + g_settings->ghq_enht = m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel()); + g_settings->ghq_cache_size = atoi(texcache); + g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; + g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED; + g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs = m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel()); + g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED; + g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; + g_settings->ghq_cmpr = (int)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel()); + g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED; + if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed + { + WriteSettings(); + } + return true; + } +private: + void ItemChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) + { + SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); + } + + CComboBox m_cmbEnhFilter; + CComboBox m_cmbEnhEnhancement; + CComboBox m_cmbHrsFormat; + CComboBox m_cmbTextureCompression; + CButton m_cbxEnhIgnoreBG; + CButton m_cbxEnhTexCompression; + CButton m_cbxHrsTexCompression; + CButton m_cbxEnhCompressCache; + CButton m_cbxHrsTile; + CButton m_cbxHrsForce16; + CButton m_cbxHrsTexEdit; + CButton m_cbxHrsAltCRC; + CButton m_cbxHrsCompressCache; + CButton m_cbxHrsLetFly; + CButton m_cbxSaveTexCache; + CEdit m_textTexCache; + CUpDownCtrl m_spinEnhCacheSize; +}; + +COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND /*hWndParent*/) : + m_pgBasicPage(new CConfigBasicPage(this)), + m_pgEmuSettings(new CConfigEmuSettings), + m_pgTextureEnhancement(NULL), + m_hTextureEnhancement(0) +{ + AddPage(&m_pgBasicPage->m_psp); + if (g_settings->advanced_options) + { + AddPage(&m_pgEmuSettings->m_psp); + } + UpdateTextureSettings(); +} + +COptionsSheet::~COptionsSheet() +{ + delete m_pgBasicPage; + delete m_pgEmuSettings; + delete m_pgTextureEnhancement; +} + +void COptionsSheet::UpdateTextureSettings(void) +{ + if (g_settings->texenh_options) + { + if (m_hTextureEnhancement == NULL) + { + m_pgTextureEnhancement = new CConfigTextureEnhancement; + m_hTextureEnhancement = m_pgTextureEnhancement->Create(); + } + AddPage(m_hTextureEnhancement); + } + else if (m_hTextureEnhancement != NULL) + { + RemovePage(m_hTextureEnhancement); + m_hTextureEnhancement = NULL; + delete m_pgTextureEnhancement; + m_pgTextureEnhancement = NULL; + } +} +#endif /****************************************************************** Function: DllConfig @@ -1131,7 +888,6 @@ void CALL DllConfig(HWND hParent) if (g_romopen) { - // ReadSpecialSettings ((char*)rdp.RomName.c_str()); if (evoodoo)// && fullscreen && !ev_fullscreen) { ReleaseGfx(); @@ -1151,19 +907,8 @@ void CALL DllConfig(HWND hParent) ReadSpecialSettings(name); } -#ifdef __WINDOWS__ - if (hostWindow == NULL) - hostWindow = new wxWindow(); - WXHWND hwnd = hParent; - hostWindow->SetHWND(hwnd); - // hostWindow->SubclassWin(hwnd); - hostWindow->Disable(); -#endif - - Glide64ConfigDialog* Glide64Config = new Glide64ConfigDialog(hostWindow, wxID_ANY, wxEmptyString); - Glide64Config->ShowModal(); - delete hostWindow; - hostWindow = NULL; + COptionsSheet("Glide64 settings").DoModal(hParent); + CloseConfig(); #endif } @@ -1179,11 +924,6 @@ void CloseConfig() else rdp_reset(); } -#ifdef __WINDOWS__ - hostWindow->Enable(); - // hostWindow->UnsubclassWin(); - hostWindow->SetHWND(NULL); -#endif } #ifdef _WIN32 @@ -1227,7 +967,6 @@ void CALL DllAbout(HWND /*hParent*/) dlg.DoModal(); #endif } -#endif void general_setting(short setting_ID, const char * name, unsigned int value) { diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 7f02f31bd..7b4b4c45b 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -41,225 +41,19 @@ // Created by Gonetz, 2008 // //**************************************************************** - -// -*- C++ -*- generated by wxGlade 0.6.3 on Wed Oct 08 18:56:23 2008 #pragma once #ifdef _WIN32 void ConfigInit(HINSTANCE hinst); void ConfigCleanup(void); - -#include -#include -// begin wxGlade: ::dependencies -#include -#include -// end wxGlade - -// begin wxGlade: ::extracode -// end wxGlade - -class ConfigNotebook : public wxNotebook { -public: - // begin wxGlade: ConfigNotebook::ids - enum { - wxID_VRAM = wxID_HIGHEST + 1000, - wxID_FBEnable = wxID_HIGHEST + 1002, - wxID_TexEdit = wxID_HIGHEST + 1004, - wxID_Performance = wxID_HIGHEST + 1006, - wxID_Quality = wxID_HIGHEST + 1008, - }; - // end wxGlade - - ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); - -private: - // begin wxGlade: ConfigNotebook::methods - void set_properties(); - void do_layout(); - // end wxGlade - -protected: - // begin wxGlade: ConfigNotebook::attributes - wxStaticBox* BasicRenderingSizer_staticbox; - wxStaticBox* OnScreenDisplaySizer_staticbox; - wxStaticBox* SpeedSizer_staticbox; - wxStaticBox* TimeSizer_staticbox; - wxStaticText* lblResolution; - wxComboBox* cmbResolution; - wxCheckBox* cbxVSync; - wxCheckBox* cbxFPS; - wxCheckBox* cbxVIS; - wxCheckBox* cbxPercent; - wxCheckBox* cbxClockEnabled; - wxCheckBox* cbxClock24; - wxCheckBox* cbxTextTransparent; - wxStaticBox* WrapperSizer_staticbox; - wxStaticBox* WrapperFBOptionsSizer_staticbox; - wxStaticText* lblFSResolution; - wxComboBox* cmbFSResolution; - wxCheckBox* cbxAnisotropic; - wxCheckBox* cbxVRAM; - wxStaticText* lblVRAM; - wxSpinCtrl* spinVRAM; - wxStaticText* lblMb; - wxCheckBox* cbxFBO; - wxStaticBox* OtherSizer_staticbox; - wxCheckBox* cbxTextureSettings; - wxStaticText* lblScreenShotFormat; - wxComboBox* cmbScreenShotFormat; - wxPanel* BasicSettingsPanel; - - wxStaticBox* EmuSettingsBoxSizer_staticbox; - wxStaticBox* EmuSettingsLeftSizer_staticbox; - wxStaticBox* DepthBufferSizer_staticbox; - wxStaticBox* FrameBufferSizer_staticbox; - wxStaticText* lbFiltering; - wxComboBox* cmbFiltering; - wxStaticText* lbBufferSwap; - wxComboBox* cmbBufferSwap; - wxStaticText* lblLOD; - wxComboBox* cmbLOD; - wxStaticText* lblAspect; - wxComboBox* cmbAspect; - wxCheckBox* cbxFog; - wxCheckBox* cbxBuffer; - wxCheckBox* cbxFBEnable; - wxCheckBox* cbxFBHWFBE; - wxCheckBox* cbxFBGetFBI; - wxCheckBox* cbxFBReadEveryFrame; - wxCheckBox* cbxFBasTex; - wxCheckBox* cbxDetect; - wxCheckBox* cbxFBDepthBuffer; - wxPanel* EmuSettingsPanel; - -#ifdef TEXTURE_FILTER - wxStaticBox* PresetsSizer_staticbox; - wxStaticBox* CommonSizer_staticbox; - wxStaticBox* TextureRightSizer_staticbox; - wxStaticBox* EnhTexSizer_staticbox; - wxStaticBox* HRTexPerfTweaksSizer_staticbox; - wxStaticBox* EnhTexPerfTweaksSizer_staticbox; - wxStaticText* lblFilter; - wxComboBox* cmbEnhFilter; - wxStaticText* lblEnhancement; - wxComboBox* cmbEnhEnhancement; - wxStaticText* lblTexCache; - wxSpinCtrl* spinEnhCacheSize; - wxStaticText* lblTexCacheMB; - wxCheckBox* cbxEnhIgnoreBG; - wxCheckBox* cbxEnhTexCompression; - wxCheckBox* cbxEnhCompressCache; - wxStaticText* lblHrsFormat; - wxComboBox* cmbHrsFormat; - wxCheckBox* cbxHrsTile; - wxCheckBox* cbxHrsForce16; - wxCheckBox* cbxHrsAltCRC; - wxCheckBox* cbxHrsTexCompression; - wxCheckBox* cbxHrsCompressCache; - wxCheckBox* cbxHrsLetFly; - wxCheckBox* cbxHrsTexEdit; - wxStaticText* lblTexCompression; - wxComboBox* cmbTextureCompression; - wxCheckBox* cbxSaveTexCache; - wxButton* btnPerformance; - wxButton* btnQuality; - wxPanel* TexturePanel; -#endif //TEXTURE_FILTER - -#ifndef _ENDUSER_RELEASE_ - wxStaticBox* DebugSizer_staticbox; - wxStaticBox* DevSettingsSizer_staticbox; - wxCheckBox* cbxAutoUcode; - wxStaticText* lblForceUcode; - wxComboBox* cmbForceUcode; - wxCheckBox* cbxWireframe; - wxComboBox* cmbWireframe; - wxCheckBox* cbxLog; - wxCheckBox* cbxCombRed; - wxCheckBox* cbxLogClear; - wxCheckBox* cbxCmbLog; - wxCheckBox* cbxWindowLog; - wxCheckBox* cbxCmbLogClear; - wxCheckBox* cbxErrLog; - wxCheckBox* cbxBilinearTexCache; - wxPanel* DebugPanel; -#endif //_ENDUSER_RELEASE_ - - // end wxGlade - - DECLARE_EVENT_TABLE(); - -public: - virtual void OnClickVRAM(wxCommandEvent &event); // wxGlade: - virtual void OnClickFB(wxCommandEvent &event); // wxGlade: -#ifdef TEXTURE_FILTER - virtual void onPerformace(wxCommandEvent &event); // wxGlade: - virtual void onQuality(wxCommandEvent &event); // wxGlade: - virtual void OnClickTexEdit(wxCommandEvent &event); // wxGlade: -#endif //TEXTURE_FILTER - - // virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: - // virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: - void SaveSettings(); -}; // wxGlade: end class - -class Glide64ConfigDialog : public wxDialog { -public: - // begin wxGlade: Glide64ConfigDialog::ids - // end wxGlade - - Glide64ConfigDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - void OnClose(wxCloseEvent& event); - -private: - // begin wxGlade: Glide64ConfigDialog::methods - void set_properties(); - void do_layout(); - // end wxGlade - -protected: - // begin wxGlade: Glide64ConfigDialog::attributes - ConfigNotebook* Config; - wxButton* btnOK; - wxButton* btnCancel; - // end wxGlade - - DECLARE_EVENT_TABLE(); - -public: - // virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: - // virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: - virtual void OnOK(wxCommandEvent &event); // wxGlade: - virtual void OnCancel(wxCommandEvent &event); // wxGlade: -}; // wxGlade: end class - -class AboutDialog : public wxDialog { -public: - // begin wxGlade: AboutDialog::ids - // end wxGlade - - AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - -private: - // begin wxGlade: AboutDialog::methods - void set_properties(); - void do_layout(); - // end wxGlade - -protected: - // begin wxGlade: AboutDialog::attributes - wxButton* button_ok; - // end wxGlade -}; // wxGlade: end class #endif enum { // General Settings Set_CardId, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, - Set_clock_24_hr, Set_texenh_options, Set_hotkeys, Set_wrpVRAM, - Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, + Set_clock_24_hr, Set_Rotate, Set_texenh_options, Set_hotkeys, Set_wrpVRAM, + Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window, Set_filter_cache, Set_unk_as_red, Set_log_unk, Set_unk_clear, Set_ghq_fltr, Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile, diff --git a/Source/Glide64/Glide64.rc b/Source/Glide64/Glide64.rc index a2b500119..e1f522821 100644 --- a/Source/Glide64/Glide64.rc +++ b/Source/Glide64/Glide64.rc @@ -79,6 +79,119 @@ BEGIN LTEXT "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.",IDC_STATIC,7,167,186,8,SS_CENTERIMAGE END +IDD_CONFIG_BASIC DIALOGEX 0, 0, 314, 194 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CAPTION +CAPTION "Basic Settings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Rendering",IDC_STATIC,6,2,161,128 + LTEXT "Windowed Resultion",IDC_STATIC,11,17,67,8 + COMBOBOX IDC_CMB_WINDOW_RES,80,16,84,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Vertical Sync",IDC_CHK_VERTICAL_SYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,30,120,10 + GROUPBOX "OpenGL settings",IDC_STATIC,11,47,153,82 + LTEXT "Full screen resolution:",IDC_STATIC,15,59,45,17 + COMBOBOX IDC_CMB_FS_RESOLUTION,64,61,97,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Anisotropic filtering",IDC_CBXANISOTROPIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,78,143,10 + CONTROL "Autodetect VRAM size",IDC_CHK_AUTODETECT_VRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,91,80,10 + EDITTEXT IDC_TXT_VRAM_SIZE,101,90,28,12,ES_AUTOHSCROLL + CONTROL "",IDC_SPIN_VRAM_SIZE,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,127,89,10,12 + LTEXT "Mb",IDC_LBL_MB,141,91,10,8 + GROUPBOX "Frame buffer emulation",IDC_STATIC,14,103,146,23 + CONTROL "Use frame buffer objects",IDC_CHK_USE_FRAME_BUFFER_OBJECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,113,133,10 + GROUPBOX "On screen display",IDC_STATIC,174,2,135,128 + CONTROL "FPS counter",IDC_CHK_FPS_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,25,54,10 + CONTROL "VI/s counter",IDC_CHK_VIS_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,36,55,10 + CONTROL "% speed",IDC_CHK_PERCENT_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,48,44,10 + GROUPBOX "Speed",IDC_STATIC,179,13,124,49 + GROUPBOX "Time",IDC_STATIC,180,64,124,36 + CONTROL "Clock enabled",IDC_CHK_CLOCK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,75,59,10 + CONTROL "Clock is 24-hour",IDC_CHK_CLOCK_24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,88,52,8 + CONTROL "Transparent text background",IDC_CHK_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,184,103,102,14 + GROUPBOX "Other",IDC_STATIC,7,132,303,36 + CONTROL "Show texture enhancement options",IDC_CHK_SHOW_TEXTURE_ENHANCEMENT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,140,123,11 + LTEXT "Screenshot format:",IDC_STATIC,14,153,65,11 + COMBOBOX IDC_CMB_SCREEN_SHOT_FORMAT,79,151,42,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +END + +IDD_EMULATION_SETTINGS DIALOGEX 0, 0, 311, 177 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Emulation Settings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "Page Info",IDC_INFO,7,7,261,12 + GROUPBOX "General options",IDC_STATIC,7,20,135,123 + LTEXT "Filtering mode:",IDC_TXT_FILTERING_MODE,10,31,52,10,SS_NOTIFY + COMBOBOX IDC_CMB_FILTERING_MODE,66,30,72,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Buffer swapping method:",IDC_TXT_BUFFER_SWAPPING,10,45,82,10,SS_NOTIFY + COMBOBOX IDC_CMB_BUFFER_SWAPPING,98,44,40,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "LOD calculation:",IDC_TXT_LOD_CALC,10,60,82,10,SS_NOTIFY + COMBOBOX IDC_CMB_LOD_CALC,98,59,40,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Aspect ratio:",IDC_TXT_ASPECT_RATIO,10,76,59,10,SS_NOTIFY + COMBOBOX IDC_CMB_ASPECT_RATIO,86,74,52,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Enable frame buffer emulation",IDC_CHK_FRAME_BUFFER_EMULATION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,32,112,10 + CONTROL "Buffer clear on every frame",IDC_CHK_BUFFER_CLEAR, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,102,102,10 + GROUPBOX "Frame buffer emulation",IDC_STATIC,146,20,158,93 + CONTROL "Fog",IDC_CHK_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,90,27,10 + CONTROL "Hardware frame buffer emulation",IDC_CHK_HARDWARE_FRAMEBUFFER, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,45,121,10 + CONTROL "Get frame buffer info",IDC_CHK_GET_FRAMEBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,58,83,10 + CONTROL "Read every frame (slow!)",IDC_CHK_READ_EVERY_FRAME, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,70,95,10 + CONTROL "Render N64 frame buffer as texture",IDC_RENDER_FRAME_AS_TEXTURE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,83,128,10 + CONTROL "Detect CPU write to the N64 frame buffer",IDC_CHK_DETECT_CPU_WRITE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,96,142,10 + GROUPBOX "Depth buffer emulation",IDC_STATIC,146,117,158,26 + CONTROL "Software depth buffer rendering",IDC_SOFTWARE_DEPTH_BUFFER, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,130,142,10 +END + +IDD_TEXTURE_ENHANCEMENT DIALOGEX 0, 0, 311, 194 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Texture enhancement" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Texture enhancement",IDC_STATIC,7,3,138,125 + LTEXT "Filter",IDC_TXT_ENH_FILTER,12,16,18,8,SS_NOTIFY + COMBOBOX IDC_CMB_ENH_FILTER,44,16,91,13,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Enhancement",IDC_TXT_ENHANCEMENT,12,32,45,8,SS_NOTIFY + COMBOBOX IDC_CMB_ENHANCEMENT,62,31,73,13,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Texture cache",IDC_STATIC,11,47,51,8 + EDITTEXT IDC_TXT_TEXTURE_CACHE,62,45,33,12,ES_AUTOHSCROLL + CONTROL "",IDC_SPIN_TEXTURE_CACHE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ARROWKEYS,95,45,10,12 + LTEXT "mb",IDC_TEXT_MB,110,47,11,8 + CONTROL "Compress texture cache",IDC_CHK_COMPRESS_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,61,89,10 + GROUPBOX "Performance tweaks",IDC_STATIC,12,74,128,44 + CONTROL "Apply texture compression",IDC_CHK_TEX_COMPRESSION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,86,109,10 + CONTROL "Ignore Backgrounds",IDC_CHK_IGNORE_BACKGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,99,109,10 + GROUPBOX "Hi-resolution textures",IDC_STATIC,148,2,138,125 + LTEXT "Format",IDC_TXT_FORMAT_CHOICES,151,18,23,8,SS_NOTIFY + COMBOBOX IDC_CMB_FORMAT_CHOICES,180,16,71,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Alternative CRC calculation",IDC_CHK_ALT_CRC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,31,128,10 + CONTROL "Texture dumping/editing mode",IDC_CHK_TEX_DUMP_EDIT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,43,128,10 + CONTROL "Use alpha channel fully",IDC_CHK_USE_ALPHA_FULLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,56,128,10 + CONTROL "Compress texture cache",IDC_CHK_HRS_COMPRESS_CACHE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,69,128,10 + GROUPBOX "Performance tweaks",IDC_STATIC,150,81,128,44 + CONTROL "Apply texture compression",IDC_CHK_HIRES_TEX_COMPRESSION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,92,128,10 + CONTROL "Force 16bpp textures",IDC_CHK_FORCE_16BPP_TEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,103,128,10 + CONTROL "Tile textures",IDC_CHK_TILE_TEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,114,128,10 + GROUPBOX "Common",IDC_STATIC,7,130,297,28 + LTEXT "Texture compression method",IDC_STATIC,13,142,94,8 + COMBOBOX IDC_CMB_TEX_COMPRESS_MEHTOD,110,141,32,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Save texture cache to hard disk",IDC_CHK_TEX_CACHE_HD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,141,128,10 + GROUPBOX "Presets",IDC_STATIC,6,159,297,28 + PUSHBUTTON "Best performance",IDC_BUTTON1,15,170,129,14 + PUSHBUTTON "Best texture quality",IDC_BUTTON2,162,170,129,14 +END ///////////////////////////////////////////////////////////////////////////// // @@ -95,6 +208,29 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 195 END + + IDD_CONFIG_BASIC, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 310 + BOTTOMMARGIN, 168 + END + + IDD_EMULATION_SETTINGS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 7 + BOTTOMMARGIN, 170 + END + + IDD_TEXTURE_ENHANCEMENT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 7 + BOTTOMMARGIN, 187 + END END #endif // APSTUDIO_INVOKED From 6b1a02ee20cc93dfe3bb94d10337c9ff5cfaab26 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 9 Mar 2016 17:49:38 +1100 Subject: [PATCH 018/559] [Glide64] Missed added the resource items --- Source/Glide64/Main.cpp | 52 ------------------------------ Source/Glide64/resource.h | 68 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 53 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index c7b05a425..7ae655873 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1075,57 +1075,8 @@ void ReleaseGfx() rdp.window_changed = TRUE; } -// -// DllMain - called when the DLL is loaded, use this to get the DLL's instance -// -class wxDLLApp : public wxApp -{ -public: - virtual bool OnInit(); - virtual void CleanUp(); -}; - -IMPLEMENT_APP_NO_MAIN(wxDLLApp) - -bool wxDLLApp::OnInit() -{ - wxImage::AddHandler(new wxPNGHandler); - wxImage::AddHandler(new wxJPEGHandler); - return true; -} - -void wxDLLApp::CleanUp() -{ - wxApp::CleanUp(); -} - -#ifndef __WINDOWS__ -int __attribute__((constructor)) DllLoad(void); -int __attribute__((destructor)) DllUnload(void); -#endif - -// Called when the library is loaded and before dlopen() returns -int DllLoad(void) -{ - int argc = 0; - char **argv = NULL; - wxEntryStart(argc, argv); - if (wxTheApp) - return wxTheApp->CallOnInit() ? TRUE : FALSE; - return 0; -} - -// Called when the library is unloaded and before dlclose() returns -int DllUnload(void) -{ - if (wxTheApp) - wxTheApp->OnExit(); - wxEntryCleanup(); - return TRUE; -} #ifdef _WIN32 -void wxSetInstance(HINSTANCE hInstance); CriticalSection * g_ProcessDListCS = NULL; extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReserved*/) @@ -1139,8 +1090,6 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser g_ProcessDListCS = new CriticalSection(); } ConfigInit(hinst); - wxSetInstance(hinstDLL); - return DllLoad(); } else if (fdwReason == DLL_PROCESS_DETACH) { @@ -1149,7 +1098,6 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser delete g_ProcessDListCS; } ConfigCleanup(); - return DllUnload(); } return TRUE; } diff --git a/Source/Glide64/resource.h b/Source/Glide64/resource.h index 37772530e..d50c89f2e 100644 --- a/Source/Glide64/resource.h +++ b/Source/Glide64/resource.h @@ -2,7 +2,73 @@ // Microsoft Visual C++ generated include file. // Used by Glide64.rc // +#define IDD_CONFIG_BASIC 101 +#define IDD_EMULATION_SETTINGS 102 +#define IDD_TEXTURE_ENHANCEMENT 103 +#define IDD_ABOUT 104 #define IDD_ABOUTBOX 104 +#define IDC_CMB_FS_RESOLUTION 1001 +#define IDC_CHK_VERTICAL_SYNC 1002 +#define IDC_CMB_WINDOW_RES 1003 +#define IDC_CBXANISOTROPIC 1004 +#define IDC_CHECK3 1005 +#define IDC_CHK_AUTODETECT_VRAM 1005 +#define IDC_SPIN1 1006 +#define IDC_SPIN_TEXTURE_CACHE 1006 +#define IDC_EDIT1 1007 +#define IDC_CHK_USE_FRAME_BUFFER_OBJECT 1008 +#define IDC_CHK_FPS_COUNTER 1009 +#define IDC_CHK_VIS_COUNTER 1010 +#define IDC_CHK_PERCENT_COUNTER 1011 +#define IDC_CHK_CLOCK_ENABLED 1012 +#define IDC_CHK_CLOCK_24 1013 +#define IDC_CHK_TRANSPARENT 1014 +#define IDC_CMB_SCREEN_SHOT_FORMAT 1015 +#define IDC_CHK_SHOW_TEXTURE_ENHANCEMENT 1016 +#define IDC_INFO 1017 +#define IDC_CMB_FILTERING_MODE 1018 +#define IDC_CMB_BUFFER_SWAPPING 1019 +#define IDC_CMB_LOD_CALC 1020 +#define IDC_CMB_ASPECT_RATIO 1021 +#define IDC_CHK_FOG 1022 +#define IDC_CHK_BUFFER_CLEAR 1023 +#define IDC_TXT_FILTERING_MODE 1024 +#define IDC_CHK_FRAME_BUFFER_EMULATION 1025 +#define IDC_CHK_HARDWARE_FRAMEBUFFER 1026 +#define IDC_CHK_READ_EVERY_FRAME 1027 +#define IDC_CHK_GET_FRAMEBUFFER 1028 +#define IDC_RENDER_FRAME_AS_TEXTURE 1029 +#define IDC_CHK_DETECT_CPU_WRITE 1030 +#define IDC_SOFTWARE_DEPTH_BUFFER 1031 +#define IDC_TXT_BUFFER_SWAPPING 1032 +#define IDC_TXT_LOD_CALC 1033 +#define IDC_TXT_ASPECT_RATIO 1034 +#define IDC_CHK_SOFTWARE_DEPTH_BUFFER 1035 +#define IDC_CMB_ENH_FILTER 1036 +#define IDC_CMB_ENHANCEMENT 1053 +#define IDC_CHK_IGNORE_BACKGROUND 1056 +#define IDC_CHK_ALT_CRC 1057 +#define IDC_CMB_FORMAT_CHOICES 1058 +#define IDC_CHK_TEX_DUMP_EDIT 1059 +#define IDC_CHK_USE_ALPHA_FULLY 1060 +#define IDC_CHK_COMPRESS_CACHE 1061 +#define IDC_CHK_HRS_COMPRESS_CACHE 1062 +#define IDC_CHK_HIRES_TEX_COMPRESSION 1063 +#define IDC_CHK_FORCE_16BPP_TEXT 1064 +#define IDC_CHK_TILE_TEX 1065 +#define IDC_CMB_TEX_COMPRESS_MEHTOD 1066 +#define IDC_CHK_TEX_CACHE_HD 1067 +#define IDC_BUTTON1 1068 +#define IDC_BUTTON2 1069 +#define IDC_TXT_ENH_FILTER 1070 +#define IDC_TXT_ENHANCEMENT 1071 +#define IDC_CHK_TEX_COMPRESSION 1072 +#define IDC_TXT_FORMAT_CHOICES 1073 +#define IDC_SPIN_VRAM_SIZE 1074 +#define IDC_TXT_VRAM_SIZE 1075 +#define IDC_LBL_MB 1076 +#define IDC_TEXT_MB 1077 +#define IDC_TXT_TEXTURE_CACHE 1078 // Next default values for new objects // @@ -10,7 +76,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_CONTROL_VALUE 1079 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif From 68a8ed03696f3365430d8cca14d5084100165cd0 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 9 Mar 2016 20:57:14 +1100 Subject: [PATCH 019/559] [3rd Party] Remove WX library --- Project64.sln | 66 +- Project64.vs2008.sln | 49 +- Source/3rdParty/wx/art/addbookm.xpm | 24 - Source/3rdParty/wx/art/back.xpm | 21 - Source/3rdParty/wx/art/cdrom.xpm | 57 - Source/3rdParty/wx/art/close.xpm | 16 - Source/3rdParty/wx/art/copy.xpm | 44 - Source/3rdParty/wx/art/cross.xpm | 17 - Source/3rdParty/wx/art/cut.xpm | 46 - Source/3rdParty/wx/art/deffile.xpm | 54 - Source/3rdParty/wx/art/delbookm.xpm | 24 - Source/3rdParty/wx/art/delete.xpm | 42 - Source/3rdParty/wx/art/dir_up.xpm | 52 - Source/3rdParty/wx/art/down.xpm | 21 - Source/3rdParty/wx/art/exefile.xpm | 73 - Source/3rdParty/wx/art/fileopen.xpm | 57 - Source/3rdParty/wx/art/filesave.xpm | 42 - Source/3rdParty/wx/art/filesaveas.xpm | 44 - Source/3rdParty/wx/art/find.xpm | 62 - Source/3rdParty/wx/art/findrepl.xpm | 63 - Source/3rdParty/wx/art/first.xpm | 22 - Source/3rdParty/wx/art/floppy.xpm | 39 - Source/3rdParty/wx/art/folder.xpm | 43 - Source/3rdParty/wx/art/folder_open.xpm | 52 - Source/3rdParty/wx/art/forward.xpm | 21 - Source/3rdParty/wx/art/harddisk.xpm | 60 - Source/3rdParty/wx/art/helpicon.xpm | 44 - Source/3rdParty/wx/art/home.xpm | 24 - Source/3rdParty/wx/art/htmbook.xpm | 25 - Source/3rdParty/wx/art/htmfoldr.xpm | 25 - Source/3rdParty/wx/art/htmoptns.xpm | 20 - Source/3rdParty/wx/art/htmpage.xpm | 23 - Source/3rdParty/wx/art/htmsidep.xpm | 27 - Source/3rdParty/wx/art/last.xpm | 22 - Source/3rdParty/wx/art/listview.xpm | 25 - Source/3rdParty/wx/art/minus.xpm | 22 - Source/3rdParty/wx/art/missimg.xpm | 43 - Source/3rdParty/wx/art/new.xpm | 50 - Source/3rdParty/wx/art/new_dir.xpm | 43 - Source/3rdParty/wx/art/paste.xpm | 46 - Source/3rdParty/wx/art/plus.xpm | 22 - Source/3rdParty/wx/art/print.xpm | 60 - Source/3rdParty/wx/art/quit.xpm | 90 - Source/3rdParty/wx/art/redo.xpm | 58 - Source/3rdParty/wx/art/removable.xpm | 44 - Source/3rdParty/wx/art/repview.xpm | 24 - .../wx/art/tango/application_x_executable.h | 284 - Source/3rdParty/wx/art/tango/dialog_error.h | 262 - .../wx/art/tango/dialog_information.h | 367 - Source/3rdParty/wx/art/tango/dialog_warning.h | 265 - Source/3rdParty/wx/art/tango/document_new.h | 191 - Source/3rdParty/wx/art/tango/document_open.h | 274 - Source/3rdParty/wx/art/tango/document_print.h | 229 - Source/3rdParty/wx/art/tango/document_save.h | 340 - .../3rdParty/wx/art/tango/document_save_as.h | 332 - Source/3rdParty/wx/art/tango/drive_harddisk.h | 193 - Source/3rdParty/wx/art/tango/drive_optical.h | 287 - .../wx/art/tango/drive_removable_media.h | 178 - Source/3rdParty/wx/art/tango/edit_copy.h | 197 - Source/3rdParty/wx/art/tango/edit_cut.h | 333 - Source/3rdParty/wx/art/tango/edit_delete.h | 339 - Source/3rdParty/wx/art/tango/edit_find.h | 309 - .../3rdParty/wx/art/tango/edit_find_replace.h | 315 - Source/3rdParty/wx/art/tango/edit_paste.h | 229 - Source/3rdParty/wx/art/tango/edit_redo.h | 235 - Source/3rdParty/wx/art/tango/edit_undo.h | 287 - Source/3rdParty/wx/art/tango/folder.h | 197 - Source/3rdParty/wx/art/tango/folder_new.h | 251 - Source/3rdParty/wx/art/tango/folder_open.h | 230 - Source/3rdParty/wx/art/tango/go_down.h | 272 - Source/3rdParty/wx/art/tango/go_first.h | 278 - Source/3rdParty/wx/art/tango/go_home.h | 252 - Source/3rdParty/wx/art/tango/go_last.h | 276 - Source/3rdParty/wx/art/tango/go_next.h | 274 - Source/3rdParty/wx/art/tango/go_previous.h | 280 - Source/3rdParty/wx/art/tango/go_up.h | 266 - Source/3rdParty/wx/art/tango/image_missing.h | 177 - Source/3rdParty/wx/art/tango/list_add.h | 109 - Source/3rdParty/wx/art/tango/list_remove.h | 76 - Source/3rdParty/wx/art/tango/text_x_generic.h | 134 - Source/3rdParty/wx/art/tick.xpm | 17 - Source/3rdParty/wx/art/tipicon.xpm | 47 - Source/3rdParty/wx/art/toparent.xpm | 21 - Source/3rdParty/wx/art/undo.xpm | 58 - Source/3rdParty/wx/art/up.xpm | 21 - Source/3rdParty/wx/include/msvc/wx/setup.h | 241 - Source/3rdParty/wx/include/wx/accel.h | 170 - Source/3rdParty/wx/include/wx/afterstd.h | 71 - Source/3rdParty/wx/include/wx/anidecod.h | 77 - Source/3rdParty/wx/include/wx/animdecod.h | 146 - Source/3rdParty/wx/include/wx/app.h | 708 -- Source/3rdParty/wx/include/wx/apptrait.h | 272 - Source/3rdParty/wx/include/wx/archive.h | 381 - Source/3rdParty/wx/include/wx/arrimpl.cpp | 120 - Source/3rdParty/wx/include/wx/arrstr.h | 377 - Source/3rdParty/wx/include/wx/artprov.h | 204 - Source/3rdParty/wx/include/wx/beforestd.h | 75 - Source/3rdParty/wx/include/wx/bitmap.h | 241 - Source/3rdParty/wx/include/wx/bmpbuttn.h | 122 - Source/3rdParty/wx/include/wx/bookctrl.h | 403 - Source/3rdParty/wx/include/wx/brush.h | 54 - Source/3rdParty/wx/include/wx/buffer.h | 314 - Source/3rdParty/wx/include/wx/build.h | 149 - Source/3rdParty/wx/include/wx/busyinfo.h | 21 - Source/3rdParty/wx/include/wx/button.h | 106 - Source/3rdParty/wx/include/wx/caret.h | 252 - Source/3rdParty/wx/include/wx/checkbox.h | 156 - Source/3rdParty/wx/include/wx/checklst.h | 64 - Source/3rdParty/wx/include/wx/chkconf.h | 1871 ----- Source/3rdParty/wx/include/wx/choicdlg.h | 22 - Source/3rdParty/wx/include/wx/choice.h | 88 - Source/3rdParty/wx/include/wx/choicebk.h | 154 - Source/3rdParty/wx/include/wx/clipbrd.h | 145 - Source/3rdParty/wx/include/wx/clntdata.h | 273 - Source/3rdParty/wx/include/wx/clrpicker.h | 200 - Source/3rdParty/wx/include/wx/cmdline.h | 239 - Source/3rdParty/wx/include/wx/cmdproc.h | 144 - Source/3rdParty/wx/include/wx/cmndata.h | 454 -- Source/3rdParty/wx/include/wx/collpane.h | 104 - Source/3rdParty/wx/include/wx/colordlg.h | 41 - Source/3rdParty/wx/include/wx/colour.h | 154 - Source/3rdParty/wx/include/wx/combo.h | 757 -- Source/3rdParty/wx/include/wx/combobox.h | 97 - Source/3rdParty/wx/include/wx/confbase.h | 359 - Source/3rdParty/wx/include/wx/config.h | 33 - Source/3rdParty/wx/include/wx/containr.h | 142 - Source/3rdParty/wx/include/wx/control.h | 117 - Source/3rdParty/wx/include/wx/convauto.h | 108 - Source/3rdParty/wx/include/wx/cpp.h | 57 - Source/3rdParty/wx/include/wx/cshelp.h | 244 - Source/3rdParty/wx/include/wx/ctrlsub.h | 210 - Source/3rdParty/wx/include/wx/cursor.h | 79 - Source/3rdParty/wx/include/wx/dataobj.h | 540 -- Source/3rdParty/wx/include/wx/datetime.h | 2137 ----- Source/3rdParty/wx/include/wx/datstrm.h | 170 - Source/3rdParty/wx/include/wx/dc.h | 1008 --- Source/3rdParty/wx/include/wx/dcbuffer.h | 276 - Source/3rdParty/wx/include/wx/dcclient.h | 42 - Source/3rdParty/wx/include/wx/dcgraph.h | 190 - Source/3rdParty/wx/include/wx/dcmemory.h | 76 - Source/3rdParty/wx/include/wx/dcmirror.h | 287 - Source/3rdParty/wx/include/wx/dcprint.h | 33 - Source/3rdParty/wx/include/wx/dcscreen.h | 42 - Source/3rdParty/wx/include/wx/dde.h | 32 - Source/3rdParty/wx/include/wx/debug.h | 316 - Source/3rdParty/wx/include/wx/defs.h | 2907 ------- Source/3rdParty/wx/include/wx/dialog.h | 167 - Source/3rdParty/wx/include/wx/dialup.h | 201 - Source/3rdParty/wx/include/wx/dir.h | 161 - Source/3rdParty/wx/include/wx/dirdlg.h | 141 - Source/3rdParty/wx/include/wx/display.h | 128 - Source/3rdParty/wx/include/wx/display_impl.h | 110 - Source/3rdParty/wx/include/wx/dlimpexp.h | 275 - Source/3rdParty/wx/include/wx/dnd.h | 267 - Source/3rdParty/wx/include/wx/docmdi.h | 107 - Source/3rdParty/wx/include/wx/docview.h | 675 -- Source/3rdParty/wx/include/wx/dynarray.h | 1044 --- Source/3rdParty/wx/include/wx/dynlib.h | 359 - Source/3rdParty/wx/include/wx/dynload.h | 153 - Source/3rdParty/wx/include/wx/effects.h | 75 - Source/3rdParty/wx/include/wx/encconv.h | 159 - Source/3rdParty/wx/include/wx/encinfo.h | 74 - Source/3rdParty/wx/include/wx/event.h | 3121 -------- Source/3rdParty/wx/include/wx/evtloop.h | 229 - Source/3rdParty/wx/include/wx/except.h | 30 - Source/3rdParty/wx/include/wx/fdrepdlg.h | 195 - Source/3rdParty/wx/include/wx/features.h | 64 - Source/3rdParty/wx/include/wx/ffile.h | 115 - Source/3rdParty/wx/include/wx/file.h | 201 - Source/3rdParty/wx/include/wx/fileconf.h | 246 - Source/3rdParty/wx/include/wx/filedlg.h | 226 - Source/3rdParty/wx/include/wx/filefn.h | 770 -- Source/3rdParty/wx/include/wx/filename.h | 547 -- Source/3rdParty/wx/include/wx/filepicker.h | 398 - Source/3rdParty/wx/include/wx/filesys.h | 300 - Source/3rdParty/wx/include/wx/flags.h | 165 - Source/3rdParty/wx/include/wx/fmappriv.h | 74 - Source/3rdParty/wx/include/wx/font.h | 251 - Source/3rdParty/wx/include/wx/fontdlg.h | 118 - Source/3rdParty/wx/include/wx/fontenc.h | 151 - Source/3rdParty/wx/include/wx/fontenum.h | 88 - Source/3rdParty/wx/include/wx/fontmap.h | 290 - Source/3rdParty/wx/include/wx/fontpicker.h | 223 - Source/3rdParty/wx/include/wx/fontutil.h | 242 - Source/3rdParty/wx/include/wx/frame.h | 262 - Source/3rdParty/wx/include/wx/fs_arc.h | 56 - Source/3rdParty/wx/include/wx/fs_filter.h | 41 - Source/3rdParty/wx/include/wx/fs_mem.h | 127 - Source/3rdParty/wx/include/wx/gauge.h | 126 - Source/3rdParty/wx/include/wx/gbsizer.h | 303 - Source/3rdParty/wx/include/wx/gdicmn.h | 755 -- Source/3rdParty/wx/include/wx/gdiobj.h | 51 - .../3rdParty/wx/include/wx/generic/busyinfo.h | 42 - .../3rdParty/wx/include/wx/generic/choicdgg.h | 320 - .../wx/include/wx/generic/clrpickerg.h | 98 - .../wx/include/wx/generic/collpaneg.h | 105 - Source/3rdParty/wx/include/wx/generic/combo.h | 140 - .../3rdParty/wx/include/wx/generic/dirctrlg.h | 295 - .../3rdParty/wx/include/wx/generic/dragimgg.h | 271 - .../wx/include/wx/generic/filepickerg.h | 213 - .../wx/include/wx/generic/fontpickerg.h | 82 - Source/3rdParty/wx/include/wx/generic/logg.h | 129 - .../3rdParty/wx/include/wx/generic/msgdlgg.h | 44 - .../3rdParty/wx/include/wx/generic/notebook.h | 160 - .../3rdParty/wx/include/wx/generic/numdlgg.h | 79 - .../3rdParty/wx/include/wx/generic/panelg.h | 95 - .../3rdParty/wx/include/wx/generic/prntdlgg.h | 256 - .../3rdParty/wx/include/wx/generic/progdlgg.h | 172 - .../3rdParty/wx/include/wx/generic/scrolwin.h | 27 - .../3rdParty/wx/include/wx/generic/spinctlg.h | 183 - .../3rdParty/wx/include/wx/generic/splitter.h | 406 - .../3rdParty/wx/include/wx/generic/srchctlg.h | 275 - .../3rdParty/wx/include/wx/generic/statline.h | 62 - .../3rdParty/wx/include/wx/generic/statusbr.h | 107 - .../3rdParty/wx/include/wx/generic/textdlgg.h | 113 - Source/3rdParty/wx/include/wx/generic/timer.h | 45 - .../3rdParty/wx/include/wx/generic/treectlg.h | 383 - Source/3rdParty/wx/include/wx/geometry.h | 814 -- Source/3rdParty/wx/include/wx/gifdecod.h | 110 - Source/3rdParty/wx/include/wx/graphics.h | 735 -- Source/3rdParty/wx/include/wx/gsocket.h | 184 - Source/3rdParty/wx/include/wx/hash.h | 630 -- Source/3rdParty/wx/include/wx/hashmap.h | 739 -- Source/3rdParty/wx/include/wx/hashset.h | 135 - Source/3rdParty/wx/include/wx/help.h | 48 - Source/3rdParty/wx/include/wx/helpbase.h | 106 - Source/3rdParty/wx/include/wx/icon.h | 53 - Source/3rdParty/wx/include/wx/iconbndl.h | 69 - Source/3rdParty/wx/include/wx/iconloc.h | 81 - Source/3rdParty/wx/include/wx/imagbmp.h | 165 - Source/3rdParty/wx/include/wx/image.h | 454 -- Source/3rdParty/wx/include/wx/imaggif.h | 48 - Source/3rdParty/wx/include/wx/imagiff.h | 44 - Source/3rdParty/wx/include/wx/imagjpeg.h | 48 - Source/3rdParty/wx/include/wx/imaglist.h | 55 - Source/3rdParty/wx/include/wx/imagpcx.h | 47 - Source/3rdParty/wx/include/wx/imagpng.h | 60 - Source/3rdParty/wx/include/wx/imagpnm.h | 46 - Source/3rdParty/wx/include/wx/imagtga.h | 46 - Source/3rdParty/wx/include/wx/imagtiff.h | 49 - Source/3rdParty/wx/include/wx/imagxpm.h | 45 - Source/3rdParty/wx/include/wx/init.h | 105 - Source/3rdParty/wx/include/wx/intl.h | 632 -- Source/3rdParty/wx/include/wx/iosfwrap.h | 26 - Source/3rdParty/wx/include/wx/ioswrap.h | 26 - Source/3rdParty/wx/include/wx/ipcbase.h | 163 - Source/3rdParty/wx/include/wx/layout.h | 191 - Source/3rdParty/wx/include/wx/list.h | 1308 ---- Source/3rdParty/wx/include/wx/listbase.h | 491 -- Source/3rdParty/wx/include/wx/listbook.h | 152 - Source/3rdParty/wx/include/wx/listbox.h | 166 - Source/3rdParty/wx/include/wx/listctrl.h | 110 - Source/3rdParty/wx/include/wx/listimpl.cpp | 39 - Source/3rdParty/wx/include/wx/log.h | 653 -- Source/3rdParty/wx/include/wx/longlong.h | 1080 --- Source/3rdParty/wx/include/wx/math.h | 140 - Source/3rdParty/wx/include/wx/matrix.h | 235 - Source/3rdParty/wx/include/wx/mdi.h | 40 - Source/3rdParty/wx/include/wx/memconf.h | 54 - Source/3rdParty/wx/include/wx/memory.h | 373 - Source/3rdParty/wx/include/wx/memtext.h | 54 - Source/3rdParty/wx/include/wx/menu.h | 555 -- Source/3rdParty/wx/include/wx/menuitem.h | 203 - Source/3rdParty/wx/include/wx/metafile.h | 62 - Source/3rdParty/wx/include/wx/mimetype.h | 453 -- Source/3rdParty/wx/include/wx/minifram.h | 43 - Source/3rdParty/wx/include/wx/module.h | 103 - Source/3rdParty/wx/include/wx/msgdlg.h | 79 - Source/3rdParty/wx/include/wx/msgout.h | 113 - Source/3rdParty/wx/include/wx/mstream.h | 92 - Source/3rdParty/wx/include/wx/msw/accel.h | 46 - Source/3rdParty/wx/include/wx/msw/app.h | 147 - Source/3rdParty/wx/include/wx/msw/apptbase.h | 46 - Source/3rdParty/wx/include/wx/msw/apptrait.h | 45 - Source/3rdParty/wx/include/wx/msw/bitmap.h | 282 - Source/3rdParty/wx/include/wx/msw/bmpbuttn.h | 73 - Source/3rdParty/wx/include/wx/msw/brush.h | 60 - Source/3rdParty/wx/include/wx/msw/button.h | 82 - Source/3rdParty/wx/include/wx/msw/caret.h | 64 - Source/3rdParty/wx/include/wx/msw/checkbox.h | 86 - Source/3rdParty/wx/include/wx/msw/checklst.h | 96 - Source/3rdParty/wx/include/wx/msw/chkconf.h | 387 - Source/3rdParty/wx/include/wx/msw/choice.h | 135 - Source/3rdParty/wx/include/wx/msw/clipbrd.h | 98 - Source/3rdParty/wx/include/wx/msw/colordlg.h | 56 - Source/3rdParty/wx/include/wx/msw/colour.h | 88 - Source/3rdParty/wx/include/wx/msw/combo.h | 111 - Source/3rdParty/wx/include/wx/msw/combobox.h | 138 - Source/3rdParty/wx/include/wx/msw/control.h | 141 - Source/3rdParty/wx/include/wx/msw/crashrpt.h | 120 - Source/3rdParty/wx/include/wx/msw/cursor.h | 47 - Source/3rdParty/wx/include/wx/msw/dc.h | 345 - Source/3rdParty/wx/include/wx/msw/dcclient.h | 118 - Source/3rdParty/wx/include/wx/msw/dcmemory.h | 45 - Source/3rdParty/wx/include/wx/msw/dcprint.h | 70 - Source/3rdParty/wx/include/wx/msw/dcscreen.h | 40 - Source/3rdParty/wx/include/wx/msw/dde.h | 144 - Source/3rdParty/wx/include/wx/msw/debughlp.h | 228 - Source/3rdParty/wx/include/wx/msw/dialog.h | 140 - Source/3rdParty/wx/include/wx/msw/dib.h | 255 - Source/3rdParty/wx/include/wx/msw/dirdlg.h | 35 - Source/3rdParty/wx/include/wx/msw/dragimag.h | 274 - Source/3rdParty/wx/include/wx/msw/enhmeta.h | 196 - Source/3rdParty/wx/include/wx/msw/evtloop.h | 69 - Source/3rdParty/wx/include/wx/msw/fdrepdlg.h | 62 - Source/3rdParty/wx/include/wx/msw/filedlg.h | 55 - Source/3rdParty/wx/include/wx/msw/font.h | 148 - Source/3rdParty/wx/include/wx/msw/fontdlg.h | 46 - Source/3rdParty/wx/include/wx/msw/frame.h | 172 - Source/3rdParty/wx/include/wx/msw/gauge95.h | 70 - Source/3rdParty/wx/include/wx/msw/gccpriv.h | 127 - Source/3rdParty/wx/include/wx/msw/gdiimage.h | 189 - Source/3rdParty/wx/include/wx/msw/genrcdefs.h | 43 - Source/3rdParty/wx/include/wx/msw/gsockmsw.h | 145 - Source/3rdParty/wx/include/wx/msw/helpchm.h | 60 - Source/3rdParty/wx/include/wx/msw/helpwin.h | 56 - Source/3rdParty/wx/include/wx/msw/htmlhelp.h | 465 -- Source/3rdParty/wx/include/wx/msw/icon.h | 95 - Source/3rdParty/wx/include/wx/msw/imaglist.h | 206 - Source/3rdParty/wx/include/wx/msw/iniconf.h | 101 - Source/3rdParty/wx/include/wx/msw/libraries.h | 27 - Source/3rdParty/wx/include/wx/msw/listbox.h | 183 - Source/3rdParty/wx/include/wx/msw/listctrl.h | 449 -- Source/3rdParty/wx/include/wx/msw/mdi.h | 238 - Source/3rdParty/wx/include/wx/msw/menu.h | 241 - Source/3rdParty/wx/include/wx/msw/menuitem.h | 100 - Source/3rdParty/wx/include/wx/msw/mimetype.h | 122 - Source/3rdParty/wx/include/wx/msw/minifram.h | 52 - Source/3rdParty/wx/include/wx/msw/missing.h | 495 -- Source/3rdParty/wx/include/wx/msw/msgdlg.h | 42 - Source/3rdParty/wx/include/wx/msw/mslu.h | 23 - Source/3rdParty/wx/include/wx/msw/msvcrt.h | 69 - Source/3rdParty/wx/include/wx/msw/notebook.h | 254 - .../3rdParty/wx/include/wx/msw/ole/activex.h | 221 - .../3rdParty/wx/include/wx/msw/ole/automtn.h | 101 - .../3rdParty/wx/include/wx/msw/ole/dataform.h | 68 - .../3rdParty/wx/include/wx/msw/ole/dataobj.h | 79 - .../3rdParty/wx/include/wx/msw/ole/dataobj2.h | 146 - .../3rdParty/wx/include/wx/msw/ole/dropsrc.h | 79 - .../3rdParty/wx/include/wx/msw/ole/droptgt.h | 72 - .../3rdParty/wx/include/wx/msw/ole/oleutils.h | 256 - Source/3rdParty/wx/include/wx/msw/ole/uuid.h | 92 - Source/3rdParty/wx/include/wx/msw/palette.h | 58 - Source/3rdParty/wx/include/wx/msw/pen.h | 132 - Source/3rdParty/wx/include/wx/msw/popupwin.h | 45 - Source/3rdParty/wx/include/wx/msw/printdlg.h | 124 - Source/3rdParty/wx/include/wx/msw/printwin.h | 66 - Source/3rdParty/wx/include/wx/msw/private.h | 956 --- Source/3rdParty/wx/include/wx/msw/radiobox.h | 175 - Source/3rdParty/wx/include/wx/msw/radiobut.h | 70 - Source/3rdParty/wx/include/wx/msw/regconf.h | 116 - Source/3rdParty/wx/include/wx/msw/region.h | 104 - Source/3rdParty/wx/include/wx/msw/registry.h | 247 - Source/3rdParty/wx/include/wx/msw/scrolbar.h | 72 - Source/3rdParty/wx/include/wx/msw/seh.h | 74 - Source/3rdParty/wx/include/wx/msw/setup.h | 1361 ---- Source/3rdParty/wx/include/wx/msw/slider95.h | 137 - Source/3rdParty/wx/include/wx/msw/spinbutt.h | 72 - Source/3rdParty/wx/include/wx/msw/spinctrl.h | 142 - Source/3rdParty/wx/include/wx/msw/stackwalk.h | 103 - Source/3rdParty/wx/include/wx/msw/statbmp.h | 90 - Source/3rdParty/wx/include/wx/msw/statbox.h | 73 - Source/3rdParty/wx/include/wx/msw/statbr95.h | 76 - Source/3rdParty/wx/include/wx/msw/statline.h | 52 - Source/3rdParty/wx/include/wx/msw/stattext.h | 56 - Source/3rdParty/wx/include/wx/msw/stdpaths.h | 53 - Source/3rdParty/wx/include/wx/msw/subwin.h | 195 - Source/3rdParty/wx/include/wx/msw/tbar95.h | 156 - Source/3rdParty/wx/include/wx/msw/textctrl.h | 291 - Source/3rdParty/wx/include/wx/msw/tglbtn.h | 60 - Source/3rdParty/wx/include/wx/msw/timer.h | 40 - Source/3rdParty/wx/include/wx/msw/tooltip.h | 71 - Source/3rdParty/wx/include/wx/msw/toplevel.h | 197 - Source/3rdParty/wx/include/wx/msw/treectrl.h | 315 - Source/3rdParty/wx/include/wx/msw/uxtheme.h | 230 - Source/3rdParty/wx/include/wx/msw/uxthemep.h | 169 - Source/3rdParty/wx/include/wx/msw/window.h | 601 -- Source/3rdParty/wx/include/wx/msw/winundef.h | 490 -- Source/3rdParty/wx/include/wx/msw/wrapcctl.h | 62 - Source/3rdParty/wx/include/wx/msw/wrapcdlg.h | 28 - Source/3rdParty/wx/include/wx/msw/wrapshl.h | 90 - Source/3rdParty/wx/include/wx/msw/wrapwin.h | 99 - Source/3rdParty/wx/include/wx/notebook.h | 183 - Source/3rdParty/wx/include/wx/numdlg.h | 23 - Source/3rdParty/wx/include/wx/object.h | 569 -- Source/3rdParty/wx/include/wx/overlay.h | 97 - Source/3rdParty/wx/include/wx/ownerdrw.h | 184 - Source/3rdParty/wx/include/wx/palette.h | 59 - Source/3rdParty/wx/include/wx/panel.h | 18 - Source/3rdParty/wx/include/wx/paper.h | 122 - Source/3rdParty/wx/include/wx/pen.h | 40 - Source/3rdParty/wx/include/wx/pickerbase.h | 189 - Source/3rdParty/wx/include/wx/platform.h | 664 -- Source/3rdParty/wx/include/wx/platinfo.h | 313 - Source/3rdParty/wx/include/wx/popupwin.h | 192 - Source/3rdParty/wx/include/wx/power.h | 111 - Source/3rdParty/wx/include/wx/print.h | 39 - Source/3rdParty/wx/include/wx/printdlg.h | 122 - .../wx/include/wx/private/browserhack28.h | 20 - .../3rdParty/wx/include/wx/private/fileback.h | 83 - .../3rdParty/wx/include/wx/private/filename.h | 56 - .../3rdParty/wx/include/wx/private/overlay.h | 72 - Source/3rdParty/wx/include/wx/prntbase.h | 665 -- Source/3rdParty/wx/include/wx/process.h | 172 - Source/3rdParty/wx/include/wx/progdlg.h | 36 - Source/3rdParty/wx/include/wx/ptr_scpd.h | 222 - Source/3rdParty/wx/include/wx/quantize.h | 76 - Source/3rdParty/wx/include/wx/radiobox.h | 181 - Source/3rdParty/wx/include/wx/radiobut.h | 61 - Source/3rdParty/wx/include/wx/rawbmp.h | 713 -- Source/3rdParty/wx/include/wx/recguard.h | 53 - Source/3rdParty/wx/include/wx/regex.h | 166 - Source/3rdParty/wx/include/wx/region.h | 300 - Source/3rdParty/wx/include/wx/renderer.h | 436 -- Source/3rdParty/wx/include/wx/scopeguard.h | 373 - Source/3rdParty/wx/include/wx/scrolbar.h | 80 - Source/3rdParty/wx/include/wx/scrolwin.h | 314 - Source/3rdParty/wx/include/wx/selstore.h | 104 - Source/3rdParty/wx/include/wx/settings.h | 214 - Source/3rdParty/wx/include/wx/sizer.h | 1092 --- Source/3rdParty/wx/include/wx/slider.h | 151 - Source/3rdParty/wx/include/wx/snglinst.h | 65 - Source/3rdParty/wx/include/wx/spinbutt.h | 129 - Source/3rdParty/wx/include/wx/spinctrl.h | 83 - Source/3rdParty/wx/include/wx/splitter.h | 47 - Source/3rdParty/wx/include/wx/srchctrl.h | 91 - Source/3rdParty/wx/include/wx/sstream.h | 103 - Source/3rdParty/wx/include/wx/stack.h | 44 - Source/3rdParty/wx/include/wx/stackwalk.h | 156 - Source/3rdParty/wx/include/wx/statbmp.h | 74 - Source/3rdParty/wx/include/wx/statbox.h | 74 - Source/3rdParty/wx/include/wx/statline.h | 103 - Source/3rdParty/wx/include/wx/stattext.h | 69 - Source/3rdParty/wx/include/wx/statusbr.h | 174 - Source/3rdParty/wx/include/wx/stdpaths.h | 179 - Source/3rdParty/wx/include/wx/stockitem.h | 73 - Source/3rdParty/wx/include/wx/stopwatch.h | 102 - Source/3rdParty/wx/include/wx/strconv.h | 553 -- Source/3rdParty/wx/include/wx/stream.h | 609 -- Source/3rdParty/wx/include/wx/string.h | 1653 ---- Source/3rdParty/wx/include/wx/sysopt.h | 71 - Source/3rdParty/wx/include/wx/tarstrm.h | 352 - Source/3rdParty/wx/include/wx/tbarbase.h | 607 -- Source/3rdParty/wx/include/wx/textbuf.h | 208 - Source/3rdParty/wx/include/wx/textctrl.h | 601 -- Source/3rdParty/wx/include/wx/textdlg.h | 23 - Source/3rdParty/wx/include/wx/textfile.h | 62 - Source/3rdParty/wx/include/wx/tglbtn.h | 51 - Source/3rdParty/wx/include/wx/thread.h | 764 -- Source/3rdParty/wx/include/wx/thrimpl.cpp | 332 - Source/3rdParty/wx/include/wx/timer.h | 201 - Source/3rdParty/wx/include/wx/tipwin.h | 98 - Source/3rdParty/wx/include/wx/tokenzr.h | 135 - Source/3rdParty/wx/include/wx/toolbar.h | 93 - Source/3rdParty/wx/include/wx/toolbook.h | 163 - Source/3rdParty/wx/include/wx/tooltip.h | 39 - Source/3rdParty/wx/include/wx/toplevel.h | 375 - Source/3rdParty/wx/include/wx/treebase.h | 426 - Source/3rdParty/wx/include/wx/treebook.h | 283 - Source/3rdParty/wx/include/wx/treectrl.h | 459 -- Source/3rdParty/wx/include/wx/txtstrm.h | 160 - Source/3rdParty/wx/include/wx/uri.h | 151 - Source/3rdParty/wx/include/wx/utils.h | 746 -- Source/3rdParty/wx/include/wx/valgen.h | 69 - Source/3rdParty/wx/include/wx/validate.h | 98 - Source/3rdParty/wx/include/wx/valtext.h | 122 - Source/3rdParty/wx/include/wx/variant.h | 423 - Source/3rdParty/wx/include/wx/vector.h | 212 - Source/3rdParty/wx/include/wx/version.h | 91 - Source/3rdParty/wx/include/wx/vidmode.h | 73 - Source/3rdParty/wx/include/wx/vlbox.h | 296 - Source/3rdParty/wx/include/wx/volume.h | 146 - Source/3rdParty/wx/include/wx/vscroll.h | 223 - Source/3rdParty/wx/include/wx/wfstream.h | 204 - Source/3rdParty/wx/include/wx/window.h | 1671 ---- Source/3rdParty/wx/include/wx/wupdlock.h | 37 - Source/3rdParty/wx/include/wx/wx.h | 105 - Source/3rdParty/wx/include/wx/wxchar.h | 1413 ---- Source/3rdParty/wx/include/wx/wxprec.h | 70 - Source/3rdParty/wx/include/wx/xpmdecod.h | 47 - Source/3rdParty/wx/include/wx/xti.h | 2102 ----- Source/3rdParty/wx/include/wx/zipstrm.h | 574 -- Source/3rdParty/wx/include/wx/zstream.h | 146 - .../wx/lib/vc_lib/msw/wx/msw/rcdefs.h | 44 - Source/3rdParty/wx/src/common/accesscmn.cpp | 26 - Source/3rdParty/wx/src/common/anidecod.cpp | 345 - Source/3rdParty/wx/src/common/appbase.cpp | 846 -- Source/3rdParty/wx/src/common/appcmn.cpp | 691 -- Source/3rdParty/wx/src/common/arcall.cpp | 41 - Source/3rdParty/wx/src/common/arcfind.cpp | 43 - Source/3rdParty/wx/src/common/archive.cpp | 98 - Source/3rdParty/wx/src/common/artprov.cpp | 354 - Source/3rdParty/wx/src/common/artstd.cpp | 267 - Source/3rdParty/wx/src/common/bmpbase.cpp | 211 - Source/3rdParty/wx/src/common/bookctrl.cpp | 497 -- Source/3rdParty/wx/src/common/choiccmn.cpp | 55 - Source/3rdParty/wx/src/common/clipcmn.cpp | 63 - Source/3rdParty/wx/src/common/clntdata.cpp | 83 - .../3rdParty/wx/src/common/clrpickercmn.cpp | 149 - Source/3rdParty/wx/src/common/cmdline.cpp | 1246 --- Source/3rdParty/wx/src/common/cmdproc.cpp | 325 - Source/3rdParty/wx/src/common/cmndata.cpp | 660 -- Source/3rdParty/wx/src/common/colourcmn.cpp | 126 - Source/3rdParty/wx/src/common/combocmn.cpp | 2340 ------ Source/3rdParty/wx/src/common/config.cpp | 490 -- Source/3rdParty/wx/src/common/containr.cpp | 678 -- Source/3rdParty/wx/src/common/convauto.cpp | 214 - Source/3rdParty/wx/src/common/cshelp.cpp | 512 -- Source/3rdParty/wx/src/common/ctrlcmn.cpp | 188 - Source/3rdParty/wx/src/common/ctrlsub.cpp | 197 - Source/3rdParty/wx/src/common/datacmn.cpp | 83 - Source/3rdParty/wx/src/common/datetime.cpp | 4615 ----------- Source/3rdParty/wx/src/common/datstrm.cpp | 745 -- Source/3rdParty/wx/src/common/dcbase.cpp | 1174 --- Source/3rdParty/wx/src/common/dcbufcmn.cpp | 95 - Source/3rdParty/wx/src/common/dcgraph.cpp | 1034 --- Source/3rdParty/wx/src/common/dircmn.cpp | 357 - Source/3rdParty/wx/src/common/dlgcmn.cpp | 565 -- Source/3rdParty/wx/src/common/dndcmn.cpp | 31 - Source/3rdParty/wx/src/common/dobjcmn.cpp | 517 -- Source/3rdParty/wx/src/common/docmdi.cpp | 206 - Source/3rdParty/wx/src/common/docview.cpp | 2491 ------ Source/3rdParty/wx/src/common/dpycmn.cpp | 269 - Source/3rdParty/wx/src/common/dseldlg.cpp | 55 - Source/3rdParty/wx/src/common/dummy.cpp | 32 - Source/3rdParty/wx/src/common/dynarray.cpp | 527 -- Source/3rdParty/wx/src/common/dynlib.cpp | 323 - Source/3rdParty/wx/src/common/dynload.cpp | 362 - Source/3rdParty/wx/src/common/effects.cpp | 124 - Source/3rdParty/wx/src/common/encconv.cpp | 531 -- Source/3rdParty/wx/src/common/event.cpp | 1499 ---- Source/3rdParty/wx/src/common/evtloopcmn.cpp | 172 - Source/3rdParty/wx/src/common/execcmn.cpp | 122 - Source/3rdParty/wx/src/common/extended.c | 196 - Source/3rdParty/wx/src/common/fddlgcmn.cpp | 102 - Source/3rdParty/wx/src/common/ffile.cpp | 256 - Source/3rdParty/wx/src/common/file.cpp | 559 -- Source/3rdParty/wx/src/common/fileback.cpp | 338 - Source/3rdParty/wx/src/common/fileconf.cpp | 2131 ----- Source/3rdParty/wx/src/common/filefn.cpp | 2123 ----- Source/3rdParty/wx/src/common/filename.cpp | 2558 ------ .../3rdParty/wx/src/common/filepickercmn.cpp | 224 - Source/3rdParty/wx/src/common/filesys.cpp | 700 -- Source/3rdParty/wx/src/common/filtall.cpp | 36 - Source/3rdParty/wx/src/common/filtfind.cpp | 43 - Source/3rdParty/wx/src/common/fldlgcmn.cpp | 348 - Source/3rdParty/wx/src/common/fmapbase.cpp | 737 -- Source/3rdParty/wx/src/common/fontcmn.cpp | 784 -- Source/3rdParty/wx/src/common/fontenumcmn.cpp | 131 - Source/3rdParty/wx/src/common/fontmap.cpp | 519 -- .../3rdParty/wx/src/common/fontpickercmn.cpp | 181 - Source/3rdParty/wx/src/common/framecmn.cpp | 590 -- Source/3rdParty/wx/src/common/fs_arc.cpp | 533 -- Source/3rdParty/wx/src/common/fs_filter.cpp | 92 - Source/3rdParty/wx/src/common/fs_mem.cpp | 288 - Source/3rdParty/wx/src/common/gaugecmn.cpp | 156 - Source/3rdParty/wx/src/common/gbsizer.cpp | 784 -- Source/3rdParty/wx/src/common/gdicmn.cpp | 871 --- Source/3rdParty/wx/src/common/geometry.cpp | 364 - Source/3rdParty/wx/src/common/gifdecod.cpp | 933 --- Source/3rdParty/wx/src/common/graphcmn.cpp | 776 -- Source/3rdParty/wx/src/common/hash.cpp | 1077 --- Source/3rdParty/wx/src/common/hashmap.cpp | 152 - Source/3rdParty/wx/src/common/helpbase.cpp | 28 - Source/3rdParty/wx/src/common/iconbndl.cpp | 142 - Source/3rdParty/wx/src/common/imagall.cpp | 64 - Source/3rdParty/wx/src/common/imagbmp.cpp | 1383 ---- Source/3rdParty/wx/src/common/image.cpp | 3132 -------- Source/3rdParty/wx/src/common/imagfill.cpp | 325 - Source/3rdParty/wx/src/common/imaggif.cpp | 105 - Source/3rdParty/wx/src/common/imagiff.cpp | 794 -- Source/3rdParty/wx/src/common/imagjpeg.cpp | 480 -- Source/3rdParty/wx/src/common/imagpcx.cpp | 500 -- Source/3rdParty/wx/src/common/imagpng.cpp | 869 --- Source/3rdParty/wx/src/common/imagpnm.cpp | 201 - Source/3rdParty/wx/src/common/imagtga.cpp | 750 -- Source/3rdParty/wx/src/common/imagtiff.cpp | 525 -- Source/3rdParty/wx/src/common/imagxpm.cpp | 224 - Source/3rdParty/wx/src/common/init.cpp | 505 -- Source/3rdParty/wx/src/common/intl.cpp | 3784 --------- Source/3rdParty/wx/src/common/ipcbase.cpp | 87 - Source/3rdParty/wx/src/common/layout.cpp | 1026 --- Source/3rdParty/wx/src/common/lboxcmn.cpp | 147 - Source/3rdParty/wx/src/common/list.cpp | 768 -- Source/3rdParty/wx/src/common/listctrlcmn.cpp | 54 - Source/3rdParty/wx/src/common/log.cpp | 838 -- Source/3rdParty/wx/src/common/longlong.cpp | 1363 ---- Source/3rdParty/wx/src/common/matrix.cpp | 601 -- Source/3rdParty/wx/src/common/memory.cpp | 1148 --- Source/3rdParty/wx/src/common/menucmn.cpp | 1173 --- Source/3rdParty/wx/src/common/mimecmn.cpp | 752 -- Source/3rdParty/wx/src/common/module.cpp | 202 - Source/3rdParty/wx/src/common/msgout.cpp | 222 - Source/3rdParty/wx/src/common/mstream.cpp | 174 - Source/3rdParty/wx/src/common/nbkbase.cpp | 84 - Source/3rdParty/wx/src/common/object.cpp | 390 - Source/3rdParty/wx/src/common/overlaycmn.cpp | 197 - Source/3rdParty/wx/src/common/paper.cpp | 376 - Source/3rdParty/wx/src/common/pickerbase.cpp | 175 - Source/3rdParty/wx/src/common/platinfo.cpp | 336 - Source/3rdParty/wx/src/common/popupcmn.cpp | 623 -- Source/3rdParty/wx/src/common/powercmn.cpp | 59 - Source/3rdParty/wx/src/common/prntbase.cpp | 1869 ----- Source/3rdParty/wx/src/common/process.cpp | 172 - Source/3rdParty/wx/src/common/quantize.cpp | 1654 ---- Source/3rdParty/wx/src/common/radiocmn.cpp | 304 - Source/3rdParty/wx/src/common/regex.cpp | 689 -- Source/3rdParty/wx/src/common/rendcmn.cpp | 208 - Source/3rdParty/wx/src/common/rgncmn.cpp | 192 - Source/3rdParty/wx/src/common/settcmn.cpp | 88 - Source/3rdParty/wx/src/common/sizer.cpp | 2265 ------ Source/3rdParty/wx/src/common/srchcmn.cpp | 42 - Source/3rdParty/wx/src/common/sstream.cpp | 235 - Source/3rdParty/wx/src/common/statbar.cpp | 368 - Source/3rdParty/wx/src/common/stdpbase.cpp | 172 - Source/3rdParty/wx/src/common/stockitem.cpp | 278 - Source/3rdParty/wx/src/common/stopwatch.cpp | 372 - Source/3rdParty/wx/src/common/strconv.cpp | 3742 --------- Source/3rdParty/wx/src/common/stream.cpp | 1388 ---- Source/3rdParty/wx/src/common/string.cpp | 2659 ------- Source/3rdParty/wx/src/common/sysopt.cpp | 111 - Source/3rdParty/wx/src/common/tarstrm.cpp | 1534 ---- Source/3rdParty/wx/src/common/tbarbase.cpp | 746 -- Source/3rdParty/wx/src/common/textbuf.cpp | 284 - Source/3rdParty/wx/src/common/textcmn.cpp | 553 -- Source/3rdParty/wx/src/common/textfile.cpp | 295 - Source/3rdParty/wx/src/common/timercmn.cpp | 88 - Source/3rdParty/wx/src/common/tokenzr.cpp | 229 - Source/3rdParty/wx/src/common/toplvcmn.cpp | 431 -- Source/3rdParty/wx/src/common/treebase.cpp | 239 - Source/3rdParty/wx/src/common/txtstrm.cpp | 520 -- Source/3rdParty/wx/src/common/unictabl.inc | 872 --- Source/3rdParty/wx/src/common/uri.cpp | 1295 ---- Source/3rdParty/wx/src/common/utilscmn.cpp | 1417 ---- Source/3rdParty/wx/src/common/valgen.cpp | 591 -- Source/3rdParty/wx/src/common/validate.cpp | 45 - Source/3rdParty/wx/src/common/valtext.cpp | 344 - Source/3rdParty/wx/src/common/variant.cpp | 2040 ----- Source/3rdParty/wx/src/common/wfstream.cpp | 418 - Source/3rdParty/wx/src/common/wincmn.cpp | 3255 -------- Source/3rdParty/wx/src/common/wxchar.cpp | 2293 ------ Source/3rdParty/wx/src/common/xpmdecod.cpp | 833 -- Source/3rdParty/wx/src/common/xti.cpp | 767 -- Source/3rdParty/wx/src/common/xtistrm.cpp | 847 -- Source/3rdParty/wx/src/common/zipstrm.cpp | 2425 ------ Source/3rdParty/wx/src/common/zstream.cpp | 428 - Source/3rdParty/wx/src/generic/busyinfo.cpp | 135 - Source/3rdParty/wx/src/generic/buttonbar.cpp | 555 -- Source/3rdParty/wx/src/generic/choicbkg.cpp | 332 - Source/3rdParty/wx/src/generic/choicdgg.cpp | 556 -- Source/3rdParty/wx/src/generic/clrpickerg.cpp | 188 - Source/3rdParty/wx/src/generic/collpaneg.cpp | 307 - Source/3rdParty/wx/src/generic/combog.cpp | 489 -- Source/3rdParty/wx/src/generic/dcpsg.cpp | 2262 ------ Source/3rdParty/wx/src/generic/dirctrlg.cpp | 1700 ---- Source/3rdParty/wx/src/generic/dragimgg.cpp | 574 -- .../3rdParty/wx/src/generic/filepickerg.cpp | 86 - .../3rdParty/wx/src/generic/fontpickerg.cpp | 120 - Source/3rdParty/wx/src/generic/graphicc.cpp | 1615 ---- Source/3rdParty/wx/src/generic/listbkg.cpp | 416 - Source/3rdParty/wx/src/generic/logg.cpp | 1229 --- Source/3rdParty/wx/src/generic/msgdlgg.cpp | 159 - Source/3rdParty/wx/src/generic/numdlgg.cpp | 181 - Source/3rdParty/wx/src/generic/panelg.cpp | 180 - Source/3rdParty/wx/src/generic/printps.cpp | 370 - Source/3rdParty/wx/src/generic/prntdlgg.cpp | 1102 --- Source/3rdParty/wx/src/generic/progdlgg.cpp | 673 -- Source/3rdParty/wx/src/generic/renderg.cpp | 678 -- Source/3rdParty/wx/src/generic/scrlwing.cpp | 1542 ---- Source/3rdParty/wx/src/generic/selstore.cpp | 216 - Source/3rdParty/wx/src/generic/spinctlg.cpp | 391 - Source/3rdParty/wx/src/generic/splitter.cpp | 1064 --- Source/3rdParty/wx/src/generic/srchctlg.cpp | 1216 --- Source/3rdParty/wx/src/generic/statusbr.cpp | 488 -- Source/3rdParty/wx/src/generic/textdlgg.cpp | 185 - Source/3rdParty/wx/src/generic/timer.cpp | 283 - Source/3rdParty/wx/src/generic/tipwin.cpp | 380 - Source/3rdParty/wx/src/generic/toolbkg.cpp | 442 -- Source/3rdParty/wx/src/generic/treebkg.cpp | 794 -- Source/3rdParty/wx/src/generic/treectlg.cpp | 3823 --------- Source/3rdParty/wx/src/generic/vlbox.cpp | 653 -- Source/3rdParty/wx/src/generic/vscroll.cpp | 519 -- Source/3rdParty/wx/src/jpeg/README | 385 - Source/3rdParty/wx/src/jpeg/ansi2knr.c | 693 -- Source/3rdParty/wx/src/jpeg/change.log | 217 - Source/3rdParty/wx/src/jpeg/jcapimin.c | 280 - Source/3rdParty/wx/src/jpeg/jcapistd.c | 161 - Source/3rdParty/wx/src/jpeg/jccoefct.c | 449 -- Source/3rdParty/wx/src/jpeg/jccolor.c | 459 -- Source/3rdParty/wx/src/jpeg/jcdctmgr.c | 387 - Source/3rdParty/wx/src/jpeg/jchuff.c | 909 --- Source/3rdParty/wx/src/jpeg/jchuff.h | 47 - Source/3rdParty/wx/src/jpeg/jcinit.c | 72 - Source/3rdParty/wx/src/jpeg/jcmainct.c | 293 - Source/3rdParty/wx/src/jpeg/jcmarker.c | 664 -- Source/3rdParty/wx/src/jpeg/jcmaster.c | 590 -- Source/3rdParty/wx/src/jpeg/jcomapi.c | 106 - Source/3rdParty/wx/src/jpeg/jconfig.h | 109 - Source/3rdParty/wx/src/jpeg/jconfig.vc | 45 - Source/3rdParty/wx/src/jpeg/jcparam.c | 610 -- Source/3rdParty/wx/src/jpeg/jcphuff.c | 833 -- Source/3rdParty/wx/src/jpeg/jcprepct.c | 354 - Source/3rdParty/wx/src/jpeg/jcsample.c | 519 -- Source/3rdParty/wx/src/jpeg/jctrans.c | 402 - Source/3rdParty/wx/src/jpeg/jdapimin.c | 395 - Source/3rdParty/wx/src/jpeg/jdapistd.c | 275 - Source/3rdParty/wx/src/jpeg/jdatadst.c | 151 - Source/3rdParty/wx/src/jpeg/jdatasrc.c | 212 - Source/3rdParty/wx/src/jpeg/jdcoefct.c | 745 -- Source/3rdParty/wx/src/jpeg/jdcolor.c | 410 - Source/3rdParty/wx/src/jpeg/jdct.h | 176 - Source/3rdParty/wx/src/jpeg/jddctmgr.c | 269 - Source/3rdParty/wx/src/jpeg/jdhuff.c | 651 -- Source/3rdParty/wx/src/jpeg/jdhuff.h | 201 - Source/3rdParty/wx/src/jpeg/jdinput.c | 385 - Source/3rdParty/wx/src/jpeg/jdmainct.c | 529 -- Source/3rdParty/wx/src/jpeg/jdmarker.c | 1360 ---- Source/3rdParty/wx/src/jpeg/jdmaster.c | 557 -- Source/3rdParty/wx/src/jpeg/jdmerge.c | 399 - Source/3rdParty/wx/src/jpeg/jdphuff.c | 668 -- Source/3rdParty/wx/src/jpeg/jdpostct.c | 290 - Source/3rdParty/wx/src/jpeg/jdsample.c | 478 -- Source/3rdParty/wx/src/jpeg/jdtrans.c | 143 - Source/3rdParty/wx/src/jpeg/jerror.c | 252 - Source/3rdParty/wx/src/jpeg/jerror.h | 291 - Source/3rdParty/wx/src/jpeg/jfdctflt.c | 168 - Source/3rdParty/wx/src/jpeg/jfdctfst.c | 224 - Source/3rdParty/wx/src/jpeg/jfdctint.c | 283 - Source/3rdParty/wx/src/jpeg/jidctflt.c | 242 - Source/3rdParty/wx/src/jpeg/jidctfst.c | 368 - Source/3rdParty/wx/src/jpeg/jidctint.c | 389 - Source/3rdParty/wx/src/jpeg/jidctred.c | 398 - Source/3rdParty/wx/src/jpeg/jinclude.h | 91 - Source/3rdParty/wx/src/jpeg/jmemansi.c | 167 - Source/3rdParty/wx/src/jpeg/jmemdos.c | 638 -- Source/3rdParty/wx/src/jpeg/jmemmac.c | 289 - Source/3rdParty/wx/src/jpeg/jmemmgr.c | 1118 --- Source/3rdParty/wx/src/jpeg/jmemname.c | 276 - Source/3rdParty/wx/src/jpeg/jmemnobs.c | 109 - Source/3rdParty/wx/src/jpeg/jmemsys.h | 198 - Source/3rdParty/wx/src/jpeg/jmorecfg.h | 420 - Source/3rdParty/wx/src/jpeg/jpeg_CW_Prefix.h | 6 - Source/3rdParty/wx/src/jpeg/jpegint.h | 400 - Source/3rdParty/wx/src/jpeg/jpeglib.h | 1096 --- Source/3rdParty/wx/src/jpeg/jpegtran.c | 504 -- Source/3rdParty/wx/src/jpeg/jquant1.c | 856 -- Source/3rdParty/wx/src/jpeg/jquant2.c | 1310 ---- Source/3rdParty/wx/src/jpeg/jutils.c | 179 - Source/3rdParty/wx/src/jpeg/jversion.h | 14 - Source/3rdParty/wx/src/msw/accel.cpp | 160 - Source/3rdParty/wx/src/msw/app.cpp | 809 -- Source/3rdParty/wx/src/msw/basemsw.cpp | 73 - Source/3rdParty/wx/src/msw/bitmap.cpp | 1809 ----- Source/3rdParty/wx/src/msw/bmpbuttn.cpp | 646 -- Source/3rdParty/wx/src/msw/brush.cpp | 327 - Source/3rdParty/wx/src/msw/button.cpp | 890 --- Source/3rdParty/wx/src/msw/caret.cpp | 188 - Source/3rdParty/wx/src/msw/checkbox.cpp | 588 -- Source/3rdParty/wx/src/msw/checklst.cpp | 546 -- Source/3rdParty/wx/src/msw/choice.cpp | 802 -- Source/3rdParty/wx/src/msw/clipbrd.cpp | 931 --- Source/3rdParty/wx/src/msw/colordlg.cpp | 224 - Source/3rdParty/wx/src/msw/colour.cpp | 90 - Source/3rdParty/wx/src/msw/combo.cpp | 920 --- Source/3rdParty/wx/src/msw/combobox.cpp | 808 -- Source/3rdParty/wx/src/msw/control.cpp | 483 -- Source/3rdParty/wx/src/msw/crashrpt.cpp | 383 - Source/3rdParty/wx/src/msw/cursor.cpp | 407 - Source/3rdParty/wx/src/msw/data.cpp | 18 - Source/3rdParty/wx/src/msw/dc.cpp | 2780 ------- Source/3rdParty/wx/src/msw/dcclient.cpp | 357 - Source/3rdParty/wx/src/msw/dcmemory.cpp | 194 - Source/3rdParty/wx/src/msw/dcprint.cpp | 484 -- Source/3rdParty/wx/src/msw/dcscreen.cpp | 38 - Source/3rdParty/wx/src/msw/dde.cpp | 1095 --- Source/3rdParty/wx/src/msw/debughlp.cpp | 767 -- Source/3rdParty/wx/src/msw/dialog.cpp | 497 -- Source/3rdParty/wx/src/msw/dialup.cpp | 1338 ---- Source/3rdParty/wx/src/msw/dib.cpp | 814 -- Source/3rdParty/wx/src/msw/dir.cpp | 404 - Source/3rdParty/wx/src/msw/dirdlg.cpp | 251 - Source/3rdParty/wx/src/msw/display.cpp | 1047 --- Source/3rdParty/wx/src/msw/dlmsw.cpp | 339 - Source/3rdParty/wx/src/msw/dragimag.cpp | 458 -- Source/3rdParty/wx/src/msw/enhmeta.cpp | 527 -- Source/3rdParty/wx/src/msw/evtloop.cpp | 296 - Source/3rdParty/wx/src/msw/fdrepdlg.cpp | 546 -- Source/3rdParty/wx/src/msw/filedlg.cpp | 572 -- Source/3rdParty/wx/src/msw/font.cpp | 1122 --- Source/3rdParty/wx/src/msw/fontdlg.cpp | 131 - Source/3rdParty/wx/src/msw/fontenum.cpp | 292 - Source/3rdParty/wx/src/msw/fontutil.cpp | 294 - Source/3rdParty/wx/src/msw/frame.cpp | 1163 --- Source/3rdParty/wx/src/msw/gdiimage.cpp | 613 -- Source/3rdParty/wx/src/msw/gdiobj.cpp | 60 - Source/3rdParty/wx/src/msw/graphics.cpp | 1680 ---- Source/3rdParty/wx/src/msw/gsockmsw.cpp | 487 -- Source/3rdParty/wx/src/msw/helpchm.cpp | 252 - Source/3rdParty/wx/src/msw/helpwin.cpp | 126 - Source/3rdParty/wx/src/msw/icon.cpp | 158 - Source/3rdParty/wx/src/msw/imaglist.cpp | 402 - Source/3rdParty/wx/src/msw/iniconf.cpp | 457 -- Source/3rdParty/wx/src/msw/listbox.cpp | 878 --- Source/3rdParty/wx/src/msw/listctrl.cpp | 3237 -------- Source/3rdParty/wx/src/msw/main.cpp | 409 - Source/3rdParty/wx/src/msw/mdi.cpp | 1500 ---- Source/3rdParty/wx/src/msw/menu.cpp | 1397 ---- Source/3rdParty/wx/src/msw/menuitem.cpp | 446 -- Source/3rdParty/wx/src/msw/metafile.cpp | 533 -- Source/3rdParty/wx/src/msw/mimetype.cpp | 850 -- Source/3rdParty/wx/src/msw/minifram.cpp | 25 - Source/3rdParty/wx/src/msw/msgdlg.cpp | 154 - Source/3rdParty/wx/src/msw/mslu.cpp | 248 - Source/3rdParty/wx/src/msw/nativdlg.cpp | 330 - Source/3rdParty/wx/src/msw/notebook.cpp | 1454 ---- Source/3rdParty/wx/src/msw/ole/access.cpp | 2014 ----- Source/3rdParty/wx/src/msw/ole/activex.cpp | 1162 --- Source/3rdParty/wx/src/msw/ole/automtn.cpp | 969 --- Source/3rdParty/wx/src/msw/ole/dataobj.cpp | 1348 ---- Source/3rdParty/wx/src/msw/ole/dropsrc.cpp | 248 - Source/3rdParty/wx/src/msw/ole/droptgt.cpp | 575 -- Source/3rdParty/wx/src/msw/ole/oleutils.cpp | 326 - Source/3rdParty/wx/src/msw/ole/uuid.cpp | 184 - Source/3rdParty/wx/src/msw/ownerdrw.cpp | 487 -- Source/3rdParty/wx/src/msw/palette.cpp | 164 - Source/3rdParty/wx/src/msw/pen.cpp | 387 - Source/3rdParty/wx/src/msw/popupwin.cpp | 113 - Source/3rdParty/wx/src/msw/power.cpp | 112 - Source/3rdParty/wx/src/msw/printdlg.cpp | 1180 --- Source/3rdParty/wx/src/msw/printwin.cpp | 447 -- Source/3rdParty/wx/src/msw/radiobox.cpp | 886 --- Source/3rdParty/wx/src/msw/radiobut.cpp | 349 - Source/3rdParty/wx/src/msw/regconf.cpp | 731 -- Source/3rdParty/wx/src/msw/region.cpp | 468 -- Source/3rdParty/wx/src/msw/registry.cpp | 1428 ---- Source/3rdParty/wx/src/msw/renderer.cpp | 709 -- Source/3rdParty/wx/src/msw/scrolbar.cpp | 342 - Source/3rdParty/wx/src/msw/settings.cpp | 498 -- Source/3rdParty/wx/src/msw/slider95.cpp | 686 -- Source/3rdParty/wx/src/msw/snglinst.cpp | 130 - Source/3rdParty/wx/src/msw/spinbutt.cpp | 340 - Source/3rdParty/wx/src/msw/spinctrl.cpp | 720 -- Source/3rdParty/wx/src/msw/stackwalk.cpp | 414 - Source/3rdParty/wx/src/msw/statbmp.cpp | 345 - Source/3rdParty/wx/src/msw/statbox.cpp | 570 -- Source/3rdParty/wx/src/msw/statbr95.cpp | 417 - Source/3rdParty/wx/src/msw/statline.cpp | 131 - Source/3rdParty/wx/src/msw/stattext.cpp | 222 - Source/3rdParty/wx/src/msw/stdpaths.cpp | 344 - Source/3rdParty/wx/src/msw/tbar95.cpp | 1848 ----- Source/3rdParty/wx/src/msw/textctrl.cpp | 2967 ------- Source/3rdParty/wx/src/msw/tglbtn.cpp | 170 - Source/3rdParty/wx/src/msw/thread.cpp | 1408 ---- Source/3rdParty/wx/src/msw/timer.cpp | 262 - Source/3rdParty/wx/src/msw/tooltip.cpp | 464 -- Source/3rdParty/wx/src/msw/toplevel.cpp | 1287 --- Source/3rdParty/wx/src/msw/treectrl.cpp | 3161 -------- Source/3rdParty/wx/src/msw/utils.cpp | 1580 ---- Source/3rdParty/wx/src/msw/utilsexc.cpp | 1003 --- Source/3rdParty/wx/src/msw/utilsgui.cpp | 503 -- Source/3rdParty/wx/src/msw/uxtheme.cpp | 177 - Source/3rdParty/wx/src/msw/volume.cpp | 608 -- Source/3rdParty/wx/src/msw/window.cpp | 6891 ----------------- Source/3rdParty/wx/src/png/CHANGES | 1373 ---- Source/3rdParty/wx/src/png/README | 260 - Source/3rdParty/wx/src/png/TODO | 24 - Source/3rdParty/wx/src/png/ansi2knr.c | 695 -- Source/3rdParty/wx/src/png/png.c | 826 -- Source/3rdParty/wx/src/png/png.h | 3364 -------- Source/3rdParty/wx/src/png/pngasmrd.h | 11 - Source/3rdParty/wx/src/png/pngconf.h | 1394 ---- Source/3rdParty/wx/src/png/pngerror.c | 295 - Source/3rdParty/wx/src/png/pnggccrd.c | 5408 ------------- Source/3rdParty/wx/src/png/pngget.c | 934 --- Source/3rdParty/wx/src/png/pngmem.c | 595 -- Source/3rdParty/wx/src/png/pngpread.c | 1573 ---- Source/3rdParty/wx/src/png/pngread.c | 1453 ---- Source/3rdParty/wx/src/png/pngrio.c | 161 - Source/3rdParty/wx/src/png/pngrtran.c | 4177 ---------- Source/3rdParty/wx/src/png/pngrutil.c | 3124 -------- Source/3rdParty/wx/src/png/pngset.c | 1219 --- Source/3rdParty/wx/src/png/pngtest.c | 1554 ---- Source/3rdParty/wx/src/png/pngtrans.c | 644 -- Source/3rdParty/wx/src/png/pngvcrd.c | 3903 ---------- Source/3rdParty/wx/src/png/pngwio.c | 228 - Source/3rdParty/wx/src/png/pngwrite.c | 1464 ---- Source/3rdParty/wx/src/png/pngwtran.c | 563 -- Source/3rdParty/wx/src/png/pngwutil.c | 2726 ------- Source/3rdParty/wx/src/regex/regex.h | 337 - Source/3rdParty/wx/src/tiff/libtiff/tiff.h | 651 -- .../3rdParty/wx/src/tiff/libtiff/tiffconf.h | 101 - Source/3rdParty/wx/src/tiff/libtiff/tiffio.h | 515 -- .../3rdParty/wx/src/tiff/libtiff/tiffvers.h | 9 - Source/3rdParty/wx/src/zlib/ChangeLog | 1472 ---- Source/3rdParty/wx/src/zlib/FAQ | 368 - Source/3rdParty/wx/src/zlib/INDEX | 68 - Source/3rdParty/wx/src/zlib/README | 115 - Source/3rdParty/wx/src/zlib/adler32.c | 178 - Source/3rdParty/wx/src/zlib/compress.c | 79 - Source/3rdParty/wx/src/zlib/crc32.c | 424 - Source/3rdParty/wx/src/zlib/crc32.h | 441 -- Source/3rdParty/wx/src/zlib/deflate.c | 1966 ----- Source/3rdParty/wx/src/zlib/deflate.h | 345 - Source/3rdParty/wx/src/zlib/gzclose.c | 25 - Source/3rdParty/wx/src/zlib/gzguts.h | 209 - Source/3rdParty/wx/src/zlib/gzlib.c | 634 -- Source/3rdParty/wx/src/zlib/gzread.c | 594 -- Source/3rdParty/wx/src/zlib/gzwrite.c | 577 -- Source/3rdParty/wx/src/zlib/infback.c | 640 -- Source/3rdParty/wx/src/zlib/inffast.c | 340 - Source/3rdParty/wx/src/zlib/inffast.h | 11 - Source/3rdParty/wx/src/zlib/inffixed.h | 94 - Source/3rdParty/wx/src/zlib/inflate.c | 1512 ---- Source/3rdParty/wx/src/zlib/inflate.h | 122 - Source/3rdParty/wx/src/zlib/inftrees.c | 306 - Source/3rdParty/wx/src/zlib/inftrees.h | 62 - Source/3rdParty/wx/src/zlib/trees.c | 1225 --- Source/3rdParty/wx/src/zlib/trees.h | 128 - Source/3rdParty/wx/src/zlib/uncompr.c | 58 - Source/3rdParty/wx/src/zlib/zconf.h | 510 -- Source/3rdParty/wx/src/zlib/zlib.3 | 151 - Source/3rdParty/wx/src/zlib/zlib.h | 1768 ----- Source/3rdParty/wx/src/zlib/zlib.map | 83 - Source/3rdParty/wx/src/zlib/zlib.pc.in | 13 - Source/3rdParty/wx/src/zlib/zutil.c | 323 - Source/3rdParty/wx/src/zlib/zutil.h | 252 - Source/3rdParty/wx/wx_base.vcproj | 1367 ---- Source/3rdParty/wx/wx_base.vcxproj | 347 - Source/3rdParty/wx/wx_base.vcxproj.filters | 811 -- Source/3rdParty/wx/wx_core.vcproj | 4241 ---------- Source/3rdParty/wx/wx_core.vcxproj | 518 -- Source/3rdParty/wx/wx_core.vcxproj.filters | 1310 ---- Source/3rdParty/wx/wx_wxjpeg.vcproj | 325 - Source/3rdParty/wx/wx_wxjpeg.vcxproj | 95 - Source/3rdParty/wx/wx_wxjpeg.vcxproj.filters | 148 - Source/3rdParty/wx/wx_wxpng.vcproj | 202 - Source/3rdParty/wx/wx_wxpng.vcxproj | 64 - Source/3rdParty/wx/wx_wxpng.vcxproj.filters | 55 - Source/3rdParty/wx/wx_wxzlib.vcproj | 198 - Source/3rdParty/wx/wx_wxzlib.vcxproj | 76 - Source/3rdParty/wx/wx_wxzlib.vcxproj.filters | 90 - Source/Glide64/Glide64.vcxproj | 20 - 942 files changed, 7 insertions(+), 416172 deletions(-) delete mode 100644 Source/3rdParty/wx/art/addbookm.xpm delete mode 100644 Source/3rdParty/wx/art/back.xpm delete mode 100644 Source/3rdParty/wx/art/cdrom.xpm delete mode 100644 Source/3rdParty/wx/art/close.xpm delete mode 100644 Source/3rdParty/wx/art/copy.xpm delete mode 100644 Source/3rdParty/wx/art/cross.xpm delete mode 100644 Source/3rdParty/wx/art/cut.xpm delete mode 100644 Source/3rdParty/wx/art/deffile.xpm delete mode 100644 Source/3rdParty/wx/art/delbookm.xpm delete mode 100644 Source/3rdParty/wx/art/delete.xpm delete mode 100644 Source/3rdParty/wx/art/dir_up.xpm delete mode 100644 Source/3rdParty/wx/art/down.xpm delete mode 100644 Source/3rdParty/wx/art/exefile.xpm delete mode 100644 Source/3rdParty/wx/art/fileopen.xpm delete mode 100644 Source/3rdParty/wx/art/filesave.xpm delete mode 100644 Source/3rdParty/wx/art/filesaveas.xpm delete mode 100644 Source/3rdParty/wx/art/find.xpm delete mode 100644 Source/3rdParty/wx/art/findrepl.xpm delete mode 100644 Source/3rdParty/wx/art/first.xpm delete mode 100644 Source/3rdParty/wx/art/floppy.xpm delete mode 100644 Source/3rdParty/wx/art/folder.xpm delete mode 100644 Source/3rdParty/wx/art/folder_open.xpm delete mode 100644 Source/3rdParty/wx/art/forward.xpm delete mode 100644 Source/3rdParty/wx/art/harddisk.xpm delete mode 100644 Source/3rdParty/wx/art/helpicon.xpm delete mode 100644 Source/3rdParty/wx/art/home.xpm delete mode 100644 Source/3rdParty/wx/art/htmbook.xpm delete mode 100644 Source/3rdParty/wx/art/htmfoldr.xpm delete mode 100644 Source/3rdParty/wx/art/htmoptns.xpm delete mode 100644 Source/3rdParty/wx/art/htmpage.xpm delete mode 100644 Source/3rdParty/wx/art/htmsidep.xpm delete mode 100644 Source/3rdParty/wx/art/last.xpm delete mode 100644 Source/3rdParty/wx/art/listview.xpm delete mode 100644 Source/3rdParty/wx/art/minus.xpm delete mode 100644 Source/3rdParty/wx/art/missimg.xpm delete mode 100644 Source/3rdParty/wx/art/new.xpm delete mode 100644 Source/3rdParty/wx/art/new_dir.xpm delete mode 100644 Source/3rdParty/wx/art/paste.xpm delete mode 100644 Source/3rdParty/wx/art/plus.xpm delete mode 100644 Source/3rdParty/wx/art/print.xpm delete mode 100644 Source/3rdParty/wx/art/quit.xpm delete mode 100644 Source/3rdParty/wx/art/redo.xpm delete mode 100644 Source/3rdParty/wx/art/removable.xpm delete mode 100644 Source/3rdParty/wx/art/repview.xpm delete mode 100644 Source/3rdParty/wx/art/tango/application_x_executable.h delete mode 100644 Source/3rdParty/wx/art/tango/dialog_error.h delete mode 100644 Source/3rdParty/wx/art/tango/dialog_information.h delete mode 100644 Source/3rdParty/wx/art/tango/dialog_warning.h delete mode 100644 Source/3rdParty/wx/art/tango/document_new.h delete mode 100644 Source/3rdParty/wx/art/tango/document_open.h delete mode 100644 Source/3rdParty/wx/art/tango/document_print.h delete mode 100644 Source/3rdParty/wx/art/tango/document_save.h delete mode 100644 Source/3rdParty/wx/art/tango/document_save_as.h delete mode 100644 Source/3rdParty/wx/art/tango/drive_harddisk.h delete mode 100644 Source/3rdParty/wx/art/tango/drive_optical.h delete mode 100644 Source/3rdParty/wx/art/tango/drive_removable_media.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_copy.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_cut.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_delete.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_find.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_find_replace.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_paste.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_redo.h delete mode 100644 Source/3rdParty/wx/art/tango/edit_undo.h delete mode 100644 Source/3rdParty/wx/art/tango/folder.h delete mode 100644 Source/3rdParty/wx/art/tango/folder_new.h delete mode 100644 Source/3rdParty/wx/art/tango/folder_open.h delete mode 100644 Source/3rdParty/wx/art/tango/go_down.h delete mode 100644 Source/3rdParty/wx/art/tango/go_first.h delete mode 100644 Source/3rdParty/wx/art/tango/go_home.h delete mode 100644 Source/3rdParty/wx/art/tango/go_last.h delete mode 100644 Source/3rdParty/wx/art/tango/go_next.h delete mode 100644 Source/3rdParty/wx/art/tango/go_previous.h delete mode 100644 Source/3rdParty/wx/art/tango/go_up.h delete mode 100644 Source/3rdParty/wx/art/tango/image_missing.h delete mode 100644 Source/3rdParty/wx/art/tango/list_add.h delete mode 100644 Source/3rdParty/wx/art/tango/list_remove.h delete mode 100644 Source/3rdParty/wx/art/tango/text_x_generic.h delete mode 100644 Source/3rdParty/wx/art/tick.xpm delete mode 100644 Source/3rdParty/wx/art/tipicon.xpm delete mode 100644 Source/3rdParty/wx/art/toparent.xpm delete mode 100644 Source/3rdParty/wx/art/undo.xpm delete mode 100644 Source/3rdParty/wx/art/up.xpm delete mode 100644 Source/3rdParty/wx/include/msvc/wx/setup.h delete mode 100644 Source/3rdParty/wx/include/wx/accel.h delete mode 100644 Source/3rdParty/wx/include/wx/afterstd.h delete mode 100644 Source/3rdParty/wx/include/wx/anidecod.h delete mode 100644 Source/3rdParty/wx/include/wx/animdecod.h delete mode 100644 Source/3rdParty/wx/include/wx/app.h delete mode 100644 Source/3rdParty/wx/include/wx/apptrait.h delete mode 100644 Source/3rdParty/wx/include/wx/archive.h delete mode 100644 Source/3rdParty/wx/include/wx/arrimpl.cpp delete mode 100644 Source/3rdParty/wx/include/wx/arrstr.h delete mode 100644 Source/3rdParty/wx/include/wx/artprov.h delete mode 100644 Source/3rdParty/wx/include/wx/beforestd.h delete mode 100644 Source/3rdParty/wx/include/wx/bitmap.h delete mode 100644 Source/3rdParty/wx/include/wx/bmpbuttn.h delete mode 100644 Source/3rdParty/wx/include/wx/bookctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/brush.h delete mode 100644 Source/3rdParty/wx/include/wx/buffer.h delete mode 100644 Source/3rdParty/wx/include/wx/build.h delete mode 100644 Source/3rdParty/wx/include/wx/busyinfo.h delete mode 100644 Source/3rdParty/wx/include/wx/button.h delete mode 100644 Source/3rdParty/wx/include/wx/caret.h delete mode 100644 Source/3rdParty/wx/include/wx/checkbox.h delete mode 100644 Source/3rdParty/wx/include/wx/checklst.h delete mode 100644 Source/3rdParty/wx/include/wx/chkconf.h delete mode 100644 Source/3rdParty/wx/include/wx/choicdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/choice.h delete mode 100644 Source/3rdParty/wx/include/wx/choicebk.h delete mode 100644 Source/3rdParty/wx/include/wx/clipbrd.h delete mode 100644 Source/3rdParty/wx/include/wx/clntdata.h delete mode 100644 Source/3rdParty/wx/include/wx/clrpicker.h delete mode 100644 Source/3rdParty/wx/include/wx/cmdline.h delete mode 100644 Source/3rdParty/wx/include/wx/cmdproc.h delete mode 100644 Source/3rdParty/wx/include/wx/cmndata.h delete mode 100644 Source/3rdParty/wx/include/wx/collpane.h delete mode 100644 Source/3rdParty/wx/include/wx/colordlg.h delete mode 100644 Source/3rdParty/wx/include/wx/colour.h delete mode 100644 Source/3rdParty/wx/include/wx/combo.h delete mode 100644 Source/3rdParty/wx/include/wx/combobox.h delete mode 100644 Source/3rdParty/wx/include/wx/confbase.h delete mode 100644 Source/3rdParty/wx/include/wx/config.h delete mode 100644 Source/3rdParty/wx/include/wx/containr.h delete mode 100644 Source/3rdParty/wx/include/wx/control.h delete mode 100644 Source/3rdParty/wx/include/wx/convauto.h delete mode 100644 Source/3rdParty/wx/include/wx/cpp.h delete mode 100644 Source/3rdParty/wx/include/wx/cshelp.h delete mode 100644 Source/3rdParty/wx/include/wx/ctrlsub.h delete mode 100644 Source/3rdParty/wx/include/wx/cursor.h delete mode 100644 Source/3rdParty/wx/include/wx/dataobj.h delete mode 100644 Source/3rdParty/wx/include/wx/datetime.h delete mode 100644 Source/3rdParty/wx/include/wx/datstrm.h delete mode 100644 Source/3rdParty/wx/include/wx/dc.h delete mode 100644 Source/3rdParty/wx/include/wx/dcbuffer.h delete mode 100644 Source/3rdParty/wx/include/wx/dcclient.h delete mode 100644 Source/3rdParty/wx/include/wx/dcgraph.h delete mode 100644 Source/3rdParty/wx/include/wx/dcmemory.h delete mode 100644 Source/3rdParty/wx/include/wx/dcmirror.h delete mode 100644 Source/3rdParty/wx/include/wx/dcprint.h delete mode 100644 Source/3rdParty/wx/include/wx/dcscreen.h delete mode 100644 Source/3rdParty/wx/include/wx/dde.h delete mode 100644 Source/3rdParty/wx/include/wx/debug.h delete mode 100644 Source/3rdParty/wx/include/wx/defs.h delete mode 100644 Source/3rdParty/wx/include/wx/dialog.h delete mode 100644 Source/3rdParty/wx/include/wx/dialup.h delete mode 100644 Source/3rdParty/wx/include/wx/dir.h delete mode 100644 Source/3rdParty/wx/include/wx/dirdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/display.h delete mode 100644 Source/3rdParty/wx/include/wx/display_impl.h delete mode 100644 Source/3rdParty/wx/include/wx/dlimpexp.h delete mode 100644 Source/3rdParty/wx/include/wx/dnd.h delete mode 100644 Source/3rdParty/wx/include/wx/docmdi.h delete mode 100644 Source/3rdParty/wx/include/wx/docview.h delete mode 100644 Source/3rdParty/wx/include/wx/dynarray.h delete mode 100644 Source/3rdParty/wx/include/wx/dynlib.h delete mode 100644 Source/3rdParty/wx/include/wx/dynload.h delete mode 100644 Source/3rdParty/wx/include/wx/effects.h delete mode 100644 Source/3rdParty/wx/include/wx/encconv.h delete mode 100644 Source/3rdParty/wx/include/wx/encinfo.h delete mode 100644 Source/3rdParty/wx/include/wx/event.h delete mode 100644 Source/3rdParty/wx/include/wx/evtloop.h delete mode 100644 Source/3rdParty/wx/include/wx/except.h delete mode 100644 Source/3rdParty/wx/include/wx/fdrepdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/features.h delete mode 100644 Source/3rdParty/wx/include/wx/ffile.h delete mode 100644 Source/3rdParty/wx/include/wx/file.h delete mode 100644 Source/3rdParty/wx/include/wx/fileconf.h delete mode 100644 Source/3rdParty/wx/include/wx/filedlg.h delete mode 100644 Source/3rdParty/wx/include/wx/filefn.h delete mode 100644 Source/3rdParty/wx/include/wx/filename.h delete mode 100644 Source/3rdParty/wx/include/wx/filepicker.h delete mode 100644 Source/3rdParty/wx/include/wx/filesys.h delete mode 100644 Source/3rdParty/wx/include/wx/flags.h delete mode 100644 Source/3rdParty/wx/include/wx/fmappriv.h delete mode 100644 Source/3rdParty/wx/include/wx/font.h delete mode 100644 Source/3rdParty/wx/include/wx/fontdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/fontenc.h delete mode 100644 Source/3rdParty/wx/include/wx/fontenum.h delete mode 100644 Source/3rdParty/wx/include/wx/fontmap.h delete mode 100644 Source/3rdParty/wx/include/wx/fontpicker.h delete mode 100644 Source/3rdParty/wx/include/wx/fontutil.h delete mode 100644 Source/3rdParty/wx/include/wx/frame.h delete mode 100644 Source/3rdParty/wx/include/wx/fs_arc.h delete mode 100644 Source/3rdParty/wx/include/wx/fs_filter.h delete mode 100644 Source/3rdParty/wx/include/wx/fs_mem.h delete mode 100644 Source/3rdParty/wx/include/wx/gauge.h delete mode 100644 Source/3rdParty/wx/include/wx/gbsizer.h delete mode 100644 Source/3rdParty/wx/include/wx/gdicmn.h delete mode 100644 Source/3rdParty/wx/include/wx/gdiobj.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/busyinfo.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/choicdgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/clrpickerg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/collpaneg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/combo.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/dirctrlg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/dragimgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/filepickerg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/fontpickerg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/logg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/msgdlgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/notebook.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/numdlgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/panelg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/prntdlgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/progdlgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/scrolwin.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/spinctlg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/splitter.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/srchctlg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/statline.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/statusbr.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/textdlgg.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/timer.h delete mode 100644 Source/3rdParty/wx/include/wx/generic/treectlg.h delete mode 100644 Source/3rdParty/wx/include/wx/geometry.h delete mode 100644 Source/3rdParty/wx/include/wx/gifdecod.h delete mode 100644 Source/3rdParty/wx/include/wx/graphics.h delete mode 100644 Source/3rdParty/wx/include/wx/gsocket.h delete mode 100644 Source/3rdParty/wx/include/wx/hash.h delete mode 100644 Source/3rdParty/wx/include/wx/hashmap.h delete mode 100644 Source/3rdParty/wx/include/wx/hashset.h delete mode 100644 Source/3rdParty/wx/include/wx/help.h delete mode 100644 Source/3rdParty/wx/include/wx/helpbase.h delete mode 100644 Source/3rdParty/wx/include/wx/icon.h delete mode 100644 Source/3rdParty/wx/include/wx/iconbndl.h delete mode 100644 Source/3rdParty/wx/include/wx/iconloc.h delete mode 100644 Source/3rdParty/wx/include/wx/imagbmp.h delete mode 100644 Source/3rdParty/wx/include/wx/image.h delete mode 100644 Source/3rdParty/wx/include/wx/imaggif.h delete mode 100644 Source/3rdParty/wx/include/wx/imagiff.h delete mode 100644 Source/3rdParty/wx/include/wx/imagjpeg.h delete mode 100644 Source/3rdParty/wx/include/wx/imaglist.h delete mode 100644 Source/3rdParty/wx/include/wx/imagpcx.h delete mode 100644 Source/3rdParty/wx/include/wx/imagpng.h delete mode 100644 Source/3rdParty/wx/include/wx/imagpnm.h delete mode 100644 Source/3rdParty/wx/include/wx/imagtga.h delete mode 100644 Source/3rdParty/wx/include/wx/imagtiff.h delete mode 100644 Source/3rdParty/wx/include/wx/imagxpm.h delete mode 100644 Source/3rdParty/wx/include/wx/init.h delete mode 100644 Source/3rdParty/wx/include/wx/intl.h delete mode 100644 Source/3rdParty/wx/include/wx/iosfwrap.h delete mode 100644 Source/3rdParty/wx/include/wx/ioswrap.h delete mode 100644 Source/3rdParty/wx/include/wx/ipcbase.h delete mode 100644 Source/3rdParty/wx/include/wx/layout.h delete mode 100644 Source/3rdParty/wx/include/wx/list.h delete mode 100644 Source/3rdParty/wx/include/wx/listbase.h delete mode 100644 Source/3rdParty/wx/include/wx/listbook.h delete mode 100644 Source/3rdParty/wx/include/wx/listbox.h delete mode 100644 Source/3rdParty/wx/include/wx/listctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/listimpl.cpp delete mode 100644 Source/3rdParty/wx/include/wx/log.h delete mode 100644 Source/3rdParty/wx/include/wx/longlong.h delete mode 100644 Source/3rdParty/wx/include/wx/math.h delete mode 100644 Source/3rdParty/wx/include/wx/matrix.h delete mode 100644 Source/3rdParty/wx/include/wx/mdi.h delete mode 100644 Source/3rdParty/wx/include/wx/memconf.h delete mode 100644 Source/3rdParty/wx/include/wx/memory.h delete mode 100644 Source/3rdParty/wx/include/wx/memtext.h delete mode 100644 Source/3rdParty/wx/include/wx/menu.h delete mode 100644 Source/3rdParty/wx/include/wx/menuitem.h delete mode 100644 Source/3rdParty/wx/include/wx/metafile.h delete mode 100644 Source/3rdParty/wx/include/wx/mimetype.h delete mode 100644 Source/3rdParty/wx/include/wx/minifram.h delete mode 100644 Source/3rdParty/wx/include/wx/module.h delete mode 100644 Source/3rdParty/wx/include/wx/msgdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msgout.h delete mode 100644 Source/3rdParty/wx/include/wx/mstream.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/accel.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/app.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/apptbase.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/apptrait.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/bitmap.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/bmpbuttn.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/brush.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/button.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/caret.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/checkbox.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/checklst.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/chkconf.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/choice.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/clipbrd.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/colordlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/colour.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/combo.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/combobox.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/control.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/crashrpt.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/cursor.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dc.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dcclient.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dcmemory.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dcprint.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dcscreen.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dde.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/debughlp.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dialog.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dib.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dirdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/dragimag.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/enhmeta.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/evtloop.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/fdrepdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/filedlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/font.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/fontdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/frame.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/gauge95.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/gccpriv.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/gdiimage.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/genrcdefs.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/gsockmsw.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/helpchm.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/helpwin.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/htmlhelp.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/icon.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/imaglist.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/iniconf.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/libraries.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/listbox.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/listctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/mdi.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/menu.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/menuitem.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/mimetype.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/minifram.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/missing.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/msgdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/mslu.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/msvcrt.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/notebook.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/activex.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/automtn.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/dataform.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/dataobj.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/dataobj2.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/dropsrc.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/droptgt.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/oleutils.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/ole/uuid.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/palette.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/pen.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/popupwin.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/printdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/printwin.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/private.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/radiobox.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/radiobut.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/regconf.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/region.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/registry.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/scrolbar.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/seh.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/setup.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/slider95.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/spinbutt.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/spinctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/stackwalk.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/statbmp.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/statbox.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/statbr95.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/statline.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/stattext.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/stdpaths.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/subwin.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/tbar95.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/textctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/tglbtn.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/timer.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/tooltip.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/toplevel.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/treectrl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/uxtheme.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/uxthemep.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/window.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/winundef.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/wrapcctl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/wrapcdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/wrapshl.h delete mode 100644 Source/3rdParty/wx/include/wx/msw/wrapwin.h delete mode 100644 Source/3rdParty/wx/include/wx/notebook.h delete mode 100644 Source/3rdParty/wx/include/wx/numdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/object.h delete mode 100644 Source/3rdParty/wx/include/wx/overlay.h delete mode 100644 Source/3rdParty/wx/include/wx/ownerdrw.h delete mode 100644 Source/3rdParty/wx/include/wx/palette.h delete mode 100644 Source/3rdParty/wx/include/wx/panel.h delete mode 100644 Source/3rdParty/wx/include/wx/paper.h delete mode 100644 Source/3rdParty/wx/include/wx/pen.h delete mode 100644 Source/3rdParty/wx/include/wx/pickerbase.h delete mode 100644 Source/3rdParty/wx/include/wx/platform.h delete mode 100644 Source/3rdParty/wx/include/wx/platinfo.h delete mode 100644 Source/3rdParty/wx/include/wx/popupwin.h delete mode 100644 Source/3rdParty/wx/include/wx/power.h delete mode 100644 Source/3rdParty/wx/include/wx/print.h delete mode 100644 Source/3rdParty/wx/include/wx/printdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/private/browserhack28.h delete mode 100644 Source/3rdParty/wx/include/wx/private/fileback.h delete mode 100644 Source/3rdParty/wx/include/wx/private/filename.h delete mode 100644 Source/3rdParty/wx/include/wx/private/overlay.h delete mode 100644 Source/3rdParty/wx/include/wx/prntbase.h delete mode 100644 Source/3rdParty/wx/include/wx/process.h delete mode 100644 Source/3rdParty/wx/include/wx/progdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/ptr_scpd.h delete mode 100644 Source/3rdParty/wx/include/wx/quantize.h delete mode 100644 Source/3rdParty/wx/include/wx/radiobox.h delete mode 100644 Source/3rdParty/wx/include/wx/radiobut.h delete mode 100644 Source/3rdParty/wx/include/wx/rawbmp.h delete mode 100644 Source/3rdParty/wx/include/wx/recguard.h delete mode 100644 Source/3rdParty/wx/include/wx/regex.h delete mode 100644 Source/3rdParty/wx/include/wx/region.h delete mode 100644 Source/3rdParty/wx/include/wx/renderer.h delete mode 100644 Source/3rdParty/wx/include/wx/scopeguard.h delete mode 100644 Source/3rdParty/wx/include/wx/scrolbar.h delete mode 100644 Source/3rdParty/wx/include/wx/scrolwin.h delete mode 100644 Source/3rdParty/wx/include/wx/selstore.h delete mode 100644 Source/3rdParty/wx/include/wx/settings.h delete mode 100644 Source/3rdParty/wx/include/wx/sizer.h delete mode 100644 Source/3rdParty/wx/include/wx/slider.h delete mode 100644 Source/3rdParty/wx/include/wx/snglinst.h delete mode 100644 Source/3rdParty/wx/include/wx/spinbutt.h delete mode 100644 Source/3rdParty/wx/include/wx/spinctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/splitter.h delete mode 100644 Source/3rdParty/wx/include/wx/srchctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/sstream.h delete mode 100644 Source/3rdParty/wx/include/wx/stack.h delete mode 100644 Source/3rdParty/wx/include/wx/stackwalk.h delete mode 100644 Source/3rdParty/wx/include/wx/statbmp.h delete mode 100644 Source/3rdParty/wx/include/wx/statbox.h delete mode 100644 Source/3rdParty/wx/include/wx/statline.h delete mode 100644 Source/3rdParty/wx/include/wx/stattext.h delete mode 100644 Source/3rdParty/wx/include/wx/statusbr.h delete mode 100644 Source/3rdParty/wx/include/wx/stdpaths.h delete mode 100644 Source/3rdParty/wx/include/wx/stockitem.h delete mode 100644 Source/3rdParty/wx/include/wx/stopwatch.h delete mode 100644 Source/3rdParty/wx/include/wx/strconv.h delete mode 100644 Source/3rdParty/wx/include/wx/stream.h delete mode 100644 Source/3rdParty/wx/include/wx/string.h delete mode 100644 Source/3rdParty/wx/include/wx/sysopt.h delete mode 100644 Source/3rdParty/wx/include/wx/tarstrm.h delete mode 100644 Source/3rdParty/wx/include/wx/tbarbase.h delete mode 100644 Source/3rdParty/wx/include/wx/textbuf.h delete mode 100644 Source/3rdParty/wx/include/wx/textctrl.h delete mode 100644 Source/3rdParty/wx/include/wx/textdlg.h delete mode 100644 Source/3rdParty/wx/include/wx/textfile.h delete mode 100644 Source/3rdParty/wx/include/wx/tglbtn.h delete mode 100644 Source/3rdParty/wx/include/wx/thread.h delete mode 100644 Source/3rdParty/wx/include/wx/thrimpl.cpp delete mode 100644 Source/3rdParty/wx/include/wx/timer.h delete mode 100644 Source/3rdParty/wx/include/wx/tipwin.h delete mode 100644 Source/3rdParty/wx/include/wx/tokenzr.h delete mode 100644 Source/3rdParty/wx/include/wx/toolbar.h delete mode 100644 Source/3rdParty/wx/include/wx/toolbook.h delete mode 100644 Source/3rdParty/wx/include/wx/tooltip.h delete mode 100644 Source/3rdParty/wx/include/wx/toplevel.h delete mode 100644 Source/3rdParty/wx/include/wx/treebase.h delete mode 100644 Source/3rdParty/wx/include/wx/treebook.h delete mode 100644 Source/3rdParty/wx/include/wx/treectrl.h delete mode 100644 Source/3rdParty/wx/include/wx/txtstrm.h delete mode 100644 Source/3rdParty/wx/include/wx/uri.h delete mode 100644 Source/3rdParty/wx/include/wx/utils.h delete mode 100644 Source/3rdParty/wx/include/wx/valgen.h delete mode 100644 Source/3rdParty/wx/include/wx/validate.h delete mode 100644 Source/3rdParty/wx/include/wx/valtext.h delete mode 100644 Source/3rdParty/wx/include/wx/variant.h delete mode 100644 Source/3rdParty/wx/include/wx/vector.h delete mode 100644 Source/3rdParty/wx/include/wx/version.h delete mode 100644 Source/3rdParty/wx/include/wx/vidmode.h delete mode 100644 Source/3rdParty/wx/include/wx/vlbox.h delete mode 100644 Source/3rdParty/wx/include/wx/volume.h delete mode 100644 Source/3rdParty/wx/include/wx/vscroll.h delete mode 100644 Source/3rdParty/wx/include/wx/wfstream.h delete mode 100644 Source/3rdParty/wx/include/wx/window.h delete mode 100644 Source/3rdParty/wx/include/wx/wupdlock.h delete mode 100644 Source/3rdParty/wx/include/wx/wx.h delete mode 100644 Source/3rdParty/wx/include/wx/wxchar.h delete mode 100644 Source/3rdParty/wx/include/wx/wxprec.h delete mode 100644 Source/3rdParty/wx/include/wx/xpmdecod.h delete mode 100644 Source/3rdParty/wx/include/wx/xti.h delete mode 100644 Source/3rdParty/wx/include/wx/zipstrm.h delete mode 100644 Source/3rdParty/wx/include/wx/zstream.h delete mode 100644 Source/3rdParty/wx/lib/vc_lib/msw/wx/msw/rcdefs.h delete mode 100644 Source/3rdParty/wx/src/common/accesscmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/anidecod.cpp delete mode 100644 Source/3rdParty/wx/src/common/appbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/appcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/arcall.cpp delete mode 100644 Source/3rdParty/wx/src/common/arcfind.cpp delete mode 100644 Source/3rdParty/wx/src/common/archive.cpp delete mode 100644 Source/3rdParty/wx/src/common/artprov.cpp delete mode 100644 Source/3rdParty/wx/src/common/artstd.cpp delete mode 100644 Source/3rdParty/wx/src/common/bmpbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/bookctrl.cpp delete mode 100644 Source/3rdParty/wx/src/common/choiccmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/clipcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/clntdata.cpp delete mode 100644 Source/3rdParty/wx/src/common/clrpickercmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/cmdline.cpp delete mode 100644 Source/3rdParty/wx/src/common/cmdproc.cpp delete mode 100644 Source/3rdParty/wx/src/common/cmndata.cpp delete mode 100644 Source/3rdParty/wx/src/common/colourcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/combocmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/config.cpp delete mode 100644 Source/3rdParty/wx/src/common/containr.cpp delete mode 100644 Source/3rdParty/wx/src/common/convauto.cpp delete mode 100644 Source/3rdParty/wx/src/common/cshelp.cpp delete mode 100644 Source/3rdParty/wx/src/common/ctrlcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/ctrlsub.cpp delete mode 100644 Source/3rdParty/wx/src/common/datacmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/datetime.cpp delete mode 100644 Source/3rdParty/wx/src/common/datstrm.cpp delete mode 100644 Source/3rdParty/wx/src/common/dcbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/dcbufcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/dcgraph.cpp delete mode 100644 Source/3rdParty/wx/src/common/dircmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/dlgcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/dndcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/dobjcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/docmdi.cpp delete mode 100644 Source/3rdParty/wx/src/common/docview.cpp delete mode 100644 Source/3rdParty/wx/src/common/dpycmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/dseldlg.cpp delete mode 100644 Source/3rdParty/wx/src/common/dummy.cpp delete mode 100644 Source/3rdParty/wx/src/common/dynarray.cpp delete mode 100644 Source/3rdParty/wx/src/common/dynlib.cpp delete mode 100644 Source/3rdParty/wx/src/common/dynload.cpp delete mode 100644 Source/3rdParty/wx/src/common/effects.cpp delete mode 100644 Source/3rdParty/wx/src/common/encconv.cpp delete mode 100644 Source/3rdParty/wx/src/common/event.cpp delete mode 100644 Source/3rdParty/wx/src/common/evtloopcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/execcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/extended.c delete mode 100644 Source/3rdParty/wx/src/common/fddlgcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/ffile.cpp delete mode 100644 Source/3rdParty/wx/src/common/file.cpp delete mode 100644 Source/3rdParty/wx/src/common/fileback.cpp delete mode 100644 Source/3rdParty/wx/src/common/fileconf.cpp delete mode 100644 Source/3rdParty/wx/src/common/filefn.cpp delete mode 100644 Source/3rdParty/wx/src/common/filename.cpp delete mode 100644 Source/3rdParty/wx/src/common/filepickercmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/filesys.cpp delete mode 100644 Source/3rdParty/wx/src/common/filtall.cpp delete mode 100644 Source/3rdParty/wx/src/common/filtfind.cpp delete mode 100644 Source/3rdParty/wx/src/common/fldlgcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/fmapbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/fontcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/fontenumcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/fontmap.cpp delete mode 100644 Source/3rdParty/wx/src/common/fontpickercmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/framecmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/fs_arc.cpp delete mode 100644 Source/3rdParty/wx/src/common/fs_filter.cpp delete mode 100644 Source/3rdParty/wx/src/common/fs_mem.cpp delete mode 100644 Source/3rdParty/wx/src/common/gaugecmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/gbsizer.cpp delete mode 100644 Source/3rdParty/wx/src/common/gdicmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/geometry.cpp delete mode 100644 Source/3rdParty/wx/src/common/gifdecod.cpp delete mode 100644 Source/3rdParty/wx/src/common/graphcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/hash.cpp delete mode 100644 Source/3rdParty/wx/src/common/hashmap.cpp delete mode 100644 Source/3rdParty/wx/src/common/helpbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/iconbndl.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagall.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagbmp.cpp delete mode 100644 Source/3rdParty/wx/src/common/image.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagfill.cpp delete mode 100644 Source/3rdParty/wx/src/common/imaggif.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagiff.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagjpeg.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagpcx.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagpng.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagpnm.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagtga.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagtiff.cpp delete mode 100644 Source/3rdParty/wx/src/common/imagxpm.cpp delete mode 100644 Source/3rdParty/wx/src/common/init.cpp delete mode 100644 Source/3rdParty/wx/src/common/intl.cpp delete mode 100644 Source/3rdParty/wx/src/common/ipcbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/layout.cpp delete mode 100644 Source/3rdParty/wx/src/common/lboxcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/list.cpp delete mode 100644 Source/3rdParty/wx/src/common/listctrlcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/log.cpp delete mode 100644 Source/3rdParty/wx/src/common/longlong.cpp delete mode 100644 Source/3rdParty/wx/src/common/matrix.cpp delete mode 100644 Source/3rdParty/wx/src/common/memory.cpp delete mode 100644 Source/3rdParty/wx/src/common/menucmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/mimecmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/module.cpp delete mode 100644 Source/3rdParty/wx/src/common/msgout.cpp delete mode 100644 Source/3rdParty/wx/src/common/mstream.cpp delete mode 100644 Source/3rdParty/wx/src/common/nbkbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/object.cpp delete mode 100644 Source/3rdParty/wx/src/common/overlaycmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/paper.cpp delete mode 100644 Source/3rdParty/wx/src/common/pickerbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/platinfo.cpp delete mode 100644 Source/3rdParty/wx/src/common/popupcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/powercmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/prntbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/process.cpp delete mode 100644 Source/3rdParty/wx/src/common/quantize.cpp delete mode 100644 Source/3rdParty/wx/src/common/radiocmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/regex.cpp delete mode 100644 Source/3rdParty/wx/src/common/rendcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/rgncmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/settcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/sizer.cpp delete mode 100644 Source/3rdParty/wx/src/common/srchcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/sstream.cpp delete mode 100644 Source/3rdParty/wx/src/common/statbar.cpp delete mode 100644 Source/3rdParty/wx/src/common/stdpbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/stockitem.cpp delete mode 100644 Source/3rdParty/wx/src/common/stopwatch.cpp delete mode 100644 Source/3rdParty/wx/src/common/strconv.cpp delete mode 100644 Source/3rdParty/wx/src/common/stream.cpp delete mode 100644 Source/3rdParty/wx/src/common/string.cpp delete mode 100644 Source/3rdParty/wx/src/common/sysopt.cpp delete mode 100644 Source/3rdParty/wx/src/common/tarstrm.cpp delete mode 100644 Source/3rdParty/wx/src/common/tbarbase.cpp delete mode 100644 Source/3rdParty/wx/src/common/textbuf.cpp delete mode 100644 Source/3rdParty/wx/src/common/textcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/textfile.cpp delete mode 100644 Source/3rdParty/wx/src/common/timercmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/tokenzr.cpp delete mode 100644 Source/3rdParty/wx/src/common/toplvcmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/treebase.cpp delete mode 100644 Source/3rdParty/wx/src/common/txtstrm.cpp delete mode 100644 Source/3rdParty/wx/src/common/unictabl.inc delete mode 100644 Source/3rdParty/wx/src/common/uri.cpp delete mode 100644 Source/3rdParty/wx/src/common/utilscmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/valgen.cpp delete mode 100644 Source/3rdParty/wx/src/common/validate.cpp delete mode 100644 Source/3rdParty/wx/src/common/valtext.cpp delete mode 100644 Source/3rdParty/wx/src/common/variant.cpp delete mode 100644 Source/3rdParty/wx/src/common/wfstream.cpp delete mode 100644 Source/3rdParty/wx/src/common/wincmn.cpp delete mode 100644 Source/3rdParty/wx/src/common/wxchar.cpp delete mode 100644 Source/3rdParty/wx/src/common/xpmdecod.cpp delete mode 100644 Source/3rdParty/wx/src/common/xti.cpp delete mode 100644 Source/3rdParty/wx/src/common/xtistrm.cpp delete mode 100644 Source/3rdParty/wx/src/common/zipstrm.cpp delete mode 100644 Source/3rdParty/wx/src/common/zstream.cpp delete mode 100644 Source/3rdParty/wx/src/generic/busyinfo.cpp delete mode 100644 Source/3rdParty/wx/src/generic/buttonbar.cpp delete mode 100644 Source/3rdParty/wx/src/generic/choicbkg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/choicdgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/clrpickerg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/collpaneg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/combog.cpp delete mode 100644 Source/3rdParty/wx/src/generic/dcpsg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/dirctrlg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/dragimgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/filepickerg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/fontpickerg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/graphicc.cpp delete mode 100644 Source/3rdParty/wx/src/generic/listbkg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/logg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/msgdlgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/numdlgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/panelg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/printps.cpp delete mode 100644 Source/3rdParty/wx/src/generic/prntdlgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/progdlgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/renderg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/scrlwing.cpp delete mode 100644 Source/3rdParty/wx/src/generic/selstore.cpp delete mode 100644 Source/3rdParty/wx/src/generic/spinctlg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/splitter.cpp delete mode 100644 Source/3rdParty/wx/src/generic/srchctlg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/statusbr.cpp delete mode 100644 Source/3rdParty/wx/src/generic/textdlgg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/timer.cpp delete mode 100644 Source/3rdParty/wx/src/generic/tipwin.cpp delete mode 100644 Source/3rdParty/wx/src/generic/toolbkg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/treebkg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/treectlg.cpp delete mode 100644 Source/3rdParty/wx/src/generic/vlbox.cpp delete mode 100644 Source/3rdParty/wx/src/generic/vscroll.cpp delete mode 100644 Source/3rdParty/wx/src/jpeg/README delete mode 100644 Source/3rdParty/wx/src/jpeg/ansi2knr.c delete mode 100644 Source/3rdParty/wx/src/jpeg/change.log delete mode 100644 Source/3rdParty/wx/src/jpeg/jcapimin.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcapistd.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jccoefct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jccolor.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcdctmgr.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jchuff.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jchuff.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jcinit.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcmainct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcmarker.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcmaster.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcomapi.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jconfig.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jconfig.vc delete mode 100644 Source/3rdParty/wx/src/jpeg/jcparam.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcphuff.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcprepct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jcsample.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jctrans.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdapimin.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdapistd.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdatadst.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdatasrc.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdcoefct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdcolor.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdct.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jddctmgr.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdhuff.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdhuff.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jdinput.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdmainct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdmarker.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdmaster.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdmerge.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdphuff.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdpostct.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdsample.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jdtrans.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jerror.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jerror.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jfdctflt.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jfdctfst.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jfdctint.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jidctflt.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jidctfst.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jidctint.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jidctred.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jinclude.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemansi.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemdos.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemmac.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemmgr.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemname.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemnobs.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jmemsys.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jmorecfg.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jpeg_CW_Prefix.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jpegint.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jpeglib.h delete mode 100644 Source/3rdParty/wx/src/jpeg/jpegtran.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jquant1.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jquant2.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jutils.c delete mode 100644 Source/3rdParty/wx/src/jpeg/jversion.h delete mode 100644 Source/3rdParty/wx/src/msw/accel.cpp delete mode 100644 Source/3rdParty/wx/src/msw/app.cpp delete mode 100644 Source/3rdParty/wx/src/msw/basemsw.cpp delete mode 100644 Source/3rdParty/wx/src/msw/bitmap.cpp delete mode 100644 Source/3rdParty/wx/src/msw/bmpbuttn.cpp delete mode 100644 Source/3rdParty/wx/src/msw/brush.cpp delete mode 100644 Source/3rdParty/wx/src/msw/button.cpp delete mode 100644 Source/3rdParty/wx/src/msw/caret.cpp delete mode 100644 Source/3rdParty/wx/src/msw/checkbox.cpp delete mode 100644 Source/3rdParty/wx/src/msw/checklst.cpp delete mode 100644 Source/3rdParty/wx/src/msw/choice.cpp delete mode 100644 Source/3rdParty/wx/src/msw/clipbrd.cpp delete mode 100644 Source/3rdParty/wx/src/msw/colordlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/colour.cpp delete mode 100644 Source/3rdParty/wx/src/msw/combo.cpp delete mode 100644 Source/3rdParty/wx/src/msw/combobox.cpp delete mode 100644 Source/3rdParty/wx/src/msw/control.cpp delete mode 100644 Source/3rdParty/wx/src/msw/crashrpt.cpp delete mode 100644 Source/3rdParty/wx/src/msw/cursor.cpp delete mode 100644 Source/3rdParty/wx/src/msw/data.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dc.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dcclient.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dcmemory.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dcprint.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dcscreen.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dde.cpp delete mode 100644 Source/3rdParty/wx/src/msw/debughlp.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dialog.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dialup.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dib.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dir.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dirdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/display.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dlmsw.cpp delete mode 100644 Source/3rdParty/wx/src/msw/dragimag.cpp delete mode 100644 Source/3rdParty/wx/src/msw/enhmeta.cpp delete mode 100644 Source/3rdParty/wx/src/msw/evtloop.cpp delete mode 100644 Source/3rdParty/wx/src/msw/fdrepdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/filedlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/font.cpp delete mode 100644 Source/3rdParty/wx/src/msw/fontdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/fontenum.cpp delete mode 100644 Source/3rdParty/wx/src/msw/fontutil.cpp delete mode 100644 Source/3rdParty/wx/src/msw/frame.cpp delete mode 100644 Source/3rdParty/wx/src/msw/gdiimage.cpp delete mode 100644 Source/3rdParty/wx/src/msw/gdiobj.cpp delete mode 100644 Source/3rdParty/wx/src/msw/graphics.cpp delete mode 100644 Source/3rdParty/wx/src/msw/gsockmsw.cpp delete mode 100644 Source/3rdParty/wx/src/msw/helpchm.cpp delete mode 100644 Source/3rdParty/wx/src/msw/helpwin.cpp delete mode 100644 Source/3rdParty/wx/src/msw/icon.cpp delete mode 100644 Source/3rdParty/wx/src/msw/imaglist.cpp delete mode 100644 Source/3rdParty/wx/src/msw/iniconf.cpp delete mode 100644 Source/3rdParty/wx/src/msw/listbox.cpp delete mode 100644 Source/3rdParty/wx/src/msw/listctrl.cpp delete mode 100644 Source/3rdParty/wx/src/msw/main.cpp delete mode 100644 Source/3rdParty/wx/src/msw/mdi.cpp delete mode 100644 Source/3rdParty/wx/src/msw/menu.cpp delete mode 100644 Source/3rdParty/wx/src/msw/menuitem.cpp delete mode 100644 Source/3rdParty/wx/src/msw/metafile.cpp delete mode 100644 Source/3rdParty/wx/src/msw/mimetype.cpp delete mode 100644 Source/3rdParty/wx/src/msw/minifram.cpp delete mode 100644 Source/3rdParty/wx/src/msw/msgdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/mslu.cpp delete mode 100644 Source/3rdParty/wx/src/msw/nativdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/notebook.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/access.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/activex.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/automtn.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/dataobj.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/dropsrc.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/droptgt.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/oleutils.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ole/uuid.cpp delete mode 100644 Source/3rdParty/wx/src/msw/ownerdrw.cpp delete mode 100644 Source/3rdParty/wx/src/msw/palette.cpp delete mode 100644 Source/3rdParty/wx/src/msw/pen.cpp delete mode 100644 Source/3rdParty/wx/src/msw/popupwin.cpp delete mode 100644 Source/3rdParty/wx/src/msw/power.cpp delete mode 100644 Source/3rdParty/wx/src/msw/printdlg.cpp delete mode 100644 Source/3rdParty/wx/src/msw/printwin.cpp delete mode 100644 Source/3rdParty/wx/src/msw/radiobox.cpp delete mode 100644 Source/3rdParty/wx/src/msw/radiobut.cpp delete mode 100644 Source/3rdParty/wx/src/msw/regconf.cpp delete mode 100644 Source/3rdParty/wx/src/msw/region.cpp delete mode 100644 Source/3rdParty/wx/src/msw/registry.cpp delete mode 100644 Source/3rdParty/wx/src/msw/renderer.cpp delete mode 100644 Source/3rdParty/wx/src/msw/scrolbar.cpp delete mode 100644 Source/3rdParty/wx/src/msw/settings.cpp delete mode 100644 Source/3rdParty/wx/src/msw/slider95.cpp delete mode 100644 Source/3rdParty/wx/src/msw/snglinst.cpp delete mode 100644 Source/3rdParty/wx/src/msw/spinbutt.cpp delete mode 100644 Source/3rdParty/wx/src/msw/spinctrl.cpp delete mode 100644 Source/3rdParty/wx/src/msw/stackwalk.cpp delete mode 100644 Source/3rdParty/wx/src/msw/statbmp.cpp delete mode 100644 Source/3rdParty/wx/src/msw/statbox.cpp delete mode 100644 Source/3rdParty/wx/src/msw/statbr95.cpp delete mode 100644 Source/3rdParty/wx/src/msw/statline.cpp delete mode 100644 Source/3rdParty/wx/src/msw/stattext.cpp delete mode 100644 Source/3rdParty/wx/src/msw/stdpaths.cpp delete mode 100644 Source/3rdParty/wx/src/msw/tbar95.cpp delete mode 100644 Source/3rdParty/wx/src/msw/textctrl.cpp delete mode 100644 Source/3rdParty/wx/src/msw/tglbtn.cpp delete mode 100644 Source/3rdParty/wx/src/msw/thread.cpp delete mode 100644 Source/3rdParty/wx/src/msw/timer.cpp delete mode 100644 Source/3rdParty/wx/src/msw/tooltip.cpp delete mode 100644 Source/3rdParty/wx/src/msw/toplevel.cpp delete mode 100644 Source/3rdParty/wx/src/msw/treectrl.cpp delete mode 100644 Source/3rdParty/wx/src/msw/utils.cpp delete mode 100644 Source/3rdParty/wx/src/msw/utilsexc.cpp delete mode 100644 Source/3rdParty/wx/src/msw/utilsgui.cpp delete mode 100644 Source/3rdParty/wx/src/msw/uxtheme.cpp delete mode 100644 Source/3rdParty/wx/src/msw/volume.cpp delete mode 100644 Source/3rdParty/wx/src/msw/window.cpp delete mode 100644 Source/3rdParty/wx/src/png/CHANGES delete mode 100644 Source/3rdParty/wx/src/png/README delete mode 100644 Source/3rdParty/wx/src/png/TODO delete mode 100644 Source/3rdParty/wx/src/png/ansi2knr.c delete mode 100644 Source/3rdParty/wx/src/png/png.c delete mode 100644 Source/3rdParty/wx/src/png/png.h delete mode 100644 Source/3rdParty/wx/src/png/pngasmrd.h delete mode 100644 Source/3rdParty/wx/src/png/pngconf.h delete mode 100644 Source/3rdParty/wx/src/png/pngerror.c delete mode 100644 Source/3rdParty/wx/src/png/pnggccrd.c delete mode 100644 Source/3rdParty/wx/src/png/pngget.c delete mode 100644 Source/3rdParty/wx/src/png/pngmem.c delete mode 100644 Source/3rdParty/wx/src/png/pngpread.c delete mode 100644 Source/3rdParty/wx/src/png/pngread.c delete mode 100644 Source/3rdParty/wx/src/png/pngrio.c delete mode 100644 Source/3rdParty/wx/src/png/pngrtran.c delete mode 100644 Source/3rdParty/wx/src/png/pngrutil.c delete mode 100644 Source/3rdParty/wx/src/png/pngset.c delete mode 100644 Source/3rdParty/wx/src/png/pngtest.c delete mode 100644 Source/3rdParty/wx/src/png/pngtrans.c delete mode 100644 Source/3rdParty/wx/src/png/pngvcrd.c delete mode 100644 Source/3rdParty/wx/src/png/pngwio.c delete mode 100644 Source/3rdParty/wx/src/png/pngwrite.c delete mode 100644 Source/3rdParty/wx/src/png/pngwtran.c delete mode 100644 Source/3rdParty/wx/src/png/pngwutil.c delete mode 100644 Source/3rdParty/wx/src/regex/regex.h delete mode 100644 Source/3rdParty/wx/src/tiff/libtiff/tiff.h delete mode 100644 Source/3rdParty/wx/src/tiff/libtiff/tiffconf.h delete mode 100644 Source/3rdParty/wx/src/tiff/libtiff/tiffio.h delete mode 100644 Source/3rdParty/wx/src/tiff/libtiff/tiffvers.h delete mode 100644 Source/3rdParty/wx/src/zlib/ChangeLog delete mode 100644 Source/3rdParty/wx/src/zlib/FAQ delete mode 100644 Source/3rdParty/wx/src/zlib/INDEX delete mode 100644 Source/3rdParty/wx/src/zlib/README delete mode 100644 Source/3rdParty/wx/src/zlib/adler32.c delete mode 100644 Source/3rdParty/wx/src/zlib/compress.c delete mode 100644 Source/3rdParty/wx/src/zlib/crc32.c delete mode 100644 Source/3rdParty/wx/src/zlib/crc32.h delete mode 100644 Source/3rdParty/wx/src/zlib/deflate.c delete mode 100644 Source/3rdParty/wx/src/zlib/deflate.h delete mode 100644 Source/3rdParty/wx/src/zlib/gzclose.c delete mode 100644 Source/3rdParty/wx/src/zlib/gzguts.h delete mode 100644 Source/3rdParty/wx/src/zlib/gzlib.c delete mode 100644 Source/3rdParty/wx/src/zlib/gzread.c delete mode 100644 Source/3rdParty/wx/src/zlib/gzwrite.c delete mode 100644 Source/3rdParty/wx/src/zlib/infback.c delete mode 100644 Source/3rdParty/wx/src/zlib/inffast.c delete mode 100644 Source/3rdParty/wx/src/zlib/inffast.h delete mode 100644 Source/3rdParty/wx/src/zlib/inffixed.h delete mode 100644 Source/3rdParty/wx/src/zlib/inflate.c delete mode 100644 Source/3rdParty/wx/src/zlib/inflate.h delete mode 100644 Source/3rdParty/wx/src/zlib/inftrees.c delete mode 100644 Source/3rdParty/wx/src/zlib/inftrees.h delete mode 100644 Source/3rdParty/wx/src/zlib/trees.c delete mode 100644 Source/3rdParty/wx/src/zlib/trees.h delete mode 100644 Source/3rdParty/wx/src/zlib/uncompr.c delete mode 100644 Source/3rdParty/wx/src/zlib/zconf.h delete mode 100644 Source/3rdParty/wx/src/zlib/zlib.3 delete mode 100644 Source/3rdParty/wx/src/zlib/zlib.h delete mode 100644 Source/3rdParty/wx/src/zlib/zlib.map delete mode 100644 Source/3rdParty/wx/src/zlib/zlib.pc.in delete mode 100644 Source/3rdParty/wx/src/zlib/zutil.c delete mode 100644 Source/3rdParty/wx/src/zlib/zutil.h delete mode 100644 Source/3rdParty/wx/wx_base.vcproj delete mode 100644 Source/3rdParty/wx/wx_base.vcxproj delete mode 100644 Source/3rdParty/wx/wx_base.vcxproj.filters delete mode 100644 Source/3rdParty/wx/wx_core.vcproj delete mode 100644 Source/3rdParty/wx/wx_core.vcxproj delete mode 100644 Source/3rdParty/wx/wx_core.vcxproj.filters delete mode 100644 Source/3rdParty/wx/wx_wxjpeg.vcproj delete mode 100644 Source/3rdParty/wx/wx_wxjpeg.vcxproj delete mode 100644 Source/3rdParty/wx/wx_wxjpeg.vcxproj.filters delete mode 100644 Source/3rdParty/wx/wx_wxpng.vcproj delete mode 100644 Source/3rdParty/wx/wx_wxpng.vcxproj delete mode 100644 Source/3rdParty/wx/wx_wxpng.vcxproj.filters delete mode 100644 Source/3rdParty/wx/wx_wxzlib.vcproj delete mode 100644 Source/3rdParty/wx/wx_wxzlib.vcxproj delete mode 100644 Source/3rdParty/wx/wx_wxzlib.vcxproj.filters diff --git a/Project64.sln b/Project64.sln index a223e72c6..dfa98a701 100644 --- a/Project64.sln +++ b/Project64.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rd Party", "3rd Party", "{AA8F7F8E-5377-4911-859D-8A8817B0DB26}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wxWidgets", "wxWidgets", "{1379F817-7E3D-4F58-9C22-7E364E46E842}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Glide", "Glide", "{9FE699A5-41C3-4441-92AB-639B3D77DE26}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "Source\Common\Common.vcxproj", "{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}" @@ -36,16 +34,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64Setup", "Source\In EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glide64", "Source\Glide64\Glide64.vcxproj", "{A4D13408-A794-4199-8FC7-4A9A32505005}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "Source\3rdParty\wx\wx_core.vcxproj", "{93447136-FACD-4740-8F35-FC46FB4A9E82}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "Source\3rdParty\wx\wx_base.vcxproj", "{427F1DCD-3BED-4010-9322-077A4C06D871}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxjpeg", "Source\3rdParty\wx\wx_wxjpeg.vcxproj", "{93CFEDF3-9A75-4484-B169-D9D8074F5AC2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxpng", "Source\3rdParty\wx\wx_wxpng.vcxproj", "{05B9CB11-12D1-47CD-8E4A-88E12162119B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxzlib", "Source\3rdParty\wx\wx_wxzlib.vcxproj", "{25A25249-C284-4C5A-8DC2-26FC3EB13703}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glitch64", "Source\Glitch64\Glitch64.vcxproj", "{462C2608-182F-452C-944F-AF201E19300B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GlideHQ", "Source\GlideHQ\GlideHQ.vcxproj", "{2DADDAA5-0F57-46ED-A974-747908DDC7F3}" @@ -144,46 +132,6 @@ Global {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|Win32.Build.0 = Release|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|x64.ActiveCfg = Release|x64 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|x64.Build.0 = Release|x64 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|Win32.ActiveCfg = Debug|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|Win32.Build.0 = Debug|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|x64.ActiveCfg = Debug|x64 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|x64.Build.0 = Debug|x64 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|Win32.ActiveCfg = Release|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|Win32.Build.0 = Release|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|x64.ActiveCfg = Release|x64 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|x64.Build.0 = Release|x64 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|Win32.ActiveCfg = Debug|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|Win32.Build.0 = Debug|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|x64.ActiveCfg = Debug|x64 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|x64.Build.0 = Debug|x64 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|Win32.ActiveCfg = Release|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|Win32.Build.0 = Release|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|x64.ActiveCfg = Release|x64 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|x64.Build.0 = Release|x64 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|Win32.ActiveCfg = Debug|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|Win32.Build.0 = Debug|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|x64.ActiveCfg = Debug|x64 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|x64.Build.0 = Debug|x64 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|Win32.ActiveCfg = Release|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|Win32.Build.0 = Release|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|x64.ActiveCfg = Release|x64 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|x64.Build.0 = Release|x64 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|Win32.ActiveCfg = Debug|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|Win32.Build.0 = Debug|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|x64.ActiveCfg = Debug|x64 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|x64.Build.0 = Debug|x64 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|Win32.ActiveCfg = Release|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|Win32.Build.0 = Release|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|x64.ActiveCfg = Release|x64 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|x64.Build.0 = Release|x64 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|Win32.ActiveCfg = Debug|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|Win32.Build.0 = Debug|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|x64.ActiveCfg = Debug|x64 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|x64.Build.0 = Debug|x64 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|Win32.ActiveCfg = Release|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|Win32.Build.0 = Release|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|x64.ActiveCfg = Release|x64 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|x64.Build.0 = Release|x64 {462C2608-182F-452C-944F-AF201E19300B}.Debug|Win32.ActiveCfg = Debug|Win32 {462C2608-182F-452C-944F-AF201E19300B}.Debug|Win32.Build.0 = Debug|Win32 {462C2608-182F-452C-944F-AF201E19300B}.Debug|x64.ActiveCfg = Debug|x64 @@ -237,19 +185,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {1379F817-7E3D-4F58-9C22-7E364E46E842} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {3326E128-33AF-422C-BB7C-67CC6B915610} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {4BC6906B-213E-40D7-9FC7-1A93E228393D} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {731BD205-2826-4631-B7AF-117658E88DBC} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} - {A4D13408-A794-4199-8FC7-4A9A32505005} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} - {93447136-FACD-4740-8F35-FC46FB4A9E82} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {427F1DCD-3BED-4010-9322-077A4C06D871} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {05B9CB11-12D1-47CD-8E4A-88E12162119B} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {25A25249-C284-4C5A-8DC2-26FC3EB13703} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {462C2608-182F-452C-944F-AF201E19300B} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} - {2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {17836496-31B0-46F2-B1B1-366D7DF6F04C} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} + {A4D13408-A794-4199-8FC7-4A9A32505005} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} + {462C2608-182F-452C-944F-AF201E19300B} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} + {2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} EndGlobalSection EndGlobal diff --git a/Project64.vs2008.sln b/Project64.vs2008.sln index f8ef256b9..ff1a05d48 100644 --- a/Project64.vs2008.sln +++ b/Project64.vs2008.sln @@ -38,35 +38,15 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glide64", "Source\Glide64\Glide64.vcproj", "{A4D13408-A794-4199-8FC7-4A9A32505005}" ProjectSection(ProjectDependencies) = postProject {462C2608-182F-452C-944F-AF201E19300B} = {462C2608-182F-452C-944F-AF201E19300B} - {05B9CB11-12D1-47CD-8E4A-88E12162119B} = {05B9CB11-12D1-47CD-8E4A-88E12162119B} - {93447136-FACD-4740-8F35-FC46FB4A9E82} = {93447136-FACD-4740-8F35-FC46FB4A9E82} - {25A25249-C284-4C5A-8DC2-26FC3EB13703} = {25A25249-C284-4C5A-8DC2-26FC3EB13703} {B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421} {51A84197-56BA-4017-9C0C-43E7F285184A} = {51A84197-56BA-4017-9C0C-43E7F285184A} {2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {2DADDAA5-0F57-46ED-A974-747908DDC7F3} {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} {8B9961B1-88D9-4EA3-A752-507A00DD9F3D} = {8B9961B1-88D9-4EA3-A752-507A00DD9F3D} - {427F1DCD-3BED-4010-9322-077A4C06D871} = {427F1DCD-3BED-4010-9322-077A4C06D871} - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "Source\3rdParty\wx\wx_core.vcproj", "{93447136-FACD-4740-8F35-FC46FB4A9E82}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rdParty", "3rdParty", "{AA8F7F8E-5377-4911-859D-8A8817B0DB26}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wxWidgets", "wxWidgets", "{1379F817-7E3D-4F58-9C22-7E364E46E842}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "Source\3rdParty\wx\wx_base.vcproj", "{427F1DCD-3BED-4010-9322-077A4C06D871}" - ProjectSection(ProjectDependencies) = postProject - {93447136-FACD-4740-8F35-FC46FB4A9E82} = {93447136-FACD-4740-8F35-FC46FB4A9E82} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxjpeg", "Source\3rdParty\wx\wx_wxjpeg.vcproj", "{93CFEDF3-9A75-4484-B169-D9D8074F5AC2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxpng", "Source\3rdParty\wx\wx_wxpng.vcproj", "{05B9CB11-12D1-47CD-8E4A-88E12162119B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxzlib", "Source\3rdParty\wx\wx_wxzlib.vcproj", "{25A25249-C284-4C5A-8DC2-26FC3EB13703}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glitch64", "Source\Glitch64\Glitch64.vcproj", "{462C2608-182F-452C-944F-AF201E19300B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Glide", "Glide", "{9FE699A5-41C3-4441-92AB-639B3D77DE26}" @@ -90,6 +70,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64-core", "Source\Project64-core\Project64-core.vcproj", "{00C7B43A-DED7-4DF0-B072-9A5783EF866D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "png", "Source\3rdParty\png\png.vcproj", "{51A84197-56BA-4017-9C0C-43E7F285184A}" + ProjectSection(ProjectDependencies) = postProject + {731BD205-2826-4631-B7AF-117658E88DBC} = {731BD205-2826-4631-B7AF-117658E88DBC} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -132,26 +115,6 @@ Global {A4D13408-A794-4199-8FC7-4A9A32505005}.Debug|Win32.Build.0 = Debug|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|Win32.ActiveCfg = Release|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|Win32.Build.0 = Release|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|Win32.ActiveCfg = Debug|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Debug|Win32.Build.0 = Debug|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|Win32.ActiveCfg = Release|Win32 - {93447136-FACD-4740-8F35-FC46FB4A9E82}.Release|Win32.Build.0 = Release|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|Win32.ActiveCfg = Debug|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Debug|Win32.Build.0 = Debug|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|Win32.ActiveCfg = Release|Win32 - {427F1DCD-3BED-4010-9322-077A4C06D871}.Release|Win32.Build.0 = Release|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|Win32.ActiveCfg = Debug|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Debug|Win32.Build.0 = Debug|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|Win32.ActiveCfg = Release|Win32 - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}.Release|Win32.Build.0 = Release|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|Win32.ActiveCfg = Debug|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Debug|Win32.Build.0 = Debug|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|Win32.ActiveCfg = Release|Win32 - {05B9CB11-12D1-47CD-8E4A-88E12162119B}.Release|Win32.Build.0 = Release|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|Win32.ActiveCfg = Debug|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Debug|Win32.Build.0 = Debug|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|Win32.ActiveCfg = Release|Win32 - {25A25249-C284-4C5A-8DC2-26FC3EB13703}.Release|Win32.Build.0 = Release|Win32 {462C2608-182F-452C-944F-AF201E19300B}.Debug|Win32.ActiveCfg = Debug|Win32 {462C2608-182F-452C-944F-AF201E19300B}.Debug|Win32.Build.0 = Debug|Win32 {462C2608-182F-452C-944F-AF201E19300B}.Release|Win32.ActiveCfg = Release|Win32 @@ -187,18 +150,12 @@ Global GlobalSection(NestedProjects) = preSolution {4BC6906B-213E-40D7-9FC7-1A93E228393D} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {731BD205-2826-4631-B7AF-117658E88DBC} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} - {1379F817-7E3D-4F58-9C22-7E364E46E842} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {3326E128-33AF-422C-BB7C-67CC6B915610} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {51A84197-56BA-4017-9C0C-43E7F285184A} = {AA8F7F8E-5377-4911-859D-8A8817B0DB26} {462C2608-182F-452C-944F-AF201E19300B} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} {A4D13408-A794-4199-8FC7-4A9A32505005} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} {2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {9FE699A5-41C3-4441-92AB-639B3D77DE26} - {93447136-FACD-4740-8F35-FC46FB4A9E82} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {427F1DCD-3BED-4010-9322-077A4C06D871} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {05B9CB11-12D1-47CD-8E4A-88E12162119B} = {1379F817-7E3D-4F58-9C22-7E364E46E842} - {25A25249-C284-4C5A-8DC2-26FC3EB13703} = {1379F817-7E3D-4F58-9C22-7E364E46E842} {5788717F-E3D4-40CF-9637-3A2AEE85BB81} = {3768C4C9-9E32-4EA6-99FD-FCE72C34B27F} EndGlobalSection EndGlobal diff --git a/Source/3rdParty/wx/art/addbookm.xpm b/Source/3rdParty/wx/art/addbookm.xpm deleted file mode 100644 index fb13ff161..000000000 --- a/Source/3rdParty/wx/art/addbookm.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static const char *const addbookm_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 3 1", -". c Black", -"X c #00C000", -" c None", -/* pixels */ -" ....... ", -" .XXXXX. ", -" .. .XXXXX. ", -" .. .XXXXX. ", -" ...... .XXXXX. ", -" ...... .XXXXX. ", -" .. .XXXXX. ", -" .. .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XX.XX. ", -" .X. .X. ", -" .. .. " -}; diff --git a/Source/3rdParty/wx/art/back.xpm b/Source/3rdParty/wx/art/back.xpm deleted file mode 100644 index 38b0f4b7d..000000000 --- a/Source/3rdParty/wx/art/back.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char *const back_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" . ", -" .. ", -" .X. ", -" .XX........ ", -" .XXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXX. ", -" .XX........ ", -" .X. ", -" .. ", -" . ", -" "}; diff --git a/Source/3rdParty/wx/art/cdrom.xpm b/Source/3rdParty/wx/art/cdrom.xpm deleted file mode 100644 index fecc52ec7..000000000 --- a/Source/3rdParty/wx/art/cdrom.xpm +++ /dev/null @@ -1,57 +0,0 @@ -/* XPM */ -static const char *const cdrom_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 36 1", -"= c #9BACC2", -"y c #547B99", -"$ c #FFFFFF", -"@ c #839CB5", -"o c #547897", -"4 c #4D7492", -"% c #F1F4F7", -"X c #5A809C", -"< c #8497A5", -"0 c #7898AD", -"+ c #CAD2DC", -"r c #ACAEB2", -"2 c #BECAD9", -"* c #65839D", -"e c #DCE2EA", -"- c #ADBED2", -"t c #597B9A", -" c None", -"1 c #467291", -"9 c #D6DFE7", -"O c #7393AB", -"u c #49708B", -"5 c #A0BACB", -"& c #AABFCD", -"8 c #B9CBD5", -"; c #B4C4D3", -": c #6F90A6", -"3 c #A8B6CA", -"# c #ADBACE", -"w c #E4E9ED", -". c #8EA9BC", -"> c #B3BFD1", -", c #C2CBDB", -"6 c #C0D1DC", -"7 c #A2B3C5", -"q c #5D7C93", -/* pixels */ -" .XooOo+ ", -" X@#$$$%o& ", -" *=-;$$$$$o+ ", -" +O#;-$$$$$$: ", -" o=>,-<1<$2-o ", -" o3>--1$122-* ", -" o=--$<4<22-X ", -" o5$$$$$26;7* ", -" X%$$$$2;-X8 ", -" 90*9$$$-7Xqo ", -" wXwe@O44X422222<<*4", -" ttyyyoo4441uuuo", -" t>$$$$$$$$$$$>o", -" XXXtyyyoo44411u" -}; diff --git a/Source/3rdParty/wx/art/close.xpm b/Source/3rdParty/wx/art/close.xpm deleted file mode 100644 index d79030228..000000000 --- a/Source/3rdParty/wx/art/close.xpm +++ /dev/null @@ -1,16 +0,0 @@ -/* XPM */ -static const char * const close_xpm[] = { -"12 10 2 1", -" c None", -"X c black", -" ", -" XX XX ", -" XX XX ", -" XXXX ", -" XX ", -" XXXX ", -" XX XX ", -" XX XX ", -" ", -" "}; - diff --git a/Source/3rdParty/wx/art/copy.xpm b/Source/3rdParty/wx/art/copy.xpm deleted file mode 100644 index 9143caa9b..000000000 --- a/Source/3rdParty/wx/art/copy.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static const char *const copy_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"o c #97C4E7", -"* c #FFFFFF", -"@ c #60A9DA", -"= c #D1E5F5", -"& c #C3DDF1", -". c #7EA6C0", -" c None", -"X c #2F93CD", -"O c #85BBE2", -", c #EFF6FC", -"; c #DEEDF8", -"+ c #72B2DD", -"3 c #F7FBFD", -"4 c #FAFCFE", -": c #DAEAF7", -"< c #E9F3FA", -"1 c #E2EFF8", -"- c #FDFDFE", -"% c #B6D5EE", -"$ c #A5CCEA", -"> c #E5F0F9", -"# c #AFD1EC", -"2 c #F4F9FD", -/* pixels */ -" .....XX ", -" .oO+@X#X ", -" .$oO+X##X ", -" .%$o........ ", -" .&%$.*=&#o.-. ", -" .=&%.*;=&#.--. ", -" .:=&.*>;=&.... ", -" .>:=.*,>;=&#o. ", -" .<1:.*2,>:=&#. ", -" .2<1.*32,>:=&. ", -" .32<.*432,>:=. ", -" .32<.*-432,>:. ", -" .....**-432,>. ", -" .***-432,. ", -" .......... " -}; diff --git a/Source/3rdParty/wx/art/cross.xpm b/Source/3rdParty/wx/art/cross.xpm deleted file mode 100644 index 20ab3f346..000000000 --- a/Source/3rdParty/wx/art/cross.xpm +++ /dev/null @@ -1,17 +0,0 @@ -/* XPM */ -static const char *const cross_xpm[] = { -/* columns rows colors chars-per-pixel */ -"10 10 2 1", -" c Gray0", -"# c None", -/* pixels */ -" ######## ", -" #### ", -"# ## #", -"## ##", -"### ###", -"### ###", -"## ##", -"# ## #", -" #### ", -" ###### "}; diff --git a/Source/3rdParty/wx/art/cut.xpm b/Source/3rdParty/wx/art/cut.xpm deleted file mode 100644 index eacd7f94b..000000000 --- a/Source/3rdParty/wx/art/cut.xpm +++ /dev/null @@ -1,46 +0,0 @@ -/* XPM */ -static const char *const cut_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 25 1", -"6 c #D8BDC0", -": c #C3C3C4", -"- c #FFFFFF", -". c #6C6D70", -"2 c #AD3A45", -"o c #DBDBDB", -"# c #939495", -"< c #E42234", -"& c #C3C5C8", -"; c #C6CCD3", -"% c #B7B7B8", -" c None", -"* c #DFE0E2", -"5 c #B69596", -"3 c #9C2A35", -"1 c #CFCFD0", -", c #AB5C64", -"+ c #D2D3D4", -"$ c #BCBDBE", -"@ c #C6C8CA", -"> c #CDC0C1", -"O c #826F72", -"X c #979BA0", -"4 c #9B8687", -"= c #9FA0A0", -/* pixels */ -" .X .o ", -" O.+ @. ", -" O. .. ", -" O#$ %.& ", -" O.*.. ", -" #%#.. ", -" O=-.. ", -" #%#;. ", -" OO:=O ", -" >,,<, ,<,,1 ", -" ><23<1 1<32<1 ", -" ,2 4< <5 2, ", -" <, ,2 2, ,< ", -" 23,<5 5<,32 ", -" 6225 522> " -}; diff --git a/Source/3rdParty/wx/art/deffile.xpm b/Source/3rdParty/wx/art/deffile.xpm deleted file mode 100644 index 182fbe418..000000000 --- a/Source/3rdParty/wx/art/deffile.xpm +++ /dev/null @@ -1,54 +0,0 @@ -/* XPM */ -static const char *const deffile_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 32 1", -"= c #97C4E7", -": c #72A8D2", -"1 c #FFFFFF", -"w c #839CB5", -"X c #6B98B8", -". c #5A89A6", -"@ c #3A749C", -", c #D1E5F5", -"< c #67A1CF", -"> c #F1F4F7", -"e c #85A7BC", -"% c #C3DDF1", -"0 c #749BB4", -"2 c #7EA6C0", -"; c #5F9BC8", -" c None", -"O c #538DB3", -"- c #85BBE2", -"$ c #D6DFE7", -"9 c #EFF6FC", -"o c #6591AE", -"4 c #F7FBFD", -"8 c #FAFCFE", -"6 c #DAEAF7", -"7 c #E9F3FA", -"q c #FDFDFE", -"3 c #E2EFF8", -"# c #8EA9BC", -"& c #B6D5EE", -"* c #A5CCEA", -"5 c #F4F9FD", -"+ c #4581AA", -/* pixels */ -" ..XooO+@#$ ", -" .%%&*=-;:;> ", -" .,,%&*=<1=X> ", -" #%%%%&*211=X ", -" #3----- c #5A7BB4", -"% c #5F7FB5", -/* pixels */ -" ", -" .Xo OO ", -" +@#. $@% ", -" &@@X .*@*o ", -" =@= .*@*. ", -" -@@X*@*. ", -" .#@@@$. ", -" ;@@: ", -" ;@@@+ ", -" .>@#%@@. ", -" o*@*oO@@, ", -" <#@*. .@@= ", -"&@@$ :@@1 ", -";#& 2#>. ", -" " -}; diff --git a/Source/3rdParty/wx/art/dir_up.xpm b/Source/3rdParty/wx/art/dir_up.xpm deleted file mode 100644 index f644d93e6..000000000 --- a/Source/3rdParty/wx/art/dir_up.xpm +++ /dev/null @@ -1,52 +0,0 @@ -/* XPM */ -static const char *const dir_up_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 31 1", -"6 c #9BACC2", -"o c #9AEA53", -"7 c #94A5BD", -"8 c #547897", -"5 c #839CB5", -"@ c #376485", -"$ c #5A809C", -"# c #7F99B4", -": c #D1D9E5", -"< c #EAEDF3", -"& c #446A8C", -"q c #65839D", -"> c #DCE2EA", -", c #E1E6EE", -"2 c #F5F6F7", -"O c #8DA0B9", -" c None", -"% c #467291", -". c #305F81", -"X c #7393AB", -"+ c #6A89A2", -"4 c #A8B6CA", -"1 c #EEF1F3", -"3 c #F8F9FA", -"0 c #215579", -"9 c #7F97B0", -"* c #B3BFD1", -"w c #7A90AC", -"- c #C2CBDB", -"; c #CAD6E1", -"= c #BBC4D6", -/* pixels */ -" .. ", -" X.o. ", -".... X.ooo. ", -".OO+....ooooo. ", -".OOOOOO@@ooo.. ", -".OOOO#OO@ooo.$ ", -".OOOOOOO@ooo.$ ", -".O%............&", -".O&*=-;:>,<1231.", -".+.4*=-;:>,<12$.", -"..564*=-;:>,<1. ", -".@O764*=-;:>,<. ", -".89O764*=-;:>$$ ", -"0qw9O764*=-;:. ", -"0............. " -}; diff --git a/Source/3rdParty/wx/art/down.xpm b/Source/3rdParty/wx/art/down.xpm deleted file mode 100644 index 88b0a9fdc..000000000 --- a/Source/3rdParty/wx/art/down.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char *const down_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ...... ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" ....XXXX.... ", -" .XXXXXXXX. ", -" .XXXXXX. ", -" .XXXX. ", -" .XX. ", -" .. ", -" "}; diff --git a/Source/3rdParty/wx/art/exefile.xpm b/Source/3rdParty/wx/art/exefile.xpm deleted file mode 100644 index f814a597e..000000000 --- a/Source/3rdParty/wx/art/exefile.xpm +++ /dev/null @@ -1,73 +0,0 @@ -/* XPM */ -static const char *const exefile_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 51 1", -"% c #E8E8EC", -"= c #E8E8ED", -"z c #CACAD4", -"8 c #D9D9E1", -"p c #D2D2DA", -"u c #E1E1E7", -"a c #D2D2DB", -"< c #E9E9ED", -"q c #DADAE1", -"+ c #F1F1F4", -"g c #D3D3DB", -"1 c #E2E2E8", -"x c #D3D3DC", -"5 c #00A5FF", -"$ c #EAEAEE", -"4 c #DBDBE2", -"h c #CCCCD6", -"y c #D4D4DC", -"r c #E3E3E9", -"d c #D4D4DD", -"7 c #DCDCE2", -": c #EBEBEF", -"0 c #DCDCE3", -" c None", -"O c #F3F3F5", -"> c #E4E4E9", -"& c #F3F3F6", -"j c #D5D5DD", -"6 c #E4E4EA", -". c #C6C6D5", -"# c #ECECF0", -"f c #CECED7", -"l c #CECED8", -"e c #D6D6DE", -"; c #EDEDF0", -"3 c #DEDEE4", -", c #EDEDF1", -"c c #CFCFD8", -"o c #F5F5F7", -"- c #E6E6EB", -"w c #D7D7DF", -"v c #C8C8D3", -"i c #DFDFE5", -"@ c #EEEEF2", -"s c #D0D0D9", -"X c #9494AD", -"9 c #D8D8DF", -"t c #D8D8E0", -"* c #EFEFF2", -"2 c #E0E0E6", -"k c #D1D1DA", -/* pixels */ -" ........X ", -" .oO+@#$%XX ", -" .&+*#$=-XXX ", -" .+*;:=->XXXX ", -" .*,:<->1234X ", -" .,5:5612378X ", -" 5,5559530qwX ", -" 55555550q9eX ", -" 5555r5555teyX ", -" 55rui559eypX ", -" 5555i5555yasX ", -" 5555555dasfX ", -" 5355595gsfhX ", -" .3595jgklhzX ", -" .0qwjxkchzvX ", -" XXXXXXXXXXXX " -}; diff --git a/Source/3rdParty/wx/art/fileopen.xpm b/Source/3rdParty/wx/art/fileopen.xpm deleted file mode 100644 index 636a90412..000000000 --- a/Source/3rdParty/wx/art/fileopen.xpm +++ /dev/null @@ -1,57 +0,0 @@ -/* XPM */ -static const char *const fileopen_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 36 1", -"6 c #9BACC2", -"< c #9AEA53", -"9 c #94A5BD", -"5 c #839CB5", -"; c #4D7492", -". c #376485", -"$ c #7F99B4", -"r c #D1D9E5", -"7 c #EAEDF3", -"@ c #CAD2DC", -"% c #718BA7", -"t c #BECAD9", -"& c #65839D", -"0 c #DCE2EA", -"4 c #F5F6F7", -"w c #597B9A", -"O c #8DA0B9", -" c None", -"+ c #467291", -"u c #305F81", -"= c #B4C4D3", -"# c #CAE2AA", -"1 c #FAFCFE", -"3 c #A8B6CA", -"q c #E4E9ED", -"8 c #EEF1F3", -"X c #215579", -"2 c #7F97B0", -": c #B3BFD1", -"y c #7A90AC", -", c #C2CBDB", -"- c #ADD668", -"* c #B6D791", -"e c #CAD6E1", -"o c #DFF0D0", -"> c #BBC4D6", -/* pixels */ -" ", -" .... ", -"XXXXX .oo. ", -"XOOOO+@.#o. ", -"XOOOO$%&.*oXXX ", -"XOOOOOOO.*oX=X ", -"XOXXXX...-oXXXX;", -"XOX:>,.<<<<,.<<>.>.X0q7; ", -"Xw2O963:>>er0t; ", -"X&y2O963:>,er; ", -"uXXXXXXXXXXXX; ", -" " -}; diff --git a/Source/3rdParty/wx/art/filesave.xpm b/Source/3rdParty/wx/art/filesave.xpm deleted file mode 100644 index b1ffda334..000000000 --- a/Source/3rdParty/wx/art/filesave.xpm +++ /dev/null @@ -1,42 +0,0 @@ -/* XPM */ -static const char *const filesave_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 21 1", -"O c #FFFFFF", -"> c #D5D6D8", -"; c #446A8C", -"1 c #CAD2DC", -": c #C0C7D1", -" c #5F666D", -"% c #A5B0BA", -"o c #65839D", -", c #DCE2EA", -"< c #C3C5C8", -"- c #E1E6EE", -"* c #C6CCD3", -". c None", -"$ c #305F81", -"2 c #D6DFE7", -"= c #D2D9E0", -"& c #B7BFC7", -"X c #1B4467", -"# c #BCBDBE", -"@ c #7A90AC", -"+ c #5D7C93", -/* pixels */ -" .", -" XoOOOOOOOOO+X .", -" @oO#######O+@ .", -" @oOOOOOOOOO+@ .", -" @oO#######O+@ .", -" @oOOOOOOOOO+@ .", -" @@+++++++++@@ .", -" @@@@@@@@@@@@@ .", -" @@@$$$$$$$$@@ .", -" @@$%%%&*=-O$@ .", -" @@$%X;;*=-O$@ .", -" @@$%X;;:>,O$@ .", -" @@$%X;;<12O$@ .", -" @@$<<2OOOOO$@ .", -". .." -}; diff --git a/Source/3rdParty/wx/art/filesaveas.xpm b/Source/3rdParty/wx/art/filesaveas.xpm deleted file mode 100644 index 4ca8e2622..000000000 --- a/Source/3rdParty/wx/art/filesaveas.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static const char *const filesaveas_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"X c Black", -"+ c #FFFFFF", -"< c #D5D6D8", -"> c #446A8C", -"3 c #CAD2DC", -", c #C0C7D1", -" c #5F666D", -"* c #A5B0BA", -"O c #65839D", -"1 c #DCE2EA", -"2 c #C3C5C8", -": c #E1E6EE", -". c #FFFF00", -"- c #C6CCD3", -"@ c None", -"& c #305F81", -"4 c #D6DFE7", -"; c #D2D9E0", -"= c #B7BFC7", -"o c #1B4467", -"$ c #BCBDBE", -"# c #7A90AC", -"% c #5D7C93", -/* pixels */ -" .X .XX.", -" oO+++++++.X.X.@", -" #O+$$$$$XX...XX", -" #O++++++.......", -" #O+$$$$$XX...XX", -" #O+++++++.X.X.@", -" ##%%%%%%.X%.X .", -" ############# @", -" ###&&&&&&&&## @", -" ##&***=-;:+&# @", -" ##&*o>>-;:+&# @", -" ##&*o>>,<1+&# @", -" ##&*o>>234+&# @", -" ##&224+++++&# @", -"@ @@" -}; diff --git a/Source/3rdParty/wx/art/find.xpm b/Source/3rdParty/wx/art/find.xpm deleted file mode 100644 index d5f24f8e4..000000000 --- a/Source/3rdParty/wx/art/find.xpm +++ /dev/null @@ -1,62 +0,0 @@ -/* XPM */ -static const char *const find_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 41 1", -"y c #A06959", -"9 c #A7DAF2", -"$ c #B5CAD7", -"> c #35B4E1", -"t c #6B98B8", -"w c #B6E0F4", -"q c #AEC9D7", -"1 c #5A89A6", -"+ c #98B3C6", -"4 c #EAF6FC", -"3 c #DEF1FA", -"= c #4CBCE3", -"d c #DB916B", -"X c #85A7BC", -"s c #D8BCA4", -"o c #749BB4", -"e c #BCD9EF", -"* c #62B4DD", -"< c #91D2EF", -"a c #E6DED2", -"0 c #E9F4FB", -" c None", -"@ c #A0BACB", -"O c #AABFCD", -"i c #6591AE", -": c #B9CBD5", -"- c #71C5E7", -"5 c #D3ECF8", -"% c #81A3B9", -"6 c #8AD0EE", -"8 c #FDFDFE", -"p c #8EA9BC", -"r c #B6D5EE", -", c #81CCEB", -". c #ACC4D3", -"; c #AFD1DE", -"7 c #EFF8FC", -"u c #C2CBDB", -"# c #C0D1DC", -"2 c #CAD6E1", -"& c #8FB0C3", -/* pixels */ -" .XooXO ", -" +@###$+% ", -" .&#*==-;@@ ", -" o:*>,<--:X ", -" 12>-345-#% ", -" 12>678392% ", -" %$*,3059q& ", -" @Oq,wwer@@ ", -" t@q22q&+ ", -" yyui+%o%p ", -" yasy ", -" yasdy ", -" yasdy ", -" ysdy ", -" yy " -}; diff --git a/Source/3rdParty/wx/art/findrepl.xpm b/Source/3rdParty/wx/art/findrepl.xpm deleted file mode 100644 index 55380e5c0..000000000 --- a/Source/3rdParty/wx/art/findrepl.xpm +++ /dev/null @@ -1,63 +0,0 @@ -/* XPM */ -static const char *const findrepl_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 42 1", -"y c #A06959", -"9 c #A7DAF2", -"$ c #B5CAD7", -"> c #35B4E1", -"t c #6B98B8", -"w c #B6E0F4", -"q c #AEC9D7", -"1 c #5A89A6", -"+ c #98B3C6", -"4 c #EAF6FC", -"d c #008000", -"3 c #DEF1FA", -"= c #4CBCE3", -"f c #DB916B", -"X c #85A7BC", -"s c #D8BCA4", -"o c #749BB4", -"e c #BCD9EF", -"* c #62B4DD", -"< c #91D2EF", -"a c #E6DED2", -"0 c #E9F4FB", -" c None", -"@ c #A0BACB", -"O c #AABFCD", -"i c #6591AE", -": c #B9CBD5", -"- c #71C5E7", -"5 c #D3ECF8", -"% c #81A3B9", -"6 c #8AD0EE", -"8 c #FDFDFE", -"p c #8EA9BC", -"r c #B6D5EE", -", c #81CCEB", -". c #ACC4D3", -"; c #AFD1DE", -"7 c #EFF8FC", -"u c #C2CBDB", -"# c #C0D1DC", -"2 c #CAD6E1", -"& c #8FB0C3", -/* pixels */ -" .XooXO ", -" +@###$+% ", -" .&#*==-;@@ ", -" o:*>,<--:X ", -" 12>-345-#% ", -" 12>678392% ", -" %$*,3059q& ", -" @Oq,wwer@@ ", -" t@q22q&+ ", -" yyui+%o%p ", -" yasy d d ", -" yasfy dd dd ", -"yasfy ddddddddd", -"ysfy dd dd ", -" yy d d " -}; diff --git a/Source/3rdParty/wx/art/first.xpm b/Source/3rdParty/wx/art/first.xpm deleted file mode 100644 index 6660af49e..000000000 --- a/Source/3rdParty/wx/art/first.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static const char *const first_xpm[] = { -"16 16 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -"... . ", -"... .. ", -"... .X. ", -"... .XX........ ", -"....XXXXXXXXXX. ", -"...XXXXXXXXXXX. ", -"...XXXXXXXXXXX. ", -"....XXXXXXXXXX. ", -"... .XX........ ", -"... .X. ", -"... .. ", -"... . ", -" ", -" "}; diff --git a/Source/3rdParty/wx/art/floppy.xpm b/Source/3rdParty/wx/art/floppy.xpm deleted file mode 100644 index 0c685efbc..000000000 --- a/Source/3rdParty/wx/art/floppy.xpm +++ /dev/null @@ -1,39 +0,0 @@ -/* XPM */ -static const char *const floppy_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 18 1", -"& c #E3E4E6", -"+ c #FFFFFF", -". c #446A8C", -"o c #697787", -"> c #5F666D", -"* c #B2B3B3", -" c None", -", c #4B4C4D", -"= c #DCDBDA", -"$ c #1B4467", -": c #E4E9ED", -"@ c #979BA0", -"X c #203646", -"O c #215579", -"- c #545B63", -"; c #636465", -"# c #CAD6E1", -"% c #7F8286", -/* pixels */ -" .XoooooooXO ", -" .o+++++++.O ", -" .o+OOOOO+.O ", -" .o+++++++.O ", -" .o@@@@@@@.O ", -" ..........O ", -" ..#+++++#.O ", -" ..+$O+++#.O ", -" ..+$O+++#.O ", -" %&.........*% ", -"%=+++++++++++&% ", -"--------------; ", -"-:::::::::::::- ", -"-:X:XXXXXXXXX:> ", -"-*************, " -}; diff --git a/Source/3rdParty/wx/art/folder.xpm b/Source/3rdParty/wx/art/folder.xpm deleted file mode 100644 index a116dcbd7..000000000 --- a/Source/3rdParty/wx/art/folder.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static const char *const folder_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 22 1", -"> c #9BACC2", -". c #547897", -"1 c #7F99B4", -"X c #D1D9E5", -"< c #EAEDF3", -"+ c #CAD2DC", -"3 c #718BA7", -"O c #BECAD9", -"$ c #E1E6EE", -"* c #F5F6F7", -", c #8DA0B9", -" c None", -"# c #D6DFE7", -"@ c #D2D9E0", -"- c #FAFCFE", -"; c #ADBACE", -"& c #EEF1F3", -"= c #F8F9FA", -"o c #B3BFD1", -"2 c #7A90AC", -": c #A2B3C5", -"% c #E5EAF1", -/* pixels */ -" ", -" ..... ", -" .XXXX. ", -" ............. ", -" .oO+@#$%&*=-. ", -" .oO+@#$%&*=-. ", -" .;oO+X#$%&*=. ", -" .:;oO+X#$%&*. ", -" .>:;oO+X#$%&. ", -" .,>:;oO+X#$<. ", -" .1,>:;oO+X#$. ", -" .21,>:;oO+X#. ", -" .321,>:;oO+X. ", -" ............. ", -" " -}; diff --git a/Source/3rdParty/wx/art/folder_open.xpm b/Source/3rdParty/wx/art/folder_open.xpm deleted file mode 100644 index dd450e73b..000000000 --- a/Source/3rdParty/wx/art/folder_open.xpm +++ /dev/null @@ -1,52 +0,0 @@ -/* XPM */ -static const char *const folder_open_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 31 1", -"6 c #9BACC2", -"w c #547B99", -"5 c #94A5BD", -". c #376485", -"; c #F1F4F7", -"o c #7F99B4", -"2 c #D1D9E5", -"- c #EAEDF3", -"O c #718BA7", -"0 c #65839D", -"* c #DCE2EA", -": c #F5F6F7", -"7 c #597B9A", -"X c #8DA0B9", -" c None", -"+ c #467291", -"q c #305F81", -"& c #D6DFE7", -"3 c #6A89A2", -"1 c #A8B6CA", -"= c #E4E9ED", -"> c #F8F9FA", -", c #FDFDFE", -"9 c #215579", -"8 c #7F97B0", -"@ c #B3BFD1", -"< c #7A90AC", -"$ c #C2CBDB", -"4 c #A2B3C5", -"% c #CAD6E1", -"# c #BBC4D6", -/* pixels */ -" ", -"..... ", -".XXXo. ", -".XXXXO........ ", -".XXXXXXXXXXXX. ", -".XXXXXXXXXXXX. ", -".X++++++++++++++", -".X+@#$%&*=-;:>,+", -".<.1@#$%2*=-;:23", -"..X41@#$%2*=-;3 ", -"..X561@#$%2*=-3 ", -".78X561@#$%2*%3 ", -"90<8X561@#$%23 ", -"q++++++++++++w ", -" " -}; diff --git a/Source/3rdParty/wx/art/forward.xpm b/Source/3rdParty/wx/art/forward.xpm deleted file mode 100644 index d17eef486..000000000 --- a/Source/3rdParty/wx/art/forward.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char *const forward_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" . ", -" .. ", -" .X. ", -" ........XX. ", -" .XXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXX. ", -" ........XX. ", -" .X. ", -" .. ", -" . ", -" "}; diff --git a/Source/3rdParty/wx/art/harddisk.xpm b/Source/3rdParty/wx/art/harddisk.xpm deleted file mode 100644 index 3151a7f30..000000000 --- a/Source/3rdParty/wx/art/harddisk.xpm +++ /dev/null @@ -1,60 +0,0 @@ -/* XPM */ -static const char *const harddisk_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 39 1", -"7 c #E3E4E6", -"4 c #FFFFFF", -"5 c #839CB5", -". c #547897", -"1 c #4D7492", -"@ c #376485", -"o c #7A92A3", -"u c #D1D9E5", -"y c #446A8C", -"i c #51B03D", -"> c #CAD2DC", -"O c #718BA7", -"2 c #65839D", -"6 c #DCE2EA", -"0 c #C3C5C8", -"9 c #F5F6F7", -": c #EBEBEC", -"< c #597B9A", -"t c #C6CCD3", -" c None", -"* c #DFE0E2", -"e c #467291", -"a c #526E8B", -", c #7393AB", -"p c #130A0B", -"# c #AABFCD", -"r c #B4C4D3", -"; c #CFCFD0", -"X c #6F90A6", -"+ c #6A89A2", -"- c #D2D3D4", -"= c #DCDBDA", -"w c #E4E9ED", -"q c #C6C8CA", -"% c #215579", -"$ c #E7E7E7", -"3 c #7F97B0", -"8 c #C0D1DC", -"& c #5D7C93", -/* pixels */ -" ", -" .XoooXO+@ ", -" #$$%%%%$$$X ", -" &$*==-;$$$& ", -" &:>+,<1234o5 ", -" ###+67;;78242 ", -" &4,49*0q*9we4. ", -" &4+49*,,*9wo4. ", -"&4%r,67;;782t%4.", -"&44468rrrr84444,", -"y11111111111111e", -"1uu1:::::::::::1", -"1uu1::::::::ip:1", -"auu&:::::::::::1", -"1111111111111111" -}; diff --git a/Source/3rdParty/wx/art/helpicon.xpm b/Source/3rdParty/wx/art/helpicon.xpm deleted file mode 100644 index 356c45239..000000000 --- a/Source/3rdParty/wx/art/helpicon.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static const char *const helpicon_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 6 1", -" c Gray0", -". c Blue", -"X c #808080808080", -"o c #c0c0c0c0c0c0", -"O c Gray100", -"+ c None", -/* pixels */ -"+++++++++++XXXXXXXX+++++++++++++", -"++++++++XXXoOOOOOOoXXX++++++++++", -"++++++XXoOOOOOOOOOOOOoXX++++++++", -"+++++XoOOOOOOOOOOOOOOOOoX+++++++", -"++++XOOOOOOOOOOOOOOOOOOOO ++++++", -"+++XOOOOOOOo......oOOOOOOO +++++", -"++XOOOOOOOo.oOO....oOOOOOOO ++++", -"+XoOOOOOOO..OOOO....OOOOOOOo +++", -"+XOOOOOOOO....OO....OOOOOOOO X++", -"XoOOOOOOOO....Oo....OOOOOOOOo X+", -"XOOOOOOOOOo..oO....OOOOOOOOOO X+", -"XOOOOOOOOOOOOOo...OOOOOOOOOOO XX", -"XOOOOOOOOOOOOO...OOOOOOOOOOOO XX", -"XOOOOOOOOOOOOO..oOOOOOOOOOOOO XX", -"XOOOOOOOOOOOOO..OOOOOOOOOOOOO XX", -"XoOOOOOOOOOOOOOOOOOOOOOOOOOOo XX", -"+XOOOOOOOOOOOo..oOOOOOOOOOOO XXX", -"+XoOOOOOOOOOO....OOOOOOOOOOo XXX", -"++XOOOOOOOOOO....OOOOOOOOOO XXX+", -"+++ OOOOOOOOOo..oOOOOOOOOO XXXX+", -"++++ OOOOOOOOOOOOOOOOOOOO XXXX++", -"+++++ oOOOOOOOOOOOOOOOOo XXXX+++", -"++++++ oOOOOOOOOOOOOo XXXX++++", -"+++++++X oOOOOOOo XXXXX+++++", -"++++++++XXX oOOO XXXXXXX++++++", -"++++++++++XXXX OOO XXXXX++++++++", -"+++++++++++++X OOO XX+++++++++++", -"+++++++++++++++ OO XX+++++++++++", -"++++++++++++++++ O XX+++++++++++", -"+++++++++++++++++ XX+++++++++++", -"++++++++++++++++++XXX+++++++++++", -"+++++++++++++++++++XX+++++++++++" -}; diff --git a/Source/3rdParty/wx/art/home.xpm b/Source/3rdParty/wx/art/home.xpm deleted file mode 100644 index d246b1d72..000000000 --- a/Source/3rdParty/wx/art/home.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static const char *const home_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 3 1", -". c Black", -"X c #FFFFFF", -" c None", -/* pixels */ -" .... ", -" .XXXX. ", -" .XXXXXX. ", -" .XXXXXXXX. ", -" .XXXXXXXXXX. ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .X.....X....X. ", -" .X. .X. .X. ", -" .X. .X. .X. ", -" .X.....X. .X. ", -" .XXXXXXX. .X. ", -" ......... ... " -}; diff --git a/Source/3rdParty/wx/art/htmbook.xpm b/Source/3rdParty/wx/art/htmbook.xpm deleted file mode 100644 index e49b4685f..000000000 --- a/Source/3rdParty/wx/art/htmbook.xpm +++ /dev/null @@ -1,25 +0,0 @@ -/* XPM */ -static const char *const htmbook_xpm[] = { -"16 16 6 1", -" c None", -". c Black", -"X c #000080", -"o c #c0c0c0", -"O c #808080", -"+ c Gray100", -" ", -" .. ", -" ..XX. ", -" ..XXXXX. ", -" ..XXXXXXXX. ", -".oXXXXXXXXXX. ", -".XoXXXXXXXXXX. ", -".XXoXXXXXXXXXX. ", -".XXXoXXXXXXXXX..", -".XXXXoXXXXXX..O ", -" .XXXXoXXX..O+O ", -" .XXXXo..O++o..", -" .XXX.O+++o.. ", -" .XX.o+o.. ", -" .X.o.. ", -" ... "}; diff --git a/Source/3rdParty/wx/art/htmfoldr.xpm b/Source/3rdParty/wx/art/htmfoldr.xpm deleted file mode 100644 index dacef687b..000000000 --- a/Source/3rdParty/wx/art/htmfoldr.xpm +++ /dev/null @@ -1,25 +0,0 @@ -/* XPM */ -static const char *const htmfoldr_xpm[] = { -"16 16 6 1", -" c None", -". c Black", -"X c #000080", -"o c #c0c0c0", -"O c #808080", -"+ c Gray100", -" ", -" .. ", -" ..XX. ", -" ..XXXXX. ", -" ..XXXXXXXX. ", -".oXXXXXXXXXX. ", -".XoXXXXXXXXXX. ", -".XXoXXXXXXXXXX. ", -".XXXoXXXXXXXXX..", -".XXXXoXXXXXX..O ", -" .XXXXoXXX..O+O ", -" .XXXXo..O++o..", -" .XXX.O+++o.. ", -" .XX.o+o.. ", -" .X.o.. ", -" ... "}; diff --git a/Source/3rdParty/wx/art/htmoptns.xpm b/Source/3rdParty/wx/art/htmoptns.xpm deleted file mode 100644 index 8806749ea..000000000 --- a/Source/3rdParty/wx/art/htmoptns.xpm +++ /dev/null @@ -1,20 +0,0 @@ -/* XPM */ -static const char *const htmoptns_xpm[] = { -"16 15 2 1", -" c None", -". c #000000", -" ", -" .. ", -" ... ", -" .... ", -" . ... ", -" .. ... ", -" . .. ", -" .. ... ", -" . .. ", -" ......... ", -" .. ... ", -" . ... ", -" .. ... ", -" .... ....... ", -" "}; diff --git a/Source/3rdParty/wx/art/htmpage.xpm b/Source/3rdParty/wx/art/htmpage.xpm deleted file mode 100644 index e4fa3fbc7..000000000 --- a/Source/3rdParty/wx/art/htmpage.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static const char *const htmpage_xpm[] = { -"16 16 4 1", -" c None", -". c #808080", -"X c Gray100", -"o c Black", -" ", -" .......... ", -" .XXXXXXXX.. ", -" .XXXXXXXXooo ", -" .X......XXXo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .XXXXXXXXXXo ", -" oooooooooooo "}; diff --git a/Source/3rdParty/wx/art/htmsidep.xpm b/Source/3rdParty/wx/art/htmsidep.xpm deleted file mode 100644 index 30f6a9239..000000000 --- a/Source/3rdParty/wx/art/htmsidep.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static const char *const htmsidep_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 6 1", -". c Black", -"X c #FFFFFF", -"+ c #808080", -" c None", -"O c #0000C0", -"o c #C0C0C0", -/* pixels */ -" ", -" .............. ", -" .XXXX.ooooooo. ", -" .XOXX.oo...oo. ", -" .XXOX.ooooooo. ", -" .OOOO.o...+.o. ", -" .XXOX.ooooooo. ", -" .XOXX.ooooooo. ", -" .XXXX.o..+ooo. ", -" .XXOX.ooooooo. ", -" .XOXX.o...+.o. ", -" .OOOO.ooooooo. ", -" .XOXX.o.+...o. ", -" .XXOX.ooooooo. ", -" .............. " -}; diff --git a/Source/3rdParty/wx/art/last.xpm b/Source/3rdParty/wx/art/last.xpm deleted file mode 100644 index 66c3bd338..000000000 --- a/Source/3rdParty/wx/art/last.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static const char *const last_xpm[] = { -"16 16 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" . ...", -" .. ...", -" .X. ...", -" ........XX. ...", -" .XXXXXXXXXX....", -" .XXXXXXXXXXX...", -" .XXXXXXXXXXX...", -" .XXXXXXXXXX....", -" ........XX. ...", -" .X. ...", -" .. ...", -" . ...", -" ", -" "}; diff --git a/Source/3rdParty/wx/art/listview.xpm b/Source/3rdParty/wx/art/listview.xpm deleted file mode 100644 index 30f748abb..000000000 --- a/Source/3rdParty/wx/art/listview.xpm +++ /dev/null @@ -1,25 +0,0 @@ -/* XPM */ -static const char *const listview_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 4 1", -" c Black", -". c #FFFFFF", -"X c #000084", -"o c #848484", -/* pixels */ -" ", -" .............. ", -" .XXX.......... ", -" .XXX. o o . ", -" .XXX.......... ", -" .............. ", -" .XXX.......... ", -" .XXX. o . ", -" .XXX.......... ", -" .............. ", -" .XXX.......... ", -" .XXX. o o . ", -" .XXX.......... ", -" .............. ", -" " -}; diff --git a/Source/3rdParty/wx/art/minus.xpm b/Source/3rdParty/wx/art/minus.xpm deleted file mode 100644 index d8cc34f36..000000000 --- a/Source/3rdParty/wx/art/minus.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static const char *const minus_xpm[] = { -"16 16 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" ", -" ", -" ", -" ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .............. ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/Source/3rdParty/wx/art/missimg.xpm b/Source/3rdParty/wx/art/missimg.xpm deleted file mode 100644 index 80eecbcf2..000000000 --- a/Source/3rdParty/wx/art/missimg.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static const char *const missimg_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 5 1", -"X c Black", -"o c #FFFFFF", -" c None", -". c #C0C0C0", -"O c #E0E0E0", -/* pixels */ -" .............................X ", -" .ooooooooooooooooooooooooooooX ", -" .ooooooooooooooooooooooooooooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOXOOOOOOOOOOOOOOOOooX ", -" XXXOOOOOXX XOOOOOOOOOOOOOOOooX ", -" XXXXX XOOOOOOOOOOOOOOooX ", -" XOOOXXXOOOOOOOooX ", -" XXX XXOOOOOooX ", -" XOOOOooX ", -" . XOOOooX ", -" .. XXOooX ", -" .o.. XooX ", -" .ooO... XXX ", -" .ooOOOO.......... ", -" .ooOOOOOOOOOOOOOO.. ", -" .ooOOOOOOOOOOOOOOOO.. ", -" .ooOOOOOOOOOOOOOOOOOO......... ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooooooooooooooooooooooooooooX ", -" .ooooooooooooooooooooooooooooX ", -" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " -}; diff --git a/Source/3rdParty/wx/art/new.xpm b/Source/3rdParty/wx/art/new.xpm deleted file mode 100644 index 6a0b13335..000000000 --- a/Source/3rdParty/wx/art/new.xpm +++ /dev/null @@ -1,50 +0,0 @@ -/* XPM */ -static const char *const new_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 29 1", -"* c #97C4E7", -"- c #72A8D2", -": c #FFFFFF", -"9 c #839CB5", -"o c #6B98B8", -"X c #5A89A6", -"# c #3A749C", -", c #D1E5F5", -"0 c #85A7BC", -"$ c #C3DDF1", -"8 c #749BB4", -"; c #5F9BC8", -" c None", -"+ c #538DB3", -"= c #85BBE2", -"3 c #EFF6FC", -"O c #6591AE", -"5 c #F7FBFD", -"7 c #FAFCFE", -"< c #DAEAF7", -"4 c #E9F3FA", -"6 c #FDFDFE", -"1 c #E2EFF8", -". c #8EA9BC", -"% c #B6D5EE", -"& c #A5CCEA", -"> c #ACE95B", -"2 c #F4F9FD", -"@ c #4581AA", -/* pixels */ -" .XoOO+@#. ", -" .$$%&*=O-; ", -" @@@@$%&*O:*o ", -" @>>@$$%&O::*o ", -"@@@>>@@@$%OOoO+ ", -"@>>>>>>@,$%&*=+ ", -"@>>>>>>@<,$%&*+ ", -"@@@>>@@@1<,$%&O ", -" @>>@2341<,$%O ", -" @@@@52341<,$o ", -" .:6752341<,8 ", -" .::6752341<8 ", -" .:::67523419 ", -" .::::6752340 ", -" ............ " -}; diff --git a/Source/3rdParty/wx/art/new_dir.xpm b/Source/3rdParty/wx/art/new_dir.xpm deleted file mode 100644 index d100eea75..000000000 --- a/Source/3rdParty/wx/art/new_dir.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static const char *const new_dir_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 22 1", -"X c Black", -"> c #9BACC2", -"o c #547897", -"1 c #7F99B4", -"O c #D1D9E5", -"< c #EAEDF3", -"# c #CAD2DC", -"3 c #718BA7", -"@ c #BECAD9", -"& c #E1E6EE", -"; c #F5F6F7", -". c #FFFF00", -", c #8DA0B9", -" c None", -"% c #D6DFE7", -"$ c #D2D9E0", -"- c #ADBACE", -"= c #EEF1F3", -"+ c #B3BFD1", -"2 c #7A90AC", -": c #A2B3C5", -"* c #E5EAF1", -/* pixels */ -" .X .XX.", -" ooooo .X.X. ", -" oOOOOo XX...XX", -" oooooooo.......", -" o+@#$%&*XX...XX", -" o+@#$%&*=.X.X. ", -" o-+@#O%&.X;.X .", -" o:-+@#O%&*=;o ", -" o>:-+@#O%&*=o ", -" o,>:-+@#O%&:-+@#O%&o ", -" o21,>:-+@#O%o ", -" o321,>:-+@#Oo ", -" ooooooooooooo ", -" " -}; diff --git a/Source/3rdParty/wx/art/paste.xpm b/Source/3rdParty/wx/art/paste.xpm deleted file mode 100644 index 2458378f8..000000000 --- a/Source/3rdParty/wx/art/paste.xpm +++ /dev/null @@ -1,46 +0,0 @@ -/* XPM */ -static const char *const paste_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 25 1", -"< c #FEECE4", -"> c #FEE3D7", -"O c #FFFFFF", -"o c #7B767D", -"% c #F79586", -"& c #CAE1F3", -"@ c #F08B62", -"# c #FCCBB8", -"- c #FDD8C9", -"4 c #FFF8F4", -"5 c #FFF5F0", -" c None", -"$ c #F8AA8F", -", c #EFF6FC", -"1 c #F7FBFD", -"2 c #FAFCFE", -"; c #DAEAF7", -": c #E9F3FA", -"6 c #FFFAF8", -". c #3C78A6", -"3 c #FFF1ED", -"X c #9B8687", -"+ c #FBBCA4", -"* c #B6D5EE", -"= c #F4F9FD", -/* pixels */ -" ...... ", -" .XoOOOOoo. ", -".+XOOOOOOX@. ", -".+XXXXXXXX@. ", -".#++$$%@..... ", -".##++$$%.&*.=. ", -".-##++$$.;&.==. ", -".--##++$.:;.... ", -".>--##++.,:;&*. ", -".<>--##+.1,:;&. ", -".<<>--##.21,:;. ", -".3<<>--#.O21=:. ", -".45<<>--....... ", -".6453<>----. ", -"............ " -}; diff --git a/Source/3rdParty/wx/art/plus.xpm b/Source/3rdParty/wx/art/plus.xpm deleted file mode 100644 index 25d299b30..000000000 --- a/Source/3rdParty/wx/art/plus.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static const char *const plus_xpm[] = { -"16 16 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" .... ", -" .XX. ", -" .XX. ", -" .XX. ", -" ......XX...... ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" ......XX...... ", -" .XX. ", -" .XX. ", -" .XX. ", -" .... ", -" ", -" "}; diff --git a/Source/3rdParty/wx/art/print.xpm b/Source/3rdParty/wx/art/print.xpm deleted file mode 100644 index dbdfe6b4d..000000000 --- a/Source/3rdParty/wx/art/print.xpm +++ /dev/null @@ -1,60 +0,0 @@ -/* XPM */ -static const char *const print_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 39 1", -"< c #E3E4E6", -"+ c #C3C3C4", -"i c #FFFFFF", -": c #74879B", -"# c #5A89A6", -"a c #F1F4F7", -"r c #5A809C", -"@ c #BDCCD9", -"e c #7A92A4", -"% c #3F6F93", -"t c #9FA2A6", -"3 c #939495", -"w c #5F666D", -"9 c #65839E", -"5 c #4A7291", -"$ c #4B7F9E", -" c None", -"O c #DFE0E2", -"o c #F3F3F3", -"; c #84A5BB", -"& c #467291", -". c #7897AD", -"* c #407598", -"4 c #CFCFD0", -"7 c #6F90A6", -"y c #6A89A2", -"0 c #AAADB2", -"1 c #D2D3D4", -"u c #4F7592", -", c #BCBDBE", -"p c #57778E", -"q c #979BA0", -"2 c #ABABAC", -"- c #E7E7E7", -"= c #D6DEE6", -"> c #9FA0A0", -"8 c #829EB5", -"X c #8FB0C3", -"6 c #5D7C93", -/* pixels */ -" .XXXXXXXX ", -" .oooooooX ", -" .OOOOOOOX ", -" .+++++++X ", -"@##$%&&&&&%*##@ ", -"$=-;:>,<123$-=$ ", -".44.5678.96$44. ", -"7,,,,,,,,,,,,,7 ", -"900qwwwwwwwe009 ", -"rtt9ryyyyyyuttr ", -"6qq6iiiiiii%qq6 ", -"633paiiiiii%336 ", -"XXX*iiiiiii%XXX ", -" 6iiiiiii% ", -" $XXXXXXX# " -}; diff --git a/Source/3rdParty/wx/art/quit.xpm b/Source/3rdParty/wx/art/quit.xpm deleted file mode 100644 index 885bbd0fa..000000000 --- a/Source/3rdParty/wx/art/quit.xpm +++ /dev/null @@ -1,90 +0,0 @@ -/* XPM */ -static const char *const quit_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 69 1", -"@ c Black", -"i c #9AEA53", -"D c #7E9BB1", -"H c #839FB4", -", c #B7C7D3", -"8 c #BCCBD6", -"7 c #C1CFDA", -"v c #92ABBD", -"- c #D0DBE2", -"O c #547897", -"+ c #376485", -"L c #7090A8", -"t c #AEC0CE", -"g c #B3C4D1", -"S c #84A0B4", -"G c #89A4B8", -"> c #BDCCD7", -"F c #5A809C", -"2 c #C2D0DA", -"k c #93ACBE", -"= c #D6E0E6", -"* c #446A8C", -"z c #A5B9C8", -"# c #DEE5EB", -"0 c #AFC1CE", -"r c #B4C5D2", -"p c #B9C9D5", -"A c #8AA5B8", -"M c #92AABD", -"j c #A6BAC9", -"K c #7796AC", -"l c #ABBECC", -"o c #E4EAEF", -"9 c #B5C6D2", -" c None", -"; c #C9D6DF", -"X c #305F81", -"m c #98AFC0", -"V c #9DB3C3", -"% c #D1DBE3", -"u c #A2B7C6", -"y c #A7BBCA", -"h c #ACBFCD", -"4 c #B6C7D3", -"w c #C0CFD9", -"d c #982106", -"B c #85A0B5", -"6 c #C8D4DE", -"c c #99B0C1", -"x c #9EB4C4", -"$ c #D7E0E7", -"q c #A8BCCA", -"s c #ADC0CD", -"3 c #BCCCD7", -"N c #8BA5B9", -": c #C4D1DB", -"1 c #C9D5DE", -"f c #9AB1C2", -"n c #A4B9C8", -"a c #B3C5D1", -". c #215579", -"J c #7D9AB0", -"& c #829EB5", -"e c #BBCAD6", -"b c #8CA6B9", -"Z c #91AABC", -"C c #96AEC0", -"< c #CFDAE2", -"5 c #AFC2CF", -/* pixels */ -" ..XXXXXXXXXX ", -" XoO+X@@@@@@X ", -" X#$%&X*@@@@X ", -" X=-;:>,X@@@X ", -" X<12345X@@@X ", -" X67890qX@XXX ", -" XwertyuX@XiX ", -" XpasddfX++iiX ", -" XghjddkXiiiiiX ", -" XlzxcvbXiiiiiiX", -" XnxmMNBXiiiiiX ", -" XVCZASDXXXiiX ", -" XXFGHJKX XiX ", -" FXXFLX XX ", -" XX* " -}; diff --git a/Source/3rdParty/wx/art/redo.xpm b/Source/3rdParty/wx/art/redo.xpm deleted file mode 100644 index 84ed3553c..000000000 --- a/Source/3rdParty/wx/art/redo.xpm +++ /dev/null @@ -1,58 +0,0 @@ -/* XPM */ -static const char *const redo_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 37 1", -"4 c #9BACC2", -"; c #4C7398", -"3 c #547B99", -"* c #547897", -"# c #5A89A6", -"8 c #3A749C", -"5 c #5A809C", -", c #7F99B4", -"& c #3F6F93", -"9 c #85A7BC", -"+ c #749BB4", -"> c #718BA7", -"e c #A5B3C8", -"w c #BECAD9", -": c #65839D", -"u c #E1E6EE", -"o c #236289", -"r c #ADBED2", -"= c #597B9A", -"2 c #8DA0B9", -" c None", -"% c #467291", -"1 c #7393AB", -"i c #4C809F", -"- c #A0BACB", -"O c #6591AE", -"X c #407598", -"6 c #6F90A6", -"t c #D2D9E0", -"7 c #ADBACE", -"@ c #326A8F", -"0 c #467A9C", -". c #ACC4D3", -"< c #7F97B0", -"y c #B3BFD1", -"q c #A2B3C5", -"$ c #8FB0C3", -/* pixels */ -" .XoooO ", -" +o@@@@@o# +", -" $@%%&@&%%&@ +o", -" X*=@+-+@*=;@#&@", -" @:=+ @=:=*:@", -" &>:$ @:>>>@", -" &,,,,&", -" +123 @<2222&", -" X44X #@56<44X", -" O1748 .9#&o", -" 0qwe8 ", -" 8rty8 ", -" 8wu+ ", -" i## ", -" " -}; diff --git a/Source/3rdParty/wx/art/removable.xpm b/Source/3rdParty/wx/art/removable.xpm deleted file mode 100644 index e066fd4df..000000000 --- a/Source/3rdParty/wx/art/removable.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static const char *const removable_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"@ c #C3C3C4", -"4 c #FFFFFF", -"o c #D5D6D8", -"> c #7A92A3", -". c #8497A5", -"% c #ACAEB2", -"2 c #4A7898", -": c #DCE2EA", -", c #F5F6F7", -"= c #EBEBEC", -"$ c #B7B7B8", -" c None", -"X c #DFE0E2", -"* c #A6A8AD", -"1 c #4C809F", -"3 c #407598", -"O c #CFCFD0", -"; c #9EA2A8", -"# c #BCBDBE", -"+ c #C6C8CA", -"- c #979BA0", -"& c #E7E7E7", -"< c #8FB0C3", -/* pixels */ -" ......... ", -" .XoO+@#$%. ", -" .XoO+@#$%. ", -" .&XoO+@#$%*. ", -" .&XoO+@#$%*. ", -" .=&XoO+@#$%*-. ", -" .=&XoO+@#$%*;. ", -".:=&XoO+@#$%*;>.", -".,=&XoO+@#$%*;-.", -"<..............<", -"<,=&XoO+@#$%%%%.", -" c #718BA7", -"0 c #A5B3C8", -"q c #BECAD9", -": c #65839D", -"u c #E1E6EE", -"X c #236289", -"y c #ADBED2", -"= c #597B9A", -"1 c #8DA0B9", -" c None", -"% c #467291", -"3 c #7393AB", -"i c #4C809F", -"; c #A0BACB", -". c #6591AE", -"o c #407598", -"5 c #6F90A6", -"t c #D2D9E0", -"9 c #ADBACE", -"# c #326A8F", -"e c #467A9C", -"O c #ACC4D3", -"< c #7F97B0", -"r c #B3BFD1", -"w c #A2B3C5", -"& c #8FB0C3", -/* pixels */ -" .XXXoO ", -"+ @X#####X+ ", -"X+ #$%%$#$%%#& ", -"#$@#*=-#+;+#=-o ", -"#:-=:=# +=:# ", -"#>>>:# &:>$ ", -"$,,,>o o<,$ ", -"$1111<# 213+ ", -"o44<56#@ o44o ", -"X$@7O 8493. ", -" 80qwe ", -" 8rty8 ", -" +uq8 ", -" @@i ", -" " -}; diff --git a/Source/3rdParty/wx/art/up.xpm b/Source/3rdParty/wx/art/up.xpm deleted file mode 100644 index f29ed3d38..000000000 --- a/Source/3rdParty/wx/art/up.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char *const up_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" .. ", -" .XX. ", -" .XXXX. ", -" .XXXXXX. ", -" .XXXXXXXX. ", -" ....XXXX.... ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" ...... ", -" "}; diff --git a/Source/3rdParty/wx/include/msvc/wx/setup.h b/Source/3rdParty/wx/include/msvc/wx/setup.h deleted file mode 100644 index f00b8ec37..000000000 --- a/Source/3rdParty/wx/include/msvc/wx/setup.h +++ /dev/null @@ -1,241 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msvc/wx/msw/setup.h -// Purpose: wrapper around the real wx/setup.h for Visual C++ -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-12-12 -// RCS-ID: $Id: setup.h 43687 2006-11-27 15:03:59Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but -// the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined -// explicitly! - -#ifdef _MSC_VER - #ifdef _UNICODE - #ifdef WXUSINGDLL - #ifdef _DEBUG - #include "../../../lib/vc_dll/mswud/wx/setup.h" - #else - #include "../../../lib/vc_dll/mswu/wx/setup.h" - #endif - #else - #ifdef _DEBUG - #include "../../../lib/vc_lib/mswud/wx/setup.h" - #else - #include "../../../lib/vc_lib/mswu/wx/setup.h" - #endif - #endif - - #ifdef _DEBUG - #pragma comment(lib,"wxbase28ud") - #pragma comment(lib,"wxbase28ud_net") - #pragma comment(lib,"wxbase28ud_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexud") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpatd") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpegd") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpngd") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiffd") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlibd") - #endif - #pragma comment(lib,"wxmsw28ud_adv") - #pragma comment(lib,"wxmsw28ud_core") - #pragma comment(lib,"wxmsw28ud_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28ud_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28ud_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28ud_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28ud_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28ud_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28ud_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28ud_odbc") - #endif - #endif // wxUSE_GUI - #else // release - #pragma comment(lib,"wxbase28u") - #pragma comment(lib,"wxbase28u_net") - #pragma comment(lib,"wxbase28u_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexu") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpat") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpeg") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpng") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiff") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlib") - #endif - #pragma comment(lib,"wxmsw28u_adv") - #pragma comment(lib,"wxmsw28u_core") - #pragma comment(lib,"wxmsw28u_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28u_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28u_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28u_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28u_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28u_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28u_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28u_odbc") - #endif - #endif // wxUSE_GUI - #endif // debug/release - #else // !_UNICODE - #ifdef WXUSINGDLL - #ifdef _DEBUG - #include "../../../lib/vc_dll/mswd/wx/setup.h" - #else - #include "../../../lib/vc_dll/msw/wx/setup.h" - #endif - #else // static lib - #ifdef _DEBUG - #include "../../../lib/vc_lib/mswd/wx/setup.h" - #else - #include "../../../lib/vc_lib/msw/wx/setup.h" - #endif - #endif // shared/static - - #ifdef _DEBUG - #pragma comment(lib,"wxbase28d") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexd") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpatd") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpegd") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpngd") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiffd") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlibd") - #endif - #pragma comment(lib,"wxmsw28d_core") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28d_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28d_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28d_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28d_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28d_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28d_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28d_odbc") - #endif - #endif // wxUSE_GUI - #else // release - #pragma comment(lib,"wxbase28") - #if wxUSE_REGEX - #pragma comment(lib,"wxregex") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpat") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpeg") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpng") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiff") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlib") - #endif - #pragma comment(lib,"wxmsw28_core") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28_odbc") - #endif - #endif // wxUSE_GUI - #endif // debug/release - #endif // _UNICODE/!_UNICODE -#else - #error "This file should only be included when using Microsoft Visual C++" -#endif - diff --git a/Source/3rdParty/wx/include/wx/accel.h b/Source/3rdParty/wx/include/wx/accel.h deleted file mode 100644 index 49d14ec2a..000000000 --- a/Source/3rdParty/wx/include/wx/accel.h +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/accel.h -// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes -// Author: Julian Smart, Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 31.05.01 (extracted from other files) -// RCS-ID: $Id: accel.h 66927 2011-02-16 23:27:30Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCEL_H_BASE_ -#define _WX_ACCEL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_ACCEL - -#include "wx/object.h" - -class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxAcceleratorEntry flags -enum -{ - wxACCEL_NORMAL = 0x0000, // no modifiers - wxACCEL_ALT = 0x0001, // hold Alt key down - wxACCEL_CTRL = 0x0002, // hold Ctrl key down - wxACCEL_SHIFT = 0x0004, // hold Shift key down -#if defined(__WXMAC__) || defined(__WXCOCOA__) - wxACCEL_CMD = 0x0008 // Command key on OS X -#else - wxACCEL_CMD = wxACCEL_CTRL -#endif -}; - -// ---------------------------------------------------------------------------- -// an entry in wxAcceleratorTable corresponds to one accelerator -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorEntry -{ -public: - wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, - wxMenuItem *item = NULL) - : m_flags(flags) - , m_keyCode(keyCode) - , m_command(cmd) - , m_item(item) - { } - - wxAcceleratorEntry(const wxAcceleratorEntry& entry) - : m_flags(entry.m_flags) - , m_keyCode(entry.m_keyCode) - , m_command(entry.m_command) - , m_item(entry.m_item) - { } - - // create accelerator corresponding to the specified string, return NULL if - // string couldn't be parsed or a pointer to be deleted by the caller - static wxAcceleratorEntry *Create(const wxString& str); - - wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry) - { - Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); - return *this; - } - - void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) - { - m_flags = flags; - m_keyCode = keyCode; - m_command = cmd; - m_item = item; - } - - void SetMenuItem(wxMenuItem *item) { m_item = item; } - - int GetFlags() const { return m_flags; } - int GetKeyCode() const { return m_keyCode; } - int GetCommand() const { return m_command; } - - wxMenuItem *GetMenuItem() const { return m_item; } - - bool operator==(const wxAcceleratorEntry& entry) const - { - return m_flags == entry.m_flags && - m_keyCode == entry.m_keyCode && - m_command == entry.m_command && - m_item == entry.m_item; - } - - bool operator!=(const wxAcceleratorEntry& entry) const - { return !(*this == entry); } - -#if defined(__WXMOTIF__) - // Implementation use only - bool MatchesEvent(const wxKeyEvent& event) const; -#endif - - bool IsOk() const - { - return m_keyCode != 0; - } - - - // string <-> wxAcceleratorEntry conversion - // ---------------------------------------- - - // returns a wxString for the this accelerator. - // this function formats it using the - format - // where maybe a hyphen-separed list of "shift|alt|ctrl" - wxString ToString() const; - - // returns true if the given string correctly initialized this object - // (i.e. if IsOk() returns true after this call) - bool FromString(const wxString& str); - - -private: - // common part of Create() and FromString() - static bool ParseAccel(const wxString& str, int *flags, int *keycode); - - - int m_flags; // combination of wxACCEL_XXX constants - int m_keyCode; // ASCII or virtual keycode - int m_command; // Command id to generate - - // the menu item this entry corresponds to, may be NULL - wxMenuItem *m_item; - - // for compatibility with old code, use accessors now! - friend class WXDLLIMPEXP_FWD_CORE wxMenu; -}; - -// ---------------------------------------------------------------------------- -// include wxAcceleratorTable class declaration, it is only used by the library -// and so doesn't have any published user visible interface -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/accel.h" -#elif defined(__WXMSW__) - #include "wx/msw/accel.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/accel.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/accel.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/accel.h" -#elif defined(__WXMAC__) - #include "wx/mac/accel.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/accel.h" -#elif defined(__WXPM__) - #include "wx/os2/accel.h" -#endif - -extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable; - -#endif // wxUSE_ACCEL - -#endif - // _WX_ACCEL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/afterstd.h b/Source/3rdParty/wx/include/wx/afterstd.h deleted file mode 100644 index 78d3a7009..000000000 --- a/Source/3rdParty/wx/include/wx/afterstd.h +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/afterstd.h -// Purpose: #include after STL headers -// Author: Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: afterstd.h 61871 2009-09-09 22:29:51Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/** - See the comments in beforestd.h. - */ - -#if defined(__WXMSW__) - #include "wx/msw/winundef.h" -#endif - -// undo what we did in wx/beforestd.h -#if defined(__VISUALC__) && __VISUALC__ <= 1201 - // MSVC 5 does not have this - #if _MSC_VER > 1100 - // don't restore this one for VC6, it gives it in each try/catch which is a - // bit annoying to say the least - #if _MSC_VER >= 0x1300 - // unreachable code - #pragma warning(default:4702) - #endif // VC++ >= 7 - - #pragma warning(pop) - #else - // 'expression' : signed/unsigned mismatch - #pragma warning(default:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(default:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(default:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(default:4663) - #endif -#endif - -/* - Redefine _T if we undefined it in wx/beforestd.h (see comment there about - why do we do it) and if we need it (we always do when building wx itself - and might also need when compiling the user code but this must be indicated - by the special wxNEEDS__T macro) - */ -#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) - #if defined(WXBUILDING) || defined(wxNEEDS_T) - /* - Undefine _T in case it was defined in the standard header. - */ - #undef _T - - /* - And define it again in the same way as it's done in wx/wxchar.h. - */ - #if wxUSE_UNICODE - #define _T(x) wxCONCAT_HELPER(L, x) - #else /* !Unicode */ - #define _T(x) x - #endif /* Unicode/!Unicode */ - #endif /* we need _T() to be defined */ -#endif /* defined(__SUNPRO_CC) || defined(__SUNPRO_C) */ diff --git a/Source/3rdParty/wx/include/wx/anidecod.h b/Source/3rdParty/wx/include/wx/anidecod.h deleted file mode 100644 index 6e3847614..000000000 --- a/Source/3rdParty/wx/include/wx/anidecod.h +++ /dev/null @@ -1,77 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/anidecod.h -// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation -// Author: Francesco Montorsi -// CVS-ID: $Id: anidecod.h 45563 2007-04-21 18:17:50Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANIDECOD_H -#define _WX_ANIDECOD_H - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_ICO_CUR - -#include "wx/stream.h" -#include "wx/image.h" -#include "wx/animdecod.h" -#include "wx/dynarray.h" - - -class /*WXDLLEXPORT*/ wxANIFrameInfo; - -WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); -WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); - -// -------------------------------------------------------------------------- -// wxANIDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder -{ -public: - // constructor, destructor, etc. - wxANIDecoder(); - ~wxANIDecoder(); - - - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; - virtual wxColour GetTransparentColour(unsigned int frame) const; - - // implementation of wxAnimationDecoder's pure virtuals - virtual bool CanRead( wxInputStream& stream ) const; - virtual bool Load( wxInputStream& stream ); - - bool ConvertToImage(unsigned int frame, wxImage *image) const; - - wxAnimationDecoder *Clone() const - { return new wxANIDecoder; } - wxAnimationType GetType() const - { return wxANIMATION_TYPE_ANI; } - -private: - // frames stored as wxImage(s): ANI files are meant to be used mostly for animated - // cursors and thus they do not use any optimization to encode differences between - // two frames: they are just a list of images to display sequentially. - wxImageArray m_images; - - // the info about each image stored in m_images. - // NB: m_info.GetCount() may differ from m_images.GetCount()! - wxANIFrameInfoArray m_info; - - // this is the wxCURHandler used to load the ICON chunk of the ANI files - static wxCURHandler sm_handler; - - - DECLARE_NO_COPY_CLASS(wxANIDecoder) -}; - - -#endif // wxUSE_STREAM && wxUSE_ICO_CUR - -#endif // _WX_ANIDECOD_H diff --git a/Source/3rdParty/wx/include/wx/animdecod.h b/Source/3rdParty/wx/include/wx/animdecod.h deleted file mode 100644 index a1cb15eaa..000000000 --- a/Source/3rdParty/wx/include/wx/animdecod.h +++ /dev/null @@ -1,146 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/animdecod.h -// Purpose: wxAnimationDecoder -// Author: Francesco Montorsi -// CVS-ID: $Id: animdecod.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANIMDECOD_H -#define _WX_ANIMDECOD_H - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/colour.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_CORE wxImage; - -/* - - Differences between a wxAnimationDecoder and a wxImageHandler: - - 1) wxImageHandlers always load an input stream directly into a given wxImage - object converting from the format-specific data representation to the - wxImage native format (RGB24). - wxAnimationDecoders always load an input stream using some optimized format - to store it which is format-depedent. This allows to store a (possibly big) - animation using a format which is a good compromise between required memory - and time required to blit in on the screen. - - 2) wxAnimationDecoders contain the animation data in some internal var. - That's why they derive from wxObjectRefData: they are data which can be shared. - - 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame - in wxImage format; the viceversa cannot be done. - - 4) wxAnimationDecoders are decoders only, thus do not support save features. - - 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation) - as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for - wxImage uses. - -*/ - - -// -------------------------------------------------------------------------- -// Constants -// -------------------------------------------------------------------------- - -// NB: the values of these enum items are not casual but coincide with the -// GIF disposal codes. Do not change them !! -enum wxAnimationDisposal -{ - // No disposal specified. The decoder is not required to take any action. - wxANIM_UNSPECIFIED = -1, - - // Do not dispose. The graphic is to be left in place. - wxANIM_DONOTREMOVE = 0, - - // Restore to background color. The area used by the graphic must be - // restored to the background color. - wxANIM_TOBACKGROUND = 1, - - // Restore to previous. The decoder is required to restore the area - // overwritten by the graphic with what was there prior to rendering the graphic. - wxANIM_TOPREVIOUS = 2 -}; - -enum wxAnimationType -{ - wxANIMATION_TYPE_INVALID, - wxANIMATION_TYPE_GIF, - wxANIMATION_TYPE_ANI, - - wxANIMATION_TYPE_ANY -}; - - -// -------------------------------------------------------------------------- -// wxAnimationDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxAnimationDecoder : public wxObjectRefData -{ -public: - wxAnimationDecoder() - { - m_background = wxNullColour; - m_nFrames = 0; - } - virtual ~wxAnimationDecoder() { } - - - virtual bool Load( wxInputStream& stream ) = 0; - virtual bool CanRead( wxInputStream& stream ) const = 0; - - virtual wxAnimationDecoder *Clone() const = 0; - virtual wxAnimationType GetType() const = 0; - - // convert given frame to wxImage - virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0; - - - // frame specific data getters - - // not all frames may be of the same size; e.g. GIF allows to - // specify that between two frames only a smaller portion of the - // entire animation has changed. - virtual wxSize GetFrameSize(unsigned int frame) const = 0; - - // the position of this frame in case it's not as big as m_szAnimation - // or wxPoint(0,0) otherwise. - virtual wxPoint GetFramePosition(unsigned int frame) const = 0; - - // what should be done after displaying this frame. - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0; - - // the number of milliseconds this frame should be displayed. - // if returns -1 then the frame must be displayed forever. - virtual long GetDelay(unsigned int frame) const = 0; - - // the transparent colour for this frame if any or wxNullColour. - virtual wxColour GetTransparentColour(unsigned int frame) const = 0; - - // get global data - wxSize GetAnimationSize() const { return m_szAnimation; } - wxColour GetBackgroundColour() const { return m_background; } - unsigned int GetFrameCount() const { return m_nFrames; } - -protected: - wxSize m_szAnimation; - unsigned int m_nFrames; - - // this is the colour to use for the wxANIM_TOBACKGROUND disposal. - // if not specified by the animation, it's set to wxNullColour - wxColour m_background; -}; - - -#endif // wxUSE_STREAM -#endif // _WX_ANIMDECOD_H - diff --git a/Source/3rdParty/wx/include/wx/app.h b/Source/3rdParty/wx/include/wx/app.h deleted file mode 100644 index b7d500b12..000000000 --- a/Source/3rdParty/wx/include/wx/app.h +++ /dev/null @@ -1,708 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/app.h -// Purpose: wxAppBase class and macros used for declaration of wxApp -// derived class in the user code -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: app.h 51592 2008-02-08 08:17:41Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APP_H_BASE_ -#define _WX_APP_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers we have to include here -// ---------------------------------------------------------------------------- - -#include "wx/event.h" // for the base class -#include "wx/build.h" -#include "wx/init.h" // we must declare wxEntry() -#include "wx/intl.h" // for wxLayoutDirection - -class WXDLLIMPEXP_FWD_BASE wxAppConsole; -class WXDLLIMPEXP_FWD_BASE wxAppTraits; -class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; -class WXDLLIMPEXP_FWD_BASE wxLog; -class WXDLLIMPEXP_FWD_BASE wxMessageOutput; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_BASE wxEventLoop; - struct WXDLLIMPEXP_FWD_CORE wxVideoMode; -#endif - -// ---------------------------------------------------------------------------- -// typedefs -// ---------------------------------------------------------------------------- - -// the type of the function used to create a wxApp object on program start up -typedef wxAppConsole* (*wxAppInitializerFunction)(); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - wxPRINT_WINDOWS = 1, - wxPRINT_POSTSCRIPT = 2 -}; - -// ---------------------------------------------------------------------------- -// wxAppConsole: wxApp for non-GUI applications -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler -{ -public: - // ctor and dtor - wxAppConsole(); - virtual ~wxAppConsole(); - - - // the virtual functions which may/must be overridden in the derived class - // ----------------------------------------------------------------------- - - // This is the very first function called for a newly created wxApp object, - // it is used by the library to do the global initialization. If, for some - // reason, you must override it (instead of just overriding OnInit(), as - // usual, for app-specific initializations), do not forget to call the base - // class version! - virtual bool Initialize(int& argc, wxChar **argv); - - // This gives wxCocoa a chance to call OnInit() with a memory pool in place - virtual bool CallOnInit() { return OnInit(); } - - // Called before OnRun(), this is a good place to do initialization -- if - // anything fails, return false from here to prevent the program from - // continuing. The command line is normally parsed here, call the base - // class OnInit() to do it. - virtual bool OnInit(); - - // this is here only temporary hopefully (FIXME) - virtual bool OnInitGui() { return true; } - - // This is the replacement for the normal main(): all program work should - // be done here. When OnRun() returns, the programs starts shutting down. - virtual int OnRun() = 0; - - // This is only called if OnInit() returned true so it's a good place to do - // any cleanup matching the initializations done there. - virtual int OnExit(); - - // This is the very last function called on wxApp object before it is - // destroyed. If you override it (instead of overriding OnExit() as usual) - // do not forget to call the base class version! - virtual void CleanUp(); - - // Called when a fatal exception occurs, this function should take care not - // to do anything which might provoke a nested exception! It may be - // overridden if you wish to react somehow in non-default way (core dump - // under Unix, application crash under Windows) to fatal program errors, - // however extreme care should be taken if you don't want this function to - // crash. - virtual void OnFatalException() { } - - // Called from wxExit() function, should terminate the application a.s.a.p. - virtual void Exit(); - - - // application info: name, description, vendor - // ------------------------------------------- - - // NB: all these should be set by the application itself, there are no - // reasonable default except for the application name which is taken to - // be argv[0] - - // set/get the application name - wxString GetAppName() const - { - return m_appName.empty() ? m_className : m_appName; - } - void SetAppName(const wxString& name) { m_appName = name; } - - // set/get the app class name - wxString GetClassName() const { return m_className; } - void SetClassName(const wxString& name) { m_className = name; } - - // set/get the vendor name - const wxString& GetVendorName() const { return m_vendorName; } - void SetVendorName(const wxString& name) { m_vendorName = name; } - - - // cmd line parsing stuff - // ---------------------- - - // all of these methods may be overridden in the derived class to - // customize the command line parsing (by default only a few standard - // options are handled) - // - // you also need to call wxApp::OnInit() from YourApp::OnInit() for all - // this to work - -#if wxUSE_CMDLINE_PARSER - // this one is called from OnInit() to add all supported options - // to the given parser (don't forget to call the base class version if you - // override it!) - virtual void OnInitCmdLine(wxCmdLineParser& parser); - - // called after successfully parsing the command line, return true - // to continue and false to exit (don't forget to call the base class - // version if you override it!) - virtual bool OnCmdLineParsed(wxCmdLineParser& parser); - - // called if "--help" option was specified, return true to continue - // and false to exit - virtual bool OnCmdLineHelp(wxCmdLineParser& parser); - - // called if incorrect command line options were given, return - // false to abort and true to continue - virtual bool OnCmdLineError(wxCmdLineParser& parser); -#endif // wxUSE_CMDLINE_PARSER - - - // miscellaneous customization functions - // ------------------------------------- - - // create the app traits object to which we delegate for everything which - // either should be configurable by the user (then he can change the - // default behaviour simply by overriding CreateTraits() and returning his - // own traits object) or which is GUI/console dependent as then wxAppTraits - // allows us to abstract the differences behind the common faade - wxAppTraits *GetTraits(); - - // the functions below shouldn't be used now that we have wxAppTraits -#if WXWIN_COMPATIBILITY_2_4 - -#if wxUSE_LOG - // override this function to create default log target of arbitrary - // user-defined class (default implementation creates a wxLogGui - // object) -- this log object is used by default by all wxLogXXX() - // functions. - wxDEPRECATED( virtual wxLog *CreateLogTarget() ); -#endif // wxUSE_LOG - - // similar to CreateLogTarget() but for the global wxMessageOutput - // object - wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() ); - -#endif // WXWIN_COMPATIBILITY_2_4 - - - // event processing functions - // -------------------------- - - // this method allows to filter all the events processed by the program, so - // you should try to return quickly from it to avoid slowing down the - // program to the crawl - // - // return value should be -1 to continue with the normal event processing, - // or TRUE or FALSE to stop further processing and pretend that the event - // had been already processed or won't be processed at all, respectively - virtual int FilterEvent(wxEvent& event); - -#if wxUSE_EXCEPTIONS - // call the specified handler on the given object with the given event - // - // this method only exists to allow catching the exceptions thrown by any - // event handler, it would lead to an extra (useless) virtual function call - // if the exceptions were not used, so it doesn't even exist in that case - virtual void HandleEvent(wxEvtHandler *handler, - wxEventFunction func, - wxEvent& event) const; - - // Called when an unhandled C++ exception occurs inside OnRun(): note that - // the exception type is lost by now, so if you really want to handle the - // exception you should override OnRun() and put a try/catch around - // MainLoop() call there or use OnExceptionInMainLoop() - virtual void OnUnhandledException() { } -#endif // wxUSE_EXCEPTIONS - - // process all events in the wxPendingEvents list -- it is necessary to - // call this function to process posted events. This happens during each - // event loop iteration in GUI mode but if there is no main loop, it may be - // also called directly. - virtual void ProcessPendingEvents(); - - // doesn't do anything in this class, just a hook for GUI wxApp - virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; } - - // make sure that idle events are sent again - virtual void WakeUpIdle() { } - - // this is just a convenience: by providing its implementation here we - // avoid #ifdefs in the code using it - static bool IsMainLoopRunning() { return false; } - - - // debugging support - // ----------------- - -#ifdef __WXDEBUG__ - // this function is called when an assert failure occurs, the base class - // version does the normal processing (i.e. shows the usual assert failure - // dialog box) - // - // the arguments are the location of the failed assert (func may be empty - // if the compiler doesn't support C99 __FUNCTION__), the text of the - // assert itself and the user-specified message - virtual void OnAssertFailure(const wxChar *file, - int line, - const wxChar *func, - const wxChar *cond, - const wxChar *msg); - - // old version of the function without func parameter, for compatibility - // only, override OnAssertFailure() in the new code - virtual void OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg); -#endif // __WXDEBUG__ - - // check that the wxBuildOptions object (constructed in the application - // itself, usually the one from IMPLEMENT_APP() macro) matches the build - // options of the library and abort if it doesn't - static bool CheckBuildOptions(const char *optionsSignature, - const char *componentName); -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) ); -#endif - - // implementation only from now on - // ------------------------------- - - // helpers for dynamic wxApp construction - static void SetInitializerFunction(wxAppInitializerFunction fn) - { ms_appInitFn = fn; } - static wxAppInitializerFunction GetInitializerFunction() - { return ms_appInitFn; } - - // accessors for ms_appInstance field (external code might wish to modify - // it, this is why we provide a setter here as well, but you should really - // know what you're doing if you call it), wxTheApp is usually used instead - // of GetInstance() - static wxAppConsole *GetInstance() { return ms_appInstance; } - static void SetInstance(wxAppConsole *app) { ms_appInstance = app; } - - - // command line arguments (public for backwards compatibility) - int argc; - wxChar **argv; - -protected: - // the function which creates the traits object when GetTraits() needs it - // for the first time - virtual wxAppTraits *CreateTraits(); - - - // function used for dynamic wxApp creation - static wxAppInitializerFunction ms_appInitFn; - - // the one and only global application object - static wxAppConsole *ms_appInstance; - - - // application info (must be set from the user code) - wxString m_vendorName, // vendor name (ACME Inc) - m_appName, // app name - m_className; // class name - - // the class defining the application behaviour, NULL initially and created - // by GetTraits() when first needed - wxAppTraits *m_traits; - - - // the application object is a singleton anyhow, there is no sense in - // copying it - DECLARE_NO_COPY_CLASS(wxAppConsole) -}; - -// ---------------------------------------------------------------------------- -// wxAppBase: the common part of wxApp implementations for all platforms -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole -{ -public: - wxAppBase(); - virtual ~wxAppBase(); - - // the virtual functions which may/must be overridden in the derived class - // ----------------------------------------------------------------------- - - // very first initialization function - // - // Override: very rarely - virtual bool Initialize(int& argc, wxChar **argv); - - // a platform-dependent version of OnInit(): the code here is likely to - // depend on the toolkit. default version does nothing. - // - // Override: rarely. - virtual bool OnInitGui(); - - // called to start program execution - the default version just enters - // the main GUI loop in which events are received and processed until - // the last window is not deleted (if GetExitOnFrameDelete) or - // ExitMainLoop() is called. In console mode programs, the execution - // of the program really starts here - // - // Override: rarely in GUI applications, always in console ones. - virtual int OnRun(); - - // a matching function for OnInit() - virtual int OnExit(); - - // very last clean up function - // - // Override: very rarely - virtual void CleanUp(); - - - // the worker functions - usually not used directly by the user code - // ----------------------------------------------------------------- - - // return true if we're running main loop, i.e. if the events can - // (already) be dispatched - static bool IsMainLoopRunning() - { - wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance()); - return app && app->m_mainLoop != NULL; - } - - // execute the main GUI loop, the function returns when the loop ends - virtual int MainLoop(); - - // exit the main loop thus terminating the application - virtual void Exit(); - - // exit the main GUI loop during the next iteration (i.e. it does not - // stop the program immediately!) - virtual void ExitMainLoop(); - - // returns true if there are unprocessed events in the event queue - virtual bool Pending(); - - // process the first event in the event queue (blocks until an event - // appears if there are none currently, use Pending() if this is not - // wanted), returns false if the event loop should stop and true - // otherwise - virtual bool Dispatch(); - - // process all currently pending events right now - // - // it is an error to call Yield() recursively unless the value of - // onlyIfNeeded is true - // - // WARNING: this function is dangerous as it can lead to unexpected - // reentrancies (i.e. when called from an event handler it - // may result in calling the same event handler again), use - // with _extreme_ care or, better, don't use at all! - virtual bool Yield(bool onlyIfNeeded = false) = 0; - - // this virtual function is called in the GUI mode when the application - // becomes idle and normally just sends wxIdleEvent to all interested - // parties - // - // it should return true if more idle events are needed, false if not - virtual bool ProcessIdle(); - - // Send idle event to window and all subwindows - // Returns true if more idle time is requested. - virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event); - - -#if wxUSE_EXCEPTIONS - // Function called if an uncaught exception is caught inside the main - // event loop: it may return true to continue running the event loop or - // false to stop it (in the latter case it may rethrow the exception as - // well) - virtual bool OnExceptionInMainLoop(); -#endif // wxUSE_EXCEPTIONS - - - // top level window functions - // -------------------------- - - // return true if our app has focus - virtual bool IsActive() const { return m_isActive; } - - // set the "main" top level window - void SetTopWindow(wxWindow *win) { m_topWindow = win; } - - // return the "main" top level window (if it hadn't been set previously - // with SetTopWindow(), will return just some top level window and, if - // there are none, will return NULL) - virtual wxWindow *GetTopWindow() const; - - // control the exit behaviour: by default, the program will exit the - // main loop (and so, usually, terminate) when the last top-level - // program window is deleted. Beware that if you disable this behaviour - // (with SetExitOnFrameDelete(false)), you'll have to call - // ExitMainLoop() explicitly from somewhere. - void SetExitOnFrameDelete(bool flag) - { m_exitOnFrameDelete = flag ? Yes : No; } - bool GetExitOnFrameDelete() const - { return m_exitOnFrameDelete == Yes; } - - - // display mode, visual, printing mode, ... - // ------------------------------------------------------------------------ - - // Get display mode that is used use. This is only used in framebuffer - // wxWin ports (such as wxMGL or wxDFB). - virtual wxVideoMode GetDisplayMode() const; - // Set display mode to use. This is only used in framebuffer wxWin - // ports (such as wxMGL or wxDFB). This method should be called from - // wxApp::OnInitGui - virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } - - // set use of best visual flag (see below) - void SetUseBestVisual( bool flag, bool forceTrueColour = false ) - { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; } - bool GetUseBestVisual() const { return m_useBestVisual; } - - // set/get printing mode: see wxPRINT_XXX constants. - // - // default behaviour is the normal one for Unix: always use PostScript - // printing. - virtual void SetPrintMode(int WXUNUSED(mode)) { } - int GetPrintMode() const { return wxPRINT_POSTSCRIPT; } - - // Return the layout direction for the current locale or wxLayout_Default - // if it's unknown - virtual wxLayoutDirection GetLayoutDirection() const; - - - // command line parsing (GUI-specific) - // ------------------------------------------------------------------------ - -#if wxUSE_CMDLINE_PARSER - virtual bool OnCmdLineParsed(wxCmdLineParser& parser); - virtual void OnInitCmdLine(wxCmdLineParser& parser); -#endif - - // miscellaneous other stuff - // ------------------------------------------------------------------------ - - // called by toolkit-specific code to set the app status: active (we have - // focus) or not and also the last window which had focus before we were - // deactivated - virtual void SetActive(bool isActive, wxWindow *lastFocus); - -#if WXWIN_COMPATIBILITY_2_6 - // OBSOLETE: don't use, always returns true - // - // returns true if the program is successfully initialized - wxDEPRECATED( bool Initialized() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // perform standard OnIdle behaviour, ensure that this is always called - void OnIdle(wxIdleEvent& event); - - -protected: - // delete all objects in wxPendingDelete list - void DeletePendingObjects(); - - // override base class method to use GUI traits - virtual wxAppTraits *CreateTraits(); - - - // the main event loop of the application (may be NULL if the loop hasn't - // been started yet or has already terminated) - wxEventLoop *m_mainLoop; - - // the main top level window (may be NULL) - wxWindow *m_topWindow; - - // if Yes, exit the main loop when the last top level window is deleted, if - // No don't do it and if Later -- only do it once we reach our OnRun() - // - // the explanation for using this strange scheme is given in appcmn.cpp - enum - { - Later = -1, - No, - Yes - } m_exitOnFrameDelete; - - // true if the app wants to use the best visual on systems where - // more than one are available (Sun, SGI, XFree86 4.0 ?) - bool m_useBestVisual; - // force TrueColour just in case "best" isn't TrueColour - bool m_forceTrueColour; - - // does any of our windows have focus? - bool m_isActive; - - - DECLARE_NO_COPY_CLASS(wxAppBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxAppBase::Initialized() { return true; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// now include the declaration of the real class -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - #if defined(__WXPALMOS__) - #include "wx/palmos/app.h" - #elif defined(__WXMSW__) - #include "wx/msw/app.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/app.h" - #elif defined(__WXMGL__) - #include "wx/mgl/app.h" - #elif defined(__WXDFB__) - #include "wx/dfb/app.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/app.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/app.h" - #elif defined(__WXX11__) - #include "wx/x11/app.h" - #elif defined(__WXMAC__) - #include "wx/mac/app.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/app.h" - #elif defined(__WXPM__) - #include "wx/os2/app.h" - #endif -#else // !GUI - // allow using just wxApp (instead of wxAppConsole) in console programs - typedef wxAppConsole wxApp; -#endif // GUI/!GUI - -// ---------------------------------------------------------------------------- -// the global data -// ---------------------------------------------------------------------------- - -// for compatibility, we define this macro to access the global application -// object of type wxApp -// -// note that instead of using of wxTheApp in application code you should -// consider using DECLARE_APP() after which you may call wxGetApp() which will -// return the object of the correct type (i.e. MyApp and not wxApp) -// -// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in -// console mode it does nothing at all -#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance()) - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// event loop related functions only work in GUI programs -// ------------------------------------------------------ - -// Force an exit from main loop -extern void WXDLLIMPEXP_BASE wxExit(); - -// avoid redeclaring this function here if it had been already declated by -// wx/utils.h, this results in warnings from g++ with -Wredundant-decls -#ifndef wx_YIELD_DECLARED -#define wx_YIELD_DECLARED - -// Yield to other apps/messages -extern bool WXDLLIMPEXP_BASE wxYield(); - -#endif // wx_YIELD_DECLARED - -// Yield to other apps/messages -extern void WXDLLIMPEXP_BASE wxWakeUpIdle(); - -// ---------------------------------------------------------------------------- -// macros for dynamic creation of the application object -// ---------------------------------------------------------------------------- - -// Having a global instance of this class allows wxApp to be aware of the app -// creator function. wxApp can then call this function to create a new app -// object. Convoluted, but necessary. - -class WXDLLIMPEXP_BASE wxAppInitializer -{ -public: - wxAppInitializer(wxAppInitializerFunction fn) - { wxApp::SetInitializerFunction(fn); } -}; - -// the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if -// your compiler really, really wants main() to be in your main program (e.g. -// hello.cpp). Now IMPLEMENT_APP should add this code if required. - -#define IMPLEMENT_WXWIN_MAIN_CONSOLE \ - int main(int argc, char **argv) { return wxEntry(argc, argv); } - -// port-specific header could have defined it already in some special way -#ifndef IMPLEMENT_WXWIN_MAIN - #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE -#endif // defined(IMPLEMENT_WXWIN_MAIN) - -#ifdef __WXUNIVERSAL__ - #include "wx/univ/theme.h" - - #ifdef wxUNIV_DEFAULT_THEME - #define IMPLEMENT_WX_THEME_SUPPORT \ - WX_USE_THEME(wxUNIV_DEFAULT_THEME); - #else - #define IMPLEMENT_WX_THEME_SUPPORT - #endif -#else - #define IMPLEMENT_WX_THEME_SUPPORT -#endif - -// Use this macro if you want to define your own main() or WinMain() function -// and call wxEntry() from there. -#define IMPLEMENT_APP_NO_MAIN(appname) \ - wxAppConsole *wxCreateApp() \ - { \ - wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ - "your program"); \ - return new appname; \ - } \ - wxAppInitializer \ - wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ - DECLARE_APP(appname) \ - appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); } - -// Same as IMPLEMENT_APP() normally but doesn't include themes support in -// wxUniversal builds -#define IMPLEMENT_APP_NO_THEMES(appname) \ - IMPLEMENT_APP_NO_MAIN(appname) \ - IMPLEMENT_WXWIN_MAIN - -// Use this macro exactly once, the argument is the name of the wxApp-derived -// class which is the class of your application. -#define IMPLEMENT_APP(appname) \ - IMPLEMENT_APP_NO_THEMES(appname) \ - IMPLEMENT_WX_THEME_SUPPORT - -// Same as IMPLEMENT_APP(), but for console applications. -#define IMPLEMENT_APP_CONSOLE(appname) \ - IMPLEMENT_APP_NO_MAIN(appname) \ - IMPLEMENT_WXWIN_MAIN_CONSOLE - -// this macro can be used multiple times and just allows you to use wxGetApp() -// function -#define DECLARE_APP(appname) extern appname& wxGetApp(); - - -// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed -// anywhere else but at the very least it suppresses icc warnings about -// defining extern symbols without prior declaration, and it shouldn't do any -// harm -extern wxAppConsole *wxCreateApp(); -extern wxAppInitializer wxTheAppInitializer; - -#endif // _WX_APP_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/apptrait.h b/Source/3rdParty/wx/include/wx/apptrait.h deleted file mode 100644 index 56f36dfea..000000000 --- a/Source/3rdParty/wx/include/wx/apptrait.h +++ /dev/null @@ -1,272 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/apptrait.h -// Purpose: declaration of wxAppTraits and derived classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.06.2003 -// RCS-ID: $Id: apptrait.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APPTRAIT_H_ -#define _WX_APPTRAIT_H_ - -#include "wx/string.h" -#include "wx/platinfo.h" - -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxAppTraits; -#if wxUSE_FONTMAP - class WXDLLIMPEXP_FWD_CORE wxFontMapper; -#endif // wxUSE_FONTMAP -class WXDLLIMPEXP_FWD_BASE wxLog; -class WXDLLIMPEXP_FWD_BASE wxMessageOutput; -class WXDLLIMPEXP_FWD_CORE wxRendererNative; -class WXDLLIMPEXP_FWD_BASE wxString; - -class GSocketGUIFunctionsTable; - - -// ---------------------------------------------------------------------------- -// wxAppTraits: this class defines various configurable aspects of wxApp -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxStandardPathsBase; - -class WXDLLIMPEXP_BASE wxAppTraitsBase -{ -public: - // needed since this class declares virtual members - virtual ~wxAppTraitsBase() { } - - // hooks for creating the global objects, may be overridden by the user - // ------------------------------------------------------------------------ - -#if wxUSE_LOG - // create the default log target - virtual wxLog *CreateLogTarget() = 0; -#endif // wxUSE_LOG - - // create the global object used for printing out messages - virtual wxMessageOutput *CreateMessageOutput() = 0; - -#if wxUSE_FONTMAP - // create the global font mapper object used for encodings/charset mapping - virtual wxFontMapper *CreateFontMapper() = 0; -#endif // wxUSE_FONTMAP - - // get the renderer to use for drawing the generic controls (return value - // may be NULL in which case the default renderer for the current platform - // is used); this is used in GUI only and always returns NULL in console - // - // NB: returned pointer will be deleted by the caller - virtual wxRendererNative *CreateRenderer() = 0; - -#if wxUSE_STDPATHS - // wxStandardPaths object is normally the same for wxBase and wxGUI - // except in the case of wxMac and wxCocoa - virtual wxStandardPathsBase& GetStandardPaths(); -#endif // wxUSE_STDPATHS - - // functions abstracting differences between GUI and console modes - // ------------------------------------------------------------------------ - -#ifdef __WXDEBUG__ - // show the assert dialog with the specified message in GUI or just print - // the string to stderr in console mode - // - // base class version has an implementation (in spite of being pure - // virtual) in base/appbase.cpp which can be called as last resort. - // - // return true to suppress subsequent asserts, false to continue as before - virtual bool ShowAssertDialog(const wxString& msg) = 0; -#endif // __WXDEBUG__ - - // return true if fprintf(stderr) goes somewhere, false otherwise - virtual bool HasStderr() = 0; - - // managing "pending delete" list: in GUI mode we can't immediately delete - // some objects because there may be unprocessed events for them and so we - // only do it during the next idle loop iteration while this is, of course, - // unnecessary in wxBase, so we have a few functions to abstract these - // operations - - // add the object to the pending delete list in GUI, delete it immediately - // in wxBase - virtual void ScheduleForDestroy(wxObject *object) = 0; - - // remove this object from the pending delete list in GUI, do nothing in - // wxBase - virtual void RemoveFromPendingDelete(wxObject *object) = 0; - -#if wxUSE_SOCKETS - // return table of GUI callbacks for GSocket code or NULL in wxBase. This - // is needed because networking classes are in their own library and so - // they can't directly call GUI functions (the same net library can be - // used in both GUI and base apps). To complicate it further, GUI library - // ("wxCore") doesn't depend on networking library and so only a functions - // table can be passed around - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; -#endif - - // return information about the (native) toolkit currently used and its - // runtime (not compile-time) version. - // returns wxPORT_BASE for console applications and one of the remaining - // wxPORT_* values for GUI applications. - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0; - - // return true if the port is using wxUniversal for the GUI, false if not - virtual bool IsUsingUniversalWidgets() const = 0; - - // return the name of the Desktop Environment such as - // "KDE" or "GNOME". May return an empty string. - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } - -protected: -#if wxUSE_STACKWALKER && defined( __WXDEBUG__ ) - // utility function: returns the stack frame as a plain wxString - virtual wxString GetAssertStackTrace(); -#endif -}; - -// ---------------------------------------------------------------------------- -// include the platform-specific version of the class -// ---------------------------------------------------------------------------- - -// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the -// Unix code (and otherwise __UNIX__ wouldn't be defined) -// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptbase.h" -#elif defined(__WIN32__) - #include "wx/msw/apptbase.h" -#elif defined(__UNIX__) && !defined(__EMX__) - #include "wx/unix/apptbase.h" -#elif defined(__WXMAC__) - #include "wx/mac/apptbase.h" -#elif defined(__OS2__) - #include "wx/os2/apptbase.h" -#else // no platform-specific methods to add to wxAppTraits - // wxAppTraits must be a class because it was forward declared as class - class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase - { - }; -#endif // platform - -// ============================================================================ -// standard traits for console and GUI applications -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits -{ -public: -#if wxUSE_LOG - virtual wxLog *CreateLogTarget(); -#endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); -#if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); -#endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif - -#ifdef __WXDEBUG__ - virtual bool ShowAssertDialog(const wxString& msg); -#endif // __WXDEBUG__ - virtual bool HasStderr(); - - virtual void ScheduleForDestroy(wxObject *object); - virtual void RemoveFromPendingDelete(wxObject *object); - - // the GetToolkitVersion for console application is always the same - virtual wxPortId GetToolkitVersion(int *verMaj, int *verMin) const - { - // no toolkits (wxBase is for console applications without GUI support) - // NB: zero means "no toolkit", -1 means "not initialized yet" - // so we must use zero here! - if (verMaj) *verMaj = 0; - if (verMin) *verMin = 0; - return wxPORT_BASE; - } - - virtual bool IsUsingUniversalWidgets() const { return false; } -}; - -// ---------------------------------------------------------------------------- -// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits -{ -public: -#if wxUSE_LOG - virtual wxLog *CreateLogTarget(); -#endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); -#if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); -#endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif - -#ifdef __WXDEBUG__ - virtual bool ShowAssertDialog(const wxString& msg); -#endif // __WXDEBUG__ - virtual bool HasStderr(); - - virtual void ScheduleForDestroy(wxObject *object); - virtual void RemoveFromPendingDelete(wxObject *object); - - virtual bool IsUsingUniversalWidgets() const - { - #ifdef __WXUNIVERSAL__ - return true; - #else - return false; - #endif - } -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// include the platform-specific version of the classes above -// ---------------------------------------------------------------------------- - -// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptrait.h" -#elif defined(__WIN32__) - #include "wx/msw/apptrait.h" -#elif defined(__OS2__) - #include "wx/os2/apptrait.h" -#elif defined(__UNIX__) - #include "wx/unix/apptrait.h" -#elif defined(__WXMAC__) - #include "wx/mac/apptrait.h" -#elif defined(__DOS__) - #include "wx/msdos/apptrait.h" -#else - #if wxUSE_GUI - class wxGUIAppTraits : public wxGUIAppTraitsBase - { - }; - #endif // wxUSE_GUI - class wxConsoleAppTraits: public wxConsoleAppTraitsBase - { - }; -#endif // platform - -#endif // _WX_APPTRAIT_H_ - diff --git a/Source/3rdParty/wx/include/wx/archive.h b/Source/3rdParty/wx/include/wx/archive.h deleted file mode 100644 index dbf26c25c..000000000 --- a/Source/3rdParty/wx/include/wx/archive.h +++ /dev/null @@ -1,381 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/archive.h -// Purpose: Streams for archive formats -// Author: Mike Wetherell -// RCS-ID: $Id: archive.h 43445 2006-11-16 14:30:20Z MW $ -// Copyright: (c) 2004 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARCHIVE_H__ -#define _WX_ARCHIVE_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS - -#include "wx/stream.h" -#include "wx/filename.h" - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveNotifier - -class WXDLLIMPEXP_BASE wxArchiveNotifier -{ -public: - virtual ~wxArchiveNotifier() { } - - virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveEntry -// -// Holds an entry's meta data, such as filename and timestamp. - -class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject -{ -public: - virtual ~wxArchiveEntry() { } - - virtual wxDateTime GetDateTime() const = 0; - virtual wxFileOffset GetSize() const = 0; - virtual wxFileOffset GetOffset() const = 0; - virtual bool IsDir() const = 0; - virtual bool IsReadOnly() const = 0; - virtual wxString GetInternalName() const = 0; - virtual wxPathFormat GetInternalFormat() const = 0; - virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0; - - virtual void SetDateTime(const wxDateTime& dt) = 0; - virtual void SetSize(wxFileOffset size) = 0; - virtual void SetIsDir(bool isDir = true) = 0; - virtual void SetIsReadOnly(bool isReadOnly = true) = 0; - virtual void SetName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) = 0; - - wxArchiveEntry *Clone() const { return DoClone(); } - - void SetNotifier(wxArchiveNotifier& notifier); - virtual void UnsetNotifier() { m_notifier = NULL; } - -protected: - wxArchiveEntry() : m_notifier(NULL) { } - wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } - - virtual void SetOffset(wxFileOffset offset) = 0; - virtual wxArchiveEntry* DoClone() const = 0; - - wxArchiveNotifier *GetNotifier() const { return m_notifier; } - wxArchiveEntry& operator=(const wxArchiveEntry& entry); - -private: - wxArchiveNotifier *m_notifier; - - DECLARE_ABSTRACT_CLASS(wxArchiveEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveInputStream -// -// GetNextEntry() returns an wxArchiveEntry object containing the meta-data -// for the next entry in the archive (and gives away ownership). Reading from -// the wxArchiveInputStream then returns the entry's data. Eof() becomes true -// after an attempt has been made to read past the end of the entry's data. -// -// When there are no more entries, GetNextEntry() returns NULL and sets Eof(). - -class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream -{ -public: - typedef wxArchiveEntry entry_type; - - virtual ~wxArchiveInputStream() { } - - virtual bool OpenEntry(wxArchiveEntry& entry) = 0; - virtual bool CloseEntry() = 0; - - wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } - - virtual char Peek() { return wxInputStream::Peek(); } - -protected: - wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); - wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv); - - virtual wxArchiveEntry *DoGetNextEntry() = 0; - - wxMBConv& GetConv() const { return m_conv; } - -private: - wxMBConv& m_conv; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveOutputStream -// -// PutNextEntry is used to create a new entry in the output archive, then -// the entry's data is written to the wxArchiveOutputStream. -// -// Only one entry can be open for output at a time; another call to -// PutNextEntry closes the current entry and begins the next. -// -// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership -// of the entry object. - -class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream -{ -public: - virtual ~wxArchiveOutputStream() { } - - virtual bool PutNextEntry(wxArchiveEntry *entry) = 0; - - virtual bool PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset) = 0; - - virtual bool PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()) = 0; - - virtual bool CopyEntry(wxArchiveEntry *entry, - wxArchiveInputStream& stream) = 0; - - virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0; - - virtual bool CloseEntry() = 0; - -protected: - wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv); - wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv); - - wxMBConv& GetConv() const { return m_conv; } - -private: - wxMBConv& m_conv; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveIterator -// -// An input iterator that can be used to transfer an archive's catalog to -// a container. - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -#include -#include - -template inline -void _wxSetArchiveIteratorValue( - X& val, Y entry, void *WXUNUSED(d)) -{ - val = X(entry); -} -template inline -void _wxSetArchiveIteratorValue( - std::pair& val, Z entry, Z WXUNUSED(d)) -{ - val = std::make_pair(X(entry->GetInternalName()), Y(entry)); -} - -#if defined _MSC_VER && _MSC_VER < 1300 -template -#else -template -#endif -class wxArchiveIterator -{ -public: - typedef std::input_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; - - wxArchiveIterator() : m_rep(NULL) { } - - wxArchiveIterator(Arc& arc) { - typename Arc::entry_type* entry = arc.GetNextEntry(); - m_rep = entry ? new Rep(arc, entry) : NULL; - } - - wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { - if (m_rep) - m_rep->AddRef(); - } - - ~wxArchiveIterator() { - if (m_rep) - m_rep->UnRef(); - } - - const T& operator *() const { - return m_rep->GetValue(); - } - - const T* operator ->() const { - return &**this; - } - - wxArchiveIterator& operator =(const wxArchiveIterator& it) { - if (it.m_rep) - it.m_rep.AddRef(); - if (m_rep) - m_rep.UnRef(); - m_rep = it.m_rep; - return *this; - } - - wxArchiveIterator& operator ++() { - m_rep = m_rep->Next(); - return *this; - } - - wxArchiveIterator operator ++(int) { - wxArchiveIterator it(*this); - ++(*this); - return it; - } - - bool operator ==(const wxArchiveIterator& j) const { - return m_rep == j.m_rep; - } - - bool operator !=(const wxArchiveIterator& j) const { - return !(*this == j); - } - -private: - class Rep { - Arc& m_arc; - typename Arc::entry_type* m_entry; - T m_value; - int m_ref; - - public: - Rep(Arc& arc, typename Arc::entry_type* entry) - : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { } - ~Rep() - { delete m_entry; } - - void AddRef() { - m_ref++; - } - - void UnRef() { - if (--m_ref == 0) - delete this; - } - - Rep *Next() { - typename Arc::entry_type* entry = m_arc.GetNextEntry(); - if (!entry) { - UnRef(); - return NULL; - } - if (m_ref > 1) { - m_ref--; - return new Rep(m_arc, entry); - } - delete m_entry; - m_entry = entry; - m_value = T(); - return this; - } - - const T& GetValue() { - if (m_entry) { - _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); - m_entry = NULL; - } - return m_value; - } - } *m_rep; -}; - -typedef wxArchiveIterator wxArchiveIter; -typedef wxArchiveIterator > wxArchivePairIter; - -#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveClassFactory -// -// A wxArchiveClassFactory instance for a particular archive type allows -// the creation of the other classes that may be needed. - -void WXDLLIMPEXP_BASE wxUseArchiveClasses(); - -class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase -{ -public: - typedef wxArchiveEntry entry_type; - typedef wxArchiveInputStream instream_type; - typedef wxArchiveOutputStream outstream_type; - typedef wxArchiveNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxArchiveIter iter_type; - typedef wxArchivePairIter pairiter_type; -#endif - - virtual ~wxArchiveClassFactory() { } - - wxArchiveEntry *NewEntry() const - { return DoNewEntry(); } - wxArchiveInputStream *NewStream(wxInputStream& stream) const - { return DoNewStream(stream); } - wxArchiveOutputStream *NewStream(wxOutputStream& stream) const - { return DoNewStream(stream); } - wxArchiveInputStream *NewStream(wxInputStream *stream) const - { return DoNewStream(stream); } - wxArchiveOutputStream *NewStream(wxOutputStream *stream) const - { return DoNewStream(stream); } - - virtual wxString GetInternalName( - const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const = 0; - - void SetConv(wxMBConv& conv) { m_pConv = &conv; } - wxMBConv& GetConv() const - { if (m_pConv) return *m_pConv; else return wxConvLocal; } - - static const wxArchiveClassFactory *Find(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL); - - static const wxArchiveClassFactory *GetFirst(); - const wxArchiveClassFactory *GetNext() const { return m_next; } - - void PushFront() { Remove(); m_next = sm_first; sm_first = this; } - void Remove(); - -protected: - // old compilers don't support covarient returns, so 'Do' methods are - // used to simulate them - virtual wxArchiveEntry *DoNewEntry() const = 0; - virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0; - virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0; - virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; - virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; - - wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } - wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) - { return *this; } - -private: - wxMBConv *m_pConv; - static wxArchiveClassFactory *sm_first; - wxArchiveClassFactory *m_next; - - DECLARE_ABSTRACT_CLASS(wxArchiveClassFactory) -}; - -#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS - -#endif // _WX_ARCHIVE_H__ diff --git a/Source/3rdParty/wx/include/wx/arrimpl.cpp b/Source/3rdParty/wx/include/wx/arrimpl.cpp deleted file mode 100644 index 37b26314a..000000000 --- a/Source/3rdParty/wx/include/wx/arrimpl.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/arrimpl.cpp -// Purpose: helper file for implementation of dynamic lists -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.10.97 -// RCS-ID: $Id: arrimpl.cpp 34241 2005-05-22 12:10:55Z JS $ -// Copyright: (c) 1997 Vadim Zeitlin -// Licence: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -/***************************************************************************** - * Purpose: implements methods of "template" class declared in * - * DECLARE_OBJARRAY macro and which couldn't be implemented inline * - * (because they need the full definition of type T in scope) * - * * - * Usage: 1) #include dynarray.h * - * 2) WX_DECLARE_OBJARRAY * - * 3) #include arrimpl.cpp * - * 4) WX_DEFINE_OBJARRAY * - *****************************************************************************/ - -// needed to resolve the conflict between global T and macro parameter T - -#define _WX_ERROR_REMOVE2(x) wxT("bad index in ") wxT(#x) wxT("::RemoveAt()") - -// macro implements remaining (not inline) methods of template list -// (it's private to this file) -#undef _DEFINE_OBJARRAY -#define _DEFINE_OBJARRAY(T, name) \ -name::~name() \ -{ \ - Empty(); \ -} \ - \ -void name::DoCopy(const name& src) \ -{ \ - for ( size_t ui = 0; ui < src.size(); ui++ ) \ - Add(src[ui]); \ -} \ - \ -name& name::operator=(const name& src) \ -{ \ - Empty(); \ - DoCopy(src); \ - \ - return *this; \ -} \ - \ -name::name(const name& src) : wxArrayPtrVoid() \ -{ \ - DoCopy(src); \ -} \ - \ -void name::DoEmpty() \ -{ \ - for ( size_t ui = 0; ui < size(); ui++ ) \ - delete (T*)base_array::operator[](ui); \ -} \ - \ -void name::RemoveAt(size_t uiIndex, size_t nRemove) \ -{ \ - wxCHECK_RET( uiIndex < size(), _WX_ERROR_REMOVE2(name) ); \ - \ - for (size_t i = 0; i < nRemove; i++ ) \ - delete (T*)base_array::operator[](uiIndex + i); \ - \ - base_array::erase(begin() + uiIndex, begin() + uiIndex + nRemove); \ -} \ - \ -void name::Add(const T& item, size_t nInsert) \ -{ \ - if (nInsert == 0) \ - return; \ - T* pItem = new T(item); \ - size_t nOldSize = size(); \ - if ( pItem != NULL ) \ - base_array::insert(end(), nInsert, pItem); \ - for (size_t i = 1; i < nInsert; i++) \ - base_array::operator[](nOldSize + i) = new T(item); \ -} \ - \ -void name::Insert(const T& item, size_t uiIndex, size_t nInsert) \ -{ \ - if (nInsert == 0) \ - return; \ - T* pItem = new T(item); \ - if ( pItem != NULL ) \ - base_array::insert(begin() + uiIndex, nInsert, pItem); \ - for (size_t i = 1; i < nInsert; i++) \ - base_array::operator[](uiIndex + i) = new T(item); \ -} \ - \ -int name::Index(const T& Item, bool bFromEnd) const \ -{ \ - if ( bFromEnd ) { \ - if ( size() > 0 ) { \ - size_t ui = size() - 1; \ - do { \ - if ( (T*)base_array::operator[](ui) == &Item ) \ - return wx_static_cast(int, ui); \ - ui--; \ - } \ - while ( ui != 0 ); \ - } \ - } \ - else { \ - for( size_t ui = 0; ui < size(); ui++ ) { \ - if( (T*)base_array::operator[](ui) == &Item ) \ - return wx_static_cast(int, ui); \ - } \ - } \ - \ - return wxNOT_FOUND; \ -} - -// redefine the macro so that now it will generate the class implementation -// old value would provoke a compile-time error if this file is not included -#undef WX_DEFINE_OBJARRAY -#define WX_DEFINE_OBJARRAY(name) _DEFINE_OBJARRAY(_wxObjArray##name, name) diff --git a/Source/3rdParty/wx/include/wx/arrstr.h b/Source/3rdParty/wx/include/wx/arrstr.h deleted file mode 100644 index 299cd00f5..000000000 --- a/Source/3rdParty/wx/include/wx/arrstr.h +++ /dev/null @@ -1,377 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/arrstr.h -// Purpose: wxArrayString class -// Author: Mattia Barbon and Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: arrstr.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARRSTR_H -#define _WX_ARRSTR_H - -#include "wx/defs.h" -#include "wx/string.h" - -WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*); -WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*); - -#if wxUSE_STL - -#include "wx/dynarray.h" - -typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*); -typedef wxString _wxArraywxBaseArrayStringBase; -_WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, - wxArray_SortFunction, - class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, - wxBaseArrayStringBase, WXDLLIMPEXP_BASE); -_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, - wxBaseArrayStringBase, = wxStringSortAscending, - class WXDLLIMPEXP_BASE, CMPFUNCwxString); - -class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase -{ -public: - // type of function used by wxArrayString::Sort() - typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, - const wxString& second); - - wxArrayString() { } - wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } - wxArrayString(size_t sz, const wxChar** a); - wxArrayString(size_t sz, const wxString* a); - - int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; - - void Sort(bool reverseOrder = false); - void Sort(CompareFunction function); - void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } - - size_t Add(const wxString& string, size_t copies = 1) - { - wxArrayStringBase::Add(string, copies); - return size() - copies; - } -}; - -class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase -{ -public: - wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) - { } - wxSortedArrayString(const wxSortedArrayString& array) - : wxSortedArrayStringBase(array) - { } - wxSortedArrayString(const wxArrayString& src) - : wxSortedArrayStringBase(wxStringSortAscending) - { - reserve(src.size()); - - for ( size_t n = 0; n < src.size(); n++ ) - Add(src[n]); - } - - int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; -}; - -#else // if !wxUSE_STL - -// ---------------------------------------------------------------------------- -// The string array uses it's knowledge of internal structure of the wxString -// class to optimize string storage. Normally, we would store pointers to -// string, but as wxString is, in fact, itself a pointer (sizeof(wxString) is -// sizeof(char *)) we store these pointers instead. The cast to "wxString *" is -// really all we need to turn such pointer into a string! -// -// Of course, it can be called a dirty hack, but we use twice less memory and -// this approach is also more speed efficient, so it's probably worth it. -// -// Usage notes: when a string is added/inserted, a new copy of it is created, -// so the original string may be safely deleted. When a string is retrieved -// from the array (operator[] or Item() method), a reference is returned. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxArrayString -{ -public: - // type of function used by wxArrayString::Sort() - typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, - const wxString& second); - // type of function used by wxArrayString::Sort(), for compatibility with - // wxArray - typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first, - wxString* second); - - // constructors and destructor - // default ctor - wxArrayString() { Init(false); } - // if autoSort is true, the array is always sorted (in alphabetical order) - // - // NB: the reason for using int and not bool is that like this we can avoid - // using this ctor for implicit conversions from "const char *" (which - // we'd like to be implicitly converted to wxString instead!) - // - // of course, using explicit would be even better - if all compilers - // supported it... - wxArrayString(int autoSort) { Init(autoSort != 0); } - // C string array ctor - wxArrayString(size_t sz, const wxChar** a); - // wxString string array ctor - wxArrayString(size_t sz, const wxString* a); - // copy ctor - wxArrayString(const wxArrayString& array); - // assignment operator - wxArrayString& operator=(const wxArrayString& src); - // not virtual, this class should not be derived from - ~wxArrayString(); - - // memory management - // empties the list, but doesn't release memory - void Empty(); - // empties the list and releases memory - void Clear(); - // preallocates memory for given number of items - void Alloc(size_t nCount); - // minimzes the memory usage (by freeing all extra memory) - void Shrink(); - - // simple accessors - // number of elements in the array - size_t GetCount() const { return m_nCount; } - // is it empty? - bool IsEmpty() const { return m_nCount == 0; } - // number of elements in the array (GetCount is preferred API) - size_t Count() const { return m_nCount; } - - // items access (range checking is done in debug version) - // get item at position uiIndex - wxString& Item(size_t nIndex) const - { - wxASSERT_MSG( nIndex < m_nCount, - wxT("wxArrayString: index out of bounds") ); - - return *(wxString *)&(m_pItems[nIndex]); - } - - // same as Item() - wxString& operator[](size_t nIndex) const { return Item(nIndex); } - // get last item - wxString& Last() const - { - wxASSERT_MSG( !IsEmpty(), - wxT("wxArrayString: index out of bounds") ); - return Item(Count() - 1); - } - - // return a wxString[], useful for the controls which - // take one in their ctor. You must delete[] it yourself - // once you are done with it. Will return NULL if the - // ArrayString was empty. -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxString* GetStringArray() const ); -#endif - - // item management - // Search the element in the array, starting from the beginning if - // bFromEnd is false or from end otherwise. If bCase, comparison is case - // sensitive (default). Returns index of the first item matched or - // wxNOT_FOUND - int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const; - // add new element at the end (if the array is not sorted), return its - // index - size_t Add(const wxString& str, size_t nInsert = 1); - // add new element at given position - void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1); - // expand the array to have count elements - void SetCount(size_t count); - // remove first item matching this value - void Remove(const wxChar *sz); - // remove item by index -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) ); -#endif - void RemoveAt(size_t nIndex, size_t nRemove = 1); - - // sorting - // sort array elements in alphabetical order (or reversed alphabetical - // order if reverseOrder parameter is true) - void Sort(bool reverseOrder = false); - // sort array elements using specified comparaison function - void Sort(CompareFunction compareFunction); - void Sort(CompareFunction2 compareFunction); - - // comparison - // compare two arrays case sensitively - bool operator==(const wxArrayString& a) const; - // compare two arrays case sensitively - bool operator!=(const wxArrayString& a) const { return !(*this == a); } - - // STL-like interface - typedef wxString value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef int difference_type; - typedef size_t size_type; - - // TODO: this code duplicates the one in dynarray.h - class reverse_iterator - { - typedef wxString value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef reverse_iterator itor; - friend itor operator+(int o, const itor& it); - friend itor operator+(const itor& it, int o); - friend itor operator-(const itor& it, int o); - friend difference_type operator -(const itor& i1, const itor& i2); - public: - pointer m_ptr; - reverse_iterator() : m_ptr(NULL) { } - reverse_iterator(pointer ptr) : m_ptr(ptr) { } - reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } - reference operator*() const { return *m_ptr; } - pointer operator->() const { return m_ptr; } - itor& operator++() { --m_ptr; return *this; } - const itor operator++(int) - { reverse_iterator tmp = *this; --m_ptr; return tmp; } - itor& operator--() { ++m_ptr; return *this; } - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } - }; - - class const_reverse_iterator - { - typedef wxString value_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef const_reverse_iterator itor; - friend itor operator+(int o, const itor& it); - friend itor operator+(const itor& it, int o); - friend itor operator-(const itor& it, int o); - friend difference_type operator -(const itor& i1, const itor& i2); - public: - pointer m_ptr; - const_reverse_iterator() : m_ptr(NULL) { } - const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } - const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } - const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } - reference operator*() const { return *m_ptr; } - pointer operator->() const { return m_ptr; } - itor& operator++() { --m_ptr; return *this; } - const itor operator++(int) - { itor tmp = *this; --m_ptr; return tmp; } - itor& operator--() { ++m_ptr; return *this; } - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } - }; - - wxArrayString(const_iterator first, const_iterator last) - { Init(false); assign(first, last); } - wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } - void assign(const_iterator first, const_iterator last); - void assign(size_type n, const_reference v) - { clear(); Add(v, n); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - iterator begin() { return (wxString *)&(m_pItems[0]); } - const_iterator begin() const { return (wxString *)&(m_pItems[0]); } - size_type capacity() const { return m_nSize; } - void clear() { Clear(); } - bool empty() const { return IsEmpty(); } - iterator end() { return begin() + GetCount(); } - const_iterator end() const { return begin() + GetCount(); } - iterator erase(iterator first, iterator last) - { - size_t idx = first - begin(); - RemoveAt(idx, last - first); - return begin() + idx; - } - iterator erase(iterator it) { return erase(it, it + 1); } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - void insert(iterator it, size_type n, const_reference v) - { Insert(v, it - begin(), n); } - iterator insert(iterator it, const_reference v = value_type()) - { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; } - void insert(iterator it, const_iterator first, const_iterator last); - size_type max_size() const { return INT_MAX; } - void pop_back() { RemoveAt(GetCount() - 1); } - void push_back(const_reference v) { Add(v); } - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } - const_reverse_iterator rbegin() const; - reverse_iterator rend() { return reverse_iterator(begin() - 1); } - const_reverse_iterator rend() const; - void reserve(size_type n) /* base::reserve*/; - void resize(size_type n, value_type v = value_type()); - size_type size() const { return GetCount(); } - -protected: - void Init(bool autoSort); // common part of all ctors - void Copy(const wxArrayString& src); // copies the contents of another array - -private: - void Grow(size_t nIncrement = 0); // makes array bigger if needed - void Free(); // free all the strings stored - - void DoSort(); // common part of all Sort() variants - - size_t m_nSize, // current size of the array - m_nCount; // current number of elements - - wxChar **m_pItems; // pointer to data - - bool m_autoSort; // if true, keep the array always sorted -}; - -class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString -{ -public: - wxSortedArrayString() : wxArrayString(true) - { } - wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) - { Copy(array); } -}; - -#endif // !wxUSE_STL - -// this class provides a temporary wxString* from a -// wxArrayString -class WXDLLIMPEXP_BASE wxCArrayString -{ -public: - wxCArrayString( const wxArrayString& array ) - : m_array( array ), m_strings( NULL ) - { } - ~wxCArrayString() { delete[] m_strings; } - - size_t GetCount() const { return m_array.GetCount(); } - wxString* GetStrings() - { - if( m_strings ) return m_strings; - size_t count = m_array.GetCount(); - m_strings = new wxString[count]; - for( size_t i = 0; i < count; ++i ) - m_strings[i] = m_array[i]; - return m_strings; - } - -#if wxABI_VERSION >= 20810 - wxString* Release(); -#endif // wxABI_VERSION >= 20810 - -private: - const wxArrayString& m_array; - wxString* m_strings; -}; - -#endif diff --git a/Source/3rdParty/wx/include/wx/artprov.h b/Source/3rdParty/wx/include/wx/artprov.h deleted file mode 100644 index 31f3bd44e..000000000 --- a/Source/3rdParty/wx/include/wx/artprov.h +++ /dev/null @@ -1,204 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/artprov.h -// Purpose: wxArtProvider class -// Author: Vaclav Slavik -// Modified by: -// Created: 18/03/2002 -// RCS-ID: $Id: artprov.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARTPROV_H_ -#define _WX_ARTPROV_H_ - -#include "wx/string.h" -#include "wx/bitmap.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; -class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; -class wxArtProviderModule; - -// ---------------------------------------------------------------------------- -// Types -// ---------------------------------------------------------------------------- - -typedef wxString wxArtClient; -typedef wxString wxArtID; - -#define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + wxT("_C")) -#define wxART_MAKE_CLIENT_ID(id) wxT(#id) wxT("_C") -#define wxART_MAKE_ART_ID_FROM_STR(id) (id) -#define wxART_MAKE_ART_ID(id) wxT(#id) - -// ---------------------------------------------------------------------------- -// Art clients -// ---------------------------------------------------------------------------- - -#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) -#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) -#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) - -#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) -#define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) -#define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) -#define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) - -#define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) - -// ---------------------------------------------------------------------------- -// Art IDs -// ---------------------------------------------------------------------------- - -#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) -#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) -#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) -#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) -#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) -#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) -#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) -#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) -#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) -#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) -#define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) -#define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) -#define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) -#define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) -#define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) -#define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) -#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) -#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) -#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) -#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) -#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) -#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) -#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) -#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) -#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) -#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) -#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) -#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) -#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) -#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) -#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) -#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) -#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) -#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) -#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) -#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) -#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) -#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) - -#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) -#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) -#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) -#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) -#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW) - -#define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) -#define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) - -#define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) - -#define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) -#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) - - -// ---------------------------------------------------------------------------- -// wxArtProvider class -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxArtProvider : public wxObject -{ -public: - // Dtor removes the provider from providers stack if it's still on it - virtual ~wxArtProvider(); - - - // Add new provider to the top of providers stack (i.e. the provider will - // be queried first of all). - static void Push(wxArtProvider *provider); - - // Add new provider to the bottom of providers stack (i.e. the provider - // will be queried as the last one). -#if wxABI_VERSION >= 20810 - static void PushBack(wxArtProvider *provider); -#endif - // same as PushBack() - static void Insert(wxArtProvider *provider); - - // Remove latest added provider and delete it. - static bool Pop(); - - // Remove provider from providers stack but don't delete it. - static bool Remove(wxArtProvider *provider); - - // Delete the given provider and remove it from the providers stack. - static bool Delete(wxArtProvider *provider); - - - // Query the providers for bitmap with given ID and return it. Return - // wxNullBitmap if no provider provides it. - static wxBitmap GetBitmap(const wxArtID& id, - const wxArtClient& client = wxART_OTHER, - const wxSize& size = wxDefaultSize); - - // Query the providers for icon with given ID and return it. Return - // wxNullIcon if no provider provides it. - static wxIcon GetIcon(const wxArtID& id, - const wxArtClient& client = wxART_OTHER, - const wxSize& size = wxDefaultSize); - - // Get the size hint of an icon from a specific wxArtClient, queries - // the topmost provider if platform_dependent = false - static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); - -#if WXWIN_COMPATIBILITY_2_6 - // use the corresponding methods without redundant "Provider" suffix - wxDEPRECATED( static void PushProvider(wxArtProvider *provider) ); - wxDEPRECATED( static void InsertProvider(wxArtProvider *provider) ); - wxDEPRECATED( static bool PopProvider() ); - - // use Delete() if this is what you really need, or just delete the - // provider pointer, do not use Remove() as it does not delete the pointer - // unlike RemoveProvider() which does - wxDEPRECATED( static bool RemoveProvider(wxArtProvider *provider) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - friend class wxArtProviderModule; - // Initializes default provider - static void InitStdProvider(); - // Initializes platform's native provider, if available (e.g. GTK2) - static void InitNativeProvider(); - // Destroy caches & all providers - static void CleanUpProviders(); - - // Get the default size of an icon for a specific client - virtual wxSize DoGetSizeHint(const wxArtClient& client) - { - return GetSizeHint(client, true); - } - - // Derived classes must override this method to create requested - // art resource. This method is called only once per instance's - // lifetime for each requested wxArtID. - virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), - const wxArtClient& WXUNUSED(client), - const wxSize& WXUNUSED(size)) = 0; - -private: - static void CommonAddingProvider(); - -private: - // list of providers: - static wxArtProvidersList *sm_providers; - // art resources cache (so that CreateXXX is not called that often): - static wxArtProviderCache *sm_cache; - - DECLARE_ABSTRACT_CLASS(wxArtProvider) -}; - - -#endif // _WX_ARTPROV_H_ diff --git a/Source/3rdParty/wx/include/wx/beforestd.h b/Source/3rdParty/wx/include/wx/beforestd.h deleted file mode 100644 index 7261de803..000000000 --- a/Source/3rdParty/wx/include/wx/beforestd.h +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/beforestd.h -// Purpose: #include before STL headers -// Author: Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: beforestd.h 61871 2009-09-09 22:29:51Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/** - Unfortunately, when compiling at maximum warning level, the standard - headers themselves may generate warnings -- and really lots of them. So - before including them, this header should be included to temporarily - suppress the warnings and after this the header afterstd.h should be - included to enable them back again. - - Note that there are intentionally no inclusion guards in this file, because - it can be included several times. - */ - -// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which -// defines _MSC_VER as 1201) does need to be included as it's VC6-like -#if defined(__VISUALC__) && __VISUALC__ <= 1201 - // MSVC 5 does not have this - #if __VISUALC__ > 1100 - // we have to disable (and reenable in afterstd.h) this one because, - // even though it is of level 4, it is not disabled by warning(push, 1) - // below for VC7.1! - - // unreachable code - #pragma warning(disable:4702) - - #pragma warning(push, 1) - #else // VC 5 - // 'expression' : signed/unsigned mismatch - #pragma warning(disable:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(disable:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(disable:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(disable:4663) - #endif - - // these warning have to be disabled and not just temporarily disabled - // because they will be given at the end of the compilation of the - // current source and there is absolutely nothing we can do about them - - // 'foo': unreferenced inline function has been removed - #pragma warning(disable:4514) - - // 'function' : function not inlined - #pragma warning(disable:4710) - - // 'id': identifier was truncated to 'num' characters in the debug info - #pragma warning(disable:4786) -#endif // VC++ < 7 - -/* - Recent versions of Sun C++ compiler use _T in their standard headers and - our definition of it in wx/wxchar.h conflicts with them and breaks - compilation, so undefine _T before including them and redefine it back in - wx/afterstd.h if needed. - */ -#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) - #undef _T -#endif /* SUNCC */ - diff --git a/Source/3rdParty/wx/include/wx/bitmap.h b/Source/3rdParty/wx/include/wx/bitmap.h deleted file mode 100644 index bcee14373..000000000 --- a/Source/3rdParty/wx/include/wx/bitmap.h +++ /dev/null @@ -1,241 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/bitmap.h -// Purpose: wxBitmap class interface -// Author: Vaclav Slavik -// Modified by: -// Created: 22.04.01 -// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BITMAP_H_BASE_ -#define _WX_BITMAP_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/string.h" -#include "wx/gdicmn.h" // for wxBitmapType -#include "wx/colour.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxMask; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -// ---------------------------------------------------------------------------- -// wxVariant support -// ---------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT) -#endif - -// ---------------------------------------------------------------------------- -// wxMask represents the transparent area of the bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMaskBase : public wxObject -{ -public: - // create the mask from bitmap pixels of the given colour - bool Create(const wxBitmap& bitmap, const wxColour& colour); - -#if wxUSE_PALETTE - // create the mask from bitmap pixels with the given palette index - bool Create(const wxBitmap& bitmap, int paletteIndex); -#endif // wxUSE_PALETTE - - // create the mask from the given mono bitmap - bool Create(const wxBitmap& bitmap); - -protected: - // this function is called from Create() to free the existing mask data - virtual void FreeData() = 0; - - // these functions must be overridden to implement the corresponding public - // Create() methods, they shouldn't call FreeData() as it's already called - // by the public wrappers - virtual bool InitFromColour(const wxBitmap& bitmap, - const wxColour& colour) = 0; - virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; -}; - -#if defined(__WXMGL__) || \ - defined(__WXDFB__) || \ - defined(__WXMAC__) || \ - defined(__WXGTK__) || \ - defined(__WXCOCOA__) || \ - defined(__WXMOTIF__) || \ - defined(__WXX11__) - #define wxUSE_BITMAP_BASE 1 -#else - #define wxUSE_BITMAP_BASE 0 -#endif - -// Only used by some ports -// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes -#if wxUSE_BITMAP_BASE - -// ---------------------------------------------------------------------------- -// wxBitmapHandler: class which knows how to create/load/save bitmaps in -// different formats -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapHandlerBase : public wxObject -{ -public: - wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; } - virtual ~wxBitmapHandlerBase() { } - - virtual bool Create(wxBitmap *bitmap, const void* data, long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, - int type, const wxPalette *palette = NULL); - - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(wxBitmapType type) { m_type = type; } - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - wxBitmapType GetType() const { return m_type; } - -private: - wxString m_name; - wxString m_extension; - wxBitmapType m_type; - - DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) -}; - -class WXDLLEXPORT wxBitmapBase : public wxGDIObject -{ -public: - /* - Derived class must implement these: - - wxBitmap(); - wxBitmap(int width, int height, int depth = -1); - wxBitmap(const char bits[], int width, int height, int depth = 1); - wxBitmap(const char* const* bits); - wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); - wxBitmap(const wxImage& image, int depth = -1); - - bool Create(int width, int height, int depth = -1); - - static void InitStandardHandlers(); - */ - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - virtual int GetHeight() const = 0; - virtual int GetWidth() const = 0; - virtual int GetDepth() const = 0; - - virtual wxImage ConvertToImage() const = 0; - - virtual wxMask *GetMask() const = 0; - virtual void SetMask(wxMask *mask) = 0; - - virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0; - - virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = (wxPalette *)NULL) const = 0; - virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; - - /* - If raw bitmap access is supported (see wx/rawbmp.h), the following - methods should be implemented: - - virtual bool GetRawData(wxRawBitmapData *data) = 0; - virtual void UngetRawData(wxRawBitmapData *data) = 0; - */ - -#if wxUSE_PALETTE - virtual wxPalette *GetPalette() const = 0; - virtual void SetPalette(const wxPalette& palette) = 0; -#endif // wxUSE_PALETTE - - // copies the contents and mask of the given (colour) icon to the bitmap - virtual bool CopyFromIcon(const wxIcon& icon) = 0; - - // implementation: - virtual void SetHeight(int height) = 0; - virtual void SetWidth(int width) = 0; - virtual void SetDepth(int depth) = 0; - - // Format handling - static inline wxList& GetHandlers() { return sm_handlers; } - static void AddHandler(wxBitmapHandlerBase *handler); - static void InsertHandler(wxBitmapHandlerBase *handler); - static bool RemoveHandler(const wxString& name); - static wxBitmapHandler *FindHandler(const wxString& name); - static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType); - static wxBitmapHandler *FindHandler(wxBitmapType bitmapType); - - //static void InitStandardHandlers(); - // (wxBitmap must implement this one) - - static void CleanUpHandlers(); - - // this method is only used by the generic implementation of wxMask - // currently but could be useful elsewhere in the future: it can be - // overridden to quantize the colour to correspond to bitmap colour depth - // if necessary; default implementation simply returns the colour as is - virtual wxColour QuantizeColour(const wxColour& colour) const - { - return colour; - } - -protected: - static wxList sm_handlers; - - DECLARE_ABSTRACT_CLASS(wxBitmapBase) -}; - -#endif // wxUSE_BITMAP_BASE - -#if defined(__WXPALMOS__) - #include "wx/palmos/bitmap.h" -#elif defined(__WXMSW__) - #include "wx/msw/bitmap.h" -#elif defined(__WXMOTIF__) - #include "wx/x11/bitmap.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/bitmap.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/bitmap.h" -#elif defined(__WXX11__) - #include "wx/x11/bitmap.h" -#elif defined(__WXMGL__) - #include "wx/mgl/bitmap.h" -#elif defined(__WXDFB__) - #include "wx/dfb/bitmap.h" -#elif defined(__WXMAC__) - #include "wx/mac/bitmap.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/bitmap.h" -#elif defined(__WXPM__) - #include "wx/os2/bitmap.h" -#endif - -// we must include generic mask.h after wxBitmap definition -#if defined(__WXMGL__) || defined(__WXDFB__) - #define wxUSE_GENERIC_MASK 1 -#else - #define wxUSE_GENERIC_MASK 0 -#endif - -#if wxUSE_GENERIC_MASK - #include "wx/generic/mask.h" -#endif - -#endif // _WX_BITMAP_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/bmpbuttn.h b/Source/3rdParty/wx/include/wx/bmpbuttn.h deleted file mode 100644 index f7b96b662..000000000 --- a/Source/3rdParty/wx/include/wx/bmpbuttn.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/bmpbutton.h -// Purpose: wxBitmapButton class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: bmpbuttn.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BMPBUTTON_H_BASE_ -#define _WX_BMPBUTTON_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_BMPBUTTON - -#include "wx/bitmap.h" -#include "wx/button.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxBitmapButton: a button which shows bitmaps instead of the usual string. -// It has different bitmaps for different states (focused/disabled/pressed) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapButtonBase : public wxButton -{ -public: - wxBitmapButtonBase() - { - m_marginX = - m_marginY = 0; - } - - // set the bitmaps - void SetBitmapLabel(const wxBitmap& bitmap) - { m_bmpNormal = bitmap; OnSetBitmap(); } - void SetBitmapSelected(const wxBitmap& sel) - { m_bmpSelected = sel; OnSetBitmap(); } - void SetBitmapFocus(const wxBitmap& focus) - { m_bmpFocus = focus; OnSetBitmap(); } - void SetBitmapDisabled(const wxBitmap& disabled) - { m_bmpDisabled = disabled; OnSetBitmap(); } - void SetBitmapHover(const wxBitmap& hover) - { m_bmpHover = hover; OnSetBitmap(); } - - // retrieve the bitmaps - const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } - const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } - const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } - const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - const wxBitmap& GetBitmapHover() const { return m_bmpHover; } - wxBitmap& GetBitmapLabel() { return m_bmpNormal; } - wxBitmap& GetBitmapSelected() { return m_bmpSelected; } - wxBitmap& GetBitmapFocus() { return m_bmpFocus; } - wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } - wxBitmap& GetBitmapHover() { return m_bmpHover; } - - // set/get the margins around the button - virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } - int GetMarginX() const { return m_marginX; } - int GetMarginY() const { return m_marginY; } - - // deprecated synonym for SetBitmapLabel() -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) ); - - // prevent virtual function hiding - virtual void SetLabel(const wxString& label) - { wxWindow::SetLabel(label); } -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // function called when any of the bitmaps changes - virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); } - - // the bitmaps for various states - wxBitmap m_bmpNormal, - m_bmpSelected, - m_bmpFocus, - m_bmpDisabled, - m_bmpHover; - - // the margins around the bitmap - int m_marginX, - m_marginY; - - - DECLARE_NO_COPY_CLASS(wxBitmapButtonBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap) -{ - SetBitmapLabel(bitmap); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/bmpbuttn.h" -#elif defined(__WXMSW__) - #include "wx/msw/bmpbuttn.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/bmpbuttn.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/bmpbuttn.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/bmpbuttn.h" -#elif defined(__WXMAC__) - #include "wx/mac/bmpbuttn.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/bmpbuttn.h" -#elif defined(__WXPM__) - #include "wx/os2/bmpbuttn.h" -#endif - -#endif // wxUSE_BMPBUTTON - -#endif // _WX_BMPBUTTON_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/bookctrl.h b/Source/3rdParty/wx/include/wx/bookctrl.h deleted file mode 100644 index 98a95dc6e..000000000 --- a/Source/3rdParty/wx/include/wx/bookctrl.h +++ /dev/null @@ -1,403 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/bookctrl.h -// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: bookctrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BOOKCTRL_H_ -#define _WX_BOOKCTRL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_BOOKCTRL - -#include "wx/control.h" -#include "wx/dynarray.h" - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); - -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxBookCtrl hit results -enum -{ - wxBK_HITTEST_NOWHERE = 1, // not on tab - wxBK_HITTEST_ONICON = 2, // on icon - wxBK_HITTEST_ONLABEL = 4, // on label - wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL, - wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page -}; - -// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook) -#define wxBK_DEFAULT 0x0000 -#define wxBK_TOP 0x0010 -#define wxBK_BOTTOM 0x0020 -#define wxBK_LEFT 0x0040 -#define wxBK_RIGHT 0x0080 -#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT) - -// ---------------------------------------------------------------------------- -// wxBookCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBookCtrlBase : public wxControl -{ -public: - // construction - // ------------ - - wxBookCtrlBase() - { - Init(); - } - - wxBookCtrlBase(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, winid, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - // dtor - virtual ~wxBookCtrlBase(); - - - // accessors - // --------- - - // get number of pages in the dialog - virtual size_t GetPageCount() const { return m_pages.size(); } - - // get the panel which represents the given page - wxWindow *GetPage(size_t n) { return m_pages[n]; } - wxWindow *GetPage(size_t n) const { return m_pages[n]; } - - // get the current page or NULL if none - wxWindow *GetCurrentPage() const - { - const int n = GetSelection(); - return n == wxNOT_FOUND ? NULL : GetPage(n); - } - - // get the currently selected page or wxNOT_FOUND if none - virtual int GetSelection() const = 0; - - // set/get the title of a page - virtual bool SetPageText(size_t n, const wxString& strText) = 0; - virtual wxString GetPageText(size_t n) const = 0; - - - // image list stuff: each page may have an image associated with it (all - // images belong to the same image list) - // --------------------------------------------------------------------- - - // sets the image list to use, it is *not* deleted by the control - virtual void SetImageList(wxImageList *imageList); - - // as SetImageList() but we will delete the image list ourselves - void AssignImageList(wxImageList *imageList); - - // get pointer (may be NULL) to the associated image list - wxImageList* GetImageList() const { return m_imageList; } - - // sets/returns item's image index in the current image list - virtual int GetPageImage(size_t n) const = 0; - virtual bool SetPageImage(size_t n, int imageId) = 0; - - - // geometry - // -------- - - // resize the notebook so that all pages will have the specified size - virtual void SetPageSize(const wxSize& size); - - // calculate the size of the control from the size of its page - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0; - - // get/set size of area between book control area and page area - unsigned int GetInternalBorder() const { return m_internalBorder; } - void SetInternalBorder(unsigned int border) { m_internalBorder = border; } - - // Sets/gets the margin around the controller - void SetControlMargin(int margin) { m_controlMargin = margin; } - int GetControlMargin() const { return m_controlMargin; } - - // returns true if we have wxBK_TOP or wxBK_BOTTOM style - bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); } - - // set/get option to shrink to fit current page - void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; } - bool GetFitToCurrentPage() const { return m_fitToCurrentPage; } - - // returns the sizer containing the control, if any - wxSizer* GetControlSizer() const { return m_controlSizer; } - - // operations - // ---------- - - // remove one page from the control and delete it - virtual bool DeletePage(size_t n); - - // remove one page from the notebook, without deleting it - virtual bool RemovePage(size_t n) - { - DoInvalidateBestSize(); - return DoRemovePage(n) != NULL; - } - - // remove all pages and delete them - virtual bool DeleteAllPages() - { - DoInvalidateBestSize(); - WX_CLEAR_ARRAY(m_pages); - return true; - } - - // adds a new page to the control - virtual bool AddPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1) - { - DoInvalidateBestSize(); - return InsertPage(GetPageCount(), page, text, bSelect, imageId); - } - - // the same as AddPage(), but adds the page at the specified position - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1) = 0; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // - // NB: this function will generate PAGE_CHANGING/ED events - virtual int SetSelection(size_t n) = 0; - - // acts as SetSelection but does not generate events - virtual int ChangeSelection(size_t n) = 0; - - - // cycle thru the pages - void AdvanceSelection(bool forward = true) - { - int nPage = GetNextPage(forward); - if ( nPage != -1 ) - { - // cast is safe because of the check above - SetSelection((size_t)nPage); - } - } - - // hit test: returns which page is hit and, optionally, where (icon, label) - virtual int HitTest(const wxPoint& WXUNUSED(pt), - long * WXUNUSED(flags) = NULL) const - { - return wxNOT_FOUND; - } - - - // we do have multiple pages - virtual bool HasMultiplePages() const { return true; } - - -protected: - // flags for DoSetSelection() - enum - { - SetSelection_SendEvent = 1 - }; - - // set the selection to the given page, sending the events (which can - // possibly prevent the page change from taking place) if SendEvent flag is - // included - virtual int DoSetSelection(size_t nPage, int flags = 0); - - // if the derived class uses DoSetSelection() for implementing - // [Set|Change]Selection, it must override UpdateSelectedPage(), - // CreatePageChangingEvent() and MakeChangedEvent(), but as it might not - // use it, these functions are not pure virtual - - // called to notify the control about a new current page - virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) - { wxFAIL_MSG(wxT("Override this function!")); } - - // create a new "page changing" event - virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const - { wxFAIL_MSG(wxT("Override this function!")); return NULL; } - - // modify the event created by CreatePageChangingEvent() to "page changed" - // event, usually by just calling SetEventType() on it - virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event)) - { wxFAIL_MSG(wxT("Override this function!")); } - - - // Should we accept NULL page pointers in Add/InsertPage()? - // - // Default is no but derived classes may override it if they can treat NULL - // pages in some sensible way (e.g. wxTreebook overrides this to allow - // having nodes without any associated page) - virtual bool AllowNullPage() const { return false; } - - // remove the page and return a pointer to it - virtual wxWindow *DoRemovePage(size_t page) = 0; - - // our best size is the size which fits all our pages - virtual wxSize DoGetBestSize() const; - - // helper: get the next page wrapping if we reached the end - int GetNextPage(bool forward) const; - - // Lay out controls - void DoSize(); - - // This method also invalidates the size of the controller and should be - // called instead of just InvalidateBestSize() whenever pages are added or - // removed as this also affects the controller - void DoInvalidateBestSize(); - -#if wxUSE_HELP - // Show the help for the corresponding page - void OnHelp(wxHelpEvent& event); -#endif // wxUSE_HELP - - - // the array of all pages of this control - wxArrayPages m_pages; - - // the associated image list or NULL - wxImageList *m_imageList; - - // true if we must delete m_imageList - bool m_ownsImageList; - - // get the page area - wxRect GetPageRect() const; - - // event handlers - virtual wxSize GetControllerSize() const; - void OnSize(wxSizeEvent& event); - - // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) - wxControl *m_bookctrl; - - // Whether to shrink to fit current page - bool m_fitToCurrentPage; - - // the sizer containing the choice control - wxSizer *m_controlSizer; - - // the margin around the choice control - int m_controlMargin; - -private: - - // common part of all ctors - void Init(); - - // internal border - unsigned int m_internalBorder; - - DECLARE_ABSTRACT_CLASS(wxBookCtrlBase) - DECLARE_NO_COPY_CLASS(wxBookCtrlBase) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxBookCtrlBaseEvent: page changing events generated by derived classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent -{ -public: - wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, winid) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event) - : wxNotifyEvent(event) - { - m_nSel = event.m_nSel; - m_nOldSel = event.m_nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page -}; - -// make a default book control for given platform -#if wxUSE_NOTEBOOK - // dedicated to majority of desktops - #include "wx/notebook.h" - #define wxBookCtrl wxNotebook - #define wxBookCtrlEvent wxNotebookEvent - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING - #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) - #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) - #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func) -#else - // dedicated to Smartphones - #include "wx/choicebk.h" - #define wxBookCtrl wxChoicebook - #define wxBookCtrlEvent wxChoicebookEvent - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING - #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) - #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) - #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func) -#endif - -#if WXWIN_COMPATIBILITY_2_6 - #define wxBC_TOP wxBK_TOP - #define wxBC_BOTTOM wxBK_BOTTOM - #define wxBC_LEFT wxBK_LEFT - #define wxBC_RIGHT wxBK_RIGHT - #define wxBC_DEFAULT wxBK_DEFAULT -#endif - -#endif // wxUSE_BOOKCTRL - -#endif // _WX_BOOKCTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/brush.h b/Source/3rdParty/wx/include/wx/brush.h deleted file mode 100644 index cf963ab2d..000000000 --- a/Source/3rdParty/wx/include/wx/brush.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/brush.h -// Purpose: Includes platform-specific wxBrush file -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: brush.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BRUSH_H_BASE_ -#define _WX_BRUSH_H_BASE_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/gdiobj.h" - -// wxBrushBase -class WXDLLEXPORT wxBrushBase: public wxGDIObject -{ -public: - virtual ~wxBrushBase() { } - - virtual int GetStyle() const = 0; - - virtual bool IsHatch() const - { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); } -}; - -#if defined(__WXPALMOS__) - #include "wx/palmos/brush.h" -#elif defined(__WXMSW__) - #include "wx/msw/brush.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) - #include "wx/x11/brush.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/brush.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/brush.h" -#elif defined(__WXMGL__) - #include "wx/mgl/brush.h" -#elif defined(__WXDFB__) - #include "wx/dfb/brush.h" -#elif defined(__WXMAC__) - #include "wx/mac/brush.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/brush.h" -#elif defined(__WXPM__) - #include "wx/os2/brush.h" -#endif - -#endif - // _WX_BRUSH_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/buffer.h b/Source/3rdParty/wx/include/wx/buffer.h deleted file mode 100644 index f1ef1a23f..000000000 --- a/Source/3rdParty/wx/include/wx/buffer.h +++ /dev/null @@ -1,314 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/buffer.h -// Purpose: auto buffer classes: buffers which automatically free memory -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.04.99 -// RCS-ID: $Id: buffer.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUFFER_H -#define _WX_BUFFER_H - -#include "wx/wxchar.h" - -#include // malloc() and free() - -// ---------------------------------------------------------------------------- -// Special classes for (wide) character strings: they use malloc/free instead -// of new/delete -// ---------------------------------------------------------------------------- - -#define DEFINE_BUFFER(classname, chartype, strdupfunc) \ -class WXDLLIMPEXP_BASE classname \ -{ \ -public: \ - classname(const chartype *str = NULL) \ - : m_str(str ? strdupfunc(str) : NULL) \ - { \ - } \ - \ - classname(size_t len) \ - : m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \ - { \ - m_str[len] = (chartype)0; \ - } \ - \ - /* no need to check for NULL, free() does it */ \ - ~classname() { free(m_str); } \ - \ - /* \ - WARNING: \ - \ - the copy ctor and assignment operators change the passed in object \ - even although it is declared as "const", so: \ - \ - a) it shouldn't be really const \ - b) you shouldn't use it afterwards (or know that it was reset) \ - \ - This is very ugly but is unfortunately needed to make the normal use\ - of classname buffer objects possible and is very similar to what \ - std::auto_ptr<> does (as if it were an excuse...) \ - */ \ - \ - /* \ - because of the remark above, release() is declared const even if it \ - isn't really const \ - */ \ - chartype *release() const \ - { \ - chartype *p = m_str; \ - ((classname *)this)->m_str = NULL; \ - return p; \ - } \ - \ - void reset() \ - { \ - free(m_str); \ - m_str = NULL; \ - } \ - \ - classname(const classname& src) \ - : m_str(src.release()) \ - { \ - } \ - \ - classname& operator=(const chartype *str) \ - { \ - free(m_str); \ - m_str = str ? strdupfunc(str) : NULL; \ - return *this; \ - } \ - \ - classname& operator=(const classname& src) \ - { \ - free(m_str); \ - m_str = src.release(); \ - \ - return *this; \ - } \ - \ - bool extend(size_t len) \ - { \ - chartype * \ - str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \ - if ( !str ) \ - return false; \ - \ - m_str = str; \ - \ - return true; \ - } \ - \ - chartype *data() { return m_str; } \ - const chartype *data() const { return m_str; } \ - operator const chartype *() const { return m_str; } \ - chartype operator[](size_t n) const { return m_str[n]; } \ - \ -private: \ - chartype *m_str; \ -} - -#if wxABI_VERSION >= 20804 -// needed for wxString::char_str() and wchar_str() -#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \ -class WXDLLIMPEXP_BASE classname : public baseclass \ -{ \ -public: \ - classname(const baseclass& src) : baseclass(src) {} \ - classname(const chartype *str = NULL) : baseclass(str) {} \ - \ - operator chartype*() { return this->data(); } \ -} -#endif // wxABI_VERSION >= 20804 - -DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA); -#if wxABI_VERSION >= 20804 -DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char); -#endif - -#if wxUSE_WCHAR_T - -DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW); -#if wxABI_VERSION >= 20804 -DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t); -#endif - -#endif // wxUSE_WCHAR_T - -#undef DEFINE_BUFFER -#undef DEFINE_WRITABLE_BUFFER - -#if wxUSE_UNICODE - typedef wxWCharBuffer wxWxCharBuffer; - - #define wxMB2WXbuf wxWCharBuffer - #define wxWX2MBbuf wxCharBuffer - #define wxWC2WXbuf wxChar* - #define wxWX2WCbuf wxChar* -#else // ANSI - typedef wxCharBuffer wxWxCharBuffer; - - #define wxMB2WXbuf wxChar* - #define wxWX2MBbuf wxChar* - #define wxWC2WXbuf wxCharBuffer - #define wxWX2WCbuf wxWCharBuffer -#endif // Unicode/ANSI - -// ---------------------------------------------------------------------------- -// A class for holding growable data buffers (not necessarily strings) -// ---------------------------------------------------------------------------- - -// This class manages the actual data buffer pointer and is ref-counted. -class wxMemoryBufferData -{ -public: - // the initial size and also the size added by ResizeIfNeeded() - enum { DefBufSize = 1024 }; - - friend class wxMemoryBuffer; - - // everyting is private as it can only be used by wxMemoryBuffer -private: - wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize) - : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0) - { - } - ~wxMemoryBufferData() { free(m_data); } - - - void ResizeIfNeeded(size_t newSize) - { - if (newSize > m_size) - { - void *dataOld = m_data; - m_data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); - if ( !m_data ) - { - free(dataOld); - } - - m_size = newSize + wxMemoryBufferData::DefBufSize; - } - } - - void IncRef() { m_ref += 1; } - void DecRef() - { - m_ref -= 1; - if (m_ref == 0) // are there no more references? - delete this; - } - - - // the buffer containing the data - void *m_data; - - // the size of the buffer - size_t m_size; - - // the amount of data currently in the buffer - size_t m_len; - - // the reference count - size_t m_ref; - - DECLARE_NO_COPY_CLASS(wxMemoryBufferData) -}; - - -class wxMemoryBuffer -{ -public: - // ctor and dtor - wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize) - { - m_bufdata = new wxMemoryBufferData(size); - m_bufdata->IncRef(); - } - - ~wxMemoryBuffer() { m_bufdata->DecRef(); } - - - // copy and assignment - wxMemoryBuffer(const wxMemoryBuffer& src) - : m_bufdata(src.m_bufdata) - { - m_bufdata->IncRef(); - } - - wxMemoryBuffer& operator=(const wxMemoryBuffer& src) - { - m_bufdata->DecRef(); - m_bufdata = src.m_bufdata; - m_bufdata->IncRef(); - return *this; - } - - - // Accessors - void *GetData() const { return m_bufdata->m_data; } - size_t GetBufSize() const { return m_bufdata->m_size; } - size_t GetDataLen() const { return m_bufdata->m_len; } - - void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } - void SetDataLen(size_t len) - { - wxASSERT(len <= m_bufdata->m_size); - m_bufdata->m_len = len; - } - - // Ensure the buffer is big enough and return a pointer to it - void *GetWriteBuf(size_t sizeNeeded) - { - m_bufdata->ResizeIfNeeded(sizeNeeded); - return m_bufdata->m_data; - } - - // Update the length after the write - void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); } - - // Like the above, but appends to the buffer - void *GetAppendBuf(size_t sizeNeeded) - { - m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded); - return (char*)m_bufdata->m_data + m_bufdata->m_len; - } - - // Update the length after the append - void UngetAppendBuf(size_t sizeUsed) - { - SetDataLen(m_bufdata->m_len + sizeUsed); - } - - // Other ways to append to the buffer - void AppendByte(char data) - { - wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") ); - - m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1); - *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data; - m_bufdata->m_len += 1; - } - - void AppendData(const void *data, size_t len) - { - memcpy(GetAppendBuf(len), data, len); - UngetAppendBuf(len); - } - - operator const char *() const { return (const char*)GetData(); } - -private: - wxMemoryBufferData* m_bufdata; -}; - -// ---------------------------------------------------------------------------- -// template class for any kind of data -// ---------------------------------------------------------------------------- - -// TODO - -#endif // _WX_BUFFER_H diff --git a/Source/3rdParty/wx/include/wx/build.h b/Source/3rdParty/wx/include/wx/build.h deleted file mode 100644 index f6f5b0e22..000000000 --- a/Source/3rdParty/wx/include/wx/build.h +++ /dev/null @@ -1,149 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/build.h -// Purpose: Runtime build options checking -// Author: Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 07.05.02 -// RCS-ID: $Id: build.h 35858 2005-10-09 15:48:42Z MBN $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUILD_H_ -#define _WX_BUILD_H_ - -#include "wx/version.h" - -// NB: This file contains macros for checking binary compatibility of libraries -// in multilib buildm, plugins and user components. -// The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should -// uniquely identify binary compatible builds: i.e. if two builds of the -// library are binary compatible, their signature string should be the -// same; if two builds are binary incompatible, their signatures should -// be different. -// -// Therefore, wxUSE_XXX flags that affect binary compatibility (vtables, -// function signatures) should be accounted for here. So should compilers -// and compiler versions (but note that binary compatible compiler versions -// such as gcc-2.95.2 and gcc-2.95.3 should have same signature!). - -// ---------------------------------------------------------------------------- -// WX_BUILD_OPTIONS_SIGNATURE -// ---------------------------------------------------------------------------- - -#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) -#define __WX_BO_STRINGIZE0(x) #x - -#if (wxMINOR_VERSION % 2) == 0 - #define __WX_BO_VERSION(x,y,z) \ - __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) -#else - #define __WX_BO_VERSION(x,y,z) \ - __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) -#endif - -#ifdef __WXDEBUG__ - #define __WX_BO_DEBUG "debug" -#else - #define __WX_BO_DEBUG "no debug" -#endif - -#if wxUSE_UNICODE - #define __WX_BO_UNICODE "Unicode" -#else - #define __WX_BO_UNICODE "ANSI" -#endif - -// GCC and Intel C++ share same C++ ABI (and possibly others in the future), -// check if compiler versions are compatible: -#if defined(__GXX_ABI_VERSION) - #define __WX_BO_COMPILER \ - ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) -#elif defined(__INTEL_COMPILER) - #define __WX_BO_COMPILER ",Intel C++" -#elif defined(__GNUG__) - #define __WX_BO_COMPILER ",GCC " \ - __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) -#elif defined(__VISUALC__) - #define __WX_BO_COMPILER ",Visual C++" -#elif defined(__BORLANDC__) - #define __WX_BO_COMPILER ",Borland C++" -#elif defined(__DIGITALMARS__) - #define __WX_BO_COMPILER ",DigitalMars" -#elif defined(__WATCOMC__) - #define __WX_BO_COMPILER ",Watcom C++" -#else - #define __WX_BO_COMPILER -#endif - -// WXWIN_COMPATIBILITY macros affect presence of virtual functions -#if WXWIN_COMPATIBILITY_2_4 - #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" -#else - #define __WX_BO_WXWIN_COMPAT_2_4 -#endif -#if WXWIN_COMPATIBILITY_2_6 - #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" -#else - #define __WX_BO_WXWIN_COMPAT_2_6 -#endif - -// deriving wxWin containers from STL ones changes them completely: -#if wxUSE_STL - #define __WX_BO_STL ",STL containers" -#else - #define __WX_BO_STL ",wx containers" -#endif - -// This macro is passed as argument to wxConsoleApp::CheckBuildOptions() -#define WX_BUILD_OPTIONS_SIGNATURE \ - __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ - " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ - __WX_BO_COMPILER \ - __WX_BO_STL \ - __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \ - ")" - - -// ---------------------------------------------------------------------------- -// WX_CHECK_BUILD_OPTIONS -// ---------------------------------------------------------------------------- - -// Use this macro to check build options. Adding it to a file in DLL will -// ensure that the DLL checks build options in same way IMPLEMENT_APP() does. -#define WX_CHECK_BUILD_OPTIONS(libName) \ - static struct wxBuildOptionsChecker \ - { \ - wxBuildOptionsChecker() \ - { \ - wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ - libName); \ - } \ - } gs_buildOptionsCheck; - - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// wxBuildOptions -// ---------------------------------------------------------------------------- - -// NB: Don't use this class in new code, it relies on the ctor being always -// inlined. WX_BUILD_OPTIONS_SIGNATURE always works. -class wxBuildOptions -{ -public: - // the ctor must be inline to get the compilation settings of the code - // which included this header - wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} - -private: - const char *m_signature; - - // actually only CheckBuildOptions() should be our friend but well... - friend class wxAppConsole; -}; - -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // _WX_BUILD_H_ diff --git a/Source/3rdParty/wx/include/wx/busyinfo.h b/Source/3rdParty/wx/include/wx/busyinfo.h deleted file mode 100644 index d13d3b68c..000000000 --- a/Source/3rdParty/wx/include/wx/busyinfo.h +++ /dev/null @@ -1,21 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/busyinfo.h -// Purpose: Information window (when app is busy) -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: busyinfo.h 37158 2006-01-26 15:40:46Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __BUSYINFO_H_BASE__ -#define __BUSYINFO_H_BASE__ - -#include "wx/defs.h" - -#if wxUSE_BUSYINFO - -#include "wx/generic/busyinfo.h" - -#endif // wxUSE_BUSYINFO - -#endif // __BUSYINFO_H_BASE__ diff --git a/Source/3rdParty/wx/include/wx/button.h b/Source/3rdParty/wx/include/wx/button.h deleted file mode 100644 index 4ca2305ae..000000000 --- a/Source/3rdParty/wx/include/wx/button.h +++ /dev/null @@ -1,106 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/button.h -// Purpose: wxButtonBase class -// Author: Vadim Zetlin -// Modified by: -// Created: 15.08.00 -// RCS-ID: $Id: button.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Vadim Zetlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUTTON_H_BASE_ -#define _WX_BUTTON_H_BASE_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxButton flags shared with other classes -// ---------------------------------------------------------------------------- - -#if wxUSE_TOGGLEBTN || wxUSE_BUTTON - -// These flags affect label alignment -#define wxBU_LEFT 0x0040 -#define wxBU_TOP 0x0080 -#define wxBU_RIGHT 0x0100 -#define wxBU_BOTTOM 0x0200 -#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) -#endif - -#if wxUSE_BUTTON - -// ---------------------------------------------------------------------------- -// wxButton specific flags -// ---------------------------------------------------------------------------- - -// These two flags are obsolete -#define wxBU_NOAUTODRAW 0x0000 -#define wxBU_AUTODRAW 0x0004 - -// by default, the buttons will be created with some (system dependent) -// minimal size to make them look nicer, giving this style will make them as -// small as possible -#define wxBU_EXACTFIT 0x0001 - -#include "wx/control.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxButton: a push button -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButtonBase : public wxControl -{ -public: - wxButtonBase() { } - - // show the image in the button in addition to the label - virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { } - - // set the margins around the image - virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } - - // this wxButton method is called when the button becomes the default one - // on its panel - virtual void SetDefault() { } - - // Buttons on MSW can look bad if they are not native colours, because - // then they become owner-drawn and not theme-drawn. Disable it here - // in wxButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - - // returns the default button size for this platform - static wxSize GetDefaultSize(); - -protected: - DECLARE_NO_COPY_CLASS(wxButtonBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/button.h" -#elif defined(__WXMSW__) - #include "wx/msw/button.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/button.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/button.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/button.h" -#elif defined(__WXMAC__) - #include "wx/mac/button.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/button.h" -#elif defined(__WXPM__) - #include "wx/os2/button.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/button.h" -#endif - -#endif // wxUSE_BUTTON - -#endif - // _WX_BUTTON_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/caret.h b/Source/3rdParty/wx/include/wx/caret.h deleted file mode 100644 index 848fdcf73..000000000 --- a/Source/3rdParty/wx/include/wx/caret.h +++ /dev/null @@ -1,252 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/caret.h -// Purpose: wxCaretBase class - the interface of wxCaret -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.05.99 -// RCS-ID: $Id: caret.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CARET_H_BASE_ -#define _WX_CARET_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CARET - -// --------------------------------------------------------------------------- -// forward declarations -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -// ---------------------------------------------------------------------------- -// headers we have to include -// ---------------------------------------------------------------------------- - -#include "wx/gdicmn.h" // for wxPoint, wxSize - -// ---------------------------------------------------------------------------- -// A caret is a blinking cursor showing the position where the typed text will -// appear. It can be either a solid block or a custom bitmap (TODO) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCaretBase -{ -public: - // ctors - // ----- - // default - use Create - wxCaretBase() { Init(); } - // create the caret of given (in pixels) width and height and associate - // with the given window - wxCaretBase(wxWindowBase *window, int width, int height) - { - Init(); - - (void)Create(window, width, height); - } - // same as above - wxCaretBase(wxWindowBase *window, const wxSize& size) - { - Init(); - - (void)Create(window, size); - } - - // a virtual dtor has been provided since this class has virtual members - virtual ~wxCaretBase() { } - - // Create() functions - same as ctor but returns the success code - // -------------------------------------------------------------- - - // same as ctor - bool Create(wxWindowBase *window, int width, int height) - { return DoCreate(window, width, height); } - // same as ctor - bool Create(wxWindowBase *window, const wxSize& size) - { return DoCreate(window, size.x, size.y); } - - // accessors - // --------- - - // is the caret valid? - bool IsOk() const { return m_width != 0 && m_height != 0; } - - // is the caret currently shown? - bool IsVisible() const { return m_countVisible > 0; } - - // get the caret position - void GetPosition(int *x, int *y) const - { - if ( x ) *x = m_x; - if ( y ) *y = m_y; - } - wxPoint GetPosition() const { return wxPoint(m_x, m_y); } - - // get the caret size - void GetSize(int *width, int *height) const - { - if ( width ) *width = m_width; - if ( height ) *height = m_height; - } - wxSize GetSize() const { return wxSize(m_width, m_height); } - - // get the window we're associated with - wxWindow *GetWindow() const { return (wxWindow *)m_window; } - - // change the size of the caret - void SetSize(int width, int height) { - m_width = width; - m_height = height; - DoSize(); - } - void SetSize(const wxSize& size) { SetSize(size.x, size.y); } - - - // operations - // ---------- - - // move the caret to given position (in logical coords) - void Move(int x, int y) { m_x = x; m_y = y; DoMove(); } - void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); } - - // show/hide the caret (should be called by wxWindow when needed): - // Show() must be called as many times as Hide() + 1 to make the caret - // visible - virtual void Show(bool show = true) - { - if ( show ) - { - if ( m_countVisible++ == 0 ) - DoShow(); - } - else - { - if ( --m_countVisible == 0 ) - DoHide(); - } - } - virtual void Hide() { Show(false); } - - // blink time is measured in milliseconds and is the time elapsed - // between 2 inversions of the caret (blink time of the caret is common - // to all carets in the Universe, so these functions are static) - static int GetBlinkTime(); - static void SetBlinkTime(int milliseconds); - - // implementation from now on - // -------------------------- - - // these functions should be called by wxWindow when the window gets/loses - // the focus - we create/show and hide/destroy the caret here - virtual void OnSetFocus() { } - virtual void OnKillFocus() { } - -protected: - // these functions may be overriden in the derived classes, but they - // should call the base class version first - virtual bool DoCreate(wxWindowBase *window, int width, int height) - { - m_window = window; - m_width = width; - m_height = height; - - return true; - } - - // pure virtuals to implement in the derived class - virtual void DoShow() = 0; - virtual void DoHide() = 0; - virtual void DoMove() = 0; - virtual void DoSize() { } - - // the common initialization - void Init() - { - m_window = (wxWindowBase *)NULL; - m_x = m_y = 0; - m_width = m_height = 0; - m_countVisible = 0; - } - - // the size of the caret - int m_width, m_height; - - // the position of the caret - int m_x, m_y; - - // the window we're associated with - wxWindowBase *m_window; - - // visibility count: the caret is visible only if it's positive - int m_countVisible; - -private: - DECLARE_NO_COPY_CLASS(wxCaretBase) -}; - -// --------------------------------------------------------------------------- -// now include the real thing -// --------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/caret.h" -#else - #include "wx/generic/caret.h" -#endif // platform - -// ---------------------------------------------------------------------------- -// wxCaretSuspend: a simple class which hides the caret in its ctor and -// restores it in the dtor, this should be used when drawing on the screen to -// avoid overdrawing the caret -// ---------------------------------------------------------------------------- - -#ifdef wxHAS_CARET_USING_OVERLAYS - -// we don't need to hide the caret if it's rendered using overlays -class WXDLLEXPORT wxCaretSuspend -{ -public: - wxCaretSuspend(wxWindow *WXUNUSED(win)) {} - - DECLARE_NO_COPY_CLASS(wxCaretSuspend) -}; - -#else // !wxHAS_CARET_USING_OVERLAYS - -class WXDLLEXPORT wxCaretSuspend -{ -public: - wxCaretSuspend(wxWindow *win) - { - m_caret = win->GetCaret(); - m_show = false; - if ( m_caret && m_caret->IsVisible() ) - { - m_caret->Hide(); - m_show = true; - } - } - - ~wxCaretSuspend() - { - if ( m_caret && m_show ) - m_caret->Show(); - } - -private: - wxCaret *m_caret; - bool m_show; - - DECLARE_NO_COPY_CLASS(wxCaretSuspend) -}; - -#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS - -#endif // wxUSE_CARET - -#endif // _WX_CARET_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/checkbox.h b/Source/3rdParty/wx/include/wx/checkbox.h deleted file mode 100644 index 4760475ab..000000000 --- a/Source/3rdParty/wx/include/wx/checkbox.h +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/checkbox.h -// Purpose: wxCheckBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.09.00 -// RCS-ID: $Id: checkbox.h 39901 2006-06-30 10:51:44Z VS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKBOX_H_BASE_ -#define _WX_CHECKBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CHECKBOX - -#include "wx/control.h" - - -/* - * wxCheckBox style flags - * (Using wxCHK_* because wxCB_* is used by wxComboBox). - * Determine whether to use a 3-state or 2-state - * checkbox. 3-state enables to differentiate - * between 'unchecked', 'checked' and 'undetermined'. - */ -#define wxCHK_2STATE 0x0000 -#define wxCHK_3STATE 0x1000 - -/* - * If this style is set the user can set the checkbox to the - * undetermined state. If not set the undetermined set can only - * be set programmatically. - * This style can only be used with 3 state checkboxes. - */ -#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 - -/* - * The possible states of a 3-state checkbox (Compatible - * with the 2-state checkbox). - */ -enum wxCheckBoxState -{ - wxCHK_UNCHECKED, - wxCHK_CHECKED, - wxCHK_UNDETERMINED /* 3-state checkbox only */ -}; - - -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxCheckBox: a control which shows a label and a box which may be checked -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckBoxBase : public wxControl -{ -public: - wxCheckBoxBase() { } - - // set/get the checked status of the listbox - virtual void SetValue(bool value) = 0; - virtual bool GetValue() const = 0; - - bool IsChecked() const - { - wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for") - wxT(" a three state checkbox, Use Get3StateValue() instead") ); - - return GetValue(); - } - - wxCheckBoxState Get3StateValue() const - { - wxCheckBoxState state = DoGet3StateValue(); - - if ( state == wxCHK_UNDETERMINED && !Is3State() ) - { - // Undetermined state with a 2-state checkbox?? - wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ") - wxT("in an undetermined/third state") ); - - state = wxCHK_UNCHECKED; - } - - return state; - } - - void Set3StateValue(wxCheckBoxState state) - { - if ( state == wxCHK_UNDETERMINED && !Is3State() ) - { - wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state")); - state = wxCHK_UNCHECKED; - } - - DoSet3StateValue(state); - } - - bool Is3State() const { return HasFlag(wxCHK_3STATE); } - - bool Is3rdStateAllowedForUser() const - { - return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); - } - - virtual bool HasTransparentBackground() { return true; } - - // wxCheckBox-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) - { - wxControl::DoUpdateWindowUI(event); - - if ( event.GetSetChecked() ) - SetValue(event.GetChecked()); - } - -protected: - virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } - - virtual wxCheckBoxState DoGet3StateValue() const - { - wxFAIL; - return wxCHK_UNCHECKED; - } - -private: - DECLARE_NO_COPY_CLASS(wxCheckBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/checkbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/checkbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/checkbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/checkbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/checkbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/checkbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checkbox.h" -#elif defined(__WXPM__) - #include "wx/os2/checkbox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/checkbox.h" -#endif - -#endif // wxUSE_CHECKBOX - -#endif - // _WX_CHECKBOX_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/checklst.h b/Source/3rdParty/wx/include/wx/checklst.h deleted file mode 100644 index c8857fd08..000000000 --- a/Source/3rdParty/wx/include/wx/checklst.h +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/checklst.h -// Purpose: wxCheckListBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.00 -// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKLST_H_BASE_ -#define _WX_CHECKLST_H_BASE_ - -#if wxUSE_CHECKLISTBOX - -#include "wx/listbox.h" - -// ---------------------------------------------------------------------------- -// wxCheckListBox: a listbox whose items may be checked -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckListBoxBase : public - #ifdef __WXWINCE__ - // keep virtuals synchronised - wxListBoxBase - #else - wxListBox - #endif -{ -public: - wxCheckListBoxBase() { } - - // check list box specific methods - virtual bool IsChecked(unsigned int item) const = 0; - virtual void Check(unsigned int item, bool check = true) = 0; - - DECLARE_NO_COPY_CLASS(wxCheckListBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/checklst.h" -#elif defined(__WXWINCE__) - #include "wx/msw/wince/checklst.h" -#elif defined(__WXMSW__) - #include "wx/msw/checklst.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/checklst.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/checklst.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/checklst.h" -#elif defined(__WXMAC__) - #include "wx/mac/checklst.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checklst.h" -#elif defined(__WXPM__) - #include "wx/os2/checklst.h" -#endif - -#endif // wxUSE_CHECKLISTBOX - -#endif - // _WX_CHECKLST_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/chkconf.h b/Source/3rdParty/wx/include/wx/chkconf.h deleted file mode 100644 index 811e0c304..000000000 --- a/Source/3rdParty/wx/include/wx/chkconf.h +++ /dev/null @@ -1,1871 +0,0 @@ -/* - * Name: wx/chkconf.h - * Purpose: check the config settings for consistency - * Author: Vadim Zeitlin - * Modified by: - * Created: 09.08.00 - * RCS-ID: $Id: chkconf.h 48113 2007-08-15 17:43:50Z DE $ - * Copyright: (c) 2000 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -/* - Platform-specific checking. - */ - -#if defined(__WXPALMOS__) -# include "wx/palmos/chkconf.h" -#elif defined(__WXWINCE__) -# include "wx/msw/wince/chkconf.h" -#elif defined(__WXMSW__) -# include "wx/msw/chkconf.h" -#elif defined(__WXMAC__) -# include "wx/mac/chkconf.h" -#elif defined(__OS2__) -# include "wx/os2/chkconf.h" -#elif defined(__WXMGL__) -# include "wx/mgl/chkconf.h" -#elif defined(__WXDFB__) -# include "wx/dfb/chkconf.h" -#elif defined(__WXMOTIF__) -# include "wx/motif/chkconf.h" -#elif defined(__WXX11__) -# include "wx/x11/chkconf.h" -#endif - -#ifdef __WXUNIVERSAL__ -# include "wx/univ/chkconf.h" -#endif - -/* - this global setting determines what should we do if the setting FOO - requires BAR and BAR is not set: we can either silently unset FOO as well - (do this if you're trying to build the smallest possible library) or give an - error and abort (default as leads to least surprizing behaviour) - */ -#define wxABORT_ON_CONFIG_ERROR - -/* - global features - */ - -/* GUI build by default */ -#if !defined(wxUSE_GUI) -# define wxUSE_GUI 1 -#endif /* !defined(wxUSE_GUI) */ - -/* Turn off wxUSE_ABI_INCOMPATIBLE_FEATURES if not specified. */ -#if !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) -# define wxUSE_ABI_INCOMPATIBLE_FEATURES 0 -#endif /* !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) */ - -/* - If we're compiling without support for threads/exceptions we have to - disable the corresponding features. - */ -#ifdef wxNO_THREADS -# undef wxUSE_THREADS -# define wxUSE_THREADS 0 -#endif /* wxNO_THREADS */ - -#ifdef wxNO_EXCEPTIONS -# undef wxUSE_EXCEPTIONS -# define wxUSE_EXCEPTIONS 0 -#endif /* wxNO_EXCEPTIONS */ - -/* we also must disable exceptions if compiler doesn't support them */ -#if defined(_MSC_VER) && !defined(_CPPUNWIND) -# undef wxUSE_EXCEPTIONS -# define wxUSE_EXCEPTIONS 0 -#endif /* VC++ without exceptions support */ - - -/* - tests for non GUI features - - please keep the options in alphabetical order! - */ - -#ifndef wxUSE_CRASHREPORT - /* this one is special: as currently it is Windows-only, don't force it - to be defined on other platforms */ -# if defined(wxABORT_ON_CONFIG_ERROR) && defined(__WXMSW__) -# error "wxUSE_CRASHREPORT must be defined." -# else -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* !defined(wxUSE_CRASHREPORT) */ - -#ifndef wxUSE_DYNLIB_CLASS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNLIB_CLASS must be defined." -# else -# define wxUSE_DYNLIB_CLASS 0 -# endif -#endif /* !defined(wxUSE_DYNLIB_CLASS) */ - -#ifndef wxUSE_EXCEPTIONS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_EXCEPTIONS must be defined." -# else -# define wxUSE_EXCEPTIONS 0 -# endif -#endif /* !defined(wxUSE_EXCEPTIONS) */ - -#ifndef wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM must be defined." -# else -# define wxUSE_FILESYSTEM 0 -# endif -#endif /* !defined(wxUSE_FILESYSTEM) */ - -#ifndef wxUSE_FS_ARCHIVE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FS_ARCHIVE must be defined." -# else -# define wxUSE_FS_ARCHIVE 0 -# endif -#endif /* !defined(wxUSE_FS_ARCHIVE) */ - -/* don't give an error about this one yet, it's not fully implemented */ -#ifndef wxUSE_FSVOLUME -# define wxUSE_FSVOLUME 0 -#endif /* !defined(wxUSE_FSVOLUME) */ - -#ifndef wxUSE_DYNAMIC_LOADER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNAMIC_LOADER must be defined." -# else -# define wxUSE_DYNAMIC_LOADER 0 -# endif -#endif /* !defined(wxUSE_DYNAMIC_LOADER) */ - -#ifndef wxUSE_LOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG must be defined." -# else -# define wxUSE_LOG 0 -# endif -#endif /* !defined(wxUSE_LOG) */ - -#ifndef wxUSE_LONGLONG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LONGLONG must be defined." -# else -# define wxUSE_LONGLONG 0 -# endif -#endif /* !defined(wxUSE_LONGLONG) */ - -#ifndef wxUSE_MIMETYPE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MIMETYPE must be defined." -# else -# define wxUSE_MIMETYPE 0 -# endif -#endif /* !defined(wxUSE_MIMETYPE) */ - -#ifndef wxUSE_ON_FATAL_EXCEPTION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ON_FATAL_EXCEPTION must be defined." -# else -# define wxUSE_ON_FATAL_EXCEPTION 0 -# endif -#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */ - -#ifndef wxUSE_PRINTF_POS_PARAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTF_POS_PARAMS must be defined." -# else -# define wxUSE_PRINTF_POS_PARAMS 0 -# endif -#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */ - -#ifndef wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL must be defined." -# else -# define wxUSE_PROTOCOL 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL) */ - -/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */ -#if !wxUSE_PROTOCOL -# undef wxUSE_PROTOCOL_HTTP -# undef wxUSE_PROTOCOL_FTP -# undef wxUSE_PROTOCOL_FILE -# define wxUSE_PROTOCOL_HTTP 0 -# define wxUSE_PROTOCOL_FTP 0 -# define wxUSE_PROTOCOL_FILE 0 -#endif /* wxUSE_PROTOCOL */ - -#ifndef wxUSE_PROTOCOL_HTTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_HTTP must be defined." -# else -# define wxUSE_PROTOCOL_HTTP 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_HTTP) */ - -#ifndef wxUSE_PROTOCOL_FTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FTP must be defined." -# else -# define wxUSE_PROTOCOL_FTP 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_FTP) */ - -#ifndef wxUSE_PROTOCOL_FILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FILE must be defined." -# else -# define wxUSE_PROTOCOL_FILE 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_FILE) */ - -#ifndef wxUSE_REGEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_REGEX must be defined." -# else -# define wxUSE_REGEX 0 -# endif -#endif /* !defined(wxUSE_REGEX) */ - -#ifndef wxUSE_STDPATHS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STDPATHS must be defined." -# else -# define wxUSE_STDPATHS 1 -# endif -#endif /* !defined(wxUSE_STDPATHS) */ - -#ifndef wxUSE_XML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XML must be defined." -# else -# define wxUSE_XML 0 -# endif -#endif /* !defined(wxUSE_XML) */ - -#ifndef wxUSE_SOCKETS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOCKETS must be defined." -# else -# define wxUSE_SOCKETS 0 -# endif -#endif /* !defined(wxUSE_SOCKETS) */ - -#ifndef wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STREAMS must be defined." -# else -# define wxUSE_STREAMS 0 -# endif -#endif /* !defined(wxUSE_STREAMS) */ - -#ifndef wxUSE_STOPWATCH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STOPWATCH must be defined." -# else -# define wxUSE_STOPWATCH 0 -# endif -#endif /* !defined(wxUSE_STOPWATCH) */ - -#ifndef wxUSE_TEXTBUFFER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTBUFFER must be defined." -# else -# define wxUSE_TEXTBUFFER 0 -# endif -#endif /* !defined(wxUSE_TEXTBUFFER) */ - -#ifndef wxUSE_TEXTFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE must be defined." -# else -# define wxUSE_TEXTFILE 0 -# endif -#endif /* !defined(wxUSE_TEXTFILE) */ - -#ifndef wxUSE_UNICODE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE must be defined." -# else -# define wxUSE_UNICODE 0 -# endif -#endif /* !defined(wxUSE_UNICODE) */ - -#ifndef wxUSE_URL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_URL must be defined." -# else -# define wxUSE_URL 0 -# endif -#endif /* !defined(wxUSE_URL) */ - -#ifndef wxUSE_VARIANT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VARIANT must be defined." -# else -# define wxUSE_VARIANT 0 -# endif -#endif /* wxUSE_VARIANT */ - -/* - all these tests are for GUI only - - please keep the options in alphabetical order! - */ -#if wxUSE_GUI - -/* - all of the settings tested below must be defined or we'd get an error from - preprocessor about invalid integer expression - */ - -#ifndef wxUSE_ABOUTDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ABOUTDLG must be defined." -# else -# define wxUSE_ABOUTDLG 0 -# endif -#endif /* !defined(wxUSE_ABOUTDLG) */ - -#ifndef wxUSE_ACCEL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACCEL must be defined." -# else -# define wxUSE_ACCEL 0 -# endif -#endif /* !defined(wxUSE_ACCEL) */ - -#ifndef wxUSE_ANIMATIONCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ANIMATIONCTRL must be defined." -# else -# define wxUSE_ANIMATIONCTRL 0 -# endif -#endif /* !defined(wxUSE_ANIMATIONCTRL) */ - -#ifndef wxUSE_BITMAPCOMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BITMAPCOMBOBOX must be defined." -# else -# define wxUSE_BITMAPCOMBOBOX 0 -# endif -#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */ - -#ifndef wxUSE_BMPBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BMPBUTTON must be defined." -# else -# define wxUSE_BMPBUTTON 0 -# endif -#endif /* !defined(wxUSE_BMPBUTTON) */ - -#ifndef wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BUTTON must be defined." -# else -# define wxUSE_BUTTON 0 -# endif -#endif /* !defined(wxUSE_BUTTON) */ - -#ifndef wxUSE_CALENDARCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CALENDARCTRL must be defined." -# else -# define wxUSE_CALENDARCTRL 0 -# endif -#endif /* !defined(wxUSE_CALENDARCTRL) */ - -#ifndef wxUSE_CARET -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CARET must be defined." -# else -# define wxUSE_CARET 0 -# endif -#endif /* !defined(wxUSE_CARET) */ - -#ifndef wxUSE_CHECKBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKBOX must be defined." -# else -# define wxUSE_CHECKBOX 0 -# endif -#endif /* !defined(wxUSE_CHECKBOX) */ - -#ifndef wxUSE_CHECKLISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKLISTBOX must be defined." -# else -# define wxUSE_CHECKLISTBOX 0 -# endif -#endif /* !defined(wxUSE_CHECKLISTBOX) */ - -#ifndef wxUSE_CHOICE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICE must be defined." -# else -# define wxUSE_CHOICE 0 -# endif -#endif /* !defined(wxUSE_CHOICE) */ - -#ifndef wxUSE_CHOICEBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEBOOK must be defined." -# else -# define wxUSE_CHOICEBOOK 0 -# endif -#endif /* !defined(wxUSE_CHOICEBOOK) */ - -#ifndef wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEDLG must be defined." -# else -# define wxUSE_CHOICEDLG 0 -# endif -#endif /* !defined(wxUSE_CHOICEDLG) */ - -#ifndef wxUSE_CLIPBOARD -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CLIPBOARD must be defined." -# else -# define wxUSE_CLIPBOARD 0 -# endif -#endif /* !defined(wxUSE_CLIPBOARD) */ - -#ifndef wxUSE_COLLPANE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLLPANE must be defined." -# else -# define wxUSE_COLLPANE 0 -# endif -#endif /* !defined(wxUSE_COLLPANE) */ - -#ifndef wxUSE_COLOURDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURDLG must be defined." -# else -# define wxUSE_COLOURDLG 0 -# endif -#endif /* !defined(wxUSE_COLOURDLG) */ - -#ifndef wxUSE_COLOURPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURPICKERCTRL must be defined." -# else -# define wxUSE_COLOURPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_COLOURPICKERCTRL) */ - -#ifndef wxUSE_COMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOBOX must be defined." -# else -# define wxUSE_COMBOBOX 0 -# endif -#endif /* !defined(wxUSE_COMBOBOX) */ - -#ifndef wxUSE_COMBOCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOCTRL must be defined." -# else -# define wxUSE_COMBOCTRL 0 -# endif -#endif /* !defined(wxUSE_COMBOCTRL) */ - -#ifndef wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAOBJ must be defined." -# else -# define wxUSE_DATAOBJ 0 -# endif -#endif /* !defined(wxUSE_DATAOBJ) */ - -#ifndef wxUSE_DATAVIEWCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAVIEWCTRL must be defined." -# else -# define wxUSE_DATAVIEWCTRL 0 -# endif -#endif /* !defined(wxUSE_DATAVIEWCTRL) */ - -#ifndef wxUSE_DATEPICKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATEPICKCTRL must be defined." -# else -# define wxUSE_DATEPICKCTRL 0 -# endif -#endif /* !defined(wxUSE_DATEPICKCTRL) */ - -#ifndef wxUSE_DIRPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIRPICKERCTRL must be defined." -# else -# define wxUSE_DIRPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_DIRPICKERCTRL) */ - -#ifndef wxUSE_DISPLAY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DISPLAY must be defined." -# else -# define wxUSE_DISPLAY 0 -# endif -#endif /* !defined(wxUSE_DISPLAY) */ - -#ifndef wxUSE_DOC_VIEW_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined." -# else -# define wxUSE_DOC_VIEW_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */ - -#ifndef wxUSE_FILEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEDLG must be defined." -# else -# define wxUSE_FILEDLG 0 -# endif -#endif /* !defined(wxUSE_FILEDLG) */ - -#ifndef wxUSE_FILEPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEPICKERCTRL must be defined." -# else -# define wxUSE_FILEPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_FILEPICKERCTRL) */ - -#ifndef wxUSE_FONTDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTDLG must be defined." -# else -# define wxUSE_FONTDLG 0 -# endif -#endif /* !defined(wxUSE_FONTDLG) */ - -#ifndef wxUSE_FONTMAP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTMAP must be defined." -# else -# define wxUSE_FONTMAP 0 -# endif -#endif /* !defined(wxUSE_FONTMAP) */ - -#ifndef wxUSE_FONTPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTPICKERCTRL must be defined." -# else -# define wxUSE_FONTPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_FONTPICKERCTRL) */ - -#ifndef wxUSE_GAUGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GAUGE must be defined." -# else -# define wxUSE_GAUGE 0 -# endif -#endif /* !defined(wxUSE_GAUGE) */ - -#ifndef wxUSE_GRAPHICS_CONTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRAPHICS_CONTEXT must be defined." -# else -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */ - - -#ifndef wxUSE_GRID -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRID must be defined." -# else -# define wxUSE_GRID 0 -# endif -#endif /* !defined(wxUSE_GRID) */ - -#ifndef wxUSE_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP must be defined." -# else -# define wxUSE_HELP 0 -# endif -#endif /* !defined(wxUSE_HELP) */ - -#ifndef wxUSE_HYPERLINKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HYPERLINKCTRL must be defined." -# else -# define wxUSE_HYPERLINKCTRL 0 -# endif -#endif /* !defined(wxUSE_HYPERLINKCTRL) */ - -#ifndef wxUSE_HTML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HTML must be defined." -# else -# define wxUSE_HTML 0 -# endif -#endif /* !defined(wxUSE_HTML) */ - -#ifndef wxUSE_LIBMSPACK -# ifndef __UNIX__ - /* set to 0 on platforms that don't have libmspack */ -# define wxUSE_LIBMSPACK 0 -# else -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBMSPACK must be defined." -# else -# define wxUSE_LIBMSPACK 0 -# endif -# endif -#endif /* !defined(wxUSE_LIBMSPACK) */ - -#ifndef wxUSE_ICO_CUR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ICO_CUR must be defined." -# else -# define wxUSE_ICO_CUR 0 -# endif -#endif /* !defined(wxUSE_ICO_CUR) */ - -#ifndef wxUSE_IFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IFF must be defined." -# else -# define wxUSE_IFF 0 -# endif -#endif /* !defined(wxUSE_IFF) */ - -#ifndef wxUSE_IMAGLIST -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IMAGLIST must be defined." -# else -# define wxUSE_IMAGLIST 0 -# endif -#endif /* !defined(wxUSE_IMAGLIST) */ - -#ifndef wxUSE_JOYSTICK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_JOYSTICK must be defined." -# else -# define wxUSE_JOYSTICK 0 -# endif -#endif /* !defined(wxUSE_JOYSTICK) */ - -#ifndef wxUSE_LISTBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOOK must be defined." -# else -# define wxUSE_LISTBOOK 0 -# endif -#endif /* !defined(wxUSE_LISTBOOK) */ - -#ifndef wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOX must be defined." -# else -# define wxUSE_LISTBOX 0 -# endif -#endif /* !defined(wxUSE_LISTBOX) */ - -#ifndef wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTCTRL must be defined." -# else -# define wxUSE_LISTCTRL 0 -# endif -#endif /* !defined(wxUSE_LISTCTRL) */ - -#ifndef wxUSE_LOGGUI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGGUI must be defined." -# else -# define wxUSE_LOGGUI 0 -# endif -#endif /* !defined(wxUSE_LOGGUI) */ - -#ifndef wxUSE_LOGWINDOW -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGWINDOW must be defined." -# else -# define wxUSE_LOGWINDOW 0 -# endif -#endif /* !defined(wxUSE_LOGWINDOW) */ - -#ifndef wxUSE_LOG_DIALOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG must be defined." -# else -# define wxUSE_LOG_DIALOG 0 -# endif -#endif /* !defined(wxUSE_LOG_DIALOG) */ - -#ifndef wxUSE_MDI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI must be defined." -# else -# define wxUSE_MDI 0 -# endif -#endif /* !defined(wxUSE_MDI) */ - -#ifndef wxUSE_MDI_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI_ARCHITECTURE must be defined." -# else -# define wxUSE_MDI_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */ - -#ifndef wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MENUS must be defined." -# else -# define wxUSE_MENUS 0 -# endif -#endif /* !defined(wxUSE_MENUS) */ - -#ifndef wxUSE_MSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MSGDLG must be defined." -# else -# define wxUSE_MSGDLG 0 -# endif -#endif /* !defined(wxUSE_MSGDLG) */ - -#ifndef wxUSE_NOTEBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_NOTEBOOK must be defined." -# else -# define wxUSE_NOTEBOOK 0 -# endif -#endif /* !defined(wxUSE_NOTEBOOK) */ - -#ifndef wxUSE_ODCOMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ODCOMBOBOX must be defined." -# else -# define wxUSE_ODCOMBOBOX 0 -# endif -#endif /* !defined(wxUSE_ODCOMBOBOX) */ - -#ifndef wxUSE_PALETTE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PALETTE must be defined." -# else -# define wxUSE_PALETTE 0 -# endif -#endif /* !defined(wxUSE_PALETTE) */ - -#ifndef wxUSE_POPUPWIN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_POPUPWIN must be defined." -# else -# define wxUSE_POPUPWIN 0 -# endif -#endif /* !defined(wxUSE_POPUPWIN) */ - -#ifndef wxUSE_PRINTING_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTING_ARCHITECTURE must be defined." -# else -# define wxUSE_PRINTING_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */ - -#ifndef wxUSE_RADIOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX must be defined." -# else -# define wxUSE_RADIOBOX 0 -# endif -#endif /* !defined(wxUSE_RADIOBOX) */ - -#ifndef wxUSE_RADIOBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBTN must be defined." -# else -# define wxUSE_RADIOBTN 0 -# endif -#endif /* !defined(wxUSE_RADIOBTN) */ - -#ifndef wxUSE_SASH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SASH must be defined." -# else -# define wxUSE_SASH 0 -# endif -#endif /* !defined(wxUSE_SASH) */ - -#ifndef wxUSE_SCROLLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SCROLLBAR must be defined." -# else -# define wxUSE_SCROLLBAR 0 -# endif -#endif /* !defined(wxUSE_SCROLLBAR) */ - -#ifndef wxUSE_SLIDER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SLIDER must be defined." -# else -# define wxUSE_SLIDER 0 -# endif -#endif /* !defined(wxUSE_SLIDER) */ - -#ifndef wxUSE_SOUND -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOUND must be defined." -# else -# define wxUSE_SOUND 0 -# endif -#endif /* !defined(wxUSE_SOUND) */ - -#ifndef wxUSE_SPINBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINBTN must be defined." -# else -# define wxUSE_SPINBTN 0 -# endif -#endif /* !defined(wxUSE_SPINBTN) */ - -#ifndef wxUSE_SPINCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINCTRL must be defined." -# else -# define wxUSE_SPINCTRL 0 -# endif -#endif /* !defined(wxUSE_SPINCTRL) */ - -#ifndef wxUSE_SPLASH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLASH must be defined." -# else -# define wxUSE_SPLASH 0 -# endif -#endif /* !defined(wxUSE_SPLASH) */ - -#ifndef wxUSE_SPLITTER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLITTER must be defined." -# else -# define wxUSE_SPLITTER 0 -# endif -#endif /* !defined(wxUSE_SPLITTER) */ - -#ifndef wxUSE_STATBMP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBMP must be defined." -# else -# define wxUSE_STATBMP 0 -# endif -#endif /* !defined(wxUSE_STATBMP) */ - -#ifndef wxUSE_STATBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBOX must be defined." -# else -# define wxUSE_STATBOX 0 -# endif -#endif /* !defined(wxUSE_STATBOX) */ - -#ifndef wxUSE_STATLINE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATLINE must be defined." -# else -# define wxUSE_STATLINE 0 -# endif -#endif /* !defined(wxUSE_STATLINE) */ - -#ifndef wxUSE_STATTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATTEXT must be defined." -# else -# define wxUSE_STATTEXT 0 -# endif -#endif /* !defined(wxUSE_STATTEXT) */ - -#ifndef wxUSE_STATUSBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATUSBAR must be defined." -# else -# define wxUSE_STATUSBAR 0 -# endif -#endif /* !defined(wxUSE_STATUSBAR) */ - -#ifndef wxUSE_TAB_DIALOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TAB_DIALOG must be defined." -# else -# define wxUSE_TAB_DIALOG 0 -# endif -#endif /* !defined(wxUSE_TAB_DIALOG) */ - -#ifndef wxUSE_TEXTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTCTRL must be defined." -# else -# define wxUSE_TEXTCTRL 0 -# endif -#endif /* !defined(wxUSE_TEXTCTRL) */ - -#ifndef wxUSE_TIPWINDOW -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TIPWINDOW must be defined." -# else -# define wxUSE_TIPWINDOW 0 -# endif -#endif /* !defined(wxUSE_TIPWINDOW) */ - -#ifndef wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR must be defined." -# else -# define wxUSE_TOOLBAR 0 -# endif -#endif /* !defined(wxUSE_TOOLBAR) */ - -#ifndef wxUSE_TOOLTIPS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLTIPS must be defined." -# else -# define wxUSE_TOOLTIPS 0 -# endif -#endif /* !defined(wxUSE_TOOLTIPS) */ - -#ifndef wxUSE_TREECTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TREECTRL must be defined." -# else -# define wxUSE_TREECTRL 0 -# endif -#endif /* !defined(wxUSE_TREECTRL) */ - -#ifndef wxUSE_VALIDATORS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VALIDATORS must be defined." -# else -# define wxUSE_VALIDATORS 0 -# endif -#endif /* !defined(wxUSE_VALIDATORS) */ - -#ifndef wxUSE_WXHTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_WXHTML_HELP must be defined." -# else -# define wxUSE_WXHTML_HELP 0 -# endif -#endif /* !defined(wxUSE_WXHTML_HELP) */ - -#ifndef wxUSE_XRC -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XRC must be defined." -# else -# define wxUSE_XRC 0 -# endif -#endif /* !defined(wxUSE_XRC) */ - -#endif /* wxUSE_GUI */ - -/* - check consistency of the settings - */ - -#if WXWIN_COMPATIBILITY_2_4 -# if !WXWIN_COMPATIBILITY_2_6 -# ifdef wxABORT_ON_CONFIG_ERROR -# error "2.4.X compatibility requires 2.6.X compatibility" -# else -# undef WXWIN_COMPATIBILITY_2_6 -# define WXWIN_COMPATIBILITY_2_6 1 -# endif -# endif -#endif /* WXWIN_COMPATIBILITY_2_4 */ - -#if wxUSE_ARCHIVE_STREAMS -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchive requires wxUSE_DATETIME" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 0 -# endif -# endif -#endif /* wxUSE_ARCHIVE_STREAMS */ - -#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" -# else -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* wxUSE_CRASHREPORT */ - -#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_PROTOCOL_XXX */ - -#if wxUSE_URL -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_URL requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_URL */ - -#if wxUSE_PROTOCOL -# if !wxUSE_SOCKETS -# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS" -# else -# undef wxUSE_SOCKETS -# define wxUSE_SOCKETS 1 -# endif -# endif -# endif - -# if !wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL requires wxUSE_STREAMS" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_PROTOCOL */ - -/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */ -#if wxUSE_HTML -# if !wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxHTML requires wxFileSystem" -# else -# undef wxUSE_FILESYSTEM -# define wxUSE_FILESYSTEM 1 -# endif -# endif -#endif /* wxUSE_HTML */ - -#if wxUSE_FS_ARCHIVE -# if !wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchiveFSHandler requires wxFileSystem" -# else -# undef wxUSE_FILESYSTEM -# define wxUSE_FILESYSTEM 1 -# endif -# endif -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchiveFSHandler requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_FS_ARCHIVE */ - -#if wxUSE_FILESYSTEM -# if !wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -# if !wxUSE_FILE && !wxUSE_FFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE" -# else -# undef wxUSE_FILE -# define wxUSE_FILE 1 -# undef wxUSE_FFILE -# define wxUSE_FFILE 1 -# endif -# endif -#endif /* wxUSE_FILESYSTEM */ - -#if wxUSE_FS_INET -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FS_INET requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_FS_INET */ - -#if wxUSE_STOPWATCH || wxUSE_DATETIME -# if !wxUSE_LONGLONG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG" -# else -# undef wxUSE_LONGLONG -# define wxUSE_LONGLONG 1 -# endif -# endif -#endif /* wxUSE_STOPWATCH */ - -#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE" -# else -# undef wxUSE_TEXTFILE -# define wxUSE_TEXTFILE 1 -# endif -#endif /* wxUSE_MIMETYPE */ - -#if wxUSE_ODBC -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxODBC requires wxUSE_DATETIME" -# else -# undef wxUSE_ODBC -# define wxUSE_ODBC 0 -# endif -# endif -#endif /* wxUSE_ODBC */ - -#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER" -# else -# undef wxUSE_TEXTBUFFER -# define wxUSE_TEXTBUFFER 1 -# endif -#endif /* wxUSE_TEXTFILE */ - -#if wxUSE_TEXTFILE && !wxUSE_FILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE requires wxUSE_FILE" -# else -# undef wxUSE_FILE -# define wxUSE_FILE 1 -# endif -#endif /* wxUSE_TEXTFILE */ - -#if wxUSE_XML && !wxUSE_WCHAR_T -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XML requires wxUSE_WCHAR_T" -# else -# undef wxUSE_XML -# define wxUSE_XML 0 -# endif -#endif /* wxUSE_XML */ - -#if !wxUSE_DYNLIB_CLASS -# if wxUSE_DYNAMIC_LOADER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS." -# else -# define wxUSE_DYNLIB_CLASS 1 -# endif -# endif -#endif /* wxUSE_DYNLIB_CLASS */ - -#if wxUSE_ZIPSTREAM -# if !wxUSE_ZLIB -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxZip requires wxZlib" -# else -# undef wxUSE_ZLIB -# define wxUSE_ZLIB 1 -# endif -# endif -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxZip requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_ZIPSTREAM */ - -#if wxUSE_TARSTREAM - /* wxTar doesn't currently compile without wchar_t */ -# if !wxUSE_WCHAR_T -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTar requires wchar_t" -# else -# undef wxUSE_TARSTREAM -# define wxUSE_TARSTREAM 0 -# endif -# endif -#endif /* wxUSE_TARSTREAM */ - -#if wxUSE_TARSTREAM -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTar requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_TARSTREAM */ - -/* the rest of the tests is for the GUI settings only */ -#if wxUSE_GUI - -#if wxUSE_BUTTON || \ - wxUSE_CALENDARCTRL || \ - wxUSE_CARET || \ - wxUSE_COMBOBOX || \ - wxUSE_BMPBUTTON || \ - wxUSE_CHECKBOX || \ - wxUSE_CHECKLISTBOX || \ - wxUSE_CHOICE || \ - wxUSE_GAUGE || \ - wxUSE_GRID || \ - wxUSE_LISTBOX || \ - wxUSE_LISTCTRL || \ - wxUSE_NOTEBOOK || \ - wxUSE_RADIOBOX || \ - wxUSE_RADIOBTN || \ - wxUSE_SCROLLBAR || \ - wxUSE_SLIDER || \ - wxUSE_SPINBTN || \ - wxUSE_SPINCTRL || \ - wxUSE_STATBMP || \ - wxUSE_STATBOX || \ - wxUSE_STATLINE || \ - wxUSE_STATTEXT || \ - wxUSE_STATUSBAR || \ - wxUSE_TEXTCTRL || \ - wxUSE_TOOLBAR || \ - wxUSE_TREECTRL -# if !wxUSE_CONTROLS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CONTROLS unset but some controls used" -# else -# undef wxUSE_CONTROLS -# define wxUSE_CONTROLS 1 -# endif -# endif -#endif /* controls */ - -#if wxUSE_BMPBUTTON -# if !wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON" -# else -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* wxUSE_BMPBUTTON */ - -/* - wxUSE_BOOKCTRL should be only used if any of the controls deriving from it - are used - */ -#ifdef wxUSE_BOOKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BOOKCTRL is defined automatically, don't define it" -# else -# undef wxUSE_BOOKCTRL -# endif -#endif - -#define wxUSE_BOOKCTRL (wxUSE_NOTEBOOK || \ - wxUSE_LISTBOOK || \ - wxUSE_CHOICEBOOK || \ - wxUSE_TOOLBOOK || \ - wxUSE_TREEBOOK) - -#if wxUSE_COLLPANE -# if !wxUSE_BUTTON || !wxUSE_STATLINE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE" -# else -# undef wxUSE_COLLPANE -# define wxUSE_COLLPANE 0 -# endif -# endif -#endif /* wxUSE_COLLPANE */ - -#if wxUSE_LISTBOOK -# if !wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxListbook requires wxListCtrl" -# else -# undef wxUSE_LISTCTRL -# define wxUSE_LISTCTRL 1 -# endif -# endif -#endif /* wxUSE_LISTBOOK */ - -#if wxUSE_CHOICEBOOK -# if !wxUSE_CHOICE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxChoicebook requires wxChoice" -# else -# undef wxUSE_CHOICE -# define wxUSE_CHOICE 1 -# endif -# endif -#endif /* wxUSE_CHOICEBOOK */ - -#if wxUSE_TOOLBOOK -# if !wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxToolbook requires wxToolBar" -# else -# undef wxUSE_TOOLBAR -# define wxUSE_TOOLBAR 1 -# endif -# endif -#endif /* wxUSE_TOOLBOOK */ - -#if !wxUSE_ODCOMBOBOX -# if wxUSE_BITMAPCOMBOBOX -# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" -# else -# undef wxUSE_BITMAPCOMBOBOX -# define wxUSE_BITMAPCOMBOBOX 0 -# endif -#endif /* !wxUSE_ODCOMBOBOX */ - -/* don't attempt to use native status bar on the platforms not having it */ -#ifndef wxUSE_NATIVE_STATUSBAR -# define wxUSE_NATIVE_STATUSBAR 0 -#elif wxUSE_NATIVE_STATUSBAR -# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ - defined(__WXMAC__) || \ - defined(__WXPALMOS__) ) -# undef wxUSE_NATIVE_STATUSBAR -# define wxUSE_NATIVE_STATUSBAR 0 -# endif -#endif - -#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY" -# else -# undef wxUSE_GRAPHICS_CONTEXT -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif /* wxUSE_GRAPHICS_CONTEXT */ - - -/* wxGTK-specific dependencies */ -#ifdef __WXGTK__ -# ifndef __WXUNIVERSAL__ -# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "MDI requires wxUSE_MENUS in wxGTK" -# else -# undef wxUSE_MENUS -# define wxUSE_MENUS 1 -# endif -# endif -# endif /* !__WXUNIVERSAL__ */ - -# if wxUSE_JOYSTICK -# if !wxUSE_THREADS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxJoystick requires threads in wxGTK" -# else -# undef wxUSE_JOYSTICK -# define wxUSE_JOYSTICK 0 -# endif -# endif -# endif -#endif /* wxGTK && !wxUniv */ - -/* Hopefully we can emulate these dialogs in due course */ -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) -# ifdef wxUSE_COLOURDLG -# undef wxUSE_COLOURDLG -# define wxUSE_COLOURDLG 0 -# endif -#endif /* __SMARTPHONE__ && __WXWINCE__ */ - - -/* generic controls dependencies */ -#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) -# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG - /* all common controls are needed by these dialogs */ -# if !defined(wxUSE_CHOICE) || \ - !defined(wxUSE_TEXTCTRL) || \ - !defined(wxUSE_BUTTON) || \ - !defined(wxUSE_CHECKBOX) || \ - !defined(wxUSE_STATTEXT) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "These common controls are needed by common dialogs" -# else -# undef wxUSE_CHOICE -# define wxUSE_CHOICE 1 -# undef wxUSE_TEXTCTRL -# define wxUSE_TEXTCTRL 1 -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# undef wxUSE_CHECKBOX -# define wxUSE_CHECKBOX 1 -# undef wxUSE_STATTEXT -# define wxUSE_STATTEXT 1 -# endif -# endif -# endif -#endif /* !wxMSW || wxUniv */ - -/* common dependencies */ -#if wxUSE_CALENDARCTRL -# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCalendarCtrl requires wxSpinButton and wxComboBox" -# else -# undef wxUSE_SPINBTN -# undef wxUSE_COMBOBOX -# define wxUSE_SPINBTN 1 -# define wxUSE_COMBOBOX 1 -# endif -# endif - -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCalendarCtrl requires wxUSE_DATETIME" -# else -# undef wxUSE_DATETIME -# define wxUSE_DATETIME 1 -# endif -# endif -#endif /* wxUSE_CALENDARCTRL */ - -#if wxUSE_DATEPICKCTRL -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDatePickerCtrl requires wxUSE_DATETIME" -# else -# undef wxUSE_DATETIME -# define wxUSE_DATETIME 1 -# endif -# endif -#endif /* wxUSE_DATEPICKCTRL */ - -#if wxUSE_CHECKLISTBOX -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCheckListBox requires wxListBox" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -#endif /* wxUSE_CHECKLISTBOX */ - -#if wxUSE_CHOICEDLG -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Choice dialogs requires wxListBox" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -#endif /* wxUSE_CHOICEDLG */ - -#if wxUSE_HELP -# if !wxUSE_BMPBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP requires wxUSE_BMPBUTTON" -# else -# undef wxUSE_BMPBUTTON -# define wxUSE_BMPBUTTON 1 -# endif -# endif - -# if !wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP requires wxUSE_CHOICEDLG" -# else -# undef wxUSE_CHOICEDLG -# define wxUSE_CHOICEDLG 1 -# endif -# endif -#endif /* wxUSE_HELP */ - -#if wxUSE_MS_HTML_HELP - /* - this doesn't make sense for platforms other than MSW but we still - define it in wx/setup_inc.h so don't complain if it happens to be - defined under another platform but just silently fix it. - */ -# ifndef __WXMSW__ -# undef wxUSE_MS_HTML_HELP -# define wxUSE_MS_HTML_HELP 0 -# endif -#endif /* wxUSE_MS_HTML_HELP */ - -#if wxUSE_WXHTML_HELP -# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Built in help controller can't be compiled" -# else -# undef wxUSE_HELP -# define wxUSE_HELP 1 -# undef wxUSE_HTML -# define wxUSE_HTML 1 -# undef wxUSE_COMBOBOX -# define wxUSE_COMBOBOX 1 -# undef wxUSE_NOTEBOOK -# define wxUSE_NOTEBOOK 1 -# undef wxUSE_SPINCTRL -# define wxUSE_SPINCTRL 1 -# endif -# endif -#endif /* wxUSE_WXHTML_HELP */ - -#if !wxUSE_IMAGE -/* - The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the - user explicitly wants this and disable all other features that require - wxUSE_IMAGE. - */ -# if wxUSE_DRAGIMAGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE" -# else -# undef wxUSE_DRAGIMAGE -# define wxUSE_DRAGIMAGE 0 -# endif -# endif - -# if wxUSE_LIBPNG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBPNG requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBPNG -# define wxUSE_LIBPNG 0 -# endif -# endif - -# if wxUSE_LIBJPEG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBJPEG requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBJPEG -# define wxUSE_LIBJPEG 0 -# endif -# endif - -# if wxUSE_LIBTIFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBTIFF requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBTIFF -# define wxUSE_LIBTIFF 0 -# endif -# endif - -# if wxUSE_GIF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GIF requires wxUSE_IMAGE" -# else -# undef wxUSE_GIF -# define wxUSE_GIF 0 -# endif -# endif - -# if wxUSE_PNM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PNM requires wxUSE_IMAGE" -# else -# undef wxUSE_PNM -# define wxUSE_PNM 0 -# endif -# endif - -# if wxUSE_PCX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PCX requires wxUSE_IMAGE" -# else -# undef wxUSE_PCX -# define wxUSE_PCX 0 -# endif -# endif - -# if wxUSE_IFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IFF requires wxUSE_IMAGE" -# else -# undef wxUSE_IFF -# define wxUSE_IFF 0 -# endif -# endif - -# if wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR requires wxUSE_IMAGE" -# else -# undef wxUSE_TOOLBAR -# define wxUSE_TOOLBAR 0 -# endif -# endif - -# if wxUSE_XPM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XPM requires wxUSE_IMAGE" -# else -# undef wxUSE_XPM -# define wxUSE_XPM 0 -# endif -# endif - -#endif /* !wxUSE_IMAGE */ - -#if wxUSE_DOC_VIEW_ARCHITECTURE -# if !wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_MENUS" -# else -# undef wxUSE_MENUS -# define wxUSE_MENUS 1 -# endif -# endif - -# if !wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_CHOICEDLG" -# else -# undef wxUSE_CHOICEDLG -# define wxUSE_CHOICEDLG 1 -# endif -# endif - -# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */ - -#if wxUSE_PRINTING_ARCHITECTURE -# if !wxUSE_COMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Print dialog requires wxUSE_COMBOBOX" -# else -# undef wxUSE_COMBOBOX -# define wxUSE_COMBOBOX 1 -# endif -# endif -#endif /* wxUSE_PRINTING_ARCHITECTURE */ - -#if wxUSE_MDI_ARCHITECTURE -# if !wxUSE_MDI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "MDI requires wxUSE_MDI" -# else -# undef wxUSE_MDI -# define wxUSE_MDI 1 -# endif -# endif - -# if !wxUSE_DOC_VIEW_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE" -# else -# undef wxUSE_DOC_VIEW_ARCHITECTURE -# define wxUSE_DOC_VIEW_ARCHITECTURE 1 -# endif -# endif -#endif /* wxUSE_MDI_ARCHITECTURE */ - -#if !wxUSE_FILEDLG -# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!" -# else -# undef wxUSE_FILEDLG -# define wxUSE_FILEDLG 1 -# endif -# endif -#endif /* wxUSE_FILEDLG */ - -#if !wxUSE_GAUGE || !wxUSE_BUTTON -# if wxUSE_PROGRESSDLG && !defined(__WXPALMOS__) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" -# else -# undef wxUSE_GAUGE -# undef wxUSE_BUTTON -# define wxUSE_GAUGE 1 -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* !wxUSE_GAUGE */ - -#if !wxUSE_BUTTON -# if wxUSE_FONTDLG || \ - wxUSE_FILEDLG || \ - wxUSE_CHOICEDLG || \ - wxUSE_NUMBERDLG || \ - wxUSE_TEXTDLG || \ - wxUSE_DIRDLG || \ - wxUSE_STARTUP_TIPS || \ - wxUSE_WIZARDDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Common and generic dialogs require wxUSE_BUTTON" -# else -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* !wxUSE_BUTTON */ - -#if !wxUSE_TOOLBAR -# if wxUSE_TOOLBAR_NATIVE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1" -# else -# undef wxUSE_TOOLBAR_NATIVE -# define wxUSE_TOOLBAR_NATIVE 0 -# endif -# endif -#endif - -#if !wxUSE_IMAGLIST -# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxImageList must be compiled as well" -# else -# undef wxUSE_IMAGLIST -# define wxUSE_IMAGLIST 1 -# endif -# endif -#endif /* !wxUSE_IMAGLIST */ - -#if !wxUSE_MSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR - /* FIXME: should compile without it, of course, but doesn't */ -# error "wxMessageBox is always needed" -# else -# undef wxUSE_MSGDLG -# define wxUSE_MSGDLG 1 -# endif -#endif - -#if wxUSE_RADIOBOX -# if !wxUSE_RADIOBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN" -# else -# undef wxUSE_RADIOBTN -# define wxUSE_RADIOBTN 1 -# endif -# endif -# if !wxUSE_STATBOX && !defined(__WXPALMOS__) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX requires wxUSE_STATBOX" -# else -# undef wxUSE_STATBOX -# define wxUSE_STATBOX 1 -# endif -# endif -#endif /* wxUSE_RADIOBOX */ - -#if wxUSE_LOGWINDOW -# if !wxUSE_TEXTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL" -# else -# undef wxUSE_TEXTCTRL -# define wxUSE_TEXTCTRL 1 -# endif -# endif -#endif /* wxUSE_LOGWINDOW */ - -#if wxUSE_LOG_DIALOG -# if !wxUSE_LISTCTRL || !wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON" -# else -# undef wxUSE_LISTCTRL -# define wxUSE_LISTCTRL 1 -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* wxUSE_LOG_DIALOG */ - -#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxClipboard requires wxDataObject" -# else -# undef wxUSE_DATAOBJ -# define wxUSE_DATAOBJ 1 -# endif -#endif /* wxUSE_CLIPBOARD */ - -#if wxUSE_WX_RESOURCES && !wxUSE_PROLOGIO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxr resources require PrologIO" -# else -# undef wxUSE_PROLOGIO -# define wxUSE_PROLOGIO 1 -# endif -#endif /* wxUSE_WX_RESOURCES */ - -#if wxUSE_XRC && !wxUSE_XML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XRC requires wxUSE_XML" -# else -# undef wxUSE_XRC -# define wxUSE_XRC 0 -# endif -#endif /* wxUSE_XRC */ - -#if wxUSE_SOCKETS && !wxUSE_STOPWATCH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH" -# else -# undef wxUSE_SOCKETS -# define wxUSE_SOCKETS 0 -# endif -#endif /* wxUSE_SOCKETS */ - -#if !wxUSE_VARIANT -# if wxUSE_DATAVIEWCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDataViewCtrl requires wxVariant" -# else -# undef wxUSE_DATAVIEWCTRL -# define wxUSE_DATAVIEWCTRL 0 -# endif -# endif - -# if wxUSE_ODBC -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ODBC requires wxVariant" -# else -# undef wxUSE_ODBC -# define wxUSE_ODBC 0 -# endif -# endif -#endif /* wxUSE_VARIANT */ - -#endif /* wxUSE_GUI */ diff --git a/Source/3rdParty/wx/include/wx/choicdlg.h b/Source/3rdParty/wx/include/wx/choicdlg.h deleted file mode 100644 index 76867ec67..000000000 --- a/Source/3rdParty/wx/include/wx/choicdlg.h +++ /dev/null @@ -1,22 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/choicdgg.h -// Purpose: Includes generic choice dialog file -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: choicdlg.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICDLG_H_BASE_ -#define _WX_CHOICDLG_H_BASE_ - -#if wxUSE_CHOICEDLG - -#include "wx/generic/choicdgg.h" - -#endif - -#endif - // _WX_CHOICDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/choice.h b/Source/3rdParty/wx/include/wx/choice.h deleted file mode 100644 index fe2a9fa76..000000000 --- a/Source/3rdParty/wx/include/wx/choice.h +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/choice.h -// Purpose: wxChoice class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: choice.h 42727 2006-10-30 16:04:27Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICE_H_BASE_ -#define _WX_CHOICE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CHOICE - -#include "wx/ctrlsub.h" // the base class - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxChoiceNameStr[]; - -// ---------------------------------------------------------------------------- -// wxChoice allows to select one of a non-modifiable list of strings -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoiceBase : public wxControlWithItems -{ -public: - wxChoiceBase() { } - virtual ~wxChoiceBase(); - - // all generic methods are in wxControlWithItems - - // get the current selection: this can only be different from the normal - // selection if the popup items list is currently opened and the user - // selected some item in it but didn't close the list yet; otherwise (and - // currently always on platforms other than MSW) this is the same as - // GetSelection() - virtual int GetCurrentSelection() const { return GetSelection(); } - - // set/get the number of columns in the control (as they're not supported on - // most platforms, they do nothing by default) - virtual void SetColumns(int WXUNUSED(n) = 1 ) { } - virtual int GetColumns() const { return 1 ; } - - // emulate selecting the item event.GetInt() - void Command(wxCommandEvent& event); - -private: - DECLARE_NO_COPY_CLASS(wxChoiceBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent class definition -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/choice.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/choicece.h" -#elif defined(__WXMSW__) - #include "wx/msw/choice.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/choice.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/choice.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/choice.h" -#elif defined(__WXMAC__) - #include "wx/mac/choice.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/choice.h" -#elif defined(__WXPM__) - #include "wx/os2/choice.h" -#endif - -#endif // wxUSE_CHOICE - -#endif // _WX_CHOICE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/choicebk.h b/Source/3rdParty/wx/include/wx/choicebk.h deleted file mode 100644 index 2f35c0a01..000000000 --- a/Source/3rdParty/wx/include/wx/choicebk.h +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/choicebk.h -// Purpose: wxChoicebook: wxChoice and wxNotebook combination -// Author: Vadim Zeitlin -// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h -// Created: 15.09.04 -// RCS-ID: $Id: choicebk.h 59616 2009-03-18 21:58:15Z VZ $ -// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICEBOOK_H_ -#define _WX_CHOICEBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_CHOICEBOOK - -#include "wx/bookctrl.h" -#include "wx/choice.h" - -class WXDLLIMPEXP_FWD_CORE wxChoice; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING; - -// wxChoicebook flags -#define wxCHB_DEFAULT wxBK_DEFAULT -#define wxCHB_TOP wxBK_TOP -#define wxCHB_BOTTOM wxBK_BOTTOM -#define wxCHB_LEFT wxBK_LEFT -#define wxCHB_RIGHT wxBK_RIGHT -#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK - -// ---------------------------------------------------------------------------- -// wxChoicebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase -{ -public: - wxChoicebook() - { - Init(); - } - - wxChoicebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - - // returns the choice control - wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the choice control should have - virtual wxSize GetControllerSize() const; - - void UpdateSelectedPage(size_t newsel) - { - m_selection = wx_static_cast(int, newsel); - GetChoiceCtrl()->Select(m_selection); - } - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // event handlers - void OnChoiceSelected(wxCommandEvent& event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) -}; - -// ---------------------------------------------------------------------------- -// choicebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxChoicebookEvent(const wxChoicebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent) -}; - -typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&); - -#define wxChoicebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func) - -#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn)) - -#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn)) - -#endif // wxUSE_CHOICEBOOK - -#endif // _WX_CHOICEBOOK_H_ diff --git a/Source/3rdParty/wx/include/wx/clipbrd.h b/Source/3rdParty/wx/include/wx/clipbrd.h deleted file mode 100644 index 11976bec9..000000000 --- a/Source/3rdParty/wx/include/wx/clipbrd.h +++ /dev/null @@ -1,145 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clipbrd.h -// Purpose: wxClipboad class and clipboard functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.10.99 -// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLIPBRD_H_BASE_ -#define _WX_CLIPBRD_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CLIPBOARD - - -#include "wx/object.h" -#include "wx/wxchar.h" - -class WXDLLIMPEXP_FWD_CORE wxDataFormat; -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLIMPEXP_FWD_CORE wxClipboard; - -// ---------------------------------------------------------------------------- -// wxClipboard represents the system clipboard. Normally, you should use -// wxTheClipboard which is a global pointer to the (unique) clipboard. -// -// Clipboard can be used to copy data to/paste data from. It works together -// with wxDataObject. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxClipboardBase : public wxObject -{ -public: - wxClipboardBase() {} - - // open the clipboard before Add/SetData() and GetData() - virtual bool Open() = 0; - - // close the clipboard after Add/SetData() and GetData() - virtual void Close() = 0; - - // query whether the clipboard is opened - virtual bool IsOpened() const = 0; - - // add to the clipboard data - // - // NB: the clipboard owns the pointer and will delete it, so data must be - // allocated on the heap - virtual bool AddData( wxDataObject *data ) = 0; - - // set the clipboard data, this is the same as Clear() followed by - // AddData() - virtual bool SetData( wxDataObject *data ) = 0; - - // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ) = 0; - - // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ) = 0; - - // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear() = 0; - - // flushes the clipboard: this means that the data which is currently on - // clipboard will stay available even after the application exits (possibly - // eating memory), otherwise the clipboard will be emptied on exit - virtual bool Flush() { return false; } - - // X11 has two clipboards which get selected by this call. Empty on MSW. - virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } - - // Returns global instance (wxTheClipboard) of the object: - static wxClipboard *Get(); -}; - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -// The global clipboard object - backward compatible access macro: -#define wxTheClipboard (wxClipboard::Get()) - -// ---------------------------------------------------------------------------- -// include platform-specific class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/clipbrd.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/clipbrd.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/clipbrd.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/clipbrd.h" -#elif defined(__WXX11__) - #include "wx/x11/clipbrd.h" -#elif defined(__WXMGL__) - #include "wx/mgl/clipbrd.h" -#elif defined(__WXMAC__) - #include "wx/mac/clipbrd.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/clipbrd.h" -#elif defined(__WXPM__) - #include "wx/os2/clipbrd.h" -#endif - -// ---------------------------------------------------------------------------- -// helpful class for opening the clipboard and automatically closing it -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxClipboardLocker -{ -public: - wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL) - { - m_clipboard = clipboard ? clipboard : wxTheClipboard; - if ( m_clipboard ) - { - m_clipboard->Open(); - } - } - - bool operator!() const { return !m_clipboard->IsOpened(); } - - ~wxClipboardLocker() - { - if ( m_clipboard ) - { - m_clipboard->Close(); - } - } - -private: - wxClipboard *m_clipboard; - - DECLARE_NO_COPY_CLASS(wxClipboardLocker) -}; - -#endif // wxUSE_CLIPBOARD - -#endif // _WX_CLIPBRD_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/clntdata.h b/Source/3rdParty/wx/include/wx/clntdata.h deleted file mode 100644 index f9704a7d0..000000000 --- a/Source/3rdParty/wx/include/wx/clntdata.h +++ /dev/null @@ -1,273 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clntdata.h -// Purpose: A mixin class for holding a wxClientData or void pointer -// Author: Robin Dunn -// Modified by: -// Created: 9-Oct-2001 -// RCS-ID: $Id: clntdata.h 36973 2006-01-18 16:45:41Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLNTDATAH__ -#define _WX_CLNTDATAH__ - -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/hashmap.h" - -typedef int (*wxShadowObjectMethod)(void*, void*); -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( - wxShadowObjectMethod, - wxShadowObjectMethods, - class WXDLLIMPEXP_BASE -); -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( - void *, - wxShadowObjectFields, - class WXDLLIMPEXP_BASE -); - -class WXDLLIMPEXP_BASE wxShadowObject -{ -public: - wxShadowObject() { } - - void AddMethod( const wxString &name, wxShadowObjectMethod method ) - { - wxShadowObjectMethods::iterator it = m_methods.find( name ); - if (it == m_methods.end()) - m_methods[ name ] = method; - else - it->second = method; - } - - bool InvokeMethod( const wxString &name, void* window, void* param, int* returnValue ) - { - wxShadowObjectMethods::iterator it = m_methods.find( name ); - if (it == m_methods.end()) - return false; - wxShadowObjectMethod method = it->second; - int ret = (*method)(window, param); - if (returnValue) - *returnValue = ret; - return true; - } - - void AddField( const wxString &name, void* initialValue = NULL ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - m_fields[ name ] = initialValue; - else - it->second = initialValue; - } - - void SetField( const wxString &name, void* value ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - return; - it->second = value; - } - - void* GetField( const wxString &name, void *defaultValue = NULL ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - return defaultValue; - return it->second; - } - -private: - wxShadowObjectMethods m_methods; - wxShadowObjectFields m_fields; -}; - - -// ---------------------------------------------------------------------------- - -// what kind of client data do we have? -enum wxClientDataType -{ - wxClientData_None, // we don't know yet because we don't have it at all - wxClientData_Object, // our client data is typed and we own it - wxClientData_Void // client data is untyped and we don't own it -}; - -class WXDLLIMPEXP_BASE wxClientData -{ -public: - wxClientData() { } - virtual ~wxClientData() { } -}; - -class WXDLLIMPEXP_BASE wxStringClientData : public wxClientData -{ -public: - wxStringClientData() : m_data() { } - wxStringClientData( const wxString &data ) : m_data(data) { } - void SetData( const wxString &data ) { m_data = data; } - const wxString& GetData() const { return m_data; } - -private: - wxString m_data; -}; - -// This class is a mixin that provides storage and management of "client -// data." The client data stored can either be a pointer to a wxClientData -// object in which case it is managed by the container (i.e. it will delete -// the data when it's destroyed) or an untyped pointer which won't be deleted -// by the container - but not both of them -// -// NOTE: This functionality is currently duplicated in wxEvtHandler in order -// to avoid having more than one vtable in that class hierarchy. - -class WXDLLIMPEXP_BASE wxClientDataContainer -{ -public: - wxClientDataContainer(); - virtual ~wxClientDataContainer(); - - void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } - wxClientData *GetClientObject() const { return DoGetClientObject(); } - - void SetClientData( void *data ) { DoSetClientData(data); } - void *GetClientData() const { return DoGetClientData(); } - -protected: - // The user data: either an object which will be deleted by the container - // when it's deleted or some raw pointer which we do nothing with. Only - // one type of data can be used with the given window, i.e. you cannot set - // the void data and then associate the container with wxClientData or vice - // versa. - union - { - wxClientData *m_clientObject; - void *m_clientData; - }; - - // client data accessors - virtual void DoSetClientObject( wxClientData *data ); - virtual wxClientData *DoGetClientObject() const; - - virtual void DoSetClientData( void *data ); - virtual void *DoGetClientData() const; - - // what kind of data do we have? - wxClientDataType m_clientDataType; - -}; - -#include "wx/vector.h" - -struct WXDLLIMPEXP_BASE wxClientDataDictionaryPair -{ - wxClientDataDictionaryPair( size_t idx ) : index( idx ), data( 0 ) { } - - size_t index; - wxClientData* data; -}; - -_WX_DECLARE_VECTOR( - wxClientDataDictionaryPair, - wxClientDataDictionaryPairVector, - WXDLLIMPEXP_BASE -); - -// this class is used internally to maintain the association between items -// of (some subclasses of) wxControlWithItems and their client data -// NOTE: this class does not keep track of whether it contains -// wxClientData or void*. The client must ensure that -// it does not contain a mix of the two, and that -// DestroyData is called if it contains wxClientData -class WXDLLIMPEXP_BASE wxClientDataDictionary -{ -public: - wxClientDataDictionary() {} - - // deletes all the data - void DestroyData() - { - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - delete m_vec[i].data; - m_vec.clear(); - } - - // if data for the given index is not present, add it, - // if it is present, delete the old data and replace it with - // the new one - void Set( size_t index, wxClientData* data, bool doDelete ) - { - size_t ptr = Find( index ); - - if( !data ) - { - if( ptr == m_vec.size() ) return; - if( doDelete ) - delete m_vec[ptr].data; - m_vec.erase( ptr ); - } - else - { - if( ptr == m_vec.size() ) - { - m_vec.push_back( wxClientDataDictionaryPair( index ) ); - ptr = m_vec.size() - 1; - } - - if( doDelete ) - delete m_vec[ptr].data; - m_vec[ptr].data = data; - } - } - - // get the data associated with the given index, - // return 0 if not found - wxClientData* Get( size_t index ) const - { - size_t it = Find( index ); - if( it == m_vec.size() ) return 0; - return (wxClientData*)m_vec[it].data; // const cast - } - - // delete the data associated with the given index - // it also decreases by one the indices of all the elements - // with an index greater than the given index - void Delete( size_t index, bool doDelete ) - { - size_t todel = m_vec.size(); - - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - { - if( m_vec[i].index == index ) - todel = i; - else if( m_vec[i].index > index ) - --(m_vec[i].index); - } - - if( todel != m_vec.size() ) - { - if( doDelete ) - delete m_vec[todel].data; - m_vec.erase( todel ); - } - } -private: - // returns MyVec.size() if not found - size_t Find( size_t index ) const - { - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - { - if( m_vec[i].index == index ) - return i; - } - - return m_vec.size(); - } - - wxClientDataDictionaryPairVector m_vec; -}; - -#endif // _WX_CLNTDATAH__ - diff --git a/Source/3rdParty/wx/include/wx/clrpicker.h b/Source/3rdParty/wx/include/wx/clrpicker.h deleted file mode 100644 index f6a436fc3..000000000 --- a/Source/3rdParty/wx/include/wx/clrpicker.h +++ /dev/null @@ -1,200 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clrpicker.h -// Purpose: wxColourPickerCtrl base header -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: clrpicker.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLRPICKER_H_BASE_ -#define _WX_CLRPICKER_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_COLOURPICKERCTRL - -#include "wx/pickerbase.h" - - -class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxColourPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxColourPickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxColourPickerWidgetBase -{ -public: - wxColourPickerWidgetBase() { m_colour = *wxBLACK; } - virtual ~wxColourPickerWidgetBase() {} - - wxColour GetColour() const - { return m_colour; } - virtual void SetColour(const wxColour &col) - { m_colour = col; UpdateColour(); } - virtual void SetColour(const wxString &col) - { m_colour.Set(col); UpdateColour(); } - -protected: - - virtual void UpdateColour() = 0; - - // the current colour (may be invalid if none) - wxColour m_colour; -}; - - -// Styles which must be supported by all controls implementing wxColourPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - -// show the colour in HTML form (#AABBCC) as colour button label -// (instead of no label at all) -// NOTE: this style is supported just by wxColourButtonGeneric and -// thus is not exposed in wxColourPickerCtrl -#define wxCLRP_SHOW_LABEL 0x0008 - -// map platform-dependent controls which implement the wxColourPickerWidgetBase -// under the name "wxColourPickerWidget". -// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the -// fact that all classes being mapped as wxColourPickerWidget have the -// same prototype for their contructor (and also explains why we use -// define instead of a typedef) -// since GTK > 2.4, there is GtkColorButton -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/clrpicker.h" - #define wxColourPickerWidget wxColourButton -#else - #include "wx/generic/clrpickerg.h" - #define wxColourPickerWidget wxGenericColourButton -#endif - - -// ---------------------------------------------------------------------------- -// wxColourPickerCtrl: platform-independent class which embeds a -// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) -#define wxCLRP_DEFAULT_STYLE 0 - -class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase -{ -public: - wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {} - virtual ~wxColourPickerCtrl() {} - - - wxColourPickerCtrl(wxWindow *parent, wxWindowID id, - const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerCtrlNameStr) - : m_bIgnoreNextTextCtrlUpdate(false) - { Create(parent, id, col, pos, size, style, validator, name); } - - bool Create(wxWindow *parent, wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerCtrlNameStr); - - -public: // public API - - // get the colour chosen - wxColour GetColour() const - { return ((wxColourPickerWidget *)m_picker)->GetColour(); } - - // set currently displayed color - void SetColour(const wxColour& col); - - // set colour using RGB(r,g,b) syntax or considering given text as a colour name; - // returns true if the given text was successfully recognized. - bool SetColour(const wxString& text); - - -public: // internal functions - - // update the button colour to match the text control contents - void UpdatePickerFromTextCtrl(); - - // update the text control to match the button's colour - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnColourChange(wxColourPickerEvent &); - -protected: - virtual long GetPickerStyle(long style) const - { return (style & wxCLRP_SHOW_LABEL); } - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - -private: - DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl) -}; - - -// ---------------------------------------------------------------------------- -// wxColourPickerEvent: used by wxColourPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent -{ -public: - wxColourPickerEvent() {} - wxColourPickerEvent(wxObject *generator, int id, const wxColour &col) - : wxCommandEvent(wxEVT_COMMAND_COLOURPICKER_CHANGED, id), - m_colour(col) - { - SetEventObject(generator); - } - - wxColour GetColour() const { return m_colour; } - void SetColour(const wxColour &c) { m_colour = c; } - - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); } - -private: - wxColour m_colour; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); - -#define wxColourPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func) - -#define EVT_COLOURPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) - - -#endif // wxUSE_COLOURPICKERCTRL - -#endif // _WX_CLRPICKER_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/cmdline.h b/Source/3rdParty/wx/include/wx/cmdline.h deleted file mode 100644 index 9f6e6080b..000000000 --- a/Source/3rdParty/wx/include/wx/cmdline.h +++ /dev/null @@ -1,239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cmdline.h -// Purpose: wxCmdLineParser and related classes for parsing the command -// line options -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.01.00 -// RCS-ID: $Id: cmdline.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMDLINE_H_ -#define _WX_CMDLINE_H_ - -#include "wx/defs.h" - -#include "wx/string.h" -#include "wx/arrstr.h" - -#if wxUSE_CMDLINE_PARSER - -class WXDLLIMPEXP_FWD_BASE wxDateTime; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// by default, options are optional (sic) and each call to AddParam() allows -// one more parameter - this may be changed by giving non-default flags to it -enum -{ - wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given - wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted - wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated - wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request - wxCMD_LINE_NEEDS_SEPARATOR = 0x10 // must have sep before the value -}; - -// an option value or parameter may be a string (the most common case), a -// number or a date -enum wxCmdLineParamType -{ - wxCMD_LINE_VAL_STRING, // should be 0 (default) - wxCMD_LINE_VAL_NUMBER, - wxCMD_LINE_VAL_DATE, - wxCMD_LINE_VAL_NONE -}; - -// for constructing the cmd line description using Init() -enum wxCmdLineEntryType -{ - wxCMD_LINE_SWITCH, - wxCMD_LINE_OPTION, - wxCMD_LINE_PARAM, - wxCMD_LINE_NONE // to terminate the list -}; - -// ---------------------------------------------------------------------------- -// wxCmdLineEntryDesc is a description of one command line -// switch/option/parameter -// ---------------------------------------------------------------------------- - -struct wxCmdLineEntryDesc -{ - wxCmdLineEntryType kind; - const wxChar *shortName; - const wxChar *longName; - const wxChar *description; - wxCmdLineParamType type; - int flags; -}; - -// ---------------------------------------------------------------------------- -// wxCmdLineParser is a class for parsing command line. -// -// It has the following features: -// -// 1. distinguishes options, switches and parameters; allows option grouping -// 2. allows both short and long options -// 3. automatically generates the usage message from the cmd line description -// 4. does type checks on the options values (number, date, ...) -// -// To use it you should: -// -// 1. construct it giving it the cmd line to parse and optionally its desc -// 2. construct the cmd line description using AddXXX() if not done in (1) -// 3. call Parse() -// 4. use GetXXX() to retrieve the parsed info -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCmdLineParser -{ -public: - // ctors and initializers - // ---------------------- - - // default ctor or ctor giving the cmd line in either Unix or Win form - wxCmdLineParser() { Init(); } - wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); } -#if wxUSE_UNICODE - wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); } -#endif // wxUSE_UNICODE - wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); } - - // the same as above, but also gives the cmd line description - otherwise, - // use AddXXX() later - wxCmdLineParser(const wxCmdLineEntryDesc *desc) - { Init(); SetDesc(desc); } - wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv) - { Init(); SetCmdLine(argc, argv); SetDesc(desc); } -#if wxUSE_UNICODE - wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv) - { Init(); SetCmdLine(argc, argv); SetDesc(desc); } -#endif // wxUSE_UNICODE - wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline) - { Init(); SetCmdLine(cmdline); SetDesc(desc); } - - // set cmd line to parse after using one of the ctors which don't do it - void SetCmdLine(int argc, char **argv); -#if wxUSE_UNICODE - void SetCmdLine(int argc, wxChar **argv); -#endif // wxUSE_UNICODE - void SetCmdLine(const wxString& cmdline); - - // not virtual, don't use this class polymorphically - ~wxCmdLineParser(); - - // set different parser options - // ---------------------------- - - // by default, '-' is switch char under Unix, '-' or '/' under Win: - // switchChars contains all characters with which an option or switch may - // start - void SetSwitchChars(const wxString& switchChars); - - // long options are not POSIX-compliant, this option allows to disable them - void EnableLongOptions(bool enable = true); - void DisableLongOptions() { EnableLongOptions(false); } - - bool AreLongOptionsEnabled(); - - // extra text may be shown by Usage() method if set by this function - void SetLogo(const wxString& logo); - - // construct the cmd line description - // ---------------------------------- - - // take the cmd line description from the wxCMD_LINE_NONE terminated table - void SetDesc(const wxCmdLineEntryDesc *desc); - - // a switch: i.e. an option without value - void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, - const wxString& desc = wxEmptyString, - int flags = 0); - - // an option taking a value of the given type - void AddOption(const wxString& name, const wxString& lng = wxEmptyString, - const wxString& desc = wxEmptyString, - wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, - int flags = 0); - - // a parameter - void AddParam(const wxString& desc = wxEmptyString, - wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, - int flags = 0); - - // actions - // ------- - - // parse the command line, return 0 if ok, -1 if "-h" or "--help" option - // was encountered and the help message was given or a positive value if a - // syntax error occurred - // - // if showUsage is true, Usage() is called in case of syntax error or if - // help was requested - int Parse(bool showUsage = true); - - // give the usage message describing all program options - void Usage(); - - // get the command line arguments - // ------------------------------ - - // returns true if the given switch was found - bool Found(const wxString& name) const; - - // returns true if an option taking a string value was found and stores the - // value in the provided pointer - bool Found(const wxString& name, wxString *value) const; - - // returns true if an option taking an integer value was found and stores - // the value in the provided pointer - bool Found(const wxString& name, long *value) const; - -#if wxUSE_DATETIME - // returns true if an option taking a date value was found and stores the - // value in the provided pointer - bool Found(const wxString& name, wxDateTime *value) const; -#endif // wxUSE_DATETIME - - // gets the number of parameters found - size_t GetParamCount() const; - - // gets the value of Nth parameter (as string only for now) - wxString GetParam(size_t n = 0u) const; - - // Resets switches and options - void Reset(); - - // break down the command line in arguments - static wxArrayString ConvertStringToArgs(const wxChar *cmdline); - -private: - // get usage string - wxString GetUsageString(); - - // common part of all ctors - void Init(); - - struct wxCmdLineParserData *m_data; - - DECLARE_NO_COPY_CLASS(wxCmdLineParser) -}; - -#else // !wxUSE_CMDLINE_PARSER - -// this function is always available (even if !wxUSE_CMDLINE_PARSER) because it -// is used by wxWin itself under Windows -class WXDLLIMPEXP_BASE wxCmdLineParser -{ -public: - static wxArrayString ConvertStringToArgs(const wxChar *cmdline); -}; - -#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER - -#endif // _WX_CMDLINE_H_ - diff --git a/Source/3rdParty/wx/include/wx/cmdproc.h b/Source/3rdParty/wx/include/wx/cmdproc.h deleted file mode 100644 index 930cad753..000000000 --- a/Source/3rdParty/wx/include/wx/cmdproc.h +++ /dev/null @@ -1,144 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cmdproc.h -// Purpose: undo/redo capable command processing framework -// Author: Julian Smart (extracted from docview.h by VZ) -// Modified by: -// Created: 05.11.00 -// RCS-ID: $Id: cmdproc.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMDPROC_H_ -#define _WX_CMDPROC_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; - -// ---------------------------------------------------------------------------- -// wxCommand: a single command capable of performing itself -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCommand : public wxObject -{ -public: - wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); - virtual ~wxCommand(){} - - // Override this to perform a command - virtual bool Do() = 0; - - // Override this to undo a command - virtual bool Undo() = 0; - - virtual bool CanUndo() const { return m_canUndo; } - virtual wxString GetName() const { return m_commandName; } - -protected: - bool m_canUndo; - wxString m_commandName; - -private: - DECLARE_CLASS(wxCommand) -}; - -// ---------------------------------------------------------------------------- -// wxCommandProcessor: wxCommand manager -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCommandProcessor : public wxObject -{ -public: - // if max number of commands is -1, it is unlimited - wxCommandProcessor(int maxCommands = -1); - virtual ~wxCommandProcessor(); - - // Pass a command to the processor. The processor calls Do(); if - // successful, is appended to the command history unless storeIt is false. - virtual bool Submit(wxCommand *command, bool storeIt = true); - - // just store the command without executing it - virtual void Store(wxCommand *command); - - virtual bool Undo(); - virtual bool Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Initialises the current command and menu strings. - virtual void Initialize(); - - // Sets the Undo/Redo menu strings for the current menu. - virtual void SetMenuStrings(); - - // Gets the current Undo menu label. - wxString GetUndoMenuLabel() const; - - // Gets the current Undo menu label. - wxString GetRedoMenuLabel() const; - -#if wxUSE_MENUS - // Call this to manage an edit menu. - void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; } - wxMenu *GetEditMenu() const { return m_commandEditMenu; } -#endif // wxUSE_MENUS - - // command list access - wxList& GetCommands() { return m_commands; } - const wxList& GetCommands() const { return m_commands; } - wxCommand *GetCurrentCommand() const - { - return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); - } - int GetMaxCommands() const { return m_maxNoCommands; } - virtual void ClearCommands(); - - // Has the current project been changed? - virtual bool IsDirty() const - { - return m_currentCommand && (m_lastSavedCommand != m_currentCommand); - } - - // Mark the current command as the one where the last save took place - void MarkAsSaved() - { - m_lastSavedCommand = m_currentCommand; - } - - - // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" - const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } - const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } - - void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } - void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } - -protected: - // for further flexibility, command processor doesn't call wxCommand::Do() - // and Undo() directly but uses these functions which can be overridden in - // the derived class - virtual bool DoCommand(wxCommand& cmd); - virtual bool UndoCommand(wxCommand& cmd); - - int m_maxNoCommands; - wxList m_commands; - wxList::compatibility_iterator m_currentCommand, - m_lastSavedCommand; - -#if wxUSE_MENUS - wxMenu* m_commandEditMenu; -#endif // wxUSE_MENUS - - wxString m_undoAccelerator; - wxString m_redoAccelerator; - -private: - DECLARE_DYNAMIC_CLASS(wxCommandProcessor) - DECLARE_NO_COPY_CLASS(wxCommandProcessor) -}; - -#endif // _WX_CMDPROC_H_ - diff --git a/Source/3rdParty/wx/include/wx/cmndata.h b/Source/3rdParty/wx/include/wx/cmndata.h deleted file mode 100644 index a96c4ff72..000000000 --- a/Source/3rdParty/wx/include/wx/cmndata.h +++ /dev/null @@ -1,454 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cmndata.h -// Purpose: Common GDI data classes -// Author: Julian Smart and others -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: cmndata.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMNDATA_H_BASE_ -#define _WX_CMNDATA_H_BASE_ - -#include "wx/window.h" -#include "wx/font.h" -#include "wx/encinfo.h" -#include "wx/colour.h" -#include "wx/gdicmn.h" - -#if wxUSE_STREAMS -#include "wx/stream.h" -#endif - - -class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; - - -class WXDLLEXPORT wxColourData: public wxObject -{ -public: - wxColourData(); - wxColourData(const wxColourData& data); - virtual ~wxColourData(); - - void SetChooseFull(bool flag) { m_chooseFull = flag; } - bool GetChooseFull() const { return m_chooseFull; } - void SetColour(const wxColour& colour) { m_dataColour = colour; } - const wxColour& GetColour() const { return m_dataColour; } - wxColour& GetColour() { return m_dataColour; } - - // Array of 16 custom colours - void SetCustomColour(int i, const wxColour& colour); - wxColour GetCustomColour(int i); - - void operator=(const wxColourData& data); - -public: - wxColour m_dataColour; - wxColour m_custColours[16]; - bool m_chooseFull; - -private: - DECLARE_DYNAMIC_CLASS(wxColourData) -}; - -class WXDLLEXPORT wxFontData : public wxObject -{ -public: - wxFontData(); - virtual ~wxFontData(); - - wxFontData(const wxFontData& data) - : wxObject(), - m_fontColour(data.m_fontColour), - m_showHelp(data.m_showHelp), - m_allowSymbols(data.m_allowSymbols), - m_enableEffects(data.m_enableEffects), - m_initialFont(data.m_initialFont), - m_chosenFont(data.m_chosenFont), - m_minSize(data.m_minSize), - m_maxSize(data.m_maxSize), - m_encoding(data.m_encoding), - m_encodingInfo(data.m_encodingInfo) - { - } - - wxFontData& operator=(const wxFontData& data) - { - wxObject::operator=(data); - m_fontColour = data.m_fontColour; - m_showHelp = data.m_showHelp; - m_allowSymbols = data.m_allowSymbols; - m_enableEffects = data.m_enableEffects; - m_initialFont = data.m_initialFont; - m_chosenFont = data.m_chosenFont; - m_minSize = data.m_minSize; - m_maxSize = data.m_maxSize; - m_encoding = data.m_encoding; - m_encodingInfo = data.m_encodingInfo; - return *this; - } - - void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } - bool GetAllowSymbols() const { return m_allowSymbols; } - - void SetColour(const wxColour& colour) { m_fontColour = colour; } - const wxColour& GetColour() const { return m_fontColour; } - - void SetShowHelp(bool flag) { m_showHelp = flag; } - bool GetShowHelp() const { return m_showHelp; } - - void EnableEffects(bool flag) { m_enableEffects = flag; } - bool GetEnableEffects() const { return m_enableEffects; } - - void SetInitialFont(const wxFont& font) { m_initialFont = font; } - wxFont GetInitialFont() const { return m_initialFont; } - - void SetChosenFont(const wxFont& font) { m_chosenFont = font; } - wxFont GetChosenFont() const { return m_chosenFont; } - - void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } - - // encoding info is split into 2 parts: the logical wxWin encoding - // (wxFontEncoding) and a structure containing the native parameters for - // it (wxNativeEncodingInfo) - wxFontEncoding GetEncoding() const { return m_encoding; } - void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } - - wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } - - - // public for backwards compatibility only: don't use directly -public: - wxColour m_fontColour; - bool m_showHelp; - bool m_allowSymbols; - bool m_enableEffects; - wxFont m_initialFont; - wxFont m_chosenFont; - int m_minSize; - int m_maxSize; - -private: - wxFontEncoding m_encoding; - wxNativeEncodingInfo m_encodingInfo; - -private: - DECLARE_DYNAMIC_CLASS(wxFontData) -}; - -#if wxUSE_PRINTING_ARCHITECTURE -/* - * wxPrintData - * Encapsulates printer information (not printer dialog information) - */ - -enum wxPrintBin -{ - wxPRINTBIN_DEFAULT, - - wxPRINTBIN_ONLYONE, - wxPRINTBIN_LOWER, - wxPRINTBIN_MIDDLE, - wxPRINTBIN_MANUAL, - wxPRINTBIN_ENVELOPE, - wxPRINTBIN_ENVMANUAL, - wxPRINTBIN_AUTO, - wxPRINTBIN_TRACTOR, - wxPRINTBIN_SMALLFMT, - wxPRINTBIN_LARGEFMT, - wxPRINTBIN_LARGECAPACITY, - wxPRINTBIN_CASSETTE, - wxPRINTBIN_FORMSOURCE, - - wxPRINTBIN_USER -}; - -const int wxPRINTMEDIA_DEFAULT = 0; - -class WXDLLEXPORT wxPrintData: public wxObject -{ -public: - wxPrintData(); - wxPrintData(const wxPrintData& printData); - virtual ~wxPrintData(); - - int GetNoCopies() const { return m_printNoCopies; } - bool GetCollate() const { return m_printCollate; } - int GetOrientation() const { return m_printOrientation; } - bool IsOrientationReversed() const { return m_printOrientationReversed; } - - // Is this data OK for showing the print dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const ; - - const wxString& GetPrinterName() const { return m_printerName; } - bool GetColour() const { return m_colour; } - wxDuplexMode GetDuplex() const { return m_duplexMode; } - wxPaperSize GetPaperId() const { return m_paperId; } - const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size - // in wxPageSetupDialogData - wxPrintQuality GetQuality() const { return m_printQuality; } - wxPrintBin GetBin() const { return m_bin; } - wxPrintMode GetPrintMode() const { return m_printMode; } - int GetMedia() const { return m_media; } - - void SetNoCopies(int v) { m_printNoCopies = v; } - void SetCollate(bool flag) { m_printCollate = flag; } - void SetOrientation(int orient) { m_printOrientation = orient; } - void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } - - void SetPrinterName(const wxString& name) { m_printerName = name; } - void SetColour(bool colour) { m_colour = colour; } - void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } - void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } - void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } - void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } - void SetBin(wxPrintBin bin) { m_bin = bin; } - void SetMedia(int media) { m_media = media; } - void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } - - wxString GetFilename() const { return m_filename; } - void SetFilename( const wxString &filename ) { m_filename = filename; } - - void operator=(const wxPrintData& data); - - char* GetPrivData() const { return m_privData; } - int GetPrivDataLen() const { return m_privDataLen; } - void SetPrivData( char *privData, int len ); - - -#if WXWIN_COMPATIBILITY_2_4 - // PostScript-specific data - wxString GetPrinterCommand() const; - wxString GetPrinterOptions() const; - wxString GetPreviewCommand() const; - wxString GetFontMetricPath() const; - double GetPrinterScaleX() const; - double GetPrinterScaleY() const; - long GetPrinterTranslateX() const; - long GetPrinterTranslateY() const; - - void SetPrinterCommand(const wxString& command); - void SetPrinterOptions(const wxString& options); - void SetPreviewCommand(const wxString& command); - void SetFontMetricPath(const wxString& path); - void SetPrinterScaleX(double x); - void SetPrinterScaleY(double y); - void SetPrinterScaling(double x, double y); - void SetPrinterTranslateX(long x); - void SetPrinterTranslateY(long y); - void SetPrinterTranslation(long x, long y); -#endif - - // Convert between wxPrintData and native data - void ConvertToNative(); - void ConvertFromNative(); - // Holds the native print data - wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; } - -private: - wxPrintBin m_bin; - int m_media; - wxPrintMode m_printMode; - - int m_printNoCopies; - int m_printOrientation; - bool m_printOrientationReversed; - bool m_printCollate; - - wxString m_printerName; - bool m_colour; - wxDuplexMode m_duplexMode; - wxPrintQuality m_printQuality; - wxPaperSize m_paperId; - wxSize m_paperSize; - - wxString m_filename; - - char* m_privData; - int m_privDataLen; - - wxPrintNativeDataBase *m_nativeData; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintData) -}; - -/* - * wxPrintDialogData - * Encapsulates information displayed and edited in the printer dialog box. - * Contains a wxPrintData object which is filled in according to the values retrieved - * from the dialog. - */ - -class WXDLLEXPORT wxPrintDialogData: public wxObject -{ -public: - wxPrintDialogData(); - wxPrintDialogData(const wxPrintDialogData& dialogData); - wxPrintDialogData(const wxPrintData& printData); - virtual ~wxPrintDialogData(); - - int GetFromPage() const { return m_printFromPage; } - int GetToPage() const { return m_printToPage; } - int GetMinPage() const { return m_printMinPage; } - int GetMaxPage() const { return m_printMaxPage; } - int GetNoCopies() const { return m_printNoCopies; } - bool GetAllPages() const { return m_printAllPages; } - bool GetSelection() const { return m_printSelection; } - bool GetCollate() const { return m_printCollate; } - bool GetPrintToFile() const { return m_printToFile; } -#if WXWIN_COMPATIBILITY_2_4 - bool GetSetupDialog() const { return m_printSetupDialog; } -#endif - void SetFromPage(int v) { m_printFromPage = v; } - void SetToPage(int v) { m_printToPage = v; } - void SetMinPage(int v) { m_printMinPage = v; } - void SetMaxPage(int v) { m_printMaxPage = v; } - void SetNoCopies(int v) { m_printNoCopies = v; } - void SetAllPages(bool flag) { m_printAllPages = flag; } - void SetSelection(bool flag) { m_printSelection = flag; } - void SetCollate(bool flag) { m_printCollate = flag; } - void SetPrintToFile(bool flag) { m_printToFile = flag; } -#if WXWIN_COMPATIBILITY_2_4 - void SetSetupDialog(bool flag) { m_printSetupDialog = flag; } -#endif - void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } - void EnableSelection(bool flag) { m_printEnableSelection = flag; } - void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } - void EnableHelp(bool flag) { m_printEnableHelp = flag; } - - bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; } - bool GetEnableSelection() const { return m_printEnableSelection; } - bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; } - bool GetEnableHelp() const { return m_printEnableHelp; } - - // Is this data OK for showing the print dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } - - wxPrintData& GetPrintData() { return m_printData; } - void SetPrintData(const wxPrintData& printData) { m_printData = printData; } - - void operator=(const wxPrintDialogData& data); - void operator=(const wxPrintData& data); // Sets internal m_printData member - -private: - int m_printFromPage; - int m_printToPage; - int m_printMinPage; - int m_printMaxPage; - int m_printNoCopies; - bool m_printAllPages; - bool m_printCollate; - bool m_printToFile; - bool m_printSelection; - bool m_printEnableSelection; - bool m_printEnablePageNumbers; - bool m_printEnableHelp; - bool m_printEnablePrintToFile; -#if WXWIN_COMPATIBILITY_2_4 - bool m_printSetupDialog; -#endif - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintDialogData) -}; - -/* -* This is the data used (and returned) by the wxPageSetupDialog. -*/ - -// Compatibility with old name -#define wxPageSetupData wxPageSetupDialogData - -class WXDLLEXPORT wxPageSetupDialogData: public wxObject -{ -public: - wxPageSetupDialogData(); - wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); - wxPageSetupDialogData(const wxPrintData& printData); - virtual ~wxPageSetupDialogData(); - - wxSize GetPaperSize() const { return m_paperSize; } - wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); } - wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; } - wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; } - wxPoint GetMarginTopLeft() const { return m_marginTopLeft; } - wxPoint GetMarginBottomRight() const { return m_marginBottomRight; } - - bool GetDefaultMinMargins() const { return m_defaultMinMargins; } - bool GetEnableMargins() const { return m_enableMargins; } - bool GetEnableOrientation() const { return m_enableOrientation; } - bool GetEnablePaper() const { return m_enablePaper; } - bool GetEnablePrinter() const { return m_enablePrinter; } - bool GetDefaultInfo() const { return m_getDefaultInfo; } - bool GetEnableHelp() const { return m_enableHelp; } - - // Is this data OK for showing the page setup dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } - - // If a corresponding paper type is found in the paper database, will set the m_printData - // paper size id member as well. - void SetPaperSize(const wxSize& sz); - - void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); } - - // Sets the wxPrintData id, plus the paper width/height if found in the paper database. - void SetPaperSize(wxPaperSize id); - - void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; } - void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; } - void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; } - void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; } - void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; } - void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; } - - void EnableMargins(bool flag) { m_enableMargins = flag; } - void EnableOrientation(bool flag) { m_enableOrientation = flag; } - void EnablePaper(bool flag) { m_enablePaper = flag; } - void EnablePrinter(bool flag) { m_enablePrinter = flag; } - void EnableHelp(bool flag) { m_enableHelp = flag; } - - // Use paper size defined in this object to set the wxPrintData - // paper id - void CalculateIdFromPaperSize(); - - // Use paper id in wxPrintData to set this object's paper size - void CalculatePaperSizeFromId(); - - wxPageSetupDialogData& operator=(const wxPageSetupData& data); - wxPageSetupDialogData& operator=(const wxPrintData& data); - - wxPrintData& GetPrintData() { return m_printData; } - const wxPrintData& GetPrintData() const { return m_printData; } - void SetPrintData(const wxPrintData& printData); - -private: - wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) - wxPoint m_minMarginTopLeft; - wxPoint m_minMarginBottomRight; - wxPoint m_marginTopLeft; - wxPoint m_marginBottomRight; - bool m_defaultMinMargins; - bool m_enableMargins; - bool m_enableOrientation; - bool m_enablePaper; - bool m_enablePrinter; - bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT - bool m_enableHelp; - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif -// _WX_CMNDATA_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/collpane.h b/Source/3rdParty/wx/include/wx/collpane.h deleted file mode 100644 index 483d33b26..000000000 --- a/Source/3rdParty/wx/include/wx/collpane.h +++ /dev/null @@ -1,104 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/collpane.h -// Purpose: wxCollapsiblePane -// Author: Francesco Montorsi -// Modified by: -// Created: 8/10/2006 -// RCS-ID: $Id: collpane.h 43300 2006-11-11 07:32:08Z RD $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLLAPSABLE_PANE_H_BASE_ -#define _WX_COLLAPSABLE_PANE_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_COLLPANE - -#include "wx/control.h" - - -// ---------------------------------------------------------------------------- -// wxCollapsiblePaneBase: interface for wxCollapsiblePane -// ---------------------------------------------------------------------------- - -#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER) -#define wxCP_NO_TLW_RESIZE (0x0002) - -class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl -{ -public: - wxCollapsiblePaneBase() {} - - virtual void Collapse(bool collapse = true) = 0; - void Expand() { Collapse(false); } - - virtual bool IsCollapsed() const = 0; - bool IsExpanded() const { return !IsCollapsed(); } - - virtual wxWindow *GetPane() const = 0; - - virtual wxString GetLabel() const = 0; - virtual void SetLabel(const wxString& label) = 0; -}; - - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent -{ -public: - wxCollapsiblePaneEvent() {} - wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed) - : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id), - m_bCollapsed(collapsed) - { - SetEventObject(generator); - } - - bool GetCollapsed() const { return m_bCollapsed; } - void SetCollapsed(bool c) { m_bCollapsed = c; } - - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); } - -private: - bool m_bCollapsed; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); - -#define wxCollapsiblePaneEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func) - -#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) - - -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/collpane.h" -#else - #include "wx/generic/collpaneg.h" - - // use #define and not a typedef to allow forward declaring the class - #define wxCollapsiblePane wxGenericCollapsiblePane -#endif - -#endif // wxUSE_COLLPANE - -#endif // _WX_COLLAPSABLE_PANE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/colordlg.h b/Source/3rdParty/wx/include/wx/colordlg.h deleted file mode 100644 index f17192078..000000000 --- a/Source/3rdParty/wx/include/wx/colordlg.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/colrdlgg.h -// Purpose: wxColourDialog -// Author: Vadim Zeitiln -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colordlg.h 36623 2006-01-02 14:26:36Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLORDLG_H_BASE_ -#define _WX_COLORDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_COLOURDLG - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/colordlg.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) - #include "wx/mac/colordlg.h" -#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/colordlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/colordlg.h" -#else - #include "wx/generic/colrdlgg.h" - - #define wxColourDialog wxGenericColourDialog -#endif - -// get the colour from user and return it -wxColour WXDLLEXPORT -wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, - const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString); - -#endif // wxUSE_COLOURDLG - -#endif - // _WX_COLORDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/colour.h b/Source/3rdParty/wx/include/wx/colour.h deleted file mode 100644 index 66c45e772..000000000 --- a/Source/3rdParty/wx/include/wx/colour.h +++ /dev/null @@ -1,154 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/colour.h -// Purpose: wxColourBase definition -// Author: Julian Smart -// Modified by: Francesco Montorsi -// Created: -// RCS-ID: $Id: colour.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLOUR_H_BASE_ -#define _WX_COLOUR_H_BASE_ - -#include "wx/defs.h" -#include "wx/gdiobj.h" - - -class WXDLLIMPEXP_FWD_CORE wxColour; - -// the standard wxColour constructors; -// this macro avoids to repeat these lines across all colour.h files, since -// Set() is a virtual function and thus cannot be called by wxColourBase -// constructors -#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \ - wxColour( ChannelType red, ChannelType green, ChannelType blue, \ - ChannelType alpha = wxALPHA_OPAQUE ) \ - { Set(red, green, blue, alpha); } \ - wxColour( unsigned long colRGB ) { Set(colRGB); } \ - wxColour(const wxString &colourName) { Set(colourName); } \ - wxColour(const wxChar *colourName) { Set(colourName); } - - -// flags for wxColour -> wxString conversion (see wxColour::GetAsString) -#define wxC2S_NAME 1 // return colour name, when possible -#define wxC2S_CSS_SYNTAX 2 // return colour in rgb(r,g,b) syntax -#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax - - -const unsigned char wxALPHA_TRANSPARENT = 0; -const unsigned char wxALPHA_OPAQUE = 0xff; - -// ---------------------------------------------------------------------------- -// wxVariant support -// ---------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) -#endif - -//----------------------------------------------------------------------------- -// wxColourBase: this class has no data members, just some functions to avoid -// code redundancy in all native wxColour implementations -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxColourBase : public wxGDIObject -{ -public: - // type of a single colour component - typedef unsigned char ChannelType; - - wxColourBase() {} - virtual ~wxColourBase() {} - - - // Set() functions - // --------------- - - void Set(ChannelType red, - ChannelType green, - ChannelType blue, - ChannelType alpha = wxALPHA_OPAQUE) - { InitRGBA(red,green,blue, alpha); } - - // implemented in colourcmn.cpp - bool Set(const wxChar *str) - { return FromString(str); } - - bool Set(const wxString &str) - { return FromString(str); } - - void Set(unsigned long colRGB) - { - // we don't need to know sizeof(long) here because we assume that the three - // least significant bytes contain the R, G and B values - Set((ChannelType)(0xFF & colRGB), - (ChannelType)(0xFF & (colRGB >> 8)), - (ChannelType)(0xFF & (colRGB >> 16))); - } - - - - // accessors - // --------- - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - virtual ChannelType Red() const = 0; - virtual ChannelType Green() const = 0; - virtual ChannelType Blue() const = 0; - virtual ChannelType Alpha() const - { return wxALPHA_OPAQUE ; } - - // implemented in colourcmn.cpp - virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; - - - - // old, deprecated - // --------------- - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( static wxColour CreateByName(const wxString& name) ); - wxDEPRECATED( void InitFromName(const wxString& col) ); -#endif - -protected: - virtual void - InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0; - - virtual bool FromString(const wxChar *s); -}; - - - -#if defined(__WXPALMOS__) - #include "wx/generic/colour.h" -#elif defined(__WXMSW__) - #include "wx/msw/colour.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/colour.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/colour.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/colour.h" -#elif defined(__WXMGL__) - #include "wx/generic/colour.h" -#elif defined(__WXDFB__) - #include "wx/generic/colour.h" -#elif defined(__WXX11__) - #include "wx/x11/colour.h" -#elif defined(__WXMAC__) - #include "wx/mac/colour.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/colour.h" -#elif defined(__WXPM__) - #include "wx/os2/colour.h" -#endif - -#define wxColor wxColour - -#endif // _WX_COLOUR_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/combo.h b/Source/3rdParty/wx/include/wx/combo.h deleted file mode 100644 index 2e5593d72..000000000 --- a/Source/3rdParty/wx/include/wx/combo.h +++ /dev/null @@ -1,757 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/combo.h -// Purpose: wxComboCtrl declaration -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 64412 2010-05-27 15:11:58Z JMS $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOCONTROL_H_BASE_ -#define _WX_COMBOCONTROL_H_BASE_ - - -/* - A few words about all the classes defined in this file are probably in - order: why do we need extra wxComboCtrl and wxComboPopup classes? - - This is because a traditional combobox is a combination of a text control - (with a button allowing to open the pop down list) with a listbox and - wxComboBox class is exactly such control, however we want to also have other - combinations - in fact, we want to allow anything at all to be used as pop - down list, not just a wxListBox. - - So we define a base wxComboCtrl which can use any control as pop down - list and wxComboBox deriving from it which implements the standard wxWidgets - combobox API. wxComboCtrl needs to be told somehow which control to use - and this is done by SetPopupControl(). However, we need something more than - just a wxControl in this method as, for example, we need to call - SetSelection("initial text value") and wxControl doesn't have such method. - So we also need a wxComboPopup which is just a very simple interface which - must be implemented by a control to be usable as a popup. - - We couldn't derive wxComboPopup from wxControl as this would make it - impossible to have a class deriving from both wxListBx and from it, so - instead it is just a mix-in. - */ - - -#include "wx/defs.h" - -#if wxUSE_COMBOCTRL - -#include "wx/control.h" -#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags -#include "wx/bitmap.h" // wxBitmap used by-value - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxComboPopup; - -// -// New window styles for wxComboCtrlBase -// -enum -{ - // Double-clicking a read-only combo triggers call to popup's OnComboPopup. - // In wxOwnerDrawnComboBox, for instance, it cycles item. - wxCC_SPECIAL_DCLICK = 0x0100, - - // Dropbutton acts like standard push button. - wxCC_STD_BUTTON = 0x0200 -}; - - -// wxComboCtrl internal flags -enum -{ - // First those that can be passed to Customize. - // It is Windows style for all flags to be clear. - - // Button is preferred outside the border (GTK style) - wxCC_BUTTON_OUTSIDE_BORDER = 0x0001, - // Show popup on mouse up instead of mouse down (which is the Windows style) - wxCC_POPUP_ON_MOUSE_UP = 0x0002, - // All text is not automatically selected on click - wxCC_NO_TEXT_AUTO_SELECT = 0x0004, - // Drop-button stays down as long as popup is displayed. - wxCC_BUTTON_STAYS_DOWN = 0x0008, - // Drop-button covers the entire control. - wxCC_FULL_BUTTON = 0x0010, - // Drop-button goes over the custom-border (used under WinVista). - wxCC_BUTTON_COVERS_BORDER = 0x0020, - - // Internal use: signals creation is complete - wxCC_IFLAG_CREATED = 0x0100, - // Internal use: really put button outside - wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, - // Internal use: SetTextIndent has been called - wxCC_IFLAG_INDENT_SET = 0x0400, - // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed - wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, - // Internal use: Secondary popup window type should be used (if available). - wxCC_IFLAG_USE_ALT_POPUP = 0x1000, - // Internal use: Skip popup animation. - wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000, - // Internal use: Drop-button is a bitmap button or has non-default size - // (but can still be on either side of the control), regardless whether - // specified by the platform or the application. - wxCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x4000 -}; - - -// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent -enum -{ - wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area - wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area - // that can be clicked to show the popup. -}; - - -// Namespace for wxComboCtrl feature flags -struct wxComboCtrlFeatures -{ - enum - { - MovableButton = 0x0001, // Button can be on either side of control - BitmapButton = 0x0002, // Button may be replaced with bitmap - ButtonSpacing = 0x0004, // Button can have spacing from the edge - // of the control - TextIndent = 0x0008, // SetTextIndent can be used - PaintControl = 0x0010, // Combo control itself can be custom painted - PaintWritable = 0x0020, // A variable-width area in front of writable - // combo control's textctrl can be custom - // painted - Borderless = 0x0040, // wxNO_BORDER window style works - - // There are no feature flags for... - // PushButtonBitmapBackground - if its in wxRendererNative, then it should be - // not an issue to have it automatically under the bitmap. - - All = MovableButton|BitmapButton| - ButtonSpacing|TextIndent| - PaintControl|PaintWritable| - Borderless - }; -}; - - -class WXDLLEXPORT wxComboCtrlBase : public wxControl -{ - friend class wxComboPopup; -public: - // ctors and such - wxComboCtrlBase() : wxControl() { Init(); } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - - virtual ~wxComboCtrlBase(); - - // show/hide popup window - virtual void ShowPopup(); - virtual void HidePopup(); - - // Override for totally custom combo action - virtual void OnButtonClick(); - - // return true if the popup is currently shown - bool IsPopupShown() const { return m_popupWinState == Visible; } - - // set interface class instance derived from wxComboPopup - // NULL popup can be used to indicate default in a derived class - void SetPopupControl( wxComboPopup* popup ) - { - DoSetPopupControl(popup); - } - - // get interface class instance derived from wxComboPopup - wxComboPopup* GetPopupControl() - { - EnsurePopupControl(); - return m_popupInterface; - } - - // get the popup window containing the popup control - wxWindow *GetPopupWindow() const { return m_winPopup; } - - // Get the text control which is part of the combobox. - wxTextCtrl *GetTextCtrl() const { return m_text; } - - // get the dropdown button which is part of the combobox - // note: its not necessarily a wxButton or wxBitmapButton - wxWindow *GetButton() const { return m_btn; } - - // forward these methods to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual bool SetFont(const wxFont& font); -#if wxUSE_VALIDATORS - virtual void SetValidator(const wxValidator &validator); - virtual wxValidator *GetValidator(); -#endif // wxUSE_VALIDATORS - - // wxTextCtrl methods - for readonly combo they should return - // without errors. - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(long from, long to); - virtual void Undo(); - - // This method sets the text without affecting list selection - // (ie. wxComboPopup::SetStringValue doesn't get called). - void SetText(const wxString& value); - - // This method sets value and also optionally sends EVT_TEXT - // (needed by combo popups) - void SetValueWithEvent(const wxString& value, bool withEvent = true); - - // - // Popup customization methods - // - - // Sets minimum width of the popup. If wider than combo control, it will extend to the left. - // Remarks: - // * Value -1 indicates the default. - // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). - void SetPopupMinWidth( int width ) - { - m_widthMinPopup = width; - } - - // Sets preferred maximum height of the popup. - // Remarks: - // * Value -1 indicates the default. - // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). - void SetPopupMaxHeight( int height ) - { - m_heightPopup = height; - } - - // Extends popup size horizontally, relative to the edges of the combo control. - // Remarks: - // * Popup minimum width may override extLeft (ie. it has higher precedence). - // * Values 0 indicate default. - // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes). - void SetPopupExtents( int extLeft, int extRight ) - { - m_extLeft = extLeft; - m_extRight = extRight; - } - - // Set width, in pixels, of custom paint area in writable combo. - // In read-only, used to indicate area that is not covered by the - // focus rectangle (which may or may not be drawn, depending on the - // popup type). - void SetCustomPaintWidth( int width ); - int GetCustomPaintWidth() const { return m_widthCustomPaint; } - - // Set side of the control to which the popup will align itself. - // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans - // that the side of the button will be used. - void SetPopupAnchor( int anchorSide ) - { - m_anchorSide = anchorSide; - } - - // Set position of dropdown button. - // width: button width. <= 0 for default. - // height: button height. <= 0 for default. - // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed. - // spacingX: empty space on sides of the button. Default is 0. - // Remarks: - // There is no spacingY - the button will be centered vertically. - void SetButtonPosition( int width = -1, - int height = -1, - int side = wxRIGHT, - int spacingX = 0 ); - - // Returns current size of the dropdown button. - wxSize GetButtonSize(); - - // - // Sets dropbutton to be drawn with custom bitmaps. - // - // bmpNormal: drawn when cursor is not on button - // pushButtonBg: Draw push button background below the image. - // NOTE! This is usually only properly supported on platforms with appropriate - // method in wxRendererNative. - // bmpPressed: drawn when button is depressed - // bmpHover: drawn when cursor hovers on button. This is ignored on platforms - // that do not generally display hover differently. - // bmpDisabled: drawn when combobox is disabled. - void SetButtonBitmaps( const wxBitmap& bmpNormal, - bool pushButtonBg = false, - const wxBitmap& bmpPressed = wxNullBitmap, - const wxBitmap& bmpHover = wxNullBitmap, - const wxBitmap& bmpDisabled = wxNullBitmap ); - - // - // This will set the space in pixels between left edge of the control and the - // text, regardless whether control is read-only (ie. no wxTextCtrl) or not. - // Platform-specific default can be set with value-1. - // Remarks - // * This method may do nothing on some native implementations. - void SetTextIndent( int indent ); - - // Returns actual indentation in pixels. - wxCoord GetTextIndent() const - { - return m_absIndent; - } - - // Returns area covered by the text field. - const wxRect& GetTextRect() const - { - return m_tcArea; - } - - // Call with enable as true to use a type of popup window that guarantees ability - // to focus the popup control, and normal function of common native controls. - // This alternative popup window is usually a wxDialog, and as such it's parent - // frame will appear as if the focus has been lost from it. - void UseAltPopupWindow( bool enable = true ) - { - wxASSERT_MSG( !m_winPopup, - wxT("call this only before SetPopupControl") ); - - if ( enable ) - m_iFlags |= wxCC_IFLAG_USE_ALT_POPUP; - else - m_iFlags &= ~wxCC_IFLAG_USE_ALT_POPUP; - } - - // Call with false to disable popup animation, if any. - void EnablePopupAnimation( bool enable = true ) - { - if ( enable ) - m_iFlags &= ~wxCC_IFLAG_DISABLE_POPUP_ANIM; - else - m_iFlags |= wxCC_IFLAG_DISABLE_POPUP_ANIM; - } - - // - // Utilies needed by the popups or native implementations - // - - // Returns true if given key combination should toggle the popup. - // NB: This is a separate from other keyboard handling because: - // 1) Replaceability. - // 2) Centralized code (otherwise it'd be split up between - // wxComboCtrl key handler and wxVListBoxComboPopup's - // key handler). - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0; - - // Prepare background of combo control or an item in a dropdown list - // in a way typical on platform. This includes painting the focus/disabled - // background and setting the clipping region. - // Unless you plan to paint your own focus indicator, you should always call this - // in your wxComboPopup::PaintComboControl implementation. - // In addition, it sets pen and text colour to what looks good and proper - // against the background. - // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control - // wxCONTROL_SELECTED: list item is selected - // wxCONTROL_DISABLED: control/item is disabled - virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; - - // Returns true if focus indicator should be drawn in the control. - bool ShouldDrawFocus() const - { - const wxWindow* curFocus = FindFocus(); - return ( IsPopupWindowState(Hidden) && - (curFocus == m_mainCtrlWnd || (m_btn && curFocus == m_btn)) && - (m_windowStyle & wxCB_READONLY) ); - } - - // These methods return references to appropriate dropbutton bitmaps - const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; } - const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; } - const wxBitmap& GetBitmapHover() const { return m_bmpHover; } - const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - - // Return internal flags - wxUint32 GetInternalFlags() const { return m_iFlags; } - - // Return true if Create has finished - bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } - - // common code to be called on popup hide/dismiss - void OnPopupDismiss(); - - // PopupShown states - enum - { - Hidden = 0, - //Closing = 1, - Animating = 2, - Visible = 3 - }; - - bool IsPopupWindowState( int state ) const { return (state == m_popupWinState) ? true : false; } - - wxByte GetPopupWindowState() const { return m_popupWinState; } - - // Set value returned by GetMainWindowOfCompositeControl - void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } - -protected: - - // - // Override these for customization purposes - // - - // called from wxSizeEvent handler - virtual void OnResize() = 0; - - // Return native text identation (for pure text, not textctrl) - virtual wxCoord GetNativeTextIndent() const; - - // Called in syscolourchanged handler and base create - virtual void OnThemeChange(); - - // Creates wxTextCtrl. - // extraStyle: Extra style parameters - void CreateTextCtrl( int extraStyle, const wxValidator& validator ); - - // Installs standard input handler to combo (and optionally to the textctrl) - void InstallInputHandlers(); - - // flags for DrawButton() - enum - { - Draw_PaintBg = 1, - Draw_BitmapOnly = 2 - }; - - // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. - void DrawButton( wxDC& dc, const wxRect& rect, int flags = Draw_PaintBg ); - - // Call if cursor is on button area or mouse is captured for the button. - //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); - bool HandleButtonMouseEvent( wxMouseEvent& event, int flags ); - - // returns true if event was consumed or filtered (event type is also set to 0 in this case) - bool PreprocessMouseEvent( wxMouseEvent& event, int flags ); - - // - // This will handle left_down and left_dclick events outside button in a Windows-like manner. - // If you need alternate behaviour, it is recommended you manipulate and filter events to it - // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will - // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method, - // if defined - you should pass events of other types of it for common processing). - void HandleNormalMouseEvent( wxMouseEvent& event ); - - // Creates popup window, calls interface->Create(), etc - void CreatePopup(); - - // Destroy popup window and all related constructs - void DestroyPopup(); - - // override the base class virtuals involved in geometry calculations - virtual wxSize DoGetBestSize() const; - - // NULL popup can be used to indicate default in a derived class - virtual void DoSetPopupControl(wxComboPopup* popup); - - // ensures there is atleast the default popup - void EnsurePopupControl(); - - // Recalculates button and textctrl areas. Called when size or button setup change. - // btnWidth: default/calculated width of the dropbutton. 0 means unchanged, - // just recalculate. - void CalculateAreas( int btnWidth = 0 ); - - // Standard textctrl positioning routine. Just give it platform-dependant - // textctrl coordinate adjustment. - void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); - - // event handlers - void OnSizeEvent( wxSizeEvent& event ); - void OnFocusEvent(wxFocusEvent& event); - void OnIdleEvent(wxIdleEvent& event); - void OnTextCtrlEvent(wxCommandEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnKeyEvent(wxKeyEvent& event); - - // Set customization flags (directs how wxComboCtrlBase helpers behave) - void Customize( wxUint32 flags ) { m_iFlags |= flags; } - - // Dispatches size event and refreshes - void RecalcAndRefresh(); - - // Flags for DoShowPopup and AnimateShow - enum - { - ShowBelow = 0x0000, // Showing popup below the control - ShowAbove = 0x0001, // Showing popup above the control - CanDeferShow = 0x0002 // Can only return true from AnimateShow if this is set - }; - - // Shows and positions the popup. - virtual void DoShowPopup( const wxRect& rect, int flags ); - - // Implement in derived class to create a drop-down animation. - // Return true if finished immediately. Otherwise popup is only - // shown when the derived class call DoShowPopup. - // Flags are same as for DoShowPopup. - virtual bool AnimateShow( const wxRect& rect, int flags ); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif - - virtual wxWindow *GetMainWindowOfCompositeControl() - { return m_mainCtrlWnd; } - - // This is used when m_text is hidden (readonly). - wxString m_valueString; - - // the text control and button we show all the time - wxTextCtrl* m_text; - wxWindow* m_btn; - - // wxPopupWindow or similar containing the window managed by the interface. - wxWindow* m_winPopup; - - // the popup control/panel - wxWindow* m_popup; - - // popup interface - wxComboPopup* m_popupInterface; - - // this is input etc. handler for the text control - wxEvtHandler* m_textEvtHandler; - - // this is for the top level window - wxEvtHandler* m_toplevEvtHandler; - - // this is for the control in popup - wxEvtHandler* m_popupExtraHandler; - - // this is for the popup window - wxEvtHandler* m_popupWinEvtHandler; - - // main (ie. topmost) window of a composite control (default = this) - wxWindow* m_mainCtrlWnd; - - // used to prevent immediate re-popupping incase closed popup - // by clicking on the combo control (needed because of inconsistent - // transient implementation across platforms). - wxLongLong m_timeCanAcceptClick; - - // how much popup should expand to the left/right of the control - wxCoord m_extLeft; - wxCoord m_extRight; - - // minimum popup width - wxCoord m_widthMinPopup; - - // preferred popup height - wxCoord m_heightPopup; - - // how much of writable combo is custom-paint by callback? - // also used to indicate area that is not covered by "blue" - // selection indicator. - wxCoord m_widthCustomPaint; - - // absolute text indentation, in pixels - wxCoord m_absIndent; - - // side on which the popup is aligned - int m_anchorSide; - - // Width of the "fake" border - wxCoord m_widthCustomBorder; - - // The button and textctrl click/paint areas - wxRect m_tcArea; - wxRect m_btnArea; - - // current button state (uses renderer flags) - int m_btnState; - - // button position - int m_btnWid; - int m_btnHei; - int m_btnSide; - int m_btnSpacingX; - - // last default button width - int m_btnWidDefault; - - // custom dropbutton bitmaps - wxBitmap m_bmpNormal; - wxBitmap m_bmpPressed; - wxBitmap m_bmpHover; - wxBitmap m_bmpDisabled; - - // area used by the button - wxSize m_btnSize; - - // platform-dependant customization and other flags - wxUint32 m_iFlags; - - // draw blank button background under bitmap? - bool m_blankButtonBg; - - // is the popup window currenty shown? - wxByte m_popupWinState; - - // should the focus be reset to the textctrl in idle time? - bool m_resetFocus; - -private: - void Init(); - - wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore - - // Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog? - wxByte m_popupWinType; - - DECLARE_EVENT_TABLE() - - DECLARE_ABSTRACT_CLASS(wxComboCtrlBase) -}; - - -// ---------------------------------------------------------------------------- -// wxComboPopup is the interface which must be implemented by a control to be -// used as a popup by wxComboCtrl -// ---------------------------------------------------------------------------- - - -// wxComboPopup internal flags -enum -{ - wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called -}; - - -class WXDLLEXPORT wxComboPopup -{ - friend class wxComboCtrlBase; -public: - wxComboPopup() - { - m_combo = (wxComboCtrlBase*) NULL; - m_iFlags = 0; - } - - // This is called immediately after construction finishes. m_combo member - // variable has been initialized before the call. - // NOTE: It is not in constructor so the derived class doesn't need to redefine - // a default constructor of its own. - virtual void Init() { } - - virtual ~wxComboPopup(); - - // Create the popup child control. - // Return true for success. - virtual bool Create(wxWindow* parent) = 0; - - // We must have an associated control which is subclassed by the combobox. - virtual wxWindow *GetControl() = 0; - - // Called immediately after the popup is shown - virtual void OnPopup(); - - // Called when popup is dismissed - virtual void OnDismiss(); - - // Called just prior to displaying popup. - // Default implementation does nothing. - virtual void SetStringValue( const wxString& value ); - - // Gets displayed string representation of the value. - virtual wxString GetStringValue() const = 0; - - // This is called to custom paint in the combo control itself (ie. not the popup). - // Default implementation draws value as string. - virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - - // Receives key events from the parent wxComboCtrl. - // Events not handled should be skipped, as usual. - virtual void OnComboKeyEvent( wxKeyEvent& event ); - - // Implement if you need to support special action when user - // double-clicks on the parent wxComboCtrl. - virtual void OnComboDoubleClick(); - - // Return final size of popup. Called on every popup, just prior to OnShow. - // minWidth = preferred minimum width for window - // prefHeight = preferred height. Only applies if > 0, - // maxHeight = max height for window, as limited by screen size - // and should only be rounded down, if necessary. - virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); - - // Return true if you want delay call to Create until the popup is shown - // for the first time. It is more efficient, but note that it is often - // more convenient to have the control created immediately. - // Default returns false. - virtual bool LazyCreate(); - - // - // Utilies - // - - // Hides the popup - void Dismiss(); - - // Returns true if Create has been called. - bool IsCreated() const - { - return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; - } - - // Default PaintComboControl behaviour - static void DefaultPaintComboControl( wxComboCtrlBase* combo, - wxDC& dc, - const wxRect& rect ); - -protected: - wxComboCtrlBase* m_combo; - wxUint32 m_iFlags; - -private: - // Called in wxComboCtrlBase::SetPopupControl - void InitBase(wxComboCtrlBase *combo) - { - m_combo = combo; - } -}; - - -// ---------------------------------------------------------------------------- -// include the platform-dependent header defining the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - // No native universal (but it must still be first in the list) -#elif defined(__WXMSW__) - #include "wx/msw/combo.h" -#endif - -// Any ports may need generic as an alternative -#include "wx/generic/combo.h" - -#endif // wxUSE_COMBOCTRL - -#endif - // _WX_COMBOCONTROL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/combobox.h b/Source/3rdParty/wx/include/wx/combobox.h deleted file mode 100644 index af84fb668..000000000 --- a/Source/3rdParty/wx/include/wx/combobox.h +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/combobox.h -// Purpose: wxComboBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 24.12.00 -// RCS-ID: $Id: combobox.h 42727 2006-10-30 16:04:27Z VZ $ -// Copyright: (c) 1996-2000 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOBOX_H_BASE_ -#define _WX_COMBOBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_COMBOBOX - -extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxComboBoxBase: this interface defines the methods wxComboBox must implement -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" -#include "wx/ctrlsub.h" - -class WXDLLEXPORT wxComboBoxBase : public wxItemContainer -{ -public: - // wxTextCtrl-like methods wxComboBox must implement - virtual wxString GetValue() const = 0; - virtual void SetValue(const wxString& value) = 0; - - virtual void Copy() = 0; - virtual void Cut() = 0; - virtual void Paste() = 0; - virtual void SetInsertionPoint(long pos) = 0; - virtual long GetInsertionPoint() const = 0; - virtual wxTextPos GetLastPosition() const = 0; - virtual void Replace(long from, long to, const wxString& value) = 0; - virtual void SetSelection(long from, long to) = 0; - virtual void SetEditable(bool editable) = 0; - - virtual void SetInsertionPointEnd() - { SetInsertionPoint(GetLastPosition()); } - virtual void Remove(long from, long to) - { Replace(from, to, wxEmptyString); } - - virtual bool IsEditable() const = 0; - - virtual void Undo() = 0; - virtual void Redo() = 0; - virtual void SelectAll() = 0; - - virtual bool CanCopy() const = 0; - virtual bool CanCut() const = 0; - virtual bool CanPaste() const = 0; - virtual bool CanUndo() const = 0; - virtual bool CanRedo() const = 0; - - // may return value different from GetSelection() when the combobox - // dropdown is shown and the user selected, but not yet accepted, a value - // different from the old one in it - virtual int GetCurrentSelection() const { return GetSelection(); } - - // redeclare inherited SetSelection() overload here as well to avoid - // virtual function hiding - virtual void SetSelection(int n) = 0; -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent header defining the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/combobox.h" -#elif defined(__WXMSW__) - #include "wx/msw/combobox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/combobox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/combobox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/combobox.h" -#elif defined(__WXMAC__) - #include "wx/mac/combobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/combobox.h" -#elif defined(__WXPM__) - #include "wx/os2/combobox.h" -#endif - -#endif // wxUSE_COMBOBOX - -#endif - // _WX_COMBOBOX_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/confbase.h b/Source/3rdParty/wx/include/wx/confbase.h deleted file mode 100644 index 2e0197dce..000000000 --- a/Source/3rdParty/wx/include/wx/confbase.h +++ /dev/null @@ -1,359 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: confbase.h -// Purpose: declaration of the base class of all config implementations -// (see also: fileconf.h and msw/regconf.h and iniconf.h) -// Author: Karsten Ballueder & Vadim Zeitlin -// Modified by: -// Created: 07.04.98 (adapted from appconf.h) -// RCS-ID: $Id: confbase.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net -// Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONFBASE_H_ -#define _WX_CONFBASE_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -/// shall we be case sensitive in parsing variable names? -#ifndef wxCONFIG_CASE_SENSITIVE - #define wxCONFIG_CASE_SENSITIVE 0 -#endif - -/// separates group and entry names (probably shouldn't be changed) -#ifndef wxCONFIG_PATH_SEPARATOR - #define wxCONFIG_PATH_SEPARATOR wxT('/') -#endif - -/// introduces immutable entries -// (i.e. the ones which can't be changed from the local config file) -#ifndef wxCONFIG_IMMUTABLE_PREFIX - #define wxCONFIG_IMMUTABLE_PREFIX wxT('!') -#endif - -#if wxUSE_CONFIG - -#include "wx/string.h" - -/// should we use registry instead of configuration files under Windows? -// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's -// false) or wxRegConfig (if it's true and we're under Win32)) -#ifndef wxUSE_CONFIG_NATIVE - #define wxUSE_CONFIG_NATIVE 1 -#endif - -// Style flags for constructor style parameter -enum -{ - wxCONFIG_USE_LOCAL_FILE = 1, - wxCONFIG_USE_GLOBAL_FILE = 2, - wxCONFIG_USE_RELATIVE_PATH = 4, - wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8, - wxCONFIG_USE_SUBDIR = 16 -}; - -// ---------------------------------------------------------------------------- -// abstract base class wxConfigBase which defines the interface for derived -// classes -// -// wxConfig organizes the items in a tree-like structure (modeled after the -// Unix/Dos filesystem). There are groups (directories) and keys (files). -// There is always one current group given by the current path. -// -// Keys are pairs "key_name = value" where value may be of string or integer -// (long) type (TODO doubles and other types such as wxDate coming soon). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConfigBase -{ -public: - // constants - // the type of an entry - enum EntryType - { - Type_Unknown, - Type_String, - Type_Boolean, - Type_Integer, // use Read(long *) - Type_Float // use Read(double *) - }; - - // static functions - // sets the config object, returns the previous pointer - static wxConfigBase *Set(wxConfigBase *pConfig); - // get the config object, creates it on demand unless DontCreateOnDemand - // was called - static wxConfigBase *Get(bool createOnDemand = true) - { if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; } - // create a new config object: this function will create the "best" - // implementation of wxConfig available for the current platform, see - // comments near definition wxUSE_CONFIG_NATIVE for details. It returns - // the created object and also sets it as ms_pConfig. - static wxConfigBase *Create(); - // should Get() try to create a new log object if the current one is NULL? - static void DontCreateOnDemand() { ms_bAutoCreate = false; } - - // ctor & virtual dtor - // ctor (can be used as default ctor too) - // - // Not all args will always be used by derived classes, but including - // them all in each class ensures compatibility. If appName is empty, - // uses wxApp name - wxConfigBase(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = 0); - - // empty but ensures that dtor of all derived classes is virtual - virtual ~wxConfigBase(); - - // path management - // set current path: if the first character is '/', it's the absolute path, - // otherwise it's a relative path. '..' is supported. If the strPath - // doesn't exist it is created. - virtual void SetPath(const wxString& strPath) = 0; - // retrieve the current path (always as absolute path) - virtual const wxString& GetPath() const = 0; - - // enumeration: all functions here return false when there are no more items. - // you must pass the same lIndex to GetNext and GetFirst (don't modify it) - // enumerate subgroups - virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0; - virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0; - // enumerate entries - virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0; - virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0; - // get number of entries/subgroups in the current group, with or without - // it's subgroups - virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0; - - // tests of existence - // returns true if the group by this name exists - virtual bool HasGroup(const wxString& strName) const = 0; - // same as above, but for an entry - virtual bool HasEntry(const wxString& strName) const = 0; - // returns true if either a group or an entry with a given name exist - bool Exists(const wxString& strName) const - { return HasGroup(strName) || HasEntry(strName); } - - // get the entry type - virtual EntryType GetEntryType(const wxString& name) const - { - // by default all entries are strings - return HasEntry(name) ? Type_String : Type_Unknown; - } - - // key access: returns true if value was really read, false if default used - // (and if the key is not found the default value is returned.) - - // read a string from the key - bool Read(const wxString& key, wxString *pStr) const; - bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const; - - // read a number (long) - bool Read(const wxString& key, long *pl) const; - bool Read(const wxString& key, long *pl, long defVal) const; - - // read an int - bool Read(const wxString& key, int *pi) const; - bool Read(const wxString& key, int *pi, int defVal) const; - - // read a double - bool Read(const wxString& key, double* val) const; - bool Read(const wxString& key, double* val, double defVal) const; - - // read a bool - bool Read(const wxString& key, bool* val) const; - bool Read(const wxString& key, bool* val, bool defVal) const; - - // convenience functions returning directly the value (we don't have them for - // int/double/bool as there would be ambiguities with the long one then) - wxString Read(const wxString& key, - const wxString& defVal = wxEmptyString) const - { wxString s; (void)Read(key, &s, defVal); return s; } - - long Read(const wxString& key, long defVal) const - { long l; (void)Read(key, &l, defVal); return l; } - - // write the value (return true on success) - bool Write(const wxString& key, const wxString& value) - { return DoWriteString(key, value); } - - bool Write(const wxString& key, long value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, int value) - { return DoWriteInt(key, value); } - - bool Write(const wxString& key, double value) - { return DoWriteDouble(key, value); } - - bool Write(const wxString& key, bool value) - { return DoWriteBool(key, value); } - - // we have to provide a separate version for C strings as otherwise they - // would be converted to bool and not to wxString as expected! - bool Write(const wxString& key, const wxChar *value) - { return Write(key, wxString(value)); } - - // permanently writes all changes - virtual bool Flush(bool bCurrentOnly = false) = 0; - - // renaming, all functions return false on failure (probably because the new - // name is already taken by an existing entry) - // rename an entry - virtual bool RenameEntry(const wxString& oldName, - const wxString& newName) = 0; - // rename a group - virtual bool RenameGroup(const wxString& oldName, - const wxString& newName) = 0; - - // delete entries/groups - // deletes the specified entry and the group it belongs to if - // it was the last key in it and the second parameter is true - virtual bool DeleteEntry(const wxString& key, - bool bDeleteGroupIfEmpty = true) = 0; - // delete the group (with all subgroups) - virtual bool DeleteGroup(const wxString& key) = 0; - // delete the whole underlying object (disk file, registry key, ...) - // primarily for use by uninstallation routine. - virtual bool DeleteAll() = 0; - - // options - // we can automatically expand environment variables in the config entries - // (this option is on by default, you can turn it on/off at any time) - bool IsExpandingEnvVars() const { return m_bExpandEnvVars; } - void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; } - // recording of default values - void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; } - bool IsRecordingDefaults() const { return m_bRecordDefaults; } - // does expansion only if needed - wxString ExpandEnvVars(const wxString& str) const; - - // misc accessors - wxString GetAppName() const { return m_appName; } - wxString GetVendorName() const { return m_vendorName; } - - // Used wxIniConfig to set members in constructor - void SetAppName(const wxString& appName) { m_appName = appName; } - void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } - - void SetStyle(long style) { m_style = style; } - long GetStyle() const { return m_style; } - -protected: - static bool IsImmutable(const wxString& key) - { return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; } - - // return the path without trailing separator, if any: this should be called - // to sanitize paths referring to the group names before passing them to - // wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it - // isn't interpreted in the same way by it (and this can't be changed there - // as it's not the same for the entries names) - static wxString RemoveTrailingSeparator(const wxString& key); - - // do read/write the values of different types - virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0; - virtual bool DoReadLong(const wxString& key, long *pl) const = 0; - virtual bool DoReadInt(const wxString& key, int *pi) const; - virtual bool DoReadDouble(const wxString& key, double* val) const; - virtual bool DoReadBool(const wxString& key, bool* val) const; - - virtual bool DoWriteString(const wxString& key, const wxString& value) = 0; - virtual bool DoWriteLong(const wxString& key, long value) = 0; - virtual bool DoWriteInt(const wxString& key, int value); - virtual bool DoWriteDouble(const wxString& key, double value); - virtual bool DoWriteBool(const wxString& key, bool value); - -private: - // are we doing automatic environment variable expansion? - bool m_bExpandEnvVars; - // do we record default values? - bool m_bRecordDefaults; - - // static variables - static wxConfigBase *ms_pConfig; - static bool ms_bAutoCreate; - - // Application name and organisation name - wxString m_appName; - wxString m_vendorName; - - // Style flag - long m_style; -}; - -// a handy little class which changes current path to the path of given entry -// and restores it in dtor: so if you declare a local variable of this type, -// you work in the entry directory and the path is automatically restored -// when the function returns -// Taken out of wxConfig since not all compilers can cope with nested classes. -class WXDLLIMPEXP_BASE wxConfigPathChanger -{ -public: - // ctor/dtor do path changing/restoring of the path - wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry); - ~wxConfigPathChanger(); - - // get the key name - const wxString& Name() const { return m_strName; } - - // this method must be called if the original path (i.e. the current path at - // the moment of creation of this object) could have been deleted to prevent - // us from restoring the not existing (any more) path - // - // if the original path doesn't exist any more, the path will be restored to - // the deepest still existing component of the old path - void UpdateIfDeleted(); - -private: - wxConfigBase *m_pContainer; // object we live in - wxString m_strName, // name of entry (i.e. name only) - m_strOldPath; // saved path - bool m_bChanged; // was the path changed? - - DECLARE_NO_COPY_CLASS(wxConfigPathChanger) -}; - - -// ---------------------------------------------------------------------------- -// the native wxConfigBase implementation -// ---------------------------------------------------------------------------- - -// under Windows we prefer to use the native implementation -// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6 -#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE - #define wxConfig wxRegConfig -#else // either we're under Unix or wish to use files even under Windows - #define wxConfig wxFileConfig -#endif - -#endif // wxUSE_CONFIG - -/* - Replace environment variables ($SOMETHING) with their values. The format is - $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and - '_' only. '$' must be escaped ('\$') in order to be taken literally. -*/ - -WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz); - -/* - Split path into parts removing '..' in progress - */ -WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz); - - -#endif - // _WX_CONFIG_H_ - diff --git a/Source/3rdParty/wx/include/wx/config.h b/Source/3rdParty/wx/include/wx/config.h deleted file mode 100644 index 92d036f93..000000000 --- a/Source/3rdParty/wx/include/wx/config.h +++ /dev/null @@ -1,33 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: config.h -// Purpose: wxConfig base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: config.h 60524 2009-05-05 22:51:44Z PC $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONFIG_H_BASE_ -#define _WX_CONFIG_H_BASE_ - -#include "wx/confbase.h" - -#if wxUSE_CONFIG - -#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE -# ifdef __WIN32__ -# include "wx/msw/regconf.h" -# else -# include "wx/msw/iniconf.h" -# endif -#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE -# include "wx/palmos/prefconf.h" -#else -# include "wx/fileconf.h" -#endif - -#endif // wxUSE_CONFIG - -#endif // _WX_CONFIG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/containr.h b/Source/3rdParty/wx/include/wx/containr.h deleted file mode 100644 index 0cf322c2e..000000000 --- a/Source/3rdParty/wx/include/wx/containr.h +++ /dev/null @@ -1,142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/containr.h -// Purpose: wxControlContainer class declration: a "mix-in" class which -// implements the TAB navigation between the controls -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.01 -// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTAINR_H_ -#define _WX_CONTAINR_H_ - -class WXDLLIMPEXP_FWD_CORE wxFocusEvent; -class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -/* - Implementation note: wxControlContainer is not a real mix-in but rather - a class meant to be agregated with (and not inherited from). Although - logically it should be a mix-in, doing it like this has no advantage from - the point of view of the existing code but does have some problems (we'd - need to play tricks with event handlers which may be difficult to do - safely). The price we pay for this simplicity is the ugly macros below. - */ - -// ---------------------------------------------------------------------------- -// wxControlContainer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlContainer -{ -public: - // ctors and such - wxControlContainer(wxWindow *winParent = NULL); - void SetContainerWindow(wxWindow *winParent) { m_winParent = winParent; } - - // the methods to be called from the window event handlers - void HandleOnNavigationKey(wxNavigationKeyEvent& event); - void HandleOnFocus(wxFocusEvent& event); - void HandleOnWindowDestroy(wxWindowBase *child); - - // should be called from SetFocus(), returns false if we did nothing with - // the focus and the default processing should take place - bool DoSetFocus(); - - // can our child get the focus? - bool AcceptsFocus() const; - - // called from OnChildFocus() handler, i.e. when one of our (grand) - // children gets the focus - void SetLastFocus(wxWindow *win); - -protected: - // set the focus to the child which had it the last time - bool SetFocusToChild(); - - // the parent window we manage the children for - wxWindow *m_winParent; - - // the child which had the focus last time this panel was activated - wxWindow *m_winLastFocused; - - // a guard against infinite recursion - bool m_inSetFocus; - - DECLARE_NO_COPY_CLASS(wxControlContainer) -}; - -// this function is for wxWidgets internal use only -extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); - -// ---------------------------------------------------------------------------- -// macros which may be used by the classes wishing to implement TAB navigation -// among their children -// ---------------------------------------------------------------------------- - -// declare the methods to be forwarded -#define WX_DECLARE_CONTROL_CONTAINER() \ -public: \ - void OnNavigationKey(wxNavigationKeyEvent& event); \ - void OnFocus(wxFocusEvent& event); \ - virtual void OnChildFocus(wxChildFocusEvent& event); \ - virtual void SetFocus(); \ - virtual void SetFocusIgnoringChildren(); \ - virtual void RemoveChild(wxWindowBase *child); \ - virtual bool AcceptsFocus() const; \ -\ -protected: \ - wxControlContainer m_container - -// implement the event table entries for wxControlContainer -#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \ - EVT_SET_FOCUS(classname::OnFocus) \ - EVT_CHILD_FOCUS(classname::OnChildFocus) \ - EVT_NAVIGATION_KEY(classname::OnNavigationKey) - -// implement the methods forwarding to the wxControlContainer -#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ -void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ -{ \ - m_container.HandleOnNavigationKey(event); \ -} \ - \ -void classname::RemoveChild(wxWindowBase *child) \ -{ \ - m_container.HandleOnWindowDestroy(child); \ - \ - basename::RemoveChild(child); \ -} \ - \ -void classname::SetFocus() \ -{ \ - if ( !m_container.DoSetFocus() ) \ - basename::SetFocus(); \ -} \ - \ -void classname::SetFocusIgnoringChildren() \ -{ \ - basename::SetFocus(); \ -} \ - \ -void classname::OnChildFocus(wxChildFocusEvent& event) \ -{ \ - m_container.SetLastFocus(event.GetWindow()); \ - event.Skip(); \ -} \ - \ -void classname::OnFocus(wxFocusEvent& event) \ -{ \ - m_container.HandleOnFocus(event); \ -} \ -bool classname::AcceptsFocus() const \ -{ \ - return m_container.AcceptsFocus(); \ -} - - -#endif // _WX_CONTAINR_H_ diff --git a/Source/3rdParty/wx/include/wx/control.h b/Source/3rdParty/wx/include/wx/control.h deleted file mode 100644 index ff11a93cf..000000000 --- a/Source/3rdParty/wx/include/wx/control.h +++ /dev/null @@ -1,117 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/control.h -// Purpose: wxControl common interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: control.h 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTROL_H_BASE_ -#define _WX_CONTROL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CONTROLS - -#include "wx/window.h" // base class - -extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[]; - -// ---------------------------------------------------------------------------- -// wxControl is the base class for all controls -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlBase : public wxWindow -{ -public: - wxControlBase() { } - - virtual ~wxControlBase(); - - // Create() function adds the validator parameter - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - - // get the control alignment (left/right/centre, top/bottom/centre) - int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } - - // get the string without mnemonic characters ('&') - static wxString GetLabelText(const wxString& label); - - // get just the text of the label, without mnemonic characters ('&') - wxString GetLabelText() const { return GetLabelText(GetLabel()); } - - // controls by default inherit the colours of their parents, if a - // particular control class doesn't want to do it, it can override - // ShouldInheritColours() to return false - virtual bool ShouldInheritColours() const { return true; } - - - // WARNING: this doesn't work for all controls nor all platforms! - // - // simulates the event of given type (i.e. wxButton::Command() is just as - // if the button was clicked) - virtual void Command(wxCommandEvent &event); - - virtual void SetLabel( const wxString &label ); - virtual bool SetFont(const wxFont& font); - - // wxControl-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - -protected: - // creates the control (calls wxWindowBase::CreateBase inside) and adds it - // to the list of parents children - bool CreateControl(wxWindowBase *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - - // initialize the common fields of wxCommandEvent - void InitCommandEvent(wxCommandEvent& event) const; - - DECLARE_NO_COPY_CLASS(wxControlBase) -}; - -// ---------------------------------------------------------------------------- -// include platform-dependent wxControl declarations -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/control.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/control.h" -#elif defined(__WXMSW__) - #include "wx/msw/control.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/control.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/control.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/control.h" -#elif defined(__WXMAC__) - #include "wx/mac/control.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/control.h" -#elif defined(__WXPM__) - #include "wx/os2/control.h" -#endif - -#endif // wxUSE_CONTROLS - -#endif - // _WX_CONTROL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/convauto.h b/Source/3rdParty/wx/include/wx/convauto.h deleted file mode 100644 index ced911950..000000000 --- a/Source/3rdParty/wx/include/wx/convauto.h +++ /dev/null @@ -1,108 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/convauto.h -// Purpose: wxConvAuto class declaration -// Author: Vadim Zeitlin -// Created: 2006-04-03 -// RCS-ID: $Id: convauto.h 45893 2007-05-08 20:05:16Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONVAUTO_H_ -#define _WX_CONVAUTO_H_ - -#include "wx/strconv.h" - -#if wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// wxConvAuto: uses BOM to automatically detect input encoding -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv -{ -public: - // default ctor, the real conversion will be created on demand - wxConvAuto() { m_conv = NULL; /* the rest will be initialized later */ } - - // copy ctor doesn't initialize anything neither as conversion can only be - // deduced on first use - wxConvAuto(const wxConvAuto& WXUNUSED(other)) : wxMBConv() { m_conv = NULL; } - - virtual ~wxConvAuto() { if ( m_conv && m_ownsConv ) delete m_conv; } - - // override the base class virtual function(s) to use our m_conv - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t GetMBNulLen() const { return m_conv->GetMBNulLen(); } - - virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } - -private: - // all currently recognized BOM values - enum BOMType - { - BOM_None, - BOM_UTF32BE, - BOM_UTF32LE, - BOM_UTF16BE, - BOM_UTF16LE, - BOM_UTF8 - }; - - // return the BOM type of this buffer - static BOMType DetectBOM(const char *src, size_t srcLen); - - // initialize m_conv with the conversion to use by default (UTF-8) - void InitWithDefault() - { - m_conv = &wxConvUTF8; - m_ownsConv = false; - } - - // create the correct conversion object for the given BOM type - void InitFromBOM(BOMType bomType); - - // create the correct conversion object for the BOM present in the - // beginning of the buffer; adjust the buffer to skip the BOM if found - void InitFromInput(const char **src, size_t *len); - - // adjust src and len to skip over the BOM (identified by m_bomType) at the - // start of the buffer - void SkipBOM(const char **src, size_t *len) const; - - - // conversion object which we really use, NULL until the first call to - // either ToWChar() or FromWChar() - wxMBConv *m_conv; - - // our BOM type - BOMType m_bomType; - - // true if we allocated m_conv ourselves, false if we just use an existing - // global conversion - bool m_ownsConv; - - // true if we already skipped BOM when converting (and not just calculating - // the size) - bool m_consumedBOM; - - - DECLARE_NO_ASSIGN_CLASS(wxConvAuto) -}; - -#else // !wxUSE_WCHAR_T - -// it doesn't matter how we define it in this case as it's unused anyhow, but -// do define it to allow the code using wxConvAuto() as default argument (this -// is done in many places) to compile -typedef wxMBConv wxConvAuto; - -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - -#endif // _WX_CONVAUTO_H_ - diff --git a/Source/3rdParty/wx/include/wx/cpp.h b/Source/3rdParty/wx/include/wx/cpp.h deleted file mode 100644 index 8d7a646d7..000000000 --- a/Source/3rdParty/wx/include/wx/cpp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Name: wx/cpp.h - * Purpose: Various preprocessor helpers - * Author: Vadim Zeitlin - * Created: 2006-09-30 - * RCS-ID: $Id: cpp.h 42993 2006-11-03 21:06:57Z VZ $ - * Copyright: (c) 2006 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_CPP_H_ -#define _WX_CPP_H_ - -/* wxCONCAT works like preprocessor ## operator but also works with macros */ -#define wxCONCAT_HELPER(text, line) text ## line -#define wxCONCAT(text, line) wxCONCAT_HELPER(text, line) - -/* wxSTRINGIZE works as the preprocessor # operator but also works with macros */ -#define wxSTRINGIZE_HELPER(x) #x -#define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x) - -/* a Unicode-friendly version of wxSTRINGIZE_T */ -#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x)) - -/* - Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the - current line number to the given identifier to reduce the probability of the - conflict (it may still happen if this is used in the headers, hence you - should avoid doing it or provide unique prefixes then) but we have to do it - differently for VC++ - */ -#if defined(__VISUALC__) && (__VISUALC__ >= 1300) - /* - __LINE__ handling is completely broken in VC++ when using "Edit and - Continue" (/ZI option) and results in preprocessor errors if we use it - inside the macros. Luckily VC7 has another standard macro which can be - used like this and is even better than __LINE__ because it is globally - unique. - */ -# define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__) -#else /* normal compilers */ -# define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__) -#endif - -/* Create a "unique" name with the given prefix */ -#define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text) - -/* - This macro can be passed as argument to another macro when you don't have - anything to pass in fact. - */ -#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */ - -#endif // _WX_CPP_H_ - diff --git a/Source/3rdParty/wx/include/wx/cshelp.h b/Source/3rdParty/wx/include/wx/cshelp.h deleted file mode 100644 index 53e13c389..000000000 --- a/Source/3rdParty/wx/include/wx/cshelp.h +++ /dev/null @@ -1,244 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cshelp.h -// Purpose: Context-sensitive help support classes -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 08/09/2000 -// RCS-ID: $Id: cshelp.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CSHELP_H_ -#define _WX_CSHELP_H_ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/help.h" - -#include "wx/hashmap.h" -#if wxUSE_BMPBUTTON -#include "wx/bmpbuttn.h" -#endif - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// classes used to implement context help UI -// ---------------------------------------------------------------------------- - -/* - * wxContextHelp - * Invokes context-sensitive help. When the user - * clicks on a window, a wxEVT_HELP event will be sent to that - * window for the application to display help for. - */ - -class WXDLLEXPORT wxContextHelp : public wxObject -{ -public: - wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); - virtual ~wxContextHelp(); - - bool BeginContextHelp(wxWindow* win); - bool EndContextHelp(); - - bool EventLoop(); - bool DispatchEvent(wxWindow* win, const wxPoint& pt); - - void SetStatus(bool status) { m_status = status; } - -protected: - bool m_inHelp; - bool m_status; // true if the user left-clicked - -private: - DECLARE_DYNAMIC_CLASS(wxContextHelp) -}; - -#if wxUSE_BMPBUTTON -/* - * wxContextHelpButton - * You can add this to your dialogs (especially on non-Windows platforms) - * to put the application into context help mode. - */ - -class WXDLLEXPORT wxContextHelpButton : public wxBitmapButton -{ -public: - wxContextHelpButton(wxWindow* parent, - wxWindowID id = wxID_CONTEXT_HELP, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW); - - void OnContextHelp(wxCommandEvent& event); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton) - DECLARE_EVENT_TABLE() -}; - -#endif - -// ---------------------------------------------------------------------------- -// classes used to implement context help support -// ---------------------------------------------------------------------------- - -// wxHelpProvider is an abstract class used by the program implementing context help to -// show the help text (or whatever: it may be HTML page or anything else) for -// the given window. -// -// The current help provider must be explicitly set by the application using -// wxHelpProvider::Set(). -// -// Special note about ShowHelpAtPoint() and ShowHelp(): we want to be able to -// override ShowHelpAtPoint() when we need to use different help messages for -// different parts of the window, but it should also be possible to override -// just ShowHelp() both for backwards compatibility and just because most -// often the help does not, in fact, depend on the position and so -// implementing just ShowHelp() is simpler and more natural, so by default -// ShowHelpAtPoint() forwards to ShowHelp(). But this means that -// wxSimpleHelpProvider has to override ShowHelp() and not ShowHelpAtPoint() -// for backwards compatibility as otherwise the existing code deriving from it -// and overriding ShowHelp() but calling the base class version wouldn't work -// any more, which forces us to use a rather ugly hack and pass the extra -// parameters of ShowHelpAtPoint() to ShowHelp() via member variables. -class WXDLLEXPORT wxHelpProvider -{ -public: - // get/set the current (application-global) help provider (Set() returns - // the previous one) - static wxHelpProvider *Set(wxHelpProvider *helpProvider) - { - wxHelpProvider *helpProviderOld = ms_helpProvider; - ms_helpProvider = helpProvider; - return helpProviderOld; - } - - // unlike some other class, the help provider is not created on demand, - // this must be explicitly done by the application - static wxHelpProvider *Get() { return ms_helpProvider; } - - // get the help string (whose interpretation is help provider dependent - // except that empty string always means that no help is associated with - // the window) for this window - virtual wxString GetHelp(const wxWindowBase *window) = 0; - - // do show help for the given window (uses window->GetHelpAtPoint() - // internally if applicable), return true if it was done or false - // if no help available for this window - virtual bool ShowHelpAtPoint(wxWindowBase *window, - const wxPoint& pt, - wxHelpEvent::Origin origin) - { - wxCHECK_MSG( window, false, wxT("window must not be NULL") ); - - m_helptextAtPoint = pt; - m_helptextOrigin = origin; - - return ShowHelp(window); - } - - // show help for the given window, see ShowHelpAtPoint() above - virtual bool ShowHelp(wxWindowBase * WXUNUSED(window)) { return false; } - - // associate the text with the given window or id: although all help - // providers have these functions to allow making wxWindow::SetHelpText() - // work, not all of them implement them - virtual void AddHelp(wxWindowBase *window, const wxString& text); - - // this version associates the given text with all window with this id - // (may be used to set the same help string for all [Cancel] buttons in - // the application, for example) - virtual void AddHelp(wxWindowID id, const wxString& text); - - // removes the association - virtual void RemoveHelp(wxWindowBase* window); - - // virtual dtor for any base class - virtual ~wxHelpProvider(); - -protected: - wxHelpProvider() - : m_helptextAtPoint(wxDefaultPosition), - m_helptextOrigin(wxHelpEvent::Origin_Unknown) - { - } - - // helper method used by ShowHelp(): returns the help string to use by - // using m_helptextAtPoint/m_helptextOrigin if they're set or just GetHelp - // otherwise - wxString GetHelpTextMaybeAtPoint(wxWindowBase *window); - - - // parameters of the last ShowHelpAtPoint() call, used by ShowHelp() - wxPoint m_helptextAtPoint; - wxHelpEvent::Origin m_helptextOrigin; - -private: - static wxHelpProvider *ms_helpProvider; -}; - -WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash, - wxIntegerEqual, wxSimpleHelpProviderHashMap ); - -// wxSimpleHelpProvider is an implementation of wxHelpProvider which supports -// only plain text help strings and shows the string associated with the -// control (if any) in a tooltip -class WXDLLEXPORT wxSimpleHelpProvider : public wxHelpProvider -{ -public: - // implement wxHelpProvider methods - virtual wxString GetHelp(const wxWindowBase *window); - - // override ShowHelp() and not ShowHelpAtPoint() as explained above - virtual bool ShowHelp(wxWindowBase *window); - - virtual void AddHelp(wxWindowBase *window, const wxString& text); - virtual void AddHelp(wxWindowID id, const wxString& text); - virtual void RemoveHelp(wxWindowBase* window); - -protected: - // we use 2 hashes for storing the help strings associated with windows - // and the ids - wxSimpleHelpProviderHashMap m_hashWindows, - m_hashIds; -}; - -// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports -// both context identifiers and plain text help strings. If the help text is an integer, -// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string -// in a tooltip as per wxSimpleHelpProvider. -class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider -{ -public: - // Note that it doesn't own the help controller. The help controller - // should be deleted separately. - wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL); - - // implement wxHelpProvider methods - - // again (see above): this should be ShowHelpAtPoint() but we need to - // override ShowHelp() to avoid breaking existing code - virtual bool ShowHelp(wxWindowBase *window); - - // Other accessors - void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; } - wxHelpControllerBase* GetHelpController() const { return m_helpController; } - -protected: - wxHelpControllerBase* m_helpController; - - DECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider) -}; - -// Convenience function for turning context id into wxString -WXDLLEXPORT wxString wxContextId(int id); - -#endif // wxUSE_HELP - -#endif // _WX_CSHELP_H_ - diff --git a/Source/3rdParty/wx/include/wx/ctrlsub.h b/Source/3rdParty/wx/include/wx/ctrlsub.h deleted file mode 100644 index dc29fe63f..000000000 --- a/Source/3rdParty/wx/include/wx/ctrlsub.h +++ /dev/null @@ -1,210 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems") -// Purpose: wxControlWithItems interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: ctrlsub.h 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CTRLSUB_H_BASE_ -#define _WX_CTRLSUB_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CONTROLS - -#include "wx/control.h" // base class - -// ---------------------------------------------------------------------------- -// wxItemContainer defines an interface which is implemented by all controls -// which have string subitems each of which may be selected. -// -// It is decomposed in wxItemContainerImmutable which omits all methods -// adding/removing items and is used by wxRadioBox and wxItemContainer itself. -// -// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which -// implements an extended interface deriving from this one) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxItemContainerImmutable -{ -public: - wxItemContainerImmutable() { } - virtual ~wxItemContainerImmutable(); - - // accessing strings - // ----------------- - - virtual unsigned int GetCount() const = 0; - bool IsEmpty() const { return GetCount() == 0; } - - virtual wxString GetString(unsigned int n) const = 0; - wxArrayString GetStrings() const; - virtual void SetString(unsigned int n, const wxString& s) = 0; - - // finding string natively is either case sensitive or insensitive - // but never both so fall back to this base version for not - // supported search type - virtual int FindString(const wxString& s, bool bCase = false) const - { - unsigned int count = GetCount(); - - for ( unsigned int i = 0; i < count ; ++i ) - { - if (GetString(i).IsSameAs( s , bCase )) - return (int)i; - } - - return wxNOT_FOUND; - } - - - // selection - // --------- - - virtual void SetSelection(int n) = 0; - virtual int GetSelection() const = 0; - - // set selection to the specified string, return false if not found - bool SetStringSelection(const wxString& s); - - // return the selected string or empty string if none - wxString GetStringSelection() const; - - // this is the same as SetSelection( for single-selection controls but - // reads better for multi-selection ones - void Select(int n) { SetSelection(n); } - - -protected: - - // check that the index is valid - inline bool IsValid(unsigned int n) const { return n < GetCount(); } - inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } -}; - -class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable -{ -public: - wxItemContainer() { m_clientDataItemsType = wxClientData_None; } - virtual ~wxItemContainer(); - - // adding items - // ------------ - - int Append(const wxString& item) - { return DoAppend(item); } - int Append(const wxString& item, void *clientData) - { int n = DoAppend(item); SetClientData(n, clientData); return n; } - int Append(const wxString& item, wxClientData *clientData) - { int n = DoAppend(item); SetClientObject(n, clientData); return n; } - - // only for rtti needs (separate name) - void AppendString( const wxString& item) - { Append( item ); } - - // append several items at once to the control - void Append(const wxArrayString& strings); - - int Insert(const wxString& item, unsigned int pos) - { return DoInsert(item, pos); } - int Insert(const wxString& item, unsigned int pos, void *clientData); - int Insert(const wxString& item, unsigned int pos, wxClientData *clientData); - - // deleting items - // -------------- - - virtual void Clear() = 0; - virtual void Delete(unsigned int n) = 0; - - // misc - // ---- - - // client data stuff - void SetClientData(unsigned int n, void* clientData); - void* GetClientData(unsigned int n) const; - - void SetClientObject(unsigned int n, wxClientData* clientData); - wxClientData* GetClientObject(unsigned int n) const; - - bool HasClientObjectData() const - { return m_clientDataItemsType == wxClientData_Object; } - bool HasClientUntypedData() const - { return m_clientDataItemsType == wxClientData_Void; } - -protected: - virtual int DoAppend(const wxString& item) = 0; - virtual int DoInsert(const wxString& item, unsigned int pos) = 0; - - virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0; - virtual void* DoGetItemClientData(unsigned int n) const = 0; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0; - virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0; - - - // the type of the client data for the items - wxClientDataType m_clientDataItemsType; -}; - -// this macro must (unfortunately) be used in any class deriving from both -// wxItemContainer and wxControl because otherwise there is ambiguity when -// calling GetClientXXX() functions -- the compiler can't choose between the -// two versions -#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \ - void SetClientData(void *data) \ - { wxEvtHandler::SetClientData(data); } \ - void *GetClientData() const \ - { return wxEvtHandler::GetClientData(); } \ - void SetClientObject(wxClientData *data) \ - { wxEvtHandler::SetClientObject(data); } \ - wxClientData *GetClientObject() const \ - { return wxEvtHandler::GetClientObject(); } \ - void SetClientData(unsigned int n, void* clientData) \ - { wxItemContainer::SetClientData(n, clientData); } \ - void* GetClientData(unsigned int n) const \ - { return wxItemContainer::GetClientData(n); } \ - void SetClientObject(unsigned int n, wxClientData* clientData) \ - { wxItemContainer::SetClientObject(n, clientData); } \ - wxClientData* GetClientObject(unsigned int n) const \ - { return wxItemContainer::GetClientObject(n); } - -class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer -{ -public: - wxControlWithItems() { } - virtual ~wxControlWithItems(); - - // we have to redefine these functions here to avoid ambiguities in classes - // deriving from us which would arise otherwise because both base classses - // have the methods with the same names - hopefully, a smart compiler can - // optimize away these simple inline wrappers so we don't suffer much from - // this - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - // usually the controls like list/combo boxes have their own background - // colour - virtual bool ShouldInheritColours() const { return false; } - -protected: - // fill in the client object or data field of the event as appropriate - // - // calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per - // item client data - void InitCommandEventWithItems(wxCommandEvent& event, int n); - -private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) - DECLARE_NO_COPY_CLASS(wxControlWithItems) -}; - - -// ---------------------------------------------------------------------------- -// inline functions -// ---------------------------------------------------------------------------- - -#endif // wxUSE_CONTROLS - -#endif // _WX_CTRLSUB_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/cursor.h b/Source/3rdParty/wx/include/wx/cursor.h deleted file mode 100644 index d072ff56a..000000000 --- a/Source/3rdParty/wx/include/wx/cursor.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cursor.h -// Purpose: wxCursor base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: cursor.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CURSOR_H_BASE_ -#define _WX_CURSOR_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) - #include "wx/palmos/cursor.h" -#elif defined(__WXMSW__) - #include "wx/msw/cursor.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/cursor.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/cursor.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/cursor.h" -#elif defined(__WXX11__) - #include "wx/x11/cursor.h" -#elif defined(__WXMGL__) - #include "wx/mgl/cursor.h" -#elif defined(__WXDFB__) - #include "wx/dfb/cursor.h" -#elif defined(__WXMAC__) - #include "wx/mac/cursor.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/cursor.h" -#elif defined(__WXPM__) - #include "wx/os2/cursor.h" -#endif - -#include "wx/utils.h" - -/* This is a small class which can be used by all ports - to temporarily suspend the busy cursor. Useful in modal - dialogs. - - Actually that is not (any longer) quite true.. currently it is - only used in wxGTK Dialog::ShowModal() and now uses static - wxBusyCursor methods that are only implemented for wxGTK so far. - The BusyCursor handling code should probably be implemented in - common code somewhere instead of the separate implementations we - currently have. Also the name BusyCursorSuspender is a little - misleading since it doesn't actually suspend the BusyCursor, just - masks one that is already showing. - If another call to wxBeginBusyCursor is made while this is active - the Busy Cursor will again be shown. But at least now it doesn't - interfere with the state of wxIsBusy() -- RL - -*/ -class wxBusyCursorSuspender -{ -public: - wxBusyCursorSuspender() - { - if( wxIsBusy() ) - { - wxSetCursor( wxBusyCursor::GetStoredCursor() ); - } - } - ~wxBusyCursorSuspender() - { - if( wxIsBusy() ) - { - wxSetCursor( wxBusyCursor::GetBusyCursor() ); - } - } -}; -#endif - // _WX_CURSOR_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dataobj.h b/Source/3rdParty/wx/include/wx/dataobj.h deleted file mode 100644 index 31a756e23..000000000 --- a/Source/3rdParty/wx/include/wx/dataobj.h +++ /dev/null @@ -1,540 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dataobj.h -// Purpose: common data object classes -// Author: Vadim Zeitlin, Robert Roebling -// Modified by: -// Created: 26.05.99 -// RCS-ID: $Id: dataobj.h 40772 2006-08-23 13:38:45Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATAOBJ_H_BASE_ -#define _WX_DATAOBJ_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- -#include "wx/defs.h" - -#if wxUSE_DATAOBJ - -#include "wx/string.h" -#include "wx/bitmap.h" -#include "wx/list.h" -#include "wx/arrstr.h" - -// ============================================================================ -/* - Generic data transfer related classes. The class hierarchy is as follows: - - - wxDataObject- - / \ - / \ - wxDataObjectSimple wxDataObjectComposite - / | \ - / | \ - wxTextDataObject | wxBitmapDataObject - | - wxCustomDataObject - -*/ -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxDataFormat class is declared in platform-specific headers: it represents -// a format for data which may be either one of the standard ones (text, -// bitmap, ...) or a custom one which is then identified by a unique string. -// ---------------------------------------------------------------------------- - -/* the class interface looks like this (pseudo code): - -class wxDataFormat -{ -public: - typedef NativeFormat; - - wxDataFormat(NativeFormat format = wxDF_INVALID); - wxDataFormat(const wxChar *format); - - wxDataFormat& operator=(NativeFormat format); - wxDataFormat& operator=(const wxDataFormat& format); - - bool operator==(NativeFormat format) const; - bool operator!=(NativeFormat format) const; - - void SetType(NativeFormat format); - NativeFormat GetType() const; - - wxString GetId() const; - void SetId(const wxChar *format); -}; - -*/ - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataform.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dataform.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dataform.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dataform.h" -#elif defined(__WXX11__) - #include "wx/x11/dataform.h" -#elif defined(__WXMAC__) - #include "wx/mac/dataform.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataform.h" -#elif defined(__WXPM__) - #include "wx/os2/dataform.h" -#endif - -// the value for default argument to some functions (corresponds to -// wxDF_INVALID) -extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid; - -// ---------------------------------------------------------------------------- -// wxDataObject represents a piece of data which knows which formats it -// supports and knows how to render itself in each of them - GetDataHere(), -// and how to restore data from the buffer (SetData()). -// -// Although this class may be used directly (i.e. custom classes may be -// derived from it), in many cases it might be simpler to use either -// wxDataObjectSimple or wxDataObjectComposite classes. -// -// A data object may be "read only", i.e. support only GetData() functions or -// "read-write", i.e. support both GetData() and SetData() (in principle, it -// might be "write only" too, but this is rare). Moreover, it doesn't have to -// support the same formats in Get() and Set() directions: for example, a data -// object containing JPEG image might accept BMPs in GetData() because JPEG -// image may be easily transformed into BMP but not in SetData(). Accordingly, -// all methods dealing with formats take an additional "direction" argument -// which is either SET or GET and which tells the function if the format needs -// to be supported by SetData() or GetDataHere(). -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObjectBase -{ -public: - enum Direction - { - Get = 0x01, // format is supported by GetDataHere() - Set = 0x02, // format is supported by SetData() - Both = 0x03 // format is supported by both (unused currently) - }; - - // this class is polymorphic, hence it needs a virtual dtor - virtual ~wxDataObjectBase(); - - // get the best suited format for rendering our data - virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0; - - // get the number of formats we support - virtual size_t GetFormatCount(Direction dir = Get) const = 0; - - // return all formats in the provided array (of size GetFormatCount()) - virtual void GetAllFormats(wxDataFormat *formats, - Direction dir = Get) const = 0; - - // get the (total) size of data for the given format - virtual size_t GetDataSize(const wxDataFormat& format) const = 0; - - // copy raw data (in the specified format) to the provided buffer, return - // true if data copied successfully, false otherwise - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0; - - // get data from the buffer of specified length (in the given format), - // return true if the data was read successfully, false otherwise - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t WXUNUSED(len), const void * WXUNUSED(buf)) - { - return false; - } - - // returns true if this format is supported - bool IsSupported(const wxDataFormat& format, Direction dir = Get) const; -}; - -// ---------------------------------------------------------------------------- -// include the platform-specific declarations of wxDataObject -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataobj.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dataobj.h" -#elif defined(__WXX11__) - #include "wx/x11/dataobj.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dataobj.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dataobj.h" -#elif defined(__WXMAC__) - #include "wx/mac/dataobj.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj.h" -#elif defined(__WXPM__) - #include "wx/os2/dataobj.h" -#endif - -// ---------------------------------------------------------------------------- -// wxDataObjectSimple is a wxDataObject which only supports one format (in -// both Get and Set directions, but you may return false from GetDataHere() or -// SetData() if one of them is not supported). This is the simplest possible -// wxDataObject implementation. -// -// This is still an "abstract base class" (although it doesn't have any pure -// virtual functions), to use it you should derive from it and implement -// GetDataSize(), GetDataHere() and SetData() functions because the base class -// versions don't do anything - they just return "not implemented". -// -// This class should be used when you provide data in only one format (no -// conversion to/from other formats), either a standard or a custom one. -// Otherwise, you should use wxDataObjectComposite or wxDataObject directly. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObjectSimple : public wxDataObject -{ -public: - // ctor takes the format we support, but it can also be set later with - // SetFormat() - wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid) - : m_format(format) - { - } - - // get/set the format we support - const wxDataFormat& GetFormat() const { return m_format; } - void SetFormat(const wxDataFormat& format) { m_format = format; } - - // virtual functions to override in derived class (the base class versions - // just return "not implemented") - // ----------------------------------------------------------------------- - - // get the size of our data - virtual size_t GetDataSize() const - { return 0; } - - // copy our data to the buffer - virtual bool GetDataHere(void *WXUNUSED(buf)) const - { return false; } - - // copy data from buffer to our data - virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf)) - { return false; } - - // implement base class pure virtuals - // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { return m_format; } - virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { return 1; } - virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { *formats = m_format; } - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - // the one and only format we support - wxDataFormat m_format; - - DECLARE_NO_COPY_CLASS(wxDataObjectSimple) -}; - -// ---------------------------------------------------------------------------- -// wxDataObjectComposite is the simplest way to implement wxDataObject -// supporting multiple formats. It contains several wxDataObjectSimple and -// supports all formats supported by any of them. -// -// This class shouldn't be (normally) derived from, but may be used directly. -// If you need more flexibility than what it provides, you should probably use -// wxDataObject directly. -// ---------------------------------------------------------------------------- - -WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); - -class WXDLLEXPORT wxDataObjectComposite : public wxDataObject -{ -public: - // ctor - wxDataObjectComposite(); - virtual ~wxDataObjectComposite(); - - // add data object (it will be deleted by wxDataObjectComposite, hence it - // must be allocated on the heap) whose format will become the preferred - // one if preferred == true - void Add(wxDataObjectSimple *dataObject, bool preferred = false); - - // Report the format passed to the SetData method. This should be the - // format of the data object within the composite that recieved data from - // the clipboard or the DnD operation. You can use this method to find - // out what kind of data object was recieved. - wxDataFormat GetReceivedFormat() const; - - // implement base class pure virtuals - // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const; - virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetDataSize(const wxDataFormat& format) const; - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; - virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf); -#if defined(__WXMSW__) - virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, - const wxDataFormat& format ); - virtual void* SetSizeInBuffer( void* buffer, size_t size, - const wxDataFormat& format ); - virtual size_t GetBufferOffset( const wxDataFormat& format ); -#endif - -protected: - // returns the pointer to the object which supports this format or NULL - wxDataObjectSimple *GetObject(const wxDataFormat& format) const; - -private: - // the list of all (simple) data objects whose formats we support - wxSimpleDataObjectList m_dataObjects; - - // the index of the preferred one (0 initially, so by default the first - // one is the preferred) - size_t m_preferred; - - wxDataFormat m_receivedFormat; - - DECLARE_NO_COPY_CLASS(wxDataObjectComposite) -}; - -// ============================================================================ -// Standard implementations of wxDataObjectSimple which can be used directly -// (i.e. without having to derive from them) for standard data type transfers. -// -// Note that although all of them can work with provided data, you can also -// override their virtual GetXXX() functions to only provide data on demand. -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxTextDataObject contains text data -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple -{ -public: - // ctor: you can specify the text here or in SetText(), or override - // GetText() - wxTextDataObject(const wxString& text = wxEmptyString) - : wxDataObjectSimple( -#if wxUSE_UNICODE - wxDF_UNICODETEXT -#else - wxDF_TEXT -#endif - ), - m_text(text) - { - } - - // virtual functions which you may override if you want to provide text on - // demand only - otherwise, the trivial default versions will be used - virtual size_t GetTextLength() const { return m_text.Len() + 1; } - virtual wxString GetText() const { return m_text; } - virtual void SetText(const wxString& text) { m_text = text; } - - // implement base class pure virtuals - // ---------------------------------- - - // some platforms have 2 and not 1 format for text data -#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__)) - virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } - virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; - - virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } - virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } - virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } - - size_t GetDataSize(const wxDataFormat& format) const; - bool GetDataHere(const wxDataFormat& format, void *pBuf) const; - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); -#else - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } -#endif - -private: - wxString m_text; - - DECLARE_NO_COPY_CLASS(wxTextDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject contains a bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple -{ -public: - // ctor: you can specify the bitmap here or in SetBitmap(), or override - // GetBitmap() - wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap) - : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap) - { - } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual wxBitmap GetBitmap() const { return m_bitmap; } - virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } - -protected: - wxBitmap m_bitmap; - - DECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase) -}; - -// ---------------------------------------------------------------------------- -// wxFileDataObject contains a list of filenames -// -// NB: notice that this is a "write only" object, it can only be filled with -// data from drag and drop operation. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple -{ -public: - // ctor: use AddFile() later to fill the array - wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { } - - // get a reference to our array - const wxArrayString& GetFilenames() const { return m_filenames; } - -protected: - wxArrayString m_filenames; - - DECLARE_NO_COPY_CLASS(wxFileDataObjectBase) -}; - -// ---------------------------------------------------------------------------- -// wxCustomDataObject contains arbitrary untyped user data. -// -// It is understood that this data can be copied bitwise. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple -{ -public: - // if you don't specify the format in the ctor, you can still use - // SetFormat() later - wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid); - - // the dtor calls Free() - virtual ~wxCustomDataObject(); - - // you can call SetData() to set m_data: it will make a copy of the data - // you pass - or you can use TakeData() which won't copy anything, but - // will take ownership of data (i.e. will call Free() on it later) - void TakeData(size_t size, void *data); - - // this function is called to allocate "size" bytes of memory from - // SetData(). The default version uses operator new[]. - virtual void *Alloc(size_t size); - - // this function is called when the data is freed, you may override it to - // anything you want (or may be nothing at all). The default version calls - // operator delete[] on m_data - virtual void Free(); - - // get data: you may override these functions if you wish to provide data - // only when it's requested - virtual size_t GetSize() const { return m_size; } - virtual void *GetData() const { return m_data; } - - // implement base class pure virtuals - // ---------------------------------- - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t size, const void *buf); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } - -private: - size_t m_size; - void *m_data; - - DECLARE_NO_COPY_CLASS(wxCustomDataObject) -}; - -// ---------------------------------------------------------------------------- -// include platform-specific declarations of wxXXXBase classes -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataobj2.h" - - // wxURLDataObject defined in msw/ole/dataobj2.h -#else // !__WXMSW__ - #if defined(__WXGTK20__) - #include "wx/gtk/dataobj2.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/dataobj2.h" - #elif defined(__WXX11__) - #include "wx/x11/dataobj2.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/dataobj2.h" - #elif defined(__WXMAC__) - #include "wx/mac/dataobj2.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj2.h" - #elif defined(__WXPM__) - #include "wx/os2/dataobj2.h" - #endif - - // wxURLDataObject is simply wxTextDataObject with a different name - class WXDLLEXPORT wxURLDataObject : public wxTextDataObject - { - public: - wxURLDataObject(const wxString& url = wxEmptyString) - : wxTextDataObject(url) - { - } - - wxString GetURL() const { return GetText(); } - void SetURL(const wxString& url) { SetText(url); } - }; -#endif // __WXMSW__/!__WXMSW__ - -#endif // wxUSE_DATAOBJ - -#endif // _WX_DATAOBJ_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/datetime.h b/Source/3rdParty/wx/include/wx/datetime.h deleted file mode 100644 index f527b9d42..000000000 --- a/Source/3rdParty/wx/include/wx/datetime.h +++ /dev/null @@ -1,2137 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/datetime.h -// Purpose: declarations of time/date related classes (wxDateTime, -// wxTimeSpan) -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.02.99 -// RCS-ID: $Id: datetime.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATETIME_H -#define _WX_DATETIME_H - -#include "wx/defs.h" - -#if wxUSE_DATETIME - -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/wince/time.h" -#endif - -#include // for INT_MIN - -#include "wx/longlong.h" - -class WXDLLIMPEXP_FWD_BASE wxDateTime; -class WXDLLIMPEXP_FWD_BASE wxTimeSpan; -class WXDLLIMPEXP_FWD_BASE wxDateSpan; - -#include "wx/dynarray.h" - -// not all c-runtimes are based on 1/1/1970 being (time_t) 0 -// set this to the corresponding value in seconds 1/1/1970 has on your -// systems c-runtime - -#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000 - #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) -#else - #define WX_TIME_BASE_OFFSET 0 -#endif -/* - * TODO - * - * + 1. Time zones with minutes (make TimeZone a class) - * ? 2. getdate() function like under Solaris - * + 3. text conversion for wxDateSpan - * + 4. pluggable modules for the workdays calculations - * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts - */ - -/* Two wrapper functions for thread safety */ -#ifdef HAVE_LOCALTIME_R -#define wxLocaltime_r localtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, localtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r -#endif -#endif - -#ifdef HAVE_GMTIME_R -#define wxGmtime_r gmtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, gmtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r -#endif -#endif - -/* - The three (main) classes declared in this header represent: - - 1. An absolute moment in the time (wxDateTime) - 2. A difference between two moments in the time, positive or negative - (wxTimeSpan) - 3. A logical difference between two dates expressed in - years/months/weeks/days (wxDateSpan) - - The following arithmetic operations are permitted (all others are not): - - addition - -------- - - wxDateTime + wxTimeSpan = wxDateTime - wxDateTime + wxDateSpan = wxDateTime - wxTimeSpan + wxTimeSpan = wxTimeSpan - wxDateSpan + wxDateSpan = wxDateSpan - - subtraction - ------------ - wxDateTime - wxDateTime = wxTimeSpan - wxDateTime - wxTimeSpan = wxDateTime - wxDateTime - wxDateSpan = wxDateTime - wxTimeSpan - wxTimeSpan = wxTimeSpan - wxDateSpan - wxDateSpan = wxDateSpan - - multiplication - -------------- - wxTimeSpan * number = wxTimeSpan - number * wxTimeSpan = wxTimeSpan - wxDateSpan * number = wxDateSpan - number * wxDateSpan = wxDateSpan - - unitary minus - ------------- - -wxTimeSpan = wxTimeSpan - -wxDateSpan = wxDateSpan - - For each binary operation OP (+, -, *) we have the following operatorOP=() as - a method and the method with a symbolic name OPER (Add, Subtract, Multiply) - as a synonym for it and another const method with the same name which returns - the changed copy of the object and operatorOP() as a global function which is - implemented in terms of the const version of OPEN. For the unary - we have - operator-() as a method, Neg() as synonym for it and Negate() which returns - the copy of the object with the changed sign. -*/ - -// an invalid/default date time object which may be used as the default -// argument for arguments of type wxDateTime; it is also returned by all -// functions returning wxDateTime on failure (this is why it is also called -// wxInvalidDateTime) -class WXDLLIMPEXP_FWD_BASE wxDateTime; - -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultDateTimeFormat; -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultTimeSpanFormat; -extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; - -#define wxInvalidDateTime wxDefaultDateTime - -// ---------------------------------------------------------------------------- -// wxDateTime represents an absolute moment in the time -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDateTime -{ -public: - // types - // ------------------------------------------------------------------------ - - // a small unsigned integer type for storing things like minutes, - // seconds &c. It should be at least short (i.e. not char) to contain - // the number of milliseconds - it may also be 'int' because there is - // no size penalty associated with it in our code, we don't store any - // data in this format - typedef unsigned short wxDateTime_t; - - // constants - // ------------------------------------------------------------------------ - - // the timezones - enum TZ - { - // the time in the current time zone - Local, - - // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be - // consequent numbers, so writing something like `GMT0 + offset' is - // safe if abs(offset) <= 12 - - // underscore stands for minus - GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7, - GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, - GMT0, - GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, - GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, - // Note that GMT12 and GMT_12 are not the same: there is a difference - // of exactly one day between them - - // some symbolic names for TZ - - // Europe - WET = GMT0, // Western Europe Time - WEST = GMT1, // Western Europe Summer Time - CET = GMT1, // Central Europe Time - CEST = GMT2, // Central Europe Summer Time - EET = GMT2, // Eastern Europe Time - EEST = GMT3, // Eastern Europe Summer Time - MSK = GMT3, // Moscow Time - MSD = GMT4, // Moscow Summer Time - - // US and Canada - AST = GMT_4, // Atlantic Standard Time - ADT = GMT_3, // Atlantic Daylight Time - EST = GMT_5, // Eastern Standard Time - EDT = GMT_4, // Eastern Daylight Saving Time - CST = GMT_6, // Central Standard Time - CDT = GMT_5, // Central Daylight Saving Time - MST = GMT_7, // Mountain Standard Time - MDT = GMT_6, // Mountain Daylight Saving Time - PST = GMT_8, // Pacific Standard Time - PDT = GMT_7, // Pacific Daylight Saving Time - HST = GMT_10, // Hawaiian Standard Time - AKST = GMT_9, // Alaska Standard Time - AKDT = GMT_8, // Alaska Daylight Saving Time - - // Australia - - A_WST = GMT8, // Western Standard Time - A_CST = GMT13 + 1, // Central Standard Time (+9.5) - A_EST = GMT10, // Eastern Standard Time - A_ESST = GMT11, // Eastern Summer Time - - // New Zealand - NZST = GMT12, // Standard Time - NZDT = GMT13, // Daylight Saving Time - - // TODO add more symbolic timezone names here - - // Universal Coordinated Time = the new and politically correct name - // for GMT - UTC = GMT0 - }; - - // the calendar systems we know about: notice that it's valid (for - // this classes purpose anyhow) to work with any of these calendars - // even with the dates before the historical appearance of the - // calendar - enum Calendar - { - Gregorian, // current calendar - Julian // calendar in use since -45 until the 1582 (or later) - - // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?) - }; - - // these values only are used to identify the different dates of - // adoption of the Gregorian calendar (see IsGregorian()) - // - // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)" - // by Claus Tndering, http://www.pip.dknet.dk/~c-t/calendar.html - // except for the comments "we take". - // - // Symbol "->" should be read as "was followed by" in the comments - // which follow. - enum GregorianAdoption - { - Gr_Unknown, // no data for this country or it's too uncertain to use - Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582 - - Gr_Alaska, // Oct 1867 when Alaska became part of the USA - Gr_Albania, // Dec 1912 - - Gr_Austria = Gr_Unknown, // Different regions on different dates - Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583 - Gr_Austria_Salzburg = Gr_Austria_Brixen, - Gr_Austria_Tyrol = Gr_Austria_Brixen, - Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583 - Gr_Austria_Styria = Gr_Austria_Carinthia, - - Gr_Belgium, // Then part of the Netherlands - - Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920) - Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916 - Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916 - Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920 - - Gr_Canada = Gr_Unknown, // Different regions followed the changes in - // Great Britain or France - - Gr_China = Gr_Unknown, // Different authorities say: - Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912 - Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929 - - Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584 - Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700 - Gr_Egypt, // 1875 - Gr_Estonia, // 1918 - Gr_Finland, // Then part of Sweden - - Gr_France, // 9 Dec 1582 -> 20 Dec 1582 - Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682 - Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760 - Gr_France_Strasbourg, // February 1682 - - Gr_Germany = Gr_Unknown, // Different states on different dates: - Gr_Germany_Catholic, // 1583-1585 (we take 1584) - Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610 - Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700 - - Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)') - - Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924 - Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587 - Gr_Ireland = Gr_GreatBritain, - Gr_Italy = Gr_Standard, - - Gr_Japan = Gr_Unknown, // Different authorities say: - Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873 - Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893 - Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919 - - Gr_Latvia, // 1915-1918 (we take 1915) - Gr_Lithuania, // 1915 - Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582 - Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583 - - // this is too weird to take into account: the Gregorian calendar was - // introduced twice in Groningen, first time 28 Feb 1583 was followed - // by 11 Mar 1583, then it has gone back to Julian in the summer of - // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is - // the date we take here - Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701 - Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700 - Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700 - Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701 - - Gr_Norway = Gr_Denmark, // Then part of Denmark - Gr_Poland = Gr_Standard, - Gr_Portugal = Gr_Standard, - Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919 - Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918 - Gr_Scotland = Gr_GreatBritain, - Gr_Spain = Gr_Standard, - - // Sweden has a curious history. Sweden decided to make a gradual - // change from the Julian to the Gregorian calendar. By dropping every - // leap year from 1700 through 1740 the eleven superfluous days would - // be omitted and from 1 Mar 1740 they would be in sync with the - // Gregorian calendar. (But in the meantime they would be in sync with - // nobody!) - // - // So 1700 (which should have been a leap year in the Julian calendar) - // was not a leap year in Sweden. However, by mistake 1704 and 1708 - // became leap years. This left Sweden out of synchronisation with - // both the Julian and the Gregorian world, so they decided to go back - // to the Julian calendar. In order to do this, they inserted an extra - // day in 1712, making that year a double leap year! So in 1712, - // February had 30 days in Sweden. - // - // Later, in 1753, Sweden changed to the Gregorian calendar by - // dropping 11 days like everyone else. - Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753 - - Gr_Switzerland = Gr_Unknown,// Different cantons used different dates - Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584) - Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701 - - Gr_Turkey, // 1 Jan 1927 - Gr_USA = Gr_GreatBritain, - Gr_Wales = Gr_GreatBritain, - Gr_Yugoslavia // 1919 - }; - - // the country parameter is used so far for calculating the start and - // the end of DST period and for deciding whether the date is a work - // day or not - // - // TODO move this to intl.h - -// Required for WinCE -#ifdef USA -#undef USA -#endif - - enum Country - { - Country_Unknown, // no special information for this country - Country_Default, // set the default country with SetCountry() method - // or use the default country with any other - - // TODO add more countries (for this we must know about DST and/or - // holidays for this country) - - // Western European countries: we assume that they all follow the same - // DST rules (true or false?) - Country_WesternEurope_Start, - Country_EEC = Country_WesternEurope_Start, - France, - Germany, - UK, - Country_WesternEurope_End = UK, - - Russia, - USA - }; - // symbolic names for the months - enum Month - { - Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month - }; - - // symbolic names for the weekdays - enum WeekDay - { - Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay - }; - - // invalid value for the year - enum Year - { - Inv_Year = SHRT_MIN // should hold in wxDateTime_t - }; - - // flags for GetWeekDayName and GetMonthName - enum NameFlags - { - Name_Full = 0x01, // return full name - Name_Abbr = 0x02 // return abbreviated name - }; - - // flags for GetWeekOfYear and GetWeekOfMonth - enum WeekFlags - { - Default_First, // Sunday_First for US, Monday_First for the rest - Monday_First, // week starts with a Monday - Sunday_First // week starts with a Sunday - }; - - // helper classes - // ------------------------------------------------------------------------ - - // a class representing a time zone: basicly, this is just an offset - // (in seconds) from GMT - class WXDLLIMPEXP_BASE TimeZone - { - public: - TimeZone(TZ tz); - - // don't use this ctor, it doesn't work for negative offsets (but can't - // be removed or changed to avoid breaking ABI in 2.8) - TimeZone(wxDateTime_t offset = 0) { m_offset = offset; } - -#if wxABI_VERSION >= 20808 - // create time zone object with the given offset - static TimeZone Make(long offset) - { - TimeZone tz; - tz.m_offset = offset; - return tz; - } -#endif // wxABI 2.8.8+ - - long GetOffset() const { return m_offset; } - - private: - // offset for this timezone from GMT in seconds - long m_offset; - }; - - // standard struct tm is limited to the years from 1900 (because - // tm_year field is the offset from 1900), so we use our own struct - // instead to represent broken down time - // - // NB: this struct should always be kept normalized (i.e. mon should - // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() - // instead of modifying the member fields directly! - struct WXDLLIMPEXP_BASE Tm - { - wxDateTime_t msec, sec, min, hour, mday; - Month mon; - int year; - - // default ctor inits the object to an invalid value - Tm(); - - // ctor from struct tm and the timezone - Tm(const struct tm& tm, const TimeZone& tz); - - // check that the given date/time is valid (in Gregorian calendar) - bool IsValid() const; - - // get the week day - WeekDay GetWeekDay() // not const because wday may be changed - { - if ( wday == Inv_WeekDay ) - ComputeWeekDay(); - - return (WeekDay)wday; - } - - // add the given number of months to the date keeping it normalized - void AddMonths(int monDiff); - - // add the given number of months to the date keeping it normalized - void AddDays(int dayDiff); - - private: - // compute the weekday from other fields - void ComputeWeekDay(); - - // the timezone we correspond to - TimeZone m_tz; - - // these values can't be accessed directly because they're not always - // computed and we calculate them on demand - wxDateTime_t wday, yday; - }; - - // static methods - // ------------------------------------------------------------------------ - - // set the current country - static void SetCountry(Country country); - // get the current country - static Country GetCountry(); - - // return true if the country is a West European one (in practice, - // this means that the same DST rules as for EEC apply) - static bool IsWestEuropeanCountry(Country country = Country_Default); - - // return the current year - static int GetCurrentYear(Calendar cal = Gregorian); - - // convert the year as returned by wxDateTime::GetYear() to a year - // suitable for BC/AD notation. The difference is that BC year 1 - // corresponds to the year 0 (while BC year 0 didn't exist) and AD - // year N is just year N. - static int ConvertYearToBC(int year); - - // return the current month - static Month GetCurrentMonth(Calendar cal = Gregorian); - - // returns true if the given year is a leap year in the given calendar - static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); - - // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) - static int GetCentury(int year); - - // returns the number of days in this year (356 or 355 for Gregorian - // calendar usually :-) - static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian); - - // get the number of the days in the given month (default value for - // the year means the current one) - static wxDateTime_t GetNumberOfDays(Month month, - int year = Inv_Year, - Calendar cal = Gregorian); - - // get the full (default) or abbreviated month name in the current - // locale, returns empty string on error - static wxString GetMonthName(Month month, - NameFlags flags = Name_Full); - - // get the full (default) or abbreviated weekday name in the current - // locale, returns empty string on error - static wxString GetWeekDayName(WeekDay weekday, - NameFlags flags = Name_Full); - - // get the AM and PM strings in the current locale (may be empty) - static void GetAmPmStrings(wxString *am, wxString *pm); - - // return true if the given country uses DST for this year - static bool IsDSTApplicable(int year = Inv_Year, - Country country = Country_Default); - - // get the beginning of DST for this year, will return invalid object - // if no DST applicable in this year. The default value of the - // parameter means to take the current year. - static wxDateTime GetBeginDST(int year = Inv_Year, - Country country = Country_Default); - // get the end of DST for this year, will return invalid object - // if no DST applicable in this year. The default value of the - // parameter means to take the current year. - static wxDateTime GetEndDST(int year = Inv_Year, - Country country = Country_Default); - - // return the wxDateTime object for the current time - static inline wxDateTime Now(); - - // return the wxDateTime object for the current time with millisecond - // precision (if available on this platform) - static wxDateTime UNow(); - - // return the wxDateTime object for today midnight: i.e. as Now() but - // with time set to 0 - static inline wxDateTime Today(); - - // constructors: you should test whether the constructor succeeded with - // IsValid() function. The values Inv_Month and Inv_Year for the - // parameters mean take current month and/or year values. - // ------------------------------------------------------------------------ - - // default ctor does not initialize the object, use Set()! - wxDateTime() { m_time = wxLongLong((wxInt32)UINT_MAX, UINT_MAX); } - - // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration - inline wxDateTime(time_t timet); -#endif - // from broken down time/date (only for standard Unix range) - inline wxDateTime(const struct tm& tm); - // from broken down time/date (any range) - inline wxDateTime(const Tm& tm); - - // from JDN (beware of rounding errors) - inline wxDateTime(double jdn); - - // from separate values for each component, date set to today - inline wxDateTime(wxDateTime_t hour, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - // from separate values for each component with explicit date - inline wxDateTime(wxDateTime_t day, // day of the month - Month month, - int year = Inv_Year, // 1999, not 99 please! - wxDateTime_t hour = 0, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // default copy ctor ok - - // no dtor - - // assignment operators and Set() functions: all non const methods return - // the reference to this object. IsValid() should be used to test whether - // the function succeeded. - // ------------------------------------------------------------------------ - - // set to the current time - inline wxDateTime& SetToCurrent(); - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration - // set to given time_t value - inline wxDateTime& Set(time_t timet); -#endif - - // set to given broken down time/date - wxDateTime& Set(const struct tm& tm); - - // set to given broken down time/date - inline wxDateTime& Set(const Tm& tm); - - // set to given JDN (beware of rounding errors) - wxDateTime& Set(double jdn); - - // set to given time, date = today - wxDateTime& Set(wxDateTime_t hour, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // from separate values for each component with explicit date - // (defaults for month and year are the current values) - wxDateTime& Set(wxDateTime_t day, - Month month, - int year = Inv_Year, // 1999, not 99 please! - wxDateTime_t hour = 0, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // resets time to 00:00:00, doesn't change the date - wxDateTime& ResetTime(); - -#if wxABI_VERSION >= 20802 - // get the date part of this object only, i.e. the object which has the - // same date as this one but time of 00:00:00 - wxDateTime GetDateOnly() const; -#endif // wxABI 2.8.1+ - - // the following functions don't change the values of the other - // fields, i.e. SetMinute() won't change either hour or seconds value - - // set the year - wxDateTime& SetYear(int year); - // set the month - wxDateTime& SetMonth(Month month); - // set the day of the month - wxDateTime& SetDay(wxDateTime_t day); - // set hour - wxDateTime& SetHour(wxDateTime_t hour); - // set minute - wxDateTime& SetMinute(wxDateTime_t minute); - // set second - wxDateTime& SetSecond(wxDateTime_t second); - // set millisecond - wxDateTime& SetMillisecond(wxDateTime_t millisecond); - - // assignment operator from time_t - wxDateTime& operator=(time_t timet) { return Set(timet); } - - // assignment operator from broken down time/date - wxDateTime& operator=(const struct tm& tm) { return Set(tm); } - - // assignment operator from broken down time/date - wxDateTime& operator=(const Tm& tm) { return Set(tm); } - - // default assignment operator is ok - - // calendar calculations (functions which set the date only leave the time - // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the - // object itself, GetXXX() ones return a new object. - // ------------------------------------------------------------------------ - - // set to the given week day in the same week as this one - wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, - WeekFlags flags = Monday_First); - inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, - WeekFlags flags = Monday_First) const; - - // set to the next week day following this one - wxDateTime& SetToNextWeekDay(WeekDay weekday); - inline wxDateTime GetNextWeekDay(WeekDay weekday) const; - - // set to the previous week day before this one - wxDateTime& SetToPrevWeekDay(WeekDay weekday); - inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; - - // set to Nth occurence of given weekday in the given month of the - // given year (time is set to 0), return true on success and false on - // failure. n may be positive (1..5) or negative to count from the end - // of the month (see helper function SetToLastWeekDay()) - bool SetToWeekDay(WeekDay weekday, - int n = 1, - Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetWeekDay(WeekDay weekday, - int n = 1, - Month month = Inv_Month, - int year = Inv_Year) const; - - // sets to the last weekday in the given month, year - inline bool SetToLastWeekDay(WeekDay weekday, - Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetLastWeekDay(WeekDay weekday, - Month month = Inv_Month, - int year = Inv_Year); - -#if WXWIN_COMPATIBILITY_2_6 - // sets the date to the given day of the given week in the year, - // returns true on success and false if given date doesn't exist (e.g. - // numWeek is > 53) - // - // these functions are badly defined as they're not the reverse of - // GetWeekOfYear(), use SetToTheWeekOfYear() instead - wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) ); - wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // returns the date corresponding to the given week day of the given - // week (in ISO notation) of the specified year - static wxDateTime SetToWeekOfYear(int year, - wxDateTime_t numWeek, - WeekDay weekday = Mon); - - // sets the date to the last day of the given (or current) month or the - // given (or current) year - wxDateTime& SetToLastMonthDay(Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetLastMonthDay(Month month = Inv_Month, - int year = Inv_Year) const; - - // sets to the given year day (1..365 or 366) - wxDateTime& SetToYearDay(wxDateTime_t yday); - inline wxDateTime GetYearDay(wxDateTime_t yday) const; - - // The definitions below were taken verbatim from - // - // http://www.capecod.net/~pbaum/date/date0.htm - // - // (Peter Baum's home page) - // - // definition: The Julian Day Number, Julian Day, or JD of a - // particular instant of time is the number of days and fractions of a - // day since 12 hours Universal Time (Greenwich mean noon) on January - // 1 of the year -4712, where the year is given in the Julian - // proleptic calendar. The idea of using this reference date was - // originally proposed by Joseph Scalizer in 1582 to count years but - // it was modified by 19th century astronomers to count days. One - // could have equivalently defined the reference time to be noon of - // November 24, -4713 if were understood that Gregorian calendar rules - // were applied. Julian days are Julian Day Numbers and are not to be - // confused with Julian dates. - // - // definition: The Rata Die number is a date specified as the number - // of days relative to a base date of December 31 of the year 0. Thus - // January 1 of the year 1 is Rata Die day 1. - - // get the Julian Day number (the fractional part specifies the time of - // the day, related to noon - beware of rounding errors!) - double GetJulianDayNumber() const; - double GetJDN() const { return GetJulianDayNumber(); } - - // get the Modified Julian Day number: it is equal to JDN - 2400000.5 - // and so integral MJDs correspond to the midnights (and not noons). - // MJD 0 is Nov 17, 1858 - double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; } - double GetMJD() const { return GetModifiedJulianDayNumber(); } - - // get the Rata Die number - double GetRataDie() const; - - // TODO algorithms for calculating some important dates, such as - // religious holidays (Easter...) or moon/solar eclipses? Some - // algorithms can be found in the calendar FAQ - - - // Timezone stuff: a wxDateTime object constructed using given - // day/month/year/hour/min/sec values is interpreted as this moment in - // local time. Using the functions below, it may be converted to another - // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()). - // - // These functions try to handle DST internally, but there is no magical - // way to know all rules for it in all countries in the world, so if the - // program can handle it itself (or doesn't want to handle it at all for - // whatever reason), the DST handling can be disabled with noDST. - // ------------------------------------------------------------------------ - - // transform to any given timezone - inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const; - wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false); - - // interpret current value as being in another timezone and transform - // it to local one - inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const; - wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false); - - // transform to/from GMT/UTC - wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); } - wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); } - - wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); } - wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); } - - wxDateTime FromUTC(bool noDST = false) const - { return FromTimezone(UTC, noDST); } - wxDateTime& MakeFromUTC(bool noDST = false) - { return MakeFromTimezone(UTC, noDST); } - - // is daylight savings time in effect at this moment according to the - // rules of the specified country? - // - // Return value is > 0 if DST is in effect, 0 if it is not and -1 if - // the information is not available (this is compatible with ANSI C) - int IsDST(Country country = Country_Default) const; - - - // accessors: many of them take the timezone parameter which indicates the - // timezone for which to make the calculations and the default value means - // to do it for the current timezone of this machine (even if the function - // only operates with the date it's necessary because a date may wrap as - // result of timezone shift) - // ------------------------------------------------------------------------ - - // is the date valid? - inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; } - - // get the broken down date/time representation in the given timezone - // - // If you wish to get several time components (day, month and year), - // consider getting the whole Tm strcuture first and retrieving the - // value from it - this is much more efficient - Tm GetTm(const TimeZone& tz = Local) const; - - // get the number of seconds since the Unix epoch - returns (time_t)-1 - // if the value is out of range - inline time_t GetTicks() const; - - // get the century, same as GetCentury(GetYear()) - int GetCentury(const TimeZone& tz = Local) const - { return GetCentury(GetYear(tz)); } - // get the year (returns Inv_Year if date is invalid) - int GetYear(const TimeZone& tz = Local) const - { return GetTm(tz).year; } - // get the month (Inv_Month if date is invalid) - Month GetMonth(const TimeZone& tz = Local) const - { return (Month)GetTm(tz).mon; } - // get the month day (in 1..31 range, 0 if date is invalid) - wxDateTime_t GetDay(const TimeZone& tz = Local) const - { return GetTm(tz).mday; } - // get the day of the week (Inv_WeekDay if date is invalid) - WeekDay GetWeekDay(const TimeZone& tz = Local) const - { return GetTm(tz).GetWeekDay(); } - // get the hour of the day - wxDateTime_t GetHour(const TimeZone& tz = Local) const - { return GetTm(tz).hour; } - // get the minute - wxDateTime_t GetMinute(const TimeZone& tz = Local) const - { return GetTm(tz).min; } - // get the second - wxDateTime_t GetSecond(const TimeZone& tz = Local) const - { return GetTm(tz).sec; } - // get milliseconds - wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const - { return GetTm(tz).msec; } - - // get the day since the year start (1..366, 0 if date is invalid) - wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const; - // get the week number since the year start (1..52 or 53, 0 if date is - // invalid) - wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, - const TimeZone& tz = Local) const; - // get the week number since the month start (1..5, 0 if date is - // invalid) - wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, - const TimeZone& tz = Local) const; - - // is this date a work day? This depends on a country, of course, - // because the holidays are different in different countries - bool IsWorkDay(Country country = Country_Default) const; - - // is this date later than Gregorian calendar introduction for the - // given country (see enum GregorianAdoption)? - // - // NB: this function shouldn't be considered as absolute authority in - // the matter. Besides, for some countries the exact date of - // adoption of the Gregorian calendar is simply unknown. - bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const; - - // dos date and time format - // ------------------------------------------------------------------------ - - // set from the DOS packed format - wxDateTime& SetFromDOS(unsigned long ddt); - - // pack the date in DOS format - unsigned long GetAsDOS() const; - - // comparison (see also functions below for operator versions) - // ------------------------------------------------------------------------ - - // returns true if the two moments are strictly identical - inline bool IsEqualTo(const wxDateTime& datetime) const; - - // returns true if the date is strictly earlier than the given one - inline bool IsEarlierThan(const wxDateTime& datetime) const; - - // returns true if the date is strictly later than the given one - inline bool IsLaterThan(const wxDateTime& datetime) const; - - // returns true if the date is strictly in the given range - inline bool IsStrictlyBetween(const wxDateTime& t1, - const wxDateTime& t2) const; - - // returns true if the date is in the given range - inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const; - - // do these two objects refer to the same date? - inline bool IsSameDate(const wxDateTime& dt) const; - - // do these two objects have the same time? - inline bool IsSameTime(const wxDateTime& dt) const; - - // are these two objects equal up to given timespan? - inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const; - - inline bool operator<(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() < dt.GetValue(); - } - - inline bool operator<=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() <= dt.GetValue(); - } - - inline bool operator>(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() > dt.GetValue(); - } - - inline bool operator>=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() >= dt.GetValue(); - } - - inline bool operator==(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() == dt.GetValue(); - } - - inline bool operator!=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") ); - return GetValue() != dt.GetValue(); - } - - // arithmetics with dates (see also below for more operators) - // ------------------------------------------------------------------------ - - // return the sum of the date with a time span (positive or negative) - inline wxDateTime Add(const wxTimeSpan& diff) const; - // add a time span (positive or negative) - inline wxDateTime& Add(const wxTimeSpan& diff); - // add a time span (positive or negative) - inline wxDateTime& operator+=(const wxTimeSpan& diff); - inline wxDateTime operator+(const wxTimeSpan& ts) const - { - wxDateTime dt(*this); - dt.Add(ts); - return dt; - } - - // return the difference of the date with a time span - inline wxDateTime Subtract(const wxTimeSpan& diff) const; - // subtract a time span (positive or negative) - inline wxDateTime& Subtract(const wxTimeSpan& diff); - // subtract a time span (positive or negative) - inline wxDateTime& operator-=(const wxTimeSpan& diff); - inline wxDateTime operator-(const wxTimeSpan& ts) const - { - wxDateTime dt(*this); - dt.Subtract(ts); - return dt; - } - - // return the sum of the date with a date span - inline wxDateTime Add(const wxDateSpan& diff) const; - // add a date span (positive or negative) - wxDateTime& Add(const wxDateSpan& diff); - // add a date span (positive or negative) - inline wxDateTime& operator+=(const wxDateSpan& diff); - inline wxDateTime operator+(const wxDateSpan& ds) const - { - wxDateTime dt(*this); - dt.Add(ds); - return dt; - } - - // return the difference of the date with a date span - inline wxDateTime Subtract(const wxDateSpan& diff) const; - // subtract a date span (positive or negative) - inline wxDateTime& Subtract(const wxDateSpan& diff); - // subtract a date span (positive or negative) - inline wxDateTime& operator-=(const wxDateSpan& diff); - inline wxDateTime operator-(const wxDateSpan& ds) const - { - wxDateTime dt(*this); - dt.Subtract(ds); - return dt; - } - - // return the difference between two dates - inline wxTimeSpan Subtract(const wxDateTime& dt) const; - inline wxTimeSpan operator-(const wxDateTime& dt2) const; - - // conversion to/from text: all conversions from text return the pointer to - // the next character following the date specification (i.e. the one where - // the scan had to stop) or NULL on failure. - // ------------------------------------------------------------------------ - - // parse a string in RFC 822 format (found e.g. in mail headers and - // having the form "Wed, 10 Feb 1999 19:07:07 +0100") - const wxChar *ParseRfc822Date(const wxChar* date); - // parse a date/time in the given format (see strptime(3)), fill in - // the missing (in the string) fields with the values of dateDef (by - // default, they will not change if they had valid values or will - // default to Today() otherwise) - const wxChar *ParseFormat(const wxChar *date, - const wxChar *format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime); - // parse a string containing the date/time in "free" format, this - // function will try to make an educated guess at the string contents - const wxChar *ParseDateTime(const wxChar *datetime); - // parse a string containing the date only in "free" format (less - // flexible than ParseDateTime) - const wxChar *ParseDate(const wxChar *date); - // parse a string containing the time only in "free" format - const wxChar *ParseTime(const wxChar *time); - - // this function accepts strftime()-like format string (default - // argument corresponds to the preferred date and time representation - // for the current locale) and returns the string containing the - // resulting text representation - wxString Format(const wxChar *format = wxDefaultDateTimeFormat, - const TimeZone& tz = Local) const; - // preferred date representation for the current locale - wxString FormatDate() const { return Format(wxT("%x")); } - // preferred time representation for the current locale - wxString FormatTime() const { return Format(wxT("%X")); } - // returns the string representing the date in ISO 8601 format - // (YYYY-MM-DD) - wxString FormatISODate() const { return Format(wxT("%Y-%m-%d")); } - // returns the string representing the time in ISO 8601 format - // (HH:MM:SS) - wxString FormatISOTime() const { return Format(wxT("%H:%M:%S")); } - - // implementation - // ------------------------------------------------------------------------ - - // construct from internal representation - wxDateTime(const wxLongLong& time) { m_time = time; } - - // get the internal representation - inline wxLongLong GetValue() const; - - // a helper function to get the current time_t - static time_t GetTimeNow() { return time((time_t *)NULL); } - - // another one to get the current time broken down - static struct tm *GetTmNow() - { - static struct tm l_CurrentTime; - return GetTmNow(&l_CurrentTime); - } - - // get current time using thread-safe function - static struct tm *GetTmNow(struct tm *tmstruct); - -private: - // the current country - as it's the same for all program objects (unless - // it runs on a _really_ big cluster system :-), this is a static member: - // see SetCountry() and GetCountry() - static Country ms_country; - - // this constant is used to transform a time_t value to the internal - // representation, as time_t is in seconds and we use milliseconds it's - // fixed to 1000 - static const long TIME_T_FACTOR; - - // returns true if we fall in range in which we can use standard ANSI C - // functions - inline bool IsInStdRange() const; - - // the internal representation of the time is the amount of milliseconds - // elapsed since the origin which is set by convention to the UNIX/C epoch - // value: the midnight of January 1, 1970 (UTC) - wxLongLong m_time; -}; - -// ---------------------------------------------------------------------------- -// This class contains a difference between 2 wxDateTime values, so it makes -// sense to add it to wxDateTime and it is the result of subtraction of 2 -// objects of that class. See also wxDateSpan. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTimeSpan -{ -public: - // constructors - // ------------------------------------------------------------------------ - - // return the timespan for the given number of milliseconds - static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } - static wxTimeSpan Millisecond() { return Milliseconds(1); } - - // return the timespan for the given number of seconds - static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } - static wxTimeSpan Second() { return Seconds(1); } - - // return the timespan for the given number of minutes - static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); } - static wxTimeSpan Minute() { return Minutes(1); } - - // return the timespan for the given number of hours - static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); } - static wxTimeSpan Hour() { return Hours(1); } - - // return the timespan for the given number of days - static wxTimeSpan Days(long days) { return Hours(24 * days); } - static wxTimeSpan Day() { return Days(1); } - - // return the timespan for the given number of weeks - static wxTimeSpan Weeks(long days) { return Days(7 * days); } - static wxTimeSpan Week() { return Weeks(1); } - - // default ctor constructs the 0 time span - wxTimeSpan() { } - - // from separate values for each component, date set to 0 (hours are - // not restricted to 0..24 range, neither are minutes, seconds or - // milliseconds) - inline wxTimeSpan(long hours, - long minutes = 0, - wxLongLong seconds = 0, - wxLongLong milliseconds = 0); - - // default copy ctor is ok - - // no dtor - - // arithmetics with time spans (see also below for more operators) - // ------------------------------------------------------------------------ - - // return the sum of two timespans - inline wxTimeSpan Add(const wxTimeSpan& diff) const; - // add two timespans together - inline wxTimeSpan& Add(const wxTimeSpan& diff); - // add two timespans together - wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } - inline wxTimeSpan operator+(const wxTimeSpan& ts) const - { - return wxTimeSpan(GetValue() + ts.GetValue()); - } - - // return the difference of two timespans - inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; - // subtract another timespan - inline wxTimeSpan& Subtract(const wxTimeSpan& diff); - // subtract another timespan - wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } - inline wxTimeSpan operator-(const wxTimeSpan& ts) - { - return wxTimeSpan(GetValue() - ts.GetValue()); - } - - // multiply timespan by a scalar - inline wxTimeSpan Multiply(int n) const; - // multiply timespan by a scalar - inline wxTimeSpan& Multiply(int n); - // multiply timespan by a scalar - wxTimeSpan& operator*=(int n) { return Multiply(n); } - inline wxTimeSpan operator*(int n) const - { - return wxTimeSpan(*this).Multiply(n); - } - - // return this timespan with opposite sign - wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); } - // negate the value of the timespan - wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; } - // negate the value of the timespan - wxTimeSpan& operator-() { return Neg(); } - - // return the absolute value of the timespan: does _not_ modify the - // object - inline wxTimeSpan Abs() const; - - // there is intentionally no division because we don't want to - // introduce rounding errors in time calculations - - // comparaison (see also operator versions below) - // ------------------------------------------------------------------------ - - // is the timespan null? - bool IsNull() const { return m_diff == 0l; } - // returns true if the timespan is null - bool operator!() const { return !IsNull(); } - - // is the timespan positive? - bool IsPositive() const { return m_diff > 0l; } - - // is the timespan negative? - bool IsNegative() const { return m_diff < 0l; } - - // are two timespans equal? - inline bool IsEqualTo(const wxTimeSpan& ts) const; - // compare two timestamps: works with the absolute values, i.e. -2 - // hours is longer than 1 hour. Also, it will return false if the - // timespans are equal in absolute value. - inline bool IsLongerThan(const wxTimeSpan& ts) const; - // compare two timestamps: works with the absolute values, i.e. 1 - // hour is shorter than -2 hours. Also, it will return false if the - // timespans are equal in absolute value. - bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); } - - inline bool operator<(const wxTimeSpan &ts) const - { - return GetValue() < ts.GetValue(); - } - - inline bool operator<=(const wxTimeSpan &ts) const - { - return GetValue() <= ts.GetValue(); - } - - inline bool operator>(const wxTimeSpan &ts) const - { - return GetValue() > ts.GetValue(); - } - - inline bool operator>=(const wxTimeSpan &ts) const - { - return GetValue() >= ts.GetValue(); - } - - inline bool operator==(const wxTimeSpan &ts) const - { - return GetValue() == ts.GetValue(); - } - - inline bool operator!=(const wxTimeSpan &ts) const - { - return GetValue() != ts.GetValue(); - } - - // breaking into days, hours, minutes and seconds - // ------------------------------------------------------------------------ - - // get the max number of weeks in this timespan - inline int GetWeeks() const; - // get the max number of days in this timespan - inline int GetDays() const; - // get the max number of hours in this timespan - inline int GetHours() const; - // get the max number of minutes in this timespan - inline int GetMinutes() const; - // get the max number of seconds in this timespan - inline wxLongLong GetSeconds() const; - // get the number of milliseconds in this timespan - wxLongLong GetMilliseconds() const { return m_diff; } - - // conversion to text - // ------------------------------------------------------------------------ - - // this function accepts strftime()-like format string (default - // argument corresponds to the preferred date and time representation - // for the current locale) and returns the string containing the - // resulting text representation. Notice that only some of format - // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, - // minutes and seconds make sense, but not "PM/AM" string for example. - wxString Format(const wxChar *format = wxDefaultTimeSpanFormat) const; - - // implementation - // ------------------------------------------------------------------------ - - // construct from internal representation - wxTimeSpan(const wxLongLong& diff) { m_diff = diff; } - - // get the internal representation - wxLongLong GetValue() const { return m_diff; } - -private: - // the (signed) time span in milliseconds - wxLongLong m_diff; -}; - -// ---------------------------------------------------------------------------- -// This class is a "logical time span" and is useful for implementing program -// logic for such things as "add one month to the date" which, in general, -// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date -// the next month (to understand that this is indeed different consider adding -// one month to Feb, 15 - we want to get Mar, 15, of course). -// -// When adding a month to the date, all lesser components (days, hours, ...) -// won't be changed unless the resulting date would be invalid: for example, -// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. -// -// Because of this feature, adding and subtracting back again the same -// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 -// month will be Jan 28, not Jan 31! -// -// wxDateSpan can be either positive or negative. They may be -// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1 -// month and 1 day) is 2 months and 2 days. They can be added together and -// with wxDateTime or wxTimeSpan, but the type of result is different for each -// case. -// -// Beware about weeks: if you specify both weeks and days, the total number of -// days added will be 7*weeks + days! See also GetTotalDays() function. -// -// Equality operators are defined for wxDateSpans. Two datespans are equal if -// they both give the same target date when added to *every* source date. -// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because -// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is -// equal to wxDateSpan::Weeks(2) -// -// Finally, notice that for adding hours, minutes &c you don't need this -// class: wxTimeSpan will do the job because there are no subtleties -// associated with those. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDateSpan -{ -public: - // constructors - // ------------------------------------------------------------------------ - - // this many years/months/weeks/days - wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0) - { - m_years = years; - m_months = months; - m_weeks = weeks; - m_days = days; - } - - // get an object for the given number of days - static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); } - static wxDateSpan Day() { return Days(1); } - - // get an object for the given number of weeks - static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); } - static wxDateSpan Week() { return Weeks(1); } - - // get an object for the given number of months - static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); } - static wxDateSpan Month() { return Months(1); } - - // get an object for the given number of years - static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); } - static wxDateSpan Year() { return Years(1); } - - // default copy ctor is ok - - // no dtor - - // accessors (all SetXXX() return the (modified) wxDateSpan object) - // ------------------------------------------------------------------------ - - // set number of years - wxDateSpan& SetYears(int n) { m_years = n; return *this; } - // set number of months - wxDateSpan& SetMonths(int n) { m_months = n; return *this; } - // set number of weeks - wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; } - // set number of days - wxDateSpan& SetDays(int n) { m_days = n; return *this; } - - // get number of years - int GetYears() const { return m_years; } - // get number of months - int GetMonths() const { return m_months; } - // get number of weeks - int GetWeeks() const { return m_weeks; } - // get number of days - int GetDays() const { return m_days; } - // returns 7*GetWeeks() + GetDays() - int GetTotalDays() const { return 7*m_weeks + m_days; } - - // arithmetics with date spans (see also below for more operators) - // ------------------------------------------------------------------------ - - // return sum of two date spans - inline wxDateSpan Add(const wxDateSpan& other) const; - // add another wxDateSpan to us - inline wxDateSpan& Add(const wxDateSpan& other); - // add another wxDateSpan to us - inline wxDateSpan& operator+=(const wxDateSpan& other); - inline wxDateSpan operator+(const wxDateSpan& ds) const - { - return wxDateSpan(GetYears() + ds.GetYears(), - GetMonths() + ds.GetMonths(), - GetWeeks() + ds.GetWeeks(), - GetDays() + ds.GetDays()); - } - - // return difference of two date spans - inline wxDateSpan Subtract(const wxDateSpan& other) const; - // subtract another wxDateSpan from us - inline wxDateSpan& Subtract(const wxDateSpan& other); - // subtract another wxDateSpan from us - inline wxDateSpan& operator-=(const wxDateSpan& other); - inline wxDateSpan operator-(const wxDateSpan& ds) const - { - return wxDateSpan(GetYears() - ds.GetYears(), - GetMonths() - ds.GetMonths(), - GetWeeks() - ds.GetWeeks(), - GetDays() - ds.GetDays()); - } - - // return a copy of this time span with changed sign - inline wxDateSpan Negate() const; - // inverse the sign of this timespan - inline wxDateSpan& Neg(); - // inverse the sign of this timespan - wxDateSpan& operator-() { return Neg(); } - - // return the date span proportional to this one with given factor - inline wxDateSpan Multiply(int factor) const; - // multiply all components by a (signed) number - inline wxDateSpan& Multiply(int factor); - // multiply all components by a (signed) number - inline wxDateSpan& operator*=(int factor) { return Multiply(factor); } - inline wxDateSpan operator*(int n) const - { - return wxDateSpan(*this).Multiply(n); - } - - // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 - inline bool operator==(const wxDateSpan& ds) const - { - return GetYears() == ds.GetYears() && - GetMonths() == ds.GetMonths() && - GetTotalDays() == ds.GetTotalDays(); - } - - inline bool operator!=(const wxDateSpan& ds) const - { - return !(*this == ds); - } - -private: - int m_years, - m_months, - m_weeks, - m_days; -}; - -// ---------------------------------------------------------------------------- -// wxDateTimeArray: array of dates. -// ---------------------------------------------------------------------------- - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxDateTimeHolidayAuthority: an object of this class will decide whether a -// given date is a holiday and is used by all functions working with "work -// days". -// -// NB: the base class is an ABC, derived classes must implement the pure -// virtual methods to work with the holidays they correspond to. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority; -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *, - wxHolidayAuthoritiesArray, - class WXDLLIMPEXP_BASE); - -class wxDateTimeHolidaysModule; -class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority -{ -friend class wxDateTimeHolidaysModule; -public: - // returns true if the given date is a holiday - static bool IsHoliday(const wxDateTime& dt); - - // fills the provided array with all holidays in the given range, returns - // the number of them - static size_t GetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays); - - // clear the list of holiday authorities - static void ClearAllAuthorities(); - - // add a new holiday authority (the pointer will be deleted by - // wxDateTimeHolidayAuthority) - static void AddAuthority(wxDateTimeHolidayAuthority *auth); - - // the base class must have a virtual dtor - virtual ~wxDateTimeHolidayAuthority(); - -protected: - // this function is called to determine whether a given day is a holiday - virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; - - // this function should fill the array with all holidays between the two - // given dates - it is implemented in the base class, but in a very - // inefficient way (it just iterates over all days and uses IsHoliday() for - // each of them), so it must be overridden in the derived class where the - // base class version may be explicitly used if needed - // - // returns the number of holidays in the given range and fills holidays - // array - virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const = 0; - -private: - // all holiday authorities - static wxHolidayAuthoritiesArray ms_authorities; -}; - -// the holidays for this class are all Saturdays and Sundays -class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority -{ -protected: - virtual bool DoIsHoliday(const wxDateTime& dt) const; - virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const; -}; - -// ============================================================================ -// inline functions implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// private macros -// ---------------------------------------------------------------------------- - -#define MILLISECONDS_PER_DAY 86400000l - -// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but -// using a temp variable always might prevent other compilers from optimising -// it away - hence use of this ugly macro -#ifndef __HPUX__ - #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op -#else - #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt -#endif - -// ---------------------------------------------------------------------------- -// wxDateTime construction -// ---------------------------------------------------------------------------- - -inline bool wxDateTime::IsInStdRange() const -{ - return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; -} - -/* static */ -inline wxDateTime wxDateTime::Now() -{ - struct tm tmstruct; - return wxDateTime(*GetTmNow(&tmstruct)); -} - -/* static */ -inline wxDateTime wxDateTime::Today() -{ - wxDateTime dt(Now()); - dt.ResetTime(); - - return dt; -} - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -inline wxDateTime& wxDateTime::Set(time_t timet) -{ - // assign first to avoid long multiplication overflow! - m_time = timet - WX_TIME_BASE_OFFSET ; - m_time *= TIME_T_FACTOR; - - return *this; -} -#endif - -inline wxDateTime& wxDateTime::SetToCurrent() -{ - *this = Now(); - return *this; -} - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -inline wxDateTime::wxDateTime(time_t timet) -{ - Set(timet); -} -#endif - -inline wxDateTime::wxDateTime(const struct tm& tm) -{ - Set(tm); -} - -inline wxDateTime::wxDateTime(const Tm& tm) -{ - Set(tm); -} - -inline wxDateTime::wxDateTime(double jdn) -{ - Set(jdn); -} - -inline wxDateTime& wxDateTime::Set(const Tm& tm) -{ - wxASSERT_MSG( tm.IsValid(), wxT("invalid broken down date/time") ); - - return Set(tm.mday, (Month)tm.mon, tm.year, - tm.hour, tm.min, tm.sec, tm.msec); -} - -inline wxDateTime::wxDateTime(wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - Set(hour, minute, second, millisec); -} - -inline wxDateTime::wxDateTime(wxDateTime_t day, - Month month, - int year, - wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - Set(day, month, year, hour, minute, second, millisec); -} - -// ---------------------------------------------------------------------------- -// wxDateTime accessors -// ---------------------------------------------------------------------------- - -inline wxLongLong wxDateTime::GetValue() const -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - - return m_time; -} - -inline time_t wxDateTime::GetTicks() const -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - if ( !IsInStdRange() ) - { - return (time_t)-1; - } - - return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET; -} - -inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, - Month month, - int year) -{ - return SetToWeekDay(weekday, -1, month, year); -} - -inline wxDateTime -wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, - WeekFlags WXUNUSED(flags)) const -{ - MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); -} - -inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const -{ - MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); -} - -inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const -{ - MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); -} - -inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, - int n, - Month month, - int year) const -{ - wxDateTime dt(*this); - - return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; -} - -inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, - Month month, - int year) -{ - wxDateTime dt(*this); - - return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; -} - -inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const -{ - MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); -} - -inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const -{ - MODIFY_AND_RETURN( SetToYearDay(yday) ); -} - -// ---------------------------------------------------------------------------- -// wxDateTime comparison -// ---------------------------------------------------------------------------- - -inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time == datetime.m_time; -} - -inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time < datetime.m_time; -} - -inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time > datetime.m_time; -} - -inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, - const wxDateTime& t2) const -{ - // no need for assert, will be checked by the functions we call - return IsLaterThan(t1) && IsEarlierThan(t2); -} - -inline bool wxDateTime::IsBetween(const wxDateTime& t1, - const wxDateTime& t2) const -{ - // no need for assert, will be checked by the functions we call - return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); -} - -inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const -{ - Tm tm1 = GetTm(), - tm2 = dt.GetTm(); - - return tm1.year == tm2.year && - tm1.mon == tm2.mon && - tm1.mday == tm2.mday; -} - -inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const -{ - // notice that we can't do something like this: - // - // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY - // - // because we have also to deal with (possibly) different DST settings! - Tm tm1 = GetTm(), - tm2 = dt.GetTm(); - - return tm1.hour == tm2.hour && - tm1.min == tm2.min && - tm1.sec == tm2.sec && - tm1.msec == tm2.msec; -} - -inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, - const wxTimeSpan& ts) const -{ - return IsBetween(dt.Subtract(ts), dt.Add(ts)); -} - -// ---------------------------------------------------------------------------- -// wxDateTime arithmetics -// ---------------------------------------------------------------------------- - -inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - - return wxDateTime(m_time + diff.GetValue()); -} - -inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - - m_time += diff.GetValue(); - - return *this; -} - -inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) -{ - return Add(diff); -} - -inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - - return wxDateTime(m_time - diff.GetValue()); -} - -inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) -{ - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); - - m_time -= diff.GetValue(); - - return *this; -} - -inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) -{ - return Subtract(diff); -} - -inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return wxTimeSpan(GetValue() - datetime.GetValue()); -} - -inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const -{ - return this->Subtract(dt2); -} - -inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const -{ - return wxDateTime(*this).Add(diff); -} - -inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) -{ - return Add(diff.Negate()); -} - -inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const -{ - return wxDateTime(*this).Subtract(diff); -} - -inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) -{ - return Subtract(diff); -} - -inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) -{ - return Add(diff); -} - -// ---------------------------------------------------------------------------- -// wxDateTime and timezones -// ---------------------------------------------------------------------------- - -inline wxDateTime -wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const -{ - MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); -} - -inline wxDateTime -wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const -{ - MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) ); -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan construction -// ---------------------------------------------------------------------------- - -inline wxTimeSpan::wxTimeSpan(long hours, - long minutes, - wxLongLong seconds, - wxLongLong milliseconds) -{ - // assign first to avoid precision loss - m_diff = hours; - m_diff *= 60l; - m_diff += minutes; - m_diff *= 60l; - m_diff += seconds; - m_diff *= 1000l; - m_diff += milliseconds; -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan accessors -// ---------------------------------------------------------------------------- - -inline wxLongLong wxTimeSpan::GetSeconds() const -{ - return m_diff / 1000l; -} - -inline int wxTimeSpan::GetMinutes() const -{ - // explicit cast to int suppresses a warning with CodeWarrior and possibly - // others (changing the return type to long from int is impossible in 2.8) - return (int)((GetSeconds() / 60l).GetLo()); -} - -inline int wxTimeSpan::GetHours() const -{ - return GetMinutes() / 60; -} - -inline int wxTimeSpan::GetDays() const -{ - return GetHours() / 24; -} - -inline int wxTimeSpan::GetWeeks() const -{ - return GetDays() / 7; -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan arithmetics -// ---------------------------------------------------------------------------- - -inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const -{ - return wxTimeSpan(m_diff + diff.GetValue()); -} - -inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) -{ - m_diff += diff.GetValue(); - - return *this; -} - -inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const -{ - return wxTimeSpan(m_diff - diff.GetValue()); -} - -inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) -{ - m_diff -= diff.GetValue(); - - return *this; -} - -inline wxTimeSpan& wxTimeSpan::Multiply(int n) -{ - m_diff *= (long)n; - - return *this; -} - -inline wxTimeSpan wxTimeSpan::Multiply(int n) const -{ - return wxTimeSpan(m_diff * (long)n); -} - -inline wxTimeSpan wxTimeSpan::Abs() const -{ - return wxTimeSpan(GetValue().Abs()); -} - -inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const -{ - return GetValue() == ts.GetValue(); -} - -inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const -{ - return GetValue().Abs() > ts.GetValue().Abs(); -} - -// ---------------------------------------------------------------------------- -// wxDateSpan -// ---------------------------------------------------------------------------- - -inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) -{ - m_years += other.m_years; - m_months += other.m_months; - m_weeks += other.m_weeks; - m_days += other.m_days; - - return *this; -} - -inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) -{ - return *this += other; -} - -inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const -{ - wxDateSpan ds(*this); - ds.Add(other); - return ds; -} - -inline wxDateSpan& wxDateSpan::Multiply(int factor) -{ - m_years *= factor; - m_months *= factor; - m_weeks *= factor; - m_days *= factor; - - return *this; -} - -inline wxDateSpan wxDateSpan::Multiply(int factor) const -{ - wxDateSpan ds(*this); - ds.Multiply(factor); - return ds; -} - -inline wxDateSpan wxDateSpan::Negate() const -{ - return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); -} - -inline wxDateSpan& wxDateSpan::Neg() -{ - m_years = -m_years; - m_months = -m_months; - m_weeks = -m_weeks; - m_days = -m_days; - - return *this; -} - -inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) -{ - return *this += other.Negate(); -} - -inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) -{ - return *this -= other; -} - -inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const -{ - wxDateSpan ds(*this); - ds.Subtract(other); - return ds; -} - -#undef MILLISECONDS_PER_DAY - -#undef MODIFY_AND_RETURN - -// ============================================================================ -// binary operators -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxTimeSpan operators -// ---------------------------------------------------------------------------- - -wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts); - -// ---------------------------------------------------------------------------- -// wxDateSpan -// ---------------------------------------------------------------------------- - -wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds); - -// ============================================================================ -// other helper functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// iteration helpers: can be used to write a for loop over enum variable like -// this: -// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) -// ---------------------------------------------------------------------------- - -WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m); -WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m); -WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd); -WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd); - -#endif // wxUSE_DATETIME - -#endif // _WX_DATETIME_H diff --git a/Source/3rdParty/wx/include/wx/datstrm.h b/Source/3rdParty/wx/include/wx/datstrm.h deleted file mode 100644 index b6d00e43e..000000000 --- a/Source/3rdParty/wx/include/wx/datstrm.h +++ /dev/null @@ -1,170 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: datstrm.h -// Purpose: Data stream classes -// Author: Guilhem Lavaux -// Modified by: Mickael Gilabert -// Created: 28/06/1998 -// RCS-ID: $Id: datstrm.h 38576 2006-04-05 16:10:08Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATSTREAM_H_ -#define _WX_DATSTREAM_H_ - -#include "wx/stream.h" -#include "wx/longlong.h" -#include "wx/convauto.h" - -#if wxUSE_STREAMS - -class WXDLLIMPEXP_BASE wxDataInputStream -{ -public: -#if wxUSE_UNICODE - wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto()); -#else - wxDataInputStream(wxInputStream& s); -#endif - ~wxDataInputStream(); - - bool IsOk() { return m_input->IsOk(); } - -#if wxHAS_INT64 - wxUint64 Read64(); -#endif -#if wxUSE_LONGLONG - wxLongLong ReadLL(); -#endif - wxUint32 Read32(); - wxUint16 Read16(); - wxUint8 Read8(); - double ReadDouble(); - wxString ReadString(); - -#if wxHAS_INT64 - void Read64(wxUint64 *buffer, size_t size); - void Read64(wxInt64 *buffer, size_t size); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - void Read64(wxULongLong *buffer, size_t size); - void Read64(wxLongLong *buffer, size_t size); -#endif -#if wxUSE_LONGLONG - void ReadLL(wxULongLong *buffer, size_t size); - void ReadLL(wxLongLong *buffer, size_t size); -#endif - void Read32(wxUint32 *buffer, size_t size); - void Read16(wxUint16 *buffer, size_t size); - void Read8(wxUint8 *buffer, size_t size); - void ReadDouble(double *buffer, size_t size); - - wxDataInputStream& operator>>(wxString& s); - wxDataInputStream& operator>>(wxInt8& c); - wxDataInputStream& operator>>(wxInt16& i); - wxDataInputStream& operator>>(wxInt32& i); - wxDataInputStream& operator>>(wxUint8& c); - wxDataInputStream& operator>>(wxUint16& i); - wxDataInputStream& operator>>(wxUint32& i); -#if wxHAS_INT64 - wxDataInputStream& operator>>(wxUint64& i); - wxDataInputStream& operator>>(wxInt64& i); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - wxDataInputStream& operator>>(wxULongLong& i); - wxDataInputStream& operator>>(wxLongLong& i); -#endif - wxDataInputStream& operator>>(double& i); - wxDataInputStream& operator>>(float& f); - - void BigEndianOrdered(bool be_order) { m_be_order = be_order; } - -protected: - wxInputStream *m_input; - bool m_be_order; -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxDataInputStream) -}; - -class WXDLLIMPEXP_BASE wxDataOutputStream -{ -public: -#if wxUSE_UNICODE - wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto()); -#else - wxDataOutputStream(wxOutputStream& s); -#endif - ~wxDataOutputStream(); - - bool IsOk() { return m_output->IsOk(); } - -#if wxHAS_INT64 - void Write64(wxUint64 i); - void Write64(wxInt64 i); -#endif -#if wxUSE_LONGLONG - void WriteLL(const wxLongLong &ll); - void WriteLL(const wxULongLong &ll); -#endif - void Write32(wxUint32 i); - void Write16(wxUint16 i); - void Write8(wxUint8 i); - void WriteDouble(double d); - void WriteString(const wxString& string); - -#if wxHAS_INT64 - void Write64(const wxUint64 *buffer, size_t size); - void Write64(const wxInt64 *buffer, size_t size); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - void Write64(const wxULongLong *buffer, size_t size); - void Write64(const wxLongLong *buffer, size_t size); -#endif -#if wxUSE_LONGLONG - void WriteLL(const wxULongLong *buffer, size_t size); - void WriteLL(const wxLongLong *buffer, size_t size); -#endif - void Write32(const wxUint32 *buffer, size_t size); - void Write16(const wxUint16 *buffer, size_t size); - void Write8(const wxUint8 *buffer, size_t size); - void WriteDouble(const double *buffer, size_t size); - - wxDataOutputStream& operator<<(const wxChar *string); - wxDataOutputStream& operator<<(const wxString& string); - wxDataOutputStream& operator<<(wxInt8 c); - wxDataOutputStream& operator<<(wxInt16 i); - wxDataOutputStream& operator<<(wxInt32 i); - wxDataOutputStream& operator<<(wxUint8 c); - wxDataOutputStream& operator<<(wxUint16 i); - wxDataOutputStream& operator<<(wxUint32 i); -#if wxHAS_INT64 - wxDataOutputStream& operator<<(wxUint64 i); - wxDataOutputStream& operator<<(wxInt64 i); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - wxDataOutputStream& operator<<(const wxULongLong &i); - wxDataOutputStream& operator<<(const wxLongLong &i); -#endif - wxDataOutputStream& operator<<(double f); - wxDataOutputStream& operator<<(float f); - - void BigEndianOrdered(bool be_order) { m_be_order = be_order; } - -protected: - wxOutputStream *m_output; - bool m_be_order; -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxDataOutputStream) -}; - -#endif - // wxUSE_STREAMS - -#endif - // _WX_DATSTREAM_H_ diff --git a/Source/3rdParty/wx/include/wx/dc.h b/Source/3rdParty/wx/include/wx/dc.h deleted file mode 100644 index 8448d8005..000000000 --- a/Source/3rdParty/wx/include/wx/dc.h +++ /dev/null @@ -1,1008 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dc.h -// Purpose: wxDC class -// Author: Vadim Zeitlin -// Modified by: -// Created: 05/25/99 -// RCS-ID: $Id: dc.h 59768 2009-03-23 12:35:12Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DC_H_BASE_ -#define _WX_DC_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers which we must include here -// ---------------------------------------------------------------------------- - -#include "wx/object.h" // the base class - -#include "wx/intl.h" // for wxLayoutDirection -#include "wx/cursor.h" // we have member variables of these classes -#include "wx/font.h" // so we can't do without them -#include "wx/colour.h" -#include "wx/bitmap.h" // for wxNullBitmap -#include "wx/brush.h" -#include "wx/pen.h" -#include "wx/palette.h" -#include "wx/list.h" // we use wxList in inline functions -#include "wx/dynarray.h" -#include "wx/math.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxDCBase; - -class WXDLLEXPORT wxDrawObject -{ -public: - - wxDrawObject() - : m_isBBoxValid(false) - , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) - { } - - virtual ~wxDrawObject() { } - - virtual void Draw(wxDCBase&) const { } - - virtual void CalcBoundingBox(wxCoord x, wxCoord y) - { - if ( m_isBBoxValid ) - { - if ( x < m_minX ) m_minX = x; - if ( y < m_minY ) m_minY = y; - if ( x > m_maxX ) m_maxX = x; - if ( y > m_maxY ) m_maxY = y; - } - else - { - m_isBBoxValid = true; - - m_minX = x; - m_minY = y; - m_maxX = x; - m_maxY = y; - } - } - - void ResetBoundingBox() - { - m_isBBoxValid = false; - - m_minX = m_maxX = m_minY = m_maxY = 0; - } - - // Get the final bounding box of the PostScript or Metafile picture. - - wxCoord MinX() const { return m_minX; } - wxCoord MaxX() const { return m_maxX; } - wxCoord MinY() const { return m_minY; } - wxCoord MaxY() const { return m_maxY; } - - //to define the type of object for derived objects - virtual int GetType()=0; - -protected: - //for boundingbox calculation - bool m_isBBoxValid:1; - //for boundingbox calculation - wxCoord m_minX, m_minY, m_maxX, m_maxY; -}; - -// --------------------------------------------------------------------------- -// global variables -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// wxDC is the device context - object on which any drawing is done -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCBase : public wxObject -{ -public: - wxDCBase() - : m_colour(wxColourDisplay()) - , m_ok(true) - , m_clipping(false) - , m_isInteractive(0) - , m_isBBoxValid(false) - , m_logicalOriginX(0), m_logicalOriginY(0) - , m_deviceOriginX(0), m_deviceOriginY(0) - , m_logicalScaleX(1.0), m_logicalScaleY(1.0) - , m_userScaleX(1.0), m_userScaleY(1.0) - , m_scaleX(1.0), m_scaleY(1.0) - , m_signX(1), m_signY(1) - , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) - , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) - , m_logicalFunction(wxCOPY) - , m_backgroundMode(wxTRANSPARENT) - , m_mappingMode(wxMM_TEXT) - , m_pen() - , m_brush() - , m_backgroundBrush(*wxTRANSPARENT_BRUSH) - , m_textForegroundColour(*wxBLACK) - , m_textBackgroundColour(*wxWHITE) - , m_font() -#if wxUSE_PALETTE - , m_palette() - , m_hasCustomPalette(false) -#endif // wxUSE_PALETTE - { - ResetBoundingBox(); - ResetClipping(); - } - - virtual ~wxDCBase() { } - - // graphic primitives - // ------------------ - - virtual void DrawObject(wxDrawObject* drawobject) - { - drawobject->Draw(*this); - CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); - CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); - } - - bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) - { return DoFloodFill(x, y, col, style); } - bool FloodFill(const wxPoint& pt, const wxColour& col, - int style = wxFLOOD_SURFACE) - { return DoFloodFill(pt.x, pt.y, col, style); } - - // fill the area specified by rect with a radial gradient, starting from - // initialColour in the centre of the cercle and fading to destColour. - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour) - { GradientFillConcentric(rect, initialColour, destColour, - wxPoint(rect.GetWidth() / 2, - rect.GetHeight() / 2)); } - - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter) - { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } - - // fill the area specified by rect with a linear gradient - void GradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST) - { DoGradientFillLinear(rect, initialColour, destColour, nDirection); } - - bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const - { return DoGetPixel(x, y, col); } - bool GetPixel(const wxPoint& pt, wxColour *col) const - { return DoGetPixel(pt.x, pt.y, col); } - - void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) - { DoDrawLine(x1, y1, x2, y2); } - void DrawLine(const wxPoint& pt1, const wxPoint& pt2) - { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } - - void CrossHair(wxCoord x, wxCoord y) - { DoCrossHair(x, y); } - void CrossHair(const wxPoint& pt) - { DoCrossHair(pt.x, pt.y); } - - void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) - { DoDrawArc(x1, y1, x2, y2, xc, yc); } - void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) - { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } - - void DrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) - { DoDrawCheckMark(x, y, width, height); } - void DrawCheckMark(const wxRect& rect) - { DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } - - void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) - { DoDrawEllipticArc(x, y, w, h, sa, ea); } - void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, - double sa, double ea) - { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } - - void DrawPoint(wxCoord x, wxCoord y) - { DoDrawPoint(x, y); } - void DrawPoint(const wxPoint& pt) - { DoDrawPoint(pt.x, pt.y); } - - void DrawLines(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0) - { DoDrawLines(n, points, xoffset, yoffset); } - void DrawLines(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0); - - void DrawPolygon(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE) - { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } - - void DrawPolygon(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE); - - void DrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE) - { DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } - - void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoDrawRectangle(x, y, width, height); } - void DrawRectangle(const wxPoint& pt, const wxSize& sz) - { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } - void DrawRectangle(const wxRect& rect) - { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } - - void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, - double radius) - { DoDrawRoundedRectangle(x, y, width, height, radius); } - void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, - double radius) - { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } - void DrawRoundedRectangle(const wxRect& r, double radius) - { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } - - void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) - { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } - void DrawCircle(const wxPoint& pt, wxCoord radius) - { DrawCircle(pt.x, pt.y, radius); } - - void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoDrawEllipse(x, y, width, height); } - void DrawEllipse(const wxPoint& pt, const wxSize& sz) - { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } - void DrawEllipse(const wxRect& rect) - { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } - - void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) - { DoDrawIcon(icon, x, y); } - void DrawIcon(const wxIcon& icon, const wxPoint& pt) - { DoDrawIcon(icon, pt.x, pt.y); } - - void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) - { DoDrawBitmap(bmp, x, y, useMask); } - void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, - bool useMask = false) - { DoDrawBitmap(bmp, pt.x, pt.y, useMask); } - - void DrawText(const wxString& text, wxCoord x, wxCoord y) - { DoDrawText(text, x, y); } - void DrawText(const wxString& text, const wxPoint& pt) - { DoDrawText(text, pt.x, pt.y); } - - void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) - { DoDrawRotatedText(text, x, y, angle); } - void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) - { DoDrawRotatedText(text, pt.x, pt.y, angle); } - - // this version puts both optional bitmap and the text into the given - // rectangle and aligns is as specified by alignment parameter; it also - // will emphasize the character with the given index if it is != -1 and - // return the bounding rectangle if required - virtual void DrawLabel(const wxString& text, - const wxBitmap& image, - const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounding = NULL); - - void DrawLabel(const wxString& text, const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1) - { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } - - bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) - { - return DoBlit(xdest, ydest, width, height, - source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); - } - bool Blit(const wxPoint& destPt, const wxSize& sz, - wxDC *source, const wxPoint& srcPt, - int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition) - { - return DoBlit(destPt.x, destPt.y, sz.x, sz.y, - source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); - } - - wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const - { - return DoGetAsBitmap(subrect); - } - -#if wxUSE_SPLINES - // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) - void DrawSpline(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord x3, wxCoord y3); - void DrawSpline(int n, wxPoint points[]); - - void DrawSpline(wxList *points) { DoDrawSpline(points); } -#endif // wxUSE_SPLINES - - // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE -#ifdef __WXWINCE__ - //! Generic method to draw ellipses, circles and arcs with current pen and brush. - /*! \param x Upper left corner of bounding box. - * \param y Upper left corner of bounding box. - * \param w Width of bounding box. - * \param h Height of bounding box. - * \param sa Starting angle of arc - * (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param ea Ending angle of arc. - * \param angle Rotation angle, the Arc will be rotated after - * calculating begin and end. - */ - void DrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxPoint& pt, - const wxSize& sz, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxRect& rect, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } - - virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa = 0, double ea = 0, double angle = 0 ); - - //! Rotates points around center. - /*! This is a quite straight method, it calculates in pixels - * and so it produces rounding errors. - * \param points The points inside will be rotated. - * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param center Center of rotation. - */ - void Rotate( wxList* points, double angle, wxPoint center = wxPoint(0,0) ); - - // used by DrawEllipticArcRot - // Careful: wxList gets filled with points you have to delete later. - void CalculateEllipticPoints( wxList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ); -#endif - - // global DC operations - // -------------------- - - virtual void Clear() = 0; - - virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } - virtual void EndDoc() { } - - virtual void StartPage() { } - virtual void EndPage() { } - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void BeginDrawing() ); - wxDEPRECATED( void EndDrawing() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - - // set objects to use for drawing - // ------------------------------ - - virtual void SetFont(const wxFont& font) = 0; - virtual void SetPen(const wxPen& pen) = 0; - virtual void SetBrush(const wxBrush& brush) = 0; - virtual void SetBackground(const wxBrush& brush) = 0; - virtual void SetBackgroundMode(int mode) = 0; -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) = 0; -#endif // wxUSE_PALETTE - - // clipping region - // --------------- - - void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoSetClippingRegion(x, y, width, height); } - void SetClippingRegion(const wxPoint& pt, const wxSize& sz) - { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } - void SetClippingRegion(const wxRect& rect) - { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } - void SetClippingRegion(const wxRegion& region) - { DoSetClippingRegionAsRegion(region); } - -#if wxABI_VERSION >= 20811 - void SetDeviceClippingRegion(const wxRegion& region) - { DoSetClippingRegionAsRegion(region); } -#endif - - virtual void DestroyClippingRegion() { ResetClipping(); } - - void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const - { DoGetClippingBox(x, y, w, h); } - void GetClippingBox(wxRect& rect) const - { - DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); - } - - // text extent - // ----------- - - virtual wxCoord GetCharHeight() const = 0; - virtual wxCoord GetCharWidth() const = 0; - - // only works for single line strings - void GetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const - { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } - - wxSize GetTextExtent(const wxString& string) const - { - wxCoord w, h; - DoGetTextExtent(string, &w, &h); - return wxSize(w, h); - } - - // works for single as well as multi-line strings - virtual void GetMultiLineTextExtent(const wxString& string, - wxCoord *width, - wxCoord *height, - wxCoord *heightLine = NULL, - wxFont *font = NULL) const; - - wxSize GetMultiLineTextExtent(const wxString& string) const - { - wxCoord w, h; - GetMultiLineTextExtent(string, &w, &h); - return wxSize(w, h); - } - - // Measure cumulative width of text after each character - bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const - { return DoGetPartialTextExtents(text, widths); } - - // size and resolution - // ------------------- - - // in device units - void GetSize(int *width, int *height) const - { DoGetSize(width, height); } - wxSize GetSize() const - { - int w, h; - DoGetSize(&w, &h); - - return wxSize(w, h); - } - - // in mm - void GetSizeMM(int* width, int* height) const - { DoGetSizeMM(width, height); } - wxSize GetSizeMM() const - { - int w, h; - DoGetSizeMM(&w, &h); - - return wxSize(w, h); - } - - // coordinates conversions - // ----------------------- - - // This group of functions does actual conversion of the input, as you'd - // expect. - wxCoord DeviceToLogicalX(wxCoord x) const; - wxCoord DeviceToLogicalY(wxCoord y) const; - wxCoord DeviceToLogicalXRel(wxCoord x) const; - wxCoord DeviceToLogicalYRel(wxCoord y) const; - wxCoord LogicalToDeviceX(wxCoord x) const; - wxCoord LogicalToDeviceY(wxCoord y) const; - wxCoord LogicalToDeviceXRel(wxCoord x) const; - wxCoord LogicalToDeviceYRel(wxCoord y) const; - - // query DC capabilities - // --------------------- - - virtual bool CanDrawBitmap() const = 0; - virtual bool CanGetTextExtent() const = 0; - - // colour depth - virtual int GetDepth() const = 0; - - // Resolution in Pixels per inch - virtual wxSize GetPPI() const = 0; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return m_ok; } - - // accessors and setters - // --------------------- - - virtual int GetBackgroundMode() const { return m_backgroundMode; } - virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } - virtual const wxBrush& GetBrush() const { return m_brush; } - virtual const wxFont& GetFont() const { return m_font; } - virtual const wxPen& GetPen() const { return m_pen; } - - virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } - virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } - virtual void SetTextForeground(const wxColour& colour) - { m_textForegroundColour = colour; } - virtual void SetTextBackground(const wxColour& colour) - { m_textBackgroundColour = colour; } - - virtual int GetMapMode() const { return m_mappingMode; } - virtual void SetMapMode(int mode) = 0; - - virtual void GetUserScale(double *x, double *y) const - { - if ( x ) *x = m_userScaleX; - if ( y ) *y = m_userScaleY; - } - virtual void SetUserScale(double x, double y) = 0; - - virtual void GetLogicalScale(double *x, double *y) - { - if ( x ) *x = m_logicalScaleX; - if ( y ) *y = m_logicalScaleY; - } - virtual void SetLogicalScale(double x, double y) - { - m_logicalScaleX = x; - m_logicalScaleY = y; - } - - void GetLogicalOrigin(wxCoord *x, wxCoord *y) const - { DoGetLogicalOrigin(x, y); } - wxPoint GetLogicalOrigin() const - { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } - virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0; - - void GetDeviceOrigin(wxCoord *x, wxCoord *y) const - { DoGetDeviceOrigin(x, y); } - wxPoint GetDeviceOrigin() const - { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0; - - virtual void ComputeScaleAndOrigin() {} - - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; - - virtual int GetLogicalFunction() const { return m_logicalFunction; } - virtual void SetLogicalFunction(int function) = 0; - -#if WXWIN_COMPATIBILITY_2_4 - virtual void SetOptimization(bool WXUNUSED(opt)) { } - virtual bool GetOptimization() { return false; } -#endif - - // bounding box - // ------------ - - virtual void CalcBoundingBox(wxCoord x, wxCoord y) - { - if ( m_isBBoxValid ) - { - if ( x < m_minX ) m_minX = x; - if ( y < m_minY ) m_minY = y; - if ( x > m_maxX ) m_maxX = x; - if ( y > m_maxY ) m_maxY = y; - } - else - { - m_isBBoxValid = true; - - m_minX = x; - m_minY = y; - m_maxX = x; - m_maxY = y; - } - } - - void ResetBoundingBox() - { - m_isBBoxValid = false; - - m_minX = m_maxX = m_minY = m_maxY = 0; - } - - // Get the final bounding box of the PostScript or Metafile picture. - wxCoord MinX() const { return m_minX; } - wxCoord MaxX() const { return m_maxX; } - wxCoord MinY() const { return m_minY; } - wxCoord MaxY() const { return m_maxY; } - - // misc old functions - // ------------------ - - // for compatibility with the old code when wxCoord was long everywhere - void GetTextExtent(const wxString& string, - long *x, long *y, - long *descent = NULL, - long *externalLeading = NULL, - wxFont *theFont = NULL) const - { - wxCoord x2, y2, descent2, externalLeading2; - DoGetTextExtent(string, &x2, &y2, - &descent2, &externalLeading2, - theFont); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - if ( descent ) - *descent = descent2; - if ( externalLeading ) - *externalLeading = externalLeading2; - } - - void GetLogicalOrigin(long *x, long *y) const - { - wxCoord x2, y2; - DoGetLogicalOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - - void GetDeviceOrigin(long *x, long *y) const - { - wxCoord x2, y2; - DoGetDeviceOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - void GetClippingBox(long *x, long *y, long *w, long *h) const - { - wxCoord xx,yy,ww,hh; - DoGetClippingBox(&xx, &yy, &ww, &hh); - if (x) *x = xx; - if (y) *y = yy; - if (w) *w = ww; - if (h) *h = hh; - } - - // RTL related functions - // --------------------- - - // get or change the layout direction (LTR or RTL) for this dc, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const - { return wxLayout_Default; } - virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) - { } - -protected: - // the pure virtual functions which should be implemented by wxDC - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) = 0; - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual void DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; - - virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) = 0; - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) = 0; - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius) = 0; - virtual void DoDrawEllipse(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) = 0; - - virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) = 0; - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; - virtual void DoDrawRotatedText(const wxString& text, - wxCoord x, wxCoord y, double angle) = 0; - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; - - virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } - - virtual void DoGetSize(int *width, int *height) const = 0; - virtual void DoGetSizeMM(int* width, int* height) const = 0; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset) = 0; - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE) = 0; - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle); - - virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0; - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) = 0; - -#if WXWIN_COMPATIBILITY_2_4 - // this was only for confusing people, use DoGetClippingBox only - virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) - { DoGetClippingBox(x, y, w, h); } -#endif - - virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) const - { - if ( x ) - *x = m_clipX1; - if ( y ) - *y = m_clipY1; - if ( w ) - *w = m_clipX2 - m_clipX1; - if ( h ) - *h = m_clipY2 - m_clipY1; - } - - virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const - { - if ( x ) *x = m_logicalOriginX; - if ( y ) *y = m_logicalOriginY; - } - - virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const - { - if ( x ) *x = m_deviceOriginX; - if ( y ) *y = m_deviceOriginY; - } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const = 0; - - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - -#if wxABI_VERSION >= 20810 - // returns adjustment factor for converting wxFont "point size"; in wx - // it is point size on screen and needs to be multiplied by this value - // for rendering on higher-resolution DCs such as printer ones - static float GetFontPointSizeAdjustment(float dpi); -#endif - -protected: - // unset clipping variables (after clipping region was destroyed) - void ResetClipping() - { - m_clipping = false; - - m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; - } - - // flags - bool m_colour:1; - bool m_ok:1; - bool m_clipping:1; - bool m_isInteractive:1; - bool m_isBBoxValid:1; - - // coordinate system variables - - // TODO short descriptions of what exactly they are would be nice... - - wxCoord m_logicalOriginX, m_logicalOriginY; - wxCoord m_deviceOriginX, m_deviceOriginY; - - double m_logicalScaleX, m_logicalScaleY; - double m_userScaleX, m_userScaleY; - double m_scaleX, m_scaleY; - - // Used by SetAxisOrientation() to invert the axes - int m_signX, m_signY; - - // bounding and clipping boxes - wxCoord m_minX, m_minY, m_maxX, m_maxY; - wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; - - int m_logicalFunction; - int m_backgroundMode; - int m_mappingMode; - - // GDI objects - wxPen m_pen; - wxBrush m_brush; - wxBrush m_backgroundBrush; - wxColour m_textForegroundColour; - wxColour m_textBackgroundColour; - wxFont m_font; - -#if wxUSE_PALETTE - wxPalette m_palette; - bool m_hasCustomPalette; -#endif // wxUSE_PALETTE - -private: - DECLARE_NO_COPY_CLASS(wxDCBase) - DECLARE_ABSTRACT_CLASS(wxDCBase) -}; - -// ---------------------------------------------------------------------------- -// now include the declaration of wxDC class -// ---------------------------------------------------------------------------- - -#if defined(__WXPALMOS__) - #include "wx/palmos/dc.h" -#elif defined(__WXMSW__) - #include "wx/msw/dc.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dc.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dc.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dc.h" -#elif defined(__WXX11__) - #include "wx/x11/dc.h" -#elif defined(__WXMGL__) - #include "wx/mgl/dc.h" -#elif defined(__WXDFB__) - #include "wx/dfb/dc.h" -#elif defined(__WXMAC__) - #include "wx/mac/dc.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dc.h" -#elif defined(__WXPM__) - #include "wx/os2/dc.h" -#endif - -#if wxUSE_GRAPHICS_CONTEXT - #include "wx/dcgraph.h" -#endif - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC text colour and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCTextColourChanger -{ -public: - wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } - - wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) - { - Set(col); - } - - ~wxDCTextColourChanger() - { - if ( m_colFgOld.Ok() ) - m_dc.SetTextForeground(m_colFgOld); - } - - void Set(const wxColour& col) - { - if ( !m_colFgOld.Ok() ) - m_colFgOld = m_dc.GetTextForeground(); - m_dc.SetTextForeground(col); - } - -private: - wxDC& m_dc; - - wxColour m_colFgOld; - - DECLARE_NO_COPY_CLASS(wxDCTextColourChanger) -}; - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC pen and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCPenChanger -{ -public: - wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) - { - m_dc.SetPen(pen); - } - - ~wxDCPenChanger() - { - if ( m_penOld.Ok() ) - m_dc.SetPen(m_penOld); - } - -private: - wxDC& m_dc; - - wxPen m_penOld; - - DECLARE_NO_COPY_CLASS(wxDCPenChanger) -}; - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC brush and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCBrushChanger -{ -public: - wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) - { - m_dc.SetBrush(brush); - } - - ~wxDCBrushChanger() - { - if ( m_brushOld.Ok() ) - m_dc.SetBrush(m_brushOld); - } - -private: - wxDC& m_dc; - - wxBrush m_brushOld; - - DECLARE_NO_COPY_CLASS(wxDCBrushChanger) -}; - -// ---------------------------------------------------------------------------- -// another small helper class: sets the clipping region in its ctor and -// destroys it in the dtor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCClipper -{ -public: - wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) - { dc.SetClippingRegion(r); } - wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) - { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } - wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) - { dc.SetClippingRegion(x, y, w, h); } - - ~wxDCClipper() { m_dc.DestroyClippingRegion(); } - -private: - wxDC& m_dc; - - DECLARE_NO_COPY_CLASS(wxDCClipper) -}; - -#endif // _WX_DC_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dcbuffer.h b/Source/3rdParty/wx/include/wx/dcbuffer.h deleted file mode 100644 index 6769dbc85..000000000 --- a/Source/3rdParty/wx/include/wx/dcbuffer.h +++ /dev/null @@ -1,276 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcbuffer.h -// Purpose: wxBufferedDC class -// Author: Ron Lee -// Modified by: Vadim Zeitlin (refactored, added bg preservation) -// Created: 16/03/02 -// RCS-ID: $Id: dcbuffer.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCBUFFER_H_ -#define _WX_DCBUFFER_H_ - -#include "wx/dcmemory.h" -#include "wx/dcclient.h" -#include "wx/window.h" - -// Split platforms into two groups - those which have well-working -// double-buffering by default, and those which do not. -#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) - #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 -#else - #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 -#endif - - -// ---------------------------------------------------------------------------- -// Double buffering helper. -// ---------------------------------------------------------------------------- - -// Assumes the buffer bitmap covers the entire scrolled window, -// and prepares the window DC accordingly -#define wxBUFFER_VIRTUAL_AREA 0x01 - -// Assumes the buffer bitmap only covers the client area; -// does not prepare the window DC -#define wxBUFFER_CLIENT_AREA 0x02 - -class WXDLLEXPORT wxBufferedDC : public wxMemoryDC -{ -public: - // Default ctor, must subsequently call Init for two stage construction. - wxBufferedDC() - : m_dc(NULL), - m_buffer(NULL), - m_style(0) - { - } - - // Construct a wxBufferedDC using a user supplied buffer. - wxBufferedDC(wxDC *dc, - wxBitmap& buffer = wxNullBitmap, - int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) - { - Init(dc, buffer, style); - } - - // Construct a wxBufferedDC with an internal buffer of 'area' - // (where area is usually something like the size of the window - // being buffered) - wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) - { - Init(dc, area, style); - } - - // The usually desired action in the dtor is to blit the buffer. - virtual ~wxBufferedDC() - { - if ( m_dc ) - UnMask(); - } - - // These reimplement the actions of the ctors for two stage creation - void Init(wxDC *dc, - wxBitmap& buffer = wxNullBitmap, - int style = wxBUFFER_CLIENT_AREA) - { - InitCommon(dc, style); - - m_buffer = &buffer; - - UseBuffer(); - } - - void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA) - { - InitCommon(dc, style); - - UseBuffer(area.x, area.y); - } - - // Blits the buffer to the dc, and detaches the dc from the buffer (so it - // can be effectively used once only). - // - // Usually called in the dtor or by the dtor of derived classes if the - // BufferedDC must blit before the derived class (which may own the dc it's - // blitting to) is destroyed. - void UnMask() - { - wxCHECK_RET( m_dc, wxT("no underlying wxDC?") ); - wxASSERT_MSG( m_buffer && m_buffer->IsOk(), wxT("invalid backing store") ); - - wxCoord x = 0, - y = 0; - - if ( m_style & wxBUFFER_CLIENT_AREA ) - GetDeviceOrigin(&x, &y); - - m_dc->Blit(0, 0, m_buffer->GetWidth(), m_buffer->GetHeight(), - this, -x, -y ); - m_dc = NULL; - } - - // Set and get the style - void SetStyle(int style) { m_style = style; } - int GetStyle() const { return m_style; } - -private: - // common part of Init()s - void InitCommon(wxDC *dc, int style) - { - wxASSERT_MSG( !m_dc, wxT("wxBufferedDC already initialised") ); - - m_dc = dc; - m_style = style; - - // inherit the same layout direction as the original DC - if (dc && dc->IsOk()) - SetLayoutDirection(dc->GetLayoutDirection()); - } - - // check that the bitmap is valid and use it - void UseBuffer(wxCoord w = -1, wxCoord h = -1); - - // the underlying DC to which we copy everything drawn on this one in - // UnMask() - // - // NB: Without the existence of a wxNullDC, this must be a pointer, else it - // could probably be a reference. - wxDC *m_dc; - - // the buffer (selected in this DC), initially invalid - wxBitmap *m_buffer; - - // the buffering style - int m_style; - - DECLARE_DYNAMIC_CLASS(wxBufferedDC) - DECLARE_NO_COPY_CLASS(wxBufferedDC) -}; - - -// ---------------------------------------------------------------------------- -// Double buffered PaintDC. -// ---------------------------------------------------------------------------- - -// Creates a double buffered wxPaintDC, optionally allowing the -// user to specify their own buffer to use. -class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC -{ -public: - // If no bitmap is supplied by the user, a temporary one will be created. - wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) - : m_paintdc(window) - { - // If we're buffering the virtual window, scale the paint DC as well - if (style & wxBUFFER_VIRTUAL_AREA) - window->PrepareDC( m_paintdc ); - - if( buffer.IsOk() ) - Init(&m_paintdc, buffer, style); - else - Init(&m_paintdc, GetBufferedSize(window, style), style); - } - - // If no bitmap is supplied by the user, a temporary one will be created. - wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) - : m_paintdc(window) - { - // If we're using the virtual window, scale the paint DC as well - if (style & wxBUFFER_VIRTUAL_AREA) - window->PrepareDC( m_paintdc ); - - Init(&m_paintdc, GetBufferedSize(window, style), style); - } - - // default copy ctor ok. - - virtual ~wxBufferedPaintDC() - { - // We must UnMask here, else by the time the base class - // does it, the PaintDC will have already been destroyed. - UnMask(); - } - -protected: - // return the size needed by the buffer: this depends on whether we're - // buffering just the currently shown part or the total (scrolled) window - static wxSize GetBufferedSize(wxWindow *window, int style) - { - return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize() - : window->GetClientSize(); - } - -private: - wxPaintDC m_paintdc; - - DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC) - DECLARE_NO_COPY_CLASS(wxBufferedPaintDC) -}; - - - -// -// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double- -// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus, -// you can only expect it work with a simple constructor that -// accepts single wxWindow* argument. -// -#if wxALWAYS_NATIVE_DOUBLE_BUFFER - #define wxAutoBufferedPaintDCBase wxPaintDC -#else - #define wxAutoBufferedPaintDCBase wxBufferedPaintDC -#endif - - -#ifdef __WXDEBUG__ - -class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase -{ -public: - - wxAutoBufferedPaintDC(wxWindow* win) - : wxAutoBufferedPaintDCBase(win) - { - TestWinStyle(win); - } - - virtual ~wxAutoBufferedPaintDC() { } - -private: - - void TestWinStyle(wxWindow* win) - { - // Help the user to get the double-buffering working properly. - wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_CUSTOM, - wxT("In constructor, you need to call SetBackgroundStyle(wxBG_STYLE_CUSTOM), ") - wxT("and also, if needed, paint the background manually in the paint event handler.")); - } - - DECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC) -}; - -#else // !__WXDEBUG__ - -// In release builds, just use typedef -typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC; - -#endif - - -// Check if the window is natively double buffered and will return a wxPaintDC -// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility -// to delete the wxDC pointer when finished with it. -inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window) -{ - if ( window->IsDoubleBuffered() ) - return new wxPaintDC(window); - else - return new wxBufferedPaintDC(window); -} - -#endif // _WX_DCBUFFER_H_ diff --git a/Source/3rdParty/wx/include/wx/dcclient.h b/Source/3rdParty/wx/include/wx/dcclient.h deleted file mode 100644 index c770f6a2f..000000000 --- a/Source/3rdParty/wx/include/wx/dcclient.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcclient.h -// Purpose: wxClientDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcclient.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCCLIENT_H_BASE_ -#define _WX_DCCLIENT_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcclient.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcclient.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcclient.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcclient.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcclient.h" -#elif defined(__WXX11__) -#include "wx/x11/dcclient.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcclient.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcclient.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcclient.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcclient.h" -#elif defined(__WXPM__) -#include "wx/os2/dcclient.h" -#endif - -#endif - // _WX_DCCLIENT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dcgraph.h b/Source/3rdParty/wx/include/wx/dcgraph.h deleted file mode 100644 index 8245f8145..000000000 --- a/Source/3rdParty/wx/include/wx/dcgraph.h +++ /dev/null @@ -1,190 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/graphdc.h -// Purpose: graphics context device bridge header -// Author: Stefan Csomor -// Modified by: -// Created: -// Copyright: (c) Stefan Csomor -// RCS-ID: $Id: dcgraph.h 53390 2008-04-28 04:19:15Z KO $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRAPHICS_DC_H_ -#define _WX_GRAPHICS_DC_H_ - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/geometry.h" -#include "wx/dynarray.h" -#include "wx/graphics.h" - -class WXDLLEXPORT wxWindowDC; - -#ifdef __WXMAC__ -#define wxGCDC wxDC -#endif - -class WXDLLEXPORT wxGCDC: -#ifdef __WXMAC__ - public wxDCBase -#else - public wxDC -#endif -{ - DECLARE_DYNAMIC_CLASS(wxGCDC) - DECLARE_NO_COPY_CLASS(wxGCDC) - -public: - wxGCDC(const wxWindowDC& dc); -#ifdef __WXMSW__ - wxGCDC( const wxMemoryDC& dc); -#endif - wxGCDC(); - virtual ~wxGCDC(); - - void Init(); - - - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc( const wxString& message ); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - // to be virtualized on next major - // flushing the content of this dc immediately onto screen - void Flush(); - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); - virtual void SetPalette(const wxPalette& palette); - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); - - virtual void SetTextForeground(const wxColour& colour); - virtual void SetTextBackground(const wxColour& colour); - - virtual void ComputeScaleAndOrigin(); - - wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } - virtual void SetGraphicsContext( wxGraphicsContext* ctx ); - -protected: - // the true implementations - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual void DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); - - virtual void DoGetSize(int *,int *) const; - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle); - - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - -protected: - // scaling variables - bool m_logicalFunctionSupported; - double m_mm_to_pix_x, m_mm_to_pix_y; - wxGraphicsMatrix m_matrixOriginal; - wxGraphicsMatrix m_matrixCurrent; - - double m_formerScaleX, m_formerScaleY; - - wxGraphicsContext* m_graphicContext; -}; - -#endif - -#endif // _WX_GRAPHICS_DC_H_ diff --git a/Source/3rdParty/wx/include/wx/dcmemory.h b/Source/3rdParty/wx/include/wx/dcmemory.h deleted file mode 100644 index cd7bb0c9d..000000000 --- a/Source/3rdParty/wx/include/wx/dcmemory.h +++ /dev/null @@ -1,76 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcmemory.h -// Purpose: wxMemoryDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcmemory.h 43843 2006-12-07 05:44:44Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMEMORY_H_BASE_ -#define _WX_DCMEMORY_H_BASE_ - -#include "wx/bitmap.h" - -// NOTE: different native implementations of wxMemoryDC will derive from -// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that -// we cannot derive wxMemoryDCBase from wxDC and then use it as the -// only base class for native impl of wxMemoryDC... -class WXDLLEXPORT wxMemoryDCBase -{ -public: - wxMemoryDCBase() { } - - // avoid warnings about having virtual functions but non virtual dtor - virtual ~wxMemoryDCBase() { } - - // select the given bitmap to draw on it - void SelectObject(wxBitmap& bmp) - { - // make sure that the given wxBitmap is not sharing its data with other - // wxBitmap instances as its contents will be modified by any drawing - // operation done on this DC - if (bmp.IsOk()) - bmp.UnShare(); - - DoSelect(bmp); - } - - // select the given bitmap for read-only - virtual void SelectObjectAsSource(const wxBitmap& bmp) - { - DoSelect(bmp); - } - -protected: - virtual void DoSelect(const wxBitmap& bmp) = 0; -}; - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcmemory.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcmemory.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcmemory.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcmemory.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcmemory.h" -#elif defined(__WXX11__) -#include "wx/x11/dcmemory.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcmemory.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcmemory.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcmemory.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcmemory.h" -#elif defined(__WXPM__) -#include "wx/os2/dcmemory.h" -#endif - -#endif - // _WX_DCMEMORY_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dcmirror.h b/Source/3rdParty/wx/include/wx/dcmirror.h deleted file mode 100644 index 89bf12575..000000000 --- a/Source/3rdParty/wx/include/wx/dcmirror.h +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dcmirror.h -// Purpose: wxMirrorDC class -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.07.2003 -// RCS-ID: $Id: dcmirror.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMIRROR_H_ -#define _WX_DCMIRROR_H_ - -#include "wx/dc.h" - -// ---------------------------------------------------------------------------- -// wxMirrorDC allows to write the same code for horz/vertical layout -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMirrorDC : public wxDC -{ -public: - // constructs a mirror DC associated with the given real DC - // - // if mirror parameter is true, all vertical and horizontal coordinates are - // exchanged, otherwise this class behaves in exactly the same way as a - // plain DC - // - // the cast to wxMirrorDC is a dirty hack done to allow us to call the - // protected methods of wxDCBase directly in our code below, without it it - // would be impossible (this is correct from C++ point of view but doesn't - // make any sense in this particular situation) - wxMirrorDC(wxDC& dc, bool mirror) : m_dc((wxMirrorDC&)dc) - { m_mirror = mirror; } - - // wxDCBase operations - virtual void Clear() { m_dc.Clear(); } - virtual void SetFont(const wxFont& font) { m_dc.SetFont(font); } - virtual void SetPen(const wxPen& pen) { m_dc.SetPen(pen); } - virtual void SetBrush(const wxBrush& brush) { m_dc.SetBrush(brush); } - virtual void SetBackground(const wxBrush& brush) - { m_dc.SetBackground(brush); } - virtual void SetBackgroundMode(int mode) { m_dc.SetBackgroundMode(mode); } -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) - { m_dc.SetPalette(palette); } -#endif // wxUSE_PALETTE - virtual void DestroyClippingRegion() { m_dc.DestroyClippingRegion(); } - virtual wxCoord GetCharHeight() const { return m_dc.GetCharHeight(); } - virtual wxCoord GetCharWidth() const { return m_dc.GetCharWidth(); } - virtual bool CanDrawBitmap() const { return m_dc.CanDrawBitmap(); } - virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } - virtual int GetDepth() const { return m_dc.GetDepth(); } - virtual wxSize GetPPI() const { return m_dc.GetPPI(); } - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return m_dc.Ok(); } - virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); } - virtual void SetUserScale(double x, double y) - { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } - virtual void SetLogicalOrigin(wxCoord x, wxCoord y) - { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y) - { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) - { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), - GetY(xLeftRight, yBottomUp)); } - virtual void SetLogicalFunction(int function) - { m_dc.SetLogicalFunction(function); } - - // helper functions which may be useful for the users of this class - wxSize Reflect(const wxSize& sizeOrig) - { - return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; - } - -protected: - // returns x and y if not mirroring or y and x if mirroring - wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } - wxCoord GetY(wxCoord x, wxCoord y) const { return m_mirror ? x : y; } - double GetX(double x, double y) const { return m_mirror ? y : x; } - double GetY(double x, double y) const { return m_mirror ? x : y; } - bool GetX(bool x, bool y) const { return m_mirror ? y : x; } - bool GetY(bool x, bool y) const { return m_mirror ? x : y; } - - // same thing but for pointers - wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; } - wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; } - - // exchange x and y unconditionally - static void Swap(wxCoord& x, wxCoord& y) - { - wxCoord t = x; - x = y; - y = t; - } - - // exchange x and y components of all points in the array if necessary - void Mirror(int n, wxPoint points[]) const - { - if ( m_mirror ) - { - for ( int i = 0; i < n; i++ ) - { - Swap(points[i].x, points[i].y); - } - } - } - - - // wxDCBase functions - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) - { - return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); - } - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const - { - return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col); - } - - - virtual void DoDrawPoint(wxCoord x, wxCoord y) - { - m_dc.DoDrawPoint(GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) - { - m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2)); - } - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) - { - wxFAIL_MSG( wxT("this is probably wrong") ); - - m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1), - GetX(x2, y2), GetY(x2, y2), - xc, yc); - } - - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) - { - m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) - { - wxFAIL_MSG( wxT("this is probably wrong") ); - - m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h), - sa, ea); - } - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { - m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double radius) - { - m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h), - radius); - } - - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { - m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoCrossHair(wxCoord x, wxCoord y) - { - m_dc.DoCrossHair(GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) - { - m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) - { - m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); - } - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) - { - // this is never mirrored - m_dc.DoDrawText(text, x, y); - } - - virtual void DoDrawRotatedText(const wxString& text, - wxCoord x, wxCoord y, double angle) - { - // this is never mirrored - m_dc.DoDrawRotatedText(text, x, y, angle); - } - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord w, wxCoord h, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) - { - return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), - GetX(w, h), GetY(w, h), - source, GetX(xsrc, ysrc), GetY(xsrc, ysrc), - rop, useMask, - GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask)); - } - - virtual void DoGetSize(int *w, int *h) const - { - m_dc.DoGetSize(GetX(w, h), GetY(w, h)); - } - - virtual void DoGetSizeMM(int *w, int *h) const - { - m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset) - { - Mirror(n, points); - - m_dc.DoDrawLines(n, points, - GetX(xoffset, yoffset), GetY(xoffset, yoffset)); - - Mirror(n, points); - } - - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE) - { - Mirror(n, points); - - m_dc.DoDrawPolygon(n, points, - GetX(xoffset, yoffset), GetY(xoffset, yoffset), - fillStyle); - - Mirror(n, points); - } - - virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region)) - { - wxFAIL_MSG( wxT("not implemented") ); - } - - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) - { - m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const - { - // never mirrored - m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); - } - -private: - wxMirrorDC& m_dc; - - bool m_mirror; - - DECLARE_NO_COPY_CLASS(wxMirrorDC) -}; - -#endif // _WX_DCMIRROR_H_ - diff --git a/Source/3rdParty/wx/include/wx/dcprint.h b/Source/3rdParty/wx/include/wx/dcprint.h deleted file mode 100644 index b22394b08..000000000 --- a/Source/3rdParty/wx/include/wx/dcprint.h +++ /dev/null @@ -1,33 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcprint.h -// Purpose: wxPrinterDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcprint.h 41240 2006-09-15 16:45:48Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCPRINT_H_BASE_ -#define _WX_DCPRINT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcprint.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcprint.h" -#endif -#if defined(__WXPM__) -#include "wx/os2/dcprint.h" -#endif -#if defined(__WXMAC__) -#include "wx/mac/dcprint.h" -#endif - -#endif // wxUSE_PRINTING_ARCHITECTURE -#endif - // _WX_DCPRINT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dcscreen.h b/Source/3rdParty/wx/include/wx/dcscreen.h deleted file mode 100644 index 8b52dd959..000000000 --- a/Source/3rdParty/wx/include/wx/dcscreen.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcscreen.h -// Purpose: wxScreenDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcscreen.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCSCREEN_H_BASE_ -#define _WX_DCSCREEN_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcscreen.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcscreen.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcscreen.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcscreen.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcscreen.h" -#elif defined(__WXX11__) -#include "wx/x11/dcscreen.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcscreen.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcscreen.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcscreen.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcscreen.h" -#elif defined(__WXPM__) -#include "wx/os2/dcscreen.h" -#endif - -#endif - // _WX_DCSCREEN_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dde.h b/Source/3rdParty/wx/include/wx/dde.h deleted file mode 100644 index 495e9e27a..000000000 --- a/Source/3rdParty/wx/include/wx/dde.h +++ /dev/null @@ -1,32 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dde.h -// Purpose: DDE base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DDE_H_BASE_ -#define _WX_DDE_H_BASE_ - -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_BASE wxDDEClient; -class WXDLLIMPEXP_FWD_BASE wxDDEServer; -class WXDLLIMPEXP_FWD_BASE wxDDEConnection; - -WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE); - -#if defined(__WXMSW__) - #include "wx/msw/dde.h" -#else - #error DDE is only supported on MSW -#endif - -#endif - // _WX_DDE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/debug.h b/Source/3rdParty/wx/include/wx/debug.h deleted file mode 100644 index fd42bdbfd..000000000 --- a/Source/3rdParty/wx/include/wx/debug.h +++ /dev/null @@ -1,316 +0,0 @@ -/** -* Name: wx/debug.h -* Purpose: Misc debug functions and macros -* Author: Vadim Zeitlin -* Modified by: Ryan Norton (Converted to C) -* Created: 29/01/98 -* RCS-ID: $Id: debug.h 61872 2009-09-09 22:37:05Z VZ $ -* Copyright: (c) 1998 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_DEBUG_H_ -#define _WX_DEBUG_H_ - -#ifndef __WXWINCE__ -#include -#endif -#include /* for CHAR_BIT used below */ - -#include "wx/wxchar.h" /* for __TFILE__ and wxChar */ - -/* ---------------------------------------------------------------------------- */ -/* Defines controlling the debugging macros */ -/* ---------------------------------------------------------------------------- */ - -/* if _DEBUG is defined (MS VC++ and others use it in debug builds), define */ -/* __WXDEBUG__ too */ -#ifdef _DEBUG - #ifndef __WXDEBUG__ - #define __WXDEBUG__ - #endif /* !__WXDEBUG__ */ -#endif /* _DEBUG */ - -/* if NDEBUG is defined ( uses it), undef __WXDEBUG__ and WXDEBUG */ -#ifdef NDEBUG - #undef __WXDEBUG__ - #undef WXDEBUG -#endif /* NDEBUG */ - -/* if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 */ -#ifdef __WXDEBUG__ - #if !defined(WXDEBUG) || !WXDEBUG - #undef WXDEBUG - #define WXDEBUG 1 - #endif /* !WXDEBUG */ -#endif /* __WXDEBUG__ */ - -#ifndef __WXFUNCTION__ - /* TODO: add more compilers supporting __FUNCTION__ */ - #if defined(__DMC__) - /* - __FUNCTION__ happens to be not defined within class members - http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 - */ - #define __WXFUNCTION__ (NULL) - #elif defined(__GNUC__) || \ - (defined(_MSC_VER) && _MSC_VER >= 1300) || \ - defined(__FUNCTION__) - #define __WXFUNCTION__ __FUNCTION__ - #else - /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ - #define __WXFUNCTION__ (NULL) - #endif -#endif /* __WXFUNCTION__ already defined */ - -/* ---------------------------------------------------------------------------- */ -/* Debugging macros */ -/* */ -/* All debugging macros rely on ASSERT() which in turn calls the user-defined */ -/* OnAssert() function. To keep things simple, it's called even when the */ -/* expression is true (i.e. everything is ok) and by default does nothing: just */ -/* returns the same value back. But if you redefine it to do something more sexy */ -/* (popping up a message box in your favourite GUI, sending you e-mail or */ -/* whatever) it will affect all ASSERTs, FAILs and CHECKs in your code. */ -/* */ -/* Warning: if you don't like advice on programming style, don't read */ -/* further! ;-) */ -/* */ -/* Extensive use of these macros is recommended! Remember that ASSERTs are */ -/* disabled in final build (without __WXDEBUG__ defined), so they add strictly */ -/* nothing to your program's code. On the other hand, CHECK macros do stay */ -/* even in release builds, but in general are not much of a burden, while */ -/* a judicious use of them might increase your program's stability. */ -/* ---------------------------------------------------------------------------- */ - -/* Macros which are completely disabled in 'release' mode */ -/* */ -/* NB: these functions are implemented in src/common/appcmn.cpp */ -#if defined(__cplusplus) && defined(__WXDEBUG__) - /* - This function is called whenever one of debugging macros fails (i.e. - condition is false in an assertion). To customize its behaviour, override - wxApp::OnAssert(). - - Parameters: - szFile and nLine - file name and line number of the ASSERT - szFunc - function name of the ASSERT, may be NULL (NB: ASCII) - szCond - text form of the condition which failed - szMsg - optional message explaining the reason - */ - extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile, - int nLine, - const char *szFunc, - const wxChar *szCond, - const wxChar *szMsg = NULL); - - /* call this function to break into the debugger unconditionally (assuming */ - /* the program is running under debugger, of course) */ - extern void WXDLLIMPEXP_BASE wxTrap(); - - /* generic assert macro */ - #define wxASSERT(cond) wxASSERT_MSG(cond, NULL) - - - /* assert with additional message explaining its cause */ - - /* compilers can give a warning (such as "possible unwanted ;") when using */ - /* the default definition of wxASSERT_MSG so we provide an alternative */ - #if defined(__MWERKS__) - #define wxASSERT_MSG(cond, msg) \ - if ( cond ) \ - {} \ - else \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg) - #else - #define wxASSERT_MSG(cond, msg) \ - if ( cond ) \ - ; \ - else \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg) - #endif - - /* special form of assert: always triggers it (in debug mode) */ - #define wxFAIL wxFAIL_MSG(NULL) - - /* FAIL with some message */ - #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("wxAssertFailure", msg) - - /* FAIL with some message and a condition */ - #define wxFAIL_COND_MSG(cond, msg) \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(cond), msg) - - /* An assert helper used to avoid warning when testing constant expressions, */ - /* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */ - /* expression being always true, but not using */ - /* wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) */ - /* */ - /* NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no */ - /* longer be used. */ - extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y); -#else - #define wxTrap() - - /* nothing to do in release mode (hopefully at this moment there are */ - /* no more bugs ;-) */ - #define wxASSERT(cond) - #define wxASSERT_MSG(cond, msg) - #define wxFAIL - #define wxFAIL_MSG(msg) - #define wxFAIL_COND_MSG(cond, msg) -#endif /* __WXDEBUG__ */ - -#ifdef __cplusplus - /* Use of wxFalse instead of false suppresses compiler warnings about testing */ - /* constant expression */ - extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse; -#endif - -#define wxAssertFailure wxFalse - -/* NB: the following macros also work in release mode! */ - -/* - These macros must be used only in invalid situation: for example, an - invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of - dereferencing it and causing core dump the function might try using - CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") ) -*/ - -/* check that expression is true, "return" if not (also FAILs in debug mode) */ -#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, NULL) - -/* as wxCHECK but with a message explaining why we fail */ -#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg) - -/* check that expression is true, perform op if not */ -#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, NULL) - -/* as wxCHECK2 but with a message explaining why we fail */ - -#ifdef __GNUC__ - #define wxFORCE_SEMICOLON typedef int wxDummyCheckInt - /* Note: old gcc versions (e.g. 2.8) give an internal compiler error */ - /* on a simple forward declaration, when used in a template */ - /* function, so rather use a dummy typedef which does work... */ -#else - #define wxFORCE_SEMICOLON struct wxDummyCheckStruct - /* Note2: however, some other compilers (notably Digital Mars */ - /* don't like multiple typedefs (even though the standard */ - /* does allow them), so use a forward declaration for non-gcc. */ -#endif -/* see comment near the definition of wxASSERT_MSG for the # if/else reason */ -#if defined(__MWERKS__) - #define wxCHECK2_MSG(cond, op, msg) \ - if ( cond ) \ - {} \ - else \ - { \ - wxFAIL_COND_MSG(#cond, msg); \ - op; \ - } \ - struct wxDummyCheckStruct /* just to force a semicolon */ -#else - #define wxCHECK2_MSG(cond, op, msg) \ - if ( cond ) \ - ; \ - else \ - { \ - wxFAIL_COND_MSG(#cond, msg); \ - op; \ - } \ - wxFORCE_SEMICOLON /* just to force a semicolon */ -#endif - -/* special form of wxCHECK2: as wxCHECK, but for use in void functions */ -/* */ -/* NB: there is only one form (with msg parameter) and it's intentional: */ -/* there is no other way to tell the caller what exactly went wrong */ -/* from the void function (of course, the function shouldn't be void */ -/* to begin with...) */ -#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg) - -/* ---------------------------------------------------------------------------- */ -/* Compile time asserts */ -/* */ -/* Unlike the normal assert and related macros above which are checked during */ -/* the program tun-time the macros below will result in a compilation error if */ -/* the condition they check is false. This is usually used to check the */ -/* expressions containing sizeof()s which cannot be tested with the */ -/* preprocessor. If you can use the #if's, do use them as you can give a more */ -/* detailed error message then. */ -/* ---------------------------------------------------------------------------- */ - -/* - How this works (you don't have to understand it to be able to use the - macros): we rely on the fact that it is invalid to define a named bit field - in a struct of width 0. All the rest are just the hacks to minimize the - possibility of the compiler warnings when compiling this macro: in - particular, this is why we define a struct and not an object (which would - result in a warning about unused variable) and a named struct (otherwise we'd - get a warning about an unnamed struct not used to define an object!). - */ - -#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_UNIQUE_NAME(wxAssert_) - -/* - The second argument of this macro must be a valid C++ identifier and not a - string. I.e. you should use it like this: - - wxCOMPILE_TIME_ASSERT( sizeof(int) >= 2, YourIntsAreTooSmall ); - - It may be used both within a function and in the global scope. -*/ -#if defined(__WATCOMC__) && defined(__cplusplus) - /* avoid "unused symbol" warning */ - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - class wxMAKE_UNIQUE_ASSERT_NAME { \ - unsigned int msg: expr; \ - wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \ - } -#else - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; } -#endif - -/* - When using VC++ 6 with "Edit and Continue" on, the compiler completely - mishandles __LINE__ and so wxCOMPILE_TIME_ASSERT() doesn't work, provide a - way to make "unique" assert names by specifying a unique prefix explicitly - */ -#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxCONCAT(wxAssert_, text) - -#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \ - struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; } - -/* helpers for wxCOMPILE_TIME_ASSERT below, for private use only */ -#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits - -/* a special case of compile time assert: check that the size of the given type */ -/* is at least the given number of bits */ -#define wxASSERT_MIN_BITSIZE(type, size) \ - wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \ - wxMAKE_BITSIZE_MSG(type, size)) - -/* ---------------------------------------------------------------------------- */ -/* other miscellaneous debugger-related functions */ -/* ---------------------------------------------------------------------------- */ - -/* - Return true if we're running under debugger. - - Currently this only really works under Win32 and Mac in CodeWarrior builds, - it always returns false in other cases. - */ -#ifdef __cplusplus - /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ - #if defined(__WXMAC__) || defined(__WIN32__) - extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); - #else /* !Mac */ - inline bool wxIsDebuggerRunning() { return false; } - #endif /* Mac/!Mac */ -#endif /* __cplusplus */ - -#endif /* _WX_DEBUG_H_ */ diff --git a/Source/3rdParty/wx/include/wx/defs.h b/Source/3rdParty/wx/include/wx/defs.h deleted file mode 100644 index 6e3fd8765..000000000 --- a/Source/3rdParty/wx/include/wx/defs.h +++ /dev/null @@ -1,2907 +0,0 @@ -/* - * Name: wx/defs.h - * Purpose: Declarations/definitions common to all wx source files - * Author: Julian Smart and others - * Modified by: Ryan Norton (Converted to C) - * Created: 01/02/97 - * RCS-ID: $Id: defs.h 66923 2011-02-16 22:37:48Z JS $ - * Copyright: (c) Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_DEFS_H_ -#define _WX_DEFS_H_ - -/* ---------------------------------------------------------------------------- */ -/* compiler and OS identification */ -/* ---------------------------------------------------------------------------- */ - -#include "wx/platform.h" - -#ifdef __cplusplus -/* Make sure the environment is set correctly */ -# if defined(__WXMSW__) && defined(__X__) -# error "Target can't be both X and Windows" -# elif defined(__WXMSW__) && defined(__PALMOS__) -# error "Target can't be both PalmOS and Windows" -# elif !defined(__WXMOTIF__) && \ - !defined(__WXMSW__) && \ - !defined(__WXPALMOS__)&& \ - !defined(__WXGTK__) && \ - !defined(__WXPM__) && \ - !defined(__WXMAC__) && \ - !defined(__WXCOCOA__) && \ - !defined(__X__) && \ - !defined(__WXMGL__) && \ - !defined(__WXDFB__) && \ - !defined(__WXX11__) && \ - wxUSE_GUI -# ifdef __UNIX__ -# error "No Target! You should use wx-config program for compilation flags!" -# else /* !Unix */ -# error "No Target! You should use supplied makefiles for compilation!" -# endif /* Unix/!Unix */ -# endif -#endif /*__cplusplus*/ - -#ifndef __WXWINDOWS__ - #define __WXWINDOWS__ 1 -#endif - -#ifndef wxUSE_BASE - /* by default consider that this is a monolithic build */ - #define wxUSE_BASE 1 -#endif - -#if !wxUSE_GUI && !defined(__WXBASE__) - #define __WXBASE__ -#endif - -/* include the feature test macros */ -#include "wx/features.h" - -/* suppress some Visual C++ warnings */ -#ifdef __VISUALC__ - /* the only "real" warning here is 4244 but there are just too many of them */ - /* in our code... one day someone should go and fix them but until then... */ -# pragma warning(disable:4097) /* typedef used as class */ -# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */ -# pragma warning(disable:4244) /* conversion from double to float */ -# pragma warning(disable:4355) /* 'this' used in base member initializer list */ -# pragma warning(disable:4511) /* copy ctor couldn't be generated */ -# pragma warning(disable:4512) /* operator=() couldn't be generated */ -# pragma warning(disable:4710) /* function not inlined */ - - /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ - /* is buggy, and occurs for code that does actually get executed */ -# if !defined __WXDEBUG__ && __VISUALC__ <= 1100 -# pragma warning(disable:4702) /* unreachable code */ -# endif - /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro' - * is incompatible with the wxWidgets headers since it is given when - * parameters are empty but not missing. */ -# if __VISUALC__ <= 1100 -# pragma warning(disable:4003) /* not enough actual parameters for macro */ -# endif - - /* - VC++ 8 gives a warning when using standard functions such as sprintf, - localtime, ... -- stop this madness, unless the user had already done it - */ - #if __VISUALC__ >= 1400 - #ifndef _CRT_SECURE_NO_DEPRECATE - #define _CRT_SECURE_NO_DEPRECATE 1 - #endif - #ifndef _CRT_NON_CONFORMING_SWPRINTFS - #define _CRT_NON_CONFORMING_SWPRINTFS 1 - #endif - #endif /* VC++ 8 */ -#endif /* __VISUALC__ */ - -/* suppress some Salford C++ warnings */ -#ifdef __SALFORDC__ -# pragma suppress 353 /* Possible nested comments */ -# pragma suppress 593 /* Define not used */ -# pragma suppress 61 /* enum has no name (doesn't suppress!) */ -# pragma suppress 106 /* unnamed, unused parameter */ -# pragma suppress 571 /* Virtual function hiding */ -#endif /* __SALFORDC__ */ - -/* suppress some Borland C++ warnings */ -#ifdef __BORLANDC__ -# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */ -#endif /* __BORLANDC__ */ - -/* - g++ gives a warning when a class has private dtor if it has no friends but - this is a perfectly valid situation for a ref-counted class which destroys - itself when its ref count drops to 0, so provide a macro to suppress this - warning - */ -#ifdef __GNUG__ -# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \ - friend class wxDummyFriendFor ## name; -#else /* !g++ */ -# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) -#endif - -/* ---------------------------------------------------------------------------- */ -/* wxWidgets version and compatibility defines */ -/* ---------------------------------------------------------------------------- */ - -#include "wx/version.h" - -/* ============================================================================ */ -/* non portable C++ features */ -/* ============================================================================ */ - -/* ---------------------------------------------------------------------------- */ -/* compiler defects workarounds */ -/* ---------------------------------------------------------------------------- */ - -/* - Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files, - so define it ourselves (newer versions do it for all files, though, and - don't allow it to be redefined) - */ -#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus) -#define __cplusplus -#endif /* __DECCXX */ - -/* Resolves linking problems under HP-UX when compiling with gcc/g++ */ -#if defined(__HPUX__) && defined(__GNUG__) -#define va_list __gnuc_va_list -#endif /* HP-UX */ - -/* ---------------------------------------------------------------------------- */ -/* check for native bool type and TRUE/FALSE constants */ -/* ---------------------------------------------------------------------------- */ - -/* Add more tests here for Windows compilers that already define bool */ -/* (under Unix, configure tests for this) */ -#ifndef HAVE_BOOL - #if defined( __MWERKS__ ) - #if (__MWERKS__ >= 0x1000) && __option(bool) - #define HAVE_BOOL - #endif - #elif defined(__APPLE__) && defined(__APPLE_CC__) - /* Apple bundled gcc supports bool */ - #define HAVE_BOOL - #elif defined(__VISUALC__) && (__VISUALC__ == 1020) - /* in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed) */ - /* but not implemented, so we must #define it */ - #define bool unsigned int - #elif defined(__VISUALC__) && (__VISUALC__ == 1010) - /* For VisualC++ 4.1, we need to define */ - /* bool as something between 4.0 & 5.0... */ - typedef unsigned int wxbool; - #define bool wxbool - #define HAVE_BOOL - #elif defined(__VISUALC__) && (__VISUALC__ > 1020) - /* VC++ supports bool since 4.2 */ - #define HAVE_BOOL - #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500) - /* Borland 5.0+ supports bool */ - #define HAVE_BOOL - #elif wxCHECK_WATCOM_VERSION(1,0) - /* Watcom 11+ supports bool */ - #define HAVE_BOOL - #elif defined(__DIGITALMARS__) - /* DigitalMars supports bool */ - #define HAVE_BOOL - #elif defined(__GNUWIN32__) || defined(__MINGW32__) || defined(__CYGWIN__) - /* Cygwin supports bool */ - #define HAVE_BOOL - #elif defined(__VISAGECPP__) - #if __IBMCPP__ < 400 - typedef unsigned long bool; - #define true ((bool)1) - #define false ((bool)0) - #endif - #define HAVE_BOOL - #endif /* compilers */ -#endif /* HAVE_BOOL */ - -#if !defined(__MWERKS__) || !defined(true) -#if !defined(HAVE_BOOL) && !defined(bool) && !defined(VMS) - /* NB: of course, this doesn't replace the standard type, because, for */ - /* example, overloading based on bool/int parameter doesn't work and */ - /* so should be avoided in portable programs */ - typedef unsigned int bool; -#endif /* bool */ - -/* deal with TRUE/true stuff: we assume that if the compiler supports bool, it */ -/* supports true/false as well and that, OTOH, if it does _not_ support bool, */ -/* it doesn't support these keywords (this is less sure, in particular VC++ */ -/* 4.x could be a problem here) */ -#ifndef HAVE_BOOL - #define true ((bool)1) - #define false ((bool)0) -#endif -#endif - -/* for backwards compatibility, also define TRUE and FALSE */ -/* */ -/* note that these definitions should work both in C++ and C code, so don't */ -/* use true/false below */ -#ifndef TRUE - #define TRUE 1 -#endif - -#ifndef FALSE - #define FALSE 0 -#endif - -typedef short int WXTYPE; - -/* special care should be taken with this type under Windows where the real */ -/* window id is unsigned, so we must always do the cast before comparing them */ -/* (or else they would be always different!). Using wxGetWindowId() which does */ -/* the cast itself is recommended. Note that this type can't be unsigned */ -/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ -typedef int wxWindowID; - -/* ---------------------------------------------------------------------------- */ -/* other feature tests */ -/* ---------------------------------------------------------------------------- */ - -/* Every ride down a slippery slope begins with a single step.. */ -/* */ -/* Yes, using nested classes is indeed against our coding standards in */ -/* general, but there are places where you can use them to advantage */ -/* without totally breaking ports that cannot use them. If you do, then */ -/* wrap it in this guard, but such cases should still be relatively rare. */ -#define wxUSE_NESTED_CLASSES 1 - -/* check for explicit keyword support */ -#ifndef HAVE_EXPLICIT - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */ - #define HAVE_EXPLICIT - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(2, 95) - /* GCC 2.95 has explicit, what about earlier versions? */ - #define HAVE_EXPLICIT - #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) - /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */ - #define HAVE_EXPLICIT - #elif defined(__MWERKS__) && (__MWERKS__ >= 0x2400) - /* Metrowerks CW6 or higher has explicit */ - #define HAVE_EXPLICIT - #elif defined(__DIGITALMARS__) - #define HAVE_EXPLICIT - #endif -#endif /* !HAVE_EXPLICIT */ - -#ifdef HAVE_EXPLICIT - #define wxEXPLICIT explicit -#else /* !HAVE_EXPLICIT */ - #define wxEXPLICIT -#endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */ - -/* check for static/const_cast<>() (we don't use the other ones for now) */ -#ifndef HAVE_CXX_CASTS - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */ - #define HAVE_CXX_CASTS - #elif defined(__MINGW32__) || defined(__CYGWIN32__) - #if wxCHECK_GCC_VERSION(2, 95) - /* GCC 2.95 has C++ casts, what about earlier versions? */ - #define HAVE_CXX_CASTS - #endif - #endif -#endif /* !HAVE_CXX_CASTS */ - -#ifdef HAVE_CXX_CASTS - #ifndef HAVE_CONST_CAST - #define HAVE_CONST_CAST - #endif - #ifndef HAVE_REINTERPRET_CAST - #define HAVE_REINTERPRET_CAST - #endif - #ifndef HAVE_STATIC_CAST - #define HAVE_STATIC_CAST - #endif - #ifndef HAVE_DYNAMIC_CAST - #define HAVE_DYNAMIC_CAST - #endif -#endif /* HAVE_CXX_CASTS */ - -#ifdef HAVE_STATIC_CAST - #define wx_static_cast(t, x) static_cast(x) -#else - #define wx_static_cast(t, x) ((t)(x)) -#endif - -#ifdef HAVE_CONST_CAST - #define wx_const_cast(t, x) const_cast(x) -#else - #define wx_const_cast(t, x) ((t)(x)) -#endif - -#ifdef HAVE_REINTERPRET_CAST - #define wx_reinterpret_cast(t, x) reinterpret_cast(x) -#else - #define wx_reinterpret_cast(t, x) ((t)(x)) -#endif - -/* - This one is a wx invention: like static cast but used when we intentionally - truncate from a larger to smaller type, static_cast<> can't be used for it - as it results in warnings when using some compilers (SGI mipspro for example) - */ -#if defined(__INTELC__) && defined(__cplusplus) - template - inline T wx_truncate_cast_impl(X x) - { - #pragma warning(push) - /* implicit conversion of a 64-bit integral type to a smaller integral type */ - #pragma warning(disable: 1682) - /* conversion from "X" to "T" may lose significant bits */ - #pragma warning(disable: 810) - - return x; - - #pragma warning(pop) - } - - #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) - -#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310 - template - inline T wx_truncate_cast_impl(X x) - { - #pragma warning(push) - /* conversion from 'X' to 'T', possible loss of data */ - #pragma warning(disable: 4267) - - return x; - - #pragma warning(pop) - } - - #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) -#else - #define wx_truncate_cast(t, x) ((t)(x)) -#endif - -/* for consistency with wxStatic/DynamicCast defined in wx/object.h */ -#define wxConstCast(obj, className) wx_const_cast(className *, obj) - -#ifndef HAVE_STD_WSTRING - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */ - #define HAVE_STD_WSTRING - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(3, 3) - /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */ - #define HAVE_STD_WSTRING - #endif -#endif - -#ifndef HAVE_STD_STRING_COMPARE - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::string::compare */ - /* (what about earlier versions?) */ - #define HAVE_STD_STRING_COMPARE - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(3, 1) - /* GCC 3.1 has std::string::compare; */ - /* 3.0 never was in MinGW, 2.95 hasn't it */ - #define HAVE_STD_STRING_COMPARE - #endif -#endif - -/* provide replacement for C99 va_copy() if the compiler doesn't have it */ - -/* could be already defined by configure or the user */ -#ifndef wxVaCopy - /* if va_copy is a macro or configure detected that we have it, use it */ - #if defined(va_copy) || defined(HAVE_VA_COPY) - #define wxVaCopy va_copy - #else /* no va_copy, try to provide a replacement */ - /* - configure tries to determine whether va_list is an array or struct - type, but it may not be used under Windows, so deal with a few - special cases. - */ - - #ifdef __WATCOMC__ - /* Watcom uses array type for va_list except for PPC and Alpha */ - #if !defined(__PPC__) && !defined(__AXP__) - #define VA_LIST_IS_ARRAY - #endif - #endif /* __WATCOMC__ */ - - #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32)) - /* - PPC using SysV ABI and NT/PPC are special in that they use an - extra level of indirection. - */ - #define VA_LIST_IS_POINTER - #endif /* SysV or Win32 on __PPC__ */ - - /* - note that we use memmove(), not memcpy(), in case anybody tries - to do wxVaCopy(ap, ap) - */ - #if defined(VA_LIST_IS_POINTER) - #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list)) - #elif defined(VA_LIST_IS_ARRAY) - #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list)) - #else /* we can only hope that va_lists are simple lvalues */ - #define wxVaCopy(d, s) ((d) = (s)) - #endif - #endif /* va_copy/!va_copy */ -#endif /* wxVaCopy */ - - -/* ---------------------------------------------------------------------------- */ -/* portable calling conventions macros */ -/* ---------------------------------------------------------------------------- */ - -/* stdcall is used for all functions called by Windows under Windows */ -#if defined(__WINDOWS__) - #if defined(__GNUWIN32__) - #define wxSTDCALL __attribute__((stdcall)) - #else - /* both VC++ and Borland understand this */ - #define wxSTDCALL _stdcall - #endif - -#else /* Win */ - /* no such stupidness under Unix */ - #define wxSTDCALL -#endif /* platform */ - -/* LINKAGEMODE mode is empty for everyting except OS/2 */ -#ifndef LINKAGEMODE - #define LINKAGEMODE -#endif /* LINKAGEMODE */ - -/* wxCALLBACK should be used for the functions which are called back by */ -/* Windows (such as compare function for wxListCtrl) */ -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - #define wxCALLBACK wxSTDCALL -#else - /* no stdcall under Unix nor Win16 */ - #define wxCALLBACK -#endif /* platform */ - -/* generic calling convention for the extern "C" functions */ - -#if defined(__VISUALC__) - #define wxC_CALLING_CONV _cdecl -#elif defined(__VISAGECPP__) - #define wxC_CALLING_CONV _Optlink -#else /* !Visual C++ */ - #define wxC_CALLING_CONV -#endif /* compiler */ - -/* callling convention for the qsort(3) callback */ -#define wxCMPFUNC_CONV wxC_CALLING_CONV - -/* compatibility :-( */ -#define CMPFUNC_CONV wxCMPFUNC_CONV - -/* DLL import/export declarations */ -#include "wx/dlimpexp.h" - -/* ---------------------------------------------------------------------------- */ -/* Very common macros */ -/* ---------------------------------------------------------------------------- */ - -/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */ -#ifndef ATTRIBUTE_PRINTF -# if defined(__GNUC__) && !wxUSE_UNICODE -# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) -# else -# define ATTRIBUTE_PRINTF(m, n) -# endif - -# define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) -# define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) -# define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) -# define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) -# define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) -#endif /* !defined(ATTRIBUTE_PRINTF) */ - -/* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ -#if wxCHECK_GCC_VERSION(3, 1) - #define wxDEPRECATED(x) x __attribute__ ((deprecated)) -#elif defined(__VISUALC__) && (__VISUALC__ >= 1300) - #define wxDEPRECATED(x) __declspec(deprecated) x -#else - #define wxDEPRECATED(x) x -#endif - -/* everybody gets the assert and other debug macros */ -#include "wx/debug.h" - -/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ -/* it must not be defined as "(void *)0" which is standard for C but completely */ -/* breaks C++ code) */ -#ifndef __HANDHELDPC__ -#include -#endif - -/* delete pointer if it is not NULL and NULL it afterwards */ -/* (checking that it's !NULL before passing it to delete is just a */ -/* a question of style, because delete will do it itself anyhow, but it might */ -/* be considered as an error by some overzealous debugging implementations of */ -/* the library, so we do it ourselves) */ -#define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; } - -/* delete an array and NULL it (see comments above) */ -#define wxDELETEA(p) if ( (p) ) { delete [] (p); p = NULL; } - -/* size of statically declared array */ -#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) - -/* symbolic constant used by all Find()-like functions returning positive */ -/* integer on success as failure indicator */ -#define wxNOT_FOUND (-1) - -/* ---------------------------------------------------------------------------- */ -/* macros to avoid compiler warnings */ -/* ---------------------------------------------------------------------------- */ - -/* Macro to cut down on compiler warnings. */ -#if 1 /* there should be no more any compilers needing the "#else" version */ - #define WXUNUSED(identifier) /* identifier */ -#else /* stupid, broken compiler */ - #define WXUNUSED(identifier) identifier -#endif - -/* some arguments are only used in debug mode, but unused in release one */ -#ifdef __WXDEBUG__ - #define WXUNUSED_UNLESS_DEBUG(param) param -#else - #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) -#endif - -/* some arguments are not used in unicode mode */ -#if wxUSE_UNICODE - #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param) -#else - #define WXUNUSED_IN_UNICODE(param) param -#endif - -/* some arguments are not used in WinCE build */ -#ifdef __WXWINCE__ - #define WXUNUSED_IN_WINCE(param) WXUNUSED(param) -#else - #define WXUNUSED_IN_WINCE(param) param -#endif - -/* unused parameters in non stream builds */ -#if wxUSE_STREAMS - #define WXUNUSED_UNLESS_STREAMS(param) param -#else - #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param) -#endif - -/* some compilers give warning about a possibly unused variable if it is */ -/* initialized in both branches of if/else and shut up if it is initialized */ -/* when declared, but other compilers then give warnings about unused variable */ -/* value -- this should satisfy both of them */ -#if defined(__VISUALC__) - #define wxDUMMY_INITIALIZE(val) = val -#else - #define wxDUMMY_INITIALIZE(val) -#endif - -/* sometimes the value of a variable is *really* not used, to suppress the */ -/* resulting warning you may pass it to this function */ -#ifdef __cplusplus -# ifdef __BORLANDC__ -# define wxUnusedVar(identifier) identifier -# else - template - inline void wxUnusedVar(const T& WXUNUSED(t)) { } -# endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* compiler specific settings */ -/* ---------------------------------------------------------------------------- */ - -/* to allow compiling with warning level 4 under Microsoft Visual C++ some */ -/* warnings just must be disabled */ -#ifdef __VISUALC__ - #pragma warning(disable: 4514) /* unreferenced inline func has been removed */ -/* - you might be tempted to disable this one also: triggered by CHECK and FAIL - macros in debug.h, but it's, overall, a rather useful one, so I leave it and - will try to find some way to disable this warning just for CHECK/FAIL. Anyone? -*/ - #pragma warning(disable: 4127) /* conditional expression is constant */ -#endif /* VC++ */ - -#if defined(__MWERKS__) - #undef try - #undef except - #undef finally - #define except(x) catch(...) -#endif /* Metrowerks */ - -#if wxONLY_WATCOM_EARLIER_THAN(1,4) - typedef short mode_t; -#endif - -/* where should i put this? we need to make sure of this as it breaks */ -/* the code. */ -#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) -# ifndef __MWERKS__ -/* #undef __WXDEBUG__ */ -# ifdef wxUSE_DEBUG_NEW_ALWAYS -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -# endif -# endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* standard wxWidgets types */ -/* ---------------------------------------------------------------------------- */ - -/* the type for screen and DC coordinates */ -typedef int wxCoord; - -enum { wxDefaultCoord = -1 }; - -/* ---------------------------------------------------------------------------- */ -/* define fixed length types */ -/* ---------------------------------------------------------------------------- */ - -#if defined(__WXPALMOS__) || defined(__MINGW32__) - #include -#endif - -/* chars are always one byte (by definition), shorts are always two (in */ -/* practice) */ - -/* 8bit */ -#ifndef SIZEOF_CHAR - #define SIZEOF_CHAR 1 -#endif -typedef signed char wxInt8; -typedef unsigned char wxUint8; -typedef wxUint8 wxByte; - - -/* 16bit */ -#ifdef SIZEOF_SHORT - #if SIZEOF_SHORT != 2 - #error "wxWidgets assumes sizeof(short) == 2, please fix the code" - #endif -#else - #define SIZEOF_SHORT 2 -#endif - -typedef signed short wxInt16; -typedef unsigned short wxUint16; - -typedef wxUint16 wxWord; - -/* - things are getting more interesting with ints, longs and pointers - - there are several different standard data models described by this table: - - +-----------+----------------------------+ - |type\model | LP64 ILP64 LLP64 ILP32 LP32| - +-----------+----------------------------+ - |char | 8 8 8 8 8 | - |short | 16 16 16 16 16 | - |int | 32 64 32 32 16 | - |long | 64 64 32 32 32 | - |long long | 64 | - |void * | 64 64 64 32 32 | - +-----------+----------------------------+ - - Win16 used LP32 (but we don't support it any longer), Win32 obviously used - ILP32 and Win64 uses LLP64 (a.k.a. P64) - - Under Unix LP64 is the most widely used (the only I've ever seen, in fact) - */ - -/* 32bit */ -#ifdef __PALMOS__ - typedef int wxInt32; - typedef unsigned int wxUint32; - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_WCHAR_T 2 - #define SIZEOF_SIZE_T 4 - #define wxSIZE_T_IS_UINT - #define SIZEOF_VOID_P 4 - #define SIZEOF_SIZE_T 4 -#elif defined(__WINDOWS__) - /* Win64 uses LLP64 model and so ints and longs have the same size as in */ - /* Win32 */ - #if defined(__WIN32__) - typedef int wxInt32; - typedef unsigned int wxUint32; - - /* Assume that if SIZEOF_INT is defined that all the other ones except - SIZEOF_SIZE_T, are too. See next #if below. */ - #ifndef SIZEOF_INT - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_WCHAR_T 2 - - /* - under Win64 sizeof(size_t) == 8 and so it is neither unsigned - int nor unsigned long! - */ - #ifdef __WIN64__ - #define SIZEOF_SIZE_T 8 - - #undef wxSIZE_T_IS_UINT - #else /* Win32 */ - #define SIZEOF_SIZE_T 4 - - #define wxSIZE_T_IS_UINT - #endif - #undef wxSIZE_T_IS_ULONG - - #ifdef __WIN64__ - #define SIZEOF_VOID_P 8 - #else /* Win32 */ - #define SIZEOF_VOID_P 4 - #endif /* Win64/32 */ - #endif /* !defined(SIZEOF_INT) */ - - /* - If Python.h was included first, it defines all of the SIZEOF's above - except for SIZEOF_SIZE_T, so we need to do it here to avoid - triggering the #error in the ssize_t typedefs below... - */ - #ifndef SIZEOF_SIZE_T - #ifdef __WIN64__ - #define SIZEOF_SIZE_T 8 - #else /* Win32 */ - #define SIZEOF_SIZE_T 4 - #endif - #endif - #else - #error "Unsupported Windows version" - #endif -#else /* !Windows */ - /* SIZEOF_XXX are normally defined by configure */ - #ifdef SIZEOF_INT - #if SIZEOF_INT == 8 - /* must be ILP64 data model, there is normally a special 32 bit */ - /* type in it but we don't know what it is... */ - #error "No 32bit int type on this platform" - #elif SIZEOF_INT == 4 - typedef int wxInt32; - typedef unsigned int wxUint32; - #elif SIZEOF_INT == 2 - /* must be LP32 */ - #if SIZEOF_LONG != 4 - #error "No 32bit int type on this platform" - #endif - - typedef long wxInt32; - typedef unsigned long wxUint32; - #else - /* wxWidgets is not ready for 128bit systems yet... */ - #error "Unknown sizeof(int) value, what are you compiling for?" - #endif - #else /* !defined(SIZEOF_INT) */ - /* assume default 32bit machine -- what else can we do? */ - wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); - wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes); - wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes); - - #define SIZEOF_INT 4 - #define SIZEOF_SIZE_T 4 - #define SIZEOF_VOID_P 4 - - typedef int wxInt32; - typedef unsigned int wxUint32; - - #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) - #define SIZEOF_WCHAR_T 4 - #endif - #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T) - /* also assume that sizeof(wchar_t) == 2 (under Unix the most */ - /* common case is 4 but there configure would have defined */ - /* SIZEOF_WCHAR_T for us) */ - /* the most common case */ - wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2, - Wchar_tMustBeExactly2Bytes); - - #define SIZEOF_WCHAR_T 2 - #endif /* wxUSE_WCHAR_T */ - #endif -#endif /* Win/!Win */ - -typedef wxUint32 wxDword; - -/* - Define an integral type big enough to contain all of long, size_t and void *. - */ -#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T - /* normal case */ - typedef unsigned long wxUIntPtr; - typedef long wxIntPtr; -#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P - /* Win64 case */ - typedef size_t wxUIntPtr; - #define wxIntPtr ssize_t -#else - /* - This should never happen for the current architectures but if you're - using one where it does, please contact wx-dev@lists.wxwidgets.org. - */ - #error "Pointers can't be stored inside integer types." -#endif - -#ifdef __cplusplus -/* And also define a couple of simple functions to cast pointer to/from it. */ -inline wxUIntPtr wxPtrToUInt(const void *p) -{ - /* - VC++ 7.1 gives warnings about casts such as below even when they're - explicit with /Wp64 option, suppress them as we really know what we're - doing here. Same thing with icc with -Wall. - */ -#ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif - /* pointer truncation from '' to '' */ - #pragma warning(disable: 4311) -#elif defined(__INTELC__) - #pragma warning(push) - /* conversion from pointer to same-sized integral type */ - #pragma warning(disable: 1684) -#endif - - return wx_reinterpret_cast(wxUIntPtr, p); - -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) - #pragma warning(pop) -#endif -} - -inline void *wxUIntToPtr(wxUIntPtr p) -{ -#ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif - /* conversion to type of greater size */ - #pragma warning(disable: 4312) -#elif defined(__INTELC__) - #pragma warning(push) - /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ - #pragma warning(disable: 171) -#endif - - return wx_reinterpret_cast(void *, p); - -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) - #pragma warning(pop) -#endif -} -#endif /*__cplusplus*/ - - -/* 64 bit */ - -/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ -/* wxLongLong_t" in wx/longlong.h */ - -/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ - -/* to avoid compilation problems on 64bit machines with ambiguous method calls */ -/* we will need to define this */ -#undef wxLongLongIsLong - -/* - First check for specific compilers which have known 64 bit integer types, - this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for - e.g. MSVC builds (Python.h defines it as 8 even for MSVC). - - Also notice that we check for "long long" before checking for 64 bit long as - we still want to use "long long" and not "long" for wxLongLong_t on 64 bit - architectures to be able to pass wxLongLong_t to the standard functions - prototyped as taking "long long" such as strtoll(). - */ -#if (defined(__VISUALC__) && defined(__WIN32__)) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec wxT("I64") -#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec wxT("L") -#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec wxT("L") -#elif defined(__DIGITALMARS__) - #define wxLongLong_t __int64 - #define wxLongLongSuffix LL - #define wxLongLongFmtSpec wxT("ll") -#elif defined(__MINGW32__) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec wxT("I64") -#elif defined(__MWERKS__) - #if __option(longlong) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec wxT("ll") - #else - #error "The 64 bit integer support in CodeWarrior has been disabled." - #error "See the documentation on the 'longlong' pragma." - #endif -#elif defined(__WXPALMOS__) - #define wxLongLong_t int64_t - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec wxT("ll") -#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 - #define wxLongLong_t long long -#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ - defined(__GNUC__) || \ - defined(__CYGWIN__) || \ - defined(__WXMICROWIN__) || \ - (defined(__DJGPP__) && __DJGPP__ >= 2) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec wxT("ll") -#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) - #define wxLongLong_t long - #define wxLongLongSuffix l - #define wxLongLongFmtSpec wxT("l") - #define wxLongLongIsLong -#endif - - -#ifdef wxLongLong_t - - #ifdef __WXPALMOS__ - #define wxULongLong_t uint64_t - #else - #define wxULongLong_t unsigned wxLongLong_t - #endif - - /* these macros allow to define 64 bit constants in a portable way */ - #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) - #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) - - typedef wxLongLong_t wxInt64; - typedef wxULongLong_t wxUint64; - - #define wxHAS_INT64 1 - -#elif wxUSE_LONGLONG - /* these macros allow to define 64 bit constants in a portable way */ - #define wxLL(x) wxLongLong(x) - #define wxULL(x) wxULongLong(x) - - #define wxInt64 wxLongLong - #define wxUint64 wxULongLong - - #define wxHAS_INT64 1 - -#else /* !wxUSE_LONGLONG */ - - #define wxHAS_INT64 0 - -#endif - - -/* Make sure ssize_t is defined (a signed type the same size as size_t) */ -/* HAVE_SSIZE_T should be defined for compiliers that already have it */ -#ifdef __MINGW32__ - #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T) - #define HAVE_SSIZE_T - #endif -#endif -#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T) - #define HAVE_SSIZE_T -#endif -#if wxCHECK_WATCOM_VERSION(1,4) - #define HAVE_SSIZE_T -#endif -#ifndef HAVE_SSIZE_T - #if SIZEOF_SIZE_T == 4 - typedef wxInt32 ssize_t; - #elif SIZEOF_SIZE_T == 8 - typedef wxInt64 ssize_t; - #else - #error "error defining ssize_t, size_t is not 4 or 8 bytes" - #endif - - /* prevent ssize_t redefinitions in other libraries */ - #define HAVE_SSIZE_T -#endif - - -/* base floating point types */ -/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */ -/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */ -/* wxDouble: native fastest representation that has at least wxFloat64 */ -/* precision, so use the IEEE types for storage, and this for */ -/* calculations */ - -typedef float wxFloat32; -#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__) - typedef short double wxFloat64; -#else - typedef double wxFloat64; -#endif - -typedef double wxDouble; - -/* - Some (non standard) compilers typedef wchar_t as an existing type instead - of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 - for them and to 1 for all the others. - */ -#if wxUSE_WCHAR_T - /* - VC++ typedefs wchar_t as unsigned short by default, that is unless - /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is - defined. - */ -# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) -# define wxWCHAR_T_IS_REAL_TYPE 0 -# else /* compiler having standard-conforming wchar_t */ -# define wxWCHAR_T_IS_REAL_TYPE 1 -# endif -#endif /* wxUSE_WCHAR_T */ - -/* ---------------------------------------------------------------------------- */ -/* byte ordering related definition and macros */ -/* ---------------------------------------------------------------------------- */ - -/* byte sex */ - -#define wxBIG_ENDIAN 4321 -#define wxLITTLE_ENDIAN 1234 -#define wxPDP_ENDIAN 3412 - -#ifdef WORDS_BIGENDIAN -#define wxBYTE_ORDER wxBIG_ENDIAN -#else -#define wxBYTE_ORDER wxLITTLE_ENDIAN -#endif - -/* byte swapping */ - -#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) -/* assembler versions for these */ -#ifdef __POWERPC__ - inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) - {return (__lhbrx( &i , 0 ) );} - inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) - {return (__lhbrx( &i , 0 ) );} - inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) - {return (__lwbrx( &i , 0 ) );} - inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) - {return (__lwbrx( &i , 0 ) );} -#else - #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) - pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) - = { 0xE158 }; - - #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) - pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) - = { 0xE158 }; - - #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) - pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) - = { 0xE158, 0x4840, 0xE158 }; - - #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) - pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) - = { 0xE158, 0x4840, 0xE158 }; - -#endif -#else /* !MWERKS */ -#define wxUINT16_SWAP_ALWAYS(val) \ - ((wxUint16) ( \ - (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ - (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) - -#define wxINT16_SWAP_ALWAYS(val) \ - ((wxInt16) ( \ - (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ - (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) - -#define wxUINT32_SWAP_ALWAYS(val) \ - ((wxUint32) ( \ - (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ - (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ - (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ - (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) - -#define wxINT32_SWAP_ALWAYS(val) \ - ((wxInt32) ( \ - (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ - (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ - (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ - (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) -#endif -/* machine specific byte swapping */ - -#ifdef wxLongLong_t - #define wxUINT64_SWAP_ALWAYS(val) \ - ((wxUint64) ( \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) - - #define wxINT64_SWAP_ALWAYS(val) \ - ((wxInt64) ( \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) -#elif wxUSE_LONGLONG /* !wxLongLong_t */ - #define wxUINT64_SWAP_ALWAYS(val) \ - ((wxUint64) ( \ - ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \ - ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \ - ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \ - ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \ - ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \ - ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \ - ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \ - ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56))) - - #define wxINT64_SWAP_ALWAYS(val) \ - ((wxInt64) ( \ - ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \ - ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \ - ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \ - ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \ - ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \ - ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \ - ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \ - ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56))) -#endif /* wxLongLong_t/!wxLongLong_t */ - -#ifdef WORDS_BIGENDIAN - #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val) - #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val) - #define wxUINT16_SWAP_ON_LE(val) (val) - #define wxINT16_SWAP_ON_LE(val) (val) - #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val) - #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val) - #define wxUINT32_SWAP_ON_LE(val) (val) - #define wxINT32_SWAP_ON_LE(val) (val) - #if wxHAS_INT64 - #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) - #define wxUINT64_SWAP_ON_LE(val) (val) - #endif -#else - #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) - #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) - #define wxUINT16_SWAP_ON_BE(val) (val) - #define wxINT16_SWAP_ON_BE(val) (val) - #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val) - #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val) - #define wxUINT32_SWAP_ON_BE(val) (val) - #define wxINT32_SWAP_ON_BE(val) (val) - #if wxHAS_INT64 - #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) - #define wxUINT64_SWAP_ON_BE(val) (val) - #endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* Geometric flags */ -/* ---------------------------------------------------------------------------- */ - -enum wxGeometryCentre -{ - wxCENTRE = 0x0001, - wxCENTER = wxCENTRE -}; - -/* centering into frame rather than screen (obsolete) */ -#define wxCENTER_FRAME 0x0000 -/* centre on screen rather than parent */ -#define wxCENTRE_ON_SCREEN 0x0002 -#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN - -enum wxOrientation -{ - /* don't change the values of these elements, they are used elsewhere */ - wxHORIZONTAL = 0x0004, - wxVERTICAL = 0x0008, - - wxBOTH = wxVERTICAL | wxHORIZONTAL -}; - -enum wxDirection -{ - wxLEFT = 0x0010, - wxRIGHT = 0x0020, - wxUP = 0x0040, - wxDOWN = 0x0080, - - wxTOP = wxUP, - wxBOTTOM = wxDOWN, - - wxNORTH = wxUP, - wxSOUTH = wxDOWN, - wxWEST = wxLEFT, - wxEAST = wxRIGHT, - - wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT) -}; - -enum wxAlignment -{ - wxALIGN_NOT = 0x0000, - wxALIGN_CENTER_HORIZONTAL = 0x0100, - wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, - wxALIGN_LEFT = wxALIGN_NOT, - wxALIGN_TOP = wxALIGN_NOT, - wxALIGN_RIGHT = 0x0200, - wxALIGN_BOTTOM = 0x0400, - wxALIGN_CENTER_VERTICAL = 0x0800, - wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL, - - wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL), - wxALIGN_CENTRE = wxALIGN_CENTER, - - /* a mask to extract alignment from the combination of flags */ - wxALIGN_MASK = 0x0f00 -}; - -enum wxStretch -{ - wxSTRETCH_NOT = 0x0000, - wxSHRINK = 0x1000, - wxGROW = 0x2000, - wxEXPAND = wxGROW, - wxSHAPED = 0x4000, - wxFIXED_MINSIZE = 0x8000, -#if wxABI_VERSION >= 20808 - wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, -#endif - wxTILE = 0xc000, - - /* for compatibility only, default now, don't use explicitly any more */ -#if WXWIN_COMPATIBILITY_2_4 - wxADJUST_MINSIZE = 0x00100000 -#else - wxADJUST_MINSIZE = 0 -#endif -}; - -/* border flags: the values are chosen for backwards compatibility */ -enum wxBorder -{ - /* this is different from wxBORDER_NONE as by default the controls do have */ - /* border */ - wxBORDER_DEFAULT = 0, - - wxBORDER_NONE = 0x00200000, - wxBORDER_STATIC = 0x01000000, - wxBORDER_SIMPLE = 0x02000000, - wxBORDER_RAISED = 0x04000000, - wxBORDER_SUNKEN = 0x08000000, - wxBORDER_DOUBLE = 0x10000000, /* deprecated */ - wxBORDER_THEME = 0x10000000, - - /* a mask to extract border style from the combination of flags */ - wxBORDER_MASK = 0x1f200000 -}; - -/* This makes it easier to specify a 'normal' border for a control */ -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -#define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE -#else -#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN -#endif - -/* ---------------------------------------------------------------------------- */ -/* Window style flags */ -/* ---------------------------------------------------------------------------- */ - -/* - * Values are chosen so they can be |'ed in a bit list. - * Some styles are used across more than one group, - * so the values mustn't clash with others in the group. - * Otherwise, numbers can be reused across groups. - * - * From version 1.66: - * Window (cross-group) styles now take up the first half - * of the flag, and control-specific styles the - * second half. - * - */ - -/* - * Window (Frame/dialog/subwindow/panel item) style flags - */ -#define wxVSCROLL 0x80000000 -#define wxHSCROLL 0x40000000 -#define wxCAPTION 0x20000000 - -/* New styles (border styles are now in their own enum) */ -#define wxDOUBLE_BORDER wxBORDER_DOUBLE -#define wxSUNKEN_BORDER wxBORDER_SUNKEN -#define wxRAISED_BORDER wxBORDER_RAISED -#define wxBORDER wxBORDER_SIMPLE -#define wxSIMPLE_BORDER wxBORDER_SIMPLE -#define wxSTATIC_BORDER wxBORDER_STATIC -#define wxNO_BORDER wxBORDER_NONE - -/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */ -/* disable it - but still show (see also wxLB_ALWAYS_SB style) */ -/* */ -/* NB: as this style is only supported by wxUniversal and wxMSW so far */ -#define wxALWAYS_SHOW_SB 0x00800000 - -/* Clip children when painting, which reduces flicker in e.g. frames and */ -/* splitter windows, but can't be used in a panel where a static box must be */ -/* 'transparent' (panel paints the background for it) */ -#define wxCLIP_CHILDREN 0x00400000 - -/* Note we're reusing the wxCAPTION style because we won't need captions */ -/* for subwindows/controls */ -#define wxCLIP_SIBLINGS 0x20000000 - -#define wxTRANSPARENT_WINDOW 0x00100000 - -/* Add this style to a panel to get tab traversal working outside of dialogs */ -/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */ -#define wxTAB_TRAVERSAL 0x00080000 - -/* Add this style if the control wants to get all keyboard messages (under */ -/* Windows, it won't normally get the dialog navigation key events) */ -#define wxWANTS_CHARS 0x00040000 - -/* Make window retained (Motif only, see src/generic/scrolwing.cpp) - * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW - * on other platforms - */ - -#ifdef __WXMOTIF__ -#define wxRETAINED 0x00020000 -#else -#define wxRETAINED 0x00000000 -#endif -#define wxBACKINGSTORE wxRETAINED - -/* set this flag to create a special popup window: it will be always shown on */ -/* top of other windows, will capture the mouse and will be dismissed when the */ -/* mouse is clicked outside of it or if it loses focus in any other way */ -#define wxPOPUP_WINDOW 0x00020000 - -/* force a full repaint when the window is resized (instead of repainting just */ -/* the invalidated area) */ -#define wxFULL_REPAINT_ON_RESIZE 0x00010000 - -/* obsolete: now this is the default behaviour */ -/* */ -/* don't invalidate the whole window (resulting in a PAINT event) when the */ -/* window is resized (currently, makes sense for wxMSW only) */ -#define wxNO_FULL_REPAINT_ON_RESIZE 0 - -/* A mask which can be used to filter (out) all wxWindow-specific styles. - */ -#define wxWINDOW_STYLE_MASK \ - (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \ - wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \ - wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE) - -/* - * Extra window style flags (use wxWS_EX prefix to make it clear that they - * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) - */ - -/* by default, TransferDataTo/FromWindow() only work on direct children of the */ -/* window (compatible behaviour), set this flag to make them recursively */ -/* descend into all subwindows */ -#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 - -/* wxCommandEvents and the objects of the derived classes are forwarded to the */ -/* parent window and so on recursively by default. Using this flag for the */ -/* given window allows to block this propagation at this window, i.e. prevent */ -/* the events from being propagated further upwards. The dialogs have this */ -/* flag on by default. */ -#define wxWS_EX_BLOCK_EVENTS 0x00000002 - -/* don't use this window as an implicit parent for the other windows: this must */ -/* be used with transient windows as otherwise there is the risk of creating a */ -/* dialog/frame with this window as a parent which would lead to a crash if the */ -/* parent is destroyed before the child */ -#define wxWS_EX_TRANSIENT 0x00000004 - -/* don't paint the window background, we'll assume it will */ -/* be done by a theming engine. This is not yet used but could */ -/* possibly be made to work in the future, at least on Windows */ -#define wxWS_EX_THEMED_BACKGROUND 0x00000008 - -/* this window should always process idle events */ -#define wxWS_EX_PROCESS_IDLE 0x00000010 - -/* this window should always process UI update events */ -#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020 - -/* Draw the window in a metal theme on Mac */ -#define wxFRAME_EX_METAL 0x00000040 -#define wxDIALOG_EX_METAL 0x00000040 - -/* Use this style to add a context-sensitive help to the window (currently for */ -/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */ -#define wxWS_EX_CONTEXTHELP 0x00000080 - -/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */ -#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP -#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP - -/* Create a window which is attachable to another top level window */ -#define wxFRAME_DRAWER 0x0020 - -/* - * MDI parent frame style flags - * Can overlap with some of the above. - */ - -#define wxFRAME_NO_WINDOW_MENU 0x0100 - -/* - * wxMenuBar style flags - */ -/* use native docking */ -#define wxMB_DOCKABLE 0x0001 - -/* - * wxMenu style flags - */ -#define wxMENU_TEAROFF 0x0001 - -/* - * Apply to all panel items - */ -#define wxCOLOURED 0x0800 -#define wxFIXED_LENGTH 0x0400 - -/* - * Styles for wxListBox - */ -#define wxLB_SORT 0x0010 -#define wxLB_SINGLE 0x0020 -#define wxLB_MULTIPLE 0x0040 -#define wxLB_EXTENDED 0x0080 -/* wxLB_OWNERDRAW is Windows-only */ -#define wxLB_OWNERDRAW 0x0100 -#define wxLB_NEEDED_SB 0x0200 -#define wxLB_ALWAYS_SB 0x0400 -#define wxLB_HSCROLL wxHSCROLL -/* always show an entire number of rows */ -#define wxLB_INT_HEIGHT 0x0800 - -#if WXWIN_COMPATIBILITY_2_6 - /* deprecated synonyms */ - #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */ - #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */ -#endif - -/* - * wxComboBox style flags - */ -#define wxCB_SIMPLE 0x0004 -#define wxCB_SORT 0x0008 -#define wxCB_READONLY 0x0010 -#define wxCB_DROPDOWN 0x0020 - -/* - * wxRadioBox style flags - */ -/* should we number the items from left to right or from top to bottom in a 2d */ -/* radiobox? */ -#define wxRA_LEFTTORIGHT 0x0001 -#define wxRA_TOPTOBOTTOM 0x0002 - -/* New, more intuitive names to specify majorDim argument */ -#define wxRA_SPECIFY_COLS wxHORIZONTAL -#define wxRA_SPECIFY_ROWS wxVERTICAL - -/* Old names for compatibility */ -#define wxRA_HORIZONTAL wxHORIZONTAL -#define wxRA_VERTICAL wxVERTICAL -#define wxRA_USE_CHECKBOX 0x0010 /* alternative native subcontrols (wxPalmOS) */ - -/* - * wxRadioButton style flag - */ -#define wxRB_GROUP 0x0004 -#define wxRB_SINGLE 0x0008 -#define wxRB_USE_CHECKBOX 0x0010 /* alternative native control (wxPalmOS) */ - -/* - * wxScrollBar flags - */ -#define wxSB_HORIZONTAL wxHORIZONTAL -#define wxSB_VERTICAL wxVERTICAL - -/* - * wxSpinButton flags. - * Note that a wxSpinCtrl is sometimes defined as - * a wxTextCtrl, and so the flags must be different - * from wxTextCtrl's. - */ -#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */ -#define wxSP_VERTICAL wxVERTICAL /* 8 */ -#define wxSP_ARROW_KEYS 0x1000 -#define wxSP_WRAP 0x2000 - -/* - * wxTabCtrl flags - */ -#define wxTC_RIGHTJUSTIFY 0x0010 -#define wxTC_FIXEDWIDTH 0x0020 -#define wxTC_TOP 0x0000 /* default */ -#define wxTC_LEFT 0x0020 -#define wxTC_RIGHT 0x0040 -#define wxTC_BOTTOM 0x0080 -#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */ -#define wxTC_OWNERDRAW 0x0400 - -/* - * wxStatusBar95 flags - */ -#define wxST_SIZEGRIP 0x0010 - -/* - * wxStaticText flags - */ -#define wxST_NO_AUTORESIZE 0x0001 -#define wxST_DOTS_MIDDLE 0x0002 -#define wxST_DOTS_END 0x0004 - -/* - * wxStaticBitmap flags - */ -#define wxBI_EXPAND wxEXPAND - -/* - * wxStaticLine flags - */ -#define wxLI_HORIZONTAL wxHORIZONTAL -#define wxLI_VERTICAL wxVERTICAL - - -/* - * extended dialog specifiers. these values are stored in a different - * flag and thus do not overlap with other style flags. note that these - * values do not correspond to the return values of the dialogs (for - * those values, look at the wxID_XXX defines). - */ - -/* wxCENTRE already defined as 0x00000001 */ -#define wxYES 0x00000002 -#define wxOK 0x00000004 -#define wxNO 0x00000008 -#define wxYES_NO (wxYES | wxNO) -#define wxCANCEL 0x00000010 - -#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ -#define wxNO_DEFAULT 0x00000080 - -#define wxICON_EXCLAMATION 0x00000100 -#define wxICON_HAND 0x00000200 -#define wxICON_WARNING wxICON_EXCLAMATION -#define wxICON_ERROR wxICON_HAND -#define wxICON_QUESTION 0x00000400 -#define wxICON_INFORMATION 0x00000800 -#define wxICON_STOP wxICON_HAND -#define wxICON_ASTERISK wxICON_INFORMATION -#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) - -#define wxFORWARD 0x00001000 -#define wxBACKWARD 0x00002000 -#define wxRESET 0x00004000 -#define wxHELP 0x00008000 -#define wxMORE 0x00010000 -#define wxSETUP 0x00020000 - -/* - * Background styles. See wxWindow::SetBackgroundStyle - */ - -enum wxBackgroundStyle -{ - wxBG_STYLE_SYSTEM, - wxBG_STYLE_COLOUR, - wxBG_STYLE_CUSTOM -}; - -/* ---------------------------------------------------------------------------- */ -/* standard IDs */ -/* ---------------------------------------------------------------------------- */ - -/* Standard menu IDs */ -enum -{ - /* no id matches this one when compared to it */ - wxID_NONE = -3, - - /* id for a separator line in the menu (invalid for normal item) */ - wxID_SEPARATOR = -2, - - /* any id: means that we don't care about the id, whether when installing - * an event handler or when creating a new window */ - wxID_ANY = -1, - - - /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */ - wxID_LOWEST = 4999, - - wxID_OPEN, - wxID_CLOSE, - wxID_NEW, - wxID_SAVE, - wxID_SAVEAS, - wxID_REVERT, - wxID_EXIT, - wxID_UNDO, - wxID_REDO, - wxID_HELP, - wxID_PRINT, - wxID_PRINT_SETUP, - wxID_PAGE_SETUP, - wxID_PREVIEW, - wxID_ABOUT, - wxID_HELP_CONTENTS, - wxID_HELP_INDEX, - wxID_HELP_SEARCH, - wxID_HELP_COMMANDS, - wxID_HELP_PROCEDURES, - wxID_HELP_CONTEXT, - wxID_CLOSE_ALL, - wxID_PREFERENCES, - - wxID_EDIT = 5030, - wxID_CUT, - wxID_COPY, - wxID_PASTE, - wxID_CLEAR, - wxID_FIND, - wxID_DUPLICATE, - wxID_SELECTALL, - wxID_DELETE, - wxID_REPLACE, - wxID_REPLACE_ALL, - wxID_PROPERTIES, - - wxID_VIEW_DETAILS, - wxID_VIEW_LARGEICONS, - wxID_VIEW_SMALLICONS, - wxID_VIEW_LIST, - wxID_VIEW_SORTDATE, - wxID_VIEW_SORTNAME, - wxID_VIEW_SORTSIZE, - wxID_VIEW_SORTTYPE, - - wxID_FILE = 5050, - wxID_FILE1, - wxID_FILE2, - wxID_FILE3, - wxID_FILE4, - wxID_FILE5, - wxID_FILE6, - wxID_FILE7, - wxID_FILE8, - wxID_FILE9, - - /* Standard button and menu IDs */ - wxID_OK = 5100, - wxID_CANCEL, - wxID_APPLY, - wxID_YES, - wxID_NO, - wxID_STATIC, - wxID_FORWARD, - wxID_BACKWARD, - wxID_DEFAULT, - wxID_MORE, - wxID_SETUP, - wxID_RESET, - wxID_CONTEXT_HELP, - wxID_YESTOALL, - wxID_NOTOALL, - wxID_ABORT, - wxID_RETRY, - wxID_IGNORE, - wxID_ADD, - wxID_REMOVE, - - wxID_UP, - wxID_DOWN, - wxID_HOME, - wxID_REFRESH, - wxID_STOP, - wxID_INDEX, - - wxID_BOLD, - wxID_ITALIC, - wxID_JUSTIFY_CENTER, - wxID_JUSTIFY_FILL, - wxID_JUSTIFY_RIGHT, - wxID_JUSTIFY_LEFT, - wxID_UNDERLINE, - wxID_INDENT, - wxID_UNINDENT, - wxID_ZOOM_100, - wxID_ZOOM_FIT, - wxID_ZOOM_IN, - wxID_ZOOM_OUT, - wxID_UNDELETE, - wxID_REVERT_TO_SAVED, - - /* System menu IDs (used by wxUniv): */ - wxID_SYSTEM_MENU = 5200, - wxID_CLOSE_FRAME, - wxID_MOVE_FRAME, - wxID_RESIZE_FRAME, - wxID_MAXIMIZE_FRAME, - wxID_ICONIZE_FRAME, - wxID_RESTORE_FRAME, - - /* IDs used by generic file dialog (13 consecutive starting from this value) */ - wxID_FILEDLGG = 5900, - - wxID_HIGHEST = 5999 -}; - -/* ---------------------------------------------------------------------------- */ -/* other constants */ -/* ---------------------------------------------------------------------------- */ - -/* menu and toolbar item kinds */ -enum wxItemKind -{ - wxITEM_SEPARATOR = -1, - wxITEM_NORMAL, - wxITEM_CHECK, - wxITEM_RADIO, - wxITEM_MAX -}; - -/* hit test results */ -enum wxHitTest -{ - wxHT_NOWHERE, - - /* scrollbar */ - wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE, - wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */ - wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */ - wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */ - wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */ - wxHT_SCROLLBAR_THUMB, /* on the thumb */ - wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */ - wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */ - wxHT_SCROLLBAR_LAST, - - /* window */ - wxHT_WINDOW_OUTSIDE, /* not in this window at all */ - wxHT_WINDOW_INSIDE, /* in the client area */ - wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */ - wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */ - wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */ - - wxHT_MAX -}; - -/* ---------------------------------------------------------------------------- */ -/* Possible SetSize flags */ -/* ---------------------------------------------------------------------------- */ - -/* Use internally-calculated width if -1 */ -#define wxSIZE_AUTO_WIDTH 0x0001 -/* Use internally-calculated height if -1 */ -#define wxSIZE_AUTO_HEIGHT 0x0002 -/* Use internally-calculated width and height if each is -1 */ -#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT) -/* Ignore missing (-1) dimensions (use existing). */ -/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */ -#define wxSIZE_USE_EXISTING 0x0000 -/* Allow -1 as a valid position */ -#define wxSIZE_ALLOW_MINUS_ONE 0x0004 -/* Don't do parent client adjustments (for implementation only) */ -#define wxSIZE_NO_ADJUSTMENTS 0x0008 -/* Change the window position even if it seems to be already correct */ -#define wxSIZE_FORCE 0x0010 - -/* ---------------------------------------------------------------------------- */ -/* GDI descriptions */ -/* ---------------------------------------------------------------------------- */ - -enum -{ - /* Text font families */ - wxDEFAULT = 70, - wxDECORATIVE, - wxROMAN, - wxSCRIPT, - wxSWISS, - wxMODERN, - wxTELETYPE, /* @@@@ */ - - /* Proportional or Fixed width fonts (not yet used) */ - wxVARIABLE = 80, - wxFIXED, - - wxNORMAL = 90, - wxLIGHT, - wxBOLD, - /* Also wxNORMAL for normal (non-italic text) */ - wxITALIC, - wxSLANT, - - /* Pen styles */ - wxSOLID = 100, - wxDOT, - wxLONG_DASH, - wxSHORT_DASH, - wxDOT_DASH, - wxUSER_DASH, - - wxTRANSPARENT, - - /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ - /* Note also that stippling a Pen IS meaningfull, because a Line is */ - wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ - wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ - /* drawn with a Pen, and without any Brush -- and it can be stippled. */ - wxSTIPPLE = 110, - - wxBDIAGONAL_HATCH, /* In wxWidgets < 2.6 use WX_HATCH macro */ - wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */ - wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */ - wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */ - wxHORIZONTAL_HATCH, - wxVERTICAL_HATCH, - wxFIRST_HATCH = wxBDIAGONAL_HATCH, - wxLAST_HATCH = wxVERTICAL_HATCH, - - wxJOIN_BEVEL = 120, - wxJOIN_MITER, - wxJOIN_ROUND, - - wxCAP_ROUND = 130, - wxCAP_PROJECTING, - wxCAP_BUTT -}; - -#if WXWIN_COMPATIBILITY_2_4 - #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) -#else - /* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */ -#endif - -/* Logical ops */ -typedef enum -{ - wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */ - wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */ - wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */ - wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */ - wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */ - wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */ - wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */ - wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */ - wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */ - wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */ - wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */ - wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */ - wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */ - wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */ - wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */ - wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */ -} form_ops_t; - -/* Flood styles */ -enum -{ - wxFLOOD_SURFACE = 1, - wxFLOOD_BORDER -}; - -/* Polygon filling mode */ -enum -{ - wxODDEVEN_RULE = 1, - wxWINDING_RULE -}; - -/* ToolPanel in wxFrame (VZ: unused?) */ -enum -{ - wxTOOL_TOP = 1, - wxTOOL_BOTTOM, - wxTOOL_LEFT, - wxTOOL_RIGHT -}; - -/* the values of the format constants should be the same as corresponding */ -/* CF_XXX constants in Windows API */ -enum wxDataFormatId -{ - wxDF_INVALID = 0, - wxDF_TEXT = 1, /* CF_TEXT */ - wxDF_BITMAP = 2, /* CF_BITMAP */ - wxDF_METAFILE = 3, /* CF_METAFILEPICT */ - wxDF_SYLK = 4, - wxDF_DIF = 5, - wxDF_TIFF = 6, - wxDF_OEMTEXT = 7, /* CF_OEMTEXT */ - wxDF_DIB = 8, /* CF_DIB */ - wxDF_PALETTE = 9, - wxDF_PENDATA = 10, - wxDF_RIFF = 11, - wxDF_WAVE = 12, - wxDF_UNICODETEXT = 13, - wxDF_ENHMETAFILE = 14, - wxDF_FILENAME = 15, /* CF_HDROP */ - wxDF_LOCALE = 16, - wxDF_PRIVATE = 20, - wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */ - wxDF_MAX -}; - -/* Virtual keycodes */ -enum wxKeyCode -{ - WXK_BACK = 8, - WXK_TAB = 9, - WXK_RETURN = 13, - WXK_ESCAPE = 27, - WXK_SPACE = 32, - WXK_DELETE = 127, - - /* These are, by design, not compatible with unicode characters. - If you want to get a unicode character from a key event, use - wxKeyEvent::GetUnicodeKey instead. */ - WXK_START = 300, - WXK_LBUTTON, - WXK_RBUTTON, - WXK_CANCEL, - WXK_MBUTTON, - WXK_CLEAR, - WXK_SHIFT, - WXK_ALT, - WXK_CONTROL, - WXK_MENU, - WXK_PAUSE, - WXK_CAPITAL, - WXK_END, - WXK_HOME, - WXK_LEFT, - WXK_UP, - WXK_RIGHT, - WXK_DOWN, - WXK_SELECT, - WXK_PRINT, - WXK_EXECUTE, - WXK_SNAPSHOT, - WXK_INSERT, - WXK_HELP, - WXK_NUMPAD0, - WXK_NUMPAD1, - WXK_NUMPAD2, - WXK_NUMPAD3, - WXK_NUMPAD4, - WXK_NUMPAD5, - WXK_NUMPAD6, - WXK_NUMPAD7, - WXK_NUMPAD8, - WXK_NUMPAD9, - WXK_MULTIPLY, - WXK_ADD, - WXK_SEPARATOR, - WXK_SUBTRACT, - WXK_DECIMAL, - WXK_DIVIDE, - WXK_F1, - WXK_F2, - WXK_F3, - WXK_F4, - WXK_F5, - WXK_F6, - WXK_F7, - WXK_F8, - WXK_F9, - WXK_F10, - WXK_F11, - WXK_F12, - WXK_F13, - WXK_F14, - WXK_F15, - WXK_F16, - WXK_F17, - WXK_F18, - WXK_F19, - WXK_F20, - WXK_F21, - WXK_F22, - WXK_F23, - WXK_F24, - WXK_NUMLOCK, - WXK_SCROLL, - WXK_PAGEUP, - WXK_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_PRIOR = WXK_PAGEUP, - WXK_NEXT = WXK_PAGEDOWN, -#endif - - WXK_NUMPAD_SPACE, - WXK_NUMPAD_TAB, - WXK_NUMPAD_ENTER, - WXK_NUMPAD_F1, - WXK_NUMPAD_F2, - WXK_NUMPAD_F3, - WXK_NUMPAD_F4, - WXK_NUMPAD_HOME, - WXK_NUMPAD_LEFT, - WXK_NUMPAD_UP, - WXK_NUMPAD_RIGHT, - WXK_NUMPAD_DOWN, - WXK_NUMPAD_PAGEUP, - WXK_NUMPAD_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP, - WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN, -#endif - WXK_NUMPAD_END, - WXK_NUMPAD_BEGIN, - WXK_NUMPAD_INSERT, - WXK_NUMPAD_DELETE, - WXK_NUMPAD_EQUAL, - WXK_NUMPAD_MULTIPLY, - WXK_NUMPAD_ADD, - WXK_NUMPAD_SEPARATOR, - WXK_NUMPAD_SUBTRACT, - WXK_NUMPAD_DECIMAL, - WXK_NUMPAD_DIVIDE, - - WXK_WINDOWS_LEFT, - WXK_WINDOWS_RIGHT, - WXK_WINDOWS_MENU , - WXK_COMMAND, - - /* Hardware-specific buttons */ - WXK_SPECIAL1 = 193, - WXK_SPECIAL2, - WXK_SPECIAL3, - WXK_SPECIAL4, - WXK_SPECIAL5, - WXK_SPECIAL6, - WXK_SPECIAL7, - WXK_SPECIAL8, - WXK_SPECIAL9, - WXK_SPECIAL10, - WXK_SPECIAL11, - WXK_SPECIAL12, - WXK_SPECIAL13, - WXK_SPECIAL14, - WXK_SPECIAL15, - WXK_SPECIAL16, - WXK_SPECIAL17, - WXK_SPECIAL18, - WXK_SPECIAL19, - WXK_SPECIAL20 -}; - -/* This enum contains bit mask constants used in wxKeyEvent */ -enum wxKeyModifier -{ - wxMOD_NONE = 0x0000, - wxMOD_ALT = 0x0001, - wxMOD_CONTROL = 0x0002, - wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL, - wxMOD_SHIFT = 0x0004, - wxMOD_META = 0x0008, - wxMOD_WIN = wxMOD_META, -#if defined(__WXMAC__) || defined(__WXCOCOA__) - wxMOD_CMD = wxMOD_META, -#else - wxMOD_CMD = wxMOD_CONTROL, -#endif - wxMOD_ALL = 0xffff -}; - -/* Mapping modes (same values as used by Windows, don't change) */ -enum -{ - wxMM_TEXT = 1, - wxMM_LOMETRIC, - wxMM_HIMETRIC, - wxMM_LOENGLISH, - wxMM_HIENGLISH, - wxMM_TWIPS, - wxMM_ISOTROPIC, - wxMM_ANISOTROPIC, - wxMM_POINTS, - wxMM_METRIC -}; - -/* Shortcut for easier dialog-unit-to-pixel conversion */ -#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) - -/* Paper types */ -typedef enum -{ - wxPAPER_NONE, /* Use specific dimensions */ - wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */ - wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */ - wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */ - wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */ - wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */ - wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */ - wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */ - wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */ - wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */ - wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */ - wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */ - wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */ - wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */ - wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */ - wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */ - wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */ - wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */ - wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */ - wxPAPER_10X14, /* 10-by-14-inch sheet */ - wxPAPER_11X17, /* 11-by-17-inch sheet */ - wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */ - wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */ - wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */ - wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */ - wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */ - wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */ - wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */ - wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */ - wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */ - wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */ - wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */ - wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */ - wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */ - wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */ - wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */ - wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */ - wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */ - wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */ - wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */ - wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */ - wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */ - - wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */ - wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */ - wxPAPER_9X11, /* 9 x 11 in */ - wxPAPER_10X11, /* 10 x 11 in */ - wxPAPER_15X11, /* 15 x 11 in */ - wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */ - wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */ - wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */ - wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */ - wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */ - wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */ - wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */ - wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */ - wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */ - wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */ - wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */ - wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */ - wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */ - wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */ - wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */ - wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */ - wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */ - wxPAPER_A2, /* A2 420 x 594 mm */ - wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */ - wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */ - - wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */ - wxPAPER_A6, /* A6 105 x 148 mm */ - wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */ - wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */ - wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */ - wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */ - wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */ - wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */ - wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */ - wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */ - wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */ - wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */ - wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */ - wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */ - wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */ - wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */ - wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */ - wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */ - wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */ - wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */ - wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */ - wxPAPER_12X11, /* 12 x 11 in */ - wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */ - wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */ - wxPAPER_P16K, /* PRC 16K 146 x 215 mm */ - wxPAPER_P32K, /* PRC 32K 97 x 151 mm */ - wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */ - wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */ - wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */ - wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */ - wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */ - wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */ - wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */ - wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */ - wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */ - wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */ - wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */ - wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */ - wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */ - wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */ - wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */ - wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */ - wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */ - wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */ - wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */ - wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */ - wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */ - wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */ - wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */ - wxPAPER_PENV_10_ROTATED /* PRC Envelope #10 Rotated 458 x 324 m */ -} wxPaperSize; - -/* Printing orientation */ -#ifndef wxPORTRAIT -#define wxPORTRAIT 1 -#define wxLANDSCAPE 2 -#endif - -/* Duplex printing modes - */ - -enum wxDuplexMode -{ - wxDUPLEX_SIMPLEX, /* Non-duplex */ - wxDUPLEX_HORIZONTAL, - wxDUPLEX_VERTICAL -}; - -/* Print quality. - */ - -#define wxPRINT_QUALITY_HIGH -1 -#define wxPRINT_QUALITY_MEDIUM -2 -#define wxPRINT_QUALITY_LOW -3 -#define wxPRINT_QUALITY_DRAFT -4 - -typedef int wxPrintQuality; - -/* Print mode (currently PostScript only) - */ - -enum wxPrintMode -{ - wxPRINT_MODE_NONE = 0, - wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */ - wxPRINT_MODE_FILE = 2, /* Print to file */ - wxPRINT_MODE_PRINTER = 3, /* Send to printer */ - wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */ -}; - -/* ---------------------------------------------------------------------------- */ -/* UpdateWindowUI flags */ -/* ---------------------------------------------------------------------------- */ - -enum wxUpdateUI -{ - wxUPDATE_UI_NONE = 0x0000, - wxUPDATE_UI_RECURSE = 0x0001, - wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */ -}; - -/* ---------------------------------------------------------------------------- */ -/* Notification Event flags - used for dock icon bouncing, etc. */ -/* ---------------------------------------------------------------------------- */ - -enum wxNotificationOptions -{ - wxNOTIFY_NONE = 0x0000, - wxNOTIFY_ONCE = 0x0001, - wxNOTIFY_REPEAT = 0x0002 -}; - -/* ---------------------------------------------------------------------------- */ -/* miscellaneous */ -/* ---------------------------------------------------------------------------- */ - -/* define this macro if font handling is done using the X font names */ -#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__) - #define _WX_X_FONTLIKE -#endif - -/* macro to specify "All Files" on different platforms */ -#if defined(__WXMSW__) || defined(__WXPM__) -# define wxALL_FILES_PATTERN wxT("*.*") -# define wxALL_FILES gettext_noop("All files (*.*)|*.*") -#else -# define wxALL_FILES_PATTERN wxT("*") -# define wxALL_FILES gettext_noop("All files (*)|*") -#endif - -#if defined(__CYGWIN__) && defined(__WXMSW__) -# if wxUSE_STL || defined(wxUSE_STD_STRING) - /* - NASTY HACK because the gethostname in sys/unistd.h which the gnu - stl includes and wx builds with by default clash with each other - (windows version 2nd param is int, sys/unistd.h version is unsigned - int). - */ -# define gethostname gethostnameHACK -# include -# undef gethostname -# endif -#endif - -/* --------------------------------------------------------------------------- */ -/* macros that enable wxWidgets apps to be compiled in absence of the */ -/* sytem headers, although some platform specific types are used in the */ -/* platform specific (implementation) parts of the headers */ -/* --------------------------------------------------------------------------- */ - -#ifdef __WXMAC__ - -#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name - -typedef unsigned char WXCOLORREF[6]; -typedef void* WXCGIMAGEREF; -typedef void* WXHBITMAP; -typedef void* WXHCURSOR; -typedef void* WXHRGN; -typedef void* WXRECTPTR; -typedef void* WXPOINTPTR; -typedef void* WXHWND; -typedef void* WXEVENTREF; -typedef void* WXEVENTHANDLERREF; -typedef void* WXEVENTHANDLERCALLREF; -typedef void* WXAPPLEEVENTREF; -typedef void* WXHDC; -typedef void* WXHMENU; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef WX_OPAQUE_TYPE(CIconHandle ) * WXHICON ; -typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; - - -/* typedef void* WXWidget; */ -/* typedef void* WXWindow; */ -typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ; -typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ; -typedef void* WXDisplay; - -/* typedef WindowPtr WXHWND; */ -/* typedef Handle WXHANDLE; */ -/* typedef CIconHandle WXHICON; */ -/* typedef unsigned long WXHFONT; */ -/* typedef MenuHandle WXHMENU; */ -/* typedef unsigned long WXHPEN; */ -/* typedef unsigned long WXHBRUSH; */ -/* typedef unsigned long WXHPALETTE; */ -/* typedef CursHandle WXHCURSOR; */ -/* typedef RgnHandle WXHRGN; */ -/* typedef unsigned long WXHACCEL; */ -/* typedef unsigned long WXHINSTANCE; */ -/* typedef unsigned long WXHIMAGELIST; */ -/* typedef unsigned long WXHGLOBAL; */ -/* typedef GrafPtr WXHDC; */ -/* typedef unsigned int WXWPARAM; */ -/* typedef long WXLPARAM; */ -/* typedef void * WXRGNDATA; */ -/* typedef void * WXMSG; */ -/* typedef unsigned long WXHCONV; */ -/* typedef unsigned long WXHKEY; */ -/* typedef void * WXDRAWITEMSTRUCT; */ -/* typedef void * WXMEASUREITEMSTRUCT; */ -/* typedef void * WXLPCREATESTRUCT; */ -/* typedef int (*WXFARPROC)(); */ - -/* typedef WindowPtr WXWindow; */ -/* typedef ControlHandle WXWidget; */ - -#endif - -#if defined( __WXCOCOA__ ) || ( defined(__WXMAC__) && defined(__DARWIN__) ) - -/* Definitions of 32-bit/64-bit types - * These are typedef'd exactly the same way in newer OS X headers so - * redefinition when real headers are included should not be a problem. If - * it is, the types are being defined wrongly here. - * The purpose of these types is so they can be used from public wx headers. - * and also because the older (pre-Leopard) headers don't define them. - */ - -/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros - * since they are unlikely to be needed in a public header. - */ -#if defined(__LP64__) && __LP64__ - typedef double CGFloat; -#else - typedef float CGFloat; -#endif - -#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64) -typedef long NSInteger; -typedef unsigned long NSUInteger; -#else -typedef int NSInteger; -typedef unsigned int NSUInteger; -#endif - -/* Objective-C type declarations. - * These are to be used in public headers in lieu of NSSomething* because - * Objective-C class names are not available in C/C++ code. - */ - -/* NOTE: This ought to work with other compilers too, but I'm being cautious */ -#if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) -/* It's desirable to have type safety for Objective-C(++) code as it does -at least catch typos of method names among other things. However, it -is not possible to declare an Objective-C class from plain old C or C++ -code. Furthermore, because of C++ name mangling, the type name must -be the same for both C++ and Objective-C++ code. Therefore, we define -what should be a pointer to an Objective-C class as a pointer to a plain -old C struct with the same name. Unfortunately, because the compiler -does not see a struct as an Objective-C class we cannot declare it -as a struct in Objective-C(++) mode. -*/ -#if defined(__OBJC__) -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -@class klass; \ -typedef klass *WX_##klass -#else /* not defined(__OBJC__) */ -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -typedef struct klass *WX_##klass -#endif /* defined(__OBJC__) */ - -#else /* not Apple's GNU or CodeWarrior */ -#warning "Objective-C types will not be checked by the compiler." -/* NOTE: typedef struct objc_object *id; */ -/* IOW, we're declaring these using the id type without using that name, */ -/* since "id" is used extensively not only within wxWidgets itself, but */ -/* also in wxWidgets application code. The following works fine when */ -/* compiling C(++) code, and works without typesafety for Obj-C(++) code */ -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -typedef struct objc_object *WX_##klass - -#endif /* (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) */ - -DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); -DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); -DECLARE_WXCOCOA_OBJC_CLASS(NSBox); -DECLARE_WXCOCOA_OBJC_CLASS(NSButton); -DECLARE_WXCOCOA_OBJC_CLASS(NSColor); -DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSControl); -DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); -DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSImage); -DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); -DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); -DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); -DECLARE_WXCOCOA_OBJC_CLASS(NSObject); -DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); -DECLARE_WXCOCOA_OBJC_CLASS(NSSound); -DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); -DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); -DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextField); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); -DECLARE_WXCOCOA_OBJC_CLASS(NSThread); -DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); -DECLARE_WXCOCOA_OBJC_CLASS(NSView); -#ifdef __WXMAC__ -// things added for __WXMAC__ -DECLARE_WXCOCOA_OBJC_CLASS(NSString); -#else -// things only for __WXCOCOA__ -typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ -#endif -#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ - -#if defined(__WXPALMOS__) - -typedef void * WXHWND; -typedef void * WXHANDLE; -typedef void * WXHICON; -typedef void * WXHFONT; -typedef void * WXHMENU; -typedef void * WXHPEN; -typedef void * WXHBRUSH; -typedef void * WXHPALETTE; -typedef void * WXHCURSOR; -typedef void * WXHRGN; -typedef void * WXHACCEL; -typedef void * WXHINSTANCE; -typedef void * WXHBITMAP; -typedef void * WXHIMAGELIST; -typedef void * WXHGLOBAL; -typedef void * WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef struct tagMSG WXMSG; - -typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */ -typedef WXWINHANDLE WXWidget; - -typedef void * WXFORMPTR; -typedef void * WXEVENTPTR; -typedef void * WXRECTANGLEPTR; - -#endif /* __WXPALMOS__ */ - - -/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ -#if defined(__WIN32__) - -/* the keywords needed for WinMain() declaration */ -#ifndef WXFAR -# define WXFAR -#endif - -/* Stand-ins for Windows types to avoid #including all of windows.h */ -typedef void * WXHWND; -typedef void * WXHANDLE; -typedef void * WXHICON; -typedef void * WXHFONT; -typedef void * WXHMENU; -typedef void * WXHPEN; -typedef void * WXHBRUSH; -typedef void * WXHPALETTE; -typedef void * WXHCURSOR; -typedef void * WXHRGN; -typedef void * WXRECTPTR; -typedef void * WXHACCEL; -typedef void WXFAR * WXHINSTANCE; -typedef void * WXHBITMAP; -typedef void * WXHIMAGELIST; -typedef void * WXHGLOBAL; -typedef void * WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef void * WXRGNDATA; -typedef struct tagMSG WXMSG; -typedef void * WXHCONV; -typedef void * WXHKEY; -typedef void * WXHTREEITEM; - -typedef void * WXDRAWITEMSTRUCT; -typedef void * WXMEASUREITEMSTRUCT; -typedef void * WXLPCREATESTRUCT; - -typedef WXHWND WXWidget; - -#ifdef __WIN64__ -typedef unsigned __int64 WXWPARAM; -typedef __int64 WXLPARAM; -typedef __int64 WXLRESULT; -#else -typedef unsigned int WXWPARAM; -typedef long WXLPARAM; -typedef long WXLRESULT; -#endif - -#if defined(__GNUWIN32__) || defined(__WXMICROWIN__) -typedef int (*WXFARPROC)(); -#else -typedef int (__stdcall *WXFARPROC)(); -#endif -#endif /* __WIN32__ */ - - -#if defined(__OS2__) -typedef unsigned long DWORD; -typedef unsigned short WORD; -#endif - -#if defined(__WXPM__) || defined(__EMX__) -#ifdef __WXPM__ -/* Stand-ins for OS/2 types, to avoid #including all of os2.h */ -typedef unsigned long WXHWND; -typedef unsigned long WXHANDLE; -typedef unsigned long WXHICON; -typedef unsigned long WXHFONT; -typedef unsigned long WXHMENU; -typedef unsigned long WXHPEN; -typedef unsigned long WXHBRUSH; -typedef unsigned long WXHPALETTE; -typedef unsigned long WXHCURSOR; -typedef unsigned long WXHRGN; -typedef unsigned long WXHACCEL; -typedef unsigned long WXHBITMAP; -typedef unsigned long WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef void * WXMSG; -typedef unsigned long WXHTREEITEM; - -typedef void * WXDRAWITEMSTRUCT; -typedef void * WXMEASUREITEMSTRUCT; -typedef void * WXLPCREATESTRUCT; - -typedef WXHWND WXWidget; -#endif -#ifdef __EMX__ -/* Need a well-known type for WXFARPROC - below. MPARAM is typedef'ed too late. */ -#define WXWPARAM void * -#define WXLPARAM void * -#else -#define WXWPARAM MPARAM -#define WXLPARAM MPARAM -#endif -#define RECT RECTL -#define LOGFONT FATTRS -#define LOWORD SHORT1FROMMP -#define HIWORD SHORT2FROMMP - -typedef unsigned long WXMPARAM; -typedef unsigned long WXMSGID; -typedef void* WXRESULT; -/* typedef int (*WXFARPROC)(); */ -/* some windows handles not defined by PM */ -typedef unsigned long HANDLE; -typedef unsigned long HICON; -typedef unsigned long HFONT; -typedef unsigned long HMENU; -typedef unsigned long HPEN; -typedef unsigned long HBRUSH; -typedef unsigned long HPALETTE; -typedef unsigned long HCURSOR; -typedef unsigned long HINSTANCE; -typedef unsigned long HIMAGELIST; -typedef unsigned long HGLOBAL; -#endif /* WXPM || EMX */ - -#if defined (__WXPM__) -/* WIN32 graphics types for OS/2 GPI */ - -/* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */ -#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) - -typedef unsigned long COLORREF; -#define GetRValue(rgb) ((unsigned char)((rgb) >> 16)) -#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8)) -#define GetBValue(rgb) ((unsigned char)(rgb)) -#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) -#define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) -/* OS2's RGB/RGB2 is backwards from this */ -typedef struct tagPALETTEENTRY -{ - char bRed; - char bGreen; - char bBlue; - char bFlags; -} PALETTEENTRY; -typedef struct tagLOGPALETTE -{ - WORD palVersion; - WORD palNumentries; - WORD PALETTEENTRY[1]; -} LOGPALETTE; - -#if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__) - /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */ -typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); -#else -#if defined(__EMX__) && !defined(_System) -#define _System -#endif -typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); -#endif - -#endif /* __WXPM__ */ - - -#if defined(__WXMOTIF__) || defined(__WXX11__) -/* Stand-ins for X/Xt/Motif types */ -typedef void* WXWindow; -typedef void* WXWidget; -typedef void* WXAppContext; -typedef void* WXColormap; -typedef void* WXColor; -typedef void WXDisplay; -typedef void WXEvent; -typedef void* WXCursor; -typedef void* WXPixmap; -typedef void* WXFontStructPtr; -typedef void* WXGC; -typedef void* WXRegion; -typedef void* WXFont; -typedef void* WXImage; -typedef void* WXFontList; -typedef void* WXFontSet; -typedef void* WXRendition; -typedef void* WXRenderTable; -typedef void* WXFontType; /* either a XmFontList or XmRenderTable */ -typedef void* WXString; - -typedef unsigned long Atom; /* this might fail on a few architectures */ -typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ - -#endif /* Motif */ - -#ifdef __WXGTK__ - -/* Stand-ins for GLIB types */ -typedef char gchar; -typedef signed char gint8; -typedef int gint; -typedef unsigned guint; -typedef unsigned long gulong; -typedef void* gpointer; -typedef struct _GSList GSList; - -/* Stand-ins for GDK types */ -typedef struct _GdkColor GdkColor; -typedef struct _GdkColormap GdkColormap; -typedef struct _GdkFont GdkFont; -typedef struct _GdkGC GdkGC; -typedef struct _GdkVisual GdkVisual; - -#ifdef __WXGTK20__ -typedef struct _GdkAtom *GdkAtom; -typedef struct _GdkDrawable GdkWindow; -typedef struct _GdkDrawable GdkBitmap; -typedef struct _GdkDrawable GdkPixmap; -#else /* GTK+ 1.2 */ -typedef gulong GdkAtom; -typedef struct _GdkWindow GdkWindow; -typedef struct _GdkWindow GdkBitmap; -typedef struct _GdkWindow GdkPixmap; -#endif /* GTK+ 1.2/2.0 */ - -typedef struct _GdkCursor GdkCursor; -typedef struct _GdkRegion GdkRegion; -typedef struct _GdkDragContext GdkDragContext; - -#ifdef HAVE_XIM -typedef struct _GdkIC GdkIC; -typedef struct _GdkICAttr GdkICAttr; -#endif - -/* Stand-ins for GTK types */ -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkRcStyle GtkRcStyle; -typedef struct _GtkAdjustment GtkAdjustment; -typedef struct _GtkList GtkList; -typedef struct _GtkToolbar GtkToolbar; -typedef struct _GtkTooltips GtkTooltips; -typedef struct _GtkNotebook GtkNotebook; -typedef struct _GtkNotebookPage GtkNotebookPage; -typedef struct _GtkAccelGroup GtkAccelGroup; -typedef struct _GtkItemFactory GtkItemFactory; -typedef struct _GtkSelectionData GtkSelectionData; -typedef struct _GtkTextBuffer GtkTextBuffer; -typedef struct _GtkRange GtkRange; - -typedef GtkWidget *WXWidget; - -#ifndef __WXGTK20__ -#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass) -#define GTK_CLASS_TYPE(klass) ((klass)->type) -#endif - -#endif /* __WXGTK__ */ - -#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE) -#define wxUSE_PANGO 1 -#else -#define wxUSE_PANGO 0 -#endif - -#if wxUSE_PANGO -/* Stand-ins for Pango types */ -typedef struct _PangoContext PangoContext; -typedef struct _PangoLayout PangoLayout; -typedef struct _PangoFontDescription PangoFontDescription; -#endif - -#ifdef __WXMGL__ -typedef struct window_t *WXWidget; -#endif /* MGL */ - -#ifdef __WXDFB__ -/* DirectFB doesn't have the concept of non-TLW window, so use - something arbitrary */ -typedef const void* WXWidget; -#endif /* DFB */ - -/* This is required because of clashing macros in windows.h, which may be */ -/* included before or after wxWidgets classes, and therefore must be */ -/* disabled here before any significant wxWidgets headers are included. */ -#ifdef __cplusplus -#ifdef __WXMSW__ -#include "wx/msw/winundef.h" -#endif /* __WXMSW__ */ -#endif /* __cplusplus */ - -/* --------------------------------------------------------------------------- */ -/* macro to define a class without copy ctor nor assignment operator */ -/* --------------------------------------------------------------------------- */ - -#define DECLARE_NO_COPY_CLASS(classname) \ - private: \ - classname(const classname&); \ - classname& operator=(const classname&); - -#define DECLARE_NO_ASSIGN_CLASS(classname) \ - private: \ - classname& operator=(const classname&); - -/* --------------------------------------------------------------------------- */ -/* If a manifest is being automatically generated, add common controls 6 to it */ -/* --------------------------------------------------------------------------- */ - -#if (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \ - ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 ) - -#define WX_CC_MANIFEST(cpu) \ - "/manifestdependency:\"type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' \ - processorArchitecture='"cpu"' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"" - -#if defined _M_IX86 - #pragma comment(linker, WX_CC_MANIFEST("x86")) -#elif defined _M_X64 - #pragma comment(linker, WX_CC_MANIFEST("amd64")) -#elif defined _M_IA64 - #pragma comment(linker, WX_CC_MANIFEST("ia64")) -#else - #pragma comment(linker, WX_CC_MANIFEST("*")) -#endif - -#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */ - -#endif - /* _WX_DEFS_H_ */ diff --git a/Source/3rdParty/wx/include/wx/dialog.h b/Source/3rdParty/wx/include/wx/dialog.h deleted file mode 100644 index cf9dbf6c9..000000000 --- a/Source/3rdParty/wx/include/wx/dialog.h +++ /dev/null @@ -1,167 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dialog.h -// Purpose: wxDialogBase class -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.06.99 -// RCS-ID: $Id: dialog.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALOG_H_BASE_ -#define _WX_DIALOG_H_BASE_ - -#include "wx/defs.h" -#include "wx/containr.h" -#include "wx/toplevel.h" - -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer; - -#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window - -#ifdef __WXWINCE__ -#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) -#else -#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) -#endif - -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; - -class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow -{ -public: - enum - { - // all flags allowed in wxDialogBase::CreateButtonSizer() - ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT - }; - - wxDialogBase() { Init(); } - virtual ~wxDialogBase() { } - - // define public wxDialog methods to be implemented by the derived classes - virtual int ShowModal() = 0; - virtual void EndModal(int retCode) = 0; - virtual bool IsModal() const = 0; - - - // Modal dialogs have a return code - usually the id of the last - // pressed button - void SetReturnCode(int returnCode) { m_returnCode = returnCode; } - int GetReturnCode() const { return m_returnCode; } - - // Set the identifier for the affirmative button: this button will close - // the dialog after validating data and calling TransferDataFromWindow() - void SetAffirmativeId(int affirmativeId); - int GetAffirmativeId() const { return m_affirmativeId; } - - // Set identifier for Esc key translation: the button with this id will - // close the dialog without doing anything else; special value wxID_NONE - // means to not handle Esc at all while wxID_ANY means to map Esc to - // wxID_CANCEL if present and GetAffirmativeId() otherwise - void SetEscapeId(int escapeId); - int GetEscapeId() const { return m_escapeId; } - -#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL - // splits text up at newlines and places the - // lines into a vertical wxBoxSizer - wxSizer *CreateTextSizer( const wxString &message ); -#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL - - // returns a horizontal wxBoxSizer containing the given buttons - // - // notice that the returned sizer can be NULL if no buttons are put in the - // sizer (this mostly happens under smart phones and other atypical - // platforms which have hardware buttons replacing OK/Cancel and such) - wxSizer *CreateButtonSizer(long flags); - - // returns the sizer containing CreateButtonSizer() below a separating - // static line for the platforms which use static lines for items - // separation (i.e. not Mac) - wxSizer *CreateSeparatedButtonSizer(long flags); - -#if wxUSE_BUTTON - wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags ); -#endif // wxUSE_BUTTON - -protected: - // emulate click of a button with the given id if it's present in the dialog - // - // return true if button was "clicked" or false if we don't have it - bool EmulateButtonClickIfPresent(int id); - - // this function is used by OnCharHook() to decide whether the given key - // should close the dialog - // - // for most platforms the default implementation (which just checks for - // Esc) is sufficient, but Mac port also adds Cmd-. here and other ports - // could do something different if needed - virtual bool IsEscapeKey(const wxKeyEvent& event); - - // end either modal or modeless dialog, for the modal dialog rc is used as - // the dialog return code - void EndDialog(int rc); - - // call Validate() and TransferDataFromWindow() and close dialog with - // wxID_OK return code - void AcceptAndClose(); - - - // The return code from modal dialog - int m_returnCode; - - // The identifier for the affirmative button (usually wxID_OK) - int m_affirmativeId; - - // The identifier for cancel button (usually wxID_CANCEL) - int m_escapeId; - -private: - // common part of all ctors - void Init(); - - // handle Esc key presses - void OnCharHook(wxKeyEvent& event); - - // handle closing the dialog window - void OnCloseWindow(wxCloseEvent& event); - - // handle the standard buttons - void OnButton(wxCommandEvent& event); - - // update the background colour - void OnSysColourChanged(wxSysColourChangedEvent& event); - - - DECLARE_NO_COPY_CLASS(wxDialogBase) - DECLARE_EVENT_TABLE() - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) - #include "wx/univ/dialog.h" -#else - #if defined(__WXPALMOS__) - #include "wx/palmos/dialog.h" - #elif defined(__WXMSW__) - #include "wx/msw/dialog.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/dialog.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/dialog.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/dialog.h" - #elif defined(__WXMAC__) - #include "wx/mac/dialog.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dialog.h" - #elif defined(__WXPM__) - #include "wx/os2/dialog.h" - #endif -#endif - -#endif - // _WX_DIALOG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/dialup.h b/Source/3rdParty/wx/include/wx/dialup.h deleted file mode 100644 index b86e70cba..000000000 --- a/Source/3rdParty/wx/include/wx/dialup.h +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dialup.h -// Purpose: Network related wxWidgets classes and functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.07.99 -// RCS-ID: $Id: dialup.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALUP_H -#define _WX_DIALUP_H - -#if wxUSE_DIALUP_MANAGER - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") - -// ---------------------------------------------------------------------------- -// A class which groups functions dealing with connecting to the network from a -// workstation using dial-up access to the net. There is at most one instance -// of this class in the program accessed via GetDialUpManager(). -// ---------------------------------------------------------------------------- - -/* TODO - * - * 1. more configurability for Unix: i.e. how to initiate the connection, how - * to check for online status, &c. - * 2. a function to enumerate all connections (ISPs) and show a dialog in - * Dial() allowing to choose between them if no ISP given - * 3. add an async version of dialing functions which notify the caller about - * the progress (or may be even start another thread to monitor it) - * 4. the static creation/accessor functions are not MT-safe - but is this - * really crucial? I think we may suppose they're always called from the - * main thread? - */ - -class WXDLLEXPORT wxDialUpManager -{ -public: - // this function should create and return the object of the - // platform-specific class derived from wxDialUpManager. It's implemented - // in the platform-specific source files. - static wxDialUpManager *Create(); - - // could the dialup manager be initialized correctly? If this function - // returns false, no other functions will work neither, so it's a good idea - // to call this function and check its result before calling any other - // wxDialUpManager methods - virtual bool IsOk() const = 0; - - // virtual dtor for any base class - virtual ~wxDialUpManager() { } - - // operations - // ---------- - - // fills the array with the names of all possible values for the first - // parameter to Dial() on this machine and returns their number (may be 0) - virtual size_t GetISPNames(wxArrayString& names) const = 0; - - // dial the given ISP, use username and password to authentificate - // - // if no nameOfISP is given, the function will select the default one - // - // if no username/password are given, the function will try to do without - // them, but will ask the user if really needed - // - // if async parameter is false, the function waits until the end of dialing - // and returns true upon successful completion. - // if async is true, the function only initiates the connection and returns - // immediately - the result is reported via events (an event is sent - // anyhow, but if dialing failed it will be a DISCONNECTED one) - virtual bool Dial(const wxString& nameOfISP = wxEmptyString, - const wxString& username = wxEmptyString, - const wxString& password = wxEmptyString, - bool async = true) = 0; - - // returns true if (async) dialing is in progress - virtual bool IsDialing() const = 0; - - // cancel dialing the number initiated with Dial(async = true) - // NB: this won't result in DISCONNECTED event being sent - virtual bool CancelDialing() = 0; - - // hang up the currently active dial up connection - virtual bool HangUp() = 0; - - // online status - // ------------- - - // returns true if the computer has a permanent network connection (i.e. is - // on a LAN) and so there is no need to use Dial() function to go online - // - // NB: this functions tries to guess the result and it is not always - // guaranteed to be correct, so it's better to ask user for - // confirmation or give him a possibility to override it - virtual bool IsAlwaysOnline() const = 0; - - // returns true if the computer is connected to the network: under Windows, - // this just means that a RAS connection exists, under Unix we check that - // the "well-known host" (as specified by SetWellKnownHost) is reachable - virtual bool IsOnline() const = 0; - - // sometimes the built-in logic for determining the online status may fail, - // so, in general, the user should be allowed to override it. This function - // allows to forcefully set the online status - whatever our internal - // algorithm may think about it. - virtual void SetOnlineStatus(bool isOnline = true) = 0; - - // set misc wxDialUpManager options - // -------------------------------- - - // enable automatical checks for the connection status and sending of - // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval - // parameter is only for Unix where we do the check manually: under - // Windows, the notification about the change of connection status is - // instantenous. - // - // Returns false if couldn't set up automatic check for online status. - virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0; - - // disable automatic check for connection status change - notice that the - // wxEVT_DIALUP_XXX events won't be sent any more neither. - virtual void DisableAutoCheckOnlineStatus() = 0; - - // additional Unix-only configuration - // ---------------------------------- - - // under Unix, the value of well-known host is used to check whether we're - // connected to the internet. It's unused under Windows, but this function - // is always safe to call. The default value is www.yahoo.com. - virtual void SetWellKnownHost(const wxString& hostname, - int portno = 80) = 0; - - // Sets the commands to start up the network and to hang up again. Used by - // the Unix implementations only. - virtual void - SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"), - const wxString& commandHangup = wxT("/usr/bin/poff")) = 0; -}; - -// ---------------------------------------------------------------------------- -// wxDialUpManager events -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450) - DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451) -END_DECLARE_EVENT_TYPES() - -// the event class for the dialup events -class WXDLLEXPORT wxDialUpEvent : public wxEvent -{ -public: - wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) - { - SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED - : wxEVT_DIALUP_DISCONNECTED); - } - - // is this a CONNECTED or DISCONNECTED event? - bool IsConnectedEvent() const - { return GetEventType() == wxEVT_DIALUP_CONNECTED; } - - // does this event come from wxDialUpManager::Dial() or from some extrenal - // process (i.e. does it result from our own attempt to establish the - // connection)? - bool IsOwnEvent() const { return m_id != 0; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); } - -private: - DECLARE_NO_ASSIGN_CLASS(wxDialUpEvent) -}; - -// the type of dialup event handler function -typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); - -#define wxDialUpEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDialUpEventFunction, &func) - -// macros to catch dialup events -#define EVT_DIALUP_CONNECTED(func) \ - wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func)) -#define EVT_DIALUP_DISCONNECTED(func) \ - wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func)) - - -#endif // wxUSE_DIALUP_MANAGER - -#endif // _WX_DIALUP_H diff --git a/Source/3rdParty/wx/include/wx/dir.h b/Source/3rdParty/wx/include/wx/dir.h deleted file mode 100644 index 90cee0225..000000000 --- a/Source/3rdParty/wx/include/wx/dir.h +++ /dev/null @@ -1,161 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dir.h -// Purpose: wxDir is a class for enumerating the files in a directory -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.12.99 -// RCS-ID: $Id: dir.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIR_H_ -#define _WX_DIR_H_ - -#include "wx/longlong.h" -#include "wx/string.h" - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// these flags define what kind of filenames is included in the list of files -// enumerated by GetFirst/GetNext -enum -{ - wxDIR_FILES = 0x0001, // include files - wxDIR_DIRS = 0x0002, // include directories - wxDIR_HIDDEN = 0x0004, // include hidden files - wxDIR_DOTDOT = 0x0008, // include '.' and '..' - - // by default, enumerate everything except '.' and '..' - wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN -}; - -// these constants are possible return value of wxDirTraverser::OnDir() -enum wxDirTraverseResult -{ - wxDIR_IGNORE = -1, // ignore this directory but continue with others - wxDIR_STOP, // stop traversing - wxDIR_CONTINUE // continue into this directory -}; - -// ---------------------------------------------------------------------------- -// wxDirTraverser: helper class for wxDir::Traverse() -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDirTraverser -{ -public: - /// a virtual dtor has been provided since this class has virtual members - virtual ~wxDirTraverser() { } - // called for each file found by wxDir::Traverse() - // - // return wxDIR_STOP or wxDIR_CONTINUE from here (wxDIR_IGNORE doesn't - // make sense) - virtual wxDirTraverseResult OnFile(const wxString& filename) = 0; - - // called for each directory found by wxDir::Traverse() - // - // return one of the enum elements defined above - virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; - - // called for each directory which we couldn't open during our traversal - // of the directory tyree - // - // this method can also return either wxDIR_STOP, wxDIR_IGNORE or - // wxDIR_CONTINUE but the latter is treated specially: it means to retry - // opening the directory and so may lead to infinite loop if it is - // returned unconditionally, be careful with this! - // - // the base class version always returns wxDIR_IGNORE - virtual wxDirTraverseResult OnOpenError(const wxString& dirname); -}; - -// ---------------------------------------------------------------------------- -// wxDir: portable equivalent of {open/read/close}dir functions -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxDirData; - -class WXDLLIMPEXP_BASE wxDir -{ -public: - // test for existence of a directory with the given name - static bool Exists(const wxString& dir); - - // ctors - // ----- - - // default, use Open() - wxDir() { m_data = NULL; } - - // opens the directory for enumeration, use IsOpened() to test success - wxDir(const wxString& dir); - - // dtor cleans up the associated ressources - ~wxDir(); - - // open the directory for enumerating - bool Open(const wxString& dir); - - // returns true if the directory was successfully opened - bool IsOpened() const; - - // get the full name of the directory (without '/' at the end) - wxString GetName() const; - - // file enumeration routines - // ------------------------- - - // start enumerating all files matching filespec (or all files if it is - // empty) and flags, return true on success - bool GetFirst(wxString *filename, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT) const; - - // get next file in the enumeration started with GetFirst() - bool GetNext(wxString *filename) const; - - // return true if this directory has any files in it - bool HasFiles(const wxString& spec = wxEmptyString); - - // return true if this directory has any subdirectories - bool HasSubDirs(const wxString& spec = wxEmptyString); - - // enumerate all files in this directory and its subdirectories - // - // return the number of files found - size_t Traverse(wxDirTraverser& sink, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT) const; - - // simplest version of Traverse(): get the names of all files under this - // directory into filenames array, return the number of files - static size_t GetAllFiles(const wxString& dirname, - wxArrayString *files, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT); - - // check if there any files matching the given filespec under the given - // directory (i.e. searches recursively), return the file path if found or - // empty string otherwise - static wxString FindFirst(const wxString& dirname, - const wxString& filespec, - int flags = wxDIR_DEFAULT); - - // returns the size of all directories recursively found in given path - static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL); - -private: - friend class wxDirData; - - wxDirData *m_data; - - DECLARE_NO_COPY_CLASS(wxDir) -}; - -#endif // _WX_DIR_H_ - diff --git a/Source/3rdParty/wx/include/wx/dirdlg.h b/Source/3rdParty/wx/include/wx/dirdlg.h deleted file mode 100644 index 8c6d2f8fe..000000000 --- a/Source/3rdParty/wx/include/wx/dirdlg.h +++ /dev/null @@ -1,141 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dirdlg.h -// Purpose: wxDirDialog base class -// Author: Robert Roebling -// Modified by: -// Created: -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: dirdlg.h 44027 2006-12-21 19:26:48Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRDLG_H_BASE_ -#define _WX_DIRDLG_H_BASE_ - -#if wxUSE_DIRDLG - -#include "wx/dialog.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; - -#define wxDD_CHANGE_DIR 0x0100 -#define wxDD_DIR_MUST_EXIST 0x0200 - -// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it -#define wxDD_NEW_DIR_BUTTON 0 - -#ifdef __WXWINCE__ - #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE -#else - #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) -#endif - -//------------------------------------------------------------------------- -// wxDirDialogBase -//------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirDialogBase : public wxDialog -{ -public: - wxDirDialogBase() {} - wxDirDialogBase(wxWindow *parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxDirDialogNameStr) - { - Create(parent, title, defaultPath, style, pos, sz, name); - } - - virtual ~wxDirDialogBase() {} - - - bool Create(wxWindow *parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxDirDialogNameStr) - { - if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name)) - return false; - m_path = defaultPath; - m_message = title; - return true; - } - -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual void SetMessage(const wxString& message) { m_message = message; } - virtual void SetPath(const wxString& path) { m_path = path; } - - virtual wxString GetMessage() const { return m_message; } - virtual wxString GetPath() const { return m_path; } - -protected: - wxString m_message; - wxString m_path; -}; - - -// Universal and non-port related switches with need for generic implementation -#if defined(__WXUNIVERSAL__) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ - !wxUSE_OLE || \ - (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) - #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) - #include "wx/msw/dirdlg.h" // Native MSW -#elif defined(__WXGTK24__) - #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4 -#elif defined(__WXGTK__) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMAC__) - #include "wx/mac/dirdlg.h" // Native Mac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dirdlg.h" // Native Cocoa -#elif defined(__WXMOTIF__) || \ - defined(__WXX11__) || \ - defined(__WXMGL__) || \ - defined(__WXCOCOA__) || \ - defined(__WXPM__) - #include "wx/generic/dirdlgg.h" // Other ports use generic implementation - #define wxDirDialog wxGenericDirDialog -#endif - -// ---------------------------------------------------------------------------- -// common ::wxDirSelector() function -// ---------------------------------------------------------------------------- - -WXDLLEXPORT wxString -wxDirSelector(const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - wxWindow *parent = NULL); - -#endif // wxUSE_DIRDLG - -#endif - // _WX_DIRDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/display.h b/Source/3rdParty/wx/include/wx/display.h deleted file mode 100644 index 98a52ec30..000000000 --- a/Source/3rdParty/wx/include/wx/display.h +++ /dev/null @@ -1,128 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/display.h -// Purpose: wxDisplay class -// Author: Royce Mitchell III, Vadim Zeitlin -// Created: 06/21/02 -// RCS-ID: $Id: display.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2002-2006 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DISPLAY_H_BASE_ -#define _WX_DISPLAY_H_BASE_ - -// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but -// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 -// it becomes just a trivial wrapper around the old wxDisplayXXX() functions - -#if wxUSE_DISPLAY - #include "wx/dynarray.h" - #include "wx/vidmode.h" - - WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); - - // default, uninitialized, video mode object - extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode; -#endif // wxUSE_DISPLAY - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxPoint; -class WXDLLIMPEXP_FWD_CORE wxRect; -class WXDLLIMPEXP_FWD_BASE wxString; - -class WXDLLIMPEXP_FWD_CORE wxDisplayFactory; -class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; - -// ---------------------------------------------------------------------------- -// wxDisplay: represents a display/monitor attached to the system -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplay -{ -public: - // initialize the object containing all information about the given - // display - // - // the displays are numbered from 0 to GetCount() - 1, 0 is always the - // primary display and the only one which is always supported - wxDisplay(unsigned n = 0); - - // dtor is not virtual as this is a concrete class not meant to be derived - // from - ~wxDisplay(); - - - // return the number of available displays, valid parameters to - // wxDisplay ctor are from 0 up to this number - static unsigned GetCount(); - - // find the display where the given point lies, return wxNOT_FOUND if - // it doesn't belong to any display - static int GetFromPoint(const wxPoint& pt); - - // find the display where the given window lies, return wxNOT_FOUND if it - // is not shown at all - static int GetFromWindow(wxWindow *window); - - - // return true if the object was initialized successfully - bool IsOk() const { return m_impl != NULL; } - - // get the full display size - wxRect GetGeometry() const; - - // get the client area of the display, i.e. without taskbars and such - wxRect GetClientArea() const; - - // name may be empty - wxString GetName() const; - - // display 0 is usually the primary display - bool IsPrimary() const; - - -#if wxUSE_DISPLAY - // enumerate all video modes supported by this display matching the given - // one (in the sense of wxVideoMode::Match()) - // - // as any mode matches the default value of the argument and there is - // always at least one video mode supported by display, the returned array - // is only empty for the default value of the argument if this function is - // not supported at all on this platform - wxArrayVideoModes - GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; - - // get current video mode - wxVideoMode GetCurrentMode() const; - - // change current mode, return true if succeeded, false otherwise - // - // for the default value of the argument restores the video mode to default - bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); - - // restore the default video mode (just a more readable synonym) - void ResetMode() { (void)ChangeMode(); } -#endif // wxUSE_DISPLAY - -private: - // returns the factory used to implement our static methods and create new - // displays - static wxDisplayFactory& Factory(); - - // creates the factory object, called by Factory() when it is called for - // the first time and should return a pointer allocated with new (the - // caller will delete it) - // - // this method must be implemented in platform-specific code if - // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code) - static wxDisplayFactory *CreateFactory(); - - - // the real implementation - wxDisplayImpl *m_impl; - - - DECLARE_NO_COPY_CLASS(wxDisplay) -}; - -#endif // _WX_DISPLAY_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/display_impl.h b/Source/3rdParty/wx/include/wx/display_impl.h deleted file mode 100644 index 8c38f6522..000000000 --- a/Source/3rdParty/wx/include/wx/display_impl.h +++ /dev/null @@ -1,110 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/display_impl.h -// Purpose: wxDisplayImpl class declaration -// Author: Vadim Zeitlin -// Created: 2006-03-15 -// RCS-ID: $Id: display_impl.h 41548 2006-10-02 05:38:05Z PC $ -// Copyright: (c) 2002-2006 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DISPLAY_IMPL_H_BASE_ -#define _WX_DISPLAY_IMPL_H_BASE_ - -#include "wx/gdicmn.h" // for wxRect - -// ---------------------------------------------------------------------------- -// wxDisplayFactory: allows to create wxDisplay objects -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayFactory -{ -public: - wxDisplayFactory() { } - virtual ~wxDisplayFactory() { } - - // create a new display object - // - // it can return a NULL pointer if the display creation failed - virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; - - // get the total number of displays - virtual unsigned GetCount() = 0; - - // return the display for the given point or wxNOT_FOUND - virtual int GetFromPoint(const wxPoint& pt) = 0; - - // return the display for the given window or wxNOT_FOUND - // - // the window pointer must not be NULL (i.e. caller should check it) - virtual int GetFromWindow(wxWindow *window); -}; - -// ---------------------------------------------------------------------------- -// wxDisplayImpl: base class for all wxDisplay implementations -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayImpl -{ -public: - // virtual dtor for this base class - virtual ~wxDisplayImpl() { } - - - // return the full area of this display - virtual wxRect GetGeometry() const = 0; - - // return the area of the display available for normal windows - virtual wxRect GetClientArea() const { return GetGeometry(); } - - // return the name (may be empty) - virtual wxString GetName() const = 0; - - // return the index of this display - unsigned GetIndex() const { return m_index; } - - // return true if this is the primary monitor (usually one with index 0) - virtual bool IsPrimary() const { return GetIndex() == 0; } - - -#if wxUSE_DISPLAY - // implements wxDisplay::GetModes() - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0; - - // get current video mode - virtual wxVideoMode GetCurrentMode() const = 0; - - // change current mode, return true if succeeded, false otherwise - virtual bool ChangeMode(const wxVideoMode& mode) = 0; -#endif // wxUSE_DISPLAY - -protected: - // create the object providing access to the display with the given index - wxDisplayImpl(unsigned n) : m_index(n) { } - - - // the index of this display (0 is always the primary one) - const unsigned m_index; - - - friend class wxDisplayFactory; - - DECLARE_NO_COPY_CLASS(wxDisplayImpl) -}; - -// ---------------------------------------------------------------------------- -// wxDisplayFactorySingle -// ---------------------------------------------------------------------------- - -// this is a stub implementation using single/main display only, it is -// available even if wxUSE_DISPLAY == 0 -class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory -{ -public: - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount() { return 1; } - virtual int GetFromPoint(const wxPoint& pt); -}; - -#endif // _WX_DISPLAY_IMPL_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/dlimpexp.h b/Source/3rdParty/wx/include/wx/dlimpexp.h deleted file mode 100644 index 743785e04..000000000 --- a/Source/3rdParty/wx/include/wx/dlimpexp.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Name: wx/dlimpexp.h - * Purpose: Macros for declaring DLL-imported/exported functions - * Author: Vadim Zeitlin - * Modified by: - * Created: 16.10.2003 (extracted from wx/defs.h) - * RCS-ID: $Id: dlimpexp.h 49563 2007-10-31 20:46:21Z VZ $ - * Copyright: (c) 2003 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* - This is a C file, not C++ one, do not use C++ comments here! - */ - -#ifndef _WX_DLIMPEXP_H_ -#define _WX_DLIMPEXP_H_ - -#if defined(__WXMSW__) - /* - __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - as VC++ and gcc - */ -# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) -# define WXEXPORT __declspec(dllexport) -# define WXIMPORT __declspec(dllimport) -# else /* compiler doesn't support __declspec() */ -# define WXEXPORT -# define WXIMPORT -# endif -#elif defined(__WXPM__) -# if defined (__WATCOMC__) -# define WXEXPORT __declspec(dllexport) - /* - __declspec(dllimport) prepends __imp to imported symbols. We do NOT - want that! - */ -# define WXIMPORT -# elif defined(__EMX__) -# define WXEXPORT -# define WXIMPORT -# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) -# define WXEXPORT _Export -# define WXIMPORT _Export -# endif -#elif defined(__WXMAC__) || defined(__WXCOCOA__) -# ifdef __MWERKS__ -# define WXEXPORT __declspec(export) -# define WXIMPORT __declspec(import) -# endif -#elif defined(__CYGWIN__) -# define WXEXPORT __declspec(dllexport) -# define WXIMPORT __declspec(dllimport) -#endif - -/* for other platforms/compilers we don't anything */ -#ifndef WXEXPORT -# define WXEXPORT -# define WXIMPORT -#endif - -/* - We support building wxWidgets as a set of several libraries but we don't - support arbitrary combinations of libs/DLLs: either we build all of them as - DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). - - However we have a problem because we need separate WXDLLEXPORT versions for - different libraries as, for example, wxString class should be dllexported - when compiled in wxBase and dllimported otherwise, so we do define separate - WXMAKING/USINGDLL_XYZ constants for each component XYZ. - */ -#ifdef WXMAKINGDLL -# if wxUSE_BASE -# define WXMAKINGDLL_BASE -# endif - -# define WXMAKINGDLL_NET -# define WXMAKINGDLL_CORE -# define WXMAKINGDLL_ADV -# define WXMAKINGDLL_QA -# define WXMAKINGDLL_ODBC -# define WXMAKINGDLL_DBGRID -# define WXMAKINGDLL_HTML -# define WXMAKINGDLL_GL -# define WXMAKINGDLL_XML -# define WXMAKINGDLL_XRC -# define WXMAKINGDLL_AUI -# define WXMAKINGDLL_RICHTEXT -# define WXMAKINGDLL_MEDIA -#endif /* WXMAKINGDLL */ - -/* - WXDLLEXPORT maps to export declaration when building the DLL, to import - declaration if using it or to nothing at all if we don't use wxWin as DLL - */ -#ifdef WXMAKINGDLL_BASE -# define WXDLLIMPEXP_BASE WXEXPORT -# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_BASE WXIMPORT -# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_BASE -# define WXDLLIMPEXP_DATA_BASE(type) type -#endif - -#ifdef WXMAKINGDLL_NET -# define WXDLLIMPEXP_NET WXEXPORT -# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_NET WXIMPORT -# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_NET -# define WXDLLIMPEXP_DATA_NET(type) type -#endif - -#ifdef WXMAKINGDLL_CORE -# define WXDLLIMPEXP_CORE WXEXPORT -# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_CORE WXIMPORT -# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_CORE -# define WXDLLIMPEXP_DATA_CORE(type) type -#endif - -#ifdef WXMAKINGDLL_ADV -# define WXDLLIMPEXP_ADV WXEXPORT -# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_ADV WXIMPORT -# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_ADV -# define WXDLLIMPEXP_DATA_ADV(type) type -#endif - -#ifdef WXMAKINGDLL_ODBC -# define WXDLLIMPEXP_ODBC WXEXPORT -# define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_ODBC WXIMPORT -# define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_ODBC -# define WXDLLIMPEXP_DATA_ODBC(type) type -#endif - -#ifdef WXMAKINGDLL_QA -# define WXDLLIMPEXP_QA WXEXPORT -# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_QA WXIMPORT -# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_QA -# define WXDLLIMPEXP_DATA_QA(type) type -#endif - -#ifdef WXMAKINGDLL_DBGRID -# define WXDLLIMPEXP_DBGRID WXEXPORT -# define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_DBGRID WXIMPORT -# define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_DBGRID -# define WXDLLIMPEXP_DATA_DBGRID(type) type -#endif - -#ifdef WXMAKINGDLL_HTML -# define WXDLLIMPEXP_HTML WXEXPORT -# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_HTML WXIMPORT -# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_HTML -# define WXDLLIMPEXP_DATA_HTML(type) type -#endif - -#ifdef WXMAKINGDLL_GL -# define WXDLLIMPEXP_GL WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_GL WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_GL -#endif - -#ifdef WXMAKINGDLL_XML -# define WXDLLIMPEXP_XML WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_XML WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_XML -#endif - -#ifdef WXMAKINGDLL_XRC -# define WXDLLIMPEXP_XRC WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_XRC WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_XRC -#endif - -#ifdef WXMAKINGDLL_AUI -# define WXDLLIMPEXP_AUI WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_AUI WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_AUI -#endif - -#ifdef WXMAKINGDLL_RICHTEXT -# define WXDLLIMPEXP_RICHTEXT WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_RICHTEXT WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_RICHTEXT -#endif - -#ifdef WXMAKINGDLL_MEDIA -# define WXDLLIMPEXP_MEDIA WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_MEDIA WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_MEDIA -#endif - -/* for backwards compatibility, define suffix-less versions too */ -#define WXDLLEXPORT WXDLLIMPEXP_CORE -#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE - -/* wx-2.9 introduces new macros for forward declarations, include them - * here for forward compatibility: - - GCC warns about using __attribute__ (and also __declspec in mingw32 case) on - forward declarations while MSVC complains about forward declarations without - __declspec for the classes later declared with it, so we need a separate set - of macros for forward declarations to hide this difference: - */ -#if defined(__WINDOWS__) && defined(__GNUC__) - #define WXDLLIMPEXP_FWD_BASE - #define WXDLLIMPEXP_FWD_NET - #define WXDLLIMPEXP_FWD_CORE - #define WXDLLIMPEXP_FWD_ADV - #define WXDLLIMPEXP_FWD_QA - #define WXDLLIMPEXP_FWD_HTML - #define WXDLLIMPEXP_FWD_GL - #define WXDLLIMPEXP_FWD_XML - #define WXDLLIMPEXP_FWD_XRC - #define WXDLLIMPEXP_FWD_AUI - #define WXDLLIMPEXP_FWD_RICHTEXT - #define WXDLLIMPEXP_FWD_MEDIA - #define WXDLLIMPEXP_FWD_STC -#else - #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE - #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET - #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE - #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV - #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA - #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML - #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL - #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML - #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC - #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI - #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT - #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA - #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC -#endif - -#endif /* _WX_DLIMPEXP_H_ */ - diff --git a/Source/3rdParty/wx/include/wx/dnd.h b/Source/3rdParty/wx/include/wx/dnd.h deleted file mode 100644 index 62dbac117..000000000 --- a/Source/3rdParty/wx/include/wx/dnd.h +++ /dev/null @@ -1,267 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dnd.h -// Purpose: Drag and drop classes declarations -// Author: Vadim Zeitlin, Robert Roebling -// Modified by: -// Created: 26.05.99 -// RCS-ID: $Id: dnd.h 43636 2006-11-25 14:08:27Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DND_H_BASE_ -#define _WX_DND_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_DRAG_AND_DROP - -#include "wx/dataobj.h" -#include "wx/cursor.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// flags for wxDropSource::DoDragDrop() -// -// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1 -// (== TRUE) for compatibility with the old DoDragDrop(bool) method! -enum -{ - wxDrag_CopyOnly = 0, // allow only copying - wxDrag_AllowMove = 1, // allow moving (copying is always allowed) - wxDrag_DefaultMove = 3 // the default operation is move, not copy -}; - -// result of wxDropSource::DoDragDrop() call -enum wxDragResult -{ - wxDragError, // error prevented the d&d operation from completing - wxDragNone, // drag target didn't accept the data - wxDragCopy, // the data was successfully copied - wxDragMove, // the data was successfully moved (MSW only) - wxDragLink, // operation is a drag-link - wxDragCancel // the operation was cancelled by user (not an error) -}; - -// return true if res indicates that something was done during a dnd operation, -// i.e. is neither error nor none nor cancel -WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res); - -// ---------------------------------------------------------------------------- -// wxDropSource is the object you need to create (and call DoDragDrop on it) -// to initiate a drag-and-drop operation -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropSourceBase -{ -public: - wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor) - : m_cursorCopy(cursorCopy), - m_cursorMove(cursorMove), - m_cursorStop(cursorStop) - { m_data = (wxDataObject *)NULL; } - virtual ~wxDropSourceBase() { } - - // set the data which is transfered by drag and drop - void SetData(wxDataObject& data) - { m_data = &data; } - - wxDataObject *GetDataObject() - { return m_data; } - - // set the icon corresponding to given drag result - void SetCursor(wxDragResult res, const wxCursor& cursor) - { - if ( res == wxDragCopy ) - m_cursorCopy = cursor; - else if ( res == wxDragMove ) - m_cursorMove = cursor; - else - m_cursorStop = cursor; - } - - // start drag action, see enum wxDragResult for return value description - // - // if flags contains wxDrag_AllowMove, moving (and only copying) data is - // allowed, if it contains wxDrag_DefaultMove (which includes the previous - // flag), it is even the default operation - virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) = 0; - - // override to give feedback depending on the current operation result - // "effect" and return true if you did something, false to let the library - // give the default feedback - virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return false; } - -protected: - const wxCursor& GetCursor(wxDragResult res) const - { - if ( res == wxDragCopy ) - return m_cursorCopy; - else if ( res == wxDragMove ) - return m_cursorMove; - else - return m_cursorStop; - } - - // the data we're dragging - wxDataObject *m_data; - - // the cursors to use for feedback - wxCursor m_cursorCopy, - m_cursorMove, - m_cursorStop; - - DECLARE_NO_COPY_CLASS(wxDropSourceBase) -}; - -// ---------------------------------------------------------------------------- -// wxDropTarget should be associated with a window if it wants to be able to -// receive data via drag and drop. -// -// To use this class, you should derive from wxDropTarget and implement -// OnData() pure virtual method. You may also wish to override OnDrop() if you -// want to accept the data only inside some region of the window (this may -// avoid having to copy the data to this application which happens only when -// OnData() is called) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropTargetBase -{ -public: - // ctor takes a pointer to heap-allocated wxDataObject which will be owned - // by wxDropTarget and deleted by it automatically. If you don't give it - // here, you can use SetDataObject() later. - wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL) - { m_dataObject = dataObject; m_defaultAction = wxDragNone; } - // dtor deletes our data object - virtual ~wxDropTargetBase() - { delete m_dataObject; } - - // get/set the associated wxDataObject - wxDataObject *GetDataObject() const - { return m_dataObject; } - void SetDataObject(wxDataObject *dataObject) - { if (m_dataObject) delete m_dataObject; - m_dataObject = dataObject; } - - // these functions are called when data is moved over position (x, y) and - // may return either wxDragCopy, wxDragMove or wxDragNone depending on - // what would happen if the data were dropped here. - // - // the last parameter is what would happen by default and is determined by - // the platform-specific logic (for example, under Windows it's wxDragCopy - // if Ctrl key is pressed and wxDragMove otherwise) except that it will - // always be wxDragNone if the carried data is in an unsupported format. - - // called when the mouse enters the window (only once until OnLeave()) - virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) - { return OnDragOver(x, y, def); } - - // called when the mouse moves in the window - shouldn't take long to - // execute or otherwise mouse movement would be too slow - virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - wxDragResult def) - { return def; } - - // called when mouse leaves the window: might be used to remove the - // feedback which was given in OnEnter() - virtual void OnLeave() { } - - // this function is called when data is dropped at position (x, y) - if it - // returns true, OnData() will be called immediately afterwards which will - // allow to retrieve the data dropped. - virtual bool OnDrop(wxCoord x, wxCoord y) = 0; - - // called after OnDrop() returns TRUE: you will usually just call - // GetData() from here and, probably, also refresh something to update the - // new data and, finally, return the code indicating how did the operation - // complete (returning default value in case of success and wxDragError on - // failure is usually ok) - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0; - - // may be called *only* from inside OnData() and will fill m_dataObject - // with the data from the drop source if it returns true - virtual bool GetData() = 0; - - // sets the default action for drag and drop: - // use wxDragMove or wxDragCopy to set deafult action to move or copy - // and use wxDragNone (default) to set default action specified by - // initialization of draging (see wxDropSourceBase::DoDragDrop()) - void SetDefaultAction(wxDragResult action) - { m_defaultAction = action; } - - // returns default action for drag and drop or - // wxDragNone if this not specified - wxDragResult GetDefaultAction() - { return m_defaultAction; } - -protected: - wxDataObject *m_dataObject; - wxDragResult m_defaultAction; - - DECLARE_NO_COPY_CLASS(wxDropTargetBase) -}; - -// ---------------------------------------------------------------------------- -// include platform dependent class declarations -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dropsrc.h" - #include "wx/msw/ole/droptgt.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dnd.h" -#elif defined(__WXX11__) - #include "wx/x11/dnd.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dnd.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dnd.h" -#elif defined(__WXMAC__) - #include "wx/mac/dnd.h" -#elif defined(__WXPM__) - #include "wx/os2/dnd.h" -#endif - -// ---------------------------------------------------------------------------- -// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp) -// ---------------------------------------------------------------------------- - -// A simple wxDropTarget derived class for text data: you only need to -// override OnDropText() to get something working -class WXDLLEXPORT wxTextDropTarget : public wxDropTarget -{ -public: - wxTextDropTarget(); - - virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; - - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); - -private: - DECLARE_NO_COPY_CLASS(wxTextDropTarget) -}; - -// A drop target which accepts files (dragged from File Manager or Explorer) -class WXDLLEXPORT wxFileDropTarget : public wxDropTarget -{ -public: - wxFileDropTarget(); - - // parameters are the number of files and the array of file names - virtual bool OnDropFiles(wxCoord x, wxCoord y, - const wxArrayString& filenames) = 0; - - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); - -private: - DECLARE_NO_COPY_CLASS(wxFileDropTarget) -}; - -#endif // wxUSE_DRAG_AND_DROP - -#endif // _WX_DND_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/docmdi.h b/Source/3rdParty/wx/include/wx/docmdi.h deleted file mode 100644 index d4d7fcfed..000000000 --- a/Source/3rdParty/wx/include/wx/docmdi.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: docmdi.h -// Purpose: Frame classes for MDI document/view applications -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docmdi.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DOCMDI_H_ -#define _WX_DOCMDI_H_ - -#include "wx/defs.h" - -#if wxUSE_MDI_ARCHITECTURE - -#include "wx/docview.h" -#include "wx/mdi.h" - -/* - * Use this instead of wxMDIParentFrame - */ - -class WXDLLEXPORT wxDocMDIParentFrame: public wxMDIParentFrame -{ -public: - wxDocMDIParentFrame(); - wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - - bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - - // Extend event processing to search the document manager's event table - virtual bool ProcessEvent(wxEvent& event); - - wxDocManager *GetDocumentManager(void) const { return m_docManager; } - - void OnExit(wxCommandEvent& event); - void OnMRUFile(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent& event); - -protected: - void Init(); - wxDocManager *m_docManager; - -private: - DECLARE_CLASS(wxDocMDIParentFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocMDIParentFrame) -}; - -/* - * Use this instead of wxMDIChildFrame - */ - -class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame -{ -public: - wxDocMDIChildFrame(); - wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - virtual ~wxDocMDIChildFrame(); - - bool Create(wxDocument *doc, - wxView *view, - wxMDIParentFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - void OnActivate(wxActivateEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - inline wxDocument *GetDocument() const { return m_childDocument; } - inline wxView *GetView(void) const { return m_childView; } - inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } - inline void SetView(wxView *view) { m_childView = view; } - bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } - -protected: - void Init(); - wxDocument* m_childDocument; - wxView* m_childView; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxDocMDIChildFrame) - DECLARE_NO_COPY_CLASS(wxDocMDIChildFrame) -}; - -#endif - // wxUSE_MDI_ARCHITECTURE - -#endif - // _WX_DOCMDI_H_ diff --git a/Source/3rdParty/wx/include/wx/docview.h b/Source/3rdParty/wx/include/wx/docview.h deleted file mode 100644 index c19bae19d..000000000 --- a/Source/3rdParty/wx/include/wx/docview.h +++ /dev/null @@ -1,675 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/docview.h -// Purpose: Doc/View classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docview.h 53546 2008-05-10 21:02:36Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DOCH__ -#define _WX_DOCH__ - -#include "wx/defs.h" - -#if wxUSE_DOC_VIEW_ARCHITECTURE - -#include "wx/list.h" -#include "wx/string.h" -#include "wx/frame.h" - -#if wxUSE_PRINTING_ARCHITECTURE - #include "wx/print.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxDocument; -class WXDLLIMPEXP_FWD_CORE wxView; -class WXDLLIMPEXP_FWD_CORE wxDocTemplate; -class WXDLLIMPEXP_FWD_CORE wxDocManager; -class WXDLLIMPEXP_FWD_CORE wxPrintInfo; -class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; -class WXDLLIMPEXP_FWD_CORE wxFileHistory; -class WXDLLIMPEXP_FWD_BASE wxConfigBase; - -#if wxUSE_STD_IOSTREAM - #include "wx/iosfwrap.h" -#else - #include "wx/stream.h" -#endif - -// Document manager flags -enum -{ - wxDOC_SDI = 1, - wxDOC_MDI, - wxDOC_NEW, - wxDOC_SILENT, - wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI -}; - -// Document template flags -enum -{ - wxTEMPLATE_VISIBLE = 1, - wxTEMPLATE_INVISIBLE, - wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE -}; - -#define wxMAX_FILE_HISTORY 9 - -class WXDLLEXPORT wxDocument : public wxEvtHandler -{ -public: - wxDocument(wxDocument *parent = (wxDocument *) NULL); - virtual ~wxDocument(); - - // accessors - void SetFilename(const wxString& filename, bool notifyViews = false); - wxString GetFilename() const { return m_documentFile; } - - void SetTitle(const wxString& title) { m_documentTitle = title; } - wxString GetTitle() const { return m_documentTitle; } - - void SetDocumentName(const wxString& name) { m_documentTypeName = name; } - wxString GetDocumentName() const { return m_documentTypeName; } - - bool GetDocumentSaved() const { return m_savedYet; } - void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } - - virtual bool Close(); - virtual bool Save(); - virtual bool SaveAs(); - virtual bool Revert(); - -#if wxUSE_STD_IOSTREAM - virtual wxSTD ostream& SaveObject(wxSTD ostream& stream); - virtual wxSTD istream& LoadObject(wxSTD istream& stream); -#else - virtual wxOutputStream& SaveObject(wxOutputStream& stream); - virtual wxInputStream& LoadObject(wxInputStream& stream); -#endif - - // Called by wxWidgets - virtual bool OnSaveDocument(const wxString& filename); - virtual bool OnOpenDocument(const wxString& filename); - virtual bool OnNewDocument(); - virtual bool OnCloseDocument(); - - // Prompts for saving if about to close a modified document. Returns true - // if ok to close the document (may have saved in the meantime, or set - // modified to false) - virtual bool OnSaveModified(); - - // Called by framework if created automatically by the default document - // manager: gives document a chance to initialise and (usually) create a - // view - virtual bool OnCreate(const wxString& path, long flags); - - // By default, creates a base wxCommandProcessor. - virtual wxCommandProcessor *OnCreateCommandProcessor(); - virtual wxCommandProcessor *GetCommandProcessor() const { return m_commandProcessor; } - virtual void SetCommandProcessor(wxCommandProcessor *proc) { m_commandProcessor = proc; } - - // Called after a view is added or removed. The default implementation - // deletes the document if this is there are no more views. - virtual void OnChangedViewList(); - - virtual bool DeleteContents(); - - virtual bool Draw(wxDC&); - virtual bool IsModified() const { return m_documentModified; } - virtual void Modify(bool mod) { m_documentModified = mod; } - - virtual bool AddView(wxView *view); - virtual bool RemoveView(wxView *view); - wxList& GetViews() { return m_documentViews; } - const wxList& GetViews() const { return m_documentViews; } - wxView *GetFirstView() const; - - virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL); - virtual void NotifyClosing(); - - // Remove all views (because we're closing the document) - virtual bool DeleteAllViews(); - - // Other stuff - virtual wxDocManager *GetDocumentManager() const; - virtual wxDocTemplate *GetDocumentTemplate() const { return m_documentTemplate; } - virtual void SetDocumentTemplate(wxDocTemplate *temp) { m_documentTemplate = temp; } - - // Get title, or filename if no title, else [unnamed] - // - // NB: this method will be deprecated in wxWidgets 3.0, you still need to - // override it if you need to modify the existing behaviour in this - // version but use GetUserReadableName() below if you just need to call - // it - virtual bool GetPrintableName(wxString& buf) const; - -#if wxABI_VERSION >= 20805 - wxString GetUserReadableName() const - { - wxString s; - GetPrintableName(s); - return s; - } -#endif // wxABI 2.8.5+ - - // Returns a window that can be used as a parent for document-related - // dialogs. Override if necessary. - virtual wxWindow *GetDocumentWindow() const; - -protected: - wxList m_documentViews; - wxString m_documentFile; - wxString m_documentTitle; - wxString m_documentTypeName; - wxDocTemplate* m_documentTemplate; - bool m_documentModified; - wxDocument* m_documentParent; - wxCommandProcessor* m_commandProcessor; - bool m_savedYet; - - // Called by OnSaveDocument and OnOpenDocument to implement standard - // Save/Load behavior. Re-implement in derived class for custom - // behavior. - virtual bool DoSaveDocument(const wxString& file); - virtual bool DoOpenDocument(const wxString& file); - -private: - DECLARE_ABSTRACT_CLASS(wxDocument) - DECLARE_NO_COPY_CLASS(wxDocument) -}; - -class WXDLLEXPORT wxView: public wxEvtHandler -{ -public: - // wxView(wxDocument *doc = (wxDocument *) NULL); - wxView(); - virtual ~wxView(); - - wxDocument *GetDocument() const { return m_viewDocument; } - virtual void SetDocument(wxDocument *doc); - - wxString GetViewName() const { return m_viewTypeName; } - void SetViewName(const wxString& name) { m_viewTypeName = name; } - - wxWindow *GetFrame() const { return m_viewFrame ; } - void SetFrame(wxWindow *frame) { m_viewFrame = frame; } - - virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); - virtual void OnDraw(wxDC *dc) = 0; - virtual void OnPrint(wxDC *dc, wxObject *info); - virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); - virtual void OnClosingDocument() {} - virtual void OnChangeFilename(); - - // Called by framework if created automatically by the default document - // manager class: gives view a chance to initialise - virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) { return true; } - - // Checks if the view is the last one for the document; if so, asks user - // to confirm save data (if modified). If ok, deletes itself and returns - // true. - virtual bool Close(bool deleteWindow = true); - - // Override to do cleanup/veto close - virtual bool OnClose(bool deleteWindow); - - // Extend event processing to search the document's event table - virtual bool ProcessEvent(wxEvent& event); - - // A view's window can call this to notify the view it is (in)active. - // The function then notifies the document manager. - virtual void Activate(bool activate); - - wxDocManager *GetDocumentManager() const - { return m_viewDocument->GetDocumentManager(); } - -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxPrintout *OnCreatePrintout(); -#endif - -protected: - wxDocument* m_viewDocument; - wxString m_viewTypeName; - wxWindow* m_viewFrame; - -private: - DECLARE_ABSTRACT_CLASS(wxView) - DECLARE_NO_COPY_CLASS(wxView) -}; - -// Represents user interface (and other) properties of documents and views -class WXDLLEXPORT wxDocTemplate: public wxObject -{ - -friend class WXDLLIMPEXP_FWD_CORE wxDocManager; - -public: - // Associate document and view types. They're for identifying what view is - // associated with what template/document type - wxDocTemplate(wxDocManager *manager, - const wxString& descr, - const wxString& filter, - const wxString& dir, - const wxString& ext, - const wxString& docTypeName, - const wxString& viewTypeName, - wxClassInfo *docClassInfo = (wxClassInfo *) NULL, - wxClassInfo *viewClassInfo = (wxClassInfo *)NULL, - long flags = wxDEFAULT_TEMPLATE_FLAGS); - - virtual ~wxDocTemplate(); - - // By default, these two member functions dynamically creates document and - // view using dynamic instance construction. Override these if you need a - // different method of construction. - virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); - virtual wxView *CreateView(wxDocument *doc, long flags = 0); - - // Helper method for CreateDocument; also allows you to do your own document - // creation - virtual bool InitDocument(wxDocument* doc, const wxString& path, long flags = 0); - - wxString GetDefaultExtension() const { return m_defaultExt; } - wxString GetDescription() const { return m_description; } - wxString GetDirectory() const { return m_directory; } - wxDocManager *GetDocumentManager() const { return m_documentManager; } - void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; } - wxString GetFileFilter() const { return m_fileFilter; } - long GetFlags() const { return m_flags; } - virtual wxString GetViewName() const { return m_viewTypeName; } - virtual wxString GetDocumentName() const { return m_docTypeName; } - - void SetFileFilter(const wxString& filter) { m_fileFilter = filter; } - void SetDirectory(const wxString& dir) { m_directory = dir; } - void SetDescription(const wxString& descr) { m_description = descr; } - void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } - void SetFlags(long flags) { m_flags = flags; } - - bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); } - - wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } - wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } - - virtual bool FileMatchesTemplate(const wxString& path); - -protected: - long m_flags; - wxString m_fileFilter; - wxString m_directory; - wxString m_description; - wxString m_defaultExt; - wxString m_docTypeName; - wxString m_viewTypeName; - wxDocManager* m_documentManager; - - // For dynamic creation of appropriate instances. - wxClassInfo* m_docClassInfo; - wxClassInfo* m_viewClassInfo; - - // Called by CreateDocument and CreateView to create the actual document/view object. - // By default uses the ClassInfo provided to the constructor. Override these functions - // to provide a different method of creation. - virtual wxDocument *DoCreateDocument(); - virtual wxView *DoCreateView(); - -private: - DECLARE_CLASS(wxDocTemplate) - DECLARE_NO_COPY_CLASS(wxDocTemplate) -}; - -// One object of this class may be created in an application, to manage all -// the templates and documents. -class WXDLLEXPORT wxDocManager: public wxEvtHandler -{ -public: - wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = true); - virtual ~wxDocManager(); - - virtual bool Initialize(); - - // Handlers for common user commands - void OnFileClose(wxCommandEvent& event); - void OnFileCloseAll(wxCommandEvent& event); - void OnFileNew(wxCommandEvent& event); - void OnFileOpen(wxCommandEvent& event); - void OnFileRevert(wxCommandEvent& event); - void OnFileSave(wxCommandEvent& event); - void OnFileSaveAs(wxCommandEvent& event); - void OnPrint(wxCommandEvent& event); - void OnPreview(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - - // Handlers for UI update commands - void OnUpdateFileOpen(wxUpdateUIEvent& event); - void OnUpdateFileClose(wxUpdateUIEvent& event); - void OnUpdateFileRevert(wxUpdateUIEvent& event); - void OnUpdateFileNew(wxUpdateUIEvent& event); - void OnUpdateFileSave(wxUpdateUIEvent& event); - void OnUpdateFileSaveAs(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - - void OnUpdatePrint(wxUpdateUIEvent& event); - void OnUpdatePreview(wxUpdateUIEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - // called when file format detection didn't work, can be overridden to do - // something in this case - virtual void OnOpenFileFailure() { } - - virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); - virtual wxView *CreateView(wxDocument *doc, long flags = 0); - virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); - virtual bool FlushDoc(wxDocument *doc); - virtual wxDocTemplate *MatchTemplate(const wxString& path); - virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates, - int noTemplates, wxString& path, long flags, bool save = false); - virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates, - int noTemplates, bool sort = false); - virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates, - int noTemplates, bool sort = false); - virtual wxDocTemplate *FindTemplateForPath(const wxString& path); - - void AssociateTemplate(wxDocTemplate *temp); - void DisassociateTemplate(wxDocTemplate *temp); - - wxDocument *GetCurrentDocument() const; - - void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } - int GetMaxDocsOpen() const { return m_maxDocsOpen; } - - // Add and remove a document from the manager's list - void AddDocument(wxDocument *doc); - void RemoveDocument(wxDocument *doc); - - // closes all currently open documents - bool CloseDocuments(bool force = true); - - // closes the specified document - bool CloseDocument(wxDocument* doc, bool force = false); - - // Clear remaining documents and templates - bool Clear(bool force = true); - - // Views or windows should inform the document manager - // when a view is going in or out of focus - virtual void ActivateView(wxView *view, bool activate = true); - virtual wxView *GetCurrentView() const; - - wxList& GetDocuments() { return m_docs; } - wxList& GetTemplates() { return m_templates; } - - // Make a default document name - // - // NB: this method is renamed to MakeNewDocumentName() in wx 3.0, you still - // need to override it if your code needs to customize the default name - // generation but if you just use it from your code, prefer the version - // below which is forward-compatible with wx 3.0 - virtual bool MakeDefaultName(wxString& buf); - -#if wxABI_VERSION >= 20808 - wxString MakeNewDocumentName() const - { - wxString s; - wx_const_cast(wxDocManager *, this)->MakeDefaultName(s); - return s; - } -#endif // wx ABI >= 2.8.8 - - // Make a frame title (override this to do something different) - virtual wxString MakeFrameTitle(wxDocument* doc); - - virtual wxFileHistory *OnCreateFileHistory(); - virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; } - - // File history management - virtual void AddFileToHistory(const wxString& file); - virtual void RemoveFileFromHistory(size_t i); - virtual size_t GetHistoryFilesCount() const; - virtual wxString GetHistoryFile(size_t i) const; - virtual void FileHistoryUseMenu(wxMenu *menu); - virtual void FileHistoryRemoveMenu(wxMenu *menu); -#if wxUSE_CONFIG - virtual void FileHistoryLoad(wxConfigBase& config); - virtual void FileHistorySave(wxConfigBase& config); -#endif // wxUSE_CONFIG - - virtual void FileHistoryAddFilesToMenu(); - virtual void FileHistoryAddFilesToMenu(wxMenu* menu); - - wxString GetLastDirectory() const { return m_lastDirectory; } - void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } - - // Get the current document manager - static wxDocManager* GetDocumentManager() { return sm_docManager; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetHistoryFilesCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - long m_flags; - int m_defaultDocumentNameCounter; - int m_maxDocsOpen; - wxList m_docs; - wxList m_templates; - wxView* m_currentView; - wxFileHistory* m_fileHistory; - wxString m_lastDirectory; - static wxDocManager* sm_docManager; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxDocManager) - DECLARE_NO_COPY_CLASS(wxDocManager) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxDocManager::GetNoHistoryFiles() const -{ - return GetHistoryFilesCount(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// A default child frame -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDocChildFrame : public wxFrame -{ -public: - wxDocChildFrame(wxDocument *doc, - wxView *view, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxT("frame")); - virtual ~wxDocChildFrame(){} - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - void OnActivate(wxActivateEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - wxDocument *GetDocument() const { return m_childDocument; } - wxView *GetView() const { return m_childView; } - void SetDocument(wxDocument *doc) { m_childDocument = doc; } - void SetView(wxView *view) { m_childView = view; } - bool Destroy() { m_childView = (wxView *)NULL; return wxFrame::Destroy(); } - -protected: - wxDocument* m_childDocument; - wxView* m_childView; - -private: - DECLARE_CLASS(wxDocChildFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocChildFrame) -}; - -// ---------------------------------------------------------------------------- -// A default parent frame -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDocParentFrame : public wxFrame -{ -public: - wxDocParentFrame(); - wxDocParentFrame(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - bool Create(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // Extend event processing to search the document manager's event table - virtual bool ProcessEvent(wxEvent& event); - - wxDocManager *GetDocumentManager() const { return m_docManager; } - - void OnExit(wxCommandEvent& event); - void OnMRUFile(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent& event); - -protected: - wxDocManager *m_docManager; - -private: - typedef wxFrame base_type; - DECLARE_CLASS(wxDocParentFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocParentFrame) -}; - -// ---------------------------------------------------------------------------- -// Provide simple default printing facilities -// ---------------------------------------------------------------------------- - -#if wxUSE_PRINTING_ARCHITECTURE -class WXDLLEXPORT wxDocPrintout : public wxPrintout -{ -public: - wxDocPrintout(wxView *view = (wxView *) NULL, const wxString& title = wxT("Printout")); - bool OnPrintPage(int page); - bool HasPage(int page); - bool OnBeginDocument(int startPage, int endPage); - void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); - - virtual wxView *GetView() { return m_printoutView; } - -protected: - wxView* m_printoutView; - -private: - DECLARE_DYNAMIC_CLASS(wxDocPrintout) - DECLARE_NO_COPY_CLASS(wxDocPrintout) -}; -#endif // wxUSE_PRINTING_ARCHITECTURE - -// ---------------------------------------------------------------------------- -// File history management -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileHistory : public wxObject -{ -public: - wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); - virtual ~wxFileHistory(); - - // Operations - virtual void AddFileToHistory(const wxString& file); - virtual void RemoveFileFromHistory(size_t i); - virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } - virtual void UseMenu(wxMenu *menu); - - // Remove menu from the list (MDI child may be closing) - virtual void RemoveMenu(wxMenu *menu); - -#if wxUSE_CONFIG - virtual void Load(wxConfigBase& config); - virtual void Save(wxConfigBase& config); -#endif // wxUSE_CONFIG - - virtual void AddFilesToMenu(); - virtual void AddFilesToMenu(wxMenu* menu); // Single menu - - // Accessors - virtual wxString GetHistoryFile(size_t i) const; - virtual size_t GetCount() const { return m_fileHistoryN; } - - const wxList& GetMenus() const { return m_fileMenus; } - -#if wxABI_VERSION >= 20802 - // Set/get base id - void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } - wxWindowID GetBaseId() const { return m_idBase; } -#endif // wxABI 2.8.2+ - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // Last n files - wxChar** m_fileHistory; - // Number of files saved - size_t m_fileHistoryN; - // Menus to maintain (may need several for an MDI app) - wxList m_fileMenus; - // Max files to maintain - size_t m_fileMaxFiles; - -private: - // The ID of the first history menu item (Doesn't have to be wxID_FILE1) - wxWindowID m_idBase; - - DECLARE_DYNAMIC_CLASS(wxFileHistory) - DECLARE_NO_COPY_CLASS(wxFileHistory) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxFileHistory::GetNoHistoryFiles() const -{ - return m_fileHistoryN; -} -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_STD_IOSTREAM -// For compatibility with existing file formats: -// converts from/to a stream to/from a temporary file. -bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); -bool WXDLLEXPORT wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); -#else -// For compatibility with existing file formats: -// converts from/to a stream to/from a temporary file. -bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); -bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); -#endif // wxUSE_STD_IOSTREAM - -#endif // wxUSE_DOC_VIEW_ARCHITECTURE - -#endif // _WX_DOCH__ diff --git a/Source/3rdParty/wx/include/wx/dynarray.h b/Source/3rdParty/wx/include/wx/dynarray.h deleted file mode 100644 index 3cde91ae7..000000000 --- a/Source/3rdParty/wx/include/wx/dynarray.h +++ /dev/null @@ -1,1044 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dynarray.h -// Purpose: auto-resizable (i.e. dynamic) array support -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.97 -// RCS-ID: $Id: dynarray.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _DYNARRAY_H -#define _DYNARRAY_H - -#include "wx/defs.h" - -#if wxUSE_STL - #include "wx/beforestd.h" - #include - #include - #include "wx/afterstd.h" -#endif - -/* - This header defines the dynamic arrays and object arrays (i.e. arrays which - own their elements). Dynamic means that the arrays grow automatically as - needed. - - These macros are ugly (especially if you look in the sources ;-), but they - allow us to define "template" classes without actually using templates and so - this works with all compilers (and may be also much faster to compile even - with a compiler which does support templates). The arrays defined with these - macros are type-safe. - - Range checking is performed in debug build for both arrays and objarrays but - not in release build - so using an invalid index will just lead to a crash - then. - - Note about memory usage: arrays never shrink automatically (although you may - use Shrink() function explicitly), they only grow, so loading 10 millions in - an array only to delete them 2 lines below might be a bad idea if the array - object is not going to be destroyed soon. However, as it does free memory - when destroyed, it is ok if the array is a local variable. - */ - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -/* - The initial size by which an array grows when an element is added default - value avoids allocate one or two bytes when the array is created which is - rather inefficient -*/ -#define WX_ARRAY_DEFAULT_INITIAL_SIZE (16) - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -/* - Callback compare function for quick sort. - - It must return negative value, 0 or positive value if the first item is - less than, equal to or greater than the second one. - */ -extern "C" -{ -typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); -} - -// ---------------------------------------------------------------------------- -// Base class managing data having size of type 'long' (not used directly) -// -// NB: for efficiency this often used class has no virtual functions (hence no -// virtual table), even dtor is *not* virtual. If used as expected it -// won't create any problems because ARRAYs from DEFINE_ARRAY have no dtor -// at all, so it's not too important if it's not called (this happens when -// you cast "SomeArray *" as "BaseArray *" and then delete it) -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -template -class WXDLLIMPEXP_BASE wxArray_SortFunction -{ -public: - typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2); - - wxArray_SortFunction(CMPFUNC f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f((T*)&i1, (T*)&i2) < 0; } -private: - CMPFUNC m_f; -}; - -template -class WXDLLIMPEXP_BASE wxSortedArray_SortFunction -{ -public: - typedef F CMPFUNC; - - wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f(i1, i2) < 0; } -private: - CMPFUNC m_f; -}; - -#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ - typedef int (wxCMPFUNC_CONV *CMPFUN##name)(T pItem1, T pItem2); \ - typedef wxSortedArray_SortFunction name##_Predicate; \ - _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp) - -#define _WX_DECLARE_BASEARRAY_2(T, name, predicate, classexp) \ -classexp name : public std::vector \ -{ \ - typedef predicate Predicate; \ - typedef predicate::CMPFUNC SCMPFUNC; \ -public: \ - typedef wxArray_SortFunction::CMPFUNC CMPFUNC; \ -public: \ - void Empty() { clear(); } \ - void Clear() { clear(); } \ - void Alloc(size_t uiSize) { reserve(uiSize); } \ - void Shrink(); \ - \ - size_t GetCount() const { return size(); } \ - void SetCount(size_t n, T v = T()) { resize(n, v); } \ - bool IsEmpty() const { return empty(); } \ - size_t Count() const { return size(); } \ - \ - typedef T base_type; \ - \ -protected: \ - T& Item(size_t uiIndex) const \ - { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); } \ - \ - int Index(T e, bool bFromEnd = false) const; \ - int Index(T lItem, CMPFUNC fnCompare) const; \ - size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ - void Add(T lItem, size_t nInsert = 1) \ - { insert(end(), nInsert, lItem); } \ - size_t Add(T lItem, CMPFUNC fnCompare); \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { insert(begin() + uiIndex, nInsert, lItem); } \ - void Remove(T lItem); \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ - \ - void Sort(CMPFUNC fCmp) \ - { \ - wxArray_SortFunction p(fCmp); \ - std::sort(begin(), end(), p); \ - } \ -} - -#else // if !wxUSE_STL - -#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ -classexp name \ -{ \ - typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STL */ \ -public: \ - name(); \ - name(const name& array); \ - name& operator=(const name& src); \ - ~name(); \ - \ - void Empty() { m_nCount = 0; } \ - void Clear(); \ - void Alloc(size_t n) { if ( n > m_nSize ) Realloc(n); } \ - void Shrink(); \ - \ - size_t GetCount() const { return m_nCount; } \ - void SetCount(size_t n, T defval = T()); \ - bool IsEmpty() const { return m_nCount == 0; } \ - size_t Count() const { return m_nCount; } \ - \ - typedef T base_type; \ - \ -protected: \ - T& Item(size_t uiIndex) const \ - { wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; } \ - T& operator[](size_t uiIndex) const { return Item(uiIndex); } \ - \ - int Index(T lItem, bool bFromEnd = false) const; \ - int Index(T lItem, CMPFUNC fnCompare) const; \ - size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ - void Add(T lItem, size_t nInsert = 1); \ - size_t Add(T lItem, CMPFUNC fnCompare); \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1); \ - void Remove(T lItem); \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ - \ - void Sort(CMPFUNC fnCompare); \ - \ - /* *minimal* STL-ish interface, for derived classes */ \ - typedef T value_type; \ - typedef value_type* iterator; \ - typedef const value_type* const_iterator; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef int difference_type; \ - typedef size_t size_type; \ - \ - void assign(const_iterator first, const_iterator last); \ - void assign(size_type n, const_reference v); \ - size_type capacity() const { return m_nSize; } \ - iterator erase(iterator first, iterator last) \ - { \ - size_type idx = first - begin(); \ - RemoveAt(idx, last - first); \ - return begin() + idx; \ - } \ - iterator erase(iterator it) { return erase(it, it + 1); } \ - void insert(iterator it, size_type n, const value_type& v) \ - { Insert(v, it - begin(), n); } \ - iterator insert(iterator it, const value_type& v = value_type()) \ - { \ - size_type idx = it - begin(); \ - Insert(v, idx); \ - return begin() + idx; \ - } \ - void insert(iterator it, const_iterator first, const_iterator last);\ - void pop_back() { RemoveAt(size() - 1); } \ - void push_back(const value_type& v) { Add(v); } \ - void reserve(size_type n) { Alloc(n); } \ - void resize(size_type n, value_type v = value_type()) \ - { SetCount(n, v); } \ - \ - iterator begin() { return m_pItems; } \ - iterator end() { return m_pItems + m_nCount; } \ - const_iterator begin() const { return m_pItems; } \ - const_iterator end() const { return m_pItems + m_nCount; } \ - \ - /* the following functions may be made directly public because */ \ - /* they don't use the type of the elements at all */ \ -public: \ - void clear() { Clear(); } \ - bool empty() const { return IsEmpty(); } \ - size_type max_size() const { return INT_MAX; } \ - size_type size() const { return GetCount(); } \ - \ -private: \ - void Grow(size_t nIncrement = 0); \ - bool Realloc(size_t nSize); \ - \ - size_t m_nSize, \ - m_nCount; \ - \ - T *m_pItems; \ -} - -#endif // !wxUSE_STL - -// ============================================================================ -// The private helper macros containing the core of the array classes -// ============================================================================ - -// Implementation notes: -// -// JACS: Salford C++ doesn't like 'var->operator=' syntax, as in: -// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); -// so using a temporary variable instead. -// -// The classes need a (even trivial) ~name() to link under Mac X -// -// _WX_ERROR_REMOVE is needed to resolve the name conflict between the wxT() -// macro and T typedef: we can't use wxT() inside WX_DEFINE_ARRAY! - -#define _WX_ERROR_REMOVE wxT("removing inexisting element in wxArray::Remove") - -// ---------------------------------------------------------------------------- -// _WX_DEFINE_TYPEARRAY: array for simple types -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ -classexp name : public base \ -{ \ -public: \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)/*const cast*/base::operator[](uiIndex); } \ - T& Last() const \ - { return Item(Count() - 1); } \ - \ - int Index(T e, bool bFromEnd = false) const \ - { return base::Index(e, bFromEnd); } \ - \ - void Add(T lItem, size_t nInsert = 1) \ - { insert(end(), nInsert, lItem); } \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { insert(begin() + uiIndex, nInsert, lItem); } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::RemoveAt(uiIndex, nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE); \ - RemoveAt((size_t)iIndex); } \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ -} - -#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY(T, name, base, classexp) - -#else // if !wxUSE_STL - -// common declaration used by both _WX_DEFINE_TYPEARRAY and -// _WX_DEFINE_TYPEARRAY_PTR -#define _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, ptrop) \ -wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ - TypeTooBigToBeStoredIn##base, \ - name); \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ -classexp name : public base \ -{ \ -public: \ - name() { } \ - ~name() { } \ - \ - name& operator=(const name& src) \ - { base* temp = (base*) this; \ - (*temp) = ((const base&)src); \ - return *this; } \ - \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Last() const \ - { return (T&)(base::operator[](Count() - 1)); } \ - \ - int Index(T lItem, bool bFromEnd = false) const \ - { return base::Index((base_type)lItem, bFromEnd); } \ - \ - void Add(T lItem, size_t nInsert = 1) \ - { base::Add((base_type)lItem, nInsert); } \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { base::Insert((base_type)lItem, uiIndex, nInsert) ; } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::RemoveAt(uiIndex, nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE); \ - base::RemoveAt((size_t)iIndex); } \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ - \ - /* STL-like interface */ \ -private: \ - typedef base::iterator biterator; \ - typedef base::const_iterator bconst_iterator; \ - typedef base::value_type bvalue_type; \ - typedef base::const_reference bconst_reference; \ -public: \ - typedef T value_type; \ - typedef value_type* pointer; \ - typedef const value_type* const_pointer; \ - typedef value_type* iterator; \ - typedef const value_type* const_iterator; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef base::difference_type difference_type; \ - typedef base::size_type size_type; \ - \ - class reverse_iterator \ - { \ - typedef T value_type; \ - typedef value_type& reference; \ - typedef value_type* pointer; \ - typedef reverse_iterator itor; \ - friend inline itor operator+(int o, const itor& it) \ - { return it.m_ptr - o; } \ - friend inline itor operator+(const itor& it, int o) \ - { return it.m_ptr - o; } \ - friend inline itor operator-(const itor& it, int o) \ - { return it.m_ptr + o; } \ - friend inline difference_type operator-(const itor& i1, \ - const itor& i2) \ - { return i1.m_ptr - i2.m_ptr; } \ - \ - public: \ - pointer m_ptr; \ - reverse_iterator() : m_ptr(NULL) { } \ - reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ - reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ - reference operator*() const { return *m_ptr; } \ - ptrop \ - itor& operator++() { --m_ptr; return *this; } \ - const itor operator++(int) \ - { reverse_iterator tmp = *this; --m_ptr; return tmp; } \ - itor& operator--() { ++m_ptr; return *this; } \ - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ - }; \ - \ - class const_reverse_iterator \ - { \ - typedef T value_type; \ - typedef const value_type& reference; \ - typedef const value_type* pointer; \ - typedef const_reverse_iterator itor; \ - friend inline itor operator+(int o, const itor& it) \ - { return it.m_ptr - o; } \ - friend inline itor operator+(const itor& it, int o) \ - { return it.m_ptr - o; } \ - friend inline itor operator-(const itor& it, int o) \ - { return it.m_ptr + o; } \ - friend inline difference_type operator-(const itor& i1, \ - const itor& i2) \ - { return i1.m_ptr - i2.m_ptr; } \ - \ - public: \ - pointer m_ptr; \ - const_reverse_iterator() : m_ptr(NULL) { } \ - const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ - const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ - const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\ - reference operator*() const { return *m_ptr; } \ - ptrop \ - itor& operator++() { --m_ptr; return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; --m_ptr; return tmp; } \ - itor& operator--() { ++m_ptr; return *this; } \ - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ - }; \ - \ - name(size_type n, const_reference v) { assign(n, v); } \ - name(const_iterator first, const_iterator last) \ - { assign(first, last); } \ - void assign(const_iterator first, const_iterator last) \ - { base::assign((bconst_iterator)first, (bconst_iterator)last); } \ - void assign(size_type n, const_reference v) \ - { base::assign(n, (bconst_reference)v); } \ - reference back() { return *(end() - 1); } \ - const_reference back() const { return *(end() - 1); } \ - iterator begin() { return (iterator)base::begin(); } \ - const_iterator begin() const { return (const_iterator)base::begin(); }\ - size_type capacity() const { return base::capacity(); } \ - iterator end() { return (iterator)base::end(); } \ - const_iterator end() const { return (const_iterator)base::end(); } \ - iterator erase(iterator first, iterator last) \ - { return (iterator)base::erase((biterator)first, (biterator)last); }\ - iterator erase(iterator it) \ - { return (iterator)base::erase((biterator)it); } \ - reference front() { return *begin(); } \ - const_reference front() const { return *begin(); } \ - void insert(iterator it, size_type n, const_reference v) \ - { base::insert((biterator)it, n, (bconst_reference)v); } \ - iterator insert(iterator it, const_reference v = value_type()) \ - { return (iterator)base::insert((biterator)it, (bconst_reference)v); }\ - void insert(iterator it, const_iterator first, const_iterator last) \ - { base::insert((biterator)it, (bconst_iterator)first, \ - (bconst_iterator)last); } \ - void pop_back() { base::pop_back(); } \ - void push_back(const_reference v) \ - { base::push_back((bconst_reference)v); } \ - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } \ - const_reverse_iterator rbegin() const; \ - reverse_iterator rend() { return reverse_iterator(begin() - 1); } \ - const_reverse_iterator rend() const; \ - void reserve(size_type n) { base::reserve(n); } \ - void resize(size_type n, value_type v = value_type()) \ - { base::resize(n, v); } \ -} - -#define _WX_PTROP pointer operator->() const { return m_ptr; } -#define _WX_PTROP_NONE - -#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP) -#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE) - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types -// cannot handle types with size greater than pointer because of sorting -// ---------------------------------------------------------------------------- - -#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classexp, comptype)\ -wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ - TypeTooBigToBeStoredInSorted##base, \ - name); \ -classexp name : public base \ -{ \ - typedef comptype SCMPFUNC; \ -public: \ - name(comptype fn defcomp) { m_fnCompare = fn; } \ - \ - name& operator=(const name& src) \ - { base* temp = (base*) this; \ - (*temp) = ((const base&)src); \ - m_fnCompare = src.m_fnCompare; \ - return *this; } \ - \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Last() const \ - { return (T&)(base::operator[](size() - 1)); } \ - \ - int Index(T lItem) const \ - { return base::Index(lItem, (CMPFUNC)m_fnCompare); } \ - \ - size_t IndexForInsert(T lItem) const \ - { return base::IndexForInsert(lItem, (CMPFUNC)m_fnCompare); } \ - \ - void AddAt(T item, size_t index) \ - { base::insert(begin() + index, item); } \ - \ - size_t Add(T lItem) \ - { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE ); \ - base::erase(begin() + iIndex); } \ - \ -private: \ - comptype m_fnCompare; \ -} - - -// ---------------------------------------------------------------------------- -// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics -// ---------------------------------------------------------------------------- - -#define _WX_DECLARE_OBJARRAY(T, name, base, classexp) \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2); \ -classexp name : protected base \ -{ \ -typedef int (CMPFUNC_CONV *CMPFUNC##base)(void **pItem1, void **pItem2); \ -typedef base base_array; \ -public: \ - name() { } \ - name(const name& src); \ - name& operator=(const name& src); \ - \ - ~name(); \ - \ - void Alloc(size_t count) { reserve(count); } \ - size_t GetCount() const { return base_array::size(); } \ - size_t size() const { return base_array::size(); } \ - bool IsEmpty() const { return base_array::empty(); } \ - bool empty() const { return base_array::empty(); } \ - size_t Count() const { return base_array::size(); } \ - void Shrink() { base::Shrink(); } \ - \ - T& operator[](size_t uiIndex) const \ - { return *(T*)base::operator[](uiIndex); } \ - T& Item(size_t uiIndex) const \ - { return *(T*)base::operator[](uiIndex); } \ - T& Last() const \ - { return *(T*)(base::operator[](size() - 1)); } \ - \ - int Index(const T& lItem, bool bFromEnd = false) const; \ - \ - void Add(const T& lItem, size_t nInsert = 1); \ - void Add(const T* pItem) \ - { base::push_back((T*)pItem); } \ - void push_back(const T* pItem) \ - { base::push_back((T*)pItem); } \ - void push_back(const T& lItem) \ - { Add(lItem); } \ - \ - void Insert(const T& lItem, size_t uiIndex, size_t nInsert = 1); \ - void Insert(const T* pItem, size_t uiIndex) \ - { base::insert(begin() + uiIndex, (T*)pItem); } \ - \ - void Empty() { DoEmpty(); base::clear(); } \ - void Clear() { DoEmpty(); base::clear(); } \ - \ - T* Detach(size_t uiIndex) \ - { T* p = (T*)base::operator[](uiIndex); \ - base::erase(begin() + uiIndex); return p; } \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC##base)fCmp); } \ - \ -private: \ - void DoEmpty(); \ - void DoCopy(const name& src); \ -} - -// ============================================================================ -// The public macros for declaration and definition of the dynamic arrays -// ============================================================================ - -// Please note that for each macro WX_FOO_ARRAY we also have -// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the -// same except that they use an additional __declspec(dllexport) or equivalent -// under Windows if needed. -// -// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL -// and so must be used used inside the library. The second kind (USER_EXPORTED) -// allow the user code to do it when it wants. This is needed if you have a dll -// that wants to export a wxArray daubed with your own import/export goo. -// -// Finally, you can define the macro below as something special to modify the -// arrays defined by a simple WX_FOO_ARRAY as well. By default is is empty. -#define wxARRAY_DEFAULT_EXPORT - -// ---------------------------------------------------------------------------- -// WX_DECLARE_BASEARRAY(T, name) declare an array class named "name" containing -// the elements of type T -// ---------------------------------------------------------------------------- - -#define WX_DECLARE_BASEARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, wxARRAY_DEFAULT_EXPORT) - -#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \ - typedef T _wxArray##name; \ - _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name" deriving -// from class "base" containing the elements of type T -// -// Note that the class defined has only inline function and doesn't take any -// space at all so there is no size penalty for defining multiple array classes -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_TYPEARRAY(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLEXPORT) - -#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLEXPORT) - -#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl) - -#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl) - -#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \ - typedef T _wxArray##name; \ - _WX_DEFINE_TYPEARRAY(_wxArray##name, name, base, classdecl) - -#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \ - typedef T _wxArray##name; \ - _WX_DEFINE_TYPEARRAY_PTR(_wxArray##name, name, base, classdecl) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it -// defines a sorted array. -// -// Differences: -// 1) it must be given a COMPARE function in ctor which takes 2 items of type -// T* and should return -1, 0 or +1 if the first one is less/greater -// than/equal to the second one. -// 2) the Add() method inserts the item in such was that the array is always -// sorted (it uses the COMPARE function) -// 3) it has no Sort() method because it's always sorted -// 4) Index() method is much faster (the sorted arrays use binary search -// instead of linear one), but Add() is slower. -// 5) there is no Insert() method because you can't insert an item into the -// given position in a sorted array but there is IndexForInsert()/AddAt() -// pair which may be used to optimize a common operation of "insert only if -// not found" -// -// Note that you have to specify the comparison function when creating the -// objects of this array type. If, as in 99% of cases, the comparison function -// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below -// is more convenient. -// -// Summary: use this class when the speed of Index() function is important, use -// the normal arrays otherwise. -// ---------------------------------------------------------------------------- - -// we need a macro which expands to nothing to pass correct number of -// parameters to a nested macro invocation even when we don't have anything to -// pass it -#define wxARRAY_EMPTY - -#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \ - wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLEXPORT) - -#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \ - typedef T _wxArray##name; \ - typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ - _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \ - wxARRAY_EMPTY, class expmode, SCMPFUNC##name) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison -// function is provided by this macro and the objects of this class have a -// default constructor which just uses it. -// -// The arguments are: the element type, the comparison function and the array -// name -// -// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked -// from the very beginning - unfortunately I didn't think about this earlier -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - WXDLLEXPORT) - -#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - expmode) \ - typedef T _wxArray##name; \ - typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ - _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \ - class expmode, SCMPFUNC##name) - -// ---------------------------------------------------------------------------- -// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class -// named "name" which owns the objects of type T it contains, i.e. it will -// delete them when it is destroyed. -// -// An element is of type T*, but arguments of type T& are taken (see below!) -// and T& is returned. -// -// Don't use this for simple types such as "int" or "long"! -// -// Note on Add/Insert functions: -// 1) function(T*) gives the object to the array, i.e. it will delete the -// object when it's removed or in the array's dtor -// 2) function(T&) will create a copy of the object and work with it -// -// Also: -// 1) Remove() will delete the object after removing it from the array -// 2) Detach() just removes the object from the array (returning pointer to it) -// -// NB1: Base type T should have an accessible copy ctor if Add(T&) is used -// NB2: Never ever cast a array to it's base type: as dtor is not virtual -// and so you risk having at least the memory leaks and probably worse -// -// Some functions of this class are not inline, so it takes some space to -// define new class from this template even if you don't use it - which is not -// the case for the simple (non-object) array classes -// -// To use an objarray class you must -// #include "dynarray.h" -// WX_DECLARE_OBJARRAY(element_type, list_class_name) -// #include "arrimpl.cpp" -// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above! -// -// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the -// element_type must be fully defined (i.e. forward declaration is not -// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of -// two allows to break cicrcular dependencies with classes which have member -// variables of objarray type. -// ---------------------------------------------------------------------------- - -#define WX_DECLARE_OBJARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT) - -#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLEXPORT) - -#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \ - typedef T _wxObjArray##name; \ - _WX_DECLARE_OBJARRAY(_wxObjArray##name, name, wxArrayPtrVoid, decl) - -#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \ - WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode) - -// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included, -// try to provoke a human-understandable error if it used incorrectly. -// -// there is no real need for 3 different macros in the DEFINE case but do it -// anyhow for consistency -#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp -#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) -#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) - -// ---------------------------------------------------------------------------- -// Some commonly used predefined base arrays -// ---------------------------------------------------------------------------- - -WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid, - WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// Convenience macros to define arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_ARRAY(T, name) \ - WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_ARRAY_PTR(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_EXPORTED_ARRAY(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl) -#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) -#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_CHAR(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar) -#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar) -#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_SHORT(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort) -#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort) -#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_INT(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt) -#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt) -#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_LONG(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong) -#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong) -#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) -#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) -#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_DOUBLE(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) -#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) -#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Convenience macros to define sorted arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_ARRAY(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode) - -#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode) - -#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Convenience macros to define sorted arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayPtrVoid, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayChar, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayShort, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayInt, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayLong, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArraySizeT, \ - wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Some commonly used predefined arrays -// ---------------------------------------------------------------------------- - -WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE); - -// ----------------------------------------------------------------------------- -// convenience macros -// ----------------------------------------------------------------------------- - -// prepend all element of one array to another one; e.g. if first array contains -// elements X,Y,Z and the second contains A,B,C (in those orders), then the -// first array will be result as A,B,C,X,Y,Z -#define WX_PREPEND_ARRAY(array, other) \ - { \ - size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - (array).Insert((other)[wxAAn], wxAAn); \ - } \ - } - -// append all element of one array to another one -#define WX_APPEND_ARRAY(array, other) \ - { \ - size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - (array).push_back((other)[wxAAn]); \ - } \ - } - -// delete all array elements -// -// NB: the class declaration of the array elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_ARRAY(array) \ - { \ - size_t wxAAcnt = (array).size(); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - delete (array)[wxAAn]; \ - } \ - \ - (array).clear(); \ - } - -#endif // _DYNARRAY_H diff --git a/Source/3rdParty/wx/include/wx/dynlib.h b/Source/3rdParty/wx/include/wx/dynlib.h deleted file mode 100644 index 5903a7b5b..000000000 --- a/Source/3rdParty/wx/include/wx/dynlib.h +++ /dev/null @@ -1,359 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dynlib.h -// Purpose: Dynamic library loading classes -// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 20/07/98 -// RCS-ID: $Id: dynlib.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DYNLIB_H__ -#define _WX_DYNLIB_H__ - -#include "wx/defs.h" - -#if wxUSE_DYNLIB_CLASS - -#include "wx/string.h" -#include "wx/dynarray.h" - -#if defined(__OS2__) || defined(__EMX__) -#include "wx/os2/private.h" -#endif - -#ifdef __WXMSW__ -#include "wx/msw/private.h" -#endif - -// note that we have our own dlerror() implementation under Darwin -#if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__) - #define wxHAVE_DYNLIB_ERROR -#endif - -class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -// Note: __OS2__/EMX has to be tested first, since we want to use -// native version, even if configure detected presence of DLOPEN. -#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) - typedef HMODULE wxDllType; -#elif defined(__DARWIN__) - // Don't include dlfcn.h on Darwin, we may be using our own replacements. - typedef void *wxDllType; -#elif defined(HAVE_DLOPEN) - #include - typedef void *wxDllType; -#elif defined(HAVE_SHL_LOAD) - #include - typedef shl_t wxDllType; -#elif defined(__WXMAC__) - #include - typedef CFragConnectionID wxDllType; -#else - #error "Dynamic Loading classes can't be compiled on this platform, sorry." -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxDLFlags -{ - wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use - // (only works on some Unix versions) - wxDL_NOW = 0x00000002, // resolve undefined symbols on load - // (default, always the case under Win32) - wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently - // loaded libs. - wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library - // name without appending the usual dll - // filename extension. - wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded - // (only for wxPluginManager) - - wxDL_QUIET = 0x00000020, // don't log an error if failed to load - -#if wxABI_VERSION >= 20810 - // this flag is dangerous, for internal use of wxMSW only, don't use at all - // and especially don't use directly, use wxLoadedDLL instead if you really - // do need it - wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already - // loaded DLL or NULL otherwise; Unload() - // should not be called so don't forget to - // Detach() if you use this function -#endif // wx 2.8.10+ - - wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32 -}; - -enum wxDynamicLibraryCategory -{ - wxDL_LIBRARY, // standard library - wxDL_MODULE // loadable module/plugin -}; - -enum wxPluginCategory -{ - wxDL_PLUGIN_GUI, // plugin that uses GUI classes - wxDL_PLUGIN_BASE // wxBase-only plugin -}; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// when loading a function from a DLL you always have to cast the returned -// "void *" pointer to the correct type and, even more annoyingly, you have to -// repeat this type twice if you want to declare and define a function pointer -// all in one line -// -// this macro makes this slightly less painful by allowing you to specify the -// type only once, as the first parameter, and creating a variable of this type -// called "pfn" initialized with the "name" from the "dynlib" -#define wxDYNLIB_FUNCTION(type, name, dynlib) \ - type pfn ## name = (type)(dynlib).GetSymbol(wxT(#name)) - -// ---------------------------------------------------------------------------- -// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDynamicLibraryDetails -{ -public: - // ctor, normally never used as these objects are only created by - // wxDynamicLibrary::ListLoaded() - wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; } - - // get the (base) name - wxString GetName() const { return m_name; } - - // get the full path of this object - wxString GetPath() const { return m_path; } - - // get the load address and the extent, return true if this information is - // available - bool GetAddress(void **addr, size_t *len) const - { - if ( !m_address ) - return false; - - if ( addr ) - *addr = m_address; - if ( len ) - *len = m_length; - - return true; - } - - // return the version of the DLL (may be empty if no version info) - wxString GetVersion() const - { - return m_version; - } - -private: - wxString m_name, - m_path, - m_version; - - void *m_address; - size_t m_length; - - friend class wxDynamicLibraryDetailsCreator; -}; - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails, - wxDynamicLibraryDetailsArray, - WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxDynamicLibrary: represents a handle to a DLL/shared object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDynamicLibrary -{ -public: - // return a valid handle for the main program itself or NULL if back - // linking is not supported by the current platform (e.g. Win32) - static wxDllType GetProgramHandle(); - - // return the platform standard DLL extension (with leading dot) - static const wxChar *GetDllExt() { return ms_dllext; } - - wxDynamicLibrary() : m_handle(0) { } - wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) - : m_handle(0) - { - Load(libname, flags); - } - - // NOTE: this class is (deliberately) not virtual, do not attempt - // to use it polymorphically. - ~wxDynamicLibrary() { Unload(); } - - // return true if the library was loaded successfully - bool IsLoaded() const { return m_handle != 0; } - - // load the library with the given name (full or not), return true if ok - bool Load(const wxString& libname, int flags = wxDL_DEFAULT); - - // raw function for loading dynamic libs: always behaves as if - // wxDL_VERBATIM were specified and doesn't log error message if the - // library couldn't be loaded but simply returns NULL - static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT); - - // detach the library object from its handle, i.e. prevent the object from - // unloading the library in its dtor -- the caller is now responsible for - // doing this - wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; } - - // unload the given library handle (presumably returned by Detach() before) - static void Unload(wxDllType handle); - - // unload the library, also done automatically in dtor - void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } } - - // Return the raw handle from dlopen and friends. - wxDllType GetLibHandle() const { return m_handle; } - - // check if the given symbol is present in the library, useful to verify if - // a loadable module is our plugin, for example, without provoking error - // messages from GetSymbol() - bool HasSymbol(const wxString& name) const - { - bool ok; - DoGetSymbol(name, &ok); - return ok; - } - - // resolve a symbol in a loaded DLL, such as a variable or function name. - // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to - // export unmangled names) - // - // Since it is perfectly valid for the returned symbol to actually be NULL, - // that is not always indication of an error. Pass and test the parameter - // 'success' for a true indication of success or failure to load the - // symbol. - // - // Returns a pointer to the symbol on success, or NULL if an error occurred - // or the symbol wasn't found. - void *GetSymbol(const wxString& name, bool *success = NULL) const; - - // low-level version of GetSymbol() - static void *RawGetSymbol(wxDllType handle, const wxString& name); - void *RawGetSymbol(const wxString& name) const - { -#if defined (__WXPM__) || defined(__EMX__) - return GetSymbol(name); -#else - return RawGetSymbol(m_handle, name); -#endif - } - -#ifdef __WXMSW__ - // this function is useful for loading functions from the standard Windows - // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or - // wide character build) suffix if they take string parameters - static void *RawGetSymbolAorW(wxDllType handle, const wxString& name) - { - return RawGetSymbol - ( - handle, - name + -#if wxUSE_UNICODE - L'W' -#else - 'A' -#endif - ); - } - - void *GetSymbolAorW(const wxString& name) const - { - return RawGetSymbolAorW(m_handle, name); - } -#endif // __WXMSW__ - - // return all modules/shared libraries in the address space of this process - // - // returns an empty array if not implemented or an error occurred - static wxDynamicLibraryDetailsArray ListLoaded(); - - // return platform-specific name of dynamic library with proper extension - // and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux) - static wxString CanonicalizeName(const wxString& name, - wxDynamicLibraryCategory cat = wxDL_LIBRARY); - - // return name of wxWidgets plugin (adds compiler and version info - // to the filename): - static wxString - CanonicalizePluginName(const wxString& name, - wxPluginCategory cat = wxDL_PLUGIN_GUI); - - // return plugin directory on platforms where it makes sense and empty - // string on others: - static wxString GetPluginsDirectory(); - - -protected: - // common part of GetSymbol() and HasSymbol() - void *DoGetSymbol(const wxString& name, bool *success = 0) const; - -#ifdef wxHAVE_DYNLIB_ERROR - // log the error after a dlxxx() function failure - static void Error(); -#endif // wxHAVE_DYNLIB_ERROR - - - // platform specific shared lib suffix. - static const wxChar *ms_dllext; - - // the handle to DLL or NULL - wxDllType m_handle; - - // no copy ctor/assignment operators (or we'd try to unload the library - // twice) - DECLARE_NO_COPY_CLASS(wxDynamicLibrary) -}; - -#if defined(__WXMSW__) && wxABI_VERSION >= 20810 - -// ---------------------------------------------------------------------------- -// wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind -// to a DLL already loaded into the project address space -// ---------------------------------------------------------------------------- - -class wxLoadedDLL : public wxDynamicLibrary -{ -public: - wxLoadedDLL(const wxString& dllname) - : wxDynamicLibrary(dllname, wxDL_GET_LOADED | wxDL_VERBATIM | wxDL_QUIET) - { - } - - ~wxLoadedDLL() - { - Detach(); - } -}; - -#endif // __WXMSW__ - -// ---------------------------------------------------------------------------- -// Interesting defines -// ---------------------------------------------------------------------------- - -#define WXDLL_ENTRY_FUNCTION() \ -extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \ -const wxClassInfo *wxGetClassFirst() { \ - return wxClassInfo::GetFirst(); \ -} - -#endif // wxUSE_DYNLIB_CLASS - -#endif // _WX_DYNLIB_H__ diff --git a/Source/3rdParty/wx/include/wx/dynload.h b/Source/3rdParty/wx/include/wx/dynload.h deleted file mode 100644 index 76b377c07..000000000 --- a/Source/3rdParty/wx/include/wx/dynload.h +++ /dev/null @@ -1,153 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dynload.h -// Purpose: Dynamic loading framework -// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's -// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) -// Modified by: -// Created: 03/12/01 -// RCS-ID: $Id: dynload.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DYNAMICLOADER_H__ -#define _WX_DYNAMICLOADER_H__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_DYNAMIC_LOADER - -#include "wx/dynlib.h" -#include "wx/hashmap.h" -#include "wx/module.h" - -class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; - - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest, - class WXDLLIMPEXP_BASE); -typedef wxDLManifest wxDLImports; - -// --------------------------------------------------------------------------- -// wxPluginLibrary -// --------------------------------------------------------------------------- - -// NOTE: Do not attempt to use a base class pointer to this class. -// wxDL is not virtual and we deliberately hide some of it's -// methods here. -// -// Unless you know exacty why you need to, you probably shouldn't -// instantiate this class directly anyway, use wxPluginManager -// instead. - -class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary -{ -public: - - static wxDLImports* ms_classes; // Static hash of all imported classes. - - wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT ); - ~wxPluginLibrary(); - - wxPluginLibrary *RefLib(); - bool UnrefLib(); - - // These two are called by the PluginSentinel on (PLUGGABLE) object - // creation/destruction. There is usually no reason for the user to - // call them directly. We have to separate this from the link count, - // since the two are not interchangeable. - - // FIXME: for even better debugging PluginSentinel should register - // the name of the class created too, then we can state - // exactly which object was not destroyed which may be - // difficult to find otherwise. Also this code should - // probably only be active in DEBUG mode, but let's just - // get it right first. - - void RefObj() { ++m_objcount; } - void UnrefObj() - { - wxASSERT_MSG( m_objcount > 0, wxT("Too many objects deleted??") ); - --m_objcount; - } - - // Override/hide some base class methods - - bool IsLoaded() const { return m_linkcount > 0; } - void Unload() { UnrefLib(); } - -private: - - wxClassInfo *m_before; // sm_first before loading this lib - wxClassInfo *m_after; // ..and after. - - size_t m_linkcount; // Ref count of library link calls - size_t m_objcount; // ..and (pluggable) object instantiations. - wxModuleList m_wxmodules; // any wxModules that we initialised. - - void UpdateClasses(); // Update ms_classes - void RestoreClasses(); // Removes this library from ms_classes - void RegisterModules(); // Init any wxModules in the lib. - void UnregisterModules(); // Cleanup any wxModules we installed. - - DECLARE_NO_COPY_CLASS(wxPluginLibrary) -}; - - -class WXDLLIMPEXP_BASE wxPluginManager -{ -public: - - // Static accessors. - - static wxPluginLibrary *LoadLibrary( const wxString &libname, - int flags = wxDL_DEFAULT ); - static bool UnloadLibrary(const wxString &libname); - - // Instance methods. - - wxPluginManager() : m_entry(NULL) {} - wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) - { - Load(libname, flags); - } - ~wxPluginManager() { if ( IsLoaded() ) Unload(); } - - bool Load(const wxString &libname, int flags = wxDL_DEFAULT); - void Unload(); - - bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } - void *GetSymbol(const wxString &symbol, bool *success = 0) - { - return m_entry->GetSymbol( symbol, success ); - } - - static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); } - static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } - -private: - // return the pointer to the entry for the library with given name in - // ms_manifest or NULL if none - static wxPluginLibrary *FindByName(const wxString& name) - { - const wxDLManifest::iterator i = ms_manifest->find(name); - - return i == ms_manifest->end() ? NULL : i->second; - } - - static wxDLManifest* ms_manifest; // Static hash of loaded libs. - wxPluginLibrary* m_entry; // Cache our entry in the manifest. - - // We could allow this class to be copied if we really - // wanted to, but not without modification. - DECLARE_NO_COPY_CLASS(wxPluginManager) -}; - - -#endif // wxUSE_DYNAMIC_LOADER -#endif // _WX_DYNAMICLOADER_H__ - diff --git a/Source/3rdParty/wx/include/wx/effects.h b/Source/3rdParty/wx/include/wx/effects.h deleted file mode 100644 index 987ddf51a..000000000 --- a/Source/3rdParty/wx/include/wx/effects.h +++ /dev/null @@ -1,75 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/effects.h -// Purpose: wxEffects class -// Draws 3D effects. -// Author: Julian Smart et al -// Modified by: -// Created: 25/4/2000 -// RCS-ID: $Id: effects.h 39109 2006-05-08 11:31:03Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EFFECTS_H_ -#define _WX_EFFECTS_H_ - -/* - * wxEffects: various 3D effects - */ - -#include "wx/object.h" -#include "wx/colour.h" -#include "wx/gdicmn.h" -#include "wx/dc.h" - -class WXDLLEXPORT wxEffects: public wxObject -{ -DECLARE_CLASS(wxEffects) - -public: - // Assume system colours - wxEffects() ; - // Going from lightest to darkest - wxEffects(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, - const wxColour& darkShadow) ; - - // Accessors - wxColour GetHighlightColour() const { return m_highlightColour; } - wxColour GetLightShadow() const { return m_lightShadow; } - wxColour GetFaceColour() const { return m_faceColour; } - wxColour GetMediumShadow() const { return m_mediumShadow; } - wxColour GetDarkShadow() const { return m_darkShadow; } - - void SetHighlightColour(const wxColour& c) { m_highlightColour = c; } - void SetLightShadow(const wxColour& c) { m_lightShadow = c; } - void SetFaceColour(const wxColour& c) { m_faceColour = c; } - void SetMediumShadow(const wxColour& c) { m_mediumShadow = c; } - void SetDarkShadow(const wxColour& c) { m_darkShadow = c; } - - void Set(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, - const wxColour& darkShadow) - { - SetHighlightColour(highlightColour); - SetLightShadow(lightShadow); - SetFaceColour(faceColour); - SetMediumShadow(mediumShadow); - SetDarkShadow(darkShadow); - } - - // Draw a sunken edge - void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1); - - // Tile a bitmap - bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); - -protected: - wxColour m_highlightColour; // Usually white - wxColour m_lightShadow; // Usually light grey - wxColour m_faceColour; // Usually grey - wxColour m_mediumShadow; // Usually dark grey - wxColour m_darkShadow; // Usually black -}; - -#endif diff --git a/Source/3rdParty/wx/include/wx/encconv.h b/Source/3rdParty/wx/include/wx/encconv.h deleted file mode 100644 index f57d8ea9d..000000000 --- a/Source/3rdParty/wx/include/wx/encconv.h +++ /dev/null @@ -1,159 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/encconv.h -// Purpose: wxEncodingConverter class for converting between different -// font encodings -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ENCCONV_H_ -#define _WX_ENCCONV_H_ - -#include "wx/defs.h" - -#include "wx/object.h" -#include "wx/fontenc.h" -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - wxCONVERT_STRICT, - wxCONVERT_SUBSTITUTE -}; - - -enum -{ - wxPLATFORM_CURRENT = -1, - - wxPLATFORM_UNIX = 0, - wxPLATFORM_WINDOWS, - wxPLATFORM_OS2, - wxPLATFORM_MAC -}; - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray); - -//-------------------------------------------------------------------------------- -// wxEncodingConverter -// This class is capable of converting strings between any two -// 8bit encodings/charsets. It can also convert from/to Unicode -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject -{ - public: - - wxEncodingConverter(); - virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } - - // Initialize conversion. Both output or input encoding may - // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1. - // - // All subsequent calls to Convert() will interpret it's argument - // as a string in input_enc encoding and will output string in - // output_enc encoding. - // - // You must call this method before calling Convert. You may call - // it more than once in order to switch to another conversion - // - // Method affects behaviour of Convert() in case input character - // cannot be converted because it does not exist in output encoding: - // wxCONVERT_STRICT -- - // follow behaviour of GNU Recode - just copy unconvertable - // characters to output and don't change them (it's integer - // value will stay the same) - // wxCONVERT_SUBSTITUTE -- - // try some (lossy) substitutions - e.g. replace - // unconvertable latin capitals with acute by ordinary - // capitals, replace en-dash or em-dash by '-' etc. - // both modes gurantee that output string will have same length - // as input string - // - // Returns false if given conversion is impossible, true otherwise - // (conversion may be impossible either if you try to convert - // to Unicode with non-Unicode build of wxWidgets or if input - // or output encoding is not supported.) - bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT); - - // Convert input string according to settings passed to Init. - // Note that you must call Init before using Convert! - bool Convert(const char* input, char* output) const; - bool Convert(char* str) const { return Convert(str, str); } - wxString Convert(const wxString& input) const; - -#if wxUSE_WCHAR_T - bool Convert(const char* input, wchar_t* output) const; - bool Convert(const wchar_t* input, char* output) const; - bool Convert(const wchar_t* input, wchar_t* output) const; - bool Convert(wchar_t* str) const { return Convert(str, str); } -#endif - // Return equivalent(s) for given font that are used - // under given platform. wxPLATFORM_CURRENT means the plaform - // this binary was compiled for - // - // Examples: - // current platform enc returned value - // ----------------------------------------------------- - // unix CP1250 {ISO8859_2} - // unix ISO8859_2 {} - // windows ISO8859_2 {CP1250} - // - // Equivalence is defined in terms of convertibility: - // 2 encodings are equivalent if you can convert text between - // then without loosing information (it may - and will - happen - // that you loose special chars like quotation marks or em-dashes - // but you shouldn't loose any diacritics and language-specific - // characters when converting between equivalent encodings). - // - // Convert() method is not limited to converting between - // equivalent encodings, it can convert between arbitrary - // two encodings! - // - // Remember that this function does _NOT_ check for presence of - // fonts in system. It only tells you what are most suitable - // encodings. (It usually returns only one encoding) - // - // Note that argument enc itself may be present in returned array! - // (so that you can -- as a side effect -- detect whether the - // encoding is native for this platform or not) - static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT); - - // Similar to GetPlatformEquivalent, but this one will return ALL - // equivalent encodings, regardless the platform, including itself. - static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc); - - // Return true if [any text in] one multibyte encoding can be - // converted to another one losslessly. - // - // Do not call this with wxFONTENCODING_UNICODE, it doesn't make - // sense (always works in one sense and always depends on the text - // to convert in the other) - static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut) - { - return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND; - } - - private: - -#if wxUSE_WCHAR_T - wchar_t *m_Table; -#else - char *m_Table; -#endif - bool m_UnicodeInput, m_UnicodeOutput; - bool m_JustCopy; - - DECLARE_NO_COPY_CLASS(wxEncodingConverter) -}; - -#endif // _WX_ENCCONV_H_ diff --git a/Source/3rdParty/wx/include/wx/encinfo.h b/Source/3rdParty/wx/include/wx/encinfo.h deleted file mode 100644 index fb3d9214f..000000000 --- a/Source/3rdParty/wx/include/wx/encinfo.h +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/encinfo.h -// Purpose: declares wxNativeEncodingInfo struct -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.09.2003 (extracted from wx/fontenc.h) -// RCS-ID: $Id: encinfo.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ENCINFO_H_ -#define _WX_ENCINFO_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxNativeEncodingInfo contains all encoding parameters for this platform -// ---------------------------------------------------------------------------- - -// This private structure specifies all the parameters needed to create a font -// with the given encoding on this platform. -// -// Under X, it contains the last 2 elements of the font specifications -// (registry and encoding). -// -// Under Windows, it contains a number which is one of predefined CHARSET_XXX -// values. -// -// Under all platforms it also contains a facename string which should be -// used, if not empty, to create fonts in this encoding (this is the only way -// to create a font of non-standard encoding (like KOI8) under Windows - the -// facename specifies the encoding then) - -struct WXDLLEXPORT wxNativeEncodingInfo -{ - wxString facename; // may be empty meaning "any" -#ifndef __WXPALMOS__ - wxFontEncoding encoding; // so that we know what this struct represents - -#if defined(__WXMSW__) || \ - defined(__WXPM__) || \ - defined(__WXMAC__) || \ - defined(__WXCOCOA__) // FIXME: __WXCOCOA__ - - wxNativeEncodingInfo() - : facename() - , encoding(wxFONTENCODING_SYSTEM) - , charset(0) /* ANSI_CHARSET */ - { } - - int charset; -#elif defined(_WX_X_FONTLIKE) - wxString xregistry, - xencoding; -#elif defined(__WXGTK20__) - // No way to specify this in Pango as this - // seems to be handled internally. -#elif defined(__WXMGL__) - int mglEncoding; -#elif defined(__WXDFB__) - // DirectFB uses UTF-8 internally, doesn't use font encodings -#else - #error "Unsupported toolkit" -#endif -#endif // !__WXPALMOS__ - // this struct is saved in config by wxFontMapper, so it should know to - // serialise itself (implemented in platform-specific code) - bool FromString(const wxString& s); - wxString ToString() const; -}; - -#endif // _WX_ENCINFO_H_ - diff --git a/Source/3rdParty/wx/include/wx/event.h b/Source/3rdParty/wx/include/wx/event.h deleted file mode 100644 index 599b588d2..000000000 --- a/Source/3rdParty/wx/include/wx/event.h +++ /dev/null @@ -1,3121 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/event.h -// Purpose: Event classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: event.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EVENT_H__ -#define _WX_EVENT_H__ - -#include "wx/defs.h" -#include "wx/cpp.h" -#include "wx/object.h" -#include "wx/clntdata.h" - -#if wxUSE_GUI - #include "wx/gdicmn.h" - #include "wx/cursor.h" -#endif - -#include "wx/thread.h" - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxList; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxDC; - class WXDLLIMPEXP_FWD_CORE wxMenu; - class WXDLLIMPEXP_FWD_CORE wxWindow; - class WXDLLIMPEXP_FWD_CORE wxWindowBase; -#endif // wxUSE_GUI - -class WXDLLIMPEXP_FWD_BASE wxEvtHandler; - -// ---------------------------------------------------------------------------- -// Event types -// ---------------------------------------------------------------------------- - -typedef int wxEventType; - -// this is used to make the event table entry type safe, so that for an event -// handler only a function with proper parameter list can be given. -#define wxStaticCastEvent(type, val) wx_static_cast(type, val) - -// in previous versions of wxWidgets the event types used to be constants -// which created difficulties with custom/user event types definition -// -// starting from wxWidgets 2.4 the event types are now dynamically assigned -// using wxNewEventType() which solves this problem, however at price of -// several incompatibilities: -// -// a) event table macros declaration changed, it now uses wxEventTableEntry -// ctor instead of initialisation from an agregate - the macro -// DECLARE_EVENT_TABLE_ENTRY may be used to write code which can compile -// with all versions of wxWidgets -// -// b) event types can't be used as switch() cases as they're not really -// constant any more - there is no magic solution here, you just have to -// change the switch()es to if()s -// -// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES -// as 1 to get 100% old behaviour, however you won't be able to use the -// libraries using the new dynamic event type allocation in such case, so avoid -// it if possible. -#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES - #define WXWIN_COMPATIBILITY_EVENT_TYPES 0 -#endif - -#if WXWIN_COMPATIBILITY_EVENT_TYPES - -#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - { type, winid, idLast, fn, obj } - -#define BEGIN_DECLARE_EVENT_TYPES() enum { -#define END_DECLARE_EVENT_TYPES() }; -#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, -#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value, -#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ - DECLARE_LOCAL_EVENT_TYPE(name, value) -#define DEFINE_EVENT_TYPE(name) -#define DEFINE_LOCAL_EVENT_TYPE(name) - - -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - -#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - wxEventTableEntry(type, winid, idLast, fn, obj) - -#define BEGIN_DECLARE_EVENT_TYPES() -#define END_DECLARE_EVENT_TYPES() -#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ - extern expdecl const wxEventType name; -#define DECLARE_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) -#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) -#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); -#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) - -// generate a new unique event type -extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); - -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - -BEGIN_DECLARE_EVENT_TYPES() - -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEVT_NULL = 0, - wxEVT_FIRST = 10000, - wxEVT_USER_FIRST = wxEVT_FIRST + 2000, -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - // it is important to still have these as constants to avoid - // initialization order related problems - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_USER_FIRST, wxEVT_FIRST + 2000) -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6) - // now they are in wx/textctrl.h -#if WXWIN_COMPATIBILITY_EVENT_TYPES - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES - DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12) - - // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use - // wxEVT_SCROLL... events - - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18) - - // Sockets and timers send events, too - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50) - DECLARE_EVENT_TYPE(wxEVT_TIMER , 80) - - // Mouse event types - DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100) - DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105) - DECLARE_EVENT_TYPE(wxEVT_MOTION, 106) - DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107) - DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108) - DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111) - DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112) - DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113) - DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114) - DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115) - - // Non-client mouse events - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200) - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205) - DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206) - DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207) - DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208) - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211) - - // Character input event type - DECLARE_EVENT_TYPE(wxEVT_CHAR, 212) - DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213) - DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214) - DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215) - DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216) -#if wxUSE_HOTKEY - DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217) -#endif - // Set cursor event - DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230) - - // wxScrollBar and wxSlider event identifiers - DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308) - - // Scroll events from wxWindow - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327) - - // System events - DECLARE_EVENT_TYPE(wxEVT_SIZE, 400) - DECLARE_EVENT_TYPE(wxEVT_MOVE, 401) - DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402) - DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403) - DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404) - DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405) - // 406..408 are power events - DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409) - DECLARE_EVENT_TYPE(wxEVT_CREATE, 410) - DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411) - DECLARE_EVENT_TYPE(wxEVT_SHOW, 412) - DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413) - DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414) - DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415) - DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416) - DECLARE_EVENT_TYPE(wxEVT_PAINT, 417) - DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418) - DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419) - DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420) - DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421) - DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422) - DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423) - DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424) - DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425) - DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426) - DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427) - DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428) - DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429) - DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430) - DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431) - DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432) - DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433) - DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434) - DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435) - DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436) - DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437) - DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439) - DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) - DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) - DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) - DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) - // more power events follow -- see wx/power.h - - // Clipboard events - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) - - // Generic command events - // Note: a click is a higher-level event than button down/up - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506) - - // Help events - DECLARE_EVENT_TYPE(wxEVT_HELP, 1050) - DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051) - -END_DECLARE_EVENT_TYPES() - -// these 2 events are the same -#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED - -// ---------------------------------------------------------------------------- -// Compatibility -// ---------------------------------------------------------------------------- - -// this event is also used by wxComboBox and wxSpinCtrl which don't include -// wx/textctrl.h in all ports [yet], so declare it here as well -// -// still, any new code using it should include wx/textctrl.h explicitly -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED; -#endif - -// the predefined constants for the number of times we propagate event -// upwards window child-parent chain -enum Propagation_state -{ - // don't propagate it at all - wxEVENT_PROPAGATE_NONE = 0, - - // propagate it until it is processed - wxEVENT_PROPAGATE_MAX = INT_MAX -}; - -/* - * wxWidgets events, covering all interesting things that might happen - * (button clicking, resizing, setting text in widgets, etc.). - * - * For each completely new event type, derive a new event class. - * An event CLASS represents a C++ class defining a range of similar event TYPES; - * examples are canvas events, panel item command events. - * An event TYPE is a unique identifier for a particular system event, - * such as a button press or a listbox deselection. - * - */ - -class WXDLLIMPEXP_BASE wxEvent : public wxObject -{ -private: - wxEvent& operator=(const wxEvent&); - -protected: - wxEvent(const wxEvent&); // for implementing Clone() - -public: - wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL ); - - void SetEventType(wxEventType typ) { m_eventType = typ; } - wxEventType GetEventType() const { return m_eventType; } - wxObject *GetEventObject() const { return m_eventObject; } - void SetEventObject(wxObject *obj) { m_eventObject = obj; } - long GetTimestamp() const { return m_timeStamp; } - void SetTimestamp(long ts = 0) { m_timeStamp = ts; } - int GetId() const { return m_id; } - void SetId(int Id) { m_id = Id; } - - // Can instruct event processor that we wish to ignore this event - // (treat as if the event table entry had not been found): this must be done - // to allow the event processing by the base classes (calling event.Skip() - // is the analog of calling the base class version of a virtual function) - void Skip(bool skip = true) { m_skipped = skip; } - bool GetSkipped() const { return m_skipped; } - - // this function is used to create a copy of the event polymorphically and - // all derived classes must implement it because otherwise wxPostEvent() - // for them wouldn't work (it needs to do a copy of the event) - virtual wxEvent *Clone() const = 0; - - // Implementation only: this test is explicitly anti OO and this function - // exists only for optimization purposes. - bool IsCommandEvent() const { return m_isCommandEvent; } - - // Determine if this event should be propagating to the parent window. - bool ShouldPropagate() const - { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; } - - // Stop an event from propagating to its parent window, returns the old - // propagation level value - int StopPropagation() - { - int propagationLevel = m_propagationLevel; - m_propagationLevel = wxEVENT_PROPAGATE_NONE; - return propagationLevel; - } - - // Resume the event propagation by restoring the propagation level - // (returned by StopPropagation()) - void ResumePropagation(int propagationLevel) - { - m_propagationLevel = propagationLevel; - } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxObject* m_eventObject; - wxEventType m_eventType; - long m_timeStamp; - int m_id; - -public: - // m_callbackUserData is for internal usage only - wxObject* m_callbackUserData; - -protected: - // the propagation level: while it is positive, we propagate the event to - // the parent window (if any) - // - // this one doesn't have to be public, we don't have to worry about - // backwards compatibility as it is new - int m_propagationLevel; - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - bool m_skipped; - bool m_isCommandEvent; - -private: - // it needs to access our m_propagationLevel - friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce; - - DECLARE_ABSTRACT_CLASS(wxEvent) -}; - -/* - * Helper class to temporarily change an event not to propagate. - */ -class WXDLLIMPEXP_BASE wxPropagationDisabler -{ -public: - wxPropagationDisabler(wxEvent& event) : m_event(event) - { - m_propagationLevelOld = m_event.StopPropagation(); - } - - ~wxPropagationDisabler() - { - m_event.ResumePropagation(m_propagationLevelOld); - } - -private: - wxEvent& m_event; - int m_propagationLevelOld; - - DECLARE_NO_COPY_CLASS(wxPropagationDisabler) -}; - -/* - * Another one to temporarily lower propagation level. - */ -class WXDLLIMPEXP_BASE wxPropagateOnce -{ -public: - wxPropagateOnce(wxEvent& event) : m_event(event) - { - wxASSERT_MSG( m_event.m_propagationLevel > 0, - wxT("shouldn't be used unless ShouldPropagate()!") ); - - m_event.m_propagationLevel--; - } - - ~wxPropagateOnce() - { - m_event.m_propagationLevel++; - } - -private: - wxEvent& m_event; - - DECLARE_NO_COPY_CLASS(wxPropagateOnce) -}; - -#if wxUSE_GUI - - -// Item or menu event class -/* - wxEVT_COMMAND_BUTTON_CLICKED - wxEVT_COMMAND_CHECKBOX_CLICKED - wxEVT_COMMAND_CHOICE_SELECTED - wxEVT_COMMAND_LISTBOX_SELECTED - wxEVT_COMMAND_LISTBOX_DOUBLECLICKED - wxEVT_COMMAND_TEXT_UPDATED - wxEVT_COMMAND_TEXT_ENTER - wxEVT_COMMAND_MENU_SELECTED - wxEVT_COMMAND_SLIDER_UPDATED - wxEVT_COMMAND_RADIOBOX_SELECTED - wxEVT_COMMAND_RADIOBUTTON_SELECTED - wxEVT_COMMAND_SCROLLBAR_UPDATED - wxEVT_COMMAND_VLBOX_SELECTED - wxEVT_COMMAND_COMBOBOX_SELECTED - wxEVT_COMMAND_TOGGLEBUTTON_CLICKED -*/ - -#if WXWIN_COMPATIBILITY_2_4 -// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage -class WXDLLIMPEXP_CORE wxCommandEvent; - -class WXDLLIMPEXP_CORE wxCommandEventStringHelper -{ -public: - wxCommandEventStringHelper(wxCommandEvent * evt) - : m_evt(evt) - { } - - void operator=(const wxString &str); - operator wxString(); - const wxChar* c_str() const; - -private: - wxCommandEvent* m_evt; -}; -#endif - -class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent -{ -public: - wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); - - wxCommandEvent(const wxCommandEvent& event) - : wxEvent(event), -#if WXWIN_COMPATIBILITY_2_4 - m_commandString(this), -#endif - m_cmdString(event.m_cmdString), - m_commandInt(event.m_commandInt), - m_extraLong(event.m_extraLong), - m_clientData(event.m_clientData), - m_clientObject(event.m_clientObject) - { } - - // Set/Get client data from controls - void SetClientData(void* clientData) { m_clientData = clientData; } - void *GetClientData() const { return m_clientData; } - - // Set/Get client object from controls - void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } - wxClientData *GetClientObject() const { return m_clientObject; } - - // Get listbox selection if single-choice - int GetSelection() const { return m_commandInt; } - - // Set/Get listbox/choice selection string - void SetString(const wxString& s) { m_cmdString = s; } - wxString GetString() const; - - // Get checkbox value - bool IsChecked() const { return m_commandInt != 0; } - - // true if the listbox event was a selection. - bool IsSelection() const { return (m_extraLong != 0); } - - void SetExtraLong(long extraLong) { m_extraLong = extraLong; } - long GetExtraLong() const { return m_extraLong; } - - void SetInt(int i) { m_commandInt = i; } - int GetInt() const { return m_commandInt; } - - virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: - wxCommandEventStringHelper m_commandString; -#else -protected: -#endif - wxString m_cmdString; // String event argument - int m_commandInt; - long m_extraLong; // Additional information (e.g. select/deselect) - void* m_clientData; // Arbitrary client data - wxClientData* m_clientObject; // Arbitrary client object - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) -}; - -#if WXWIN_COMPATIBILITY_2_4 -inline void wxCommandEventStringHelper::operator=(const wxString &str) -{ - m_evt->SetString(str); -} - -inline wxCommandEventStringHelper::operator wxString() -{ - return m_evt->GetString(); -} - -inline const wxChar* wxCommandEventStringHelper::c_str() const -{ - return m_evt->GetString().c_str(); -} -#endif - -// this class adds a possibility to react (from the user) code to a control -// notification: allow or veto the operation being reported. -class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent -{ -public: - wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxCommandEvent(commandType, winid) - { m_bAllow = true; } - - wxNotifyEvent(const wxNotifyEvent& event) - : wxCommandEvent(event) - { m_bAllow = event.m_bAllow; } - - // veto the operation (usually it's allowed by default) - void Veto() { m_bAllow = false; } - - // allow the operation if it was disabled by default - void Allow() { m_bAllow = true; } - - // for implementation code only: is the operation allowed? - bool IsAllowed() const { return m_bAllow; } - - virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); } - -private: - bool m_bAllow; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent) -}; - -// Scroll event class, derived form wxCommandEvent. wxScrollEvents are -// sent by wxSlider and wxScrollBar. -/* - wxEVT_SCROLL_TOP - wxEVT_SCROLL_BOTTOM - wxEVT_SCROLL_LINEUP - wxEVT_SCROLL_LINEDOWN - wxEVT_SCROLL_PAGEUP - wxEVT_SCROLL_PAGEDOWN - wxEVT_SCROLL_THUMBTRACK - wxEVT_SCROLL_THUMBRELEASE - wxEVT_SCROLL_CHANGED -*/ - -class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent -{ -public: - wxScrollEvent(wxEventType commandType = wxEVT_NULL, - int winid = 0, int pos = 0, int orient = 0); - - int GetOrientation() const { return (int) m_extraLong; } - int GetPosition() const { return m_commandInt; } - void SetOrientation(int orient) { m_extraLong = (long) orient; } - void SetPosition(int pos) { m_commandInt = pos; } - - virtual wxEvent *Clone() const { return new wxScrollEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent) -}; - -// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents -// are sent by wxWindow. -/* - wxEVT_SCROLLWIN_TOP - wxEVT_SCROLLWIN_BOTTOM - wxEVT_SCROLLWIN_LINEUP - wxEVT_SCROLLWIN_LINEDOWN - wxEVT_SCROLLWIN_PAGEUP - wxEVT_SCROLLWIN_PAGEDOWN - wxEVT_SCROLLWIN_THUMBTRACK - wxEVT_SCROLLWIN_THUMBRELEASE -*/ - -class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent -{ -public: - wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, - int pos = 0, int orient = 0); - wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event) - { m_commandInt = event.m_commandInt; - m_extraLong = event.m_extraLong; } - - int GetOrientation() const { return (int) m_extraLong; } - int GetPosition() const { return m_commandInt; } - void SetOrientation(int orient) { m_extraLong = (long) orient; } - void SetPosition(int pos) { m_commandInt = pos; } - - virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - int m_commandInt; - long m_extraLong; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent) -}; - -// Mouse event class - -/* - wxEVT_LEFT_DOWN - wxEVT_LEFT_UP - wxEVT_MIDDLE_DOWN - wxEVT_MIDDLE_UP - wxEVT_RIGHT_DOWN - wxEVT_RIGHT_UP - wxEVT_MOTION - wxEVT_ENTER_WINDOW - wxEVT_LEAVE_WINDOW - wxEVT_LEFT_DCLICK - wxEVT_MIDDLE_DCLICK - wxEVT_RIGHT_DCLICK - wxEVT_NC_LEFT_DOWN - wxEVT_NC_LEFT_UP, - wxEVT_NC_MIDDLE_DOWN, - wxEVT_NC_MIDDLE_UP, - wxEVT_NC_RIGHT_DOWN, - wxEVT_NC_RIGHT_UP, - wxEVT_NC_MOTION, - wxEVT_NC_ENTER_WINDOW, - wxEVT_NC_LEAVE_WINDOW, - wxEVT_NC_LEFT_DCLICK, - wxEVT_NC_MIDDLE_DCLICK, - wxEVT_NC_RIGHT_DCLICK, -*/ - -// the symbolic names for the mouse buttons -enum -{ - wxMOUSE_BTN_ANY = -1, - wxMOUSE_BTN_NONE = 0, - wxMOUSE_BTN_LEFT = 1, - wxMOUSE_BTN_MIDDLE = 2, - wxMOUSE_BTN_RIGHT = 3 -}; - -class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent -{ -public: - wxMouseEvent(wxEventType mouseType = wxEVT_NULL); - wxMouseEvent(const wxMouseEvent& event) : wxEvent(event) - { Assign(event); } - - // Was it a button event? (*doesn't* mean: is any button *down*?) - bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } - - // Was it a down event from this (or any) button? - bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; - - // Was it a dclick event from this (or any) button? - bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; - - // Was it a up event from this (or any) button? - bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; - - // Was the given button? - bool Button(int but) const; - - // Was the given button in Down state? - bool ButtonIsDown(int but) const; - - // Get the button which is changing state (wxMOUSE_BTN_NONE if none) - int GetButton() const; - - // Find state of shift/control keys - bool ControlDown() const { return m_controlDown; } - bool MetaDown() const { return m_metaDown; } - bool AltDown() const { return m_altDown; } - bool ShiftDown() const { return m_shiftDown; } - bool CmdDown() const - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - // Find which event was just generated - bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } - bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } - bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } - - bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } - bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } - bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } - - bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } - bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } - bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } - - // Find the current state of the mouse buttons (regardless - // of current event type) - bool LeftIsDown() const { return m_leftDown; } - bool MiddleIsDown() const { return m_middleDown; } - bool RightIsDown() const { return m_rightDown; } - - // True if a button is down and the mouse is moving - bool Dragging() const - { - return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY); - } - - // True if the mouse is moving, and no button is down - bool Moving() const - { - return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY); - } - - // True if the mouse is just entering the window - bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); } - - // True if the mouse is just leaving the window - bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } - - // Find the position of the event - void GetPosition(wxCoord *xpos, wxCoord *ypos) const - { - if (xpos) - *xpos = m_x; - if (ypos) - *ypos = m_y; - } - - void GetPosition(long *xpos, long *ypos) const - { - if (xpos) - *xpos = (long)m_x; - if (ypos) - *ypos = (long)m_y; - } - - // Find the position of the event - wxPoint GetPosition() const { return wxPoint(m_x, m_y); } - - // Find the logical position of the event given the DC - wxPoint GetLogicalPosition(const wxDC& dc) const; - - // Get X position - wxCoord GetX() const { return m_x; } - - // Get Y position - wxCoord GetY() const { return m_y; } - - // Get wheel rotation, positive or negative indicates direction of - // rotation. Current devices all send an event when rotation is equal to - // +/-WheelDelta, but this allows for finer resolution devices to be - // created in the future. Because of this you shouldn't assume that one - // event is equal to 1 line or whatever, but you should be able to either - // do partial line scrolling or wait until +/-WheelDelta rotation values - // have been accumulated before scrolling. - int GetWheelRotation() const { return m_wheelRotation; } - - // Get wheel delta, normally 120. This is the threshold for action to be - // taken, and one such action (for example, scrolling one increment) - // should occur for each delta. - int GetWheelDelta() const { return m_wheelDelta; } - - // Returns the configured number of lines (or whatever) to be scrolled per - // wheel action. Defaults to one. - int GetLinesPerAction() const { return m_linesPerAction; } - - // Is the system set to do page scrolling? - bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } - - virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } - - wxMouseEvent& operator=(const wxMouseEvent& event) { Assign(event); return *this; } - -public: - wxCoord m_x, m_y; - - bool m_leftDown; - bool m_middleDown; - bool m_rightDown; - - bool m_controlDown; - bool m_shiftDown; - bool m_altDown; - bool m_metaDown; - - int m_wheelRotation; - int m_wheelDelta; - int m_linesPerAction; - -protected: - void Assign(const wxMouseEvent& evt); - -private: - DECLARE_DYNAMIC_CLASS(wxMouseEvent) -}; - -// Cursor set event - -/* - wxEVT_SET_CURSOR - */ - -class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent -{ -public: - wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0) - : wxEvent(0, wxEVT_SET_CURSOR), - m_x(x), m_y(y), m_cursor() - { } - - wxSetCursorEvent(const wxSetCursorEvent & event) - : wxEvent(event), - m_x(event.m_x), - m_y(event.m_y), - m_cursor(event.m_cursor) - { } - - wxCoord GetX() const { return m_x; } - wxCoord GetY() const { return m_y; } - - void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } - const wxCursor& GetCursor() const { return m_cursor; } - bool HasCursor() const { return m_cursor.Ok(); } - - virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } - -private: - wxCoord m_x, m_y; - wxCursor m_cursor; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent) -}; - -// Keyboard input event class - -/* - wxEVT_CHAR - wxEVT_CHAR_HOOK - wxEVT_KEY_DOWN - wxEVT_KEY_UP - wxEVT_HOTKEY - */ - -class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent -{ -public: - wxKeyEvent(wxEventType keyType = wxEVT_NULL); - wxKeyEvent(const wxKeyEvent& evt); - - // can be used check if the key event has exactly the given modifiers: - // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() - // && !MetaDown() && !AltDown() && !ShiftDown()" - int GetModifiers() const - { - return (m_controlDown ? wxMOD_CONTROL : 0) | - (m_shiftDown ? wxMOD_SHIFT : 0) | - (m_metaDown ? wxMOD_META : 0) | - (m_altDown ? wxMOD_ALT : 0); - } - - // Find state of shift/control keys - bool ControlDown() const { return m_controlDown; } - bool ShiftDown() const { return m_shiftDown; } - bool MetaDown() const { return m_metaDown; } - bool AltDown() const { return m_altDown; } - - // "Cmd" is a pseudo key which is Control for PC and Unix platforms but - // Apple ("Command") key under Macs: it makes often sense to use it instead - // of, say, ControlDown() because Cmd key is used for the same thing under - // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this - // purpose under Mac) - bool CmdDown() const - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - // exclude MetaDown() from HasModifiers() because NumLock under X is often - // configured as mod2 modifier, yet the key events even when it is pressed - // should be processed normally, not like Ctrl- or Alt-key - bool HasModifiers() const { return ControlDown() || AltDown(); } - - // get the key code: an ASCII7 char or an element of wxKeyCode enum - int GetKeyCode() const { return (int)m_keyCode; } - -#if wxUSE_UNICODE - // get the Unicode character corresponding to this key - wxChar GetUnicodeKey() const { return m_uniChar; } -#endif // wxUSE_UNICODE - - // get the raw key code (platform-dependent) - wxUint32 GetRawKeyCode() const { return m_rawCode; } - - // get the raw key flags (platform-dependent) - wxUint32 GetRawKeyFlags() const { return m_rawFlags; } - - // Find the position of the event - void GetPosition(wxCoord *xpos, wxCoord *ypos) const - { - if (xpos) *xpos = m_x; - if (ypos) *ypos = m_y; - } - - void GetPosition(long *xpos, long *ypos) const - { - if (xpos) *xpos = (long)m_x; - if (ypos) *ypos = (long)m_y; - } - - wxPoint GetPosition() const - { return wxPoint(m_x, m_y); } - - // Get X position - wxCoord GetX() const { return m_x; } - - // Get Y position - wxCoord GetY() const { return m_y; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, Use GetKeyCode instead. - wxDEPRECATED( long KeyCode() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } - - // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for - // example) - wxKeyEvent& operator=(const wxKeyEvent& evt) - { - m_x = evt.m_x; - m_y = evt.m_y; - - m_keyCode = evt.m_keyCode; - - m_controlDown = evt.m_controlDown; - m_shiftDown = evt.m_shiftDown; - m_altDown = evt.m_altDown; - m_metaDown = evt.m_metaDown; - m_scanCode = evt.m_scanCode; - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif - - return *this; - } - -public: - wxCoord m_x, m_y; - - long m_keyCode; - - // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX? - bool m_controlDown; - bool m_shiftDown; - bool m_altDown; - bool m_metaDown; - - // FIXME: what is this for? relation to m_rawXXX? - bool m_scanCode; - -#if wxUSE_UNICODE - // This contains the full Unicode character - // in a character events in Unicode mode - wxChar m_uniChar; -#endif - - // these fields contain the platform-specific information about - // key that was pressed - wxUint32 m_rawCode; - wxUint32 m_rawFlags; - -private: - DECLARE_DYNAMIC_CLASS(wxKeyEvent) -}; - -// Size event class -/* - wxEVT_SIZE - */ - -class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent -{ -public: - wxSizeEvent() : wxEvent(0, wxEVT_SIZE) - { } - wxSizeEvent(const wxSize& sz, int winid = 0) - : wxEvent(winid, wxEVT_SIZE), - m_size(sz) - { } - wxSizeEvent(const wxSizeEvent & event) - : wxEvent(event), - m_size(event.m_size), m_rect(event.m_rect) - { } - wxSizeEvent(const wxRect& rect, int id = 0) - : m_size(rect.GetSize()), m_rect(rect) - { m_eventType = wxEVT_SIZING; m_id = id; } - - wxSize GetSize() const { return m_size; } - wxRect GetRect() const { return m_rect; } - void SetRect(const wxRect& rect) { m_rect = rect; } - - virtual wxEvent *Clone() const { return new wxSizeEvent(*this); } - -public: - // For internal usage only. Will be converted to protected members. - wxSize m_size; - wxRect m_rect; // Used for wxEVT_SIZING - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent) -}; - -// Move event class - -/* - wxEVT_MOVE - */ - -class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent -{ -public: - wxMoveEvent() - : wxEvent(0, wxEVT_MOVE) - { } - wxMoveEvent(const wxPoint& pos, int winid = 0) - : wxEvent(winid, wxEVT_MOVE), - m_pos(pos) - { } - wxMoveEvent(const wxMoveEvent& event) - : wxEvent(event), - m_pos(event.m_pos) - { } - wxMoveEvent(const wxRect& rect, int id = 0) - : m_pos(rect.GetPosition()), m_rect(rect) - { m_eventType = wxEVT_MOVING; m_id = id; } - - wxPoint GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - wxRect GetRect() const { return m_rect; } - void SetRect(const wxRect& rect) { m_rect = rect; } - - virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxPoint m_pos; - wxRect m_rect; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent) -}; - -// Paint event class -/* - wxEVT_PAINT - wxEVT_NC_PAINT - wxEVT_PAINT_ICON - */ - -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined - extern WXDLLIMPEXP_CORE int g_isPainting; -#endif // debug - -class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent -{ -public: - wxPaintEvent(int Id = 0) - : wxEvent(Id, wxEVT_PAINT) - { -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - // set the internal flag for the duration of processing of WM_PAINT - g_isPainting++; -#endif // debug - } - - // default copy ctor and dtor are normally fine, we only need them to keep - // g_isPainting updated in debug build -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - wxPaintEvent(const wxPaintEvent& event) - : wxEvent(event) - { - g_isPainting++; - } - - virtual ~wxPaintEvent() - { - g_isPainting--; - } -#endif // debug - - virtual wxEvent *Clone() const { return new wxPaintEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent) -}; - -class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent -{ -public: - wxNcPaintEvent(int winid = 0) - : wxEvent(winid, wxEVT_NC_PAINT) - { } - - virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent) -}; - -// Erase background event class -/* - wxEVT_ERASE_BACKGROUND - */ - -class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent -{ -public: - wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) - : wxEvent(Id, wxEVT_ERASE_BACKGROUND), - m_dc(dc) - { } - - wxEraseEvent(const wxEraseEvent& event) - : wxEvent(event), - m_dc(event.m_dc) - { } - - wxDC *GetDC() const { return m_dc; } - - virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxDC *m_dc; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent) -}; - -// Focus event class -/* - wxEVT_SET_FOCUS - wxEVT_KILL_FOCUS - */ - -class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent -{ -public: - wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0) - : wxEvent(winid, type) - { m_win = NULL; } - - wxFocusEvent(const wxFocusEvent& event) - : wxEvent(event) - { m_win = event.m_win; } - - // The window associated with this event is the window which had focus - // before for SET event and the window which will have focus for the KILL - // one. NB: it may be NULL in both cases! - wxWindow *GetWindow() const { return m_win; } - void SetWindow(wxWindow *win) { m_win = win; } - - virtual wxEvent *Clone() const { return new wxFocusEvent(*this); } - -private: - wxWindow *m_win; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent) -}; - -// wxChildFocusEvent notifies the parent that a child has got the focus: unlike -// wxFocusEvent it is propagated upwards the window chain -class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent -{ -public: - wxChildFocusEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent) -}; - -// Activate event class -/* - wxEVT_ACTIVATE - wxEVT_ACTIVATE_APP - wxEVT_HIBERNATE - */ - -class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent -{ -public: - wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0) - : wxEvent(Id, type) - { m_active = active; } - wxActivateEvent(const wxActivateEvent& event) - : wxEvent(event) - { m_active = event.m_active; } - - bool GetActive() const { return m_active; } - - virtual wxEvent *Clone() const { return new wxActivateEvent(*this); } - -private: - bool m_active; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent) -}; - -// InitDialog event class -/* - wxEVT_INIT_DIALOG - */ - -class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent -{ -public: - wxInitDialogEvent(int Id = 0) - : wxEvent(Id, wxEVT_INIT_DIALOG) - { } - - virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent) -}; - -// Miscellaneous menu event class -/* - wxEVT_MENU_OPEN, - wxEVT_MENU_CLOSE, - wxEVT_MENU_HIGHLIGHT, -*/ - -class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent -{ -public: - wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) - : wxEvent(winid, type) - { m_menuId = winid; m_menu = menu; } - wxMenuEvent(const wxMenuEvent & event) - : wxEvent(event) - { m_menuId = event.m_menuId; m_menu = event.m_menu; } - - // only for wxEVT_MENU_HIGHLIGHT - int GetMenuId() const { return m_menuId; } - - // only for wxEVT_MENU_OPEN/CLOSE - bool IsPopup() const { return m_menuId == wxID_ANY; } - - // only for wxEVT_MENU_OPEN/CLOSE - wxMenu* GetMenu() const { return m_menu; } - - virtual wxEvent *Clone() const { return new wxMenuEvent(*this); } - -private: - int m_menuId; - wxMenu* m_menu; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent) -}; - -// Window close or session close event class -/* - wxEVT_CLOSE_WINDOW, - wxEVT_END_SESSION, - wxEVT_QUERY_END_SESSION - */ - -class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent -{ -public: - wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0) - : wxEvent(winid, type), - m_loggingOff(true), - m_veto(false), // should be false by default - m_canVeto(true) {} - - wxCloseEvent(const wxCloseEvent & event) - : wxEvent(event), - m_loggingOff(event.m_loggingOff), - m_veto(event.m_veto), - m_canVeto(event.m_canVeto) {} - - void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } - bool GetLoggingOff() const - { - // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it - // doesn't make sense for wxEVT_CLOSE_WINDOW - wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW, - wxT("this flag is for end session events only") ); - - return m_loggingOff; - } - - void Veto(bool veto = true) - { - // GetVeto() will return false anyhow... - wxCHECK_RET( m_canVeto, - wxT("call to Veto() ignored (can't veto this event)") ); - - m_veto = veto; - } - void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } - bool CanVeto() const { return m_canVeto; } - bool GetVeto() const { return m_canVeto && m_veto; } - - virtual wxEvent *Clone() const { return new wxCloseEvent(*this); } - -protected: - bool m_loggingOff, - m_veto, - m_canVeto; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent) -}; - -/* - wxEVT_SHOW - */ - -class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent -{ -public: - wxShowEvent(int winid = 0, bool show = false) - : wxEvent(winid, wxEVT_SHOW) - { m_show = show; } - wxShowEvent(const wxShowEvent & event) - : wxEvent(event) - { m_show = event.m_show; } - - void SetShow(bool show) { m_show = show; } - bool GetShow() const { return m_show; } -#if wxABI_VERSION >= 20811 - bool IsShown() const { return GetShow(); } -#endif - - virtual wxEvent *Clone() const { return new wxShowEvent(*this); } - -protected: - bool m_show; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent) -}; - -/* - wxEVT_ICONIZE - */ - -class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent -{ -public: - wxIconizeEvent(int winid = 0, bool iconized = true) - : wxEvent(winid, wxEVT_ICONIZE) - { m_iconized = iconized; } - wxIconizeEvent(const wxIconizeEvent & event) - : wxEvent(event) - { m_iconized = event.m_iconized; } - - // return true if the frame was iconized, false if restored - bool Iconized() const { return m_iconized; } -#if wxABI_VERSION >= 20811 - bool IsIconized() const { return Iconized(); } -#endif - virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } - -protected: - bool m_iconized; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent) -}; -/* - wxEVT_MAXIMIZE - */ - -class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent -{ -public: - wxMaximizeEvent(int winid = 0) - : wxEvent(winid, wxEVT_MAXIMIZE) - { } - - virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent) -}; - -// Joystick event class -/* - wxEVT_JOY_BUTTON_DOWN, - wxEVT_JOY_BUTTON_UP, - wxEVT_JOY_MOVE, - wxEVT_JOY_ZMOVE -*/ - -// Which joystick? Same as Windows ids so no conversion necessary. -enum -{ - wxJOYSTICK1, - wxJOYSTICK2 -}; - -// Which button is down? -enum -{ - wxJOY_BUTTON_ANY = -1, - wxJOY_BUTTON1 = 1, - wxJOY_BUTTON2 = 2, - wxJOY_BUTTON3 = 4, - wxJOY_BUTTON4 = 8 -}; - -class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent -{ -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxPoint m_pos; - int m_zPosition; - int m_buttonChange; // Which button changed? - int m_buttonState; // Which buttons are down? - int m_joyStick; // Which joystick? - -public: - wxJoystickEvent(wxEventType type = wxEVT_NULL, - int state = 0, - int joystick = wxJOYSTICK1, - int change = 0) - : wxEvent(0, type), - m_pos(), - m_zPosition(0), - m_buttonChange(change), - m_buttonState(state), - m_joyStick(joystick) - { - } - wxJoystickEvent(const wxJoystickEvent & event) - : wxEvent(event), - m_pos(event.m_pos), - m_zPosition(event.m_zPosition), - m_buttonChange(event.m_buttonChange), - m_buttonState(event.m_buttonState), - m_joyStick(event.m_joyStick) - { } - - wxPoint GetPosition() const { return m_pos; } - int GetZPosition() const { return m_zPosition; } - int GetButtonState() const { return m_buttonState; } - int GetButtonChange() const { return m_buttonChange; } - int GetJoystick() const { return m_joyStick; } - - void SetJoystick(int stick) { m_joyStick = stick; } - void SetButtonState(int state) { m_buttonState = state; } - void SetButtonChange(int change) { m_buttonChange = change; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - void SetZPosition(int zPos) { m_zPosition = zPos; } - - // Was it a button event? (*doesn't* mean: is any button *down*?) - bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || - (GetEventType() == wxEVT_JOY_BUTTON_UP)); } - - // Was it a move event? - bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); } - - // Was it a zmove event? - bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); } - - // Was it a down event from button 1, 2, 3, 4 or any? - bool ButtonDown(int but = wxJOY_BUTTON_ANY) const - { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && - ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } - - // Was it a up event from button 1, 2, 3 or any? - bool ButtonUp(int but = wxJOY_BUTTON_ANY) const - { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && - ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } - - // Was the given button 1,2,3,4 or any in Down state? - bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const - { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || - ((m_buttonState & but) == but)); } - - virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent) -}; - -// Drop files event class -/* - wxEVT_DROP_FILES - */ - -class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent -{ -public: - int m_noFiles; - wxPoint m_pos; - wxString* m_files; - - wxDropFilesEvent(wxEventType type = wxEVT_NULL, - int noFiles = 0, - wxString *files = (wxString *) NULL) - : wxEvent(0, type), - m_noFiles(noFiles), - m_pos(), - m_files(files) - { } - - // we need a copy ctor to avoid deleting m_files pointer twice - wxDropFilesEvent(const wxDropFilesEvent& other) - : wxEvent(other), - m_noFiles(other.m_noFiles), - m_pos(other.m_pos), - m_files(NULL) - { - m_files = new wxString[m_noFiles]; - for ( int n = 0; n < m_noFiles; n++ ) - { - m_files[n] = other.m_files[n]; - } - } - - virtual ~wxDropFilesEvent() - { - delete [] m_files; - } - - wxPoint GetPosition() const { return m_pos; } - int GetNumberOfFiles() const { return m_noFiles; } - wxString *GetFiles() const { return m_files; } - - virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent) -}; - -// Update UI event -/* - wxEVT_UPDATE_UI - */ - -// Whether to always send update events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_UI_UPDATES style. - -enum wxUpdateUIMode -{ - // Send UI update events to all windows - wxUPDATE_UI_PROCESS_ALL, - - // Send UI update events to windows that have - // the wxWS_EX_PROCESS_UI_UPDATES flag specified - wxUPDATE_UI_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent -{ -public: - wxUpdateUIEvent(wxWindowID commandId = 0) - : wxCommandEvent(wxEVT_UPDATE_UI, commandId) - { - m_checked = - m_enabled = - m_shown = - m_setEnabled = - m_setShown = - m_setText = - m_setChecked = false; - } - wxUpdateUIEvent(const wxUpdateUIEvent & event) - : wxCommandEvent(event), - m_checked(event.m_checked), - m_enabled(event.m_enabled), - m_shown(event.m_shown), - m_setEnabled(event.m_setEnabled), - m_setShown(event.m_setShown), - m_setText(event.m_setText), - m_setChecked(event.m_setChecked), - m_text(event.m_text) - { } - - bool GetChecked() const { return m_checked; } - bool GetEnabled() const { return m_enabled; } - bool GetShown() const { return m_shown; } - wxString GetText() const { return m_text; } - bool GetSetText() const { return m_setText; } - bool GetSetChecked() const { return m_setChecked; } - bool GetSetEnabled() const { return m_setEnabled; } - bool GetSetShown() const { return m_setShown; } - - void Check(bool check) { m_checked = check; m_setChecked = true; } - void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; } - void Show(bool show) { m_shown = show; m_setShown = true; } - void SetText(const wxString& text) { m_text = text; m_setText = true; } - - // Sets the interval between updates in milliseconds. - // Set to -1 to disable updates, or to 0 to update as frequently as possible. - static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; } - - // Returns the current interval between updates in milliseconds - static long GetUpdateInterval() { return sm_updateInterval; } - - // Can we update this window? - static bool CanUpdate(wxWindowBase *win); - - // Reset the update time to provide a delay until the next - // time we should update - static void ResetUpdateTime(); - - // Specify how wxWidgets will send update events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; } - - // Returns the UI update mode - static wxUpdateUIMode GetMode() { return sm_updateMode; } - - virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); } - -protected: - bool m_checked; - bool m_enabled; - bool m_shown; - bool m_setEnabled; - bool m_setShown; - bool m_setText; - bool m_setChecked; - wxString m_text; -#if wxUSE_LONGLONG - static wxLongLong sm_lastUpdate; -#endif - static long sm_updateInterval; - static wxUpdateUIMode sm_updateMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent) -}; - -/* - wxEVT_SYS_COLOUR_CHANGED - */ - -// TODO: shouldn't all events record the window ID? -class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent -{ -public: - wxSysColourChangedEvent() - : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED) - { } - - virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent) -}; - -/* - wxEVT_MOUSE_CAPTURE_CHANGED - The window losing the capture receives this message - (even if it released the capture itself). - */ - -class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent -{ -public: - wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL) - : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED), - m_gainedCapture(gainedCapture) - { } - - wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event) - : wxEvent(event), - m_gainedCapture(event.m_gainedCapture) - { } - - virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); } - - wxWindow* GetCapturedWindow() const { return m_gainedCapture; } - -private: - wxWindow* m_gainedCapture; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent) -}; - -/* - wxEVT_MOUSE_CAPTURE_LOST - The window losing the capture receives this message, unless it released it - it itself or unless wxWindow::CaptureMouse was called on another window - (and so capture will be restored when the new capturer releases it). - */ - -class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent -{ -public: - wxMouseCaptureLostEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST) - {} - - wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event) - : wxEvent(event) - {} - - virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); } - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent) -}; - -/* - wxEVT_DISPLAY_CHANGED - */ -class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent -{ -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent) - -public: - wxDisplayChangedEvent() - : wxEvent(0, wxEVT_DISPLAY_CHANGED) - { } - - virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); } -}; - -/* - wxEVT_PALETTE_CHANGED - */ - -class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent -{ -public: - wxPaletteChangedEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_PALETTE_CHANGED), - m_changedWindow((wxWindow *) NULL) - { } - - wxPaletteChangedEvent(const wxPaletteChangedEvent& event) - : wxEvent(event), - m_changedWindow(event.m_changedWindow) - { } - - void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } - wxWindow* GetChangedWindow() const { return m_changedWindow; } - - virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); } - -protected: - wxWindow* m_changedWindow; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent) -}; - -/* - wxEVT_QUERY_NEW_PALETTE - Indicates the window is getting keyboard focus and should re-do its palette. - */ - -class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent -{ -public: - wxQueryNewPaletteEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE), - m_paletteRealized(false) - { } - wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event) - : wxEvent(event), - m_paletteRealized(event.m_paletteRealized) - { } - - // App sets this if it changes the palette. - void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } - bool GetPaletteRealized() const { return m_paletteRealized; } - - virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); } - -protected: - bool m_paletteRealized; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent) -}; - -/* - Event generated by dialog navigation keys - wxEVT_NAVIGATION_KEY - */ -// NB: don't derive from command event to avoid being propagated to the parent -class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent -{ -public: - wxNavigationKeyEvent() - : wxEvent(0, wxEVT_NAVIGATION_KEY), - m_flags(IsForward | FromTab), // defaults are for TAB - m_focus((wxWindow *)NULL) - { - m_propagationLevel = wxEVENT_PROPAGATE_NONE; - } - - wxNavigationKeyEvent(const wxNavigationKeyEvent& event) - : wxEvent(event), - m_flags(event.m_flags), - m_focus(event.m_focus) - { } - - // direction: forward (true) or backward (false) - bool GetDirection() const - { return (m_flags & IsForward) != 0; } - void SetDirection(bool bForward) - { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; } - - // it may be a window change event (MDI, notebook pages...) or a control - // change event - bool IsWindowChange() const - { return (m_flags & WinChange) != 0; } - void SetWindowChange(bool bIs) - { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } - - // Set to true under MSW if the event was generated using the tab key. - // This is required for proper navogation over radio buttons - bool IsFromTab() const - { return (m_flags & FromTab) != 0; } - void SetFromTab(bool bIs) - { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } - - // the child which has the focus currently (may be NULL - use - // wxWindow::FindFocus then) - wxWindow* GetCurrentFocus() const { return m_focus; } - void SetCurrentFocus(wxWindow *win) { m_focus = win; } - - // Set flags - void SetFlags(long flags) { m_flags = flags; } - - virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); } - - enum - { - IsBackward = 0x0000, - IsForward = 0x0001, - WinChange = 0x0002, - FromTab = 0x0004 - }; - - long m_flags; - wxWindow *m_focus; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent) -}; - -// Window creation/destruction events: the first is sent as soon as window is -// created (i.e. the underlying GUI object exists), but when the C++ object is -// fully initialized (so virtual functions may be called). The second, -// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's -// still safe to call virtual functions at this moment -/* - wxEVT_CREATE - wxEVT_DESTROY - */ - -class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent -{ -public: - wxWindowCreateEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent) -}; - -class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent -{ -public: - wxWindowDestroyEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent) -}; - -// A help event is sent when the user clicks on a window in context-help mode. -/* - wxEVT_HELP - wxEVT_DETAILED_HELP -*/ - -class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent -{ -public: - // how was this help event generated? - enum Origin - { - Origin_Unknown, // unrecognized event source - Origin_Keyboard, // event generated from F1 key press - Origin_HelpButton // event from [?] button on the title bar (Windows) - }; - - wxHelpEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0, - const wxPoint& pt = wxDefaultPosition, - Origin origin = Origin_Unknown) - : wxCommandEvent(type, winid), - m_pos(pt), - m_origin(GuessOrigin(origin)) - { } - wxHelpEvent(const wxHelpEvent & event) - : wxCommandEvent(event), - m_pos(event.m_pos), - m_target(event.m_target), - m_link(event.m_link), - m_origin(event.m_origin) - { } - - // Position of event (in screen coordinates) - const wxPoint& GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - - // Optional link to further help - const wxString& GetLink() const { return m_link; } - void SetLink(const wxString& link) { m_link = link; } - - // Optional target to display help in. E.g. a window specification - const wxString& GetTarget() const { return m_target; } - void SetTarget(const wxString& target) { m_target = target; } - - virtual wxEvent *Clone() const { return new wxHelpEvent(*this); } - - // optional indication of the event source - Origin GetOrigin() const { return m_origin; } - void SetOrigin(Origin origin) { m_origin = origin; } - -protected: - wxPoint m_pos; - wxString m_target; - wxString m_link; - Origin m_origin; - - // we can try to guess the event origin ourselves, even if none is - // specified in the ctor - static Origin GuessOrigin(Origin origin); - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent) -}; - -// A Clipboard Text event is sent when a window intercepts text copy/cut/paste -// message, i.e. the user has cut/copied/pasted data from/into a text control -// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc. -// NOTE : under windows these events are *NOT* generated automatically -// for a Rich Edit text control. -/* -wxEVT_COMMAND_TEXT_COPY -wxEVT_COMMAND_TEXT_CUT -wxEVT_COMMAND_TEXT_PASTE -*/ - -class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent -{ -public: - wxClipboardTextEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0) - : wxCommandEvent(type, winid) - { } - wxClipboardTextEvent(const wxClipboardTextEvent & event) - : wxCommandEvent(event) - { } - - virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent) -}; - -// A Context event is sent when the user right clicks on a window or -// presses Shift-F10 -// NOTE : Under windows this is a repackaged WM_CONTETXMENU message -// Under other systems it may have to be generated from a right click event -/* - wxEVT_CONTEXT_MENU -*/ - -class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent -{ -public: - wxContextMenuEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0, - const wxPoint& pt = wxDefaultPosition) - : wxCommandEvent(type, winid), - m_pos(pt) - { } - wxContextMenuEvent(const wxContextMenuEvent & event) - : wxCommandEvent(event), - m_pos(event.m_pos) - { } - - // Position of event (in screen coordinates) - const wxPoint& GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - - virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); } - -protected: - wxPoint m_pos; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) -}; - -// Idle event -/* - wxEVT_IDLE - */ - -// Whether to always send idle events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_IDLE style. - -enum wxIdleMode -{ - // Send idle events to all windows - wxIDLE_PROCESS_ALL, - - // Send idle events to windows that have - // the wxWS_EX_PROCESS_IDLE flag specified - wxIDLE_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent -{ -public: - wxIdleEvent() - : wxEvent(0, wxEVT_IDLE), - m_requestMore(false) - { } - wxIdleEvent(const wxIdleEvent & event) - : wxEvent(event), - m_requestMore(event.m_requestMore) - { } - - void RequestMore(bool needMore = true) { m_requestMore = needMore; } - bool MoreRequested() const { return m_requestMore; } - - virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } - - // Specify how wxWidgets will send idle events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } - - // Returns the idle event mode - static wxIdleMode GetMode() { return sm_idleMode; } - - // Can we send an idle event? - static bool CanSend(wxWindow* win); - -protected: - bool m_requestMore; - static wxIdleMode sm_idleMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) -}; - -#endif // wxUSE_GUI - -/* TODO - wxEVT_MOUSE_CAPTURE_CHANGED, - wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) -// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate - // wxEVT_FONT_CHANGED to all other windows (maybe). - wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. - wxEVT_MEASURE_ITEM, - wxEVT_COMPARE_ITEM -*/ - - -// ============================================================================ -// event handler and related classes -// ============================================================================ - -// for backwards compatibility and to prevent eVC 4 for ARM from crashing with -// internal compiler error when compiling wx, we define wxObjectEventFunction -// as a wxObject method even though it can only be a wxEvtHandler one -typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); - -// we can't have ctors nor base struct in backwards compatibility mode or -// otherwise we won't be able to initialize the objects with an agregate, so -// we have to keep both versions -#if WXWIN_COMPATIBILITY_EVENT_TYPES - -struct WXDLLIMPEXP_BASE wxEventTableEntry -{ - // For some reason, this can't be wxEventType, or VC++ complains. - int m_eventType; // main event type - int m_id; // control/menu/toolbar id - int m_lastId; // used for ranges of ids - wxObjectEventFunction m_fn; // function to call: not wxEventFunction, - // because of dependency problems - - wxObject* m_callbackUserData; -}; - -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - -// struct containing the members common to static and dynamic event tables -// entries -struct WXDLLIMPEXP_BASE wxEventTableEntryBase -{ -private: - wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event); - -public: - wxEventTableEntryBase(int winid, int idLast, - wxObjectEventFunction fn, wxObject *data) - : m_id(winid), - m_lastId(idLast), - m_fn(fn), - m_callbackUserData(data) - { } - - wxEventTableEntryBase(const wxEventTableEntryBase& event) - : m_id(event.m_id), - m_lastId(event.m_lastId), - m_fn(event.m_fn), - m_callbackUserData(event.m_callbackUserData) - { } - - // the range of ids for this entry: if m_lastId == wxID_ANY, the range - // consists only of m_id, otherwise it is m_id..m_lastId inclusive - int m_id, - m_lastId; - - // function to call: not wxEventFunction, because of dependency problems - wxObjectEventFunction m_fn; - - // arbitrary user data asosciated with the callback - wxObject* m_callbackUserData; -}; - -// an entry from a static event table -struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase -{ - wxEventTableEntry(const int& evType, int winid, int idLast, - wxObjectEventFunction fn, wxObject *data) - : wxEventTableEntryBase(winid, idLast, fn, data), - m_eventType(evType) - { } - - // the reference to event type: this allows us to not care about the - // (undefined) order in which the event table entries and the event types - // are initialized: initially the value of this reference might be - // invalid, but by the time it is used for the first time, all global - // objects will have been initialized (including the event type constants) - // and so it will have the correct value when it is needed - const int& m_eventType; - -private: - wxEventTableEntry& operator=(const wxEventTableEntry&); -}; - -// an entry used in dynamic event table managed by wxEvtHandler::Connect() -struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase -{ - wxDynamicEventTableEntry(int evType, int winid, int idLast, - wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink) - : wxEventTableEntryBase(winid, idLast, fn, data), - m_eventType(evType), - m_eventSink(eventSink) - { } - - // not a reference here as we can't keep a reference to a temporary int - // created to wrap the constant value typically passed to Connect() - nor - // do we need it - int m_eventType; - - // Pointer to object whose function is fn - so we don't assume the - // EventFunction is always a member of the EventHandler receiving the - // message - wxEvtHandler* m_eventSink; - - DECLARE_NO_COPY_CLASS(wxDynamicEventTableEntry) -}; - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -// ---------------------------------------------------------------------------- -// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0} -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxEventTable -{ - const wxEventTable *baseTable; // base event table (next in chain) - const wxEventTableEntry *entries; // bottom of entry array -}; - -// ---------------------------------------------------------------------------- -// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups. -// ---------------------------------------------------------------------------- - -WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray); - -class WXDLLIMPEXP_BASE wxEventHashTable -{ -private: - // Internal data structs - struct EventTypeTable - { - wxEventType eventType; - wxEventTableEntryPointerArray eventEntryTable; - }; - typedef EventTypeTable* EventTypeTablePointer; - -public: - // Constructor, needs the event table it needs to hash later on. - // Note: hashing of the event table is not done in the constructor as it - // can be that the event table is not yet full initialize, the hash - // will gets initialized when handling the first event look-up request. - wxEventHashTable(const wxEventTable &table); - // Destructor. - ~wxEventHashTable(); - - // Handle the given event, in other words search the event table hash - // and call self->ProcessEvent() if a match was found. - bool HandleEvent(wxEvent &event, wxEvtHandler *self); - - // Clear table - void Clear(); - - // Clear all tables - static void ClearAll(); - // Rebuild all tables - static void ReconstructAll(); - -protected: - // Init the hash table with the entries of the static event table. - void InitHashTable(); - // Helper funtion of InitHashTable() to insert 1 entry into the hash table. - void AddEntry(const wxEventTableEntry &entry); - // Allocate and init with null pointers the base hash table. - void AllocEventTypeTable(size_t size); - // Grow the hash table in size and transfer all items currently - // in the table to the correct location in the new table. - void GrowEventTypeTable(); - -protected: - const wxEventTable &m_table; - bool m_rebuildHash; - - size_t m_size; - EventTypeTablePointer *m_eventTypeTable; - - static wxEventHashTable* sm_first; - wxEventHashTable* m_previous; - wxEventHashTable* m_next; - - DECLARE_NO_COPY_CLASS(wxEventHashTable) -}; - -// ---------------------------------------------------------------------------- -// wxEvtHandler: the base class for all objects handling wxWidgets events -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject -{ -public: - wxEvtHandler(); - virtual ~wxEvtHandler(); - - wxEvtHandler *GetNextHandler() const { return m_nextHandler; } - wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } - void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } - void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } - - void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } - bool GetEvtHandlerEnabled() const { return m_enabled; } - - // process an event right now - virtual bool ProcessEvent(wxEvent& event); - - // add an event to be processed later - void AddPendingEvent(wxEvent& event); - - void ProcessPendingEvents(); - -#if wxUSE_THREADS - bool ProcessThreadEvent(wxEvent& event); -#endif - - // Dynamic association of a member function handler with the event handler, - // winid and event type - void Connect(int winid, - int lastId, - int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL); - - // Convenience function: take just one id - void Connect(int winid, - int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } - - // Even more convenient: without id (same as using id of wxID_ANY) - void Connect(int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } - - bool Disconnect(int winid, - int lastId, - wxEventType eventType, - wxObjectEventFunction func = NULL, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL); - - bool Disconnect(int winid = wxID_ANY, - wxEventType eventType = wxEVT_NULL, - wxObjectEventFunction func = NULL, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } - - bool Disconnect(wxEventType eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } - - wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } - - // User data can be associated with each wxEvtHandler - void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } - wxClientData *GetClientObject() const { return DoGetClientObject(); } - - void SetClientData( void *data ) { DoSetClientData(data); } - void *GetClientData() const { return DoGetClientData(); } - - // check if the given event table entry matches this event and call the - // handler if it does - // - // return true if the event was processed, false otherwise (no match or the - // handler decided to skip the event) - static bool ProcessEventIfMatches(const wxEventTableEntryBase& tableEntry, - wxEvtHandler *handler, - wxEvent& event); - - // implementation from now on - virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); - bool SearchDynamicEventTable( wxEvent& event ); - -#if wxUSE_THREADS - void ClearEventLocker(); -#endif // wxUSE_THREADS - - // Avoid problems at exit by cleaning up static hash table gracefully - void ClearEventHashTable() { GetEventHashTable().Clear(); } - -private: - static const wxEventTableEntry sm_eventTableEntries[]; - -protected: - // hooks for wxWindow used by ProcessEvent() - // ----------------------------------------- - - // This one is called before trying our own event table to allow plugging - // in the validators. - // - // NB: This method is intentionally *not* inside wxUSE_VALIDATORS! - // It is part of wxBase which doesn't use validators and the code - // is compiled out when building wxBase w/o GUI classes, which affects - // binary compatibility and wxBase library can't be used by GUI - // ports. - virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; } - - // this one is called after failing to find the event handle in our own - // table to give a chance to the other windows to process it - // - // base class implementation passes the event to wxTheApp - virtual bool TryParent(wxEvent& event); - - - static const wxEventTable sm_eventTable; - virtual const wxEventTable *GetEventTable() const; - - static wxEventHashTable sm_eventHashTable; - virtual wxEventHashTable& GetEventHashTable() const; - - wxEvtHandler* m_nextHandler; - wxEvtHandler* m_previousHandler; - wxList* m_dynamicEvents; - wxList* m_pendingEvents; - -#if wxUSE_THREADS -#if defined (__VISAGECPP__) - const wxCriticalSection& Lock() const { return m_eventsLocker; } - wxCriticalSection& Lock() { return m_eventsLocker; } - - wxCriticalSection m_eventsLocker; -# else - const wxCriticalSection& Lock() const { return *m_eventsLocker; } - wxCriticalSection& Lock() { return *m_eventsLocker; } - - wxCriticalSection* m_eventsLocker; -# endif -#endif - - // Is event handler enabled? - bool m_enabled; - - - // The user data: either an object which will be deleted by the container - // when it's deleted or some raw pointer which we do nothing with - only - // one type of data can be used with the given window (i.e. you cannot set - // the void data and then associate the container with wxClientData or vice - // versa) - union - { - wxClientData *m_clientObject; - void *m_clientData; - }; - - // what kind of data do we have? - wxClientDataType m_clientDataType; - - // client data accessors - virtual void DoSetClientObject( wxClientData *data ); - virtual wxClientData *DoGetClientObject() const; - - virtual void DoSetClientData( void *data ); - virtual void *DoGetClientData() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) -}; - -// Post a message to the given eventhandler which will be processed during the -// next event loop iteration -inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event) -{ - wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") ); - - dest->AddPendingEvent(event); -} - -typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); - -#define wxEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func) - -#if wxUSE_GUI - -typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); -typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); -typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); -typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); -typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&); -typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&); -typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&); -typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&); -typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&); -typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&); -typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&); -typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&); -typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&); -typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&); -typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&); -typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&); -typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); -typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&); -typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&); -typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); -typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); -typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); -typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); -typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); -typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&); -typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); -typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); -typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); -typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&); -typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&); -typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); -typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); -typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); -typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&); -typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&); -typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); -typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); - -// these typedefs don't have the same name structure as the others, keep for -// backwards compatibility only -#if WXWIN_COMPATIBILITY_2_4 - typedef wxSysColourChangedEventFunction wxSysColourChangedFunction; - typedef wxDisplayChangedEventFunction wxDisplayChangedFunction; -#endif // WXWIN_COMPATIBILITY_2_4 - - -#define wxCommandEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) -#define wxScrollEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) -#define wxScrollWinEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) -#define wxSizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) -#define wxMoveEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) -#define wxPaintEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) -#define wxNcPaintEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) -#define wxEraseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) -#define wxMouseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) -#define wxCharEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) -#define wxKeyEventHandler(func) wxCharEventHandler(func) -#define wxFocusEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) -#define wxChildFocusEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) -#define wxActivateEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) -#define wxMenuEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) -#define wxJoystickEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) -#define wxDropFilesEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) -#define wxInitDialogEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) -#define wxSysColourChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) -#define wxDisplayChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) -#define wxUpdateUIEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) -#define wxIdleEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) -#define wxCloseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) -#define wxShowEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) -#define wxIconizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) -#define wxMaximizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) -#define wxNavigationKeyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) -#define wxPaletteChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) -#define wxQueryNewPaletteEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) -#define wxWindowCreateEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) -#define wxWindowDestroyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) -#define wxSetCursorEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) -#define wxNotifyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) -#define wxHelpEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) -#define wxContextMenuEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) -#define wxMouseCaptureChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) -#define wxMouseCaptureLostEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func) -#define wxClipboardTextEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func) - -#endif // wxUSE_GUI - -// N.B. In GNU-WIN32, you *have* to take the address of a member function -// (use &) or the compiler crashes... - -#define DECLARE_EVENT_TABLE() \ - private: \ - static const wxEventTableEntry sm_eventTableEntries[]; \ - protected: \ - static const wxEventTable sm_eventTable; \ - virtual const wxEventTable* GetEventTable() const; \ - static wxEventHashTable sm_eventHashTable; \ - virtual wxEventHashTable& GetEventHashTable() const; - -// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize -// sm_eventTable before using it in GetEventTable() or the compiler gives -// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews) - -#define BEGIN_EVENT_TABLE(theClass, baseClass) \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) }; - -/* - * Event table macros - */ - -// helpers for writing shorter code below: declare an event macro taking 2, 1 -// or none ids (the missing ids default to wxID_ANY) -// -// macro arguments: -// - evt one of wxEVT_XXX constants -// - id1, id2 ids of the first/last id -// - fn the function (should be cast to the right type) -#define wx__DECLARE_EVT2(evt, id1, id2, fn) \ - DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), -#define wx__DECLARE_EVT1(evt, id, fn) \ - wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) -#define wx__DECLARE_EVT0(evt, fn) \ - wx__DECLARE_EVT1(evt, wxID_ANY, fn) - - -// Generic events -#define EVT_CUSTOM(event, winid, func) \ - wx__DECLARE_EVT1(event, winid, wxEventHandler(func)) -#define EVT_CUSTOM_RANGE(event, id1, id2, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func)) - -// EVT_COMMAND -#define EVT_COMMAND(winid, event, func) \ - wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RANGE(id1, id2, event, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) - -#define EVT_NOTIFY(event, winid, func) \ - wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func)) -#define EVT_NOTIFY_RANGE(event, id1, id2, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func)) - -// Miscellaneous -#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func)) -#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) -#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) -#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) -#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) -#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) -#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) -#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func)) -#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func)) -#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func)) -#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func)) -#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func)) -#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func)) -#if wxUSE_HOTKEY -#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func)) -#endif -#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func)) -#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func)) -#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func)) -#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func)) -#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func)) -#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func)) -#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func)) -#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func)) -#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func)) -#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func)) -#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func)) -#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) -#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) -#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func)) -#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func)) -#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func)) -#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func)) -#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func)) -#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func)) -#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func)) -#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func)) -#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func)) -#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func)) -#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func)) -#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func)) -#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func)) -#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func)) -#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func)) - -// Mouse events -#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func)) -#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func)) -#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func)) -#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func)) -#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func)) -#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func)) -#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func)) -#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func)) -#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func)) -#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func)) -#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func)) -#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func)) -#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func)) - -// All mouse events -#define EVT_MOUSE_EVENTS(func) \ - EVT_LEFT_DOWN(func) \ - EVT_LEFT_UP(func) \ - EVT_MIDDLE_DOWN(func) \ - EVT_MIDDLE_UP(func) \ - EVT_RIGHT_DOWN(func) \ - EVT_RIGHT_UP(func) \ - EVT_MOTION(func) \ - EVT_LEFT_DCLICK(func) \ - EVT_MIDDLE_DCLICK(func) \ - EVT_RIGHT_DCLICK(func) \ - EVT_LEAVE_WINDOW(func) \ - EVT_ENTER_WINDOW(func) \ - EVT_MOUSEWHEEL(func) - -// Scrolling from wxWindow (sent to wxScrolledWindow) -#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func)) - -#define EVT_SCROLLWIN(func) \ - EVT_SCROLLWIN_TOP(func) \ - EVT_SCROLLWIN_BOTTOM(func) \ - EVT_SCROLLWIN_LINEUP(func) \ - EVT_SCROLLWIN_LINEDOWN(func) \ - EVT_SCROLLWIN_PAGEUP(func) \ - EVT_SCROLLWIN_PAGEDOWN(func) \ - EVT_SCROLLWIN_THUMBTRACK(func) \ - EVT_SCROLLWIN_THUMBRELEASE(func) - -// Scrolling from wxSlider and wxScrollBar -#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func)) -#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func)) -#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func)) -#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func)) -#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func)) -#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func)) -#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func)) -#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func)) -#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func)) - -#define EVT_SCROLL(func) \ - EVT_SCROLL_TOP(func) \ - EVT_SCROLL_BOTTOM(func) \ - EVT_SCROLL_LINEUP(func) \ - EVT_SCROLL_LINEDOWN(func) \ - EVT_SCROLL_PAGEUP(func) \ - EVT_SCROLL_PAGEDOWN(func) \ - EVT_SCROLL_THUMBTRACK(func) \ - EVT_SCROLL_THUMBRELEASE(func) \ - EVT_SCROLL_CHANGED(func) - -// Scrolling from wxSlider and wxScrollBar, with an id -#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func)) - -#define EVT_COMMAND_SCROLL(winid, func) \ - EVT_COMMAND_SCROLL_TOP(winid, func) \ - EVT_COMMAND_SCROLL_BOTTOM(winid, func) \ - EVT_COMMAND_SCROLL_LINEUP(winid, func) \ - EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \ - EVT_COMMAND_SCROLL_PAGEUP(winid, func) \ - EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \ - EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \ - EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ - EVT_COMMAND_SCROLL_CHANGED(winid, func) - -#if WXWIN_COMPATIBILITY_2_6 - // compatibility macros for the old name, deprecated in 2.8 - #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED - #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED - #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED -#endif // WXWIN_COMPATIBILITY_2_6 - -// Convenience macros for commonly-used commands -#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func)) -#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func)) -#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func)) -#if defined(__SMARTPHONE__) -# define EVT_BUTTON(winid, func) EVT_MENU(winid, func) -#else -# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func)) -#endif -#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func)) -#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func)) -// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events -#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func)) -#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func)) -#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) -#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func)) -#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func)) - -// Generic command events -#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func)) - -// Joystick events - -#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func)) -#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func)) -#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) -#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) - -// These are obsolete, see _BUTTON_ events -#if WXWIN_COMPATIBILITY_2_4 - #define EVT_JOY_DOWN(func) EVT_JOY_BUTTON_DOWN(func) - #define EVT_JOY_UP(func) EVT_JOY_BUTTON_UP(func) -#endif // WXWIN_COMPATIBILITY_2_4 - -// All joystick events -#define EVT_JOYSTICK_EVENTS(func) \ - EVT_JOY_BUTTON_DOWN(func) \ - EVT_JOY_BUTTON_UP(func) \ - EVT_JOY_MOVE(func) \ - EVT_JOY_ZMOVE(func) - -// Idle event -#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func)) - -// Update UI event -#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func)) -#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func)) - -// Help events -#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func)) -#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func)) -#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func)) -#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func)) - -// Context Menu Events -#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func)) -#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func)) - -// Clipboard text Events -#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func)) -#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func)) -#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) - -// ---------------------------------------------------------------------------- -// Global data -// ---------------------------------------------------------------------------- - -// for pending event processing - notice that there is intentionally no -// WXDLLEXPORT here -extern WXDLLIMPEXP_BASE wxList *wxPendingEvents; -#if wxUSE_THREADS - extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker; -#endif - -// ---------------------------------------------------------------------------- -// Helper functions -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -// Find a window with the focus, that is also a descendant of the given window. -// This is used to determine the window to initially send commands to. -WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); - -#endif // wxUSE_GUI - -#endif // _WX_EVENT_H__ diff --git a/Source/3rdParty/wx/include/wx/evtloop.h b/Source/3rdParty/wx/include/wx/evtloop.h deleted file mode 100644 index 3f44e8688..000000000 --- a/Source/3rdParty/wx/include/wx/evtloop.h +++ /dev/null @@ -1,229 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/evtloop.h -// Purpose: declares wxEventLoop class -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.06.01 -// RCS-ID: $Id: evtloop.h 53607 2008-05-16 15:21:40Z SN $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EVTLOOP_H_ -#define _WX_EVTLOOP_H_ - -#include "wx/utils.h" - -class WXDLLIMPEXP_FWD_CORE wxEventLoop; - -// ---------------------------------------------------------------------------- -// wxEventLoop: a GUI event loop -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEventLoopBase -{ -public: - // trivial, but needed (because of wxEventLoopBase) ctor - wxEventLoopBase() { } - - // dtor - virtual ~wxEventLoopBase() { } - - // start the event loop, return the exit code when it is finished - virtual int Run() = 0; - - // exit from the loop with the given exit code - virtual void Exit(int rc = 0) = 0; - - // return true if any events are available - virtual bool Pending() const = 0; - - // dispatch a single event, return false if we should exit from the loop - virtual bool Dispatch() = 0; - - // return currently active (running) event loop, may be NULL - static wxEventLoop *GetActive() { return ms_activeLoop; } - - // set currently active (running) event loop - static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; } - - // is this event loop running now? - // - // notice that even if this event loop hasn't terminated yet but has just - // spawned a nested (e.g. modal) event loop, this would return false - bool IsRunning() const; - -protected: - // this function should be called before the event loop terminates, whether - // this happens normally (because of Exit() call) or abnormally (because of - // an exception thrown from inside the loop) - virtual void OnExit() { } - - - // the pointer to currently active loop - static wxEventLoop *ms_activeLoop; - - DECLARE_NO_COPY_CLASS(wxEventLoopBase) -}; - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) - -// this class can be used to implement a standard event loop logic using -// Pending() and Dispatch() -// -// it also handles idle processing automatically -class WXDLLEXPORT wxEventLoopManual : public wxEventLoopBase -{ -public: - wxEventLoopManual(); - - // enters a loop calling OnNextIteration(), Pending() and Dispatch() and - // terminating when Exit() is called - virtual int Run(); - - // sets the "should exit" flag and wakes up the loop so that it terminates - // soon - virtual void Exit(int rc = 0); - -protected: - // implement this to wake up the loop: usually done by posting a dummy event - // to it (called from Exit()) - virtual void WakeUp() = 0; - - // may be overridden to perform some action at the start of each new event - // loop iteration - virtual void OnNextIteration() { } - - - // the loop exit code - int m_exitcode; - - // should we exit the loop? - bool m_shouldExit; -}; - -#endif // platforms using "manual" loop - -// we're moving away from old m_impl wxEventLoop model as otherwise the user -// code doesn't have access to platform-specific wxEventLoop methods and this -// can sometimes be very useful (e.g. under MSW this is necessary for -// integration with MFC) but currently this is done for MSW only, other ports -// should follow a.s.a.p. -#if defined(__WXPALMOS__) - #include "wx/palmos/evtloop.h" -#elif defined(__WXMSW__) - #include "wx/msw/evtloop.h" -#elif defined(__WXMAC__) - #include "wx/mac/evtloop.h" -#elif defined(__WXDFB__) - #include "wx/dfb/evtloop.h" -#else // other platform - -class WXDLLEXPORT wxEventLoopImpl; - -class WXDLLEXPORT wxEventLoop : public wxEventLoopBase -{ -public: - wxEventLoop() { m_impl = NULL; } - virtual ~wxEventLoop(); - - virtual int Run(); - virtual void Exit(int rc = 0); - virtual bool Pending() const; - virtual bool Dispatch(); - -protected: - // the pointer to the port specific implementation class - wxEventLoopImpl *m_impl; - - DECLARE_NO_COPY_CLASS(wxEventLoop) -}; - -#endif // platforms - -inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } - -// ---------------------------------------------------------------------------- -// wxModalEventLoop -// ---------------------------------------------------------------------------- - -// this is a naive generic implementation which uses wxWindowDisabler to -// implement modality, we will surely need platform-specific implementations -// too, this generic implementation is here only temporarily to see how it -// works -class WXDLLEXPORT wxModalEventLoop : public wxEventLoop -{ -public: - wxModalEventLoop(wxWindow *winModal) - { - m_windowDisabler = new wxWindowDisabler(winModal); - } - -protected: - virtual void OnExit() - { - delete m_windowDisabler; - m_windowDisabler = NULL; - - wxEventLoop::OnExit(); - } - -private: - wxWindowDisabler *m_windowDisabler; -}; - -// ---------------------------------------------------------------------------- -// wxEventLoopActivator: helper class for wxEventLoop implementations -// ---------------------------------------------------------------------------- - -// this object sets the wxEventLoop given to the ctor as the currently active -// one and unsets it in its dtor, this is especially useful in presence of -// exceptions but is more tidy even when we don't use them -class wxEventLoopActivator -{ -public: - wxEventLoopActivator(wxEventLoop *evtLoop) - { - m_evtLoopOld = wxEventLoop::GetActive(); - wxEventLoop::SetActive(evtLoop); - } - - ~wxEventLoopActivator() - { - // restore the previously active event loop - wxEventLoop::SetActive(m_evtLoopOld); - } - -private: - wxEventLoop *m_evtLoopOld; -}; - -#if wxABI_VERSION >= 20808 -class wxEventLoopGuarantor -{ -public: - wxEventLoopGuarantor() - { - m_evtLoopNew = NULL; - if (!wxEventLoop::GetActive()) - { - m_evtLoopNew = new wxEventLoop; - wxEventLoop::SetActive(m_evtLoopNew); - } - } - - ~wxEventLoopGuarantor() - { - if (m_evtLoopNew) - { - wxEventLoop::SetActive(NULL); - delete m_evtLoopNew; - } - } - -private: - wxEventLoop *m_evtLoopNew; -}; -#endif // wxABI_VERSION >= 20805 - -#endif // _WX_EVTLOOP_H_ diff --git a/Source/3rdParty/wx/include/wx/except.h b/Source/3rdParty/wx/include/wx/except.h deleted file mode 100644 index f6310a57f..000000000 --- a/Source/3rdParty/wx/include/wx/except.h +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/except.h -// Purpose: C++ exception related stuff -// Author: Vadim Zeitlin -// Modified by: -// Created: 17.09.2003 -// RCS-ID: $Id: except.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EXCEPT_H_ -#define _WX_EXCEPT_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// macros working whether wxUSE_EXCEPTIONS is 0 or 1 -// ---------------------------------------------------------------------------- - -#if wxUSE_EXCEPTIONS - #define wxTRY try - #define wxCATCH_ALL(code) catch ( ... ) { code } -#else // !wxUSE_EXCEPTIONS - #define wxTRY - #define wxCATCH_ALL(code) -#endif // wxUSE_EXCEPTIONS/!wxUSE_EXCEPTIONS - -#endif // _WX_EXCEPT_H_ - diff --git a/Source/3rdParty/wx/include/wx/fdrepdlg.h b/Source/3rdParty/wx/include/wx/fdrepdlg.h deleted file mode 100644 index 87d154497..000000000 --- a/Source/3rdParty/wx/include/wx/fdrepdlg.h +++ /dev/null @@ -1,195 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fdrepdlg.h -// Purpose: wxFindReplaceDialog class -// Author: Markus Greither and Vadim Zeitlin -// Modified by: -// Created: 23/03/2001 -// RCS-ID: -// Copyright: (c) Markus Greither -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FINDREPLACEDLG_H_ -#define _WX_FINDREPLACEDLG_H_ - -#include "wx/defs.h" - -#if wxUSE_FINDREPLDLG - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceData; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl; - -// ---------------------------------------------------------------------------- -// Flags for wxFindReplaceData.Flags -// ---------------------------------------------------------------------------- - -// flages used by wxFindDialogEvent::GetFlags() -enum wxFindReplaceFlags -{ - // downward search/replace selected (otherwise - upwards) - wxFR_DOWN = 1, - - // whole word search/replace selected - wxFR_WHOLEWORD = 2, - - // case sensitive search/replace selected (otherwise - case insensitive) - wxFR_MATCHCASE = 4 -}; - -// these flags can be specified in wxFindReplaceDialog ctor or Create() -enum wxFindReplaceDialogStyles -{ - // replace dialog (otherwise find dialog) - wxFR_REPLACEDIALOG = 1, - - // don't allow changing the search direction - wxFR_NOUPDOWN = 2, - - // don't allow case sensitive searching - wxFR_NOMATCHCASE = 4, - - // don't allow whole word searching - wxFR_NOWHOLEWORD = 8 -}; - -// ---------------------------------------------------------------------------- -// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceData : public wxObject -{ -public: - wxFindReplaceData() { Init(); } - wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); } - - // accessors - const wxString& GetFindString() { return m_FindWhat; } - const wxString& GetReplaceString() { return m_ReplaceWith; } - - int GetFlags() const { return m_Flags; } - - // setters: may only be called before showing the dialog, no effect later - void SetFlags(wxUint32 flags) { m_Flags = flags; } - - void SetFindString(const wxString& str) { m_FindWhat = str; } - void SetReplaceString(const wxString& str) { m_ReplaceWith = str; } - -protected: - void Init(); - -private: - wxUint32 m_Flags; - wxString m_FindWhat, - m_ReplaceWith; - - friend class wxFindReplaceDialogBase; -}; - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialogBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceDialogBase : public wxDialog -{ -public: - // ctors and such - wxFindReplaceDialogBase() { m_FindReplaceData = NULL; } - wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent), - wxFindReplaceData *data, - const wxString& WXUNUSED(title), - int WXUNUSED(style) = 0) - { - m_FindReplaceData = data; - } - - virtual ~wxFindReplaceDialogBase(); - - // find dialog data access - const wxFindReplaceData *GetData() const { return m_FindReplaceData; } - void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; } - - // implementation only, don't use - void Send(wxFindDialogEvent& event); - -protected: - wxFindReplaceData *m_FindReplaceData; - - // the last string we searched for - wxString m_lastSearch; - - DECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase) -}; - -// include wxFindReplaceDialog declaration -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__) - #include "wx/msw/fdrepdlg.h" -#else - #define wxGenericFindReplaceDialog wxFindReplaceDialog - - #include "wx/generic/fdrepdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialog events -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindDialogEvent : public wxCommandEvent -{ -public: - wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0) - : wxCommandEvent(commandType, id) { } - - int GetFlags() const { return GetInt(); } - wxString GetFindString() const { return GetString(); } - const wxString& GetReplaceString() const { return m_strReplace; } - - wxFindReplaceDialog *GetDialog() const - { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); } - - // implementation only - void SetFlags(int flags) { SetInt(flags); } - void SetFindString(const wxString& str) { SetString(str); } - void SetReplaceString(const wxString& str) { m_strReplace = str; } - -private: - wxString m_strReplace; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFindDialogEvent) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND, 510) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT, 511) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE, 512) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL, 513) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE, 514) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); - -#define wxFindDialogEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFindDialogEventFunction, &func) - -#define EVT_FIND(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_NEXT(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_NEXT, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_REPLACE(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_REPLACE_ALL(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_CLOSE(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_CLOSE, id, wxFindDialogEventHandler(fn)) - -#endif // wxUSE_FINDREPLDLG - -#endif - // _WX_FDREPDLG_H diff --git a/Source/3rdParty/wx/include/wx/features.h b/Source/3rdParty/wx/include/wx/features.h deleted file mode 100644 index 953940a87..000000000 --- a/Source/3rdParty/wx/include/wx/features.h +++ /dev/null @@ -1,64 +0,0 @@ -/** -* Name: wx/features.h -* Purpose: test macros for the features which might be available in some -* wxWidgets ports but not others -* Author: Vadim Zeitlin -* Modified by: Ryan Norton (Converted to C) -* Created: 18.03.02 -* RCS-ID: $Id: features.h 40865 2006-08-27 09:42:42Z VS $ -* Copyright: (c) 2002 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_FEATURES_H_ -#define _WX_FEATURES_H_ - -/* radio menu items are currently not implemented in wxMotif, use this - symbol (kept for compatibility from the time when they were not implemented - under other platforms as well) to test for this */ -#if !defined(__WXMOTIF__) - #define wxHAS_RADIO_MENU_ITEMS -#else - #undef wxHAS_RADIO_MENU_ITEMS -#endif - -/* the raw keyboard codes are generated under wxGTK and wxMSW only */ -#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \ - || defined(__WXDFB__) - #define wxHAS_RAW_KEY_CODES -#else - #undef wxHAS_RAW_KEY_CODES -#endif - -/* taskbar is implemented in the major ports */ -#if defined(__WXMSW__) || defined(__WXCOCOA__) \ - || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ - || defined(__WXMAC_OSX__) || defined(__WXCOCOA__) - #define wxHAS_TASK_BAR_ICON -#else - #undef wxHAS_TASK_BAR_ICON -#endif - -/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */ -/* separate define for it */ -#define wxHAS_ICON_LOCATION - -/* same for wxCrashReport */ -#ifdef __WXMSW__ - #define wxHAS_CRASH_REPORT -#else - #undef wxHAS_CRASH_REPORT -#endif - -/* wxRE_ADVANCED is not always available, depending on regex library used - * (it's unavailable only if compiling via configure against system library) */ -#ifndef WX_NO_REGEX_ADVANCED - #define wxHAS_REGEX_ADVANCED -#else - #undef wxHAS_REGEX_ADVANCED -#endif - -#endif /* _WX_FEATURES_H_ */ - diff --git a/Source/3rdParty/wx/include/wx/ffile.h b/Source/3rdParty/wx/include/wx/ffile.h deleted file mode 100644 index 26f1b4e3e..000000000 --- a/Source/3rdParty/wx/include/wx/ffile.h +++ /dev/null @@ -1,115 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ffile.h -// Purpose: wxFFile - encapsulates "FILE *" stream -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.07.99 -// RCS-ID: $Id: ffile.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FFILE_H_ -#define _WX_FFILE_H_ - -#include "wx/defs.h" // for wxUSE_FFILE - -#if wxUSE_FFILE - -#include "wx/string.h" -#include "wx/filefn.h" -#include "wx/convauto.h" - -#include - -// ---------------------------------------------------------------------------- -// class wxFFile: standard C stream library IO -// -// NB: for space efficiency this class has no virtual functions, including -// dtor which is _not_ virtual, so it shouldn't be used as a base class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFFile -{ -public: - // ctors - // ----- - // def ctor - wxFFile() { m_fp = NULL; } - // open specified file (may fail, use IsOpened()) - wxFFile(const wxChar *filename, const wxChar *mode = wxT("r")); - // attach to (already opened) file - wxFFile(FILE *lfp) { m_fp = lfp; } - - // open/close - // open a file (existing or not - the mode controls what happens) - bool Open(const wxChar *filename, const wxChar *mode = wxT("r")); - // closes the opened file (this is a NOP if not opened) - bool Close(); - - // assign an existing file descriptor and get it back from wxFFile object - void Attach(FILE *lfp, const wxString& name = wxEmptyString) - { Close(); m_fp = lfp; m_name = name; } - void Detach() { m_fp = NULL; } - FILE *fp() const { return m_fp; } - - // read/write (unbuffered) - // read all data from the file into a string (useful for text files) - bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); - // returns number of bytes read - use Eof() and Error() to see if an error - // occurred or not - size_t Read(void *pBuf, size_t nCount); - // returns the number of bytes written - size_t Write(const void *pBuf, size_t nCount); - // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()) - { - const wxWX2MBbuf buf = s.mb_str(conv); - size_t size = strlen(buf); - return Write((const char *)buf, size) == size; - } - // flush data not yet written - bool Flush(); - - // file pointer operations (return ofsInvalid on failure) - // move ptr ofs bytes related to start/current pos/end of file - bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); - // move ptr to ofs bytes before the end - bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } - // get current position in the file - wxFileOffset Tell() const; - // get current file length - wxFileOffset Length() const; - - // simple accessors: note that Eof() and Error() may only be called if - // IsOpened()! - // is file opened? - bool IsOpened() const { return m_fp != NULL; } - // is end of file reached? - bool Eof() const { return feof(m_fp) != 0; } - // has an error occurred? - bool Error() const { return ferror(m_fp) != 0; } - // get the file name - const wxString& GetName() const { return m_name; } - // type such as disk or pipe - wxFileKind GetKind() const { return wxGetFileKind(m_fp); } - - // dtor closes the file if opened - ~wxFFile() { Close(); } - -private: - // copy ctor and assignment operator are private because it doesn't make - // sense to copy files this way: attempt to do it will provoke a compile-time - // error. - wxFFile(const wxFFile&); - wxFFile& operator=(const wxFFile&); - - FILE *m_fp; // IO stream or NULL if not opened - - wxString m_name; // the name of the file (for diagnostic messages) -}; - -#endif // wxUSE_FFILE - -#endif // _WX_FFILE_H_ - diff --git a/Source/3rdParty/wx/include/wx/file.h b/Source/3rdParty/wx/include/wx/file.h deleted file mode 100644 index a2ccd4223..000000000 --- a/Source/3rdParty/wx/include/wx/file.h +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: wxFile - encapsulates low-level "file descriptor" -// wxTempFile - safely replace the old file -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: file.h 46331 2007-06-05 13:16:11Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEH__ -#define _WX_FILEH__ - -#include "wx/defs.h" - -#if wxUSE_FILE - -#include "wx/string.h" -#include "wx/filefn.h" -#include "wx/strconv.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// we redefine these constants here because S_IREAD &c are _not_ standard -// however, we do assume that the values correspond to the Unix umask bits -#define wxS_IRUSR 00400 -#define wxS_IWUSR 00200 -#define wxS_IXUSR 00100 - -#define wxS_IRGRP 00040 -#define wxS_IWGRP 00020 -#define wxS_IXGRP 00010 - -#define wxS_IROTH 00004 -#define wxS_IWOTH 00002 -#define wxS_IXOTH 00001 - -// default mode for the new files: corresponds to umask 022 -#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\ - wxS_IROTH | wxS_IWOTH) - -// ---------------------------------------------------------------------------- -// class wxFile: raw file IO -// -// NB: for space efficiency this class has no virtual functions, including -// dtor which is _not_ virtual, so it shouldn't be used as a base class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFile -{ -public: - // more file constants - // ------------------- - // opening mode - enum OpenMode { read, write, read_write, write_append, write_excl }; - // standard values for file descriptor - enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr }; - - // static functions - // ---------------- - // check whether a regular file by this name exists - static bool Exists(const wxChar *name); - // check whether we can access the given file in given mode - // (only read and write make sense here) - static bool Access(const wxChar *name, OpenMode mode); - - // ctors - // ----- - // def ctor - wxFile() { m_fd = fd_invalid; m_error = false; } - // open specified file (may fail, use IsOpened()) - wxFile(const wxChar *szFileName, OpenMode mode = read); - // attach to (already opened) file - wxFile(int lfd) { m_fd = lfd; m_error = false; } - - // open/close - // create a new file (with the default value of bOverwrite, it will fail if - // the file already exists, otherwise it will overwrite it and succeed) - bool Create(const wxChar *szFileName, bool bOverwrite = false, - int access = wxS_DEFAULT); - bool Open(const wxChar *szFileName, OpenMode mode = read, - int access = wxS_DEFAULT); - bool Close(); // Close is a NOP if not opened - - // assign an existing file descriptor and get it back from wxFile object - void Attach(int lfd) { Close(); m_fd = lfd; m_error = false; } - void Detach() { m_fd = fd_invalid; } - int fd() const { return m_fd; } - - // read/write (unbuffered) - // returns number of bytes read or wxInvalidOffset on error - ssize_t Read(void *pBuf, size_t nCount); - // returns the number of bytes written - size_t Write(const void *pBuf, size_t nCount); - // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8) - { - const wxWX2MBbuf buf = s.mb_str(conv); - if (!buf) - return false; - size_t size = strlen(buf); - return Write((const char *) buf, size) == size; - } - // flush data not yet written - bool Flush(); - - // file pointer operations (return wxInvalidOffset on failure) - // move ptr ofs bytes related to start/current offset/end of file - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); - // move ptr to ofs bytes before the end - wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } - // get current offset - wxFileOffset Tell() const; - // get current file length - wxFileOffset Length() const; - - // simple accessors - // is file opened? - bool IsOpened() const { return m_fd != fd_invalid; } - // is end of file reached? - bool Eof() const; - // has an error occurred? - bool Error() const { return m_error; } - // type such as disk or pipe - wxFileKind GetKind() const { return wxGetFileKind(m_fd); } - - // dtor closes the file if opened - ~wxFile() { Close(); } - -private: - // copy ctor and assignment operator are private because - // it doesn't make sense to copy files this way: - // attempt to do it will provoke a compile-time error. - wxFile(const wxFile&); - wxFile& operator=(const wxFile&); - - int m_fd; // file descriptor or INVALID_FD if not opened - bool m_error; // error memory -}; - -// ---------------------------------------------------------------------------- -// class wxTempFile: if you want to replace another file, create an instance -// of wxTempFile passing the name of the file to be replaced to the ctor. Then -// you can write to wxTempFile and call Commit() function to replace the old -// file (and close this one) or call Discard() to cancel the modification. If -// you call neither of them, dtor will call Discard(). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTempFile -{ -public: - // ctors - // default - wxTempFile() { } - // associates the temp file with the file to be replaced and opens it - wxTempFile(const wxString& strName); - - // open the temp file (strName is the name of file to be replaced) - bool Open(const wxString& strName); - - // is the file opened? - bool IsOpened() const { return m_file.IsOpened(); } - // get current file length - wxFileOffset Length() const { return m_file.Length(); } - // move ptr ofs bytes related to start/current offset/end of file - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) - { return m_file.Seek(ofs, mode); } - // get current offset - wxFileOffset Tell() const { return m_file.Tell(); } - - // I/O (both functions return true on success, false on failure) - bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } - bool Write(const wxString& str, const wxMBConv& conv = wxConvUTF8) - { return m_file.Write(str, conv); } - - // different ways to close the file - // validate changes and delete the old file of name m_strName - bool Commit(); - // discard changes - void Discard(); - - // dtor calls Discard() if file is still opened - ~wxTempFile(); - -private: - // no copy ctor/assignment operator - wxTempFile(const wxTempFile&); - wxTempFile& operator=(const wxTempFile&); - - wxString m_strName, // name of the file to replace in Commit() - m_strTemp; // temporary file name - wxFile m_file; // the temporary file -}; - -#endif // wxUSE_FILE - -#endif // _WX_FILEH__ diff --git a/Source/3rdParty/wx/include/wx/fileconf.h b/Source/3rdParty/wx/include/wx/fileconf.h deleted file mode 100644 index 47c483f26..000000000 --- a/Source/3rdParty/wx/include/wx/fileconf.h +++ /dev/null @@ -1,246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fileconf.h -// Purpose: wxFileConfig derivation of wxConfigBase -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.04.98 (adapted from appconf.cpp) -// RCS-ID: $Id: fileconf.h 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin -// Ballueder@usa.net -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _FILECONF_H -#define _FILECONF_H - -#include "wx/defs.h" - -#if wxUSE_CONFIG - -#include "wx/textfile.h" -#include "wx/string.h" -#include "wx/confbase.h" - -// ---------------------------------------------------------------------------- -// wxFileConfig -// ---------------------------------------------------------------------------- - -/* - wxFileConfig derives from base Config and implements file based config class, - i.e. it uses ASCII disk files to store the information. These files are - alternatively called INI, .conf or .rc in the documentation. They are - organized in groups or sections, which can nest (i.e. a group contains - subgroups, which contain their own subgroups &c). Each group has some - number of entries, which are "key = value" pairs. More precisely, the format - is: - - # comments are allowed after either ';' or '#' (Win/UNIX standard) - - # blank lines (as above) are ignored - - # global entries are members of special (no name) top group - written_for = Windows - platform = Linux - - # the start of the group 'Foo' - [Foo] # may put comments like this also - # following 3 lines are entries - key = value - another_key = " strings with spaces in the beginning should be quoted, \ - otherwise the spaces are lost" - last_key = but you don't have to put " normally (nor quote them, like here) - - # subgroup of the group 'Foo' - # (order is not important, only the name is: separator is '/', as in paths) - [Foo/Bar] - # entries prefixed with "!" are immutable, i.e. can't be changed if they are - # set in the system-wide config file - !special_key = value - bar_entry = whatever - - [Foo/Bar/Fubar] # depth is (theoretically :-) unlimited - # may have the same name as key in another section - bar_entry = whatever not - - You have {read/write/delete}Entry functions (guess what they do) and also - setCurrentPath to select current group. enum{Subgroups/Entries} allow you - to get all entries in the config file (in the current group). Finally, - flush() writes immediately all changed entries to disk (otherwise it would - be done automatically in dtor) - - wxFileConfig manages not less than 2 config files for each program: global - and local (or system and user if you prefer). Entries are read from both of - them and the local entries override the global ones unless the latter is - immutable (prefixed with '!') in which case a warning message is generated - and local value is ignored. Of course, the changes are always written to local - file only. - - The names of these files can be specified in a number of ways. First of all, - you can use the standard convention: using the ctor which takes 'strAppName' - parameter will probably be sufficient for 90% of cases. If, for whatever - reason you wish to use the files with some other names, you can always use the - second ctor. - - wxFileConfig also may automatically expand the values of environment variables - in the entries it reads: for example, if you have an entry - score_file = $HOME/.score - a call to Read(&str, "score_file") will return a complete path to .score file - unless the expansion was previously disabled with SetExpandEnvVars(false) call - (it's on by default, the current status can be retrieved with - IsExpandingEnvVars function). -*/ -class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup; -class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry; -class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList; - -#if wxUSE_STREAMS -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_BASE wxOutputStream; -#endif // wxUSE_STREAMS - -class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase -{ -public: - // construct the "standard" full name for global (system-wide) and - // local (user-specific) config files from the base file name. - // - // the following are the filenames returned by this functions: - // global local - // Unix /etc/file.ext ~/.file - // Win %windir%\file.ext %USERPROFILE%\file.ext - // - // where file is the basename of szFile, ext is its extension - // or .conf (Unix) or .ini (Win) if it has none - static wxString GetGlobalFileName(const wxChar *szFile); - static wxString GetLocalFileName(const wxChar *szFile); - - // ctor & dtor - // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or - // wxCONFIG_USE_GLOBAL_FILE to say which files should be used. - wxFileConfig(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE, - const wxMBConv& conv = wxConvAuto()); - -#if wxUSE_STREAMS - // ctor that takes an input stream. - wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto()); -#endif // wxUSE_STREAMS - - // dtor will save unsaved data - virtual ~wxFileConfig(); - - // under Unix, set the umask to be used for the file creation, do nothing - // under other systems -#ifdef __UNIX__ - void SetUmask(int mode) { m_umask = mode; } -#else // !__UNIX__ - void SetUmask(int WXUNUSED(mode)) { } -#endif // __UNIX__/!__UNIX__ - - // implement inherited pure virtual functions - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const { return m_strPath; } - - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - - virtual bool Flush(bool bCurrentOnly = false); - - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& szKey); - virtual bool DeleteAll(); - - // additional, wxFileConfig-specific, functionality -#if wxUSE_STREAMS - // save the entire config file text to the given stream, note that the text - // won't be saved again in dtor when Flush() is called if you use this method - // as it won't be "changed" any more - virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto()); -#endif // wxUSE_STREAMS - -public: - // functions to work with this list - wxFileConfigLineList *LineListAppend(const wxString& str); - wxFileConfigLineList *LineListInsert(const wxString& str, - wxFileConfigLineList *pLine); // NULL => Prepend() - void LineListRemove(wxFileConfigLineList *pLine); - bool LineListIsEmpty(); - -protected: - virtual bool DoReadString(const wxString& key, wxString *pStr) const; - virtual bool DoReadLong(const wxString& key, long *pl) const; - - virtual bool DoWriteString(const wxString& key, const wxString& szValue); - virtual bool DoWriteLong(const wxString& key, long lValue); - -private: - // GetXXXFileName helpers: return ('/' terminated) directory names - static wxString GetGlobalDir(); - static wxString GetLocalDir(); - - // common part of all ctors (assumes that m_str{Local|Global}File are already - // initialized - void Init(); - - // common part of from dtor and DeleteAll - void CleanUp(); - - // parse the whole file - void Parse(const wxTextBuffer& buffer, bool bLocal); - - // the same as SetPath("/") - void SetRootPath(); - - // real SetPath() implementation, returns true if path could be set or false - // if path doesn't exist and createMissingComponents == false - bool DoSetPath(const wxString& strPath, bool createMissingComponents); - - // set/test the dirty flag - void SetDirty() { m_isDirty = true; } - void ResetDirty() { m_isDirty = false; } - bool IsDirty() const { return m_isDirty; } - - - // member variables - // ---------------- - wxFileConfigLineList *m_linesHead, // head of the linked list - *m_linesTail; // tail - - wxString m_strLocalFile, // local file name passed to ctor - m_strGlobalFile; // global - wxString m_strPath; // current path (not '/' terminated) - - wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group - *m_pCurrentGroup; // the current group - - wxMBConv *m_conv; - -#ifdef __UNIX__ - int m_umask; // the umask to use for file creation -#endif // __UNIX__ - - bool m_isDirty; // if true, we have unsaved changes - - DECLARE_NO_COPY_CLASS(wxFileConfig) -}; - -#endif - // wxUSE_CONFIG - -#endif - //_FILECONF_H - diff --git a/Source/3rdParty/wx/include/wx/filedlg.h b/Source/3rdParty/wx/include/wx/filedlg.h deleted file mode 100644 index 0e247b358..000000000 --- a/Source/3rdParty/wx/include/wx/filedlg.h +++ /dev/null @@ -1,226 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filedlg.h -// Purpose: wxFileDialog base header -// Author: Robert Roebling -// Modified by: -// Created: 8/17/99 -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: filedlg.h 44027 2006-12-21 19:26:48Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDLG_H_BASE_ -#define _WX_FILEDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_FILEDLG - -#include "wx/dialog.h" -#include "wx/arrstr.h" - -//---------------------------------------------------------------------------- -// wxFileDialog data -//---------------------------------------------------------------------------- - -/* - The flags below must coexist with the following flags in m_windowStyle - #define wxCAPTION 0x20000000 - #define wxMAXIMIZE 0x00002000 - #define wxCLOSE_BOX 0x00001000 - #define wxSYSTEM_MENU 0x00000800 - wxBORDER_NONE = 0x00200000 - #define wxRESIZE_BORDER 0x00000040 -*/ - -enum -{ - wxFD_OPEN = 0x0001, - wxFD_SAVE = 0x0002, - wxFD_OVERWRITE_PROMPT = 0x0004, - wxFD_FILE_MUST_EXIST = 0x0010, - wxFD_MULTIPLE = 0x0020, - wxFD_CHANGE_DIR = 0x0080, - wxFD_PREVIEW = 0x0100 -}; - -#if WXWIN_COMPATIBILITY_2_6 -enum -{ - wxOPEN = wxFD_OPEN, - wxSAVE = wxFD_SAVE, - wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT, -#if WXWIN_COMPATIBILITY_2_4 - wxHIDE_READONLY = 0x0008, -#endif - wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST, - wxMULTIPLE = wxFD_MULTIPLE, - wxCHANGE_DIR = wxFD_CHANGE_DIR -}; -#endif - -#define wxFD_DEFAULT_STYLE wxFD_OPEN - -extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[]; - -//---------------------------------------------------------------------------- -// wxFileDialogBase -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDialogBase: public wxDialog -{ -public: - wxFileDialogBase () { Init(); } - - wxFileDialogBase(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr) - { - Init(); - Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name); - } - - bool Create(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr); - - bool HasFdFlag(int flag) const { return HasFlag(flag); } - - virtual void SetMessage(const wxString& message) { m_message = message; } - virtual void SetPath(const wxString& path) { m_path = path; } - virtual void SetDirectory(const wxString& dir) { m_dir = dir; } - virtual void SetFilename(const wxString& name) { m_fileName = name; } - virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } - virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } - - virtual wxString GetMessage() const { return m_message; } - virtual wxString GetPath() const { return m_path; } - virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); } - virtual wxString GetDirectory() const { return m_dir; } - virtual wxString GetFilename() const { return m_fileName; } - virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); } - virtual wxString GetWildcard() const { return m_wildCard; } - virtual int GetFilterIndex() const { return m_filterIndex; } - - // Utility functions - -#if WXWIN_COMPATIBILITY_2_4 - // Parses the wildCard, returning the number of filters. - // Returns 0 if none or if there's a problem, - // The arrays will contain an equal number of items found before the error. - // wildCard is in the form: - // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" - wxDEPRECATED( static int ParseWildcard(const wxString& wildCard, - wxArrayString& descriptions, - wxArrayString& filters) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - - - // Append first extension to filePath from a ';' separated extensionList - // if filePath = "path/foo.bar" just return it as is - // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" - // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath - static wxString AppendExtension(const wxString &filePath, - const wxString &extensionList); - -protected: - wxString m_message; - wxString m_dir; - wxString m_path; // Full path - wxString m_fileName; - wxString m_wildCard; - int m_filterIndex; - -private: - void Init(); - DECLARE_DYNAMIC_CLASS(wxFileDialogBase) - DECLARE_NO_COPY_CLASS(wxFileDialogBase) -}; - -//---------------------------------------------------------------------------- -// wxFileDialog convenience functions -//---------------------------------------------------------------------------- - -// File selector - backward compatibility -WXDLLEXPORT wxString -wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, - const wxChar *default_path = NULL, - const wxChar *default_filename = NULL, - const wxChar *default_extension = NULL, - const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, - int flags = 0, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -// An extended version of wxFileSelector -WXDLLEXPORT wxString -wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, - const wxChar *default_path = NULL, - const wxChar *default_filename = NULL, - int *indexDefaultExtension = NULL, - const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, - int flags = 0, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -// Ask for filename to load -WXDLLEXPORT wxString -wxLoadFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = (const wxChar *)NULL, - wxWindow *parent = (wxWindow *) NULL); - -// Ask for filename to save -WXDLLEXPORT wxString -wxSaveFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = (const wxChar *) NULL, - wxWindow *parent = (wxWindow *) NULL); - - -#if defined (__WXUNIVERSAL__) -#define wxUSE_GENERIC_FILEDIALOG -#include "wx/generic/filedlgg.h" -#elif defined(__WXMSW__) -#include "wx/msw/filedlg.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/filedlg.h" -#elif defined(__WXGTK24__) -#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version -#elif defined(__WXGTK20__) -#define wxUSE_GENERIC_FILEDIALOG -#include "wx/generic/filedlgg.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/filedlg.h" -#elif defined(__WXMAC__) -#include "wx/mac/filedlg.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/filedlg.h" -#elif defined(__WXPM__) -#include "wx/os2/filedlg.h" -#endif - -#endif // wxUSE_FILEDLG - -#endif // _WX_FILEDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/filefn.h b/Source/3rdParty/wx/include/wx/filefn.h deleted file mode 100644 index 84bb515a7..000000000 --- a/Source/3rdParty/wx/include/wx/filefn.h +++ /dev/null @@ -1,770 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filefn.h -// Purpose: File- and directory-related functions -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: filefn.h 63300 2010-01-28 21:36:09Z MW $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _FILEFN_H_ -#define _FILEFN_H_ - -#include "wx/list.h" -#include "wx/arrstr.h" - -#ifdef __WXWINCE__ - #include "wx/msw/wince/time.h" - #include "wx/msw/private.h" -#else - #include -#endif - -#ifdef __WXWINCE__ -// Nothing -#elif !defined(__MWERKS__) - #include - #include -#else - #ifdef __MACH__ - #include - #include - #include - #include - #else - #include - #include - #include - #endif -#endif - -#ifdef __OS2__ -// need to check for __OS2__ first since currently both -// __OS2__ and __UNIX__ are defined. - #include - #include "wx/os2/private.h" - #ifdef __WATCOMC__ - #include - #endif - #include - #ifdef __EMX__ - #include - #endif -#elif defined(__UNIX__) - #include - #include -#endif - -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) - #include - #include - #include -#endif // __WINDOWS__ -#endif // native Win compiler - -#if defined(__DOS__) - #ifdef __WATCOMC__ - #include - #include - #include - #endif - #ifdef __DJGPP__ - #include - #include - #endif -#endif - -#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs - // this (3.1 I believe) and how to test for it. - // If this works for Borland 4.0 as well, then no worries. - #include -#endif - -#ifdef __SALFORDC__ - #include - #include -#endif - -#ifndef __WXWINCE__ - #include // O_RDONLY &c -#endif -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifdef __WXWINCE__ - typedef long off_t; -#else - // define off_t - #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__) - #include - #else - typedef long off_t; - #endif -#endif - -#if (defined(__VISUALC__) && !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) - typedef _off_t off_t; -#elif defined(__SYMANTEC__) - typedef long off_t; -#elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) - typedef long off_t; -#endif - -enum wxSeekMode -{ - wxFromStart, - wxFromCurrent, - wxFromEnd -}; - -enum wxFileKind -{ - wxFILE_KIND_UNKNOWN, - wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_KIND_TERMINAL, // a tty - wxFILE_KIND_PIPE // a pipe -}; - -// ---------------------------------------------------------------------------- -// declare our versions of low level file functions: some compilers prepend -// underscores to the usual names, some also have Unicode versions of them -// ---------------------------------------------------------------------------- - -// Wrappers around Win32 api functions like CreateFile, ReadFile and such -// Implemented in filefnwce.cpp -#if defined( __WXWINCE__) - typedef __int64 wxFileOffset; - #define wxFileOffsetFmtSpec _("I64") - int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode)); - int wxAccess(const wxChar *name, int WXUNUSED(how)); - int wxClose(int fd); - int wxFsync(int WXUNUSED(fd)); - int wxRead(int fd, void *buf, unsigned int count); - int wxWrite(int fd, const void *buf, unsigned int count); - int wxEof(int fd); - wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); - #define wxLSeek wxSeek - wxFileOffset wxTell(int fd); - - // always Unicode under WinCE - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #define wxStat _wstat - #define wxStructStat struct _stat -#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ - ( \ - defined(__VISUALC__) || \ - (defined(__MINGW32__) && !defined(__WINE__) && \ - wxCHECK_W32API_VERSION(0, 5)) || \ - defined(__MWERKS__) || \ - defined(__DMC__) || \ - defined(__WATCOMC__) || \ - defined(__BORLANDC__) \ - ) - - // temporary defines just used immediately below - #undef wxHAS_HUGE_FILES - #undef wxHAS_HUGE_STDIO_FILES - - // detect compilers which have support for huge files - #if defined(__VISUALC__) - #define wxHAS_HUGE_FILES 1 - #elif defined(__MINGW32__) - #define wxHAS_HUGE_FILES 1 - #elif defined(_LARGE_FILES) - #define wxHAS_HUGE_FILES 1 - #endif - - // detect compilers which have support for huge stdio files - #if defined __VISUALC__ && __VISUALC__ >= 1400 - #define wxHAS_HUGE_STDIO_FILES - #define wxFseek _fseeki64 - #define wxFtell _ftelli64 - #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc) - #define wxHAS_HUGE_STDIO_FILES - #define wxFseek fseeko64 - #define wxFtell ftello64 - #endif - - // other Windows compilers (DMC, Watcom, Metrowerks and Borland) don't have - // huge file support (or at least not all functions needed for it by wx) - // currently - - #ifdef wxHAS_HUGE_FILES - typedef wxLongLong_t wxFileOffset; - #define wxFileOffsetFmtSpec wxLongLongFmtSpec - #else - typedef off_t wxFileOffset; - #endif - - - // functions - - // MSVC and compatible compilers prepend underscores to the POSIX function - // names, other compilers don't and even if their later versions usually do - // define the versions with underscores for MSVC compatibility, it's better - // to avoid using them as they're not present in earlier versions and - // always using the native functions spelling is easier than testing for - // the versions - #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) - #define wxPOSIX_IDENT(func) ::func - #else // by default assume MSVC-compatible names - #define wxPOSIX_IDENT(func) _ ## func - #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS - #endif - - // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope - // resolution operator present in wxPOSIX_IDENT for it - #ifdef __BORLANDC__ - #define wxPOSIX_STRUCT(s) struct s - #else - #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) - #endif - - // first functions not working with strings, i.e. without ANSI/Unicode - // complications - #define wxClose wxPOSIX_IDENT(close) - - #if defined(__MWERKS__) - #if __MSL__ >= 0x6000 - #define wxRead(fd, buf, nCount) _read(fd, (void *)buf, nCount) - #define wxWrite(fd, buf, nCount) _write(fd, (void *)buf, nCount) - #else - #define wxRead(fd, buf, nCount)\ - _read(fd, (const char *)buf, nCount) - #define wxWrite(fd, buf, nCount)\ - _write(fd, (const char *)buf, nCount) - #endif - #else // __MWERKS__ - #define wxRead wxPOSIX_IDENT(read) - #define wxWrite wxPOSIX_IDENT(write) - #endif - - #ifdef wxHAS_HUGE_FILES - #ifndef __MINGW64__ - #define wxSeek wxPOSIX_IDENT(lseeki64) - #define wxLseek wxPOSIX_IDENT(lseeki64) - #define wxTell wxPOSIX_IDENT(telli64) - #else - // unfortunately, mingw-W64 is somewhat inconsistent... - #define wxSeek _lseeki64 - #define wxLseek _lseeki64 - #define wxTell _telli64 - #endif - #else // !wxHAS_HUGE_FILES - #define wxSeek wxPOSIX_IDENT(lseek) - #define wxLseek wxPOSIX_IDENT(lseek) - #define wxTell wxPOSIX_IDENT(tell) - #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES - - #ifndef __WATCOMC__ - #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) - // NB: this one is not POSIX and always has the underscore - #define wxFsync _commit - - // could be already defined by configure (Cygwin) - #ifndef HAVE_FSYNC - #define HAVE_FSYNC - #endif - #endif // BORLANDC - #endif - - #define wxEof wxPOSIX_IDENT(eof) - - // then the functions taking strings - #if wxUSE_UNICODE - #if wxUSE_UNICODE_MSLU - // implement the missing file functions in Win9x ourselves - #if defined( __VISUALC__ ) \ - || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ - || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ - || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) \ - || defined(__DMC__) - - WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, - int flags, int mode); - WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, - int mode); - WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); - WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); - - WXDLLIMPEXP_BASE int - wxMSLU__wstat(const wxChar *name, wxPOSIX_STRUCT(stat) *buffer); - WXDLLIMPEXP_BASE int - wxMSLU__wstati64(const wxChar *name, - wxPOSIX_STRUCT(stati64) *buffer); - #endif // Windows compilers with MSLU support - - #define wxOpen wxMSLU__wopen - - #define wxAccess wxMSLU__waccess - #define wxMkDir wxMSLU__wmkdir - #define wxRmDir wxMSLU__wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat wxMSLU__wstati64 - #else - #define wxStat wxMSLU__wstat - #endif - #else // !wxUSE_UNICODE_MSLU - #ifdef __BORLANDC__ - #if __BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551 - WXDLLIMPEXP_BASE int wxOpen(const wxChar *pathname, - int flags, mode_t mode); - #else - #define wxOpen _wopen - #endif - #define wxAccess _waccess - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat _wstati64 - #else - #define wxStat _wstat - #endif - #else - #define wxOpen _wopen - #define wxAccess _waccess - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat _wstati64 - #else - #define wxStat _wstat - #endif - #endif - #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU - #else // !wxUSE_UNICODE - #define wxOpen wxPOSIX_IDENT(open) - #define wxAccess wxPOSIX_IDENT(access) - #define wxMkDir wxPOSIX_IDENT(mkdir) - #define wxRmDir wxPOSIX_IDENT(rmdir) - #ifdef wxHAS_HUGE_FILES - #define wxStat wxPOSIX_IDENT(stati64) - #else - // Unfortunately Watcom is not consistent, so:- - #if defined(__OS2__) && defined(__WATCOMC__) - #define wxStat _stat - #else - #if defined (__BORLANDC__) - #define wxStat _stat //wxPOSIX_IDENT(stat) - #else - #define wxStat wxPOSIX_IDENT(stat) - #endif // !borland - #endif // !watcom - #endif - #endif // wxUSE_UNICODE/!wxUSE_UNICODE - - // Types: Notice that Watcom is the only compiler to have a wide char - // version of struct stat as well as a wide char stat function variant. - // This was droped since OW 1.4 "for consistency across platforms". - #ifdef wxHAS_HUGE_FILES - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstati64 - #else - #define wxStructStat struct _stati64 - #endif - #else - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstat - #else - #define wxStructStat struct _stat - #endif - #endif - - // constants (unless already defined by the user code) - #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS - #ifndef O_RDONLY - #define O_RDONLY _O_RDONLY - #define O_WRONLY _O_WRONLY - #define O_RDWR _O_RDWR - #define O_EXCL _O_EXCL - #define O_CREAT _O_CREAT - #define O_BINARY _O_BINARY - #endif - - #ifndef S_IFMT - #define S_IFMT _S_IFMT - #define S_IFDIR _S_IFDIR - #define S_IFREG _S_IFREG - #endif - #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS - - #ifdef wxHAS_HUGE_FILES - // wxFile is present and supports large files. - #if wxUSE_FILE - #define wxHAS_LARGE_FILES - #endif - // wxFFile is present and supports large files - #if wxUSE_FFILE && defined wxHAS_HUGE_STDIO_FILES - #define wxHAS_LARGE_FFILES - #endif - #endif - - // private defines, undefine so that nobody gets tempted to use - #undef wxHAS_HUGE_FILES - #undef wxHAS_HUGE_STDIO_FILES -#else // Unix or Windows using unknown compiler, assume POSIX supported - typedef off_t wxFileOffset; - #ifdef _LARGE_FILES - #define wxFileOffsetFmtSpec wxLongLongFmtSpec - wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), - BadFileSizeType ); - // wxFile is present and supports large files - #ifdef wxUSE_FILE - #define wxHAS_LARGE_FILES - #endif - // wxFFile is present and supports large files - #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO - #define wxHAS_LARGE_FFILES - #endif - #ifdef HAVE_FSEEKO - #define wxFseek fseeko - #define wxFtell ftello - #endif - #else - #define wxFileOffsetFmtSpec wxT("") - #endif - // functions - #define wxClose close - #define wxRead ::read - #define wxWrite ::write - #define wxLseek lseek - #define wxSeek lseek - #define wxFsync fsync - #define wxEof eof - - #define wxMkDir mkdir - #define wxRmDir rmdir - - #define wxTell(fd) lseek(fd, 0, SEEK_CUR) - - #define wxStructStat struct stat - - #if wxUSE_UNICODE - #define wxNEED_WX_UNISTD_H - #if defined(__DMC__) - typedef unsigned long mode_t; - #endif - WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); - WXDLLIMPEXP_BASE int wxLstat( const wxChar *file_name, wxStructStat *buf ); - WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); - WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); - #else - #define wxOpen open - #define wxStat stat - #define wxLstat lstat - #define wxAccess access - #endif - - #define wxHAS_NATIVE_LSTAT -#endif // platforms - -// define wxFseek/wxFtell to large file versions if available (done above) or -// to fseek/ftell if not, to save ifdefs in using code -#ifndef wxFseek - #define wxFseek fseek -#endif -#ifndef wxFtell - #define wxFtell ftell -#endif - -#ifdef O_BINARY - #define wxO_BINARY O_BINARY -#else - #define wxO_BINARY 0 -#endif - -// if the platform doesn't have symlinks, define wxLstat to be the same as -// wxStat to avoid #ifdefs in the code using it -#ifndef wxHAS_NATIVE_LSTAT - #define wxLstat wxStat -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -// -// VisualAge C++ V4.0 cannot have any external linkage const decs -// in headers included by more than one primary source -// -extern const int wxInvalidOffset; -#else -const int wxInvalidOffset = -1; -#endif - -// ---------------------------------------------------------------------------- -// functions -// ---------------------------------------------------------------------------- -WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); - -// does the path exist? (may have or not '/' or '\\' at the end) -WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); - -WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); - -// Get filename -WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path); -WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); - -// Get directory -WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); - -// wxString version -WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); - -WXDLLIMPEXP_BASE void wxDos2UnixFilename(wxChar *s); - -WXDLLIMPEXP_BASE void wxUnix2DosFilename(wxChar *s); - -// Strip the extension, in situ -WXDLLIMPEXP_BASE void wxStripExtension(wxChar *buffer); -WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); - -// Get a temporary filename -WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); -WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); - -// Expand file name (~/ and ${OPENWINHOME}/ stuff) -WXDLLIMPEXP_BASE wxChar* wxExpandPath(wxChar *dest, const wxChar *path); -WXDLLIMPEXP_BASE bool wxExpandPath(wxString& dest, const wxChar *path); - -// Contract w.r.t environment ( -> ${OPENWINHOME}/lib) -// and make (if under the home tree) relative to home -// [caller must copy-- volatile] -WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, - const wxString& envname = wxEmptyString, - const wxString& user = wxEmptyString); - -// Destructive removal of /./ and /../ stuff -WXDLLIMPEXP_BASE wxChar* wxRealPath(wxChar *path); - -// Allocate a copy of the full absolute path -WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); - -// Get first file name matching given wild card. -// Flags are reserved for future use. -#define wxFILE 1 -#define wxDIR 2 -WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxChar *spec, int flags = wxFILE); -WXDLLIMPEXP_BASE wxString wxFindNextFile(); - -// Does the pattern contain wildcards? -WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); - -// Does the pattern match the text (usually a filename)? -// If dot_special is true, doesn't match * against . (eliminating -// `hidden' dot files) -WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); - -// Concatenate two files to form third -WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); - -// Copy file1 to file2 -WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, - bool overwrite = true); - -// Remove file -WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); - -// Rename file -WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); - -// Get current working directory. -#if WXWIN_COMPATIBILITY_2_6 -// If buf is NULL, allocates space using new, else -// copies into buf. -// IMPORTANT NOTE getcwd is know not to work under some releases -// of Win32s 1.3, according to MS release notes! -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) ); -// new and preferred version of wxGetWorkingDirectory -// NB: can't have the same name because of overloading ambiguity -#endif // WXWIN_COMPATIBILITY_2_6 -WXDLLIMPEXP_BASE wxString wxGetCwd(); - -// Set working directory -WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); - -// Make directory -WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); - -// Remove directory. Flags reserved for future use. -WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); - -// Return the type of an open file -WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); -WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); - -#if WXWIN_COMPATIBILITY_2_6 -// compatibility defines, don't use in new code -wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); -inline bool wxPathExists(const wxChar *pszPathName) -{ - return wxDirExists(pszPathName); -} -#endif //WXWIN_COMPATIBILITY_2_6 - -// permissions; these functions work both on files and directories: -WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); -WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); -WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); - -// ---------------------------------------------------------------------------- -// separators in file names -// ---------------------------------------------------------------------------- - -// between file name and extension -#define wxFILE_SEP_EXT wxT('.') - -// between drive/volume name and the path -#define wxFILE_SEP_DSK wxT(':') - -// between the path components -#define wxFILE_SEP_PATH_DOS wxT('\\') -#define wxFILE_SEP_PATH_UNIX wxT('/') -#define wxFILE_SEP_PATH_MAC wxT(':') -#define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']' - -// separator in the path list (as in PATH environment variable) -// there is no PATH variable in Classic Mac OS so just use the -// semicolon (it must be different from the file name separator) -// NB: these are strings and not characters on purpose! -#define wxPATH_SEP_DOS wxT(";") -#define wxPATH_SEP_UNIX wxT(":") -#define wxPATH_SEP_MAC wxT(";") - -// platform independent versions -#if defined(__UNIX__) && !defined(__OS2__) - // CYGWIN also uses UNIX settings - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX - #define wxPATH_SEP wxPATH_SEP_UNIX -#elif defined(__MAC__) - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC - #define wxPATH_SEP wxPATH_SEP_MAC -#else // Windows and OS/2 - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS - #define wxPATH_SEP wxPATH_SEP_DOS -#endif // Unix/Windows - -// this is useful for wxString::IsSameAs(): to compare two file names use -// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) -#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) - #define wxARE_FILENAMES_CASE_SENSITIVE true -#else // Windows, Mac OS and OS/2 - #define wxARE_FILENAMES_CASE_SENSITIVE false -#endif // Unix/Windows - -// is the char a path separator? -inline bool wxIsPathSeparator(wxChar c) -{ - // under DOS/Windows we should understand both Unix and DOS file separators -#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) - return c == wxFILE_SEP_PATH; -#else - return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; -#endif -} - -// does the string ends with path separator? -WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxChar *pszFileName); - -// split the full path into path (including drive for DOS), name and extension -// (understands both '/' and '\\') -WXDLLIMPEXP_BASE void wxSplitPath(const wxChar *pszFileName, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt); - -// find a file in a list of directories, returns false if not found -WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile); - -// Get the OS directory if appropriate (such as the Windows directory). -// On non-Windows platform, probably just return the empty string. -WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); - -#if wxUSE_DATETIME - -// Get file modification time -WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); - -#endif // wxUSE_DATETIME - -// Parses the wildCard, returning the number of filters. -// Returns 0 if none or if there's a problem, -// The arrays will contain an equal number of items found before the error. -// wildCard is in the form: -// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" -WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); - -// ---------------------------------------------------------------------------- -// classes -// ---------------------------------------------------------------------------- - -#ifdef __UNIX__ - -// set umask to the given value in ctor and reset it to the old one in dtor -class WXDLLIMPEXP_BASE wxUmaskChanger -{ -public: - // change the umask to the given one if it is not -1: this allows to write - // the same code whether you really want to change umask or not, as is in - // wxFileConfig::Flush() for example - wxUmaskChanger(int umaskNew) - { - m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew); - } - - ~wxUmaskChanger() - { - if ( m_umaskOld != -1 ) - umask((mode_t)m_umaskOld); - } - -private: - int m_umaskOld; -}; - -// this macro expands to an "anonymous" wxUmaskChanger object under Unix and -// nothing elsewhere -#define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m) - -#else // !__UNIX__ - -#define wxCHANGE_UMASK(m) - -#endif // __UNIX__/!__UNIX__ - - -// Path searching -class WXDLLIMPEXP_BASE wxPathList : public wxArrayString -{ -public: - wxPathList() {} - wxPathList(const wxArrayString &arr) - { Add(arr); } - - // Adds all paths in environment variable - void AddEnvList(const wxString& envVariable); - - // Adds given path to this list - bool Add(const wxString& path); - void Add(const wxArrayString &paths); - - // Find the first full path for which the file exists - wxString FindValidPath(const wxString& filename) const; - - // Find the first full path for which the file exists; ensure it's an - // absolute path that gets returned. - wxString FindAbsoluteValidPath(const wxString& filename) const; - - // Given full path and filename, add path to list - bool EnsureFileAccessible(const wxString& path); - -#if WXWIN_COMPATIBILITY_2_6 - // Returns true if the path is in the list - wxDEPRECATED( bool Member(const wxString& path) const ); -#endif -}; - -#endif // _WX_FILEFN_H_ diff --git a/Source/3rdParty/wx/include/wx/filename.h b/Source/3rdParty/wx/include/wx/filename.h deleted file mode 100644 index e9228787d..000000000 --- a/Source/3rdParty/wx/include/wx/filename.h +++ /dev/null @@ -1,547 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filename.h -// Purpose: wxFileName - encapsulates a file path -// Author: Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 28.12.00 -// RCS-ID: $Id: filename.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2000 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILENAME_H_ -#define _WX_FILENAME_H_ - -/* - TODO: - - 1. support for drives under Windows - 2. more file operations: - a) chmod() - b) [acm]time() - get and set - c) rename()? - 3. SameFileAs() function to compare inodes under Unix - */ - -#include "wx/arrstr.h" -#include "wx/filefn.h" -#include "wx/datetime.h" -#include "wx/intl.h" - -#if wxUSE_FILE -class WXDLLIMPEXP_FWD_BASE wxFile; -#endif - -#if wxUSE_FFILE -class WXDLLIMPEXP_FWD_BASE wxFFile; -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the various values for the path format: this mainly affects the path -// separator but also whether or not the path has the drive part (as under -// Windows) -enum wxPathFormat -{ - wxPATH_NATIVE = 0, // the path format for the current platform - wxPATH_UNIX, - wxPATH_BEOS = wxPATH_UNIX, - wxPATH_MAC, - wxPATH_DOS, - wxPATH_WIN = wxPATH_DOS, - wxPATH_OS2 = wxPATH_DOS, - wxPATH_VMS, - - wxPATH_MAX // Not a valid value for specifying path format -}; - -// the kind of normalization to do with the file name: these values can be -// or'd together to perform several operations at once -enum wxPathNormalize -{ - wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values - wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd - wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user - wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower - wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute - wxPATH_NORM_LONG = 0x0020, // make the path the long form - wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut - wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE -}; - -// what exactly should GetPath() return? -enum -{ - wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable - wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator -}; - -// MkDir flags -enum -{ - wxPATH_MKDIR_FULL = 0x0001 // create directories recursively -}; - -// error code of wxFileName::GetSize() -extern WXDLLIMPEXP_DATA_BASE(wxULongLong) wxInvalidSize; - - - -// ---------------------------------------------------------------------------- -// wxFileName: encapsulates a file path -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileName -{ -public: - // constructors and assignment - - // the usual stuff - wxFileName() { Clear(); } - wxFileName(const wxFileName& filepath) { Assign(filepath); } - - // from a full filename: if it terminates with a '/', a directory path - // is contructed (the name will be empty), otherwise a file name and - // extension are extracted from it - wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE ) - { Assign( fullpath, format ); } - - // from a directory name and a file name - wxFileName(const wxString& path, - const wxString& name, - wxPathFormat format = wxPATH_NATIVE) - { Assign(path, name, format); } - - // from a volume, directory name, file base name and extension - wxFileName(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(volume, path, name, ext, format); } - - // from a directory name, file base name and extension - wxFileName(const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(path, name, ext, format); } - - // the same for delayed initialization - - void Assign(const wxFileName& filepath); - - void Assign(const wxString& fullpath, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - bool hasExt, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(volume, path, name, ext, !ext.empty(), format); } - - void Assign(const wxString& path, - const wxString& name, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE); - - void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); - - // assorted assignment operators - - wxFileName& operator=(const wxFileName& filename) - { Assign(filename); return *this; } - - wxFileName& operator=(const wxString& filename) - { Assign(filename); return *this; } - - // reset all components to default, uninitialized state - void Clear(); - - // static pseudo constructors - static wxFileName FileName(const wxString& file, - wxPathFormat format = wxPATH_NATIVE); - static wxFileName DirName(const wxString& dir, - wxPathFormat format = wxPATH_NATIVE); - - // file tests - - // is the filename valid at all? - bool IsOk() const - { - // we're fine if we have the path or the name or if we're a root dir - return m_dirs.size() != 0 || !m_name.empty() || !m_relative || - !m_ext.empty() || m_hasExt; - } - - // does the file with this name exists? - bool FileExists() const; - static bool FileExists( const wxString &file ); - - // does the directory with this name exists? - bool DirExists() const; - static bool DirExists( const wxString &dir ); - - // checks on most common flags for files/directories; - // more platform-specific features (like e.g. Unix permissions) are not - // available in wxFileName - - bool IsDirWritable() const { return wxIsWritable(GetPath()); } - static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); } - - bool IsDirReadable() const { return wxIsReadable(GetPath()); } - static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); } - - // NOTE: IsDirExecutable() is not present because the meaning of "executable" - // directory is very platform-dependent and also not so useful - - bool IsFileWritable() const { return wxIsWritable(GetFullPath()); } - static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); } - - bool IsFileReadable() const { return wxIsReadable(GetFullPath()); } - static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); } - - bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); } - static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); } - - - // time functions -#if wxUSE_DATETIME - // set the file last access/mod and creation times - // (any of the pointers may be NULL) - bool SetTimes(const wxDateTime *dtAccess, - const wxDateTime *dtMod, - const wxDateTime *dtCreate); - - // set the access and modification times to the current moment - bool Touch(); - - // return the last access, last modification and create times - // (any of the pointers may be NULL) - bool GetTimes(wxDateTime *dtAccess, - wxDateTime *dtMod, - wxDateTime *dtCreate) const; - - // convenience wrapper: get just the last mod time of the file - wxDateTime GetModificationTime() const - { - wxDateTime dtMod; - (void)GetTimes(NULL, &dtMod, NULL); - return dtMod; - } -#endif // wxUSE_DATETIME - -#ifdef __WXMAC__ - bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; - bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) ; - // gets the 'common' type and creator for a certain extension - static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; - // registers application defined extensions and their default type and creator - static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ; - // looks up the appropriate type and creator from the registration and then sets - bool MacSetDefaultTypeAndCreator() ; -#endif - - // various file/dir operations - - // retrieve the value of the current working directory - void AssignCwd(const wxString& volume = wxEmptyString); - static wxString GetCwd(const wxString& volume = wxEmptyString); - - // change the current working directory - bool SetCwd(); - static bool SetCwd( const wxString &cwd ); - - // get the value of user home (Unix only mainly) - void AssignHomeDir(); - static wxString GetHomeDir(); - - // get the system temporary directory - static wxString GetTempDir(); - -#if wxUSE_FILE || wxUSE_FFILE - // get a temp file name starting with the specified prefix - void AssignTempFileName(const wxString& prefix); - static wxString CreateTempFileName(const wxString& prefix); -#endif // wxUSE_FILE - -#if wxUSE_FILE - // get a temp file name starting with the specified prefix and open the - // file passed to us using this name for writing (atomically if - // possible) - void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); - static wxString CreateTempFileName(const wxString& prefix, - wxFile *fileTemp); -#endif // wxUSE_FILE - -#if wxUSE_FFILE - // get a temp file name starting with the specified prefix and open the - // file passed to us using this name for writing (atomically if - // possible) - void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); - static wxString CreateTempFileName(const wxString& prefix, - wxFFile *fileTemp); -#endif // wxUSE_FFILE - - // directory creation and removal. - bool Mkdir( int perm = 0777, int flags = 0); - static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 ); - - bool Rmdir(); - static bool Rmdir( const wxString &dir ); - - // operations on the path - - // normalize the path: with the default flags value, the path will be - // made absolute, without any ".." and "." and all environment - // variables will be expanded in it - // - // this may be done using another (than current) value of cwd - bool Normalize(int flags = wxPATH_NORM_ALL, - const wxString& cwd = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE); - - // get a path path relative to the given base directory, i.e. opposite - // of Normalize - // - // pass an empty string to get a path relative to the working directory - // - // returns true if the file name was modified, false if we failed to do - // anything with it (happens when the file is on a different volume, - // for example) - bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE); - - // make the path absolute - // - // this may be done using another (than current) value of cwd - bool MakeAbsolute(const wxString& cwd = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE) - { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | - wxPATH_NORM_TILDE, cwd, format); } - -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE - // if the path is a shortcut, return the target and optionally, - // the arguments - bool GetShortcutTarget(const wxString& shortcutPath, - wxString& targetFilename, - wxString* arguments = NULL); -#endif - - // Comparison - - // compares with the rules of the given platforms format - bool SameAs(const wxFileName& filepath, - wxPathFormat format = wxPATH_NATIVE) const; - - // compare with another filename object - bool operator==(const wxFileName& filename) const - { return SameAs(filename); } - bool operator!=(const wxFileName& filename) const - { return !SameAs(filename); } - - // compare with a filename string interpreted as a native file name - bool operator==(const wxString& filename) const - { return SameAs(wxFileName(filename)); } - bool operator!=(const wxString& filename) const - { return !SameAs(wxFileName(filename)); } - - // are the file names of this type cases sensitive? - static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); - - // is this filename absolute? - bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; - - // is this filename relative? - bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const - { return !IsAbsolute(format); } - - // Returns the characters that aren't allowed in filenames - // on the specified platform. - static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); - - // Information about path format - - // get the string separating the volume from the path for this format, - // return an empty string if this format doesn't support the notion of - // volumes at all - static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); - - // get the string of path separators for this format - static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); - - // get the string of path terminators, i.e. characters which terminate the - // path - static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); - - // get the canonical path separator for this format - static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) - { return GetPathSeparators(format)[0u]; } - - // is the char a path separator for this format? - static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); - - // Dir accessors - size_t GetDirCount() const { return m_dirs.size(); } - void AppendDir(const wxString& dir); - void PrependDir(const wxString& dir); - void InsertDir(size_t before, const wxString& dir); - void RemoveDir(size_t pos); - void RemoveLastDir() { RemoveDir(GetDirCount() - 1); } - - // Other accessors - void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); } - void ClearExt() { m_ext = wxEmptyString; m_hasExt = false; } - void SetEmptyExt() { m_ext = wxT(""); m_hasExt = true; } - wxString GetExt() const { return m_ext; } - bool HasExt() const { return m_hasExt; } - - void SetName( const wxString &name ) { m_name = name; } - wxString GetName() const { return m_name; } - bool HasName() const { return !m_name.empty(); } - - void SetVolume( const wxString &volume ) { m_volume = volume; } - wxString GetVolume() const { return m_volume; } - bool HasVolume() const { return !m_volume.empty(); } - - // full name is the file name + extension (but without the path) - void SetFullName(const wxString& fullname); - wxString GetFullName() const; - - const wxArrayString& GetDirs() const { return m_dirs; } - - // flags are combination of wxPATH_GET_XXX flags - wxString GetPath(int flags = wxPATH_GET_VOLUME, - wxPathFormat format = wxPATH_NATIVE) const; - - // Replace current path with this one - void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE ); - - // Construct full path with name and ext - wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const; - - // Return the short form of the path (returns identity on non-Windows platforms) - wxString GetShortPath() const; - - // Return the long form of the path (returns identity on non-Windows platforms) - wxString GetLongPath() const; - - // Is this a file or directory (not necessarily an existing one) - bool IsDir() const { return m_name.empty() && m_ext.empty(); } - - // various helpers - - // get the canonical path format for this platform - static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); - - // split a fullpath into the volume, path, (base) name and extension - // (all of the pointers can be NULL) - static void SplitPath(const wxString& fullpath, - wxString *volume, - wxString *path, - wxString *name, - wxString *ext, - bool *hasExt = NULL, - wxPathFormat format = wxPATH_NATIVE); - - static void SplitPath(const wxString& fullpath, - wxString *volume, - wxString *path, - wxString *name, - wxString *ext, - wxPathFormat format) - { - SplitPath(fullpath, volume, path, name, ext, NULL, format); - } - - // compatibility version: volume is part of path - static void SplitPath(const wxString& fullpath, - wxString *path, - wxString *name, - wxString *ext, - wxPathFormat format = wxPATH_NATIVE); - - // split a path into volume and pure path part - static void SplitVolume(const wxString& fullpathWithVolume, - wxString *volume, - wxString *path, - wxPathFormat format = wxPATH_NATIVE); - -#if wxABI_VERSION >= 20811 - // strip the file extension - static wxString StripExtension(const wxString& fullpath); -#endif // wxABI_VERSION >= 20811 - - - // Filesize - - // returns the size of the given filename - wxULongLong GetSize() const; - static wxULongLong GetSize(const wxString &file); - - // returns the size in a human readable form - wxString GetHumanReadableSize(const wxString &nullsize = wxGetTranslation(wxT("Not available")), - int precision = 1) const; - static wxString GetHumanReadableSize(const wxULongLong &sz, - const wxString &nullsize = wxGetTranslation(wxT("Not available")), - int precision = 1); - - - // deprecated methods, don't use any more - // -------------------------------------- - -#ifndef __DIGITALMARS__ - wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const - { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } -#endif - wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const - { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } - -private: - // check whether this dir is valid for Append/Prepend/InsertDir() - static bool IsValidDirComponent(const wxString& dir); - - // the drive/volume/device specification (always empty for Unix) - wxString m_volume; - - // the path components of the file - wxArrayString m_dirs; - - // the file name and extension (empty for directories) - wxString m_name, - m_ext; - - // when m_dirs is empty it may mean either that we have no path at all or - // that our path is '/', i.e. the root directory - // - // we use m_relative to distinguish between these two cases, it will be - // true in the former and false in the latter - // - // NB: the path is not absolute just because m_relative is false, it still - // needs the drive (i.e. volume) in some formats (Windows) - bool m_relative; - - // when m_ext is empty, it may be because we don't have any extension or - // because we have an empty extension - // - // the difference is important as file with name "foo" and without - // extension has full name "foo" while with empty extension it is "foo." - bool m_hasExt; -}; - -#endif // _WX_FILENAME_H_ - diff --git a/Source/3rdParty/wx/include/wx/filepicker.h b/Source/3rdParty/wx/include/wx/filepicker.h deleted file mode 100644 index ce08f8569..000000000 --- a/Source/3rdParty/wx/include/wx/filepicker.h +++ /dev/null @@ -1,398 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filepicker.h -// Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepicker.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDIRPICKER_H_BASE_ -#define _WX_FILEDIRPICKER_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#include "wx/pickerbase.h" - -class WXDLLIMPEXP_FWD_CORE wxDialog; -class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetLabel[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerCtrlNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; - -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetLabel[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerCtrlNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; - - -// ---------------------------------------------------------------------------- -// wxFileDirPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxFileDirPickerCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase -{ -public: - wxFileDirPickerWidgetBase() { } - virtual ~wxFileDirPickerWidgetBase() { } - - wxString GetPath() const { return m_path; } - virtual void SetPath(const wxString &str) { m_path=str; } - - // returns the picker widget cast to wxControl - virtual wxControl *AsControl() = 0; - -protected: - virtual void UpdateDialogPath(wxDialog *) = 0; - virtual void UpdatePathFromDialog(wxDialog *) = 0; - - wxString m_path; -}; - -// Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - -#define wxFLP_OPEN 0x0400 -#define wxFLP_SAVE 0x0800 -#define wxFLP_OVERWRITE_PROMPT 0x1000 -#define wxFLP_FILE_MUST_EXIST 0x2000 -#define wxFLP_CHANGE_DIR 0x4000 - -// NOTE: wxMULTIPLE is not supported ! - - -#define wxDIRP_DIR_MUST_EXIST 0x0008 -#define wxDIRP_CHANGE_DIR 0x0010 - - -// map platform-dependent controls which implement the wxFileDirPickerWidgetBase -// under the name "wxFilePickerWidget" and "wxDirPickerWidget". -// NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this -// requires that all classes being mapped as wx{File|Dir}PickerWidget have the -// same prototype for the contructor... -// since GTK >= 2.6, there is GtkFileButton -#if defined(__WXGTK26__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/filepicker.h" - #define wxFilePickerWidget wxFileButton - #define wxDirPickerWidget wxDirButton -#else - #include "wx/generic/filepickerg.h" - #define wxFilePickerWidget wxGenericFileButton - #define wxDirPickerWidget wxGenericDirButton -#endif - - - -// ---------------------------------------------------------------------------- -// wxFileDirPickerCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase -{ -public: - wxFileDirPickerCtrlBase() : m_bIgnoreNextTextCtrlUpdate(false) {} - -protected: - // NB: no default values since this function will never be used - // directly by the user and derived classes wouldn't use them - bool CreateBase(wxWindow *parent, - wxWindowID id, - const wxString& path, - const wxString &message, - const wxString &wildcard, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - -public: // public API - - wxString GetPath() const; - void SetPath(const wxString &str); - -public: // internal functions - - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnFileDirChange(wxFileDirPickerEvent &); - - // Returns TRUE if the current path is a valid one - // (i.e. a valid file for a wxFilePickerWidget or a valid - // folder for a wxDirPickerWidget). - virtual bool CheckPath(const wxString &str) const = 0; - - // TRUE if any textctrl change should update the current working directory - virtual bool IsCwdToUpdate() const = 0; - - // Returns the event type sent by this picker - virtual wxEventType GetEventType() const = 0; - - // Returns the filtered value currently placed in the text control (if present). - virtual wxString GetTextCtrlValue() const = 0; - -protected: - // creates the picker control - virtual - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& wildcard) = 0; - -protected: - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - - // m_picker object as wxFileDirPickerWidgetBase interface - wxFileDirPickerWidgetBase *m_pickerIface; -}; - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - - -#if wxUSE_FILEPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxFilePickerCtrl: platform-independent class which embeds the -// platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) - -#ifdef __WXGTK__ - // GTK apps usually don't have a textctrl next to the picker - #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) -#else - #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) -#endif - -class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase -{ -public: - wxFilePickerCtrl() {} - - wxFilePickerCtrl(wxWindow *parent, - wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxFileSelectorPromptStr, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFLP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr) - { - Create(parent, id, path, message, wildcard, pos, size, style, - validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxFileSelectorPromptStr, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFLP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase(parent, id, path, - message, wildcard, - pos, size, style, - validator, name); - } - - -public: // overrides - - // return true if the given path is valid for this control - bool CheckPath(const wxString& path) const; - - // return the text control value in canonical form - wxString GetTextCtrlValue() const; - - bool IsCwdToUpdate() const - { return HasFlag(wxFLP_CHANGE_DIR); } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_FILEPICKER_CHANGED; } - -protected: - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& wildcard) - { - return new wxFilePickerWidget(parent, wxID_ANY, - wxFilePickerWidgetLabel, - path, message, wildcard, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(GetWindowStyle())); - } - - // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const - { - return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT| - wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR)); - } - -private: - DECLARE_DYNAMIC_CLASS(wxFilePickerCtrl) -}; - -#endif // wxUSE_FILEPICKERCTRL - - -#if wxUSE_DIRPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxDirPickerCtrl: platform-independent class which embeds the -// platform-dependent wxDirPickerWidget and eventually a textctrl -// (see wxDIRP_USE_TEXTCTRL) next to it. -// ---------------------------------------------------------------------------- - -#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) - -#ifdef __WXGTK__ - // GTK apps usually don't have a textctrl next to the picker - #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) -#else - #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST) -#endif - -class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase -{ -public: - wxDirPickerCtrl() {} - - wxDirPickerCtrl(wxWindow *parent, wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) - { - Create(parent, id, path, message, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase - ( - parent, id, path, message, wxEmptyString, - pos, size, style, validator, name - ); - } - - -public: // overrides - - bool CheckPath(const wxString &path) const; - - wxString GetTextCtrlValue() const; - - bool IsCwdToUpdate() const - { return HasFlag(wxDIRP_CHANGE_DIR); } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_DIRPICKER_CHANGED; } - -protected: - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& WXUNUSED(wildcard)) - { - return new wxDirPickerWidget(parent, wxID_ANY, wxDirPickerWidgetLabel, - path, message, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(GetWindowStyle())); - } - - // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const - { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR)); } - -private: - DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) -}; - -#endif // wxUSE_DIRPICKERCTRL - - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, 1102) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, 1103) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent -{ -public: - wxFileDirPickerEvent() {} - wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) - : wxCommandEvent(type, id), - m_path(path) - { - SetEventObject(generator); - } - - wxString GetPath() const { return m_path; } - void SetPath(const wxString &p) { m_path = p; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } - -private: - wxString m_path; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); - -#define wxFileDirPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileDirPickerEventFunction, &func) - -#define EVT_FILEPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) -#define EVT_DIRPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) - - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#endif // _WX_FILEDIRPICKER_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/filesys.h b/Source/3rdParty/wx/include/wx/filesys.h deleted file mode 100644 index 3d40f1104..000000000 --- a/Source/3rdParty/wx/include/wx/filesys.h +++ /dev/null @@ -1,300 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filesys.h -// Purpose: class for opening files - virtual file system -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: filesys.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __FILESYS_H__ -#define __FILESYS_H__ - -#include "wx/defs.h" - -#if !wxUSE_STREAMS -#error You cannot compile virtual file systems without wxUSE_STREAMS -#endif - -#if wxUSE_HTML && !wxUSE_FILESYSTEM -#error You cannot compile wxHTML without virtual file systems -#endif - -#if wxUSE_FILESYSTEM - -#include "wx/stream.h" -#include "wx/datetime.h" -#include "wx/filename.h" -#include "wx/hashmap.h" - -class WXDLLIMPEXP_FWD_BASE wxFSFile; -class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler; -class WXDLLIMPEXP_FWD_BASE wxFileSystem; - -//-------------------------------------------------------------------------------- -// wxFSFile -// This class is a file opened using wxFileSystem. It consists of -// input stream, location, mime type & optional anchor -// (in 'index.htm#chapter2', 'chapter2' is anchor) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFSFile : public wxObject -{ -public: - wxFSFile(wxInputStream *stream, const wxString& loc, - const wxString& mimetype, const wxString& anchor -#if wxUSE_DATETIME - , wxDateTime modif -#endif // wxUSE_DATETIME - ) - { - m_Stream = stream; - m_Location = loc; - m_MimeType = mimetype; m_MimeType.MakeLower(); - m_Anchor = anchor; -#if wxUSE_DATETIME - m_Modif = modif; -#endif // wxUSE_DATETIME - } - - virtual ~wxFSFile() { delete m_Stream; } - - // returns stream. This doesn't give away ownership of the stream object. - wxInputStream *GetStream() const { return m_Stream; } - - // gives away the ownership of the current stream. - wxInputStream *DetachStream() - { - wxInputStream *stream = m_Stream; - m_Stream = NULL; - return stream; - } - - // deletes the current stream and takes ownership of another. - void SetStream(wxInputStream *stream) - { - delete m_Stream; - m_Stream = stream; - } - - // returns file's mime type - const wxString& GetMimeType() const { return m_MimeType; } - - // returns the original location (aka filename) of the file - const wxString& GetLocation() const { return m_Location; } - - const wxString& GetAnchor() const { return m_Anchor; } - -#if wxUSE_DATETIME - wxDateTime GetModificationTime() const { return m_Modif; } -#endif // wxUSE_DATETIME - -private: - wxInputStream *m_Stream; - wxString m_Location; - wxString m_MimeType; - wxString m_Anchor; -#if wxUSE_DATETIME - wxDateTime m_Modif; -#endif // wxUSE_DATETIME - - DECLARE_ABSTRACT_CLASS(wxFSFile) - DECLARE_NO_COPY_CLASS(wxFSFile) -}; - - - - - -//-------------------------------------------------------------------------------- -// wxFileSystemHandler -// This class is FS handler for wxFileSystem. It provides -// interface to access certain -// kinds of files (HTPP, FTP, local, tar.gz etc..) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject -{ -public: - wxFileSystemHandler() : wxObject() {} - - // returns true if this handler is able to open given location - virtual bool CanOpen(const wxString& location) = 0; - - // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. - // The location is always absolute path. - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; - - // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting - // the query to directories or wxFILE for files only or 0 for either. - // Returns filename or empty string if no more matching file exists - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -protected: - // returns protocol ("file", "http", "tar" etc.) The last (most right) - // protocol is used: - // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetProtocol(const wxString& location) const; - - // returns left part of address: - // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetLeftLocation(const wxString& location) const; - - // returns anchor part of address: - // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"} - // NOTE: anchor is NOT a part of GetLeftLocation()'s return value - wxString GetAnchor(const wxString& location) const; - - // returns right part of address: - // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetRightLocation(const wxString& location) const; - - // Returns MIME type of the file - w/o need to open it - // (default behaviour is that it returns type based on extension) - wxString GetMimeTypeFromExt(const wxString& location); - - DECLARE_ABSTRACT_CLASS(wxFileSystemHandler) -}; - - - - -//-------------------------------------------------------------------------------- -// wxFileSystem -// This class provides simple interface for opening various -// kinds of files (HTPP, FTP, local, tar.gz etc..) -//-------------------------------------------------------------------------------- - -// Open Bit Flags -enum { - wxFS_READ = 1, // Open for reading - wxFS_SEEKABLE = 4 // Returned stream will be seekable -}; - -WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxFileSystem : public wxObject -{ -public: - wxFileSystem() : wxObject() { m_FindFileHandler = NULL;} - virtual ~wxFileSystem(); - - // sets the current location. Every call to OpenFile is - // relative to this location. - // NOTE !! - // unless is_dir = true 'location' is *not* the directory but - // file contained in this directory - // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/") - void ChangePathTo(const wxString& location, bool is_dir = false); - - wxString GetPath() const {return m_Path;} - - // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. - // It first tries to open the file in relative scope - // (based on ChangePathTo()'s value) and then as an absolute - // path. - wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ); - - // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting - // the query to directories or wxFILE for files only or 0 for either. - // Returns filename or empty string if no more matching file exists - wxString FindFirst(const wxString& spec, int flags = 0); - wxString FindNext(); - - // find a file in a list of directories, returns false if not found - bool FindFileInPath(wxString *pStr, const wxChar *path, const wxChar *file); - - // Adds FS handler. - // In fact, this class is only front-end to the FS handlers :-) - static void AddHandler(wxFileSystemHandler *handler); - - // Removes FS handler - static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler); - - // Returns true if there is a handler which can open the given location. - static bool HasHandlerForPath(const wxString& location); - - // remove all items from the m_Handlers list - static void CleanUpHandlers(); - - // Returns the native path for a file URL - static wxFileName URLToFileName(const wxString& url); - - // Returns the file URL for a native path - static wxString FileNameToURL(const wxFileName& filename); - - -protected: - wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h); - - wxString m_Path; - // the path (location) we are currently in - // this is path, not file! - // (so if you opened test/demo.htm, it is - // "test/", not "test/demo.htm") - wxString m_LastName; - // name of last opened file (full path) - static wxList m_Handlers; - // list of FS handlers - wxFileSystemHandler *m_FindFileHandler; - // handler that succeed in FindFirst query - wxFSHandlerHash m_LocalHandlers; - // Handlers local to this instance - - DECLARE_DYNAMIC_CLASS(wxFileSystem) - DECLARE_NO_COPY_CLASS(wxFileSystem) -}; - - -/* - -'location' syntax: - -To determine FS type, we're using standard KDE notation: -file:/absolute/path/file.htm -file:relative_path/xxxxx.html -/some/path/x.file ('file:' is default) -http://www.gnome.org -file:subdir/archive.tar.gz#tar:/README.txt - -special characters : - ':' - FS identificator is before this char - '#' - separator. It can be either HTML anchor ("index.html#news") - (in case there is no ':' in the string to the right from it) - or FS separator - (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h" - this would access tgz archive stored on web) - '/' - directory (path) separator. It is used to determine upper-level path. - HEY! Don't use \ even if you're on Windows! - -*/ - - -class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler -{ -public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - - // wxLocalFSHandler will prefix all filenames with 'root' before accessing - // files on disk. This effectively makes 'root' the top-level directory - // and prevents access to files outside this directory. - // (This is similar to Unix command 'chroot'.) - static void Chroot(const wxString& root) { ms_root = root; } - -protected: - static wxString ms_root; -}; - - - -#endif - // wxUSE_FILESYSTEM - -#endif - // __FILESYS_H__ diff --git a/Source/3rdParty/wx/include/wx/flags.h b/Source/3rdParty/wx/include/wx/flags.h deleted file mode 100644 index 803205fdf..000000000 --- a/Source/3rdParty/wx/include/wx/flags.h +++ /dev/null @@ -1,165 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/flags.h -// Purpose: a bitset suited for replacing the current style flags -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: flags.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETH__ -#define _WX_SETH__ - -// wxBitset should be applied to an enum, then this can be used like -// bitwise operators but keeps the type safety and information, the -// enums must be in a sequence , their value determines the bit position -// that they represent -// The api is made as close as possible to - -template class wxBitset -{ - friend class wxEnumData ; -public: - // creates a wxBitset<> object with all flags initialized to 0 - wxBitset() { m_data = 0; } - - // created a wxBitset<> object initialized according to the bits of the - // integral value val - wxBitset(unsigned long val) { m_data = val ; } - - // copies the content in the new wxBitset<> object from another one - wxBitset(const wxBitset &src) { m_data = src.m_data; } - - // creates a wxBitset<> object that has the specific flag set - wxBitset(const T el) { m_data |= 1 << el; } - - // returns the integral value that the bits of this object represent - unsigned long to_ulong() const { return m_data ; } - - // assignment - wxBitset &operator =(const wxBitset &rhs) - { - m_data = rhs.m_data; - return *this; - } - - // bitwise or operator, sets all bits that are in rhs and leaves - // the rest unchanged - wxBitset &operator |=(const wxBitset &rhs) - { - m_data |= rhs.m_data; - return *this; - } - - // bitwsie exclusive-or operator, toggles the value of all bits - // that are set in bits and leaves all others unchanged - wxBitset &operator ^=(const wxBitset &rhs) // difference - { - m_data ^= rhs.m_data; - return *this; - } - - // bitwise and operator, resets all bits that are not in rhs and leaves - // all others unchanged - wxBitset &operator &=(const wxBitset &rhs) // intersection - { - m_data &= rhs.m_data; - return *this; - } - - // bitwise or operator, returns a new bitset that has all bits set that set are in - // bitset2 or in this bitset - wxBitset operator |(const wxBitset &bitset2) const // union - { - wxBitset s; - s.m_data = m_data | bitset2.m_data; - return s; - } - - // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in - // bitset2 or in this bitset but not in both - wxBitset operator ^(const wxBitset &bitset2) const // difference - { - wxBitset s; - s.m_data = m_data ^ bitset2.m_data; - return s; - } - - // bitwise and operator, returns a new bitset that has all bits set that are set both in - // bitset2 and in this bitset - wxBitset operator &(const wxBitset &bitset2) const // intersection - { - wxBitset s; - s.m_data = m_data & bitset2.m_data; - return s; - } - - // sets appropriate the bit to true - wxBitset& set(const T el) //Add element - { - m_data |= 1 << el; - return *this; - } - - // clears the appropriate flag to false - wxBitset& reset(const T el) //remove element - { - m_data &= ~(1 << el); - return *this; - } - - // clear all flags - wxBitset& reset() - { - m_data = 0; - return *this; - } - - // true if this flag is set - bool test(const T el) const - { - return (m_data & (1 << el)) ? true : false; - } - - // true if no flag is set - bool none() const - { - return m_data == 0; - } - - // true if any flag is set - bool any() const - { - return m_data != 0; - } - - // true if both have the same flags - bool operator ==(const wxBitset &rhs) const - { - return m_data == rhs.m_data; - } - - // true if both differ in their flags set - bool operator !=(const wxBitset &rhs) const - { - return !operator==(rhs); - } - - bool operator[] (const T el) const { return test(el) ; } - -private : - unsigned long m_data; -}; - -#define WX_DEFINE_FLAGS( flags ) \ - class WXDLLEXPORT flags \ - {\ - public : \ - flags(long data=0) :m_data(data) {} \ - long m_data ;\ - bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\ - } ; - -#endif diff --git a/Source/3rdParty/wx/include/wx/fmappriv.h b/Source/3rdParty/wx/include/wx/fmappriv.h deleted file mode 100644 index 95df28c90..000000000 --- a/Source/3rdParty/wx/include/wx/fmappriv.h +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fmappriv.h -// Purpose: private wxFontMapper stuff, not to be used by the library users -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 (extracted from common/fontmap.cpp) -// RCS-ID: $Id: fmappriv.h 27454 2004-05-26 10:49:43Z JS $ -// Copyright: (c) 1999-2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FMAPPRIV_H_ -#define _WX_FMAPPRIV_H_ - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// a special pseudo encoding which means "don't ask me about this charset -// any more" -- we need it to avoid driving the user crazy with asking him -// time after time about the same charset which he [presumably] doesn't -// have the fonts for -enum { wxFONTENCODING_UNKNOWN = -2 }; - -// the config paths we use -#if wxUSE_CONFIG - -#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") -#define FONTMAPPER_CHARSET_PATH wxT("Charsets") -#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") - -#endif // wxUSE_CONFIG - -// ---------------------------------------------------------------------------- -// wxFontMapperPathChanger: change the config path during our lifetime -// ---------------------------------------------------------------------------- - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - -class wxFontMapperPathChanger -{ -public: - wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) - { - m_fontMapper = fontMapper; - m_ok = m_fontMapper->ChangePath(path, &m_pathOld); - } - - bool IsOk() const { return m_ok; } - - ~wxFontMapperPathChanger() - { - if ( IsOk() ) - m_fontMapper->RestorePath(m_pathOld); - } - -private: - // the fontmapper object we're working with - wxFontMapperBase *m_fontMapper; - - // the old path to be restored if m_ok - wxString m_pathOld; - - // have we changed the path successfully? - bool m_ok; - - - DECLARE_NO_COPY_CLASS(wxFontMapperPathChanger) -}; - -#endif // wxUSE_CONFIG - -#endif // _WX_FMAPPRIV_H_ - diff --git a/Source/3rdParty/wx/include/wx/font.h b/Source/3rdParty/wx/include/wx/font.h deleted file mode 100644 index 751262626..000000000 --- a/Source/3rdParty/wx/include/wx/font.h +++ /dev/null @@ -1,251 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/font.h -// Purpose: wxFontBase class: the interface of wxFont -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.99 -// RCS-ID: $Id: font.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONT_H_BASE_ -#define _WX_FONT_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" // for wxDEFAULT &c -#include "wx/fontenc.h" // the font encoding constants -#include "wx/gdiobj.h" // the base class - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxFontData; -class WXDLLIMPEXP_FWD_CORE wxFontBase; -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxSize; - -// ---------------------------------------------------------------------------- -// font constants -// ---------------------------------------------------------------------------- - -// standard font families: these may be used only for the font creation, it -// doesn't make sense to query an existing font for its font family as, -// especially if the font had been created from a native font description, it -// may be unknown -enum wxFontFamily -{ - wxFONTFAMILY_DEFAULT = wxDEFAULT, - wxFONTFAMILY_DECORATIVE = wxDECORATIVE, - wxFONTFAMILY_ROMAN = wxROMAN, - wxFONTFAMILY_SCRIPT = wxSCRIPT, - wxFONTFAMILY_SWISS = wxSWISS, - wxFONTFAMILY_MODERN = wxMODERN, - wxFONTFAMILY_TELETYPE = wxTELETYPE, - wxFONTFAMILY_MAX, - wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX -}; - -// font styles -enum wxFontStyle -{ - wxFONTSTYLE_NORMAL = wxNORMAL, - wxFONTSTYLE_ITALIC = wxITALIC, - wxFONTSTYLE_SLANT = wxSLANT, - wxFONTSTYLE_MAX -}; - -// font weights -enum wxFontWeight -{ - wxFONTWEIGHT_NORMAL = wxNORMAL, - wxFONTWEIGHT_LIGHT = wxLIGHT, - wxFONTWEIGHT_BOLD = wxBOLD, - wxFONTWEIGHT_MAX -}; - -// the font flag bits for the new font ctor accepting one combined flags word -enum -{ - // no special flags: font with default weight/slant/anti-aliasing - wxFONTFLAG_DEFAULT = 0, - - // slant flags (default: no slant) - wxFONTFLAG_ITALIC = 1 << 0, - wxFONTFLAG_SLANT = 1 << 1, - - // weight flags (default: medium) - wxFONTFLAG_LIGHT = 1 << 2, - wxFONTFLAG_BOLD = 1 << 3, - - // anti-aliasing flag: force on or off (default: the current system default) - wxFONTFLAG_ANTIALIASED = 1 << 4, - wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, - - // underlined/strikethrough flags (default: no lines) - wxFONTFLAG_UNDERLINED = 1 << 6, - wxFONTFLAG_STRIKETHROUGH = 1 << 7, - - // the mask of all currently used flags - wxFONTFLAG_MASK = wxFONTFLAG_ITALIC | - wxFONTFLAG_SLANT | - wxFONTFLAG_LIGHT | - wxFONTFLAG_BOLD | - wxFONTFLAG_ANTIALIASED | - wxFONTFLAG_NOT_ANTIALIASED | - wxFONTFLAG_UNDERLINED | - wxFONTFLAG_STRIKETHROUGH -}; - -// ---------------------------------------------------------------------------- -// wxFontBase represents a font object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo; - -class WXDLLEXPORT wxFontBase : public wxGDIObject -{ -public: - // creator function - virtual ~wxFontBase(); - - // from the font components - static wxFont *New( - int pointSize, // size of the font in points - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... - - // from the font components but using the font flags instead of separate - // parameters for each flag - static wxFont *New(int pointSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - // from the font components - static wxFont *New( - const wxSize& pixelSize, // size of the font in pixels - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... - - // from the font components but using the font flags instead of separate - // parameters for each flag - static wxFont *New(const wxSize& pixelSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - // from the (opaque) native font description object - static wxFont *New(const wxNativeFontInfo& nativeFontDesc); - - // from the string representation of wxNativeFontInfo - static wxFont *New(const wxString& strNativeFontDesc); - - // was the font successfully created? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // comparison - bool operator == (const wxFont& font) const; - bool operator != (const wxFont& font) const; - - // accessors: get the font characteristics - virtual int GetPointSize() const = 0; - virtual wxSize GetPixelSize() const; - virtual bool IsUsingSizeInPixels() const; - virtual int GetFamily() const = 0; - virtual int GetStyle() const = 0; - virtual int GetWeight() const = 0; - virtual bool GetUnderlined() const = 0; - virtual wxString GetFaceName() const = 0; - virtual wxFontEncoding GetEncoding() const = 0; - virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; - - virtual bool IsFixedWidth() const; - - wxString GetNativeFontInfoDesc() const; - wxString GetNativeFontInfoUserDesc() const; - - // change the font characteristics - virtual void SetPointSize( int pointSize ) = 0; - virtual void SetPixelSize( const wxSize& pixelSize ); - virtual void SetFamily( int family ) = 0; - virtual void SetStyle( int style ) = 0; - virtual void SetWeight( int weight ) = 0; - virtual void SetUnderlined( bool underlined ) = 0; - virtual void SetEncoding(wxFontEncoding encoding) = 0; - virtual bool SetFaceName( const wxString& faceName ); - void SetNativeFontInfo(const wxNativeFontInfo& info) - { DoSetNativeFontInfo(info); } - - bool SetNativeFontInfo(const wxString& info); - bool SetNativeFontInfoUserDesc(const wxString& info); - - // translate the fonts into human-readable string (i.e. GetStyleString() - // will return "wxITALIC" for an italic font, ...) - wxString GetFamilyString() const; - wxString GetStyleString() const; - wxString GetWeightString() const; - - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } - virtual bool GetNoAntiAliasing() const { return false; } - - // the default encoding is used for creating all fonts with default - // encoding parameter - static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } - static void SetDefaultEncoding(wxFontEncoding encoding); - -protected: - // the function called by both overloads of SetNativeFontInfo() - virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - -private: - // the currently default encoding: by default, it's the default system - // encoding, but may be changed by the application using - // SetDefaultEncoding() to make all subsequent fonts created without - // specifying encoding parameter using this encoding - static wxFontEncoding ms_encodingDefault; -}; - -// include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/font.h" -#elif defined(__WXMSW__) - #include "wx/msw/font.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/font.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/font.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/font.h" -#elif defined(__WXX11__) - #include "wx/x11/font.h" -#elif defined(__WXMGL__) - #include "wx/mgl/font.h" -#elif defined(__WXDFB__) - #include "wx/dfb/font.h" -#elif defined(__WXMAC__) - #include "wx/mac/font.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/font.h" -#elif defined(__WXPM__) - #include "wx/os2/font.h" -#endif - -#endif - // _WX_FONT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/fontdlg.h b/Source/3rdParty/wx/include/wx/fontdlg.h deleted file mode 100644 index f93bba49e..000000000 --- a/Source/3rdParty/wx/include/wx/fontdlg.h +++ /dev/null @@ -1,118 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fontdlg.h -// Purpose: common interface for different wxFontDialog classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.05.02 -// RCS-ID: $Id: fontdlg.h 41846 2006-10-09 22:56:48Z VZ $ -// Copyright: (c) 1997-2002 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTDLG_H_BASE_ -#define _WX_FONTDLG_H_BASE_ - -#include "wx/defs.h" // for wxUSE_FONTDLG - -#if wxUSE_FONTDLG - -#include "wx/dialog.h" // the base class -#include "wx/cmndata.h" // wxFontData - -// ---------------------------------------------------------------------------- -// wxFontDialog interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontDialogBase : public wxDialog -{ -public: - // create the font dialog - wxFontDialogBase() { } - wxFontDialogBase(wxWindow *parent) { m_parent = parent; } - wxFontDialogBase(wxWindow *parent, const wxFontData& data) - { m_parent = parent; InitFontData(&data); } - - bool Create(wxWindow *parent) - { return DoCreate(parent); } - bool Create(wxWindow *parent, const wxFontData& data) - { InitFontData(&data); return Create(parent); } - - virtual ~wxFontDialogBase(); - - // retrieve the font data - const wxFontData& GetFontData() const { return m_fontData; } - wxFontData& GetFontData() { return m_fontData; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use - wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) ); - - wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } - - void InitFontData(const wxFontData *data = NULL) - { if ( data ) m_fontData = *data; } - - wxFontData m_fontData; - - DECLARE_NO_COPY_CLASS(wxFontDialogBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use -inline wxFontDialogBase::wxFontDialogBase(wxWindow *parent, const wxFontData *data) -{ m_parent = parent; InitFontData(data); } - -inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) -{ InitFontData(data); return Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// platform-specific wxFontDialog implementation -// ---------------------------------------------------------------------------- - -#if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) -//set to 1 to use native mac font and color dialogs -#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 -#else -//not supported on these platforms, leave 0 -#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 -#endif - -#if defined(__WXUNIVERSAL__) || \ - defined(__WXMOTIF__) || \ - defined(__WXCOCOA__) || \ - defined(__WXWINCE__) || \ - defined(__WXGPE__) - - #include "wx/generic/fontdlgg.h" - #define wxFontDialog wxGenericFontDialog -#elif defined(__WXMSW__) - #include "wx/msw/fontdlg.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/fontdlg.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/fontdlg.h" -#elif defined(__WXPM__) - #include "wx/os2/fontdlg.h" -#elif defined(__WXMAC__) - #include "wx/mac/fontdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// global public functions -// ---------------------------------------------------------------------------- - -// get the font from user and return it, returns wxNullFont if the dialog was -// cancelled -wxFont WXDLLEXPORT -wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, - const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); - -#endif // wxUSE_FONTDLG - -#endif - // _WX_FONTDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/fontenc.h b/Source/3rdParty/wx/include/wx/fontenc.h deleted file mode 100644 index b80acafff..000000000 --- a/Source/3rdParty/wx/include/wx/fontenc.h +++ /dev/null @@ -1,151 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontenc.h -// Purpose: wxFontEncoding constants -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.03.00 -// RCS-ID: $Id: fontenc.h 29139 2004-09-14 12:08:28Z ABX $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTENC_H_ -#define _WX_FONTENC_H_ - -// font encodings -enum wxFontEncoding -{ - wxFONTENCODING_SYSTEM = -1, // system default - wxFONTENCODING_DEFAULT, // current default encoding - - // ISO8859 standard defines a number of single-byte charsets - wxFONTENCODING_ISO8859_1, // West European (Latin1) - wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) - wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) - wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) - wxFONTENCODING_ISO8859_5, // Cyrillic - wxFONTENCODING_ISO8859_6, // Arabic - wxFONTENCODING_ISO8859_7, // Greek - wxFONTENCODING_ISO8859_8, // Hebrew - wxFONTENCODING_ISO8859_9, // Turkish (Latin5) - wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) - wxFONTENCODING_ISO8859_11, // Thai - wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it - // here anyhow to make all ISO8859 - // consecutive numbers - wxFONTENCODING_ISO8859_13, // Baltic (Latin7) - wxFONTENCODING_ISO8859_14, // Latin8 - wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) - wxFONTENCODING_ISO8859_MAX, - - // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) - wxFONTENCODING_KOI8, // KOI8 Russian - wxFONTENCODING_KOI8_U, // KOI8 Ukrainian - wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 - wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria - - // what would we do without Microsoft? They have their own encodings - // for DOS - wxFONTENCODING_CP437, // original MS-DOS codepage - wxFONTENCODING_CP850, // CP437 merged with Latin1 - wxFONTENCODING_CP852, // CP437 merged with Latin2 - wxFONTENCODING_CP855, // another cyrillic encoding - wxFONTENCODING_CP866, // and another one - // and for Windows - wxFONTENCODING_CP874, // WinThai - wxFONTENCODING_CP932, // Japanese (shift-JIS) - wxFONTENCODING_CP936, // Chinese simplified (GB) - wxFONTENCODING_CP949, // Korean (Hangul charset) - wxFONTENCODING_CP950, // Chinese (traditional - Big5) - wxFONTENCODING_CP1250, // WinLatin2 - wxFONTENCODING_CP1251, // WinCyrillic - wxFONTENCODING_CP1252, // WinLatin1 - wxFONTENCODING_CP1253, // WinGreek (8859-7) - wxFONTENCODING_CP1254, // WinTurkish - wxFONTENCODING_CP1255, // WinHebrew - wxFONTENCODING_CP1256, // WinArabic - wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) - wxFONTENCODING_CP12_MAX, - - wxFONTENCODING_UTF7, // UTF-7 Unicode encoding - wxFONTENCODING_UTF8, // UTF-8 Unicode encoding - wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese - wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding - wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding - wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding - wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding - - wxFONTENCODING_MACROMAN, // the standard mac encodings - wxFONTENCODING_MACJAPANESE, - wxFONTENCODING_MACCHINESETRAD, - wxFONTENCODING_MACKOREAN, - wxFONTENCODING_MACARABIC, - wxFONTENCODING_MACHEBREW, - wxFONTENCODING_MACGREEK, - wxFONTENCODING_MACCYRILLIC, - wxFONTENCODING_MACDEVANAGARI, - wxFONTENCODING_MACGURMUKHI, - wxFONTENCODING_MACGUJARATI, - wxFONTENCODING_MACORIYA, - wxFONTENCODING_MACBENGALI, - wxFONTENCODING_MACTAMIL, - wxFONTENCODING_MACTELUGU, - wxFONTENCODING_MACKANNADA, - wxFONTENCODING_MACMALAJALAM, - wxFONTENCODING_MACSINHALESE, - wxFONTENCODING_MACBURMESE, - wxFONTENCODING_MACKHMER, - wxFONTENCODING_MACTHAI, - wxFONTENCODING_MACLAOTIAN, - wxFONTENCODING_MACGEORGIAN, - wxFONTENCODING_MACARMENIAN, - wxFONTENCODING_MACCHINESESIMP, - wxFONTENCODING_MACTIBETAN, - wxFONTENCODING_MACMONGOLIAN, - wxFONTENCODING_MACETHIOPIC, - wxFONTENCODING_MACCENTRALEUR, - wxFONTENCODING_MACVIATNAMESE, - wxFONTENCODING_MACARABICEXT, - wxFONTENCODING_MACSYMBOL, - wxFONTENCODING_MACDINGBATS, - wxFONTENCODING_MACTURKISH, - wxFONTENCODING_MACCROATIAN, - wxFONTENCODING_MACICELANDIC, - wxFONTENCODING_MACROMANIAN, - wxFONTENCODING_MACCELTIC, - wxFONTENCODING_MACGAELIC, - wxFONTENCODING_MACKEYBOARD, - - wxFONTENCODING_MAX, // highest enumerated encoding value - - wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , - wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , - - // aliases for endian-dependent UTF encodings -#ifdef WORDS_BIGENDIAN - wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 - wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32 -#else // WORDS_BIGENDIAN - wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16 - wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32 -#endif // WORDS_BIGENDIAN - - // alias for the native Unicode encoding on this platform - // (this is used by wxEncodingConverter and wxUTFFile only for now) -#if SIZEOF_WCHAR_T == 2 - wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16, -#else // SIZEOF_WCHAR_T == 4 - wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32, -#endif - - // alternative names for Far Eastern encodings - // Chinese - wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese - wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese - - // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) - wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS -}; - -#endif // _WX_FONTENC_H_ - diff --git a/Source/3rdParty/wx/include/wx/fontenum.h b/Source/3rdParty/wx/include/wx/fontenum.h deleted file mode 100644 index 8ea5a23c9..000000000 --- a/Source/3rdParty/wx/include/wx/fontenum.h +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontenum.h -// Purpose: wxFontEnumerator class for getting available fonts -// Author: Julian Smart, Vadim Zeitlin -// Modified by: extended to enumerate more than just font facenames and works -// not only on Windows now (VZ) -// Created: 04/01/98 -// RCS-ID: $Id: fontenum.h 43727 2006-12-01 10:14:28Z VS $ -// Copyright: (c) Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTENUM_H_ -#define _WX_FONTENUM_H_ - -#include "wx/fontenc.h" -#include "wx/arrstr.h" - -#if wxUSE_PANGO || defined(__WXDFB__) - // defined if the port uses only UTF-8 font encodings internally - #define wxHAS_UTF8_FONTS -#endif - -// ---------------------------------------------------------------------------- -// wxFontEnumerator enumerates all available fonts on the system or only the -// fonts with given attributes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontEnumerator -{ -public: - wxFontEnumerator() {} - - // virtual dtor for the base class - virtual ~wxFontEnumerator() {} - - // start enumerating font facenames (either all of them or those which - // support the given encoding) - will result in OnFacename() being - // called for each available facename (until they are exhausted or - // OnFacename returns false) - virtual bool EnumerateFacenames - ( - wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = false - ); - - // enumerate the different encodings either for given font facename or for - // all facenames - will result in OnFontEncoding() being called for each - // available (facename, encoding) couple - virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString); - - // callbacks which are called after one of EnumerateXXX() functions from - // above is invoked - all of them may return false to stop enumeration or - // true to continue with it - - // called by EnumerateFacenames - virtual bool OnFacename(const wxString& WXUNUSED(facename)) - { return true; } - - // called by EnumerateEncodings - virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), - const wxString& WXUNUSED(encoding)) - { return true; } - - - - // convenience function that returns array of facenames. - static wxArrayString - GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = false); - - // convenience function that returns array of all available encodings. - static wxArrayString GetEncodings(const wxString& facename = wxEmptyString); - - // convenience function that returns true if the given face name exist - // in the user's system - static bool IsValidFacename(const wxString &str); - -private: -#ifdef wxHAS_UTF8_FONTS - // helper for ports that only use UTF-8 encoding natively - bool EnumerateEncodingsUTF8(const wxString& facename); -#endif - - DECLARE_NO_COPY_CLASS(wxFontEnumerator) -}; - -#endif // _WX_FONTENUM_H_ diff --git a/Source/3rdParty/wx/include/wx/fontmap.h b/Source/3rdParty/wx/include/wx/fontmap.h deleted file mode 100644 index c30511328..000000000 --- a/Source/3rdParty/wx/include/wx/fontmap.h +++ /dev/null @@ -1,290 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontmap.h -// Purpose: wxFontMapper class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.11.99 -// RCS-ID: $Id: fontmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTMAPPER_H_ -#define _WX_FONTMAPPER_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_FONTMAP - -#include "wx/fontenc.h" // for wxFontEncoding - -#if wxUSE_GUI - #include "wx/fontutil.h" // for wxNativeEncodingInfo -#endif // wxUSE_GUI - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - class WXDLLIMPEXP_FWD_BASE wxConfigBase; -#endif // wxUSE_CONFIG - -class WXDLLIMPEXP_FWD_CORE wxFontMapper; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxWindow; -#endif // wxUSE_GUI - -// ============================================================================ -// wxFontMapper manages user-definable correspondence between wxWidgets font -// encodings and the fonts present on the machine. -// -// This is a singleton class, font mapper objects can only be accessed using -// wxFontMapper::Get(). -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxFontMapperBase: this is a non-interactive class which just uses its built -// in knowledge of the encodings equivalence -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFontMapperBase -{ -public: - // constructtor and such - // --------------------- - - // default ctor - wxFontMapperBase(); - - // virtual dtor for any base class - virtual ~wxFontMapperBase(); - - // return instance of the wxFontMapper singleton - // wxBase code only cares that it's a wxFontMapperBase - // In wxBase, wxFontMapper is only forward declared - // so one cannot implicitly cast from it to wxFontMapperBase. - static wxFontMapperBase *Get(); - - // set the singleton to 'mapper' instance and return previous one - static wxFontMapper *Set(wxFontMapper *mapper); - - // delete the existing font mapper if any - static void Reset(); - - - // translates charset strings to encoding - // -------------------------------------- - - // returns the encoding for the given charset (in the form of RFC 2046) or - // wxFONTENCODING_SYSTEM if couldn't decode it - // - // interactive parameter is ignored in the base class, we behave as if it - // were always false - virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = true); - - // information about supported encodings - // ------------------------------------- - - // get the number of font encodings we know about - static size_t GetSupportedEncodingsCount(); - - // get the n-th supported encoding - static wxFontEncoding GetEncoding(size_t n); - - // return canonical name of this encoding (this is a short string, - // GetEncodingDescription() returns a longer one) - static wxString GetEncodingName(wxFontEncoding encoding); - - // return a list of all names of this encoding (see GetEncodingName) - static const wxChar** GetAllEncodingNames(wxFontEncoding encoding); - - // return user-readable string describing the given encoding - // - // NB: hard-coded now, but might change later (read it from config?) - static wxString GetEncodingDescription(wxFontEncoding encoding); - - // find the encoding corresponding to the given name, inverse of - // GetEncodingName() and less general than CharsetToEncoding() - // - // returns wxFONTENCODING_MAX if the name is not a supported encoding - static wxFontEncoding GetEncodingFromName(const wxString& name); - - - // functions which allow to configure the config object used: by default, - // the global one (from wxConfigBase::Get() will be used) and the default - // root path for the config settings is the string returned by - // GetDefaultConfigPath() - // ---------------------------------------------------------------------- - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // set the root config path to use (should be an absolute path) - void SetConfigPath(const wxString& prefix); - - // return default config path - static const wxChar *GetDefaultConfigPath(); -#endif // wxUSE_CONFIG - - - // returns true for the base class and false for a "real" font mapper object - // (implementation-only) - virtual bool IsDummy() { return true; } - -protected: -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // get the config object we're using -- either the global config object - // or a wxMemoryConfig object created by this class otherwise - wxConfigBase *GetConfig(); - - // gets the root path for our settings -- if it wasn't set explicitly, use - // GetDefaultConfigPath() - const wxString& GetConfigPath(); - - // change to the given (relative) path in the config, return true if ok - // (then GetConfig() will return something !NULL), false if no config - // object - // - // caller should provide a pointer to the string variable which should be - // later passed to RestorePath() - bool ChangePath(const wxString& pathNew, wxString *pathOld); - - // restore the config path after use - void RestorePath(const wxString& pathOld); - - // config object and path (in it) to use - wxConfigBase *m_configDummy; - - wxString m_configRootPath; -#endif // wxUSE_CONFIG - - // the real implementation of the base class version of CharsetToEncoding() - // - // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't - // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we - // should/could ask the user - int NonInteractiveCharsetToEncoding(const wxString& charset); - -private: - // the global fontmapper object or NULL - static wxFontMapper *sm_instance; - - friend class wxFontMapperPathChanger; - - DECLARE_NO_COPY_CLASS(wxFontMapperBase) -}; - -// ---------------------------------------------------------------------------- -// wxFontMapper: interactive extension of wxFontMapperBase -// -// The default implementations of all functions will ask the user if they are -// not capable of finding the answer themselves and store the answer in a -// config file (configurable via SetConfigXXX functions). This behaviour may -// be disabled by giving the value of false to "interactive" parameter. -// However, the functions will always consult the config file to allow the -// user-defined values override the default logic and there is no way to -// disable this -- which shouldn't be ever needed because if "interactive" was -// never true, the config file is never created anyhow. -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase -{ -public: - // default ctor - wxFontMapper(); - - // virtual dtor for a base class - virtual ~wxFontMapper(); - - // working with the encodings - // -------------------------- - - // returns the encoding for the given charset (in the form of RFC 2046) or - // wxFONTENCODING_SYSTEM if couldn't decode it - virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = true); - - // find an alternative for the given encoding (which is supposed to not be - // available on this system). If successful, return true and fill info - // structure with the parameters required to create the font, otherwise - // return false - virtual bool GetAltForEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info, - const wxString& facename = wxEmptyString, - bool interactive = true); - - // version better suitable for 'public' use. Returns wxFontEcoding - // that can be used it wxFont ctor - bool GetAltForEncoding(wxFontEncoding encoding, - wxFontEncoding *alt_encoding, - const wxString& facename = wxEmptyString, - bool interactive = true); - - // checks whether given encoding is available in given face or not. - // - // if no facename is given (default), return true if it's available in any - // facename at alll. - virtual bool IsEncodingAvailable(wxFontEncoding encoding, - const wxString& facename = wxEmptyString); - - - // configure the appearance of the dialogs we may popup - // ---------------------------------------------------- - - // the parent window for modal dialogs - void SetDialogParent(wxWindow *parent) { m_windowParent = parent; } - - // the title for the dialogs (note that default is quite reasonable) - void SetDialogTitle(const wxString& title) { m_titleDialog = title; } - - // GUI code needs to know it's a wxFontMapper because there - // are additional methods in the subclass. - static wxFontMapper *Get(); - - // pseudo-RTTI since we aren't a wxObject. - virtual bool IsDummy() { return false; } - -protected: - // GetAltForEncoding() helper: tests for the existence of the given - // encoding and saves the result in config if ok - this results in the - // following (desired) behaviour: when an unknown/unavailable encoding is - // requested for the first time, the user is asked about a replacement, - // but if he doesn't choose any and the default logic finds one, it will - // be saved in the config so that the user won't be asked about it any - // more - bool TestAltEncoding(const wxString& configEntry, - wxFontEncoding encReplacement, - wxNativeEncodingInfo *info); - - // the title for our dialogs - wxString m_titleDialog; - - // the parent window for our dialogs - wxWindow *m_windowParent; - -private: - DECLARE_NO_COPY_CLASS(wxFontMapper) -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default font mapper for wxWidgets programs do NOT use! This is for -// backward compatibility, use wxFontMapper::Get() instead -#define wxTheFontMapper (wxFontMapper::Get()) - -#else // !wxUSE_FONTMAP - -#if wxUSE_GUI - // wxEncodingToCodepage (utils.cpp) needs wxGetNativeFontEncoding - #include "wx/fontutil.h" -#endif - -#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP - -#endif // _WX_FONTMAPPER_H_ - diff --git a/Source/3rdParty/wx/include/wx/fontpicker.h b/Source/3rdParty/wx/include/wx/fontpicker.h deleted file mode 100644 index d13d0b22f..000000000 --- a/Source/3rdParty/wx/include/wx/fontpicker.h +++ /dev/null @@ -1,223 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontpicker.h -// Purpose: wxFontPickerCtrl base header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: fontpicker.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTPICKER_H_BASE_ -#define _WX_FONTPICKER_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_FONTPICKERCTRL - -#include "wx/pickerbase.h" - - -class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxFontPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxFontPickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFontPickerWidgetBase -{ -public: - wxFontPickerWidgetBase() { m_selectedFont = *wxNORMAL_FONT; } - virtual ~wxFontPickerWidgetBase() {} - - wxFont GetSelectedFont() const - { return m_selectedFont; } - virtual void SetSelectedFont(const wxFont &f) - { m_selectedFont = f; UpdateFont(); } - -protected: - - virtual void UpdateFont() = 0; - - // the current font (may be invalid if none) - // NOTE: don't call this m_font as wxWindow::m_font already exists - wxFont m_selectedFont; -}; - -// Styles which must be supported by all controls implementing wxFontPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - - -// keeps the label of the button updated with the fontface name + font size -// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, -// updates the wxFontButtonGeneric's label (overwriting any previous label) -// with the "Times New Roman, 10" text (only fontface + fontsize is displayed -// to avoid extralong labels). -#define wxFNTP_FONTDESC_AS_LABEL 0x0008 - -// uses the currently selected font to draw the label of the button -#define wxFNTP_USEFONT_FOR_LABEL 0x0010 - -// since GTK > 2.4, there is GtkFontButton -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/fontpicker.h" - #define wxFontPickerWidget wxFontButton -#else - #include "wx/generic/fontpickerg.h" - #define wxFontPickerWidget wxGenericFontButton -#endif - - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl specific flags -// ---------------------------------------------------------------------------- - -#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) -#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL) - -// not a style but rather the default value of the maximum pointsize allowed -#define wxFNTP_MAXPOINT_SIZE 100 - - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl: platform-independent class which embeds the -// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase -{ -public: - wxFontPickerCtrl() - : m_bIgnoreNextTextCtrlUpdate(false), - m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) - { - } - - virtual ~wxFontPickerCtrl() {} - - - wxFontPickerCtrl(wxWindow *parent, - wxWindowID id, - const wxFont& initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFNTP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerCtrlNameStr) - : m_bIgnoreNextTextCtrlUpdate(false), - m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) - { - Create(parent, id, initial, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxFont& initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFNTP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerCtrlNameStr); - - -public: // public API - - // get the font chosen - wxFont GetSelectedFont() const - { return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); } - - // sets currently displayed font - void SetSelectedFont(const wxFont& f); - - // set/get the max pointsize - void SetMaxPointSize(unsigned int max) - { m_nMaxPointSize=max; } - unsigned int GetMaxPointSize() const - { return m_nMaxPointSize; } - -public: // internal functions - - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnFontChange(wxFontPickerEvent &); - - // used to convert wxString <-> wxFont - virtual wxString Font2String(const wxFont &font); - virtual wxFont String2Font(const wxString &font); - -protected: - - // extracts the style for our picker from wxFontPickerCtrl's style - long GetPickerStyle(long style) const - { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - - // the maximum pointsize allowed to the user - unsigned int m_nMaxPointSize; - -private: - DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl) -}; - - -// ---------------------------------------------------------------------------- -// wxFontPickerEvent: used by wxFontPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FONTPICKER_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent -{ -public: - wxFontPickerEvent() {} - wxFontPickerEvent(wxObject *generator, int id, const wxFont &f) - : wxCommandEvent(wxEVT_COMMAND_FONTPICKER_CHANGED, id), - m_font(f) - { - SetEventObject(generator); - } - - wxFont GetFont() const { return m_font; } - void SetFont(const wxFont &c) { m_font = c; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFontPickerEvent(*this); } - -private: - wxFont m_font; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); - -#define wxFontPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFontPickerEventFunction, &func) - -#define EVT_FONTPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) - - -#endif // wxUSE_FONTPICKERCTRL - -#endif - // _WX_FONTPICKER_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/fontutil.h b/Source/3rdParty/wx/include/wx/fontutil.h deleted file mode 100644 index c0c46e458..000000000 --- a/Source/3rdParty/wx/include/wx/fontutil.h +++ /dev/null @@ -1,242 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontutil.h -// Purpose: font-related helper functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.11.99 -// RCS-ID: $Id: fontutil.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// General note: this header is private to wxWidgets and is not supposed to be -// included by user code. The functions declared here are implemented in -// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c. - -#ifndef _WX_FONTUTIL_H_ -#define _WX_FONTUTIL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/font.h" // for wxFont and wxFontEncoding - -#if defined(__WXMSW__) - #include "wx/msw/wrapwin.h" -#endif - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo; - -#if defined(_WX_X_FONTLIKE) - -// the symbolic names for the XLFD fields (with examples for their value) -// -// NB: we suppose that the font always starts with the empty token (font name -// registry field) as we never use nor generate it anyhow -enum wxXLFDField -{ - wxXLFD_FOUNDRY, // adobe - wxXLFD_FAMILY, // courier, times, ... - wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light - wxXLFD_SLANT, // r/i/o (roman/italique/oblique) - wxXLFD_SETWIDTH, // condensed, expanded, ... - wxXLFD_ADDSTYLE, // whatever - usually nothing - wxXLFD_PIXELSIZE, // size in pixels - wxXLFD_POINTSIZE, // size in points - wxXLFD_RESX, // 72, 75, 100, ... - wxXLFD_RESY, - wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell) - wxXLFD_AVGWIDTH, // average width in 1/10 pixels - wxXLFD_REGISTRY, // iso8859, rawin, koi8, ... - wxXLFD_ENCODING, // 1, r, r, ... - wxXLFD_MAX -}; - -#endif // _WX_X_FONTLIKE - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// wxNativeFontInfo is platform-specific font representation: this struct -// should be considered as opaque font description only used by the native -// functions, the user code can only get the objects of this type from -// somewhere and pass it somewhere else (possibly save them somewhere using -// ToString() and restore them using FromString()) -class WXDLLEXPORT wxNativeFontInfo -{ -public: -#if wxUSE_PANGO - PangoFontDescription *description; -#elif defined(_WX_X_FONTLIKE) - // the members can't be accessed directly as we only parse the - // xFontName on demand -private: - // the components of the XLFD - wxString fontElements[wxXLFD_MAX]; - - // the full XLFD - wxString xFontName; - - // true until SetXFontName() is called - bool m_isDefault; - - // return true if we have already initialized fontElements - inline bool HasElements() const; - -public: - // init the elements from an XLFD, return true if ok - bool FromXFontName(const wxString& xFontName); - - // return false if we were never initialized with a valid XLFD - bool IsDefault() const { return m_isDefault; } - - // return the XLFD (using the fontElements if necessary) - wxString GetXFontName() const; - - // get the given XFLD component - wxString GetXFontComponent(wxXLFDField field) const; - - // change the font component - void SetXFontComponent(wxXLFDField field, const wxString& value); - - // set the XFLD - void SetXFontName(const wxString& xFontName); -#elif defined(__WXMSW__) - LOGFONT lf; -#elif defined(__WXPM__) - // OS/2 native structures that define a font - FATTRS fa; - FONTMETRICS fm; - FACENAMEDESC fn; -#else // other platforms - // - // This is a generic implementation that should work on all ports - // without specific support by the port. - // - #define wxNO_NATIVE_FONTINFO - - int pointSize; - wxFontFamily family; - wxFontStyle style; - wxFontWeight weight; - bool underlined; - wxString faceName; - wxFontEncoding encoding; -#endif // platforms - - // default ctor (default copy ctor is ok) - wxNativeFontInfo() { Init(); } - -#if wxUSE_PANGO -private: - void Init(const wxNativeFontInfo& info); - void Free(); - -public: - wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } - ~wxNativeFontInfo() { Free(); } - - wxNativeFontInfo& operator=(const wxNativeFontInfo& info) - { - Free(); - Init(info); - return *this; - } -#endif // wxUSE_PANGO - - // reset to the default state - void Init(); - - // init with the parameters of the given font - void InitFromFont(const wxFont& font) - { - // translate all font parameters - SetStyle((wxFontStyle)font.GetStyle()); - SetWeight((wxFontWeight)font.GetWeight()); - SetUnderlined(font.GetUnderlined()); -#if defined(__WXMSW__) - if ( font.IsUsingSizeInPixels() ) - SetPixelSize(font.GetPixelSize()); - else - SetPointSize(font.GetPointSize()); -#else - SetPointSize(font.GetPointSize()); -#endif - - // set the family/facename - SetFamily((wxFontFamily)font.GetFamily()); - const wxString& facename = font.GetFaceName(); - if ( !facename.empty() ) - { - SetFaceName(facename); - } - - // deal with encoding now (it may override the font family and facename - // so do it after setting them) - SetEncoding(font.GetEncoding()); - } - - // accessors and modifiers for the font elements - int GetPointSize() const; - wxSize GetPixelSize() const; - wxFontStyle GetStyle() const; - wxFontWeight GetWeight() const; - bool GetUnderlined() const; - wxString GetFaceName() const; - wxFontFamily GetFamily() const; - wxFontEncoding GetEncoding() const; - - void SetPointSize(int pointsize); - void SetPixelSize(const wxSize& pixelSize); - void SetStyle(wxFontStyle style); - void SetWeight(wxFontWeight weight); - void SetUnderlined(bool underlined); - bool SetFaceName(const wxString& facename); - void SetFamily(wxFontFamily family); - void SetEncoding(wxFontEncoding encoding); - - // sets the first facename in the given array which is found - // to be valid. If no valid facename is given, sets the - // first valid facename returned by wxFontEnumerator::GetFacenames(). - // Does not return a bool since it cannot fail. - void SetFaceName(const wxArrayString &facenames); - - - // it is important to be able to serialize wxNativeFontInfo objects to be - // able to store them (in config file, for example) - bool FromString(const wxString& s); - wxString ToString() const; - - // we also want to present the native font descriptions to the user in some - // human-readable form (it is not platform independent neither, but can - // hopefully be understood by the user) - bool FromUserString(const wxString& s); - wxString ToUserString() const; -}; - -// ---------------------------------------------------------------------------- -// font-related functions (common) -// ---------------------------------------------------------------------------- - -// translate a wxFontEncoding into native encoding parameter (defined above), -// returning true if an (exact) macth could be found, false otherwise (without -// attempting any substitutions) -extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info); - -// test for the existence of the font described by this facename/encoding, -// return true if such font(s) exist, false otherwise -extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); - -// ---------------------------------------------------------------------------- -// font-related functions (X and GTK) -// ---------------------------------------------------------------------------- - -#ifdef _WX_X_FONTLIKE - #include "wx/unix/fontutil.h" -#endif // X || GDK - -#endif // _WX_FONTUTIL_H_ diff --git a/Source/3rdParty/wx/include/wx/frame.h b/Source/3rdParty/wx/include/wx/frame.h deleted file mode 100644 index a1a8036fc..000000000 --- a/Source/3rdParty/wx/include/wx/frame.h +++ /dev/null @@ -1,262 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/frame.h -// Purpose: wxFrame class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.11.99 -// RCS-ID: $Id: frame.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FRAME_H_BASE_ -#define _WX_FRAME_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/toplevel.h" // the base class - -// the default names for various classs -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxStatusBar; -class WXDLLIMPEXP_FWD_CORE wxToolBar; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxFrame-specific (i.e. not for wxDialog) styles -#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) -#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu -#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent -#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped - -// ---------------------------------------------------------------------------- -// wxFrame is a top-level window with optional menubar, statusbar and toolbar -// -// For each of *bars, a frame may have several of them, but only one is -// managed by the frame, i.e. resized/moved when the frame is and whose size -// is accounted for in client size calculations - all others should be taken -// care of manually. The CreateXXXBar() functions create this, main, XXXBar, -// but the actual creation is done in OnCreateXXXBar() functions which may be -// overridden to create custom objects instead of standard ones when -// CreateXXXBar() is called. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow -{ -public: - // construction - wxFrameBase(); - virtual ~wxFrameBase(); - - wxFrame *New(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // frame state - // ----------- - - // get the origin of the client area (which may be different from (0, 0) - // if the frame has a toolbar) in client coordinates - virtual wxPoint GetClientAreaOrigin() const; - - // sends a size event to the window using its current size -- this has an - // effect of refreshing the window layout - virtual void SendSizeEvent(); - - // menu bar functions - // ------------------ - -#if wxUSE_MENUS - virtual void SetMenuBar(wxMenuBar *menubar); - virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } -#endif // wxUSE_MENUS - - // process menu command: returns true if processed - bool ProcessCommand(int winid); - - // status bar functions - // -------------------- -#if wxUSE_STATUSBAR - // create the main status bar by calling OnCreateStatusBar() - virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE, - wxWindowID winid = 0, - const wxString& name = - wxStatusLineNameStr); - // return a new status bar - virtual wxStatusBar *OnCreateStatusBar(int number, - long style, - wxWindowID winid, - const wxString& name); - // get the main status bar - virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } - - // sets the main status bar - virtual void SetStatusBar(wxStatusBar *statBar); - - // forward these to status bar - virtual void SetStatusText(const wxString &text, int number = 0); - virtual void SetStatusWidths(int n, const int widths_field[]); - void PushStatusText(const wxString &text, int number = 0); - void PopStatusText(int number = 0); - - // set the status bar pane the help will be shown in - void SetStatusBarPane(int n) { m_statusBarPane = n; } - int GetStatusBarPane() const { return m_statusBarPane; } -#endif // wxUSE_STATUSBAR - - // toolbar functions - // ----------------- - -#if wxUSE_TOOLBAR - // create main toolbar bycalling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // return a new toolbar - virtual wxToolBar *OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name ); - - // get/set the main toolbar - virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } - virtual void SetToolBar(wxToolBar *toolbar); -#endif // wxUSE_TOOLBAR - - // implementation only from now on - // ------------------------------- - - // event handlers -#if wxUSE_MENUS -#if wxUSE_STATUSBAR - void OnMenuOpen(wxMenuEvent& event); - void OnMenuClose(wxMenuEvent& event); - void OnMenuHighlight(wxMenuEvent& event); -#endif // wxUSE_STATUSBAR - - // send wxUpdateUIEvents for all menu items in the menubar, - // or just for menu if non-NULL - virtual void DoMenuUpdates(wxMenu* menu = NULL); -#endif // wxUSE_MENUS - - // do the UI update processing for this window - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); - - // Implement internal behaviour (menu updating on some platforms) - virtual void OnInternalIdle(); - - // if there is no real wxTopLevelWindow on this platform we have to define - // some wxTopLevelWindowBase pure virtual functions here to avoid breaking - // old ports (wxMotif) which don't define them in wxFrame -#ifndef wxTopLevelWindowNative - virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style) = wxFULLSCREEN_ALL) - { return false; } - virtual bool IsFullScreen() const - { return false; } -#endif // no wxTopLevelWindowNative - -#if wxUSE_MENUS || wxUSE_TOOLBAR - // show help text (typically in the statusbar); show is false - // if you are hiding the help, true otherwise - virtual void DoGiveHelp(const wxString& text, bool show); -#endif - -protected: - // the frame main menu/status/tool bars - // ------------------------------------ - - // this (non virtual!) function should be called from dtor to delete the - // main menubar, statusbar and toolbar (if any) - void DeleteAllBars(); - - // test whether this window makes part of the frame - virtual bool IsOneOfBars(const wxWindow *win) const; - -#if wxUSE_MENUS - // override to update menu bar position when the frame size changes - virtual void PositionMenuBar() { } - - // override to do something special when the menu bar is being removed - // from the frame - virtual void DetachMenuBar(); - - // override to do something special when the menu bar is attached to the - // frame - virtual void AttachMenuBar(wxMenuBar *menubar); - - wxMenuBar *m_frameMenuBar; -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) - // the saved status bar text overwritten by DoGiveHelp() - wxString m_oldStatusText; -#endif - -#if wxUSE_STATUSBAR - // override to update status bar position (or anything else) when - // something changes - virtual void PositionStatusBar() { } - - // show the help string for this menu item in the given status bar: the - // status bar pointer can be NULL; return true if help was shown - bool ShowMenuHelp(wxStatusBar *statbar, int helpid); - - wxStatusBar *m_frameStatusBar; -#endif // wxUSE_STATUSBAR - - - int m_statusBarPane; - -#if wxUSE_TOOLBAR - // override to update status bar position (or anything else) when - // something changes - virtual void PositionToolBar() { } - - wxToolBar *m_frameToolBar; -#endif // wxUSE_TOOLBAR - -#if wxUSE_MENUS && wxUSE_STATUSBAR - DECLARE_EVENT_TABLE() -#endif // wxUSE_MENUS && wxUSE_STATUSBAR - - DECLARE_NO_COPY_CLASS(wxFrameBase) -}; - -// include the real class declaration -#if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) - #include "wx/univ/frame.h" -#else // !__WXUNIVERSAL__ - #if defined(__WXPALMOS__) - #include "wx/palmos/frame.h" - #elif defined(__WXMSW__) - #include "wx/msw/frame.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/frame.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/frame.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/frame.h" - #elif defined(__WXMAC__) - #include "wx/mac/frame.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/frame.h" - #elif defined(__WXPM__) - #include "wx/os2/frame.h" - #endif -#endif - -#endif - // _WX_FRAME_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/fs_arc.h b/Source/3rdParty/wx/include/wx/fs_arc.h deleted file mode 100644 index 02afd0746..000000000 --- a/Source/3rdParty/wx/include/wx/fs_arc.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_arc.h -// Purpose: Archive file system -// Author: Vaclav Slavik, Mike Wetherell -// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_arc.h 42713 2006-10-30 11:56:12Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_ARC_H_ -#define _WX_FS_ARC_H_ - -#include "wx/defs.h" - -#if wxUSE_FS_ARCHIVE - -#include "wx/filesys.h" -#include "wx/hashmap.h" - -WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap); - -//--------------------------------------------------------------------------- -// wxArchiveFSHandler -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler -{ -public: - wxArchiveFSHandler(); - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - void Cleanup(); - virtual ~wxArchiveFSHandler(); - -private: - class wxArchiveFSCache *m_cache; - wxFileSystem m_fs; - - // these vars are used by FindFirst/Next: - class wxArchiveFSCacheData *m_Archive; - struct wxArchiveFSEntry *m_FindEntry; - wxString m_Pattern, m_BaseDir, m_ZipFile; - bool m_AllowDirs, m_AllowFiles; - wxArchiveFilenameHashMap *m_DirsFound; - - wxString DoFind(); - - DECLARE_NO_COPY_CLASS(wxArchiveFSHandler) - DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) -}; - -#endif // wxUSE_FS_ARCHIVE - -#endif // _WX_FS_ARC_H_ diff --git a/Source/3rdParty/wx/include/wx/fs_filter.h b/Source/3rdParty/wx/include/wx/fs_filter.h deleted file mode 100644 index 1eb014510..000000000 --- a/Source/3rdParty/wx/include/wx/fs_filter.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_filter.h -// Purpose: Filter file system handler -// Author: Mike Wetherell -// Copyright: (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_filter.h 42713 2006-10-30 11:56:12Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_FILTER_H_ -#define _WX_FS_FILTER_H_ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/filesys.h" - -//--------------------------------------------------------------------------- -// wxFilterFSHandler -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler -{ -public: - wxFilterFSHandler() : wxFileSystemHandler() { } - virtual ~wxFilterFSHandler() { } - - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -private: - DECLARE_NO_COPY_CLASS(wxFilterFSHandler) -}; - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FS_FILTER_H_ diff --git a/Source/3rdParty/wx/include/wx/fs_mem.h b/Source/3rdParty/wx/include/wx/fs_mem.h deleted file mode 100644 index e4d6737d7..000000000 --- a/Source/3rdParty/wx/include/wx/fs_mem.h +++ /dev/null @@ -1,127 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: fs_mem.h -// Purpose: in-memory file system -// Author: Vaclav Slavik -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_MEM_H_ -#define _WX_FS_MEM_H_ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/filesys.h" - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxBitmap; - class WXDLLIMPEXP_FWD_CORE wxImage; -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxMemoryFSHandlerBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler -{ -public: - wxMemoryFSHandlerBase(); - virtual ~wxMemoryFSHandlerBase(); - - // Add file to list of files stored in memory. Stored data (bitmap, text or - // raw data) will be copied into private memory stream and available under - // name "memory:" + filename - static void AddFile(const wxString& filename, const wxString& textdata); - static void AddFile(const wxString& filename, const void *binarydata, size_t size); -#if wxABI_VERSION >= 20805 - static void AddFileWithMimeType(const wxString& filename, - const wxString& textdata, - const wxString& mimetype); - static void AddFileWithMimeType(const wxString& filename, - const void *binarydata, size_t size, - const wxString& mimetype); -#endif // wxABI_VERSION >= 20805 - - // Remove file from memory FS and free occupied memory - static void RemoveFile(const wxString& filename); - - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -protected: - static bool CheckHash(const wxString& filename); - static wxHashTable *m_Hash; -}; - -// ---------------------------------------------------------------------------- -// wxMemoryFSHandler -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -// add GUI-only operations to the base class -class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase -{ -public: - // bring the base class versions into the scope, otherwise they would be - // inaccessible in wxMemoryFSHandler - // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...) - static void AddFile(const wxString& filename, const wxString& textdata) - { - wxMemoryFSHandlerBase::AddFile(filename, textdata); - } - - static void AddFile(const wxString& filename, - const void *binarydata, - size_t size) - { - wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); - } -#if wxABI_VERSION >= 20805 - static void AddFileWithMimeType(const wxString& filename, - const wxString& textdata, - const wxString& mimetype) - { - wxMemoryFSHandlerBase::AddFileWithMimeType(filename, - textdata, - mimetype); - } - static void AddFileWithMimeType(const wxString& filename, - const void *binarydata, size_t size, - const wxString& mimetype) - { - wxMemoryFSHandlerBase::AddFileWithMimeType(filename, - binarydata, size, - mimetype); - } -#endif // wxABI_VERSION >= 20805 - -#if wxUSE_IMAGE - static void AddFile(const wxString& filename, - const wxImage& image, - long type); - - static void AddFile(const wxString& filename, - const wxBitmap& bitmap, - long type); -#endif // wxUSE_IMAGE - -}; - -#else // !wxUSE_GUI - -// just the same thing as the base class in wxBase -class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase -{ -}; - -#endif // wxUSE_GUI/!wxUSE_GUI - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FS_MEM_H_ - diff --git a/Source/3rdParty/wx/include/wx/gauge.h b/Source/3rdParty/wx/include/wx/gauge.h deleted file mode 100644 index a6246ca42..000000000 --- a/Source/3rdParty/wx/include/wx/gauge.h +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/gauge.h -// Purpose: wxGauge interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.02.01 -// RCS-ID: $Id: gauge.h 41089 2006-09-09 13:36:54Z RR $ -// Copyright: (c) 1996-2001 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GAUGE_H_BASE_ -#define _WX_GAUGE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_GAUGE - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxGauge style flags -// ---------------------------------------------------------------------------- - -#define wxGA_HORIZONTAL wxHORIZONTAL -#define wxGA_VERTICAL wxVERTICAL - -// Win32 only, is default (and only) on some other platforms -#define wxGA_SMOOTH 0x0020 - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete style - #define wxGA_PROGRESSBAR 0 -#endif // WXWIN_COMPATIBILITY_2_6 - -// GTK and Mac always have native implementation of the indeterminate mode -// wxMSW has native implementation only if comctl32.dll >= 6.00 -#if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__) - #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 -#else - #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 -#endif - -extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; - -// ---------------------------------------------------------------------------- -// wxGauge: a progress bar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGaugeBase : public wxControl -{ -public: - wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } - virtual ~wxGaugeBase(); - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // determinate mode API - - // set/get the control range - virtual void SetRange(int range); - virtual int GetRange() const; - - virtual void SetValue(int pos); - virtual int GetValue() const; - - // indeterminate mode API - virtual void Pulse(); - - // simple accessors - bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } - - // appearance params (not implemented for most ports) - virtual void SetShadowWidth(int w); - virtual int GetShadowWidth() const; - - virtual void SetBezelFace(int w); - virtual int GetBezelFace() const; - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - -protected: - // the max position - int m_rangeMax; - - // the current position - int m_gaugePos; - -#if wxGAUGE_EMULATE_INDETERMINATE_MODE - int m_nDirection; // can be wxRIGHT or wxLEFT -#endif - - DECLARE_NO_COPY_CLASS(wxGaugeBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/gauge.h" -#elif defined(__WXMSW__) - #include "wx/msw/gauge95.h" - #define wxGauge wxGauge95 -#elif defined(__WXMOTIF__) - #include "wx/motif/gauge.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/gauge.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/gauge.h" -#elif defined(__WXMAC__) - #include "wx/mac/gauge.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/gauge.h" -#elif defined(__WXPM__) - #include "wx/os2/gauge.h" -#endif - -#endif // wxUSE_GAUGE - -#endif - // _WX_GAUGE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/gbsizer.h b/Source/3rdParty/wx/include/wx/gbsizer.h deleted file mode 100644 index dd2f31bec..000000000 --- a/Source/3rdParty/wx/include/wx/gbsizer.h +++ /dev/null @@ -1,303 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: gbsizer.h -// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, -// with items at specified cells, and with the option of row -// and/or column spanning -// -// Author: Robin Dunn -// Created: 03-Nov-2003 -// RCS-ID: $Id: gbsizer.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Robin Dunn -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXGBSIZER_H__ -#define __WXGBSIZER_H__ - -#include "wx/sizer.h" - - -//--------------------------------------------------------------------------- -// Classes to represent a position in the grid and a size of an item in the -// grid, IOW, the number of rows and columns it occupies. I chose to use these -// instead of wxPoint and wxSize because they are (x,y) and usually pixel -// oriented while grids and tables are usually thought of as (row,col) so some -// confusion would definitely result in using wxPoint... -// -// NOTE: This should probably be refactored to a common RowCol data type which -// is used for this and also for wxGridCellCoords. -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxGBPosition -{ -public: - wxGBPosition() : m_row(0), m_col(0) {} - wxGBPosition(int row, int col) : m_row(row), m_col(col) {} - - // default copy ctor and assignment operator are okay. - - int GetRow() const { return m_row; } - int GetCol() const { return m_col; } - void SetRow(int row) { m_row = row; } - void SetCol(int col) { m_col = col; } - - bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } - bool operator!=(const wxGBPosition& p) const { return !(*this == p); } - -private: - int m_row; - int m_col; -}; - - -class WXDLLEXPORT wxGBSpan -{ -public: - wxGBSpan() : m_rowspan(1), m_colspan(1) {} - wxGBSpan(int rowspan, int colspan) : m_rowspan(rowspan), m_colspan(colspan) {} - - // default copy ctor and assignment operator are okay. - - int GetRowspan() const { return m_rowspan; } - int GetColspan() const { return m_colspan; } - void SetRowspan(int rowspan) { m_rowspan = rowspan; } - void SetColspan(int colspan) { m_colspan = colspan; } - - bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } - bool operator!=(const wxGBSpan& o) const { return !(*this == o); } - -private: - int m_rowspan; - int m_colspan; -}; - - -extern WXDLLEXPORT_DATA(const wxGBSpan) wxDefaultSpan; - - -//--------------------------------------------------------------------------- -// wxGBSizerItem -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; - - -class WXDLLEXPORT wxGBSizerItem : public wxSizerItem -{ -public: - // spacer - wxGBSizerItem( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData); - - // window - wxGBSizerItem( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); - - // subsizer - wxGBSizerItem( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); - - // default ctor - wxGBSizerItem(); - - - // Get the grid position of the item - wxGBPosition GetPos() const { return m_pos; } - void GetPos(int& row, int& col) const; - - // Get the row and column spanning of the item - wxGBSpan GetSpan() const { return m_span; } - void GetSpan(int& rowspan, int& colspan) const; - - // If the item is already a member of a sizer then first ensure that there - // is no other item that would intersect with this one at the new - // position, then set the new position. Returns true if the change is - // successful and after the next Layout the item will be moved. - bool SetPos( const wxGBPosition& pos ); - - // If the item is already a member of a sizer then first ensure that there - // is no other item that would intersect with this one with its new - // spanning size, then set the new spanning. Returns true if the change - // is successful and after the next Layout the item will be resized. - bool SetSpan( const wxGBSpan& span ); - - // Returns true if this item and the other item instersect - bool Intersects(const wxGBSizerItem& other); - - // Returns true if the given pos/span would intersect with this item. - bool Intersects(const wxGBPosition& pos, const wxGBSpan& span); - - // Get the row and column of the endpoint of this item - void GetEndPos(int& row, int& col); - - - wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } - void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } - - -protected: - wxGBPosition m_pos; - wxGBSpan m_span; - wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects - - -private: - DECLARE_DYNAMIC_CLASS(wxGBSizerItem) - DECLARE_NO_COPY_CLASS(wxGBSizerItem) -}; - - -//--------------------------------------------------------------------------- -// wxGridBagSizer -//--------------------------------------------------------------------------- - - -class WXDLLEXPORT wxGridBagSizer : public wxFlexGridSizer -{ -public: - wxGridBagSizer(int vgap = 0, int hgap = 0 ); - - // The Add methods return true if the item was successfully placed at the - // given position, false if something was already there. - wxSizerItem* Add( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( wxGBSizerItem *item ); - - - // Get/Set the size used for cells in the grid with no item. - wxSize GetEmptyCellSize() const { return m_emptyCellSize; } - void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; } - - // Get the size of the specified cell, including hgap and vgap. Only - // valid after a Layout. - wxSize GetCellSize(int row, int col) const; - - // Get the grid position of the specified item (non-recursive) - wxGBPosition GetItemPosition(wxWindow *window); - wxGBPosition GetItemPosition(wxSizer *sizer); - wxGBPosition GetItemPosition(size_t index); - - // Set the grid position of the specified item. Returns true on success. - // If the move is not allowed (because an item is already there) then - // false is returned. (non-recursive) - bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); - bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); - bool SetItemPosition(size_t index, const wxGBPosition& pos); - - // Get the row/col spanning of the specified item (non-recursive) - wxGBSpan GetItemSpan(wxWindow *window); - wxGBSpan GetItemSpan(wxSizer *sizer); - wxGBSpan GetItemSpan(size_t index); - - // Set the row/col spanning of the specified item. Returns true on - // success. If the move is not allowed (because an item is already there) - // then false is returned. (non-recursive) - bool SetItemSpan(wxWindow *window, const wxGBSpan& span); - bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); - bool SetItemSpan(size_t index, const wxGBSpan& span); - - - // Find the sizer item for the given window or subsizer, returns NULL if - // not found. (non-recursive) - wxGBSizerItem* FindItem(wxWindow* window); - wxGBSizerItem* FindItem(wxSizer* sizer); - - - // Return the sizer item for the given grid cell, or NULL if there is no - // item at that position. (non-recursive) - wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); - - - // Return the sizer item located at the point given in pt, or NULL if - // there is no item at that point. The (x,y) coordinates in pt correspond - // to the client coordinates of the window using the sizer for - // layout. (non-recursive) - wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); - - - // Return the sizer item that has a matching user data (it only compares - // pointer values) or NULL if not found. (non-recursive) - wxGBSizerItem* FindItemWithData(const wxObject* userData); - - - // These are what make the sizer do size calculations and layout - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - - - // Look at all items and see if any intersect (or would overlap) the given - // item. Returns true if so, false if there would be no overlap. If an - // excludeItem is given then it will not be checked for intersection, for - // example it may be the item we are checking the position of. - bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); - bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); - - - // The Add base class virtuals should not be used with this class, but - // we'll try to make them automatically select a location for the item - // anyway. - virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - - // The Insert and Prepend base class virtuals that are not appropriate for - // this class and should not be used. Their implementation in this class - // simply fails. - virtual wxSizerItem* Add( wxSizerItem *item ); - virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); - virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( wxSizerItem *item ); - - -protected: - wxGBPosition FindEmptyCell(); -#if wxABI_VERSION >= 20808 - void AdjustForOverflow(); -#endif - - wxSize m_emptyCellSize; - - -private: - - DECLARE_CLASS(wxGridBagSizer) - DECLARE_NO_COPY_CLASS(wxGridBagSizer) -}; - -//--------------------------------------------------------------------------- -#endif diff --git a/Source/3rdParty/wx/include/wx/gdicmn.h b/Source/3rdParty/wx/include/wx/gdicmn.h deleted file mode 100644 index 2b9e71b05..000000000 --- a/Source/3rdParty/wx/include/wx/gdicmn.h +++ /dev/null @@ -1,755 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gdicmn.h -// Purpose: Common GDI classes, types and declarations -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: gdicmn.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GDICMNH__ -#define _WX_GDICMNH__ - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/list.h" -#include "wx/string.h" -#include "wx/fontenc.h" -#include "wx/hashmap.h" -#include "wx/math.h" - -// --------------------------------------------------------------------------- -// forward declarations -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBrush; -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxPalette; -class WXDLLIMPEXP_FWD_CORE wxPen; -class WXDLLIMPEXP_FWD_CORE wxRegion; -class WXDLLIMPEXP_FWD_BASE wxString; - -// --------------------------------------------------------------------------- -// constants -// --------------------------------------------------------------------------- - -// Bitmap flags -enum wxBitmapType -{ - wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! - wxBITMAP_TYPE_BMP, - wxBITMAP_TYPE_BMP_RESOURCE, - wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, - wxBITMAP_TYPE_ICO, - wxBITMAP_TYPE_ICO_RESOURCE, - wxBITMAP_TYPE_CUR, - wxBITMAP_TYPE_CUR_RESOURCE, - wxBITMAP_TYPE_XBM, - wxBITMAP_TYPE_XBM_DATA, - wxBITMAP_TYPE_XPM, - wxBITMAP_TYPE_XPM_DATA, - wxBITMAP_TYPE_TIF, - wxBITMAP_TYPE_TIF_RESOURCE, - wxBITMAP_TYPE_GIF, - wxBITMAP_TYPE_GIF_RESOURCE, - wxBITMAP_TYPE_PNG, - wxBITMAP_TYPE_PNG_RESOURCE, - wxBITMAP_TYPE_JPEG, - wxBITMAP_TYPE_JPEG_RESOURCE, - wxBITMAP_TYPE_PNM, - wxBITMAP_TYPE_PNM_RESOURCE, - wxBITMAP_TYPE_PCX, - wxBITMAP_TYPE_PCX_RESOURCE, - wxBITMAP_TYPE_PICT, - wxBITMAP_TYPE_PICT_RESOURCE, - wxBITMAP_TYPE_ICON, - wxBITMAP_TYPE_ICON_RESOURCE, - wxBITMAP_TYPE_ANI, - wxBITMAP_TYPE_IFF, - wxBITMAP_TYPE_TGA, - wxBITMAP_TYPE_MACCURSOR, - wxBITMAP_TYPE_MACCURSOR_RESOURCE, - wxBITMAP_TYPE_ANY = 50 -}; - -// Standard cursors -enum wxStockCursor -{ - wxCURSOR_NONE, // should be 0 - wxCURSOR_ARROW, - wxCURSOR_RIGHT_ARROW, - wxCURSOR_BULLSEYE, - wxCURSOR_CHAR, - wxCURSOR_CROSS, - wxCURSOR_HAND, - wxCURSOR_IBEAM, - wxCURSOR_LEFT_BUTTON, - wxCURSOR_MAGNIFIER, - wxCURSOR_MIDDLE_BUTTON, - wxCURSOR_NO_ENTRY, - wxCURSOR_PAINT_BRUSH, - wxCURSOR_PENCIL, - wxCURSOR_POINT_LEFT, - wxCURSOR_POINT_RIGHT, - wxCURSOR_QUESTION_ARROW, - wxCURSOR_RIGHT_BUTTON, - wxCURSOR_SIZENESW, - wxCURSOR_SIZENS, - wxCURSOR_SIZENWSE, - wxCURSOR_SIZEWE, - wxCURSOR_SIZING, - wxCURSOR_SPRAYCAN, - wxCURSOR_WAIT, - wxCURSOR_WATCH, - wxCURSOR_BLANK, -#ifdef __WXGTK__ - wxCURSOR_DEFAULT, // standard X11 cursor -#endif -#ifdef __WXMAC__ - wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow -#endif -#ifdef __X__ - // Not yet implemented for Windows - wxCURSOR_CROSS_REVERSE, - wxCURSOR_DOUBLE_ARROW, - wxCURSOR_BASED_ARROW_UP, - wxCURSOR_BASED_ARROW_DOWN, -#endif // X11 - - wxCURSOR_ARROWWAIT, - - wxCURSOR_MAX -}; - -#ifndef __WXGTK__ - #define wxCURSOR_DEFAULT wxCURSOR_ARROW -#endif - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -/* Useful macro for creating icons portably, for example: - - wxIcon *icon = new wxICON(mondrian); - - expands into: - - wxIcon *icon = new wxIcon("mondrian"); // On wxMSW - wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK - */ - -#ifdef __WXMSW__ - // Load from a resource - #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXPM__) - // Load from a resource - #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXMGL__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXDFB__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXGTK__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXMAC__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXMOTIF__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) -#elif defined(__WXX11__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) -#else - // This will usually mean something on any platform - #define wxICON(X) wxIcon(wxT(#X)) -#endif // platform - -/* Another macro: this one is for portable creation of bitmaps. We assume that - under Unix bitmaps live in XPMs and under Windows they're in ressources. - */ - -#if defined(__WXMSW__) || defined(__WXPM__) - #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) -#elif defined(__WXGTK__) || \ - defined(__WXMOTIF__) || \ - defined(__WXX11__) || \ - defined(__WXMAC__) || \ - defined(__WXMGL__) || \ - defined(__WXDFB__) || \ - defined(__WXCOCOA__) - // Initialize from an included XPM - #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) -#else // other platforms - #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) -#endif // platform - -// =========================================================================== -// classes -// =========================================================================== - -// --------------------------------------------------------------------------- -// wxSize -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxSize -{ -public: - // members are public for compatibility, don't use them directly. - int x, y; - - // constructors - wxSize() : x(0), y(0) { } - wxSize(int xx, int yy) : x(xx), y(yy) { } - - // no copy ctor or assignment operator - the defaults are ok - - bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } - bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } - - wxSize operator+(const wxSize& sz) const { return wxSize(x + sz.x, y + sz.y); } - wxSize operator-(const wxSize& sz) const { return wxSize(x - sz.x, y - sz.y); } - wxSize operator/(int i) const { return wxSize(x / i, y / i); } - wxSize operator*(int i) const { return wxSize(x * i, y * i); } - - wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } - wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } - wxSize& operator/=(const int i) { x /= i; y /= i; return *this; } - wxSize& operator*=(const int i) { x *= i; y *= i; return *this; } - - void IncTo(const wxSize& sz) - { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } - void DecTo(const wxSize& sz) - { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } - - void IncBy(int dx, int dy) { x += dx; y += dy; } - void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } - void IncBy(int d) { IncBy(d, d); } - - void DecBy(int dx, int dy) { IncBy(-dx, -dy); } - void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } - void DecBy(int d) { DecBy(d, d); } - - - wxSize& Scale(float xscale, float yscale) - { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } - - // accessors - void Set(int xx, int yy) { x = xx; y = yy; } - void SetWidth(int w) { x = w; } - void SetHeight(int h) { y = h; } - - int GetWidth() const { return x; } - int GetHeight() const { return y; } - - bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } - - // combine this size with the other one replacing the default (i.e. equal - // to wxDefaultCoord) components of this object with those of the other - void SetDefaults(const wxSize& size) - { - if ( x == wxDefaultCoord ) - x = size.x; - if ( y == wxDefaultCoord ) - y = size.y; - } - - // compatibility - int GetX() const { return x; } - int GetY() const { return y; } -}; - -// --------------------------------------------------------------------------- -// Point classes: with real or integer coordinates -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxRealPoint -{ -public: - double x; - double y; - - wxRealPoint() : x(0.0), y(0.0) { } - wxRealPoint(double xx, double yy) : x(xx), y(yy) { } - - wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } - wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } - - bool operator==(const wxRealPoint& pt) const - { - return wxIsSameDouble(x, pt.x) && wxIsSameDouble(y, pt.y); - } - bool operator!=(const wxRealPoint& pt) const { return !(*this == pt); } -}; - - -class WXDLLEXPORT wxPoint -{ -public: - int x, y; - - wxPoint() : x(0), y(0) { } - wxPoint(int xx, int yy) : x(xx), y(yy) { } - - // no copy ctor or assignment operator - the defaults are ok - - // comparison - bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } - bool operator!=(const wxPoint& p) const { return !(*this == p); } - - // arithmetic operations (component wise) - wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } - wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } - - wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } - wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } - - wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } - wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } - - wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } - wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } - - wxPoint operator-() const { return wxPoint(-x, -y); } -}; - -// --------------------------------------------------------------------------- -// wxRect -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxRect -{ -public: - wxRect() - : x(0), y(0), width(0), height(0) - { } - wxRect(int xx, int yy, int ww, int hh) - : x(xx), y(yy), width(ww), height(hh) - { } - wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRect(const wxPoint& pt, const wxSize& size) - : x(pt.x), y(pt.y), width(size.x), height(size.y) - { } - wxRect(const wxSize& size) - : x(0), y(0), width(size.x), height(size.y) - { } - - // default copy ctor and assignment operators ok - - int GetX() const { return x; } - void SetX(int xx) { x = xx; } - - int GetY() const { return y; } - void SetY(int yy) { y = yy; } - - int GetWidth() const { return width; } - void SetWidth(int w) { width = w; } - - int GetHeight() const { return height; } - void SetHeight(int h) { height = h; } - - wxPoint GetPosition() const { return wxPoint(x, y); } - void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } - - wxSize GetSize() const { return wxSize(width, height); } - void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } - - bool IsEmpty() const { return (width <= 0) || (height <= 0); } - - int GetLeft() const { return x; } - int GetTop() const { return y; } - int GetBottom() const { return y + height - 1; } - int GetRight() const { return x + width - 1; } - - void SetLeft(int left) { x = left; } - void SetRight(int right) { width = right - x + 1; } - void SetTop(int top) { y = top; } - void SetBottom(int bottom) { height = bottom - y + 1; } - - wxPoint GetTopLeft() const { return GetPosition(); } - wxPoint GetLeftTop() const { return GetTopLeft(); } - void SetTopLeft(const wxPoint &p) { SetPosition(p); } - void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } - - wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } - wxPoint GetRightBottom() const { return GetBottomRight(); } - void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } - void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } - - wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } - wxPoint GetRightTop() const { return GetTopRight(); } - void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } - void SetRightTop(const wxPoint &p) { SetTopLeft(p); } - - wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } - wxPoint GetLeftBottom() const { return GetBottomLeft(); } - void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } - void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } - - // operations with rect - wxRect& Inflate(wxCoord dx, wxCoord dy); - wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } - wxRect& Inflate(wxCoord d) { return Inflate(d, d); } - wxRect Inflate(wxCoord dx, wxCoord dy) const - { - wxRect r = *this; - r.Inflate(dx, dy); - return r; - } - - wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } - wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } - wxRect& Deflate(wxCoord d) { return Inflate(-d); } - wxRect Deflate(wxCoord dx, wxCoord dy) const - { - wxRect r = *this; - r.Deflate(dx, dy); - return r; - } - - void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } - void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } - - wxRect& Intersect(const wxRect& rect); - wxRect Intersect(const wxRect& rect) const - { - wxRect r = *this; - r.Intersect(rect); - return r; - } - - wxRect& Union(const wxRect& rect); - wxRect Union(const wxRect& rect) const - { - wxRect r = *this; - r.Union(rect); - return r; - } - - // compare rectangles - bool operator==(const wxRect& rect) const; - bool operator!=(const wxRect& rect) const { return !(*this == rect); } - - // return true if the point is (not strcitly) inside the rect - bool Contains(int x, int y) const; - bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } - // return true if the rectangle is (not strcitly) inside the rect - bool Contains(const wxRect& rect) const; - -#if WXWIN_COMPATIBILITY_2_6 - // use Contains() instead - wxDEPRECATED( bool Inside(int x, int y) const ); - wxDEPRECATED( bool Inside(const wxPoint& pt) const ); - wxDEPRECATED( bool Inside(const wxRect& rect) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // return true if the rectangles have a non empty intersection - bool Intersects(const wxRect& rect) const; - - - // these are like Union() but don't ignore empty rectangles - wxRect operator+(const wxRect& rect) const; - wxRect& operator+=(const wxRect& rect) - { - *this = *this + rect; - return *this; - } - - - // centre this rectangle in the given (usually, but not necessarily, - // larger) one - wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const - { - return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, - dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, - width, height); - } - - wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const - { - return CentreIn(r, dir); - } - -public: - int x, y, width, height; -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } -inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } -inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } -#endif // WXWIN_COMPATIBILITY_2_6 - - -// --------------------------------------------------------------------------- -// Management of pens, brushes and fonts -// --------------------------------------------------------------------------- - -typedef wxInt8 wxDash; - -class WXDLLIMPEXP_CORE wxGDIObjListBase { -public: - wxGDIObjListBase(); - ~wxGDIObjListBase(); - -protected: - wxList list; -}; - -class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase -{ -public: - wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddPen(wxPen*) ); - wxDEPRECATED( void RemovePen(wxPen*) ); -#endif -}; - -class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase -{ -public: - wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddBrush(wxBrush*) ); - wxDEPRECATED( void RemoveBrush(wxBrush*) ); -#endif -}; - -class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase -{ -public: - wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, - bool underline = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddFont(wxFont*) ); - wxDEPRECATED( void RemoveFont(wxFont*) ); -#endif -}; - -WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); - -class WXDLLEXPORT wxColourDatabase -{ -public: - wxColourDatabase(); - ~wxColourDatabase(); - - // find colour by name or name for the given colour - wxColour Find(const wxString& name) const; - wxString FindName(const wxColour& colour) const; - - // add a new colour to the database - void AddColour(const wxString& name, const wxColour& colour); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use Find() instead - wxDEPRECATED( wxColour *FindColour(const wxString& name) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - -#ifdef __WXPM__ - // PM keeps its own type of colour table - long* m_palTable; - size_t m_nSize; -#endif - -private: - // load the database with the built in colour values when called for the - // first time, do nothing after this - void Initialize(); - - wxStringToColourHashMap *m_map; -}; - -class WXDLLEXPORT wxResourceCache: public wxList -{ -public: - wxResourceCache() { } -#if !wxUSE_STL - wxResourceCache(const unsigned int keyType) : wxList(keyType) { } -#endif - virtual ~wxResourceCache(); -}; - -// --------------------------------------------------------------------------- -// global variables -// --------------------------------------------------------------------------- - -// Lists of GDI objects -extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList; -extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList; -extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList; - -/* Stock objects - - wxStockGDI creates the stock GDI objects on demand. Pointers to the - created objects are stored in the ms_stockObject array, which is indexed - by the Item enum values. Platorm-specific fonts can be created by - implementing a derived class with an override for the GetFont function. - wxStockGDI operates as a singleton, accessed through the ms_instance - pointer. By default this pointer is set to an instance of wxStockGDI. - A derived class must arrange to set this pointer to an instance of itself. -*/ -class WXDLLIMPEXP_CORE wxStockGDI -{ -public: - enum Item { - BRUSH_BLACK, - BRUSH_BLUE, - BRUSH_CYAN, - BRUSH_GREEN, - BRUSH_GREY, - BRUSH_LIGHTGREY, - BRUSH_MEDIUMGREY, - BRUSH_RED, - BRUSH_TRANSPARENT, - BRUSH_WHITE, - COLOUR_BLACK, - COLOUR_BLUE, - COLOUR_CYAN, - COLOUR_GREEN, - COLOUR_LIGHTGREY, - COLOUR_RED, - COLOUR_WHITE, - CURSOR_CROSS, - CURSOR_HOURGLASS, - CURSOR_STANDARD, - FONT_ITALIC, - FONT_NORMAL, - FONT_SMALL, - FONT_SWISS, - PEN_BLACK, - PEN_BLACKDASHED, - PEN_CYAN, - PEN_GREEN, - PEN_GREY, - PEN_LIGHTGREY, - PEN_MEDIUMGREY, - PEN_RED, - PEN_TRANSPARENT, - PEN_WHITE, - ITEMCOUNT - }; - - wxStockGDI(); - virtual ~wxStockGDI(); - static void DeleteAll(); - - static wxStockGDI& instance() { return *ms_instance; } - - static const wxBrush* GetBrush(Item item); - static const wxColour* GetColour(Item item); - static const wxCursor* GetCursor(Item item); - // Can be overridden by platform-specific derived classes - virtual const wxFont* GetFont(Item item); - static const wxPen* GetPen(Item item); - -protected: - static wxStockGDI* ms_instance; - - static wxObject* ms_stockObject[ITEMCOUNT]; - - DECLARE_NO_COPY_CLASS(wxStockGDI) -}; - -#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) -#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) -#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) -#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) - -#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) -#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) -#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) -#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) -#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) -#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) -#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) -#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) -#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) -#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) - -#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) -#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) -#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) -#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) -#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) -#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) -#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) -#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) -#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) -#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) - -#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) -#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) -#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) -#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) -#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) -#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) -#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) - -#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) -#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) -#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) - -// 'Null' objects -extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap; -extern WXDLLEXPORT_DATA(wxIcon) wxNullIcon; -extern WXDLLEXPORT_DATA(wxCursor) wxNullCursor; -extern WXDLLEXPORT_DATA(wxPen) wxNullPen; -extern WXDLLEXPORT_DATA(wxBrush) wxNullBrush; -extern WXDLLEXPORT_DATA(wxPalette) wxNullPalette; -extern WXDLLEXPORT_DATA(wxFont) wxNullFont; -extern WXDLLEXPORT_DATA(wxColour) wxNullColour; - -extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase; - -extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; - -extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; -extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -// resource management -extern void WXDLLEXPORT wxInitializeStockLists(); -extern void WXDLLEXPORT wxDeleteStockLists(); - -// is the display colour (or monochrome)? -extern bool WXDLLEXPORT wxColourDisplay(); - -// Returns depth of screen -extern int WXDLLEXPORT wxDisplayDepth(); -#define wxGetDisplayDepth wxDisplayDepth - -// get the display size -extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); -extern wxSize WXDLLEXPORT wxGetDisplaySize(); -extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); -extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); - -// Get position and size of the display workarea -extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); -extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); - -// set global cursor -extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); - -#endif - // _WX_GDICMNH__ diff --git a/Source/3rdParty/wx/include/wx/gdiobj.h b/Source/3rdParty/wx/include/wx/gdiobj.h deleted file mode 100644 index b4dab2774..000000000 --- a/Source/3rdParty/wx/include/wx/gdiobj.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gdiobj.h -// Purpose: wxGDIObject base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: gdiobj.h 42211 2006-10-21 17:19:11Z SN $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GDIOBJ_H_BASE_ -#define _WX_GDIOBJ_H_BASE_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// wxGDIRefData is the base class for wxXXXData structures which contain the -// real data for the GDI object and are shared among all wxWin objects sharing -// the same native GDI object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { }; - -// ---------------------------------------------------------------------------- -// wxGDIObject -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGDIObject: public wxObject -{ -public: - bool IsNull() const { return m_refData == NULL; } - -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__) - // Creates the resource - virtual bool RealizeResource() { return false; } - - // Frees the resource - virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; } - - virtual bool IsFree() const { return false; } - - // Returns handle. - virtual WXHANDLE GetResourceHandle() const { return 0; } -#endif // defined(__WXMSW__) || defined(__WXPM__) - - DECLARE_DYNAMIC_CLASS(wxGDIObject) -}; - -#endif - // _WX_GDIOBJ_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/generic/busyinfo.h b/Source/3rdParty/wx/include/wx/generic/busyinfo.h deleted file mode 100644 index b8fdd4866..000000000 --- a/Source/3rdParty/wx/include/wx/generic/busyinfo.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/busyinfo.h -// Purpose: Information window (when app is busy) -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: busyinfo.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __BUSYINFO_H__ -#define __BUSYINFO_H__ - -#include "wx/defs.h" - -#if wxUSE_BUSYINFO - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -//-------------------------------------------------------------------------------- -// wxBusyInfo -// Displays progress information -// Can be used in exactly same way as wxBusyCursor -//-------------------------------------------------------------------------------- - -class WXDLLEXPORT wxBusyInfo : public wxObject -{ -public: - wxBusyInfo(const wxString& message, wxWindow *parent = NULL); - - virtual ~wxBusyInfo(); - -private: - wxFrame *m_InfoFrame; - - DECLARE_NO_COPY_CLASS(wxBusyInfo) -}; - - -#endif // wxUSE_BUSYINFO - -#endif // __BUSYINFO_H__ diff --git a/Source/3rdParty/wx/include/wx/generic/choicdgg.h b/Source/3rdParty/wx/include/wx/generic/choicdgg.h deleted file mode 100644 index ebefcd81b..000000000 --- a/Source/3rdParty/wx/include/wx/generic/choicdgg.h +++ /dev/null @@ -1,320 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/choicdgg.h -// Purpose: Generic choice dialogs -// Author: Julian Smart -// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions -// Created: 01/02/97 -// RCS-ID: $Id: choicdgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_CHOICDGG_H_ -#define _WX_GENERIC_CHOICDGG_H_ - -#include "wx/dynarray.h" -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxListBoxBase; - -// ---------------------------------------------------------------------------- -// some (ugly...) constants -// ---------------------------------------------------------------------------- - -#define wxCHOICE_HEIGHT 150 -#define wxCHOICE_WIDTH 200 - -#ifdef __WXWINCE__ -#define wxCHOICEDLG_STYLE \ - (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE) -#else -#define wxCHOICEDLG_STYLE \ - (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) -#endif - -// ---------------------------------------------------------------------------- -// wxAnyChoiceDialog: a base class for dialogs containing a listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAnyChoiceDialog : public wxDialog -{ -public: - wxAnyChoiceDialog() { } - - wxAnyChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB) - { - (void)Create(parent, message, caption, n, choices, - styleDlg, pos, styleLbox); - } - wxAnyChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB) - { - (void)Create(parent, message, caption, choices, - styleDlg, pos, styleLbox); - } - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB); - -protected: - wxListBoxBase *m_listbox; - - virtual wxListBoxBase *CreateList(int n, - const wxString *choices, - long styleLbox); - - DECLARE_NO_COPY_CLASS(wxAnyChoiceDialog) -}; - -// ---------------------------------------------------------------------------- -// wxSingleChoiceDialog: a dialog with single selection listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSingleChoiceDialog : public wxAnyChoiceDialog -{ -public: - wxSingleChoiceDialog() - { - m_selection = -1; - } - - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - void SetSelection(int sel); - int GetSelection() const { return m_selection; } - wxString GetStringSelection() const { return m_stringSelection; } - - // obsolete function (NB: no need to make it return wxChar, it's untyped) - char *GetSelectionClientData() const { return (char *)m_clientData; } - - // implementation from now on - void OnOK(wxCommandEvent& event); -#ifndef __SMARTPHONE__ - void OnListBoxDClick(wxCommandEvent& event); -#endif -#ifdef __WXWINCE__ - void OnJoystickButtonDown(wxJoystickEvent& event); -#endif - -protected: - int m_selection; - wxString m_stringSelection; - - void DoChoice(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxMultiChoiceDialog: a dialog with multi selection listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMultiChoiceDialog : public wxAnyChoiceDialog -{ -public: - wxMultiChoiceDialog() { } - - wxMultiChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - (void)Create(parent, message, caption, n, choices, style, pos); - } - wxMultiChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - (void)Create(parent, message, caption, choices, style, pos); - } - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - void SetSelections(const wxArrayInt& selections); - wxArrayInt GetSelections() const { return m_selections; } - - // implementation from now on - virtual bool TransferDataFromWindow(); - -protected: -#if wxUSE_CHECKLISTBOX - virtual wxListBoxBase *CreateList(int n, - const wxString *choices, - long styleLbox); -#endif // wxUSE_CHECKLISTBOX - - wxArrayInt m_selections; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog) -}; - -// ---------------------------------------------------------------------------- -// wrapper functions which can be used to get selection(s) from the user -// ---------------------------------------------------------------------------- - -// get the user selection as a string -WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// Same as above but gets position in list of strings, instead of string, -// or -1 if no selection -WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// Return client data instead or NULL if cancelled -WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - void **client_data, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - void **client_data, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// fill the array with the indices of the chosen items, it will be empty -// if no items were selected or Cancel was pressed - return the number of -// selections -WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -#endif // _WX_GENERIC_CHOICDGG_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/clrpickerg.h b/Source/3rdParty/wx/include/wx/generic/clrpickerg.h deleted file mode 100644 index 3a54f1e6f..000000000 --- a/Source/3rdParty/wx/include/wx/generic/clrpickerg.h +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/clrpickerg.h -// Purpose: wxGenericColourButton header -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: clrpickerg.h 58967 2009-02-17 13:31:28Z SC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLRPICKER_H_ -#define _WX_CLRPICKER_H_ - -#include "wx/button.h" -#include "wx/cmndata.h" - -//----------------------------------------------------------------------------- -// wxGenericColourButton: a button which brings up a wxColourDialog -//----------------------------------------------------------------------------- - -// show the colour in HTML form (#AABBCC) as colour button label -#define wxCLRBTN_SHOW_LABEL 100 - -// the default style -#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) - -#ifndef wxCLRBTN_USES_BMP_BUTTON - #define wxCLRBTN_USES_BMP_BUTTON 0 -#endif - -#if wxCLRBTN_USES_BMP_BUTTON - #include "wx/bmpbutton.h" - #define wxCLRBTN_BASE_CLASS wxBitmapButton -#else - #define wxCLRBTN_BASE_CLASS wxButton -#endif - -class WXDLLIMPEXP_CORE wxGenericColourButton : public wxCLRBTN_BASE_CLASS, - public wxColourPickerWidgetBase -{ -public: - wxGenericColourButton() {} - wxGenericColourButton(wxWindow *parent, - wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerWidgetNameStr) - { - Create(parent, id, col, pos, size, style, validator, name); - } - - virtual ~wxGenericColourButton() {} - - -public: // API extensions specific for wxGenericColourButton - - // user can override this to init colour data in a different way - virtual void InitColourData(); - - // returns the colour data shown in wxColourDialog - wxColourData *GetColourData() { return &ms_data; } - - -public: - - bool Create(wxWindow *parent, - wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerWidgetNameStr); - - void OnButtonClick(wxCommandEvent &); - - -protected: - - wxSize DoGetBestSize() const; - - void UpdateColour(); - - // the colour data shown in wxColourPickerCtrlGeneric - // controls. This member is static so that all colour pickers - // in the program share the same set of custom colours. - static wxColourData ms_data; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericColourButton) -}; - - -#endif // _WX_CLRPICKER_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/collpaneg.h b/Source/3rdParty/wx/include/wx/generic/collpaneg.h deleted file mode 100644 index b16b65948..000000000 --- a/Source/3rdParty/wx/include/wx/generic/collpaneg.h +++ /dev/null @@ -1,105 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/collpaneg.h -// Purpose: wxGenericCollapsiblePane -// Author: Francesco Montorsi -// Modified by: -// Created: 8/10/2006 -// RCS-ID: $Id: collpaneg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_ -#define _WX_COLLAPSABLE_PANE_H_GENERIC_ - -// forward declared -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxStaticLine; - -// class name -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[]; - -// ---------------------------------------------------------------------------- -// wxGenericCollapsiblePane -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase -{ -public: - wxGenericCollapsiblePane() { Init(); } - - wxGenericCollapsiblePane(wxWindow *parent, - wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCP_DEFAULT_STYLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxCollapsiblePaneNameStr) - { - Init(); - - Create(parent, winid, label, pos, size, style, val, name); - } - - void Init() - { - m_pButton = NULL; - m_pPane = NULL; - m_pStaticLine = NULL; - m_sz = NULL; - } - - ~wxGenericCollapsiblePane(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCP_DEFAULT_STYLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxCollapsiblePaneNameStr); - - // public wxCollapsiblePane API - virtual void Collapse(bool collapse = true); - virtual void SetLabel(const wxString &label); - - virtual bool IsCollapsed() const - { return m_pPane==NULL || !m_pPane->IsShown(); } - virtual wxWindow *GetPane() const - { return m_pPane; } - virtual wxString GetLabel() const - { return m_strLabel; } - - virtual bool Layout(); - - // implementation only, don't use - void OnStateChange(const wxSize& sizeNew); - -protected: - // overridden methods - virtual wxSize DoGetBestSize() const; - - wxString GetBtnLabel() const; - int GetBorder() const; - - // child controls - wxButton *m_pButton; - wxStaticLine *m_pStaticLine; - wxWindow *m_pPane; - wxSizer *m_sz; - - // the button label without ">>" or "<<" - wxString m_strLabel; - -private: - // event handlers - void OnButton(wxCommandEvent &ev); - void OnSize(wxSizeEvent &ev); - - DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ diff --git a/Source/3rdParty/wx/include/wx/generic/combo.h b/Source/3rdParty/wx/include/wx/generic/combo.h deleted file mode 100644 index 1c0ccee5c..000000000 --- a/Source/3rdParty/wx/include/wx/generic/combo.h +++ /dev/null @@ -1,140 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/combo.h -// Purpose: Generic wxComboCtrl -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_COMBOCTRL_H_ -#define _WX_GENERIC_COMBOCTRL_H_ - -#if wxUSE_COMBOCTRL - -// Only define generic if native doesn't have all the features -#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) - -// ---------------------------------------------------------------------------- -// Generic wxComboCtrl -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - -// all actions of single line text controls are supported - -// popup/dismiss the choice window -#define wxACTION_COMBOBOX_POPUP wxT("popup") -#define wxACTION_COMBOBOX_DISMISS wxT("dismiss") - -#endif - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; - -class WXDLLEXPORT wxGenericComboCtrl : public wxComboCtrlBase -{ -public: - // ctors and such - wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } - - wxGenericComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxComboCtrlBase() - { - Init(); - - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxGenericComboCtrl(); - - void SetCustomPaintWidth( int width ); - - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; - - static int GetFeatures() { return wxComboCtrlFeatures::All; } - -#if defined(__WXUNIVERSAL__) - // we have our own input handler and our own actions - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0l, - const wxString& strArg = wxEmptyString); -#endif - -protected: - - // Mandatory virtuals - virtual void OnResize(); - - // Event handlers - void OnPaintEvent( wxPaintEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - -private: - void Init(); - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl) -}; - - -#ifndef _WX_COMBOCONTROL_H_ - -// If native wxComboCtrl was not defined, then prepare a simple -// front-end so that wxRTTI works as expected. - -class WXDLLEXPORT wxComboCtrl : public wxGenericComboCtrl -{ -public: - wxComboCtrl() : wxGenericComboCtrl() {} - - wxComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxGenericComboCtrl() - { - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - virtual ~wxComboCtrl() {} - -protected: - -private: - DECLARE_DYNAMIC_CLASS(wxComboCtrl) -}; - -#endif // _WX_COMBOCONTROL_H_ - -#else - -#define wxGenericComboCtrl wxComboCtrl - -#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) - -#endif // wxUSE_COMBOCTRL -#endif - // _WX_GENERIC_COMBOCTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/dirctrlg.h b/Source/3rdParty/wx/include/wx/generic/dirctrlg.h deleted file mode 100644 index b4cea43b5..000000000 --- a/Source/3rdParty/wx/include/wx/generic/dirctrlg.h +++ /dev/null @@ -1,295 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dirctrlg.h -// Purpose: wxGenericDirCtrl class -// Builds on wxDirCtrl class written by Robert Roebling for the -// wxFile application, modified by Harm van der Heijden. -// Further modified for Windows. -// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al -// Modified by: -// Created: 21/3/2000 -// RCS-ID: $Id: dirctrlg.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRCTRL_H_ -#define _WX_DIRCTRL_H_ - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - #include "wx/imaglist.h" -#endif - -#if wxUSE_DIRDLG - -#include "wx/treectrl.h" -#include "wx/dialog.h" -#include "wx/dirdlg.h" -#include "wx/choice.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_BASE wxHashTable; - -//----------------------------------------------------------------------------- -// Extra styles for wxGenericDirCtrl -//----------------------------------------------------------------------------- - -enum -{ - // Only allow directory viewing/selection, no files - wxDIRCTRL_DIR_ONLY = 0x0010, - // When setting the default path, select the first file in the directory - wxDIRCTRL_SELECT_FIRST = 0x0020, - // Show the filter list - wxDIRCTRL_SHOW_FILTERS = 0x0040, - // Use 3D borders on internal controls - wxDIRCTRL_3D_INTERNAL = 0x0080, - // Editable labels - wxDIRCTRL_EDIT_LABELS = 0x0100 -}; - -//----------------------------------------------------------------------------- -// wxDirItemData -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirItemData : public wxTreeItemData -{ -public: - wxDirItemData(const wxString& path, const wxString& name, bool isDir); - virtual ~wxDirItemData(){} - void SetNewDirName(const wxString& path); - - bool HasSubDirs() const; - bool HasFiles(const wxString& spec = wxEmptyString) const; - - wxString m_path, m_name; - bool m_isHidden; - bool m_isExpanded; - bool m_isDir; -}; - -//----------------------------------------------------------------------------- -// wxDirCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl; - -class WXDLLEXPORT wxGenericDirCtrl: public wxControl -{ -public: - wxGenericDirCtrl(); - wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY, - const wxString &dir = wxDirDialogDefaultFolderStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, - const wxString& filter = wxEmptyString, - int defaultFilter = 0, - const wxString& name = wxTreeCtrlNameStr ) - { - Init(); - Create(parent, id, dir, pos, size, style, filter, defaultFilter, name); - } - - bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY, - const wxString &dir = wxDirDialogDefaultFolderStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, - const wxString& filter = wxEmptyString, - int defaultFilter = 0, - const wxString& name = wxTreeCtrlNameStr ); - - virtual void Init(); - - virtual ~wxGenericDirCtrl(); - - void OnExpandItem(wxTreeEvent &event ); - void OnCollapseItem(wxTreeEvent &event ); - void OnBeginEditItem(wxTreeEvent &event ); - void OnEndEditItem(wxTreeEvent &event ); - void OnSize(wxSizeEvent &event ); - - // Try to expand as much of the given path as possible. - virtual bool ExpandPath(const wxString& path); - // collapse the path - virtual bool CollapsePath(const wxString& path); - - // Accessors - - virtual inline wxString GetDefaultPath() const { return m_defaultPath; } - virtual void SetDefaultPath(const wxString& path) { m_defaultPath = path; } - - // Get dir or filename - virtual wxString GetPath() const; - - // Get selected filename path only (else empty string). - // I.e. don't count a directory as a selection - virtual wxString GetFilePath() const; - virtual void SetPath(const wxString& path); - - virtual void ShowHidden( bool show ); - virtual bool GetShowHidden() { return m_showHidden; } - - virtual wxString GetFilter() const { return m_filter; } - virtual void SetFilter(const wxString& filter); - - virtual int GetFilterIndex() const { return m_currentFilter; } - virtual void SetFilterIndex(int n); - - virtual wxTreeItemId GetRootId() { return m_rootId; } - - virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; } - virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; } - - // Helper - virtual void SetupSections(); - -#if WXWIN_COMPATIBILITY_2_4 - // Parse the filter into an array of filters and an array of descriptions - virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); -#endif // WXWIN_COMPATIBILITY_2_4 - - // Find the child that matches the first part of 'path'. - // E.g. if a child path is "/usr" and 'path' is "/usr/include" - // then the child for /usr is returned. - // If the path string has been used (we're at the leaf), done is set to true - virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done); - - // Resize the components of the control - virtual void DoResize(); - - // Collapse & expand the tree, thus re-creating it from scratch: - virtual void ReCreateTree(); - - // Collapse the entire tree - virtual void CollapseTree(); - -protected: - virtual void ExpandRoot(); - virtual void ExpandDir(wxTreeItemId parentId); - virtual void CollapseDir(wxTreeItemId parentId); - virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0); - virtual wxTreeItemId AppendItem (const wxTreeItemId & parent, - const wxString & text, - int image = -1, int selectedImage = -1, - wxTreeItemData * data = NULL); - //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames); - virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle); - - // Extract description and actual filter from overall filter string - bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description); - -private: - bool m_showHidden; - wxTreeItemId m_rootId; - wxString m_defaultPath; // Starting path - long m_styleEx; // Extended style - wxString m_filter; // Wildcards in same format as per wxFileDialog - int m_currentFilter; // The current filter index - wxString m_currentFilterStr; // Current filter string - wxTreeCtrl* m_treeCtrl; - wxDirFilterListCtrl* m_filterListCtrl; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl) - DECLARE_NO_COPY_CLASS(wxGenericDirCtrl) -}; - -//----------------------------------------------------------------------------- -// wxDirFilterListCtrl -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirFilterListCtrl: public wxChoice -{ -public: - wxDirFilterListCtrl() { Init(); } - wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0) - { - Init(); - Create(parent, id, pos, size, style); - } - - bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0); - - void Init(); - - virtual ~wxDirFilterListCtrl() {} - - //// Operations - void FillFilterList(const wxString& filter, int defaultFilter); - - //// Events - void OnSelFilter(wxCommandEvent& event); - -protected: - wxGenericDirCtrl* m_dirCtrl; - - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxDirFilterListCtrl) - DECLARE_NO_COPY_CLASS(wxDirFilterListCtrl) -}; - -#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) - #define wxDirCtrl wxGenericDirCtrl -#endif - -// Symbols for accessing individual controls -#define wxID_TREECTRL 7000 -#define wxID_FILTERLISTCTRL 7001 - -#endif // wxUSE_DIRDLG - -//------------------------------------------------------------------------- -// wxFileIconsTable - use wxTheFileIconsTable which is created as necessary -//------------------------------------------------------------------------- - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - -class WXDLLEXPORT wxFileIconsTable -{ -public: - wxFileIconsTable(); - ~wxFileIconsTable(); - - enum iconId_Type - { - folder, - folder_open, - computer, - drive, - cdrom, - floppy, - removeable, - file, - executable - }; - - int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString); - wxImageList *GetSmallImageList(); - -protected: - void Create(); // create on first use - - wxImageList *m_smallImageList; - wxHashTable *m_HashTable; -}; - -// The global fileicons table -extern WXDLLEXPORT_DATA(wxFileIconsTable *) wxTheFileIconsTable; - -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG - -#endif - // _WX_DIRCTRLG_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/dragimgg.h b/Source/3rdParty/wx/include/wx/generic/dragimgg.h deleted file mode 100644 index 79f2785ba..000000000 --- a/Source/3rdParty/wx/include/wx/generic/dragimgg.h +++ /dev/null @@ -1,271 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dragimgg.h -// Purpose: wxDragImage class: a kind of a cursor, that can cope -// with more sophisticated images -// Author: Julian Smart -// Modified by: -// Created: 29/2/2000 -// RCS-ID: $Id: dragimgg.h 42397 2006-10-25 12:12:56Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAGIMGG_H_ -#define _WX_DRAGIMGG_H_ - -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/treectrl.h" -#include "wx/listctrl.h" -#include "wx/log.h" -#include "wx/overlay.h" - -/* - To use this class, create a wxDragImage when you start dragging, for example: - - void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) - { -#ifdef __WXMSW__ - ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets -#endif - - CaptureMouse(); - - m_dragImage = new wxDragImage(* this, itemId); - m_dragImage->BeginDrag(wxPoint(0, 0), this); - m_dragImage->Move(pt, this); - m_dragImage->Show(this); - ... - } - - In your OnMouseMove function, hide the image, do any display updating required, - then move and show the image again: - - void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) - { - if (m_dragMode == MY_TREE_DRAG_NONE) - { - event.Skip(); - return; - } - - // Prevent screen corruption by hiding the image - if (m_dragImage) - m_dragImage->Hide(this); - - // Do some updating of the window, such as highlighting the drop target - ... - -#ifdef __WXMSW__ - if (updateWindow) - ::UpdateWindow((HWND) GetHWND()); -#endif - - // Move and show the image again - m_dragImage->Move(event.GetPosition(), this); - m_dragImage->Show(this); - } - - Eventually we end the drag and delete the drag image. - - void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) - { - ... - - // End the drag and delete the drag image - if (m_dragImage) - { - m_dragImage->EndDrag(this); - delete m_dragImage; - m_dragImage = NULL; - } - ReleaseMouse(); - } -*/ - -/* - * wxGenericDragImage - */ - -class WXDLLEXPORT wxGenericDragImage: public wxObject -{ -public: - - // Ctors & dtor - //////////////////////////////////////////////////////////////////////////// - - wxGenericDragImage(const wxCursor& cursor = wxNullCursor) - { - Init(); - Create(cursor); - } - - wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - wxGenericDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - wxGenericDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(str, cursor); - } - -#if WXWIN_COMPATIBILITY_2_6 - // don't use in new code, use versions without hot spot parameter - wxDEPRECATED( wxGenericDragImage(const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_TREECTRL - wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) - { - Init(); - - Create(treeCtrl, id); - } -#endif - -#if wxUSE_LISTCTRL - wxGenericDragImage(const wxListCtrl& listCtrl, long id) - { - Init(); - - Create(listCtrl, id); - } -#endif - - virtual ~wxGenericDragImage(); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // For efficiency, tell wxGenericDragImage to use a bitmap that's already - // created (e.g. from last drag) - void SetBackingBitmap(wxBitmap* bitmap) { -#ifndef wxHAS_NATIVE_OVERLAY - m_pBackingBitmap = bitmap; -#endif - } - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) - bool Create(const wxCursor& cursor = wxNullCursor); - - // Create a drag image from a bitmap and optional cursor - bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); - - // Create a drag image from an icon and optional cursor - bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); - - // Create a drag image from a string and optional cursor - bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); - -#if wxUSE_TREECTRL - // Create a drag image for the given tree control item - bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); -#endif - -#if wxUSE_LISTCTRL - // Create a drag image for the given list control item - bool Create(const wxListCtrl& listCtrl, long id); -#endif - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. This is full screen only. fullScreenRect gives the - // position of the window on the screen, to restrict the drag to. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); - - // End drag - bool EndDrag(); - - // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. - bool Move(const wxPoint& pt); - - // Show the image - bool Show(); - - // Hide the image - bool Hide(); - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - void Init(); - - // Override this if you are using a virtual image (drawing your own image) - virtual wxRect GetImageRect(const wxPoint& pos) const; - - // Override this if you are using a virtual image (drawing your own image) - virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; - - // Override this if you wish to draw the window contents to the backing bitmap - // yourself. This can be desirable if you wish to avoid flicker by not having to - // redraw the window itself before dragging in order to be graphic-minus-dragged-objects. - // Instead, paint the drag image's backing bitmap to be correct, and leave the window - // to be updated only when dragging the objects away (thus giving a smoother appearance). - virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, - const wxRect& sourceRect, const wxRect& destRect) const; - - // Erase and redraw simultaneously if possible - virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); - -protected: - wxBitmap m_bitmap; - wxIcon m_icon; - wxCursor m_cursor; - wxCursor m_oldCursor; -// wxPoint m_hotspot; - wxPoint m_offset; // The hostpot value passed to BeginDrag - wxPoint m_position; - bool m_isDirty; - bool m_isShown; - wxWindow* m_window; - wxDC* m_windowDC; - -#ifdef wxHAS_NATIVE_OVERLAY - wxOverlay m_overlay; - wxDCOverlay* m_dcOverlay; -#else - // Stores the window contents while we're dragging the image around - wxBitmap m_backingBitmap; - wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap - // (pass to wxGenericDragImage as an efficiency measure) - // A temporary bitmap for repairing/redrawing - wxBitmap m_repairBitmap; -#endif // !wxHAS_NATIVE_OVERLAY - - wxRect m_boundingRect; - bool m_fullScreen; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericDragImage) - DECLARE_NO_COPY_CLASS(wxGenericDragImage) -}; - -#endif - // _WX_DRAGIMGG_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/filepickerg.h b/Source/3rdParty/wx/include/wx/generic/filepickerg.h deleted file mode 100644 index 769d20b4a..000000000 --- a/Source/3rdParty/wx/include/wx/generic/filepickerg.h +++ /dev/null @@ -1,213 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/filepickerg.h -// Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepickerg.h 40100 2006-07-15 15:13:04Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDIRPICKER_H_ -#define _WX_FILEDIRPICKER_H_ - -#include "wx/button.h" -#include "wx/filedlg.h" -#include "wx/dirdlg.h" - - -extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_DIRPICKER_CHANGED; -extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_FILEPICKER_CHANGED; - - -//----------------------------------------------------------------------------- -// wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, - public wxFileDirPickerWidgetBase -{ -public: - wxGenericFileDirButton() { } - wxGenericFileDirButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr) - { - Create(parent, id, label, path, message, wildcard, - pos, size, style, validator, name); - } - - virtual ~wxGenericFileDirButton() {} - - virtual wxControl *AsControl() { return this; } - -public: // overrideable - - virtual wxDialog *CreateDialog() = 0; - - virtual wxWindow *GetDialogParent() - { return GetParent(); } - - virtual wxEventType GetEventType() const = 0; - -public: - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr); - - // event handler for the click - void OnButtonClick(wxCommandEvent &); - -protected: - wxString m_message, m_wildcard; -}; - - -//----------------------------------------------------------------------------- -// wxGenericFileButton: a button which brings up a wxFileDialog -//----------------------------------------------------------------------------- - -#define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN) - -class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton -{ -public: - wxGenericFileButton() {} - wxGenericFileButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFILEBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr) - { - Create(parent, id, label, path, message, wildcard, - pos, size, style, validator, name); - } - -public: // overrideable - - virtual long GetDialogStyle() const - { - long filedlgstyle = 0; - - if (this->HasFlag(wxFLP_OPEN)) - filedlgstyle |= wxFD_OPEN; - if (this->HasFlag(wxFLP_SAVE)) - filedlgstyle |= wxFD_SAVE; - if (this->HasFlag(wxFLP_OVERWRITE_PROMPT)) - filedlgstyle |= wxFD_OVERWRITE_PROMPT; - if (this->HasFlag(wxFLP_FILE_MUST_EXIST)) - filedlgstyle |= wxFD_FILE_MUST_EXIST; - if (this->HasFlag(wxFLP_CHANGE_DIR)) - filedlgstyle |= wxFD_CHANGE_DIR; - - return filedlgstyle; - } - - virtual wxDialog *CreateDialog() - { - wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, - wxEmptyString, wxEmptyString, - m_wildcard, GetDialogStyle()); - - // this sets both the default folder and the default file of the dialog - p->SetPath(m_path); - return p; - } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_FILEPICKER_CHANGED; } - -protected: - void UpdateDialogPath(wxDialog *p) - { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) - { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } - -private: - DECLARE_DYNAMIC_CLASS(wxGenericFileButton) -}; - - -//----------------------------------------------------------------------------- -// wxGenericDirButton: a button which brings up a wxDirDialog -//----------------------------------------------------------------------------- - -#define wxDIRBTN_DEFAULT_STYLE 0 - -class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton -{ -public: - wxGenericDirButton() {} - wxGenericDirButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxDirPickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerWidgetNameStr) - { - Create(parent, id, label, path, message, wxEmptyString, - pos, size, style, validator, name); - } - -public: // overrideable - - virtual long GetDialogStyle() const - { - long dirdlgstyle = wxDD_DEFAULT_STYLE; - - if (this->HasFlag(wxDIRP_DIR_MUST_EXIST)) - dirdlgstyle |= wxDD_DIR_MUST_EXIST; - if (this->HasFlag(wxDIRP_CHANGE_DIR)) - dirdlgstyle |= wxDD_CHANGE_DIR; - - return dirdlgstyle; - } - - virtual wxDialog *CreateDialog() - { - return new wxDirDialog(GetDialogParent(), m_message, m_path, - GetDialogStyle()); - } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_DIRPICKER_CHANGED; } - -protected: - void UpdateDialogPath(wxDialog *p) - { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) - { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } - -private: - DECLARE_DYNAMIC_CLASS(wxGenericDirButton) -}; - - -#endif // _WX_FILEDIRPICKER_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/fontpickerg.h b/Source/3rdParty/wx/include/wx/generic/fontpickerg.h deleted file mode 100644 index cfa612aa9..000000000 --- a/Source/3rdParty/wx/include/wx/generic/fontpickerg.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/fontpickerg.h -// Purpose: wxGenericFontButton header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: fontpickerg.h 42999 2006-11-03 21:54:13Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTPICKER_H_ -#define _WX_FONTPICKER_H_ - -#include "wx/button.h" -#include "wx/cmndata.h" - -//----------------------------------------------------------------------------- -// wxGenericFontButton: a button which brings up a wxColourDialog -//----------------------------------------------------------------------------- - -#define wxFONTBTN_DEFAULT_STYLE \ - (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) - -class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, - public wxFontPickerWidgetBase -{ -public: - wxGenericFontButton() {} - wxGenericFontButton(wxWindow *parent, - wxWindowID id, - const wxFont &initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFONTBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerWidgetNameStr) - { - Create(parent, id, initial, pos, size, style, validator, name); - } - - virtual ~wxGenericFontButton() {} - - -public: // API extensions specific for wxGenericFontButton - - // user can override this to init font data in a different way - virtual void InitFontData(); - - // returns the font data shown in wxColourDialog - wxFontData *GetFontData() { return &ms_data; } - - -public: - - bool Create(wxWindow *parent, - wxWindowID id, - const wxFont &initial = *wxNORMAL_FONT, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFONTBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerWidgetNameStr); - - void OnButtonClick(wxCommandEvent &); - - -protected: - - void UpdateFont(); - - // the colour data shown in wxColourPickerCtrlGeneric - // controls. This member is static so that all colour pickers - // in the program share the same set of custom colours. - static wxFontData ms_data; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericFontButton) -}; - - -#endif // _WX_FONTPICKER_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/logg.h b/Source/3rdParty/wx/include/wx/generic/logg.h deleted file mode 100644 index 240b30fbd..000000000 --- a/Source/3rdParty/wx/include/wx/generic/logg.h +++ /dev/null @@ -1,129 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/logg.h -// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: logg.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LOGG_H_ -#define _WX_LOGG_H_ - -#if wxUSE_GUI - -// ---------------------------------------------------------------------------- -// the following log targets are only compiled in if the we're compiling the -// GUI part (andnot just the base one) of the library, they're implemented in -// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest) -// ---------------------------------------------------------------------------- - -#if wxUSE_TEXTCTRL - -// log everything to a text window (GUI only of course) -class WXDLLEXPORT wxLogTextCtrl : public wxLog -{ -public: - wxLogTextCtrl(wxTextCtrl *pTextCtrl); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - // the control we use - wxTextCtrl *m_pTextCtrl; - - DECLARE_NO_COPY_CLASS(wxLogTextCtrl) -}; - -#endif // wxUSE_TEXTCTRL - -// ---------------------------------------------------------------------------- -// GUI log target, the default one for wxWidgets programs -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGGUI - -class WXDLLEXPORT wxLogGui : public wxLog -{ -public: - // ctor - wxLogGui(); - - // show all messages that were logged since the last Flush() - virtual void Flush(); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - - // empty everything - void Clear(); - - wxArrayString m_aMessages; // the log message texts - wxArrayInt m_aSeverity; // one of wxLOG_XXX values - wxArrayLong m_aTimes; // the time of each message - bool m_bErrors, // do we have any errors? - m_bWarnings, // any warnings? - m_bHasMessages; // any messages at all? - -}; - -#endif // wxUSE_LOGGUI - -// ---------------------------------------------------------------------------- -// (background) log window: this class forwards all log messages to the log -// target which was active when it was instantiated, but also collects them -// to the log window. This window has it's own menu which allows the user to -// close it, clear the log contents or save it to the file. -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGWINDOW - -class WXDLLEXPORT wxLogWindow : public wxLogPassThrough -{ -public: - wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) - const wxChar *szTitle, // the title of the frame - bool bShow = true, // show window immediately? - bool bPassToOld = true); // pass messages to the old target? - - virtual ~wxLogWindow(); - - // window operations - // show/hide the log window - void Show(bool bShow = true); - // retrieve the pointer to the frame - wxFrame *GetFrame() const; - - // overridables - // called immediately after the log frame creation allowing for - // any extra initializations - virtual void OnFrameCreate(wxFrame *frame); - // called if the user closes the window interactively, will not be - // called if it is destroyed for another reason (such as when program - // exits) - return true from here to allow the frame to close, false - // to prevent this from happening - virtual bool OnFrameClose(wxFrame *frame); - // called right before the log frame is going to be deleted: will - // always be called unlike OnFrameClose() - virtual void OnFrameDelete(wxFrame *frame); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - wxLogFrame *m_pLogFrame; // the log frame - - DECLARE_NO_COPY_CLASS(wxLogWindow) -}; - -#endif // wxUSE_LOGWINDOW - -#endif // wxUSE_GUI - -#endif // _WX_LOGG_H_ - diff --git a/Source/3rdParty/wx/include/wx/generic/msgdlgg.h b/Source/3rdParty/wx/include/wx/generic/msgdlgg.h deleted file mode 100644 index 4776b106a..000000000 --- a/Source/3rdParty/wx/include/wx/generic/msgdlgg.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/msgdlgg.h -// Purpose: Generic wxMessageDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: msgdlgg.h 49765 2007-11-09 18:32:38Z DE $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __MSGDLGH_G__ -#define __MSGDLGH_G__ - -#include "wx/defs.h" -#include "wx/dialog.h" - -// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO -// Returns wxYES/NO/OK/CANCEL - -extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; - -class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase -{ -DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) - -public: - wxGenericMessageDialog(wxWindow *parent, const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - - void OnYes(wxCommandEvent& event); - void OnNo(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - -private: - DECLARE_EVENT_TABLE() -}; - -#if (!defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__) && !defined(__WXCOCOA__)) || defined(__WXUNIVERSAL__) -#define wxMessageDialog wxGenericMessageDialog -#endif - -#endif // __MSGDLGH_G__ diff --git a/Source/3rdParty/wx/include/wx/generic/notebook.h b/Source/3rdParty/wx/include/wx/generic/notebook.h deleted file mode 100644 index 5b96a204b..000000000 --- a/Source/3rdParty/wx/include/wx/generic/notebook.h +++ /dev/null @@ -1,160 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: notebook.h -// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) -// Author: Julian Smart -// Modified by: -// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NOTEBOOK_H_ -#define _WX_NOTEBOOK_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- -#include "wx/event.h" -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// fwd declarations -class WXDLLEXPORT wxImageList; -class WXDLLEXPORT wxWindow; -class WXDLLEXPORT wxTabView; - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase -{ -public: - // ctors - // ----- - // default for dynamic class - wxNotebook(); - // the same arguments as for wxControl (@@@ any special styles?) - wxNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // Create() function - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // dtor - virtual ~wxNotebook(); - - // accessors - // --------- - // Find the position of the wxNotebookPage, -1 if not found. - int FindPagePosition(wxNotebookPage* page) const; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage); - // cycle thru the tabs - // void AdvanceSelection(bool bForward = true); - // get the currently selected page - int GetSelection() const { return m_nSelection; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage); - - // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; - - // get the number of rows for a control with wxNB_MULTILINE style (not all - // versions support it - they will always return 1 then) - virtual int GetRowCount() const ; - - // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); - - // control the appearance of the notebook pages - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); - // set the padding between tabs (in pixels) - void SetPadding(const wxSize& padding); - - // Sets the size of the tabs (assumes all tabs are the same size) - void SetTabSize(const wxSize& sz); - - // operations - // ---------- - // remove one page from the notebook, and delete the page. - bool DeletePage(size_t nPage); - bool DeletePage(wxNotebookPage* page); - // remove one page from the notebook, without deleting the page. - bool RemovePage(size_t nPage); - bool RemovePage(wxNotebookPage* page); - virtual wxWindow* DoRemovePage(size_t nPage); - - // remove all pages - bool DeleteAllPages(); - // the same as AddPage(), but adds it at the specified position - bool InsertPage(size_t nPage, - wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = false, - int imageId = -1); - - // callbacks - // --------- - void OnSize(wxSizeEvent& event); - void OnInternalIdle(); - void OnSelChange(wxNotebookEvent& event); - void OnSetFocus(wxFocusEvent& event); - void OnNavigationKey(wxNavigationKeyEvent& event); - - // base class virtuals - // ------------------- - virtual void Command(wxCommandEvent& event); - virtual void SetConstraintSizes(bool recurse = true); - virtual bool DoPhase(int nPhase); - - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // Implementation - - // wxNotebook on Motif uses a generic wxTabView to implement itself. - wxTabView *GetTabView() const { return m_tabView; } - void SetTabView(wxTabView *v) { m_tabView = v; } - - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); - - virtual wxRect GetAvailableClientSize(); - - // Implementation: calculate the layout of the view rect - // and resize the children if required - bool RefreshLayout(bool force = true); - -protected: - // common part of all ctors - void Init(); - - // helper functions - void ChangePage(int nOldSel, int nSel); // change pages - - int m_nSelection; // the current selection (-1 if none) - - wxTabView* m_tabView; - - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_NOTEBOOK_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/numdlgg.h b/Source/3rdParty/wx/include/wx/generic/numdlgg.h deleted file mode 100644 index cbebd0918..000000000 --- a/Source/3rdParty/wx/include/wx/generic/numdlgg.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/numdlgg.h -// Purpose: wxNumberEntryDialog class -// Author: John Labenski -// Modified by: -// Created: 07.02.04 (extracted from textdlgg.cpp) -// RCS-ID: $Id: numdlgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __NUMDLGH_G__ -#define __NUMDLGH_G__ - -#include "wx/defs.h" - -#if wxUSE_NUMBERDLG - -#include "wx/dialog.h" - -#if wxUSE_SPINCTRL - class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -#else - class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -#endif // wxUSE_SPINCTRL - -// ---------------------------------------------------------------------------- -// wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNumberEntryDialog : public wxDialog -{ -public: - wxNumberEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& prompt, - const wxString& caption, - long value, long min, long max, - const wxPoint& pos = wxDefaultPosition); - - long GetValue() const { return m_value; } - - // implementation only - void OnOK(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - -protected: - -#if wxUSE_SPINCTRL - wxSpinCtrl *m_spinctrl; -#else - wxTextCtrl *m_spinctrl; -#endif // wxUSE_SPINCTRL - - long m_value, m_min, m_max; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog) - DECLARE_NO_COPY_CLASS(wxNumberEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// function to get a number from user -// ---------------------------------------------------------------------------- - -long WXDLLEXPORT -wxGetNumberFromUser(const wxString& message, - const wxString& prompt, - const wxString& caption, - long value = 0, - long min = 0, - long max = 100, - wxWindow *parent = (wxWindow *)NULL, - const wxPoint& pos = wxDefaultPosition); - -#endif // wxUSE_NUMBERDLG - -#endif // __NUMDLGH_G__ diff --git a/Source/3rdParty/wx/include/wx/generic/panelg.h b/Source/3rdParty/wx/include/wx/generic/panelg.h deleted file mode 100644 index f211a995c..000000000 --- a/Source/3rdParty/wx/include/wx/generic/panelg.h +++ /dev/null @@ -1,95 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/panelg.h -// Purpose: wxPanel: a container for child controls -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: panelg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_PANEL_H_ -#define _WX_GENERIC_PANEL_H_ - -// ---------------------------------------------------------------------------- -// headers and forward declarations -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxControlContainer; - -extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; - -// ---------------------------------------------------------------------------- -// wxPanel contains other controls and implements TAB traversal between them -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPanel : public wxWindow -{ -public: - wxPanel() { Init(); } - - // Old-style constructor (no default values for coordinates to avoid - // ambiguity with the new one) - wxPanel(wxWindow *parent, - int x, int y, int width, int height, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Init(); - - Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); - } - - // Constructor - wxPanel(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Init(); - - Create(parent, winid, pos, size, style, name); - } - - // Pseudo ctor - bool Create(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr); - - virtual ~wxPanel(); - - // implementation from now on - // -------------------------- - - // calls layout for layout constraints and sizers - void OnSize(wxSizeEvent& event); - - virtual void InitDialog(); - -#ifdef __WXUNIVERSAL__ - virtual bool IsCanvasWindow() const { return true; } -#endif - - - WX_DECLARE_CONTROL_CONTAINER(); - -protected: - // common part of all ctors - void Init(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel) - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_GENERIC_PANEL_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/prntdlgg.h b/Source/3rdParty/wx/include/wx/generic/prntdlgg.h deleted file mode 100644 index ef57d47cc..000000000 --- a/Source/3rdParty/wx/include/wx/generic/prntdlgg.h +++ /dev/null @@ -1,256 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: prntdlgg.h -// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, -// wxGenericPageSetupDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: prntdlgg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __PRINTDLGH_G_ -#define __PRINTDLGH_G_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dialog.h" -#include "wx/cmndata.h" -#include "wx/prntbase.h" -#include "wx/printdlg.h" -#include "wx/listctrl.h" - -#if wxUSE_POSTSCRIPT - #include "wx/dcps.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxCheckBox; -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxRadioBox; -class WXDLLIMPEXP_FWD_CORE wxPageSetupData; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// This is not clear why all these enums start with 10 or 30 but do not change it -// without good reason to avoid some subtle backwards compatibility breakage - -enum -{ - wxPRINTID_STATIC = 10, - wxPRINTID_RANGE, - wxPRINTID_FROM, - wxPRINTID_TO, - wxPRINTID_COPIES, - wxPRINTID_PRINTTOFILE, - wxPRINTID_SETUP -}; - -enum -{ - wxPRINTID_LEFTMARGIN = 30, - wxPRINTID_RIGHTMARGIN, - wxPRINTID_TOPMARGIN, - wxPRINTID_BOTTOMMARGIN -}; - -enum -{ - wxPRINTID_PRINTCOLOUR = 10, - wxPRINTID_ORIENTATION, - wxPRINTID_COMMAND, - wxPRINTID_OPTIONS, - wxPRINTID_PAPERSIZE, - wxPRINTID_PRINTER -}; - -#if wxUSE_POSTSCRIPT - -//---------------------------------------------------------------------------- -// wxPostScriptNativeData -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase -{ -public: - wxPostScriptPrintNativeData(); - virtual ~wxPostScriptPrintNativeData(); - - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return true; } - - const wxString& GetPrinterCommand() const { return m_printerCommand; } - const wxString& GetPrinterOptions() const { return m_printerOptions; } - const wxString& GetPreviewCommand() const { return m_previewCommand; } - const wxString& GetFontMetricPath() const { return m_afmPath; } - double GetPrinterScaleX() const { return m_printerScaleX; } - double GetPrinterScaleY() const { return m_printerScaleY; } - long GetPrinterTranslateX() const { return m_printerTranslateX; } - long GetPrinterTranslateY() const { return m_printerTranslateY; } - - void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } - void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } - void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } - void SetFontMetricPath(const wxString& path) { m_afmPath = path; } - void SetPrinterScaleX(double x) { m_printerScaleX = x; } - void SetPrinterScaleY(double y) { m_printerScaleY = y; } - void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } - void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } - void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } - void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } - -#if wxUSE_STREAMS - wxOutputStream *GetOutputStream() { return m_outputStream; } - void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } -#endif - -private: - wxString m_printerCommand; - wxString m_previewCommand; - wxString m_printerOptions; - wxString m_afmPath; - double m_printerScaleX; - double m_printerScaleY; - long m_printerTranslateX; - long m_printerTranslateY; -#if wxUSE_STREAMS - wxOutputStream *m_outputStream; -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) -}; - -// ---------------------------------------------------------------------------- -// Simulated Print and Print Setup dialogs for non-Windows platforms (and -// Windows using PostScript print/preview) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase -{ -public: - wxGenericPrintDialog(wxWindow *parent, - wxPrintDialogData* data = (wxPrintDialogData*)NULL); - wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); - - virtual ~wxGenericPrintDialog(); - - void OnSetup(wxCommandEvent& event); - void OnRange(wxCommandEvent& event); - void OnOK(wxCommandEvent& event); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual int ShowModal(); - - wxPrintData& GetPrintData() - { return m_printDialogData.GetPrintData(); } - - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - wxDC *GetPrintDC(); - -public: -// wxStaticText* m_printerMessage; - wxButton* m_setupButton; -// wxButton* m_helpButton; - wxRadioBox* m_rangeRadioBox; - wxTextCtrl* m_fromText; - wxTextCtrl* m_toText; - wxTextCtrl* m_noCopiesText; - wxCheckBox* m_printToFileCheckBox; -// wxCheckBox* m_collateCopiesCheckBox; - - wxPrintDialogData m_printDialogData; - -protected: - void Init(wxWindow *parent); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) -}; - -class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog -{ -public: - // There are no configuration options for the dialog, so we - // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) - wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxGenericPrintSetupDialog(); - - void Init(wxPrintData* data); - - void OnPrinter(wxListEvent& event); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual wxComboBox *CreatePaperTypeChoice(); - -public: - wxListCtrl* m_printerListCtrl; - wxRadioBox* m_orientationRadioBox; - wxTextCtrl* m_printerCommandText; - wxTextCtrl* m_printerOptionsText; - wxCheckBox* m_colourCheckBox; - wxComboBox* m_paperTypeChoice; - - wxPrintData m_printData; - wxPrintData& GetPrintData() { return m_printData; } - - // After pressing OK, write data here. - wxPrintData* m_targetData; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGenericPrintSetupDialog) -}; -#endif - // wxUSE_POSTSCRIPT - -class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase -{ -public: - wxGenericPageSetupDialog(wxWindow *parent = NULL, - wxPageSetupDialogData* data = NULL); - virtual ~wxGenericPageSetupDialog(); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual wxPageSetupDialogData& GetPageSetupDialogData(); - - void OnPrinter(wxCommandEvent& event); - wxComboBox *CreatePaperTypeChoice(int* x, int* y); - -public: - wxButton* m_printerButton; - wxRadioBox* m_orientationRadioBox; - wxTextCtrl* m_marginLeftText; - wxTextCtrl* m_marginTopText; - wxTextCtrl* m_marginRightText; - wxTextCtrl* m_marginBottomText; - wxComboBox* m_paperTypeChoice; - - wxPageSetupDialogData m_pageData; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) -}; - -#endif - -#endif -// __PRINTDLGH_G_ diff --git a/Source/3rdParty/wx/include/wx/generic/progdlgg.h b/Source/3rdParty/wx/include/wx/generic/progdlgg.h deleted file mode 100644 index 6382d1fc8..000000000 --- a/Source/3rdParty/wx/include/wx/generic/progdlgg.h +++ /dev/null @@ -1,172 +0,0 @@ -//////////////////////////////////////////////////// -// Name: progdlgg.h -// Purpose: wxProgressDialog class -// Author: Karsten Ballueder -// Modified by: -// Created: 09.05.1999 -// RCS-ID: $Id: progdlgg.h 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) Karsten Ballueder -// Licence: wxWindows licence -//////////////////////////////////////////////////// - -#ifndef __PROGDLGH_G__ -#define __PROGDLGH_G__ - -#include "wx/defs.h" -#include "wx/progdlg.h" - -#if wxUSE_PROGRESSDLG - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxGauge; -class WXDLLIMPEXP_FWD_CORE wxStaticText; - -/* Progress dialog which shows a moving progress bar. - Taken from the Mahogany project.*/ - -class WXDLLEXPORT wxProgressDialog : public wxDialog -{ -DECLARE_DYNAMIC_CLASS(wxProgressDialog) -public: - /* Creates and displays dialog, disables event handling for other - frames or parent frame to avoid recursion problems. - @param title title for window - @param message message to display in window - @param maximum value for status bar, if <= 0, no bar is shown - @param parent window or NULL - @param style is the bit mask of wxPD_XXX constants from wx/defs.h - */ - wxProgressDialog(const wxString &title, wxString const &message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); - /* Destructor. - Re-enables event handling for other windows. - */ - virtual ~wxProgressDialog(); - - /* Update the status bar to the new value. - @param value new value - @param newmsg if used, new message to display - @returns true if ABORT button has not been pressed - */ - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); - - /* Switches the dialog to use a gauge in indeterminate mode and calls - wxGauge::Pulse() to show to the user a bit of progress */ - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); - - // Must provide overload to avoid hiding it (and warnings about it) - virtual void Update() { wxDialog::Update(); } - - /* Can be called to continue after the cancel button has been pressed, but - the program decided to continue the operation (e.g., user didn't - confirm it) - */ - void Resume(); - - virtual bool Show( bool show = true ); - -protected: - // callback for optional abort button - void OnCancel(wxCommandEvent& event); - - // callback for optional skip button - void OnSkip(wxCommandEvent& event); - - // callback to disable "hard" window closing - void OnClose(wxCloseEvent& event); - - // must be called to reenable the other windows temporarily disabled while - // the dialog was shown - void ReenableOtherWindows(); - -private: - // create the label with given text and another one to show the time nearby - // as the next windows in the sizer, returns the created control - wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); - - // updates the label message - void UpdateMessage(const wxString &newmsg); - - // common part of Update() and Pulse(), returns true if not cancelled - bool DoAfterUpdate(bool *skip); - - // shortcuts for enabling buttons - void EnableClose(); - void EnableSkip(bool enable=true); - void EnableAbort(bool enable=true); - inline void DisableSkip() { EnableSkip(false); } - inline void DisableAbort() { EnableAbort(false); } - - // the status bar - wxGauge *m_gauge; - // the message displayed - wxStaticText *m_msg; - // displayed elapsed, estimated, remaining time - class wxStaticText *m_elapsed, - *m_estimated, - *m_remaining; - // time when the dialog was created - unsigned long m_timeStart; - // time when the dialog was closed or cancelled - unsigned long m_timeStop; - // time between the moment the dialog was closed/cancelled and resume - unsigned long m_break; - - // parent top level window (may be NULL) - wxWindow *m_parentTop; - - // continue processing or not (return value for Update()) - enum - { - Uncancelable = -1, // dialog can't be canceled - Canceled, // can be cancelled and, in fact, was - Continue, // can be cancelled but wasn't - Finished // finished, waiting to be removed from screen - } m_state; - - // skip some portion - bool m_skip; - -#if !defined(__SMARTPHONE__) - // the abort and skip buttons (or NULL if none) - wxButton *m_btnAbort; - wxButton *m_btnSkip; -#endif - - // the maximum value - int m_maximum; - - // saves the time when elapsed time was updated so there is only one - // update per second - unsigned long m_last_timeupdate; - // tells how often a change of the estimated time has to be confirmed - // before it is actually displayed - this reduces the frequence of updates - // of estimated and remaining time - const int m_delay; - // counts the confirmations - int m_ctdelay; - unsigned long m_display_estimated; - - bool m_hasAbortButton, - m_hasSkipButton; - -#if defined(__WXMSW__ ) || defined(__WXPM__) - // the factor we use to always keep the value in 16 bit range as the native - // control only supports ranges from 0 to 65,535 - size_t m_factor; -#endif // __WXMSW__ - - // for wxPD_APP_MODAL case - class WXDLLIMPEXP_FWD_CORE wxWindowDisabler *m_winDisabler; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxProgressDialog) -}; - -#endif // wxUSE_PROGRESSDLG - -#endif // __PROGDLGH_G__ diff --git a/Source/3rdParty/wx/include/wx/generic/scrolwin.h b/Source/3rdParty/wx/include/wx/generic/scrolwin.h deleted file mode 100644 index b1cea5de7..000000000 --- a/Source/3rdParty/wx/include/wx/generic/scrolwin.h +++ /dev/null @@ -1,27 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/scrolwin.h -// Purpose: wxGenericScrolledWindow class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: scrolwin.h 35875 2005-10-10 18:24:27Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SCROLLWIN_H_ -#define _WX_GENERIC_SCROLLWIN_H_ - -// ---------------------------------------------------------------------------- -// headers and constants -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/panel.h" - -// ---------------------------------------------------------------------------- -// wxGenericScrolledWindow -// ---------------------------------------------------------------------------- - -#endif // _WX_GENERIC_SCROLLWIN_H_ - diff --git a/Source/3rdParty/wx/include/wx/generic/spinctlg.h b/Source/3rdParty/wx/include/wx/generic/spinctlg.h deleted file mode 100644 index 59a62d6a4..000000000 --- a/Source/3rdParty/wx/include/wx/generic/spinctlg.h +++ /dev/null @@ -1,183 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/spinctlg.h -// Purpose: generic wxSpinCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.10.99 -// RCS-ID: $Id: spinctlg.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SPINCTRL_H_ -#define _WX_GENERIC_SPINCTRL_H_ - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if -// wxSpinButton is available, this is what we do - but if it isn't, we still -// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but -// the different interface. This allows to write programs using wxSpinCtrl -// without tons of #ifdefs. -// ---------------------------------------------------------------------------- - -#if wxUSE_SPINBTN - -class WXDLLEXPORT wxSpinButton; -class WXDLLEXPORT wxTextCtrl; - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinCtrl : public wxControl -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) - { - Init(); - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")); - - virtual ~wxSpinCtrl(); - - // operations - void SetValue(int val); - void SetValue(const wxString& text); - void SetRange(int min, int max); - void SetSelection(long from, long to); - - // accessors - int GetValue() const; - int GetMin() const; - int GetMax() const; - - // implementation from now on - - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual bool Reparent(wxWindow *newParent); - - // get the subcontrols - wxTextCtrl *GetText() const { return m_text; } - wxSpinButton *GetSpinButton() const { return m_btn; } - - // set the value of the text (only) - void SetTextValue(int val); - - // put the numeric value of the string in the text ctrl into val and return - // true or return false if the text ctrl doesn't contain a number or if the - // number is out of range - bool GetTextValue(int *val) const; - -protected: - // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - - // common part of all ctors - void Init(); - -private: - // the subcontrols - wxTextCtrl *m_text; - wxSpinButton *m_btn; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#else // !wxUSE_SPINBTN - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is just a text control -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" - -class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) - { - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) - { - SetRange(min, max); - - bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, - wxDefaultValidator, name); - SetValue(initial); - - return ok; - } - - // accessors - int GetValue(int WXUNUSED(dummy) = 1) const - { - int n; - if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) - n = INT_MIN; - - return n; - } - - int GetMin() const { return m_min; } - int GetMax() const { return m_max; } - - // operations - void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } - void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } - void SetRange(int min, int max) { m_min = min; m_max = max; } - -protected: - // initialize m_min/max with the default values - void Init() { SetRange(0, 100); } - - int m_min; - int m_max; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN - -#endif // _WX_GENERIC_SPINCTRL_H_ - diff --git a/Source/3rdParty/wx/include/wx/generic/splitter.h b/Source/3rdParty/wx/include/wx/generic/splitter.h deleted file mode 100644 index 14012b1b8..000000000 --- a/Source/3rdParty/wx/include/wx/generic/splitter.h +++ /dev/null @@ -1,406 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/splitter.h -// Purpose: wxSplitterWindow class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: splitter.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SPLITTER_H_ -#define _WX_GENERIC_SPLITTER_H_ - -#include "wx/window.h" // base class declaration -#include "wx/containr.h" // wxControlContainer - -class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; - -// --------------------------------------------------------------------------- -// splitter constants -// --------------------------------------------------------------------------- - -enum wxSplitMode -{ - wxSPLIT_HORIZONTAL = 1, - wxSPLIT_VERTICAL -}; - -enum -{ - wxSPLIT_DRAG_NONE, - wxSPLIT_DRAG_DRAGGING, - wxSPLIT_DRAG_LEFT_DOWN -}; - -// --------------------------------------------------------------------------- -// wxSplitterWindow maintains one or two panes, with -// an optional vertical or horizontal split which -// can be used with the mouse or programmatically. -// --------------------------------------------------------------------------- - -// TODO: -// 1) Perhaps make the borders sensitive to dragging in order to create a split. -// The MFC splitter window manages scrollbars as well so is able to -// put sash buttons on the scrollbars, but we probably don't want to go down -// this path. -// 2) for wxWidgets 2.0, we must find a way to set the WS_CLIPCHILDREN style -// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be -// standard). - -class WXDLLEXPORT wxSplitterWindow: public wxWindow -{ -public: - -//////////////////////////////////////////////////////////////////////////// -// Public API - - // Default constructor - wxSplitterWindow() - { - Init(); - } - - // Normal constructor - wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_3D, - const wxString& name = wxT("splitter")) - { - Init(); - Create(parent, id, pos, size, style, name); - } - - virtual ~wxSplitterWindow(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_3D, - const wxString& name = wxT("splitter")); - - // Gets the only or left/top pane - wxWindow *GetWindow1() const { return m_windowOne; } - - // Gets the right/bottom pane - wxWindow *GetWindow2() const { return m_windowTwo; } - - // Sets the split mode - void SetSplitMode(int mode) - { - wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL, - wxT("invalid split mode") ); - - m_splitMode = (wxSplitMode)mode; - } - - // Gets the split mode - wxSplitMode GetSplitMode() const { return m_splitMode; } - - // Initialize with one window - void Initialize(wxWindow *window); - - // Associates the given window with window 2, drawing the appropriate sash - // and changing the split mode. - // Does nothing and returns false if the window is already split. - // A sashPosition of 0 means choose a default sash position, - // negative sashPosition specifies the size of right/lower pane as it's - // absolute value rather than the size of left/upper pane. - virtual bool SplitVertically(wxWindow *window1, - wxWindow *window2, - int sashPosition = 0) - { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); } - virtual bool SplitHorizontally(wxWindow *window1, - wxWindow *window2, - int sashPosition = 0) - { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); } - - // Removes the specified (or second) window from the view - // Doesn't actually delete the window. - bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL); - - // Replaces one of the windows with another one (neither old nor new - // parameter should be NULL) - bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); - - // Make sure the child window sizes are updated. This is useful - // for reducing flicker by updating the sizes before a - // window is shown, if you know the overall size is correct. - void UpdateSize(); - - // Is the window split? - bool IsSplit() const { return (m_windowTwo != NULL); } - - // Sets the sash size - void SetSashSize(int width) { m_sashSize = width; } - - // Sets the border size - void SetBorderSize(int WXUNUSED(width)) { } - - // Gets the sash size - int GetSashSize() const; - - // Gets the border size - int GetBorderSize() const; - - // Set the sash position - void SetSashPosition(int position, bool redraw = true); - - // Gets the sash position - int GetSashPosition() const { return m_sashPosition; } - - // Set the sash gravity - void SetSashGravity(double gravity); - - // Gets the sash gravity - double GetSashGravity() const { return m_sashGravity; } - - // If this is zero, we can remove panes by dragging the sash. - void SetMinimumPaneSize(int min); - int GetMinimumPaneSize() const { return m_minimumPaneSize; } - - // NB: the OnXXX() functions below are for backwards compatibility only, - // don't use them in new code but handle the events instead! - - // called when the sash position is about to change, may return a new value - // for the sash or -1 to prevent the change from happening at all - virtual int OnSashPositionChanging(int newSashPosition); - - // Called when the sash position is about to be changed, return - // false from here to prevent the change from taking place. - // Repositions sash to minimum position if pane would be too small. - // newSashPosition here is always positive or zero. - virtual bool OnSashPositionChange(int newSashPosition); - - // If the sash is moved to an extreme position, a subwindow - // is removed from the splitter window, and the app is - // notified. The app should delete or hide the window. - virtual void OnUnsplit(wxWindow *removed); - - // Called when the sash is double-clicked. - // The default behaviour is to remove the sash if the - // minimum pane size is zero. - virtual void OnDoubleClickSash(int x, int y); - -//////////////////////////////////////////////////////////////////////////// -// Implementation - - // Paints the border and sash - void OnPaint(wxPaintEvent& event); - - // Handles mouse events - void OnMouseEvent(wxMouseEvent& ev); - - // Adjusts the panes - void OnSize(wxSizeEvent& event); - - // In live mode, resize child windows in idle time - void OnInternalIdle(); - - // Draws the sash - virtual void DrawSash(wxDC& dc); - - // Draws the sash tracker (for whilst moving the sash) - virtual void DrawSashTracker(int x, int y); - - // Tests for x, y over sash - virtual bool SashHitTest(int x, int y, int tolerance = 5); - - // Resizes subwindows - virtual void SizeWindows(); - - void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } - bool GetNeedUpdating() const { return m_needUpdating ; } - -#ifdef __WXMAC__ - virtual bool MacClipGrandChildren() const { return true ; } -#endif - -protected: - // event handlers -#if defined(__WXMSW__) || defined(__WXMAC__) - void OnSetCursor(wxSetCursorEvent& event); -#endif // wxMSW - - // send the given event, return false if the event was processed and vetoed - // by the user code - bool DoSendEvent(wxSplitterEvent& event); - - // common part of all ctors - void Init(); - - // common part of SplitVertically() and SplitHorizontally() - bool DoSplit(wxSplitMode mode, - wxWindow *window1, wxWindow *window2, - int sashPosition); - - // adjusts sash position with respect to min. pane and window sizes - int AdjustSashPosition(int sashPos) const; - - // get either width or height depending on the split mode - int GetWindowSize() const; - - // convert the user specified sash position which may be > 0 (as is), < 0 - // (specifying the size of the right pane) or 0 (use default) to the real - // position to be passed to DoSetSashPosition() - int ConvertSashPosition(int sashPos) const; - - // set the real sash position, sashPos here must be positive - // - // returns true if the sash position has been changed, false otherwise - bool DoSetSashPosition(int sashPos); - - // set the sash position and send an event about it having been changed - void SetSashPositionAndNotify(int sashPos); - - // callbacks executed when we detect that the mouse has entered or left - // the sash - virtual void OnEnterSash(); - virtual void OnLeaveSash(); - - // set the cursor appropriate for the current split mode - void SetResizeCursor(); - - // redraw the splitter if its "hotness" changed if necessary - void RedrawIfHotSensitive(bool isHot); - - // return the best size of the splitter equal to best sizes of its - // subwindows - virtual wxSize DoGetBestSize() const; - - - wxSplitMode m_splitMode; - wxWindow* m_windowOne; - wxWindow* m_windowTwo; - int m_dragMode; - int m_oldX; - int m_oldY; - int m_sashPosition; // Number of pixels from left or top - double m_sashGravity; - int m_sashSize; - wxSize m_lastSize; - int m_requestedSashPosition; - int m_sashPositionCurrent; // while dragging - int m_firstX; - int m_firstY; - int m_minimumPaneSize; - wxCursor m_sashCursorWE; - wxCursor m_sashCursorNS; - wxPen *m_sashTrackerPen; - - // when in live mode, set this to true to resize children in idle - bool m_needUpdating:1; - bool m_permitUnsplitAlways:1; - bool m_isHot:1; - bool m_checkRequestedSashPosition:1; - -private: - WX_DECLARE_CONTROL_CONTAINER(); - - DECLARE_DYNAMIC_CLASS(wxSplitterWindow) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSplitterWindow) -}; - -// ---------------------------------------------------------------------------- -// event class and macros -// ---------------------------------------------------------------------------- - -// we reuse the same class for all splitter event types because this is the -// usual wxWin convention, but the three event types have different kind of -// data associated with them, so the accessors can be only used if the real -// event type matches with the one for which the accessors make sense -class WXDLLEXPORT wxSplitterEvent : public wxNotifyEvent -{ -public: - wxSplitterEvent(wxEventType type = wxEVT_NULL, - wxSplitterWindow *splitter = (wxSplitterWindow *)NULL) - : wxNotifyEvent(type) - { - SetEventObject(splitter); - if (splitter) m_id = splitter->GetId(); - } - - // SASH_POS_CHANGED methods - - // setting the sash position to -1 prevents the change from taking place at - // all - void SetSashPosition(int pos) - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED - || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); - - m_data.pos = pos; - } - - int GetSashPosition() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED - || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); - - return m_data.pos; - } - - // UNSPLIT event methods - wxWindow *GetWindowBeingRemoved() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_UNSPLIT ); - - return m_data.win; - } - - // DCLICK event methods - int GetX() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); - - return m_data.pt.x; - } - - int GetY() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); - - return m_data.pt.y; - } - -private: - friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; - - // data for the different types of event - union - { - int pos; // position for SASH_POS_CHANGED event - wxWindow *win; // window being removed for UNSPLIT event - struct - { - int x, y; - } pt; // position of double click for DCLICK event - } m_data; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSplitterEvent) -}; - -typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); - -#define wxSplitterEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSplitterEventFunction, &func) - -#define wx__DECLARE_SPLITTEREVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn)) - -#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \ - wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGED, id, fn) - -#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \ - wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGING, id, fn) - -#define EVT_SPLITTER_DCLICK(id, fn) \ - wx__DECLARE_SPLITTEREVT(DOUBLECLICKED, id, fn) - -#define EVT_SPLITTER_UNSPLIT(id, fn) \ - wx__DECLARE_SPLITTEREVT(UNSPLIT, id, fn) - -#endif // _WX_GENERIC_SPLITTER_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/srchctlg.h b/Source/3rdParty/wx/include/wx/generic/srchctlg.h deleted file mode 100644 index 8f7a42e52..000000000 --- a/Source/3rdParty/wx/include/wx/generic/srchctlg.h +++ /dev/null @@ -1,275 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/srchctlg.h -// Purpose: generic wxSearchCtrl class -// Author: Vince Harron -// Created: 2006-02-19 -// RCS-ID: $Id: srchctlg.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: Vince Harron -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SEARCHCTRL_H_ -#define _WX_GENERIC_SEARCHCTRL_H_ - -#if wxUSE_SEARCHCTRL - -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxSearchButton; -class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl; - -// ---------------------------------------------------------------------------- -// wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase -{ -public: - // creation - // -------- - - wxSearchCtrl(); - wxSearchCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSearchCtrlNameStr); - - virtual ~wxSearchCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSearchCtrlNameStr); - -#if wxUSE_MENUS - // get/set search button menu - // -------------------------- - virtual void SetMenu( wxMenu* menu ); - virtual wxMenu* GetMenu(); -#endif // wxUSE_MENUS - - // get/set search options - // ---------------------- - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; - - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; - -#if wxABI_VERSION >= 20802 - // TODO: In 2.9 these should probably be virtual, and declared in the base class... - void SetDescriptiveText(const wxString& text); - wxString GetDescriptiveText() const; -#endif - - // accessors - // --------- - - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - // more readable flag testing methods - virtual bool IsSingleLine() const; - virtual bool IsMultiLine() const; - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const; - - virtual wxString GetStringSelection() const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load/save the controls contents from/to the file - virtual bool LoadFile(const wxString& file); - virtual bool SaveFile(const wxString& file = wxEmptyString); - - // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // insert the character which would have resulted from this key event, - // return true if anything has been inserted - virtual bool EmulateKeyPress(const wxKeyEvent& event); - - // text control under some platforms supports the text styles: these - // methods allow to apply the given text style to the given selection or to - // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual const wxTextAttr& GetDefaultStyle() const; - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - - // find the character at position given in pixels - // - // NB: pt is in device coords (not adjusted for the client area origin nor - // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SelectAll(); - virtual void SetEditable(bool editable); - -#if 0 - - // override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - - // stream-like insertion operators: these are always available, whether we - // were, or not, compiled with streambuf support - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); -#endif - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - virtual bool ShouldInheritColours() const; - - // wxWindow overrides - virtual bool SetFont(const wxFont& font); - - // search control generic only - void SetSearchBitmap( const wxBitmap& bitmap ); - void SetCancelBitmap( const wxBitmap& bitmap ); -#if wxUSE_MENUS - void SetSearchMenuBitmap( const wxBitmap& bitmap ); -#endif // wxUSE_MENUS - -protected: - virtual void DoSetValue(const wxString& value, int flags = 0); - - // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void LayoutControls(int x, int y, int width, int height); - - virtual void RecalcBitmaps(); - - void Init(); - - virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop ); - virtual wxBitmap RenderCancelBitmap( int x, int y ); - - virtual void OnSearchButton( wxCommandEvent& event ); - - void OnSetFocus( wxFocusEvent& event ); - void OnSize( wxSizeEvent& event ); - - bool HasMenu() const - { -#if wxUSE_MENUS - return m_menu != NULL; -#else // !wxUSE_MENUS - return false; -#endif // wxUSE_MENUS/!wxUSE_MENUS - } - -private: - friend class wxSearchButton; - -#if wxUSE_MENUS - void PopupSearchMenu(); -#endif // wxUSE_MENUS - - // the subcontrols - wxSearchTextCtrl *m_text; - wxSearchButton *m_searchButton; - wxSearchButton *m_cancelButton; -#if wxUSE_MENUS - wxMenu *m_menu; -#endif // wxUSE_MENUS - - bool m_searchButtonVisible; - bool m_cancelButtonVisible; - - bool m_searchBitmapUser; - bool m_cancelBitmapUser; -#if wxUSE_MENUS - bool m_searchMenuBitmapUser; -#endif // wxUSE_MENUS - - wxBitmap m_searchBitmap; - wxBitmap m_cancelBitmap; -#if wxUSE_MENUS - wxBitmap m_searchMenuBitmap; -#endif // wxUSE_MENUS - -private: - DECLARE_DYNAMIC_CLASS(wxSearchCtrl) - - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_SEARCHCTRL - -#endif // _WX_GENERIC_SEARCHCTRL_H_ - diff --git a/Source/3rdParty/wx/include/wx/generic/statline.h b/Source/3rdParty/wx/include/wx/generic/statline.h deleted file mode 100644 index 4ad6f17fd..000000000 --- a/Source/3rdParty/wx/include/wx/generic/statline.h +++ /dev/null @@ -1,62 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: generic/statline.h -// Purpose: a generic wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATLINE_H_ -#define _WX_GENERIC_STATLINE_H_ - -class wxStaticBox; - -// ---------------------------------------------------------------------------- -// wxStaticLine -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLine : public wxStaticLineBase -{ - DECLARE_DYNAMIC_CLASS(wxStaticLine) - -public: - // constructors and pseudo-constructors - wxStaticLine() { m_statbox = NULL; } - - wxStaticLine( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - { - Create(parent, id, pos, size, style, name); - } - - virtual ~wxStaticLine(); - - bool Create( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - - // it's necessary to override this wxWindow function because we - // will want to return the main widget for m_statbox - // - WXWidget GetMainWidget() const; - - // override wxWindow methods to make things work - virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoMoveWindow(int x, int y, int width, int height); -protected: - // we implement the static line using a static box - wxStaticBox *m_statbox; -}; - -#endif // _WX_GENERIC_STATLINE_H_ - diff --git a/Source/3rdParty/wx/include/wx/generic/statusbr.h b/Source/3rdParty/wx/include/wx/generic/statusbr.h deleted file mode 100644 index 5934a9472..000000000 --- a/Source/3rdParty/wx/include/wx/generic/statusbr.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/statusbr.h -// Purpose: wxStatusBarGeneric class -// Author: Julian Smart -// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase -// Created: 01/02/97 -// RCS-ID: $Id: statusbr.h 41200 2006-09-13 19:10:31Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATUSBR_H_ -#define _WX_GENERIC_STATUSBR_H_ - -#include "wx/defs.h" - -#if wxUSE_STATUSBAR - -#include "wx/pen.h" -#include "wx/arrstr.h" - -class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase -{ -public: - wxStatusBarGeneric() { Init(); } - wxStatusBarGeneric(wxWindow *parent, - wxWindowID winid = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr) - { - Init(); - - Create(parent, winid, style, name); - } - - virtual ~wxStatusBarGeneric(); - - bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - // Create status line - virtual void SetFieldsCount(int number = 1, - const int *widths = (const int *) NULL); - - // Set status line text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // Set status line widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height); - - virtual int GetBorderX() const { return m_borderX; } - virtual int GetBorderY() const { return m_borderY; } - - //////////////////////////////////////////////////////////////////////// - // Implementation - - virtual void DrawFieldText(wxDC& dc, int i); - virtual void DrawField(wxDC& dc, int i); - - void SetBorderX(int x); - void SetBorderY(int y); - - void OnPaint(wxPaintEvent& event); - - void OnLeftDown(wxMouseEvent& event); - void OnRightDown(wxMouseEvent& event); - - virtual void InitColours(); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - // common part of all ctors - void Init(); - - wxArrayString m_statusStrings; - - // the last known width of the client rect (used to rebuild cache) - int m_lastClientWidth; - // the widths of the status bar panes in pixels - wxArrayInt m_widthsAbs; - - int m_borderX; - int m_borderY; - wxPen m_mediumShadowPen; - wxPen m_hilightPen; - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric) -}; - -#endif // wxUSE_STATUSBAR - -#endif - // _WX_GENERIC_STATUSBR_H_ diff --git a/Source/3rdParty/wx/include/wx/generic/textdlgg.h b/Source/3rdParty/wx/include/wx/generic/textdlgg.h deleted file mode 100644 index fab9a1012..000000000 --- a/Source/3rdParty/wx/include/wx/generic/textdlgg.h +++ /dev/null @@ -1,113 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: textdlgg.h -// Purpose: wxTextEntryDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textdlgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __TEXTDLGH_G__ -#define __TEXTDLGH_G__ - -#include "wx/defs.h" - -#if wxUSE_TEXTDLG - -#include "wx/dialog.h" - -#if wxUSE_VALIDATORS -#include "wx/valtext.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[]; - -#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) - -// ---------------------------------------------------------------------------- -// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextEntryDialog : public wxDialog -{ -public: - wxTextEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& value = wxEmptyString, - long style = wxTextEntryDialogStyle, - const wxPoint& pos = wxDefaultPosition); - - void SetValue(const wxString& val); - wxString GetValue() const { return m_value; } - -#if wxUSE_VALIDATORS - void SetTextValidator( const wxTextValidator& validator ); - void SetTextValidator( long style = wxFILTER_NONE ); - wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } -#endif - // wxUSE_VALIDATORS - - // implementation only - void OnOK(wxCommandEvent& event); - -protected: - wxTextCtrl *m_textctrl; - wxString m_value; - long m_dialogStyle; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) - DECLARE_NO_COPY_CLASS(wxTextEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog -{ -public: - wxPasswordEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxGetPasswordFromUserPromptStr, - const wxString& value = wxEmptyString, - long style = wxTextEntryDialogStyle, - const wxPoint& pos = wxDefaultPosition); -private: - DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) - DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// function to get a string from user -// ---------------------------------------------------------------------------- - -wxString WXDLLEXPORT -wxGetTextFromUser(const wxString& message, - const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = (wxWindow *) NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); - -wxString WXDLLEXPORT -wxGetPasswordFromUser(const wxString& message, - const wxString& caption = wxGetPasswordFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = (wxWindow *) NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); - -#endif - // wxUSE_TEXTDLG -#endif - // __TEXTDLGH_G__ diff --git a/Source/3rdParty/wx/include/wx/generic/timer.h b/Source/3rdParty/wx/include/wx/generic/timer.h deleted file mode 100644 index 0f52c1b4a..000000000 --- a/Source/3rdParty/wx/include/wx/generic/timer.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: timer.h -// Purpose: Generic implementation of wxTimer class -// Author: Vaclav Slavik -// Id: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef __WX_TIMER_H__ -#define __WX_TIMER_H__ - -//----------------------------------------------------------------------------- -// wxTimer -//----------------------------------------------------------------------------- - -class wxTimerDesc; - -class WXDLLEXPORT wxTimer : public wxTimerBase -{ -public: - wxTimer() { Init(); } - wxTimer(wxEvtHandler *owner, int timerid = -1) : wxTimerBase(owner, timerid) - { Init(); } - virtual ~wxTimer(); - - virtual bool Start(int millisecs = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const; - - // implementation - static void NotifyTimers(); - -protected: - void Init(); - -private: - wxTimerDesc *m_desc; - - DECLARE_ABSTRACT_CLASS(wxTimer) -}; - -#endif // __WX_TIMER_H__ diff --git a/Source/3rdParty/wx/include/wx/generic/treectlg.h b/Source/3rdParty/wx/include/wx/generic/treectlg.h deleted file mode 100644 index 818c8a31c..000000000 --- a/Source/3rdParty/wx/include/wx/generic/treectlg.h +++ /dev/null @@ -1,383 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/treectlg.h -// Purpose: wxTreeCtrl class -// Author: Robert Roebling -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: treectlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1997,1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _GENERIC_TREECTRL_H_ -#define _GENERIC_TREECTRL_H_ - -#if wxUSE_TREECTRL - -#include "wx/scrolwin.h" -#include "wx/pen.h" - -// ----------------------------------------------------------------------------- -// forward declaration -// ----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; - -class WXDLLIMPEXP_FWD_CORE wxTreeItemData; - -class WXDLLIMPEXP_FWD_CORE wxTreeRenameTimer; -class WXDLLIMPEXP_FWD_CORE wxTreeFindTimer; -class WXDLLIMPEXP_FWD_CORE wxTreeTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -// ----------------------------------------------------------------------------- -// wxGenericTreeCtrl - the tree control -// ----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericTreeCtrl : public wxTreeCtrlBase, - public wxScrollHelper -{ -public: - // creation - // -------- - - wxGenericTreeCtrl() : wxTreeCtrlBase(), wxScrollHelper(this) { Init(); } - - wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - : wxTreeCtrlBase(), - wxScrollHelper(this) - { - Init(); - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxGenericTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr); - - - // implement base class pure virtuals - // ---------------------------------- - - virtual unsigned int GetCount() const; - - virtual unsigned int GetIndent() const { return m_indent; } - virtual void SetIndent(unsigned int indent); - - - virtual void SetImageList(wxImageList *imageList); - virtual void SetStateImageList(wxImageList *imageList); - - virtual wxString GetItemText(const wxTreeItemId& item) const; - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; - virtual wxFont GetItemFont(const wxTreeItemId& item) const; - - virtual void SetItemText(const wxTreeItemId& item, const wxString& text); - virtual void SetItemImage(const wxTreeItemId& item, - int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); - - virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); - virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true); - virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); - - virtual bool IsVisible(const wxTreeItemId& item) const; - virtual bool ItemHasChildren(const wxTreeItemId& item) const; - virtual bool IsExpanded(const wxTreeItemId& item) const; - virtual bool IsSelected(const wxTreeItemId& item) const; - virtual bool IsBold(const wxTreeItemId& item) const; - - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const; - - // navigation - // ---------- - - virtual wxTreeItemId GetRootItem() const { return m_anchor; } - virtual wxTreeItemId GetSelection() const { return m_current; } - virtual size_t GetSelections(wxArrayTreeItemIds&) const; - - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetFirstVisibleItem() const; - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; - - - // operations - // ---------- - - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - virtual void Delete(const wxTreeItemId& item); - virtual void DeleteChildren(const wxTreeItemId& item); - virtual void DeleteAllItems(); - - virtual void Expand(const wxTreeItemId& item); - virtual void Collapse(const wxTreeItemId& item); - virtual void CollapseAndReset(const wxTreeItemId& item); - virtual void Toggle(const wxTreeItemId& item); - - virtual void Unselect(); - virtual void UnselectAll(); - virtual void SelectItem(const wxTreeItemId& item, bool select = true); - - virtual void EnsureVisible(const wxTreeItemId& item); - virtual void ScrollTo(const wxTreeItemId& item); - - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); - virtual wxTextCtrl *GetEditControl() const; - virtual void EndEditLabel(const wxTreeItemId& item, - bool discardChanges = false); - - virtual void SortChildren(const wxTreeItemId& item); - - // items geometry - // -------------- - - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const; - - - // this version specific methods - // ----------------------------- - - wxImageList *GetButtonsImageList() const { return m_imageListButtons; } - void SetButtonsImageList(wxImageList *imageList); - void AssignButtonsImageList(wxImageList *imageList); - - void SetDropEffectAboveItem( bool above = false ) { m_dropEffectAboveItem = above; } - bool GetDropEffectAboveItem() const { return m_dropEffectAboveItem; } - - wxTreeItemId GetNext(const wxTreeItemId& item) const; - -#if WXWIN_COMPATIBILITY_2_6 - // use EditLabel() instead - void Edit( const wxTreeItemId& item ) { EditLabel(item); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated functions: use Set/GetItemImage directly - wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); - wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); - - // use the versions taking wxTreeItemIdValue cookies (note that - // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we - // get twice as many warnings without any added benefit: it is always used - // with GetFirstChild() anyhow) - wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, - long& cookie) const ); - wxTreeItemId GetNextChild(const wxTreeItemId& item, - long& cookie) const; -#endif // WXWIN_COMPATIBILITY_2_4 - - // implementation only from now on - - // overridden base class virtuals - virtual bool SetBackgroundColour(const wxColour& colour); - virtual bool SetForegroundColour(const wxColour& colour); - - virtual void Freeze(); - virtual void Thaw(); - virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); - - virtual bool SetFont( const wxFont &font ); - virtual void SetWindowStyle(const long styles); - - // callbacks - void OnPaint( wxPaintEvent &event ); - void OnSetFocus( wxFocusEvent &event ); - void OnKillFocus( wxFocusEvent &event ); - void OnChar( wxKeyEvent &event ); - void OnMouse( wxMouseEvent &event ); - void OnGetToolTip( wxTreeEvent &event ); - void OnSize( wxSizeEvent &event ); - void OnInternalIdle( ); - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // implementation helpers - void AdjustMyScrollbars(); - - WX_FORWARD_TO_SCROLL_HELPER() - -protected: - friend class wxGenericTreeItem; - friend class wxTreeRenameTimer; - friend class wxTreeFindTimer; - friend class wxTreeTextCtrl; - - wxFont m_normalFont; - wxFont m_boldFont; - - wxGenericTreeItem *m_anchor; - wxGenericTreeItem *m_current, - *m_key_current, - // A hint to select a parent item after deleting a child - *m_select_me; - unsigned short m_indent; - int m_lineHeight; - wxPen m_dottedPen; - wxBrush *m_hilightBrush, - *m_hilightUnfocusedBrush; - bool m_hasFocus; - bool m_dirty; - bool m_ownsImageListButtons; - bool m_isDragging; // true between BEGIN/END drag events - bool m_lastOnSame; // last click on the same item as prev - wxImageList *m_imageListButtons; - - int m_freezeCount; - int m_dragCount; - wxPoint m_dragStart; - wxGenericTreeItem *m_dropTarget; - wxCursor m_oldCursor; // cursor is changed while dragging - wxGenericTreeItem *m_oldSelection; - wxGenericTreeItem *m_underMouse; // for visual effects - wxTreeTextCtrl *m_textCtrl; - - wxTimer *m_renameTimer; - - // incremental search data - wxString m_findPrefix; - wxTimer *m_findTimer; - - bool m_dropEffectAboveItem; - - // the common part of all ctors - void Init(); - - // misc helpers - void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); - - void DrawBorder(const wxTreeItemId& item); - void DrawLine(const wxTreeItemId& item, bool below); - void DrawDropEffect(wxGenericTreeItem *item); - - void DoSelectItem(const wxTreeItemId& id, - bool unselect_others = true, - bool extended_select = false); - - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t previous, - const wxString& text, - int image, - int selectedImage, - wxTreeItemData *data); - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; - - // called by wxTextTreeCtrl when it marks itself for deletion - void ResetTextControl(); - - // find the first item starting with the given prefix after the given item - wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const; - - bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); } - - void CalculateLineHeight(); - int GetLineHeight(wxGenericTreeItem *item) const; - void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y ); - void PaintItem( wxGenericTreeItem *item, wxDC& dc); - - void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ); - void CalculatePositions(); - void CalculateSize( wxGenericTreeItem *item, wxDC &dc ); - - void RefreshSubtree( wxGenericTreeItem *item ); - void RefreshLine( wxGenericTreeItem *item ); - - // redraw all selected items - void RefreshSelected(); - - // RefreshSelected() recursive helper - void RefreshSelectedUnder(wxGenericTreeItem *item); - - void OnRenameTimer(); - bool OnRenameAccept(wxGenericTreeItem *item, const wxString& value); - void OnRenameCancelled(wxGenericTreeItem *item); - - void FillArray(wxGenericTreeItem*, wxArrayTreeItemIds&) const; - void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 ); - bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); - bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); - void UnselectAllChildren( wxGenericTreeItem *item ); - void ChildrenClosing(wxGenericTreeItem* item); - - void DoDirtyProcessing(); - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) - DECLARE_NO_COPY_CLASS(wxGenericTreeCtrl) -}; - -#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) -/* - * wxTreeCtrl has to be a real class or we have problems with - * the run-time information. - */ - -class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl -{ - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) - -public: - wxTreeCtrl() {} - - wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - : wxGenericTreeCtrl(parent, id, pos, size, style, validator, name) - { - } -}; -#endif // !__WXMSW__ || __WXUNIVERSAL__ - -#endif // wxUSE_TREECTRL - -#endif // _GENERIC_TREECTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/geometry.h b/Source/3rdParty/wx/include/wx/geometry.h deleted file mode 100644 index c4e67817f..000000000 --- a/Source/3rdParty/wx/include/wx/geometry.h +++ /dev/null @@ -1,814 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/geometry.h -// Purpose: Common Geometry Classes -// Author: Stefan Csomor -// Modified by: -// Created: 08/05/99 -// RCS-ID: $Id: geometry.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GEOMETRY_H_ -#define _WX_GEOMETRY_H_ - -#include "wx/defs.h" - -#if wxUSE_GEOMETRY - -#include "wx/utils.h" -#include "wx/gdicmn.h" -#include "wx/math.h" - -class WXDLLIMPEXP_FWD_BASE wxDataInputStream; -class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; - -// clipping from Cohen-Sutherland - -enum wxOutCode -{ - wxInside = 0x00 , - wxOutLeft = 0x01 , - wxOutRight = 0x02 , - wxOutTop = 0x08 , - wxOutBottom = 0x04 -}; - -class WXDLLEXPORT wxPoint2DInt -{ -public : - inline wxPoint2DInt(); - inline wxPoint2DInt( wxInt32 x , wxInt32 y ); - inline wxPoint2DInt( const wxPoint2DInt &pt ); - inline wxPoint2DInt( const wxPoint &pt ); - - // noops for this class, just return the coords - inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; - inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; - - inline wxDouble GetVectorLength() const; - wxDouble GetVectorAngle() const; - inline void SetVectorLength( wxDouble length ); - void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxInt32 angle , wxInt32 length ); - // set the vector length to 1.0, preserving the angle - inline void Normalize(); - - inline wxDouble GetDistance( const wxPoint2DInt &pt ) const; - inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const; - inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const; - inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; - - // the reflection of this point - inline wxPoint2DInt operator-(); - - inline wxPoint2DInt& operator=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator*=(wxDouble n); - inline wxPoint2DInt& operator*=(wxInt32 n); - inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator/=(wxDouble n); - inline wxPoint2DInt& operator/=(wxInt32 n); - inline operator wxPoint() const; - inline bool operator==(const wxPoint2DInt& pt) const; - inline bool operator!=(const wxPoint2DInt& pt) const; - -#if wxUSE_STREAMS - void WriteTo( wxDataOutputStream &stream ) const; - void ReadFrom( wxDataInputStream &stream ); -#endif // wxUSE_STREAMS - - wxInt32 m_x; - wxInt32 m_y; -}; - -inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); - -inline wxPoint2DInt::wxPoint2DInt() -{ - m_x = 0; - m_y = 0; -} - -inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) -{ - m_x = x; - m_y = y; -} - -inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - -inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) -{ - m_x = pt.x; - m_y = pt.y; -} - -inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const -{ - if ( x ) - *x = m_x; - if ( y ) - *y = m_y; -} - -inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const -{ - GetFloor(x, y); -} - -inline wxDouble wxPoint2DInt::GetVectorLength() const -{ - // cast needed MIPSpro compiler under SGI - return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) ); -} - -inline void wxPoint2DInt::SetVectorLength( wxDouble length ) -{ - wxDouble before = GetVectorLength(); - m_x = (wxInt32)(m_x * length / before); - m_y = (wxInt32)(m_y * length / before); -} - -inline void wxPoint2DInt::Normalize() -{ - SetVectorLength( 1 ); -} - -inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const -{ - return sqrt( GetDistanceSquare( pt ) ); -} - -inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const -{ - return ( (wxDouble)(pt.m_x-m_x)*(pt.m_x-m_x) + (wxDouble)(pt.m_y-m_y)*(pt.m_y-m_y) ); -} - -inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const -{ - return ( m_x * vec.m_x + m_y * vec.m_y ); -} - -inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const -{ - return ( m_x * vec.m_y - vec.m_x * m_y ); -} - -inline wxPoint2DInt::operator wxPoint() const -{ - return wxPoint( m_x, m_y); -} - -inline wxPoint2DInt wxPoint2DInt::operator-() -{ - return wxPoint2DInt( -m_x, -m_y); -} - -inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) -{ - m_x = pt.m_x; - m_y = pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const -{ - return m_x == pt.m_x && m_y == pt.m_y; -} - -inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const -{ - return m_x != pt.m_x || m_y != pt.m_y; -} - -inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); -} - -inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); -} - - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); -} - -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) -{ - return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) -{ - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); -} - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) -{ - return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) -{ - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) -{ - return wxPoint2DInt( pt.m_x / n , pt.m_y / n ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) -{ - return wxPoint2DInt( (int) (pt.m_x / n) , (int) (pt.m_y / n) ); -} - -// wxPoint2Ds represent a point or a vector in a 2d coordinate system - -class WXDLLEXPORT wxPoint2DDouble -{ -public : - inline wxPoint2DDouble(); - inline wxPoint2DDouble( wxDouble x , wxDouble y ); - inline wxPoint2DDouble( const wxPoint2DDouble &pt ); - wxPoint2DDouble( const wxPoint2DInt &pt ) - { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } - wxPoint2DDouble( const wxPoint &pt ) - { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } - - // two different conversions to integers, floor and rounding - inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; - inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; - - inline wxDouble GetVectorLength() const; - wxDouble GetVectorAngle() const ; - void SetVectorLength( wxDouble length ); - void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxDouble angle , wxDouble length ); - // set the vector length to 1.0, preserving the angle - void Normalize(); - - inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const; - inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const; - inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const; - inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; - - // the reflection of this point - inline wxPoint2DDouble operator-(); - - inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator*=(wxDouble n); - inline wxPoint2DDouble& operator*=(wxInt32 n); - inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator/=(wxDouble n); - inline wxPoint2DDouble& operator/=(wxInt32 n); - - inline bool operator==(const wxPoint2DDouble& pt) const; - inline bool operator!=(const wxPoint2DDouble& pt) const; - - wxDouble m_x; - wxDouble m_y; -}; - -inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); -inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); - -inline wxPoint2DDouble::wxPoint2DDouble() -{ - m_x = 0.0; - m_y = 0.0; -} - -inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) -{ - m_x = x; - m_y = y; -} - -inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - -inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const -{ - *x = (wxInt32) floor( m_x ); - *y = (wxInt32) floor( m_y ); -} - -inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const -{ - *x = (wxInt32) floor( m_x + 0.5 ); - *y = (wxInt32) floor( m_y + 0.5); -} - -inline wxDouble wxPoint2DDouble::GetVectorLength() const -{ - return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ; -} - -inline void wxPoint2DDouble::SetVectorLength( wxDouble length ) -{ - wxDouble before = GetVectorLength() ; - m_x = (m_x * length / before) ; - m_y = (m_y * length / before) ; -} - -inline void wxPoint2DDouble::Normalize() -{ - SetVectorLength( 1 ); -} - -inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const -{ - return sqrt( GetDistanceSquare( pt ) ); -} - -inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const -{ - return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); -} - -inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const -{ - return ( m_x * vec.m_x + m_y * vec.m_y ); -} - -inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const -{ - return ( m_x * vec.m_y - vec.m_x * m_y ); -} - -inline wxPoint2DDouble wxPoint2DDouble::operator-() -{ - return wxPoint2DDouble( -m_x, -m_y); -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) -{ - m_x = pt.m_x; - m_y = pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt) -{ - m_x = m_x * pt.m_x; - m_y = m_y * pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt) -{ - m_x = m_x / pt.m_x; - m_y = m_y / pt.m_y; - return *this; -} - -inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const -{ - return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y); -} - -inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const -{ - return !(*this == pt); -} - -inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); -} - -inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); -} - - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); -} - -inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n) -{ - return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) -{ - return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); -} - -// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the -// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if -// left <= x < right and top <= m_y < bottom , thus it is a half open interval. - -class WXDLLEXPORT wxRect2DDouble -{ -public: - wxRect2DDouble() - { m_x = m_y = m_width = m_height = 0; } - wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h) - { m_x = x; m_y = y; m_width = w; m_height = h; } -/* - wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight); - wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size); - wxRect2DDouble(const wxRect2DDouble& rect); -*/ - // single attribute accessors - - inline wxPoint2DDouble GetPosition() - { return wxPoint2DDouble(m_x, m_y); } - inline wxSize GetSize() - { return wxSize((int) m_width, (int) m_height); } - - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately - - inline wxDouble GetLeft() const { return m_x; } - inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } - inline void MoveLeftTo( wxDouble n ) { m_x = n; } - inline wxDouble GetTop() const { return m_y; } - inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; } - inline void MoveTopTo( wxDouble n ) { m_y = n; } - inline wxDouble GetBottom() const { return m_y + m_height; } - inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);} - inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; } - inline wxDouble GetRight() const { return m_x + m_width; } - inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; } - inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; } - - inline wxPoint2DDouble GetLeftTop() const - { return wxPoint2DDouble( m_x , m_y ); } - inline void SetLeftTop( const wxPoint2DDouble &pt ) - { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } - inline void MoveLeftTopTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x; m_y = pt.m_y; } - inline wxPoint2DDouble GetLeftBottom() const - { return wxPoint2DDouble( m_x , m_y + m_height ); } - inline void SetLeftBottom( const wxPoint2DDouble &pt ) - { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } - inline void MoveLeftBottomTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x; m_y = pt.m_y - m_height; } - inline wxPoint2DDouble GetRightTop() const - { return wxPoint2DDouble( m_x+m_width , m_y ); } - inline void SetRightTop( const wxPoint2DDouble &pt ) - { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } - inline void MoveRightTopTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x - m_width; m_y = pt.m_y; } - inline wxPoint2DDouble GetRightBottom() const - { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); } - inline void SetRightBottom( const wxPoint2DDouble &pt ) - { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} - inline void MoveRightBottomTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } - inline wxPoint2DDouble GetCentre() const - { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); } - inline void SetCentre( const wxPoint2DDouble &pt ) - { MoveCentreTo( pt ); } // since this is impossible without moving... - inline void MoveCentreTo( const wxPoint2DDouble &pt ) - { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } - inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const - { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + - ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) + - ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + - ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); } - inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const - { return GetOutCode(pt) ; } - inline bool Contains( const wxPoint2DDouble &pt ) const - { return GetOutCode( pt ) == wxInside; } - inline bool Contains( const wxRect2DDouble &rect ) const - { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && - ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } - inline bool IsEmpty() const - { return m_width <= 0 || m_height <= 0; } - inline bool HaveEqualSize( const wxRect2DDouble &rect ) const - { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); } - - inline void Inset( wxDouble x , wxDouble y ) - { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } - inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom ) - { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} - inline void Offset( const wxPoint2DDouble &pt ) - { m_x += pt.m_x; m_y += pt.m_y; } - - void ConstrainTo( const wxRect2DDouble &rect ); - - inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) - { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } - - static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); - inline void Intersect( const wxRect2DDouble &otherRect ) - { Intersect( *this , otherRect , this ); } - inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const - { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; } - bool Intersects( const wxRect2DDouble &rect ) const; - - static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); - void Union( const wxRect2DDouble &otherRect ) - { Union( *this , otherRect , this ); } - void Union( const wxPoint2DDouble &pt ); - inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const - { wxRect2DDouble result; Union( *this , otherRect , &result); return result; } - - inline void Scale( wxDouble f ) - { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} - inline void Scale( wxInt32 num , wxInt32 denum ) - { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); - m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} - - wxRect2DDouble& operator = (const wxRect2DDouble& rect); - inline bool operator == (const wxRect2DDouble& rect) const - { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } - inline bool operator != (const wxRect2DDouble& rect) const - { return !(*this == rect); } - - wxDouble m_x; - wxDouble m_y; - wxDouble m_width; - wxDouble m_height; -}; - - -// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the -// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if -// left <= x < right and top <= m_y < bottom , thus it is a half open interval. - -class WXDLLEXPORT wxRect2DInt -{ -public: - wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } - wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; } - wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } - wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); - inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); - inline wxRect2DInt(const wxRect2DInt& rect); - - // single attribute accessors - - inline wxPoint2DInt GetPosition() { return wxPoint2DInt(m_x, m_y); } - inline wxSize GetSize() { return wxSize(m_width, m_height); } - - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately - - inline wxInt32 GetLeft() const { return m_x; } - inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } - inline void MoveLeftTo( wxInt32 n ) { m_x = n; } - inline wxInt32 GetTop() const { return m_y; } - inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; } - inline void MoveTopTo( wxInt32 n ) { m_y = n; } - inline wxInt32 GetBottom() const { return m_y + m_height; } - inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);} - inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; } - inline wxInt32 GetRight() const { return m_x + m_width; } - inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; } - inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; } - - inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); } - inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } - inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } - inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); } - inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } - inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } - inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); } - inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } - inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } - inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); } - inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} - inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } - inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); } - inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... - inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } - inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const - { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + - ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) + - ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + - ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); } - inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const - { return GetOutCode( pt ) ; } - inline bool Contains( const wxPoint2DInt &pt ) const - { return GetOutCode( pt ) == wxInside; } - inline bool Contains( const wxRect2DInt &rect ) const - { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && - ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } - inline bool IsEmpty() const - { return ( m_width <= 0 || m_height <= 0 ); } - inline bool HaveEqualSize( const wxRect2DInt &rect ) const - { return ( rect.m_width == m_width && rect.m_height == m_height ); } - - inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } - inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ) - { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} - inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } - void ConstrainTo( const wxRect2DInt &rect ); - inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } - - static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); - inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } - inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; } - bool Intersects( const wxRect2DInt &rect ) const; - - static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); - void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); } - void Union( const wxPoint2DInt &pt ); - inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; } - - inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} - inline void Scale( wxInt32 num , wxInt32 denum ) - { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); - m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} - - wxRect2DInt& operator = (const wxRect2DInt& rect); - bool operator == (const wxRect2DInt& rect) const; - bool operator != (const wxRect2DInt& rect) const; - -#if wxUSE_STREAMS - void WriteTo( wxDataOutputStream &stream ) const; - void ReadFrom( wxDataInputStream &stream ); -#endif // wxUSE_STREAMS - - wxInt32 m_x; - wxInt32 m_y; - wxInt32 m_width; - wxInt32 m_height; -}; - -inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; -} - -inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) -{ - m_x = wxMin( a.m_x , b.m_x ); - m_y = wxMin( a.m_y , b.m_y ); - m_width = abs( a.m_x - b.m_x ); - m_height = abs( a.m_y - b.m_y ); -} - -inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size) -{ - m_x = pos.m_x; - m_y = pos.m_y; - m_width = size.x; - m_height = size.y; -} - -inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const -{ - return (m_x==rect.m_x && m_y==rect.m_y && - m_width==rect.m_width && m_height==rect.m_height); -} - -inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const -{ - return !(*this == rect); -} - -class wxTransform2D -{ -public : - virtual ~wxTransform2D() { } - virtual void Transform( wxPoint2DInt* pt )const = 0; - virtual void Transform( wxRect2DInt* r ) const; - virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const; - virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ; - - virtual void InverseTransform( wxPoint2DInt* pt ) const = 0; - virtual void InverseTransform( wxRect2DInt* r ) const ; - virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ; - virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ; -}; - -inline void wxTransform2D::Transform( wxRect2DInt* r ) const - { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); Transform( &a ); Transform( &b ); *r = wxRect2DInt( a , b ); } - -inline wxPoint2DInt wxTransform2D::Transform( const wxPoint2DInt &pt ) const - { wxPoint2DInt res = pt; Transform( &res ); return res; } - -inline wxRect2DInt wxTransform2D::Transform( const wxRect2DInt &r ) const - { wxRect2DInt res = r; Transform( &res ); return res; } - -inline void wxTransform2D::InverseTransform( wxRect2DInt* r ) const - { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); InverseTransform( &a ); InverseTransform( &b ); *r = wxRect2DInt( a , b ); } - -inline wxPoint2DInt wxTransform2D::InverseTransform( const wxPoint2DInt &pt ) const - { wxPoint2DInt res = pt; InverseTransform( &res ); return res; } - -inline wxRect2DInt wxTransform2D::InverseTransform( const wxRect2DInt &r ) const - { wxRect2DInt res = r; InverseTransform( &res ); return res; } - - -#endif // wxUSE_GEOMETRY - -#endif // _WX_GEOMETRY_H_ diff --git a/Source/3rdParty/wx/include/wx/gifdecod.h b/Source/3rdParty/wx/include/wx/gifdecod.h deleted file mode 100644 index 3ada1a19d..000000000 --- a/Source/3rdParty/wx/include/wx/gifdecod.h +++ /dev/null @@ -1,110 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gifdecod.h -// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation -// Author: Guillermo Rodriguez Garcia -// Version: 3.02 -// CVS-ID: $Id: gifdecod.h 45563 2007-04-21 18:17:50Z VZ $ -// Copyright: (c) 1999 Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GIFDECOD_H_ -#define _WX_GIFDECOD_H_ - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_GIF - -#include "wx/stream.h" -#include "wx/image.h" -#include "wx/animdecod.h" -#include "wx/dynarray.h" - -// internal utility used to store a frame in 8bit-per-pixel format -class GIFImage; - - -// -------------------------------------------------------------------------- -// Constants -// -------------------------------------------------------------------------- - -// Error codes: -// Note that the error code wxGIF_TRUNCATED means that the image itself -// is most probably OK, but the decoder didn't reach the end of the data -// stream; this means that if it was not reading directly from file, -// the stream will not be correctly positioned. -// -enum wxGIFErrorCode -{ - wxGIF_OK = 0, // everything was OK - wxGIF_INVFORMAT, // error in GIF header - wxGIF_MEMERR, // error allocating memory - wxGIF_TRUNCATED // file appears to be truncated -}; - -// -------------------------------------------------------------------------- -// wxGIFDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxGIFDecoder : public wxAnimationDecoder -{ -public: - // constructor, destructor, etc. - wxGIFDecoder(); - ~wxGIFDecoder(); - - // get data of current frame - unsigned char* GetData(unsigned int frame) const; - unsigned char* GetPalette(unsigned int frame) const; - unsigned int GetNcolours(unsigned int frame) const; - int GetTransparentColourIndex(unsigned int frame) const; - wxColour GetTransparentColour(unsigned int frame) const; - - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; - - // GIFs can contain both static images and animations - bool IsAnimation() const - { return m_nFrames > 1; } - - // load function which returns more info than just Load(): - wxGIFErrorCode LoadGIF( wxInputStream& stream ); - - // free all internal frames - void Destroy(); - - // implementation of wxAnimationDecoder's pure virtuals - virtual bool CanRead( wxInputStream& stream ) const; - virtual bool Load( wxInputStream& stream ) - { return LoadGIF(stream) == wxGIF_OK; } - - bool ConvertToImage(unsigned int frame, wxImage *image) const; - - wxAnimationDecoder *Clone() const - { return new wxGIFDecoder; } - wxAnimationType GetType() const - { return wxANIMATION_TYPE_GIF; } - -private: - // array of all frames - wxArrayPtrVoid m_frames; - - // decoder state vars - int m_restbits; // remaining valid bits - unsigned int m_restbyte; // remaining bytes in this block - unsigned int m_lastbyte; // last byte read - unsigned char m_buffer[256]; // buffer for reading - unsigned char *m_bufp; // pointer to next byte in buffer - - int getcode(wxInputStream& stream, int bits, int abfin); - wxGIFErrorCode dgif(wxInputStream& stream, - GIFImage *img, int interl, int bits); - - DECLARE_NO_COPY_CLASS(wxGIFDecoder) -}; - -#endif // wxUSE_STREAM && wxUSE_GIF - -#endif // _WX_GIFDECOD_H_ diff --git a/Source/3rdParty/wx/include/wx/graphics.h b/Source/3rdParty/wx/include/wx/graphics.h deleted file mode 100644 index 6d4333bd2..000000000 --- a/Source/3rdParty/wx/include/wx/graphics.h +++ /dev/null @@ -1,735 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/graphics.h -// Purpose: graphics context header -// Author: Stefan Csomor -// Modified by: -// Created: -// Copyright: (c) Stefan Csomor -// RCS-ID: $Id: graphics.h 60190 2009-04-16 00:57:35Z KO $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRAPHICS_H_ -#define _WX_GRAPHICS_H_ - -#include "wx/defs.h" - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/geometry.h" -#include "wx/dynarray.h" - -class WXDLLIMPEXP_CORE wxWindowDC; -class WXDLLIMPEXP_CORE wxMemoryDC; -class WXDLLIMPEXP_CORE wxGraphicsContext; -class WXDLLIMPEXP_CORE wxGraphicsPath; -class WXDLLIMPEXP_CORE wxGraphicsMatrix; -class WXDLLIMPEXP_CORE wxGraphicsFigure; -class WXDLLIMPEXP_CORE wxGraphicsRenderer; -class WXDLLIMPEXP_CORE wxGraphicsPen; -class WXDLLIMPEXP_CORE wxGraphicsBrush; -class WXDLLIMPEXP_CORE wxGraphicsFont; -class WXDLLIMPEXP_CORE wxGraphicsBitmap; - -/* - * notes about the graphics context apis - * - * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being - * in direction of positive y axis. - */ - -// Base class of all objects used for drawing in the new graphics API, the always point back to their -// originating rendering engine, there is no dynamic unloading of a renderer currently allowed, -// these references are not counted - -// -// The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive -// duplication. Any operation on a shared instance that results in a modified state, uncouples this -// instance from the other instances that were shared - using copy on write semantics -// - -class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData -{ -public : - wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); - wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); - wxGraphicsRenderer* GetRenderer() const ; - virtual wxGraphicsObjectRefData* Clone() const ; - -protected : - wxGraphicsRenderer* m_renderer; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject -{ -public : - wxGraphicsObject() ; -#if wxABI_VERSION >= 20810 - wxGraphicsObject( const wxGraphicsObject& other) : wxObject( other ) {} - wxGraphicsObject& operator= (const wxGraphicsObject & other) { Ref(other); return *this;} -#endif - wxGraphicsObject( wxGraphicsRenderer* renderer ) ; - virtual ~wxGraphicsObject() ; - - bool IsNull() const ; - - // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet - wxGraphicsRenderer* GetRenderer() const ; - wxGraphicsObjectRefData* GetGraphicsData() const ; -protected : - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; - - DECLARE_DYNAMIC_CLASS(wxGraphicsObject) -} ; - -class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject -{ -public : - wxGraphicsPen() {} -#if wxABI_VERSION >= 20810 - wxGraphicsPen( const wxGraphicsPen& other) : wxGraphicsObject( other ) {} - wxGraphicsPen& operator= (const wxGraphicsPen & other) { Ref(other); return *this;} -#endif - virtual ~wxGraphicsPen() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsPen) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsPen) wxNullGraphicsPen; - -class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject -{ -public : - wxGraphicsBrush() {} -#if wxABI_VERSION >= 20810 - wxGraphicsBrush( const wxGraphicsBrush& other) : wxGraphicsObject( other ) {} - wxGraphicsBrush& operator= (const wxGraphicsBrush & other) { Ref(other); return *this;} -#endif - virtual ~wxGraphicsBrush() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsBrush) wxNullGraphicsBrush; - -class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject -{ -public : - wxGraphicsFont() {} -#if wxABI_VERSION >= 20810 - wxGraphicsFont( const wxGraphicsFont& other) : wxGraphicsObject( other ) {} - wxGraphicsFont& operator= (const wxGraphicsFont & other) { Ref(other); return *this;} -#endif - virtual ~wxGraphicsFont() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsFont) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont; - -class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject -{ -public : - wxGraphicsBitmap() {} -#if wxABI_VERSION >= 20810 - wxGraphicsBitmap( const wxGraphicsBitmap& other) : wxGraphicsObject( other ) {} - wxGraphicsBitmap& operator= (const wxGraphicsBitmap & other) { Ref(other); return *this;} -#endif - virtual ~wxGraphicsBitmap() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsBitmap) wxNullGraphicsBitmap; - -class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : - wxGraphicsObjectRefData(renderer) {} - - virtual ~wxGraphicsMatrixData() {} - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ) = 0; - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) = 0; - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; - - // makes this the inverse matrix - virtual void Invert() = 0; - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; - - // return true if this is the identity matrix - virtual bool IsIdentity() const = 0; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ) = 0; - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ) = 0; - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; - - // returns the native representation - virtual void * GetNativeMatrix() const = 0; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject -{ -public : - wxGraphicsMatrix() {} -#if wxABI_VERSION >= 20810 - wxGraphicsMatrix( const wxGraphicsMatrix& other) : wxGraphicsObject( other ) {} - wxGraphicsMatrix& operator= (const wxGraphicsMatrix & other) { Ref(other); return *this;} -#endif - - virtual ~wxGraphicsMatrix() {} - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrix *t ); - void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); } - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; - - // makes this the inverse matrix - virtual void Invert(); - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrix* t) const; - bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); } - - // return true if this is the identity matrix - virtual bool IsIdentity() const; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ); - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ); - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ); - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; - - // returns the native representation - virtual void * GetNativeMatrix() const; - - const wxGraphicsMatrixData* GetMatrixData() const - { return (const wxGraphicsMatrixData*) GetRefData(); } - wxGraphicsMatrixData* GetMatrixData() - { return (wxGraphicsMatrixData*) GetRefData(); } - -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsMatrix) wxNullGraphicsMatrix; - -class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} - virtual ~wxGraphicsPathData() {} - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; - - // adds another path - virtual void AddPath( const wxGraphicsPathData* path ) =0; - - // closes the current sub-path - virtual void CloseSubpath() = 0; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); - - // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - - // appends an ellipse - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // appends a rounded rectangle - virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // returns the native path - virtual void * GetNativePath() const = 0; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p) const= 0; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; - - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const=0; -}; - -class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject -{ -public : - wxGraphicsPath() {} -#if wxABI_VERSION >= 20810 - wxGraphicsPath( const wxGraphicsPath& other) : wxGraphicsObject( other ) {} - wxGraphicsPath& operator= (const wxGraphicsPath & other) { Ref(other); return *this;} -#endif - virtual ~wxGraphicsPath() {} - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ); - void MoveToPoint( const wxPoint2DDouble& p); - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ); - void AddLineToPoint( const wxPoint2DDouble& p); - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) ; - void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); - - // adds another path - virtual void AddPath( const wxGraphicsPath& path ); - - // closes the current sub-path - virtual void CloseSubpath() ; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; - wxPoint2DDouble GetCurrentPoint() const; - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; - void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); - - // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - - // appends an ellipse - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // appends a rounded rectangle - virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // returns the native path - virtual void * GetNativePath() const; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p)const; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrix& matrix ); - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const; - wxRect2DDouble GetBox()const; - - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE)const; - bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE)const; - - const wxGraphicsPathData* GetPathData() const - { return (const wxGraphicsPathData*) GetRefData(); } - wxGraphicsPathData* GetPathData() - { return (wxGraphicsPathData*) GetRefData(); } - -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsPath) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsPath) wxNullGraphicsPath; - - -class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject -{ -public: - wxGraphicsContext(wxGraphicsRenderer* renderer); - - virtual ~wxGraphicsContext(); - - static wxGraphicsContext* Create( const wxWindowDC& dc) ; - -#ifdef __WXMSW__ - static wxGraphicsContext * Create( const wxMemoryDC& dc) ; -#endif - - static wxGraphicsContext* CreateFromNative( void * context ) ; - - static wxGraphicsContext* CreateFromNativeWindow( void * window ) ; - - static wxGraphicsContext* Create( wxWindow* window ) ; - - // create a context that can be used for measuring texts only, no drawing allowed - static wxGraphicsContext * Create(); - - wxGraphicsPath CreatePath() const; - - virtual wxGraphicsPen CreatePen(const wxPen& pen) const; - - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const; - - // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 - virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) const; - - // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) - // with radius r and color cColor - virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) const; - - // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; - -#if wxABI_VERSION >= 20809 - wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const; -#endif - - //virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const; - - // create a 'native' matrix corresponding to these values - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) const; - - // push the current state of the context, ie the transformation matrix on a stack - virtual void PushState() = 0; - - // pops a stored state from the stack - virtual void PopState() = 0; - - // clips drawings to the region intersected with the current clipping region - virtual void Clip( const wxRegion ®ion ) = 0; - - // clips drawings to the rect intersected with the current clipping region - virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - // resets the clipping to original extent - virtual void ResetClip() = 0 ; - - // returns the native context - virtual void * GetNativeContext() = 0; - - // returns the current logical function - virtual int GetLogicalFunction() const { return m_logicalFunction; } - - // sets the current logical function, returns true if it supported - virtual bool SetLogicalFunction(int function) ; - - // - // transformation : changes the current transformation matrix CTM of the context - // - - // translate - virtual void Translate( wxDouble dx , wxDouble dy ) = 0; - - // scale - virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; - - // rotate (radians) - virtual void Rotate( wxDouble angle ) = 0; - - // concatenates this transform with the current transform of this context - virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0; - - // sets the transform of this context - virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0; - - // gets the matrix of this context - virtual wxGraphicsMatrix GetTransform() const = 0; - // - // setting the paint - // - - // sets the pen - virtual void SetPen( const wxGraphicsPen& pen ); - - void SetPen( const wxPen& pen ); - - // sets the brush for filling - virtual void SetBrush( const wxGraphicsBrush& brush ); - - void SetBrush( const wxBrush& brush ); - - // sets the font - virtual void SetFont( const wxGraphicsFont& font ); - - void SetFont( const wxFont& font, const wxColour& colour ); - - - // strokes along a path with the current pen - virtual void StrokePath( const wxGraphicsPath& path ) = 0; - - // fills a path with the current brush - virtual void FillPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ) = 0; - - // draws a path by first filling and then stroking - virtual void DrawPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ); - - // - // text - // - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y ) = 0; - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) ; - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ); - - virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const = 0; - - virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; - - // - // image support - // -#if wxABI_VERSION >= 20809 - void DrawGraphicsBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); -#endif - - virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - // - // convenience methods - // - - // strokes a single line - virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2); - - // stroke lines connecting each of the points - virtual void StrokeLines( size_t n, const wxPoint2DDouble *points); - - // stroke disconnected lines from begin to end points - virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); - - // draws a polygon - virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxODDEVEN_RULE ); - - // draws a polygon - virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // draws an ellipse - virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // draws a rounded rectangle - virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // wrappers using wxPoint2DDouble TODO - - // helper to determine if a 0.5 offset should be applied for the drawing operation - virtual bool ShouldOffset() const { return false; } - -protected : - - wxGraphicsPen m_pen; - wxGraphicsBrush m_brush; - wxGraphicsFont m_font; - int m_logicalFunction; - -private : - DECLARE_NO_COPY_CLASS(wxGraphicsContext) - DECLARE_ABSTRACT_CLASS(wxGraphicsContext) -}; - -#if 0 - -// -// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements -// - -class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject -{ -public : - wxGraphicsFigure(wxGraphicsRenderer* renderer) ; -#if wxABI_VERSION >= 20810 - wxGraphicsFigure( const wxGraphicsFigure& other) : wxGraphicsObject( other ) {} - wxGraphicsFigure& operator= (const wxGraphicsFigure & other) { Ref(other); return *this;} -#endif - - virtual ~wxGraphicsFigure() ; - - void SetPath( wxGraphicsMatrix* matrix ); - - void SetMatrix( wxGraphicsPath* path); - - // draws this object on the context - virtual void Draw( wxGraphicsContext* cg ); - - // returns the path of this object - wxGraphicsPath* GetPath() { return m_path; } - - // returns the transformation matrix of this object, may be null if there is no transformation necessary - wxGraphicsMatrix* GetMatrix() { return m_matrix; } - -private : - wxGraphicsMatrix* m_matrix; - wxGraphicsPath* m_path; - - DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) -} ; - -#endif - -// -// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer -// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional -// paths at any point from a given matrix etc. -// - -class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject -{ -public : - wxGraphicsRenderer() {} - - virtual ~wxGraphicsRenderer() {} - - static wxGraphicsRenderer* GetDefaultRenderer(); - -#if wxABI_VERSION >= 20811 - static wxGraphicsRenderer* GetCairoRenderer(); -#endif - // Context - - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; -#ifdef __WXMSW__ - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ; -#endif - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; - - virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; - - virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; - - // create a context that can be used for measuring texts only, no drawing allowed - virtual wxGraphicsContext * CreateMeasuringContext() = 0; - - // Path - - virtual wxGraphicsPath CreatePath() = 0; - - // Matrix - - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) = 0; - - // Paints - - virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0 ; - - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0 ; - - // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 - virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) = 0; - - // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) - // with radius r and color cColor - virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) = 0; - - // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; - -#if wxABI_VERSION >= 20809 - wxGraphicsBitmap CreateBitmap( const wxBitmap &bmp ); -#endif - -private : - DECLARE_NO_COPY_CLASS(wxGraphicsRenderer) - DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) -} ; - -#endif - -#endif // _WX_GRAPHICS_H_ diff --git a/Source/3rdParty/wx/include/wx/gsocket.h b/Source/3rdParty/wx/include/wx/gsocket.h deleted file mode 100644 index 83d8ee49b..000000000 --- a/Source/3rdParty/wx/include/wx/gsocket.h +++ /dev/null @@ -1,184 +0,0 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) - * Name: gsocket.h - * Author: Guilhem Lavaux - * Guillermo Rodriguez Garcia (maintainer) - * Copyright: (c) Guilhem Lavaux - * Licence: wxWindows Licence - * Purpose: GSocket include file (system independent) - * CVSID: $Id: gsocket.h 33948 2005-05-04 18:57:50Z JS $ - * ------------------------------------------------------------------------- - */ - -#ifndef __GSOCKET_H -#define __GSOCKET_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/defs.h" - -#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ - -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#include - -/* - Including sys/types.h under cygwin results in the warnings about "fd_set - having been defined in sys/types.h" when winsock.h is included later and - doesn't seem to be necessary anyhow. It's not needed under Mac neither. - */ -#if !defined(__WXMAC__) && !defined(__CYGWIN__) && !defined(__WXWINCE__) -#include -#endif - -#ifdef __WXWINCE__ -#include -#endif - -class GSocket; - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _GAddress GAddress; - -typedef enum { - GSOCK_NOFAMILY = 0, - GSOCK_INET, - GSOCK_INET6, - GSOCK_UNIX -} GAddressType; - -typedef enum { - GSOCK_STREAMED, - GSOCK_UNSTREAMED -} GSocketStream; - -typedef enum { - GSOCK_NOERROR = 0, - GSOCK_INVOP, - GSOCK_IOERR, - GSOCK_INVADDR, - GSOCK_INVSOCK, - GSOCK_NOHOST, - GSOCK_INVPORT, - GSOCK_WOULDBLOCK, - GSOCK_TIMEDOUT, - GSOCK_MEMERR, - GSOCK_OPTERR -} GSocketError; - -/* See below for an explanation on how events work. - */ -typedef enum { - GSOCK_INPUT = 0, - GSOCK_OUTPUT = 1, - GSOCK_CONNECTION = 2, - GSOCK_LOST = 3, - GSOCK_MAX_EVENT = 4 -} GSocketEvent; - -enum { - GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT, - GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT, - GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION, - GSOCK_LOST_FLAG = 1 << GSOCK_LOST -}; - -typedef int GSocketEventFlags; - -typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event, - char *cdata); - - -/* Functions tables for internal use by GSocket code: */ - -/* Actually this is a misnomer now, but reusing this name means I don't - have to ifdef app traits or common socket code */ -class GSocketGUIFunctionsTable -{ -public: - // needed since this class declares virtual members - virtual ~GSocketGUIFunctionsTable() { } - virtual bool OnInit() = 0; - virtual void OnExit() = 0; - virtual bool CanUseEventLoop() = 0; - virtual bool Init_Socket(GSocket *socket) = 0; - virtual void Destroy_Socket(GSocket *socket) = 0; -#ifndef __WINDOWS__ - virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0; - virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0; -#endif - virtual void Enable_Events(GSocket *socket) = 0; - virtual void Disable_Events(GSocket *socket) = 0; -}; - - -/* Global initializers */ - -/* Sets GUI functions callbacks. Must be called *before* GSocket_Init - if the app uses async sockets. */ -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc); - -/* GSocket_Init() must be called at the beginning */ -int GSocket_Init(void); - -/* GSocket_Cleanup() must be called at the end */ -void GSocket_Cleanup(void); - - -/* Constructors / Destructors */ - -GSocket *GSocket_new(void); - - -/* GAddress */ - -GAddress *GAddress_new(void); -GAddress *GAddress_copy(GAddress *address); -void GAddress_destroy(GAddress *address); - -void GAddress_SetFamily(GAddress *address, GAddressType type); -GAddressType GAddress_GetFamily(GAddress *address); - -/* The use of any of the next functions will set the address family to - * the specific one. For example if you use GAddress_INET_SetHostName, - * address family will be implicitly set to AF_INET. - */ - -GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname); -GSocketError GAddress_INET_SetAnyAddress(GAddress *address); -GSocketError GAddress_INET_SetHostAddress(GAddress *address, - unsigned long hostaddr); -GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, - const char *protocol); -GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port); - -GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, - size_t sbuf); -unsigned long GAddress_INET_GetHostAddress(GAddress *address); -unsigned short GAddress_INET_GetPort(GAddress *address); - -/* TODO: Define specific parts (INET6, UNIX) */ - -GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path); -GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -# if defined(__WINDOWS__) -# include "wx/msw/gsockmsw.h" -# elif defined(__WXMAC__) && !defined(__DARWIN__) -# include "wx/mac/gsockmac.h" -# else -# include "wx/unix/gsockunx.h" -# endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCKET_H */ diff --git a/Source/3rdParty/wx/include/wx/hash.h b/Source/3rdParty/wx/include/wx/hash.h deleted file mode 100644 index 9937bbe4e..000000000 --- a/Source/3rdParty/wx/include/wx/hash.h +++ /dev/null @@ -1,630 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hash.h -// Purpose: wxHashTable class -// Author: Julian Smart -// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() -// Created: 01/02/97 -// RCS-ID: $Id: hash.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASH_H__ -#define _WX_HASH_H__ - -#include "wx/defs.h" - -#if !wxUSE_STL && WXWIN_COMPATIBILITY_2_4 - #define wxUSE_OLD_HASH_TABLE 1 -#else - #define wxUSE_OLD_HASH_TABLE 0 -#endif - -#if !wxUSE_STL - #include "wx/object.h" -#else - class WXDLLIMPEXP_BASE wxObject; -#endif -#if wxUSE_OLD_HASH_TABLE - #include "wx/list.h" -#endif -#if WXWIN_COMPATIBILITY_2_4 - #include "wx/dynarray.h" -#endif - -// the default size of the hash -#define wxHASH_SIZE_DEFAULT (1000) - -/* - * A hash table is an array of user-definable size with lists - * of data items hanging off the array positions. Usually there'll - * be a hit, so no search is required; otherwise we'll have to run down - * the list to find the desired item. -*/ - -// ---------------------------------------------------------------------------- -// this is the base class for object hashes: hash tables which contain -// pointers to objects -// ---------------------------------------------------------------------------- - -#if wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTableBase : public wxObject -{ -public: - wxHashTableBase(); - - void Create(wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT); - void Destroy(); - - size_t GetSize() const { return m_hashSize; } - size_t GetCount() const { return m_count; } - - void DeleteContents(bool flag); - -protected: - // find the node for (key, value) - wxNodeBase *GetNode(long key, long value) const; - - // the array of lists in which we store the values for given key hash - wxListBase **m_hashTable; - - // the size of m_lists array - size_t m_hashSize; - - // the type of indexing we use - wxKeyType m_keyType; - - // the total number of elements in the hash - size_t m_count; - - // should we delete our data? - bool m_deleteContents; - -private: - // no copy ctor/assignment operator (yet) - DECLARE_NO_COPY_CLASS(wxHashTableBase) -}; - -#else // if !wxUSE_OLD_HASH_TABLE - -#if !defined(wxENUM_KEY_TYPE_DEFINED) -#define wxENUM_KEY_TYPE_DEFINED - -enum wxKeyType -{ - wxKEY_NONE, - wxKEY_INTEGER, - wxKEY_STRING -}; - -#endif - -union wxHashKeyValue -{ - long integer; - wxChar *string; -}; - -// for some compilers (AIX xlC), defining it as friend inside the class is not -// enough, so provide a real forward declaration -class WXDLLIMPEXP_FWD_BASE wxHashTableBase; - -class WXDLLIMPEXP_BASE wxHashTableBase_Node -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase; - typedef class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node _Node; -public: - wxHashTableBase_Node( long key, void* value, - wxHashTableBase* table ); - wxHashTableBase_Node( const wxChar* key, void* value, - wxHashTableBase* table ); - ~wxHashTableBase_Node(); - - long GetKeyInteger() const { return m_key.integer; } - const wxChar* GetKeyString() const { return m_key.string; } - - void* GetData() const { return m_value; } - void SetData( void* data ) { m_value = data; } - -protected: - _Node* GetNext() const { return m_next; } - -protected: - // next node in the chain - wxHashTableBase_Node* m_next; - - // key - wxHashKeyValue m_key; - - // value - void* m_value; - - // pointer to the hash containing the node, used to remove the - // node from the hash when the user deletes the node iterating - // through it - // TODO: move it to wxHashTable_Node (only wxHashTable supports - // iteration) - wxHashTableBase* m_hashPtr; -}; - -class WXDLLIMPEXP_BASE wxHashTableBase -#if !wxUSE_STL - : public wxObject -#endif -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node; -public: - typedef wxHashTableBase_Node Node; - - wxHashTableBase(); - virtual ~wxHashTableBase() { } - - void Create( wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT ); - void Clear(); - void Destroy(); - - size_t GetSize() const { return m_size; } - size_t GetCount() const { return m_count; } - - void DeleteContents( bool flag ) { m_deleteContents = flag; } - - static long MakeKey(const wxChar *string); - -protected: - void DoPut( long key, long hash, void* data ); - void DoPut( const wxChar* key, long hash, void* data ); - void* DoGet( long key, long hash ) const; - void* DoGet( const wxChar* key, long hash ) const; - void* DoDelete( long key, long hash ); - void* DoDelete( const wxChar* key, long hash ); - -private: - // Remove the node from the hash, *only called from - // ~wxHashTable*_Node destructor - void DoRemoveNode( wxHashTableBase_Node* node ); - - // destroys data contained in the node if appropriate: - // deletes the key if it is a string and destrys - // the value if m_deleteContents is true - void DoDestroyNode( wxHashTableBase_Node* node ); - - // inserts a node in the table (at the end of the chain) - void DoInsertNode( size_t bucket, wxHashTableBase_Node* node ); - - // removes a node from the table (fiven a pointer to the previous - // but does not delete it (only deletes its contents) - void DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, - wxHashTableBase_Node* prev ); - - // unconditionally deletes node value (invoking the - // correct destructor) - virtual void DoDeleteContents( wxHashTableBase_Node* node ) = 0; - -protected: - // number of buckets - size_t m_size; - - // number of nodes (key/value pairs) - size_t m_count; - - // table - Node** m_table; - - // key typ (INTEGER/STRING) - wxKeyType m_keyType; - - // delete contents when hash is cleared - bool m_deleteContents; - -private: - DECLARE_NO_COPY_CLASS(wxHashTableBase) -}; - -#endif // wxUSE_OLD_HASH_TABLE - -#if !wxUSE_STL - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// a hash table which stores longs -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxHashTableLong : public wxObject -{ -public: - wxHashTableLong(size_t size = wxHASH_SIZE_DEFAULT) - { Init(size); } - virtual ~wxHashTableLong(); - - void Create(size_t size = wxHASH_SIZE_DEFAULT); - void Destroy(); - - size_t GetSize() const { return m_hashSize; } - size_t GetCount() const { return m_count; } - - void Put(long key, long value); - long Get(long key) const; - long Delete(long key); - -protected: - void Init(size_t size); - -private: - wxArrayLong **m_values, - **m_keys; - - // the size of array above - size_t m_hashSize; - - // the total number of elements in the hash - size_t m_count; - - // not implemented yet - DECLARE_NO_COPY_CLASS(wxHashTableLong) -}; - -// ---------------------------------------------------------------------------- -// wxStringHashTable: a hash table which indexes strings with longs -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringHashTable : public wxObject -{ -public: - wxStringHashTable(size_t sizeTable = wxHASH_SIZE_DEFAULT); - virtual ~wxStringHashTable(); - - // add a string associated with this key to the table - void Put(long key, const wxString& value); - - // get the string from the key: if not found, an empty string is returned - // and the wasFound is set to false if not NULL - wxString Get(long key, bool *wasFound = NULL) const; - - // remove the item, returning true if the item was found and deleted - bool Delete(long key) const; - - // clean up - void Destroy(); - -private: - wxArrayLong **m_keys; - wxArrayString **m_values; - - // the size of array above - size_t m_hashSize; - - DECLARE_NO_COPY_CLASS(wxStringHashTable) -}; - -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// for compatibility only -// ---------------------------------------------------------------------------- - -#if !wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTable; -public: - wxHashTable_Node( long key, void* value, - wxHashTableBase* table ) - : wxHashTableBase_Node( key, value, table ) { } - wxHashTable_Node( const wxChar* key, void* value, - wxHashTableBase* table ) - : wxHashTableBase_Node( key, value, table ) { } - - wxObject* GetData() const - { return (wxObject*)wxHashTableBase_Node::GetData(); } - void SetData( wxObject* data ) - { wxHashTableBase_Node::SetData( data ); } - - wxHashTable_Node* GetNext() const - { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); } -}; - -// should inherit protectedly, but it is public for compatibility in -// order to publicly inherit from wxObject -class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase -{ - typedef wxHashTableBase hash; -public: - typedef wxHashTable_Node Node; - typedef wxHashTable_Node* compatibility_iterator; -public: - wxHashTable( wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT ) - : wxHashTableBase() { Create( keyType, size ); BeginFind(); } - wxHashTable( const wxHashTable& table ); - - virtual ~wxHashTable() { Destroy(); } - - const wxHashTable& operator=( const wxHashTable& ); - - // key and value are the same - void Put(long value, wxObject *object) - { DoPut( value, value, object ); } - void Put(long lhash, long value, wxObject *object) - { DoPut( value, lhash, object ); } - void Put(const wxChar *value, wxObject *object) - { DoPut( value, MakeKey( value ), object ); } - void Put(long lhash, const wxChar *value, wxObject *object) - { DoPut( value, lhash, object ); } - - // key and value are the same - wxObject *Get(long value) const - { return (wxObject*)DoGet( value, value ); } - wxObject *Get(long lhash, long value) const - { return (wxObject*)DoGet( value, lhash ); } - wxObject *Get(const wxChar *value) const - { return (wxObject*)DoGet( value, MakeKey( value ) ); } - wxObject *Get(long lhash, const wxChar *value) const - { return (wxObject*)DoGet( value, lhash ); } - - // Deletes entry and returns data if found - wxObject *Delete(long key) - { return (wxObject*)DoDelete( key, key ); } - wxObject *Delete(long lhash, long key) - { return (wxObject*)DoDelete( key, lhash ); } - wxObject *Delete(const wxChar *key) - { return (wxObject*)DoDelete( key, MakeKey( key ) ); } - wxObject *Delete(long lhash, const wxChar *key) - { return (wxObject*)DoDelete( key, lhash ); } - - // Construct your own integer key from a string, e.g. in case - // you need to combine it with something - long MakeKey(const wxChar *string) const - { return wxHashTableBase::MakeKey(string); } - - // Way of iterating through whole hash table (e.g. to delete everything) - // Not necessary, of course, if you're only storing pointers to - // objects maintained separately - void BeginFind() { m_curr = NULL; m_currBucket = 0; } - Node* Next(); - - void Clear() { wxHashTableBase::Clear(); } - - size_t GetCount() const { return wxHashTableBase::GetCount(); } -protected: - // copy helper - void DoCopy( const wxHashTable& copy ); - - // searches the next node starting from bucket bucketStart and sets - // m_curr to it and m_currBucket to its bucket - void GetNextNode( size_t bucketStart ); -private: - virtual void DoDeleteContents( wxHashTableBase_Node* node ); - - // current node - Node* m_curr; - - // bucket the current node belongs to - size_t m_currBucket; -}; - -#else // if wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTable : public wxObject -{ -public: - typedef wxNode Node; - typedef wxNode* compatibility_iterator; - - int n; - int current_position; - wxNode *current_node; - - unsigned int key_type; - wxList **hash_table; - - wxHashTable(int the_key_type = wxKEY_INTEGER, - int size = wxHASH_SIZE_DEFAULT); - virtual ~wxHashTable(); - - // copy ctor and assignment operator - wxHashTable(const wxHashTable& table) : wxObject() - { DoCopy(table); } - wxHashTable& operator=(const wxHashTable& table) - { Clear(); DoCopy(table); return *this; } - - void DoCopy(const wxHashTable& table); - - void Destroy(); - - bool Create(int the_key_type = wxKEY_INTEGER, - int size = wxHASH_SIZE_DEFAULT); - - // Note that there are 2 forms of Put, Get. - // With a key and a value, the *value* will be checked - // when a collision is detected. Otherwise, if there are - // 2 items with a different value but the same key, - // we'll retrieve the WRONG ONE. So where possible, - // supply the required value along with the key. - // In fact, the value-only versions make a key, and still store - // the value. The use of an explicit key might be required - // e.g. when combining several values into one key. - // When doing that, it's highly likely we'll get a collision, - // e.g. 1 + 2 = 3, 2 + 1 = 3. - - // key and value are NOT necessarily the same - void Put(long key, long value, wxObject *object); - void Put(long key, const wxChar *value, wxObject *object); - - // key and value are the same - void Put(long value, wxObject *object); - void Put(const wxChar *value, wxObject *object); - - // key and value not the same - wxObject *Get(long key, long value) const; - wxObject *Get(long key, const wxChar *value) const; - - // key and value are the same - wxObject *Get(long value) const; - wxObject *Get(const wxChar *value) const; - - // Deletes entry and returns data if found - wxObject *Delete(long key); - wxObject *Delete(const wxChar *key); - - wxObject *Delete(long key, int value); - wxObject *Delete(long key, const wxChar *value); - - // Construct your own integer key from a string, e.g. in case - // you need to combine it with something - long MakeKey(const wxChar *string) const; - - // Way of iterating through whole hash table (e.g. to delete everything) - // Not necessary, of course, if you're only storing pointers to - // objects maintained separately - - void BeginFind(); - Node* Next(); - - void DeleteContents(bool flag); - void Clear(); - - // Returns number of nodes - size_t GetCount() const { return m_count; } - -private: - size_t m_count; // number of elements in the hashtable - bool m_deleteContents; - - DECLARE_DYNAMIC_CLASS(wxHashTable) -}; - -#endif // wxUSE_OLD_HASH_TABLE - -#if !wxUSE_OLD_HASH_TABLE - -// defines a new type safe hash table which stores the elements of type eltype -// in lists of class listclass -#define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \ - classexp hashclass : public wxHashTableBase \ - { \ - public: \ - hashclass(wxKeyType keyType = wxKEY_INTEGER, \ - size_t size = wxHASH_SIZE_DEFAULT) \ - : wxHashTableBase() { Create(keyType, size); } \ - \ - virtual ~hashclass() { Destroy(); } \ - \ - void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \ - void Put(long lhash, long key, eltype *data) \ - { DoPut(key, lhash, (void*)data); } \ - eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \ - eltype *Get(long lhash, long key) const \ - { return (eltype*)DoGet(key, lhash); } \ - eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \ - eltype *Delete(long lhash, long key) \ - { return (eltype*)DoDelete(key, lhash); } \ - private: \ - virtual void DoDeleteContents( wxHashTableBase_Node* node ) \ - { delete (eltype*)node->GetData(); } \ - \ - DECLARE_NO_COPY_CLASS(hashclass) \ - } - -#else // if wxUSE_OLD_HASH_TABLE - -#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \ - classexp hashclass : public wxHashTableBase \ - { \ - public: \ - hashclass(wxKeyType keyType = wxKEY_INTEGER, \ - size_t size = wxHASH_SIZE_DEFAULT) \ - { Create(keyType, size); } \ - \ - virtual ~hashclass() { Destroy(); } \ - \ - void Put(long key, long val, eltype *data) { DoPut(key, val, data); } \ - void Put(long key, eltype *data) { DoPut(key, key, data); } \ - \ - eltype *Get(long key, long value) const \ - { \ - wxNodeBase *node = GetNode(key, value); \ - return node ? ((listclass::Node *)node)->GetData() : (eltype *)0; \ - } \ - eltype *Get(long key) const { return Get(key, key); } \ - \ - eltype *Delete(long key, long value) \ - { \ - eltype *data; \ - \ - wxNodeBase *node = GetNode(key, value); \ - if ( node ) \ - { \ - data = ((listclass::Node *)node)->GetData(); \ - \ - delete node; \ - m_count--; \ - } \ - else \ - { \ - data = (eltype *)0; \ - } \ - \ - return data; \ - } \ - eltype *Delete(long key) { return Delete(key, key); } \ - \ - protected: \ - void DoPut(long key, long value, eltype *data) \ - { \ - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); \ - \ - if ( !m_hashTable[slot] ) \ - { \ - m_hashTable[slot] = new listclass(m_keyType); \ - if ( m_deleteContents ) \ - m_hashTable[slot]->DeleteContents(true); \ - } \ - \ - ((listclass *)m_hashTable[slot])->Append(value, data); \ - m_count++; \ - } \ - \ - DECLARE_NO_COPY_CLASS(hashclass) \ - } - -#endif // wxUSE_OLD_HASH_TABLE - -// this macro is to be used in the user code -#define WX_DECLARE_HASH(el, list, hash) \ - _WX_DECLARE_HASH(el, list, hash, class) - -// and this one does exactly the same thing but should be used inside the -// library -#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ - _WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \ - _WX_DECLARE_HASH(el, list, hash, class usergoo) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_TABLE(hash) \ - { \ - (hash).BeginFind(); \ - wxHashTable::compatibility_iterator it = (hash).Next(); \ - while( it ) \ - { \ - delete it->GetData(); \ - it = (hash).Next(); \ - } \ - (hash).Clear(); \ - } - -#endif - // _WX_HASH_H__ diff --git a/Source/3rdParty/wx/include/wx/hashmap.h b/Source/3rdParty/wx/include/wx/hashmap.h deleted file mode 100644 index 44b081fb3..000000000 --- a/Source/3rdParty/wx/include/wx/hashmap.h +++ /dev/null @@ -1,739 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hashmap.h -// Purpose: wxHashMap class -// Author: Mattia Barbon -// Modified by: -// Created: 29/01/2002 -// RCS-ID: $Id: hashmap.h 57388 2008-12-17 09:34:48Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASHMAP_H_ -#define _WX_HASHMAP_H_ - -#include "wx/string.h" - -// In wxUSE_STL build we prefer to use the standard hash map class but it can -// be either in non-standard hash_map header (old g++ and some other STL -// implementations) or in C++0x standard unordered_map which can in turn be -// available either in std::tr1 or std namespace itself -// -// To summarize: if std::unordered_map is available use it, otherwise use tr1 -// and finally fall back to non-standard hash_map - -#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \ - && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP)) - #define HAVE_STL_HASH_MAP -#endif - -#if wxUSE_STL && \ - (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP)) - -#if defined(HAVE_STD_UNORDERED_MAP) - #include - #define WX_HASH_MAP_NAMESPACE std -#elif defined(HAVE_TR1_UNORDERED_MAP) - #include - #define WX_HASH_MAP_NAMESPACE std::tr1 -#endif - -#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ - typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME - -#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) - -#if defined(HAVE_EXT_HASH_MAP) - #include -#elif defined(HAVE_HASH_MAP) - #include -#endif - -#if defined(HAVE_GNU_CXX_HASH_MAP) - #define WX_HASH_MAP_NAMESPACE __gnu_cxx -#elif defined(HAVE_STD_HASH_MAP) - #define WX_HASH_MAP_NAMESPACE std -#endif - -#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ - typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME - -#else // !wxUSE_STL || no std::{hash,unordered}_map class available - -#define wxNEEDS_WX_HASH_MAP - -#ifdef __WXWINCE__ -typedef int ptrdiff_t; -#else -#include // for ptrdiff_t -#endif - -// private -struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase -{ - _wxHashTable_NodeBase() : m_nxt(0) {} - - _wxHashTable_NodeBase* m_nxt; - -// Cannot do this: -// DECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase) -// without rewriting the macros, which require a public copy constructor. -}; - -// private -class WXDLLIMPEXP_BASE _wxHashTableBase2 -{ -public: - typedef void (*NodeDtor)(_wxHashTable_NodeBase*); - typedef unsigned long (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); - typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); -protected: - static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); - static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table, - NodeDtor dtor ); - static _wxHashTable_NodeBase* GetFirstNode( size_t buckets, - _wxHashTable_NodeBase** table ) - { - for( size_t i = 0; i < buckets; ++i ) - if( table[i] ) - return table[i]; - return 0; - } - - // as static const unsigned prime_count = 31 but works with all compilers - enum { prime_count = 31 }; - static const unsigned long ms_primes[prime_count]; - - // returns the first prime in ms_primes greater than n - static unsigned long GetNextPrime( unsigned long n ); - - // returns the first prime in ms_primes smaller than n - // ( or ms_primes[0] if n is very small ) - static unsigned long GetPreviousPrime( unsigned long n ); - - static void CopyHashTable( _wxHashTable_NodeBase** srcTable, - size_t srcBuckets, _wxHashTableBase2* dst, - _wxHashTable_NodeBase** dstTable, - BucketFromNode func, ProcessNode proc ); - - static void** AllocTable( size_t sz ) - { - return (void **)calloc(sz, sizeof(void*)); - } - static void FreeTable(void *table) - { - free(table); - } -}; - -#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T, CLASSNAME, CLASSEXP, SHOULD_GROW, SHOULD_SHRINK ) \ -CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ -{ \ -public: \ - typedef KEY_T key_type; \ - typedef VALUE_T value_type; \ - typedef HASH_T hasher; \ - typedef KEY_EQ_T key_equal; \ - \ - typedef size_t size_type; \ - typedef ptrdiff_t difference_type; \ - typedef value_type* pointer; \ - typedef const value_type* const_pointer; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - /* should these be protected? */ \ - typedef const KEY_T const_key_type; \ - typedef const VALUE_T const_mapped_type; \ -public: \ - struct Node; \ - typedef KEY_EX_T key_extractor; \ - typedef CLASSNAME Self; \ -protected: \ - Node** m_table; \ - size_t m_tableBuckets; \ - size_t m_items; \ - hasher m_hasher; \ - key_equal m_equals; \ - key_extractor m_getKey; \ -public: \ - struct Node:public _wxHashTable_NodeBase \ - { \ - public: \ - Node( const value_type& value ) \ - : m_value( value ) {} \ - Node* m_next() { return (Node*)this->m_nxt; } \ - \ - value_type m_value; \ - }; \ - \ - CLASSEXP Iterator; \ - friend CLASSEXP Iterator; \ -protected: \ - static void DeleteNode( _wxHashTable_NodeBase* node ) \ - { \ - delete (Node*)node; \ - } \ -public: \ - /* */ \ - /* forward iterator */ \ - /* */ \ - CLASSEXP Iterator \ - { \ - public: \ - Node* m_node; \ - Self* m_ht; \ - \ - Iterator() : m_node(0), m_ht(0) {} \ - Iterator( Node* node, const Self* ht ) \ - : m_node(node), m_ht((Self*)ht) {} \ - bool operator ==( const Iterator& it ) const \ - { return m_node == it.m_node; } \ - bool operator !=( const Iterator& it ) const \ - { return m_node != it.m_node; } \ - protected: \ - Node* GetNextNode() \ - { \ - size_type bucket = GetBucketForNode(m_ht,m_node); \ - for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ - { \ - if( m_ht->m_table[i] ) \ - return m_ht->m_table[i]; \ - } \ - return 0; \ - } \ - \ - void PlusPlus() \ - { \ - Node* next = m_node->m_next(); \ - m_node = next ? next : GetNextNode(); \ - } \ - }; \ - \ -public: \ - CLASSEXP iterator : public Iterator \ - { \ - public: \ - iterator() : Iterator() {} \ - iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \ - iterator& operator++() { PlusPlus(); return *this; } \ - iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ - reference operator *() const { return m_node->m_value; } \ - pointer operator ->() const { return &(m_node->m_value); } \ - }; \ - \ - CLASSEXP const_iterator : public Iterator \ - { \ - public: \ - const_iterator() : Iterator() {} \ - const_iterator(iterator i) : Iterator(i) {} \ - const_iterator( Node* node, const Self* ht ) \ - : Iterator( node, (Self*)ht ) {} \ - const_iterator& operator++() { PlusPlus();return *this; } \ - const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ - const_reference operator *() const { return m_node->m_value; } \ - const_pointer operator ->() const { return &(m_node->m_value); } \ - }; \ - \ - CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ - const key_equal& k_eq = key_equal(), \ - const key_extractor& k_ex = key_extractor() ) \ - : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ - m_items( 0 ), \ - m_hasher( hfun ), \ - m_equals( k_eq ), \ - m_getKey( k_ex ) \ - { \ - m_table = (Node**)AllocTable( m_tableBuckets ); \ - } \ - \ - CLASSNAME( const Self& ht ) \ - : m_table( 0 ), \ - m_tableBuckets( 0 ), \ - m_items( ht.m_items ), \ - m_hasher( ht.m_hasher ), \ - m_equals( ht.m_equals ), \ - m_getKey( ht.m_getKey ) \ - { \ - HashCopy( ht ); \ - } \ - \ - const Self& operator=( const Self& ht ) \ - { \ - clear(); \ - m_hasher = ht.m_hasher; \ - m_equals = ht.m_equals; \ - m_getKey = ht.m_getKey; \ - m_items = ht.m_items; \ - HashCopy( ht ); \ - return *this; \ - } \ - \ - ~CLASSNAME() \ - { \ - clear(); \ - \ - FreeTable(m_table); \ - } \ - \ - hasher hash_funct() { return m_hasher; } \ - key_equal key_eq() { return m_equals; } \ - \ - /* removes all elements from the hash table, but does not */ \ - /* shrink it ( perhaps it should ) */ \ - void clear() \ - { \ - DeleteNodes( m_tableBuckets, (_wxHashTable_NodeBase**)m_table, \ - DeleteNode ); \ - m_items = 0; \ - } \ - \ - size_type size() const { return m_items; } \ - size_type max_size() const { return size_type(-1); } \ - bool empty() const { return size() == 0; } \ - \ - const_iterator end() const { return const_iterator( 0, this ); } \ - iterator end() { return iterator( 0, this ); } \ - const_iterator begin() const \ - { return const_iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ - iterator begin() \ - { return iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ - \ - size_type erase( const const_key_type& key ) \ - { \ - Node** node = GetNodePtr( key ); \ - \ - if( !node ) \ - return 0; \ - \ - --m_items; \ - Node* temp = (*node)->m_next(); \ - delete *node; \ - (*node) = temp; \ - if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ - ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ - return 1; \ - } \ - \ -protected: \ - static size_type GetBucketForNode( Self* ht, Node* node ) \ - { \ - return ht->m_hasher( ht->m_getKey( node->m_value ) ) \ - % ht->m_tableBuckets; \ - } \ - static Node* CopyNode( Node* node ) { return new Node( *node ); } \ - \ - Node* GetOrCreateNode( const value_type& value, bool& created ) \ - { \ - const const_key_type& key = m_getKey( value ); \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = m_table[bucket]; \ - \ - while( node ) \ - { \ - if( m_equals( m_getKey( node->m_value ), key ) ) \ - { \ - created = false; \ - return node; \ - } \ - node = node->m_next(); \ - } \ - created = true; \ - return CreateNode( value, bucket); \ - }\ - Node * CreateNode( const value_type& value, size_t bucket ) \ - {\ - Node* node = new Node( value ); \ - node->m_nxt = m_table[bucket]; \ - m_table[bucket] = node; \ - \ - /* must be after the node is inserted */ \ - ++m_items; \ - if( SHOULD_GROW( m_tableBuckets, m_items ) ) \ - ResizeTable( m_tableBuckets ); \ - \ - return node; \ - } \ - void CreateNode( const value_type& value ) \ - {\ - CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ - }\ - \ - /* returns NULL if not found */ \ - Node** GetNodePtr( const const_key_type& key ) const \ - { \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node** node = &m_table[bucket]; \ - \ - while( *node ) \ - { \ - if( m_equals( m_getKey( (*node)->m_value ), key ) ) \ - return node; \ - /* Tell the compiler to not do any strict-aliasing assumptions with a void cast? Can we make such a runtime guarantee? */ \ - node = (Node**)&(*node)->m_nxt; \ - } \ - \ - return NULL; \ - } \ - \ - /* returns NULL if not found */ \ - /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ - Node* GetNode( const const_key_type& key ) const \ - { \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = m_table[bucket]; \ - \ - while( node ) \ - { \ - if( m_equals( m_getKey( node->m_value ), key ) ) \ - return node; \ - node = node->m_next(); \ - } \ - \ - return 0; \ - } \ - \ - void ResizeTable( size_t newSize ) \ - { \ - newSize = GetNextPrime( (unsigned long)newSize ); \ - Node** srcTable = m_table; \ - size_t srcBuckets = m_tableBuckets; \ - m_table = (Node**)AllocTable( newSize ); \ - m_tableBuckets = newSize; \ - \ - CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \ - this, (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)GetBucketForNode,\ - (ProcessNode)&DummyProcessNode ); \ - FreeTable(srcTable); \ - } \ - \ - /* this must be called _after_ m_table has been cleaned */ \ - void HashCopy( const Self& ht ) \ - { \ - ResizeTable( ht.size() ); \ - CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\ - (_wxHashTableBase2*)this, \ - (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)GetBucketForNode, \ - (ProcessNode)CopyNode ); \ - } \ -}; - -// defines an STL-like pair class CLASSNAME storing two fields: first of type -// KEY_T and second of type VALUE_T -#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ -public: \ - typedef KEY_T t1; \ - typedef VALUE_T t2; \ - typedef const KEY_T const_t1; \ - typedef const VALUE_T const_t2; \ - \ - CLASSNAME( const const_t1& f, const const_t2& s ):first(t1(f)),second(t2(s)) {} \ - \ - t1 first; \ - t2 second; \ -}; - -// defines the class CLASSNAME returning the key part (of type KEY_T) from a -// pair of type PAIR_T -#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ - typedef KEY_T key_type; \ - typedef PAIR_T pair_type; \ - typedef const key_type const_key_type; \ - typedef const pair_type const_pair_type; \ - typedef const_key_type& const_key_reference; \ - typedef const_pair_type& const_pair_reference; \ -public: \ - CLASSNAME() { } \ - const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ - \ - /* the dummy assignment operator is needed to suppress compiler */ \ - /* warnings from hash table class' operator=(): gcc complains about */ \ - /* "statement with no effect" without it */ \ - CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ -}; - -// grow/shrink predicates -inline bool never_grow( size_t, size_t ) { return false; } -inline bool never_shrink( size_t, size_t ) { return false; } -inline bool grow_lf70( size_t buckets, size_t items ) -{ - return float(items)/float(buckets) >= 0.85; -} - -#endif // various hash map implementations - -// ---------------------------------------------------------------------------- -// hashing and comparison functors -// ---------------------------------------------------------------------------- - -// NB: implementation detail: all of these classes must have dummy assignment -// operators to suppress warnings about "statement with no effect" from gcc -// in the hash table class assignment operator (where they're assigned) - -#ifndef wxNEEDS_WX_HASH_MAP - -// integer types -class WXDLLIMPEXP_BASE wxIntegerHash -{ - WX_HASH_MAP_NAMESPACE::hash longHash; - WX_HASH_MAP_NAMESPACE::hash ulongHash; - WX_HASH_MAP_NAMESPACE::hash intHash; - WX_HASH_MAP_NAMESPACE::hash uintHash; - WX_HASH_MAP_NAMESPACE::hash shortHash; - WX_HASH_MAP_NAMESPACE::hash ushortHash; - -#if defined wxLongLong_t && !defined wxLongLongIsLong - // hash ought to work but doesn't on some compilers - #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ - || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) - size_t longlongHash( wxLongLong_t x ) const - { - return longHash( wx_truncate_cast(long, x) ) ^ - longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); - } - #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG - WX_HASH_MAP_NAMESPACE::hash longlongHash; - #else - WX_HASH_MAP_NAMESPACE::hash longlongHash; - #endif -#endif - -public: - wxIntegerHash() { } - size_t operator()( long x ) const { return longHash( x ); } - size_t operator()( unsigned long x ) const { return ulongHash( x ); } - size_t operator()( int x ) const { return intHash( x ); } - size_t operator()( unsigned int x ) const { return uintHash( x ); } - size_t operator()( short x ) const { return shortHash( x ); } - size_t operator()( unsigned short x ) const { return ushortHash( x ); } -#if defined wxLongLong_t && !defined wxLongLongIsLong - size_t operator()( wxLongLong_t x ) const { return longlongHash(x); } - size_t operator()( wxULongLong_t x ) const { return longlongHash(x); } -#endif - - wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } -}; - -#else // wxNEEDS_WX_HASH_MAP - -// integer types -class WXDLLIMPEXP_BASE wxIntegerHash -{ -public: - wxIntegerHash() { } - unsigned long operator()( long x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned long x ) const { return x; } - unsigned long operator()( int x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned int x ) const { return x; } - unsigned long operator()( short x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned short x ) const { return x; } -#if defined wxLongLong_t && !defined wxLongLongIsLong - wxULongLong_t operator()( wxLongLong_t x ) const { return wx_static_cast(wxULongLong_t, x); } - wxULongLong_t operator()( wxULongLong_t x ) const { return x; } -#endif - - wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } -}; - -#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP - -class WXDLLIMPEXP_BASE wxIntegerEqual -{ -public: - wxIntegerEqual() { } - bool operator()( long a, long b ) const { return a == b; } - bool operator()( unsigned long a, unsigned long b ) const { return a == b; } - bool operator()( int a, int b ) const { return a == b; } - bool operator()( unsigned int a, unsigned int b ) const { return a == b; } - bool operator()( short a, short b ) const { return a == b; } - bool operator()( unsigned short a, unsigned short b ) const { return a == b; } -#if defined wxLongLong_t && !defined wxLongLongIsLong - bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } - bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } -#endif - - wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; } -}; - -// pointers -class WXDLLIMPEXP_BASE wxPointerHash -{ -public: - wxPointerHash() { } - -#ifdef wxNEEDS_WX_HASH_MAP - wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } -#else - wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } -#endif - - wxPointerHash& operator=(const wxPointerHash&) { return *this; } -}; - -class WXDLLIMPEXP_BASE wxPointerEqual -{ -public: - wxPointerEqual() { } - bool operator()( const void* a, const void* b ) const { return a == b; } - - wxPointerEqual& operator=(const wxPointerEqual&) { return *this; } -}; - -// wxString, char*, wxChar* -class WXDLLIMPEXP_BASE wxStringHash -{ -public: - wxStringHash() {} - unsigned long operator()( const wxString& x ) const - { return wxCharStringHash( x.c_str() ); } - unsigned long operator()( const wxChar* x ) const - { return wxCharStringHash( x ); } - static unsigned long wxCharStringHash( const wxChar* ); -#if wxUSE_UNICODE - unsigned long operator()( const char* x ) const - { return charStringHash( x ); } - static unsigned long charStringHash( const char* ); -#endif // wxUSE_UNICODE - - wxStringHash& operator=(const wxStringHash&) { return *this; } -}; - -class WXDLLIMPEXP_BASE wxStringEqual -{ -public: - wxStringEqual() {} - bool operator()( const wxString& a, const wxString& b ) const - { return a == b; } - bool operator()( const wxChar* a, const wxChar* b ) const - { return wxStrcmp( a, b ) == 0; } -#if wxUSE_UNICODE - bool operator()( const char* a, const char* b ) const - { return strcmp( a, b ) == 0; } -#endif // wxUSE_UNICODE - - wxStringEqual& operator=(const wxStringEqual&) { return *this; } -}; - -#ifdef wxNEEDS_WX_HASH_MAP - -#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ -_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ -_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ -CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ -{ \ -public: \ - typedef VALUE_T mapped_type; \ - _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ - \ - wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ - key_equal eq = key_equal() ) \ - : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ - CLASSNAME##_wxImplementation_KeyEx() ) {} \ - \ - mapped_type& operator[]( const const_key_type& key ) \ - { \ - bool created; \ - return GetOrCreateNode( \ - CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \ - created)->m_value.second; \ - } \ - \ - const_iterator find( const const_key_type& key ) const \ - { \ - return const_iterator( GetNode( key ), this ); \ - } \ - \ - iterator find( const const_key_type& key ) \ - { \ - return iterator( GetNode( key ), this ); \ - } \ - \ - Insert_Result insert( const value_type& v ) \ - { \ - bool created; \ - Node *node = GetOrCreateNode( \ - CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \ - created); \ - return Insert_Result(iterator(node, this), created); \ - } \ - \ - size_type erase( const key_type& k ) \ - { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( it->first ); } \ - void erase( const const_iterator& it ) { erase( it->first ); } \ - \ - /* count() == 0 | 1 */ \ - size_type count( const const_key_type& key ) \ - { \ - /* explicit cast needed to suppress CodeWarrior warnings */ \ - return (size_type)(GetNode( key ) ? 1 : 0); \ - } \ -} - -#endif // wxNEEDS_WX_HASH_MAP - -// these macros are to be used in the user code -#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) - -#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ - _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ - CLASSNAME, class ) - -#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ - _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ - CLASSNAME, class ) - -// and these do exactly the same thing but should be used inside the -// library -#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLEXPORT ) - -#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ - _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ - CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ - WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLEXPORT ) - -#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ - _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ - CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ - WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLEXPORT ) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_MAP(type, hashmap) \ - { \ - type::iterator it, en; \ - for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ - delete it->second; \ - (hashmap).clear(); \ - } - -//--------------------------------------------------------------------------- -// Declarations of common hashmap classes - -WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, - wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); - - -#endif // _WX_HASHMAP_H_ diff --git a/Source/3rdParty/wx/include/wx/hashset.h b/Source/3rdParty/wx/include/wx/hashset.h deleted file mode 100644 index b5e7892ff..000000000 --- a/Source/3rdParty/wx/include/wx/hashset.h +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hashset.h -// Purpose: wxHashSet class -// Author: Mattia Barbon -// Modified by: -// Created: 11/08/2003 -// RCS-ID: $Id: hashset.h 55215 2008-08-23 18:54:04Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASHSET_H_ -#define _WX_HASHSET_H_ - -#include "wx/hashmap.h" - -// see comment in wx/hashmap.h which also applies to different standard hash -// set classes - -#if wxUSE_STL && \ - (defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET)) - -#if defined(HAVE_STD_UNORDERED_SET) - #include - #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ - typedef std::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME -#elif defined(HAVE_TR1_UNORDERED_SET) - #include - #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ - typedef std::tr1::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME -#else -#error Update this code: unordered_set is available, but I do not know where. -#endif - -#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) - -#if defined(HAVE_EXT_HASH_MAP) - #include -#elif defined(HAVE_HASH_MAP) - #include -#endif - -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ - typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME - -#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// this is a complex way of defining an easily inlineable identity function... -#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ - typedef KEY_T key_type; \ - typedef const key_type const_key_type; \ - typedef const_key_type& const_key_reference; \ -public: \ - CLASSNAME() { } \ - const_key_reference operator()( const_key_reference key ) const \ - { return key; } \ - \ - /* the dummy assignment operator is needed to suppress compiler */ \ - /* warnings from hash table class' operator=(): gcc complains about */ \ - /* "statement with no effect" without it */ \ - CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ -}; - -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ -_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ -CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ -{ \ -public: \ - _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ - \ - wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ - key_equal eq = key_equal() ) \ - : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ - CLASSNAME##_wxImplementation_KeyEx() ) {} \ - \ - Insert_Result insert( const key_type& key ) \ - { \ - bool created; \ - Node *node = GetOrCreateNode( key, created ); \ - return Insert_Result( iterator( node, this ), created ); \ - } \ - \ - const_iterator find( const const_key_type& key ) const \ - { \ - return const_iterator( GetNode( key ), this ); \ - } \ - \ - iterator find( const const_key_type& key ) \ - { \ - return iterator( GetNode( key ), this ); \ - } \ - \ - size_type erase( const key_type& k ) \ - { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( *it ); } \ - void erase( const const_iterator& it ) { erase( *it ); } \ - \ - /* count() == 0 | 1 */ \ - size_type count( const const_key_type& key ) \ - { return GetNode( key ) ? 1 : 0; } \ -} - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// these macros are to be used in the user code -#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) - -// and these do exactly the same thing but should be used inside the -// library -#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLEXPORT ) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_SET(type, hashset) \ - { \ - type::iterator it, en; \ - for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \ - delete *it; \ - (hashset).clear(); \ - } - -#endif // _WX_HASHSET_H_ diff --git a/Source/3rdParty/wx/include/wx/help.h b/Source/3rdParty/wx/include/wx/help.h deleted file mode 100644 index 1cc09d42c..000000000 --- a/Source/3rdParty/wx/include/wx/help.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: help.h -// Purpose: wxHelpController base header -// Author: wxWidgets Team -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: help.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELP_H_BASE_ -#define _WX_HELP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -#ifdef __WXWINCE__ - #include "wx/msw/wince/helpwce.h" - - #define wxHelpController wxWinceHelpController -#elif defined(__WXPALMOS__) - #include "wx/palmos/help.h" - - #define wxHelpController wxPalmHelpController -#elif defined(__WXMSW__) - #include "wx/msw/helpchm.h" - - #define wxHelpController wxCHMHelpController -#else // !MSW - -#if wxUSE_WXHTML_HELP - #include "wx/html/helpctrl.h" - #define wxHelpController wxHtmlHelpController -#else - #include "wx/generic/helpext.h" - #define wxHelpController wxExtHelpController -#endif - -#endif // MSW/!MSW - -#endif // wxUSE_HELP - -#endif - // _WX_HELP_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/helpbase.h b/Source/3rdParty/wx/include/wx/helpbase.h deleted file mode 100644 index 0ab778205..000000000 --- a/Source/3rdParty/wx/include/wx/helpbase.h +++ /dev/null @@ -1,106 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpbase.h -// Purpose: Help system base classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: helpbase.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPBASEH__ -#define _WX_HELPBASEH__ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/gdicmn.h" -#include "wx/frame.h" - -// Flags for SetViewer -#define wxHELP_NETSCAPE 1 - -// Search modes: -enum wxHelpSearchMode -{ - wxHELP_SEARCH_INDEX, - wxHELP_SEARCH_ALL -}; - -// Defines the API for help controllers -class WXDLLEXPORT wxHelpControllerBase: public wxObject -{ -public: - inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } - inline ~wxHelpControllerBase() {} - - // Must call this to set the filename and server name. - // server is only required when implementing TCP/IP-based - // help controllers. - virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } - virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } - - // Set viewer: only relevant to some kinds of controller - virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; - - // Displays the contents - virtual bool DisplayContents(void) = 0; - - // Display the given section - virtual bool DisplaySection(int sectionNo) = 0; - - // Display the section using a context id - virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } - - // Display the text in a popup, if possible - virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } - - // By default, uses KeywordSection to display a topic. Implementations - // may override this for more specific behaviour. - virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } - virtual bool DisplayBlock(long blockNo) = 0; - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; - /// Allows one to override the default settings for the help frame. - virtual void SetFrameParameters(const wxString& WXUNUSED(title), - const wxSize& WXUNUSED(size), - const wxPoint& WXUNUSED(pos) = wxDefaultPosition, - bool WXUNUSED(newFrameEachTime) = false) - { - // does nothing by default - } - /// Obtains the latest settings used by the help frame and the help - /// frame. - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) - { - return (wxFrame*) NULL; // does nothing by default - } - - virtual bool Quit() = 0; - virtual void OnQuit() {} - - /// Set the window that can optionally be used for the help window's parent. - virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } - - /// Get the window that can optionally be used for the help window's parent. - virtual wxWindow* GetParentWindow() const { return m_parentWindow; } - -protected: - wxWindow* m_parentWindow; -private: - DECLARE_CLASS(wxHelpControllerBase) -}; - -#endif // wxUSE_HELP - -#endif -// _WX_HELPBASEH__ diff --git a/Source/3rdParty/wx/include/wx/icon.h b/Source/3rdParty/wx/include/wx/icon.h deleted file mode 100644 index 8a73884ca..000000000 --- a/Source/3rdParty/wx/include/wx/icon.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/icon.h -// Purpose: wxIcon base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: icon.h 41538 2006-09-30 20:45:15Z RR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICON_H_BASE_ -#define _WX_ICON_H_BASE_ - -#include "wx/iconloc.h" - -#if defined(__WXPALMOS__) - #include "wx/generic/icon.h" -#elif defined(__WXMSW__) - #include "wx/msw/icon.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/icon.h" -#elif defined(__WXGTK20__) - #include "wx/generic/icon.h" -#elif defined(__WXGTK__) - #include "wx/generic/icon.h" -#elif defined(__WXX11__) - #include "wx/generic/icon.h" -#elif defined(__WXMGL__) - #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_ICO_RESOURCE - #include "wx/generic/icon.h" -#elif defined(__WXDFB__) - #include "wx/generic/icon.h" -#elif defined(__WXMAC__) - #include "wx/mac/icon.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/icon.h" -#elif defined(__WXPM__) - #include "wx/os2/icon.h" -#endif - -//----------------------------------------------------------------------------- -// wxVariant support -//----------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT) -#endif - - -#endif - // _WX_ICON_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/iconbndl.h b/Source/3rdParty/wx/include/wx/iconbndl.h deleted file mode 100644 index ced8dbba6..000000000 --- a/Source/3rdParty/wx/include/wx/iconbndl.h +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iconbndl.h -// Purpose: wxIconBundle -// Author: Mattia barbon -// Modified by: -// Created: 23.03.02 -// RCS-ID: $Id: iconbndl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICONBNDL_H_ -#define _WX_ICONBNDL_H_ - -#include "wx/dynarray.h" -// for wxSize -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_BASE wxString; - -WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray ); - -// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE, -// if you need them, you have to load them manually and call -// wxIconCollection::AddIcon -class WXDLLEXPORT wxIconBundle -{ -public: - // default constructor - wxIconBundle() : m_icons() {} - // initializes the bundle with the icon(s) found in the file - wxIconBundle( const wxString& file, long type ) : m_icons() - { AddIcon( file, type ); } - // initializes the bundle with a single icon - wxIconBundle( const wxIcon& icon ) : m_icons() - { AddIcon( icon ); } - - const wxIconBundle& operator =( const wxIconBundle& ic ); - wxIconBundle( const wxIconBundle& ic ) : m_icons() - { *this = ic; } - - ~wxIconBundle() { DeleteIcons(); } - - // adds all the icons contained in the file to the collection, - // if the collection already contains icons with the same - // width and height, they are replaced - void AddIcon( const wxString& file, long type ); - // adds the icon to the collection, if the collection already - // contains an icon with the same width and height, it is - // replaced - void AddIcon( const wxIcon& icon ); - - // returns the icon with the given size; if no such icon exists, - // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, - // returns the first icon in the bundle - const wxIcon& GetIcon( const wxSize& size ) const; - // equivalent to GetIcon( wxSize( size, size ) ) - const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const - { return GetIcon( wxSize( size, size ) ); } -private: - // delete all icons - void DeleteIcons(); -public: - wxIconArray m_icons; -}; - -#endif - // _WX_ICONBNDL_H_ diff --git a/Source/3rdParty/wx/include/wx/iconloc.h b/Source/3rdParty/wx/include/wx/iconloc.h deleted file mode 100644 index e89d45d4e..000000000 --- a/Source/3rdParty/wx/include/wx/iconloc.h +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iconloc.h -// Purpose: declaration of wxIconLocation class -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 -// RCS-ID: $Id: iconloc.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICONLOC_H_ -#define _WX_ICONLOC_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxIconLocation: describes the location of an icon -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxIconLocationBase -{ -public: - // ctor takes the name of the file where the icon is - wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString) - : m_filename(filename) { } - - // default copy ctor, assignment operator and dtor are ok - - - // returns true if this object is valid/initialized - bool IsOk() const { return !m_filename.empty(); } - - // set/get the icon file name - void SetFileName(const wxString& filename) { m_filename = filename; } - const wxString& GetFileName() const { return m_filename; } - -private: - wxString m_filename; -}; - -// under MSW the same file may contain several icons so we also store the -// index of the icon -#if defined(__WXMSW__) - -class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase -{ -public: - // ctor takes the name of the file where the icon is and the icons index in - // the file - wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0); - - // set/get the icon index - void SetIndex(int num) { m_index = num; } - int GetIndex() const { return m_index; } - -private: - int m_index; -}; - -inline -wxIconLocation::wxIconLocation(const wxString& file, int num) - : wxIconLocationBase(file) -{ - SetIndex(num); -} - -#else // !MSW - -// must be a class because we forward declare it as class -class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase -{ -public: - wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString) - : wxIconLocationBase(filename) { } -}; - -#endif // platform - -#endif // _WX_ICONLOC_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagbmp.h b/Source/3rdParty/wx/include/wx/imagbmp.h deleted file mode 100644 index e32fc509b..000000000 --- a/Source/3rdParty/wx/include/wx/imagbmp.h +++ /dev/null @@ -1,165 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagbmp.h -// Purpose: wxImage BMP, ICO, CUR and ANI handlers -// Author: Robert Roebling, Chris Elliott -// RCS-ID: $Id: imagbmp.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Robert Roebling, Chris Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGBMP_H_ -#define _WX_IMAGBMP_H_ - -#include "wx/image.h" - -// defines for saving the BMP file in different formats, Bits Per Pixel -// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP ); -#define wxIMAGE_OPTION_BMP_FORMAT wxString(wxT("wxBMP_FORMAT")) - -// These two options are filled in upon reading CUR file and can (should) be -// specified when saving a CUR file - they define the hotspot of the cursor: -#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX") -#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY") - -#if WXWIN_COMPATIBILITY_2_4 - // Do not use these macros, they are deprecated - #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT - #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X - #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y -#endif - - -enum -{ - wxBMP_24BPP = 24, // default, do not need to set - //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors? - wxBMP_8BPP = 8, // 8bpp, quantized colors - wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys - wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY, - wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale - wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette - wxBMP_4BPP = 4, // 4bpp, quantized colors - wxBMP_1BPP = 1, // 1bpp, quantized "colors" - wxBMP_1BPP_BW = 2 // 1bpp, black & white from red -}; - -// ---------------------------------------------------------------------------- -// wxBMPHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBMPHandler : public wxImageHandler -{ -public: - wxBMPHandler() - { - m_name = wxT("Windows bitmap file"); - m_extension = wxT("bmp"); - m_type = wxBITMAP_TYPE_BMP; - m_mime = wxT("image/x-bmp"); - } - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - -protected: - virtual bool DoCanRead( wxInputStream& stream ); - bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, - bool IsBmp, bool IsMask); - bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors, - int comp, wxFileOffset bmpOffset, wxInputStream& stream, - bool verbose, bool IsBmp, bool hasPalette); - bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxBMPHandler) -}; - -#if wxUSE_ICO_CUR -// ---------------------------------------------------------------------------- -// wxICOHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxICOHandler : public wxBMPHandler -{ -public: - wxICOHandler() - { - m_name = wxT("Windows icon file"); - m_extension = wxT("ico"); - m_type = wxBITMAP_TYPE_ICO; - m_mime = wxT("image/x-ico"); - } - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxICOHandler) -}; - - -// ---------------------------------------------------------------------------- -// wxCURHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCURHandler : public wxICOHandler -{ -public: - wxCURHandler() - { - m_name = wxT("Windows cursor file"); - m_extension = wxT("cur"); - m_type = wxBITMAP_TYPE_CUR; - m_mime = wxT("image/x-cur"); - } - - // VS: This handler's meat is implemented inside wxICOHandler (the two - // formats are almost identical), but we hide this fact at - // the API level, since it is a mere implementation detail. - -protected: -#if wxUSE_STREAMS - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxCURHandler) -}; -// ---------------------------------------------------------------------------- -// wxANIHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxANIHandler : public wxCURHandler -{ -public: - wxANIHandler() - { - m_name = wxT("Windows animated cursor file"); - m_extension = wxT("ani"); - m_type = wxBITMAP_TYPE_ANI; - m_mime = wxT("image/x-ani"); - } - - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;} - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxANIHandler) -}; - -#endif // wxUSE_ICO_CUR -#endif // _WX_IMAGBMP_H_ diff --git a/Source/3rdParty/wx/include/wx/image.h b/Source/3rdParty/wx/include/wx/image.h deleted file mode 100644 index 8dc2d8500..000000000 --- a/Source/3rdParty/wx/include/wx/image.h +++ /dev/null @@ -1,454 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/image.h -// Purpose: wxImage class -// Author: Robert Roebling -// RCS-ID: $Id: image.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGE_H_ -#define _WX_IMAGE_H_ - -#include "wx/defs.h" - -#if wxUSE_IMAGE - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/gdicmn.h" -#include "wx/hashmap.h" - -#if wxUSE_STREAMS -# include "wx/stream.h" -#endif - -// on some systems (Unixware 7.x) index is defined as a macro in the headers -// which breaks the compilation below -#undef index - -#define wxIMAGE_OPTION_QUALITY wxString(wxT("quality")) -#define wxIMAGE_OPTION_FILENAME wxString(wxT("FileName")) - -#define wxIMAGE_OPTION_RESOLUTION wxString(wxT("Resolution")) -#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxT("ResolutionX")) -#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxT("ResolutionY")) - -#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxT("ResolutionUnit")) - -// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT -enum -{ - wxIMAGE_RESOLUTION_INCHES = 1, - wxIMAGE_RESOLUTION_CM = 2 -}; - -// Constants for wxImage::Scale() for determining the level of quality -enum -{ - wxIMAGE_QUALITY_NORMAL = 0, - wxIMAGE_QUALITY_HIGH = 1 -}; - -// alpha channel values: fully transparent, default threshold separating -// transparent pixels from opaque for a few functions dealing with alpha and -// fully opaque -const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0; -const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80; -const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff; - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxImageHandler; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -//----------------------------------------------------------------------------- -// wxVariant support -//----------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT) -#endif - -//----------------------------------------------------------------------------- -// wxImageHandler -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImageHandler: public wxObject -{ -public: - wxImageHandler() - : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(0) - { } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - - virtual int GetImageCount( wxInputStream& stream ); - - bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); } - bool CanRead( const wxString& name ); -#endif // wxUSE_STREAMS - - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - void SetMimeType(const wxString& type) { m_mime = type; } - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - const wxString& GetMimeType() const { return m_mime; } - -protected: -#if wxUSE_STREAMS - virtual bool DoCanRead( wxInputStream& stream ) = 0; - - // save the stream position, call DoCanRead() and restore the position - bool CallDoCanRead(wxInputStream& stream); -#endif // wxUSE_STREAMS - - wxString m_name; - wxString m_extension; - wxString m_mime; - long m_type; - -private: - DECLARE_CLASS(wxImageHandler) -}; - -//----------------------------------------------------------------------------- -// wxImageHistogram -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImageHistogramEntry -{ -public: - wxImageHistogramEntry() { index = value = 0; } - unsigned long index; - unsigned long value; -}; - -WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, - wxIntegerHash, wxIntegerEqual, - wxImageHistogramBase); - -class WXDLLEXPORT wxImageHistogram : public wxImageHistogramBase -{ -public: - wxImageHistogram() : wxImageHistogramBase(256) { } - - // get the key in the histogram for the given RGB values - static unsigned long MakeKey(unsigned char r, - unsigned char g, - unsigned char b) - { - return (r << 16) | (g << 8) | b; - } - - // find first colour that is not used in the image and has higher - // RGB values than RGB(startR, startG, startB) - // - // returns true and puts this colour in r, g, b (each of which may be NULL) - // on success or returns false if there are no more free colours - bool FindFirstUnusedColour(unsigned char *r, - unsigned char *g, - unsigned char *b, - unsigned char startR = 1, - unsigned char startG = 0, - unsigned char startB = 0 ) const; -}; - -//----------------------------------------------------------------------------- -// wxImage -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImage: public wxObject -{ -public: - // red, green and blue are 8 bit unsigned integers in the range of 0..255 - // We use the identifier RGBValue instead of RGB, since RGB is #defined - class RGBValue - { - public: - RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0) - : red(r), green(g), blue(b) {} - unsigned char red; - unsigned char green; - unsigned char blue; - }; - - // hue, saturation and value are doubles in the range 0.0..1.0 - class HSVValue - { - public: - HSVValue(double h=0.0, double s=0.0, double v=0.0) - : hue(h), saturation(s), value(v) {} - double hue; - double saturation; - double value; - }; - - wxImage(){} - wxImage( int width, int height, bool clear = true ); - wxImage( int width, int height, unsigned char* data, bool static_data = false ); - wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); - wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - wxImage( const wxString& name, const wxString& mimetype, int index = -1 ); - wxImage( const char* const* xpmData ); - -#if wxUSE_STREAMS - wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ); -#endif // wxUSE_STREAMS - - bool Create( int width, int height, bool clear = true ); - bool Create( int width, int height, unsigned char* data, bool static_data = false ); - bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); - bool Create( const char* const* xpmData ); -#ifdef __BORLANDC__ - // needed for Borland 5.5 - wxImage( char** xpmData ) { Create(wx_const_cast(const char* const*, xpmData)); } - bool Create( char** xpmData ) { return Create(wx_const_cast(const char* const*, xpmData)); } -#endif - void Destroy(); - - // creates an identical copy of the image (the = operator - // just raises the ref count) - wxImage Copy() const; - - // return the new image with size width*height - wxImage GetSubImage( const wxRect& rect) const; - - // Paste the image or part of this image into an image of the given size at the pos - // any newly exposed areas will be filled with the rgb colour - // by default if r = g = b = -1 then fill with this image's mask colour or find and - // set a suitable mask colour - wxImage Size( const wxSize& size, const wxPoint& pos, - int r = -1, int g = -1, int b = -1 ) const; - - // pastes image into this instance and takes care of - // the mask colour and out of bounds problems - void Paste( const wxImage &image, int x, int y ); - - // return the new image with size width*height - wxImage Scale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) const; - - // box averager and bicubic filters for up/down sampling - wxImage ResampleBox(int width, int height) const; - wxImage ResampleBicubic(int width, int height) const; - - // blur the image according to the specified pixel radius - wxImage Blur(int radius); - wxImage BlurHorizontal(int radius); - wxImage BlurVertical(int radius); - - wxImage ShrinkBy( int xFactor , int yFactor ) const ; - - // rescales the image in place - wxImage& Rescale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) { return *this = Scale(width, height, quality); } - - // resizes the image in place - wxImage& Resize( const wxSize& size, const wxPoint& pos, - int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); } - - // Rotates the image about the given point, 'angle' radians. - // Returns the rotated image, leaving this image intact. - wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; - - wxImage Rotate90( bool clockwise = true ) const; - wxImage Mirror( bool horizontally = true ) const; - - // replace one colour with another - void Replace( unsigned char r1, unsigned char g1, unsigned char b1, - unsigned char r2, unsigned char g2, unsigned char b2 ); - - // Convert to greyscale image. Uses the luminance component (Y) of the image. - // The luma value (YUV) is calculated using (R * lr) + (G * lg) + (B * lb), defaults to ITU-T BT.601 - wxImage ConvertToGreyscale( double lr = 0.299, double lg = 0.587, double lb = 0.114 ) const; - - // convert to monochrome image ( will be replaced by white, - // everything else by black) - wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const; - - // these routines are slow but safe - void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); - void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b ); - unsigned char GetRed( int x, int y ) const; - unsigned char GetGreen( int x, int y ) const; - unsigned char GetBlue( int x, int y ) const; - - void SetAlpha(int x, int y, unsigned char alpha); - unsigned char GetAlpha(int x, int y) const; - - // find first colour that is not used in the image and has higher - // RGB values than - bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b, - unsigned char startR = 1, unsigned char startG = 0, - unsigned char startB = 0 ) const; - // Set image's mask to the area of 'mask' that has colour - bool SetMaskFromImage(const wxImage & mask, - unsigned char mr, unsigned char mg, unsigned char mb); - - // converts image's alpha channel to mask, if it has any, does nothing - // otherwise: - bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); - - // This method converts an image where the original alpha - // information is only available as a shades of a colour - // (actually shades of grey) typically when you draw anti- - // aliased text into a bitmap. The DC drawinf routines - // draw grey values on the black background although they - // actually mean to draw white with differnt alpha values. - // This method reverses it, assuming a black (!) background - // and white text (actually only the red channel is read). - // The method will then fill up the whole image with the - // colour given. - bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); - - static bool CanRead( const wxString& name ); - static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 ); - -#if wxUSE_STREAMS - static bool CanRead( wxInputStream& stream ); - static int GetImageCount( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 ); -#endif - - virtual bool SaveFile( const wxString& name ) const; - virtual bool SaveFile( const wxString& name, int type ) const; - virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const; - -#if wxUSE_STREAMS - virtual bool SaveFile( wxOutputStream& stream, int type ) const; - virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const; -#endif - - bool Ok() const { return IsOk(); } - bool IsOk() const; - int GetWidth() const; - int GetHeight() const; - - // these functions provide fastest access to wxImage data but should be - // used carefully as no checks are done - unsigned char *GetData() const; - void SetData( unsigned char *data, bool static_data=false ); - void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false ); - - unsigned char *GetAlpha() const; // may return NULL! - bool HasAlpha() const { return GetAlpha() != NULL; } - void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); - void InitAlpha(); - - // return true if this pixel is masked or has alpha less than specified - // threshold - bool IsTransparent(int x, int y, - unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const; - - // Mask functions - void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); - // Get the current mask colour or find a suitable colour - // returns true if using current mask colour - bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const; - unsigned char GetMaskRed() const; - unsigned char GetMaskGreen() const; - unsigned char GetMaskBlue() const; - void SetMask( bool mask = true ); - bool HasMask() const; - -#if wxUSE_PALETTE - // Palette functions - bool HasPalette() const; - const wxPalette& GetPalette() const; - void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - // Option functions (arbitrary name/value mapping) - void SetOption(const wxString& name, const wxString& value); - void SetOption(const wxString& name, int value); - wxString GetOption(const wxString& name) const; - int GetOptionInt(const wxString& name) const; - bool HasOption(const wxString& name) const; - - unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const; - - // Computes the histogram of the image and fills a hash table, indexed - // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry - // objects. Each of them contains an 'index' (useful to build a palette - // with the image colours) and a 'value', which is the number of pixels - // in the image with that colour. - // Returned value: # of entries in the histogram - unsigned long ComputeHistogram( wxImageHistogram &h ) const; - - // Rotates the hue of each pixel of the image. angle is a double in the range - // -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees - void RotateHue(double angle); - - static wxList& GetHandlers() { return sm_handlers; } - static void AddHandler( wxImageHandler *handler ); - static void InsertHandler( wxImageHandler *handler ); - static bool RemoveHandler( const wxString& name ); - static wxImageHandler *FindHandler( const wxString& name ); - static wxImageHandler *FindHandler( const wxString& extension, long imageType ); - static wxImageHandler *FindHandler( long imageType ); - static wxImageHandler *FindHandlerMime( const wxString& mimetype ); - - static wxString GetImageExtWildcard(); - - static void CleanUpHandlers(); - static void InitStandardHandlers(); - - static HSVValue RGBtoHSV(const RGBValue& rgb); - static RGBValue HSVtoRGB(const HSVValue& hsv); - - -protected: - static wxList sm_handlers; - - // return the index of the point with the given coordinates or -1 if the - // image is invalid of the coordinates are out of range - // - // note that index must be multiplied by 3 when using it with RGB array - long XYToIndex(int x, int y) const; - - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; - - DECLARE_DYNAMIC_CLASS(wxImage) -}; - - -extern void WXDLLEXPORT wxInitAllImageHandlers(); - -extern WXDLLEXPORT_DATA(wxImage) wxNullImage; - -//----------------------------------------------------------------------------- -// wxImage handlers -//----------------------------------------------------------------------------- - -#include "wx/imagbmp.h" -#include "wx/imagpng.h" -#include "wx/imaggif.h" -#include "wx/imagpcx.h" -#include "wx/imagjpeg.h" -#include "wx/imagtga.h" -#include "wx/imagtiff.h" -#include "wx/imagpnm.h" -#include "wx/imagxpm.h" -#include "wx/imagiff.h" - -#endif // wxUSE_IMAGE - -#endif - // _WX_IMAGE_H_ diff --git a/Source/3rdParty/wx/include/wx/imaggif.h b/Source/3rdParty/wx/include/wx/imaggif.h deleted file mode 100644 index 21b58e618..000000000 --- a/Source/3rdParty/wx/include/wx/imaggif.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaggif.h -// Purpose: wxImage GIF handler -// Author: Vaclav Slavik & Guillermo Rodriguez Garcia -// RCS-ID: $Id: imaggif.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGGIF_H_ -#define _WX_IMAGGIF_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxGIFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_GIF - -class WXDLLEXPORT wxGIFHandler : public wxImageHandler -{ -public: - inline wxGIFHandler() - { - m_name = wxT("GIF file"); - m_extension = wxT("gif"); - m_type = wxBITMAP_TYPE_GIF; - m_mime = wxT("image/gif"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxGIFHandler) -}; -#endif - - -#endif - // _WX_IMAGGIF_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagiff.h b/Source/3rdParty/wx/include/wx/imagiff.h deleted file mode 100644 index 6b47da735..000000000 --- a/Source/3rdParty/wx/include/wx/imagiff.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagiff.h -// Purpose: wxImage handler for Amiga IFF images -// Author: Steffen Gutmann -// RCS-ID: $Id: imagiff.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Steffen Gutmann, 2002 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGE_IFF_H_ -#define _WX_IMAGE_IFF_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxIFFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_IMAGE && wxUSE_IFF - -class WXDLLEXPORT wxIFFHandler : public wxImageHandler -{ -public: - wxIFFHandler() - { - m_name = wxT("IFF file"); - m_extension = wxT("iff"); - m_type = wxBITMAP_TYPE_IFF; - m_mime = wxT("image/x-iff"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); - virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); - virtual bool DoCanRead(wxInputStream& stream); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxIFFHandler) -}; - -#endif // wxUSE_IMAGE && wxUSE_IFF - -#endif // _WX_IMAGE_IFF_H_ diff --git a/Source/3rdParty/wx/include/wx/imagjpeg.h b/Source/3rdParty/wx/include/wx/imagjpeg.h deleted file mode 100644 index 410b7cc93..000000000 --- a/Source/3rdParty/wx/include/wx/imagjpeg.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagjpeg.h -// Purpose: wxImage JPEG handler -// Author: Vaclav Slavik -// RCS-ID: $Id: imagjpeg.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGJPEG_H_ -#define _WX_IMAGJPEG_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxJPEGHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBJPEG - -#include "wx/image.h" - -class WXDLLEXPORT wxJPEGHandler: public wxImageHandler -{ -public: - inline wxJPEGHandler() - { - m_name = wxT("JPEG file"); - m_extension = wxT("jpg"); - m_type = wxBITMAP_TYPE_JPEG; - m_mime = wxT("image/jpeg"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxJPEGHandler) -}; - -#endif // wxUSE_LIBJPEG - -#endif // _WX_IMAGJPEG_H_ - diff --git a/Source/3rdParty/wx/include/wx/imaglist.h b/Source/3rdParty/wx/include/wx/imaglist.h deleted file mode 100644 index 91cf8eac6..000000000 --- a/Source/3rdParty/wx/include/wx/imaglist.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imaglist.h -// Purpose: wxImageList base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: imaglist.h 41288 2006-09-18 23:06:35Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_BASE_ -#define _WX_IMAGLIST_H_BASE_ - -/* - * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to - * images for their items by an index into an image list. - * A wxImageList is capable of creating images with optional masks from - * a variety of sources - a single bitmap plus a colour to indicate the mask, - * two bitmaps, or an icon. - * - * Image lists can also create and draw images used for drag and drop functionality. - * This is not yet implemented in wxImageList. We need to discuss a generic API - * for doing drag and drop and see whether it ties in with the Win95 view of it. - * See below for candidate functions and an explanation of how they might be - * used. - */ - -// Flag values for Set/GetImageList -enum -{ - wxIMAGE_LIST_NORMAL, // Normal icons - wxIMAGE_LIST_SMALL, // Small icons - wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) -}; - -// Flags for Draw -#define wxIMAGELIST_DRAW_NORMAL 0x0001 -#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 -#define wxIMAGELIST_DRAW_SELECTED 0x0004 -#define wxIMAGELIST_DRAW_FOCUSED 0x0008 - -#if defined(__WXMSW__) || defined(__WXMAC_CARBON__) - #define wxHAS_NATIVE_IMAGELIST -#endif - -#if !defined(wxHAS_NATIVE_IMAGELIST) - #include "wx/generic/imaglist.h" -#elif defined(__WXMSW__) - #include "wx/msw/imaglist.h" -#elif defined(__WXMAC_CARBON__) - #include "wx/mac/imaglist.h" -#endif - -#endif // _WX_IMAGLIST_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/imagpcx.h b/Source/3rdParty/wx/include/wx/imagpcx.h deleted file mode 100644 index f56048f84..000000000 --- a/Source/3rdParty/wx/include/wx/imagpcx.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpcx.h -// Purpose: wxImage PCX handler -// Author: Guillermo Rodriguez Garcia -// RCS-ID: $Id: imagpcx.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 1999 Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPCX_H_ -#define _WX_IMAGPCX_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxPCXHandler -//----------------------------------------------------------------------------- - -#if wxUSE_PCX -class WXDLLEXPORT wxPCXHandler : public wxImageHandler -{ -public: - inline wxPCXHandler() - { - m_name = wxT("PCX file"); - m_extension = wxT("pcx"); - m_type = wxBITMAP_TYPE_PCX; - m_mime = wxT("image/pcx"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxPCXHandler) -}; -#endif // wxUSE_PCX - - -#endif - // _WX_IMAGPCX_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagpng.h b/Source/3rdParty/wx/include/wx/imagpng.h deleted file mode 100644 index daea3a26f..000000000 --- a/Source/3rdParty/wx/include/wx/imagpng.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpng.h -// Purpose: wxImage PNG handler -// Author: Robert Roebling -// RCS-ID: $Id: imagpng.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPNG_H_ -#define _WX_IMAGPNG_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxPNGHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBPNG - -#include "wx/image.h" - -#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") -#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") - -enum -{ - wxPNG_TYPE_COLOUR = 0, - wxPNG_TYPE_GREY = 2, - wxPNG_TYPE_GREY_RED = 3 -}; - -class WXDLLEXPORT wxPNGHandler: public wxImageHandler -{ -public: - inline wxPNGHandler() - { - m_name = wxT("PNG file"); - m_extension = wxT("png"); - m_type = wxBITMAP_TYPE_PNG; - m_mime = wxT("image/png"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPNGHandler) -}; - -#endif - // wxUSE_LIBPNG - -#endif - // _WX_IMAGPNG_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagpnm.h b/Source/3rdParty/wx/include/wx/imagpnm.h deleted file mode 100644 index 68b95efd9..000000000 --- a/Source/3rdParty/wx/include/wx/imagpnm.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpnm.h -// Purpose: wxImage PNM handler -// Author: Sylvain Bougnoux -// RCS-ID: $Id: imagpnm.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPNM_H_ -#define _WX_IMAGPNM_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxPNMHandler -//----------------------------------------------------------------------------- - -#if wxUSE_PNM -class WXDLLEXPORT wxPNMHandler : public wxImageHandler -{ -public: - inline wxPNMHandler() - { - m_name = wxT("PNM file"); - m_extension = wxT("pnm"); - m_type = wxBITMAP_TYPE_PNM; - m_mime = wxT("image/pnm"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPNMHandler) -}; -#endif - - -#endif - // _WX_IMAGPNM_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagtga.h b/Source/3rdParty/wx/include/wx/imagtga.h deleted file mode 100644 index 9b0a84187..000000000 --- a/Source/3rdParty/wx/include/wx/imagtga.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagtga.h -// Purpose: wxImage TGA handler -// Author: Seth Jackson -// RCS-ID: $Id: imagtga.h 43843 2006-12-07 05:44:44Z PC $ -// Copyright: (c) 2005 Seth Jackson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGTGA_H_ -#define _WX_IMAGTGA_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxTGAHandler -//----------------------------------------------------------------------------- - -#if wxUSE_TGA - -class WXDLLEXPORT wxTGAHandler : public wxImageHandler -{ -public: - wxTGAHandler() - { - m_name = wxT("TGA file"); - m_extension = wxT("tga"); - m_type = wxBITMAP_TYPE_TGA; - m_mime = wxT("image/tga"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile(wxImage* image, wxInputStream& stream, - bool verbose = true, int index = -1); - virtual bool SaveFile(wxImage* image, wxOutputStream& stream, - bool verbose = true); -protected: - virtual bool DoCanRead(wxInputStream& stream); -#endif // wxUSE_STREAMS - - DECLARE_DYNAMIC_CLASS(wxTGAHandler) -}; - -#endif // wxUSE_TGA - -#endif // _WX_IMAGTGA_H_ diff --git a/Source/3rdParty/wx/include/wx/imagtiff.h b/Source/3rdParty/wx/include/wx/imagtiff.h deleted file mode 100644 index 53df633a3..000000000 --- a/Source/3rdParty/wx/include/wx/imagtiff.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagtiff.h -// Purpose: wxImage TIFF handler -// Author: Robert Roebling -// RCS-ID: $Id: imagtiff.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGTIFF_H_ -#define _WX_IMAGTIFF_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxTIFFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBTIFF - -#include "wx/image.h" - -// defines for wxImage::SetOption -#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(wxT("BitsPerSample")) -#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) -#define wxIMAGE_OPTION_COMPRESSION wxString(wxT("Compression")) -#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) - -class WXDLLEXPORT wxTIFFHandler: public wxImageHandler -{ -public: - wxTIFFHandler(); - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxTIFFHandler) -}; - -#endif // wxUSE_LIBTIFF - -#endif // _WX_IMAGTIFF_H_ - diff --git a/Source/3rdParty/wx/include/wx/imagxpm.h b/Source/3rdParty/wx/include/wx/imagxpm.h deleted file mode 100644 index 4bff4894f..000000000 --- a/Source/3rdParty/wx/include/wx/imagxpm.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaggif.h -// Purpose: wxImage XPM handler -// Author: Vaclav Slavik -// RCS-ID: $Id: imagxpm.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGXPM_H_ -#define _WX_IMAGXPM_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxXPMHandler -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxXPMHandler : public wxImageHandler -{ -public: - inline wxXPMHandler() - { - m_name = wxT("XPM file"); - m_extension = wxT("xpm"); - m_type = wxBITMAP_TYPE_XPM; - m_mime = wxT("image/xpm"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxXPMHandler) -}; - - -#endif - // _WX_IMAGXPM_H_ - diff --git a/Source/3rdParty/wx/include/wx/init.h b/Source/3rdParty/wx/include/wx/init.h deleted file mode 100644 index d07112ff5..000000000 --- a/Source/3rdParty/wx/include/wx/init.h +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/init.h -// Purpose: wxWidgets initialization and finalization functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.06.2003 -// RCS-ID: $Id: init.h 61558 2009-07-30 10:14:36Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_INIT_H_ -#define _WX_INIT_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" - -// ---------------------------------------------------------------------------- -// wxEntry helper functions which allow to have more fine grained control -// ---------------------------------------------------------------------------- - -// do common initialization, return true if ok (in this case wxEntryCleanup -// must be called later), otherwise the program can't use wxWidgets at all -// -// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP -// hadn't been used a dummy default application object is created -// -// note that the parameters may be modified, this is why we pass them by -// reference! -extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv); - -// free the resources allocated by the library in wxEntryStart() and shut it -// down (wxEntryStart() may be called again afterwards if necessary) -extern void WXDLLIMPEXP_BASE wxEntryCleanup(); - - -// ---------------------------------------------------------------------------- -// wxEntry: this function initializes the library, runs the main event loop -// and cleans it up -// ---------------------------------------------------------------------------- - -// note that other, platform-specific, overloads of wxEntry may exist as well -// but this one always exists under all platforms -// -// returns the program exit code -extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv); - -// we overload wxEntry[Start]() to take "char **" pointers too -#if wxUSE_UNICODE - -extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv); -extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); - -#endif// wxUSE_UNICODE - -// ---------------------------------------------------------------------------- -// Using the library without (explicit) application object: you may avoid using -// DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at -// the program startup and termination -// ---------------------------------------------------------------------------- - -// initialize the library (may be called as many times as needed, but each -// call to wxInitialize() must be matched by wxUninitialize()) -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL); -#if wxUSE_UNICODE && wxABI_VERSION >= 20811 -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv); -#endif - -// clean up -- the library can't be used any more after the last call to -// wxUninitialize() -extern void WXDLLIMPEXP_BASE wxUninitialize(); - -// create an object of this class on stack to initialize/cleanup the library -// automatically -class WXDLLIMPEXP_BASE wxInitializer -{ -public: - // initialize the library - wxInitializer(int argc = 0, wxChar **argv = NULL) - { - m_ok = wxInitialize(argc, argv); - } - -#if wxUSE_UNICODE && wxABI_VERSION >= 20811 - wxInitializer(int argc, char **argv) - { - m_ok = wxInitialize(argc, argv); - } -#endif // wxUSE_UNICODE - - // has the initialization been successful? (explicit test) - bool IsOk() const { return m_ok; } - - // has the initialization been successful? (implicit test) - operator bool() const { return m_ok; } - - // dtor only does clean up if we initialized the library properly - ~wxInitializer() { if ( m_ok ) wxUninitialize(); } - -private: - bool m_ok; -}; - -#endif // _WX_INIT_H_ - diff --git a/Source/3rdParty/wx/include/wx/intl.h b/Source/3rdParty/wx/include/wx/intl.h deleted file mode 100644 index ed5631a83..000000000 --- a/Source/3rdParty/wx/include/wx/intl.h +++ /dev/null @@ -1,632 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/intl.h -// Purpose: Internationalization and localisation for wxWidgets -// Author: Vadim Zeitlin -// Modified by: Michael N. Filippov -// (2003/09/30 - plural forms support) -// Created: 29/01/98 -// RCS-ID: $Id: intl.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// WARNING: Parts of this file are generated. See misc/languages/README for -// details. - -#ifndef _WX_INTL_H_ -#define _WX_INTL_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -// Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp -// and other classes are not distrubed by wxUSE_INTL - -enum wxLayoutDirection -{ - wxLayout_Default, - wxLayout_LeftToRight, - wxLayout_RightToLeft -}; - -#if wxUSE_INTL - -#include "wx/fontenc.h" - -// ============================================================================ -// global decls -// ============================================================================ - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// gettext() style macros (notice that xgettext should be invoked with -// --keyword="_" --keyword="wxPLURAL:1,2" options -// to extract the strings from the sources) -#ifndef WXINTL_NO_GETTEXT_MACRO - #define _(s) wxGetTranslation(wxT(s)) - #define wxPLURAL(sing, plur, n) wxGetTranslation(wxT(sing), wxT(plur), n) -#endif - -// another one which just marks the strings for extraction, but doesn't -// perform the translation (use -kwxTRANSLATE with xgettext!) -#define wxTRANSLATE(str) wxT(str) - -// ---------------------------------------------------------------------------- -// forward decls -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxLocale; -class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray; -class wxMsgCatalog; - -// ============================================================================ -// locale support -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxLanguage: defines all supported languages -// ---------------------------------------------------------------------------- - -// --- --- --- generated code begins here --- --- --- - -// This enum is generated by misc/languages/genlang.py -// When making changes, please put them into misc/languages/langtabl.txt -enum wxLanguage -{ - // user's default/preffered language as got from OS: - wxLANGUAGE_DEFAULT, - // unknown language, if wxLocale::GetSystemLanguage fails: - wxLANGUAGE_UNKNOWN, - - wxLANGUAGE_ABKHAZIAN, - wxLANGUAGE_AFAR, - wxLANGUAGE_AFRIKAANS, - wxLANGUAGE_ALBANIAN, - wxLANGUAGE_AMHARIC, - wxLANGUAGE_ARABIC, - wxLANGUAGE_ARABIC_ALGERIA, - wxLANGUAGE_ARABIC_BAHRAIN, - wxLANGUAGE_ARABIC_EGYPT, - wxLANGUAGE_ARABIC_IRAQ, - wxLANGUAGE_ARABIC_JORDAN, - wxLANGUAGE_ARABIC_KUWAIT, - wxLANGUAGE_ARABIC_LEBANON, - wxLANGUAGE_ARABIC_LIBYA, - wxLANGUAGE_ARABIC_MOROCCO, - wxLANGUAGE_ARABIC_OMAN, - wxLANGUAGE_ARABIC_QATAR, - wxLANGUAGE_ARABIC_SAUDI_ARABIA, - wxLANGUAGE_ARABIC_SUDAN, - wxLANGUAGE_ARABIC_SYRIA, - wxLANGUAGE_ARABIC_TUNISIA, - wxLANGUAGE_ARABIC_UAE, - wxLANGUAGE_ARABIC_YEMEN, - wxLANGUAGE_ARMENIAN, - wxLANGUAGE_ASSAMESE, - wxLANGUAGE_AYMARA, - wxLANGUAGE_AZERI, - wxLANGUAGE_AZERI_CYRILLIC, - wxLANGUAGE_AZERI_LATIN, - wxLANGUAGE_BASHKIR, - wxLANGUAGE_BASQUE, - wxLANGUAGE_BELARUSIAN, - wxLANGUAGE_BENGALI, - wxLANGUAGE_BHUTANI, - wxLANGUAGE_BIHARI, - wxLANGUAGE_BISLAMA, - wxLANGUAGE_BRETON, - wxLANGUAGE_BULGARIAN, - wxLANGUAGE_BURMESE, - wxLANGUAGE_CAMBODIAN, - wxLANGUAGE_CATALAN, - wxLANGUAGE_CHINESE, - wxLANGUAGE_CHINESE_SIMPLIFIED, - wxLANGUAGE_CHINESE_TRADITIONAL, - wxLANGUAGE_CHINESE_HONGKONG, - wxLANGUAGE_CHINESE_MACAU, - wxLANGUAGE_CHINESE_SINGAPORE, - wxLANGUAGE_CHINESE_TAIWAN, - wxLANGUAGE_CORSICAN, - wxLANGUAGE_CROATIAN, - wxLANGUAGE_CZECH, - wxLANGUAGE_DANISH, - wxLANGUAGE_DUTCH, - wxLANGUAGE_DUTCH_BELGIAN, - wxLANGUAGE_ENGLISH, - wxLANGUAGE_ENGLISH_UK, - wxLANGUAGE_ENGLISH_US, - wxLANGUAGE_ENGLISH_AUSTRALIA, - wxLANGUAGE_ENGLISH_BELIZE, - wxLANGUAGE_ENGLISH_BOTSWANA, - wxLANGUAGE_ENGLISH_CANADA, - wxLANGUAGE_ENGLISH_CARIBBEAN, - wxLANGUAGE_ENGLISH_DENMARK, - wxLANGUAGE_ENGLISH_EIRE, - wxLANGUAGE_ENGLISH_JAMAICA, - wxLANGUAGE_ENGLISH_NEW_ZEALAND, - wxLANGUAGE_ENGLISH_PHILIPPINES, - wxLANGUAGE_ENGLISH_SOUTH_AFRICA, - wxLANGUAGE_ENGLISH_TRINIDAD, - wxLANGUAGE_ENGLISH_ZIMBABWE, - wxLANGUAGE_ESPERANTO, - wxLANGUAGE_ESTONIAN, - wxLANGUAGE_FAEROESE, - wxLANGUAGE_FARSI, - wxLANGUAGE_FIJI, - wxLANGUAGE_FINNISH, - wxLANGUAGE_FRENCH, - wxLANGUAGE_FRENCH_BELGIAN, - wxLANGUAGE_FRENCH_CANADIAN, - wxLANGUAGE_FRENCH_LUXEMBOURG, - wxLANGUAGE_FRENCH_MONACO, - wxLANGUAGE_FRENCH_SWISS, - wxLANGUAGE_FRISIAN, - wxLANGUAGE_GALICIAN, - wxLANGUAGE_GEORGIAN, - wxLANGUAGE_GERMAN, - wxLANGUAGE_GERMAN_AUSTRIAN, - wxLANGUAGE_GERMAN_BELGIUM, - wxLANGUAGE_GERMAN_LIECHTENSTEIN, - wxLANGUAGE_GERMAN_LUXEMBOURG, - wxLANGUAGE_GERMAN_SWISS, - wxLANGUAGE_GREEK, - wxLANGUAGE_GREENLANDIC, - wxLANGUAGE_GUARANI, - wxLANGUAGE_GUJARATI, - wxLANGUAGE_HAUSA, - wxLANGUAGE_HEBREW, - wxLANGUAGE_HINDI, - wxLANGUAGE_HUNGARIAN, - wxLANGUAGE_ICELANDIC, - wxLANGUAGE_INDONESIAN, - wxLANGUAGE_INTERLINGUA, - wxLANGUAGE_INTERLINGUE, - wxLANGUAGE_INUKTITUT, - wxLANGUAGE_INUPIAK, - wxLANGUAGE_IRISH, - wxLANGUAGE_ITALIAN, - wxLANGUAGE_ITALIAN_SWISS, - wxLANGUAGE_JAPANESE, - wxLANGUAGE_JAVANESE, - wxLANGUAGE_KANNADA, - wxLANGUAGE_KASHMIRI, - wxLANGUAGE_KASHMIRI_INDIA, - wxLANGUAGE_KAZAKH, - wxLANGUAGE_KERNEWEK, - wxLANGUAGE_KINYARWANDA, - wxLANGUAGE_KIRGHIZ, - wxLANGUAGE_KIRUNDI, - wxLANGUAGE_KONKANI, - wxLANGUAGE_KOREAN, - wxLANGUAGE_KURDISH, - wxLANGUAGE_LAOTHIAN, - wxLANGUAGE_LATIN, - wxLANGUAGE_LATVIAN, - wxLANGUAGE_LINGALA, - wxLANGUAGE_LITHUANIAN, - wxLANGUAGE_MACEDONIAN, - wxLANGUAGE_MALAGASY, - wxLANGUAGE_MALAY, - wxLANGUAGE_MALAYALAM, - wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, - wxLANGUAGE_MALAY_MALAYSIA, - wxLANGUAGE_MALTESE, - wxLANGUAGE_MANIPURI, - wxLANGUAGE_MAORI, - wxLANGUAGE_MARATHI, - wxLANGUAGE_MOLDAVIAN, - wxLANGUAGE_MONGOLIAN, - wxLANGUAGE_NAURU, - wxLANGUAGE_NEPALI, - wxLANGUAGE_NEPALI_INDIA, - wxLANGUAGE_NORWEGIAN_BOKMAL, - wxLANGUAGE_NORWEGIAN_NYNORSK, - wxLANGUAGE_OCCITAN, - wxLANGUAGE_ORIYA, - wxLANGUAGE_OROMO, - wxLANGUAGE_PASHTO, - wxLANGUAGE_POLISH, - wxLANGUAGE_PORTUGUESE, - wxLANGUAGE_PORTUGUESE_BRAZILIAN, - wxLANGUAGE_PUNJABI, - wxLANGUAGE_QUECHUA, - wxLANGUAGE_RHAETO_ROMANCE, - wxLANGUAGE_ROMANIAN, - wxLANGUAGE_RUSSIAN, - wxLANGUAGE_RUSSIAN_UKRAINE, - wxLANGUAGE_SAMOAN, - wxLANGUAGE_SANGHO, - wxLANGUAGE_SANSKRIT, - wxLANGUAGE_SCOTS_GAELIC, - wxLANGUAGE_SERBIAN, - wxLANGUAGE_SERBIAN_CYRILLIC, - wxLANGUAGE_SERBIAN_LATIN, - wxLANGUAGE_SERBO_CROATIAN, - wxLANGUAGE_SESOTHO, - wxLANGUAGE_SETSWANA, - wxLANGUAGE_SHONA, - wxLANGUAGE_SINDHI, - wxLANGUAGE_SINHALESE, - wxLANGUAGE_SISWATI, - wxLANGUAGE_SLOVAK, - wxLANGUAGE_SLOVENIAN, - wxLANGUAGE_SOMALI, - wxLANGUAGE_SPANISH, - wxLANGUAGE_SPANISH_ARGENTINA, - wxLANGUAGE_SPANISH_BOLIVIA, - wxLANGUAGE_SPANISH_CHILE, - wxLANGUAGE_SPANISH_COLOMBIA, - wxLANGUAGE_SPANISH_COSTA_RICA, - wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, - wxLANGUAGE_SPANISH_ECUADOR, - wxLANGUAGE_SPANISH_EL_SALVADOR, - wxLANGUAGE_SPANISH_GUATEMALA, - wxLANGUAGE_SPANISH_HONDURAS, - wxLANGUAGE_SPANISH_MEXICAN, - wxLANGUAGE_SPANISH_MODERN, - wxLANGUAGE_SPANISH_NICARAGUA, - wxLANGUAGE_SPANISH_PANAMA, - wxLANGUAGE_SPANISH_PARAGUAY, - wxLANGUAGE_SPANISH_PERU, - wxLANGUAGE_SPANISH_PUERTO_RICO, - wxLANGUAGE_SPANISH_URUGUAY, - wxLANGUAGE_SPANISH_US, - wxLANGUAGE_SPANISH_VENEZUELA, - wxLANGUAGE_SUNDANESE, - wxLANGUAGE_SWAHILI, - wxLANGUAGE_SWEDISH, - wxLANGUAGE_SWEDISH_FINLAND, - wxLANGUAGE_TAGALOG, - wxLANGUAGE_TAJIK, - wxLANGUAGE_TAMIL, - wxLANGUAGE_TATAR, - wxLANGUAGE_TELUGU, - wxLANGUAGE_THAI, - wxLANGUAGE_TIBETAN, - wxLANGUAGE_TIGRINYA, - wxLANGUAGE_TONGA, - wxLANGUAGE_TSONGA, - wxLANGUAGE_TURKISH, - wxLANGUAGE_TURKMEN, - wxLANGUAGE_TWI, - wxLANGUAGE_UIGHUR, - wxLANGUAGE_UKRAINIAN, - wxLANGUAGE_URDU, - wxLANGUAGE_URDU_INDIA, - wxLANGUAGE_URDU_PAKISTAN, - wxLANGUAGE_UZBEK, - wxLANGUAGE_UZBEK_CYRILLIC, - wxLANGUAGE_UZBEK_LATIN, - wxLANGUAGE_VIETNAMESE, - wxLANGUAGE_VOLAPUK, - wxLANGUAGE_WELSH, - wxLANGUAGE_WOLOF, - wxLANGUAGE_XHOSA, - wxLANGUAGE_YIDDISH, - wxLANGUAGE_YORUBA, - wxLANGUAGE_ZHUANG, - wxLANGUAGE_ZULU, - - // for custom, user-defined languages: - wxLANGUAGE_USER_DEFINED - - -#if wxABI_VERSION >= 20808 - // For binary compatibility, we can't put new items in their normal - // position in the enum, because it would change other values. We have to - // put it somewhere well outside normal range -- the particular value used - // is arbitrary: - , wxLANGUAGE_VALENCIAN = 0x1fffffff, - wxLANGUAGE_SAMI -#endif -}; - -// --- --- --- generated code ends here --- --- --- - -// ---------------------------------------------------------------------------- -// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. -// translation information -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxLanguageInfo -{ - int Language; // wxLanguage id - wxString CanonicalName; // Canonical name, e.g. fr_FR -#ifdef __WIN32__ - wxUint32 WinLang, // Win32 language identifiers - WinSublang; -#endif // __WIN32__ - wxString Description; // human-readable name of the language - wxLayoutDirection LayoutDirection; -}; - -// ---------------------------------------------------------------------------- -// wxLocaleCategory: the category of locale settings -// ---------------------------------------------------------------------------- - -enum wxLocaleCategory -{ - // (any) numbers - wxLOCALE_CAT_NUMBER, - - // date/time - wxLOCALE_CAT_DATE, - - // monetary value - wxLOCALE_CAT_MONEY, - - wxLOCALE_CAT_MAX -}; - -// ---------------------------------------------------------------------------- -// wxLocaleInfo: the items understood by wxLocale::GetInfo() -// ---------------------------------------------------------------------------- - -enum wxLocaleInfo -{ - // the thounsands separator - wxLOCALE_THOUSANDS_SEP, - - // the character used as decimal point - wxLOCALE_DECIMAL_POINT - -}; - -// ---------------------------------------------------------------------------- -// wxLocale: encapsulates all language dependent settings, including current -// message catalogs, date, time and currency formats (TODO) &c -// ---------------------------------------------------------------------------- - -enum wxLocaleInitFlags -{ - wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? - wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? -}; - -class WXDLLIMPEXP_BASE wxLocale -{ -public: - // ctor & dtor - // ----------- - - // call Init() if you use this ctor - wxLocale() { DoCommonInit(); } - - // the ctor has a side effect of changing current locale - wxLocale(const wxChar *szName, // name (for messages) - const wxChar *szShort = (const wxChar *) NULL, // dir prefix (for msg files) - const wxChar *szLocale = (const wxChar *) NULL, // locale (for setlocale) - bool bLoadDefault = true, // preload wxstd.mo? - bool bConvertEncoding = false) // convert Win<->Unix if necessary? - { - DoCommonInit(); - - Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding); - } - - wxLocale(int language, // wxLanguage id or custom language - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) - { - DoCommonInit(); - - Init(language, flags); - } - - // the same as a function (returns true on success) - bool Init(const wxChar *szName, - const wxChar *szShort = (const wxChar *) NULL, - const wxChar *szLocale = (const wxChar *) NULL, - bool bLoadDefault = true, - bool bConvertEncoding = false); - - // same as second ctor (returns true on success) - bool Init(int language = wxLANGUAGE_DEFAULT, - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); - - // restores old locale - virtual ~wxLocale(); - - // Try to get user's (or OS's) preferred language setting. - // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed - static int GetSystemLanguage(); - - // get the encoding used by default for text on this system, returns - // wxFONTENCODING_SYSTEM if it couldn't be determined - static wxFontEncoding GetSystemEncoding(); - - // get the string describing the system encoding, return empty string if - // couldn't be determined - static wxString GetSystemEncodingName(); - - // get the values of the given locale-dependent datum: the current locale - // is used, the US default value is returned if everything else fails - static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat); - - // return true if the locale was set successfully - bool IsOk() const { return m_pszOldLocale != NULL; } - - // returns locale name - const wxChar *GetLocale() const { return m_strLocale; } - - // return current locale wxLanguage value - int GetLanguage() const { return m_language; } - - // return locale name to be passed to setlocale() - wxString GetSysName() const; - - // return 'canonical' name, i.e. in the form of xx[_YY], where xx is - // language code according to ISO 639 and YY is country name - // as specified by ISO 3166. - wxString GetCanonicalName() const { return m_strShort; } - - // add a prefix to the catalog lookup path: the message catalog files will be - // looked up under prefix//LC_MESSAGES, prefix/LC_MESSAGES and prefix - // (in this order). - // - // This only applies to subsequent invocations of AddCatalog()! - static void AddCatalogLookupPathPrefix(const wxString& prefix); - - // add a catalog: it's searched for in standard places (current directory - // first, system one after), but the you may prepend additional directories to - // the search path with AddCatalogLookupPathPrefix(). - // - // The loaded catalog will be used for message lookup by GetString(). - // - // Returns 'true' if it was successfully loaded - bool AddCatalog(const wxChar *szDomain); - bool AddCatalog(const wxChar *szDomain, - wxLanguage msgIdLanguage, const wxChar *msgIdCharset); - - // check if the given locale is provided by OS and C run time - static bool IsAvailable(int lang); - - // check if the given catalog is loaded - bool IsLoaded(const wxChar *szDomain) const; - - // Retrieve the language info struct for the given language - // - // Returns NULL if no info found, pointer must *not* be deleted by caller - static const wxLanguageInfo *GetLanguageInfo(int lang); - - // Returns language name in English or empty string if the language - // is not in database - static wxString GetLanguageName(int lang); - - // Find the language for the given locale string which may be either a - // canonical ISO 2 letter language code ("xx"), a language code followed by - // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") - // - // Returns NULL if no info found, pointer must *not* be deleted by caller - static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); - - // Add custom language to the list of known languages. - // Notes: 1) wxLanguageInfo contains platform-specific data - // 2) must be called before Init to have effect - static void AddLanguage(const wxLanguageInfo& info); - - // retrieve the translation for a string in all loaded domains unless - // the szDomain parameter is specified (and then only this domain is - // searched) - // n - additional parameter for PluralFormsParser - // - // return original string if translation is not available - // (in this case an error message is generated the first time - // a string is not found; use wxLogNull to suppress it) - // - // domains are searched in the last to first order, i.e. catalogs - // added later override those added before. - virtual const wxChar *GetString(const wxChar *szOrigString, - const wxChar *szDomain = NULL) const; - // plural form version of the same: - virtual const wxChar *GetString(const wxChar *szOrigString, - const wxChar *szOrigString2, - size_t n, - const wxChar *szDomain = NULL) const; - - // Returns the current short name for the locale - const wxString& GetName() const { return m_strShort; } - - // return the contents of .po file header - wxString GetHeaderValue( const wxChar* szHeader, - const wxChar* szDomain = NULL ) const; - - // These two methods are for internal use only. First one creates - // ms_languagesDB if it doesn't already exist, second one destroys - // it. - static void CreateLanguagesDB(); - static void DestroyLanguagesDB(); - -private: - // find catalog by name in a linked list, return NULL if !found - wxMsgCatalog *FindCatalog(const wxChar *szDomain) const; - - // copy default table of languages from global static array to - // m_langugagesInfo, called by InitLanguagesDB - static void InitLanguagesDB(); - - // initialize the member fields to default values - void DoCommonInit(); - - wxString m_strLocale, // this locale name - m_strShort; // short name for the locale - int m_language; // this locale wxLanguage value - - const wxChar *m_pszOldLocale; // previous locale from setlocale() - wxLocale *m_pOldLocale; // previous wxLocale - - wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs - - bool m_bConvertEncoding; - - bool m_initialized; - - static wxLanguageInfoArray *ms_languagesDB; - - DECLARE_NO_COPY_CLASS(wxLocale) -}; - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// get the current locale object (note that it may be NULL!) -extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); - -// get the translation of the string in the current locale -inline const wxChar * -wxGetTranslation(const wxChar *sz, const wxChar* domain = NULL) -{ - wxLocale *pLoc = wxGetLocale(); - if (pLoc) - return pLoc->GetString(sz, domain); - else - return sz; -} - -inline const wxChar * -wxGetTranslation(const wxChar *sz1, const wxChar *sz2, - size_t n, - const wxChar *domain = NULL) -{ - wxLocale *pLoc = wxGetLocale(); - if (pLoc) - return pLoc->GetString(sz1, sz2, n, domain); - else - return n == 1 ? sz1 : sz2; -} - -#else // !wxUSE_INTL - -// the macros should still be defined - otherwise compilation would fail - -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(_) - #define _(s) (wxT(s)) - #endif - #define wxPLURAL(sing, plur, n) ((n) == 1 ? wxT(sing) : wxT(plur)) -#endif - -#define wxTRANSLATE(str) wxT(str) - -inline const wxChar * -wxGetTranslation(const wxChar *sz, const wxChar * WXUNUSED(domain) = NULL) -{ - return sz; -} - -#endif // wxUSE_INTL/!wxUSE_INTL - -// define this one just in case it occurs somewhere (instead of preferred -// wxTRANSLATE) too -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(gettext_noop) - #define gettext_noop(str) wxT(str) - #endif - #if !defined(N_) - #define N_(s) wxT(s) - #endif -#endif - -#endif // _WX_INTL_H_ diff --git a/Source/3rdParty/wx/include/wx/iosfwrap.h b/Source/3rdParty/wx/include/wx/iosfwrap.h deleted file mode 100644 index 0a68afcc2..000000000 --- a/Source/3rdParty/wx/include/wx/iosfwrap.h +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iosfwrap.h -// Purpose: includes the correct stream-related forward declarations -// Author: Jan van Dijk -// Modified by: -// Created: 18.12.2002 -// RCS-ID: $Id: iosfwrap.h 33555 2005-04-12 21:06:03Z ABX $ -// Copyright: wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#if wxUSE_STD_IOSTREAM - -#if wxUSE_IOSTREAMH - // There is no pre-ANSI iosfwd header so we include the full declarations. -# include -#else -# include -#endif - -#ifdef __WXMSW__ -# include "wx/msw/winundef.h" -#endif - -#endif // wxUSE_STD_IOSTREAM - diff --git a/Source/3rdParty/wx/include/wx/ioswrap.h b/Source/3rdParty/wx/include/wx/ioswrap.h deleted file mode 100644 index 19292af5d..000000000 --- a/Source/3rdParty/wx/include/wx/ioswrap.h +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/ioswrap.h -// Purpose: includes the correct iostream headers for current compiler -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.02.99 -// RCS-ID: $Id: ioswrap.h 33555 2005-04-12 21:06:03Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#if wxUSE_STD_IOSTREAM - -#if wxUSE_IOSTREAMH -# include -#else -# include -#endif - -#ifdef __WXMSW__ -# include "wx/msw/winundef.h" -#endif - -#endif - // wxUSE_STD_IOSTREAM - diff --git a/Source/3rdParty/wx/include/wx/ipcbase.h b/Source/3rdParty/wx/include/wx/ipcbase.h deleted file mode 100644 index d2a48f621..000000000 --- a/Source/3rdParty/wx/include/wx/ipcbase.h +++ /dev/null @@ -1,163 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ipcbase.h -// Purpose: Base classes for IPC -// Author: Julian Smart -// Modified by: -// Created: 4/1/98 -// RCS-ID: $Id: ipcbase.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IPCBASEH__ -#define _WX_IPCBASEH__ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -enum wxIPCFormat -{ - wxIPC_INVALID = 0, - wxIPC_TEXT = 1, /* CF_TEXT */ - wxIPC_BITMAP = 2, /* CF_BITMAP */ - wxIPC_METAFILE = 3, /* CF_METAFILEPICT */ - wxIPC_SYLK = 4, - wxIPC_DIF = 5, - wxIPC_TIFF = 6, - wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */ - wxIPC_DIB = 8, /* CF_DIB */ - wxIPC_PALETTE = 9, - wxIPC_PENDATA = 10, - wxIPC_RIFF = 11, - wxIPC_WAVE = 12, - wxIPC_UNICODETEXT = 13, - wxIPC_ENHMETAFILE = 14, - wxIPC_FILENAME = 15, /* CF_HDROP */ - wxIPC_LOCALE = 16, - wxIPC_PRIVATE = 20 -}; - -class WXDLLIMPEXP_FWD_BASE wxServerBase; -class WXDLLIMPEXP_FWD_BASE wxClientBase; - -class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject -{ - DECLARE_CLASS(wxConnectionBase) - -public: - wxConnectionBase(wxChar *buffer, int size); // use external buffer - wxConnectionBase(); // use internal, adaptive buffer - wxConnectionBase(const wxConnectionBase& copy); - virtual ~wxConnectionBase(void); - - void SetConnected( bool c ) { m_connected = c; } - bool GetConnected() { return m_connected; } - - // Calls that CLIENT can make - virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0; - virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } - virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0; - virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; - virtual bool StartAdvise(const wxString& item) = 0; - virtual bool StopAdvise(const wxString& item) = 0; - - // Calls that SERVER can make - virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; - - // Calls that both can make - virtual bool Disconnect(void) = 0; - - // Callbacks to SERVER - override at will - virtual bool OnExecute ( const wxString& WXUNUSED(topic), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - int *WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return (wxChar *) NULL; } - - virtual bool OnPoke ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item) ) - { return false; } - - virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item) ) - { return false; } - - // Callbacks to CLIENT - override at will - virtual bool OnAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - // Callbacks to BOTH - override at will - // Default behaviour is to delete connection and return true - virtual bool OnDisconnect(void) = 0; - - // return a buffer at least this size, reallocating buffer if needed - // returns NULL if using an inadequate user buffer - it can't be resized - wxChar * GetBufferAtLeast( size_t bytes ); - -protected: - bool m_connected; -private: - wxChar * m_buffer; - size_t m_buffersize; - bool m_deletebufferwhendone; - - // can't use DECLARE_NO_COPY_CLASS(wxConnectionBase) because we already - // have copy ctor but still forbid the default assignment operator - wxConnectionBase& operator=(const wxConnectionBase&); -}; - - -class WXDLLIMPEXP_BASE wxServerBase: public wxObject -{ - DECLARE_CLASS(wxServerBase) - -public: - inline wxServerBase(void) {} - inline ~wxServerBase(void) {} - - // Returns false on error (e.g. port number is already in use) - virtual bool Create(const wxString& serverName) = 0; - - // Callbacks to SERVER - override at will - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; -}; - -class WXDLLIMPEXP_BASE wxClientBase: public wxObject -{ - DECLARE_CLASS(wxClientBase) - -public: - inline wxClientBase(void) {} - inline ~wxClientBase(void) {} - - virtual bool ValidHost(const wxString& host) = 0; - - // Call this to make a connection. Returns NULL if cannot. - virtual wxConnectionBase *MakeConnection(const wxString& host, - const wxString& server, - const wxString& topic) = 0; - - // Callbacks to CLIENT - override at will - virtual wxConnectionBase *OnMakeConnection(void) = 0; -}; - -#endif - // _WX_IPCBASEH__ diff --git a/Source/3rdParty/wx/include/wx/layout.h b/Source/3rdParty/wx/include/wx/layout.h deleted file mode 100644 index 4a6d82d7b..000000000 --- a/Source/3rdParty/wx/include/wx/layout.h +++ /dev/null @@ -1,191 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/layout.h -// Purpose: OBSOLETE layout constraint classes, use sizers instead -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: layout.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LAYOUT_H_ -#define _WX_LAYOUT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" - -// X stupidly defines these in X.h -#ifdef Above - #undef Above -#endif -#ifdef Below - #undef Below -#endif - -#if wxUSE_CONSTRAINTS - -// ---------------------------------------------------------------------------- -// forward declrations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxWindowBase; -class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#define wxLAYOUT_DEFAULT_MARGIN 0 - -enum wxEdge -{ - wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, - wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY -}; - -enum wxRelationship -{ - wxUnconstrained = 0, - wxAsIs, - wxPercentOf, - wxAbove, - wxBelow, - wxLeftOf, - wxRightOf, - wxSameAs, - wxAbsolute -}; - -// ---------------------------------------------------------------------------- -// wxIndividualLayoutConstraint: a constraint on window position -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxIndividualLayoutConstraint : public wxObject -{ -public: - wxIndividualLayoutConstraint(); - - // note that default copy ctor and assignment operators are ok - - virtual ~wxIndividualLayoutConstraint(){} - - void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // - // Sibling relationships - // - void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // - // 'Same edge' alignment - // - void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // The edge is a percentage of the other window's edge - void PercentOf(wxWindowBase *otherW, wxEdge wh, int per); - - // - // Edge has absolute value - // - void Absolute(int val); - - // - // Dimension is unconstrained - // - void Unconstrained() { relationship = wxUnconstrained; } - - // - // Dimension is 'as is' (use current size settings) - // - void AsIs() { relationship = wxAsIs; } - - // - // Accessors - // - wxWindowBase *GetOtherWindow() { return otherWin; } - wxEdge GetMyEdge() const { return myEdge; } - void SetEdge(wxEdge which) { myEdge = which; } - void SetValue(int v) { value = v; } - int GetMargin() { return margin; } - void SetMargin(int m) { margin = m; } - int GetValue() const { return value; } - int GetPercent() const { return percent; } - int GetOtherEdge() const { return otherEdge; } - bool GetDone() const { return done; } - void SetDone(bool d) { done = d; } - wxRelationship GetRelationship() { return relationship; } - void SetRelationship(wxRelationship r) { relationship = r; } - - // Reset constraint if it mentions otherWin - bool ResetIfWin(wxWindowBase *otherW); - - // Try to satisfy constraint - bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win); - - // Get the value of this edge or dimension, or if this - // is not determinable, -1. - int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const; - -protected: - // To be allowed to modify the internal variables - friend class wxIndividualLayoutConstraint_Serialize; - - // 'This' window is the parent or sibling of otherWin - wxWindowBase *otherWin; - - wxEdge myEdge; - wxRelationship relationship; - int margin; - int value; - int percent; - wxEdge otherEdge; - bool done; - - DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint) -}; - -// ---------------------------------------------------------------------------- -// wxLayoutConstraints: the complete set of constraints for a window -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxLayoutConstraints : public wxObject -{ -public: - // Edge constraints - wxIndividualLayoutConstraint left; - wxIndividualLayoutConstraint top; - wxIndividualLayoutConstraint right; - wxIndividualLayoutConstraint bottom; - // Size constraints - wxIndividualLayoutConstraint width; - wxIndividualLayoutConstraint height; - // Centre constraints - wxIndividualLayoutConstraint centreX; - wxIndividualLayoutConstraint centreY; - - wxLayoutConstraints(); - - // note that default copy ctor and assignment operators are ok - - virtual ~wxLayoutConstraints(){} - - bool SatisfyConstraints(wxWindowBase *win, int *noChanges); - bool AreSatisfied() const - { - return left.GetDone() && top.GetDone() && - width.GetDone() && height.GetDone(); - } - - DECLARE_DYNAMIC_CLASS(wxLayoutConstraints) -}; - -#endif // wxUSE_CONSTRAINTS - -#endif // _WX_LAYOUT_H_ diff --git a/Source/3rdParty/wx/include/wx/list.h b/Source/3rdParty/wx/include/wx/list.h deleted file mode 100644 index 1d3a69af3..000000000 --- a/Source/3rdParty/wx/include/wx/list.h +++ /dev/null @@ -1,1308 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/list.h -// Purpose: wxList, wxStringList classes -// Author: Julian Smart -// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added -// Created: 29/01/98 -// RCS-ID: $Id: list.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - All this is quite ugly but serves two purposes: - 1. Be almost 100% compatible with old, untyped, wxList class - 2. Ensure compile-time type checking for the linked lists - - The idea is to have one base class (wxListBase) working with "void *" data, - but to hide these untyped functions - i.e. make them protected, so they - can only be used from derived classes which have inline member functions - working with right types. This achieves the 2nd goal. As for the first one, - we provide a special derivation of wxListBase called wxList which looks just - like the old class. -*/ - -#ifndef _WX_LISTH__ -#define _WX_LISTH__ - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -#if wxUSE_STL - #include "wx/beforestd.h" - #include - #include - #include - #include "wx/afterstd.h" -#endif - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// type of compare function for list sort operation (as in 'qsort'): it should -// return a negative value, 0 or positive value if the first element is less -// than, equal or greater than the second - -extern "C" -{ -typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); -} - -class WXDLLIMPEXP_FWD_BASE wxObjectListNode; -typedef wxObjectListNode wxNode; - -// -typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#if !defined(wxENUM_KEY_TYPE_DEFINED) -#define wxENUM_KEY_TYPE_DEFINED - -enum wxKeyType -{ - wxKEY_NONE, - wxKEY_INTEGER, - wxKEY_STRING -}; - -#endif - -#if wxUSE_STL - -#define wxLIST_COMPATIBILITY - -#define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \ - WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) -#define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \ - WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) - -#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ - WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) -#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \ - WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ - -#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ - WX_DECLARE_LIST_XO(elT*, liT, decl) - -#if !defined( __VISUALC__ ) - -template -class WXDLLIMPEXP_BASE wxList_SortFunction -{ -public: - wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f((T*)&i1, (T*)&i2) < 0; } -private: - wxSortCompareFunction m_f; -}; - -#define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction(f) -#define VC6_WORKAROUND(elT, liT, decl) - -#else // if defined( __VISUALC__ ) - -#define WX_LIST_SORTFUNCTION( elT, f ) std::greater( f ) -#define VC6_WORKAROUND(elT, liT, decl) \ - decl liT; \ - \ - /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \ - /* to be passed into std::list::sort() */ \ - template <> \ - struct std::greater \ - { \ - private: \ - wxSortCompareFunction m_CompFunc; \ - public: \ - greater( wxSortCompareFunction compfunc = NULL ) \ - : m_CompFunc( compfunc ) {} \ - bool operator()(const elT X, const elT Y) const \ - { \ - return m_CompFunc ? \ - ( m_CompFunc( X, Y ) < 0 ) : \ - ( X > Y ); \ - } \ - }; - -#endif // defined( __VISUALC__ ) - -/* - Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround - for mingw 3.2.3 compiler bug that prevents a static function of liT class - from being exported into dll. A minimal code snippet reproducing the bug: - - struct WXDLLEXPORT Foo - { - static void Bar(); - struct SomeInnerClass - { - friend class Foo; // comment this out to make it link - }; - ~Foo() - { - Bar(); - } - }; - - The program does not link under mingw_gcc 3.2.3 producing undefined - reference to Foo::Bar() function - - - Note 2: the EmptyList is needed to allow having a NULL pointer-like - invalid iterator. We used to use just an uninitialized iterator object - instead but this fails with some debug/checked versions of STL, notably the - glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate - invalid iterator. - */ - -// the real wxList-class declaration -#define WX_DECLARE_LIST_XO(elT, liT, decl) \ - decl _WX_LIST_HELPER_##liT \ - { \ - typedef elT _WX_LIST_ITEM_TYPE_##liT; \ - public: \ - static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ - }; \ - \ - VC6_WORKAROUND(elT, liT, decl) \ - decl liT : public std::list \ - { \ - private: \ - typedef std::list BaseListType; \ - static BaseListType EmptyList; \ - \ - bool m_destroy; \ - \ - public: \ - decl compatibility_iterator \ - { \ - private: \ - /* Workaround for broken VC6 nested class name resolution */ \ - typedef std::list::iterator iterator; \ - friend class liT; \ - \ - iterator m_iter; \ - liT * m_list; \ - \ - public: \ - compatibility_iterator() \ - : m_iter(EmptyList.end()), m_list( NULL ) {} \ - compatibility_iterator( liT* li, iterator i ) \ - : m_iter( i ), m_list( li ) {} \ - compatibility_iterator( const liT* li, iterator i ) \ - : m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \ - \ - compatibility_iterator* operator->() { return this; } \ - const compatibility_iterator* operator->() const { return this; } \ - \ - bool operator==(const compatibility_iterator& i) const \ - { \ - wxASSERT_MSG( m_list && i.m_list, \ - wxT("comparing invalid iterators is illegal") ); \ - return (m_list == i.m_list) && (m_iter == i.m_iter); \ - } \ - bool operator!=(const compatibility_iterator& i) const \ - { return !( operator==( i ) ); } \ - operator bool() const \ - { return m_list ? m_iter != m_list->end() : false; } \ - bool operator !() const \ - { return !( operator bool() ); } \ - \ - elT GetData() const \ - { return *m_iter; } \ - void SetData( elT e ) \ - { *m_iter = e; } \ - \ - compatibility_iterator GetNext() const \ - { \ - iterator i = m_iter; \ - return compatibility_iterator( m_list, ++i ); \ - } \ - compatibility_iterator GetPrevious() const \ - { \ - if ( m_iter == m_list->begin() ) \ - return compatibility_iterator(); \ - \ - iterator i = m_iter; \ - return compatibility_iterator( m_list, --i ); \ - } \ - int IndexOf() const \ - { \ - return *this ? std::distance( m_list->begin(), m_iter ) \ - : wxNOT_FOUND; \ - } \ - }; \ - public: \ - liT() : m_destroy( false ) {} \ - \ - compatibility_iterator Find( const elT e ) const \ - { \ - liT* _this = const_cast< liT* >( this ); \ - return compatibility_iterator( _this, \ - std::find( _this->begin(), _this->end(), e ) ); \ - } \ - \ - bool IsEmpty() const \ - { return empty(); } \ - size_t GetCount() const \ - { return size(); } \ - int Number() const \ - { return static_cast< int >( GetCount() ); } \ - \ - compatibility_iterator Item( size_t idx ) const \ - { \ - iterator i = const_cast< liT* >(this)->begin(); \ - std::advance( i, idx ); \ - return compatibility_iterator( this, i ); \ - } \ - elT operator[](size_t idx) const \ - { \ - return Item(idx).GetData(); \ - } \ - \ - compatibility_iterator GetFirst() const \ - { \ - return compatibility_iterator( this, \ - const_cast< liT* >(this)->begin() ); \ - } \ - compatibility_iterator GetLast() const \ - { \ - iterator i = const_cast< liT* >(this)->end(); \ - return compatibility_iterator( this, !empty() ? --i : i ); \ - } \ - compatibility_iterator Member( elT e ) const \ - { return Find( e ); } \ - compatibility_iterator Nth( int n ) const \ - { return Item( n ); } \ - int IndexOf( elT e ) const \ - { return Find( e ).IndexOf(); } \ - \ - compatibility_iterator Append( elT e ) \ - { \ - push_back( e ); \ - return GetLast(); \ - } \ - compatibility_iterator Insert( elT e ) \ - { \ - push_front( e ); \ - return compatibility_iterator( this, begin() ); \ - } \ - compatibility_iterator Insert(const compatibility_iterator &i, elT e) \ - { \ - return compatibility_iterator( this, insert( i.m_iter, e ) ); \ - } \ - compatibility_iterator Insert( size_t idx, elT e ) \ - { \ - return compatibility_iterator( this, \ - insert( Item( idx ).m_iter, e ) ); \ - } \ - \ - void DeleteContents( bool destroy ) \ - { m_destroy = destroy; } \ - bool GetDeleteContents() const \ - { return m_destroy; } \ - void Erase( const compatibility_iterator& i ) \ - { \ - if ( m_destroy ) \ - _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \ - erase( i.m_iter ); \ - } \ - bool DeleteNode( const compatibility_iterator& i ) \ - { \ - if( i ) \ - { \ - Erase( i ); \ - return true; \ - } \ - return false; \ - } \ - bool DeleteObject( elT e ) \ - { \ - return DeleteNode( Find( e ) ); \ - } \ - void Clear() \ - { \ - if ( m_destroy ) \ - std::for_each( begin(), end(), \ - _WX_LIST_HELPER_##liT::DeleteFunction ); \ - clear(); \ - } \ - /* Workaround for broken VC6 std::list::sort() see above */ \ - void Sort( wxSortCompareFunction compfunc ) \ - { sort( WX_LIST_SORTFUNCTION( elT, compfunc ) ); } \ - ~liT() { Clear(); } \ - \ - /* It needs access to our EmptyList */ \ - friend decl compatibility_iterator; \ - } - -#define WX_DECLARE_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class) -#define WX_DECLARE_LIST_PTR(elementtype, listname) \ - WX_DECLARE_LIST(elementtype, listname) - -#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) -#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ - WX_DECLARE_EXPORTED_LIST(elementtype, listname) - -#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo) -#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ - WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) - -// this macro must be inserted in your program after -// #include "wx/listimpl.cpp" -#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" - -#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) - -#else // if !wxUSE_STL - -// due to circular header dependencies this function has to be declared here -// (normally it's found in utils.h which includes itself list.h...) -#if WXWIN_COMPATIBILITY_2_4 -extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s); -#endif - -// undef it to get rid of old, deprecated functions -#define wxLIST_COMPATIBILITY - -// ----------------------------------------------------------------------------- -// key stuff: a list may be optionally keyed on integer or string key -// ----------------------------------------------------------------------------- - -union wxListKeyValue -{ - long integer; - wxChar *string; -}; - -// a struct which may contain both types of keys -// -// implementation note: on one hand, this class allows to have only one function -// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to -// resolve ambiguity which we would otherwise have with wxStringList::Find() and -// wxList::Find(const char *). -class WXDLLIMPEXP_BASE wxListKey -{ -public: - // implicit ctors - wxListKey() : m_keyType(wxKEY_NONE) - { } - wxListKey(long i) : m_keyType(wxKEY_INTEGER) - { m_key.integer = i; } - wxListKey(const wxChar *s) : m_keyType(wxKEY_STRING) - { m_key.string = wxStrdup(s); } - wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) - { m_key.string = wxStrdup(s.c_str()); } - - // accessors - wxKeyType GetKeyType() const { return m_keyType; } - const wxChar *GetString() const - { wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; } - long GetNumber() const - { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } - - // comparison - // Note: implementation moved to list.cpp to prevent BC++ inline - // expansion warning. - bool operator==(wxListKeyValue value) const ; - - // dtor - ~wxListKey() - { - if ( m_keyType == wxKEY_STRING ) - free(m_key.string); - } - -private: - wxKeyType m_keyType; - wxListKeyValue m_key; -}; - -// ----------------------------------------------------------------------------- -// wxNodeBase class is a (base for) node in a double linked list -// ----------------------------------------------------------------------------- - -extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey; - -class WXDLLIMPEXP_FWD_BASE wxListBase; - -class WXDLLIMPEXP_BASE wxNodeBase -{ -friend class wxListBase; -public: - // ctor - wxNodeBase(wxListBase *list = (wxListBase *)NULL, - wxNodeBase *previous = (wxNodeBase *)NULL, - wxNodeBase *next = (wxNodeBase *)NULL, - void *data = NULL, - const wxListKey& key = wxDefaultListKey); - - virtual ~wxNodeBase(); - - // FIXME no check is done that the list is really keyed on strings - const wxChar *GetKeyString() const { return m_key.string; } - long GetKeyInteger() const { return m_key.integer; } - - // Necessary for some existing code - void SetKeyString(wxChar* s) { m_key.string = s; } - void SetKeyInteger(long i) { m_key.integer = i; } - -#ifdef wxLIST_COMPATIBILITY - // compatibility methods, use Get* instead. - wxDEPRECATED( wxNode *Next() const ); - wxDEPRECATED( wxNode *Previous() const ); - wxDEPRECATED( wxObject *Data() const ); -#endif // wxLIST_COMPATIBILITY - -protected: - // all these are going to be "overloaded" in the derived classes - wxNodeBase *GetNext() const { return m_next; } - wxNodeBase *GetPrevious() const { return m_previous; } - - void *GetData() const { return m_data; } - void SetData(void *data) { m_data = data; } - - // get 0-based index of this node within the list or wxNOT_FOUND - int IndexOf() const; - - virtual void DeleteData() { } -public: - // for wxList::iterator - void** GetDataPtr() const { return &(((wxNodeBase*)this)->m_data); } -private: - // optional key stuff - wxListKeyValue m_key; - - void *m_data; // user data - wxNodeBase *m_next, // next and previous nodes in the list - *m_previous; - - wxListBase *m_list; // list we belong to - - DECLARE_NO_COPY_CLASS(wxNodeBase) -}; - -// ----------------------------------------------------------------------------- -// a double-linked list class -// ----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxList; - -class WXDLLIMPEXP_BASE wxListBase : public wxObject -{ -friend class WXDLLIMPEXP_FWD_BASE wxNodeBase; // should be able to call DetachNode() -friend class wxHashTableBase; // should be able to call untyped Find() - -public: - // default ctor & dtor - wxListBase(wxKeyType keyType = wxKEY_NONE) - { Init(keyType); } - virtual ~wxListBase(); - - // accessors - // count of items in the list - size_t GetCount() const { return m_count; } - - // return true if this list is empty - bool IsEmpty() const { return m_count == 0; } - - // operations - - // delete all nodes - void Clear(); - - // instruct it to destroy user data when deleting nodes - void DeleteContents(bool destroy) { m_destroy = destroy; } - - // query if to delete - bool GetDeleteContents() const - { return m_destroy; } - - // get the keytype - wxKeyType GetKeyType() const - { return m_keyType; } - - // set the keytype (required by the serial code) - void SetKeyType(wxKeyType keyType) - { wxASSERT( m_count==0 ); m_keyType = keyType; } - -#ifdef wxLIST_COMPATIBILITY - // compatibility methods from old wxList - wxDEPRECATED( int Number() const ); // use GetCount instead. - wxDEPRECATED( wxNode *First() const ); // use GetFirst - wxDEPRECATED( wxNode *Last() const ); // use GetLast - wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item - - // kludge for typesafe list migration in core classes. - wxDEPRECATED( operator wxList&() const ); -#endif // wxLIST_COMPATIBILITY - -protected: - - // all methods here are "overloaded" in derived classes to provide compile - // time type checking - - // create a node for the list of this type - virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, - void *data, - const wxListKey& key = wxDefaultListKey) = 0; - -// Can't access these from derived classes otherwise (bug in Salford C++?) -#ifdef __SALFORDC__ -public: -#endif - - // ctors - // from an array - wxListBase(size_t count, void *elements[]); - // from a sequence of objects - wxListBase(void *object, ... /* terminate with NULL */); - -protected: - void Assign(const wxListBase& list) - { Clear(); DoCopy(list); } - - // get list head/tail - wxNodeBase *GetFirst() const { return m_nodeFirst; } - wxNodeBase *GetLast() const { return m_nodeLast; } - - // by (0-based) index - wxNodeBase *Item(size_t index) const; - - // get the list item's data - void *operator[](size_t n) const - { - wxNodeBase *node = Item(n); - - return node ? node->GetData() : (wxNodeBase *)NULL; - } - - // operations - // append to end of list - wxNodeBase *Prepend(void *object) - { return (wxNodeBase *)wxListBase::Insert(object); } - // append to beginning of list - wxNodeBase *Append(void *object); - // insert a new item at the beginning of the list - wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); } - // insert a new item at the given position - wxNodeBase *Insert(size_t pos, void *object) - { return pos == GetCount() ? Append(object) - : Insert(Item(pos), object); } - // insert before given node or at front of list if prev == NULL - wxNodeBase *Insert(wxNodeBase *prev, void *object); - - // keyed append - wxNodeBase *Append(long key, void *object); - wxNodeBase *Append(const wxChar *key, void *object); - - // removes node from the list but doesn't delete it (returns pointer - // to the node or NULL if it wasn't found in the list) - wxNodeBase *DetachNode(wxNodeBase *node); - // delete element from list, returns false if node not found - bool DeleteNode(wxNodeBase *node); - // finds object pointer and deletes node (and object if DeleteContents - // is on), returns false if object not found - bool DeleteObject(void *object); - - // search (all return NULL if item not found) - // by data - wxNodeBase *Find(const void *object) const; - - // by key - wxNodeBase *Find(const wxListKey& key) const; - - // get 0-based index of object or wxNOT_FOUND - int IndexOf( void *object ) const; - - // this function allows the sorting of arbitrary lists by giving - // a function to compare two list elements. The list is sorted in place. - void Sort(const wxSortCompareFunction compfunc); - - // functions for iterating over the list - void *FirstThat(wxListIterateFunction func); - void ForEach(wxListIterateFunction func); - void *LastThat(wxListIterateFunction func); - - // for STL interface, "last" points to one after the last node - // of the controlled sequence (NULL for the end of the list) - void Reverse(); - void DeleteNodes(wxNodeBase* first, wxNodeBase* last); -private: - - // common part of all ctors - void Init(wxKeyType keyType = wxKEY_NONE); - - // helpers - // common part of copy ctor and assignment operator - void DoCopy(const wxListBase& list); - // common part of all Append()s - wxNodeBase *AppendCommon(wxNodeBase *node); - // free node's data and node itself - void DoDeleteNode(wxNodeBase *node); - - size_t m_count; // number of elements in the list - bool m_destroy; // destroy user data when deleting list items? - wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list - *m_nodeLast; - - wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE) -}; - -// ----------------------------------------------------------------------------- -// macros for definition of "template" list type -// ----------------------------------------------------------------------------- - -// and now some heavy magic... - -// declare a list type named 'name' and containing elements of type 'T *' -// (as a by product of macro expansion you also get wx##name##Node -// wxNode-derived type) -// -// implementation details: -// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type -// for the list of given type - this allows us to pass only the list name -// to WX_DEFINE_LIST() even if it needs both the name and the type -// -// 2. We redefine all non-type-safe wxList functions with type-safe versions -// which don't take any space (everything is inline), but bring compile -// time error checking. -// -// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of -// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most -// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes -// interesting capability to store polymorphic objects in the list and is -// particularly useful with, for example, "wxWindow *" list where the -// wxWindowBase pointers are put into the list, but wxWindow pointers are -// retrieved from it. -// -// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of -// WX_DECLARE_LIST_4 to allow defining classes without operator->() as -// it results in compiler warnings when this operator doesn't make sense -// (i.e. stored elements are not pointers) - -// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3 -#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \ - typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ - \ - classexp nodetype : public wxNodeBase \ - { \ - public: \ - nodetype(wxListBase *list = (wxListBase *)NULL, \ - nodetype *previous = (nodetype *)NULL, \ - nodetype *next = (nodetype *)NULL, \ - T *data = (T *)NULL, \ - const wxListKey& key = wxDefaultListKey) \ - : wxNodeBase(list, previous, next, data, key) { } \ - \ - nodetype *GetNext() const \ - { return (nodetype *)wxNodeBase::GetNext(); } \ - nodetype *GetPrevious() const \ - { return (nodetype *)wxNodeBase::GetPrevious(); } \ - \ - T *GetData() const \ - { return (T *)wxNodeBase::GetData(); } \ - void SetData(T *data) \ - { wxNodeBase::SetData(data); } \ - \ - protected: \ - virtual void DeleteData(); \ - \ - DECLARE_NO_COPY_CLASS(nodetype) \ - }; \ - \ - classexp name : public wxListBase \ - { \ - public: \ - typedef nodetype Node; \ - classexp compatibility_iterator \ - { \ - public: \ - compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ - \ - Node *operator->() const { return m_ptr; } \ - operator Node *() const { return m_ptr; } \ - \ - private: \ - Node *m_ptr; \ - }; \ - \ - name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ - { } \ - name(const name& list) : wxListBase(list.GetKeyType()) \ - { Assign(list); } \ - name(size_t count, T *elements[]) \ - : wxListBase(count, (void **)elements) { } \ - \ - name& operator=(const name& list) \ - { Assign(list); return *this; } \ - \ - nodetype *GetFirst() const \ - { return (nodetype *)wxListBase::GetFirst(); } \ - nodetype *GetLast() const \ - { return (nodetype *)wxListBase::GetLast(); } \ - \ - nodetype *Item(size_t index) const \ - { return (nodetype *)wxListBase::Item(index); } \ - \ - T *operator[](size_t index) const \ - { \ - nodetype *node = Item(index); \ - return node ? (T*)(node->GetData()) : (T*)NULL; \ - } \ - \ - nodetype *Append(Tbase *object) \ - { return (nodetype *)wxListBase::Append(object); } \ - nodetype *Insert(Tbase *object) \ - { return (nodetype *)Insert((nodetype*)NULL, object); } \ - nodetype *Insert(size_t pos, Tbase *object) \ - { return (nodetype *)wxListBase::Insert(pos, object); } \ - nodetype *Insert(nodetype *prev, Tbase *object) \ - { return (nodetype *)wxListBase::Insert(prev, object); } \ - \ - nodetype *Append(long key, void *object) \ - { return (nodetype *)wxListBase::Append(key, object); } \ - nodetype *Append(const wxChar *key, void *object) \ - { return (nodetype *)wxListBase::Append(key, object); } \ - \ - nodetype *DetachNode(nodetype *node) \ - { return (nodetype *)wxListBase::DetachNode(node); } \ - bool DeleteNode(nodetype *node) \ - { return wxListBase::DeleteNode(node); } \ - bool DeleteObject(Tbase *object) \ - { return wxListBase::DeleteObject(object); } \ - void Erase(nodetype *it) \ - { DeleteNode(it); } \ - \ - nodetype *Find(const Tbase *object) const \ - { return (nodetype *)wxListBase::Find(object); } \ - \ - virtual nodetype *Find(const wxListKey& key) const \ - { return (nodetype *)wxListBase::Find(key); } \ - \ - int IndexOf(Tbase *object) const \ - { return wxListBase::IndexOf(object); } \ - \ - void Sort(wxSortCompareFunction func) \ - { wxListBase::Sort(func); } \ - void Sort(wxSortFuncFor_##name func) \ - { Sort((wxSortCompareFunction)func); } \ - \ - protected: \ - virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \ - void *data, \ - const wxListKey& key = wxDefaultListKey) \ - { \ - return new nodetype(this, \ - (nodetype *)prev, (nodetype *)next, \ - (T *)data, key); \ - } \ - /* STL interface */ \ - public: \ - typedef size_t size_type; \ - typedef int difference_type; \ - typedef T* value_type; \ - typedef Tbase* base_value_type; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef base_value_type& base_reference; \ - typedef const base_value_type& const_base_reference; \ - \ - classexp iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef iterator itor; \ - typedef T* value_type; \ - typedef value_type* ptr_type; \ - typedef value_type& reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef reference reference_type; \ - typedef ptr_type pointer_type; \ - \ - iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\ - iterator() : m_node(NULL), m_init(NULL) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() { m_node = m_node->GetNext(); return *this; }\ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ - itor& operator--() \ - { \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return *this; \ - } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp const_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef const value_type& const_reference; \ - typedef const_iterator itor; \ - typedef value_type* ptr_type; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef const_reference reference_type; \ - typedef const ptr_type pointer_type; \ - \ - const_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - const_iterator() : m_node(NULL), m_init(NULL) { } \ - const_iterator(const iterator& it) \ - : m_node(it.m_node), m_init(it.m_init) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() { m_node = m_node->GetNext(); return *this; }\ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ - itor& operator--() \ - { \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return *this; \ - } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp reverse_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef reverse_iterator itor; \ - typedef value_type* ptr_type; \ - typedef value_type& reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef reference reference_type; \ - typedef ptr_type pointer_type; \ - \ - reverse_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - reverse_iterator() : m_node(NULL), m_init(NULL) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() \ - { m_node = m_node->GetPrevious(); return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ - itor& operator--() \ - { m_node = m_node ? m_node->GetNext() : m_init; return *this; } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetNext() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp const_reverse_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef const_reverse_iterator itor; \ - typedef value_type* ptr_type; \ - typedef const value_type& const_reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef const_reference reference_type; \ - typedef const ptr_type pointer_type; \ - \ - const_reverse_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \ - const_reverse_iterator(const reverse_iterator& it) \ - : m_node(it.m_node), m_init(it.m_init) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() \ - { m_node = m_node->GetPrevious(); return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ - itor& operator--() \ - { m_node = m_node ? m_node->GetNext() : m_init; return *this;}\ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetNext() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - \ - wxEXPLICIT name(size_type n, const_reference v = value_type()) \ - { assign(n, v); } \ - name(const const_iterator& first, const const_iterator& last) \ - { assign(first, last); } \ - iterator begin() { return iterator(GetFirst(), GetLast()); } \ - const_iterator begin() const \ - { return const_iterator(GetFirst(), GetLast()); } \ - iterator end() { return iterator(NULL, GetLast()); } \ - const_iterator end() const { return const_iterator(NULL, GetLast()); }\ - reverse_iterator rbegin() \ - { return reverse_iterator(GetLast(), GetFirst()); } \ - const_reverse_iterator rbegin() const \ - { return const_reverse_iterator(GetLast(), GetFirst()); } \ - reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\ - const_reverse_iterator rend() const \ - { return const_reverse_iterator(NULL, GetFirst()); } \ - void resize(size_type n, value_type v = value_type()) \ - { \ - while (n < size()) \ - pop_back(); \ - while (n > size()) \ - push_back(v); \ - } \ - size_type size() const { return GetCount(); } \ - size_type max_size() const { return INT_MAX; } \ - bool empty() const { return IsEmpty(); } \ - reference front() { return *begin(); } \ - const_reference front() const { return *begin(); } \ - reference back() { iterator tmp = end(); return *--tmp; } \ - const_reference back() const { const_iterator tmp = end(); return *--tmp; }\ - void push_front(const_reference v = value_type()) \ - { Insert(GetFirst(), (const_base_reference)v); } \ - void pop_front() { DeleteNode(GetFirst()); } \ - void push_back(const_reference v = value_type()) \ - { Append((const_base_reference)v); } \ - void pop_back() { DeleteNode(GetLast()); } \ - void assign(const_iterator first, const const_iterator& last) \ - { \ - clear(); \ - for(; first != last; ++first) \ - Append((const_base_reference)*first); \ - } \ - void assign(size_type n, const_reference v = value_type()) \ - { \ - clear(); \ - for(size_type i = 0; i < n; ++i) \ - Append((const_base_reference)v); \ - } \ - iterator insert(const iterator& it, const_reference v = value_type())\ - { \ - if ( it == end() ) \ - Append((const_base_reference)v); \ - else \ - Insert(it.m_node, (const_base_reference)v); \ - iterator itprev(it); \ - return itprev--; \ - } \ - void insert(const iterator& it, size_type n, const_reference v = value_type())\ - { \ - for(size_type i = 0; i < n; ++i) \ - insert(it, v); \ - } \ - void insert(const iterator& it, const_iterator first, const const_iterator& last)\ - { \ - for(; first != last; ++first) \ - insert(it, *first); \ - } \ - iterator erase(const iterator& it) \ - { \ - iterator next = iterator(it.m_node->GetNext(), GetLast()); \ - DeleteNode(it.m_node); return next; \ - } \ - iterator erase(const iterator& first, const iterator& last) \ - { \ - iterator next = last; \ - if ( next != end() ) \ - ++next; \ - DeleteNodes(first.m_node, last.m_node); \ - return next; \ - } \ - void clear() { Clear(); } \ - void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\ - { insert(it, first, last); l.erase(first, last); } \ - void splice(const iterator& it, name& l) \ - { splice(it, l, l.begin(), l.end() ); } \ - void splice(const iterator& it, name& l, const iterator& first) \ - { \ - if ( it != first ) \ - { \ - insert(it, *first); \ - l.erase(first); \ - } \ - } \ - void remove(const_reference v) \ - { DeleteObject((const_base_reference)v); } \ - void reverse() \ - { Reverse(); } \ - /* void swap(name& l) \ - { \ - { size_t t = m_count; m_count = l.m_count; l.m_count = t; } \ - { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\ - { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\ - { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\ - { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\ - } */ \ - } - -#define WX_LIST_PTROP \ - pointer_type operator->() const \ - { return (pointer_type)m_node->GetDataPtr(); } -#define WX_LIST_PTROP_NONE - -#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \ - WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE) -#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \ - WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP) - -#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \ - WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp) -#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \ - WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp) - -#define WX_DECLARE_LIST(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class) -#define WX_DECLARE_LIST_PTR(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class) - -#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl) - -#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) - -#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo) -#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo) - -// this macro must be inserted in your program after -// #include "wx/listimpl.cpp" -#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" - -#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) - -#endif // !wxUSE_STL - -// ============================================================================ -// now we can define classes 100% compatible with the old ones -// ============================================================================ - -// ---------------------------------------------------------------------------- -// commonly used list classes -// ---------------------------------------------------------------------------- - -#if defined(wxLIST_COMPATIBILITY) - -// inline compatibility functions - -#if !wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxNodeBase deprecated methods -// ---------------------------------------------------------------------------- - -inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); } -inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); } -inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); } - -// ---------------------------------------------------------------------------- -// wxListBase deprecated methods -// ---------------------------------------------------------------------------- - -inline int wxListBase::Number() const { return (int)GetCount(); } -inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); } -inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); } -inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); } -inline wxListBase::operator wxList&() const { return *(wxList*)this; } - -#endif - -// define this to make a lot of noise about use of the old wxList classes. -//#define wxWARN_COMPAT_LIST_USE - -// ---------------------------------------------------------------------------- -// wxList compatibility class: in fact, it's a list of wxObjects -// ---------------------------------------------------------------------------- - -WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, - class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxList : public wxObjectList -{ -public: -#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STL - wxList() { }; - wxDEPRECATED( wxList(int key_type) ); -#elif !wxUSE_STL - wxList(int key_type = wxKEY_NONE); -#endif - - // this destructor is required for Darwin - ~wxList() { } - -#if !wxUSE_STL - wxList& operator=(const wxList& list) - { (void) wxListBase::operator=(list); return *this; } - - // compatibility methods - void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } -#endif - -#if wxUSE_STL -#else - wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); } -#endif - -private: -#if !wxUSE_STL - DECLARE_DYNAMIC_CLASS(wxList) -#endif -}; - -#if !wxUSE_STL - -// ----------------------------------------------------------------------------- -// wxStringList class for compatibility with the old code -// ----------------------------------------------------------------------------- -WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase -{ -public: - // ctors and such - // default -#ifdef wxWARN_COMPAT_LIST_USE - wxStringList(); - wxDEPRECATED( wxStringList(const wxChar *first ...) ); -#else - wxStringList(); - wxStringList(const wxChar *first ...); -#endif - - // copying the string list: the strings are copied, too (extremely - // inefficient!) - wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); } - wxStringList& operator=(const wxStringList& other) - { Clear(); DoCopy(other); return *this; } - - // operations - // makes a copy of the string - wxNode *Add(const wxChar *s); - - // Append to beginning of list - wxNode *Prepend(const wxChar *s); - - bool Delete(const wxChar *s); - - wxChar **ListToArray(bool new_copies = false) const; - bool Member(const wxChar *s) const; - - // alphabetic sort - void Sort(); - -private: - void DoCopy(const wxStringList&); // common part of copy ctor and operator= - - DECLARE_DYNAMIC_CLASS(wxStringList) -}; - -#else // if wxUSE_STL - -WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase -{ -public: - compatibility_iterator Append(wxChar* s) - { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); } - compatibility_iterator Insert(wxChar* s) - { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); } - compatibility_iterator Insert(size_t pos, wxChar* s) - { - wxString tmp = s; - delete[] s; - return wxStringListBase::Insert(pos, tmp); - } - compatibility_iterator Add(const wxChar* s) - { push_back(s); return GetLast(); } - compatibility_iterator Prepend(const wxChar* s) - { push_front(s); return GetFirst(); } -}; - -#endif // wxUSE_STL - -#endif // wxLIST_COMPATIBILITY - -// delete all list elements -// -// NB: the class declaration of the list elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_LIST(type, list) \ - { \ - type::iterator it, en; \ - for( it = (list).begin(), en = (list).end(); it != en; ++it ) \ - delete *it; \ - (list).clear(); \ - } - -#endif // _WX_LISTH__ diff --git a/Source/3rdParty/wx/include/wx/listbase.h b/Source/3rdParty/wx/include/wx/listbase.h deleted file mode 100644 index 152864786..000000000 --- a/Source/3rdParty/wx/include/wx/listbase.h +++ /dev/null @@ -1,491 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbase.h -// Purpose: wxListCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.12.99 -// RCS-ID: $Id: listbase.h 46313 2007-06-03 22:38:28Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBASE_H_BASE_ -#define _WX_LISTBASE_H_BASE_ - -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/gdicmn.h" -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// type of compare function for wxListCtrl sort operation -typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); - -// ---------------------------------------------------------------------------- -// wxListCtrl constants -// ---------------------------------------------------------------------------- - -// style flags -#define wxLC_VRULES 0x0001 -#define wxLC_HRULES 0x0002 - -#define wxLC_ICON 0x0004 -#define wxLC_SMALL_ICON 0x0008 -#define wxLC_LIST 0x0010 -#define wxLC_REPORT 0x0020 - -#define wxLC_ALIGN_TOP 0x0040 -#define wxLC_ALIGN_LEFT 0x0080 -#define wxLC_AUTOARRANGE 0x0100 -#define wxLC_VIRTUAL 0x0200 -#define wxLC_EDIT_LABELS 0x0400 -#define wxLC_NO_HEADER 0x0800 -#define wxLC_NO_SORT_HEADER 0x1000 -#define wxLC_SINGLE_SEL 0x2000 -#define wxLC_SORT_ASCENDING 0x4000 -#define wxLC_SORT_DESCENDING 0x8000 - -#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) -#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT) -#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING) - -// for compatibility only -#define wxLC_USER_TEXT wxLC_VIRTUAL - -// Omitted because -// (a) too much detail -// (b) not enough style flags -// (c) not implemented anyhow in the generic version -// -// #define wxLC_NO_SCROLL -// #define wxLC_NO_LABEL_WRAP -// #define wxLC_OWNERDRAW_FIXED -// #define wxLC_SHOW_SEL_ALWAYS - -// Mask flags to tell app/GUI what fields of wxListItem are valid -#define wxLIST_MASK_STATE 0x0001 -#define wxLIST_MASK_TEXT 0x0002 -#define wxLIST_MASK_IMAGE 0x0004 -#define wxLIST_MASK_DATA 0x0008 -#define wxLIST_SET_ITEM 0x0010 -#define wxLIST_MASK_WIDTH 0x0020 -#define wxLIST_MASK_FORMAT 0x0040 - -// State flags for indicating the state of an item -#define wxLIST_STATE_DONTCARE 0x0000 -#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only -#define wxLIST_STATE_FOCUSED 0x0002 -#define wxLIST_STATE_SELECTED 0x0004 -#define wxLIST_STATE_CUT 0x0008 // MSW only -#define wxLIST_STATE_DISABLED 0x0010 // OS2 only -#define wxLIST_STATE_FILTERED 0x0020 // OS2 only -#define wxLIST_STATE_INUSE 0x0040 // OS2 only -#define wxLIST_STATE_PICKED 0x0080 // OS2 only -#define wxLIST_STATE_SOURCE 0x0100 // OS2 only - -// Hit test flags, used in HitTest -#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. -#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. -#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. -#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. -#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. -#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. -#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. -#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. -#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. - -#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) - -// GetSubItemRect constants -#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l - -// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) -enum -{ - wxLIST_NEXT_ABOVE, // Searches for an item above the specified item - wxLIST_NEXT_ALL, // Searches for subsequent item by index - wxLIST_NEXT_BELOW, // Searches for an item below the specified item - wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item - wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item -}; - -// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) -enum -{ - wxLIST_ALIGN_DEFAULT, - wxLIST_ALIGN_LEFT, - wxLIST_ALIGN_TOP, - wxLIST_ALIGN_SNAP_TO_GRID -}; - -// Column format (MSW only except wxLIST_FORMAT_LEFT) -enum wxListColumnFormat -{ - wxLIST_FORMAT_LEFT, - wxLIST_FORMAT_RIGHT, - wxLIST_FORMAT_CENTRE, - wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE -}; - -// Autosize values for SetColumnWidth -enum -{ - wxLIST_AUTOSIZE = -1, - wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version -}; - -// Flag values for GetItemRect -enum -{ - wxLIST_RECT_BOUNDS, - wxLIST_RECT_ICON, - wxLIST_RECT_LABEL -}; - -// Flag values for FindItem (MSW only) -enum -{ - wxLIST_FIND_UP, - wxLIST_FIND_DOWN, - wxLIST_FIND_LEFT, - wxLIST_FIND_RIGHT -}; - -// ---------------------------------------------------------------------------- -// wxListItemAttr: a structure containing the visual attributes of an item -// ---------------------------------------------------------------------------- - -// TODO: this should be renamed to wxItemAttr or something general like this -// and used as base class for wxTextAttr which duplicates this class -// entirely currently -class WXDLLEXPORT wxListItemAttr -{ -public: - // ctors - wxListItemAttr() { } - wxListItemAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font) - : m_colText(colText), m_colBack(colBack), m_font(font) - { - } - - // default copy ctor, assignment operator and dtor are ok - - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetFont(const wxFont& font) { m_font = font; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - - - // this is almost like assignment operator except it doesn't overwrite the - // fields unset in the source attribute - void AssignFrom(const wxListItemAttr& source) - { - if ( source.HasTextColour() ) - SetTextColour(source.GetTextColour()); - if ( source.HasBackgroundColour() ) - SetBackgroundColour(source.GetBackgroundColour()); - if ( source.HasFont() ) - SetFont(source.GetFont()); - } - -private: - wxColour m_colText, - m_colBack; - wxFont m_font; -}; - -// ---------------------------------------------------------------------------- -// wxListItem: the item or column info, used to exchange data with wxListCtrl -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListItem : public wxObject -{ -public: - wxListItem() { Init(); m_attr = NULL; } - wxListItem(const wxListItem& item) - : wxObject(), - m_mask(item.m_mask), - m_itemId(item.m_itemId), - m_col(item.m_col), - m_state(item.m_state), - m_stateMask(item.m_stateMask), - m_text(item.m_text), - m_image(item.m_image), - m_data(item.m_data), - m_format(item.m_format), - m_width(item.m_width), - m_attr(NULL) - { - // copy list item attributes - if ( item.HasAttributes() ) - m_attr = new wxListItemAttr(*item.GetAttributes()); - } - virtual ~wxListItem() { delete m_attr; } - - // resetting - void Clear() { Init(); m_text.clear(); ClearAttributes(); } - void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } } - - // setters - void SetMask(long mask) - { m_mask = mask; } - void SetId(long id) - { m_itemId = id; } - void SetColumn(int col) - { m_col = col; } - void SetState(long state) - { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; } - void SetStateMask(long stateMask) - { m_stateMask = stateMask; } - void SetText(const wxString& text) - { m_mask |= wxLIST_MASK_TEXT; m_text = text; } - void SetImage(int image) - { m_mask |= wxLIST_MASK_IMAGE; m_image = image; } - void SetData(long data) - { m_mask |= wxLIST_MASK_DATA; m_data = data; } - void SetData(void *data) - { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); } - - void SetWidth(int width) - { m_mask |= wxLIST_MASK_WIDTH; m_width = width; } - void SetAlign(wxListColumnFormat align) - { m_mask |= wxLIST_MASK_FORMAT; m_format = align; } - - void SetTextColour(const wxColour& colText) - { Attributes().SetTextColour(colText); } - void SetBackgroundColour(const wxColour& colBack) - { Attributes().SetBackgroundColour(colBack); } - void SetFont(const wxFont& font) - { Attributes().SetFont(font); } - - // accessors - long GetMask() const { return m_mask; } - long GetId() const { return m_itemId; } - int GetColumn() const { return m_col; } - long GetState() const { return m_state & m_stateMask; } - const wxString& GetText() const { return m_text; } - int GetImage() const { return m_image; } - wxUIntPtr GetData() const { return m_data; } - - int GetWidth() const { return m_width; } - wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } - - wxListItemAttr *GetAttributes() const { return m_attr; } - bool HasAttributes() const { return m_attr != NULL; } - - wxColour GetTextColour() const - { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; } - wxColour GetBackgroundColour() const - { return HasAttributes() ? m_attr->GetBackgroundColour() - : wxNullColour; } - wxFont GetFont() const - { return HasAttributes() ? m_attr->GetFont() : wxNullFont; } - - // this conversion is necessary to make old code using GetItem() to - // compile - operator long() const { return m_itemId; } - - // these members are public for compatibility - - long m_mask; // Indicates what fields are valid - long m_itemId; // The zero-based item position - int m_col; // Zero-based column, if in report mode - long m_state; // The state of the item - long m_stateMask;// Which flags of m_state are valid (uses same flags) - wxString m_text; // The label/header text - int m_image; // The zero-based index into an image list - wxUIntPtr m_data; // App-defined data - - // For columns only - int m_format; // left, right, centre - int m_width; // width of column - -#ifdef __WXPM__ - int m_miniImage; // handle to the mini image for OS/2 -#endif - -protected: - // creates m_attr if we don't have it yet - wxListItemAttr& Attributes() - { - if ( !m_attr ) - m_attr = new wxListItemAttr; - - return *m_attr; - } - - void Init() - { - m_mask = 0; - m_itemId = 0; - m_col = 0; - m_state = 0; - m_stateMask = 0; - m_image = -1; - m_data = 0; - - m_format = wxLIST_FORMAT_CENTRE; - m_width = 0; - } - - wxListItemAttr *m_attr; // optional pointer to the items style - -private: - // VZ: this is strange, we have a copy ctor but not operator=(), why? - wxListItem& operator=(const wxListItem& item); - - DECLARE_DYNAMIC_CLASS(wxListItem) -}; - -// ---------------------------------------------------------------------------- -// wxListEvent - the event class for the wxListCtrl notifications -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListEvent : public wxNotifyEvent -{ -public: - wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid) - , m_code(0) - , m_oldItemIndex(0) - , m_itemIndex(0) - , m_col(0) - , m_pointDrag() - , m_item() - , m_editCancelled(false) - { } - - wxListEvent(const wxListEvent& event) - : wxNotifyEvent(event) - , m_code(event.m_code) - , m_oldItemIndex(event.m_oldItemIndex) - , m_itemIndex(event.m_itemIndex) - , m_col(event.m_col) - , m_pointDrag(event.m_pointDrag) - , m_item(event.m_item) - , m_editCancelled(event.m_editCancelled) - { } - - int GetKeyCode() const { return m_code; } - long GetIndex() const { return m_itemIndex; } - int GetColumn() const { return m_col; } - wxPoint GetPoint() const { return m_pointDrag; } - const wxString& GetLabel() const { return m_item.m_text; } - const wxString& GetText() const { return m_item.m_text; } - int GetImage() const { return m_item.m_image; } - long GetData() const { return wx_static_cast(long, m_item.m_data); } - long GetMask() const { return m_item.m_mask; } - const wxListItem& GetItem() const { return m_item; } - - // for wxEVT_COMMAND_LIST_CACHE_HINT only - long GetCacheFrom() const { return m_oldItemIndex; } - long GetCacheTo() const { return m_itemIndex; } - - // was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only) - bool IsEditCancelled() const { return m_editCancelled; } - void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - - virtual wxEvent *Clone() const { return new wxListEvent(*this); } - -//protected: -- not for backwards compatibility - int m_code; - long m_oldItemIndex; // only for wxEVT_COMMAND_LIST_CACHE_HINT - long m_itemIndex; - int m_col; - wxPoint m_pointDrag; - - wxListItem m_item; - -protected: - bool m_editCancelled; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent) -}; - -// ---------------------------------------------------------------------------- -// wxListCtrl event macros -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG, 700) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG, 701) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 702) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705) -#if WXWIN_COMPATIBILITY_2_4 - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707) -#endif - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM, 711) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK, 712) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 713) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 714) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 715) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT, 716) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 717) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 718) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING, 719) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG, 720) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED, 721) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); - -#define wxListEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListEventFunction, &func) - -#define wx__DECLARE_LISTEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn)) - -#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn) -#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn) -#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn) -#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn) -#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn) -#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn) -#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn) -#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn) - -#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn) -#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn) -#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn) -#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn) -#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn) - -#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn) -#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn) -#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn) -#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn) -#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn) -#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn) - -#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) - - -#if WXWIN_COMPATIBILITY_2_4 -#define EVT_LIST_GET_INFO(id, fn) wx__DECLARE_LISTEVT(GET_INFO, id, fn) -#define EVT_LIST_SET_INFO(id, fn) wx__DECLARE_LISTEVT(SET_INFO, id, fn) -#endif - -#endif - // _WX_LISTCTRL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/listbook.h b/Source/3rdParty/wx/include/wx/listbook.h deleted file mode 100644 index b14ee4cdb..000000000 --- a/Source/3rdParty/wx/include/wx/listbook.h +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbook.h -// Purpose: wxListbook: wxListCtrl and wxNotebook combination -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: listbook.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOOK_H_ -#define _WX_LISTBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_LISTBOOK - -#include "wx/bookctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxListView; -class WXDLLIMPEXP_FWD_CORE wxListEvent; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING; - -// wxListbook flags -#define wxLB_DEFAULT wxBK_DEFAULT -#define wxLB_TOP wxBK_TOP -#define wxLB_BOTTOM wxBK_BOTTOM -#define wxLB_LEFT wxBK_LEFT -#define wxLB_RIGHT wxBK_RIGHT -#define wxLB_ALIGN_MASK wxBK_ALIGN_MASK - -// ---------------------------------------------------------------------------- -// wxListbook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListbook : public wxBookCtrlBase -{ -public: - wxListbook() - { - Init(); - } - - wxListbook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - // overridden base class methods - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - - wxListView* GetListView() const { return (wxListView*)m_bookctrl; } - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the list control should have - virtual wxSize GetControllerSize() const; - - void UpdateSelectedPage(size_t newsel); - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // event handlers - void OnListSelected(wxListEvent& event); - void OnSize(wxSizeEvent& event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) -}; - -// ---------------------------------------------------------------------------- -// listbook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxListbookEvent(const wxListbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxListbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent) -}; - -typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&); - -#define wxListbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func) - -#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn)) - -#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn)) - -#endif // wxUSE_LISTBOOK - -#endif // _WX_LISTBOOK_H_ diff --git a/Source/3rdParty/wx/include/wx/listbox.h b/Source/3rdParty/wx/include/wx/listbox.h deleted file mode 100644 index a3b98fc48..000000000 --- a/Source/3rdParty/wx/include/wx/listbox.h +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbox.h -// Purpose: wxListBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOX_H_BASE_ -#define _WX_LISTBOX_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_LISTBOX - -#include "wx/ctrlsub.h" // base class - -// forward declarations are enough here -class WXDLLIMPEXP_FWD_BASE wxArrayInt; -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxListBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxListBox interface is defined by the class wxListBoxBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListBoxBase : public wxControlWithItems -{ -public: - wxListBoxBase() { } - virtual ~wxListBoxBase(); - - // all generic methods are in wxControlWithItems, except for the following - // ones which are not yet implemented by wxChoice/wxComboBox - void Insert(const wxString& item, unsigned int pos) - { /* return*/ wxControlWithItems::Insert(item,pos); } - void Insert(const wxString& item, unsigned int pos, void *clientData) - { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } - void Insert(const wxString& item, unsigned int pos, wxClientData *clientData) - { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } - - void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos); - void InsertItems(const wxArrayString& items, unsigned int pos) - { DoInsertItems(items, pos); } - - void Set(int n, const wxString* items, void **clientData = NULL); - void Set(const wxArrayString& items, void **clientData = NULL) - { DoSetItems(items, clientData); } - - // multiple selection logic - virtual bool IsSelected(int n) const = 0; - virtual void SetSelection(int n) { DoSetSelection(n, true); } - void SetSelection(int n, bool select) { DoSetSelection(n, select); } - void Deselect(int n) { DoSetSelection(n, false); } - void DeselectAll(int itemToLeaveSelected = -1); - - virtual bool SetStringSelection(const wxString& s, bool select); - virtual bool SetStringSelection(const wxString& s) - { - return SetStringSelection(s, true); - } - - // works for single as well as multiple selection listboxes (unlike - // GetSelection which only works for listboxes with single selection) - virtual int GetSelections(wxArrayInt& aSelections) const = 0; - - // set the specified item at the first visible item or scroll to max - // range. - void SetFirstItem(int n) { DoSetFirstItem(n); } - void SetFirstItem(const wxString& s); - - // ensures that the given item is visible scrolling the listbox if - // necessary - virtual void EnsureVisible(int n); - - // a combination of Append() and EnsureVisible(): appends the item to the - // listbox and ensures that it is visible i.e. not scrolled out of view - void AppendAndEnsureVisible(const wxString& s); - - // return true if the listbox allows multiple selection - bool HasMultipleSelection() const - { - return (m_windowStyle & wxLB_MULTIPLE) || - (m_windowStyle & wxLB_EXTENDED); - } - - // return true if this listbox is sorted - bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; } - - // emulate selecting or deselecting the item event.GetInt() (depending on - // event.GetExtraLong()) - void Command(wxCommandEvent& event); - - // returns the item number at a point or wxNOT_FOUND - int HitTest(const wxPoint& point) const { return DoListHitTest(point); } - -#if WXWIN_COMPATIBILITY_2_6 - // compatibility - these functions are deprecated, use the new ones - // instead - wxDEPRECATED( bool Selected(int n) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // NB: due to wxGTK implementation details, DoInsert() is implemented - // using DoInsertItems() and not the other way round - virtual int DoInsert(const wxString& item, unsigned int pos) - { InsertItems(1, &item, pos); return pos; } - - // to be implemented in derived classes - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos) = 0; - virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0; - - virtual void DoSetFirstItem(int n) = 0; - - virtual void DoSetSelection(int n, bool select) = 0; - - // there is already wxWindow::DoHitTest() so call this one differently - virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const - { return wxNOT_FOUND; } - - - DECLARE_NO_COPY_CLASS(wxListBoxBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxListBoxBase::Selected(int n) const { return IsSelected(n); } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// include the platform-specific class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/listbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/listbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/listbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/listbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/listbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/listbox.h" -#elif defined(__WXPM__) - #include "wx/os2/listbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/listbox.h" -#endif - -#endif // wxUSE_LISTBOX - -#endif - // _WX_LISTBOX_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/listctrl.h b/Source/3rdParty/wx/include/wx/listctrl.h deleted file mode 100644 index efccc7300..000000000 --- a/Source/3rdParty/wx/include/wx/listctrl.h +++ /dev/null @@ -1,110 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listctrl.h -// Purpose: wxListCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.12.99 -// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTCTRL_H_BASE_ -#define _WX_LISTCTRL_H_BASE_ - -#include "wx/defs.h" // headers should include this before first wxUSE_XXX check - -#if wxUSE_LISTCTRL - -#include "wx/listbase.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxListCtrlNameStr[]; - -// ---------------------------------------------------------------------------- -// include the wxListCtrl class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/listctrl.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) - #include "wx/mac/carbon/listctrl.h" -#else - #include "wx/generic/listctrl.h" -#endif - -// ---------------------------------------------------------------------------- -// wxListView: a class which provides a better API for list control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListView : public wxListCtrl -{ -public: - wxListView() { } - wxListView( wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_REPORT, - const wxValidator& validator = wxDefaultValidator, - const wxString &name = wxListCtrlNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - - // focus/selection stuff - // --------------------- - - // [de]select an item - void Select(long n, bool on = true) - { - SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED); - } - - // focus and show the given item - void Focus(long index) - { - SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); - EnsureVisible(index); - } - - // get the currently focused item or -1 if none - long GetFocusedItem() const - { - return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); - } - - // get first and subsequent selected items, return -1 when no more - long GetNextSelected(long item) const - { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } - long GetFirstSelected() const - { return GetNextSelected(-1); } - - // return true if the item is selected - bool IsSelected(long index) const - { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; } - - // columns - // ------- - - void SetColumnImage(int col, int image) - { - wxListItem item; - item.SetMask(wxLIST_MASK_IMAGE); - item.SetImage(image); - SetColumn(col, item); - } - - void ClearColumnImage(int col) { SetColumnImage(col, -1); } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView) -}; - -#endif // wxUSE_LISTCTRL - -#endif - // _WX_LISTCTRL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/listimpl.cpp b/Source/3rdParty/wx/include/wx/listimpl.cpp deleted file mode 100644 index d05fda13e..000000000 --- a/Source/3rdParty/wx/include/wx/listimpl.cpp +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: listimpl.cpp -// Purpose: second-part of macro based implementation of template lists -// Author: Vadim Zeitlin -// Modified by: -// Created: 16/11/98 -// RCS-ID: $Id: listimpl.cpp 38893 2006-04-24 17:59:10Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#if wxUSE_STL - -#undef WX_DEFINE_LIST -#define WX_DEFINE_LIST(name) \ - void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X )\ - { \ - delete X; \ - } \ - name::BaseListType name::EmptyList; - -#else // !wxUSE_STL - - #define _DEFINE_LIST(T, name) \ - void wx##name##Node::DeleteData() \ - { \ - delete (T *)GetData(); \ - } - - // redefine the macro so that now it will generate the class implementation - // old value would provoke a compile-time error if this file is not included - #undef WX_DEFINE_LIST - #define WX_DEFINE_LIST(name) _DEFINE_LIST(_WX_LIST_ITEM_TYPE_##name, name) - - // don't pollute preprocessor's name space - //#undef _DEFINE_LIST - -#endif // wxUSE_STL/!wxUSE_STL - diff --git a/Source/3rdParty/wx/include/wx/log.h b/Source/3rdParty/wx/include/wx/log.h deleted file mode 100644 index 5e23bcf92..000000000 --- a/Source/3rdParty/wx/include/wx/log.h +++ /dev/null @@ -1,653 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/log.h -// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: log.h 50993 2008-01-02 21:18:15Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LOG_H_ -#define _WX_LOG_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// common constants for use in wxUSE_LOG/!wxUSE_LOG -// ---------------------------------------------------------------------------- - -// the trace masks have been superceded by symbolic trace constants, they're -// for compatibility only andwill be removed soon - do NOT use them - -// meaning of different bits of the trace mask (which allows selectively -// enable/disable some trace messages) -#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) -#define wxTraceMessages 0x0002 // trace window messages/X callbacks -#define wxTraceResAlloc 0x0004 // trace GDI resource allocation -#define wxTraceRefCount 0x0008 // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTraceOleCalls 0x0100 // OLE interface calls -#endif - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// NB: these types are needed even if wxUSE_LOG == 0 -typedef unsigned long wxTraceMask; -typedef unsigned long wxLogLevel; - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/string.h" - -#if wxUSE_LOG - -#include "wx/arrstr.h" - -#ifndef __WXWINCE__ - #include // for time_t -#endif - -#include "wx/dynarray.h" - -#ifndef wxUSE_LOG_DEBUG -# ifdef __WXDEBUG__ -# define wxUSE_LOG_DEBUG 1 -# else // !__WXDEBUG__ -# define wxUSE_LOG_DEBUG 0 -# endif -#endif - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - class WXDLLIMPEXP_FWD_CORE wxLogFrame; - class WXDLLIMPEXP_FWD_CORE wxFrame; - class WXDLLIMPEXP_FWD_CORE wxWindow; -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// different standard log levels (you may also define your own) -enum -{ - wxLOG_FatalError, // program can't continue, abort immediately - wxLOG_Error, // a serious error, user must be informed about it - wxLOG_Warning, // user is normally informed about it but may be ignored - wxLOG_Message, // normal message (i.e. normal output of a non GUI app) - wxLOG_Status, // informational: might go to the status line of GUI app - wxLOG_Info, // informational message (a.k.a. 'Verbose') - wxLOG_Debug, // never shown to the user, disabled in release mode - wxLOG_Trace, // trace messages are also only enabled in debug mode - wxLOG_Progress, // used for progress indicator (not yet) - wxLOG_User = 100, // user defined levels start here - wxLOG_Max = 10000 -}; - -// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be -// discarded unless the string "foo" has been added to the list of allowed -// ones with AddTraceMask() - -#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete) -#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks -#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation -#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTRACE_OleCalls wxT("ole") // OLE interface calls -#endif - -#include "wx/iosfwrap.h" - -// ---------------------------------------------------------------------------- -// derive from this class to redirect (or suppress, or ...) log messages -// normally, only a single instance of this class exists but it's not enforced -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxLog -{ -public: - // ctor - wxLog(){} - - // these functions allow to completely disable all log messages - - // is logging disabled now? - static bool IsEnabled() { return ms_doLog; } - - // change the flag state, return the previous one - static bool EnableLogging(bool doIt = true) - { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; } - - // static sink function - see DoLog() for function to overload in the - // derived classes - static void OnLog(wxLogLevel level, const wxChar *szString, time_t t); - - // message buffering - - // flush shows all messages if they're not logged immediately (FILE - // and iostream logs don't need it, but wxGuiLog does to avoid showing - // 17 modal dialogs one after another) - virtual void Flush(); - - // flush the active target if any - static void FlushActive() - { - if ( !ms_suspendCount ) - { - wxLog *log = GetActiveTarget(); - if ( log ) - log->Flush(); - } - } - - // only one sink is active at each moment - // get current log target, will call wxApp::CreateLogTarget() to - // create one if none exists - static wxLog *GetActiveTarget(); - - // change log target, pLogger may be NULL - static wxLog *SetActiveTarget(wxLog *pLogger); - - // suspend the message flushing of the main target until the next call - // to Resume() - this is mainly for internal use (to prevent wxYield() - // from flashing the messages) - static void Suspend() { ms_suspendCount++; } - - // must be called for each Suspend()! - static void Resume() { ms_suspendCount--; } - - // functions controlling the default wxLog behaviour - // verbose mode is activated by standard command-line '-verbose' - // option - static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } - - // Set log level. Log messages with level > logLevel will not be logged. - static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } - -#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ - // should GetActiveTarget() try to create a new log object if the - // current is NULL? - static void DontCreateOnDemand(); -#endif - - // Make GetActiveTarget() create a new log object again. - static void DoCreateOnDemand(); - - // log the count of repeating messages instead of logging the messages - // multiple times - static void SetRepetitionCounting(bool bRepetCounting = true) - { ms_bRepetCounting = bRepetCounting; } - - // gets duplicate counting status - static bool GetRepetitionCounting() { return ms_bRepetCounting; } - - // trace mask (see wxTraceXXX constants for details) - static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; } - - // add string trace mask - static void AddTraceMask(const wxString& str) - { ms_aTraceMasks.push_back(str); } - - // add string trace mask - static void RemoveTraceMask(const wxString& str); - - // remove all string trace masks - static void ClearTraceMasks(); - - // get string trace masks - static const wxArrayString &GetTraceMasks() { return ms_aTraceMasks; } - - // sets the timestamp string: this is used as strftime() format string - // for the log targets which add time stamps to the messages - set it - // to NULL to disable time stamping completely. - static void SetTimestamp(const wxChar *ts) { ms_timestamp = ts; } - - - // accessors - - // gets the verbose status - static bool GetVerbose() { return ms_bVerbose; } - - // get trace mask - static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } - - // is this trace mask in the list? - static bool IsAllowedTraceMask(const wxChar *mask); - - // return the current loglevel limit - static wxLogLevel GetLogLevel() { return ms_logLevel; } - - // get the current timestamp format string (may be NULL) - static const wxChar *GetTimestamp() { return ms_timestamp; } - - - // helpers - - // put the time stamp into the string if ms_timestamp != NULL (don't - // change it otherwise) - static void TimeStamp(wxString *str); - - // make dtor virtual for all derived classes - virtual ~wxLog(); - - - // this method exists for backwards compatibility only, don't use - bool HasPendingMessages() const { return true; } - -#if WXWIN_COMPATIBILITY_2_6 - // this function doesn't do anything any more, don't call it - wxDEPRECATED( static wxChar *SetLogBuffer(wxChar *buf, size_t size = 0) ); -#endif - -protected: - // the logging functions that can be overriden - - // default DoLog() prepends the time stamp and a prefix corresponding - // to the message to szString and then passes it to DoLogString() - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - - // default DoLogString does nothing but is not pure virtual because if - // you override DoLog() you might not need it at all - virtual void DoLogString(const wxChar *szString, time_t t); - - // log a line containing the number of times the previous message was - // repeated and returns this number (which can be 0) - static unsigned DoLogNumberOfRepeats(); - -private: - // static variables - // ---------------- - - // traditional behaviour or counting repetitions - static bool ms_bRepetCounting; - static wxString ms_prevString; // previous message that was logged - // how many times the previous message was logged - static unsigned ms_prevCounter; - static time_t ms_prevTimeStamp;// timestamp of the previous message - static wxLogLevel ms_prevLevel; // level of the previous message - - static wxLog *ms_pLogger; // currently active log sink - static bool ms_doLog; // false => all logging disabled - static bool ms_bAutoCreate; // create new log targets on demand? - static bool ms_bVerbose; // false => ignore LogInfo messages - - static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel - - static size_t ms_suspendCount; // if positive, logs are not flushed - - // format string for strftime(), if NULL, time stamping log messages is - // disabled - static const wxChar *ms_timestamp; - - static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour - static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace - - - // this is the replacement of DoLogNumberOfRepeats() (which has to be kept - // to avoid breaking ABI in this version) - unsigned LogLastRepeatIfNeeded(); - - // implementation of the function above which supposes that the caller had - // already locked gs_prevCS - unsigned LogLastRepeatIfNeededUnlocked(); -}; - -// ---------------------------------------------------------------------------- -// "trivial" derivations of wxLog -// ---------------------------------------------------------------------------- - -// log everything to a buffer -class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog -{ -public: - wxLogBuffer() { } - - // get the string contents with all messages logged - const wxString& GetBuffer() const { return m_str; } - - // show the buffer contents to the user in the best possible way (this uses - // wxMessageOutputMessageBox) and clear it - virtual void Flush(); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - wxString m_str; - - DECLARE_NO_COPY_CLASS(wxLogBuffer) -}; - - -// log everything to a "FILE *", stderr by default -class WXDLLIMPEXP_BASE wxLogStderr : public wxLog -{ -public: - // redirect log output to a FILE - wxLogStderr(FILE *fp = (FILE *) NULL); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - - FILE *m_fp; - - DECLARE_NO_COPY_CLASS(wxLogStderr) -}; - -#if wxUSE_STD_IOSTREAM - -// log everything to an "ostream", cerr by default -class WXDLLIMPEXP_BASE wxLogStream : public wxLog -{ -public: - // redirect log output to an ostream - wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - - // using ptr here to avoid including from this file - wxSTD ostream *m_ostr; -}; - -#endif // wxUSE_STD_IOSTREAM - -// ---------------------------------------------------------------------------- -// /dev/null log target: suppress logging until this object goes out of scope -// ---------------------------------------------------------------------------- - -// example of usage: -/* - void Foo() - { - wxFile file; - - // wxFile.Open() normally complains if file can't be opened, we don't - // want it - wxLogNull logNo; - - if ( !file.Open("bar") ) - ... process error ourselves ... - - // ~wxLogNull called, old log sink restored - } - */ -class WXDLLIMPEXP_BASE wxLogNull -{ -public: - wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { } - ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } - -private: - bool m_flagOld; // the previous value of the wxLog::ms_doLog -}; - -// ---------------------------------------------------------------------------- -// chaining log target: installs itself as a log target and passes all -// messages to the real log target given to it in the ctor but also forwards -// them to the previously active one -// -// note that you don't have to call SetActiveTarget() with this class, it -// does it itself in its ctor -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxLogChain : public wxLog -{ -public: - wxLogChain(wxLog *logger); - virtual ~wxLogChain(); - - // change the new log target - void SetLog(wxLog *logger); - - // this can be used to temporarily disable (and then reenable) passing - // messages to the old logger (by default we do pass them) - void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } - - // are we passing the messages to the previous log target? - bool IsPassingMessages() const { return m_bPassMessages; } - - // return the previous log target (may be NULL) - wxLog *GetOldLog() const { return m_logOld; } - - // override base class version to flush the old logger as well - virtual void Flush(); - - // call to avoid destroying the old log target -#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ - void DetachOldLog() { m_logOld = NULL; } -#endif - -protected: - // pass the chain to the old logger if needed - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - -private: - // the current log target - wxLog *m_logNew; - - // the previous log target - wxLog *m_logOld; - - // do we pass the messages to the old logger? - bool m_bPassMessages; - - DECLARE_NO_COPY_CLASS(wxLogChain) -}; - -// a chain log target which uses itself as the new logger -class WXDLLIMPEXP_BASE wxLogPassThrough : public wxLogChain -{ -public: - wxLogPassThrough(); - -private: - DECLARE_NO_COPY_CLASS(wxLogPassThrough) -}; - -#if wxUSE_GUI - // include GUI log targets: - #include "wx/generic/logg.h" -#endif // wxUSE_GUI - -// ============================================================================ -// global functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Log functions should be used by application instead of stdio, iostream &c -// for log messages for easy redirection -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// get error code/error message from system in a portable way -// ---------------------------------------------------------------------------- - -// return the last system error code -WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); - -// return the error message for given (or last if 0) error code -WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); - -// ---------------------------------------------------------------------------- -// define wxLog -// ---------------------------------------------------------------------------- - -#define DECLARE_LOG_FUNCTION(level) \ -extern void WXDLLIMPEXP_BASE wxVLog##level(const wxChar *szFormat, \ - va_list argptr); \ -extern void WXDLLIMPEXP_BASE wxLog##level(const wxChar *szFormat, \ - ...) ATTRIBUTE_PRINTF_1 -#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ -extern void expdecl wxVLog##level(argclass arg, \ - const wxChar *szFormat, \ - va_list argptr); \ -extern void expdecl wxLog##level(argclass arg, \ - const wxChar *szFormat, \ - ...) ATTRIBUTE_PRINTF_2 -#else // !wxUSE_LOG - -// log functions do nothing at all -#define DECLARE_LOG_FUNCTION(level) \ -inline void wxVLog##level(const wxChar *WXUNUSED(szFormat), \ - va_list WXUNUSED(argptr)) { } \ -inline void wxLog##level(const wxChar *WXUNUSED(szFormat), \ - ...) { } -#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ -inline void wxVLog##level(argclass WXUNUSED(arg), \ - const wxChar *WXUNUSED(szFormat), \ - va_list WXUNUSED(argptr)) {} \ -inline void wxLog##level(argclass WXUNUSED(arg), \ - const wxChar *WXUNUSED(szFormat), \ - ...) { } - -// Empty Class to fake wxLogNull -class WXDLLIMPEXP_BASE wxLogNull -{ -public: - wxLogNull() { } -}; - -// Dummy macros to replace some functions. -#define wxSysErrorCode() (unsigned long)0 -#define wxSysErrorMsg( X ) (const wxChar*)NULL - -// Fake symbolic trace masks... for those that are used frequently -#define wxTRACE_OleCalls wxEmptyString // OLE interface calls - -#endif // wxUSE_LOG/!wxUSE_LOG - -#define DECLARE_LOG_FUNCTION2(level, argclass, arg) \ - DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, WXDLLIMPEXP_BASE) - - -// a generic function for all levels (level is passes as parameter) -DECLARE_LOG_FUNCTION2(Generic, wxLogLevel, level); - -// one function per each level -DECLARE_LOG_FUNCTION(FatalError); -DECLARE_LOG_FUNCTION(Error); -DECLARE_LOG_FUNCTION(Warning); -DECLARE_LOG_FUNCTION(Message); -DECLARE_LOG_FUNCTION(Info); -DECLARE_LOG_FUNCTION(Verbose); - -// this function sends the log message to the status line of the top level -// application frame, if any -DECLARE_LOG_FUNCTION(Status); - -#if wxUSE_GUI - // this one is the same as previous except that it allows to explicitly - class WXDLLIMPEXP_FWD_CORE wxFrame; - // specify the frame to which the output should go - DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *, pFrame, WXDLLIMPEXP_CORE); -#endif // wxUSE_GUI - -// additional one: as wxLogError, but also logs last system call error code -// and the corresponding error message if available -DECLARE_LOG_FUNCTION(SysError); - -// and another one which also takes the error code (for those broken APIs -// that don't set the errno (like registry APIs in Win32)) -DECLARE_LOG_FUNCTION2(SysError, long, lErrCode); - -// debug functions do nothing in release mode -#if wxUSE_LOG && wxUSE_LOG_DEBUG - DECLARE_LOG_FUNCTION(Debug); - - // there is no more unconditional LogTrace: it is not different from - // LogDebug and it creates overload ambiguities - //DECLARE_LOG_FUNCTION(Trace); - - // this version only logs the message if the mask had been added to the - // list of masks with AddTraceMask() - DECLARE_LOG_FUNCTION2(Trace, const wxChar *, mask); - - // and this one does nothing if all of level bits are not set in - // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of - // string identifiers - DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask); -#else //!debug || !wxUSE_LOG - // these functions do nothing in release builds, but don't define them as - // nothing as it could result in different code structure in debug and - // release and this could result in trouble when these macros are used - // inside if/else - // - // note that making wxVLogDebug/Trace() themselves (empty inline) functions - // is a bad idea as some compilers are stupid enough to not inline even - // empty functions if their parameters are complicated enough, but by - // defining them as an empty inline function we ensure that even dumbest - // compilers optimise them away - inline void wxLogNop() { } - - #define wxVLogDebug(fmt, valist) wxLogNop() - #define wxVLogTrace(mask, fmt, valist) wxLogNop() - - #ifdef HAVE_VARIADIC_MACROS - // unlike the inline functions below, this completely removes the - // wxLogXXX calls from the object file: - #define wxLogDebug(fmt, ...) wxLogNop() - #define wxLogTrace(mask, fmt, ...) wxLogNop() - #else // !HAVE_VARIADIC_MACROS - // note that leaving out "fmt" in the vararg functions provokes a warning - // from SGI CC: "the last argument of the varargs function is unnamed" - inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); } - inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); } - inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); } - #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS -#endif // debug/!debug - -// wxLogFatalError helper: show the (fatal) error to the user in a safe way, -// i.e. without using wxMessageBox() for example because it could crash -void WXDLLIMPEXP_BASE -wxSafeShowMessage(const wxString& title, const wxString& text); - -// ---------------------------------------------------------------------------- -// debug only logging functions: use them with API name and error code -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - // make life easier for people using VC++ IDE: clicking on the message - // will take us immediately to the place of the failed API -#ifdef __VISUALC__ - #define wxLogApiError(api, rc) \ - wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, api, \ - (long)rc, wxSysErrorMsg(rc)) -#else // !VC++ - #define wxLogApiError(api, rc) \ - wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ - wxT("error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, api, \ - (long)rc, wxSysErrorMsg(rc)) -#endif // VC++/!VC++ - - #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) - -#else //!debug - #define wxLogApiError(api, err) wxLogNop() - #define wxLogLastError(api) wxLogNop() -#endif //debug/!debug - -// wxCocoa has additiional trace masks -#if defined(__WXCOCOA__) -#include "wx/cocoa/log.h" -#endif - -#endif // _WX_LOG_H_ - diff --git a/Source/3rdParty/wx/include/wx/longlong.h b/Source/3rdParty/wx/include/wx/longlong.h deleted file mode 100644 index 304001d8d..000000000 --- a/Source/3rdParty/wx/include/wx/longlong.h +++ /dev/null @@ -1,1080 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/longlong.h -// Purpose: declaration of wxLongLong class - best implementation of a 64 -// bit integer for the current platform. -// Author: Jeffrey C. Ollie , Vadim Zeitlin -// Modified by: -// Created: 10.02.99 -// RCS-ID: $Id: longlong.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LONGLONG_H -#define _WX_LONGLONG_H - -#include "wx/defs.h" - -#if wxUSE_LONGLONG - -#include "wx/string.h" - -#include // for LONG_MAX - -// define this to compile wxLongLongWx in "test" mode: the results of all -// calculations will be compared with the real results taken from -// wxLongLongNative -- this is extremely useful to find the bugs in -// wxLongLongWx class! - -// #define wxLONGLONG_TEST_MODE - -#ifdef wxLONGLONG_TEST_MODE - #define wxUSE_LONGLONG_WX 1 - #define wxUSE_LONGLONG_NATIVE 1 -#endif // wxLONGLONG_TEST_MODE - -// ---------------------------------------------------------------------------- -// decide upon which class we will use -// ---------------------------------------------------------------------------- - -#ifndef wxLongLong_t - // both warning and pragma warning are not portable, but at least an - // unknown pragma should never be an error -- except that, actually, some - // broken compilers don't like it, so we have to disable it in this case - // - #ifdef __GNUC__ - #warning "Your compiler does not appear to support 64 bit "\ - "integers, using emulation class instead.\n" \ - "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" - #elif !(defined(__WATCOMC__) || defined(__VISAGECPP__)) - #pragma warning "Your compiler does not appear to support 64 bit "\ - "integers, using emulation class instead.\n" \ - "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" - #endif - - #define wxUSE_LONGLONG_WX 1 -#endif // compiler - -// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE -// to disable automatic testing (useful for the test program which defines -// both classes) but by default we only use one class -#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t) - // don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set: - // this is useful in test programs and only there - #ifndef wxUSE_LONGLONG_NATIVE - #define wxUSE_LONGLONG_NATIVE 0 - #endif - - class WXDLLIMPEXP_BASE wxLongLongWx; - class WXDLLIMPEXP_BASE wxULongLongWx; -#if defined(__VISUALC__) && !defined(__WIN32__) - #define wxLongLong wxLongLongWx - #define wxULongLong wxULongLongWx -#else - typedef wxLongLongWx wxLongLong; - typedef wxULongLongWx wxULongLong; -#endif - -#else - // if nothing is defined, use native implementation by default, of course - #ifndef wxUSE_LONGLONG_NATIVE - #define wxUSE_LONGLONG_NATIVE 1 - #endif -#endif - -#ifndef wxUSE_LONGLONG_WX - #define wxUSE_LONGLONG_WX 0 - class WXDLLIMPEXP_FWD_BASE wxLongLongNative; - class WXDLLIMPEXP_FWD_BASE wxULongLongNative; - typedef wxLongLongNative wxLongLong; - typedef wxULongLongNative wxULongLong; -#endif - -// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should -// typedef wxLongLong as it wants, we don't do it - -// ---------------------------------------------------------------------------- -// choose the appropriate class -// ---------------------------------------------------------------------------- - -// we use iostream for wxLongLong output -#include "wx/iosfwrap.h" - -#if wxUSE_LONGLONG_NATIVE - -class WXDLLIMPEXP_BASE wxLongLongNative -{ -public: - // ctors - // default ctor initializes to 0 - wxLongLongNative() : m_ll(0) { } - // from long long - wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { } - // from 2 longs - wxLongLongNative(wxInt32 hi, wxUint32 lo) - { - // cast to wxLongLong_t first to avoid precision loss! - m_ll = ((wxLongLong_t) hi) << 32; - m_ll |= (wxLongLong_t) lo; - } -#if wxUSE_LONGLONG_WX - wxLongLongNative(wxLongLongWx ll); -#endif - - // default copy ctor is ok - - // no dtor - - // assignment operators - // from native 64 bit integer -#ifndef wxLongLongIsLong - wxLongLongNative& operator=(wxLongLong_t ll) - { m_ll = ll; return *this; } - wxLongLongNative& operator=(wxULongLong_t ll) - { m_ll = ll; return *this; } -#endif // !wxLongLongNative - wxLongLongNative& operator=(const wxULongLongNative &ll); - wxLongLongNative& operator=(int l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(long l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(unsigned int l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(unsigned long l) - { m_ll = l; return *this; } -#if wxUSE_LONGLONG_WX - wxLongLongNative& operator=(wxLongLongWx ll); - wxLongLongNative& operator=(const class wxULongLongWx &ll); -#endif - - - // from double: this one has an explicit name because otherwise we - // would have ambiguity with "ll = int" and also because we don't want - // to have implicit conversions between doubles and wxLongLongs - wxLongLongNative& Assign(double d) - { m_ll = (wxLongLong_t)d; return *this; } - - // assignment operators from wxLongLongNative is ok - - // accessors - // get high part - wxInt32 GetHi() const - { return wx_truncate_cast(wxInt32, m_ll >> 32); } - // get low part - wxUint32 GetLo() const - { return wx_truncate_cast(wxUint32, m_ll); } - - // get absolute value - wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); } - wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; } - - // convert to native long long - wxLongLong_t GetValue() const { return m_ll; } - - // convert to long with range checking in debug mode (only!) - long ToLong() const - { - wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), - wxT("wxLongLong to long conversion loss of precision") ); - - return wx_truncate_cast(long, m_ll); - } - - // convert to double - double ToDouble() const { return wx_truncate_cast(double, m_ll); } - - // don't provide implicit conversion to wxLongLong_t or we will have an - // ambiguity for all arithmetic operations - //operator wxLongLong_t() const { return m_ll; } - - // operations - // addition - wxLongLongNative operator+(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll + ll.m_ll); } - wxLongLongNative& operator+=(const wxLongLongNative& ll) - { m_ll += ll.m_ll; return *this; } - - wxLongLongNative operator+(const wxLongLong_t ll) const - { return wxLongLongNative(m_ll + ll); } - wxLongLongNative& operator+=(const wxLongLong_t ll) - { m_ll += ll; return *this; } - - // pre increment - wxLongLongNative& operator++() - { m_ll++; return *this; } - - // post increment - wxLongLongNative operator++(int) - { wxLongLongNative value(*this); m_ll++; return value; } - - // negation operator - wxLongLongNative operator-() const - { return wxLongLongNative(-m_ll); } - wxLongLongNative& Negate() { m_ll = -m_ll; return *this; } - - // subtraction - wxLongLongNative operator-(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll - ll.m_ll); } - wxLongLongNative& operator-=(const wxLongLongNative& ll) - { m_ll -= ll.m_ll; return *this; } - - wxLongLongNative operator-(const wxLongLong_t ll) const - { return wxLongLongNative(m_ll - ll); } - wxLongLongNative& operator-=(const wxLongLong_t ll) - { m_ll -= ll; return *this; } - - // pre decrement - wxLongLongNative& operator--() - { m_ll--; return *this; } - - // post decrement - wxLongLongNative operator--(int) - { wxLongLongNative value(*this); m_ll--; return value; } - - // shifts - // left shift - wxLongLongNative operator<<(int shift) const - { return wxLongLongNative(m_ll << shift); } - wxLongLongNative& operator<<=(int shift) - { m_ll <<= shift; return *this; } - - // right shift - wxLongLongNative operator>>(int shift) const - { return wxLongLongNative(m_ll >> shift); } - wxLongLongNative& operator>>=(int shift) - { m_ll >>= shift; return *this; } - - // bitwise operators - wxLongLongNative operator&(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll & ll.m_ll); } - wxLongLongNative& operator&=(const wxLongLongNative& ll) - { m_ll &= ll.m_ll; return *this; } - - wxLongLongNative operator|(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll | ll.m_ll); } - wxLongLongNative& operator|=(const wxLongLongNative& ll) - { m_ll |= ll.m_ll; return *this; } - - wxLongLongNative operator^(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll ^ ll.m_ll); } - wxLongLongNative& operator^=(const wxLongLongNative& ll) - { m_ll ^= ll.m_ll; return *this; } - - // multiplication/division - wxLongLongNative operator*(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll * ll.m_ll); } - wxLongLongNative operator*(long l) const - { return wxLongLongNative(m_ll * l); } - wxLongLongNative& operator*=(const wxLongLongNative& ll) - { m_ll *= ll.m_ll; return *this; } - wxLongLongNative& operator*=(long l) - { m_ll *= l; return *this; } - - wxLongLongNative operator/(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll / ll.m_ll); } - wxLongLongNative operator/(long l) const - { return wxLongLongNative(m_ll / l); } - wxLongLongNative& operator/=(const wxLongLongNative& ll) - { m_ll /= ll.m_ll; return *this; } - wxLongLongNative& operator/=(long l) - { m_ll /= l; return *this; } - - wxLongLongNative operator%(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll % ll.m_ll); } - wxLongLongNative operator%(long l) const - { return wxLongLongNative(m_ll % l); } - - // comparison - bool operator==(const wxLongLongNative& ll) const - { return m_ll == ll.m_ll; } - bool operator==(long l) const - { return m_ll == l; } - bool operator!=(const wxLongLongNative& ll) const - { return m_ll != ll.m_ll; } - bool operator!=(long l) const - { return m_ll != l; } - bool operator<(const wxLongLongNative& ll) const - { return m_ll < ll.m_ll; } - bool operator<(long l) const - { return m_ll < l; } - bool operator>(const wxLongLongNative& ll) const - { return m_ll > ll.m_ll; } - bool operator>(long l) const - { return m_ll > l; } - bool operator<=(const wxLongLongNative& ll) const - { return m_ll <= ll.m_ll; } - bool operator<=(long l) const - { return m_ll <= l; } - bool operator>=(const wxLongLongNative& ll) const - { return m_ll >= ll.m_ll; } - bool operator>=(long l) const - { return m_ll >= l; } - - // miscellaneous - - // return the string representation of this number - wxString ToString() const; - - // conversion to byte array: returns a pointer to static buffer! - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - // input/output - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&); -#endif - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxLongLongNative&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&); -#endif - -private: - wxLongLong_t m_ll; -}; - - -class WXDLLIMPEXP_BASE wxULongLongNative -{ -public: - // ctors - // default ctor initializes to 0 - wxULongLongNative() : m_ll(0) { } - // from long long - wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { } - // from 2 longs - wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0) - { - // cast to wxLongLong_t first to avoid precision loss! - m_ll = ((wxULongLong_t) hi) << 32; - m_ll |= (wxULongLong_t) lo; - } - -#if wxUSE_LONGLONG_WX - wxULongLongNative(const class wxULongLongWx &ll); -#endif - - // default copy ctor is ok - - // no dtor - - // assignment operators - // from native 64 bit integer -#ifndef wxLongLongIsLong - wxULongLongNative& operator=(wxULongLong_t ll) - { m_ll = ll; return *this; } - wxULongLongNative& operator=(wxLongLong_t ll) - { m_ll = ll; return *this; } -#endif // !wxLongLongNative - wxULongLongNative& operator=(int l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(long l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(unsigned int l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(unsigned long l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(const wxLongLongNative &ll) - { m_ll = ll.GetValue(); return *this; } -#if wxUSE_LONGLONG_WX - wxULongLongNative& operator=(wxLongLongWx ll); - wxULongLongNative& operator=(const class wxULongLongWx &ll); -#endif - - // assignment operators from wxULongLongNative is ok - - // accessors - // get high part - wxUint32 GetHi() const - { return wx_truncate_cast(wxUint32, m_ll >> 32); } - // get low part - wxUint32 GetLo() const - { return wx_truncate_cast(wxUint32, m_ll); } - - // convert to native ulong long - wxULongLong_t GetValue() const { return m_ll; } - - // convert to ulong with range checking in debug mode (only!) - unsigned long ToULong() const - { - wxASSERT_MSG( m_ll <= LONG_MAX, - wxT("wxULongLong to long conversion loss of precision") ); - - return wx_truncate_cast(unsigned long, m_ll); - } - - // convert to double -#ifdef _MSC_VER - double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); } -#else - double ToDouble() const { return wx_truncate_cast(double, m_ll); } -#endif - - // operations - // addition - wxULongLongNative operator+(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll + ll.m_ll); } - wxULongLongNative& operator+=(const wxULongLongNative& ll) - { m_ll += ll.m_ll; return *this; } - - wxULongLongNative operator+(const wxULongLong_t ll) const - { return wxULongLongNative(m_ll + ll); } - wxULongLongNative& operator+=(const wxULongLong_t ll) - { m_ll += ll; return *this; } - - // pre increment - wxULongLongNative& operator++() - { m_ll++; return *this; } - - // post increment - wxULongLongNative operator++(int) - { wxULongLongNative value(*this); m_ll++; return value; } - - // subtraction - wxULongLongNative operator-(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll - ll.m_ll); } - wxULongLongNative& operator-=(const wxULongLongNative& ll) - { m_ll -= ll.m_ll; return *this; } - - wxULongLongNative operator-(const wxULongLong_t ll) const - { return wxULongLongNative(m_ll - ll); } - wxULongLongNative& operator-=(const wxULongLong_t ll) - { m_ll -= ll; return *this; } - - // pre decrement - wxULongLongNative& operator--() - { m_ll--; return *this; } - - // post decrement - wxULongLongNative operator--(int) - { wxULongLongNative value(*this); m_ll--; return value; } - - // shifts - // left shift - wxULongLongNative operator<<(int shift) const - { return wxULongLongNative(m_ll << shift); } - wxULongLongNative& operator<<=(int shift) - { m_ll <<= shift; return *this; } - - // right shift - wxULongLongNative operator>>(int shift) const - { return wxULongLongNative(m_ll >> shift); } - wxULongLongNative& operator>>=(int shift) - { m_ll >>= shift; return *this; } - - // bitwise operators - wxULongLongNative operator&(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll & ll.m_ll); } - wxULongLongNative& operator&=(const wxULongLongNative& ll) - { m_ll &= ll.m_ll; return *this; } - - wxULongLongNative operator|(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll | ll.m_ll); } - wxULongLongNative& operator|=(const wxULongLongNative& ll) - { m_ll |= ll.m_ll; return *this; } - - wxULongLongNative operator^(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll ^ ll.m_ll); } - wxULongLongNative& operator^=(const wxULongLongNative& ll) - { m_ll ^= ll.m_ll; return *this; } - - // multiplication/division - wxULongLongNative operator*(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll * ll.m_ll); } - wxULongLongNative operator*(unsigned long l) const - { return wxULongLongNative(m_ll * l); } - wxULongLongNative& operator*=(const wxULongLongNative& ll) - { m_ll *= ll.m_ll; return *this; } - wxULongLongNative& operator*=(unsigned long l) - { m_ll *= l; return *this; } - - wxULongLongNative operator/(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll / ll.m_ll); } - wxULongLongNative operator/(unsigned long l) const - { return wxULongLongNative(m_ll / l); } - wxULongLongNative& operator/=(const wxULongLongNative& ll) - { m_ll /= ll.m_ll; return *this; } - wxULongLongNative& operator/=(unsigned long l) - { m_ll /= l; return *this; } - - wxULongLongNative operator%(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll % ll.m_ll); } - wxULongLongNative operator%(unsigned long l) const - { return wxULongLongNative(m_ll % l); } - - // comparison - bool operator==(const wxULongLongNative& ll) const - { return m_ll == ll.m_ll; } - bool operator==(unsigned long l) const - { return m_ll == l; } - bool operator!=(const wxULongLongNative& ll) const - { return m_ll != ll.m_ll; } - bool operator!=(unsigned long l) const - { return m_ll != l; } - bool operator<(const wxULongLongNative& ll) const - { return m_ll < ll.m_ll; } - bool operator<(unsigned long l) const - { return m_ll < l; } - bool operator>(const wxULongLongNative& ll) const - { return m_ll > ll.m_ll; } - bool operator>(unsigned long l) const - { return m_ll > l; } - bool operator<=(const wxULongLongNative& ll) const - { return m_ll <= ll.m_ll; } - bool operator<=(unsigned long l) const - { return m_ll <= l; } - bool operator>=(const wxULongLongNative& ll) const - { return m_ll >= ll.m_ll; } - bool operator>=(unsigned long l) const - { return m_ll >= l; } - - // miscellaneous - - // return the string representation of this number - wxString ToString() const; - - // conversion to byte array: returns a pointer to static buffer! - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - // input/output - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&); -#endif - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxULongLongNative&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&); -#endif - -private: - wxULongLong_t m_ll; -}; - -inline -wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll) -{ - m_ll = ll.GetValue(); - return *this; -} - -#endif // wxUSE_LONGLONG_NATIVE - -#if wxUSE_LONGLONG_WX - -class WXDLLIMPEXP_BASE wxLongLongWx -{ -public: - // ctors - // default ctor initializes to 0 - wxLongLongWx() - { - m_lo = m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = 0; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - // from long - wxLongLongWx(long l) { *this = l; } - // from 2 longs - wxLongLongWx(long hi, unsigned long lo) - { - m_hi = hi; - m_lo = lo; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = hi; - m_ll <<= 32; - m_ll |= lo; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - - // default copy ctor is ok in both cases - - // no dtor - - // assignment operators - // from long - wxLongLongWx& operator=(long l) - { - m_lo = l; - m_hi = (l < 0 ? -1l : 0l); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - // from int - wxLongLongWx& operator=(int l) - { - return operator=((long)l); - } - - wxLongLongWx& operator=(unsigned long l) - { - m_lo = l; - m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - - wxLongLongWx& operator=(unsigned int l) - { - return operator=((unsigned long)l); - } - - wxLongLongWx& operator=(const class wxULongLongWx &ll); - - // from double - wxLongLongWx& Assign(double d); - // can't have assignment operator from 2 longs - - // accessors - // get high part - long GetHi() const { return m_hi; } - // get low part - unsigned long GetLo() const { return m_lo; } - - // get absolute value - wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); } - wxLongLongWx& Abs() - { - if ( m_hi < 0 ) - m_hi = -m_hi; - -#ifdef wxLONGLONG_TEST_MODE - if ( m_ll < 0 ) - m_ll = -m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - - // convert to long with range checking in debug mode (only!) - long ToLong() const - { - wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l), - wxT("wxLongLong to long conversion loss of precision") ); - - return (long)m_lo; - } - - // convert to double - double ToDouble() const; - - // operations - // addition - wxLongLongWx operator+(const wxLongLongWx& ll) const; - wxLongLongWx& operator+=(const wxLongLongWx& ll); - wxLongLongWx operator+(long l) const; - wxLongLongWx& operator+=(long l); - - // pre increment operator - wxLongLongWx& operator++(); - - // post increment operator - wxLongLongWx& operator++(int) { return ++(*this); } - - // negation operator - wxLongLongWx operator-() const; - wxLongLongWx& Negate(); - - // subraction - wxLongLongWx operator-(const wxLongLongWx& ll) const; - wxLongLongWx& operator-=(const wxLongLongWx& ll); - - // pre decrement operator - wxLongLongWx& operator--(); - - // post decrement operator - wxLongLongWx& operator--(int) { return --(*this); } - - // shifts - // left shift - wxLongLongWx operator<<(int shift) const; - wxLongLongWx& operator<<=(int shift); - - // right shift - wxLongLongWx operator>>(int shift) const; - wxLongLongWx& operator>>=(int shift); - - // bitwise operators - wxLongLongWx operator&(const wxLongLongWx& ll) const; - wxLongLongWx& operator&=(const wxLongLongWx& ll); - wxLongLongWx operator|(const wxLongLongWx& ll) const; - wxLongLongWx& operator|=(const wxLongLongWx& ll); - wxLongLongWx operator^(const wxLongLongWx& ll) const; - wxLongLongWx& operator^=(const wxLongLongWx& ll); - wxLongLongWx operator~() const; - - // comparison - bool operator==(const wxLongLongWx& ll) const - { return m_lo == ll.m_lo && m_hi == ll.m_hi; } -#if wxUSE_LONGLONG_NATIVE - bool operator==(const wxLongLongNative& ll) const - { return m_lo == ll.GetLo() && m_hi == ll.GetHi(); } -#endif - bool operator!=(const wxLongLongWx& ll) const - { return !(*this == ll); } - bool operator<(const wxLongLongWx& ll) const; - bool operator>(const wxLongLongWx& ll) const; - bool operator<=(const wxLongLongWx& ll) const - { return *this < ll || *this == ll; } - bool operator>=(const wxLongLongWx& ll) const - { return *this > ll || *this == ll; } - - bool operator<(long l) const { return *this < wxLongLongWx(l); } - bool operator>(long l) const { return *this > wxLongLongWx(l); } - bool operator==(long l) const - { - return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l) - : (m_hi == -1 && m_lo == (unsigned long)l); - } - - bool operator<=(long l) const { return *this < l || *this == l; } - bool operator>=(long l) const { return *this > l || *this == l; } - - // multiplication - wxLongLongWx operator*(const wxLongLongWx& ll) const; - wxLongLongWx& operator*=(const wxLongLongWx& ll); - - // division - wxLongLongWx operator/(const wxLongLongWx& ll) const; - wxLongLongWx& operator/=(const wxLongLongWx& ll); - - wxLongLongWx operator%(const wxLongLongWx& ll) const; - - void Divide(const wxLongLongWx& divisor, - wxLongLongWx& quotient, - wxLongLongWx& remainder) const; - - // input/output - - // return the string representation of this number - wxString ToString() const; - - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&); -#endif // wxUSE_STD_IOSTREAM - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxLongLongWx&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&); -#endif - -private: - // long is at least 32 bits, so represent our 64bit number as 2 longs - - long m_hi; // signed bit is in the high part - unsigned long m_lo; - -#ifdef wxLONGLONG_TEST_MODE - void Check() - { - wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); - } - - wxLongLong_t m_ll; -#endif // wxLONGLONG_TEST_MODE -}; - - -class WXDLLIMPEXP_BASE wxULongLongWx -{ -public: - // ctors - // default ctor initializes to 0 - wxULongLongWx() - { - m_lo = m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = 0; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - // from ulong - wxULongLongWx(unsigned long l) { *this = l; } - // from 2 ulongs - wxULongLongWx(unsigned long hi, unsigned long lo) - { - m_hi = hi; - m_lo = lo; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = hi; - m_ll <<= 32; - m_ll |= lo; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - - // from signed to unsigned - wxULongLongWx(wxLongLongWx ll) - { - wxASSERT(ll.GetHi() >= 0); - m_hi = (unsigned long)ll.GetHi(); - m_lo = ll.GetLo(); - } - - // default copy ctor is ok in both cases - - // no dtor - - // assignment operators - // from long - wxULongLongWx& operator=(unsigned long l) - { - m_lo = l; - m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - wxULongLongWx& operator=(long l) - { - m_lo = l; - m_hi = (unsigned long) ((l<0) ? -1l : 0); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = (wxULongLong_t) (wxLongLong_t) l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - wxULongLongWx& operator=(const class wxLongLongWx &ll) { - // Should we use an assert like it was before in the constructor? - // wxASSERT(ll.GetHi() >= 0); - m_hi = (unsigned long)ll.GetHi(); - m_lo = ll.GetLo(); - return *this; - } - - // can't have assignment operator from 2 longs - - // accessors - // get high part - unsigned long GetHi() const { return m_hi; } - // get low part - unsigned long GetLo() const { return m_lo; } - - // convert to long with range checking in debug mode (only!) - unsigned long ToULong() const - { - wxASSERT_MSG( m_hi == 0ul, - wxT("wxULongLong to long conversion loss of precision") ); - - return (unsigned long)m_lo; - } - - // convert to double - double ToDouble() const; - - // operations - // addition - wxULongLongWx operator+(const wxULongLongWx& ll) const; - wxULongLongWx& operator+=(const wxULongLongWx& ll); - wxULongLongWx operator+(unsigned long l) const; - wxULongLongWx& operator+=(unsigned long l); - - // pre increment operator - wxULongLongWx& operator++(); - - // post increment operator - wxULongLongWx& operator++(int) { return ++(*this); } - - // subtraction - wxLongLongWx operator-(const wxULongLongWx& ll) const; - wxULongLongWx& operator-=(const wxULongLongWx& ll); - - // pre decrement operator - wxULongLongWx& operator--(); - - // post decrement operator - wxULongLongWx& operator--(int) { return --(*this); } - - // shifts - // left shift - wxULongLongWx operator<<(int shift) const; - wxULongLongWx& operator<<=(int shift); - - // right shift - wxULongLongWx operator>>(int shift) const; - wxULongLongWx& operator>>=(int shift); - - // bitwise operators - wxULongLongWx operator&(const wxULongLongWx& ll) const; - wxULongLongWx& operator&=(const wxULongLongWx& ll); - wxULongLongWx operator|(const wxULongLongWx& ll) const; - wxULongLongWx& operator|=(const wxULongLongWx& ll); - wxULongLongWx operator^(const wxULongLongWx& ll) const; - wxULongLongWx& operator^=(const wxULongLongWx& ll); - wxULongLongWx operator~() const; - - // comparison - bool operator==(const wxULongLongWx& ll) const - { return m_lo == ll.m_lo && m_hi == ll.m_hi; } - bool operator!=(const wxULongLongWx& ll) const - { return !(*this == ll); } - bool operator<(const wxULongLongWx& ll) const; - bool operator>(const wxULongLongWx& ll) const; - bool operator<=(const wxULongLongWx& ll) const - { return *this < ll || *this == ll; } - bool operator>=(const wxULongLongWx& ll) const - { return *this > ll || *this == ll; } - - bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); } - bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); } - bool operator==(unsigned long l) const - { - return (m_hi == 0 && m_lo == (unsigned long)l); - } - - bool operator<=(unsigned long l) const { return *this < l || *this == l; } - bool operator>=(unsigned long l) const { return *this > l || *this == l; } - - // multiplication - wxULongLongWx operator*(const wxULongLongWx& ll) const; - wxULongLongWx& operator*=(const wxULongLongWx& ll); - - // division - wxULongLongWx operator/(const wxULongLongWx& ll) const; - wxULongLongWx& operator/=(const wxULongLongWx& ll); - - wxULongLongWx operator%(const wxULongLongWx& ll) const; - - void Divide(const wxULongLongWx& divisor, - wxULongLongWx& quotient, - wxULongLongWx& remainder) const; - - // input/output - - // return the string representation of this number - wxString ToString() const; - - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&); -#endif // wxUSE_STD_IOSTREAM - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxULongLongWx&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&); -#endif - -private: - // long is at least 32 bits, so represent our 64bit number as 2 longs - - unsigned long m_hi; - unsigned long m_lo; - -#ifdef wxLONGLONG_TEST_MODE - void Check() - { - wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); - } - - wxULongLong_t m_ll; -#endif // wxLONGLONG_TEST_MODE -}; - -#endif // wxUSE_LONGLONG_WX - -// ---------------------------------------------------------------------------- -// binary operators -// ---------------------------------------------------------------------------- - -inline bool operator<(long l, const wxLongLong& ll) { return ll > l; } -inline bool operator>(long l, const wxLongLong& ll) { return ll < l; } -inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; } -inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; } -inline bool operator==(long l, const wxLongLong& ll) { return ll == l; } -inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; } - -inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; } -inline wxLongLong operator-(long l, const wxLongLong& ll) -{ - return wxLongLong(l) - ll; -} - -inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; } -inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; } -inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; } -inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; } -inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; } -inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; } - -inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; } - -inline wxLongLong operator-(unsigned long l, const wxULongLong& ull) -{ - wxULongLong ret = wxULongLong(l) - ull; - return wxLongLong((long)ret.GetHi(),ret.GetLo()); -} - -#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS - -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value); -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value); - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value); -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value); - -#endif - -#endif // wxUSE_LONGLONG - -#endif // _WX_LONGLONG_H diff --git a/Source/3rdParty/wx/include/wx/math.h b/Source/3rdParty/wx/include/wx/math.h deleted file mode 100644 index 5ac102151..000000000 --- a/Source/3rdParty/wx/include/wx/math.h +++ /dev/null @@ -1,140 +0,0 @@ -/** -* Name: wx/math.h -* Purpose: Declarations/definitions of common math functions -* Author: John Labenski and others -* Modified by: -* Created: 02/02/03 -* RCS-ID: $Id: math.h 62541 2009-11-03 14:10:46Z VZ $ -* Copyright: (c) John Labenski -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MATH_H_ -#define _WX_MATH_H_ - -#include "wx/defs.h" - -#include - -#ifndef M_PI - #define M_PI 3.1415926535897932384626433832795 -#endif - -/* Scaling factors for various unit conversions */ -#ifndef METRIC_CONVERSION_CONSTANT - #define METRIC_CONVERSION_CONSTANT 0.0393700787 -#endif - -#ifndef mm2inches - #define mm2inches (METRIC_CONVERSION_CONSTANT) -#endif - -#ifndef inches2mm - #define inches2mm (1/(mm2inches)) -#endif - -#ifndef mm2twips - #define mm2twips (METRIC_CONVERSION_CONSTANT*1440) -#endif - -#ifndef twips2mm - #define twips2mm (1/(mm2twips)) -#endif - -#ifndef mm2pt - #define mm2pt (METRIC_CONVERSION_CONSTANT*72) -#endif - -#ifndef pt2mm - #define pt2mm (1/(mm2pt)) -#endif - - -/* unknown __VISAGECC__, __SYMANTECCC__ */ - -#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) - #include - #define wxFinite(x) _finite(x) -#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ - defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__)||defined(__MWERKS__) - #define wxFinite(x) finite(x) -#else - #define wxFinite(x) ((x) == (x)) -#endif - - -#if defined(__VISUALC__)||defined(__BORLAND__) - #define wxIsNaN(x) _isnan(x) -#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ - defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__)||defined(__MWERKS__) - #define wxIsNaN(x) isnan(x) -#else - #define wxIsNaN(x) ((x) != (x)) -#endif - -#ifdef __cplusplus - - #ifdef __INTELC__ - - inline bool wxIsSameDouble(double x, double y) - { - // VZ: this warning, given for operators==() and !=() is not wrong, as == - // shouldn't be used with doubles, but we get too many of them and - // removing these operators is probably not a good idea - // - // Maybe we should alway compare doubles up to some "epsilon" precision - #pragma warning(push) - - // floating-point equality and inequality comparisons are unreliable - #pragma warning(disable: 1572) - - return x == y; - - #pragma warning(pop) - } - - #else /* !__INTELC__ */ - - inline bool wxIsSameDouble(double x, double y) { return x == y; } - - #endif /* __INTELC__/!__INTELC__ */ - - inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); } - - inline int wxRound(double x) - { - #if defined(HAVE_ROUND) - return int(round(x)); - #else - return (int)(x < 0 ? x - 0.5 : x + 0.5); - #endif - } -#endif /* __cplusplus */ - - -#if defined(__WXMSW__) && !defined(__WXWINCE__) - #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) -#elif defined( __WXMAC__ ) - #define wxMulDivInt32( a , b , c ) ( (wxInt32) ( ( (wxInt64)(a) * (wxInt64)(b) ) / (wxInt64)(c) ) ) -#else - #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) -#endif - -#if wxUSE_APPLE_IEEE -#ifdef __cplusplus - extern "C" { -#endif - /* functions from common/extended.c */ - WXDLLEXPORT wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes); - WXDLLEXPORT void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); -#ifdef __cplusplus - } -#endif -#endif /* wxUSE_APPLE_IEEE */ - - -#endif /* _WX_MATH_H_ */ diff --git a/Source/3rdParty/wx/include/wx/matrix.h b/Source/3rdParty/wx/include/wx/matrix.h deleted file mode 100644 index 11c688ba4..000000000 --- a/Source/3rdParty/wx/include/wx/matrix.h +++ /dev/null @@ -1,235 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/matrix.h -// Purpose: wxTransformMatrix class. NOT YET USED -// Author: Chris Breeze, Julian Smart -// Modified by: Klaas Holwerda -// Created: 01/02/97 -// RCS-ID: $Id: matrix.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart, Chris Breeze -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MATRIXH__ -#define _WX_MATRIXH__ - -//! headerfiles="matrix.h wx/object.h" -#include "wx/object.h" -#include "wx/math.h" - -//! codefiles="matrix.cpp" - -// A simple 3x3 matrix. This may be replaced by a more general matrix -// class some day. -// -// Note: this is intended to be used in wxDC at some point to replace -// the current system of scaling/translation. It is not yet used. - -//:definition -// A 3x3 matrix to do 2D transformations. -// It can be used to map data to window coordinates, -// and also for manipulating your own data. -// For example drawing a picture (composed of several primitives) -// at a certain coordinate and angle within another parent picture. -// At all times m_isIdentity is set if the matrix itself is an Identity matrix. -// It is used where possible to optimize calculations. -class WXDLLEXPORT wxTransformMatrix: public wxObject -{ -public: - wxTransformMatrix(void); - wxTransformMatrix(const wxTransformMatrix& mat); - - //get the value in the matrix at col,row - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double GetValue(int col, int row) const; - - //set the value in the matrix at col,row - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - void SetValue(int col, int row, double value); - - void operator = (const wxTransformMatrix& mat); - bool operator == (const wxTransformMatrix& mat) const; - bool operator != (const wxTransformMatrix& mat) const; - - //multiply every element by t - wxTransformMatrix& operator*=(const double& t); - //divide every element by t - wxTransformMatrix& operator/=(const double& t); - //add matrix m to this t - wxTransformMatrix& operator+=(const wxTransformMatrix& m); - //subtract matrix m from this - wxTransformMatrix& operator-=(const wxTransformMatrix& m); - //multiply matrix m with this - wxTransformMatrix& operator*=(const wxTransformMatrix& m); - - // constant operators - - //multiply every element by t and return result - wxTransformMatrix operator*(const double& t) const; - //divide this matrix by t and return result - wxTransformMatrix operator/(const double& t) const; - //add matrix m to this and return result - wxTransformMatrix operator+(const wxTransformMatrix& m) const; - //subtract matrix m from this and return result - wxTransformMatrix operator-(const wxTransformMatrix& m) const; - //multiply this by matrix m and return result - wxTransformMatrix operator*(const wxTransformMatrix& m) const; - wxTransformMatrix operator-() const; - - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double& operator()(int col, int row); - - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double operator()(int col, int row) const; - - // Invert matrix - bool Invert(void); - - // Make into identity matrix - bool Identity(void); - - // Is the matrix the identity matrix? - // Only returns a flag, which is set whenever an operation - // is done. - inline bool IsIdentity(void) const { return m_isIdentity; } - - // This does an actual check. - inline bool IsIdentity1(void) const ; - - //Scale by scale (isotropic scaling i.e. the same in x and y): - //!ex: - //!code: | scale 0 0 | - //!code: matrix' = | 0 scale 0 | x matrix - //!code: | 0 0 scale | - bool Scale(double scale); - - //Scale with center point and x/y scale - // - //!ex: - //!code: | xs 0 xc(1-xs) | - //!code: matrix' = | 0 ys yc(1-ys) | x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc); - - // mirror a matrix in x, y - //!ex: - //!code: | -1 0 0 | - //!code: matrix' = | 0 -1 0 | x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Mirror(bool x=true, bool y=false); - // Translate by dx, dy: - //!ex: - //!code: | 1 0 dx | - //!code: matrix' = | 0 1 dy | x matrix - //!code: | 0 0 1 | - bool Translate(double x, double y); - - // Rotate clockwise by the given number of degrees: - //!ex: - //!code: | cos sin 0 | - //!code: matrix' = | -sin cos 0 | x matrix - //!code: | 0 0 1 | - bool Rotate(double angle); - - //Rotate counter clockwise with point of rotation - // - //!ex: - //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)| - //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Rotate(const double &r, const double &x, const double &y); - - // Transform X value from logical to device - inline double TransformX(double x) const; - - // Transform Y value from logical to device - inline double TransformY(double y) const; - - // Transform a point from logical to device coordinates - bool TransformPoint(double x, double y, double& tx, double& ty) const; - - // Transform a point from device to logical coordinates. - // Example of use: - // wxTransformMatrix mat = dc.GetTransformation(); - // mat.Invert(); - // mat.InverseTransformPoint(x, y, x1, y1); - // OR (shorthand:) - // dc.LogicalToDevice(x, y, x1, y1); - // The latter is slightly less efficient if we're doing several - // conversions, since the matrix is inverted several times. - // N.B. 'this' matrix is the inverse at this point - bool InverseTransformPoint(double x, double y, double& tx, double& ty) const; - - double Get_scaleX(); - double Get_scaleY(); - double GetRotation(); - void SetRotation(double rotation); - - -public: - double m_matrix[3][3]; - bool m_isIdentity; -}; - - -/* -Chris Breeze reported, that -some functions of wxTransformMatrix cannot work because it is not -known if he matrix has been inverted. Be careful when using it. -*/ - -// Transform X value from logical to device -// warning: this function can only be used for this purpose -// because no rotation is involved when mapping logical to device coordinates -// mirror and scaling for x and y will be part of the matrix -// if you have a matrix that is rotated, eg a shape containing a matrix to place -// it in the logical coordinate system, use TransformPoint -inline double wxTransformMatrix::TransformX(double x) const -{ - //normally like this, but since no rotation is involved (only mirror and scale) - //we can do without Y -> m_matrix[1]{0] is -sin(rotation angle) and therefore zero - //(x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])) - return (m_isIdentity ? x : (x * m_matrix[0][0] + m_matrix[2][0])); -} - -// Transform Y value from logical to device -// warning: this function can only be used for this purpose -// because no rotation is involved when mapping logical to device coordinates -// mirror and scaling for x and y will be part of the matrix -// if you have a matrix that is rotated, eg a shape containing a matrix to place -// it in the logical coordinate system, use TransformPoint -inline double wxTransformMatrix::TransformY(double y) const -{ - //normally like this, but since no rotation is involved (only mirror and scale) - //we can do without X -> m_matrix[0]{1] is sin(rotation angle) and therefore zero - //(x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])) - return (m_isIdentity ? y : (y * m_matrix[1][1] + m_matrix[2][1])); -} - - -// Is the matrix the identity matrix? -// Each operation checks whether the result is still the identity matrix and sets a flag. -inline bool wxTransformMatrix::IsIdentity1(void) const -{ - return - ( wxIsSameDouble(m_matrix[0][0], 1.0) && - wxIsSameDouble(m_matrix[1][1], 1.0) && - wxIsSameDouble(m_matrix[2][2], 1.0) && - wxIsSameDouble(m_matrix[1][0], 0.0) && - wxIsSameDouble(m_matrix[2][0], 0.0) && - wxIsSameDouble(m_matrix[0][1], 0.0) && - wxIsSameDouble(m_matrix[2][1], 0.0) && - wxIsSameDouble(m_matrix[0][2], 0.0) && - wxIsSameDouble(m_matrix[1][2], 0.0) ); -} - -// Calculates the determinant of a 2 x 2 matrix -inline double wxCalculateDet(double a11, double a21, double a12, double a22) -{ - return a11 * a22 - a12 * a21; -} - -#endif // _WX_MATRIXH__ diff --git a/Source/3rdParty/wx/include/wx/mdi.h b/Source/3rdParty/wx/include/wx/mdi.h deleted file mode 100644 index 7a9eeca59..000000000 --- a/Source/3rdParty/wx/include/wx/mdi.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mdi.h -// Purpose: wxMDI base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: mdi.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MDI_H_BASE_ -#define _WX_MDI_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MDI - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/mdig.h" -#elif defined(__WXMSW__) - #include "wx/msw/mdi.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/mdi.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/mdi.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/mdi.h" -#elif defined(__WXMAC__) - #include "wx/mac/mdi.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/mdi.h" -#elif defined(__WXPM__) - #include "wx/generic/mdig.h" -#endif - -#endif // wxUSE_MDI - -#endif - // _WX_MDI_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/memconf.h b/Source/3rdParty/wx/include/wx/memconf.h deleted file mode 100644 index 9508b1fef..000000000 --- a/Source/3rdParty/wx/include/wx/memconf.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/memconf.h -// Purpose: wxMemoryConfig class: a wxConfigBase implementation which only -// stores the settings in memory (thus they are lost when the -// program terminates) -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.01.00 -// RCS-ID: $Id: memconf.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - * NB: I don't see how this class may possibly be useful to the application - * program (as the settings are lost on program termination), but it is - * handy to have it inside wxWidgets. So for now let's say that this class - * is private and should only be used by wxWidgets itself - this might - * change in the future. - */ - -#ifndef _WX_MEMCONF_H_ -#define _WX_MEMCONF_H_ - -#if wxUSE_CONFIG - -#include "wx/fileconf.h" // the base class - -// ---------------------------------------------------------------------------- -// wxMemoryConfig: a config class which stores settings in non-persistent way -// ---------------------------------------------------------------------------- - -// notice that we inherit from wxFileConfig which already stores its data in -// memory and just disable file reading/writing - this is probably not optimal -// and might be changed in future as well (this class will always deriev from -// wxConfigBase though) -class wxMemoryConfig : public wxFileConfig -{ -public: - // default (and only) ctor - wxMemoryConfig() : wxFileConfig(wxEmptyString, // default app name - wxEmptyString, // default vendor name - wxEmptyString, // no local config file - wxEmptyString, // no system config file - 0) // don't use any files - { - } - - DECLARE_NO_COPY_CLASS(wxMemoryConfig) -}; - -#endif // wxUSE_CONFIG - -#endif // _WX_MEMCONF_H_ diff --git a/Source/3rdParty/wx/include/wx/memory.h b/Source/3rdParty/wx/include/wx/memory.h deleted file mode 100644 index e4594f66e..000000000 --- a/Source/3rdParty/wx/include/wx/memory.h +++ /dev/null @@ -1,373 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/memory.h -// Purpose: Memory operations -// Author: Arthur Seaton, Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: memory.h 39634 2006-06-08 12:51:01Z ABX $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MEMORYH__ -#define _WX_MEMORYH__ - -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/msgout.h" - -/* - The macro which will be expanded to include the file and line number - info, or to be a straight call to the new operator. -*/ - -#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#include - -#ifdef __WXDEBUG__ - -WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); -WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); - -//********************************************************************************** -/* - The global operator new used for everything apart from getting - dynamic storage within this function itself. -*/ - -// We'll only do malloc and free for the moment: leave the interesting -// stuff for the wxObject versions. - - -#if wxUSE_GLOBAL_MEMORY_OPERATORS - -// Undefine temporarily (new is #defined in object.h) because we want to -// declare some new operators. -#ifdef new - #undef new -#endif - -#if defined(__SUNCC__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 -#elif defined (__SGI_CC_) - // only supported by -n32 compilers - #ifndef __EDG_ABI_COMPATIBILITY_VERSION - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 - #endif -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 -#else - // ::operator new[] is a recent C++ feature, so assume it's not supported - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#endif - -// devik 2000-8-29: All new/delete ops are now inline because they can't -// be marked as dllexport/dllimport. It then leads to weird bugs when -// used on MSW as DLL -#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) -inline void * operator new (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, false); -} - -inline void * operator new (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false); -} - -inline void operator delete (void * buf) -{ - wxDebugFree(buf, false); -} - -#if wxUSE_ARRAY_MEMORY_OPERATORS -inline void * operator new[] (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false, true); -} - -inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, true); -} - -inline void operator delete[] (void * buf) -{ - wxDebugFree(buf, true); -} -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#else - -void * operator new (size_t size, wxChar * fileName, int lineNum); - -void * operator new (size_t size); - -void operator delete (void * buf); - -#if wxUSE_ARRAY_MEMORY_OPERATORS -void * operator new[] (size_t size); - -void * operator new[] (size_t size, wxChar * fileName, int lineNum); - -void operator delete[] (void * buf); -#endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) - -// VC++ 6.0 and MWERKS -#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) || defined(__MWERKS__) -inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, false); -} -inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, true); -} -#endif // __VISUALC__>=1200 -#endif // wxUSE_GLOBAL_MEMORY_OPERATORS -#endif // __WXDEBUG__ - -//********************************************************************************** - -typedef unsigned int wxMarkerType; - -/* - Define the struct which will be placed at the start of all dynamically - allocated memory. -*/ - -class WXDLLIMPEXP_BASE wxMemStruct { - -friend class WXDLLIMPEXP_BASE wxDebugContext; // access to the m_next pointer for list traversal. - -public: -public: - int AssertList (); - - size_t RequestSize () { return m_reqSize; } - wxMarkerType Marker () { return m_firstMarker; } - - // When an object is deleted we set the id slot to a specific value. - inline void SetDeleted (); - inline int IsDeleted (); - - int Append (); - int Unlink (); - - // Used to determine if the object is really a wxMemStruct. - // Not a foolproof test by any means, but better than none I hope! - int AssertIt (); - - // Do all validation on a node. - int ValidateNode (); - - // Check the integrity of a node and of the list, node by node. - int CheckBlock (); - int CheckAllPrevious (); - - // Print a single node. - void PrintNode (); - - // Called when the memory linking functions get an error. - void ErrorMsg (const char *); - void ErrorMsg (); - - inline void *GetActualData(void) const { return m_actualData; } - - void Dump(void); - -public: - // Check for underwriting. There are 2 of these checks. This one - // inside the struct and another right after the struct. - wxMarkerType m_firstMarker; - - // File name and line number are from cpp. - wxChar* m_fileName; - int m_lineNum; - - // The amount of memory requested by the caller. - size_t m_reqSize; - - // Used to try to verify that we really are dealing with an object - // of the required class. Can be 1 of 2 values these indicating a valid - // wxMemStruct object, or a deleted wxMemStruct object. - wxMarkerType m_id; - - wxMemStruct * m_prev; - wxMemStruct * m_next; - - void * m_actualData; - bool m_isObject; -}; - - -typedef void (wxMemStruct::*PmSFV) (); - - -/* - Debugging class. This will only have a single instance, but it's - a reasonable way to keep everything together and to make this - available for change if needed by someone else. - A lot of this stuff would be better off within the wxMemStruct class, but - it's stuff which we need to access at times when there is no wxMemStruct - object so we use this class instead. Think of it as a collection of - globals which have to do with the wxMemStruct class. -*/ - -class WXDLLIMPEXP_BASE wxDebugContext { - -protected: - // Used to set alignment for markers. - static size_t CalcAlignment (); - - // Returns the amount of padding needed after something of the given - // size. This is so that when we cast pointers backwards and forwards - // the pointer value will be valid for a wxMarkerType. - static size_t GetPadding (const size_t size) ; - - // Traverse the list. - static void TraverseList (PmSFV, wxMemStruct *from = NULL); - - static int debugLevel; - static bool debugOn; - - static int m_balign; // byte alignment - static int m_balignmask; // mask for performing byte alignment -public: - // Set a checkpoint to dump only the memory from - // a given point - static wxMemStruct *checkPoint; - - wxDebugContext(void); - ~wxDebugContext(void); - - static int GetLevel(void) { return debugLevel; } - static void SetLevel(int level) { debugLevel = level; } - - static bool GetDebugMode(void) { return debugOn; } - static void SetDebugMode(bool flag) { debugOn = flag; } - - static void SetCheckpoint(bool all = false); - static wxMemStruct *GetCheckpoint(void) { return checkPoint; } - - // Calculated from the request size and any padding needed - // before the final marker. - static size_t PaddedSize (const size_t reqSize); - - // Calc the total amount of space we need from the system - // to satisfy a caller request. This includes all padding. - static size_t TotSize (const size_t reqSize); - - // Return valid pointers to offsets within the allocated memory. - static char * StructPos (const char * buf); - static char * MidMarkerPos (const char * buf); - static char * CallerMemPos (const char * buf); - static char * EndMarkerPos (const char * buf, const size_t size); - - // Given a pointer to the start of the caller requested area - // return a pointer to the start of the entire alloc\'d buffer. - static char * StartPos (const char * caller); - - // Access to the list. - static wxMemStruct * GetHead () { return m_head; } - static wxMemStruct * GetTail () { return m_tail; } - - // Set the list sentinals. - static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); } - static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); } - - // If this is set then every new operation checks the validity - // of the all previous nodes in the list. - static bool GetCheckPrevious () { return m_checkPrevious; } - static void SetCheckPrevious (bool value) { m_checkPrevious = value; } - - // Checks all nodes, or all nodes if checkAll is true - static int Check(bool checkAll = false); - - // Print out the list of wxMemStruct nodes. - static bool PrintList(void); - - // Dump objects - static bool Dump(void); - - // Print statistics - static bool PrintStatistics(bool detailed = true); - - // Print out the classes in the application. - static bool PrintClasses(void); - - // Count the number of non-wxDebugContext-related objects - // that are outstanding - static int CountObjectsLeft(bool sinceCheckpoint = false); - - // This function is used to output the dump - static void OutputDumpLine(const wxChar *szFormat, ...); - -private: - // Store these here to allow access to the list without - // needing to have a wxMemStruct object. - static wxMemStruct* m_head; - static wxMemStruct* m_tail; - - // Set to false if we're not checking all previous nodes when - // we do a new. Set to true when we are. - static bool m_checkPrevious; -}; - -// Final cleanup (e.g. deleting the log object and doing memory leak checking) -// will be delayed until all wxDebugContextDumpDelayCounter objects have been -// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay -// memory leak checking until after destructing all global objects. -class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter -{ -public: - wxDebugContextDumpDelayCounter() { - sm_count++; - } - - ~wxDebugContextDumpDelayCounter() { - sm_count--; - if(!sm_count) DoDump(); - } -private: - void DoDump(); - static int sm_count; -}; - -// make leak dump after all globals have been destructed -static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; -#define WXDEBUG_DUMPDELAYCOUNTER \ - static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; - -// Output a debug message, in a system dependent fashion. -void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1; -void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2; - -#define WXTRACE wxTrace -#define WXTRACELEVEL wxTraceLevel - -#else // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#define WXDEBUG_DUMPDELAYCOUNTER - -// Borland C++ Builder 6 seems to have troubles with inline functions (see bug -// 819700) -#if 0 - inline void wxTrace(const wxChar *WXUNUSED(fmt)) {} - inline void wxTraceLevel(int WXUNUSED(level), const wxChar *WXUNUSED(fmt)) {} -#else - #define wxTrace(fmt) - #define wxTraceLevel(l, fmt) -#endif - -#define WXTRACE true ? (void)0 : wxTrace -#define WXTRACELEVEL true ? (void)0 : wxTraceLevel - -#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#endif - // _WX_MEMORYH__ diff --git a/Source/3rdParty/wx/include/wx/memtext.h b/Source/3rdParty/wx/include/wx/memtext.h deleted file mode 100644 index 16706092a..000000000 --- a/Source/3rdParty/wx/include/wx/memtext.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/memtext.h -// Purpose: wxMemoryText allows to use wxTextBuffer without a file -// Created: 14.11.01 -// Author: Morten Hanssen -// Copyright: (c) 2001 Morten Hanssen -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MEMTEXT_H -#define _WX_MEMTEXT_H - -#include "wx/defs.h" - -// there is no separate setting for wxMemoryText, it's smallish anyhow -#if wxUSE_TEXTBUFFER - -// ---------------------------------------------------------------------------- -// wxMemoryText -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMemoryText : public wxTextBuffer -{ -public: - // Constructors. - wxMemoryText() { } - wxMemoryText(const wxString& name) : wxTextBuffer(name) { } - -protected: - virtual bool OnExists() const - { return false; } - - virtual bool OnOpen(const wxString & WXUNUSED(strBufferName), - wxTextBufferOpenMode WXUNUSED(OpenMode)) - { return true; } - - virtual bool OnClose() - { return true; } - - virtual bool OnRead(const wxMBConv& WXUNUSED(conv)) - { return true; } - - virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew), - const wxMBConv& WXUNUSED(conv) = wxConvUTF8) - { return true; } - -private: - DECLARE_NO_COPY_CLASS(wxMemoryText) -}; - -#endif // wxUSE_TEXTBUFFER - -#endif // _WX_MEMTEXT_H - diff --git a/Source/3rdParty/wx/include/wx/menu.h b/Source/3rdParty/wx/include/wx/menu.h deleted file mode 100644 index dad76c795..000000000 --- a/Source/3rdParty/wx/include/wx/menu.h +++ /dev/null @@ -1,555 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/menu.h -// Purpose: wxMenu and wxMenuBar classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.10.99 -// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENU_H_BASE_ -#define _WX_MENU_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MENUS - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/list.h" // for "template" list classes -#include "wx/window.h" // base class for wxMenuBar - -// also include this one to ensure compatibility with old code which only -// included wx/menu.h -#include "wx/menuitem.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; -class WXDLLIMPEXP_FWD_CORE wxMenuBarBase; -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; - -// pseudo template list classes -WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); -WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); - -// ---------------------------------------------------------------------------- -// wxMenu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuBase : public wxEvtHandler -{ -public: - // create a menu - static wxMenu *New(const wxString& title = wxEmptyString, long style = 0); - - // ctors - wxMenuBase(const wxString& title, long style = 0) : m_title(title) - { Init(style); } - wxMenuBase(long style = 0) - { Init(style); } - - // dtor deletes all the menu items we own - virtual ~wxMenuBase(); - - // menu construction - // ----------------- - - // append any kind of item (normal/check/radio/separator) - wxMenuItem* Append(int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); - } - - // append a separator to the menu - wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR, wxEmptyString); } - - // append a check item - wxMenuItem* AppendCheckItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Append(itemid, text, help, wxITEM_CHECK); - } - - // append a radio item - wxMenuItem* AppendRadioItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Append(itemid, text, help, wxITEM_RADIO); - } - - // append a submenu - wxMenuItem* AppendSubMenu(wxMenu *submenu, - const wxString& text, - const wxString& help = wxEmptyString) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help, - wxITEM_NORMAL, submenu)); - } - - // the most generic form of Append() - append anything - wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); } - - // insert a break in the menu (only works when appending the items, not - // inserting them) - virtual void Break() { } - - // insert an item before given position - wxMenuItem* Insert(size_t pos, wxMenuItem *item); - - // insert an item before given position - wxMenuItem* Insert(size_t pos, - int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); - } - - // insert a separator - wxMenuItem* InsertSeparator(size_t pos) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR)); - } - - // insert a check item - wxMenuItem* InsertCheckItem(size_t pos, - int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Insert(pos, itemid, text, help, wxITEM_CHECK); - } - - // insert a radio item - wxMenuItem* InsertRadioItem(size_t pos, - int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Insert(pos, itemid, text, help, wxITEM_RADIO); - } - - // insert a submenu - wxMenuItem* Insert(size_t pos, - int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, - wxITEM_NORMAL, submenu)); - } - - // prepend an item to the menu - wxMenuItem* Prepend(wxMenuItem *item) - { - return Insert(0u, item); - } - - // prepend any item to the menu - wxMenuItem* Prepend(int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return Insert(0u, itemid, text, help, kind); - } - - // prepend a separator - wxMenuItem* PrependSeparator() - { - return InsertSeparator(0u); - } - - // prepend a check item - wxMenuItem* PrependCheckItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return InsertCheckItem(0u, itemid, text, help); - } - - // prepend a radio item - wxMenuItem* PrependRadioItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return InsertRadioItem(0u, itemid, text, help); - } - - // prepend a submenu - wxMenuItem* Prepend(int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return Insert(0u, itemid, text, submenu, help); - } - - // detach an item from the menu, but don't delete it so that it can be - // added back later (but if it's not, the caller is responsible for - // deleting it!) - wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); } - wxMenuItem *Remove(wxMenuItem *item); - - // delete an item from the menu (submenus are not destroyed by this - // function, see Destroy) - bool Delete(int itemid) { return Delete(FindChildItem(itemid)); } - bool Delete(wxMenuItem *item); - - // delete the item from menu and destroy it (if it's a submenu) - bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); } - bool Destroy(wxMenuItem *item); - - // menu items access - // ----------------- - - // get the items - size_t GetMenuItemCount() const { return m_items.GetCount(); } - - const wxMenuItemList& GetMenuItems() const { return m_items; } - wxMenuItemList& GetMenuItems() { return m_items; } - - // search - virtual int FindItem(const wxString& item) const; - wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; - - // find by position - wxMenuItem* FindItemByPosition(size_t position) const; - - // get/set items attributes - void Enable(int itemid, bool enable); - bool IsEnabled(int itemid) const; - - void Check(int itemid, bool check); - bool IsChecked(int itemid) const; - - void SetLabel(int itemid, const wxString& label); - wxString GetLabel(int itemid) const; - - virtual void SetHelpString(int itemid, const wxString& helpString); - virtual wxString GetHelpString(int itemid) const; - - // misc accessors - // -------------- - - // the title - virtual void SetTitle(const wxString& title) { m_title = title; } - const wxString GetTitle() const { return m_title; } - - // event handler - void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } - wxEvtHandler *GetEventHandler() const { return m_eventHandler; } - - // invoking window - void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; } - wxWindow *GetInvokingWindow() const { return m_invokingWindow; } - - // style - long GetStyle() const { return m_style; } - - // implementation helpers - // ---------------------- - - // Updates the UI for a menu and all submenus recursively. source is the - // object that has the update event handlers defined for it. If NULL, the - // menu or associated window will be used. - void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL); - - // get the menu bar this menu is attached to (may be NULL, always NULL for - // popup menus). Traverse up the menu hierarchy to find it. - wxMenuBar *GetMenuBar() const; - - // called when the menu is attached/detached to/from a menu bar - virtual void Attach(wxMenuBarBase *menubar); - virtual void Detach(); - - // is the menu attached to a menu bar (or is it a popup one)? - bool IsAttached() const { return GetMenuBar() != NULL; } - - // set/get the parent of this menu - void SetParent(wxMenu *parent) { m_menuParent = parent; } - wxMenu *GetParent() const { return m_menuParent; } - - // implementation only from now on - // ------------------------------- - - // unlike FindItem(), this function doesn't recurse but only looks through - // our direct children and also may return the index of the found child if - // pos != NULL - wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const; - - // called to generate a wxCommandEvent, return true if it was processed, - // false otherwise - // - // the checked parameter may have boolean value or -1 for uncheckable items - bool SendEvent(int itemid, int checked = -1); - - // compatibility: these functions are deprecated, use the new ones instead - // ----------------------------------------------------------------------- - - // use the versions taking wxItem_XXX now instead, they're more readable - // and allow adding the radio items as well - void Append(int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); - } - - // use more readable and not requiring unused itemid AppendSubMenu() instead - wxMenuItem* Append(int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, - wxITEM_NORMAL, submenu)); - } - - void Insert(size_t pos, - int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); - } - - void Prepend(int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Insert(0u, itemid, text, help, isCheckable); - } - - static void LockAccels(bool locked) - { - ms_locked = locked; - } - -protected: - // virtuals to override in derived classes - // --------------------------------------- - - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - - virtual wxMenuItem *DoRemove(wxMenuItem *item); - virtual bool DoDelete(wxMenuItem *item); - virtual bool DoDestroy(wxMenuItem *item); - - // helpers - // ------- - - // common part of all ctors - void Init(long style); - - // associate the submenu with this menu - void AddSubMenu(wxMenu *submenu); - - wxMenuBar *m_menuBar; // menubar we belong to or NULL - wxMenu *m_menuParent; // parent menu or NULL - - wxString m_title; // the menu title or label - wxMenuItemList m_items; // the list of menu items - - wxWindow *m_invokingWindow; // for popup menus - - long m_style; // combination of wxMENU_XXX flags - - wxEvtHandler *m_eventHandler; // a pluggable in event handler - - static bool ms_locked; - - DECLARE_NO_COPY_CLASS(wxMenuBase) - -public: - -#if wxABI_VERSION >= 20805 - // Returns the stripped label - wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelFromText(GetLabel(itemid)); } -#endif - -}; - -// ---------------------------------------------------------------------------- -// wxMenuBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuBarBase : public wxWindow -{ -public: - // default ctor - wxMenuBarBase(); - - // dtor will delete all menus we own - virtual ~wxMenuBarBase(); - - // menu bar construction - // --------------------- - - // append a menu to the end of menubar, return true if ok - virtual bool Append(wxMenu *menu, const wxString& title); - - // insert a menu before the given position into the menubar, return true - // if inserted ok - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - - // menu bar items access - // --------------------- - - // get the number of menus in the menu bar - size_t GetMenuCount() const { return m_menus.GetCount(); } - - // get the menu at given position - wxMenu *GetMenu(size_t pos) const; - - // replace the menu at given position with another one, returns the - // previous menu (which should be deleted by the caller) - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - - // delete the menu at given position from the menu bar, return the pointer - // to the menu (which should be deleted by the caller) - virtual wxMenu *Remove(size_t pos); - - // enable or disable a submenu - virtual void EnableTop(size_t pos, bool enable) = 0; - - // is the menu enabled? - virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } - - // get or change the label of the menu at given position - virtual void SetLabelTop(size_t pos, const wxString& label) = 0; - virtual wxString GetLabelTop(size_t pos) const = 0; - - // item search - // ----------- - - // by menu and item names, returns wxNOT_FOUND if not found or id of the - // found item - virtual int FindMenuItem(const wxString& menu, const wxString& item) const; - - // find item by id (in any menu), returns NULL if not found - // - // if menu is !NULL, it will be filled with wxMenu this item belongs to - virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; - - // find menu by its caption, return wxNOT_FOUND on failure - int FindMenu(const wxString& title) const; - - // item access - // ----------- - - // all these functions just use FindItem() and then call an appropriate - // method on it - // - // NB: under MSW, these methods can only be used after the menubar had - // been attached to the frame - - void Enable(int itemid, bool enable); - void Check(int itemid, bool check); - bool IsChecked(int itemid) const; - bool IsEnabled(int itemid) const; - virtual bool IsEnabled() const { return wxWindow::IsEnabled(); } - - void SetLabel(int itemid, const wxString &label); - wxString GetLabel(int itemid) const; - - void SetHelpString(int itemid, const wxString& helpString); - wxString GetHelpString(int itemid) const; - - // implementation helpers - - // get the frame we are attached to (may return NULL) - wxFrame *GetFrame() const { return m_menuBarFrame; } - - // returns true if we're attached to a frame - bool IsAttached() const { return GetFrame() != NULL; } - - // associate the menubar with the frame - virtual void Attach(wxFrame *frame); - - // called before deleting the menubar normally - virtual void Detach(); - - // need to override these ones to avoid virtual function hiding - virtual bool Enable(bool enable = true) { return wxWindow::Enable(enable); } - virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); } - virtual wxString GetLabel() const { return wxWindow::GetLabel(); } - - // don't want menu bars to accept the focus by tabbing to them - virtual bool AcceptsFocusFromKeyboard() const { return false; } - - // update all menu item states in all menus - virtual void UpdateMenus(); - -protected: - // the list of all our menus - wxMenuList m_menus; - - // the frame we are attached to (may be NULL) - wxFrame *m_menuBarFrame; - - DECLARE_NO_COPY_CLASS(wxMenuBarBase) - -public: - -#if wxABI_VERSION >= 20805 - // Replacement for SetLabelTop - void SetMenuLabel(size_t pos, const wxString& label) { SetLabelTop(pos, label); } - - // Gets the original label at the top-level of the menubar - // Implemented per port, since we can't have virtual functions in the stable branch. - // wxString GetMenuLabel(size_t pos) const; - - // Get the text only, from the label at the top-level of the menubar - wxString GetMenuLabelText(size_t pos) const; -#endif - -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#ifdef wxUSE_BASE_CLASSES_ONLY - #define wxMenuItem wxMenuItemBase -#else // !wxUSE_BASE_CLASSES_ONLY -#if defined(__WXUNIVERSAL__) - #include "wx/univ/menu.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menu.h" -#elif defined(__WXMSW__) - #include "wx/msw/menu.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/menu.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/menu.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/menu.h" -#elif defined(__WXMAC__) - #include "wx/mac/menu.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menu.h" -#elif defined(__WXPM__) - #include "wx/os2/menu.h" -#endif -#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY - -#endif // wxUSE_MENUS - -#endif - // _WX_MENU_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/menuitem.h b/Source/3rdParty/wx/include/wx/menuitem.h deleted file mode 100644 index 2a55e582b..000000000 --- a/Source/3rdParty/wx/include/wx/menuitem.h +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/menuitem.h -// Purpose: wxMenuItem class -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.10.99 -// RCS-ID: $Id: menuitem.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENUITEM_H_BASE_ -#define _WX_MENUITEM_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MENUS - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" // base class - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; -class WXDLLIMPEXP_FWD_CORE wxMenu; - -// ---------------------------------------------------------------------------- -// wxMenuItem is an item in the menu which may be either a normal item, a sub -// menu or a separator -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuItemBase : public wxObject -{ -public: - // creation - static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL, - int itemid = wxID_SEPARATOR, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - - // destruction: wxMenuItem will delete its submenu - virtual ~wxMenuItemBase(); - - // the menu we're in - wxMenu *GetMenu() const { return m_parentMenu; } - void SetMenu(wxMenu* menu) { m_parentMenu = menu; } - - // get/set id - void SetId(int itemid) { m_id = itemid; } - int GetId() const { return m_id; } - bool IsSeparator() const { return m_id == wxID_SEPARATOR; } - - // the item's text (or name) - // - // NB: the item's text includes the accelerators and mnemonics info (if - // any), i.e. it may contain '&' or '_' or "\t..." and thus is - // different from the item's label which only contains the text shown - // in the menu - virtual void SetText(const wxString& str); - - wxString GetLabel() const { return GetLabelFromText(m_text); } - const wxString& GetText() const { return m_text; } - - // get the label from text (implemented in platform-specific code) - static wxString GetLabelFromText(const wxString& text); - - // what kind of menu item we are - wxItemKind GetKind() const { return m_kind; } - void SetKind(wxItemKind kind) { m_kind = kind; } - - virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } - bool IsCheckable() const - { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } - - bool IsSubMenu() const { return m_subMenu != NULL; } - void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } - wxMenu *GetSubMenu() const { return m_subMenu; } - - // state - virtual void Enable(bool enable = true) { m_isEnabled = enable; } - virtual bool IsEnabled() const { return m_isEnabled; } - - virtual void Check(bool check = true) { m_isChecked = check; } - virtual bool IsChecked() const { return m_isChecked; } - void Toggle() { Check(!m_isChecked); } - - // help string (displayed in the status bar by default) - void SetHelp(const wxString& str); - const wxString& GetHelp() const { return m_help; } - -#if wxUSE_ACCEL - // extract the accelerator from the given menu string, return NULL if none - // found - static wxAcceleratorEntry *GetAccelFromString(const wxString& label); - - // get our accelerator or NULL (caller must delete the pointer) - virtual wxAcceleratorEntry *GetAccel() const; - - // set the accel for this item - this may also be done indirectly with - // SetText() - virtual void SetAccel(wxAcceleratorEntry *accel); -#endif // wxUSE_ACCEL - - // compatibility only, use new functions in the new code - void SetName(const wxString& str) { SetText(str); } - const wxString& GetName() const { return GetText(); } - - static wxMenuItem *New(wxMenu *parentMenu, - int itemid, - const wxString& text, - const wxString& help, - bool isCheckable, - wxMenu *subMenu = (wxMenu *)NULL) - { - return New(parentMenu, itemid, text, help, - isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); - } - -protected: - int m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR - wxMenu *m_parentMenu, // the menu we belong to - *m_subMenu; // our sub menu or NULL - wxString m_text, // label of the item - m_help; // the help string for the item - wxItemKind m_kind; // separator/normal/check/radio item? - bool m_isChecked; // is checked? - bool m_isEnabled; // is enabled? - - // this ctor is for the derived classes only, we're never created directly - wxMenuItemBase(wxMenu *parentMenu = (wxMenu *)NULL, - int itemid = wxID_SEPARATOR, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - -private: - // and, if we have one ctor, compiler won't generate a default copy one, so - // declare them ourselves - but don't implement as they shouldn't be used - wxMenuItemBase(const wxMenuItemBase& item); - wxMenuItemBase& operator=(const wxMenuItemBase& item); - -public: - -#if wxABI_VERSION >= 20805 - // Sets the label. This function replaces SetText. - void SetItemLabel(const wxString& str) { SetText(str); } - - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - // We can't implement this in the base class (no new virtuals in stable branch) - // wxString GetItemLabel() const; - - // return just the text of the item label, without any mnemonics - // This used to be called GetLabel. - wxString GetItemLabelText() const { return GetLabelText(m_text); } - - // return just the text part of the given label. In 2.9 and up, this is implemented in - // platform-specific code, but is now implemented in terms of GetLabelFromText. - static wxString GetLabelText(const wxString& label); -#endif -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#ifdef wxUSE_BASE_CLASSES_ONLY - #define wxMenuItem wxMenuItemBase -#else // !wxUSE_BASE_CLASSES_ONLY -#if defined(__WXUNIVERSAL__) - #include "wx/univ/menuitem.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menuitem.h" -#elif defined(__WXMSW__) - #include "wx/msw/menuitem.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/menuitem.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/menuitem.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/menuitem.h" -#elif defined(__WXMAC__) - #include "wx/mac/menuitem.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menuitem.h" -#elif defined(__WXPM__) - #include "wx/os2/menuitem.h" -#endif -#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY - -#endif // wxUSE_MENUS - -#endif - // _WX_MENUITEM_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/metafile.h b/Source/3rdParty/wx/include/wx/metafile.h deleted file mode 100644 index 7d92ab0f3..000000000 --- a/Source/3rdParty/wx/include/wx/metafile.h +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/metafile.h -// Purpose: wxMetaFile class declaration -// Author: wxWidgets team -// Modified by: -// Created: 13.01.00 -// RCS-ID: $Id: metafile.h 39841 2006-06-26 14:37:34Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_METAFILE_H_BASE_ -#define _WX_METAFILE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_METAFILE - -// provide synonyms for all metafile classes -#define wxMetaFile wxMetafile -#define wxMetaFileDC wxMetafileDC -#define wxMetaFileDataObject wxMetafileDataObject - -#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable - -#if defined(__WXMSW__) - #if wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/enhmeta.h" - #else - #include "wx/msw/enhmeta.h" - #endif - - #if wxUSE_WIN_METAFILES_ALWAYS - // use normal metafiles as well - #include "wx/msw/metafile.h" - #else // also map all metafile classes to enh metafile - typedef wxEnhMetaFile wxMetafile; - typedef wxEnhMetaFileDC wxMetafileDC; - #if wxUSE_DRAG_AND_DROP - typedef wxEnhMetaFileDataObject wxMetafileDataObject; - #endif - - // this flag will be set if wxMetafile class is wxEnhMetaFile - #define wxMETAFILE_IS_ENH - #endif // wxUSE_WIN_METAFILES_ALWAYS - #else // !wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/metafile.h" - #else - #include "wx/msw/metafile.h" - #endif - #endif -#elif defined(__WXPM__) - #include "wx/os2/metafile.h" -#elif defined(__WXMAC__) - #include "wx/mac/metafile.h" -#endif - -#endif // wxUSE_METAFILE - -#endif // _WX_METAFILE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/mimetype.h b/Source/3rdParty/wx/include/wx/mimetype.h deleted file mode 100644 index 8baf854c1..000000000 --- a/Source/3rdParty/wx/include/wx/mimetype.h +++ /dev/null @@ -1,453 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MIMETYPE_H_ -#define _WX_MIMETYPE_H_ - -// ---------------------------------------------------------------------------- -// headers and such -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_MIMETYPE - -// the things we really need -#include "wx/string.h" -#include "wx/dynarray.h" -#include "wx/arrstr.h" - -// fwd decls -class WXDLLIMPEXP_FWD_BASE wxIconLocation; -class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; -class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; - -// these constants define the MIME informations source under UNIX and are used -// by wxMimeTypesManager::Initialize() -enum wxMailcapStyle -{ - wxMAILCAP_STANDARD = 1, - wxMAILCAP_NETSCAPE = 2, - wxMAILCAP_KDE = 4, - wxMAILCAP_GNOME = 8, - - wxMAILCAP_ALL = 15 -}; - -/* - TODO: would it be more convenient to have this class? - -class WXDLLIMPEXP_BASE wxMimeType : public wxString -{ -public: - // all string ctors here - - wxString GetType() const { return BeforeFirst(wxT('/')); } - wxString GetSubType() const { return AfterFirst(wxT('/')); } - - void SetSubType(const wxString& subtype) - { - *this = GetType() + wxT('/') + subtype; - } - - bool Matches(const wxMimeType& wildcard) - { - // implement using wxMimeTypesManager::IsOfType() - } -}; - -*/ - -// wxMimeTypeCommands stores the verbs defined for the given MIME type with -// their values -class WXDLLIMPEXP_BASE wxMimeTypeCommands -{ -public: - wxMimeTypeCommands() {} - - wxMimeTypeCommands(const wxArrayString& verbs, - const wxArrayString& commands) - : m_verbs(verbs), - m_commands(commands) - { - } - - // add a new verb with the command or replace the old value - void AddOrReplaceVerb(const wxString& verb, const wxString& cmd); - void Add(const wxString& s) - { - m_verbs.Add(s.BeforeFirst(wxT('='))); - m_commands.Add(s.AfterFirst(wxT('='))); - } - - // access the commands - size_t GetCount() const { return m_verbs.GetCount(); } - const wxString& GetVerb(size_t n) const { return m_verbs[n]; } - const wxString& GetCmd(size_t n) const { return m_commands[n]; } - - bool HasVerb(const wxString& verb) const - { return m_verbs.Index(verb) != wxNOT_FOUND; } - - // returns empty string and wxNOT_FOUND in idx if no such verb - wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const; - - // get a "verb=command" string - wxString GetVerbCmd(size_t n) const; - -private: - wxArrayString m_verbs; - wxArrayString m_commands; -}; - -// ---------------------------------------------------------------------------- -// wxFileTypeInfo: static container of information accessed via wxFileType. -// -// This class is used with wxMimeTypesManager::AddFallbacks() and Associate() -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileTypeInfo -{ -public: - // ctors - // a normal item - wxFileTypeInfo(const wxChar *mimeType, - const wxChar *openCmd, - const wxChar *printCmd, - const wxChar *desc, - // the other parameters form a NULL terminated list of - // extensions - ...); - - // the array elements correspond to the parameters of the ctor above in - // the same order - wxFileTypeInfo(const wxArrayString& sArray); - - // invalid item - use this to terminate the array passed to - // wxMimeTypesManager::AddFallbacks - wxFileTypeInfo() { } - - // test if this object can be used - bool IsValid() const { return !m_mimeType.empty(); } - - // setters - // set the icon info - void SetIcon(const wxString& iconFile, int iconIndex = 0) - { - m_iconFile = iconFile; - m_iconIndex = iconIndex; - } - // set the short desc - void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; } - - // accessors - // get the MIME type - const wxString& GetMimeType() const { return m_mimeType; } - // get the open command - const wxString& GetOpenCommand() const { return m_openCmd; } - // get the print command - const wxString& GetPrintCommand() const { return m_printCmd; } - // get the short description (only used under Win32 so far) - const wxString& GetShortDesc() const { return m_shortDesc; } - // get the long, user visible description - const wxString& GetDescription() const { return m_desc; } - // get the array of all extensions - const wxArrayString& GetExtensions() const { return m_exts; } - size_t GetExtensionsCount() const {return m_exts.GetCount(); } - // get the icon info - const wxString& GetIconFile() const { return m_iconFile; } - int GetIconIndex() const { return m_iconIndex; } - -private: - wxString m_mimeType, // the MIME type in "type/subtype" form - m_openCmd, // command to use for opening the file (%s allowed) - m_printCmd, // command to use for printing the file (%s allowed) - m_shortDesc, // a short string used in the registry - m_desc; // a free form description of this file type - - // icon stuff - wxString m_iconFile; // the file containing the icon - int m_iconIndex; // icon index in this file - - wxArrayString m_exts; // the extensions which are mapped on this filetype - - -#if 0 // TODO - // the additional (except "open" and "print") command names and values - wxArrayString m_commandNames, - m_commandValues; -#endif // 0 -}; - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo, - WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxFileType: gives access to all information about the files of given type. -// -// This class holds information about a given "file type". File type is the -// same as MIME type under Unix, but under Windows it corresponds more to an -// extension than to MIME type (in fact, several extensions may correspond to a -// file type). This object may be created in many different ways and depending -// on how it was created some fields may be unknown so the return value of all -// the accessors *must* be checked! -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileType -{ -friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl - -public: - // An object of this class must be passed to Get{Open|Print}Command. The - // default implementation is trivial and doesn't know anything at all about - // parameters, only filename and MIME type are used (so it's probably ok for - // Windows where %{param} is not used anyhow) - class MessageParameters - { - public: - // ctors - MessageParameters() { } - MessageParameters(const wxString& filename, - const wxString& mimetype = wxEmptyString) - : m_filename(filename), m_mimetype(mimetype) { } - - // accessors (called by GetOpenCommand) - // filename - const wxString& GetFileName() const { return m_filename; } - // mime type - const wxString& GetMimeType() const { return m_mimetype; } - - // override this function in derived class - virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const - { return wxEmptyString; } - - // virtual dtor as in any base class - virtual ~MessageParameters() { } - - protected: - wxString m_filename, m_mimetype; - }; - - // ctor from static data - wxFileType(const wxFileTypeInfo& ftInfo); - - // accessors: all of them return true if the corresponding information - // could be retrieved/found, false otherwise (and in this case all [out] - // parameters are unchanged) - // return the MIME type for this file type - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - // fill passed in array with all extensions associated with this file - // type - bool GetExtensions(wxArrayString& extensions); - // get the icon corresponding to this file type and of the given size - bool GetIcon(wxIconLocation *iconloc) const; - bool GetIcon(wxIconLocation *iconloc, - const MessageParameters& params) const; - // get a brief file type description ("*.txt" => "text document") - bool GetDescription(wxString *desc) const; - - // get the command to be used to open/print the given file. - // get the command to execute the file of given type - bool GetOpenCommand(wxString *openCmd, - const MessageParameters& params) const; - // a simpler to use version of GetOpenCommand() -- it only takes the - // filename and returns an empty string on failure - wxString GetOpenCommand(const wxString& filename) const; - // get the command to print the file of given type - bool GetPrintCommand(wxString *printCmd, - const MessageParameters& params) const; - - - // return the number of commands defined for this file type, 0 if none - size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, - const wxFileType::MessageParameters& params) const; - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is true - bool SetCommand(const wxString& cmd, const wxString& verb, - bool overwriteprompt = true); - - bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); - - - // remove the association for this filetype from the system MIME database: - // notice that it will only work if the association is defined in the user - // file/registry part, we will never modify the system-wide settings - bool Unassociate(); - - // operations - // expand a string in the format of GetOpenCommand (which may contain - // '%s' and '%t' format specificators for the file name and mime type - // and %{param} constructions). - static wxString ExpandCommand(const wxString& command, - const MessageParameters& params); - - // dtor (not virtual, shouldn't be derived from) - ~wxFileType(); - -private: - // default ctor is private because the user code never creates us - wxFileType(); - - // no copy ctor/assignment operator - wxFileType(const wxFileType&); - wxFileType& operator=(const wxFileType&); - - // the static container of wxFileType data: if it's not NULL, it means that - // this object is used as fallback only - const wxFileTypeInfo *m_info; - - // the object which implements the real stuff like reading and writing - // to/from system MIME database - wxFileTypeImpl *m_impl; -}; - -//---------------------------------------------------------------------------- -// wxMimeTypesManagerFactory -//---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory -{ -public: - wxMimeTypesManagerFactory() {} - virtual ~wxMimeTypesManagerFactory() {} - - virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl(); - - static void Set( wxMimeTypesManagerFactory *factory ); - static wxMimeTypesManagerFactory *Get(); - -private: - static wxMimeTypesManagerFactory *m_factory; -}; - -// ---------------------------------------------------------------------------- -// wxMimeTypesManager: interface to system MIME database. -// -// This class accesses the information about all known MIME types and allows -// the application to retrieve information (including how to handle data of -// given type) about them. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMimeTypesManager -{ -public: - // static helper functions - // ----------------------- - - // check if the given MIME type is the same as the other one: the - // second argument may contain wildcards ('*'), but not the first. If - // the types are equal or if the mimeType matches wildcard the function - // returns true, otherwise it returns false - static bool IsOfType(const wxString& mimeType, const wxString& wildcard); - - // ctor - wxMimeTypesManager(); - - // NB: the following 2 functions are for Unix only and don't do anything - // elsewhere - - // loads data from standard files according to the mailcap styles - // specified: this is a bitwise OR of wxMailcapStyle values - // - // use the extraDir parameter if you want to look for files in another - // directory - void Initialize(int mailcapStyle = wxMAILCAP_ALL, - const wxString& extraDir = wxEmptyString); - - // and this function clears all the data from the manager - void ClearData(); - - // Database lookup: all functions return a pointer to wxFileType object - // whose methods may be used to query it for the information you're - // interested in. If the return value is !NULL, caller is responsible for - // deleting it. - // get file type from file extension - wxFileType *GetFileTypeFromExtension(const wxString& ext); - // get file type from MIME type (in format /) - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - // other operations: return true if there were no errors or false if there - // were some unrecognized entries (the good entries are always read anyhow) - // - // FIXME: These ought to be private ?? - - // read in additional file (the standard ones are read automatically) - // in mailcap format (see mimetype.cpp for description) - // - // 'fallback' parameter may be set to true to avoid overriding the - // settings from other, previously parsed, files by this one: normally, - // the files read most recently would override the older files, but with - // fallback == true this won't happen - - bool ReadMailcap(const wxString& filename, bool fallback = false); - // read in additional file in mime.types format - bool ReadMimeTypes(const wxString& filename); - - // enumerate all known MIME types - // - // returns the number of retrieved file types - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - // these functions can be used to provide default values for some of the - // MIME types inside the program itself (you may also use - // ReadMailcap(filenameWithDefaultTypes, true /* use as fallback */) to - // achieve the same goal, but this requires having this info in a file). - // - // The filetypes array should be terminated by either NULL entry or an - // invalid wxFileTypeInfo (i.e. the one created with default ctor) - void AddFallbacks(const wxFileTypeInfo *filetypes); - void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } - - // create or remove associations - - // create a new association using the fields of wxFileTypeInfo (at least - // the MIME type and the extension should be set) - // if the other fields are empty, the existing values should be left alone - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - - // undo Associate() - bool Unassociate(wxFileType *ft) ; - - // dtor (not virtual, shouldn't be derived from) - ~wxMimeTypesManager(); - -private: - // no copy ctor/assignment operator - wxMimeTypesManager(const wxMimeTypesManager&); - wxMimeTypesManager& operator=(const wxMimeTypesManager&); - - // the fallback info which is used if the information is not found in the - // real system database - wxArrayFileTypeInfo m_fallbacks; - - // the object working with the system MIME database - wxMimeTypesManagerImpl *m_impl; - - // if m_impl is NULL, create one - void EnsureImpl(); - - friend class wxMimeTypeCmnModule; -}; - - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default mime manager for wxWidgets programs -extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager; - -#endif // wxUSE_MIMETYPE - -#endif - //_WX_MIMETYPE_H_ diff --git a/Source/3rdParty/wx/include/wx/minifram.h b/Source/3rdParty/wx/include/wx/minifram.h deleted file mode 100644 index 50df6006a..000000000 --- a/Source/3rdParty/wx/include/wx/minifram.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/minifram.h -// Purpose: wxMiniFrame base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: minifram.h 49299 2007-10-21 18:07:29Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MINIFRAM_H_BASE_ -#define _WX_MINIFRAM_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MINIFRAME - -#if defined(__WXPALMOS__) -#include "wx/palmos/minifram.h" -#elif defined(__WXMSW__) -#include "wx/msw/minifram.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/minifram.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/minifram.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/minifram.h" -#elif defined(__WXX11__) -#include "wx/x11/minifram.h" -#elif defined(__WXMAC__) -#include "wx/mac/minifram.h" -#elif defined(__WXPM__) -#include "wx/os2/minifram.h" -#else -// TODO: it seems that wxMiniFrame could be just defined here generically -// instead of having all the above port-specific headers -#include "wx/frame.h" -typedef wxFrame wxMiniFrame; -#endif - -#endif // wxUSE_MINIFRAME -#endif // _WX_MINIFRAM_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/module.h b/Source/3rdParty/wx/include/wx/module.h deleted file mode 100644 index 7cee6f226..000000000 --- a/Source/3rdParty/wx/include/wx/module.h +++ /dev/null @@ -1,103 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/module.h -// Purpose: Modules handling -// Author: Wolfram Gloger/adapted by Guilhem Lavaux -// Modified by: -// Created: 04/11/98 -// RCS-ID: $Id: module.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Wolfram Gloger and Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MODULE_H_ -#define _WX_MODULE_H_ - -#include "wx/object.h" -#include "wx/list.h" -#include "wx/dynarray.h" - -// declare a linked list of modules -class WXDLLIMPEXP_FWD_BASE wxModule; -WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE); - -// and an array of class info objects -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo, - class WXDLLIMPEXP_BASE); - - -// declaring a class derived from wxModule will automatically create an -// instance of this class on program startup, call its OnInit() method and call -// OnExit() on program termination (but only if OnInit() succeeded) -class WXDLLIMPEXP_BASE wxModule : public wxObject -{ -public: - wxModule() {} - virtual ~wxModule() {} - - // if module init routine returns false the application - // will fail to startup - - bool Init() { return OnInit(); } - void Exit() { OnExit(); } - - // Override both of these - - // called on program startup - - virtual bool OnInit() = 0; - - // called just before program termination, but only if OnInit() - // succeeded - - virtual void OnExit() = 0; - - static void RegisterModule(wxModule *module); - static void RegisterModules(); - static bool InitializeModules(); - static void CleanUpModules() { DoCleanUpModules(m_modules); } - - // used by wxObjectLoader when unloading shared libs's - - static void UnregisterModule(wxModule *module); - -protected: - static wxModuleList m_modules; - - // the function to call from constructor of a deriving class add module - // dependency which will be initialized before the module and unloaded - // after that - void AddDependency(wxClassInfo *dep) - { - wxCHECK_RET( dep, wxT("NULL module dependency") ); - - m_dependencies.Add(dep); - } - -private: - // initialize module and Append it to initializedModules list recursively - // calling itself to satisfy module dependencies if needed - static bool - DoInitializeModule(wxModule *module, wxModuleList &initializedModules); - - // cleanup the modules in the specified list (which may not contain all - // modules if we're called during initialization because not all modules - // could be initialized) and also empty m_modules itself - static void DoCleanUpModules(const wxModuleList& modules); - - - // module dependencies: contains - wxArrayClassInfo m_dependencies; - - // used internally while initiliazing/cleaning up modules - enum - { - State_Registered, // module registered but not initialized yet - State_Initializing, // we're initializing this module but not done yet - State_Initialized // module initialized successfully - } m_state; - - - DECLARE_CLASS(wxModule) -}; - -#endif // _WX_MODULE_H_ diff --git a/Source/3rdParty/wx/include/wx/msgdlg.h b/Source/3rdParty/wx/include/wx/msgdlg.h deleted file mode 100644 index dabea34f9..000000000 --- a/Source/3rdParty/wx/include/wx/msgdlg.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msgdlgg.h -// Purpose: common header and base class for wxMessageDialog -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: msgdlg.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGDLG_H_BASE_ -#define _WX_MSGDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MSGDLG - -class WXDLLEXPORT wxMessageDialogBase -{ -protected: - // common validation of wxMessageDialog style - void SetMessageDialogStyle(long style) - { - wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0), - wxT("wxYES and wxNO may only be used together in wxMessageDialog") ); - - wxASSERT_MSG( (style & wxID_OK) != wxID_OK, - wxT("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); - - m_dialogStyle = style; - } - inline long GetMessageDialogStyle() const - { - return m_dialogStyle; - } - -private: - long m_dialogStyle; -}; - -#if defined(__WX_COMPILING_MSGDLGG_CPP__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXUNIVERSAL__) || defined(__WXGPE__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXPALMOS__) -#include "wx/palmos/msgdlg.h" -#elif defined(__WXMSW__) -#include "wx/msw/msgdlg.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/msgdlg.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/msgdlg.h" -#elif defined(__WXGTK__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXGTK__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXMAC__) -#include "wx/mac/msgdlg.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/msgdlg.h" -#elif defined(__WXPM__) -#include "wx/os2/msgdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// wxMessageBox: the simplest way to use wxMessageDialog -// ---------------------------------------------------------------------------- - -int WXDLLEXPORT wxMessageBox(const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK | wxCENTRE, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -#endif // wxUSE_MSGDLG - -#endif - // _WX_MSGDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/msgout.h b/Source/3rdParty/wx/include/wx/msgout.h deleted file mode 100644 index 63803bfa3..000000000 --- a/Source/3rdParty/wx/include/wx/msgout.h +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msgout.h -// Purpose: wxMessageOutput class. Shows a message to the user -// Author: Mattia Barbon -// Modified by: -// Created: 17.07.02 -// RCS-ID: $Id: msgout.h 35690 2005-09-25 20:23:30Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGOUT_H_ -#define _WX_MSGOUT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/wxchar.h" - -// ---------------------------------------------------------------------------- -// wxMessageOutput is a class abstracting formatted output target, i.e. -// something you can printf() to -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutput -{ -public: - virtual ~wxMessageOutput() { } - - // show a message to the user - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; - - // gets the current wxMessageOutput object (may be NULL during - // initialization or shutdown) - static wxMessageOutput* Get(); - - // sets the global wxMessageOutput instance; returns the previous one - static wxMessageOutput* Set(wxMessageOutput* msgout); - -private: - static wxMessageOutput* ms_msgOut; -}; - -// ---------------------------------------------------------------------------- -// implementation showing the message to the user in "best" possible way: uses -// native message box if available (currently only under Windows) and stderr -// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput -{ -public: - wxMessageOutputBest() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation which sends output to stderr -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput -{ -public: - wxMessageOutputStderr() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation which shows output in a message box -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput -{ -public: - wxMessageOutputMessageBox() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// implementation using the native way of outputting debug messages -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput -{ -public: - wxMessageOutputDebug() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation using wxLog (mainly for backwards compatibility) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput -{ -public: - wxMessageOutputLog() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -#endif - // _WX_MSGOUT_H_ diff --git a/Source/3rdParty/wx/include/wx/mstream.h b/Source/3rdParty/wx/include/wx/mstream.h deleted file mode 100644 index a81452284..000000000 --- a/Source/3rdParty/wx/include/wx/mstream.h +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mstream.h -// Purpose: Memory stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: mstream.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXMMSTREAM_H__ -#define _WX_WXMMSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/stream.h" - -class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream; - -class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream -{ -public: - wxMemoryInputStream(const void *data, size_t length); - wxMemoryInputStream(const wxMemoryOutputStream& stream); - virtual ~wxMemoryInputStream(); - virtual wxFileOffset GetLength() const { return m_length; } - virtual bool IsSeekable() const { return true; } - - char Peek(); - - wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxStreamBuffer *m_i_streambuf; - - size_t OnSysRead(void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -private: - size_t m_length; - - DECLARE_NO_COPY_CLASS(wxMemoryInputStream) -}; - -class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream -{ -public: - // if data is !NULL it must be allocated with malloc() - wxMemoryOutputStream(void *data = NULL, size_t length = 0); - virtual ~wxMemoryOutputStream(); - virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); } - virtual bool IsSeekable() const { return true; } - - size_t CopyTo(void *buffer, size_t len) const; - - wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxStreamBuffer *m_o_streambuf; - -protected: - size_t OnSysWrite(const void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - - DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif - // wxUSE_STREAMS - -#endif - // _WX_WXMMSTREAM_H__ diff --git a/Source/3rdParty/wx/include/wx/msw/accel.h b/Source/3rdParty/wx/include/wx/msw/accel.h deleted file mode 100644 index 705146894..000000000 --- a/Source/3rdParty/wx/include/wx/msw/accel.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/accel.h -// Purpose: wxAcceleratorTable class -// Author: Julian Smart -// Modified by: -// Created: 31/7/98 -// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCEL_H_ -#define _WX_ACCEL_H_ - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// ---------------------------------------------------------------------------- -// the accel table has all accelerators for a given window or menu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorTable : public wxObject -{ -public: - // default ctor - wxAcceleratorTable() { } - - // load from .rc resource (Windows specific) - wxAcceleratorTable(const wxString& resource); - - // initialize from array - wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); - - bool Ok() const { return IsOk(); } - bool IsOk() const; - void SetHACCEL(WXHACCEL hAccel); - WXHACCEL GetHACCEL() const; - - // translate the accelerator, return true if done - bool Translate(wxWindow *window, WXMSG *msg) const; - -private: - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) -}; - -#endif - // _WX_ACCEL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/app.h b/Source/3rdParty/wx/include/wx/msw/app.h deleted file mode 100644 index 4989c9c7a..000000000 --- a/Source/3rdParty/wx/include/wx/msw/app.h +++ /dev/null @@ -1,147 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: app.h -// Purpose: wxApp class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: app.h 53157 2008-04-13 12:17:37Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APP_H_ -#define _WX_APP_H_ - -#include "wx/event.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxApp; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; -class WXDLLIMPEXP_FWD_BASE wxLog; - -// Represents the application. Derive OnInit and declare -// a new App object to start application -class WXDLLEXPORT wxApp : public wxAppBase -{ - DECLARE_DYNAMIC_CLASS(wxApp) - -public: - wxApp(); - virtual ~wxApp(); - - // override base class (pure) virtuals - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); - - virtual bool Yield(bool onlyIfNeeded = false); - virtual void WakeUpIdle(); - - virtual void SetPrintMode(int mode) { m_printMode = mode; } - virtual int GetPrintMode() const { return m_printMode; } - - // implementation only - void OnIdle(wxIdleEvent& event); - void OnEndSession(wxCloseEvent& event); - void OnQueryEndSession(wxCloseEvent& event); - -#if wxUSE_EXCEPTIONS - virtual bool OnExceptionInMainLoop(); -#endif // wxUSE_EXCEPTIONS - - // deprecated functions, use wxEventLoop directly instead -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); - wxDEPRECATED( bool DoMessage() ); - wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -protected: - int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT - -public: - // Implementation - static bool RegisterWindowClasses(); - static bool UnregisterWindowClasses(); - -#if wxUSE_RICHEDIT - // initialize the richedit DLL of (at least) given version, return true if - // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) - static bool InitRichEdit(int version = 2); -#endif // wxUSE_RICHEDIT - - // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it - // wasn't found at all - static int GetComCtl32Version(); - - // the SW_XXX value to be used for the frames opened by the application - // (currently seems unused which is a bug -- TODO) - static int m_nCmdShow; - -protected: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxApp) -}; - -// ---------------------------------------------------------------------------- -// MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition -// ---------------------------------------------------------------------------- - -// we need HINSTANCE declaration to define WinMain() -#include "wx/msw/wrapwin.h" - -#ifndef SW_SHOWNORMAL - #define SW_SHOWNORMAL 1 -#endif - -// WinMain() is always ANSI, even in Unicode build, under normal Windows -// but is always Unicode under CE -#ifdef __WXWINCE__ - typedef wchar_t *wxCmdLineArgType; -#else - typedef char *wxCmdLineArgType; -#endif - -extern int WXDLLEXPORT -wxEntry(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, - int nCmdShow = SW_SHOWNORMAL); - -#if defined(__BORLANDC__) && wxUSE_UNICODE - // Borland C++ has the following nonstandard behaviour: when the -WU - // command line flag is used, the linker expects to find wWinMain instead - // of WinMain. This flag causes the compiler to define _UNICODE and - // UNICODE symbols and there's no way to detect its use, so we have to - // define both WinMain and wWinMain so that IMPLEMENT_WXWIN_MAIN works - // for both code compiled with and without -WU. - // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 - // for more details. - #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ - extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wchar_t * WXUNUSED(lpCmdLine), \ - int nCmdShow) \ - { \ - /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ - /* wchar_t*, but fortunately it's not used anywhere */ \ - /* and we can simply pass NULL in: */ \ - return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ - } -#else - #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD -#endif // defined(__BORLANDC__) && wxUSE_UNICODE - -#define IMPLEMENT_WXWIN_MAIN \ - extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wxCmdLineArgType lpCmdLine, \ - int nCmdShow) \ - { \ - return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ - } \ - IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD - -#endif // _WX_APP_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/apptbase.h b/Source/3rdParty/wx/include/wx/msw/apptbase.h deleted file mode 100644 index efab1ed33..000000000 --- a/Source/3rdParty/wx/include/wx/msw/apptbase.h +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/apptbase.h -// Purpose: declaration of wxAppTraits for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.06.2003 -// RCS-ID: $Id: apptbase.h 40599 2006-08-13 21:00:32Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_APPTBASE_H_ -#define _WX_MSW_APPTBASE_H_ - -// ---------------------------------------------------------------------------- -// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase -{ -public: - // wxExecute() support methods - // --------------------------- - - // called before starting to wait for the child termination, may return - // some opaque data which will be passed later to AfterChildWaitLoop() - virtual void *BeforeChildWaitLoop() = 0; - - // process pending Windows messages, even in console app - virtual void AlwaysYield() = 0; - - // called after starting to wait for the child termination, the parameter - // is the return value of BeforeChildWaitLoop() - virtual void AfterChildWaitLoop(void *data) = 0; - - - // wxThread helpers - // ---------------- - - // process a message while waiting for a(nother) thread, should return - // false if and only if we have to exit the application - virtual bool DoMessageFromThreadWait() = 0; -}; - -#endif // _WX_MSW_APPTBASE_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/apptrait.h b/Source/3rdParty/wx/include/wx/msw/apptrait.h deleted file mode 100644 index 6b094ce29..000000000 --- a/Source/3rdParty/wx/include/wx/msw/apptrait.h +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/apptrait.h -// Purpose: class implementing wxAppTraits for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 -// RCS-ID: $Id: apptrait.h 40599 2006-08-13 21:00:32Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_APPTRAIT_H_ -#define _WX_MSW_APPTRAIT_H_ - -// ---------------------------------------------------------------------------- -// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase -{ -public: - virtual void *BeforeChildWaitLoop(); - virtual void AlwaysYield(); - virtual void AfterChildWaitLoop(void *data); - - virtual bool DoMessageFromThreadWait(); -}; - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase -{ -public: - virtual void *BeforeChildWaitLoop(); - virtual void AlwaysYield(); - virtual void AfterChildWaitLoop(void *data); - - virtual bool DoMessageFromThreadWait(); - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; -}; - -#endif // wxUSE_GUI - -#endif // _WX_MSW_APPTRAIT_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/bitmap.h b/Source/3rdParty/wx/include/wx/msw/bitmap.h deleted file mode 100644 index 4e71852a5..000000000 --- a/Source/3rdParty/wx/include/wx/msw/bitmap.h +++ /dev/null @@ -1,282 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/bitmap.h -// Purpose: wxBitmap class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BITMAP_H_ -#define _WX_BITMAP_H_ - -#include "wx/msw/gdiimage.h" -#include "wx/palette.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; -class WXDLLIMPEXP_FWD_CORE wxBitmapRefData; -class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxDC; -#if wxUSE_WXDIB -class WXDLLIMPEXP_FWD_CORE wxDIB; -#endif -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxMask; -class WXDLLIMPEXP_FWD_CORE wxPalette; -class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; - -// ---------------------------------------------------------------------------- -// wxBitmap: a mono or colour bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmap : public wxGDIImage -{ -public: - // default ctor creates an invalid bitmap, you must Create() it later - wxBitmap() { } - - // Initialize with raw data - wxBitmap(const char bits[], int width, int height, int depth = 1); - - // Initialize with XPM data - wxBitmap(const char* const* data); -#ifdef wxNEEDS_CHARPP - wxBitmap(char** data) - { - *this = wxBitmap(wx_const_cast(const char* const*, data)); - } -#endif - - // Load a file or resource - wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); - - // New constructor for generalised creation from data - wxBitmap(const void* data, long type, int width, int height, int depth = 1); - - // Create a new, uninitialized bitmap of the given size and depth (if it - // is omitted, will create a bitmap compatible with the display) - // - // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor - // taking a DC argument if you want to force using DDB in this case - wxBitmap(int width, int height, int depth = -1); - - // Create a bitmap compatible with the given DC - wxBitmap(int width, int height, const wxDC& dc); - -#if wxUSE_IMAGE - // Convert from wxImage - wxBitmap(const wxImage& image, int depth = -1) - { (void)CreateFromImage(image, depth); } - - // Create a DDB compatible with the given DC from wxImage - wxBitmap(const wxImage& image, const wxDC& dc) - { (void)CreateFromImage(image, dc); } -#endif // wxUSE_IMAGE - - // we must have this, otherwise icons are silently copied into bitmaps using - // the copy ctor but the resulting bitmap is invalid! - wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - - wxBitmap& operator=(const wxIcon& icon) - { - (void)CopyFromIcon(icon); - - return *this; - } - - wxBitmap& operator=(const wxCursor& cursor) - { - (void)CopyFromCursor(cursor); - - return *this; - } - - virtual ~wxBitmap(); - -#if wxUSE_IMAGE - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - - // get the given part of bitmap - wxBitmap GetSubBitmap( const wxRect& rect ) const; - - // NB: This should not be called from user code. It is for wx internal - // use only. - wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; - - // copies the contents and mask of the given (colour) icon to the bitmap - bool CopyFromIcon(const wxIcon& icon); - - // copies the contents and mask of the given cursor to the bitmap - bool CopyFromCursor(const wxCursor& cursor); - -#if wxUSE_WXDIB - // copies from a device independent bitmap - bool CopyFromDIB(const wxDIB& dib); -#endif - - virtual bool Create(int width, int height, int depth = -1); - virtual bool Create(int width, int height, const wxDC& dc); - virtual bool Create(const void* data, long type, int width, int height, int depth = 1); - virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); - virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); - - wxBitmapRefData *GetBitmapData() const - { return (wxBitmapRefData *)m_refData; } - - // raw bitmap access support functions - void *GetRawData(wxPixelDataBase& data, int bpp); - void UngetRawData(wxPixelDataBase& data); - -#if wxUSE_PALETTE - wxPalette* GetPalette() const; - void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - wxMask *GetMask() const; - wxBitmap GetMaskBitmap() const; - void SetMask(wxMask *mask); - - // these functions are internal and shouldn't be used, they risk to - // disappear in the future - bool HasAlpha() const; - void UseAlpha(); - -#if WXWIN_COMPATIBILITY_2_4 - // these functions do nothing and are only there for backwards - // compatibility - wxDEPRECATED( int GetQuality() const ); - wxDEPRECATED( void SetQuality(int quality) ); -#endif // WXWIN_COMPATIBILITY_2_4 - - // implementation only from now on - // ------------------------------- - -public: - void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } - WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } - -#ifdef __WXDEBUG__ - void SetSelectedInto(wxDC *dc); - wxDC *GetSelectedInto() const; -#endif // __WXDEBUG__ - -protected: - virtual wxGDIImageRefData *CreateData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - // creates an uninitialized bitmap, called from Create()s above - bool DoCreate(int w, int h, int depth, WXHDC hdc); - -#if wxUSE_IMAGE - // creates the bitmap from wxImage, supposed to be called from ctor - bool CreateFromImage(const wxImage& image, int depth); - - // creates a DDB from wxImage, supposed to be called from ctor - bool CreateFromImage(const wxImage& image, const wxDC& dc); - - // common part of the 2 methods above (hdc may be 0) - bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc); -#endif // wxUSE_IMAGE - -private: - // common part of CopyFromIcon/CopyFromCursor for Win32 - bool CopyFromIconOrCursor(const wxGDIImage& icon); - - - DECLARE_DYNAMIC_CLASS(wxBitmap) -}; - -// ---------------------------------------------------------------------------- -// wxMask: a mono bitmap used for drawing bitmaps transparently. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMask : public wxObject -{ -public: - wxMask(); - - // Copy constructor - wxMask(const wxMask &mask); - - // Construct a mask from a bitmap and a colour indicating the transparent - // area - wxMask(const wxBitmap& bitmap, const wxColour& colour); - - // Construct a mask from a bitmap and a palette index indicating the - // transparent area - wxMask(const wxBitmap& bitmap, int paletteIndex); - - // Construct a mask from a mono bitmap (copies the bitmap). - wxMask(const wxBitmap& bitmap); - - // construct a mask from the givne bitmap handle - wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; } - - virtual ~wxMask(); - - bool Create(const wxBitmap& bitmap, const wxColour& colour); - bool Create(const wxBitmap& bitmap, int paletteIndex); - bool Create(const wxBitmap& bitmap); - - // Implementation - WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } - void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } - -protected: - WXHBITMAP m_maskBitmap; - - DECLARE_DYNAMIC_CLASS(wxMask) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler -{ -public: - wxBitmapHandler() { } - wxBitmapHandler(const wxString& name, const wxString& ext, long type) - : wxGDIImageHandler(name, ext, type) - { - } - - // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the - // old class which worked only with bitmaps - virtual bool Create(wxBitmap *bitmap, - const void* data, - long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(wxBitmap *bitmap, - const wxString& name, - int type, - const wxPalette *palette = NULL); - - virtual bool Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth = 1); - virtual bool Load(wxGDIImage *image, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight); - virtual bool Save(wxGDIImage *image, - const wxString& name, - int type); - -private: - DECLARE_DYNAMIC_CLASS(wxBitmapHandler) -}; - -#endif - // _WX_BITMAP_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/bmpbuttn.h b/Source/3rdParty/wx/include/wx/msw/bmpbuttn.h deleted file mode 100644 index a9173613b..000000000 --- a/Source/3rdParty/wx/include/wx/msw/bmpbuttn.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/bmpbuttn.h -// Purpose: wxBitmapButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: bmpbuttn.h 36078 2005-11-03 19:38:20Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BMPBUTTN_H_ -#define _WX_BMPBUTTN_H_ - -#include "wx/button.h" -#include "wx/bitmap.h" -#include "wx/brush.h" - -class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase -{ -public: - wxBitmapButton() { } - - wxBitmapButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, bitmap, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - // Implementation - virtual bool SetBackgroundColour(const wxColour& colour); - virtual void SetDefault(); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); - -protected: - // reimplement some base class virtuals - virtual wxSize DoGetBestSize() const; - virtual void OnSetBitmap(); - - // invalidate m_brushDisabled when system colours change - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // change the currently bitmap if we have a hover one - void OnMouseEnterOrLeave(wxMouseEvent& event); - - - // the brush we use to draw disabled buttons - wxBrush m_brushDisabled; - - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) -}; - -#endif // _WX_BMPBUTTN_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/brush.h b/Source/3rdParty/wx/include/wx/msw/brush.h deleted file mode 100644 index 37de6d77d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/brush.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/brush.h -// Purpose: wxBrush class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: brush.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BRUSH_H_ -#define _WX_BRUSH_H_ - -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxBrush; - -// ---------------------------------------------------------------------------- -// wxBrush -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBrush : public wxBrushBase -{ -public: - wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); - wxBrush(const wxBitmap& stipple); - virtual ~wxBrush(); - - virtual void SetColour(const wxColour& col); - virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); - virtual void SetStyle(int style); - virtual void SetStipple(const wxBitmap& stipple); - - bool operator==(const wxBrush& brush) const; - bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - - wxColour GetColour() const; - virtual int GetStyle() const; - wxBitmap *GetStipple() const; - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // return the HBRUSH for this brush - virtual WXHANDLE GetResourceHandle() const; - -protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxBrush) -}; - -#endif - // _WX_BRUSH_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/button.h b/Source/3rdParty/wx/include/wx/msw/button.h deleted file mode 100644 index e36e44ff6..000000000 --- a/Source/3rdParty/wx/include/wx/msw/button.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/button.h -// Purpose: wxButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: button.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUTTON_H_ -#define _WX_BUTTON_H_ - -// ---------------------------------------------------------------------------- -// Pushbutton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButton : public wxButtonBase -{ -public: - wxButton() { } - wxButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual ~wxButton(); - - virtual void SetDefault(); - - // implementation from now on - virtual void Command(wxCommandEvent& event); - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWCommand(WXUINT param, WXWORD id); - - // coloured buttons support - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - void MakeOwnerDrawn(); - -protected: - // send a notification event, return true if processed - bool SendClickEvent(); - - // default button handling - void SetTmpDefault(); - void UnsetTmpDefault(); - - // set or unset BS_DEFPUSHBUTTON style - static void SetDefaultStyle(wxButton *btn, bool on); - - // usually overridden base class virtuals - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) -}; - -#endif - // _WX_BUTTON_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/caret.h b/Source/3rdParty/wx/include/wx/msw/caret.h deleted file mode 100644 index 90b0d29cc..000000000 --- a/Source/3rdParty/wx/include/wx/msw/caret.h +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/caret.h -// Purpose: wxCaret class - the MSW implementation of wxCaret -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.05.99 -// RCS-ID: $Id: caret.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CARET_H_ -#define _WX_CARET_H_ - -class WXDLLEXPORT wxCaret : public wxCaretBase -{ -public: - wxCaret() { Init(); } - // create the caret of given (in pixels) width and height and associate - // with the given window - wxCaret(wxWindow *window, int width, int height) - { - Init(); - - (void)Create(window, width, height); - } - // same as above - wxCaret(wxWindowBase *window, const wxSize& size) - { - Init(); - - (void)Create(window, size); - } - - // process wxWindow notifications - virtual void OnSetFocus(); - virtual void OnKillFocus(); - -protected: - void Init() - { - wxCaretBase::Init(); - - m_hasCaret = false; - } - - // override base class virtuals - virtual void DoMove(); - virtual void DoShow(); - virtual void DoHide(); - virtual void DoSize(); - - // helper function which creates the system caret - bool MSWCreateCaret(); - -private: - bool m_hasCaret; - - DECLARE_NO_COPY_CLASS(wxCaret) -}; - -#endif // _WX_CARET_H_ - - diff --git a/Source/3rdParty/wx/include/wx/msw/checkbox.h b/Source/3rdParty/wx/include/wx/msw/checkbox.h deleted file mode 100644 index 6f5605571..000000000 --- a/Source/3rdParty/wx/include/wx/msw/checkbox.h +++ /dev/null @@ -1,86 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/checkbox.h -// Purpose: wxCheckBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: checkbox.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKBOX_H_ -#define _WX_CHECKBOX_H_ - -// Checkbox item (single checkbox) -class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase -{ -public: - wxCheckBox() { } - wxCheckBox(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetValue(bool value); - virtual bool GetValue() const; - - // override some base class virtuals - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - -protected: - virtual wxSize DoGetBestSize() const; - - virtual void DoSet3StateValue(wxCheckBoxState value); - virtual wxCheckBoxState DoGet3StateValue() const; - - // make the checkbox owner drawn or reset it to normal style - void MakeOwnerDrawn(bool ownerDrawn); - - // return true if this checkbox is owner drawn - bool IsOwnerDrawn() const; - -private: - // common part of all ctors - void Init(); - - // event handlers used by owner-drawn checkbox - void OnMouseEnterOrLeave(wxMouseEvent& event); - void OnMouseLeft(wxMouseEvent& event); - void OnFocus(wxFocusEvent& event); - - - // current state of the checkbox - wxCheckBoxState m_state; - - // true if the checkbox is currently pressed - bool m_isPressed; - - // true if mouse is currently over the control - bool m_isHot; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox) -}; - -#endif - // _WX_CHECKBOX_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/checklst.h b/Source/3rdParty/wx/include/wx/msw/checklst.h deleted file mode 100644 index 5f1272781..000000000 --- a/Source/3rdParty/wx/include/wx/msw/checklst.h +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/checklst.h -// Purpose: wxCheckListBox class - a listbox with checkable items -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.11.97 -// RCS-ID: $Id: checklst.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __CHECKLST__H_ -#define __CHECKLST__H_ - -#if !wxUSE_OWNER_DRAWN - #error "wxCheckListBox class requires owner-drawn functionality." -#endif - -class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; -class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp - -class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase -{ -public: - // ctors - wxCheckListBox(); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // override base class virtuals - virtual void Delete(unsigned int n); - - virtual bool SetFont( const wxFont &font ); - - // items may be checked - virtual bool IsChecked(unsigned int uiIndex) const; - virtual void Check(unsigned int uiIndex, bool bCheck = true); - - // return the index of the item at this position or wxNOT_FOUND - int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } - int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } - - // accessors - size_t GetItemHeight() const { return m_nItemHeight; } - - // we create our items ourselves and they have non-standard size, - // so we need to override these functions - virtual wxOwnerDrawn *CreateLboxItem(size_t n); - virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - -protected: - // this can't be called DoHitTest() because wxWindow already has this method - int DoHitTestItem(wxCoord x, wxCoord y) const; - - // pressing space or clicking the check box toggles the item - void OnKeyDown(wxKeyEvent& event); - void OnLeftClick(wxMouseEvent& event); - - wxSize DoGetBestSize() const; - -private: - size_t m_nItemHeight; // height of checklistbox items (the same for all) - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) -}; - -#endif //_CHECKLST_H diff --git a/Source/3rdParty/wx/include/wx/msw/chkconf.h b/Source/3rdParty/wx/include/wx/msw/chkconf.h deleted file mode 100644 index 022ca20dd..000000000 --- a/Source/3rdParty/wx/include/wx/msw/chkconf.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Name: wx/msw/chkconf.h - * Purpose: Compiler-specific configuration checking - * Author: Julian Smart - * Modified by: - * Created: 01/02/97 - * RCS-ID: $Id: chkconf.h 44436 2007-02-10 02:06:54Z RD $ - * Copyright: (c) Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MSW_CHKCONF_H_ -#define _WX_MSW_CHKCONF_H_ - -/* ensure that MSW-specific settings are defined */ -#ifndef wxUSE_DC_CACHEING -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DC_CACHEING must be defined" -# else -# define wxUSE_DC_CACHEING 1 -# endif -#endif /* wxUSE_DC_CACHEING */ - - -/* - * disable the settings which don't work for some compilers - */ - -/* - * If using PostScript-in-MSW in Univ, must enable PostScript - */ -#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT -# undef wxUSE_POSTSCRIPT -# define wxUSE_POSTSCRIPT 1 -#endif - -#ifndef wxUSE_NORLANDER_HEADERS -# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ - ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) -# define wxUSE_NORLANDER_HEADERS 1 -# else -# define wxUSE_NORLANDER_HEADERS 0 -# endif -#endif - -/* - * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but - * wxUSE_UNICODE is not as this would make it impossible to simply set the - * former in wx/setup.h as then the library wouldn't compile in non-Unicode - * configurations, so instead simply unset it silently when it doesn't make - * sense. - */ -#if wxUSE_UNICODE_MSLU && !wxUSE_UNICODE -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -#endif - -/* - * Don't use MSLU if compiling with Wine - */ - -#if wxUSE_UNICODE_MSLU && defined(__WINE__) -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -#endif - -/* - * All of the settings below require SEH support (__try/__catch) and can't work - * without it. - */ -#if !defined(_MSC_VER) && \ - (!defined(__BORLANDC__) || __BORLANDC__ < 0x0550) -# undef wxUSE_ON_FATAL_EXCEPTION -# define wxUSE_ON_FATAL_EXCEPTION 0 - -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 - -# undef wxUSE_STACKWALKER -# define wxUSE_STACKWALKER 0 -#endif /* compiler doesn't support SEH */ - -/* wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior */ -#if defined(__MWERKS__) -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - -#if defined(__GNUWIN32__) - /* These don't work as expected for mingw32 and cygwin32 */ -# undef wxUSE_MEMORY_TRACING -# define wxUSE_MEMORY_TRACING 0 - -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 - -/* some Cygwin versions don't have wcslen */ -# if defined(__CYGWIN__) || defined(__CYGWIN32__) -# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) -# undef wxUSE_WCHAR_T -# define wxUSE_WCHAR_T 0 -# endif -#endif - -#endif /* __GNUWIN32__ */ - -/* wxUSE_MFC is not defined when using configure as it doesn't make sense for - gcc or mingw32 anyhow */ -#ifndef wxUSE_MFC - #define wxUSE_MFC 0 -#endif /* !defined(wxUSE_MFC) */ - -/* MFC duplicates these operators */ -#if wxUSE_MFC -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif /* wxUSE_MFC */ - -#if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) - /* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */ -# undef wxUSE_DRAG_AND_DROP -# define wxUSE_DRAG_AND_DROP 0 -#endif - -#if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) -# undef wxUSE_CHECKLISTBOX -# define wxUSE_CHECKLISTBOX 0 -#endif - -#if wxUSE_SPINCTRL -# if !wxUSE_SPINBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxSpinCtrl requires wxSpinButton on MSW" -# else -# undef wxUSE_SPINBTN -# define wxUSE_SPINBTN 1 -# endif -# endif -#endif - -/* - Win64-specific checks. - */ -#ifdef __WIN64__ -# if wxUSE_STACKWALKER - /* this is not currently supported under Win64, volunteers needed to - make it work */ -# undef wxUSE_STACKWALKER -# define wxUSE_STACKWALKER 0 - -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* __WIN64__ */ - - -/* - Compiler-specific checks. - */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) - /* BC++ 4.0 can't compile JPEG library */ -# undef wxUSE_LIBJPEG -# define wxUSE_LIBJPEG 0 -#endif - -/* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */ -#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - -/* DMC++ doesn't have definitions for date picker control, so use generic control - */ -#ifdef __DMC__ -# if wxUSE_DATEPICKCTRL -# undef wxUSE_DATEPICKCTRL_GENERIC -# undef wxUSE_DATEPICKCTRL -# endif -# define wxUSE_DATEPICKCTRL 0 -# define wxUSE_DATEPICKCTRL_GENERIC 1 -#endif - - -/* check that MSW-specific options are defined too */ -#ifndef wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACTIVEX must be defined." -# else -# define wxUSE_ACTIVEX 0 -# endif -#endif /* !defined(wxUSE_ACTIVEX) */ - -#ifndef wxUSE_DIALUP_MANAGER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIALUP_MANAGER must be defined." -# else -# define wxUSE_DIALUP_MANAGER 0 -# endif -#endif /* !defined(wxUSE_DIALUP_MANAGER) */ - -#ifndef wxUSE_MS_HTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MS_HTML_HELP must be defined." -# else -# define wxUSE_MS_HTML_HELP 0 -# endif -#endif /* !defined(wxUSE_MS_HTML_HELP) */ - -#ifndef wxUSE_OLE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE must be defined." -# else -# define wxUSE_OLE 0 -# endif -#endif /* !defined(wxUSE_OLE) */ - -#ifndef wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE_AUTOMATION must be defined." -# else -# define wxUSE_OLE_AUTOMATION 0 -# endif -#endif /* !defined(wxUSE_OLE_AUTOMATION) */ - -#ifndef wxUSE_UNICODE_MSLU -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE_MSLU must be defined." -# else -# define wxUSE_UNICODE_MSLU 0 -# endif -#endif /* wxUSE_UNICODE_MSLU */ - -#ifndef wxUSE_UXTHEME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME must be defined." -# else -# define wxUSE_UXTHEME 0 -# endif -#endif /* wxUSE_UXTHEME */ - -#ifndef wxUSE_UXTHEME_AUTO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME_AUTO must be defined." -# else -# define wxUSE_UXTHEME_AUTO 0 -# endif -#endif /* wxUSE_UXTHEME_AUTO */ - - -/* - un/redefine the options which we can't compile (after checking that they're - defined - */ -#ifdef __WINE__ - /* apparently it doesn't compile under Wine, remove it/when it does */ - #if wxUSE_ACTIVEX - #undef wxUSE_ACTIVEX - #define wxUSE_ACTIVEX 0 - #endif // wxUSE_ACTIVEX -#endif // __WINE__ - - -/* check settings consistency for MSW-specific ones */ -#if !wxUSE_VARIANT -# if wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxActiveXContainer requires wxVariant" -# else -# undef wxUSE_ACTIVEX -# define wxUSE_ACTIVEX 0 -# endif -# endif - -# if wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxAutomationObject requires wxVariant" -# else -# undef wxUSE_OLE_AUTOMATION -# define wxUSE_OLE_AUTOMATION 0 -# endif -# endif -#endif /* !wxUSE_VARIANT */ - -#if !wxUSE_DYNAMIC_LOADER -# if wxUSE_MS_HTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER." -# else -# undef wxUSE_MS_HTML_HELP -# define wxUSE_MS_HTML_HELP 0 -# endif -# endif -# if wxUSE_DIALUP_MANAGER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER." -# else -# undef wxUSE_DIALUP_MANAGER -# define wxUSE_DIALUP_MANAGER 0 -# endif -# endif -#endif /* !wxUSE_DYNAMIC_LOADER */ - -#if !wxUSE_DYNLIB_CLASS -# if wxUSE_UXTHEME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_UXTHEME -# define wxUSE_UXTHEME 0 -# endif -# endif -# if wxUSE_MEDIACTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MEDIACTRL requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_MEDIACTRL -# define wxUSE_MEDIACTRL 0 -# endif -# endif -# if wxUSE_INKEDIT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_INKEDIT requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_INKEDIT -# define wxUSE_INKEDIT 0 -# endif -# endif -#endif /* !wxUSE_DYNLIB_CLASS */ - -#if !wxUSE_OLE -# if wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxActiveXContainer requires wxUSE_OLE" -# else -# undef wxUSE_ACTIVEX -# define wxUSE_ACTIVEX 0 -# endif -# endif - -# if wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAOBJ requires wxUSE_OLE" -# else -# undef wxUSE_DATAOBJ -# define wxUSE_DATAOBJ 0 -# endif -# endif - -# if wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxAutomationObject requires wxUSE_OLE" -# else -# undef wxUSE_OLE_AUTOMATION -# define wxUSE_OLE_AUTOMATION 0 -# endif -# endif -#endif /* !wxUSE_OLE */ - -#if !wxUSE_ACTIVEX -# if wxUSE_MEDIACTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxMediaCtl requires wxActiveXContainer" -# else -# undef wxUSE_MEDIACTRL -# define wxUSE_MEDIACTRL 0 -# endif -# endif -#endif /* !wxUSE_ACTIVEX */ - -#if defined(_MSC_VER) && _MSC_VER <= 1200 && wxUSE_GRAPHICS_CONTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxGraphicsContext needs MSVC 7 or newer" -# else -# undef wxUSE_GRAPHICS_CONTEXT -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif - -#endif /* _WX_MSW_CHKCONF_H_ */ diff --git a/Source/3rdParty/wx/include/wx/msw/choice.h b/Source/3rdParty/wx/include/wx/msw/choice.h deleted file mode 100644 index 6dccdafa4..000000000 --- a/Source/3rdParty/wx/include/wx/msw/choice.h +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/choice.h -// Purpose: wxChoice class -// Author: Julian Smart -// Modified by: Vadim Zeitlin to derive from wxChoiceBase -// Created: 01/02/97 -// RCS-ID: $Id: choice.h 51616 2008-02-09 15:22:15Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICE_H_ -#define _WX_CHOICE_H_ - -// ---------------------------------------------------------------------------- -// Choice item -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoice : public wxChoiceBase -{ -public: - // ctors - wxChoice() { Init(); } - virtual ~wxChoice(); - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - virtual void SetLabel(const wxString& label); - - virtual void Delete(unsigned int n); - virtual void Clear(); - - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual int GetCurrentSelection() const; - virtual void SetSelection(int n); - - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // MSW only - virtual bool MSWCommand(WXUINT param, WXWORD id); - WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); - virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // common part of all ctors - void Init() { m_lastAcceptedSelection = wxID_NONE; } - - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - - // MSW implementation - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *w, int *h) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - // update the height of the drop down list to fit the number of items we - // have (without changing the visible height) - void UpdateVisibleHeight(); - - // create and initialize the control - bool CreateAndInit(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name); - - // free all memory we have (used by Clear() and dtor) - void Free(); - - - // last "completed" selection, i.e. not the transient one while the user is - // browsing the popup list: this is only used when != wxID_NONE which is - // the case while the drop down is opened - int m_lastAcceptedSelection; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) -}; - -#endif // _WX_CHOICE_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/clipbrd.h b/Source/3rdParty/wx/include/wx/msw/clipbrd.h deleted file mode 100644 index a8cf81c3c..000000000 --- a/Source/3rdParty/wx/include/wx/msw/clipbrd.h +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/clipbrd.h -// Purpose: wxClipboad class and clipboard functions for MSW -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLIPBRD_H_ -#define _WX_CLIPBRD_H_ - -#if wxUSE_CLIPBOARD - -#include "wx/list.h" -#include "wx/module.h" -#include "wx/dataobj.h" // for wxDataFormat - -// These functions superceded by wxClipboard, but retained in order to -// implement wxClipboard, and for compatibility. - -// open/close the clipboard -WXDLLEXPORT bool wxOpenClipboard(); -WXDLLEXPORT bool wxIsClipboardOpened(); -#define wxClipboardOpen wxIsClipboardOpened -WXDLLEXPORT bool wxCloseClipboard(); - -// get/set data -WXDLLEXPORT bool wxEmptyClipboard(); -WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, - const void *data, - int width = 0, int height = 0); -WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, - long *len = NULL); - -// clipboard formats -WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); -WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); -WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); -WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, - wxChar *formatName, - int maxCount); - -//----------------------------------------------------------------------------- -// wxClipboard -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLEXPORT wxClipboard : public wxClipboardBase -{ - DECLARE_DYNAMIC_CLASS(wxClipboard) - -public: - wxClipboard(); - virtual ~wxClipboard(); - - // open the clipboard before SetData() and GetData() - virtual bool Open(); - - // close the clipboard after SetData() and GetData() - virtual void Close(); - - // query whether the clipboard is opened - virtual bool IsOpened() const; - - // set the clipboard data. all other formats will be deleted. - virtual bool SetData( wxDataObject *data ); - - // add to the clipboard data. - virtual bool AddData( wxDataObject *data ); - - // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ); - - // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ); - - // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear(); - - // flushes the clipboard: this means that the data which is currently on - // clipboard will stay available even after the application exits (possibly - // eating memory), otherwise the clipboard will be emptied on exit - virtual bool Flush(); - - // X11 has two clipboards which get selected by this call. Empty on MSW. - void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } - -private: - IDataObject *m_lastDataObject; - bool m_isOpened; -}; - -#endif // wxUSE_CLIPBOARD -#endif - // _WX_CLIPBRD_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/colordlg.h b/Source/3rdParty/wx/include/wx/msw/colordlg.h deleted file mode 100644 index fa0913473..000000000 --- a/Source/3rdParty/wx/include/wx/msw/colordlg.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/colordlg.h -// Purpose: wxColourDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colordlg.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLORDLG_H_ -#define _WX_COLORDLG_H_ - -#include "wx/defs.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -// ---------------------------------------------------------------------------- -// wxColourDialog: dialog for choosing a colours -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxColourDialog : public wxDialog -{ -public: - wxColourDialog(); - wxColourDialog(wxWindow *parent, wxColourData *data = NULL); - - bool Create(wxWindow *parent, wxColourData *data = NULL); - - wxColourData& GetColourData() { return m_colourData; } - - // override some base class virtuals - virtual void SetTitle(const wxString& title); - virtual wxString GetTitle() const; - - virtual int ShowModal(); - -protected: - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - wxColourData m_colourData; - wxString m_title; - - wxPoint m_pos; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) -}; - -#endif - // _WX_COLORDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/colour.h b/Source/3rdParty/wx/include/wx/msw/colour.h deleted file mode 100644 index d66b838d7..000000000 --- a/Source/3rdParty/wx/include/wx/msw/colour.h +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/colour.h -// Purpose: wxColour class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colour.h 51769 2008-02-13 22:36:43Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLOUR_H_ -#define _WX_COLOUR_H_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// Colour -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxColour : public wxColourBase -{ -public: - // constructors - // ------------ - - wxColour() { Init(); } - wxColour( ChannelType red, ChannelType green, ChannelType blue, - ChannelType alpha = wxALPHA_OPAQUE ) - { Set(red, green, blue, alpha); } - wxColour( unsigned long colRGB ) { Set(colRGB); } - wxColour(const wxString& colourName) { Init(); Set(colourName); } - wxColour(const wxChar *colourName) { Init(); Set(colourName); } - - - // dtor - virtual ~wxColour(); - - - // accessors - // --------- - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_isInit; } - - unsigned char Red() const { return m_red; } - unsigned char Green() const { return m_green; } - unsigned char Blue() const { return m_blue; } - unsigned char Alpha() const { return m_alpha ; } - - // comparison - bool operator==(const wxColour& colour) const - { - return m_isInit == colour.m_isInit - && m_red == colour.m_red - && m_green == colour.m_green - && m_blue == colour.m_blue - && m_alpha == colour.m_alpha; - } - - bool operator != (const wxColour& colour) const { return !(*this == colour); } - - WXCOLORREF GetPixel() const { return m_pixel; } - - -public: - WXCOLORREF m_pixel; - -protected: - // Helper function - void Init(); - - virtual void - InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); - -private: - bool m_isInit; - unsigned char m_red; - unsigned char m_blue; - unsigned char m_green; - unsigned char m_alpha; - -private: - DECLARE_DYNAMIC_CLASS(wxColour) -}; - -#endif - // _WX_COLOUR_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/combo.h b/Source/3rdParty/wx/include/wx/msw/combo.h deleted file mode 100644 index 0cd58b32d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/combo.h +++ /dev/null @@ -1,111 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/combo.h -// Purpose: wxComboCtrl class -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 43881 2006-12-09 19:48:21Z PC $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOCONTROL_H_ -#define _WX_COMBOCONTROL_H_ - -// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to -// determine whether there is native wxComboCtrl, so make sure you -// use it in all native wxComboCtrls. - -#if wxUSE_COMBOCTRL - -#if !defined(__WXWINCE__) && wxUSE_TIMER - #include "wx/timer.h" - #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 -#else - #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0 -#endif - - -// ---------------------------------------------------------------------------- -// Native wxComboCtrl -// ---------------------------------------------------------------------------- - -// Define this only if native implementation includes all features -#define wxCOMBOCONTROL_FULLY_FEATURED - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; - -class WXDLLEXPORT wxComboCtrl : public wxComboCtrlBase -{ -public: - // ctors and such - wxComboCtrl() : wxComboCtrlBase() { Init(); } - - wxComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxComboCtrlBase() - { - Init(); - - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxComboCtrl(); - - virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; - - static int GetFeatures() { return wxComboCtrlFeatures::All; } - -#if wxUSE_COMBOCTRL_POPUP_ANIMATION - void OnTimerEvent( wxTimerEvent& event ); -protected: - virtual bool AnimateShow( const wxRect& rect, int flags ); -#endif - -protected: - - // customization - virtual void OnResize(); - virtual wxCoord GetNativeTextIndent() const; - virtual void OnThemeChange(); - - // event handlers - void OnPaintEvent( wxPaintEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - -private: - void Init(); - -#if wxUSE_COMBOCTRL_POPUP_ANIMATION - // Popup animation related - wxLongLong m_animStart; - wxTimer m_animTimer; - wxRect m_animRect; - int m_animFlags; -#endif - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxComboCtrl) -}; - - -#endif // wxUSE_COMBOCTRL -#endif - // _WX_COMBOCONTROL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/combobox.h b/Source/3rdParty/wx/include/wx/msw/combobox.h deleted file mode 100644 index 5d4d7761f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/combobox.h +++ /dev/null @@ -1,138 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/combobox.h -// Purpose: wxComboBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: combobox.h 45818 2007-05-05 13:15:47Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOBOX_H_ -#define _WX_COMBOBOX_H_ - -#include "wx/choice.h" - -#if wxUSE_COMBOBOX - -// ---------------------------------------------------------------------------- -// Combobox control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxComboBox: public wxChoice -{ -public: - wxComboBox() { } - - wxComboBox(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, id, value, pos, size, n, choices, style, validator, name); - } - wxComboBox(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, id, value, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - // List functions: see wxChoice - - // Text field functions - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(int n) { wxChoice::SetSelection(n); } - virtual void SetSelection(long from, long to); - virtual int GetSelection() const { return wxChoice::GetSelection(); } - virtual void GetSelection(long* from, long* to) const; - virtual void SetEditable(bool editable); - - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void SelectAll(); - virtual bool IsEditable() const; - virtual bool HasSelection() const; - - // implementation only from now on - virtual bool MSWCommand(WXUINT param, WXWORD id); - bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - bool MSWShouldPreProcessMessage(WXMSG *pMsg); - - WXHWND GetEditHWND() const; - - // Standard event handling - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_COMBOBOX -#endif - // _WX_COMBOBOX_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/control.h b/Source/3rdParty/wx/include/wx/msw/control.h deleted file mode 100644 index c70454cbc..000000000 --- a/Source/3rdParty/wx/include/wx/msw/control.h +++ /dev/null @@ -1,141 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/control.h -// Purpose: wxControl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: control.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTROL_H_ -#define _WX_CONTROL_H_ - -#include "wx/dynarray.h" - -// General item class -class WXDLLEXPORT wxControl : public wxControlBase -{ -public: - wxControl() { } - - wxControl(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - - virtual ~wxControl(); - - // Simulates an event - virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } - - - // implementation from now on - // -------------------------- - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // Calls the callback and appropriate event handlers - bool ProcessCommand(wxCommandEvent& event); - - // MSW-specific - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // For ownerdraw items - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return false; } - virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return false; } - - const wxArrayLong& GetSubcontrols() const { return m_subControls; } - - // default handling of WM_CTLCOLORxxx: this is public so that wxWindow - // could call it - virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); - - // default style for the control include WS_TABSTOP if it AcceptsFocus() - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - - // return default best size (doesn't really make any sense, override this) - virtual wxSize DoGetBestSize() const; - - // This is a helper for all wxControls made with UPDOWN native control. - // In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in - // WinCE of Smartphones this happens also for native wxTextCtrl, - // wxChoice and others. - virtual wxSize GetBestSpinnerSize(const bool is_vertical) const; - - // create the control of the given Windows class: this is typically called - // from Create() method of the derived class passing its label, pos and - // size parameter (style parameter is not needed because m_windowStyle is - // supposed to had been already set and so is used instead when this - // function is called) - bool MSWCreateControl(const wxChar *classname, - const wxString& label, - const wxPoint& pos, - const wxSize& size); - - // NB: the method below is deprecated now, with MSWGetStyle() the method - // above should be used instead! Once all the controls are updated to - // implement MSWGetStyle() this version will disappear. - // - // create the control of the given class with the given style (combination - // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns - // false if creation failed - // - // All parameters except classname and style are optional, if the - // size/position are not given, they should be set later with SetSize() - // and, label (the title of the window), of course, is left empty. The - // extended style is determined from the style and the app 3D settings - // automatically if it's not specified explicitly. - bool MSWCreateControl(const wxChar *classname, - WXDWORD style, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& label = wxEmptyString, - WXDWORD exstyle = (WXDWORD)-1); - - // call this from the derived class MSWControlColor() if you want to show - // the control greyed out (and opaque) - WXHBRUSH MSWControlColorDisabled(WXHDC pDC); - - // common part of the 3 functions above: pass wxNullColour to use the - // appropriate background colour (meaning ours or our parents) or a fixed - // one - virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); - - // this is a helper for the derived class GetClassDefaultAttributes() - // implementation: it returns the right colours for the classes which - // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of - // being simple controls (such as wxButton, wxCheckBox, ...) - static wxVisualAttributes - GetCompositeControlsDefaultAttributes(wxWindowVariant variant); - - // for controls like radiobuttons which are really composite this array - // holds the ids (not HWNDs!) of the sub controls - wxArrayLong m_subControls; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) -}; - -#endif // _WX_CONTROL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/crashrpt.h b/Source/3rdParty/wx/include/wx/msw/crashrpt.h deleted file mode 100644 index 3933a387d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/crashrpt.h +++ /dev/null @@ -1,120 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/crashrpt.h -// Purpose: helpers for the structured exception handling (SEH) under Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.07.2003 -// RCS-ID: $Id: crashrpt.h 34436 2005-05-31 09:20:43Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_CRASHRPT_H_ -#define _WX_MSW_CRASHRPT_H_ - -#include "wx/defs.h" - -#if wxUSE_CRASHREPORT - -struct _EXCEPTION_POINTERS; - -// ---------------------------------------------------------------------------- -// crash report generation flags -// ---------------------------------------------------------------------------- - -enum -{ - // we always report where the crash occurred - wxCRASH_REPORT_LOCATION = 0, - - // if this flag is given, the call stack is dumped - // - // this results in dump/crash report as small as possible, this is the - // default flag - wxCRASH_REPORT_STACK = 1, - - // if this flag is given, the values of the local variables are dumped - // - // note that with the current implementation it requires dumping the full - // process address space and so this will result in huge dump file and will - // take some time to generate - // - // it's probably not a good idea to use this by default, start with default - // mini dump and ask your users to set WX_CRASH_FLAGS environment variable - // to 2 or 4 if you need more information in the dump - wxCRASH_REPORT_LOCALS = 2, - - // if this flag is given, the values of all global variables are dumped - // - // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but - // still much smaller than wxCRASH_REPORT_LOCALS one - wxCRASH_REPORT_GLOBALS = 4, - - // default is to create the smallest possible crash report - wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK -}; - -// ---------------------------------------------------------------------------- -// wxCrashContext: information about the crash context -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxCrashContext -{ - // initialize this object with the given information or from the current - // global exception info which is only valid inside wxApp::OnFatalException - wxCrashContext(_EXCEPTION_POINTERS *ep = NULL); - - // get the name for this exception code - wxString GetExceptionString() const; - - - // exception code - size_t code; - - // exception address - void *addr; - - // machine-specific registers vaues - struct - { -#ifdef __INTEL__ - wxInt32 eax, ebx, ecx, edx, esi, edi, - ebp, esp, eip, - cs, ds, es, fs, gs, ss, - flags; -#endif // __INTEL__ - } regs; -}; - -// ---------------------------------------------------------------------------- -// wxCrashReport: this class is used to create crash reports -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxCrashReport -{ - // set the name of the file to which the report is written, it is - // constructed from the .exe name by default - static void SetFileName(const wxChar *filename); - - // return the current file name - static const wxChar *GetFileName(); - - // write the exception report to the file, return true if it could be done - // or false otherwise - // - // if ep pointer is NULL, the global exception info which is valid only - // inside wxApp::OnFatalException() is used - static bool Generate(int flags = wxCRASH_REPORT_DEFAULT, - _EXCEPTION_POINTERS *ep = NULL); - - - // generate a crash report from outside of wxApp::OnFatalException(), this - // can be used to take "snapshots" of the program in wxApp::OnAssert() for - // example - static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT); -}; - -#endif // wxUSE_CRASHREPORT - -#endif // _WX_MSW_CRASHRPT_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/cursor.h b/Source/3rdParty/wx/include/wx/msw/cursor.h deleted file mode 100644 index 3cf280d43..000000000 --- a/Source/3rdParty/wx/include/wx/msw/cursor.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/cursor.h -// Purpose: wxCursor class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: cursor.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CURSOR_H_ -#define _WX_CURSOR_H_ - -#include "wx/msw/gdiimage.h" - -class WXDLLIMPEXP_FWD_CORE wxImage; - -// Cursor -class WXDLLEXPORT wxCursor : public wxGDIImage -{ -public: - // constructors - wxCursor(); - wxCursor(const wxImage& image); - wxCursor(const char bits[], int width, int height, - int hotSpotX = -1, int hotSpotY = -1, - const char maskBits[] = NULL); - wxCursor(const wxString& name, - long flags = wxBITMAP_TYPE_CUR_RESOURCE, - int hotSpotX = 0, int hotSpotY = 0); - wxCursor(int idCursor); - virtual ~wxCursor(); - - // implementation only - void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } - WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } - -protected: - virtual wxGDIImageRefData *CreateData() const; - -private: - DECLARE_DYNAMIC_CLASS(wxCursor) -}; - -#endif - // _WX_CURSOR_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/dc.h b/Source/3rdParty/wx/include/wx/msw/dc.h deleted file mode 100644 index 97b1444fc..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dc.h +++ /dev/null @@ -1,345 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dc.h -// Purpose: wxDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dc.h 42612 2006-10-29 10:46:49Z SC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DC_H_ -#define _WX_MSW_DC_H_ - -#include "wx/defs.h" - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -#if wxUSE_DC_CACHEING -/* - * Cached blitting, maintaining a cache - * of bitmaps required for transparent blitting - * instead of constant creation/deletion - */ - -class wxDCCacheEntry: public wxObject -{ -public: - wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth); - wxDCCacheEntry(WXHDC hDC, int depth); - virtual ~wxDCCacheEntry(); - - WXHBITMAP m_bitmap; - WXHDC m_dc; - int m_width; - int m_height; - int m_depth; -}; -#endif - -// this is an ABC: use one of the derived classes to create a DC associated -// with a window, screen, printer and so on -class WXDLLEXPORT wxDC : public wxDCBase -{ -public: - wxDC(WXHDC hDC) { Init(); m_hDC = hDC; } - virtual ~wxDC(); - - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - virtual void SetSystemScale(double x, double y); - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); - - // implementation from now on - // -------------------------- - - virtual void SetRop(WXHDC cdc); - virtual void SelectOldObjects(WXHDC dc); - - wxWindow *GetWindow() const { return m_canvas; } - void SetWindow(wxWindow *win) - { - m_canvas = win; - -#if wxUSE_PALETTE - // if we have palettes use the correct one for this window - InitializePalette(); -#endif // wxUSE_PALETTE - } - - WXHDC GetHDC() const { return m_hDC; } - void SetHDC(WXHDC dc, bool bOwnsDC = false) - { - m_hDC = dc; - m_bOwnsDC = bOwnsDC; - - // we might have a pre existing clipping region, make sure that we - // return it if asked -- but avoid calling ::GetClipBox() right now as - // it could be unnecessary wasteful - m_clipping = true; - m_clipX1 = - m_clipX2 = 0; - } - - const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; } - wxBitmap& GetSelectedBitmap() { return m_selectedBitmap; } - - // update the internal clip box variables - void UpdateClipBox(); - -#if wxUSE_DC_CACHEING - static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h); - static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC); - - static void AddToBitmapCache(wxDCCacheEntry* entry); - static void AddToDCCache(wxDCCacheEntry* entry); - static void ClearCache(); -#endif - - // RTL related functions - // --------------------- - - // get or change the layout direction (LTR or RTL) for this dc, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const; - virtual void SetLayoutDirection(wxLayoutDirection dir); - -protected: - void Init() - { - m_canvas = NULL; - m_bOwnsDC = false; - m_hDC = NULL; - - m_oldBitmap = NULL; - m_oldPen = NULL; - m_oldBrush = NULL; - m_oldFont = NULL; - -#if wxUSE_PALETTE - m_oldPalette = NULL; -#endif // wxUSE_PALETTE - } - - // create an uninitialized DC: this should be only used by the derived - // classes - wxDC() { Init(); } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - - // this is gnarly - we can't even call this function DoSetClippingRegion() - // because of virtual function hiding - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) const; - - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } - - -#if wxUSE_PALETTE - // MSW specific, select a logical palette into the HDC - // (tell windows to translate pixel from other palettes to our custom one - // and vice versa) - // Realize tells it to also reset the system palette to this one. - void DoSelectPalette(bool realize = false); - - // Find out what palette our parent window has, then select it into the dc - void InitializePalette(); -#endif // wxUSE_PALETTE - - // common part of DoDrawText() and DoDrawRotatedText() - void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); - - // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() - void SetClippingHrgn(WXHRGN hrgn); - - // implementation of DoGetSize() for wxScreen/PrinterDC: this simply - // returns the size of the entire device this DC is associated with - // - // notice that we intentionally put it in a separate function instead of - // DoGetSize() itself because we want it to remain pure virtual both - // because each derived class should take care to define it as needed (this - // implementation is not at all always appropriate) and because we want - // wxDC to be an ABC to prevent it from being created directly - void GetDeviceSize(int *width, int *height) const; - - - // MSW-specific member variables - // ----------------------------- - - // the window associated with this DC (may be NULL) - wxWindow *m_canvas; - - wxBitmap m_selectedBitmap; - - // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it - bool m_bOwnsDC:1; - - // our HDC - WXHDC m_hDC; - - // Store all old GDI objects when do a SelectObject, so we can select them - // back in (this unselecting user's objects) so we can safely delete the - // DC. - WXHBITMAP m_oldBitmap; - WXHPEN m_oldPen; - WXHBRUSH m_oldBrush; - WXHFONT m_oldFont; - -#if wxUSE_PALETTE - WXHPALETTE m_oldPalette; -#endif // wxUSE_PALETTE - -#if wxUSE_DC_CACHEING - static wxList sm_bitmapCache; - static wxList sm_dcCache; -#endif - - DECLARE_DYNAMIC_CLASS(wxDC) - DECLARE_NO_COPY_CLASS(wxDC) -}; - -// ---------------------------------------------------------------------------- -// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets -// only/mainly) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCTemp : public wxDC -{ -public: - // construct a temporary DC with the specified HDC and size (it should be - // specified whenever we know it for this HDC) - wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) - : wxDC(hdc), - m_size(size) - { - } - - virtual ~wxDCTemp() - { - // prevent base class dtor from freeing it - SetHDC((WXHDC)NULL); - } - -protected: - virtual void DoGetSize(int *w, int *h) const - { - wxASSERT_MSG( m_size.IsFullySpecified(), - _T("size of this DC hadn't been set and is unknown") ); - - if ( w ) - *w = m_size.x; - if ( h ) - *h = m_size.y; - } - -private: - // size of this DC must be explicitly set by SetSize() as we have no way to - // find it ourselves - const wxSize m_size; - - DECLARE_NO_COPY_CLASS(wxDCTemp) -}; - -#endif // _WX_MSW_DC_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/dcclient.h b/Source/3rdParty/wx/include/wx/msw/dcclient.h deleted file mode 100644 index e01171e3e..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dcclient.h +++ /dev/null @@ -1,118 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dcclient.h -// Purpose: wxClientDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcclient.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCCLIENT_H_ -#define _WX_DCCLIENT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/dc.h" -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// array types -// ---------------------------------------------------------------------------- - -// this one if used by wxPaintDC only -struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo; - -WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); - -// ---------------------------------------------------------------------------- -// DC classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowDC : public wxDC -{ -public: - // default ctor - wxWindowDC(); - - // Create a DC corresponding to the whole window - wxWindowDC(wxWindow *win); - -protected: - // initialize the newly created DC - void InitDC(); - - // override some base class virtuals - virtual void DoGetSize(int *width, int *height) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC) -}; - -class WXDLLEXPORT wxClientDC : public wxWindowDC -{ -public: - // default ctor - wxClientDC(); - - // Create a DC corresponding to the client area of the window - wxClientDC(wxWindow *win); - - virtual ~wxClientDC(); - -protected: - void InitDC(); - - // override some base class virtuals - virtual void DoGetSize(int *width, int *height) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC) -}; - -class WXDLLEXPORT wxPaintDC : public wxClientDC -{ -public: - wxPaintDC(); - - // Create a DC corresponding for painting the window in OnPaint() - wxPaintDC(wxWindow *win); - - virtual ~wxPaintDC(); - - // find the entry for this DC in the cache (keyed by the window) - static WXHDC FindDCInCache(wxWindow* win); - -protected: - static wxArrayDCInfo ms_cache; - - // find the entry for this DC in the cache (keyed by the window) - wxPaintDCInfo *FindInCache(size_t *index = NULL) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC) -}; - -/* - * wxPaintDCEx - * This class is used when an application sends an HDC with the WM_PAINT - * message. It is used in HandlePaint and need not be used by an application. - */ - -class WXDLLEXPORT wxPaintDCEx : public wxPaintDC -{ -public: - wxPaintDCEx(wxWindow *canvas, WXHDC dc); - virtual ~wxPaintDCEx(); -private: - int saveState; - - DECLARE_CLASS(wxPaintDCEx) - DECLARE_NO_COPY_CLASS(wxPaintDCEx) -}; - -#endif - // _WX_DCCLIENT_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/dcmemory.h b/Source/3rdParty/wx/include/wx/msw/dcmemory.h deleted file mode 100644 index fced2bc4f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dcmemory.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcmemory.h -// Purpose: wxMemoryDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcmemory.h 48236 2007-08-20 23:43:32Z KO $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMEMORY_H_ -#define _WX_DCMEMORY_H_ - -#include "wx/dcclient.h" - -class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase -{ -public: - wxMemoryDC() { CreateCompatible(NULL); Init(); } - wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } - wxMemoryDC(wxDC *dc); // Create compatible DC - - -protected: - // override some base class virtuals - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoGetSize(int* width, int* height) const; - virtual void DoSelect(const wxBitmap& bitmap); - - virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} - - // create DC compatible with the given one or screen if dc == NULL - bool CreateCompatible(wxDC *dc); - - // initialize the newly created DC - void Init(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) -}; - -#endif - // _WX_DCMEMORY_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/dcprint.h b/Source/3rdParty/wx/include/wx/msw/dcprint.h deleted file mode 100644 index 948b52e45..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dcprint.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcprint.h -// Purpose: wxPrinterDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcprint.h 42522 2006-10-27 13:07:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DCPRINT_H_ -#define _WX_MSW_DCPRINT_H_ - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dc.h" -#include "wx/cmndata.h" - -class WXDLLEXPORT wxPrinterDC : public wxDC -{ -public: - // Create a printer DC (obsolete function: use wxPrintData version now) - wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT); - - // Create from print data - wxPrinterDC(const wxPrintData& data); - - wxPrinterDC(WXHDC theDC); - - // override some base class virtuals - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - virtual void StartPage(); - virtual void EndPage(); - - wxRect GetPaperRect(); - -protected: - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - virtual void DoGetSize(int *w, int *h) const - { - GetDeviceSize(w, h); - } - - - // init the dc - void Init(); - - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC) -}; - -// Gets an HDC for the default printer configuration -// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation); - -// Gets an HDC for the specified printer configuration -WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif // _WX_MSW_DCPRINT_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/dcscreen.h b/Source/3rdParty/wx/include/wx/msw/dcscreen.h deleted file mode 100644 index 89c83ae7f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dcscreen.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcscreen.h -// Purpose: wxScreenDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcscreen.h 36565 2005-12-25 12:52:53Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DCSCREEN_H_ -#define _WX_MSW_DCSCREEN_H_ - -#include "wx/dc.h" - -class WXDLLEXPORT wxScreenDC : public wxDC -{ -public: - // Create a DC representing the whole screen - wxScreenDC(); - - // Compatibility with X's requirements for drawing on top of all windows: - // they don't do anything under MSW - static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; } - static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; } - static bool EndDrawingOnTop() { return true; } - -protected: - virtual void DoGetSize(int *w, int *h) const - { - GetDeviceSize(w, h); - } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC) -}; - -#endif // _WX_MSW_DCSCREEN_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/dde.h b/Source/3rdParty/wx/include/wx/msw/dde.h deleted file mode 100644 index fe8f23c2f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dde.h +++ /dev/null @@ -1,144 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dde.h -// Purpose: DDE class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DDE_H_ -#define _WX_DDE_H_ - -#include "wx/ipcbase.h" - -/* - * Mini-DDE implementation - - Most transactions involve a topic name and an item name (choose these - as befits your application). - - A client can: - - - ask the server to execute commands (data) associated with a topic - - request data from server by topic and item - - poke data into the server - - ask the server to start an advice loop on topic/item - - ask the server to stop an advice loop - - A server can: - - - respond to execute, request, poke and advice start/stop - - send advise data to client - - Note that this limits the server in the ways it can send data to the - client, i.e. it can't send unsolicited information. - * - */ - -class WXDLLIMPEXP_FWD_BASE wxDDEServer; -class WXDLLIMPEXP_FWD_BASE wxDDEClient; - -class WXDLLIMPEXP_BASE wxDDEConnection: public wxConnectionBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEConnection) -public: - wxDDEConnection(wxChar *buffer, int size); // use external buffer - wxDDEConnection(); // use internal buffer - virtual ~wxDDEConnection(void); - - // Calls that CLIENT can make - virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } - virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); - virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual bool StartAdvise(const wxString& item); - virtual bool StopAdvise(const wxString& item); - - // Calls that SERVER can make - virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - - // Calls that both can make - virtual bool Disconnect(void); - - // Default behaviour is to delete connection and return true - virtual bool OnDisconnect(void); - - public: - wxString m_topicName; - wxDDEServer* m_server; - wxDDEClient* m_client; - - WXHCONV m_hConv; - wxChar* m_sendingData; - int m_dataSize; - wxIPCFormat m_dataType; - - DECLARE_NO_COPY_CLASS(wxDDEConnection) -}; - -class WXDLLIMPEXP_BASE wxDDEServer: public wxServerBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEServer) - public: - - wxDDEServer(void); - virtual ~wxDDEServer(void); - bool Create(const wxString& server_name); // Returns false if can't create server (e.g. port - // number is already in use) - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); - - //////////////////////////////////////////////////////////// - // Implementation - - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; } - inline wxDDEConnectionList& GetConnections(void) const - { - return (wxDDEConnectionList&) m_connections; - } - -protected: - int m_lastError; - wxString m_serviceName; - wxDDEConnectionList m_connections; -}; - -class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEClient) - public: - wxDDEClient(void); - virtual ~wxDDEClient(void); - bool ValidHost(const wxString& host); - virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); - // Call this to make a connection. - // Returns NULL if cannot. - virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection. - - //////////////////////////////////////////////////////////// - // Implementation - - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - - inline wxDDEConnectionList& GetConnections(void) const - { - return (wxDDEConnectionList&) m_connections; - } - -protected: - int m_lastError; - wxDDEConnectionList m_connections; -}; - -void WXDLLIMPEXP_BASE wxDDEInitialize(); -void WXDLLIMPEXP_BASE wxDDECleanUp(); - -#endif - // _WX_DDE_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/debughlp.h b/Source/3rdParty/wx/include/wx/msw/debughlp.h deleted file mode 100644 index 65ca85d82..000000000 --- a/Source/3rdParty/wx/include/wx/msw/debughlp.h +++ /dev/null @@ -1,228 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapdbgh.h -// Purpose: wraps dbghelp.h standard file -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-08 (extracted from msw/crashrpt.cpp) -// RCS-ID: $Id: debughlp.h 31443 2005-01-18 10:10:23Z ABX $ -// Copyright: (c) 2003-2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DEBUGHLPH_H_ -#define _WX_MSW_DEBUGHLPH_H_ - -#include "wx/dynlib.h" - -#include "wx/msw/wrapwin.h" -#ifndef __WXWINCE__ -#include -#endif // __WXWINCE__ -#include "wx/msw/private.h" - -// we need to determine whether we have the declarations for the function in -// debughlp.dll version 5.81 (at least) and we check for DBHLPAPI to test this -// -// reasons: -// - VC6 version of imagehlp.h doesn't define it -// - VC7 one does -// - testing for compiler version doesn't work as you can install and use -// the new SDK headers with VC6 -// -// in any case, the user may override by defining wxUSE_DBGHELP himself -#ifndef wxUSE_DBGHELP - #ifdef DBHLPAPI - #define wxUSE_DBGHELP 1 - #else - #define wxUSE_DBGHELP 0 - #endif -#endif - -#if wxUSE_DBGHELP - -// ---------------------------------------------------------------------------- -// wxDbgHelpDLL: dynamically load dbghelp.dll functions -// ---------------------------------------------------------------------------- - -// wrapper for some functions from dbghelp.dll -// -// MT note: this class is not MT safe and should be only used from a single -// thread at a time (this is so because dbghelp.dll is not MT-safe -// itself anyhow) -class wxDbgHelpDLL -{ -public: - // some useful constants not present in debughlp.h (stolen from DIA SDK) - enum BasicType - { - BASICTYPE_NOTYPE = 0, - BASICTYPE_VOID = 1, - BASICTYPE_CHAR = 2, - BASICTYPE_WCHAR = 3, - BASICTYPE_INT = 6, - BASICTYPE_UINT = 7, - BASICTYPE_FLOAT = 8, - BASICTYPE_BCD = 9, - BASICTYPE_BOOL = 10, - BASICTYPE_LONG = 13, - BASICTYPE_ULONG = 14, - BASICTYPE_CURRENCY = 25, - BASICTYPE_DATE = 26, - BASICTYPE_VARIANT = 27, - BASICTYPE_COMPLEX = 28, - BASICTYPE_BIT = 29, - BASICTYPE_BSTR = 30, - BASICTYPE_HRESULT = 31, - BASICTYPE_MAX - }; - - enum SymbolTag - { - SYMBOL_TAG_NULL, - SYMBOL_TAG_EXE, - SYMBOL_TAG_COMPILAND, - SYMBOL_TAG_COMPILAND_DETAILS, - SYMBOL_TAG_COMPILAND_ENV, - SYMBOL_TAG_FUNCTION, - SYMBOL_TAG_BLOCK, - SYMBOL_TAG_DATA, - SYMBOL_TAG_ANNOTATION, - SYMBOL_TAG_LABEL, - SYMBOL_TAG_PUBLIC_SYMBOL, - SYMBOL_TAG_UDT, - SYMBOL_TAG_ENUM, - SYMBOL_TAG_FUNCTION_TYPE, - SYMBOL_TAG_POINTER_TYPE, - SYMBOL_TAG_ARRAY_TYPE, - SYMBOL_TAG_BASE_TYPE, - SYMBOL_TAG_TYPEDEF, - SYMBOL_TAG_BASE_CLASS, - SYMBOL_TAG_FRIEND, - SYMBOL_TAG_FUNCTION_ARG_TYPE, - SYMBOL_TAG_FUNC_DEBUG_START, - SYMBOL_TAG_FUNC_DEBUG_END, - SYMBOL_TAG_USING_NAMESPACE, - SYMBOL_TAG_VTABLE_SHAPE, - SYMBOL_TAG_VTABLE, - SYMBOL_TAG_CUSTOM, - SYMBOL_TAG_THUNK, - SYMBOL_TAG_CUSTOM_TYPE, - SYMBOL_TAG_MANAGED_TYPE, - SYMBOL_TAG_DIMENSION, - SYMBOL_TAG_MAX - }; - - enum DataKind - { - DATA_UNKNOWN, - DATA_LOCAL, - DATA_STATIC_LOCAL, - DATA_PARAM, - DATA_OBJECT_PTR, // "this" pointer - DATA_FILE_STATIC, - DATA_GLOBAL, - DATA_MEMBER, - DATA_STATIC_MEMBER, - DATA_CONSTANT, - DATA_MAX - }; - - enum UdtKind - { - UDT_STRUCT, - UDT_CLASS, - UDT_UNION, - UDT_MAX - }; - - - // function types - typedef DWORD (WINAPI *SymGetOptions_t)(); - typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); - typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL); - typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, - LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, - PFUNCTION_TABLE_ACCESS_ROUTINE, - PGET_MODULE_BASE_ROUTINE, - PTRANSLATE_ADDRESS_ROUTINE); - typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); - typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); - typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, - PDWORD, PIMAGEHLP_LINE); - typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, - PIMAGEHLP_CONTEXT); - typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, - PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); - typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, - IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); - typedef BOOL (WINAPI *SymCleanup_t)(HANDLE); - typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID); - typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, - MINIDUMP_TYPE, - CONST PMINIDUMP_EXCEPTION_INFORMATION, - CONST PMINIDUMP_USER_STREAM_INFORMATION, - CONST PMINIDUMP_CALLBACK_INFORMATION); - - #define wxDO_FOR_ALL_SYM_FUNCS(what) \ - what(SymGetOptions); \ - what(SymSetOptions); \ - what(SymInitialize); \ - what(StackWalk); \ - what(SymFromAddr); \ - what(SymFunctionTableAccess); \ - what(SymGetModuleBase); \ - what(SymGetLineFromAddr); \ - what(SymSetContext); \ - what(SymEnumSymbols); \ - what(SymGetTypeInfo); \ - what(SymCleanup); \ - what(EnumerateLoadedModules); \ - what(MiniDumpWriteDump) - - #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func - - wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); - - #undef wxDECLARE_SYM_FUNCTION - - // load all functions from DLL, return true if ok - static bool Init(); - - // return the string with the error message explaining why Init() failed - static const wxString& GetErrorMessage(); - - // log error returned by the given function to debug output - static void LogError(const wxChar *func); - - // return textual representation of the value of given symbol - static wxString DumpSymbol(PSYMBOL_INFO pSymInfo, void *pVariable); - - // return the name of the symbol with given type index - static wxString GetSymbolName(PSYMBOL_INFO pSymInfo); - -private: - // dereference the given symbol, i.e. return symbol which is not a - // pointer/reference any more - // - // if ppData != NULL, dereference the pointer as many times as we - // dereferenced the symbol - // - // return the tag of the dereferenced symbol - static SymbolTag DereferenceSymbol(PSYMBOL_INFO pSymInfo, void **ppData); - - static wxString DumpField(PSYMBOL_INFO pSymInfo, - void *pVariable, - unsigned level); - - static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable); - - static wxString DumpUDT(PSYMBOL_INFO pSymInfo, - void *pVariable, - unsigned level = 0); -}; - -#endif // wxUSE_DBGHELP - -#endif // _WX_MSW_DEBUGHLPH_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/dialog.h b/Source/3rdParty/wx/include/wx/msw/dialog.h deleted file mode 100644 index 15f8ba10f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dialog.h +++ /dev/null @@ -1,140 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dialog.h -// Purpose: wxDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dialog.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALOG_H_ -#define _WX_DIALOG_H_ - -#include "wx/panel.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxDialogModalData; - -#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) -class WXDLLIMPEXP_FWD_CORE wxToolBar; -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; -#endif - -// Dialog boxes -class WXDLLEXPORT wxDialog : public wxDialogBase -{ -public: - wxDialog() { Init(); } - - // full ctor - wxDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - virtual ~wxDialog(); - - // return true if we're showing the dialog modally - virtual bool IsModal() const { return m_modalData != NULL; } - - // show the dialog modally and return the value passed to EndModal() - virtual int ShowModal(); - - // may be called to terminate the dialog with the given return code - virtual void EndModal(int retCode); - - - // we treat dialog toolbars specially under Windows CE -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - // create main toolbar by calling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // return a new toolbar - virtual wxToolBar *OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name ); - - // get the main toolbar - wxToolBar *GetToolBar() const { return m_dialogToolBar; } -#endif // wxUSE_TOOLBAR && __POCKETPC__ - - - // implementation only from now on - // ------------------------------- - - // override some base class virtuals - virtual bool Show(bool show = true); - - virtual void Raise(); - -#ifdef __POCKETPC__ - // Responds to the OK button in a PocketPC titlebar. This - // can be overridden, or you can change the id used for - // sending the event with SetAffirmativeId. Returns false - // if the event was not processed. - virtual bool DoOK(); -#endif - - // Windows callbacks - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -#if WXWIN_COMPATIBILITY_2_6 - // use the other ctor - wxDEPRECATED( wxDialog(wxWindow *parent, - const wxString& title, bool modal, - int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) ); - - // just call Show() or ShowModal() - wxDEPRECATED( void SetModal(bool flag) ); - - // use IsModal() - wxDEPRECATED( bool IsModalShowing() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // find the window to use as parent for this dialog if none has been - // specified explicitly by the user - // - // may return NULL - wxWindow *FindSuitableParent() const; - - // common part of all ctors - void Init(); - -private: - wxWindow* m_oldFocus; - bool m_endModalCalled; // allow for closing within InitDialog - -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - wxToolBar* m_dialogToolBar; -#endif - - // this pointer is non-NULL only while the modal event loop is running - wxDialogModalData *m_modalData; - - DECLARE_DYNAMIC_CLASS(wxDialog) - DECLARE_NO_COPY_CLASS(wxDialog) -}; - -#endif - // _WX_DIALOG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/dib.h b/Source/3rdParty/wx/include/wx/msw/dib.h deleted file mode 100644 index 71ae02bb7..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dib.h +++ /dev/null @@ -1,255 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dib.h -// Purpose: wxDIB class representing Win32 device independent bitmaps -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.03.03 (replaces the old file with the same name) -// RCS-ID: $Id: dib.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1997-2003 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DIB_H_ -#define _WX_MSW_DIB_H_ - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -#include "wx/msw/private.h" - -#if wxUSE_WXDIB - -// ---------------------------------------------------------------------------- -// wxDIB: represents a DIB section -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDIB -{ -public: - // ctors and such - // -------------- - - // create an uninitialized DIB with the given width, height and depth (only - // 24 and 32 bpp DIBs are currently supported) - // - // after using this ctor, GetData() and GetHandle() may be used if IsOk() - // returns true - wxDIB(int width, int height, int depth) - { Init(); (void)Create(width, height, depth); } - - // create a DIB from the DDB - wxDIB(const wxBitmap& bmp) - { Init(); (void)Create(bmp); } - - // create a DIB from the Windows DDB - wxDIB(HBITMAP hbmp) - { Init(); (void)Create(hbmp); } - - // load a DIB from file (any depth is supoprted here unlike above) - // - // as above, use IsOk() to see if the bitmap was loaded successfully - wxDIB(const wxString& filename) - { Init(); (void)Load(filename); } - - // same as the corresponding ctors but with return value - bool Create(int width, int height, int depth); - bool Create(const wxBitmap& bmp); - bool Create(HBITMAP hbmp); - bool Load(const wxString& filename); - - // dtor is not virtual, this class is not meant to be used polymorphically - ~wxDIB(); - - - // operations - // ---------- - -#ifndef __WXWINCE__ - // create a bitmap compatible with the given HDC (or screen by default) and - // return its handle, the caller is responsible for freeing it (using - // DeleteObject()) - HBITMAP CreateDDB(HDC hdc = 0) const; -#endif // !__WXWINCE__ - - // get the handle from the DIB and reset it, i.e. this object won't destroy - // the DIB after this (but the caller should do it) - HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } - -#if wxUSE_PALETTE - // create a palette for this DIB (always a trivial/default one for 24bpp) - wxPalette *CreatePalette() const; -#endif // wxUSE_PALETTE - - // save the DIB as a .BMP file to the file with the given name - bool Save(const wxString& filename); - - - // accessors - // --------- - - // return true if DIB was successfully created, false otherwise - bool IsOk() const { return m_handle != 0; } - - // get the bitmap size - wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } - int GetWidth() const { DoGetObject(); return m_width; } - int GetHeight() const { DoGetObject(); return m_height; } - - // get the number of bits per pixel, or depth - int GetDepth() const { DoGetObject(); return m_depth; } - - // get the DIB handle - HBITMAP GetHandle() const { return m_handle; } - - // get raw pointer to bitmap bits, you should know what you do if you - // decide to use it - unsigned char *GetData() const - { DoGetObject(); return (unsigned char *)m_data; } - - - // HBITMAP conversion - // ------------------ - - // these functions are only used by wxWidgets internally right now, please - // don't use them directly if possible as they're subject to change - -#ifndef __WXWINCE__ - // creates a DDB compatible with the given (or screen) DC from either - // a plain DIB or a DIB section (in which case the last parameter must be - // non NULL) - static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, - HDC hdc = 0, - void *bits = NULL); - - // create a plain DIB (not a DIB section) from a DDB, the caller is - // responsable for freeing it using ::GlobalFree() - static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); - - // creates a DIB from the given DDB or calculates the space needed by it: - // if pbi is NULL, only the space is calculated, otherwise pbi is supposed - // to point at BITMAPINFO of the correct size which is filled by this - // function (this overload is needed for wxBitmapDataObject code in - // src/msw/ole/dataobj.cpp) - static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); -#endif // __WXWINCE__ - - - // wxImage conversion - // ------------------ - -#if wxUSE_IMAGE - // create a DIB from the given image, the DIB will be either 24 or 32 (if - // the image has alpha channel) bpp - wxDIB(const wxImage& image) { Init(); (void)Create(image); } - - // same as the above ctor but with the return code - bool Create(const wxImage& image); - - // create wxImage having the same data as this DIB - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - - - // helper functions - // ---------------- - - // return the size of one line in a DIB with given width and depth: the - // point here is that as the scan lines need to be DWORD aligned so we may - // need to add some padding - static unsigned long GetLineSize(int width, int depth) - { - return ((width*depth + 31) & ~31) >> 3; - } - -private: - // common part of all ctors - void Init(); - - // free resources - void Free(); - - // initialize the contents from the provided DDB (Create() must have been - // already called) - bool CopyFromDDB(HBITMAP hbmp); - - - // the DIB section handle, 0 if invalid - HBITMAP m_handle; - - // NB: we could store only m_handle and not any of the other fields as - // we may always retrieve them from it using ::GetObject(), but we - // decide to still store them for efficiency concerns -- however if we - // don't have them from the very beginning (e.g. DIB constructed from a - // bitmap), we only retrieve them when necessary and so these fields - // should *never* be accessed directly, even from inside wxDIB code - - // function which must be called before accessing any members and which - // gets their values from m_handle, if not done yet - void DoGetObject() const; - - // pointer to DIB bits, may be NULL - void *m_data; - - // size and depth of the image - int m_width, - m_height, - m_depth; - - // in some cases we could be using a handle which we didn't create and in - // this case we shouldn't free it neither -- this flag tell us if this is - // the case - bool m_ownsHandle; - - // if true, we have alpha, if false we don't (note that we can still have - // m_depth == 32 but the last component is then simply padding and not - // alpha) - bool m_hasAlpha; - - - // DIBs can't be copied - wxDIB(const wxDIB&); - wxDIB& operator=(const wxDIB&); -}; - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -inline -void wxDIB::Init() -{ - m_handle = 0; - m_ownsHandle = true; - m_hasAlpha = false; - - m_data = NULL; - - m_width = - m_height = - m_depth = 0; -} - -inline -void wxDIB::Free() -{ - if ( m_handle && m_ownsHandle ) - { - if ( !::DeleteObject(m_handle) ) - { - wxLogLastError(wxT("DeleteObject(hDIB)")); - } - - Init(); - } -} - -inline wxDIB::~wxDIB() -{ - Free(); -} - -#endif - // wxUSE_WXDIB - -#endif // _WX_MSW_DIB_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/dirdlg.h b/Source/3rdParty/wx/include/wx/msw/dirdlg.h deleted file mode 100644 index 8e27d57e3..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dirdlg.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dirdlg.h -// Purpose: wxDirDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dirdlg.h 38956 2006-04-30 09:44:29Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRDLG_H_ -#define _WX_DIRDLG_H_ - -class WXDLLEXPORT wxDirDialog : public wxDirDialogBase -{ -public: - wxDirDialog(wxWindow *parent, - const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxDirDialogNameStr); - - void SetPath(const wxString& path); - - virtual int ShowModal(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) -}; - -#endif - // _WX_DIRDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/dragimag.h b/Source/3rdParty/wx/include/wx/msw/dragimag.h deleted file mode 100644 index ce944200e..000000000 --- a/Source/3rdParty/wx/include/wx/msw/dragimag.h +++ /dev/null @@ -1,274 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dragimag.h -// Purpose: wxDragImage class: a kind of a cursor, that can cope -// with more sophisticated images -// Author: Julian Smart -// Modified by: -// Created: 08/04/99 -// RCS-ID: $Id: dragimag.h 45845 2007-05-05 19:00:35Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAGIMAG_H_ -#define _WX_DRAGIMAG_H_ - -#if wxUSE_DRAGIMAGE - -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/treectrl.h" -#include "wx/listctrl.h" - -// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage -#define wxUSE_SIMPLER_DRAGIMAGE 0 - -/* - To use this class, create a wxDragImage when you start dragging, for example: - - void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) - { -#ifdef __WXMSW__ - ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets -#endif - - CaptureMouse(); - - m_dragImage = new wxDragImage(* this, itemId); - m_dragImage->BeginDrag(wxPoint(0, 0), this); - m_dragImage->Move(pt, this); - m_dragImage->Show(this); - ... - } - - In your OnMouseMove function, hide the image, do any display updating required, - then move and show the image again: - - void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) - { - if (m_dragMode == MY_TREE_DRAG_NONE) - { - event.Skip(); - return; - } - - // Prevent screen corruption by hiding the image - if (m_dragImage) - m_dragImage->Hide(this); - - // Do some updating of the window, such as highlighting the drop target - ... - -#ifdef __WXMSW__ - if (updateWindow) - ::UpdateWindow((HWND) GetHWND()); -#endif - - // Move and show the image again - m_dragImage->Move(event.GetPosition(), this); - m_dragImage->Show(this); - } - - Eventually we end the drag and delete the drag image. - - void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) - { - ... - - // End the drag and delete the drag image - if (m_dragImage) - { - m_dragImage->EndDrag(this); - delete m_dragImage; - m_dragImage = NULL; - } - ReleaseMouse(); - } -*/ - -/* - Notes for Unix version: - Can we simply use cursors instead, creating a cursor dynamically, setting it into the window - in BeginDrag, and restoring the old cursor in EndDrag? - For a really bog-standard implementation, we could simply use a normal dragging cursor - and ignore the image. -*/ - -/* - * wxDragImage - */ - -class WXDLLEXPORT wxDragImage: public wxObject -{ -public: - - // Ctors & dtor - //////////////////////////////////////////////////////////////////////////// - - wxDragImage(); - wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - - wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - - wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(str, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(str, cursor, cursorHotspot); - } - -#if wxUSE_TREECTRL - wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) - { - Init(); - - Create(treeCtrl, id); - } -#endif - -#if wxUSE_LISTCTRL - wxDragImage(const wxListCtrl& listCtrl, long id) - { - Init(); - - Create(listCtrl, id); - } -#endif - - virtual ~wxDragImage(); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Create a drag image from a bitmap and optional cursor - bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } - - // Create a drag image from an icon and optional cursor - bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } - - // Create a drag image from a string and optional cursor - bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); - bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(str, cursor); - } - -#if wxUSE_TREECTRL - // Create a drag image for the given tree control item - bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); -#endif - -#if wxUSE_LISTCTRL - // Create a drag image for the given list control item - bool Create(const wxListCtrl& listCtrl, long id); -#endif - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. This is full screen only. fullScreenRect gives the - // position of the window on the screen, to restrict the drag to. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); - - // End drag - bool EndDrag(); - - // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. - bool Move(const wxPoint& pt); - - // Show the image - bool Show(); - - // Hide the image - bool Hide(); - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - // Initialize variables - void Init(); - - // Returns the native image list handle - WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } - -#if !wxUSE_SIMPLER_DRAGIMAGE - // Returns the native image list handle for the cursor - WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } -#endif - -protected: - WXHIMAGELIST m_hImageList; - -#if wxUSE_SIMPLER_DRAGIMAGE - wxCursor m_oldCursor; -#else - WXHIMAGELIST m_hCursorImageList; -#endif - - wxCursor m_cursor; -// wxPoint m_cursorHotspot; // Obsolete - wxPoint m_position; - wxWindow* m_window; - wxRect m_boundingRect; - bool m_fullScreen; - -private: - DECLARE_DYNAMIC_CLASS(wxDragImage) - DECLARE_NO_COPY_CLASS(wxDragImage) -}; - -#endif // wxUSE_DRAGIMAGE -#endif - // _WX_DRAGIMAG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/enhmeta.h b/Source/3rdParty/wx/include/wx/msw/enhmeta.h deleted file mode 100644 index 59631b5af..000000000 --- a/Source/3rdParty/wx/include/wx/msw/enhmeta.h +++ /dev/null @@ -1,196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/enhmeta.h -// Purpose: wxEnhMetaFile class for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.01.00 -// RCS-ID: $Id: enhmeta.h 60850 2009-06-01 10:16:13Z JS $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_ENHMETA_H_ -#define _WX_MSW_ENHMETA_H_ - -#include "wx/dc.h" - -#if wxUSE_DRAG_AND_DROP - #include "wx/dataobj.h" -#endif - -// Change this to 1 if you set wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW to 1 in prntbase.cpp -#define wxUSE_ENH_METAFILE_FROM_DC 0 - -// ---------------------------------------------------------------------------- -// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFile : public wxObject -{ -public: - wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) - { Init(); } - wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxObject() - { Init(); Assign(metafile); } - wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) - { Free(); Assign(metafile); return *this; } - - virtual ~wxEnhMetaFile() - { Free(); } - - // display the picture stored in the metafile on the given DC - bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL); - - // accessors - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_hMF != 0; } - - wxSize GetSize() const; - int GetWidth() const { return GetSize().x; } - int GetHeight() const { return GetSize().y; } - - const wxString& GetFileName() const { return m_filename; } - - // copy the metafile to the clipboard: the width and height parameters are - // for backwards compatibility (with wxMetaFile) only, they are ignored by - // this method - bool SetClipboard(int width = 0, int height = 0); - - // implementation - WXHANDLE GetHENHMETAFILE() const { return m_hMF; } - void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } - -protected: - void Init(); - void Free(); - void Assign(const wxEnhMetaFile& mf); - -private: - wxString m_filename; - WXHANDLE m_hMF; - - DECLARE_DYNAMIC_CLASS(wxEnhMetaFile) -}; - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileDC: allows to create a wxEnhMetaFile -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFileDC : public wxDC -{ -public: - // the ctor parameters specify the filename (empty for memory metafiles), - // the metafile picture size and the optional description/comment - wxEnhMetaFileDC(const wxString& filename = wxEmptyString, - int width = 0, int height = 0, - const wxString& description = wxEmptyString); - -#if wxUSE_ENH_METAFILE_FROM_DC - // as above, but takes reference DC as first argument to take resolution, - // size, font metrics etc. from - wxEnhMetaFileDC(const wxDC& referenceDC, - const wxString& filename = wxEmptyString, - int width = 0, int height = 0, - const wxString& description = wxEmptyString); -#endif - - virtual ~wxEnhMetaFileDC(); - - // obtain a pointer to the new metafile (caller should delete it) - wxEnhMetaFile *Close(); - -protected: - virtual void DoGetSize(int *width, int *height) const; - -private: - // size passed to ctor and returned by DoGetSize() - int m_width, - m_height; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) -}; - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile -// ---------------------------------------------------------------------------- - -// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and -// so we derive from wxDataObject and not from wxDataObjectSimple -class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject -{ -public: - // ctors - wxEnhMetaFileDataObject() { } - wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile) - : m_metafile(metafile) { } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual void SetMetafile(const wxEnhMetaFile& metafile) - { m_metafile = metafile; } - virtual wxEnhMetaFile GetMetafile() const - { return m_metafile; } - - // implement base class pure virtuals - virtual wxDataFormat GetPreferredFormat(Direction dir) const; - virtual size_t GetFormatCount(Direction dir) const; - virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const; - virtual size_t GetDataSize(const wxDataFormat& format) const; - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; - virtual bool SetData(const wxDataFormat& format, size_t len, - const void *buf); - -protected: - wxEnhMetaFile m_metafile; - - DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject) -}; - - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which -// makes it more convenient to use (it can be used with wxDataObjectComposite) -// at the price of not supoprting any more CF_METAFILEPICT but only -// CF_ENHMETAFILE -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple -{ -public: - // ctors - wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { } - wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile) - : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual void SetEnhMetafile(const wxEnhMetaFile& metafile) - { m_metafile = metafile; } - virtual wxEnhMetaFile GetEnhMetafile() const - { return m_metafile; } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -protected: - wxEnhMetaFile m_metafile; - - DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject) -}; - -#endif // wxUSE_DRAG_AND_DROP - -#endif // _WX_MSW_ENHMETA_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/evtloop.h b/Source/3rdParty/wx/include/wx/msw/evtloop.h deleted file mode 100644 index d6f4312ac..000000000 --- a/Source/3rdParty/wx/include/wx/msw/evtloop.h +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/evtloop.h -// Purpose: wxEventLoop class for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-07-31 -// RCS-ID: $Id: evtloop.h 36881 2006-01-15 10:13:40Z ABX $ -// Copyright: (c) 2003-2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_EVTLOOP_H_ -#define _WX_MSW_EVTLOOP_H_ - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxEventLoop -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEventLoop : public wxEventLoopManual -{ -public: - wxEventLoop(); - - // implement base class pure virtuals - virtual bool Pending() const; - virtual bool Dispatch(); - - // MSW-specific methods - // -------------------- - - // preprocess a message, return true if processed (i.e. no further - // dispatching required) - virtual bool PreProcessMessage(WXMSG *msg); - - // process a single message - virtual void ProcessMessage(WXMSG *msg); - - // set the critical window: this is the window such that all the events - // except those to this window (and its children) stop to be processed - // (typical examples: assert or crash report dialog) - // - // calling this function with NULL argument restores the normal event - // handling - static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } - - // return true if there is no critical window or if this window is [a child - // of] the critical one - static bool AllowProcessing(wxWindowMSW *win) - { - return !ms_winCritical || IsChildOfCriticalWindow(win); - } - -protected: - // override/implement base class virtuals - virtual void WakeUp(); - virtual void OnNextIteration(); - - // check if the given window is a child of ms_winCritical (which must be - // non NULL) - static bool IsChildOfCriticalWindow(wxWindowMSW *win); - - - // critical window or NULL - static wxWindowMSW *ms_winCritical; -}; - -#endif // _WX_MSW_EVTLOOP_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/fdrepdlg.h b/Source/3rdParty/wx/include/wx/msw/fdrepdlg.h deleted file mode 100644 index 1e534ae85..000000000 --- a/Source/3rdParty/wx/include/wx/msw/fdrepdlg.h +++ /dev/null @@ -1,62 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fdrepdlg.h -// Purpose: wxFindReplaceDialog class -// Author: Markus Greither -// Modified by: 31.07.01: VZ: integrated into wxWidgets -// Created: 23/03/2001 -// RCS-ID: -// Copyright: (c) Markus Greither -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_FDREPDLG_H_ -#define _WX_MSW_FDREPDLG_H_ - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialog: dialog for searching / replacing text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceDialog : public wxFindReplaceDialogBase -{ -public: - // ctors and such - wxFindReplaceDialog() { Init(); } - wxFindReplaceDialog(wxWindow *parent, - wxFindReplaceData *data, - const wxString &title, - int style = 0); - - bool Create(wxWindow *parent, - wxFindReplaceData *data, - const wxString &title, - int style = 0); - - virtual ~wxFindReplaceDialog(); - - // implementation only from now on - - wxFindReplaceDialogImpl *GetImpl() const { return m_impl; } - - // override some base class virtuals - virtual bool Show(bool show = true); - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - -protected: - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - void Init(); - - wxString m_title; - - wxFindReplaceDialogImpl *m_impl; - - DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) - DECLARE_NO_COPY_CLASS(wxFindReplaceDialog) -}; - -#endif // _WX_MSW_FDREPDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/filedlg.h b/Source/3rdParty/wx/include/wx/msw/filedlg.h deleted file mode 100644 index 4608a2ed9..000000000 --- a/Source/3rdParty/wx/include/wx/msw/filedlg.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/filedlg.h -// Purpose: wxFileDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: filedlg.h 39402 2006-05-28 23:32:12Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDLG_H_ -#define _WX_FILEDLG_H_ - -//------------------------------------------------------------------------- -// wxFileDialog -//------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDialog: public wxFileDialogBase -{ -public: - wxFileDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr); - - virtual void SetPath(const wxString& path); - virtual void GetPaths(wxArrayString& paths) const; - virtual void GetFilenames(wxArrayString& files) const; - - virtual int ShowModal(); - -protected: - -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetPosition( int *x, int *y ) const; -#endif // !(__SMARTPHONE__ && __WXWINCE__) - -private: - wxArrayString m_fileNames; - bool m_bMovedWindow; - - DECLARE_DYNAMIC_CLASS(wxFileDialog) - DECLARE_NO_COPY_CLASS(wxFileDialog) -}; - -#endif // _WX_FILEDLG_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/font.h b/Source/3rdParty/wx/include/wx/msw/font.h deleted file mode 100644 index 925355dfb..000000000 --- a/Source/3rdParty/wx/include/wx/msw/font.h +++ /dev/null @@ -1,148 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/font.h -// Purpose: wxFont class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: font.h 39411 2006-05-29 00:03:36Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONT_H_ -#define _WX_FONT_H_ - -#include "wx/gdicmn.h" - -// ---------------------------------------------------------------------------- -// wxFont -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFont : public wxFontBase -{ -public: - // ctors and such - wxFont() { } - - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, family, style, weight, underlined, face, encoding); - } - - wxFont(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(pixelSize, family, style, weight, - underlined, face, encoding); - } - - wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) - { - Create(info, hFont); - } - - wxFont(const wxString& fontDesc); - - bool Create(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - return DoCreate(size, wxDefaultSize, false, family, style, - weight, underlined, face, encoding); - } - - bool Create(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - return DoCreate(-1, pixelSize, true, family, style, - weight, underlined, face, encoding); - } - - bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); - - virtual ~wxFont(); - - // wxFontBase overridden functions - virtual wxString GetNativeFontInfoDesc() const; - virtual wxString GetNativeFontInfoUserDesc() const; - - // implement base class pure virtuals - virtual int GetPointSize() const; - virtual wxSize GetPixelSize() const; - virtual bool IsUsingSizeInPixels() const; - virtual int GetFamily() const; - virtual int GetStyle() const; - virtual int GetWeight() const; - virtual bool GetUnderlined() const; - virtual wxString GetFaceName() const; - virtual wxFontEncoding GetEncoding() const; - virtual const wxNativeFontInfo *GetNativeFontInfo() const; - - virtual void SetPointSize(int pointSize); - virtual void SetPixelSize(const wxSize& pixelSize); - virtual void SetFamily(int family); - virtual void SetStyle(int style); - virtual void SetWeight(int weight); - virtual bool SetFaceName(const wxString& faceName); - virtual void SetUnderlined(bool underlined); - virtual void SetEncoding(wxFontEncoding encoding); - - virtual bool IsFixedWidth() const; - - // implementation only from now on - // ------------------------------- - - virtual bool IsFree() const; - virtual bool RealizeResource(); - virtual WXHANDLE GetResourceHandle() const; - virtual bool FreeResource(bool force = false); - - // for consistency with other wxMSW classes - WXHFONT GetHFONT() const; - - /* - virtual bool UseResource(); - virtual bool ReleaseResource(); - */ - -protected: - // real font creation function, used in all cases - bool DoCreate(int size, - const wxSize& pixelSize, - bool sizeUsingPixels, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - - void Unshare(); - -private: - DECLARE_DYNAMIC_CLASS(wxFont) -}; - -#endif // _WX_FONT_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/fontdlg.h b/Source/3rdParty/wx/include/wx/msw/fontdlg.h deleted file mode 100644 index f3c3562d3..000000000 --- a/Source/3rdParty/wx/include/wx/msw/fontdlg.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fontdlg.h -// Purpose: wxFontDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: fontdlg.h 38448 2006-03-30 14:04:17Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_FONTDLG_H_ -#define _WX_MSW_FONTDLG_H_ - -// ---------------------------------------------------------------------------- -// wxFontDialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontDialog : public wxFontDialogBase -{ -public: - wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } - wxFontDialog(wxWindow *parent) - : wxFontDialogBase(parent) { Create(parent); } - wxFontDialog(wxWindow *parent, const wxFontData& data) - : wxFontDialogBase(parent, data) { Create(parent, data); } - - virtual int ShowModal(); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use - wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) -}; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use -inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data) - : wxFontDialogBase(parent) { InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif - // _WX_MSW_FONTDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/frame.h b/Source/3rdParty/wx/include/wx/msw/frame.h deleted file mode 100644 index dc3a58be5..000000000 --- a/Source/3rdParty/wx/include/wx/msw/frame.h +++ /dev/null @@ -1,172 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/frame.h -// Purpose: wxFrame class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: frame.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FRAME_H_ -#define _WX_FRAME_H_ - -class WXDLLEXPORT wxFrame : public wxFrameBase -{ -public: - // construction - wxFrame() { Init(); } - wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxFrame(); - - // implement base class pure virtuals - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual void Raise(); - - // implementation only from now on - // ------------------------------- - - // event handlers - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Toolbar -#if wxUSE_TOOLBAR - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID id = wxID_ANY, - const wxString& name = wxToolBarNameStr); -#endif // wxUSE_TOOLBAR - - // Status bar -#if wxUSE_STATUSBAR - virtual wxStatusBar* OnCreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP, - wxWindowID id = 0, - const wxString& name = wxStatusLineNameStr); - - // Hint to tell framework which status bar to use: the default is to use - // native one for the platforms which support it (Win32), the generic one - // otherwise - - // TODO: should this go into a wxFrameworkSettings class perhaps? - static void UseNativeStatusBar(bool useNative) - { m_useNativeStatusBar = useNative; } - static bool UsesNativeStatusBar() - { return m_useNativeStatusBar; } -#endif // wxUSE_STATUSBAR - -#if wxUSE_MENUS - WXHMENU GetWinMenu() const { return m_hMenu; } -#endif // wxUSE_MENUS - - // event handlers - bool HandlePaint(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); - - // tooltip management -#if wxUSE_TOOLTIPS - WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } - void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } -#endif // tooltips - - // a MSW only function which sends a size event to the window using its - // current size - this has an effect of refreshing the window layout - virtual void SendSizeEvent(); - - virtual wxPoint GetClientAreaOrigin() const; - - // override base class version to add menu bar accel processing - virtual bool MSWTranslateMessage(WXMSG *msg) - { - return MSWDoTranslateMessage(this, msg); - } - - // window proc for the frames - virtual WXLRESULT MSWWindowProc(WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // override base class virtuals - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); - -#if wxUSE_MENUS_NATIVE - // perform MSW-specific action when menubar is changed - virtual void AttachMenuBar(wxMenuBar *menubar); - - // a plug in for MDI frame classes which need to do something special when - // the menubar is set - virtual void InternalSetMenuBar(); -#endif // wxUSE_MENUS_NATIVE - - // propagate our state change to all child frames - void IconizeChildFrames(bool bIconize); - - // the real implementation of MSWTranslateMessage(), also used by - // wxMDIChildFrame - bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); - - // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN - bool HandleInitMenuPopup(WXHMENU hMenu); - - virtual bool IsMDIChild() const { return false; } - - // get default (wxWidgets) icon for the frame - virtual WXHICON GetDefaultIcon() const; - -#if wxUSE_TOOLBAR - virtual void PositionToolBar(); -#endif // wxUSE_TOOLBAR - -#if wxUSE_STATUSBAR - virtual void PositionStatusBar(); - - static bool m_useNativeStatusBar; -#endif // wxUSE_STATUSBAR - -#if wxUSE_MENUS - // frame menu, NULL if none - WXHMENU m_hMenu; -#endif // wxUSE_MENUS - -private: -#if wxUSE_TOOLTIPS - WXHWND m_hwndToolTip; -#endif // tooltips - - // used by IconizeChildFrames(), see comments there - bool m_wasMinimized; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) -}; - -#endif - // _WX_FRAME_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/gauge95.h b/Source/3rdParty/wx/include/wx/msw/gauge95.h deleted file mode 100644 index c6c74df20..000000000 --- a/Source/3rdParty/wx/include/wx/msw/gauge95.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: gauge95.h -// Purpose: wxGauge95 class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: gauge95.h 43881 2006-12-09 19:48:21Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _GAUGE95_H_ -#define _GAUGE95_H_ - -#if wxUSE_GAUGE - -extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; - -// Group box -class WXDLLEXPORT wxGauge95 : public wxGaugeBase -{ -public: - wxGauge95() { } - - wxGauge95(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - (void)Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // set gauge range/value - virtual void SetRange(int range); - virtual void SetValue(int pos); - - // overriden base class virtuals - virtual bool SetForegroundColour(const wxColour& col); - virtual bool SetBackgroundColour(const wxColour& col); - - - void SetIndeterminateMode(); - void SetDeterminateMode(); - void Pulse(); - - WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge95) -}; - -#endif // wxUSE_GAUGE - -#endif - // _GAUGEMSW_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/gccpriv.h b/Source/3rdParty/wx/include/wx/msw/gccpriv.h deleted file mode 100644 index db4c72a84..000000000 --- a/Source/3rdParty/wx/include/wx/msw/gccpriv.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Name: wx/msw/gccpriv.h - Purpose: MinGW/Cygwin definitions - Author: Vadim Zeitlin - Modified by: - Created: - RCS-ID: $Id: gccpriv.h 36155 2005-11-10 16:16:05Z ABX $ - Copyright: (c) Vadim Zeitlin - Licence: wxWindows Licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MSW_GCCPRIV_H_ -#define _WX_MSW_GCCPRIV_H_ - -#if defined(__MINGW32__) && !defined(__GNUWIN32__) - #define __GNUWIN32__ -#endif - -#if defined(__MINGW32__) && ( ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) ) - #include <_mingw.h> -#endif - -#if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H ) - #if __MINGW32_MAJOR_VERSION >= 1 - #define HAVE_W32API_H - #endif -#elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H ) - #if ( __GNUC__ > 2 ) - #define HAVE_W32API_H - #endif -#endif - -#if wxCHECK_WATCOM_VERSION(1,0) - #define HAVE_W32API_H -#endif - -/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ -#if defined( HAVE_W32API_H ) -#include -#endif - -/* Watcom can't handle defined(xxx) here: */ -#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) - #define wxCHECK_W32API_VERSION( major, minor ) \ - ( ( ( __W32API_MAJOR_VERSION > (major) ) \ - || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) ) -#else - #define wxCHECK_W32API_VERSION( major, minor ) (0) -#endif - -/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which - are more ms-like (header author is Anders Norlander, hence the name) */ -#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95))) - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 1 - #endif -#else - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 0 - #endif -#endif - -/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the - standard Win32 headers and we define the used stuff ourselves for it - in wx/msw/gnuwin32/extra.h */ -#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS - #define __GNUWIN32_OLD__ -#endif - -/* Cygwin 1.0 */ -#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) - #define __CYGWIN10__ -#endif - -/* Check for Mingw runtime version: */ -#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION) - #define wxCHECK_MINGW32_VERSION( major, minor ) \ - ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ - || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) -#else - #define wxCHECK_MINGW32_VERSION( major, minor ) (0) -#endif - -/* Mingw runtime 1.0-20010604 has some missing _tXXXX functions, - so let's define them ourselves: */ -#if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \ - && !wxCHECK_W32API_VERSION( 1, 1 ) - #ifndef _tsetlocale - #if wxUSE_UNICODE - #define _tsetlocale _wsetlocale - #else - #define _tsetlocale setlocale - #endif - #endif - #ifndef _tgetenv - #if wxUSE_UNICODE - #define _tgetenv _wgetenv - #else - #define _tgetenv getenv - #endif - #endif - #ifndef _tfopen - #if wxUSE_UNICODE - #define _tfopen _wfopen - #else - #define _tfopen fopen - #endif - #endif -#endif - -/* current (= before mingw-runtime 3.3) mingw32 headers forget to - define _puttchar, this will probably be fixed in the next versions but - for now do it ourselves - */ -#if defined( __MINGW32__ ) && \ - !wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar ) - #ifdef wxUSE_UNICODE - #define _puttchar putwchar - #else - #define _puttchar puttchar - #endif -#endif - -#endif - /* _WX_MSW_GCCPRIV_H_ */ diff --git a/Source/3rdParty/wx/include/wx/msw/gdiimage.h b/Source/3rdParty/wx/include/wx/msw/gdiimage.h deleted file mode 100644 index d78f5b620..000000000 --- a/Source/3rdParty/wx/include/wx/msw/gdiimage.h +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/gdiimage.h -// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor -// under MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.11.99 -// RCS-ID: $Id: gdiimage.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// NB: this is a private header, it is not intended to be directly included by -// user code (but may be included from other, public, wxWin headers - -#ifndef _WX_MSW_GDIIMAGE_H_ -#define _WX_MSW_GDIIMAGE_H_ - -#include "wx/gdiobj.h" // base class -#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_CORE wxGDIImageRefData; -class WXDLLIMPEXP_FWD_CORE wxGDIImageHandler; -class WXDLLIMPEXP_FWD_CORE wxGDIImage; - -WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); - -// ---------------------------------------------------------------------------- -// wxGDIImageRefData: common data fields for all derived classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImageRefData : public wxGDIRefData -{ -public: - wxGDIImageRefData() - { - m_width = m_height = m_depth = 0; - - m_handle = 0; - } - - wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData(data) - { - m_width = data.m_width; - m_height = data.m_height; - m_depth = data.m_depth; - - // can't copy handles like this, derived class copy ctor must do it! - m_handle = NULL; - } - - // accessors - bool IsOk() const { return m_handle != 0; } - - void SetSize(int w, int h) { m_width = w; m_height = h; } - - // free the ressources we allocated - virtual void Free() = 0; - - // for compatibility, the member fields are public - - // the size of the image - int m_width, m_height; - - // the depth of the image - int m_depth; - - // the handle to it - union - { - WXHANDLE m_handle; // for untyped access - WXHBITMAP m_hBitmap; - WXHICON m_hIcon; - WXHCURSOR m_hCursor; - }; -}; - -// ---------------------------------------------------------------------------- -// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImageHandler : public wxObject -{ -public: - // ctor - wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } - wxGDIImageHandler(const wxString& name, - const wxString& ext, - long type) - : m_name(name), m_extension(ext) - { - m_type = type; - } - - // accessors - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - - // real handler operations: to implement in derived classes - virtual bool Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth = 1) = 0; - virtual bool Load(wxGDIImage *image, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight) = 0; - virtual bool Save(wxGDIImage *image, - const wxString& name, - int type) = 0; - -protected: - wxString m_name; - wxString m_extension; - long m_type; -}; - -// ---------------------------------------------------------------------------- -// wxGDIImage: this class supports GDI image handlers which may be registered -// dynamically and will be used for loading/saving the images in the specified -// format. It also falls back to wxImage if no appropriate image is found. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImage : public wxGDIObject -{ -public: - // handlers list interface - static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; } - - static void AddHandler(wxGDIImageHandler *handler); - static void InsertHandler(wxGDIImageHandler *handler); - static bool RemoveHandler(const wxString& name); - - static wxGDIImageHandler *FindHandler(const wxString& name); - static wxGDIImageHandler *FindHandler(const wxString& extension, long type); - static wxGDIImageHandler *FindHandler(long type); - - static void InitStandardHandlers(); - static void CleanUpHandlers(); - - // access to the ref data casted to the right type - wxGDIImageRefData *GetGDIImageData() const - { return (wxGDIImageRefData *)m_refData; } - - // accessors - WXHANDLE GetHandle() const - { return IsNull() ? 0 : GetGDIImageData()->m_handle; } - void SetHandle(WXHANDLE handle) - { AllocExclusive(); GetGDIImageData()->m_handle = handle; } - - bool Ok() const { return IsOk(); } - bool IsOk() const { return GetHandle() != 0; } - - int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } - int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } - int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } - - void SetWidth(int w) { AllocExclusive(); GetGDIImageData()->m_width = w; } - void SetHeight(int h) { AllocExclusive(); GetGDIImageData()->m_height = h; } - void SetDepth(int d) { AllocExclusive(); GetGDIImageData()->m_depth = d; } - - void SetSize(int w, int h) - { - AllocExclusive(); - GetGDIImageData()->SetSize(w, h); - } - void SetSize(const wxSize& size) { SetSize(size.x, size.y); } - - // forward some of base class virtuals to wxGDIImageRefData - bool FreeResource(bool force = false); - virtual WXHANDLE GetResourceHandle() const; - -protected: - // create the data for the derived class here - virtual wxGDIImageRefData *CreateData() const = 0; - - // implement the wxObject method in terms of our, more specific, one - virtual wxObjectRefData *CreateRefData() const { return CreateData(); } - - static wxGDIImageHandlerList ms_handlers; -}; - -#endif // _WX_MSW_GDIIMAGE_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/genrcdefs.h b/Source/3rdParty/wx/include/wx/msw/genrcdefs.h deleted file mode 100644 index d96634cfe..000000000 --- a/Source/3rdParty/wx/include/wx/msw/genrcdefs.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Name: wx/msw/genrcdefs.h - * Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler - * Author: Mike Wetherell - * RCS-ID: $Id: genrcdefs.h 36133 2005-11-08 22:49:46Z MW $ - * Copyright: (c) 2005 Mike Wetherell - * Licence: wxWindows licence - */ - -#define EMIT(line) line - -EMIT(#ifndef _WX_RCDEFS_H) -EMIT(#define _WX_RCDEFS_H) - -#ifdef _MSC_FULL_VER -EMIT(#define WX_MSC_FULL_VER _MSC_FULL_VER) -#endif - -#ifdef _M_AMD64 -EMIT(#define WX_CPU_AMD64) -#endif - -#ifdef _M_ARM -EMIT(#define WX_CPU_ARM) -#endif - -#ifdef _M_IA64 -EMIT(#define WX_CPU_IA64) -#endif - -#if defined _M_IX86 || defined _X86_ -EMIT(#define WX_CPU_X86) -#endif - -#ifdef _M_PPC -EMIT(#define WX_CPU_PPC) -#endif - -#ifdef _M_SH -EMIT(#define WX_CPU_SH) -#endif - -EMIT(#endif) diff --git a/Source/3rdParty/wx/include/wx/msw/gsockmsw.h b/Source/3rdParty/wx/include/wx/msw/gsockmsw.h deleted file mode 100644 index 6e5486992..000000000 --- a/Source/3rdParty/wx/include/wx/msw/gsockmsw.h +++ /dev/null @@ -1,145 +0,0 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) for WX - * Name: gsockmsw.h - * Copyright: (c) Guilhem Lavaux - * Licence: wxWindows Licence - * Purpose: GSocket MSW header - * CVSID: $Id: gsockmsw.h 33948 2005-05-04 18:57:50Z JS $ - * ------------------------------------------------------------------------- - */ - -#ifndef __GSOCK_MSW_H -#define __GSOCK_MSW_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/setup.h" -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/gsocket.h" -#else -#include "gsocket.h" -#endif - -#include "wx/msw/wrapwin.h" - -#if defined(__CYGWIN__) - //CYGWIN gives annoying warning about runtime stuff if we don't do this -# define USE_SYS_TYPES_FD_SET -# include -#endif - -#if defined(__WXWINCE__) || defined(__CYGWIN__) || defined(__WXMSW__) -#include -#endif - -class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - -/* Definition of GSocket */ -class GSocket -{ -public: - GSocket(); - ~GSocket(); - bool IsOk() { return m_ok; } - void Close(); - void Shutdown(); - GSocketError SetLocal(GAddress *address); - GSocketError SetPeer(GAddress *address); - GAddress *GetLocal(); - GAddress *GetPeer(); - GSocketError SetServer(); - GSocket *WaitConnection(); - bool SetReusable(); - GSocketError Connect(GSocketStream stream); - GSocketError SetNonOriented(); - int Read(char *buffer, int size); - int Write(const char *buffer, int size); - GSocketEventFlags Select(GSocketEventFlags flags); - void SetNonBlocking(bool non_block); - void SetTimeout(unsigned long millis); - GSocketError WXDLLIMPEXP_NET GetError(); - void SetCallback(GSocketEventFlags flags, - GSocketCallback callback, char *cdata); - void UnsetCallback(GSocketEventFlags flags); - GSocketError GetSockOpt(int level, int optname, - void *optval, int *optlen); - GSocketError SetSockOpt(int level, int optname, - const void *optval, int optlen); -protected: - GSocketError Input_Timeout(); - GSocketError Output_Timeout(); - GSocketError Connect_Timeout(); - int Recv_Stream(char *buffer, int size); - int Recv_Dgram(char *buffer, int size); - int Send_Stream(const char *buffer, int size); - int Send_Dgram(const char *buffer, int size); - bool m_ok; - -/* TODO: Make these protected */ -public: - SOCKET m_fd; - GAddress *m_local; - GAddress *m_peer; - GSocketError m_error; - - /* Attributes */ - bool m_non_blocking; - bool m_server; - bool m_stream; - bool m_establishing; - bool m_reusable; - struct timeval m_timeout; - - /* Callbacks */ - GSocketEventFlags m_detected; - GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; - char *m_data[GSOCK_MAX_EVENT]; - int m_msgnumber; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Definition of GAddress */ -struct _GAddress -{ - struct sockaddr *m_addr; - size_t m_len; - - GAddressType m_family; - int m_realfamily; - - GSocketError m_error; -}; - - -/* GAddress */ - -GSocketError _GAddress_translate_from(GAddress *address, - struct sockaddr *addr, int len); -GSocketError _GAddress_translate_to (GAddress *address, - struct sockaddr **addr, int *len); -GSocketError _GAddress_Init_INET(GAddress *address); -GSocketError _GAddress_Init_UNIX(GAddress *address); - -#ifdef __cplusplus -} -#endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCK_MSW_H */ diff --git a/Source/3rdParty/wx/include/wx/msw/helpchm.h b/Source/3rdParty/wx/include/wx/msw/helpchm.h deleted file mode 100644 index a6c3e8440..000000000 --- a/Source/3rdParty/wx/include/wx/msw/helpchm.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpchm.h -// Purpose: Help system: MS HTML Help implementation -// Author: Julian Smart -// Modified by: -// Created: 16/04/2000 -// RCS-ID: $Id: helpchm.h 39725 2006-06-14 17:46:51Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPCHM_H_ -#define _WX_HELPCHM_H_ - -#if wxUSE_MS_HTML_HELP - -#include "wx/helpbase.h" - -class WXDLLEXPORT wxCHMHelpController : public wxHelpControllerBase -{ -public: - wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section); - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - wxString GetHelpFile() const { return m_helpFile; } - - // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp - static bool ShowContextHelpPopup(const wxString& text, - const wxPoint& pos, - wxWindow *window); - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - -protected: - wxString m_helpFile; - - DECLARE_CLASS(wxCHMHelpController) -}; - -#endif // wxUSE_MS_HTML_HELP - -#endif -// _WX_HELPCHM_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/helpwin.h b/Source/3rdParty/wx/include/wx/msw/helpwin.h deleted file mode 100644 index e563c8e9c..000000000 --- a/Source/3rdParty/wx/include/wx/msw/helpwin.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpwin.h -// Purpose: Help system: WinHelp implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: helpwin.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWIN_H_ -#define _WX_HELPWIN_H_ - -#include "wx/wx.h" - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase -{ - DECLARE_CLASS(wxWinHelpController) - -public: - wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} - virtual ~wxWinHelpController() {} - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - inline wxString GetHelpFile() const { return m_helpFile; } - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - -private: - wxString m_helpFile; -}; - -#endif // wxUSE_HELP -#endif -// _WX_HELPWIN_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/htmlhelp.h b/Source/3rdParty/wx/include/wx/msw/htmlhelp.h deleted file mode 100644 index 960ee155c..000000000 --- a/Source/3rdParty/wx/include/wx/msw/htmlhelp.h +++ /dev/null @@ -1,465 +0,0 @@ -/* - * wx/msw/htmlhelp.h - * Copyright 2004 Jacek Caban - * - * Originally written for the Wine project, and issued under - * the wxWindows License by kind permission of the author. - * - * License: wxWindows License - */ - -#ifndef __HTMLHELP_H__ -#define __HTMLHELP_H__ - -#define HH_DISPLAY_TOPIC 0x00 -#define HH_HELP_FINDER 0x00 -#define HH_DISPLAY_TOC 0x01 -#define HH_DISPLAY_INDEX 0x02 -#define HH_DISPLAY_SEARCH 0x03 -#define HH_SET_WIN_TYPE 0x04 -#define HH_GET_WIN_TYPE 0x05 -#define HH_GET_WIN_HANDLE 0x06 -#define HH_ENUM_INFO_TYPE 0x07 -#define HH_SET_INFO_TYPE 0x08 -#define HH_SYNC 0x09 -#define HH_RESERVED1 0x0A -#define HH_RESERVED2 0x0B -#define HH_RESERVED3 0x0C -#define HH_KEYWORD_LOOKUP 0x0D -#define HH_DISPLAY_TEXT_POPUP 0x0E -#define HH_HELP_CONTEXT 0x0F -#define HH_TP_HELP_CONTEXTMENU 0x10 -#define HH_TP_HELP_WM_HELP 0x11 -#define HH_CLOSE_ALL 0x12 -#define HH_ALINK_LOOKUP 0x13 -#define HH_GET_LAST_ERROR 0x14 -#define HH_ENUM_CATEGORY 0x15 -#define HH_ENUM_CATEGORY_IT 0x16 -#define HH_RESET_IT_FILTER 0x17 -#define HH_SET_INCLUSIVE_FILTER 0x18 -#define HH_SET_EXCLUSIVE_FILTER 0x19 -#define HH_INITIALIZE 0x1C -#define HH_UNINITIALIZE 0x1D -#define HH_PRETRANSLATEMESSAGE 0xFD -#define HH_SET_GLOBAL_PROPERTY 0xFC - -#define HHWIN_PROP_TAB_AUTOHIDESHOW 0x00000001 -#define HHWIN_PROP_ONTOP 0x00000002 -#define HHWIN_PROP_NOTITLEBAR 0x00000004 -#define HHWIN_PROP_NODEF_STYLES 0x00000008 -#define HHWIN_PROP_NODEF_EXSTYLES 0x00000010 -#define HHWIN_PROP_TRI_PANE 0x00000020 -#define HHWIN_PROP_NOTB_TEXT 0x00000040 -#define HHWIN_PROP_POST_QUIT 0x00000080 -#define HHWIN_PROP_AUTO_SYNC 0x00000100 -#define HHWIN_PROP_TRACKING 0x00000200 -#define HHWIN_PROP_TAB_SEARCH 0x00000400 -#define HHWIN_PROP_TAB_HISTORY 0x00000800 -#define HHWIN_PROP_TAB_FAVORITES 0x00001000 -#define HHWIN_PROP_CHANGE_TITLE 0x00002000 -#define HHWIN_PROP_NAV_ONLY_WIN 0x00004000 -#define HHWIN_PROP_NO_TOOLBAR 0x00008000 -#define HHWIN_PROP_MENU 0x00010000 -#define HHWIN_PROP_TAB_ADVSEARCH 0x00020000 -#define HHWIN_PROP_USER_POS 0x00040000 -#define HHWIN_PROP_TAB_CUSTOM1 0x00080000 -#define HHWIN_PROP_TAB_CUSTOM2 0x00100000 -#define HHWIN_PROP_TAB_CUSTOM3 0x00200000 -#define HHWIN_PROP_TAB_CUSTOM4 0x00400000 -#define HHWIN_PROP_TAB_CUSTOM5 0x00800000 -#define HHWIN_PROP_TAB_CUSTOM6 0x01000000 -#define HHWIN_PROP_TAB_CUSTOM7 0x02000000 -#define HHWIN_PROP_TAB_CUSTOM8 0x04000000 -#define HHWIN_PROP_TAB_CUSTOM9 0x08000000 -#define HHWIN_TB_MARGIN 0x10000000 - -#define HHWIN_PARAM_PROPERTIES 0x00000002 -#define HHWIN_PARAM_STYLES 0x00000004 -#define HHWIN_PARAM_EXSTYLES 0x00000008 -#define HHWIN_PARAM_RECT 0x00000010 -#define HHWIN_PARAM_NAV_WIDTH 0x00000020 -#define HHWIN_PARAM_SHOWSTATE 0x00000040 -#define HHWIN_PARAM_INFOTYPES 0x00000080 -#define HHWIN_PARAM_TB_FLAGS 0x00000100 -#define HHWIN_PARAM_EXPANSION 0x00000200 -#define HHWIN_PARAM_TABPOS 0x00000400 -#define HHWIN_PARAM_TABORDER 0x00000800 -#define HHWIN_PARAM_HISTORY_COUNT 0x00001000 -#define HHWIN_PARAM_CUR_TAB 0x00002000 - -#define HHWIN_BUTTON_EXPAND 0x00000002 -#define HHWIN_BUTTON_BACK 0x00000004 -#define HHWIN_BUTTON_FORWARD 0x00000008 -#define HHWIN_BUTTON_STOP 0x00000010 -#define HHWIN_BUTTON_REFRESH 0x00000020 -#define HHWIN_BUTTON_HOME 0x00000040 -#define HHWIN_BUTTON_BROWSE_FWD 0x00000080 -#define HHWIN_BUTTON_BROWSE_BCK 0x00000100 -#define HHWIN_BUTTON_NOTES 0x00000200 -#define HHWIN_BUTTON_CONTENTS 0x00000400 -#define HHWIN_BUTTON_SYNC 0x00000800 -#define HHWIN_BUTTON_OPTIONS 0x00001000 -#define HHWIN_BUTTON_PRINT 0x00002000 -#define HHWIN_BUTTON_INDEX 0x00004000 -#define HHWIN_BUTTON_SEARCH 0x00008000 -#define HHWIN_BUTTON_HISTORY 0x00010000 -#define HHWIN_BUTTON_FAVORITES 0x00020000 -#define HHWIN_BUTTON_JUMP1 0x00040000 -#define HHWIN_BUTTON_JUMP2 0x00080000 -#define HHWIN_BUTTON_ZOOM 0x00100000 -#define HHWIN_BUTTON_TOC_NEXT 0x00200000 -#define HHWIN_BUTTON_TOC_PREV 0x00400000 - -#define HHWIN_DEF_BUTTONS \ - (HHWIN_BUTTON_EXPAND | HHWIN_BUTTON_BACK | HHWIN_BUTTON_OPTIONS | HHWIN_BUTTON_PRINT) - -#define IDTB_EXPAND 200 -#define IDTB_CONTRACT 201 -#define IDTB_STOP 202 -#define IDTB_REFRESH 203 -#define IDTB_BACK 204 -#define IDTB_HOME 205 -#define IDTB_SYNC 206 -#define IDTB_PRINT 207 -#define IDTB_OPTIONS 208 -#define IDTB_FORWARD 209 -#define IDTB_NOTES 210 -#define IDTB_BROWSE_FWD 211 -#define IDTB_BROWSE_BACK 212 -#define IDTB_CONTENTS 213 -#define IDTB_INDEX 214 -#define IDTB_SEARCH 215 -#define IDTB_HISTORY 216 -#define IDTB_FAVORITES 217 -#define IDTB_JUMP1 218 -#define IDTB_JUMP2 219 -#define IDTB_CUSTOMIZE 221 -#define IDTB_ZOOM 222 -#define IDTB_TOC_NEXT 223 -#define IDTB_TOC_PREV 224 - -#define HHN_FIRST (0U-860U) -#define HHN_LAST (0U-879U) -#define HHN_NAVCOMPLETE HHN_FIRST -#define HHN_TRACK (HHN_FIRST-1) -#define HHN_WINDOW_CREATE (HHN_FIRST-2) - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct tagHH_NOTIFY { - NMHDR hdr; - PCSTR pszurl; -} HH_NOTIFY; - -typedef struct tagHH_POPUPA { - int cbStruct; - HINSTANCE hinst; - UINT idString; - LPCSTR pszText; - POINT pt; - COLORREF clrForeground; - COLORREF clrBackground; - RECT rcMargins; - LPCSTR pszFont; -} HH_POPUPA; - -typedef struct tagHH_POPUPW { - int cbStruct; - HINSTANCE hinst; - UINT idString; - LPCWSTR pszText; - POINT pt; - COLORREF clrForeground; - COLORREF clrBackground; - RECT rcMargins; - LPCWSTR pszFont; -} HH_POPUPW; - -#ifdef _UNICODE -typedef HH_POPUPW HH_POPUP; -#else -typedef HH_POPUPA HH_POPUP; -#endif - -typedef struct tagHH_ALINKA { - int cbStruct; - BOOL fReserved; - LPCSTR pszKeywords; - LPCSTR pszUrl; - LPCSTR pszMsgText; - LPCSTR pszMsgTitle; - LPCSTR pszWindow; - BOOL fIndexOnFail; -} HH_ALINKA; - -typedef struct tagHH_ALINKW { - int cbStruct; - BOOL fReserved; - LPCWSTR pszKeywords; - LPCWSTR pszUrl; - LPCWSTR pszMsgText; - LPCWSTR pszMsgTitle; - LPCWSTR pszWindow; - BOOL fIndexOnFail; -} HH_ALINKW; - -#ifdef _UNICODE -typedef HH_ALINKW HH_ALINK; -typedef HH_ALINKW HH_AKLINK; -#else -typedef HH_ALINKA HH_ALINK; -typedef HH_ALINKA HH_AKLINK; -#endif - -enum { - HHWIN_NAVTYPE_TOC, - HHWIN_NAVTYPE_INDEX, - HHWIN_NAVTYPE_SEARCH, - HHWIN_NAVTYPE_FAVORITES, - HHWIN_NAVTYPE_HISTORY, - HHWIN_NAVTYPE_AUTHOR, - HHWIN_NAVTYPE_CUSTOM_FIRST = 11 -}; - -enum { - IT_INCLUSIVE, - IT_EXCLUSIVE, - IT_HIDDEN -}; - -typedef struct tagHH_ENUM_IT { - int cbStruct; - int iType; - LPCSTR pszCatName; - LPCSTR pszITName; - LPCSTR pszITDescription; -} HH_ENUM_IT, *PHH_ENUM_IT; - -typedef struct tagHH_ENUM_CAT { - int cbStruct; - LPCSTR pszCatName; - LPCSTR pszCatDescription; -} HH_ENUM_CAT, *PHH_ENUM_CAT; - -typedef struct tagHH_SET_INFOTYPE { - int cbStruct; - LPCSTR pszCatName; - LPCSTR pszInfoTypeName; -} HH_SET_INFOTYPE; - -typedef DWORD HH_INFOTYPE, *PHH_INFOTYPE; - -enum { - HHWIN_NAVTAB_TOP, - HHWIN_NAVTAB_LEFT, - HHWIN_NAVTAB_BOTTOM -}; - -#define HH_MAX_TABS 19 - -enum { - HH_TAB_CONTENTS, - HH_TAB_INDEX, - HH_TAB_SEARCH, - HH_TAB_FAVORITES, - HH_TAB_HISTORY, - HH_TAB_AUTHOR, - HH_TAB_CUSTOM_FIRST = 11, - HH_TAB_CUSTOM_LAST = HH_MAX_TABS -}; - -#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST-HH_TAB_CUSTOM_FIRST+1) -#define HH_FTS_DEFAULT_PROXIMITY -1 - -typedef struct tagHH_FTS_QUERYA { - int cbStruct; - BOOL fUniCodeStrings; - LPCSTR pszSearchQuery; - LONG iProximity; - BOOL fStemmedSearch; - BOOL fTitleOnly; - BOOL fExecute; - LPCSTR pszWindow; -} HH_FTS_QUERYA; - -typedef struct tagHH_FTS_QUERYW { - int cbStruct; - BOOL fUniCodeStrings; - LPCWSTR pszSearchQuery; - LONG iProximity; - BOOL fStemmedSearch; - BOOL fTitleOnly; - BOOL fExecute; - LPCWSTR pszWindow; -} HH_FTS_QUERYW; - -#ifdef _UNICODE -typedef HH_FTS_QUERYW HH_FTS_QUERY; -#else -typedef HH_FTS_QUERYA HH_FTS_QUERY; -#endif - -typedef struct tagHH_WINTYPEA { - int cbStruct; - BOOL fUniCodeStrings; - LPCSTR pszType; - DWORD fsValidMembers; - DWORD fsWinProperties; - LPCSTR pszCaption; - DWORD dwStyles; - DWORD dwExStyles; - RECT rcWindowPos; - int nShowState; - HWND hwndHelp; - HWND hwndCaller; - PHH_INFOTYPE paInfoTypes; - HWND hwndToolBar; - HWND hwndNavigation; - HWND hwndHTML; - int iNavWidth; - RECT rcHTML; - LPCSTR pszToc; - LPCSTR pszIndex; - LPCSTR pszFile; - LPCSTR pszHome; - DWORD fsToolBarFlags; - BOOL fNotExpanded; - int curNavType; - int tabpos; - int idNotify; - BYTE tabOrder[HH_MAX_TABS+1]; - int cHistory; - LPCSTR pszJump1; - LPCSTR pszJump2; - LPCSTR pszUrlJump1; - LPCSTR pszUrlJump2; - RECT rcMinSize; - int cbInfoTypes; - LPCSTR pszCustomTabs; -} HH_WINTYPEA, *PHH_WINTYPEA; - -typedef struct tagHH_WINTYPEW { - int cbStruct; - BOOL fUniCodeStrings; - LPCWSTR pszType; - DWORD fsValidMembers; - DWORD fsWinProperties; - LPCWSTR pszCaption; - DWORD dwStyles; - DWORD dwExStyles; - RECT rcWindowPos; - int nShowState; - HWND hwndHelp; - HWND hwndCaller; - PHH_INFOTYPE paInfoTypes; - HWND hwndToolBar; - HWND hwndNavigation; - HWND hwndHTML; - int iNavWidth; - RECT rcHTML; - LPCWSTR pszToc; - LPCWSTR pszIndex; - LPCWSTR pszFile; - LPCWSTR pszHome; - DWORD fsToolBarFlags; - BOOL fNotExpanded; - int curNavType; - int tabpos; - int idNotify; - BYTE tabOrder[HH_MAX_TABS+1]; - int cHistory; - LPCWSTR pszJump1; - LPCWSTR pszJump2; - LPCWSTR pszUrlJump1; - LPCWSTR pszUrlJump2; - RECT rcMinSize; - int cbInfoTypes; - LPCWSTR pszCustomTabs; -} HH_WINTYPEW, *PHH_WINTYPEW; - -#ifdef _UNICODE -typedef HH_WINTYPEW HH_WINTYPE; -#else -typedef HH_WINTYPEA HH_WINTYPE; -#endif - -enum { - HHACT_TAB_CONTENTS, - HHACT_TAB_INDEX, - HHACT_TAB_SEARCH, - HHACT_TAB_HISTORY, - HHACT_TAB_FAVORITES, - HHACT_EXPAND, - HHACT_CONTRACT, - HHACT_BACK, - HHACT_FORWARD, - HHACT_STOP, - HHACT_REFRESH, - HHACT_HOME, - HHACT_SYNC, - HHACT_OPTIONS, - HHACT_PRINT, - HHACT_HIGHLIGHT, - HHACT_CUSTOMIZE, - HHACT_JUMP1, - HHACT_JUMP2, - HHACT_ZOOM, - HHACT_TOC_NEXT, - HHACT_TOC_PREV, - HHACT_NOTES, - HHACT_LAST_ENUM -}; - -typedef struct tagHH_NTRACKA { - NMHDR hdr; - PCSTR pszCurUrl; - int idAction; - PHH_WINTYPEA phhWinType; -} HH_NTRACKA; - -typedef struct tagHH_NTRACKW { - NMHDR hdr; - PCSTR pszCurUrl; - int idAction; - PHH_WINTYPEW phhWinType; -} HH_NTRACKW; - -#ifdef _UNICODE -typedef HH_NTRACKW HH_NTRACK; -#else -typedef HH_NTRACKA HH_NTRACK; -#endif - -HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); -HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); -#define HtmlHelp WINELIB_NAME_AW(HtmlHelp) - -#define ATOM_HTMLHELP_API_ANSI (LPTSTR)14 -#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)15 - -typedef enum tagHH_GPROPID { - HH_GPROPID_SINGLETHREAD = 1, - HH_GPROPID_TOOLBAR_MARGIN = 2, - HH_GPROPID_UI_LANGUAGE = 3, - HH_GPROPID_CURRENT_SUBSET = 4, - HH_GPROPID_CONTENT_LANGUAGE = 5 -} HH_GPROPID; - -#ifdef __WIDL_OAIDL_H - -typedef struct tagHH_GLOBAL_PROPERTY -{ - HH_GPROPID id; - VARIANT var; -} HH_GLOBAL_PROPERTY ; - -#endif /* __WIDL_OAIDL_H */ - -#ifdef __cplusplus -} -#endif - -#endif /* __HTMLHELP_H__ */ diff --git a/Source/3rdParty/wx/include/wx/msw/icon.h b/Source/3rdParty/wx/include/wx/msw/icon.h deleted file mode 100644 index d716a26a5..000000000 --- a/Source/3rdParty/wx/include/wx/msw/icon.h +++ /dev/null @@ -1,95 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/icon.h -// Purpose: wxIcon class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICON_H_ -#define _WX_ICON_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/msw/gdiimage.h" - -// --------------------------------------------------------------------------- -// icon data -// --------------------------------------------------------------------------- - -// notice that although wxIconRefData inherits from wxBitmapRefData, it is not -// a valid wxBitmapRefData -class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData -{ -public: - wxIconRefData() { } - virtual ~wxIconRefData() { Free(); } - - virtual void Free(); -}; - -// --------------------------------------------------------------------------- -// Icon -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxIcon : public wxGDIImage -{ -public: - // ctors - // default - wxIcon() { } - - // from raw data - wxIcon(const char bits[], int width, int height); - - // from XPM data - wxIcon(const char **data) { CreateIconFromXpm(data); } - - wxIcon(char **data) { CreateIconFromXpm((const char **)data); } - - // from resource/file - wxIcon(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, - int desiredWidth = -1, int desiredHeight = -1); - - wxIcon(const wxIconLocation& loc); - - virtual ~wxIcon(); - - virtual bool LoadFile(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, - int desiredWidth = -1, int desiredHeight = -1); - - // implementation only from now on - wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } - - void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } - WXHICON GetHICON() const { return (WXHICON)GetHandle(); } - - // create from bitmap (which should have a mask unless it's monochrome): - // there shouldn't be any implicit bitmap -> icon conversion (i.e. no - // ctors, assignment operators...), but it's ok to have such function - void CopyFromBitmap(const wxBitmap& bmp); - -protected: - virtual wxGDIImageRefData *CreateData() const - { - return new wxIconRefData; - } - - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - // create from XPM data - void CreateIconFromXpm(const char **data); - -private: - DECLARE_DYNAMIC_CLASS(wxIcon) -}; - -#endif - // _WX_ICON_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/imaglist.h b/Source/3rdParty/wx/include/wx/msw/imaglist.h deleted file mode 100644 index b31c73539..000000000 --- a/Source/3rdParty/wx/include/wx/msw/imaglist.h +++ /dev/null @@ -1,206 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/imaglist.h -// Purpose: wxImageList class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: imaglist.h 41271 2006-09-18 04:41:09Z KO $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_ -#define _WX_IMAGLIST_H_ - -#include "wx/bitmap.h" - -// Eventually we'll make this a reference-counted wxGDIObject. For -// now, the app must take care of ownership issues. That is, the -// image lists must be explicitly deleted after the control(s) that uses them -// is (are) deleted, or when the app exits. -class WXDLLEXPORT wxImageList : public wxObject -{ -public: - /* - * Public interface - */ - - wxImageList(); - - // Creates an image list. - // Specify the width and height of the images in the list, - // whether there are masks associated with them (e.g. if creating images - // from icons), and the initial size of the list. - wxImageList(int width, int height, bool mask = true, int initialCount = 1) - { - Create(width, height, mask, initialCount); - } - virtual ~wxImageList(); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Returns the number of images in the image list. - int GetImageCount() const; - - // Returns the size (same for all images) of the images in the list - bool GetSize(int index, int &width, int &height) const; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Creates an image list - // width, height specify the size of the images in the list (all the same). - // mask specifies whether the images have masks or not. - // initialNumber is the initial number of images to reserve. - bool Create(int width, int height, bool mask = true, int initialNumber = 1); - - // Adds a bitmap, and optionally a mask bitmap. - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Add. - int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - - // Adds a bitmap, using the specified colour to create the mask bitmap - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' after calling Add. - int Add(const wxBitmap& bitmap, const wxColour& maskColour); - - // Adds a bitmap and mask from an icon. - int Add(const wxIcon& icon); - - // Replaces a bitmap, optionally passing a mask bitmap. - // Note that wxImageList creates new bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Replace. - bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - -/* Not supported by Win95 - // Replacing a bitmap, using the specified colour to create the mask bitmap - // Note that wxImageList creates new bitmaps, so you may delete - // 'bitmap'. - bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour); -*/ - - // Replaces a bitmap and mask from an icon. - // You can delete 'icon' after calling Replace. - bool Replace(int index, const wxIcon& icon); - - // Removes the image at the given index. - bool Remove(int index); - - // Remove all images - bool RemoveAll(); - - // Draws the given image on a dc at the specified position. - // If 'solidBackground' is true, Draw sets the image list background - // colour to the background colour of the wxDC, to speed up - // drawing by eliminating masked drawing where possible. - bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, - bool solidBackground = false); - - // Get a bitmap - wxBitmap GetBitmap(int index) const; - - // Get an icon - wxIcon GetIcon(int index) const; - - // TODO: miscellaneous functionality -/* - wxIcon *MakeIcon(int index); - bool SetOverlayImage(int index, int overlayMask); - -*/ - - // TODO: Drag-and-drop related functionality. - -#if 0 - // Creates a new drag image by combining the given image (typically a mouse cursor image) - // with the current drag image. - bool SetDragCursorImage(int index, const wxPoint& hotSpot); - - // If successful, returns a pointer to the temporary image list that is used for dragging; - // otherwise, NULL. - // dragPos: receives the current drag position. - // hotSpot: receives the offset of the drag image relative to the drag position. - static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); - - // Call this function to begin dragging an image. This function creates a temporary image list - // that is used for dragging. The image combines the specified image and its mask with the - // current cursor. In response to subsequent mouse move messages, you can move the drag image - // by using the DragMove member function. To end the drag operation, you can use the EndDrag - // member function. - bool BeginDrag(int index, const wxPoint& hotSpot); - - // Ends a drag operation. - bool EndDrag(); - - // Call this function to move the image that is being dragged during a drag-and-drop operation. - // This function is typically called in response to a mouse move message. To begin a drag - // operation, use the BeginDrag member function. - static bool DragMove(const wxPoint& point); - - // During a drag operation, locks updates to the window specified by lockWindow and displays - // the drag image at the position specified by point. - // The coordinates are relative to the window's upper left corner, so you must compensate - // for the widths of window elements, such as the border, title bar, and menu bar, when - // specifying the coordinates. - // If lockWindow is NULL, this function draws the image in the display context associated - // with the desktop window, and coordinates are relative to the upper left corner of the screen. - // This function locks all other updates to the given window during the drag operation. - // If you need to do any drawing during a drag operation, such as highlighting the target - // of a drag-and-drop operation, you can temporarily hide the dragged image by using the - // wxImageList::DragLeave function. - - // lockWindow: pointer to the window that owns the drag image. - // point: position at which to display the drag image. Coordinates are relative to the - // upper left corner of the window (not the client area). - - static bool DragEnter( wxWindow *lockWindow, const wxPoint& point ); - - // Unlocks the window specified by pWndLock and hides the drag image, allowing the - // window to be updated. - static bool DragLeave( wxWindow *lockWindow ); - - /* Here's roughly how you'd use these functions if implemented in this Win95-like way: - - 1) Starting to drag: - - wxImageList *dragImageList = new wxImageList(16, 16, true); - dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor - dragImageList->BeginDrag(0, wxPoint(0, 0)); - wxShowCursor(false); // wxShowCursor not yet implemented in wxWin - myWindow->CaptureMouse(); - - 2) Dragging: - - // Called within mouse move event. Could also use dragImageList instead of assuming - // these are static functions. - // These two functions could possibly be combined into one, since DragEnter is - // a bit obscure. - wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position - wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen - - 3) Finishing dragging: - - dragImageList->EndDrag(); - myWindow->ReleaseMouse(); - wxShowCursor(true); -*/ - -#endif - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - // Returns the native image list handle - WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } - -protected: - WXHIMAGELIST m_hImageList; - - DECLARE_DYNAMIC_CLASS(wxImageList) -}; - -#endif - // _WX_IMAGLIST_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/iniconf.h b/Source/3rdParty/wx/include/wx/msw/iniconf.h deleted file mode 100644 index 61b9d0c8d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/iniconf.h +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/iniconf.h -// Purpose: INI-file based wxConfigBase implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.07.98 -// RCS-ID: $Id: iniconf.h 62185 2009-09-28 10:02:42Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _INICONF_H -#define _INICONF_H - -#include "wx/defs.h" - -#if wxUSE_CONFIG - -// ---------------------------------------------------------------------------- -// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to -// store the data. Because INI files don't really support arbitrary nesting of -// groups, we do the following: -// (1) in win.ini file we store all entries in the [vendor] section and -// the value group1/group2/key is mapped to the value group1_group2_key -// in this section, i.e. all path separators are replaced with underscore -// (2) in appname.ini file we map group1/group2/group3/key to the entry -// group2_group3_key in [group1] -// -// Of course, it might lead to indesirable results if '_' is also used in key -// names (i.e. group/key is the same as group_key) and also GetPath() result -// may be not what you would expect it to be. -// -// Another limitation: the keys and section names are never case-sensitive -// which might differ from wxFileConfig it it was compiled with -// wxCONFIG_CASE_SENSITIVE option. -// ---------------------------------------------------------------------------- - -// for this class, "local" file is the file appname.ini and the global file -// is the [vendor] subsection of win.ini (default for "vendor" is to be the -// same as appname). The file name (strAppName parameter) may, in fact, -// contain the full path to the file. If it doesn't, the file is searched for -// in the Windows directory. -class WXDLLEXPORT wxIniConfig : public wxConfigBase -{ -public: - // ctor & dtor - // if strAppName doesn't contain the extension and is not an absolute path, - // ".ini" is appended to it. if strVendor is empty, it's taken to be the - // same as strAppName. - wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, - const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); - virtual ~wxIniConfig(); - - // implement inherited pure virtual functions - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const; - - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - - // return true if the current group is empty - bool IsEmpty() const; - - virtual bool Flush(bool bCurrentOnly = false); - - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& szKey); - virtual bool DeleteAll(); - -protected: - // read/write - bool DoReadString(const wxString& key, wxString *pStr) const; - bool DoReadLong(const wxString& key, long *plResult) const; - - bool DoWriteString(const wxString& key, const wxString& szValue); - bool DoWriteLong(const wxString& key, long lValue); - -private: - // helpers - wxString GetPrivateKeyName(const wxString& szKey) const; - wxString GetKeyName(const wxString& szKey) const; - - wxString m_strLocalFilename; // name of the private INI file - wxString m_strGroup, // current group in appname.ini file - m_strPath; // the rest of the path (no trailing '_'!) -}; - -#endif // wxUSE_CONFIG - -#endif // _INICONF_H diff --git a/Source/3rdParty/wx/include/wx/msw/libraries.h b/Source/3rdParty/wx/include/wx/msw/libraries.h deleted file mode 100644 index efd7389e0..000000000 --- a/Source/3rdParty/wx/include/wx/msw/libraries.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Name: wx/msw/libraries.h - * Purpose: Pragmas for linking libs conditionally - * Author: Michael Wetherell - * Modified by: - * RCS-ID: $Id: libraries.h 37045 2006-01-21 22:50:46Z MW $ - * Copyright: (c) 2005 Michael Wetherell - * Licence: wxWindows licence - */ - -#ifndef _WX_MSW_LIBRARIES_H_ -#define _WX_MSW_LIBRARIES_H_ - -/* - * Notes: - * - * In general the preferred place to add libs is in the bakefiles. This file - * can be used where libs must be added conditionally, for those compilers that - * support a way to do that. - */ - -/* VC++ 5 didn't include oleacc.lib, though it came with the PSDK */ -#if defined __VISUALC__ && (wxUSE_ACCESSIBILITY || __VISUALC__ >= 1200) -#pragma comment(lib, "oleacc") -#endif - -#endif /* _WX_MSW_LIBRARIES_H_ */ diff --git a/Source/3rdParty/wx/include/wx/msw/listbox.h b/Source/3rdParty/wx/include/wx/msw/listbox.h deleted file mode 100644 index 518b78303..000000000 --- a/Source/3rdParty/wx/include/wx/msw/listbox.h +++ /dev/null @@ -1,183 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/listbox.h -// Purpose: wxListBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: listbox.h 66941 2011-02-17 11:01:22Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOX_H_ -#define _WX_LISTBOX_H_ - -#if wxUSE_LISTBOX - -// Fixing spurious selection events breaks binary compatibility, so this is normally 0. -// See ticket #12143 -#define wxUSE_LISTBOX_SELECTION_FIX 0 - -// ---------------------------------------------------------------------------- -// simple types -// ---------------------------------------------------------------------------- - -#if wxUSE_OWNER_DRAWN - class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; - - // define the array of list box items - #include "wx/dynarray.h" - - WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); -#endif // wxUSE_OWNER_DRAWN - -// forward decl for GetSelections() -class WXDLLIMPEXP_FWD_BASE wxArrayInt; - -// ---------------------------------------------------------------------------- -// List box control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListBox : public wxListBoxBase -{ -public: - // ctors and such - wxListBox(); - wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - virtual ~wxListBox(); - - // implement base class pure virtuals - virtual void Clear(); - virtual void Delete(unsigned int n); - - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - - virtual bool IsSelected(int n) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - - // wxCheckListBox support -#if wxUSE_OWNER_DRAWN - bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - - // plug-in for derived classes - virtual wxOwnerDrawn *CreateLboxItem(size_t n); - - // allows to get the item and use SetXXX functions to set it's appearance - wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } - - // get the index of the given item - int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } -#endif // wxUSE_OWNER_DRAWN - - // Windows-specific code to update the horizontal extent of the listbox, if - // necessary. If s is non-empty, the horizontal extent is increased to the - // length of this string if it's currently too short, otherwise the maximum - // extent of all strings is used. In any case calls InvalidateBestSize() - virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); - - // Windows callbacks - bool MSWCommand(WXUINT param, WXWORD id); - WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // under XP when using "transition effect for menus and tooltips" if we - // return true for WM_PRINTCLIENT here then it causes noticable slowdown - virtual bool MSWShouldPropagatePrintChild() - { - return false; - } - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) - { - return GetCompositeControlsDefaultAttributes(variant); - } - -#if wxUSE_LISTBOX_SELECTION_FIX - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif - -protected: - virtual void DoSetSelection(int n, bool select); - virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); - virtual void DoSetItems(const wxArrayString& items, void **clientData); - virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - virtual int DoListHitTest(const wxPoint& point) const; - - // free memory (common part of Clear() and dtor) - void Free(); - - unsigned int m_noItems; - int m_selected; - - virtual wxSize DoGetBestSize() const; - -#if wxUSE_OWNER_DRAWN - // control items - wxListBoxItemsArray m_aItems; -#endif - -#if wxUSE_LISTBOX_SELECTION_FIX - // flag set to true when we get a keyboard event and reset to false when we - // get a mouse one: this is used to find the correct item for the selection - // event - bool m_selectedByKeyboard; -#endif - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) -}; - -#endif // wxUSE_LISTBOX - -#endif - // _WX_LISTBOX_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/listctrl.h b/Source/3rdParty/wx/include/wx/msw/listctrl.h deleted file mode 100644 index de4c7d839..000000000 --- a/Source/3rdParty/wx/include/wx/msw/listctrl.h +++ /dev/null @@ -1,449 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/listctrl.h -// Purpose: wxListCtrl class -// Author: Julian Smart -// Modified by: Agron Selimaj -// Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 54419 2008-06-29 01:35:24Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTCTRL_H_ -#define _WX_LISTCTRL_H_ - -#include "wx/textctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -/* - The wxListCtrl can show lists of items in four different modes: - wxLC_LIST: multicolumn list view, with optional small icons (icons could be - optional for some platforms). Columns are computed automatically, - i.e. you don't set columns as in wxLC_REPORT. In other words, - the list wraps, unlike a wxListBox. - wxLC_REPORT: single or multicolumn report view (with optional header) - wxLC_ICON: large icon view, with optional labels - wxLC_SMALL_ICON: small icon view, with optional labels - - You can change the style dynamically, either with SetSingleStyle or - SetWindowStyleFlag. - - Further window styles: - - wxLC_ALIGN_TOP icons align to the top (default) - wxLC_ALIGN_LEFT icons align to the left - wxLC_AUTOARRANGE icons arrange themselves - wxLC_USER_TEXT the app provides label text on demand, except for column headers - wxLC_EDIT_LABELS labels are editable: app will be notified. - wxLC_NO_HEADER no header in report mode - wxLC_NO_SORT_HEADER can't click on header - wxLC_SINGLE_SEL single selection - wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) - wxLC_SORT_DESCENDING sort descending (ditto) - - Items are referred to by their index (position in the list starting from zero). - - Label text is supplied via insertion/setting functions and is stored by the - control, unless the wxLC_USER_TEXT style has been specified, in which case - the app will be notified when text is required (see sample). - - Images are dealt with by (optionally) associating 3 image lists with the control. - Zero-based indexes into these image lists indicate which image is to be used for - which item. Each image in an image list can contain a mask, and can be made out - of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. - - Notifications are passed via the wxWidgets 2.0 event system, or using virtual - functions in wxWidgets 1.66. - - See the sample wxListCtrl app for API usage. - - TODO: - - addition of further convenience functions - to avoid use of wxListItem in some functions - - state/overlay images: probably not needed. - - in Win95, you can be called back to supply other information - besides text, such as state information. This saves no memory - and is probably superfluous to requirements. - - testing of whole API, extending current sample. - - - */ - -class WXDLLEXPORT wxListCtrl: public wxControl -{ -public: - /* - * Public interface - */ - - wxListCtrl() { Init(); } - - wxListCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr) - { - Init(); - - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxListCtrl(); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Set the control colours - bool SetForegroundColour(const wxColour& col); - bool SetBackgroundColour(const wxColour& col); - - // Gets information about this column - bool GetColumn(int col, wxListItem& item) const; - - // Sets information about this column - bool SetColumn(int col, const wxListItem& item) ; - - // Gets the column width - int GetColumnWidth(int col) const; - - // Sets the column width - bool SetColumnWidth(int col, int width) ; - - // Gets the number of items that can fit vertically in the - // visible area of the list control (list or report view) - // or the total number of items in the list control (icon - // or small icon view) - int GetCountPerPage() const; - - // return the total area occupied by all the items (icon/small icon only) - wxRect GetViewRect() const; - - // Gets the edit control for editing labels. - wxTextCtrl* GetEditControl() const; - - // Gets information about the item - bool GetItem(wxListItem& info) const ; - - // Sets information about the item - bool SetItem(wxListItem& info) ; - - // Sets a string field at a particular column - long SetItem(long index, int col, const wxString& label, int imageId = -1); - - // Gets the item state - int GetItemState(long item, long stateMask) const ; - - // Sets the item state - bool SetItemState(long item, long state, long stateMask) ; - - // Sets the item image - bool SetItemImage(long item, int image, int selImage = -1) ; - bool SetItemColumnImage(long item, long column, int image); - - // Gets the item text - wxString GetItemText(long item) const ; - - // Sets the item text - void SetItemText(long item, const wxString& str) ; - - // Gets the item data - wxUIntPtr GetItemData(long item) const ; - - // Sets the item data -#if wxABI_VERSION >= 20804 - bool SetItemPtrData(long item, wxUIntPtr data); -#endif // wxABI 2.8.4+ - bool SetItemData(long item, long data); - - // Gets the item rectangle - bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; - - // Gets the subitem rectangle in report mode - bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; - - // Gets the item position - bool GetItemPosition(long item, wxPoint& pos) const ; - - // Sets the item position - bool SetItemPosition(long item, const wxPoint& pos) ; - - // Gets the number of items in the list control - int GetItemCount() const; - - // Gets the number of columns in the list control - int GetColumnCount() const { return m_colCount; } - - // get the horizontal and vertical components of the item spacing - wxSize GetItemSpacing() const; - - // Foreground colour of an item. - void SetItemTextColour( long item, const wxColour& col); - wxColour GetItemTextColour( long item ) const; - - // Background colour of an item. - void SetItemBackgroundColour( long item, const wxColour &col); - wxColour GetItemBackgroundColour( long item ) const; - - // Font of an item. - void SetItemFont( long item, const wxFont &f); - wxFont GetItemFont( long item ) const; - - // Gets the number of selected items in the list control - int GetSelectedItemCount() const; - - // Gets the text colour of the listview - wxColour GetTextColour() const; - - // Sets the text colour of the listview - void SetTextColour(const wxColour& col); - - // Gets the index of the topmost visible item when in - // list or report view - long GetTopItem() const ; - - // Add or remove a single window style - void SetSingleStyle(long style, bool add = true) ; - - // Set the whole window style - void SetWindowStyleFlag(long style) ; - - // Searches for an item, starting from 'item'. - // item can be -1 to find the first item that matches the - // specified flags. - // Returns the item or -1 if unsuccessful. - long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; - - // Gets one of the three image lists - wxImageList *GetImageList(int which) const ; - - // Sets the image list - // N.B. There's a quirk in the Win95 list view implementation. - // If in wxLC_LIST mode, it'll *still* display images by the labels if - // there's a small-icon image list set for the control - even though you - // haven't specified wxLIST_MASK_IMAGE when inserting. - // So you have to set a NULL small-icon image list to be sure that - // the wxLC_LIST mode works without icons. Of course, you may want icons... - void SetImageList(wxImageList *imageList, int which) ; - void AssignImageList(wxImageList *imageList, int which) ; - - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - // are we in virtual report mode? - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - - // refresh items selectively (only useful for virtual list controls) - void RefreshItem(long item); - void RefreshItems(long itemFrom, long itemTo); - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Arranges the items - bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); - - // Deletes an item - bool DeleteItem(long item); - - // Deletes all items - bool DeleteAllItems() ; - - // Deletes a column - bool DeleteColumn(int col); - - // Deletes all columns - bool DeleteAllColumns(); - - // Clears items, and columns if there are any. - void ClearAll(); - - // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); - - // End label editing, optionally cancelling the edit - bool EndEditLabel(bool cancel); - - // Ensures this item is visible - bool EnsureVisible(long item) ; - - // Find an item whose label matches this string, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, const wxString& str, bool partial = false); - - // Find an item whose data matches this data, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, wxUIntPtr data); - - // Find an item nearest this position in the specified direction, starting from - // the item after 'start' or the beginning if 'start' is -1. - long FindItem(long start, const wxPoint& pt, int direction); - - // Determines which item (if any) is at the specified point, - // giving details in 'flags' (see wxLIST_HITTEST_... flags above) - // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; - - // Inserts an item, returning the index of the new item if successful, - // -1 otherwise. - long InsertItem(const wxListItem& info); - - // Insert a string item - long InsertItem(long index, const wxString& label); - - // Insert an image item - long InsertItem(long index, int imageIndex); - - // Insert an image/string item - long InsertItem(long index, const wxString& label, int imageIndex); - - // For list view mode (only), inserts a column. - long InsertColumn(long col, const wxListItem& info); - - long InsertColumn(long col, - const wxString& heading, - int format = wxLIST_FORMAT_LEFT, - int width = -1); - - // set the number of items in a virtual list control - void SetItemCount(long count); - - // Scrolls the list control. If in icon, small icon or report view mode, - // x specifies the number of pixels to scroll. If in list view mode, x - // specifies the number of columns to scroll. - // If in icon, small icon or list view mode, y specifies the number of pixels - // to scroll. If in report view mode, y specifies the number of lines to scroll. - bool ScrollList(int dx, int dy); - - // Sort items. - - // fn is a function which takes 3 long arguments: item1, item2, data. - // item1 is the long data associated with a first item (NOT the index). - // item2 is the long data associated with a second item (NOT the index). - // data is the same value as passed to SortItems. - // The return value is a negative number if the first item should precede the second - // item, a positive number of the second item should precede the first, - // or zero if the two items are equivalent. - - // data is arbitrary data to be passed to the sort function. - bool SortItems(wxListCtrlCompare fn, long data); - - // IMPLEMENTATION - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWShouldPreProcessMessage(WXMSG* msg); - - // bring the control in sync with current m_windowStyle value - void UpdateStyle(); - - // Event handlers - //////////////////////////////////////////////////////////////////////////// - // Necessary for drawing hrules and vrules, if specified - void OnPaint(wxPaintEvent& event); - - - virtual bool ShouldInheritColours() const { return false; } - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete stuff, for compatibility only -- don't use - wxDEPRECATED( int GetItemSpacing(bool isSmall) const); -#endif // WXWIN_COMPATIBILITY_2_6 - - // convert our styles to Windows - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // special Windows message handling - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // free memory taken by all internal data - void FreeAllInternalData(); - - // get the item attribute, either by quering it for virtual control, or by - // returning the one previously set using setter methods for a normal one - wxListItemAttr *DoGetItemAttr(long item) const; - - - wxTextCtrl* m_textCtrl; // The control used for editing a label - wxImageList * m_imageListNormal; // The image list for normal icons - wxImageList * m_imageListSmall; // The image list for small icons - wxImageList * m_imageListState; // The image list state icons (not implemented yet) - bool m_ownsImageListNormal, - m_ownsImageListSmall, - m_ownsImageListState; - - int m_colCount; // Windows doesn't have GetColumnCount so must - // keep track of inserted/deleted columns - long m_count; // Keep track of item count to save calls to - // ListView_GetItemCount - bool m_ignoreChangeMessages; - - // true if we have any internal data (user data & attributes) - bool m_AnyInternalData; - - // true if we have any items with custom attributes - bool m_hasAnyAttr; - - // these functions are only used for virtual list view controls, i.e. the - // ones with wxLC_VIRTUAL style - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the item (may return NULL if none) - virtual wxListItemAttr *OnGetItemAttr(long item) const; - -private: - // process NM_CUSTOMDRAW notification message - WXLPARAM OnCustomDraw(WXLPARAM lParam); - - // set the extended styles for the control (used by Create() and - // UpdateStyle()), only should be called if InReportView() - void MSWSetExListStyles(); - - // initialize the (already created) m_textCtrl with the associated HWND - void InitEditControl(WXHWND hWnd); - - // destroy m_textCtrl if it's currently valid and reset it to NULL - void DeleteEditControl(); - - DECLARE_DYNAMIC_CLASS(wxListCtrl) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxListCtrl) -}; - -#endif // _WX_LISTCTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/mdi.h b/Source/3rdParty/wx/include/wx/msw/mdi.h deleted file mode 100644 index 46f7f1059..000000000 --- a/Source/3rdParty/wx/include/wx/msw/mdi.h +++ /dev/null @@ -1,238 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mdi.h -// Purpose: MDI (Multiple Document Interface) classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: mdi.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MDI_H_ -#define _WX_MDI_H_ - -#include "wx/frame.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; -class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - -// --------------------------------------------------------------------------- -// wxMDIParentFrame -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIParentFrame : public wxFrame -{ -public: - wxMDIParentFrame(); - wxMDIParentFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - virtual ~wxMDIParentFrame(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - - // accessors - // --------- - - // Get the active MDI child window (Windows only) - wxMDIChildFrame *GetActiveChild() const; - - // Get the client window - wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } - - // Create the client window class (don't Create the window, - // just return a new class) - virtual wxMDIClientWindow *OnCreateClient(void); - - // MDI windows menu - wxMenu* GetWindowMenu() const { return m_windowMenu; } - void SetWindowMenu(wxMenu* menu) ; - virtual void DoMenuUpdates(wxMenu* menu = NULL); - - // MDI operations - // -------------- - virtual void Cascade(); - virtual void Tile(wxOrientation orient = wxHORIZONTAL); - virtual void ArrangeIcons(); - virtual void ActivateNext(); - virtual void ActivatePrevious(); - - // handlers - // -------- - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - void OnSize(wxSizeEvent& event); - void OnIconized(wxIconizeEvent& event); - - bool HandleActivate(int state, bool minimized, WXHWND activate); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - - // override window proc for MDI-specific message processing - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); - virtual bool MSWTranslateMessage(WXMSG* msg); - -protected: -#if wxUSE_MENUS_NATIVE - virtual void InternalSetMenuBar(); -#endif // wxUSE_MENUS_NATIVE - - virtual WXHICON GetDefaultIcon() const; - - // set the size of the MDI client window to match the frame size - void UpdateClientSize(); - - - wxMDIClientWindow * m_clientWindow; - wxMDIChildFrame * m_currentChild; - wxMenu* m_windowMenu; - - // true if MDI Frame is intercepting commands, not child - bool m_parentFrameActive; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - DECLARE_NO_COPY_CLASS(wxMDIParentFrame) -}; - -// --------------------------------------------------------------------------- -// wxMDIChildFrame -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIChildFrame : public wxFrame -{ -public: - wxMDIChildFrame() { Init(); } - wxMDIChildFrame(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - Create(parent, id, title, pos, size, style, name); - } - - virtual ~wxMDIChildFrame(); - - bool Create(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual bool IsTopLevel() const { return false; } - - // MDI operations - virtual void Maximize(bool maximize = true); - virtual void Restore(); - virtual void Activate(); - - // Implementation only from now on - // ------------------------------- - - // Handlers - bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); - bool HandleWindowPosChanging(void *lpPos); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleGetMinMaxInfo(void *mmInfo); - - virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWTranslateMessage(WXMSG *msg); - - virtual void MSWDestroyWindow(); - - bool ResetWindowStyle(void *vrect); - - void OnIdle(wxIdleEvent& event); - - virtual bool Show(bool show = true); - -protected: - virtual void DoGetScreenPosition(int *x, int *y) const; - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoSetClientSize(int width, int height); - virtual void InternalSetMenuBar(); - virtual bool IsMDIChild() const { return true; } - virtual void DetachMenuBar(); - - virtual WXHICON GetDefaultIcon() const; - - // common part of all ctors - void Init(); - -private: - bool m_needsInitialShow; // Show must be called in idle time after Creation - bool m_needsResize; // flag which tells us to artificially resize the frame - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) -}; - -// --------------------------------------------------------------------------- -// wxMDIClientWindow -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIClientWindow : public wxWindow -{ -public: - wxMDIClientWindow() { Init(); } - wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) - { - Init(); - - CreateClient(parent, style); - } - - // Note: this is virtual, to allow overridden behaviour. - virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL); - - // Explicitly call default scroll behaviour - void OnScroll(wxScrollEvent& event); - -protected: - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - void Init() { m_scrollX = m_scrollY = 0; } - - int m_scrollX, m_scrollY; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) -}; - -#endif - // _WX_MDI_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/menu.h b/Source/3rdParty/wx/include/wx/msw/menu.h deleted file mode 100644 index b25f77d5d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/menu.h +++ /dev/null @@ -1,241 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/menu.h -// Purpose: wxMenu, wxMenuBar classes -// Author: Julian Smart -// Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) -// Created: 01/02/97 -// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENU_H_ -#define _WX_MENU_H_ - -#if wxUSE_ACCEL - #include "wx/accel.h" - #include "wx/dynarray.h" - - WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); -#endif // wxUSE_ACCEL - -class WXDLLIMPEXP_FWD_CORE wxFrame; - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR -class WXDLLIMPEXP_FWD_CORE wxToolBar; -#endif - - -// Not using a combined wxToolBar/wxMenuBar? then use -// a commandbar in WinCE .NET to implement the -// menubar, since there is no ::SetMenu function. -#if defined(__WXWINCE__) -# if ((_WIN32_WCE >= 400) && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) || \ - defined(__HANDHELDPC__) -# define WINCE_WITH_COMMANDBAR -# else -# define WINCE_WITHOUT_COMMANDBAR -# endif -#endif - - -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// Menu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenu : public wxMenuBase -{ -public: - // ctors & dtor - wxMenu(const wxString& title, long style = 0) - : wxMenuBase(title, style) { Init(); } - - wxMenu(long style = 0) : wxMenuBase(style) { Init(); } - - virtual ~wxMenu(); - - virtual void Break(); - - virtual void SetTitle(const wxString& title); - - // implementation only from now on - // ------------------------------- - - virtual void Attach(wxMenuBarBase *menubar); - - bool MSWCommand(WXUINT param, WXWORD id); - - // semi-private accessors - // get the window which contains this menu - wxWindow *GetWindow() const; - // get the menu handle - WXHMENU GetHMenu() const { return m_hMenu; } - -#if wxUSE_ACCEL - // called by wxMenuBar to build its accel table from the accels of all menus - bool HasAccels() const { return !m_accels.IsEmpty(); } - size_t GetAccelCount() const { return m_accels.GetCount(); } - size_t CopyAccels(wxAcceleratorEntry *accels) const; - - // called by wxMenuItem when its accels changes - void UpdateAccel(wxMenuItem *item); - - // helper used by wxMenu itself (returns the index in m_accels) - int FindAccel(int id) const; -#endif // wxUSE_ACCEL - -protected: - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); - -private: - // common part of all ctors - void Init(); - - // common part of Append/Insert (behaves as Append is pos == (size_t)-1) - bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); - - // terminate the current radio group, if any - void EndRadioGroup(); - - // if true, insert a breal before appending the next item - bool m_doBreak; - - // the position of the first item in the current radio group or -1 - int m_startRadioGroup; - - // the menu handle of this menu - WXHMENU m_hMenu; - -#if wxUSE_ACCEL - // the accelerators for our menu items - wxAcceleratorArray m_accels; -#endif // wxUSE_ACCEL - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) -}; - -// ---------------------------------------------------------------------------- -// Menu Bar (a la Windows) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuInfo : public wxObject -{ -public : - wxMenuInfo() { m_menu = NULL; } - virtual ~wxMenuInfo() { } - - void Create( wxMenu *menu , const wxString &title ) - { m_menu = menu; m_title = title; } - wxMenu* GetMenu() const { return m_menu; } - wxString GetTitle() const { return m_title; } -private : - wxMenu *m_menu; - wxString m_title; - - DECLARE_DYNAMIC_CLASS(wxMenuInfo) -}; - -WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList ); - -class WXDLLEXPORT wxMenuBar : public wxMenuBarBase -{ -public: - // ctors & dtor - // default constructor - wxMenuBar(); - // unused under MSW - wxMenuBar(long style); - // menubar takes ownership of the menus arrays but copies the titles - wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); - virtual ~wxMenuBar(); - - // menubar construction - bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ); } - const wxMenuInfoList& GetMenuInfos() const; - - virtual bool Append( wxMenu *menu, const wxString &title ); - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Remove(size_t pos); - - virtual void EnableTop( size_t pos, bool flag ); - virtual void SetLabelTop( size_t pos, const wxString& label ); - virtual wxString GetLabelTop( size_t pos ) const; - - // implementation from now on - WXHMENU Create(); - virtual void Detach(); - virtual void Attach(wxFrame *frame); - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - // Under WinCE, a menubar is owned by the frame's toolbar - void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; } - wxToolBar* GetToolBar() const { return m_toolBar; } -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND GetCommandBar() const { return m_commandBar; } - bool AddAdornments(long style); -#endif - -#if wxUSE_ACCEL - // get the accel table for all the menus - const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } - - // update the accel table (must be called after adding/deleting a menu) - void RebuildAccelTable(); -#endif // wxUSE_ACCEL - - // get the menu handle - WXHMENU GetHMenu() const { return m_hMenu; } - - // if the menubar is modified, the display is not updated automatically, - // call this function to update it (m_menuBarFrame should be !NULL) - void Refresh(); - - // To avoid compile warning - void Refresh( bool eraseBackground, - const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } - -protected: - // common part of all ctors - void Init(); - - wxArrayString m_titles; - wxMenuInfoList m_menuInfos; - - WXHMENU m_hMenu; - - // Return the MSW position for a wxMenu which is sometimes different from - // the wxWidgets position. - int MSWPositionForWxMenu(wxMenu *menu, int wxpos); -#if wxUSE_ACCEL - // the accelerator table for all accelerators in all our menus - wxAcceleratorTable m_accelTable; -#endif // wxUSE_ACCEL - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - wxToolBar* m_toolBar; -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND m_commandBar; - bool m_adornmentsAdded; -#endif - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) - -public: - -#if wxABI_VERSION >= 20805 - // Gets the original label at the top-level of the menubar - wxString GetMenuLabel(size_t pos) const; -#endif -}; - -#endif // _WX_MENU_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/menuitem.h b/Source/3rdParty/wx/include/wx/msw/menuitem.h deleted file mode 100644 index 641365848..000000000 --- a/Source/3rdParty/wx/include/wx/msw/menuitem.h +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: menuitem.h -// Purpose: wxMenuItem class -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.11.97 -// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MENUITEM_H -#define _MENUITEM_H - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_OWNER_DRAWN - #include "wx/ownerdrw.h" // base class -#endif - -// ---------------------------------------------------------------------------- -// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuItem : public wxMenuItemBase -#if wxUSE_OWNER_DRAWN - , public wxOwnerDrawn -#endif -{ -public: - // ctor & dtor - wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, - int id = wxID_SEPARATOR, - const wxString& name = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - virtual ~wxMenuItem(); - - // override base class virtuals - virtual void SetText(const wxString& strName); - virtual void SetCheckable(bool checkable); - - virtual void Enable(bool bDoEnable = true); - virtual void Check(bool bDoCheck = true); - virtual bool IsChecked() const; - - // unfortunately needed to resolve ambiguity between - // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() - bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } - - // the id for a popup menu is really its menu handle (as required by - // ::AppendMenu() API), so this function will return either the id or the - // menu handle depending on what we're - int GetRealId() const; - - // mark item as belonging to the given radio group - void SetAsRadioGroupStart(); - void SetRadioGroupStart(int start); - void SetRadioGroupEnd(int end); - - // compatibility only, don't use in new code - wxMenuItem(wxMenu *parentMenu, - int id, - const wxString& text, - const wxString& help, - bool isCheckable, - wxMenu *subMenu = (wxMenu *)NULL); - -private: - // common part of all ctors - void Init(); - - // the positions of the first and last items of the radio group this item - // belongs to or -1: start is the radio group start and is valid for all - // but first radio group items (m_isRadioGroupStart == false), end is valid - // only for the first one - union - { - int start; - int end; - } m_radioGroup; - - // does this item start a radio group? - bool m_isRadioGroupStart; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) - -public: - -#if wxABI_VERSION >= 20805 - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - wxString GetItemLabel() const { return GetText(); } -#endif -}; - -#endif //_MENUITEM_H diff --git a/Source/3rdParty/wx/include/wx/msw/mimetype.h b/Source/3rdParty/wx/include/wx/msw/mimetype.h deleted file mode 100644 index 9052d07dc..000000000 --- a/Source/3rdParty/wx/include/wx/msw/mimetype.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/defs.h" - -#if wxUSE_MIMETYPE - -#include "wx/mimetype.h" - -// ---------------------------------------------------------------------------- -// wxFileTypeImpl is the MSW version of wxFileType, this is a private class -// and is never used directly by the application -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileTypeImpl -{ -public: - // ctor - wxFileTypeImpl() { } - - // one of these Init() function must be called (ctor can't take any - // arguments because it's common) - - // initialize us with our file type name and extension - in this case - // we will read all other data from the registry - void Init(const wxString& strFileType, const wxString& ext); - - // implement accessor functions - bool GetExtensions(wxArrayString& extensions); - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - bool GetIcon(wxIconLocation *iconLoc) const; - bool GetDescription(wxString *desc) const; - bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const; - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) const; - - size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, - const wxFileType::MessageParameters& params) const; - - bool Unassociate(); - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is true - bool SetCommand(const wxString& cmd, - const wxString& verb, - bool overwriteprompt = true); - - bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); - - // this is called by Associate - bool SetDescription (const wxString& desc); - -private: - // helper function: reads the command corresponding to the specified verb - // from the registry (returns an empty string if not found) - wxString GetCommand(const wxChar *verb) const; - - // get the registry path for the given verb - wxString GetVerbPath(const wxString& verb) const; - - // check that the registry key for our extension exists, create it if it - // doesn't, return false if this failed - bool EnsureExtKeyExists(); - - wxString m_strFileType, // may be empty - m_ext; - - // these methods are not publicly accessible (as wxMimeTypesManager - // doesn't know about them), and should only be called by Unassociate - - bool RemoveOpenCommand(); - bool RemoveCommand(const wxString& verb); - bool RemoveMimeType(); - bool RemoveDefaultIcon(); - bool RemoveDescription(); -}; - -class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl -{ -public: - // nothing to do here, we don't load any data but just go and fetch it from - // the registry when asked for - wxMimeTypesManagerImpl() { } - - // implement containing class functions - wxFileType *GetFileTypeFromExtension(const wxString& ext); - wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext); - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - // this are NOPs under Windows - bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true) - { return true; } - bool ReadMimeTypes(const wxString& WXUNUSED(filename)) - { return true; } - - // create a new filetype association - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - - // create a new filetype with the given name and extension - wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); -}; - -#endif // wxUSE_MIMETYPE - -#endif - //_MIMETYPE_IMPL_H - diff --git a/Source/3rdParty/wx/include/wx/msw/minifram.h b/Source/3rdParty/wx/include/wx/msw/minifram.h deleted file mode 100644 index d2e23d9cf..000000000 --- a/Source/3rdParty/wx/include/wx/msw/minifram.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/minifram.h -// Purpose: wxMiniFrame class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: minifram.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MINIFRAM_H_ -#define _WX_MINIFRAM_H_ - -#include "wx/frame.h" - -class WXDLLEXPORT wxMiniFrame : public wxFrame -{ -public: - wxMiniFrame() { } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, - const wxString& name = wxFrameNameStr) - { - return wxFrame::Create(parent, id, title, pos, size, - style | - wxFRAME_TOOL_WINDOW | - (parent ? wxFRAME_FLOAT_ON_PARENT : 0), name); - } - - wxMiniFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame) -}; - -#endif - // _WX_MINIFRAM_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/missing.h b/Source/3rdParty/wx/include/wx/msw/missing.h deleted file mode 100644 index c84134bdf..000000000 --- a/Source/3rdParty/wx/include/wx/msw/missing.h +++ /dev/null @@ -1,495 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/missing.h -// Purpose: Declarations for parts of the Win32 SDK that are missing in -// the versions that come with some compilers -// Created: 2002/04/23 -// RCS-ID: $Id: missing.h 48436 2007-08-28 19:26:16Z JS $ -// Copyright: (c) 2002 Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MISSING_H_ -#define _WX_MISSING_H_ - -/* - * The following are required for VC++ 6. - */ - -// Needed by cursor.cpp -#ifndef IDC_HAND - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -// Needed by strconv.cpp -#ifndef WC_NO_BEST_FIT_CHARS - #define WC_NO_BEST_FIT_CHARS 0x400 -#endif - -#ifndef WM_CONTEXTMENU - #define WM_CONTEXTMENU 0x007B -#endif - -// Needed by toplevel.cpp -#ifndef WM_UPDATEUISTATE - #define WM_UPDATEUISTATE 0x0128 -#endif - -#ifndef WM_CHANGEUISTATE - #define WM_CHANGEUISTATE 0x0127 -#endif - -#ifndef WM_PRINTCLIENT - #define WM_PRINTCLIENT 0x318 -#endif - -// Needed by toplevel.cpp -#ifndef UIS_SET - #define UIS_SET 1 - #define UIS_CLEAR 2 - #define UIS_INITIALIZE 3 -#endif - -#ifndef UISF_HIDEFOCUS - #define UISF_HIDEFOCUS 1 -#endif - -#ifndef UISF_HIDEACCEL - #define UISF_HIDEACCEL 2 -#endif - -#ifndef OFN_EXPLORER - #define OFN_EXPLORER 0x00080000 -#endif - -#ifndef OFN_ENABLESIZING - #define OFN_ENABLESIZING 0x00800000 -#endif - -// Needed by window.cpp -#if wxUSE_MOUSEWHEEL - #ifndef WM_MOUSEWHEEL - #define WM_MOUSEWHEEL 0x020A - #endif - #ifndef WHEEL_DELTA - #define WHEEL_DELTA 120 - #endif - #ifndef SPI_GETWHEELSCROLLLINES - #define SPI_GETWHEELSCROLLLINES 104 - #endif -#endif // wxUSE_MOUSEWHEEL - -// Needed by window.cpp -#ifndef VK_OEM_1 - #define VK_OEM_1 0xBA - #define VK_OEM_2 0xBF - #define VK_OEM_3 0xC0 - #define VK_OEM_4 0xDB - #define VK_OEM_5 0xDC - #define VK_OEM_6 0xDD - #define VK_OEM_7 0xDE -#endif - -#ifndef VK_OEM_COMMA - #define VK_OEM_PLUS 0xBB - #define VK_OEM_COMMA 0xBC - #define VK_OEM_MINUS 0xBD - #define VK_OEM_PERIOD 0xBE -#endif - -#ifndef SM_TABLETPC - #define SM_TABLETPC 86 -#endif - -#ifndef INKEDIT_CLASS -# define INKEDIT_CLASSW L"INKEDIT" -# ifdef UNICODE -# define INKEDIT_CLASS INKEDIT_CLASSW -# else -# define INKEDIT_CLASS "INKEDIT" -# endif -#endif - -#ifndef EM_SETINKINSERTMODE -# define EM_SETINKINSERTMODE (WM_USER + 0x0204) -#endif - -#ifndef EM_SETUSEMOUSEFORINPUT -#define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224) -#endif - -#ifndef TPM_RECURSE -#define TPM_RECURSE 1 -#endif - - -#ifndef WS_EX_LAYOUTRTL -#define WS_EX_LAYOUTRTL 0x00400000 -#endif - -#ifndef WS_EX_COMPOSITED -#define WS_EX_COMPOSITED 0x02000000L -#endif - -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x00080000 -#endif - -#ifndef LWA_ALPHA -#define LWA_ALPHA 2 -#endif - -#if defined __VISUALC__ && __VISUALC__ <= 1200 && !defined MIIM_BITMAP -#define MIIM_STRING 0x00000040 -#define MIIM_BITMAP 0x00000080 -#define MIIM_FTYPE 0x00000100 -#define HBMMENU_CALLBACK ((HBITMAP) -1) -typedef struct tagMENUINFO -{ - DWORD cbSize; - DWORD fMask; - DWORD dwStyle; - UINT cyMax; - HBRUSH hbrBack; - DWORD dwContextHelpID; - DWORD dwMenuData; -} MENUINFO, FAR *LPMENUINFO; -struct wxMENUITEMINFO_ -{ - UINT cbSize; - UINT fMask; - UINT fType; - UINT fState; - UINT wID; - HMENU hSubMenu; - HBITMAP hbmpChecked; - HBITMAP hbmpUnchecked; - DWORD dwItemData; - LPTSTR dwTypeData; - UINT cch; - HBITMAP hbmpItem; -}; -#else -#define wxMENUITEMINFO_ MENUITEMINFO -#endif - -/* - * The following are required for VC++ 5 when the PSDK is not available. - */ - -#if defined __VISUALC__ && __VISUALC__ <= 1100 - -#ifndef VER_NT_WORKSTATION - -typedef struct _OSVERSIONINFOEXA { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - CHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; -typedef struct _OSVERSIONINFOEXW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW; - -#ifdef UNICODE -typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#else -typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#endif - -#endif // defined VER_NT_WORKSTATION - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// NMLVCUSTOMDRAW originally didn't have the iSubItem member. It was added -// with IE4, as was IPN_FIRST which is used as a test :-(. -// -#ifndef IPN_FIRST - -typedef struct wxtagNMLVCUSTOMDRAW_ { - NMCUSTOMDRAW nmcd; - COLORREF clrText; - COLORREF clrTextBk; - int iSubItem; -} wxNMLVCUSTOMDRAW_, *wxLPNMLVCUSTOMDRAW_; - -#define NMLVCUSTOMDRAW wxNMLVCUSTOMDRAW_ -#define LPNMLVCUSTOMDRAW wxLPNMLVCUSTOMDRAW_ - -#endif // defined IPN_FIRST - -#endif // defined __VISUALC__ && __VISUALC__ <= 1100 - -// ---------------------------------------------------------------------------- -// ListView common control -// Needed by listctrl.cpp -// ---------------------------------------------------------------------------- - -#ifndef LVS_EX_FULLROWSELECT - #define LVS_EX_FULLROWSELECT 0x00000020 -#endif - -#ifndef LVS_EX_LABELTIP - #define LVS_EX_LABELTIP 0x00004000 -#endif - -#ifndef LVS_EX_SUBITEMIMAGES - #define LVS_EX_SUBITEMIMAGES 0x00000002 -#endif - -#ifndef HDN_GETDISPINFOW - #define HDN_GETDISPINFOW (HDN_FIRST-29) -#endif - - /* - * In addition to the above, the following are required for several compilers. - */ - -#if !defined(CCS_VERT) -#define CCS_VERT 0x00000080L -#endif - -#if !defined(CCS_RIGHT) -#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM) -#endif - -#if !defined(TB_SETDISABLEDIMAGELIST) - #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) -#endif // !defined(TB_SETDISABLEDIMAGELIST) - -#ifndef CFM_BACKCOLOR - #define CFM_BACKCOLOR 0x04000000 -#endif - -#ifndef HANGUL_CHARSET - #define HANGUL_CHARSET 129 -#endif - -#ifndef CCM_SETUNICODEFORMAT - #define CCM_SETUNICODEFORMAT 8197 -#endif - -// ---------------------------------------------------------------------------- -// Tree control -// ---------------------------------------------------------------------------- - -#ifndef TV_FIRST - #define TV_FIRST 0x1100 -#endif - -#ifndef TVS_FULLROWSELECT - #define TVS_FULLROWSELECT 0x1000 -#endif - -#ifndef TVM_SETBKCOLOR - #define TVM_SETBKCOLOR (TV_FIRST + 29) - #define TVM_SETTEXTCOLOR (TV_FIRST + 30) -#endif - - /* - * The following are required for BC++ 5.5 (none at present.) - */ - - /* - * The following are specifically required for Digital Mars C++ - */ - -#ifdef __DMC__ - -typedef struct _OSVERSIONINFOEX { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - TCHAR szCSDVersion[ 128 ]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEX; - -#ifndef _TrackMouseEvent - #define _TrackMouseEvent TrackMouseEvent -#endif - -#ifndef LVM_SETEXTENDEDLISTVIEWSTYLE - #define LVM_SETEXTENDEDLISTVIEWSTYLE (0x1000 + 54) -#endif - -#ifndef LVM_GETSUBITEMRECT - #define LVM_GETSUBITEMRECT (0x1000 + 56) -#endif - -#ifndef LVCF_IMAGE - #define LVCF_IMAGE 0x0010 -#endif - -#ifndef Header_GetItemRect - #define Header_GetItemRect(w,i,r) \ - (BOOL)SendMessage((w),HDM_GETITEMRECT,(WPARAM)(i),(LPARAM)(r)) -#endif - -#ifndef HDM_GETITEMRECT - #define HDM_GETITEMRECT (HDM_FIRST+7) -#endif - -#ifndef ListView_GetHeader - #define ListView_GetHeader(w) (HWND)SendMessage((w),LVM_GETHEADER,0,0) -#endif - -#ifndef ListView_GetSubItemRect - #define ListView_GetSubItemRect(w, i, s, c, p) (HWND)SendMessage(w,LVM_GETSUBITEMRECT,i, ((p) ? ((((LPRECT)(p))->top = s), (((LPRECT)(p))->left = c), (LPARAM)(p)) : (LPARAM)(LPRECT)NULL)) -#endif - -#ifndef LVM_GETHEADER - #define LVM_GETHEADER (LVM_FIRST+31) -#endif - -#ifndef LVSICF_NOSCROLL - #define LVSICF_NOINVALIDATEALL 0x0001 - #define LVSICF_NOSCROLL 0x0002 -#endif - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// ---------------------------------------------------------------------------- -// wxDisplay -// ---------------------------------------------------------------------------- - -// The windows headers with Digital Mars lack some typedefs. -// typedef them as my_XXX and then #define to rename to XXX in case -// a newer version of Digital Mars fixes the headers -// (or up to date PSDK is in use with older version) -// also we use any required definition (MONITOR_DEFAULTTONULL) to recognize -// whether whole missing block needs to be included - -#ifndef MONITOR_DEFAULTTONULL - - #define HMONITOR_DECLARED - DECLARE_HANDLE(HMONITOR); - typedef BOOL(CALLBACK* my_MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); - #define MONITORENUMPROC my_MONITORENUMPROC - typedef struct my_tagMONITORINFO { - DWORD cbSize; - RECT rcMonitor; - RECT rcWork; - DWORD dwFlags; - } my_MONITORINFO,*my_LPMONITORINFO; - #define MONITORINFO my_MONITORINFO - #define LPMONITORINFO my_LPMONITORINFO - - typedef struct my_MONITORINFOEX : public my_tagMONITORINFO - { - TCHAR szDevice[CCHDEVICENAME]; - } my_MONITORINFOEX, *my_LPMONITORINFOEX; - #define MONITORINFOEX my_MONITORINFOEX - #define LPMONITORINFOEX my_LPMONITORINFOEX - - #ifndef MONITOR_DEFAULTTONULL - #define MONITOR_DEFAULTTONULL 0 - #endif // MONITOR_DEFAULTTONULL - - #ifndef MONITORINFOF_PRIMARY - #define MONITORINFOF_PRIMARY 1 - #endif // MONITORINFOF_PRIMARY - - #ifndef DDENUM_ATTACHEDSECONDARYDEVICES - #define DDENUM_ATTACHEDSECONDARYDEVICES 1 - #endif - -#endif // MONITOR_DEFAULTTONULL - -// ---------------------------------------------------------------------------- -// Tree control -// ---------------------------------------------------------------------------- - -#ifndef TVIS_FOCUSED - #define TVIS_FOCUSED 0x0001 -#endif - -#ifndef TVS_CHECKBOXES - #define TVS_CHECKBOXES 0x0100 -#endif - -#ifndef TVITEM - #define TVITEM TV_ITEM -#endif - -#endif - // DMC++ - - /* - * The following are specifically required for OpenWatcom C++ (none at present) - */ - -#if defined(__WATCOMC__) -#endif - - /* - * The following are specifically required for MinGW (none at present) - */ - -#if defined (__MINGW32__) - -#if !wxCHECK_W32API_VERSION(3,1) - -#include -#include "wx/msw/winundef.h" - -typedef struct -{ - RECT rgrc[3]; - WINDOWPOS *lppos; -} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; - -#endif - -#endif - - /* - * In addition to the declarations for VC++, the following are required for WinCE - */ - -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" -#endif - - /* - * The following are specifically required for Wine - */ - -#ifdef __WINE__ - #ifndef ENUM_CURRENT_SETTINGS - #define ENUM_CURRENT_SETTINGS ((DWORD)-1) - #endif - #ifndef BROADCAST_QUERY_DENY - #define BROADCAST_QUERY_DENY 1112363332 - #endif -#endif // defined __WINE__ - -#endif - // _WX_MISSING_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/msgdlg.h b/Source/3rdParty/wx/include/wx/msw/msgdlg.h deleted file mode 100644 index 690678b8d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/msgdlg.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/msgdlg.h -// Purpose: wxMessageDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: msgdlg.h 37164 2006-01-26 17:20:50Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGBOXDLG_H_ -#define _WX_MSGBOXDLG_H_ - -#include "wx/defs.h" -#include "wx/dialog.h" - -/* - * Message box dialog - */ - -extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; - -class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase -{ -DECLARE_DYNAMIC_CLASS(wxMessageDialog) -protected: - wxString m_caption; - wxString m_message; - wxWindow * m_parent; -public: - wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - - int ShowModal(void); - - DECLARE_NO_COPY_CLASS(wxMessageDialog) -}; - - -#endif - // _WX_MSGBOXDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/mslu.h b/Source/3rdParty/wx/include/wx/msw/mslu.h deleted file mode 100644 index 83f4060d7..000000000 --- a/Source/3rdParty/wx/include/wx/msw/mslu.h +++ /dev/null @@ -1,23 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mslu.h -// Purpose: MSLU-related declarations -// Author: Vaclav Slavik -// Modified by: Vadim Zeitlin to move out various functions to other files -// to fix header inter-dependencies -// Created: 2002/02/17 -// RCS-ID: $Id: mslu.h 42462 2006-10-26 19:06:51Z VZ $ -// Copyright: (c) 2002 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSLU_H_ -#define _WX_MSLU_H_ - -#include "wx/defs.h" - -// Returns true if we are running under Unicode emulation in Win9x environment. -// Workaround hacks take effect only if this condition is met -// (NB: this function is needed even if !wxUSE_UNICODE_MSLU) -WXDLLIMPEXP_BASE bool wxUsingUnicowsDll(); - -#endif // _WX_MSLU_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/msvcrt.h b/Source/3rdParty/wx/include/wx/msw/msvcrt.h deleted file mode 100644 index 15c4dfbde..000000000 --- a/Source/3rdParty/wx/include/wx/msw/msvcrt.h +++ /dev/null @@ -1,69 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/msvcrt.h -// Purpose: macros to use some non-standard features of MS Visual C++ -// C run-time library -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.01.1999 -// RCS-ID: $Id: msvcrt.h 42363 2006-10-24 23:19:12Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// the goal of this file is to define wxCrtSetDbgFlag() macro which may be -// used like this: -// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); -// to turn on memory leak checks for programs compiled with Microsoft Visual -// C++ (5.0+). The macro will expand to nothing under other compilers. - -#ifndef _MSW_MSVCRT_H_ -#define _MSW_MSVCRT_H_ - -// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug -// builds -#undef wxUSE_VC_CRTDBG -#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ - && !defined(UNDER_CE) - // it doesn't combine well with wxWin own memory debugging methods - #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) - #define wxUSE_VC_CRTDBG - #endif -#endif - -#ifdef wxUSE_VC_CRTDBG - // VC++ uses this macro as debug/release mode indicator - #ifndef _DEBUG - #define _DEBUG - #endif - - // Need to undef new if including crtdbg.h which may redefine new itself - #ifdef new - #undef new - #endif - - #include - #ifndef _CRTBLD - // Need when builded with pure MS SDK - #define _CRTBLD - #endif - - #include - - #undef WXDEBUG_NEW - #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) - - // this define works around a bug with inline declarations of new, see - // - // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp - // - // for the details - #define new WXDEBUG_NEW - - #define wxCrtSetDbgFlag(flag) \ - _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag)) -#else // !using VC CRT - #define wxCrtSetDbgFlag(flag) -#endif // wxUSE_VC_CRTDBG - -#endif // _MSW_MSVCRT_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/notebook.h b/Source/3rdParty/wx/include/wx/msw/notebook.h deleted file mode 100644 index 5832c2d0e..000000000 --- a/Source/3rdParty/wx/include/wx/msw/notebook.h +++ /dev/null @@ -1,254 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/notebook.h -// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) -// Author: Robert Roebling -// Modified by: Vadim Zeitlin for Windows version -// RCS-ID: $Id: notebook.h 41797 2006-10-09 12:10:01Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _NOTEBOOK_H -#define _NOTEBOOK_H - -#if wxUSE_NOTEBOOK - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookPageInfo : public wxObject -{ -public : - wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } - virtual ~wxNotebookPageInfo() { } - - void Create(wxNotebookPage *page, - const wxString& text, - bool selected, - int imageId) - { - m_page = page; - m_text = text; - m_selected = selected; - m_imageId = imageId; - } - - wxNotebookPage* GetPage() const { return m_page; } - wxString GetText() const { return m_text; } - bool GetSelected() const { return m_selected; } - int GetImageId() const { return m_imageId; } - -private: - wxNotebookPage *m_page; - wxString m_text; - bool m_selected; - int m_imageId; - - DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) -}; - - -WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); - -class WXDLLEXPORT wxNotebook : public wxNotebookBase -{ -public: - // ctors - // ----- - // default for dynamic class - wxNotebook(); - // the same arguments as for wxControl (@@@ any special styles?) - wxNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // Create() function - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - virtual ~wxNotebook(); - - // accessors - // --------- - // get number of pages in the dialog - virtual size_t GetPageCount() const; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage); - // get the currently selected page - int GetSelection() const { return m_nSelection; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage); - - // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; - - // image list stuff: each page may have an image associated with it. All - // the images belong to an image list, so you have to - // 1) create an image list - // 2) associate it with the notebook - // 3) set for each page it's image - // associate image list with a control - void SetImageList(wxImageList* imageList); - - // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); - - // currently it's always 1 because wxGTK doesn't support multi-row - // tab controls - int GetRowCount() const; - - // control the appearance of the notebook pages - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); - // set the padding between tabs (in pixels) - void SetPadding(const wxSize& padding); - - // operations - // ---------- - // remove all pages - bool DeleteAllPages(); - - // inserts a new page to the notebook (it will be deleted ny the notebook, - // don't delete it yourself). If bSelect, this page becomes active. - bool InsertPage(size_t nPage, - wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = false, - int imageId = -1); - - void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); } - const wxNotebookPageInfoList& GetPageInfos() const; - - // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH - // style. - void SetTabSize(const wxSize& sz); - - // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - // calculate the size of the notebook from the size of its page - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // callbacks - // --------- - void OnSize(wxSizeEvent& event); - void OnSelChange(wxNotebookEvent& event); - void OnNavigationKey(wxNavigationKeyEvent& event); - - // base class virtuals - // ------------------- - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - -#if wxUSE_CONSTRAINTS - virtual void SetConstraintSizes(bool recurse = true); - virtual bool DoPhase(int nPhase); -#endif // wxUSE_CONSTRAINTS - - // Attempts to get colour for UX theme page background - wxColour GetThemeBackgroundColour() const; - - // implementation only - // ------------------- - -#if wxUSE_UXTHEME - virtual bool SetBackgroundColour(const wxColour& colour) - { - if ( !wxNotebookBase::SetBackgroundColour(colour) ) - return false; - - UpdateBgBrush(); - - return true; - } - - // return the themed brush for painting our children - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); - - // draw child background - virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win); -#endif // wxUSE_UXTHEME - - // translate wxWin styles to the Windows ones - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // common part of all ctors - void Init(); - - // hides the currently shown page and shows the given one (if not -1) and - // updates m_nSelection accordingly - void UpdateSelection(int selNew); - - // remove one page from the notebook, without deleting - virtual wxNotebookPage *DoRemovePage(size_t nPage); - - // get the page rectangle for the current notebook size - // - // returns empty rectangle if an error occurs, do test for it - wxRect GetPageSize() const; - - // set the size of the given page to fit in the notebook - void AdjustPageSize(wxNotebookPage *page); - -#if wxUSE_UXTHEME - // gets the bitmap of notebook background and returns a brush from it - WXHBRUSH QueryBgBitmap(); - - // creates the brush to be used for drawing the tab control background - void UpdateBgBrush(); - - // common part of QueryBgBitmap() and MSWPrintChild() - // - // if child == NULL, draw background for the entire notebook itself - bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL); -#endif // wxUSE_UXTHEME - - // these function are only used for reducing flicker on notebook resize and - // we don't need to do this for WinCE -#ifndef __WXWINCE__ - void OnEraseBackground(wxEraseEvent& event); - void OnPaint(wxPaintEvent& event); - - // true if we have already subclassed our updown control - bool m_hasSubclassedUpdown; -#endif // __WXWINCE__ - - // the current selection (-1 if none) - int m_nSelection; - - wxNotebookPageInfoList m_pageInfos; - -#if wxUSE_UXTHEME - // background brush used to paint the tab control - WXHBRUSH m_hbrBackground; -#endif // wxUSE_UXTHEME - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_NOTEBOOK - -#endif // _NOTEBOOK_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/activex.h b/Source/3rdParty/wx/include/wx/msw/ole/activex.h deleted file mode 100644 index 20de45c2d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/activex.h +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/activex.h -// Purpose: wxActiveXContainer class -// Author: Ryan Norton -// Modified by: -// Created: 8/18/05 -// RCS-ID: $Id: activex.h 41793 2006-10-09 09:32:08Z ABX $ -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// Definitions -// ============================================================================ - -#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_ -#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_ - -#if wxUSE_ACTIVEX - -//--------------------------------------------------------------------------- -// wx includes -//--------------------------------------------------------------------------- - -#include "wx/msw/ole/oleutils.h" // wxBasicString &c -#include "wx/msw/ole/uuid.h" -#include "wx/window.h" -#include "wx/variant.h" - -//--------------------------------------------------------------------------- -// MSW COM includes -//--------------------------------------------------------------------------- -#include -#include - -#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) -#include -#endif - -#include - -#ifndef STDMETHOD - #define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname -#endif - -// -// These defines are from another ole header - but its not in the -// latest sdk. Also the ifndef DISPID_READYSTATE is here because at -// least on my machine with the latest sdk olectl.h defines these 3 -// -#ifndef DISPID_READYSTATE - #define DISPID_READYSTATE (-525) - #define DISPID_READYSTATECHANGE (-609) - #define DISPID_AMBIENT_TRANSFERPRIORITY (-728) -#endif - -#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501) -#define DISPID_AMBIENT_SILENT (-5502) - -#ifndef DISPID_AMBIENT_CODEPAGE - #define DISPID_AMBIENT_CODEPAGE (-725) - #define DISPID_AMBIENT_CHARSET (-727) -#endif - - -//--------------------------------------------------------------------------- -// -// wxActiveXContainer -// -//--------------------------------------------------------------------------- - -#define WX_DECLARE_AUTOOLE(wxAutoOleInterface, I) \ -class wxAutoOleInterface \ -{ \ - protected: \ - I *m_interface; \ -\ - public: \ - explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} \ - wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) \ - { QueryInterface(riid, pUnk); } \ - wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) \ - { QueryInterface(riid, pDispatch); } \ - wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)\ - { CreateInstance(clsid, riid); }\ - wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)\ - { operator = (ti); }\ -\ - wxAutoOleInterface& operator = (const wxAutoOleInterface& ti)\ - {\ - if (ti.m_interface)\ - ti.m_interface->AddRef();\ - Free();\ - m_interface = ti.m_interface;\ - return *this;\ - }\ -\ - wxAutoOleInterface& operator = (I *&ti)\ - {\ - Free();\ - m_interface = ti;\ - return *this;\ - }\ -\ - ~wxAutoOleInterface() { Free(); }\ -\ - inline void Free()\ - {\ - if (m_interface)\ - m_interface->Release();\ - m_interface = NULL;\ - }\ -\ - HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)\ - {\ - Free();\ - wxASSERT(pUnk != NULL);\ - return pUnk->QueryInterface(riid, (void **) &m_interface);\ - }\ -\ - HRESULT CreateInstance(REFCLSID clsid, REFIID riid)\ - {\ - Free();\ - return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);\ - }\ -\ - inline operator I *() const {return m_interface;}\ - inline I* operator ->() {return m_interface;}\ - inline I** GetRef() {return &m_interface;}\ - inline bool Ok() const { return IsOk(); }\ - inline bool IsOk() const {return m_interface != NULL;}\ -}; - -WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch) -WX_DECLARE_AUTOOLE(wxAutoIOleClientSite, IOleClientSite) -WX_DECLARE_AUTOOLE(wxAutoIUnknown, IUnknown) -WX_DECLARE_AUTOOLE(wxAutoIOleObject, IOleObject) -WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceObject, IOleInPlaceObject) -WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject) -WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView) -WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject) - -class wxActiveXContainer : public wxWindow -{ -public: - wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); - virtual ~wxActiveXContainer(); - - void OnSize(wxSizeEvent&); - void OnPaint(wxPaintEvent&); - void OnSetFocus(wxFocusEvent&); - void OnKillFocus(wxFocusEvent&); - -protected: - friend class FrameSite; - friend class wxActiveXEvents; - - wxAutoIDispatch m_Dispatch; - wxAutoIOleClientSite m_clientSite; - wxAutoIUnknown m_ActiveX; - wxAutoIOleObject m_oleObject; - wxAutoIOleInPlaceObject m_oleInPlaceObject; - wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject; - wxAutoIOleDocumentView m_docView; - wxAutoIViewObject m_viewObject; - HWND m_oleObjectHWND; - bool m_bAmbientUserMode; - DWORD m_docAdviseCookie; - wxWindow* m_realparent; - - void CreateActiveX(REFIID, IUnknown*); -}; - - -// Events -class wxActiveXEvent : public wxCommandEvent -{ -private: - friend class wxActiveXEvents; - wxVariant m_params; - DISPID m_dispid; - -public: - virtual wxEvent *Clone() const - { return new wxActiveXEvent(*this); } - - size_t ParamCount() const - { return m_params.GetCount(); } - - wxString ParamType(size_t idx) const - { - wxASSERT(idx < m_params.GetCount()); - return m_params[idx].GetType(); - } - - wxString ParamName(size_t idx) const - { - wxASSERT(idx < m_params.GetCount()); - return m_params[idx].GetName(); - } - - wxVariant& operator[] (size_t idx) - { - wxASSERT(idx < ParamCount()); - return m_params[idx]; - } - - DISPID GetDispatchId() const - { return m_dispid; } -}; - -#define wxACTIVEX_ID 14001 -DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_ACTIVEX, wxACTIVEX_ID) -typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); -#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ), -#define wxActiveXEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActiveXEventFunction, &func) - -#endif // wxUSE_ACTIVEX - -#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/ole/automtn.h b/Source/3rdParty/wx/include/wx/msw/ole/automtn.h deleted file mode 100644 index 9dd1e3763..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/automtn.h +++ /dev/null @@ -1,101 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: automtn.h -// Purpose: OLE automation utilities -// Author: Julian Smart -// Modified by: -// Created: 11/6/98 -// RCS-ID: $Id: automtn.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1998, Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AUTOMTN_H_ -#define _WX_AUTOMTN_H_ - -#include "wx/defs.h" - -#if wxUSE_OLE_AUTOMATION - -#include "wx/object.h" -#include "wx/variant.h" - -typedef void WXIDISPATCH; -typedef unsigned short* WXBSTR; - -#ifdef GetObject -#undef GetObject -#endif - -/* - * wxAutomationObject - * Wraps up an IDispatch pointer and invocation; does variant conversion. - */ - -class WXDLLEXPORT wxAutomationObject: public wxObject -{ -public: - wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); - virtual ~wxAutomationObject(); - - // Set/get dispatch pointer - inline void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } - inline WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } - - // Get a dispatch pointer from the current object associated - // with a class id, such as "Excel.Application" - bool GetInstance(const wxString& classId) const; - - // Get a dispatch pointer from a new instance of the the class - bool CreateInstance(const wxString& classId) const; - - // Low-level invocation function. Pass either an array of variants, - // or an array of pointers to variants. - bool Invoke(const wxString& member, int action, - wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const; - - // Invoke a member function - wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); - wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args); - - // Convenience function - wxVariant CallMethod(const wxString& method, - const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - // Get/Put property - wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; - wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; - wxVariant GetProperty(const wxString& property, - const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args); - bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ; - bool PutProperty(const wxString& property, - const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - // Uses DISPATCH_PROPERTYGET - // and returns a dispatch pointer. The calling code should call Release - // on the pointer, though this could be implicit by constructing an wxAutomationObject - // with it and letting the destructor call Release. - WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const; - WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const; - - // A way of initialising another wxAutomationObject with a dispatch object, - // without having to deal with nasty IDispatch pointers. - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; - -public: - WXIDISPATCH* m_dispatchPtr; - - DECLARE_NO_COPY_CLASS(wxAutomationObject) -}; - -#endif // wxUSE_OLE_AUTOMATION - -#endif // _WX_AUTOMTN_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/ole/dataform.h b/Source/3rdParty/wx/include/wx/msw/ole/dataform.h deleted file mode 100644 index f94c87f86..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/dataform.h +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/ole/dataform.h -// Purpose: declaration of the wxDataFormat class -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.10.99 (extracted from msw/ole/dataobj.h) -// RCS-ID: $Id: dataform.h 28812 2004-08-16 12:45:46Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAFORM_H -#define _WX_MSW_OLE_DATAFORM_H - -// ---------------------------------------------------------------------------- -// wxDataFormat identifies the single format of data -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataFormat -{ -public: - // the clipboard formats under Win32 are WORD's - typedef unsigned short NativeFormat; - - wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } - wxDataFormat(const wxChar *format) { SetId(format); } - - wxDataFormat& operator=(NativeFormat format) - { m_format = format; return *this; } - wxDataFormat& operator=(const wxDataFormat& format) - { m_format = format.m_format; return *this; } - - // default copy ctor/assignment operators ok - - // comparison (must have both versions) - bool operator==(wxDataFormatId format) const - { return m_format == (NativeFormat)format; } - bool operator!=(wxDataFormatId format) const - { return m_format != (NativeFormat)format; } - bool operator==(const wxDataFormat& format) const - { return m_format == format.m_format; } - bool operator!=(const wxDataFormat& format) const - { return m_format != format.m_format; } - - // explicit and implicit conversions to NativeFormat which is one of - // standard data types (implicit conversion is useful for preserving the - // compatibility with old code) - NativeFormat GetFormatId() const { return m_format; } - operator NativeFormat() const { return m_format; } - - // this works with standard as well as custom ids - void SetType(NativeFormat format) { m_format = format; } - NativeFormat GetType() const { return m_format; } - - // string ids are used for custom types - this SetId() must be used for - // application-specific formats - wxString GetId() const; - void SetId(const wxChar *format); - - // returns true if the format is one of those defined in wxDataFormatId - bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } - -private: - NativeFormat m_format; -}; - -#endif // _WX_MSW_OLE_DATAFORM_H - diff --git a/Source/3rdParty/wx/include/wx/msw/ole/dataobj.h b/Source/3rdParty/wx/include/wx/msw/ole/dataobj.h deleted file mode 100644 index 71cd44553..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/dataobj.h +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/ole/dataobj.h -// Purpose: declaration of the wxDataObject class -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.05.98 -// RCS-ID: $Id: dataobj.h 37406 2006-02-09 03:45:14Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAOBJ_H -#define _WX_MSW_OLE_DATAOBJ_H - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -struct IDataObject; - -// ---------------------------------------------------------------------------- -// wxDataObject is a "smart" and polymorphic piece of data. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObject : public wxDataObjectBase -{ -public: - // ctor & dtor - wxDataObject(); - virtual ~wxDataObject(); - - // retrieve IDataObject interface (for other OLE related classes) - IDataObject *GetInterface() const { return m_pIDataObject; } - - // tell the object that it should be now owned by IDataObject - i.e. when - // it is deleted, it should delete us as well - void SetAutoDelete(); - - // return true if we support this format in "Get" direction - bool IsSupportedFormat(const wxDataFormat& format) const - { return wxDataObjectBase::IsSupported(format, Get); } - - // if this method returns false, this wxDataObject will be copied to - // the clipboard with its size prepended to it, which is compatible with - // older wx versions - // - // if returns true, then this wxDataObject will be copied to the clipboard - // without any additional information and ::HeapSize() function will be used - // to get the size of that data - virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const - { - // return false from here only for compatibility with earlier wx versions - return true; - } - - // function to return symbolic name of clipboard format (for debug messages) -#ifdef __WXDEBUG__ - static const wxChar *GetFormatName(wxDataFormat format); - - #define wxGetFormatName(format) wxDataObject::GetFormatName(format) -#else // !Debug - #define wxGetFormatName(format) _T("") -#endif // Debug/!Debug - // they need to be accessed from wxIDataObject, so made them public, - // or wxIDataObject friend -public: - virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, - const wxDataFormat& format ); - virtual void* SetSizeInBuffer( void* buffer, size_t size, - const wxDataFormat& format ); - virtual size_t GetBufferOffset( const wxDataFormat& format ); - -private: - IDataObject *m_pIDataObject; // pointer to the COM interface - - DECLARE_NO_COPY_CLASS(wxDataObject) -}; - -#endif //_WX_MSW_OLE_DATAOBJ_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/dataobj2.h b/Source/3rdParty/wx/include/wx/msw/ole/dataobj2.h deleted file mode 100644 index dc1954d0b..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/dataobj2.h +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/dataobj2.h -// Purpose: second part of platform specific wxDataObject header - -// declarations of predefined wxDataObjectSimple-derived classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.10.99 -// RCS-ID: $Id: dataobj2.h 40772 2006-08-23 13:38:45Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAOBJ2_H -#define _WX_MSW_OLE_DATAOBJ2_H - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject is a specialization of wxDataObject for bitmap data -// -// NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard -// format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is -// rarely used). This is ugly, but I haven't found a solution for it yet. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObject : public wxBitmapDataObjectBase -{ -public: - // ctors - wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap) - : wxBitmapDataObjectBase(bitmap) - { - SetFormat(wxDF_DIB); - - m_data = NULL; - } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - // the DIB data - void /* BITMAPINFO */ *m_data; - - DECLARE_NO_COPY_CLASS(wxBitmapDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject2 - a data object for CF_BITMAP -// -// FIXME did I already mention it was ugly? -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObject2 : public wxBitmapDataObjectBase -{ -public: - // ctors - wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap) - : wxBitmapDataObjectBase(bitmap) - { - } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - DECLARE_NO_COPY_CLASS(wxBitmapDataObject2) -}; - -// ---------------------------------------------------------------------------- -// wxFileDataObject - data object for CF_HDROP -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDataObject : public wxFileDataObjectBase -{ -public: - wxFileDataObject() { } - - // implement base class pure virtuals - virtual bool SetData(size_t len, const void *buf); - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *pData) const; - virtual void AddFile(const wxString& file); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - DECLARE_NO_COPY_CLASS(wxFileDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxURLDataObject: data object for URLs -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxURLDataObject : public wxDataObjectComposite -{ -public: - // initialize with URL in ctor or use SetURL later - wxURLDataObject(const wxString& url = wxEmptyString); - - // return the URL as string - wxString GetURL() const; - - // Set a string as the URL in the data object - void SetURL(const wxString& url); - - // override to set m_textFormat - virtual bool SetData(const wxDataFormat& format, - size_t len, - const void *buf); - -private: - // last data object we got data in - wxDataObjectSimple *m_dataObjectLast; - - DECLARE_NO_COPY_CLASS(wxURLDataObject) -}; - -#endif // _WX_MSW_OLE_DATAOBJ2_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/dropsrc.h b/Source/3rdParty/wx/include/wx/msw/ole/dropsrc.h deleted file mode 100644 index 8646558f9..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/dropsrc.h +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/dropsrc.h -// Purpose: declaration of the wxDropSource class -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.03.98 -// RCS-ID: $Id: dropsrc.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEDROPSRC_H -#define _WX_OLEDROPSRC_H - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class wxIDropSource; -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// this macro may be used instead for wxDropSource ctor arguments: it will use -// the cursor 'name' from the resources under MSW, but will expand to -// something else under GTK. If you don't use it, you will have to use #ifdef -// in the application code. -#define wxDROP_ICON(name) wxCursor(_T(#name)) - -// ---------------------------------------------------------------------------- -// wxDropSource is used to start the drag-&-drop operation on associated -// wxDataObject object. It's responsible for giving UI feedback while dragging. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropSource : public wxDropSourceBase -{ -public: - // ctors: if you use default ctor you must call SetData() later! - // - // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK - // compatibility, as well as both icon parameters - wxDropSource(wxWindow *win = NULL, - const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor); - wxDropSource(wxDataObject& data, - wxWindow *win = NULL, - const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor); - - virtual ~wxDropSource(); - - // do it (call this in response to a mouse button press, for example) - // params: if bAllowMove is false, data can be only copied - virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); - - // overridable: you may give some custom UI feedback during d&d operation - // in this function (it's called on each mouse move, so it shouldn't be - // too slow). Just return false if you want default feedback. - virtual bool GiveFeedback(wxDragResult effect); - -protected: - void Init(); - -private: - wxIDropSource *m_pIDropSource; // the pointer to COM interface - - DECLARE_NO_COPY_CLASS(wxDropSource) -}; - -#endif //wxUSE_DRAG_AND_DROP - -#endif //_WX_OLEDROPSRC_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/droptgt.h b/Source/3rdParty/wx/include/wx/msw/ole/droptgt.h deleted file mode 100644 index a1d44a0ef..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/droptgt.h +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/droptgt.h -// Purpose: declaration of the wxDropTarget class -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.03.98 -// RCS-ID: $Id: droptgt.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEDROPTGT_H -#define _WX_OLEDROPTGT_H - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class wxIDropTarget; -struct IDataObject; - -// ---------------------------------------------------------------------------- -// An instance of the class wxDropTarget may be associated with any wxWindow -// derived object via SetDropTarget() function. If this is done, the virtual -// methods of wxDropTarget are called when something is dropped on the window. -// -// Note that wxDropTarget is an abstract base class (ABC) and you should derive -// your own class from it implementing pure virtual function in order to use it -// (all of them, including protected ones which are called by the class itself) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropTarget : public wxDropTargetBase -{ -public: - // ctor & dtor - wxDropTarget(wxDataObject *dataObject = NULL); - virtual ~wxDropTarget(); - - // normally called by wxWindow on window creation/destruction, but might be - // called `manually' as well. Register() returns true on success. - bool Register(WXHWND hwnd); - void Revoke(WXHWND hwnd); - - // provide default implementation for base class pure virtuals - virtual bool OnDrop(wxCoord x, wxCoord y); - virtual bool GetData(); - - // implementation only from now on - // ------------------------------- - - // do we accept this kind of data? - bool IsAcceptedData(IDataObject *pIDataSource) const; - - // give us the data source from IDropTarget::Drop() - this is later used by - // GetData() when it's called from inside OnData() - void SetDataSource(IDataObject *pIDataSource); - -private: - // helper used by IsAcceptedData() and GetData() - wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const; - - wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface - IDataObject *m_pIDataSource; // the pointer to the source data object - - DECLARE_NO_COPY_CLASS(wxDropTarget) -}; - -#endif //wxUSE_DRAG_AND_DROP - -#endif //_WX_OLEDROPTGT_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/oleutils.h b/Source/3rdParty/wx/include/wx/msw/ole/oleutils.h deleted file mode 100644 index 635c11b19..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/oleutils.h +++ /dev/null @@ -1,256 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: oleutils.h -// Purpose: OLE helper routines, OLE debugging support &c -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.02.1998 -// RCS-ID: $Id: oleutils.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEUTILS_H -#define _WX_OLEUTILS_H - -#include "wx/defs.h" - -#if wxUSE_OLE - -// ole2.h includes windows.h, so include wrapwin.h first -#include "wx/msw/wrapwin.h" -// get IUnknown, REFIID &c -#include -#include "wx/intl.h" -#include "wx/log.h" - -// ============================================================================ -// General purpose functions and macros -// ============================================================================ - -// ---------------------------------------------------------------------------- -// initialize/cleanup OLE -// ---------------------------------------------------------------------------- - -// call OleInitialize() or CoInitialize[Ex]() depending on the platform -// -// return true if ok, false otherwise -inline bool wxOleInitialize() -{ - // we need to initialize OLE library -#ifdef __WXWINCE__ - if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) -#else - if ( FAILED(::OleInitialize(NULL)) ) -#endif - { - wxLogError(_("Cannot initialize OLE")); - - return false; - } - - return true; -} - -inline void wxOleUninitialize() -{ -#ifdef __WXWINCE__ - ::CoUninitialize(); -#else - ::OleUninitialize(); -#endif -} - -// ---------------------------------------------------------------------------- -// misc helper functions/macros -// ---------------------------------------------------------------------------- - -// release the interface pointer (if !NULL) -inline void ReleaseInterface(IUnknown *pIUnk) -{ - if ( pIUnk != NULL ) - pIUnk->Release(); -} - -// release the interface pointer (if !NULL) and make it NULL -#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; - -// return true if the iid is in the array -extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); - -// ============================================================================ -// IUnknown implementation helpers -// ============================================================================ - -/* - The most dumb implementation of IUnknown methods. We don't support - aggregation nor containment, but for 99% of cases this simple - implementation is quite enough. - - Usage is trivial: here is all you should have - 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration - 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you - support (at least all for which you intent to return 'this' from QI, - i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else - 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also - - These macros are quite simple: AddRef and Release are trivial and QI does - lookup in a static member array of IIDs and returns 'this' if it founds - the requested interface in it or E_NOINTERFACE if not. - */ - -/* - wxAutoULong: this class is used for automatically initalising m_cRef to 0 -*/ -class wxAutoULong -{ -public: - wxAutoULong(ULONG value = 0) : m_Value(value) { } - - operator ULONG&() { return m_Value; } - ULONG& operator=(ULONG value) { m_Value = value; return m_Value; } - - wxAutoULong& operator++() { ++m_Value; return *this; } - const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; } - - wxAutoULong& operator--() { --m_Value; return *this; } - const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; } - -private: - ULONG m_Value; -}; - -// declare the methods and the member variable containing reference count -// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE -// and friends (see below) - -#define DECLARE_IUNKNOWN_METHODS \ - public: \ - STDMETHODIMP QueryInterface(REFIID, void **); \ - STDMETHODIMP_(ULONG) AddRef(); \ - STDMETHODIMP_(ULONG) Release(); \ - private: \ - static const IID *ms_aIids[]; \ - wxAutoULong m_cRef - -// macros for declaring supported interfaces -// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)! -#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { -#define ADD_IID(iid) &IID_I##iid, -#define END_IID_TABLE } - -// implementation is as straightforward as possible -// Parameter: classname - the name of the class -#define IMPLEMENT_IUNKNOWN_METHODS(classname) \ - STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ - { \ - wxLogQueryInterface(_T(#classname), riid); \ - \ - if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ - *ppv = this; \ - AddRef(); \ - \ - return S_OK; \ - } \ - else { \ - *ppv = NULL; \ - \ - return (HRESULT) E_NOINTERFACE; \ - } \ - } \ - \ - STDMETHODIMP_(ULONG) classname::AddRef() \ - { \ - wxLogAddRef(_T(#classname), m_cRef); \ - \ - return ++m_cRef; \ - } \ - \ - STDMETHODIMP_(ULONG) classname::Release() \ - { \ - wxLogRelease(_T(#classname), m_cRef); \ - \ - if ( --m_cRef == wxAutoULong(0) ) { \ - delete this; \ - return 0; \ - } \ - else \ - return m_cRef; \ - } - -// ============================================================================ -// Debugging support -// ============================================================================ - -// VZ: I don't know it's not done for compilers other than VC++ but I leave it -// as is. Please note, though, that tracing OLE interface calls may be -// incredibly useful when debugging OLE programs. -#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ >= 1000) ) || defined(__MWERKS__) ) -// ---------------------------------------------------------------------------- -// All OLE specific log functions have DebugTrace level (as LogTrace) -// ---------------------------------------------------------------------------- - -// tries to translate riid into a symbolic name, if possible -void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); - -// these functions print out the new value of reference counter -void wxLogAddRef (const wxChar *szInterface, ULONG cRef); -void wxLogRelease(const wxChar *szInterface, ULONG cRef); - -#else //!__WXDEBUG__ - #define wxLogQueryInterface(szInterface, riid) - #define wxLogAddRef(szInterface, cRef) - #define wxLogRelease(szInterface, cRef) -#endif //__WXDEBUG__ - -// wrapper around BSTR type (by Vadim Zeitlin) - -class WXDLLEXPORT wxBasicString -{ -public: - // ctors & dtor - wxBasicString(const char *sz); - wxBasicString(const wxString& str); - ~wxBasicString(); - - void Init(const char* sz); - - // accessors - // just get the string - operator BSTR() const { return m_wzBuf; } - // retrieve a copy of our string - caller must SysFreeString() it later! - BSTR Get() const { return SysAllocString(m_wzBuf); } - -private: - // @@@ not implemented (but should be) - wxBasicString(const wxBasicString&); - wxBasicString& operator=(const wxBasicString&); - - OLECHAR *m_wzBuf; // actual string -}; - -#if wxUSE_VARIANT -// Convert variants -class WXDLLIMPEXP_FWD_BASE wxVariant; - -WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); -WXDLLEXPORT bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant); -#endif // wxUSE_VARIANT - -// Convert string to Unicode -WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str); - -// Convert string from BSTR to wxString -WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr); - -#else // !wxUSE_OLE - -// ---------------------------------------------------------------------------- -// stub functions to avoid #if wxUSE_OLE in the main code -// ---------------------------------------------------------------------------- - -inline bool wxOleInitialize() { return false; } -inline void wxOleUninitialize() { } - -#endif // wxUSE_OLE/!wxUSE_OLE - -#endif //_WX_OLEUTILS_H diff --git a/Source/3rdParty/wx/include/wx/msw/ole/uuid.h b/Source/3rdParty/wx/include/wx/msw/ole/uuid.h deleted file mode 100644 index 0609448ec..000000000 --- a/Source/3rdParty/wx/include/wx/msw/ole/uuid.h +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/uuid.h -// Purpose: encapsulates an UUID with some added helper functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.07.97 -// RCS-ID: $Id: uuid.h 55113 2008-08-18 11:30:10Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -// -// Notes: you should link your project with RPCRT4.LIB! -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEUUID_H -#define _WX_OLEUUID_H - -#include "wx/wxchar.h" -// ------------------------------------------------------------------ -// UUID (Universally Unique IDentifier) definition -// ------------------------------------------------------------------ - -// ----- taken from RPC.H -#ifndef UUID_DEFINED // in some cases RPC.H will be already - #ifdef __WIN32__ // included, so avoid redefinition - typedef struct - { - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[8]; - } UUID; // UUID = GUID = CLSID = LIBID = IID - #endif // WIN32 -#endif // UUID_DEFINED - -#ifndef GUID_DEFINED - typedef UUID GUID; - #define UUID_DEFINED // prevent redefinition -#endif // GUID_DEFINED - -typedef unsigned char uchar; - -// ------------------------------------------------------------------ -// a class to store UUID and it's string representation -// ------------------------------------------------------------------ - -// uses RPC functions to create/convert Universally Unique Identifiers -class WXDLLEXPORT Uuid -{ -private: - UUID m_uuid; - wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC - wxChar *m_pszCForm; // this string is allocated in Set/Create - - void UuidToCForm(); - - // function used to set initial state by all ctors - void Init() { m_pszUuid = NULL; m_pszCForm = NULL; } - -public: - // ctors & dtor - Uuid() { Init(); } - Uuid(const wxChar *pc) { Init(); Set(pc); } - Uuid(const UUID &uuid) { Init(); Set(uuid); } - ~Uuid(); - - // copy ctor and assignment operator needed for this class - Uuid(const Uuid& uuid); - Uuid& operator=(const Uuid& uuid); - - // create a brand new UUID - void Create(); - - // set value of UUID - bool Set(const wxChar *pc); // from a string, returns true if ok - void Set(const UUID& uuid); // from another UUID (never fails) - -#if wxABI_VERSION >= 20809 - // comparison operators - bool operator==(const Uuid& uuid) const; - bool operator!=(const Uuid& uuid) const; -#endif // wxABI_VERSION >= 2.8.9 - - // accessors - operator const UUID*() const { return &m_uuid; } - operator const wxChar*() const { return (wxChar *)(m_pszUuid); } - - // return string representation of the UUID in the C form - // (as in DEFINE_GUID macro) - const wxChar *CForm() const { return m_pszCForm; } -}; - -#endif //_WX_OLEUUID_H diff --git a/Source/3rdParty/wx/include/wx/msw/palette.h b/Source/3rdParty/wx/include/wx/msw/palette.h deleted file mode 100644 index 87b59ec33..000000000 --- a/Source/3rdParty/wx/include/wx/msw/palette.h +++ /dev/null @@ -1,58 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/palette.h -// Purpose: wxPalette class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: palette.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PALETTE_H_ -#define _WX_PALETTE_H_ - -#include "wx/gdiobj.h" - -class WXDLLIMPEXP_FWD_CORE wxPalette; - -class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData -{ - friend class WXDLLIMPEXP_FWD_CORE wxPalette; -public: - wxPaletteRefData(void); - virtual ~wxPaletteRefData(void); -protected: - WXHPALETTE m_hPalette; -}; - -#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) - -class WXDLLEXPORT wxPalette: public wxPaletteBase -{ -public: - wxPalette(); - wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - virtual ~wxPalette(void); - bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - - int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; - bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; - - virtual int GetColoursCount() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk(void) const { return (m_refData != NULL) ; } - - virtual bool FreeResource(bool force = false); - - // implemetation - inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } - void SetHPALETTE(WXHPALETTE pal); - -private: - DECLARE_DYNAMIC_CLASS(wxPalette) -}; - -#endif - // _WX_PALETTE_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/pen.h b/Source/3rdParty/wx/include/wx/msw/pen.h deleted file mode 100644 index caf378d33..000000000 --- a/Source/3rdParty/wx/include/wx/msw/pen.h +++ /dev/null @@ -1,132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/pen.h -// Purpose: wxPen class -// Author: Julian Smart -// Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=() -// Created: 01/02/97 -// RCS-ID: $Id: pen.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PEN_H_ -#define _WX_PEN_H_ - -#include "wx/gdiobj.h" -#include "wx/bitmap.h" -#include "wx/colour.h" - -typedef WXDWORD wxMSWDash; - -class WXDLLIMPEXP_FWD_CORE wxPen; - -// VZ: this class should be made private -class WXDLLEXPORT wxPenRefData : public wxGDIRefData -{ -public: - wxPenRefData(); - wxPenRefData(const wxPenRefData& data); - virtual ~wxPenRefData(); - - bool operator==(const wxPenRefData& data) const - { - // we intentionally don't compare m_hPen fields here - return m_style == data.m_style && - m_width == data.m_width && - m_join == data.m_join && - m_cap == data.m_cap && - m_colour == data.m_colour && - (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) && - (m_style != wxUSER_DASH || - (m_nbDash == data.m_nbDash && - memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0)); - } - -protected: - int m_width; - int m_style; - int m_join; - int m_cap; - wxBitmap m_stipple; - int m_nbDash; - wxDash * m_dash; - wxColour m_colour; - WXHPEN m_hPen; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxPen; - - // Cannot use - // DECLARE_NO_COPY_CLASS(wxPenRefData) - // because copy constructor is explicitly declared above; - // but no copy assignment operator is defined, so declare - // it private to prevent the compiler from defining it: - wxPenRefData& operator=(const wxPenRefData&); -}; - -#define M_PENDATA ((wxPenRefData *)m_refData) -#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData) - -// ---------------------------------------------------------------------------- -// Pen -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPen : public wxGDIObject -{ -public: - wxPen(); - wxPen(const wxColour& col, int width = 1, int style = wxSOLID); - wxPen(const wxBitmap& stipple, int width); - virtual ~wxPen(); - - bool operator==(const wxPen& pen) const - { - const wxPenRefData *penData = (wxPenRefData *)pen.m_refData; - - // an invalid pen is only equal to another invalid pen - return m_refData ? penData && *M_PENDATA == *penData : !penData; - } - - bool operator!=(const wxPen& pen) const { return !(*this == pen); } - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return (m_refData != NULL); } - - // Override in order to recreate the pen - void SetColour(const wxColour& col); - void SetColour(unsigned char r, unsigned char g, unsigned char b); - - void SetWidth(int width); - void SetStyle(int style); - void SetStipple(const wxBitmap& stipple); - void SetDashes(int nb_dashes, const wxDash *dash); - void SetJoin(int join); - void SetCap(int cap); - - wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); } - int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); } - int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); } - int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); } - int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); } - int GetDashes(wxDash **ptr) const - { - *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); - return (M_PENDATA ? M_PENDATA->m_nbDash : 0); - } - wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); } - inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } - - inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); } - - // Internal - bool RealizeResource(); - bool FreeResource(bool force = false); - WXHANDLE GetResourceHandle() const; - bool IsFree() const; - void Unshare(); - -private: - DECLARE_DYNAMIC_CLASS(wxPen) -}; - -#endif // _WX_PEN_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/popupwin.h b/Source/3rdParty/wx/include/wx/msw/popupwin.h deleted file mode 100644 index 56f63fef4..000000000 --- a/Source/3rdParty/wx/include/wx/msw/popupwin.h +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/popupwin.h -// Purpose: wxPopupWindow class for wxMSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.01.01 -// RCS-ID: $Id: popupwin.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_POPUPWIN_H_ -#define _WX_MSW_POPUPWIN_H_ - -// ---------------------------------------------------------------------------- -// wxPopupWindow -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase -{ -public: - wxPopupWindow() { } - - wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) - { (void)Create(parent, flags); } - - bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - - virtual bool Show(bool show = true); - - // return the style to be used for the popup windows - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; - - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND MSWGetParent() const; - -protected: - // popups handle the position like wxTopLevelWindow, not wxWindow - virtual void DoGetPosition(int *x, int *y) const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) -}; - -#endif // _WX_MSW_POPUPWIN_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/printdlg.h b/Source/3rdParty/wx/include/wx/msw/printdlg.h deleted file mode 100644 index 25b21a50f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/printdlg.h +++ /dev/null @@ -1,124 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: printdlg.h -// Purpose: wxPrintDialog, wxPageSetupDialog classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: printdlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTDLG_H_ -#define _WX_PRINTDLG_H_ - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dialog.h" -#include "wx/cmndata.h" -#include "wx/prntbase.h" -#include "wx/printdlg.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; - -//---------------------------------------------------------------------------- -// wxWindowsPrintNativeData -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintNativeData: public wxPrintNativeDataBase -{ -public: - wxWindowsPrintNativeData(); - virtual ~wxWindowsPrintNativeData(); - - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - - void* GetDevMode() const { return m_devMode; } - void SetDevMode(void* data) { m_devMode = data; } - void* GetDevNames() const { return m_devNames; } - void SetDevNames(void* data) { m_devNames = data; } - -private: - void* m_devMode; - void* m_devNames; - - short m_customWindowsPaperId; - -private: - DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) -}; - -// --------------------------------------------------------------------------- -// wxWindowsPrintDialog: the MSW dialog for printing -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase -{ -public: - wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); - wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxWindowsPrintDialog(); - - bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); - virtual int ShowModal(); - - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } - - virtual wxDC *GetPrintDC(); - -private: - wxPrintDialogData m_printDialogData; - wxPrinterDC* m_printerDC; - bool m_destroyDC; - wxWindow* m_dialogParent; - -private: - bool ConvertToNative( wxPrintDialogData &data ); - bool ConvertFromNative( wxPrintDialogData &data ); - - // holds MSW handle - void* m_printDlg; - -private: - DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog) - DECLARE_CLASS(wxWindowsPrintDialog) -}; - -// --------------------------------------------------------------------------- -// wxWindowsPageSetupDialog: the MSW page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase -{ -public: - wxWindowsPageSetupDialog(); - wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual ~wxWindowsPageSetupDialog(); - - bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual int ShowModal(); - bool ConvertToNative( wxPageSetupDialogData &data ); - bool ConvertFromNative( wxPageSetupDialogData &data ); - - virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; } - -private: - wxPageSetupDialogData m_pageSetupData; - wxWindow* m_dialogParent; - - // holds MSW handle - void* m_pageDlg; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif - // _WX_PRINTDLG_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/printwin.h b/Source/3rdParty/wx/include/wx/msw/printwin.h deleted file mode 100644 index 4240682a6..000000000 --- a/Source/3rdParty/wx/include/wx/msw/printwin.h +++ /dev/null @@ -1,66 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: printwin.h -// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: printwin.h 42522 2006-10-27 13:07:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTWIN_H_ -#define _WX_PRINTWIN_H_ - -#include "wx/prntbase.h" - -// --------------------------------------------------------------------------- -// Represents the printer: manages printing a wxPrintout object -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrinter : public wxPrinterBase -{ - DECLARE_DYNAMIC_CLASS(wxWindowsPrinter) - -public: - wxWindowsPrinter(wxPrintDialogData *data = NULL); - virtual ~wxWindowsPrinter(); - - virtual bool Print(wxWindow *parent, - wxPrintout *printout, - bool prompt = true); - - virtual wxDC *PrintDialog(wxWindow *parent); - virtual bool Setup(wxWindow *parent); - -private: - WXFARPROC m_lpAbortProc; - - DECLARE_NO_COPY_CLASS(wxWindowsPrinter) -}; - -// --------------------------------------------------------------------------- -// wxPrintPreview: programmer creates an object of this class to preview a -// wxPrintout. -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintPreview : public wxPrintPreviewBase -{ -public: - wxWindowsPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); - wxWindowsPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxWindowsPrintPreview(); - - virtual bool Print(bool interactive); - virtual void DetermineScaling(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) -}; - -#endif -// _WX_PRINTWIN_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/private.h b/Source/3rdParty/wx/include/wx/msw/private.h deleted file mode 100644 index aebcdf756..000000000 --- a/Source/3rdParty/wx/include/wx/msw/private.h +++ /dev/null @@ -1,956 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private.h -// Purpose: Private declarations: as this header is only included by -// wxWidgets itself, it may contain identifiers which don't start -// with "wx". -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: private.h 62189 2009-09-28 16:02:08Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_H_ -#define _WX_PRIVATE_H_ - -#include "wx/msw/wrapwin.h" - -#ifdef __WXMICROWIN__ - // Extra prototypes and symbols not defined by MicroWindows - #include "wx/msw/microwin.h" -#endif - -#include "wx/log.h" - -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -// --------------------------------------------------------------------------- -// private constants -// --------------------------------------------------------------------------- - -// 260 was taken from windef.h -#ifndef MAX_PATH - #define MAX_PATH 260 -#endif - -// --------------------------------------------------------------------------- -// standard icons from the resources -// --------------------------------------------------------------------------- - -#if wxUSE_GUI - -extern WXDLLEXPORT_DATA(HICON) wxSTD_FRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxSTD_MDIPARENTFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxSTD_MDICHILDFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_FRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDICHILDFRAME_ICON; -extern WXDLLEXPORT_DATA(HFONT) wxSTATUS_LINE_FONT; - -#endif // wxUSE_GUI - -// --------------------------------------------------------------------------- -// global data -// --------------------------------------------------------------------------- - -extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance; - -// --------------------------------------------------------------------------- -// define things missing from some compilers' headers -// --------------------------------------------------------------------------- - -#if defined(__WXWINCE__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) -#ifndef ZeroMemory - inline void ZeroMemory(void *buf, size_t len) { memset(buf, 0, len); } -#endif -#endif // old mingw32 - -// this defines a CASTWNDPROC macro which casts a pointer to the type of a -// window proc -#if defined(STRICT) || defined(__GNUC__) - typedef WNDPROC WndProcCast; -#else - typedef FARPROC WndProcCast; -#endif - - -#define CASTWNDPROC (WndProcCast) - - - -// --------------------------------------------------------------------------- -// some stuff for old Windows versions (FIXME: what does it do here??) -// --------------------------------------------------------------------------- - -#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not - #define APIENTRY FAR PASCAL -#endif - -#ifdef __WIN32__ - #define _EXPORT -#else - #define _EXPORT _export -#endif - -#ifndef __WIN32__ - typedef signed short int SHORT; -#endif - -#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs -#ifndef STRICT - #define DLGPROC FARPROC -#endif -#endif - -/* - * Decide what window classes we're going to use - * for this combination of CTl3D/FAFA settings - */ - -#define STATIC_CLASS wxT("STATIC") -#define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE) -#define CHECK_CLASS wxT("BUTTON") -#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD) -#define CHECK_IS_FAFA FALSE -#define RADIO_CLASS wxT("BUTTON") -#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE) -#define RADIO_SIZE 20 -#define RADIO_IS_FAFA FALSE -#define PURE_WINDOWS -#define GROUP_CLASS wxT("BUTTON") -#define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE) - -/* -#define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE) -#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE) -*/ - -// --------------------------------------------------------------------------- -// misc macros -// --------------------------------------------------------------------------- - -#define MEANING_CHARACTER '0' -#define DEFAULT_ITEM_WIDTH 100 -#define DEFAULT_ITEM_HEIGHT 80 - -// Scale font to get edit control height -//#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) -#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (cy+8) - -// Generic subclass proc, for panel item moving/sizing and intercept -// EDIT control VK_RETURN messages -extern LONG APIENTRY _EXPORT - wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -// --------------------------------------------------------------------------- -// useful macros and functions -// --------------------------------------------------------------------------- - -// a wrapper macro for ZeroMemory() -#if defined(__WIN32__) && !defined(__WXMICROWIN__) -#define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) -#else -#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) -#endif - -// This one is a macro so that it can be tested with #ifdef, it will be -// undefined if it cannot be implemented for a given compiler. -// Vc++, bcc, dmc, ow, mingw, codewarrior (and rsxnt) have _get_osfhandle. -// Cygwin has get_osfhandle. Others are currently unknown, e.g. Salford, -// Intel, Visual Age. -#if defined(__WXWINCE__) - #define wxGetOSFHandle(fd) ((HANDLE)fd) - #define wxOpenOSFHandle(h, flags) ((int)wxPtrToUInt(h)) -#elif defined(__CYGWIN__) - #define wxGetOSFHandle(fd) ((HANDLE)get_osfhandle(fd)) -#elif defined(__VISUALC__) \ - || defined(__BORLANDC__) \ - || defined(__DMC__) \ - || defined(__WATCOMC__) \ - || defined(__MINGW32__) \ - || (defined(__MWERKS__) && defined(__MSL__)) - #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) - #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) - #define wx_fdopen _fdopen -#endif - -// close the handle in the class dtor -class AutoHANDLE -{ -public: - wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { } - - bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; } - operator HANDLE() const { return m_handle; } - - ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); } - -protected: - HANDLE m_handle; -}; - -// a template to make initializing Windows styructs less painful: it zeroes all -// the struct fields and also sets cbSize member to the correct value (and so -// can be only used with structures which have this member...) -template -struct WinStruct : public T -{ - WinStruct() - { - ::ZeroMemory(this, sizeof(T)); - - // explicit qualification is required here for this to be valid C++ - this->cbSize = sizeof(T); - } -}; - - -#if wxUSE_GUI - -#include "wx/gdicmn.h" -#include "wx/colour.h" - -// make conversion from wxColour and COLORREF a bit less painful -inline COLORREF wxColourToRGB(const wxColour& c) -{ - return RGB(c.Red(), c.Green(), c.Blue()); -} - -inline COLORREF wxColourToPalRGB(const wxColour& c) -{ - return PALETTERGB(c.Red(), c.Green(), c.Blue()); -} - -inline wxColour wxRGBToColour(COLORREF rgb) -{ - unsigned char red = ((unsigned char)((rgb) >> 16)); - unsigned char green = ((unsigned char)(((unsigned short)(rgb & 0xFFFF)) >> 8)); - unsigned char blue = ((unsigned char)(rgb & 0xFF)); - return wxColour(red, green, blue); -} - -inline void wxRGBToColour(wxColour& c, COLORREF rgb) -{ - c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); -} - -// get the standard colour map for some standard colours - see comment in this -// function to understand why is it needed and when should it be used -// -// it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll -// might be not included/available) array of size wxSTD_COLOUR_MAX -// -// NB: if you change these colours, update wxBITMAP_STD_COLOURS in the -// resources as well: it must have the same number of pixels! -enum wxSTD_COLOUR -{ - wxSTD_COL_BTNTEXT, - wxSTD_COL_BTNSHADOW, - wxSTD_COL_BTNFACE, - wxSTD_COL_BTNHIGHLIGHT, - wxSTD_COL_MAX -}; - -struct WXDLLEXPORT wxCOLORMAP -{ - COLORREF from, to; -}; - -// this function is implemented in src/msw/window.cpp -extern wxCOLORMAP *wxGetStdColourMap(); - -// create a wxRect from Windows RECT -inline wxRect wxRectFromRECT(const RECT& rc) -{ - return wxRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); -} - -// copy Windows RECT to our wxRect -inline void wxCopyRECTToRect(const RECT& rc, wxRect& rect) -{ - rect = wxRectFromRECT(rc); -} - -// and vice versa -inline void wxCopyRectToRECT(const wxRect& rect, RECT& rc) -{ - // note that we don't use wxRect::GetRight() as it is one of compared to - // wxRectFromRECT() above - rc.top = rect.y; - rc.left = rect.x; - rc.right = rect.x + rect.width; - rc.bottom = rect.y + rect.height; -} - -// translations between HIMETRIC units (which OLE likes) and pixels (which are -// liked by all the others) - implemented in msw/utilsexc.cpp -extern void HIMETRICToPixel(LONG *x, LONG *y); -extern void PixelToHIMETRIC(LONG *x, LONG *y); - -// Windows convention of the mask is opposed to the wxWidgets one, so we need -// to invert the mask each time we pass one/get one to/from Windows -extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); - -// Creates an icon or cursor depending from a bitmap -// -// The bitmap must be valid and it should have a mask. If it doesn't, a default -// mask is created using light grey as the transparent colour. -extern HICON wxBitmapToHICON(const wxBitmap& bmp); - -// Same requirments as above apply and the bitmap must also have the correct -// size. -extern -HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); - -// get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they -// will fail on system with multiple monitors where the coords may be negative -// -// these macros are standard now (Win98) but some older headers don't have them -#ifndef GET_X_LPARAM - #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) - #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -#endif // GET_X_LPARAM - -// get the current state of SHIFT/CTRL keys -inline bool wxIsShiftDown() -{ -// return (::GetKeyState(VK_SHIFT) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(VK_SHIFT) < 0; -} - -inline bool wxIsCtrlDown() -{ -// return (::GetKeyState(VK_CONTROL) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(VK_CONTROL) < 0; -} - -// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking -// for Win32 -inline RECT wxGetWindowRect(HWND hwnd) -{ - RECT rect; - - if ( !::GetWindowRect(hwnd, &rect) ) - wxLogLastError(_T("GetWindowRect")); - - return rect; -} - -inline RECT wxGetClientRect(HWND hwnd) -{ - RECT rect; - - if ( !::GetClientRect(hwnd, &rect) ) - wxLogLastError(_T("GetClientRect")); - - return rect; -} - -// --------------------------------------------------------------------------- -// small helper classes -// --------------------------------------------------------------------------- - -// create an instance of this class and use it as the HDC for screen, will -// automatically release the DC going out of scope -class ScreenHDC -{ -public: - ScreenHDC() { m_hdc = ::GetDC(NULL); } - ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(ScreenHDC) -}; - -// the same as ScreenHDC but for window DCs -class WindowHDC -{ -public: - WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } - ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HWND m_hwnd; - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(WindowHDC) -}; - -// the same as ScreenHDC but for memory DCs: creates the HDC compatible with -// the given one (screen by default) in ctor and destroys it in dtor -class MemoryHDC -{ -public: - MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); } - ~MemoryHDC() { ::DeleteDC(m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(MemoryHDC) -}; - -// a class which selects a GDI object into a DC in its ctor and deselects in -// dtor -class SelectInHDC -{ -private: - void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } - -public: - SelectInHDC() : m_hdc(NULL) { } - SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } - - void Init(HDC hdc, HGDIOBJ hgdiobj) - { - wxASSERT_MSG( !m_hdc, _T("initializing twice?") ); - - m_hdc = hdc; - - DoInit(hgdiobj); - } - - ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } - - // return true if the object was successfully selected - operator bool() const { return m_hgdiobj != 0; } - -private: - HDC m_hdc; - HGDIOBJ m_hgdiobj; - - DECLARE_NO_COPY_CLASS(SelectInHDC) -}; - -// a class which cleans up any GDI object -class AutoGDIObject -{ -protected: - AutoGDIObject() { m_gdiobj = NULL; } - AutoGDIObject(HGDIOBJ gdiobj) : m_gdiobj(gdiobj) { } - ~AutoGDIObject() { if ( m_gdiobj ) ::DeleteObject(m_gdiobj); } - - void InitGdiobj(HGDIOBJ gdiobj) - { - wxASSERT_MSG( !m_gdiobj, _T("initializing twice?") ); - - m_gdiobj = gdiobj; - } - - HGDIOBJ GetObject() const { return m_gdiobj; } - -private: - HGDIOBJ m_gdiobj; -}; - -// TODO: all this asks for using a AutoHandler template... - -// a class for temporary brushes -class AutoHBRUSH : private AutoGDIObject -{ -public: - AutoHBRUSH(COLORREF col) - : AutoGDIObject(::CreateSolidBrush(col)) { } - - operator HBRUSH() const { return (HBRUSH)GetObject(); } -}; - -// a class for temporary fonts -class AutoHFONT : private AutoGDIObject -{ -private: -public: - AutoHFONT() - : AutoGDIObject() { } - - AutoHFONT(const LOGFONT& lf) - : AutoGDIObject(::CreateFontIndirect(&lf)) { } - - void Init(const LOGFONT& lf) { InitGdiobj(::CreateFontIndirect(&lf)); } - - operator HFONT() const { return (HFONT)GetObject(); } -}; - -// a class for temporary pens -class AutoHPEN : private AutoGDIObject -{ -public: - AutoHPEN(COLORREF col) - : AutoGDIObject(::CreatePen(PS_SOLID, 0, col)) { } - - operator HPEN() const { return (HPEN)GetObject(); } -}; - -// classes for temporary bitmaps -class AutoHBITMAP : private AutoGDIObject -{ -public: - AutoHBITMAP(HBITMAP hbmp) : AutoGDIObject(hbmp) { } - - operator HBITMAP() const { return (HBITMAP)GetObject(); } -}; - -class CompatibleBitmap : public AutoHBITMAP -{ -public: - CompatibleBitmap(HDC hdc, int w, int h) - : AutoHBITMAP(::CreateCompatibleBitmap(hdc, w, h)) - { - } -}; - -class MonoBitmap : public AutoHBITMAP -{ -public: - MonoBitmap(int w, int h) - : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, 0)) - { - } -}; - -// class automatically destroys the region object -class AutoHRGN : private AutoGDIObject -{ -public: - AutoHRGN(HRGN hrgn) : AutoGDIObject(hrgn) { } - - operator HRGN() const { return (HRGN)GetObject(); } -}; - -// class sets the specified clipping region during its life time -class HDCClipper -{ -public: - HDCClipper(HDC hdc, HRGN hrgn) - : m_hdc(hdc) - { - if ( !::SelectClipRgn(hdc, hrgn) ) - wxLogLastError(_T("SelectClipRgn")); - } - - ~HDCClipper() - { - ::SelectClipRgn(m_hdc, NULL); - } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(HDCClipper) -}; - -// set the given map mode for the life time of this object -// -// NB: SetMapMode() is not supported by CE so we also define a helper macro -// to avoid using it there -#ifdef __WXWINCE__ - #define wxCHANGE_HDC_MAP_MODE(hdc, mm) -#else // !__WXWINCE__ - class HDCMapModeChanger - { - public: - HDCMapModeChanger(HDC hdc, int mm) - : m_hdc(hdc) - { - m_modeOld = ::SetMapMode(hdc, mm); - if ( !m_modeOld ) - wxLogLastError(_T("SelectClipRgn")); - } - - ~HDCMapModeChanger() - { - if ( m_modeOld ) - ::SetMapMode(m_hdc, m_modeOld); - } - - private: - HDC m_hdc; - int m_modeOld; - - DECLARE_NO_COPY_CLASS(HDCMapModeChanger) - }; - - #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ - HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) -#endif // __WXWINCE__/!__WXWINCE__ - -// smart buffeer using GlobalAlloc/GlobalFree() -class GlobalPtr -{ -public: - // allocates a block of given size - GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) - { - m_hGlobal = ::GlobalAlloc(flags, size); - if ( !m_hGlobal ) - wxLogLastError(_T("GlobalAlloc")); - } - - ~GlobalPtr() - { - if ( m_hGlobal && ::GlobalFree(m_hGlobal) ) - wxLogLastError(_T("GlobalFree")); - } - - // implicit conversion - operator HGLOBAL() const { return m_hGlobal; } - -private: - HGLOBAL m_hGlobal; - - DECLARE_NO_COPY_CLASS(GlobalPtr) -}; - -// when working with global pointers (which is unfortunately still necessary -// sometimes, e.g. for clipboard) it is important to unlock them exactly as -// many times as we lock them which just asks for using a "smart lock" class -class GlobalPtrLock -{ -public: - GlobalPtrLock(HGLOBAL hGlobal) : m_hGlobal(hGlobal) - { - m_ptr = GlobalLock(hGlobal); - if ( !m_ptr ) - wxLogLastError(_T("GlobalLock")); - } - - ~GlobalPtrLock() - { - if ( !GlobalUnlock(m_hGlobal) ) - { -#ifdef __WXDEBUG__ - // this might happen simply because the block became unlocked - DWORD dwLastError = ::GetLastError(); - if ( dwLastError != NO_ERROR ) - { - wxLogApiError(_T("GlobalUnlock"), dwLastError); - } -#endif // __WXDEBUG__ - } - } - - operator void *() const { return m_ptr; } - -private: - HGLOBAL m_hGlobal; - void *m_ptr; - - DECLARE_NO_COPY_CLASS(GlobalPtrLock) -}; - -// register the class when it is first needed and unregister it in dtor -class ClassRegistrar -{ -public: - // ctor doesn't register the class, call Initialize() for this - ClassRegistrar() { m_registered = -1; } - - // return true if the class is already registered - bool IsInitialized() const { return m_registered != -1; } - - // return true if the class had been already registered - bool IsRegistered() const { return m_registered == 1; } - - // try to register the class if not done yet, return true on success - bool Register(const WNDCLASS& wc) - { - // we should only be called if we hadn't been initialized yet - wxASSERT_MSG( m_registered == -1, - _T("calling ClassRegistrar::Register() twice?") ); - - m_registered = ::RegisterClass(&wc) ? 1 : 0; - if ( !IsRegistered() ) - { - wxLogLastError(_T("RegisterClassEx()")); - } - else - { - m_clsname = wc.lpszClassName; - } - - return m_registered == 1; - } - - // get the name of the registered class (returns empty string if not - // registered) - const wxString& GetName() const { return m_clsname; } - - // unregister the class if it had been registered - ~ClassRegistrar() - { - if ( IsRegistered() ) - { - if ( !::UnregisterClass(m_clsname, wxhInstance) ) - { - wxLogLastError(_T("UnregisterClass")); - } - } - } - -private: - // initial value is -1 which means that we hadn't tried registering the - // class yet, it becomes true or false (1 or 0) when Initialize() is called - int m_registered; - - // the name of the class, only non empty if it had been registered - wxString m_clsname; -}; - -// --------------------------------------------------------------------------- -// macros to make casting between WXFOO and FOO a bit easier: the GetFoo() -// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes -// an argument which should be a pointer or reference to the object of the -// corresponding class (this depends on the macro) -// --------------------------------------------------------------------------- - -#define GetHwnd() ((HWND)GetHWND()) -#define GetHwndOf(win) ((HWND)((win)->GetHWND())) -// old name -#define GetWinHwnd GetHwndOf - -#define GetHdc() ((HDC)GetHDC()) -#define GetHdcOf(dc) ((HDC)(dc).GetHDC()) - -#define GetHbitmap() ((HBITMAP)GetHBITMAP()) -#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP()) - -#define GetHicon() ((HICON)GetHICON()) -#define GetHiconOf(icon) ((HICON)(icon).GetHICON()) - -#define GetHaccel() ((HACCEL)GetHACCEL()) -#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) - -#define GetHbrush() ((HBRUSH)GetResourceHandle()) -#define GetHbrushOf(brush) ((HBRUSH)(brush).GetResourceHandle()) - -#define GetHmenu() ((HMENU)GetHMenu()) -#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) - -#define GetHcursor() ((HCURSOR)GetHCURSOR()) -#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) - -#define GetHfont() ((HFONT)GetHFONT()) -#define GetHfontOf(font) ((HFONT)(font).GetHFONT()) - -#define GetHimagelist() ((HIMAGELIST)GetHIMAGELIST()) -#define GetHimagelistOf(imgl) ((HIMAGELIST)imgl->GetHIMAGELIST()) - -#define GetHpalette() ((HPALETTE)GetHPALETTE()) -#define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE()) - -#define GetHpen() ((HPEN)GetResourceHandle()) -#define GetHpenOf(pen) ((HPEN)(pen).GetResourceHandle()) - -#define GetHrgn() ((HRGN)GetHRGN()) -#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN()) - -#endif // wxUSE_GUI - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -extern "C" -{ - WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); -} - -WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - -// return the full path of the given module -inline wxString wxGetFullModuleName(HMODULE hmod) -{ - wxString fullname; - if ( !::GetModuleFileName - ( - hmod, - wxStringBuffer(fullname, MAX_PATH), - MAX_PATH - ) ) - { - wxLogLastError(_T("GetModuleFileName")); - } - - return fullname; -} - -// return the full path of the program file -inline wxString wxGetFullModuleName() -{ - return wxGetFullModuleName((HMODULE)wxGetInstance()); -} - -// return the run-time version of the OS in a format similar to -// WINVER/_WIN32_WINNT compile-time macros: -// -// 0x0300 Windows NT 3.51 -// 0x0400 Windows 95, NT4 -// 0x0410 Windows 98 -// 0x0500 Windows ME, 2000 -// 0x0501 Windows XP -// 0x0502 Windows 2003 -// 0x0600 Longhorn -// -// for the other Windows versions 0 is currently returned -enum wxWinVersion -{ - wxWinVersion_Unknown = 0, - - wxWinVersion_3 = 0x0300, - wxWinVersion_NT3 = wxWinVersion_3, - - wxWinVersion_4 = 0x0400, - wxWinVersion_95 = wxWinVersion_4, - wxWinVersion_NT4 = wxWinVersion_4, - wxWinVersion_98 = 0x0410, - - wxWinVersion_5 = 0x0500, - wxWinVersion_ME = wxWinVersion_5, - wxWinVersion_NT5 = wxWinVersion_5, - wxWinVersion_2000 = wxWinVersion_5, - wxWinVersion_XP = 0x0501, - wxWinVersion_2003 = 0x0502, - - wxWinVersion_6 = 0x0600, - wxWinVersion_NT6 = 0x0600 -}; - -WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); - -#if wxUSE_GUI - -// cursor stuff -extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp -extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp - -WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); -WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); -WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); -WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); - -WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); -WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); - -// Find maximum size of window/rectangle -extern WXDLLEXPORT void wxFindMaxSize(WXHWND hwnd, RECT *rect); - -// Safely get the window text (i.e. without using fixed size buffer) -extern WXDLLEXPORT wxString wxGetWindowText(WXHWND hWnd); - -// get the window class name -extern WXDLLEXPORT wxString wxGetWindowClass(WXHWND hWnd); - -// get the window id (should be unsigned, hence this is not wxWindowID which -// is, for mainly historical reasons, signed) -extern WXDLLEXPORT WXWORD wxGetWindowId(WXHWND hWnd); - -// check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are -// different -extern WXDLLEXPORT bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); - -// Does this window style specify any border? -inline bool wxStyleHasBorder(long style) -{ - return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER | - wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; -} - -// ---------------------------------------------------------------------------- -// functions mapping HWND to wxWindow -// ---------------------------------------------------------------------------- - -// this function simply checks whether the given hWnd corresponds to a wxWindow -// and returns either that window if it does or NULL otherwise -extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); - -// find the window for HWND which is part of some wxWindow, i.e. unlike -// wxFindWinFromHandle() above it will also work for "sub controls" of a -// wxWindow. -// -// returns the wxWindow corresponding to the given HWND or NULL. -extern WXDLLEXPORT wxWindow *wxGetWindowFromHWND(WXHWND hwnd); - -// Get the size of an icon -extern WXDLLEXPORT wxSize wxGetHiconSize(HICON hicon); - -// Lines are drawn differently for WinCE and regular WIN32 -WXDLLEXPORT void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); - -// fill the client rect of the given window on the provided dc using this brush -inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr) -{ - RECT rc; - ::GetClientRect(hwnd, &rc); - ::FillRect(hdc, &rc, hbr); -} - -// ---------------------------------------------------------------------------- -// 32/64 bit helpers -// ---------------------------------------------------------------------------- - -#ifdef __WIN64__ - -inline void *wxGetWindowProc(HWND hwnd) -{ - return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC); -} - -inline void *wxGetWindowUserData(HWND hwnd) -{ - return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); -} - -inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) -{ - return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func); -} - -inline void *wxSetWindowUserData(HWND hwnd, void *data) -{ - return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); -} - -#else // __WIN32__ - -// note that the casts to LONG_PTR here are required even on 32-bit machines -// for the 64-bit warning mode of later versions of MSVC (C4311/4312) -inline WNDPROC wxGetWindowProc(HWND hwnd) -{ - return (WNDPROC)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC); -} - -inline void *wxGetWindowUserData(HWND hwnd) -{ - return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA); -} - -inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) -{ - return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func); -} - -inline void *wxSetWindowUserData(HWND hwnd, void *data) -{ - return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data); -} - -#endif // __WIN64__/__WIN32__ - -#endif // wxUSE_GUI - -#endif // _WX_PRIVATE_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/radiobox.h b/Source/3rdParty/wx/include/wx/msw/radiobox.h deleted file mode 100644 index 8012dd8b9..000000000 --- a/Source/3rdParty/wx/include/wx/msw/radiobox.h +++ /dev/null @@ -1,175 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/radiobox.h -// Purpose: wxRadioBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: radiobox.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBOX_H_ -#define _WX_RADIOBOX_H_ - -#include "wx/statbox.h" - -class WXDLLIMPEXP_FWD_CORE wxSubwindows; - -// ---------------------------------------------------------------------------- -// wxRadioBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase -{ -public: - wxRadioBox() { Init(); } - - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, n, choices, majorDim, - style, val, name); - } - - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, choices, majorDim, - style, val, name); - } - - virtual ~wxRadioBox(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - - // implement the radiobox interface - virtual void SetSelection(int n); - virtual int GetSelection() const { return m_selectedButton; } - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& label); - virtual bool Enable(unsigned int n, bool enable = true); - virtual bool Show(unsigned int n, bool show = true); - virtual bool IsItemEnabled(unsigned int n) const; - virtual bool IsItemShown(unsigned int n) const; - virtual int GetItemFromPoint(const wxPoint& pt) const; - - // override some base class methods - virtual bool Show(bool show = true); - virtual bool Enable(bool enable = true); - virtual void SetFocus(); - virtual bool SetFont(const wxFont& font); - virtual bool ContainsHWND(WXHWND hWnd) const; -#if wxUSE_TOOLTIPS - virtual bool HasToolTips() const; -#endif // wxUSE_TOOLTIPS -#if wxUSE_HELP - // override virtual function with a platform-independent implementation - virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const - { - return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); - } -#endif // wxUSE_HELP - - virtual bool Reparent(wxWindowBase *newParent); - - // we inherit a version always returning false from wxStaticBox, override - // it to behave normally - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } - - void SetLabelFont(const wxFont& WXUNUSED(font)) {} - void SetButtonFont(const wxFont& font) { SetFont(font); } - - // implementation only from now on - // ------------------------------- - - virtual bool MSWCommand(WXUINT param, WXWORD id); - void Command(wxCommandEvent& event); - - void SendNotificationEvent(); - -protected: - // common part of all ctors - void Init(); - - // subclass one radio button - void SubclassRadioButton(WXHWND hWndBtn); - - // get the max size of radio buttons - wxSize GetMaxButtonSize() const; - - // get the total size occupied by the radio box buttons - wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; - - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestSize() const; - -#if wxUSE_TOOLTIPS - virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip); -#endif - -#ifndef __WXWINCE__ - virtual WXHRGN MSWGetRegionWithoutChildren(); -#endif // __WXWINCE__ - - - // the buttons we contain - wxSubwindows *m_radioButtons; - - // array of widths and heights of the buttons, may be wxDefaultCoord if the - // corresponding quantity should be computed - int *m_radioWidth; - int *m_radioHeight; - - // currently selected button or wxNOT_FOUND if none - int m_selectedButton; - -private: - DECLARE_DYNAMIC_CLASS(wxRadioBox) - DECLARE_NO_COPY_CLASS(wxRadioBox) -}; - -#endif - // _WX_RADIOBOX_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/radiobut.h b/Source/3rdParty/wx/include/wx/msw/radiobut.h deleted file mode 100644 index 6e48bf3f3..000000000 --- a/Source/3rdParty/wx/include/wx/msw/radiobut.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: radiobut.h -// Purpose: wxRadioButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: radiobut.h 41144 2006-09-10 23:08:13Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBUT_H_ -#define _WX_RADIOBUT_H_ - -class WXDLLEXPORT wxRadioButton: public wxControl -{ -public: - // ctors and creation functions - wxRadioButton() { Init(); } - - wxRadioButton(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr); - - // implement the radio button interface - virtual void SetValue(bool value); - virtual bool GetValue() const; - - // implementation only from now on - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual bool HasTransparentBackground() { return true; } - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - -private: - // common part of all ctors - void Init(); - - // we need to store the state internally as the result of GetValue() - // sometimes gets out of sync in WM_COMMAND handler - bool m_isChecked; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton) -}; - -#endif - // _WX_RADIOBUT_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/regconf.h b/Source/3rdParty/wx/include/wx/msw/regconf.h deleted file mode 100644 index a256e98c8..000000000 --- a/Source/3rdParty/wx/include/wx/msw/regconf.h +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/regconf.h -// Purpose: Registry based implementation of wxConfigBase -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.04.98 -// RCS-ID: $Id: regconf.h 62185 2009-09-28 10:02:42Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _REGCONF_H -#define _REGCONF_H - -#include "wx/defs.h" - -#if wxUSE_CONFIG - -#ifndef _REGISTRY_H - #include "wx/msw/registry.h" -#endif - -#include "wx/object.h" -#include "wx/confbase.h" - -// ---------------------------------------------------------------------------- -// wxRegConfig -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase -{ -public: - // ctor & dtor - // will store data in HKLM\appName and HKCU\appName - wxRegConfig(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = wxCONFIG_USE_GLOBAL_FILE); - - // dtor will save unsaved data - virtual ~wxRegConfig(){} - - // implement inherited pure virtual functions - // ------------------------------------------ - - // path management - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const { return m_strPath; } - - // entry/subgroup info - // enumerate all of them - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - // tests for existence - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - virtual EntryType GetEntryType(const wxString& name) const; - - // get number of entries/subgroups in the current group, with or without - // it's subgroups - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; } - - // rename - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - // delete - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& key); - virtual bool DeleteAll(); - -protected: - // opens the local key creating it if necessary and returns it - wxRegKey& LocalKey() const // must be const to be callable from const funcs - { - wxRegConfig* self = wxConstCast(this, wxRegConfig); - - if ( !m_keyLocal.IsOpened() ) - { - // create on demand - self->m_keyLocal.Create(); - } - - return self->m_keyLocal; - } - - // implement read/write methods - virtual bool DoReadString(const wxString& key, wxString *pStr) const; - virtual bool DoReadLong(const wxString& key, long *plResult) const; - - virtual bool DoWriteString(const wxString& key, const wxString& szValue); - virtual bool DoWriteLong(const wxString& key, long lValue); - -private: - // no copy ctor/assignment operator - wxRegConfig(const wxRegConfig&); - wxRegConfig& operator=(const wxRegConfig&); - - // these keys are opened during all lifetime of wxRegConfig object - wxRegKey m_keyLocalRoot, m_keyLocal, - m_keyGlobalRoot, m_keyGlobal; - - // current path (not '/' terminated) - wxString m_strPath; -}; - -#endif // wxUSE_CONFIG - -#endif // _REGCONF_H diff --git a/Source/3rdParty/wx/include/wx/msw/region.h b/Source/3rdParty/wx/include/wx/msw/region.h deleted file mode 100644 index 881214c7e..000000000 --- a/Source/3rdParty/wx/include/wx/msw/region.h +++ /dev/null @@ -1,104 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/region.h -// Purpose: wxRegion class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: region.h 59602 2009-03-18 10:07:58Z VZ $ -// Copyright: (c) 1997-2002 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_REGION_H_ -#define _WX_MSW_REGION_H_ - -class WXDLLEXPORT wxRegion : public wxRegionWithCombine -{ -public: - wxRegion(); - wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRegion(const wxRect& rect); - wxRegion(WXHRGN hRegion); // Hangs on to this region - wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); -#if wxUSE_IMAGE - wxRegion( const wxBitmap& bmp) - { - Union(bmp); - } - wxRegion( const wxBitmap& bmp, - const wxColour& transColour, int tolerance = 0) - { - Union(bmp, transColour, tolerance); - } -#endif // wxUSE_IMAGE - - virtual ~wxRegion(); - - // wxRegionBase methods - virtual void Clear(); - virtual bool IsEmpty() const; - - // Get internal region handle - WXHRGN GetHRGN() const; - -protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - virtual bool DoIsEqual(const wxRegion& region) const; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const; - - virtual bool DoOffset(wxCoord x, wxCoord y); - virtual bool DoCombine(const wxRegion& region, wxRegionOp op); - - friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; - - DECLARE_DYNAMIC_CLASS(wxRegion) -}; - -class WXDLLEXPORT wxRegionIterator : public wxObject -{ -public: - wxRegionIterator() { Init(); } - wxRegionIterator(const wxRegion& region); - wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } - - wxRegionIterator& operator=(const wxRegionIterator& ri); - - virtual ~wxRegionIterator(); - - void Reset() { m_current = 0; } - void Reset(const wxRegion& region); - - bool HaveRects() const { return (m_current < m_numRects); } - - operator bool () const { return HaveRects(); } - - wxRegionIterator& operator++(); - wxRegionIterator operator++(int); - - wxCoord GetX() const; - wxCoord GetY() const; - wxCoord GetW() const; - wxCoord GetWidth() const { return GetW(); } - wxCoord GetH() const; - wxCoord GetHeight() const { return GetH(); } - - wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } - -private: - // common part of all ctors - void Init(); - - long m_current; - long m_numRects; - wxRegion m_region; - wxRect* m_rects; - - DECLARE_DYNAMIC_CLASS(wxRegionIterator) -}; - -#endif // _WX_MSW_REGION_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/registry.h b/Source/3rdParty/wx/include/wx/msw/registry.h deleted file mode 100644 index 04758d280..000000000 --- a/Source/3rdParty/wx/include/wx/msw/registry.h +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/registry.h -// Purpose: Registry classes and functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.1998 -// RCS-ID: $Id: registry.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_REGISTRY_H_ -#define _WX_MSW_REGISTRY_H_ - -class WXDLLIMPEXP_FWD_BASE wxOutputStream; - -// ---------------------------------------------------------------------------- -// class wxRegKey encapsulates window HKEY handle -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRegKey -{ -public: - // NB: do _not_ change the values of elements in these enumerations! - - // registry value types (with comments from winnt.h) - enum ValueType - { - Type_None, // No value type - Type_String, // Unicode nul terminated string - Type_Expand_String, // Unicode nul terminated string - // (with environment variable references) - Type_Binary, // Free form binary - Type_Dword, // 32-bit number - Type_Dword_little_endian // 32-bit number - = Type_Dword, // (same as Type_DWORD) - Type_Dword_big_endian, // 32-bit number - Type_Link, // Symbolic Link (unicode) - Type_Multi_String, // Multiple Unicode strings - Type_Resource_list, // Resource list in the resource map - Type_Full_resource_descriptor, // Resource list in the hardware description - Type_Resource_requirements_list // ??? - }; - - // predefined registry keys - enum StdKey - { - HKCR, // classes root - HKCU, // current user - HKLM, // local machine - HKUSR, // users - HKPD, // performance data (WinNT/2K only) - HKCC, // current config - HKDD, // dynamic data (Win95/98 only) - HKMAX - }; - - // access mode for the key - enum AccessMode - { - Read, // read-only - Write // read and write - }; - - // information about standard (predefined) registry keys - // number of standard keys - static const size_t nStdKeys; - // get the name of a standard key - static const wxChar *GetStdKeyName(size_t key); - // get the short name of a standard key - static const wxChar *GetStdKeyShortName(size_t key); - // get StdKey from root HKEY - static StdKey GetStdKeyFromHkey(WXHKEY hkey); - - // extacts the std key prefix from the string (return value) and - // leaves only the part after it (i.e. modifies the string passed!) - static StdKey ExtractKeyName(wxString& str); - - // ctors - // root key is set to HKCR (the only root key under Win16) - wxRegKey(); - // strKey is the full name of the key (i.e. starting with HKEY_xxx...) - wxRegKey(const wxString& strKey); - // strKey is the name of key under (standard key) keyParent - wxRegKey(StdKey keyParent, const wxString& strKey); - // strKey is the name of key under (previously created) keyParent - wxRegKey(const wxRegKey& keyParent, const wxString& strKey); - // dtor closes the key - ~wxRegKey(); - - // change key (closes the previously opened key if any) - // the name is absolute, i.e. should start with HKEY_xxx - void SetName(const wxString& strKey); - // the name is relative to the parent key - void SetName(StdKey keyParent, const wxString& strKey); - // the name is relative to the parent key - void SetName(const wxRegKey& keyParent, const wxString& strKey); - // hKey should be opened and will be closed in wxRegKey dtor - void SetHkey(WXHKEY hKey); - - // get infomation about the key - // get the (full) key name. Abbreviate std root keys if bShortPrefix. - wxString GetName(bool bShortPrefix = true) const; - // return true if the key exists - bool Exists() const; - // get the info about key (any number of these pointers may be NULL) - bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys - size_t *pnMaxKeyLen, // max len of subkey name - size_t *pnValues, // number of values - size_t *pnMaxValueLen) const; - // return true if the key is opened - bool IsOpened() const { return m_hKey != 0; } - // for "if ( !key ) wxLogError(...)" kind of expressions - operator bool() const { return m_dwLastError == 0; } - - // operations on the key itself - // explicitly open the key (will be automatically done by all functions - // which need the key to be opened if the key is not opened yet) - bool Open(AccessMode mode = Write); - // create the key: will fail if the key already exists and !bOkIfExists - bool Create(bool bOkIfExists = true); - // rename a value from old name to new one - bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew); - // rename the key - bool Rename(const wxChar *szNewName); - // copy value to another key possibly changing its name (by default it will - // remain the same) - bool CopyValue(const wxChar *szValue, wxRegKey& keyDst, - const wxChar *szNewName = NULL); - // copy the entire contents of the key recursively to another location - bool Copy(const wxChar *szNewName); - // same as Copy() but using a key and not the name - bool Copy(wxRegKey& keyDst); - // close the key (will be automatically done in dtor) - bool Close(); - - // deleting keys/values - // deletes this key and all of it's subkeys/values - bool DeleteSelf(); - // deletes the subkey with all of it's subkeys/values recursively - bool DeleteKey(const wxChar *szKey); - // deletes the named value (may be NULL to remove the default value) - bool DeleteValue(const wxChar *szValue); - - // access to values and subkeys - // get value type - ValueType GetValueType(const wxChar *szValue) const; - // returns true if the value contains a number (else it's some string) - bool IsNumericValue(const wxChar *szValue) const; - - // assignment operators set the default value of the key - wxRegKey& operator=(const wxString& strValue) - { SetValue(NULL, strValue); return *this; } - wxRegKey& operator=(long lValue) - { SetValue(NULL, lValue); return *this; } - - // query the default value of the key: implicitly or explicitly - wxString QueryDefaultValue() const; - operator wxString() const { return QueryDefaultValue(); } - - // named values - - // set the string value - bool SetValue(const wxChar *szValue, const wxString& strValue); - // retrieve the string value - bool QueryValue(const wxChar *szValue, wxString& strValue) const - { return QueryValue(szValue, strValue, false); } - // retrieve raw string value - bool QueryRawValue(const wxChar *szValue, wxString& strValue) const - { return QueryValue(szValue, strValue, true); } - // retrieve either raw or expanded string value - bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const; - - // set the numeric value - bool SetValue(const wxChar *szValue, long lValue); - // return the numeric value - bool QueryValue(const wxChar *szValue, long *plValue) const; - // set the binary value - bool SetValue(const wxChar *szValue, const wxMemoryBuffer& buf); - // return the binary value - bool QueryValue(const wxChar *szValue, wxMemoryBuffer& buf) const; - - // query existence of a key/value - // return true if value exists - bool HasValue(const wxChar *szKey) const; - // return true if given subkey exists - bool HasSubKey(const wxChar *szKey) const; - // return true if any subkeys exist - bool HasSubkeys() const; - // return true if any values exist - bool HasValues() const; - // return true if the key is empty (nothing under this key) - bool IsEmpty() const { return !HasSubkeys() && !HasValues(); } - - // enumerate values and subkeys - bool GetFirstValue(wxString& strValueName, long& lIndex); - bool GetNextValue (wxString& strValueName, long& lIndex) const; - - bool GetFirstKey (wxString& strKeyName , long& lIndex); - bool GetNextKey (wxString& strKeyName , long& lIndex) const; - - // export the contents of this key and all its subkeys to the given file - // (which won't be overwritten, it's an error if it already exists) - // - // note that we export the key in REGEDIT4 format, not RegSaveKey() binary - // format nor newer REGEDIT5 one - bool Export(const wxString& filename) const; - - // same as above but write to the given (opened) stream - bool Export(wxOutputStream& ostr) const; - - - // for wxRegConfig usage only: preallocate some memory for the name - void ReserveMemoryForName(size_t bytes) { m_strKey.reserve(bytes); } - -private: - // common part of all ctors - void Init() - { - m_hKey = (WXHKEY) NULL; - m_dwLastError = 0; - } - - // recursive helper for Export() - bool DoExport(wxOutputStream& ostr) const; - - // export a single value - bool DoExportValue(wxOutputStream& ostr, const wxString& name) const; - - // return the text representation (in REGEDIT4 format) of the value with the - // given name - wxString FormatValue(const wxString& name) const; - - - WXHKEY m_hKey, // our handle - m_hRootKey; // handle of the top key (i.e. StdKey) - wxString m_strKey; // key name (relative to m_hRootKey) - - AccessMode m_mode; // valid only if key is opened - long m_dwLastError; // last error (0 if none) - - - DECLARE_NO_COPY_CLASS(wxRegKey) -}; - -#endif // _WX_MSW_REGISTRY_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/scrolbar.h b/Source/3rdParty/wx/include/wx/msw/scrolbar.h deleted file mode 100644 index bfe86c6a8..000000000 --- a/Source/3rdParty/wx/include/wx/msw/scrolbar.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: scrollbar.h -// Purpose: wxScrollBar class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: scrolbar.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLBAR_H_ -#define _WX_SCROLBAR_H_ - -// Scrollbar item -class WXDLLEXPORT wxScrollBar: public wxScrollBarBase -{ -public: - wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } - virtual ~wxScrollBar(); - - wxScrollBar(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - int GetThumbPosition() const ; - int GetThumbSize() const { return m_pageSize; } - int GetPageSize() const { return m_viewSize; } - int GetRange() const { return m_objectSize; } - - virtual void SetThumbPosition(int viewStart); - virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, - bool refresh = true); - - // needed for RTTI - void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } - void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } - void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } - - void Command(wxCommandEvent& event); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - // override wxControl version to not use solid background here - virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - int m_pageSize; - int m_viewSize; - int m_objectSize; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar) -}; - -#endif - // _WX_SCROLBAR_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/seh.h b/Source/3rdParty/wx/include/wx/msw/seh.h deleted file mode 100644 index 23053fab0..000000000 --- a/Source/3rdParty/wx/include/wx/msw/seh.h +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/seh.h -// Purpose: declarations for SEH (structured exceptions handling) support -// Author: Vadim Zeitlin -// Created: 2006-04-26 -// RCS-ID: $Id: seh.h 44451 2007-02-11 02:17:28Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SEH_H_ -#define _WX_MSW_SEH_H_ - -#if wxUSE_ON_FATAL_EXCEPTION - - // the exception handler which should be called from the exception filter - // - // it calsl wxApp::OnFatalException() if possible - extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); - - // helper macro for wxSEH_HANDLE -#if defined(__BORLANDC__) || (defined(__VISUALC__) && (__VISUALC__ <= 1200)) - // some compilers don't understand that this code is unreachable and warn - // about no value being returned from the function without it, so calm them - // down - #define wxSEH_DUMMY_RETURN(rc) return rc; -#else - #define wxSEH_DUMMY_RETURN(rc) -#endif - - // macros which allow to avoid many #if wxUSE_ON_FATAL_EXCEPTION in the code - // which uses them - #define wxSEH_TRY __try - #define wxSEH_IGNORE __except ( EXCEPTION_EXECUTE_HANDLER ) { } - #define wxSEH_HANDLE(rc) \ - __except ( wxGlobalSEHandler(GetExceptionInformation()) ) \ - { \ - /* use the same exit code as abort() */ \ - ::ExitProcess(3); \ - \ - wxSEH_DUMMY_RETURN(rc) \ - } - -#else // wxUSE_ON_FATAL_EXCEPTION - #define wxSEH_TRY - #define wxSEH_IGNORE - #define wxSEH_HANDLE(rc) -#endif // wxUSE_ON_FATAL_EXCEPTION - -#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) && !defined(__WXWINCE__) - #include - - // C++ exception to structured exceptions translator: we need it in order - // to prevent VC++ from "helpfully" translating structured exceptions (such - // as division by 0 or access violation) to C++ pseudo-exceptions - extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); - - // up to VC 7.1 this warning ("calling _set_se_translator() requires /EHa") - // is harmless and it's easier to suppress it than use different makefiles - // for VC5 and 6 (which don't support /EHa at all) and VC7 (which does - // accept it but it seems to change nothing for it anyhow) - #if __VISUALC__ <= 1310 - #pragma warning(disable: 4535) - #endif - - // note that the SE translator must be called wxSETranslator! - #define DisableAutomaticSETranslator() _set_se_translator(wxSETranslator) -#else // !__VISUALC__ - // the other compilers do nothing as stupid by default so nothing to do for - // them - #define DisableAutomaticSETranslator() -#endif // __VISUALC__/!__VISUALC__ - -#endif // _WX_MSW_SEH_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/setup.h b/Source/3rdParty/wx/include/wx/msw/setup.h deleted file mode 100644 index 36147b18f..000000000 --- a/Source/3rdParty/wx/include/wx/msw/setup.h +++ /dev/null @@ -1,1361 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup0.h 60190 2009-04-16 00:57:35Z KO $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 0 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 0 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 0 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 0 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 0 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable the new wxCairoContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that you will need to link with Cairo for this to work. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_CAIRO -#define wxUSE_CAIRO 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 0 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set to 1 for , 0 for . Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 0 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 0 - -// Set to 1 for GIF format support -#define wxUSE_GIF 0 - -// Set to 1 for PNM format support -#define wxUSE_PNM 0 - -// Set to 1 for PCX format support -#define wxUSE_PCX 0 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 0 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmao data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -#endif // _WX_SETUP_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/slider95.h b/Source/3rdParty/wx/include/wx/msw/slider95.h deleted file mode 100644 index 55415c789..000000000 --- a/Source/3rdParty/wx/include/wx/msw/slider95.h +++ /dev/null @@ -1,137 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/slider95.h -// Purpose: wxSlider class, using the Win95 (and later) trackbar control -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: slider95.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SLIDER95_H_ -#define _WX_SLIDER95_H_ - -class WXDLLIMPEXP_FWD_CORE wxSubwindows; - -// Slider -class WXDLLEXPORT wxSlider : public wxSliderBase -{ -public: - wxSlider() { Init(); } - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, - int minValue, - int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Init(); - - (void)Create(parent, id, value, minValue, maxValue, - pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int value, - int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual ~wxSlider(); - - // slider methods - virtual int GetValue() const; - virtual void SetValue(int); - - void SetRange(int minValue, int maxValue); - - int GetMin() const { return m_rangeMin; } - int GetMax() const { return m_rangeMax; } - - // Win32-specific slider methods - void SetTickFreq(int n, int pos); - int GetTickFreq() const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize() const; - void ClearSel(); - void ClearTicks(); - void SetLineSize(int lineSize); - int GetLineSize() const; - int GetSelEnd() const; - int GetSelStart() const; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len); - int GetThumbLength() const; - void SetTick(int tickPos); - - // implementation only from now on - WXHWND GetStaticMin() const; - WXHWND GetStaticMax() const; - WXHWND GetEditValue() const; - virtual bool ContainsHWND(WXHWND hWnd) const; - - // we should let background show through the slider (and its labels) - virtual bool HasTransparentBackground() { return true; } - - - void Command(wxCommandEvent& event); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - virtual bool Show(bool show = true); - virtual bool Enable(bool show = true); - virtual bool SetFont(const wxFont& font); - - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // common part of all ctors - void Init(); - - // format an integer value as string - static wxString Format(int n) { return wxString::Format(_T("%d"), n); } - - // get the boundig box for the slider and possible labels - wxRect GetBoundingBox() const; - - // get the height and, if the pointer is not NULL, width of our labels - int GetLabelsSize(int *width = NULL) const; - - - // overridden base class virtuals - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - - // the labels windows, if any - wxSubwindows *m_labels; - - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; - - // flag needed to detect whether we're getting THUMBRELEASE event because - // of dragging the thumb or scrolling the mouse wheel - bool m_isDragging; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) -}; - -#endif // _WX_SLIDER95_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/spinbutt.h b/Source/3rdParty/wx/include/wx/msw/spinbutt.h deleted file mode 100644 index dcfb0a370..000000000 --- a/Source/3rdParty/wx/include/wx/msw/spinbutt.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/spinbutt.h -// Purpose: wxSpinButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: spinbutt.h 41316 2006-09-20 14:15:14Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINBUTT_H_ -#define _WX_SPINBUTT_H_ - -#include "wx/control.h" -#include "wx/event.h" - -#if wxUSE_SPINBTN - -class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase -{ -public: - // construction - wxSpinButton() { } - - wxSpinButton(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME) - { - Create(parent, id, pos, size, style, name); - } - - virtual ~wxSpinButton(); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME); - - - // accessors - virtual int GetValue() const; - virtual void SetValue(int val); - virtual void SetRange(int minVal, int maxVal); - - // implementation - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can - virtual bool AcceptsFocus() const { return false; } - -protected: - virtual wxSize DoGetBestSize() const; - - // ensure that the control displays a value in the current range - virtual void NormalizeValue(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) -}; - -#endif // wxUSE_SPINBTN - -#endif // _WX_SPINBUTT_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/spinctrl.h b/Source/3rdParty/wx/include/wx/msw/spinctrl.h deleted file mode 100644 index 08b619450..000000000 --- a/Source/3rdParty/wx/include/wx/msw/spinctrl.h +++ /dev/null @@ -1,142 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Name: msw/spinctrl.h -// Purpose: wxSpinCtrl class declaration for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.07.99 -// RCS-ID: $Id: spinctrl.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SPINCTRL_H_ -#define _WX_MSW_SPINCTRL_H_ - -#include "wx/spinbutt.h" // the base class - -#if wxUSE_SPINCTRL - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); - -// ---------------------------------------------------------------------------- -// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call -// it) text window whose contents is automatically updated when the spin -// control is clicked. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinCtrl : public wxSpinButton -{ -public: - wxSpinCtrl() { } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")) - { - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")); - - // a wxTextCtrl-like method (but we can't have GetValue returning wxString - // because the base class already has one returning int!) - void SetValue(const wxString& text); - - // another wxTextCtrl-like method - void SetSelection(long from, long to); - - // implementation only from now on - // ------------------------------- - - virtual ~wxSpinCtrl(); - - virtual void SetValue(int val); - virtual int GetValue() const; - virtual bool SetFont(const wxFont &font); - virtual void SetFocus(); - - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - - virtual bool Reparent(wxWindowBase *newParent); - - // wxSpinButton doesn't accept focus, but we do - virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } - - // for internal use only - - // get the subclassed window proc of the buddy text - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // return the spinctrl object whose buddy is the given window or NULL - static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); - - // process a WM_COMMAND generated by the buddy text control - bool ProcessTextCommand(WXWORD cmd, WXWORD id); - -protected: - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *width, int *height) const; -#if wxABI_VERSION >= 20808 - virtual void DoGetClientSize(int *x, int *y) const; -#endif - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS - - // the handler for wxSpinButton events - void OnSpinChange(wxSpinEvent& event); - - // handle processing of special keys - void OnChar(wxKeyEvent& event); - void OnSetFocus(wxFocusEvent& event); - void OnKillFocus(wxFocusEvent& event); - - // generate spin control update event with the given value - void SendSpinUpdate(int value); - - // called to ensure that the value is in the correct range - virtual void NormalizeValue(); - - - // the value of the control before the latest change (which might not have - // changed anything in fact -- this is why we need this field) - int m_oldValue; - - // the data for the "buddy" text ctrl - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - - // all existing wxSpinCtrls - this allows to find the one corresponding to - // the given buddy window in GetSpinForTextCtrl() - static wxArraySpins ms_allSpins; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSpinCtrl) -}; - -#endif // wxUSE_SPINCTRL - -#endif // _WX_MSW_SPINCTRL_H_ - - diff --git a/Source/3rdParty/wx/include/wx/msw/stackwalk.h b/Source/3rdParty/wx/include/wx/msw/stackwalk.h deleted file mode 100644 index 2aeba90c5..000000000 --- a/Source/3rdParty/wx/include/wx/msw/stackwalk.h +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stackwalk.h -// Purpose: wxStackWalker for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-08 -// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STACKWALK_H_ -#define _WX_MSW_STACKWALK_H_ - -#include "wx/arrstr.h" - -// these structs are declared in windows headers -struct _CONTEXT; -struct _EXCEPTION_POINTERS; - -// and these in dbghelp.h -struct _SYMBOL_INFO; - -// ---------------------------------------------------------------------------- -// wxStackFrame -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase -{ -private: - wxStackFrame *ConstCast() const - { return wx_const_cast(wxStackFrame *, this); } - - size_t DoGetParamCount() const { return m_paramTypes.GetCount(); } - -public: - wxStackFrame(size_t level, void *address, size_t addrFrame) - : wxStackFrameBase(level, address) - { - m_hasName = - m_hasLocation = false; - - m_addrFrame = addrFrame; - } - - virtual size_t GetParamCount() const - { - ConstCast()->OnGetParam(); - return DoGetParamCount(); - } - - virtual bool - GetParam(size_t n, wxString *type, wxString *name, wxString *value) const; - - // callback used by OnGetParam(), don't call directly - void OnParam(_SYMBOL_INFO *pSymInfo); - -protected: - virtual void OnGetName(); - virtual void OnGetLocation(); - - void OnGetParam(); - - - // helper for debug API: it wants to have addresses as DWORDs - size_t GetSymAddr() const - { - return wx_reinterpret_cast(size_t, m_address); - } - -private: - bool m_hasName, - m_hasLocation; - - size_t m_addrFrame; - - wxArrayString m_paramTypes, - m_paramNames, - m_paramValues; -}; - -// ---------------------------------------------------------------------------- -// wxStackWalker -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase -{ -public: - // we don't use ctor argument, it is for compatibility with Unix version - // only - wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } - - virtual void Walk(size_t skip = 1, size_t maxDepth = 200); - virtual void WalkFromException(); - - - // enumerate stack frames from the given context - void WalkFrom(const _CONTEXT *ctx, size_t skip = 1); - void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1); -}; - -#endif // _WX_MSW_STACKWALK_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/statbmp.h b/Source/3rdParty/wx/include/wx/msw/statbmp.h deleted file mode 100644 index 99bc98595..000000000 --- a/Source/3rdParty/wx/include/wx/msw/statbmp.h +++ /dev/null @@ -1,90 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statbmp.h -// Purpose: wxStaticBitmap class for wxMSW -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: statbmp.h 51824 2008-02-16 01:59:21Z SN $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBMP_H_ -#define _WX_STATBMP_H_ - -#include "wx/control.h" -#include "wx/icon.h" -#include "wx/bitmap.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; - -// a control showing an icon or a bitmap -class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase -{ -public: - wxStaticBitmap() { Init(); } - - wxStaticBitmap(wxWindow *parent, - wxWindowID id, - const wxGDIImage& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxGDIImage& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual ~wxStaticBitmap() { Free(); } - - virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); } - virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); } - virtual wxBitmap GetBitmap() const; - virtual wxIcon GetIcon() const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxBorder GetDefaultBorder() const; - virtual wxSize DoGetBestSize() const; - - // ctor/dtor helpers - void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } - void Free(); - - // true if icon/bitmap is valid - bool ImageIsOk() const; - - void SetImage(const wxGDIImage* image); - void SetImageNoCopy( wxGDIImage* image ); - -#if wxABI_VERSION >= 20808 - // draw the bitmap ourselves here if the OS can't do it correctly (if it - // can we leave it to it) - void DoPaintManually(wxPaintEvent& event); -#endif - - // we can have either an icon or a bitmap - bool m_isIcon; - wxGDIImage *m_image; - - // handle used in last call to STM_SETIMAGE - WXHANDLE m_currentHandle; - -private: - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - DECLARE_NO_COPY_CLASS(wxStaticBitmap) -}; - -#endif - // _WX_STATBMP_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/statbox.h b/Source/3rdParty/wx/include/wx/msw/statbox.h deleted file mode 100644 index 99604516d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/statbox.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statbox.h -// Purpose: wxStaticBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STATBOX_H_ -#define _WX_MSW_STATBOX_H_ - -// Group box -class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase -{ -public: - wxStaticBox() { } - - wxStaticBox(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr); - - /// Implementation only - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - -#ifndef __WXWINCE__ -public: - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // return the region with all the windows inside this static box excluded - virtual WXHRGN MSWGetRegionWithoutChildren(); - - // remove the parts which are painted by static box itself from the given - // region which is embedded in a rectangle (0, 0)-(w, h) - virtual void MSWGetRegionWithoutSelf(WXHRGN hrgn, int w, int h); - - // paint the given rectangle with our background brush/colour - virtual void PaintBackground(wxDC& dc, const struct tagRECT& rc); - // paint the foreground of the static box - virtual void PaintForeground(wxDC& dc, const struct tagRECT& rc); - - void OnPaint(wxPaintEvent& event); -#endif // !__WXWINCE__ - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox) -}; - -#endif // _WX_MSW_STATBOX_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/statbr95.h b/Source/3rdParty/wx/include/wx/msw/statbr95.h deleted file mode 100644 index 1e3155ad0..000000000 --- a/Source/3rdParty/wx/include/wx/msw/statbr95.h +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/statbr95.h -// Purpose: native implementation of wxStatusBar -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.04.98 -// RCS-ID: $Id: statbr95.h 41035 2006-09-06 17:36:22Z PC $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _STATBR95_H -#define _STATBR95_H - -#if wxUSE_NATIVE_STATUSBAR - -class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase -{ -public: - // ctors and such - wxStatusBar95(); - wxStatusBar95(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr) - { - (void)Create(parent, id, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - virtual ~wxStatusBar95(); - - // a status line can have several (<256) fields numbered from 0 - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - - // each field of status line has it's own text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // set status line fields' widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - // set status line fields' styles - virtual void SetStatusStyles(int n, const int styles[]); - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height); - - // get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - - // get the border size - virtual int GetBorderX() const; - virtual int GetBorderY() const; - - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); -protected: - void CopyFieldsWidth(const int widths[]); - void SetFieldsWidth(); - - // override base class virtual - void DoMoveWindow(int x, int y, int width, int height); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar95) -}; - -#endif // wxUSE_NATIVE_STATUSBAR - -#endif diff --git a/Source/3rdParty/wx/include/wx/msw/statline.h b/Source/3rdParty/wx/include/wx/msw/statline.h deleted file mode 100644 index 7b7edf930..000000000 --- a/Source/3rdParty/wx/include/wx/msw/statline.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msw/statline.h -// Purpose: MSW version of wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STATLINE_H_ -#define _WX_MSW_STATLINE_H_ - -// ---------------------------------------------------------------------------- -// wxStaticLine -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLine : public wxStaticLineBase -{ -public: - // constructors and pseudo-constructors - wxStaticLine() { } - - wxStaticLine( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - { - Create(parent, id, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - - // usually overridden base class virtuals - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine) -}; - -#endif // _WX_MSW_STATLINE_H_ - - diff --git a/Source/3rdParty/wx/include/wx/msw/stattext.h b/Source/3rdParty/wx/include/wx/msw/stattext.h deleted file mode 100644 index 2338315cb..000000000 --- a/Source/3rdParty/wx/include/wx/msw/stattext.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stattext.h -// Purpose: wxStaticText class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: stattext.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATTEXT_H_ -#define _WX_STATTEXT_H_ - -class WXDLLEXPORT wxStaticText : public wxStaticTextBase -{ -public: - wxStaticText() { } - - wxStaticText(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr); - - // override some methods to resize the window properly - virtual void SetLabel(const wxString& label); - virtual bool SetFont( const wxFont &font ); - - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // implement/override some base class virtuals - virtual wxBorder GetDefaultBorder() const; - virtual void DoSetSize(int x, int y, int w, int h, - int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestSize() const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) -}; - -#endif - // _WX_STATTEXT_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/stdpaths.h b/Source/3rdParty/wx/include/wx/msw/stdpaths.h deleted file mode 100644 index 55f8f2d98..000000000 --- a/Source/3rdParty/wx/include/wx/msw/stdpaths.h +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stdpaths.h -// Purpose: wxStandardPaths for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STDPATHS_H_ -#define _WX_MSW_STDPATHS_H_ - -// ---------------------------------------------------------------------------- -// wxStandardPaths -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase -{ -public: - // implement base class pure virtuals - virtual wxString GetExecutablePath() const; - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; - virtual wxString GetDataDir() const; - virtual wxString GetUserDataDir() const; - virtual wxString GetUserLocalDataDir() const; - virtual wxString GetPluginsDir() const; - virtual wxString GetDocumentsDir() const; - -protected: - // get the path corresponding to the given standard CSIDL_XXX constant - static wxString DoGetDirectory(int csidl); - - // return the directory of the application itself - static wxString GetAppDir(); -}; - -// ---------------------------------------------------------------------------- -// wxStandardPathsWin16: this class is for internal use only -// ---------------------------------------------------------------------------- - -// override config file locations to be compatible with the values used by -// wxFileConfig (dating from Win16 days which explains the class name) -class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths -{ -public: - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; -}; - -#endif // _WX_MSW_STDPATHS_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/subwin.h b/Source/3rdParty/wx/include/wx/msw/subwin.h deleted file mode 100644 index 75f8dad6d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/subwin.h +++ /dev/null @@ -1,195 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/subwin.h -// Purpose: helper for implementing the controls with subwindows -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-12-11 -// RCS-ID: $Id: subwin.h 30981 2004-12-13 01:02:32Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SUBWIN_H_ -#define _WX_MSW_SUBWIN_H_ - -#include "wx/msw/private.h" - -// ---------------------------------------------------------------------------- -// wxSubwindows contains all HWNDs making part of a single wx control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSubwindows -{ -public: - // the number of subwindows can be specified either as parameter to ctor or - // later in Create() - wxSubwindows(size_t n = 0) { Init(); if ( n ) Create(n); } - - // allocate enough space for the given number of windows - void Create(size_t n) - { - wxASSERT_MSG( !m_hwnds, _T("Create() called twice?") ); - - m_count = n; - m_hwnds = (HWND *)calloc(n, sizeof(HWND)); - } - - // non-virtual dtor, this class is not supposed to be used polymorphically - ~wxSubwindows() - { - for ( size_t n = 0; n < m_count; n++ ) - { - ::DestroyWindow(m_hwnds[n]); - } - - free(m_hwnds); - } - - // get the number of subwindows - size_t GetCount() const { return m_count; } - - // access a given window - HWND& Get(size_t n) - { - wxASSERT_MSG( n < m_count, _T("subwindow index out of range") ); - - return m_hwnds[n]; - } - - HWND& operator[](size_t n) { return Get(n); } - HWND operator[](size_t n) const - { - return wx_const_cast(wxSubwindows *, this)->Get(n); - } - - // check if we have this window - bool HasWindow(HWND hwnd) - { - for ( size_t n = 0; n < m_count; n++ ) - { - if ( m_hwnds[n] == hwnd ) - return true; - } - - return false; - } - - - // methods which are forwarded to all subwindows - // --------------------------------------------- - - // show/hide everything - void Show(bool show) - { - int sw = show ? SW_SHOW : SW_HIDE; - for ( size_t n = 0; n < m_count; n++ ) - { - ::ShowWindow(m_hwnds[n], sw); - } - } - - // enable/disable everything - void Enable(bool enable) - { - for ( size_t n = 0; n < m_count; n++ ) - { - ::EnableWindow(m_hwnds[n], enable); - } - } - - // set font for all windows - void SetFont(const wxFont& font) - { - HFONT hfont = GetHfontOf(font); - wxCHECK_RET( hfont, _T("invalid font") ); - - for ( size_t n = 0; n < m_count; n++ ) - { - ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); - - // otherwise the window might not be redrawn correctly - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); - } - } - - // find the bounding box for all windows - wxRect GetBoundingBox() const - { - wxRect r; - for ( size_t n = 0; n < m_count; n++ ) - { - RECT rc; - ::GetWindowRect(m_hwnds[n], &rc); - - r.Union(wxRectFromRECT(rc)); - } - - return r; - } - -private: - void Init() - { - m_count = 0; - m_hwnds = NULL; - } - - // number of elements in m_hwnds array - size_t m_count; - - // the HWNDs we contain - HWND *m_hwnds; - - - DECLARE_NO_COPY_CLASS(wxSubwindows) -}; - -// convenient macro to forward a few methods which are usually propagated to -// subwindows to a wxSubwindows object -// -// parameters should be: -// - cname the name of the class implementing these methods -// - base the name of its base class -// - subwins the name of the member variable of type wxSubwindows * -#define WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(cname, base, subwins) \ - bool cname::ContainsHWND(WXHWND hWnd) const \ - { \ - return subwins && subwins->HasWindow((HWND)hWnd); \ - } \ - \ - bool cname::Show(bool show) \ - { \ - if ( !base::Show(show) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->Show(show); \ - \ - return true; \ - } \ - \ - bool cname::Enable(bool enable) \ - { \ - if ( !base::Enable(enable) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->Enable(enable); \ - \ - return true; \ - } \ - \ - bool cname::SetFont(const wxFont& font) \ - { \ - if ( !base::SetFont(font) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->SetFont(font); \ - \ - return true; \ - } - - -#endif // _WX_MSW_SUBWIN_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/tbar95.h b/Source/3rdParty/wx/include/wx/msw/tbar95.h deleted file mode 100644 index 4b1d4b66d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/tbar95.h +++ /dev/null @@ -1,156 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tbar95.h -// Purpose: wxToolBar (Windows 95 toolbar) class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tbar95.h 58446 2009-01-26 23:32:16Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TBAR95_H_ -#define _WX_MSW_TBAR95_H_ - -#if wxUSE_TOOLBAR - -#include "wx/dynarray.h" -#include "wx/imaglist.h" - -class WXDLLEXPORT wxToolBar : public wxToolBarBase -{ -public: - // ctors and dtor - wxToolBar() { Init(); } - - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr); - - virtual ~wxToolBar(); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual bool Realize(); - - virtual void SetToolBitmapSize(const wxSize& size); - virtual wxSize GetToolSize() const; - - virtual void SetRows(int nRows); - -#if wxABI_VERSION >= 20802 - // TODO: In 2.9 these should probably be virtual, and declared in the base class... - void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); -#endif - - // implementation only from now on - // ------------------------------- - - virtual void SetWindowStyleFlag(long style); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - void OnMouseEvent(wxMouseEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnEraseBackground(wxEraseEvent& event); - - void SetFocus() {} - - static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); - - // override WndProc mainly to process WM_SIZE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // common part of all ctors - void Init(); - - // create the native toolbar control - bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); - - // recreate the control completely - void Recreate(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - - // return the appropriate size and flags for the toolbar control - virtual wxSize DoGetBestSize() const; - - // handlers for various events - bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); - bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); - void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); - - // should be called whenever the toolbar size changes - void UpdateSize(); - - // create m_disabledImgList (but doesn't fill it), set it to NULL if it is - // unneeded - void CreateDisabledImageList(); - - // get the Windows toolbar style of this control - long GetMSWToolbarStyle() const; - - - // the big bitmap containing all bitmaps of the toolbar buttons - WXHBITMAP m_hBitmap; - - // the image list with disabled images, may be NULL if we use - // system-provided versions of them - wxImageList *m_disabledImgList; - - // the total number of toolbar elements - size_t m_nButtons; - - // the tool the cursor is in - wxToolBarToolBase *m_pInTool; - -private: - // makes sure tool bitmap size is sufficient for all tools - void AdjustToolBitmapSize(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) - DECLARE_NO_COPY_CLASS(wxToolBar) -}; - -#endif // wxUSE_TOOLBAR - -#endif // _WX_MSW_TBAR95_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/textctrl.h b/Source/3rdParty/wx/include/wx/msw/textctrl.h deleted file mode 100644 index 5790a7c93..000000000 --- a/Source/3rdParty/wx/include/wx/msw/textctrl.h +++ /dev/null @@ -1,291 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/textctrl.h -// Purpose: wxTextCtrl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textctrl.h 52547 2008-03-15 12:33:04Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRL_H_ -#define _WX_TEXTCTRL_H_ - -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase -{ -public: - // creation - // -------- - - wxTextCtrl() { Init(); } - wxTextCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - { - Init(); - - Create(parent, id, value, pos, size, style, validator, name); - } - virtual ~wxTextCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual wxString GetValue() const; - virtual bool IsEmpty() const; - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - virtual void GetSelection(long* from, long* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load the control's contents from the file - virtual bool DoLoadFile(const wxString& file, int fileType); - - // clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - virtual void SetMaxLength(unsigned long len); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - -#ifdef __WIN32__ - virtual bool EmulateKeyPress(const wxKeyEvent& event); -#endif // __WIN32__ - -#if wxUSE_RICHEDIT - // apply text attribute to the range of text (only works with richedit - // controls) - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); -#endif // wxUSE_RICHEDIT - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const - { - return wxTextCtrlBase::HitTest(pt, col, row); - } - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // Caret handling (Windows only) - - bool ShowNativeCaret(bool show = true); - bool HideNativeCaret() { return ShowNativeCaret(false); } - - // Implementation from now on - // -------------------------- - - virtual void SetWindowStyleFlag(long style); - - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); - -#if wxUSE_RICHEDIT - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - int GetRichVersion() const { return m_verRichEdit; } - bool IsRich() const { return m_verRichEdit != 0; } - - // rich edit controls are not compatible with normal ones and wem ust set - // the colours for them otherwise - virtual bool SetBackgroundColour(const wxColour& colour); - virtual bool SetForegroundColour(const wxColour& colour); -#else - bool IsRich() const { return false; } -#endif // wxUSE_RICHEDIT - -#if wxUSE_INKEDIT && wxUSE_RICHEDIT - bool IsInkEdit() const { return m_isInkEdit != 0; } -#else - bool IsInkEdit() const { return false; } -#endif - - virtual void AdoptAttributesFromHWND(); - - virtual bool AcceptsFocus() const; - - // callbacks - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required - - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - // Show a context menu for Rich Edit controls (the standard - // EDIT control has one already) - void OnContextMenu(wxContextMenuEvent& event); - - // be sure the caret remains invisible if the user - // called HideNativeCaret() before - void OnSetFocus(wxFocusEvent& event); - - // intercept WM_GETDLGCODE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - virtual wxVisualAttributes GetDefaultAttributes() const; - -protected: - // common part of all ctors - void Init(); - - // creates the control of appropriate class (plain or rich edit) with the - // styles corresponding to m_windowStyle - // - // this is used by ctor/Create() and when we need to recreate the control - // later - bool MSWCreateText(const wxString& value, - const wxPoint& pos, - const wxSize& size); - - virtual void DoSetValue(const wxString &value, int flags = 0); - - // return true if this control has a user-set limit on amount of text (i.e. - // the limit is due to a previous call to SetMaxLength() and not built in) - bool HasSpaceLimit(unsigned int *len) const; - - // call this to increase the size limit (will do nothing if the current - // limit is big enough) - // - // returns true if we increased the limit to allow entering more text, - // false if we hit the limit set by SetMaxLength() and so didn't change it - bool AdjustSpaceLimit(); - -#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) - // replace the selection or the entire control contents with the given text - // in the specified encoding - bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); - - // get the contents of the control out as text in the given encoding - wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const; -#endif // wxUSE_RICHEDIT - - // replace the contents of the selection or of the entire control with the - // given text - void DoWriteText(const wxString& text, - int flags = SetValue_SendEvent | SetValue_SelectionOnly); - - // set the selection possibly without scrolling the caret into view - void DoSetSelection(long from, long to, bool scrollCaret = true); - - // return true if there is a non empty selection in the control - bool HasSelection() const; - - // get the length of the line containing the character at the given - // position - long GetLengthOfLineContainingPos(long pos) const; - - // send TEXT_UPDATED event, return true if it was handled, false otherwise - bool SendUpdateEvent(); - - virtual wxSize DoGetBestSize() const; - -#if wxUSE_RICHEDIT - // we're using RICHEDIT (and not simple EDIT) control if this field is not - // 0, it also gives the version of the RICHEDIT control being used (1, 2 or - // 3 so far) - int m_verRichEdit; -#endif // wxUSE_RICHEDIT - - // number of EN_UPDATE events sent by Windows when we change the controls - // text ourselves: we want this to be exactly 1 - int m_updatesCount; - -private: - void OnKeyDown(wxKeyEvent& event); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) - - wxMenu* m_privateContextMenu; - - bool m_isNativeCaretShown; - -#if wxUSE_INKEDIT && wxUSE_RICHEDIT - int m_isInkEdit; -#endif - -}; - -#endif - // _WX_TEXTCTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/tglbtn.h b/Source/3rdParty/wx/include/wx/msw/tglbtn.h deleted file mode 100644 index ae45202c2..000000000 --- a/Source/3rdParty/wx/include/wx/msw/tglbtn.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tglbtn.h -// Purpose: Declaration of the wxToggleButton class, which implements a -// toggle button under wxMSW. -// Author: John Norris, minor changes by Axel Schlueter -// Modified by: -// Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2000 Johnny C. Norris II -// License: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOGGLEBUTTON_H_ -#define _WX_TOGGLEBUTTON_H_ - -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; - -// Checkbox item (single checkbox) -class WXDLLEXPORT wxToggleButton : public wxControl -{ -public: - wxToggleButton() {} - wxToggleButton(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetValue(bool value); - virtual bool GetValue() const ; - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - virtual wxSize DoGetBestSize() const; - virtual wxBorder GetDefaultBorder() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) -}; - -#endif // _WX_TOGGLEBUTTON_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/timer.h b/Source/3rdParty/wx/include/wx/msw/timer.h deleted file mode 100644 index 449543300..000000000 --- a/Source/3rdParty/wx/include/wx/msw/timer.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: timer.h -// Purpose: wxTimer class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIMER_H_ -#define _WX_TIMER_H_ - -class WXDLLEXPORT wxTimer : public wxTimerBase -{ -friend void wxProcessTimer(wxTimer& timer); - -public: - wxTimer() { Init(); } - wxTimer(wxEvtHandler *owner, int id = wxID_ANY) : wxTimerBase(owner, id) - { Init(); } - virtual ~wxTimer(); - - virtual bool Start(int milliseconds = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const { return m_id != 0; } - -protected: - void Init(); - - unsigned long m_id; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTimer) -}; - -#endif - // _WX_TIMERH_ diff --git a/Source/3rdParty/wx/include/wx/msw/tooltip.h b/Source/3rdParty/wx/include/wx/msw/tooltip.h deleted file mode 100644 index 3e623a39a..000000000 --- a/Source/3rdParty/wx/include/wx/msw/tooltip.h +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tooltip.h -// Purpose: wxToolTip class - tooltip control -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.01.99 -// RCS-ID: $Id: tooltip.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TOOLTIP_H_ -#define _WX_MSW_TOOLTIP_H_ - -#include "wx/object.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -class WXDLLEXPORT wxToolTip : public wxObject -{ -public: - // ctor & dtor - wxToolTip(const wxString &tip); - virtual ~wxToolTip(); - - // accessors - // tip text - void SetTip(const wxString& tip); - const wxString& GetTip() const { return m_text; } - - // the window we're associated with - void SetWindow(wxWindow *win); - wxWindow *GetWindow() const { return m_window; } - - // controlling tooltip behaviour: globally change tooltip parameters - // enable or disable the tooltips globally - static void Enable(bool flag); - // set the delay after which the tooltip appears - static void SetDelay(long milliseconds); - - // implementation only from now on - // ------------------------------- - - // should be called in responde to WM_MOUSEMOVE - static void RelayEvent(WXMSG *msg); - - // add a window to the tooltip control - void Add(WXHWND hwnd); - - // remove any tooltip from the window - static void Remove(WXHWND hwnd); - -private: - // the one and only one tooltip control we use - never access it directly - // but use GetToolTipCtrl() which will create it when needed - static WXHWND ms_hwndTT; - - // create the tooltip ctrl if it doesn't exist yet and return its HWND - static WXHWND GetToolTipCtrl(); - - // remove this tooltip from the tooltip control - void Remove(); - - wxString m_text; // tooltip text - wxWindow *m_window; // window we're associated with - - DECLARE_ABSTRACT_CLASS(wxToolTip) - DECLARE_NO_COPY_CLASS(wxToolTip) -}; - -#endif // _WX_MSW_TOOLTIP_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/toplevel.h b/Source/3rdParty/wx/include/wx/msw/toplevel.h deleted file mode 100644 index 30ddeeda9..000000000 --- a/Source/3rdParty/wx/include/wx/msw/toplevel.h +++ /dev/null @@ -1,197 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/toplevel.h -// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.01 -// RCS-ID: $Id: toplevel.h 50999 2008-01-03 01:13:44Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TOPLEVEL_H_ -#define _WX_MSW_TOPLEVEL_H_ - -// ---------------------------------------------------------------------------- -// wxTopLevelWindowMSW -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase -{ -public: - // constructors and such - wxTopLevelWindowMSW() { Init(); } - - wxTopLevelWindowMSW(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxTopLevelWindowMSW(); - - // implement base class pure virtuals - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - virtual void Maximize(bool maximize = true); - virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = true); - virtual bool IsIconized() const; - virtual void SetIcon(const wxIcon& icon); - virtual void SetIcons(const wxIconBundle& icons ); - virtual void Restore(); - - virtual void SetLayoutDirection(wxLayoutDirection dir); - -#ifndef __WXWINCE__ - virtual bool SetShape(const wxRegion& region); -#endif // __WXWINCE__ - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - - virtual bool Show(bool show = true); - - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual bool IsFullScreen() const { return m_fsIsShowing; } - - // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" - // button from the title bar - virtual bool EnableCloseButton(bool enable = true); - - // Set window transparency if the platform supports it - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); - - - // implementation from now on - // -------------------------- - - // event handlers - void OnActivate(wxActivateEvent& event); - - // called by wxWindow whenever it gets focus - void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } - wxWindow *GetLastFocus() const { return m_winLastFocused; } - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); -#endif // __SMARTPHONE__ && __WXWINCE__ - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - // Soft Input Panel (SIP) change notification - virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); -#endif - - // translate wxWidgets flags to Windows ones - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; - - // choose the right parent to use with CreateWindow() - virtual WXHWND MSWGetParent() const; - - // window proc for the frames - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // create a new frame, return false if it couldn't be created - bool CreateFrame(const wxString& title, - const wxPoint& pos, - const wxSize& size); - - // create a new dialog using the given dialog template from resources, - // return false if it couldn't be created - bool CreateDialog(const void *dlgTemplate, - const wxString& title, - const wxPoint& pos, - const wxSize& size); - - // common part of Iconize(), Maximize() and Restore() - void DoShowWindow(int nShowCmd); - - // is the window currently iconized? - bool m_iconized; - - // should the frame be maximized when it will be shown? set by Maximize() - // when it is called while the frame is hidden - bool m_maximizeOnShow; - - // Data to save/restore when calling ShowFullScreen - long m_fsStyle; // Passed to ShowFullScreen - wxRect m_fsOldSize; - long m_fsOldWindowStyle; - bool m_fsIsMaximized; - bool m_fsIsShowing; - - // the last focused child: we restore focus to it on activation - wxWindow *m_winLastFocused; - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - class ButtonMenu - { - public: - ButtonMenu(); - ~ButtonMenu(); - - void SetButton(int id = wxID_ANY, - const wxString& label = wxEmptyString, - wxMenu *subMenu = NULL); - - bool IsAssigned() const {return m_assigned;} - bool IsMenu() const {return m_menu!=NULL;} - - int GetId() const {return m_id;} - wxMenu* GetMenu() const {return m_menu;} - wxString GetLabel() {return m_label;} - - static wxMenu *DuplicateMenu(wxMenu *menu); - - protected: - int m_id; - wxString m_label; - wxMenu *m_menu; - bool m_assigned; - }; - - ButtonMenu m_LeftButton; - ButtonMenu m_RightButton; - HWND m_MenuBarHWND; - - void ReloadButton(ButtonMenu& button, UINT menuID); - void ReloadAllButtons(); -#endif // __SMARTPHONE__ && __WXWINCE__ - -private: - // helper of SetIcons(): calls gets the icon with the size specified by the - // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it - // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG) - void DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); - - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - void* m_activateInfo; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) -}; - -#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/treectrl.h b/Source/3rdParty/wx/include/wx/msw/treectrl.h deleted file mode 100644 index d3a6a2e35..000000000 --- a/Source/3rdParty/wx/include/wx/msw/treectrl.h +++ /dev/null @@ -1,315 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/treectrl.h -// Purpose: wxTreeCtrl class -// Author: Julian Smart -// Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 -// Created: 01/02/97 -// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TREECTRL_H_ -#define _WX_MSW_TREECTRL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_TREECTRL - -#include "wx/textctrl.h" -#include "wx/dynarray.h" -#include "wx/treebase.h" -#include "wx/hashmap.h" - -#ifdef __GNUWIN32__ - // Cygwin windows.h defines these identifiers - #undef GetFirstChild - #undef GetNextSibling -#endif // Cygwin - -// fwd decl -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxDragImage; -struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; - -#if WXWIN_COMPATIBILITY_2_6 - // NB: all the following flags are for compatbility only and will be removed in the - // next versions - // flags for deprecated InsertItem() variant (their values are the same as of - // TVI_FIRST and TVI_LAST) - #define wxTREE_INSERT_FIRST 0xFFFF0001 - #define wxTREE_INSERT_LAST 0xFFFF0002 -#endif - -// hash storing attributes for our items -WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); - -// ---------------------------------------------------------------------------- -// wxTreeCtrl -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeCtrl : public wxTreeCtrlBase -{ -public: - // creation - // -------- - wxTreeCtrl() { Init(); } - - wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual unsigned int GetCount() const; - - virtual unsigned int GetIndent() const; - virtual void SetIndent(unsigned int indent); - - virtual void SetImageList(wxImageList *imageList); - virtual void SetStateImageList(wxImageList *imageList); - - virtual wxString GetItemText(const wxTreeItemId& item) const; - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; - virtual wxFont GetItemFont(const wxTreeItemId& item) const; - - virtual void SetItemText(const wxTreeItemId& item, const wxString& text); - virtual void SetItemImage(const wxTreeItemId& item, int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); - virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); - virtual void SetItemDropHighlight(const wxTreeItemId& item, - bool highlight = true); - virtual void SetItemTextColour(const wxTreeItemId& item, - const wxColour& col); - virtual void SetItemBackgroundColour(const wxTreeItemId& item, - const wxColour& col); - virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); - - // item status inquiries - // --------------------- - - virtual bool IsVisible(const wxTreeItemId& item) const; - virtual bool ItemHasChildren(const wxTreeItemId& item) const; - virtual bool IsExpanded(const wxTreeItemId& item) const; - virtual bool IsSelected(const wxTreeItemId& item) const; - virtual bool IsBold(const wxTreeItemId& item) const; - - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const; - - // navigation - // ---------- - - virtual wxTreeItemId GetRootItem() const; - virtual wxTreeItemId GetSelection() const; - virtual size_t GetSelections(wxArrayTreeItemIds& selections) const; - - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetFirstVisibleItem() const; - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; - - // operations - // ---------- - - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - virtual void Delete(const wxTreeItemId& item); - virtual void DeleteChildren(const wxTreeItemId& item); - virtual void DeleteAllItems(); - - virtual void Expand(const wxTreeItemId& item); - virtual void Collapse(const wxTreeItemId& item); - virtual void CollapseAndReset(const wxTreeItemId& item); - virtual void Toggle(const wxTreeItemId& item); - - virtual void Unselect(); - virtual void UnselectAll(); - virtual void SelectItem(const wxTreeItemId& item, bool select = true); - - virtual void EnsureVisible(const wxTreeItemId& item); - virtual void ScrollTo(const wxTreeItemId& item); - - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); - virtual wxTextCtrl *GetEditControl() const; - virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), - bool discardChanges = false) - { - DoEndEditLabel(discardChanges); - } - - virtual void SortChildren(const wxTreeItemId& item); - - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const; - - // deprecated - // ---------- - -#if WXWIN_COMPATIBILITY_2_4 - // these methods are deprecated and will be removed in future versions of - // wxWidgets, they're here for compatibility only, don't use them in new - // code (the comments indicate why these methods are now useless and how to - // replace them) - - // use Expand, Collapse, CollapseAndReset or Toggle - wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); - - // use Set/GetImageList and Set/GetStateImageList - // Use base class GetImageList() - wxDEPRECATED( void SetImageList(wxImageList *imageList, int) ); - - // use Set/GetItemImage directly - wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); - wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); - - // use the versions taking wxTreeItemIdValue cookies - wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, - long& cookie) const ); - wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, - long& cookie) const ); -#endif // WXWIN_COMPATIBILITY_2_4 - - - // implementation - // -------------- - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWShouldPreProcessMessage(WXMSG* msg); - - // override some base class virtuals - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - - // get/set the check state for the item (only for wxTR_MULTIPLE) - bool IsItemChecked(const wxTreeItemId& item) const; - void SetItemCheck(const wxTreeItemId& item, bool check = true); - - // set/get the item state.image (state == -1 means cycle to the next one) - void SetState(const wxTreeItemId& node, int state); - int GetState(const wxTreeItemId& node); - -protected: - // SetImageList helper - void SetAnyImageList(wxImageList *imageList, int which); - - // refresh a single item - void RefreshItem(const wxTreeItemId& item); - - // end edit label - void DoEndEditLabel(bool discardChanges = false); - - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data); - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; - - // obtain the user data for the lParam member of TV_ITEM - class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; - - - // data used only while editing the item label: - wxTextCtrl *m_textCtrl; // text control in which it is edited - wxTreeItemId m_idEdited; // the item being edited - -private: - // the common part of all ctors - void Init(); - - // helper functions - bool DoGetItem(wxTreeViewItem *tvItem) const; - void DoSetItem(wxTreeViewItem *tvItem); - - void DoExpand(const wxTreeItemId& item, int flag); - - void DeleteTextCtrl(); - - // return true if the item is the hidden root one (i.e. it's the root item - // and the tree has wxTR_HIDE_ROOT style) - bool IsHiddenRoot(const wxTreeItemId& item) const; - - - // the hash storing the items attributes (indexed by item ids) - wxMapTreeAttr m_attrs; - - // true if the hash above is not empty - bool m_hasAnyAttr; - -#if wxUSE_DRAGIMAGE - // used for dragging - wxDragImage *m_dragImage; -#endif - - // Virtual root item, if wxTR_HIDE_ROOT is set. - void* m_pVirtualRoot; - - // the starting item for selection with Shift - wxTreeItemId m_htSelStart, m_htClickedItem; - wxPoint m_ptClick; - - friend class wxTreeItemIndirectData; - friend class wxTreeSortHelper; - - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) - DECLARE_NO_COPY_CLASS(wxTreeCtrl) -}; - -#endif // wxUSE_TREECTRL - -#endif // _WX_MSW_TREECTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/uxtheme.h b/Source/3rdParty/wx/include/wx/msw/uxtheme.h deleted file mode 100644 index 23e745fc9..000000000 --- a/Source/3rdParty/wx/include/wx/msw/uxtheme.h +++ /dev/null @@ -1,230 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/uxtheme.h -// Purpose: wxUxThemeEngine class: support for XP themes -// Author: John Platts, Vadim Zeitlin -// Modified by: -// Created: 2003 -// RCS-ID: $Id: uxtheme.h 42725 2006-10-30 15:37:42Z VZ $ -// Copyright: (c) 2003 John Platts, Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UXTHEME_H_ -#define _WX_UXTHEME_H_ - -#include "wx/defs.h" - -#include "wx/msw/private.h" // we use GetHwndOf() -#include "wx/msw/uxthemep.h" - -typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *); -typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, DWORD, const RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME, HDC, int, int, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(HTHEME, HDC, int, int, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(HTHEME, HDC, int, int, const RECT *, /* enum */ THEMESIZE, SIZE *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(HTHEME, HDC, int, int, TEXTMETRIC*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(HTHEME, HDC, int, int, const RECT *, HRGN *); -typedef HRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(HTHEME, HDC, int, int, DWORD, const RECT *, HRGN, POINT, unsigned short *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(HTHEME, HDC, int, int, const RECT *, unsigned int, unsigned int, RECT *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(HTHEME, HDC, int, int, const RECT *, HIMAGELIST, int); -typedef BOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(HTHEME, int, int); -typedef BOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME, int, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(HTHEME, int, int, int, COLORREF*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(HTHEME, HDC, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESTRING)(HTHEME, int, int, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(HTHEME, int, int, int, BOOL *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEINT)(HTHEME, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(HTHEME, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(HTHEME, int, int, int, POINT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEFONT)(HTHEME, HDC, int, int, int, LOGFONT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMERECT)(HTHEME, int, int, int, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(HTHEME, HDC, int, int, int, RECT *, MARGINS *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(HTHEME, int, int, int, INTLIST*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(HTHEME, int, int, int, /* enum */ PROPERTYORIGIN *); -typedef HRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(HWND, const wchar_t*, const wchar_t *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(HTHEME, int, int, int, wchar_t *, int); -typedef COLORREF(__stdcall *PFNWXUGETTHEMESYSCOLOR)(HTHEME, int); -typedef HBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(HTHEME, int); -typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(HTHEME, int); -typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(HTHEME, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(HTHEME, int, LOGFONT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(HTHEME, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(HTHEME, int, int *); -typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)(); -typedef BOOL (__stdcall *PFNWXUISAPPTHEMED)(); -typedef HTHEME (__stdcall *PFNWXUGETWINDOWTHEME)(HWND); -typedef HRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(HWND, DWORD); -typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(HWND); -typedef DWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)(); -typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(DWORD); -typedef HRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int, wchar_t *, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *, const wchar_t *, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(HWND, HDC, RECT *); -typedef HRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL); - -// ---------------------------------------------------------------------------- -// wxUxThemeEngine: provides all theme functions from uxtheme.dll -// ---------------------------------------------------------------------------- - -// we always define this class, even if wxUSE_UXTHEME == 0, but we just make it -// empty in this case -- this allows to use it elsewhere without any #ifdefs -#if wxUSE_UXTHEME - #include "wx/dynlib.h" - - #define wxUX_THEME_DECLARE(type, func) type func; -#else - #define wxUX_THEME_DECLARE(type, func) type func(...) { return 0; } -#endif - -class WXDLLEXPORT wxUxThemeEngine -{ -public: - // get the theme engine or NULL if themes are not available - static wxUxThemeEngine *Get(); - - // get the theme enging or NULL if themes are not available or not used for - // this application - static wxUxThemeEngine *GetIfActive(); - - // all uxtheme.dll functions - wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData) - wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize) - wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTEXTENT, GetThemeTextExtent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTMETRICS, GetThemeTextMetrics) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDREGION, GetThemeBackgroundRegion) - wxUX_THEME_DECLARE(PFNWXUHITTESTTHEMEBACKGROUND, HitTestThemeBackground) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEEDGE, DrawThemeEdge) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEICON, DrawThemeIcon) - wxUX_THEME_DECLARE(PFNWXUISTHEMEPARTDEFINED, IsThemePartDefined) - wxUX_THEME_DECLARE(PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT, IsThemeBackgroundPartiallyTransparent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMECOLOR, GetThemeColor) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEMETRIC, GetThemeMetric) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESTRING, GetThemeString) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBOOL, GetThemeBool) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEINT, GetThemeInt) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEENUMVALUE, GetThemeEnumValue) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPOSITION, GetThemePosition) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEFONT, GetThemeFont) - wxUX_THEME_DECLARE(PFNWXUGETTHEMERECT, GetThemeRect) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEMARGINS, GetThemeMargins) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEINTLIST, GetThemeIntList) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPROPERTYORIGIN, GetThemePropertyOrigin) - wxUX_THEME_DECLARE(PFNWXUSETWINDOWTHEME, SetWindowTheme) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEFILENAME, GetThemeFilename) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLOR, GetThemeSysColor) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLORBRUSH, GetThemeSysColorBrush) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSBOOL, GetThemeSysBool) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSIZE, GetThemeSysSize) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSFONT, GetThemeSysFont) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSTRING, GetThemeSysString) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSINT, GetThemeSysInt) - wxUX_THEME_DECLARE(PFNWXUISTHEMEACTIVE, IsThemeActive) - wxUX_THEME_DECLARE(PFNWXUISAPPTHEMED, IsAppThemed) - wxUX_THEME_DECLARE(PFNWXUGETWINDOWTHEME, GetWindowTheme) - wxUX_THEME_DECLARE(PFNWXUENABLETHEMEDIALOGTEXTURE, EnableThemeDialogTexture) - wxUX_THEME_DECLARE(PFNWXUISTHEMEDIALOGTEXTUREENABLED, IsThemeDialogTextureEnabled) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEAPPPROPERTIES, GetThemeAppProperties) - wxUX_THEME_DECLARE(PFNWXUSETTHEMEAPPPROPERTIES, SetThemeAppProperties) - wxUX_THEME_DECLARE(PFNWXUGETCURRENTTHEMENAME, GetCurrentThemeName) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEDOCUMENTATIONPROPERTY, GetThemeDocumentationProperty) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEPARENTBACKGROUND, DrawThemeParentBackground) - wxUX_THEME_DECLARE(PFNWXUENABLETHEMING, EnableTheming) - -private: - // construcor is private as only Get() can create us and is also trivial as - // everything really happens in Initialize() - wxUxThemeEngine() { } - - // destructor is private as only Get() and wxUxThemeModule delete us, it is - // not virtual as we're not supposed to be derived from - ~wxUxThemeEngine() { } - -#if wxUSE_UXTHEME - // initialize the theme engine: load the DLL, resolve the functions - // - // return true if we can be used, false if themes are not available - bool Initialize(); - - - // uxtheme.dll - wxDynamicLibrary m_dllUxTheme; - - - // the one and only theme engine, initially NULL - static wxUxThemeEngine *ms_themeEngine; - - // this is a bool which initially has the value -1 meaning "unknown" - static int ms_isThemeEngineAvailable; - - // it must be able to delete us - friend class wxUxThemeModule; -#endif // wxUSE_UXTHEME - - DECLARE_NO_COPY_CLASS(wxUxThemeEngine) -}; - -#if wxUSE_UXTHEME - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() -{ - wxUxThemeEngine *engine = Get(); - return engine && engine->IsAppThemed() && engine->IsThemeActive() - ? engine - : NULL; -} - -#else // !wxUSE_UXTHEME - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get() -{ - return NULL; -} - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() -{ - return NULL; -} - -#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME - -// ---------------------------------------------------------------------------- -// wxUxThemeHandle: encapsulates ::Open/CloseThemeData() -// ---------------------------------------------------------------------------- - -class wxUxThemeHandle -{ -public: - wxUxThemeHandle(const wxWindow *win, const wchar_t *classes) - { - wxUxThemeEngine *engine = wxUxThemeEngine::Get(); - - m_hTheme = engine ? (HTHEME)engine->OpenThemeData(GetHwndOf(win), classes) - : NULL; - } - - operator HTHEME() const { return m_hTheme; } - - ~wxUxThemeHandle() - { - if ( m_hTheme ) - { - wxUxThemeEngine::Get()->CloseThemeData(m_hTheme); - } - } - -private: - HTHEME m_hTheme; - - DECLARE_NO_COPY_CLASS(wxUxThemeHandle) -}; - -#endif // _WX_UXTHEME_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/uxthemep.h b/Source/3rdParty/wx/include/wx/msw/uxthemep.h deleted file mode 100644 index bc2fda91d..000000000 --- a/Source/3rdParty/wx/include/wx/msw/uxthemep.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Win32 5.1 theme definitions - * - * Copyright (C) 2003 Kevin Koltzau - * - * Originally written for the Wine project, and issued under - * the wxWindows License by kind permission of the author. - * - * License: wxWindows License - */ - -#ifndef __WINE_UXTHEME_H -#define __WINE_UXTHEME_H - -#include "wx/msw/wrapcctl.h" - -typedef HANDLE HTHEME; - -HRESULT WINAPI CloseThemeData(HTHEME hTheme); -HRESULT WINAPI DrawThemeBackground(HTHEME,HDC,int,int,const RECT*,const RECT*); - -#define DTBG_CLIPRECT 0x00000001 -#define DTBG_DRAWSOLID 0x00000002 -#define DTBG_OMITBORDER 0x00000004 -#define DTBG_OMITCONTENT 0x00000008 -#define DTBG_COMPUTINGREGION 0x00000010 -#define DTBG_MIRRORDC 0x00000020 - -typedef struct _DTBGOPTS { - DWORD dwSize; - DWORD dwFlags; - RECT rcClip; -} DTBGOPTS, *PDTBGOPTS; - -HRESULT WINAPI DrawThemeBackgroundEx(HTHEME,HDC,int,int,const RECT*, - const DTBGOPTS*); -HRESULT WINAPI DrawThemeEdge(HTHEME,HDC,int,int,const RECT*,UINT,UINT, - RECT*); -HRESULT WINAPI DrawThemeIcon(HTHEME,HDC,int,int,const RECT*,HIMAGELIST,int); -HRESULT WINAPI DrawThemeParentBackground(HWND,HDC,RECT*); - -#define DTT_GRAYED 0x1 - -HRESULT WINAPI DrawThemeText(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD, - const RECT*); - -#define ETDT_DISABLE 0x00000001 -#define ETDT_ENABLE 0x00000002 -#define ETDT_USETABTEXTURE 0x00000004 -#define ETDT_ENABLETAB (ETDT_ENABLE|ETDT_USETABTEXTURE) - -HRESULT WINAPI EnableThemeDialogTexture(HWND,DWORD); -HRESULT WINAPI EnableTheming(BOOL); -HRESULT WINAPI GetCurrentThemeName(LPWSTR,int,LPWSTR,int,LPWSTR,int); - -#define STAP_ALLOW_NONCLIENT (1<<0) -#define STAP_ALLOW_CONTROLS (1<<1) -#define STAP_ALLOW_WEBCONTENT (1<<2) - -DWORD WINAPI GetThemeAppProperties(void); -HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME,HDC,int,int, - const RECT*,RECT*); -HRESULT WINAPI GetThemeBackgroundExtent(HTHEME,HDC,int,int,const RECT*,RECT*); -HRESULT WINAPI GetThemeBackgroundRegion(HTHEME,HDC,int,int,const RECT*,HRGN*); -HRESULT WINAPI GetThemeBool(HTHEME,int,int,int,BOOL*); -HRESULT WINAPI GetThemeColor(HTHEME,int,int,int,COLORREF*); - -#if defined(__GNUC__) -# define SZ_THDOCPROP_DISPLAYNAME (const WCHAR []){ 'D','i','s','p','l','a','y','N','a','m','e',0 } -# define SZ_THDOCPROP_CANONICALNAME (const WCHAR []){ 'T','h','e','m','e','N','a','m','e',0 } -# define SZ_THDOCPROP_TOOLTIP (const WCHAR []){ 'T','o','o','l','T','i','p',0 } -# define SZ_THDOCPROP_AUTHOR (const WCHAR []){ 'a','u','t','h','o','r',0 } -#else /* lif defined(_MSC_VER) */ -# define SZ_THDOCPROP_DISPLAYNAME L"DisplayName" -# define SZ_THDOCPROP_CANONICALNAME L"ThemeName" -# define SZ_THDOCPROP_TOOLTIP L"ToolTip" -# define SZ_THDOCPROP_AUTHOR L"author" -/* -#else -static const WCHAR SZ_THDOCPROP_DISPLAYNAME[] = { 'D','i','s','p','l','a','y','N','a','m','e',0 }; -static const WCHAR SZ_THDOCPROP_CANONICALNAME[] = { 'T','h','e','m','e','N','a','m','e',0 }; -static const WCHAR SZ_THDOCPROP_TOOLTIP[] = { 'T','o','o','l','T','i','p',0 }; -static const WCHAR SZ_THDOCPROP_AUTHOR[] = { 'a','u','t','h','o','r',0 }; -*/ -#endif - -HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR,LPCWSTR,LPWSTR,int); -HRESULT WINAPI GetThemeEnumValue(HTHEME,int,int,int,int*); -HRESULT WINAPI GetThemeFilename(HTHEME,int,int,int,LPWSTR,int); -HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONTW*); -HRESULT WINAPI GetThemeInt(HTHEME,int,int,int,int*); - -#define MAX_INTLIST_COUNT 10 -typedef struct _INTLIST { - int iValueCount; - int iValues[MAX_INTLIST_COUNT]; -} INTLIST, *PINTLIST; - -HRESULT WINAPI GetThemeIntList(HTHEME,int,int,int,INTLIST*); - -typedef struct _MARGINS { - int cxLeftWidth; - int cxRightWidth; - int cyTopHeight; - int cyBottomHeight; -} MARGINS, *PMARGINS; - -HRESULT WINAPI GetThemeMargins(HTHEME,HDC,int,int,int,RECT*,MARGINS*); -HRESULT WINAPI GetThemeMetric(HTHEME,HDC,int,int,int,int*); - -typedef enum { - TS_MIN, - TS_TRUE, - TS_DRAW -} THEMESIZE; - -HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEMESIZE,SIZE*); -HRESULT WINAPI GetThemePosition(HTHEME,int,int,int,POINT*); - -typedef enum { - PO_STATE, - PO_PART, - PO_CLASS, - PO_GLOBAL, - PO_NOTFOUND -} PROPERTYORIGIN; - -HRESULT WINAPI GetThemePropertyOrigin(HTHEME,int,int,int,PROPERTYORIGIN*); -HRESULT WINAPI GetThemeRect(HTHEME,int,int,int,RECT*); -HRESULT WINAPI GetThemeString(HTHEME,int,int,int,LPWSTR,int); -BOOL WINAPI GetThemeSysBool(HTHEME,int); -COLORREF WINAPI GetThemeSysColor(HTHEME,int); -HBRUSH WINAPI GetThemeSysColorBrush(HTHEME,int); -HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONTW*); -HRESULT WINAPI GetThemeSysInt(HTHEME,int,int*); -int WINAPI GetThemeSysSize(HTHEME,int); -HRESULT WINAPI GetThemeSysString(HTHEME,int,LPWSTR,int); -HRESULT WINAPI GetThemeTextExtent(HTHEME,HDC,int,int,LPCWSTR,int,DWORD, - const RECT*,RECT*); -HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRICW*); -HTHEME WINAPI GetWindowTheme(HWND); - -#define HTTB_BACKGROUNDSEG 0x0000 -#define HTTB_FIXEDBORDER 0x0002 -#define HTTB_CAPTION 0x0004 -#define HTTB_RESIZINGBORDER_LEFT 0x0010 -#define HTTB_RESIZINGBORDER_TOP 0x0020 -#define HTTB_RESIZINGBORDER_RIGHT 0x0040 -#define HTTB_RESIZINGBORDER_BOTTOM 0x0080 -#define HTTB_RESIZINGBORDER \ - (HTTB_RESIZINGBORDER_LEFT|HTTB_RESIZINGBORDER_TOP|\ - HTTB_RESIZINGBORDER_RIGHT|HTTB_RESIZINGBORDER_BOTTOM) -#define HTTB_SIZINGTEMPLATE 0x0100 -#define HTTB_SYSTEMSIZINGMARGINS 0x0200 - -HRESULT WINAPI HitTestThemeBackground(HTHEME,HDC,int,int,DWORD,const RECT*, - HRGN,POINT,WORD*); -BOOL WINAPI IsAppThemed(void); -BOOL WINAPI IsThemeActive(void); -BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME,int,int); -BOOL WINAPI IsThemeDialogTextureEnabled(void); -BOOL WINAPI IsThemePartDefined(HTHEME,int,int); -HTHEME WINAPI OpenThemeData(HWND,LPCWSTR); -void WINAPI SetThemeAppProperties(DWORD); -HRESULT WINAPI SetWindowTheme(HWND,LPCWSTR,LPCWSTR); - - -#endif - diff --git a/Source/3rdParty/wx/include/wx/msw/window.h b/Source/3rdParty/wx/include/wx/msw/window.h deleted file mode 100644 index b765ac1db..000000000 --- a/Source/3rdParty/wx/include/wx/msw/window.h +++ /dev/null @@ -1,601 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/window.h -// Purpose: wxWindowMSW class -// Author: Julian Smart -// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, -// elimination of Default(), ... -// Created: 01/02/97 -// RCS-ID: $Id: window.h 53929 2008-06-02 18:27:16Z RD $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINDOW_H_ -#define _WX_WINDOW_H_ - -// --------------------------------------------------------------------------- -// constants -// --------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 -// they're unused by wxWidgets... -enum -{ - wxKEY_SHIFT = 1, - wxKEY_CTRL = 2 -}; -#endif - -// --------------------------------------------------------------------------- -// wxWindow declaration for MSW -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowMSW : public wxWindowBase -{ - friend class wxSpinCtrl; - friend class wxSlider; - friend class wxRadioBox; -#if defined __VISUALC__ && __VISUALC__ <= 1200 - friend class wxWindowMSW; -#endif -public: - wxWindowMSW() { Init(); } - - wxWindowMSW(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - Create(parent, id, pos, size, style, name); - } - - virtual ~wxWindowMSW(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - // implement base class pure virtuals - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; - - virtual void Raise(); - virtual void Lower(); - - virtual bool Show( bool show = true ); - virtual bool Enable( bool enable = true ); - - virtual void SetFocus(); - virtual void SetFocusFromKbd(); - - virtual bool Reparent(wxWindowBase *newParent); - - virtual void WarpPointer(int x, int y); - - virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); - virtual void Update(); - virtual void Freeze(); - virtual void Thaw(); - virtual bool IsFrozen() const { return m_frozenness > 0; } - - virtual void SetWindowStyleFlag(long style); - virtual void SetExtraStyle(long exStyle); - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); - - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void GetTextExtent(const wxString& string, - int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL) - const; - - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ); - - virtual bool ScrollLines(int lines); - virtual bool ScrollPages(int pages); - - virtual void SetLayoutDirection(wxLayoutDirection dir); - virtual wxLayoutDirection GetLayoutDirection() const; - virtual wxCoord AdjustForLayoutDirection(wxCoord x, - wxCoord width, - wxCoord widthTotal) const; - -#if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); -#endif // wxUSE_DRAG_AND_DROP - - // Accept files for dragging - virtual void DragAcceptFiles(bool accept); - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( bool GetUseCtl3D() const ); - wxDEPRECATED( bool GetTransparentBackground() const ); - wxDEPRECATED( void SetTransparent(bool t = true) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -#ifndef __WXUNIVERSAL__ - // Native resource loading (implemented in src/msw/nativdlg.cpp) - // FIXME: should they really be all virtual? - virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); - virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); - wxWindow* GetWindowChild1(wxWindowID id); - wxWindow* GetWindowChild(wxWindowID id); -#endif // __WXUNIVERSAL__ - -#if wxUSE_HOTKEY - // install and deinstall a system wide hotkey - virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); - virtual bool UnregisterHotKey(int hotkeyId); -#endif // wxUSE_HOTKEY - -#ifdef __POCKETPC__ - bool IsContextMenuEnabled() const { return m_contextMenuEnabled; } - void EnableContextMenu(bool enable = true) { m_contextMenuEnabled = enable; } -#endif - - // window handle stuff - // ------------------- - - WXHWND GetHWND() const { return m_hWnd; } - void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } - virtual WXWidget GetHandle() const { return GetHWND(); } - - void AssociateHandle(WXWidget handle); - void DissociateHandle(); - - // does this window have deferred position and/or size? - bool IsSizeDeferred() const; - - - // implementation from now on - // ========================== - - // event handlers - // -------------- - - void OnPaint(wxPaintEvent& event); - void OnEraseBackground(wxEraseEvent& event); -#ifdef __WXWINCE__ - void OnInitDialog(wxInitDialogEvent& event); -#endif - -public: - // Windows subclassing - void SubclassWin(WXHWND hWnd); - void UnsubclassWin(); - - WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } - void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - - // return true if the window is of a standard (i.e. not wxWidgets') class - // - // to understand why does it work, look at SubclassWin() code and comments - bool IsOfStandardClass() const { return m_oldWndProc != NULL; } - - wxWindow *FindItem(long id) const; - wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; - - // MSW only: true if this control is part of the main control - virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; } - -#if wxUSE_TOOLTIPS - // MSW only: true if this window or any of its children have a tooltip - virtual bool HasToolTips() const { return GetToolTip() != NULL; } -#endif // wxUSE_TOOLTIPS - - // translate wxWidgets style flags for this control into the Windows style - // and optional extended style for the corresponding native control - // - // this is the function that should be overridden in the derived classes, - // but you will mostly use MSWGetCreateWindowFlags() below - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; - - // get the MSW window flags corresponding to wxWidgets ones - // - // the functions returns the flags (WS_XXX) directly and puts the ext - // (WS_EX_XXX) flags into the provided pointer if not NULL - WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const - { return MSWGetStyle(GetWindowStyle(), exflags); } - - // update the real underlying window style flags to correspond to the - // current wxWindow object style (safe to call even if window isn't fully - // created yet) - void MSWUpdateStyle(long flagsOld, long exflagsOld); - -#if wxABI_VERSION >= 20805 - // Helper for getting an appropriate theme style for the application. Unnecessary in - // 2.9 and above. - wxBorder GetThemedBorderStyle() const; -#endif - - // translate wxWidgets coords into Windows ones suitable to be passed to - // ::CreateWindow() - // - // returns true if non default coords are returned, false otherwise - bool MSWGetCreateWindowCoords(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h) const; - - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND MSWGetParent() const; - - // creates the window of specified Windows class with given style, extended - // style, title and geometry (default values - // - // returns true if the window has been created, false if creation failed - bool MSWCreate(const wxChar *wclass, - const wxChar *title = NULL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - WXDWORD style = 0, - WXDWORD exendedStyle = 0); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - -#ifndef __WXUNIVERSAL__ - // Create an appropriate wxWindow from a HWND - virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); - - // Make sure the window style reflects the HWND style (roughly) - virtual void AdoptAttributesFromHWND(); -#endif // __WXUNIVERSAL__ - - // Setup background and foreground colours correctly - virtual void SetupColours(); - - // ------------------------------------------------------------------------ - // helpers for message handlers: these perform the same function as the - // message crackers from - they unpack WPARAM and LPARAM into - // the correct parameters - // ------------------------------------------------------------------------ - - void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *id, WXHWND *hwnd, WXWORD *cmd); - void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *state, WXWORD *minimized, WXHWND *hwnd); - void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *code, WXWORD *pos, WXHWND *hwnd); - void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, - WXHDC *hdc, WXHWND *hwnd); - void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *item, WXWORD *flags, WXHMENU *hmenu); - - // ------------------------------------------------------------------------ - // internal handlers for MSW messages: all handlers return a boolean value: - // true means that the handler processed the event and false that it didn't - // ------------------------------------------------------------------------ - - // there are several cases where we have virtual functions for Windows - // message processing: this is because these messages often require to be - // processed in a different manner in the derived classes. For all other - // messages, however, we do *not* have corresponding MSWOnXXX() function - // and if the derived class wants to process them, it should override - // MSWWindowProc() directly. - - // scroll event (both horizontal and vertical) - virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - - // child control notifications - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // owner-drawn controls need to process these messages - virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); - virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); - - // the rest are not virtual - bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); - bool HandleInitDialog(WXHWND hWndFocus); - bool HandleDestroy(); - - bool HandlePaint(); - bool HandlePrintClient(WXHDC hDC); - bool HandleEraseBkgnd(WXHDC hDC); - - bool HandleMinimize(); - bool HandleMaximize(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleSizing(wxRect& rect); - bool HandleGetMinMaxInfo(void *mmInfo); - - bool HandleShow(bool show, int status); - bool HandleActivate(int flag, bool minimized, WXHWND activate); - - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - - bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd); - - bool HandlePaletteChanged(WXHWND hWndPalChange); - bool HandleQueryNewPalette(); - bool HandleSysColorChange(); - bool HandleDisplayChange(); - bool HandleCaptureChanged(WXHWND gainedCapture); - virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleQueryEndSession(long logOff, bool *mayEnd); - bool HandleEndSession(bool endSession, long logOff); - - bool HandleSetFocus(WXHWND wnd); - bool HandleKillFocus(WXHWND wnd); - - bool HandleDropFiles(WXWPARAM wParam); - - bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleMouseMove(int x, int y, WXUINT flags); - bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false); - bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); - bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); -#if wxUSE_ACCEL - bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); -#endif -#ifdef __WIN32__ - int HandleMenuChar(int chAccel, WXLPARAM lParam); -#endif - // Create and process a clipboard event specified by type. - bool HandleClipboardEvent( WXUINT nMsg ); - - bool HandleQueryDragIcon(WXHICON *hIcon); - - bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); - - bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); - - - // Window procedure - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // Calls an appropriate default window procedure - virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // message processing helpers - - // return false if the message shouldn't be translated/preprocessed but - // dispatched normally - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); - - // return true if the message was preprocessed and shouldn't be dispatched - virtual bool MSWProcessMessage(WXMSG* pMsg); - - // return true if the message was translated and shouldn't be dispatched - virtual bool MSWTranslateMessage(WXMSG* pMsg); - - // called when the window is about to be destroyed - virtual void MSWDestroyWindow(); - - - // this function should return the brush to paint the children controls - // background or 0 if this window doesn't impose any particular background - // on its children - // - // the base class version returns a solid brush if we have a non default - // background colour or 0 otherwise - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); - - // return the background brush to use for painting the given window by - // quering the parent windows via their MSWGetBgBrushForChild() recursively - // - // hWndToPaint is normally NULL meaning this window itself, but it can also - // be a child of this window which is used by the static box and could be - // potentially useful for other transparent controls - WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL); - - // gives the parent the possibility to draw its children background, e.g. - // this is used by wxNotebook to do it using DrawThemeBackground() - // - // return true if background was drawn, false otherwise - virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child)) - { - return false; - } - - // some controls (e.g. wxListBox) need to set the return value themselves - // - // return true to let parent handle it if we don't, false otherwise - virtual bool MSWShouldPropagatePrintChild() - { - return true; - } - - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX) - void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); - - // check if mouse is in the window - bool IsMouseInWindow() const; - - // check if a native double-buffering applies for this window - virtual bool IsDoubleBuffered() const; - -#if wxABI_VERSION >= 20808 - void SetDoubleBuffered(bool on); -#endif - - // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false - void GenerateMouseLeave(); - - // virtual function for implementing internal idle - // behaviour - virtual void OnInternalIdle(); - -protected: - -#if wxUSE_MENUS_NATIVE - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); -#endif // wxUSE_MENUS_NATIVE - - // the window handle - WXHWND m_hWnd; - - // the old window proc (we subclass all windows) - WXFARPROC m_oldWndProc; - - // additional (MSW specific) flags - bool m_mouseInWindow:1; - bool m_lastKeydownProcessed:1; - - // the size of one page for scrolling - int m_xThumbSize; - int m_yThumbSize; - - // implement the base class pure virtuals - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetClientSize( int *width, int *height ) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); - - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); - - // this simply moves/resizes the given HWND which is supposed to be our - // sibling (this is useful for controls which are composite at MSW level - // and for which DoMoveWindow() is not enough) - // - // returns true if the window move was deferred, false if it was moved - // immediately (no error return) - bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height); - - // move the window to the specified location and resize it: this is called - // from both DoSetSize() and DoSetClientSize() and would usually just call - // ::MoveWindow() except for composite controls which will want to arrange - // themselves inside the given rectangle - virtual void DoMoveWindow(int x, int y, int width, int height); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); - - // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in - // comctl32.dll in our code -- see the function body for more info) - bool HandleTooltipNotify(WXUINT code, - WXLPARAM lParam, - const wxString& ttip); -#endif // wxUSE_TOOLTIPS - - // the helper functions used by HandleChar/KeyXXX methods - wxKeyEvent CreateKeyEvent(wxEventType evType, int id, - WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; - - - // default OnEraseBackground() implementation, return true if we did erase - // the background, false otherwise (i.e. the system should erase it) - bool DoEraseBackground(WXHDC hDC); - - // generate WM_CHANGEUISTATE if it's needed for the OS we're running under - // - // action should be one of the UIS_XXX constants - // state should be one or more of the UISF_XXX constants - // if action == UIS_INITIALIZE then it doesn't seem to matter what we use - // for state as the system will decide for us what needs to be set - void MSWUpdateUIState(int action, int state = 0); - -private: - // common part of all ctors - void Init(); - - // the (non-virtual) handlers for the events - bool HandleMove(int x, int y); - bool HandleMoving(wxRect& rect); - bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // list of disabled children before last call to our Disable() - wxWindowList *m_childrenDisabled; - - // number of calls to Freeze() minus number of calls to Thaw() - unsigned int m_frozenness; - - // current defer window position operation handle (may be NULL) - WXHANDLE m_hDWP; - -protected: - // When deferred positioning is done these hold the pending changes, and - // are used for the default values if another size/pos changes is done on - // this window before the group of deferred changes is completed. - wxPoint m_pendingPosition; - wxSize m_pendingSize; - -private: -#ifdef __POCKETPC__ - bool m_contextMenuEnabled; -#endif - - DECLARE_DYNAMIC_CLASS(wxWindowMSW) - DECLARE_NO_COPY_CLASS(wxWindowMSW) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// inline functions -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 - -inline bool wxWindowMSW::GetUseCtl3D() const { return false; } -inline bool wxWindowMSW::GetTransparentBackground() const { return false; } -inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { } - -#endif // WXWIN_COMPATIBILITY_2_4 - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -// kbd code translation -WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0); -WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual = NULL); - -// window creation helper class: before creating a new HWND, instantiate an -// object of this class on stack - this allows to process the messages sent to -// the window even before CreateWindow() returns -class wxWindowCreationHook -{ -public: - wxWindowCreationHook(wxWindowMSW *winBeingCreated); - ~wxWindowCreationHook(); -}; - -// ---------------------------------------------------------------------------- -// global objects -// ---------------------------------------------------------------------------- - -// notice that this hash must be defined after wxWindow declaration as it -// needs to "see" its dtor and not just forward declaration -#include "wx/hash.h" - -// pseudo-template HWND <-> wxWindow hash table -#if WXWIN_COMPATIBILITY_2_4 -WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); -#else -WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable); -#endif - -extern wxWinHashTable *wxWinHandleHash; - -#endif // _WX_WINDOW_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/winundef.h b/Source/3rdParty/wx/include/wx/msw/winundef.h deleted file mode 100644 index b8acb68b7..000000000 --- a/Source/3rdParty/wx/include/wx/msw/winundef.h +++ /dev/null @@ -1,490 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: winundef.h -// Purpose: undefine the common symbols #define'd by -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.05.99 -// RCS-ID: $Id: winundef.h 36044 2005-10-31 19:35:41Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h, - * then again _AFTER_ you've included windows.h, in which case it won't work - * a 2nd time -- JACS -#ifndef _WX_WINUNDEF_H_ -#define _WX_WINUNDEF_H_ - */ - -// ---------------------------------------------------------------------------- -// windows.h #defines the following identifiers which are also used in wxWin so -// we replace these symbols with the corresponding inline functions and -// undefine the macro. -// -// This looks quite ugly here but allows us to write clear (and correct!) code -// elsewhere because the functions, unlike the macros, respect the scope. -// ---------------------------------------------------------------------------- - -// CreateDialog - -#if defined(CreateDialog) - #undef CreateDialog - - inline HWND CreateDialog(HINSTANCE hInstance, - LPCTSTR pTemplate, - HWND hwndParent, - DLGPROC pDlgProc) - { - #ifdef _UNICODE - return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc); - #else - return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc); - #endif - } -#endif - -// CreateFont - -#ifdef CreateFont - #undef CreateFont - - inline HFONT CreateFont(int height, - int width, - int escapement, - int orientation, - int weight, - DWORD italic, - DWORD underline, - DWORD strikeout, - DWORD charset, - DWORD outprecision, - DWORD clipprecision, - DWORD quality, - DWORD family, - LPCTSTR facename) - { - #ifdef _UNICODE - return CreateFontW(height, width, escapement, orientation, - weight, italic, underline, strikeout, charset, - outprecision, clipprecision, quality, - family, facename); - #else - return CreateFontA(height, width, escapement, orientation, - weight, italic, underline, strikeout, charset, - outprecision, clipprecision, quality, - family, facename); - #endif - } -#endif // CreateFont - -// CreateWindow - -#if defined(CreateWindow) - #undef CreateWindow - - inline HWND CreateWindow(LPCTSTR lpClassName, - LPCTSTR lpWndClass, - DWORD dwStyle, - int x, int y, int w, int h, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance, - LPVOID lpParam) - { - #ifdef _UNICODE - return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h, - hWndParent, hMenu, hInstance, lpParam); - #else - return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h, - hWndParent, hMenu, hInstance, lpParam); - #endif - } -#endif - -// LoadMenu - -#ifdef LoadMenu - #undef LoadMenu - - inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name) - { - #ifdef _UNICODE - return LoadMenuW(instance, name); - #else - return LoadMenuA(instance, name); - #endif - } -#endif - -// FindText - -#ifdef FindText - #undef FindText - - inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace) - { - #ifdef UNICODE - return FindTextW(lpfindreplace); - #else - return FindTextA(lpfindreplace); - #endif // !UNICODE - } -#endif - -// GetCharWidth - -#ifdef GetCharWidth - #undef GetCharWidth - inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer) - { - #ifdef _UNICODE - return GetCharWidthW(dc, first, last, buffer); - #else - return GetCharWidthA(dc, first, last, buffer); - #endif - } -#endif - -// FindWindow - -#ifdef FindWindow - #undef FindWindow - #ifdef _UNICODE - inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname) - { - return FindWindowW(classname, windowname); - } - #else - inline HWND FindWindow(LPCSTR classname, LPCSTR windowname) - { - return FindWindowA(classname, windowname); - } - #endif -#endif - -// PlaySound - -#ifdef PlaySound - #undef PlaySound - #ifdef _UNICODE - inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound) - { - return PlaySoundW(pszSound, hMod, fdwSound); - } - #else - inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound) - { - return PlaySoundA(pszSound, hMod, fdwSound); - } - #endif -#endif - -// GetClassName - -#ifdef GetClassName - #undef GetClassName - #ifdef _UNICODE - inline int GetClassName(HWND h, LPWSTR classname, int maxcount) - { - return GetClassNameW(h, classname, maxcount); - } - #else - inline int GetClassName(HWND h, LPSTR classname, int maxcount) - { - return GetClassNameA(h, classname, maxcount); - } - #endif -#endif - -// GetClassInfo - -#ifdef GetClassInfo - #undef GetClassInfo - #ifdef _UNICODE - inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass) - { - return GetClassInfoW(h, name, winclass); - } - #else - inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass) - { - return GetClassInfoA(h, name, winclass); - } - #endif -#endif - -// LoadAccelerators - -#ifdef LoadAccelerators - #undef LoadAccelerators - #ifdef _UNICODE - inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name) - { - return LoadAcceleratorsW(h, name); - } - #else - inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name) - { - return LoadAcceleratorsA(h, name); - } - #endif -#endif - -// DrawText - -#ifdef DrawText - #undef DrawText - #ifdef _UNICODE - inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format) - { - return DrawTextW(h, str, count, rect, format); - } - #else - inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format) - { - return DrawTextA(h, str, count, rect, format); - } - #endif -#endif - - -/* - When this file is included, sometimes the wxCHECK_W32API_VERSION macro - is undefined. With for example CodeWarrior this gives problems with - the following code: - #if 0 && wxCHECK_W32API_VERSION( 0, 5 ) - Because CodeWarrior does macro expansion before test evaluation. - We define wxCHECK_W32API_VERSION here if it's undefined. -*/ -#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION) - #define wxCHECK_W32API_VERSION(maj, min) (0) -#endif - -// StartDoc - -#ifdef StartDoc - #undef StartDoc - #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 ) - #define DOCINFOW DOCINFO - #define DOCINFOA DOCINFO - #endif - #ifdef _UNICODE - inline int StartDoc(HDC h, CONST DOCINFOW* info) - { - return StartDocW(h, (DOCINFOW*) info); - } - #else - inline int StartDoc(HDC h, CONST DOCINFOA* info) - { - return StartDocA(h, (DOCINFOA*) info); - } - #endif -#endif - -// GetObject - -#ifdef GetObject - #undef GetObject - inline int GetObject(HGDIOBJ h, int i, LPVOID buffer) - { - #ifdef _UNICODE - return GetObjectW(h, i, buffer); - #else - return GetObjectA(h, i, buffer); - #endif - } -#endif - -// GetMessage - -#ifdef GetMessage - #undef GetMessage - inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax) - { - #ifdef _UNICODE - return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); - #else - return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); - #endif - } -#endif - -// LoadIcon -#ifdef LoadIcon - #undef LoadIcon - inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName) - { - #ifdef _UNICODE - return LoadIconW(hInstance, lpIconName); - #else // ANSI - return LoadIconA(hInstance, lpIconName); - #endif // Unicode/ANSI - } -#endif // LoadIcon - -// LoadBitmap -#ifdef LoadBitmap - #undef LoadBitmap - inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName) - { - #ifdef _UNICODE - return LoadBitmapW(hInstance, lpBitmapName); - #else // ANSI - return LoadBitmapA(hInstance, lpBitmapName); - #endif // Unicode/ANSI - } -#endif // LoadBitmap - -// LoadLibrary - -#ifdef LoadLibrary - #undef LoadLibrary - #ifdef _UNICODE - inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName) - { - return LoadLibraryW(lpLibFileName); - } - #else - inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName) - { - return LoadLibraryA(lpLibFileName); - } - #endif -#endif - -// FindResource -#ifdef FindResource - #undef FindResource - #ifdef _UNICODE - inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType) - { - return FindResourceW(hModule, lpName, lpType); - } - #else - inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType) - { - return FindResourceA(hModule, lpName, lpType); - } - #endif -#endif - -// IsMaximized - -#ifdef IsMaximized - #undef IsMaximized - inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd)) - { -#ifdef __WXWINCE__ - return FALSE; -#else - return IsZoomed(hwnd); -#endif - } -#endif - -// GetFirstChild - -#ifdef GetFirstChild - #undef GetFirstChild - inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd)) - { -#ifdef __WXWINCE__ - return 0; -#else - return GetTopWindow(hwnd); -#endif - } -#endif - -// GetFirstSibling - -#ifdef GetFirstSibling - #undef GetFirstSibling - inline HWND GetFirstSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDFIRST); - } -#endif - -// GetLastSibling - -#ifdef GetLastSibling - #undef GetLastSibling - inline HWND GetLastSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDLAST); - } -#endif - -// GetPrevSibling - -#ifdef GetPrevSibling - #undef GetPrevSibling - inline HWND GetPrevSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDPREV); - } -#endif - -// GetNextSibling - -#ifdef GetNextSibling - #undef GetNextSibling - inline HWND GetNextSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDNEXT); - } -#endif - -// For WINE - -#if defined(GetWindowStyle) - #undef GetWindowStyle -#endif - -// For ming and cygwin - -// GetFirstChild -#ifdef GetFirstChild - #undef GetFirstChild - inline HWND GetFirstChild(HWND h) - { - return GetTopWindow(h); - } -#endif - - -// GetNextSibling -#ifdef GetNextSibling - #undef GetNextSibling - inline HWND GetNextSibling(HWND h) - { - return GetWindow(h, GW_HWNDNEXT); - } -#endif - - -#ifdef Yield - #undef Yield -#endif - - -#if defined(__WXWINCE__) && defined(DrawIcon) //#ifdef DrawIcon - #undef DrawIcon - inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hicon) - { - return DrawIconEx(hdc,x,y,hicon,0,0,0,NULL, DI_NORMAL) ; - } -#endif - - -// GetWindowProc -//ifdef GetWindowProc -// #undef GetWindowProc -//endif -//ifdef GetNextChild -// #undef GetNextChild -//endif - -// #endif // _WX_WINUNDEF_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/wrapcctl.h b/Source/3rdParty/wx/include/wx/msw/wrapcctl.h deleted file mode 100644 index eaa68be04..000000000 --- a/Source/3rdParty/wx/include/wx/msw/wrapcctl.h +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapcctl.h -// Purpose: Wrapper for the standard header -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.08.2003 -// RCS-ID: $Id: wrapcctl.h 41054 2006-09-07 19:01:45Z ABX $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPCCTL_H_ -#define _WX_MSW_WRAPCCTL_H_ - -// define _WIN32_IE to a high value because we always check for the version -// of installed DLLs at runtime anyway (see wxApp::GetComCtl32Version()) unless -// the user really doesn't want it and had defined it to a (presumably lower) -// value -// -// just for the reference, here is the table showing what the different value -// of _WIN32_IE correspond to: -// -// 0x0200 for comctl32.dll 4.00 shipped with Win95/NT 4.0 -// 0x0300 4.70 IE 3.x -// 0x0400 4.71 IE 4.0 -// 0x0401 4.72 IE 4.01 and Win98 -// 0x0500 5.80 IE 5.x -// 0x0500 5.81 Win2k/ME -// 0x0600 6.00 WinXP - -#ifndef _WIN32_IE - // use maximal set of features by default, we check for them during - // run-time anyhow - #define _WIN32_IE 0x0600 -#endif // !defined(_WIN32_IE) - -#include "wx/msw/wrapwin.h" - -#include - -// define things which might be missing from our commctrl.h -#include "wx/msw/missing.h" - -// Set Unicode format for a common control -inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) -{ -#ifndef __WXWINCE__ - ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); -#else // !__WXWINCE__ - // here it should be already in Unicode anyhow -#endif // __WXWINCE__/!__WXWINCE__ -} - -#if wxUSE_GUI -// Return the default font for the common controls -// -// this is implemented in msw/settings.cpp -class wxFont; -extern wxFont wxGetCCDefaultFont(); -#endif - -#endif // _WX_MSW_WRAPCCTL_H_ diff --git a/Source/3rdParty/wx/include/wx/msw/wrapcdlg.h b/Source/3rdParty/wx/include/wx/msw/wrapcdlg.h deleted file mode 100644 index 907515291..000000000 --- a/Source/3rdParty/wx/include/wx/msw/wrapcdlg.h +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapcdlg.h -// Purpose: Wrapper for the standard header -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 22.03.2005 -// RCS-ID: $Id: wrapcdlg.h 43151 2006-11-07 09:08:33Z JS $ -// Copyright: (c) 2005 Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPCDLG_H_ -#define _WX_MSW_WRAPCDLG_H_ - -#include "wx/defs.h" - -#include "wx/msw/wrapwin.h" -#include "wx/msw/private.h" -#include "wx/msw/missing.h" - -#if wxUSE_COMMON_DIALOGS && !defined(__SMARTPHONE__) && !defined(__WXMICROWIN__) - #include -#endif - -#include "wx/msw/winundef.h" - -#endif // _WX_MSW_WRAPCDLG_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/wrapshl.h b/Source/3rdParty/wx/include/wx/msw/wrapshl.h deleted file mode 100644 index 282a81c01..000000000 --- a/Source/3rdParty/wx/include/wx/msw/wrapshl.h +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapshl.h -// Purpose: wrapper class for stuff from shell32.dll -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: wrapshl.h 40367 2006-07-29 19:19:50Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPSHL_H_ -#define _WX_MSW_WRAPSHL_H_ - -#ifdef __WXWINCE__ - #include - #include - #include -#endif - -#include - -#include "wx/msw/winundef.h" - -// ---------------------------------------------------------------------------- -// wxItemIdList implements RAII on top of ITEMIDLIST -// ---------------------------------------------------------------------------- - -class wxItemIdList -{ -public: - // ctor takes ownership of the item and will free it - wxItemIdList(LPITEMIDLIST pidl) - { - m_pidl = pidl; - } - - static void Free(LPITEMIDLIST pidl) - { - if ( pidl ) - { - LPMALLOC pMalloc; - SHGetMalloc(&pMalloc); - if ( pMalloc ) - { - pMalloc->Free(pidl); - pMalloc->Release(); - } - else - { - wxLogLastError(wxT("SHGetMalloc")); - } - } - } - - ~wxItemIdList() - { - Free(m_pidl); - } - - // implicit conversion to LPITEMIDLIST - operator LPITEMIDLIST() const { return m_pidl; } - - // get the corresponding path, returns empty string on error - wxString GetPath() const - { - wxString path; - if ( !SHGetPathFromIDList(m_pidl, wxStringBuffer(path, MAX_PATH)) ) - { - wxLogLastError(_T("SHGetPathFromIDList")); - } - - return path; - } - -private: - LPITEMIDLIST m_pidl; - - DECLARE_NO_COPY_CLASS(wxItemIdList) -}; - -// enable autocompleting filenames in the text control with given HWND -// -// this only works on systems with shlwapi.dll 5.0 or later -// -// implemented in src/msw/utilsgui.cpp -extern bool wxEnableFileNameAutoComplete(HWND hwnd); - -#endif // _WX_MSW_WRAPSHL_H_ - diff --git a/Source/3rdParty/wx/include/wx/msw/wrapwin.h b/Source/3rdParty/wx/include/wx/msw/wrapwin.h deleted file mode 100644 index d1e6a0a86..000000000 --- a/Source/3rdParty/wx/include/wx/msw/wrapwin.h +++ /dev/null @@ -1,99 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msw/wrapwin.h -// Purpose: Wrapper around , to be included instead of it -// Author: Vaclav Slavik -// Created: 2003/07/22 -// RCS-ID: $Id: wrapwin.h 53877 2008-05-31 12:43:44Z SN $ -// Copyright: (c) 2003 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WRAPWIN_H_ -#define _WX_WRAPWIN_H_ - -#include "wx/platform.h" - -// strict type checking to detect conversion from HFOO to HBAR at compile-time -#ifndef STRICT - #define STRICT 1 -#endif - -// this macro tells windows.h to not define min() and max() as macros: we need -// this as otherwise they conflict with standard C++ functions -#ifndef NOMINMAX - #define NOMINMAX -#endif // NOMINMAX - - -// before including windows.h, define version macros at (currently) maximal -// values because we do all our checks at run-time anyhow -#ifndef WINVER - // the only exception to the above is MSVC 6 which has a time bomb in its - // headers: they warn against using them with WINVER >= 0x0500 as they - // contain only part of the declarations and they're not always correct, so - // don't define WINVER for it at all as this allows everything to work as - // expected both with standard VC6 headers (which define WINVER as 0x0400 - // by default) and headers from a newer SDK (which may define it as 0x0500) - #if !defined(__VISUALC__) || (__VISUALC__ >= 1300) - #define WINVER 0x0600 - #endif -#endif - -#ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 -#endif - -/* Deal with clash with __WINDOWS__ include guard */ -#if defined(__WXWINCE__) && defined(__WINDOWS__) -#undef __WINDOWS__ -#endif - -#include - -#if defined(__WXWINCE__) && !defined(__WINDOWS__) -#define __WINDOWS__ -#endif - -// #undef the macros defined in winsows.h which conflict with code elsewhere -#include "wx/msw/winundef.h" - -// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatability -// in the WINAPI SDK (they are an integral type that is the size of a -// pointer) on MSVC 7 and later. However, they are not available in older -// Platform SDKs, and since they are typedefs and not #defines we simply -// overwrite them if there is a chance that they're not defined -#if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__) - #define UINT_PTR unsigned int - #define LONG_PTR long - #define ULONG_PTR unsigned long - #define DWORD_PTR unsigned long -#endif // !defined(_MSC_VER) || _MSC_VER < 1300 - -// ---------------------------------------------------------------------------- -// Fix the functions wrongly implemented in unicows.dll -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE_MSLU - -#if wxUSE_GUI - -WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, - WXLPARAM lData, WXWPARAM wData, - int x, int y, int cx, int cy, - unsigned int flags); -#define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \ - wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ - ld, wd, x, y, cx, cy, flags) - -WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn); -#define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) - -WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn); -#define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) - -#endif // wxUSE_GUI - -#endif // wxUSE_UNICODE_MSLU - -#endif // _WX_WRAPWIN_H_ - diff --git a/Source/3rdParty/wx/include/wx/notebook.h b/Source/3rdParty/wx/include/wx/notebook.h deleted file mode 100644 index db1dc1361..000000000 --- a/Source/3rdParty/wx/include/wx/notebook.h +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/notebook.h -// Purpose: wxNotebook interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.02.01 -// RCS-ID: $Id: notebook.h 42152 2006-10-20 09:16:41Z VZ $ -// Copyright: (c) 1996-2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NOTEBOOK_H_BASE_ -#define _WX_NOTEBOOK_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_NOTEBOOK - -#include "wx/bookctrl.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them -// if wxUSE_NOTEBOOK is disabled -enum -{ - wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, - wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, - wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, - wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, - wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE -}; - -// wxNotebook flags - -// use common book wxBK_* flags for describing alignment -#define wxNB_DEFAULT wxBK_DEFAULT -#define wxNB_TOP wxBK_TOP -#define wxNB_BOTTOM wxBK_BOTTOM -#define wxNB_LEFT wxBK_LEFT -#define wxNB_RIGHT wxBK_RIGHT - -#define wxNB_FIXEDWIDTH 0x0100 -#define wxNB_MULTILINE 0x0200 -#define wxNB_NOPAGETHEME 0x0400 -#define wxNB_FLAT 0x0800 - - -typedef wxWindow wxNotebookPage; // so far, any window can be a page - -extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; - -#if WXWIN_COMPATIBILITY_2_4 - #define wxNOTEBOOK_NAME wxNotebookNameStr -#endif - -// ---------------------------------------------------------------------------- -// wxNotebookBase: define wxNotebook interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase -{ -public: - // ctors - // ----- - - wxNotebookBase() { } - - wxNotebookBase(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr) ; - - // wxNotebook-specific additions to wxBookCtrlBase interface - // --------------------------------------------------------- - - // get the number of rows for a control with wxNB_MULTILINE style (not all - // versions support it - they will always return 1 then) - virtual int GetRowCount() const { return 1; } - - // set the padding between tabs (in pixels) - virtual void SetPadding(const wxSize& padding) = 0; - - // set the size of the tabs for wxNB_FIXEDWIDTH controls - virtual void SetTabSize(const wxSize& sz) = 0; - - - - // implement some base class functions - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // On platforms that support it, get the theme page background colour, else invalid colour - virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } - - - // send wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING/ED events - - // returns false if the change to nPage is vetoed by the program - bool SendPageChangingEvent(int nPage); - - // sends the event about page change from old to new (or GetSelection() if - // new is -1) - void SendPageChangedEvent(int nPageOld, int nPageNew = -1); - - -protected: - DECLARE_NO_COPY_CLASS(wxNotebookBase) -}; - -// ---------------------------------------------------------------------------- -// notebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) - { - } - - wxNotebookEvent(const wxNotebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); - -#define wxNotebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func) - -#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn)) - -#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn)) - -// ---------------------------------------------------------------------------- -// wxNotebook class itself -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/notebook.h" -#elif defined(__WXMSW__) - #include "wx/msw/notebook.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/notebook.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/notebook.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/notebook.h" -#elif defined(__WXMAC__) - #include "wx/mac/notebook.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/notebook.h" -#elif defined(__WXPM__) - #include "wx/os2/notebook.h" -#endif - -#endif // wxUSE_NOTEBOOK - -#endif - // _WX_NOTEBOOK_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/numdlg.h b/Source/3rdParty/wx/include/wx/numdlg.h deleted file mode 100644 index 741bc72fa..000000000 --- a/Source/3rdParty/wx/include/wx/numdlg.h +++ /dev/null @@ -1,23 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/numdlg.h -// Purpose: wxNumberEntryDialog class -// Author: John Labenski -// Modified by: -// Created: 07.02.04 (extracted from wx/textdlg.h) -// RCS-ID: $Id: numdlg.h 37157 2006-01-26 15:33:27Z ABX $ -// Copyright: (c) John Labenski -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NUMDLGDLG_H_BASE_ -#define _WX_NUMDLGDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_NUMBERDLG - -#include "wx/generic/numdlgg.h" - -#endif // wxUSE_NUMBERDLG - -#endif // _WX_NUMDLGDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/object.h b/Source/3rdParty/wx/include/wx/object.h deleted file mode 100644 index 37b11e6ec..000000000 --- a/Source/3rdParty/wx/include/wx/object.h +++ /dev/null @@ -1,569 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/object.h -// Purpose: wxObject class, plus run-time type information macros -// Author: Julian Smart -// Modified by: Ron Lee -// Created: 01/02/97 -// RCS-ID: $Id: object.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1997 Julian Smart -// (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OBJECTH__ -#define _WX_OBJECTH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/memory.h" - -class WXDLLIMPEXP_FWD_BASE wxObject; - -#ifndef wxUSE_EXTENDED_RTTI -#define wxUSE_EXTENDED_RTTI 0 -#endif - -#if wxUSE_EXTENDED_RTTI -#include "wx/xti.h" -#else - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxClassInfo; -class WXDLLIMPEXP_FWD_BASE wxHashTable; -class WXDLLIMPEXP_FWD_BASE wxObjectRefData; - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -typedef wxObject *(*wxObjectConstructorFn)(void); - -class WXDLLIMPEXP_BASE wxClassInfo -{ -public: - wxClassInfo( const wxChar *className, - const wxClassInfo *baseInfo1, - const wxClassInfo *baseInfo2, - int size, - wxObjectConstructorFn ctor ) - : m_className(className) - , m_objectSize(size) - , m_objectConstructor(ctor) - , m_baseInfo1(baseInfo1) - , m_baseInfo2(baseInfo2) - , m_next(sm_first) - { - sm_first = this; - Register(); - } - - ~wxClassInfo(); - - wxObject *CreateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : 0; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } - - const wxChar *GetClassName() const { return m_className; } - const wxChar *GetBaseClassName1() const - { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } - const wxChar *GetBaseClassName2() const - { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } - const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } - const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } - int GetSize() const { return m_objectSize; } - - wxObjectConstructorFn GetConstructor() const - { return m_objectConstructor; } - static const wxClassInfo *GetFirst() { return sm_first; } - const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxChar *className); - - // Climb upwards through inheritance hierarchy. - // Dual inheritance is catered for. - - bool IsKindOf(const wxClassInfo *info) const - { - return info != 0 && - ( info == this || - ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) || - ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); - } - -#if WXWIN_COMPATIBILITY_2_4 - // Initializes parent pointers and hash table for fast searching. - wxDEPRECATED( static void InitializeClasses() ); - // Cleans up hash table used for fast searching. - wxDEPRECATED( static void CleanUpClasses() ); -#endif - -public: - const wxChar *m_className; - int m_objectSize; - wxObjectConstructorFn m_objectConstructor; - - // Pointers to base wxClassInfos: set in InitializeClasses - - const wxClassInfo *m_baseInfo1; - const wxClassInfo *m_baseInfo2; - - // class info object live in a linked list: - // pointers to its head and the next element in it - - static wxClassInfo *sm_first; - wxClassInfo *m_next; - - // FIXME: this should be private (currently used directly by way too - // many clients) - static wxHashTable *sm_classTable; - -private: - // InitializeClasses() helper - static wxClassInfo *GetBaseByName(const wxChar *name); - - DECLARE_NO_COPY_CLASS(wxClassInfo) - -protected: - // registers the class - void Register(); - void Unregister(); -}; - -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); - -#if WXWIN_COMPATIBILITY_2_4 -inline void wxClassInfo::InitializeClasses() {} -inline void wxClassInfo::CleanUpClasses() {} -#endif - -// ---------------------------------------------------------------------------- -// Dynamic class macros -// ---------------------------------------------------------------------------- - -#define DECLARE_ABSTRACT_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - virtual wxClassInfo *GetClassInfo() const; - -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - DECLARE_NO_ASSIGN_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - DECLARE_NO_COPY_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) \ - static wxObject* wxCreateObject(); - -#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) - - -// common part of the macros below -#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ - wxClassInfo name::ms_classInfo(wxT(#name), \ - &basename::ms_classInfo, \ - baseclsinfo2, \ - (int) sizeof(name), \ - (wxObjectConstructorFn) func); \ - \ - wxClassInfo *name::GetClassInfo() const \ - { return &name::ms_classInfo; } - -#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) - -#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) - -// ----------------------------------- -// for concrete classes -// ----------------------------------- - - // Single inheritance with one base class -#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - - // Multiple inheritance with two base classes -#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ - name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - -// ----------------------------------- -// for abstract classes -// ----------------------------------- - - // Single inheritance with one base class - -#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) - - // Multiple inheritance with two base classes - -#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) - -#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS -#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 - -#endif // !wxUSE_EXTENDED_RTTI - - -// ----------------------------------- -// for pluggable classes -// ----------------------------------- - - // NOTE: this should probably be the very first statement - // in the class declaration so wxPluginSentinel is - // the first member initialised and the last destroyed. - -// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel; - -#if wxUSE_NESTED_CLASSES - -#define _DECLARE_DL_SENTINEL(name, exportdecl) \ -class exportdecl name##PluginSentinel { \ -private: \ - static const wxString sm_className; \ -public: \ - name##PluginSentinel(); \ - ~name##PluginSentinel(); \ -}; \ -name##PluginSentinel m_pluginsentinel; - -#define _IMPLEMENT_DL_SENTINEL(name) \ - const wxString name::name##PluginSentinel::sm_className(#name); \ - name::name##PluginSentinel::name##PluginSentinel() { \ - wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ - if( e != 0 ) { e->RefObj(); } \ - } \ - name::name##PluginSentinel::~name##PluginSentinel() { \ - wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ - if( e != 0 ) { e->UnrefObj(); } \ - } -#else - -#define _DECLARE_DL_SENTINEL(name) -#define _IMPLEMENT_DL_SENTINEL(name) - -#endif // wxUSE_NESTED_CLASSES - -#define DECLARE_PLUGGABLE_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) -#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) - -#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) -#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) - -#define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) - -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) - -#define CLASSINFO(name) (&name::ms_classInfo) - -#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) - -// Just seems a bit nicer-looking (pretend it's not a macro) -#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo) - -// this cast does some more checks at compile time as it uses static_cast -// internally -// -// note that it still has different semantics from dynamic_cast<> and so can't -// be replaced by it as long as there are any compilers not supporting it -#define wxDynamicCast(obj, className) \ - ((className *) wxCheckDynamicCast( \ - wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \ - wx_const_cast(className *, wx_static_cast(const className *, obj)))), \ - &className::ms_classInfo)) - -// The 'this' pointer is always true, so use this version -// to cast the this pointer and avoid compiler warnings. -#define wxDynamicCastThis(className) \ - (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) - -#ifdef __WXDEBUG__ -inline void* wxCheckCast(void *ptr) -{ - wxASSERT_MSG( ptr, wxT("wxStaticCast() used incorrectly") ); - return ptr; -} -#define wxStaticCast(obj, className) \ - ((className *)wxCheckCast(wxDynamicCast(obj, className))) - -#else // !__WXDEBUG__ -#define wxStaticCast(obj, className) \ - wx_const_cast(className *, wx_static_cast(const className *, obj)) - -#endif // __WXDEBUG__ - -// ---------------------------------------------------------------------------- -// set up memory debugging macros -// ---------------------------------------------------------------------------- - -/* - Which new/delete operator variants do we want? - - _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) - _WX_WANT_DELETE_VOID = void operator delete (void * buf) - _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line) - _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) - _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) - _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) - _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) -*/ - -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING - -// All compilers get this one -#define _WX_WANT_NEW_SIZET_WXCHAR_INT - -// Everyone except Visage gets the next one -#ifndef __VISAGECPP__ - #define _WX_WANT_DELETE_VOID -#endif - -// Only visage gets this one under the correct circumstances -#if defined(__VISAGECPP__) && __DEBUG_ALLOC__ - #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET -#endif - -// Only VC++ 6 and CodeWarrior get overloaded delete that matches new -#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \ - (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) - #define _WX_WANT_DELETE_VOID_WXCHAR_INT -#endif - -// Now see who (if anyone) gets the array memory operators -#if wxUSE_ARRAY_MEMORY_OPERATORS - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - #endif - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_DELETE_VOID - #endif - - // Only CodeWarrior 6 or higher - #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) - #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT - #endif - -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING - -// ---------------------------------------------------------------------------- -// wxObjectRefData: ref counted data meant to be stored in wxObject -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxObjectRefData -{ - friend class WXDLLIMPEXP_FWD_BASE wxObject; - -public: - wxObjectRefData() : m_count(1) { } - virtual ~wxObjectRefData() { } - - int GetRefCount() const { return m_count; } - -private: - int m_count; -}; - -// ---------------------------------------------------------------------------- -// wxObject: the root class of wxWidgets object hierarchy -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxObject -{ - DECLARE_ABSTRACT_CLASS(wxObject) - -public: - wxObject() { m_refData = NULL; } - virtual ~wxObject() { UnRef(); } - - wxObject(const wxObject& other) - { - m_refData = other.m_refData; - if (m_refData) - m_refData->m_count++; - } - - wxObject& operator=(const wxObject& other) - { - if ( this != &other ) - { - Ref(other); - } - return *this; - } - - bool IsKindOf(wxClassInfo *info) const; - - - // Turn on the correct set of new and delete operators - -#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT - void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); -#endif - -#ifdef _WX_WANT_DELETE_VOID - void operator delete ( void * buf ); -#endif - -#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET - void operator delete ( void *buf, const char *_fname, size_t _line ); -#endif - -#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT - void operator delete ( void *buf, const wxChar*, int ); -#endif - -#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID - void operator delete[] ( void *buf ); -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT - void operator delete[] (void* buf, const wxChar*, int ); -#endif - - // ref counted data handling methods - - // get/set - wxObjectRefData *GetRefData() const { return m_refData; } - void SetRefData(wxObjectRefData *data) { m_refData = data; } - - // make a 'clone' of the object - void Ref(const wxObject& clone); - - // destroy a reference - void UnRef(); - - // Make sure this object has only one reference - void UnShare() { AllocExclusive(); } - - // check if this object references the same data as the other one - bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; } - -protected: - // ensure that our data is not shared with anybody else: if we have no - // data, it is created using CreateRefData() below, if we have shared data - // it is copied using CloneRefData(), otherwise nothing is done - void AllocExclusive(); - - // both methods must be implemented if AllocExclusive() is used, not pure - // virtual only because of the backwards compatibility reasons - - // create a new m_refData - virtual wxObjectRefData *CreateRefData() const; - - // create a new m_refData initialized with the given one - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - wxObjectRefData *m_refData; -}; - -inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) -{ - return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; -} - -#if wxUSE_EXTENDED_RTTI -class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public: - // instantiates this object with an instance of its superclass - wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; - virtual ~wxDynamicObject(); - - void SetProperty (const wxChar *propertyName, const wxxVariant &value); - wxxVariant GetProperty (const wxChar *propertyName) const ; - - // get the runtime identity of this object - wxClassInfo *GetClassInfo() const - { -#ifdef _MSC_VER - return (wxClassInfo*) m_classInfo; -#else - return wx_const_cast(wxClassInfo *, m_classInfo); -#endif - } - - wxObject* GetSuperClassInstance() const - { - return m_superClassInstance ; - } -private : - // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ) ; - - // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; - - wxObject *m_superClassInstance ; - const wxDynamicClassInfo *m_classInfo; - struct wxDynamicObjectInternal; - wxDynamicObjectInternal *m_data; -}; -#endif - -// ---------------------------------------------------------------------------- -// more debugging macros -// ---------------------------------------------------------------------------- - -// Redefine new to be the debugging version. This doesn't work with all -// compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish -// to use the debugging version. - -#ifdef __WXDEBUG__ - #define WXDEBUG_NEW new(__TFILE__,__LINE__) - - #if wxUSE_DEBUG_NEW_ALWAYS - #if wxUSE_GLOBAL_MEMORY_OPERATORS - #define new WXDEBUG_NEW - #elif defined(__VISUALC__) - // Including this file redefines new and allows leak reports to - // contain line numbers - #include "wx/msw/msvcrt.h" - #endif - #endif // wxUSE_DEBUG_NEW_ALWAYS -#else // !__WXDEBUG__ - #define WXDEBUG_NEW new -#endif // __WXDEBUG__/!__WXDEBUG__ - -#endif // _WX_OBJECTH__ diff --git a/Source/3rdParty/wx/include/wx/overlay.h b/Source/3rdParty/wx/include/wx/overlay.h deleted file mode 100644 index d0d2a11aa..000000000 --- a/Source/3rdParty/wx/include/wx/overlay.h +++ /dev/null @@ -1,97 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/overlay.h -// Purpose: wxOverlay class -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OVERLAY_H_ -#define _WX_OVERLAY_H_ - -#include "wx/defs.h" - -#if defined(wxMAC_USE_CORE_GRAPHICS) && wxMAC_USE_CORE_GRAPHICS - #define wxHAS_NATIVE_OVERLAY 1 -#elif defined(__WXDFB__) - #define wxHAS_NATIVE_OVERLAY 1 -#else - // don't define wxHAS_NATIVE_OVERLAY -#endif - -// ---------------------------------------------------------------------------- -// creates an overlay over an existing window, allowing for manipulations like -// rubberbanding etc. This API is not stable yet, not to be used outside wx -// internal code -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; -class WXDLLIMPEXP_FWD_CORE wxWindowDC; - -class WXDLLEXPORT wxOverlay -{ -public: - wxOverlay(); - ~wxOverlay(); - - // clears the overlay without restoring the former state - // to be done eg when the window content has been changed and repainted - void Reset(); - - // returns (port-specific) implementation of the overlay - wxOverlayImpl *GetImpl() { return m_impl; } - -private: - friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; - - // returns true if it has been setup - bool IsOk(); - - void Init(wxWindowDC* dc, int x , int y , int width , int height); - - void BeginDrawing(wxWindowDC* dc); - - void EndDrawing(wxWindowDC* dc); - - void Clear(wxWindowDC* dc); - - wxOverlayImpl* m_impl; - - bool m_inDrawing; - - - DECLARE_NO_COPY_CLASS(wxOverlay) -}; - - -class WXDLLEXPORT wxDCOverlay -{ -public: - // connects this overlay to the corresponding drawing dc, if the overlay is - // not initialized yet this call will do so - wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc, int x , int y , int width , int height); - - // convenience wrapper that behaves the same using the entire area of the dc - wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc); - - // removes the connection between the overlay and the dc - virtual ~wxDCOverlay(); - - // clears the layer, restoring the state at the last init - void Clear(); - -private: - void Init(wxWindowDC *dc, int x , int y , int width , int height); - - wxOverlay& m_overlay; - - wxWindowDC* m_dc; - - - DECLARE_NO_COPY_CLASS(wxDCOverlay) -}; - -#endif // _WX_OVERLAY_H_ diff --git a/Source/3rdParty/wx/include/wx/ownerdrw.h b/Source/3rdParty/wx/include/wx/ownerdrw.h deleted file mode 100644 index fe673cec8..000000000 --- a/Source/3rdParty/wx/include/wx/ownerdrw.h +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ownerdrw.h -// Purpose: interface for owner-drawn GUI elements -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.11.97 -// RCS-ID: $Id: ownerdrw.h 62511 2009-10-30 14:11:03Z JMS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _OWNERDRW_H -#define _OWNERDRW_H - -#include "wx/defs.h" - -#if wxUSE_OWNER_DRAWN - -#include "wx/bitmap.h" -#include "wx/colour.h" -#include "wx/font.h" - -// ---------------------------------------------------------------------------- -// wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn -// behaviour -// -// wxOwnerDrawn supports drawing of an item with non standard font, color and -// also supports 3 bitmaps: either a checked/unchecked bitmap for a checkable -// element or one unchangeable bitmap otherwise. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxOwnerDrawn -{ -public: - // ctor & dtor - wxOwnerDrawn(const wxString& str = wxEmptyString, - bool bCheckable = false, - bool bMenuItem = false); // FIXME kludge for colors - virtual ~wxOwnerDrawn(); - - // fix appearance - void SetFont(const wxFont& font) - { m_font = font; m_bOwnerDrawn = true; } - - wxFont& GetFont() const { return (wxFont &)m_font; } - - void SetTextColour(const wxColour& colText) - { m_colText = colText; m_bOwnerDrawn = true; } - - wxColour& GetTextColour() const { return (wxColour&) m_colText; } - - void SetBackgroundColour(const wxColour& colBack) - { m_colBack = colBack; m_bOwnerDrawn = true; } - - wxColour& GetBackgroundColour() const - { return (wxColour&) m_colBack ; } - - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap) - { m_bmpChecked = bmpChecked; - m_bmpUnchecked = bmpUnchecked; - m_bOwnerDrawn = true; } - - void SetBitmap(const wxBitmap& bmpChecked) - { m_bmpChecked = bmpChecked; - m_bOwnerDrawn = true; } - - void SetDisabledBitmap( const wxBitmap& bmpDisabled ) - { m_bmpDisabled = bmpDisabled; - m_bOwnerDrawn = true; } - - const wxBitmap& GetBitmap(bool bChecked = true) const - { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } - - const wxBitmap& GetDisabledBitmap() const - { return m_bmpDisabled; } - - // the height of the menu checkmark (or bitmap) is determined by the font - // for the current item, but the width should be always the same (for the - // items to be aligned), so by default it's taken to be the same as for - // the last item (and default width for the first one). - // - // NB: default is too small for bitmaps, but ok for checkmarks. - void SetMarginWidth(int nWidth) - { - ms_nLastMarginWidth = m_nMarginWidth = (size_t) nWidth; - if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) - m_bOwnerDrawn = true; - } - - int GetMarginWidth() const { return (int) m_nMarginWidth; } - static int GetDefaultMarginWidth() { return (int) ms_nDefaultMarginWidth; } - - // accessors - void SetName(const wxString& strName) { m_strName = strName; } - const wxString& GetName() const { return m_strName; } - void SetCheckable(bool checkable) { m_bCheckable = checkable; } - bool IsCheckable() const { return m_bCheckable; } - - // this is for menu items only: accel string is drawn right aligned after the - // menu item if not empty - void SetAccelString(const wxString& strAccel) { m_strAccel = strAccel; } - - // this function might seem strange, but if it returns false it means that - // no non-standard attribute are set, so there is no need for this control - // to be owner-drawn. Moreover, you can force owner-drawn to false if you - // want to change, say, the color for the item but only if it is owner-drawn - // (see wxMenuItem::wxMenuItem for example) - bool IsOwnerDrawn() const { return m_bOwnerDrawn; } - - // switch on/off owner-drawing the item - void SetOwnerDrawn(bool ownerDrawn = true) { m_bOwnerDrawn = ownerDrawn; } - void ResetOwnerDrawn() { m_bOwnerDrawn = false; } - -public: - // constants used in OnDrawItem - // (they have the same values as corresponding Win32 constants) - enum wxODAction - { - wxODDrawAll = 0x0001, // redraw entire control - wxODSelectChanged = 0x0002, // selection changed (see Status.Select) - wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) - }; - - enum wxODStatus - { - wxODSelected = 0x0001, // control is currently selected - wxODGrayed = 0x0002, // item is to be grayed - wxODDisabled = 0x0004, // item is to be drawn as disabled - wxODChecked = 0x0008, // item is to be checked - wxODHasFocus = 0x0010, // item has the keyboard focus - wxODDefault = 0x0020, // item is the default item - wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) - }; - - // virtual functions to implement drawing (return true if processed) - virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); - -protected: - // return true if this is a menu item - bool IsMenuItem() const; - - // get the font to use, whether m_font is set or not - wxFont GetFontToUse() const; - - // Same as wxOwnerDrawn::SetMarginWidth() but does not affect - // ms_nLastMarginWidth. Exists solely to work around bug #4068, - // and will not exist in wxWidgets 2.9.0 and later. - void SetOwnMarginWidth(int nWidth) - { - m_nMarginWidth = (size_t) nWidth; - if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) - m_bOwnerDrawn = true; - } - - - wxString m_strName, // label for a manu item - m_strAccel; // the accel string ("Ctrl-F17") if any - -private: - static size_t ms_nDefaultMarginWidth; // menu check mark width - static size_t ms_nLastMarginWidth; // handy for aligning all items - - bool m_bCheckable, // used only for menu or check listbox items - m_bOwnerDrawn, // true if something is non standard - m_isMenuItem; // true if this is a menu item - - wxFont m_font; // font to use for drawing - wxColour m_colText, // color ----"---"---"---- - m_colBack; // background color - wxBitmap m_bmpChecked, // bitmap to put near the item - m_bmpUnchecked, // (checked is used also for 'uncheckable' items) - m_bmpDisabled; - - size_t m_nHeight, // font height - m_nMinHeight, // minimum height, as determined by user's system settings - m_nMarginWidth; // space occupied by bitmap to the left of the item -}; - -#endif // wxUSE_OWNER_DRAWN - -#endif - // _OWNERDRW_H diff --git a/Source/3rdParty/wx/include/wx/palette.h b/Source/3rdParty/wx/include/wx/palette.h deleted file mode 100644 index 3b2e3cb78..000000000 --- a/Source/3rdParty/wx/include/wx/palette.h +++ /dev/null @@ -1,59 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/palette.h -// Purpose: Common header and base class for wxPalette -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: palette.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PALETTE_H_BASE_ -#define _WX_PALETTE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PALETTE - -#include "wx/object.h" -#include "wx/gdiobj.h" - -// wxPaletteBase -class WXDLLEXPORT wxPaletteBase: public wxGDIObject -{ -public: - virtual ~wxPaletteBase() { } - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; } -}; - -#if defined(__WXPALMOS__) - #include "wx/palmos/palette.h" -#elif defined(__WXMSW__) - #include "wx/msw/palette.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/palette.h" -#elif defined(__WXGTK__) || defined(__WXCOCOA__) - #include "wx/generic/paletteg.h" -#elif defined(__WXX11__) - #include "wx/x11/palette.h" -#elif defined(__WXMGL__) - #include "wx/mgl/palette.h" -#elif defined(__WXMAC__) - #include "wx/mac/palette.h" -#elif defined(__WXPM__) - #include "wx/os2/palette.h" -#endif - -#if WXWIN_COMPATIBILITY_2_4 - #define wxColorMap wxPalette - #define wxColourMap wxPalette -#endif - -#endif // wxUSE_PALETTE - -#endif - // _WX_PALETTE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/panel.h b/Source/3rdParty/wx/include/wx/panel.h deleted file mode 100644 index 260e2b972..000000000 --- a/Source/3rdParty/wx/include/wx/panel.h +++ /dev/null @@ -1,18 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/panel.h -// Purpose: Base header for wxPanel -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: panel.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PANEL_H_BASE_ -#define _WX_PANEL_H_BASE_ - -#include "wx/generic/panelg.h" - -#endif - // _WX_PANELH_BASE_ diff --git a/Source/3rdParty/wx/include/wx/paper.h b/Source/3rdParty/wx/include/wx/paper.h deleted file mode 100644 index fe69bd471..000000000 --- a/Source/3rdParty/wx/include/wx/paper.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: paper.h -// Purpose: Paper database types and classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: paper.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PAPERH__ -#define _WX_PAPERH__ - -#include "wx/defs.h" -#include "wx/event.h" -#include "wx/cmndata.h" -#include "wx/intl.h" -#include "wx/hashmap.h" - -/* - * Paper type: see defs.h for wxPaperSize enum. - * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE, - * so you can add further paper types without needing new ids. - */ - -#ifdef __WXMSW__ -#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h) -#else -#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h) -#endif - -class WXDLLEXPORT wxPrintPaperType: public wxObject -{ -public: - wxPrintPaperType(); - - // platformId is a platform-specific id, such as in Windows, DMPAPER_... - wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); - - inline wxString GetName() const { return wxGetTranslation(m_paperName); } - inline wxPaperSize GetId() const { return m_paperId; } - inline int GetPlatformId() const { return m_platformId; } - - // Get width and height in tenths of a millimetre - inline int GetWidth() const { return m_width; } - inline int GetHeight() const { return m_height; } - - // Get size in tenths of a millimetre - inline wxSize GetSize() const { return wxSize(m_width, m_height); } - - // Get size in a millimetres - inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); } - - // Get width and height in device units (1/72th of an inch) - wxSize GetSizeDeviceUnits() const ; - -public: - wxPaperSize m_paperId; - int m_platformId; - int m_width; // In tenths of a millimetre - int m_height; // In tenths of a millimetre - wxString m_paperName; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintPaperType) -}; - -WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); - -class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList; - -class WXDLLEXPORT wxPrintPaperDatabase -{ -public: - wxPrintPaperDatabase(); - ~wxPrintPaperDatabase(); - - void CreateDatabase(); - void ClearDatabase(); - - void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h); - void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); - - // Find by name - wxPrintPaperType *FindPaperType(const wxString& name); - - // Find by size id - wxPrintPaperType *FindPaperType(wxPaperSize id); - - // Find by platform id - wxPrintPaperType *FindPaperTypeByPlatformId(int id); - - // Find by size - wxPrintPaperType *FindPaperType(const wxSize& size); - - // Convert name to size id - wxPaperSize ConvertNameToId(const wxString& name); - - // Convert size id to name - wxString ConvertIdToName(wxPaperSize paperId); - - // Get the paper size - wxSize GetSize(wxPaperSize paperId); - - // Get the paper size - wxPaperSize GetSize(const wxSize& size); - - // - wxPrintPaperType* Item(size_t index) const; - size_t GetCount() const; -private: - wxStringToPrintPaperTypeHashMap* m_map; - wxPrintPaperTypeList* m_list; - // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) -}; - -extern WXDLLEXPORT_DATA(wxPrintPaperDatabase*) wxThePrintPaperDatabase; - - -#endif - // _WX_PAPERH__ diff --git a/Source/3rdParty/wx/include/wx/pen.h b/Source/3rdParty/wx/include/wx/pen.h deleted file mode 100644 index cd28212f5..000000000 --- a/Source/3rdParty/wx/include/wx/pen.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/pen.h -// Purpose: Base header for wxPen -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: pen.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PEN_H_BASE_ -#define _WX_PEN_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/pen.h" -#elif defined(__WXMSW__) -#include "wx/msw/pen.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) -#include "wx/x11/pen.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/pen.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/pen.h" -#elif defined(__WXMGL__) -#include "wx/mgl/pen.h" -#elif defined(__WXDFB__) -#include "wx/dfb/pen.h" -#elif defined(__WXMAC__) -#include "wx/mac/pen.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/pen.h" -#elif defined(__WXPM__) -#include "wx/os2/pen.h" -#endif - -#endif - // _WX_PEN_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/pickerbase.h b/Source/3rdParty/wx/include/wx/pickerbase.h deleted file mode 100644 index da79f2dea..000000000 --- a/Source/3rdParty/wx/include/wx/pickerbase.h +++ /dev/null @@ -1,189 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/pickerbase.h -// Purpose: wxPickerBase definition -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: pickerbase.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PICKERBASE_H_BASE_ -#define _WX_PICKERBASE_H_BASE_ - -#include "wx/control.h" -#include "wx/sizer.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxToolTip; - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxPickerBase is the base class for the picker controls which support -// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary -// text control next to the 'real' picker. -// -// The wxTextPickerHelper class manages enabled/disabled state of the text control, -// its sizing and positioning. -// ---------------------------------------------------------------------------- - -#define wxPB_USE_TEXTCTRL 0x0002 - -class WXDLLIMPEXP_CORE wxPickerBase : public wxControl -{ -public: - // ctor: text is the associated text control - wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) - { m_container.SetContainerWindow(this); } - virtual ~wxPickerBase() {} - - - // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control - // The 3rd argument is the initial wxString to display in the text control - bool CreateBase(wxWindow *parent, - wxWindowID id, - const wxString& text = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - -public: // public API - - // margin between the text control and the picker - void SetInternalMargin(int newmargin) - { GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); } - int GetInternalMargin() const - { return GetTextCtrlItem()->GetBorder(); } - - // proportion of the text control - void SetTextCtrlProportion(int prop) - { GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); } - int GetTextCtrlProportion() const - { return GetTextCtrlItem()->GetProportion(); } - - // proportion of the picker control - void SetPickerCtrlProportion(int prop) - { GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); } - int GetPickerCtrlProportion() const - { return GetPickerCtrlItem()->GetProportion(); } - - bool IsTextCtrlGrowable() const - { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; } - void SetTextCtrlGrowable(bool grow = true) - { - int f = GetDefaultTextCtrlFlag(); - if ( grow ) - f |= wxGROW; - else - f &= ~wxGROW; - - GetTextCtrlItem()->SetFlag(f); - } - - bool IsPickerCtrlGrowable() const - { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; } - void SetPickerCtrlGrowable(bool grow = true) - { - int f = GetDefaultPickerCtrlFlag(); - if ( grow ) - f |= wxGROW; - else - f &= ~wxGROW; - - GetPickerCtrlItem()->SetFlag(f); - } - - bool HasTextCtrl() const - { return m_text != NULL; } - wxTextCtrl *GetTextCtrl() - { return m_text; } - wxControl *GetPickerCtrl() - { return m_picker; } - - // methods that derived class must/may override - virtual void UpdatePickerFromTextCtrl() = 0; - virtual void UpdateTextCtrlFromPicker() = 0; - -protected: - // overridden base class methods -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif // wxUSE_TOOLTIPS - - - // event handlers - void OnTextCtrlDelete(wxWindowDestroyEvent &); - void OnTextCtrlUpdate(wxCommandEvent &); - void OnTextCtrlKillFocus(wxFocusEvent &); - - void OnSize(wxSizeEvent &); - - // returns the set of styles for the attached wxTextCtrl - // from given wxPickerBase's styles - virtual long GetTextCtrlStyle(long style) const - { return (style & wxWINDOW_STYLE_MASK); } - - // returns the set of styles for the m_picker - virtual long GetPickerStyle(long style) const - { return (style & wxWINDOW_STYLE_MASK); } - - - wxSizerItem *GetPickerCtrlItem() const - { - if (this->HasTextCtrl()) - return m_sizer->GetItem((size_t)1); - return m_sizer->GetItem((size_t)0); - } - - wxSizerItem *GetTextCtrlItem() const - { - wxASSERT(this->HasTextCtrl()); - return m_sizer->GetItem((size_t)0); - } - - int GetDefaultPickerCtrlFlag() const - { - // on macintosh, without additional borders - // there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL|wxGROW -#ifdef __WXMAC__ - | wxTOP | wxRIGHT | wxBOTTOM -#endif - ; - } - - int GetDefaultTextCtrlFlag() const - { - // on macintosh, without wxALL there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL -#ifdef __WXMAC__ - | wxALL -#else - | wxRIGHT -#endif - ; - } - - void PostCreation(); - -protected: - wxTextCtrl *m_text; // can be NULL - wxControl *m_picker; - wxBoxSizer *m_sizer; - -private: - DECLARE_ABSTRACT_CLASS(wxPickerBase) - DECLARE_EVENT_TABLE() - - // This class must be something just like a panel... - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -#endif - // _WX_PICKERBASE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/platform.h b/Source/3rdParty/wx/include/wx/platform.h deleted file mode 100644 index 471e28eba..000000000 --- a/Source/3rdParty/wx/include/wx/platform.h +++ /dev/null @@ -1,664 +0,0 @@ -/** -* Name: wx/platform.h -* Purpose: define the OS and compiler identification macros -* Author: Vadim Zeitlin -* Modified by: -* Created: 29.10.01 (extracted from wx/defs.h) -* RCS-ID: $Id: platform.h 63300 2010-01-28 21:36:09Z MW $ -* Copyright: (c) 1997-2001 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_PLATFORM_H_ -#define _WX_PLATFORM_H_ - - -/* - Codewarrior doesn't define any Windows symbols until some headers - are included -*/ -#ifdef __MWERKS__ -# include -#endif - -/* - WXMAC variants - __WXMAC_CLASSIC__ means ppc non-carbon builds, __WXMAC_CARBON__ means - carbon API available (mach or cfm builds) , __WXMAC_OSX__ means mach-o - builds, running under 10.2 + only -*/ -#ifdef __WXMAC__ -# if defined(__MACH__) -# define __WXMAC_OSX__ -# define __WXMAC_CARBON__ -# include -# ifndef MAC_OS_X_VERSION_10_4 -# define MAC_OS_X_VERSION_10_4 1040 -# endif -# ifndef MAC_OS_X_VERSION_10_5 -# define MAC_OS_X_VERSION_10_5 1050 -# endif -# ifdef __WXMAC_XCODE__ -# include -# include "wx/mac/carbon/config_xcode.h" -# endif -# else -# if TARGET_CARBON -# define __WXMAC_CARBON__ -# else -# define __WXMAC_CLASSIC__ -# endif -# endif -#endif - -/* - __WXOSX__ is a common define to wxMac (Carbon) and wxCocoa ports under OS X. - */ -#if defined(__WXMAC_OSX__) || defined(__WXCOCOA__) -# define __WXOSX__ -#endif - -/* - first define Windows symbols if they're not defined on the command line: we - can autodetect everything we need if _WIN32 is defined - */ -#if defined(__CYGWIN__) && defined(__WINDOWS__) -# ifndef __WXMSW__ -# define __WXMSW__ -# endif - -# ifndef _WIN32 -# define _WIN32 -# endif - -# ifndef WIN32 -# define WIN32 -# endif -#endif - -#if defined(__PALMOS__) -# if __PALMOS__ == 0x06000000 -# define __WXPALMOS6__ -# endif -# if __PALMOS__ == 0x05000000 -# define __WXPALMOS5__ -# endif -# ifndef __WXPALMOS__ -# define __WXPALMOS__ -# endif -# ifdef __WXMSW__ -# undef __WXMSW__ -# endif -# ifdef __WINDOWS__ -# undef __WINDOWS__ -# endif -# ifdef __WIN32__ -# undef __WIN32__ -# endif -# ifdef WIN32 -# undef WIN32 -# endif -# ifdef _WIN32 -# undef _WIN32 -# endif -#endif - -#if defined(_WIN64) -# ifndef _WIN32 - /* - a lot of code (mistakenly) uses #ifdef _WIN32 to either test for - Windows or to test for !__WIN16__, so we must define _WIN32 for - Win64 as well to ensure that the existing code continues to work. - */ -# define _WIN32 -# endif /* !_WIN32 */ - -# ifndef __WIN64__ -# define __WIN64__ -# endif /* !__WIN64__ */ -#endif /* _WIN64 */ - -#if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \ - && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) -# ifndef __WXMSW__ -# define __WXMSW__ -# endif - -# ifndef __WIN32__ -# define __WIN32__ -# endif -#endif /* Win32 */ - -#if defined(__WXMSW__) || defined(__WIN32__) -# if !defined(__WINDOWS__) -# define __WINDOWS__ -# endif -#endif - -/* detect MS SmartPhone */ -#if defined( WIN32_PLATFORM_WFSP ) -# ifndef __SMARTPHONE__ -# define __SMARTPHONE__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect PocketPC */ -#if defined( WIN32_PLATFORM_PSPC ) -# ifndef __POCKETPC__ -# define __POCKETPC__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect Standard WinCE SDK */ -#if defined( WCE_PLATFORM_STANDARDSDK ) -# ifndef __WINCE_STANDARDSDK__ -# define __WINCE_STANDARDSDK__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) -# if (_WIN32_WCE >= 400) -# ifndef __WINCE_NET__ -# define __WINCE_NET__ -# endif -# elif (_WIN32_WCE >= 200) -# ifndef __HANDHELDPC__ -# define __HANDHELDPC__ -# endif -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__) -# define __WXHANDHELD__ -#endif - -/* - Include wx/setup.h for the Unix platform defines generated by configure and - the library compilation options - - Note that it must be included before defining hardware symbols below as they - could be already defined by configure - */ -#include "wx/setup.h" - -/* - Hardware platform detection. - - VC++ defines _M_xxx symbols. - */ -#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__) - #ifndef __INTEL__ - #define __INTEL__ - #endif -#endif /* x86 */ - -#if defined(_M_IA64) - #ifndef __IA64__ - #define __IA64__ - #endif -#endif /* ia64 */ - -#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__) - #ifndef __POWERPC__ - #define __POWERPC__ - #endif -#endif /* alpha */ - -#if defined(_M_ALPHA) || defined(__AXP__) - #ifndef __ALPHA__ - #define __ALPHA__ - #endif -#endif /* alpha */ - - -/* - adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1 - and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by - the system headers so bring these settings in sync - */ - -/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */ -#if defined(_UNICODE) || defined(UNICODE) -# undef wxUSE_UNICODE -# define wxUSE_UNICODE 1 -#else /* !UNICODE */ -# ifndef wxUSE_UNICODE -# define wxUSE_UNICODE 0 -# endif -#endif /* UNICODE/!UNICODE */ - -/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */ -#if wxUSE_UNICODE -# ifndef _UNICODE -# define _UNICODE -# endif -# ifndef UNICODE -# define UNICODE -# endif -#endif /* wxUSE_UNICODE */ - -#if defined( __MWERKS__ ) && !defined(__INTEL__) -/* otherwise MSL headers bring in WIN32 dependant APIs */ -#undef UNICODE -#endif - -/* - Notice that Turbo Explorer (BCC 5.82) is available for free at - http://www.turboexplorer.com/downloads, you can get it if you have trouble - compiling wxWidgets with your current Borland compiler. -*/ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x540) -# error "wxWidgets requires a newer version of Borland, we recommend upgrading to 5.82 (Turbo Explorer). You may at your own risk remove this line and try building but be prepared to get build errors." -#endif /* __BORLANDC__ */ - -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x582) && (__BORLANDC__ > 0x559) -# ifndef _USE_OLD_RW_STL -# error "wxWidgets is incompatible with default Borland C++ 5.6 STL library, please add -D_USE_OLD_RW_STL to your bcc32.cfg to use RogueWave STL implementation." -# endif -#endif /* __BORLANDC__ */ - -/* - This macro can be used to test the Open Watcom version. -*/ -#ifndef __WATCOMC__ -# define wxWATCOM_VERSION(major,minor) 0 -# define wxCHECK_WATCOM_VERSION(major,minor) 0 -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0 -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# error "Only Open Watcom is supported in this release" -#else -# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 ) -# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) ) -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) -#endif - -/* - check the consistency of the settings in setup.h: note that this must be - done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h - */ -#include "wx/chkconf.h" - - -/* - some compilers don't support iostream.h any longer, while some of theme - are not updated with yet, so override the users setting here - in such case. - */ -#if defined(_MSC_VER) && (_MSC_VER >= 1310) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#elif defined(__DMC__) || defined(__WATCOMC__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 1 -#elif defined(__MINGW32__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#endif /* compilers with/without iostream.h */ - -/* - old C++ headers (like ) declare classes in the global namespace - while the new, standard ones (like ) do it in std:: namespace, - unless it's an old gcc version. - - using this macro allows constuctions like "wxSTD iostream" to work in - either case - */ -#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -# define wxSTD std:: -#else -# define wxSTD -#endif - -/* - OS: first of all, test for MS-DOS platform. We must do this before testing - for Unix, because DJGPP compiler defines __unix__ under MS-DOS - */ -#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__) -# ifndef __DOS__ -# define __DOS__ -# endif - /* size_t is the same as unsigned int for Watcom 11 compiler, */ - /* so define it if it hadn't been done by configure yet */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# ifdef __WATCOMC__ -# define wxSIZE_T_IS_UINT -# endif -# ifdef __DJGPP__ -# define wxSIZE_T_IS_ULONG -# endif -# endif - -/* - OS: then test for generic Unix defines, then for particular flavours and - finally for Unix-like systems - Mac OS X matches this case (__MACH__), prior Mac OS do not. - */ -#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ - defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ - defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ - defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__) - -# define __UNIX_LIKE__ - - /* Helps SGI compilation, apparently */ -# ifdef __SGI__ -# ifdef __GNUG__ -# define __need_wchar_t -# else /* !gcc */ - /* - Note I use the term __SGI_CC__ for both cc and CC, its not a good - idea to mix gcc and cc/CC, the name mangling is different - */ -# define __SGI_CC__ -# endif /* gcc/!gcc */ - - /* system headers use this symbol and not __cplusplus in some places */ -# ifndef _LANGUAGE_C_PLUS_PLUS -# define _LANGUAGE_C_PLUS_PLUS -# endif -# endif /* SGI */ - -# if defined(sun) || defined(__SUN__) -# ifndef __GNUG__ -# ifndef __SUNCC__ -# define __SUNCC__ -# endif /* Sun CC */ -# endif -# endif /* Sun */ - -# ifdef __EMX__ -# define OS2EMX_PLAIN_CHAR -# endif - - /* define __HPUX__ for HP-UX where standard macro is __hpux */ -# if defined(__hpux) && !defined(__HPUX__) -# define __HPUX__ -# endif /* HP-UX */ - -# if defined(__CYGWIN__) || defined(__WINE__) -# if !defined(wxSIZE_T_IS_UINT) -# define wxSIZE_T_IS_UINT -# endif -# endif - - /* All of these should already be defined by including configure- - generated setup.h but we wish to support Xcode compilation without - requiring the user to define these himself. - */ -# if defined(__APPLE__) && defined(__MACH__) -# ifndef __UNIX__ -# define __UNIX__ 1 -# endif -# ifndef __BSD__ -# define __BSD__ 1 -# endif - /* __DARWIN__ is our own define to mean OS X or pure Darwin */ -# ifndef __DARWIN__ -# define __DARWIN__ 1 -# endif - /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */ -# ifndef TARGET_CARBON -# define TARGET_CARBON 1 -# endif - /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# define wxSIZE_T_IS_ULONG -# endif -# endif - -/* - OS: Classic Mac OS - */ -#elif defined(applec) || \ - defined(THINK_C) || \ - (defined(__MWERKS__) && !defined(__INTEL__)) - /* MacOS */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# define wxSIZE_T_IS_ULONG -# endif - -/* - OS: OS/2 - */ -#elif defined(__OS2__) - - /* wxOS2 vs. non wxOS2 ports on OS2 platform */ -# if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) -# ifndef __WXPM__ -# define __WXPM__ -# endif -# endif - -# if defined(__IBMCPP__) -# define __VISAGEAVER__ __IBMCPP__ -# endif - - /* Place other OS/2 compiler environment defines here */ -# if defined(__VISAGECPP__) - /* VisualAge is the only thing that understands _Optlink */ -# define LINKAGEMODE _Optlink -# endif -# define wxSIZE_T_IS_UINT - -/* - OS: Palm OS - */ -#elif defined(__PALMOS__) -# ifdef __WIN32__ -# error "__WIN32__ should not be defined for PalmOS" -# endif -# ifdef __WINDOWS__ -# error "__WINDOWS__ should not be defined for PalmOS" -# endif -# ifdef __WXMSW__ -# error "__WXMSW__ should not be defined for PalmOS" -# endif - -/* - OS: Otherwise it must be Windows - */ -#else /* Windows */ -# ifndef __WINDOWS__ -# define __WINDOWS__ -# endif /* Windows */ - - /* to be changed for Win64! */ -# ifndef __WIN32__ -# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported" -# endif - - /* - define another standard symbol for Microsoft Visual C++: the standard - one (_MSC_VER) is also defined by Metrowerks compiler - */ -# if defined(_MSC_VER) && !defined(__MWERKS__) -# define __VISUALC__ _MSC_VER -# elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) -# define __BORLANDC__ -# elif defined(__WATCOMC__) -# elif defined(__SC__) -# define __SYMANTECC__ -# endif /* compiler */ - - /* size_t is the same as unsigned int for all Windows compilers we know, */ - /* so define it if it hadn't been done by configure yet */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__) -# define wxSIZE_T_IS_UINT -# endif -#endif /* OS */ - -/* - if we're on a Unix system but didn't use configure (so that setup.h didn't - define __UNIX__), do define __UNIX__ now - */ -#if !defined(__UNIX__) && defined(__UNIX_LIKE__) -# define __UNIX__ -#endif /* Unix */ - -#if defined(__WXMOTIF__) || defined(__WXX11__) -# define __X__ -#endif - -#ifdef __SC__ -# ifdef __DMC__ -# define __DIGITALMARS__ -# else -# define __SYMANTEC__ -# endif -#endif - -#ifdef __INTEL_COMPILER -# define __INTELC__ -#endif - -/* - We get "Large Files (ILP32) not supported in strict ANSI mode." #error - from HP-UX standard headers when compiling with g++ without this: - */ -#if defined(__HPUX__) && !defined(__STDC_EXT__) -# define __STDC_EXT__ 1 -#endif - -/* Force linking against required libraries under Windows: */ -#ifdef __WXWINCE__ -# include "wx/msw/wince/libraries.h" -#elif defined __WINDOWS__ -# include "wx/msw/libraries.h" -#endif - -/* - This macro can be used to test the gcc version and can be used like this: - -# if wxCHECK_GCC_VERSION(3, 1) - ... we have gcc 3.1 or later ... -# else - ... no gcc at all or gcc < 3.1 ... -# endif -*/ -#if defined(__GNUC__) && defined(__GNUC_MINOR__) - #define wxCHECK_GCC_VERSION( major, minor ) \ - ( ( __GNUC__ > (major) ) \ - || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) -#else - #define wxCHECK_GCC_VERSION( major, minor ) 0 -#endif - -#if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3) -#define wxNEEDS_CHARPP -#endif - -/* - This macro can be used to check that the version of mingw32 compiler is - at least maj.min - */ -#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ - ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \ - wxCHECK_WATCOM_VERSION(1,0) ) && \ - !defined(__DOS__) && \ - !defined(__WXPM__) && \ - !defined(__WXMOTIF__) && \ - !defined(__WXGTK__) && \ - !defined(__WXX11__) && \ - !defined(__WXPALMOS__) -# include "wx/msw/gccpriv.h" -#else -# undef wxCHECK_W32API_VERSION -# define wxCHECK_W32API_VERSION(maj, min) (0) -# undef wxCHECK_MINGW32_VERSION -# define wxCHECK_MINGW32_VERSION(maj, min) (0) -#endif - -#if defined (__WXMSW__) -# if !wxONLY_WATCOM_EARLIER_THAN(1, 8) -# define wxHAVE_RAW_BITMAP -# endif -#endif -#if defined(__WXGTK20__) || defined(__WXMAC__) -# define wxHAVE_RAW_BITMAP -#endif - -/* - Handle Darwin gcc universal compilation. Don't do this in an Apple- - specific case since no sane compiler should be defining either - __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating - code that will be hosted on a machine with the appropriate endianness. - If a compiler defines neither, assume the user or configure set - WORDS_BIGENDIAN appropriately. - */ -#if defined(__BIG_ENDIAN__) -# undef WORDS_BIGENDIAN -# define WORDS_BIGENDIAN 1 -#elif defined(__LITTLE_ENDIAN__) -# undef WORDS_BIGENDIAN -#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN) -/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */ -# warning "Compiling wxMac with probably wrong endianness" -#endif - -#ifdef __VMS -#define XtDisplay XTDISPLAY -#ifdef __WXMOTIF__ -#define XtParent XTPARENT -#define XtScreen XTSCREEN -#define XtWindow XTWINDOW -#endif -#endif - -/* Choose which method we will use for updating menus - * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. - * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. - */ -#ifndef wxUSE_IDLEMENUUPDATES -# if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__) -# define wxUSE_IDLEMENUUPDATES 0 -# else -# define wxUSE_IDLEMENUUPDATES 1 -# endif -#endif - -/* - * Define symbols that are not yet in - * configure or possibly some setup.h files. - * They will need to be added. - */ - -#ifndef wxUSE_FILECONFIG -# if wxUSE_CONFIG -# define wxUSE_FILECONFIG 1 -# else -# define wxUSE_FILECONFIG 0 -# endif -#endif - -#ifndef wxUSE_HOTKEY -# define wxUSE_HOTKEY 0 -#endif - -#if !defined(wxUSE_WXDIB) && defined(__WXMSW__) -# define wxUSE_WXDIB 1 -#endif - -/* - We need AvailabilityMacros.h for ifdefing out things that don't exist on - OSX 10.2 and lower - FIXME: We need a better way to detect for 10.3 then including a system header -*/ -#ifdef __DARWIN__ - #include -#endif - -#endif /* _WX_PLATFORM_H_ */ diff --git a/Source/3rdParty/wx/include/wx/platinfo.h b/Source/3rdParty/wx/include/wx/platinfo.h deleted file mode 100644 index d9382dd2e..000000000 --- a/Source/3rdParty/wx/include/wx/platinfo.h +++ /dev/null @@ -1,313 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/platinfo.h -// Purpose: declaration of the wxPlatformInfo class -// Author: Francesco Montorsi -// Modified by: -// Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id: platinfo.h 41807 2006-10-09 15:58:56Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PLATINFO_H_ -#define _WX_PLATINFO_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxPlatformInfo -// ---------------------------------------------------------------------------- - -// VERY IMPORTANT: when changing these enum values, also change the relative -// string tables in src/common/platinfo.cpp - - -// families & sub-families of operating systems -enum wxOperatingSystemId -{ - wxOS_UNKNOWN = 0, // returned on error - - wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths - wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths - wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN, - - wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME) - wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP) - wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows - wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile) - wxOS_WINDOWS = wxOS_WINDOWS_9X | - wxOS_WINDOWS_NT | - wxOS_WINDOWS_MICRO | - wxOS_WINDOWS_CE, - - wxOS_UNIX_LINUX = 1 << 6, // Linux - wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD - wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD - wxOS_UNIX_NETBSD = 1 << 9, // NetBSD - wxOS_UNIX_SOLARIS = 1 << 10, // SunOS - wxOS_UNIX_AIX = 1 << 11, // AIX - wxOS_UNIX_HPUX = 1 << 12, // HP/UX - wxOS_UNIX = wxOS_UNIX_LINUX | - wxOS_UNIX_FREEBSD | - wxOS_UNIX_OPENBSD | - wxOS_UNIX_NETBSD | - wxOS_UNIX_SOLARIS | - wxOS_UNIX_AIX | - wxOS_UNIX_HPUX, - - // 1<<13 and 1<<14 available for other Unix flavours - - wxOS_DOS = 1 << 15, // Microsoft DOS - wxOS_OS2 = 1 << 16 // OS/2 -}; - -// list of wxWidgets ports - some of them can be used with more than -// a single toolkit. -enum wxPortId -{ - wxPORT_UNKNOWN = 0, // returned on error - - wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used - - wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API - wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif - wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo - wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal - wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal - wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager - wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager - wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API - wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API - wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API - wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API - wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal -}; - -// architecture of the operating system -// (regardless of the build environment of wxWidgets library - see -// wxIsPlatform64bit documentation for more info) -enum wxArchitecture -{ - wxARCH_INVALID = -1, // returned on error - - wxARCH_32, // 32 bit - wxARCH_64, - - wxARCH_MAX -}; - - -// endian-ness of the machine -enum wxEndianness -{ - wxENDIAN_INVALID = -1, // returned on error - - wxENDIAN_BIG, // 4321 - wxENDIAN_LITTLE, // 1234 - wxENDIAN_PDP, // 3412 - - wxENDIAN_MAX -}; - -// Information about the toolkit that the app is running under and some basic -// platform and architecture info -class WXDLLIMPEXP_BASE wxPlatformInfo -{ -public: - wxPlatformInfo(); - wxPlatformInfo(wxPortId pid, - int tkMajor = -1, int tkMinor = -1, - wxOperatingSystemId id = wxOS_UNKNOWN, - int osMajor = -1, int osMinor = -1, - wxArchitecture arch = wxARCH_INVALID, - wxEndianness endian = wxENDIAN_INVALID, - bool usingUniversal = false); - - // default copy ctor, assignment operator and dtor are ok - - bool operator==(const wxPlatformInfo &t) const; - - bool operator!=(const wxPlatformInfo &t) const - { return !(*this == t); } - - // Gets a wxPlatformInfo already initialized with the values for - // the currently running platform. - static const wxPlatformInfo& Get(); - - - - // string -> enum conversions - // --------------------------------- - - static wxOperatingSystemId GetOperatingSystemId(const wxString &name); - static wxPortId GetPortId(const wxString &portname); - - static wxArchitecture GetArch(const wxString &arch); - static wxEndianness GetEndianness(const wxString &end); - - // enum -> string conversions - // --------------------------------- - - static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os); - static wxString GetOperatingSystemIdName(wxOperatingSystemId os); - static wxString GetPortIdName(wxPortId port, bool usingUniversal); - static wxString GetPortIdShortName(wxPortId port, bool usingUniversal); - - static wxString GetArchName(wxArchitecture arch); - static wxString GetEndiannessName(wxEndianness end); - - // getters - // ----------------- - - int GetOSMajorVersion() const - { return m_osVersionMajor; } - int GetOSMinorVersion() const - { return m_osVersionMinor; } - - // return true if the OS version >= major.minor - bool CheckOSVersion(int major, int minor) const - { - return DoCheckVersion(GetOSMajorVersion(), - GetOSMinorVersion(), - major, - minor); - } - - int GetToolkitMajorVersion() const - { return m_tkVersionMajor; } - int GetToolkitMinorVersion() const - { return m_tkVersionMinor; } - - bool CheckToolkitVersion(int major, int minor) const - { - return DoCheckVersion(GetToolkitMajorVersion(), - GetToolkitMinorVersion(), - major, - minor); - } - - bool IsUsingUniversalWidgets() const - { return m_usingUniversal; } - - wxOperatingSystemId GetOperatingSystemId() const - { return m_os; } - wxPortId GetPortId() const - { return m_port; } - wxArchitecture GetArchitecture() const - { return m_arch; } - wxEndianness GetEndianness() const - { return m_endian; } - - - // string getters - // ----------------- - - wxString GetOperatingSystemFamilyName() const - { return GetOperatingSystemFamilyName(m_os); } - wxString GetOperatingSystemIdName() const - { return GetOperatingSystemIdName(m_os); } - wxString GetPortIdName() const - { return GetPortIdName(m_port, m_usingUniversal); } - wxString GetPortIdShortName() const - { return GetPortIdShortName(m_port, m_usingUniversal); } - wxString GetArchName() const - { return GetArchName(m_arch); } - wxString GetEndiannessName() const - { return GetEndiannessName(m_endian); } - - // setters - // ----------------- - - void SetOSVersion(int major, int minor) - { m_osVersionMajor=major; m_osVersionMinor=minor; } - void SetToolkitVersion(int major, int minor) - { m_tkVersionMajor=major; m_tkVersionMinor=minor; } - - void SetOperatingSystemId(wxOperatingSystemId n) - { m_os = n; } - void SetPortId(wxPortId n) - { m_port = n; } - void SetArchitecture(wxArchitecture n) - { m_arch = n; } - void SetEndianness(wxEndianness n) - { m_endian = n; } - - // miscellaneous - // ----------------- - - bool IsOk() const - { - return m_osVersionMajor != -1 && m_osVersionMinor != -1 && - m_os != wxOS_UNKNOWN && - m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && - m_port != wxPORT_UNKNOWN && - m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; - } - - -protected: - static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor) - { - return majorCur > major || (majorCur == major && minorCur >= minor); - } - - void InitForCurrentPlatform(); - - - // OS stuff - // ----------------- - - // Version of the OS; valid if m_os != wxOS_UNKNOWN - // (-1 means not initialized yet). - int m_osVersionMajor, - m_osVersionMinor; - - // Operating system ID. - wxOperatingSystemId m_os; - - - // toolkit - // ----------------- - - // Version of the underlying toolkit - // (-1 means not initialized yet; zero means no toolkit). - int m_tkVersionMajor, m_tkVersionMinor; - - // name of the wxWidgets port - wxPortId m_port; - - // is using wxUniversal widgets? - bool m_usingUniversal; - - - // others - // ----------------- - - // architecture of the OS - wxArchitecture m_arch; - - // endianness of the machine - wxEndianness m_endian; -}; - - -#if WXWIN_COMPATIBILITY_2_6 - #define wxUNKNOWN_PLATFORM wxOS_UNKNOWN - #define wxUnix wxOS_UNIX - #define wxWin95 wxOS_WINDOWS_9X - #define wxWIN95 wxOS_WINDOWS_9X - #define wxWINDOWS_NT wxOS_WINDOWS_NT - #define wxMSW wxOS_WINDOWS - #define wxWinCE wxOS_WINDOWS_CE - #define wxWIN32S wxOS_WINDOWS_9X - - #define wxPalmOS wxPORT_PALMOS - #define wxOS2 wxPORT_OS2 - #define wxMGL wxPORT_MGL - #define wxCocoa wxPORT_MAC - #define wxMac wxPORT_MAC - #define wxMotif wxPORT_MOTIF - #define wxGTK wxPORT_GTK -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // _WX_PLATINFO_H_ diff --git a/Source/3rdParty/wx/include/wx/popupwin.h b/Source/3rdParty/wx/include/wx/popupwin.h deleted file mode 100644 index c72eafeb6..000000000 --- a/Source/3rdParty/wx/include/wx/popupwin.h +++ /dev/null @@ -1,192 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/popupwin.h -// Purpose: wxPopupWindow interface declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.01.01 -// RCS-ID: $Id: popupwin.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_POPUPWIN_H_BASE_ -#define _WX_POPUPWIN_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_POPUPWIN - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxPopupWindow: a special kind of top level window used for popup menus, -// combobox popups and such. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPopupWindowBase : public wxWindow -{ -public: - wxPopupWindowBase() { } - virtual ~wxPopupWindowBase(); - - // create the popup window - // - // style may only contain border flags - bool Create(wxWindow *parent, int style = wxBORDER_NONE); - - // move the popup window to the right position, i.e. such that it is - // entirely visible - // - // the popup is positioned at ptOrigin + size if it opens below and to the - // right (default), at ptOrigin - sizePopup if it opens above and to the - // left &c - // - // the point must be given in screen coordinates! - virtual void Position(const wxPoint& ptOrigin, - const wxSize& size); - - virtual bool IsTopLevel() const { return true; } - - DECLARE_NO_COPY_CLASS(wxPopupWindowBase) -}; - - -// include the real class declaration -#if defined(__WXMSW__) - #include "wx/msw/popupwin.h" -#elif defined(__WXPM__) - #include "wx/os2/popupwin.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/popupwin.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/popupwin.h" -#elif defined(__WXX11__) - #include "wx/x11/popupwin.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/popupwin.h" -#elif defined(__WXMGL__) - #include "wx/mgl/popupwin.h" -#elif defined(__WXMAC__) - #include "wx/mac/popupwin.h" -#else - #error "wxPopupWindow is not supported under this platform." -#endif - -// ---------------------------------------------------------------------------- -// wxPopupTransientWindow: a wxPopupWindow which disappears automatically -// when the user clicks mouse outside it or if it loses focus in any other way -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; -class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; - -class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow -{ -public: - // ctors - wxPopupTransientWindow() { Init(); } - wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); - - virtual ~wxPopupTransientWindow(); - - // popup the window (this will show it too) and keep focus at winFocus - // (or itself if it's NULL), dismiss the popup if we lose focus - virtual void Popup(wxWindow *focus = NULL); - - // hide the window - virtual void Dismiss(); - - // can the window be dismissed now? - // - // VZ: where is this used?? - virtual bool CanDismiss() - { return true; } - - // called when a mouse is pressed while the popup is shown: return true - // from here to prevent its normal processing by the popup (which consists - // in dismissing it if the mouse is cilcked outside it) - virtual bool ProcessLeftDown(wxMouseEvent& event); - - // Overridden to grab the input on some plaforms - virtual bool Show( bool show = true ); - -protected: - // common part of all ctors - void Init(); - - // this is called when the popup is disappeared because of anything - // else but direct call to Dismiss() - virtual void OnDismiss(); - - // dismiss and notify the derived class - void DismissAndNotify(); - - // remove our event handlers - void PopHandlers(); - - // get alerted when child gets deleted from under us - void OnDestroy(wxWindowDestroyEvent& event); - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - // check if the mouse needs captured or released - void OnIdle(wxIdleEvent& event); -#endif - - // the child of this popup if any - wxWindow *m_child; - - // the window which has the focus while we're shown - wxWindow *m_focus; - - // these classes may call our DismissAndNotify() - friend class wxPopupWindowHandler; - friend class wxPopupFocusHandler; - - // the handlers we created, may be NULL (if not, must be deleted) - wxPopupWindowHandler *m_handlerPopup; - wxPopupFocusHandler *m_handlerFocus; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow) - DECLARE_NO_COPY_CLASS(wxPopupTransientWindow) -}; - -#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -// ---------------------------------------------------------------------------- -// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxComboBox; -class WXDLLEXPORT wxComboCtrl; - -class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow -{ -public: - wxPopupComboWindow() { m_combo = NULL; } - wxPopupComboWindow(wxComboCtrl *parent); - - bool Create(wxComboCtrl *parent); - - // position the window correctly relatively to the combo - void PositionNearCombo(); - -protected: - // notify the combo here - virtual void OnDismiss(); - - // forward the key presses to the combobox - void OnKeyDown(wxKeyEvent& event); - - // the parent combobox - wxComboCtrl *m_combo; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupComboWindow) -}; - -#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -#endif // wxUSE_POPUPWIN - -#endif // _WX_POPUPWIN_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/power.h b/Source/3rdParty/wx/include/wx/power.h deleted file mode 100644 index 66492cb55..000000000 --- a/Source/3rdParty/wx/include/wx/power.h +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/power.h -// Purpose: functions and classes for system power management -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-05-27 -// RCS-ID: $Id: power.h 48811 2007-09-19 23:11:28Z RD $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_POWER_H_ -#define _WX_POWER_H_ - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// power management constants -// ---------------------------------------------------------------------------- - -enum wxPowerType -{ - wxPOWER_SOCKET, - wxPOWER_BATTERY, - wxPOWER_UNKNOWN -}; - -enum wxBatteryState -{ - wxBATTERY_NORMAL_STATE, // system is fully usable - wxBATTERY_LOW_STATE, // start to worry - wxBATTERY_CRITICAL_STATE, // save quickly - wxBATTERY_SHUTDOWN_STATE, // too late - wxBATTERY_UNKNOWN_STATE -}; - -// ---------------------------------------------------------------------------- -// wxPowerEvent is generated when the system online status changes -// ---------------------------------------------------------------------------- - -// currently the power events are only available under Windows, to avoid -// compiling in the code for handling them which is never going to be invoked -// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event -// is available, it should be used to guard all code using wxPowerEvent -#ifdef __WXMSW__ - -#define wxHAS_POWER_EVENTS - -class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent -{ -public: - wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) - { - m_veto = false; - } - - // Veto the operation (only makes sense with EVT_POWER_SUSPENDING) - void Veto() { m_veto = true; } - - bool IsVetoed() const { return m_veto; } - - - // default copy ctor, assignment operator and dtor are ok - - virtual wxEvent *Clone() const { return new wxPowerEvent(*this); } - -private: - bool m_veto; - -#if wxABI_VERSION >= 20806 - DECLARE_ABSTRACT_CLASS(wxPowerEvent) -#endif -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, 406) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, 407) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, 408) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, 444) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); - -#define wxPowerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction) \ - wxStaticCastEvent(wxPowerEventFunction, &func) - -#define EVT_POWER_SUSPENDING(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func)) -#define EVT_POWER_SUSPENDED(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func)) -#define EVT_POWER_SUSPEND_CANCEL(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func)) -#define EVT_POWER_RESUME(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func)) - -#else // no support for power events - #undef wxHAS_POWER_EVENTS -#endif // support for power events/no support - -// ---------------------------------------------------------------------------- -// power management functions -// ---------------------------------------------------------------------------- - -// return the current system power state: online or offline -WXDLLIMPEXP_BASE wxPowerType wxGetPowerType(); - -// return approximate battery state -WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState(); - -#endif // _WX_POWER_H_ diff --git a/Source/3rdParty/wx/include/wx/print.h b/Source/3rdParty/wx/include/wx/print.h deleted file mode 100644 index e4cf1e2e7..000000000 --- a/Source/3rdParty/wx/include/wx/print.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/print.h -// Purpose: Base header for printer classes -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: print.h 41240 2006-09-15 16:45:48Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINT_H_BASE_ -#define _WX_PRINT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - -#include "wx/msw/printwin.h" - -#elif defined(__WXMAC__) - -#include "wx/mac/printmac.h" - -#elif defined(__WXPM__) - -#include "wx/os2/printos2.h" - -#else - -#include "wx/generic/printps.h" - -#endif - -#endif // wxUSE_PRINTING_ARCHITECTURE -#endif - // _WX_PRINT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/printdlg.h b/Source/3rdParty/wx/include/wx/printdlg.h deleted file mode 100644 index 4c98d251d..000000000 --- a/Source/3rdParty/wx/include/wx/printdlg.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/printdlg.h -// Purpose: Base header and class for print dialogs -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: printdlg.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTDLG_H_BASE_ -#define _WX_PRINTDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/event.h" -#include "wx/dialog.h" -#include "wx/intl.h" -#include "wx/cmndata.h" - - -// --------------------------------------------------------------------------- -// wxPrintDialogBase: interface for the dialog for printing -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintDialogBase : public wxDialog -{ -public: - wxPrintDialogBase() { } - wxPrintDialogBase(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = wxEmptyString, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - - virtual wxPrintDialogData& GetPrintDialogData() = 0; - virtual wxPrintData& GetPrintData() = 0; - virtual wxDC *GetPrintDC() = 0; - -private: - DECLARE_ABSTRACT_CLASS(wxPrintDialogBase) - DECLARE_NO_COPY_CLASS(wxPrintDialogBase) -}; - -// --------------------------------------------------------------------------- -// wxPrintDialog: the dialog for printing. -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintDialog : public wxObject -{ -public: - wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); - wxPrintDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxPrintDialog(); - - virtual int ShowModal(); - - virtual wxPrintDialogData& GetPrintDialogData(); - virtual wxPrintData& GetPrintData(); - virtual wxDC *GetPrintDC(); - -private: - wxPrintDialogBase *m_pimpl; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintDialog) - DECLARE_NO_COPY_CLASS(wxPrintDialog) -}; - -// --------------------------------------------------------------------------- -// wxPageSetupDialogBase: interface for the page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPageSetupDialogBase: public wxDialog -{ -public: - wxPageSetupDialogBase() { } - wxPageSetupDialogBase(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = wxEmptyString, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - - virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0; - -private: - DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase) - DECLARE_NO_COPY_CLASS(wxPageSetupDialogBase) -}; - -// --------------------------------------------------------------------------- -// wxPageSetupDialog: the page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPageSetupDialog: public wxObject -{ -public: - wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual ~wxPageSetupDialog(); - - int ShowModal(); - wxPageSetupDialogData& GetPageSetupDialogData(); - // old name - wxPageSetupDialogData& GetPageSetupData(); - -private: - wxPageSetupDialogBase *m_pimpl; - -private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) - DECLARE_NO_COPY_CLASS(wxPageSetupDialog) -}; - -#endif - -#endif - // _WX_PRINTDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/private/browserhack28.h b/Source/3rdParty/wx/include/wx/private/browserhack28.h deleted file mode 100644 index 28d6da71b..000000000 --- a/Source/3rdParty/wx/include/wx/private/browserhack28.h +++ /dev/null @@ -1,20 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/browserhack28.h -// Purpose: Allows GUI library to override base wxLaunchDefaultBrowser. -// Author: David Elliott -// Modified by: -// Created: 2007-08-19 -// RCS-ID: $Id: browserhack28.h 48184 2007-08-19 19:22:09Z DE $ -// Copyright: (c) David Elliott -// Licence: wxWidgets licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_BROWSERHACK28_H_ -#define _WX_PRIVATE_BROWSERHACK28_H_ - -typedef bool (*wxLaunchDefaultBrowserImpl_t)(const wxString& url, int flags); - -// Function the GUI library can call to provide a better implementation -WXDLLIMPEXP_BASE void wxSetLaunchDefaultBrowserImpl(wxLaunchDefaultBrowserImpl_t newImpl); - -#endif //ndef _WX_PRIVATE_BROWSERHACK28_H_ diff --git a/Source/3rdParty/wx/include/wx/private/fileback.h b/Source/3rdParty/wx/include/wx/private/fileback.h deleted file mode 100644 index 1ef8a4305..000000000 --- a/Source/3rdParty/wx/include/wx/private/fileback.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/private/fileback.h -// Purpose: Back an input stream with memory or a file -// Author: Mike Wetherell -// RCS-ID: $Id: fileback.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEBACK_H__ -#define _WX_FILEBACK_H__ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/stream.h" - -// ---------------------------------------------------------------------------- -// Backs an input stream with memory or a file to make it seekable. -// -// One or more wxBackedInputStreams can be used to read it's data. The data is -// reference counted, so stays alive until the last wxBackingFile or -// wxBackedInputStream using it is destroyed. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBackingFile -{ -public: - enum { DefaultBufSize = 16384 }; - - // Takes ownership of stream. If the stream is smaller than bufsize, the - // backing file is never created and the backing is done with memory. - wxBackingFile(wxInputStream *stream, - size_t bufsize = DefaultBufSize, - const wxString& prefix = wxT("wxbf")); - - wxBackingFile() : m_impl(NULL) { } - ~wxBackingFile(); - - wxBackingFile(const wxBackingFile& backer); - wxBackingFile& operator=(const wxBackingFile& backer); - - operator bool() const { return m_impl != NULL; } - -private: - class wxBackingFileImpl *m_impl; - friend class wxBackedInputStream; -}; - -// ---------------------------------------------------------------------------- -// An input stream to read from a wxBackingFile. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBackedInputStream : public wxInputStream -{ -public: - wxBackedInputStream(const wxBackingFile& backer); - - // If the length of the backer's parent stream is unknown then GetLength() - // returns wxInvalidOffset until the parent has been read to the end. - wxFileOffset GetLength() const; - - // Returns the length, reading the parent stream to the end if necessary. - wxFileOffset FindLength() const; - - bool IsSeekable() const { return true; } - -protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -private: - wxBackingFile m_backer; - wxFileOffset m_pos; - - DECLARE_NO_COPY_CLASS(wxBackedInputStream) -}; - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FILEBACK_H__ diff --git a/Source/3rdParty/wx/include/wx/private/filename.h b/Source/3rdParty/wx/include/wx/private/filename.h deleted file mode 100644 index f25e33c8b..000000000 --- a/Source/3rdParty/wx/include/wx/private/filename.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/private/filename.h -// Purpose: Internal declarations for src/common/filename.cpp -// Author: Mike Wetherell -// Modified by: -// Created: 2006-10-22 -// RCS-ID: $Id: filename.h 42277 2006-10-23 13:10:12Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_FILENAME_H_ -#define _WX_PRIVATE_FILENAME_H_ - -#include "wx/file.h" -#include "wx/ffile.h" - -// Self deleting temp files aren't supported on all platforms. Therefore -// rather than let these be in the API, they can be used internally to -// implement classes (e.g. wxTempFileStream), that will do the clean up when -// the OS doesn't support it. - -// Same usage as wxFileName::CreateTempFileName() with the extra parameter -// deleteOnClose. *deleteOnClose true on entry requests a file created with a -// delete on close flag, on exit the value of *deleteOnClose indicates whether -// available. - -#if wxUSE_FILE -wxString wxCreateTempFileName(const wxString& prefix, - wxFile *fileTemp, - bool *deleteOnClose = NULL); -#endif - -#if wxUSE_FFILE -wxString wxCreateTempFileName(const wxString& prefix, - wxFFile *fileTemp, - bool *deleteOnClose = NULL); -#endif - -// Returns an open temp file, if possible either an unlinked open file or one -// that will delete on close. Only returns the filename if neither was -// possible, so that the caller can delete the file when done. - -#if wxUSE_FILE -bool wxCreateTempFile(const wxString& prefix, - wxFile *fileTemp, - wxString *name); -#endif - -#if wxUSE_FFILE -bool wxCreateTempFile(const wxString& prefix, - wxFFile *fileTemp, - wxString *name); -#endif - -#endif // _WX_PRIVATE_FILENAME_H_ diff --git a/Source/3rdParty/wx/include/wx/private/overlay.h b/Source/3rdParty/wx/include/wx/private/overlay.h deleted file mode 100644 index 9203503ce..000000000 --- a/Source/3rdParty/wx/include/wx/private/overlay.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/overlay.h -// Purpose: wxOverlayImpl declaration -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_OVERLAY_H_ -#define _WX_PRIVATE_OVERLAY_H_ - -#include "wx/overlay.h" - -#ifdef wxHAS_NATIVE_OVERLAY - -#if defined(__WXMAC__) - #include "wx/mac/carbon/private/overlay.h" -#elif defined(__WXDFB__) - #include "wx/dfb/private/overlay.h" -#else - #error "unknown native wxOverlay implementation" -#endif - -#else // !wxHAS_NATIVE_OVERLAY - -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// generic implementation of wxOverlay -class wxOverlayImpl -{ -public: - wxOverlayImpl(); - ~wxOverlayImpl(); - - - // clears the overlay without restoring the former state - // to be done eg when the window content has been changed and repainted - void Reset(); - - // returns true if it has been setup - bool IsOk(); - - void Init(wxWindowDC* dc, int x , int y , int width , int height); - - void BeginDrawing(wxWindowDC* dc); - - void EndDrawing(wxWindowDC* dc); - - void Clear(wxWindowDC* dc); - -private: - wxBitmap m_bmpSaved ; - int m_x ; - int m_y ; - int m_width ; - int m_height ; -// this is to enable wxMOTIF and UNIV to compile.... -// currently (10 oct 06) we don't use m_window -// ce - how do we fix this -#if defined(__WXGTK__) || defined(__WXMSW__) - wxWindow* m_window ; -#endif -} ; - -#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY - -#endif // _WX_PRIVATE_OVERLAY_H_ diff --git a/Source/3rdParty/wx/include/wx/prntbase.h b/Source/3rdParty/wx/include/wx/prntbase.h deleted file mode 100644 index 4c442a011..000000000 --- a/Source/3rdParty/wx/include/wx/prntbase.h +++ /dev/null @@ -1,665 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/prntbase.h -// Purpose: Base classes for printing framework -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: prntbase.h 62502 2009-10-27 16:39:01Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRNTBASEH__ -#define _WX_PRNTBASEH__ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/event.h" -#include "wx/cmndata.h" -#include "wx/panel.h" -#include "wx/scrolwin.h" -#include "wx/dialog.h" -#include "wx/frame.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxChoice; -class WXDLLIMPEXP_FWD_CORE wxPrintout; -class WXDLLIMPEXP_FWD_CORE wxPrinterBase; -class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase; -class WXDLLIMPEXP_FWD_CORE wxPrintDialog; -class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase; -class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog; -class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase; -class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas; -class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar; -class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; -class WXDLLIMPEXP_FWD_CORE wxPrintFactory; -class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; - -//---------------------------------------------------------------------------- -// error consts -//---------------------------------------------------------------------------- - -enum wxPrinterError -{ - wxPRINTER_NO_ERROR = 0, - wxPRINTER_CANCELLED, - wxPRINTER_ERROR -}; - -//---------------------------------------------------------------------------- -// wxPrintFactory -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintFactory -{ -public: - wxPrintFactory() {} - virtual ~wxPrintFactory() {} - - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; - - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ) = 0; - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, - wxPrintData *data ) = 0; - - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ) = 0; - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ) = 0; - - virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ) = 0; - - virtual wxDC* CreatePrinterDC( const wxPrintData& data ) = 0; - - // What to do and what to show in the wxPrintDialog - // a) Use the generic print setup dialog or a native one? - virtual bool HasPrintSetupDialog() = 0; - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0; - // b) Provide the "print to file" option ourselves or via print setup? - virtual bool HasOwnPrintToFile() = 0; - // c) Show current printer - virtual bool HasPrinterLine() = 0; - virtual wxString CreatePrinterLine() = 0; - // d) Show Status line for current printer? - virtual bool HasStatusLine() = 0; - virtual wxString CreateStatusLine() = 0; - - - virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0; - - static void SetPrintFactory( wxPrintFactory *factory ); - static wxPrintFactory *GetFactory(); -private: - static wxPrintFactory *m_factory; -}; - -class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory -{ -public: - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); - - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ); - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, - wxPrintData *data ); - - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ); - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ); - - virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ); - - virtual wxDC* CreatePrinterDC( const wxPrintData& data ); - - virtual bool HasPrintSetupDialog(); - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); - virtual bool HasOwnPrintToFile(); - virtual bool HasPrinterLine(); - virtual wxString CreatePrinterLine(); - virtual bool HasStatusLine(); - virtual wxString CreateStatusLine(); - - virtual wxPrintNativeDataBase *CreatePrintNativeData(); -}; - -//---------------------------------------------------------------------------- -// wxPrintNativeDataBase -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintNativeDataBase: public wxObject -{ -public: - wxPrintNativeDataBase(); - virtual ~wxPrintNativeDataBase() {} - - virtual bool TransferTo( wxPrintData &data ) = 0; - virtual bool TransferFrom( const wxPrintData &data ) = 0; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - int m_ref; - -private: - DECLARE_CLASS(wxPrintNativeDataBase) - DECLARE_NO_COPY_CLASS(wxPrintNativeDataBase) -}; - -//---------------------------------------------------------------------------- -// wxPrinterBase -//---------------------------------------------------------------------------- - -/* - * Represents the printer: manages printing a wxPrintout object - */ - -class WXDLLEXPORT wxPrinterBase: public wxObject -{ -public: - wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL); - virtual ~wxPrinterBase(); - - virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); - virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); - - virtual wxPrintDialogData& GetPrintDialogData() const; - bool GetAbort() const { return sm_abortIt; } - - static wxPrinterError GetLastError() { return sm_lastError; } - - /////////////////////////////////////////////////////////////////////////// - // OVERRIDES - - virtual bool Setup(wxWindow *parent) = 0; - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0; - virtual wxDC* PrintDialog(wxWindow *parent) = 0; - -protected: - wxPrintDialogData m_printDialogData; - wxPrintout* m_currentPrintout; - - static wxPrinterError sm_lastError; - -public: - static wxWindow* sm_abortWindow; - static bool sm_abortIt; - -private: - DECLARE_CLASS(wxPrinterBase) - DECLARE_NO_COPY_CLASS(wxPrinterBase) -}; - -//---------------------------------------------------------------------------- -// wxPrinter -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrinter: public wxPrinterBase -{ -public: - wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); - virtual ~wxPrinter(); - - virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); - virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); - - virtual bool Setup(wxWindow *parent); - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); - - virtual wxPrintDialogData& GetPrintDialogData() const; - -protected: - wxPrinterBase *m_pimpl; - -private: - DECLARE_CLASS(wxPrinter) - DECLARE_NO_COPY_CLASS(wxPrinter) -}; - -//---------------------------------------------------------------------------- -// wxPrintout -//---------------------------------------------------------------------------- - -/* - * Represents an object via which a document may be printed. - * The programmer derives from this, overrides (at least) OnPrintPage, - * and passes it to a wxPrinter object for printing, or a wxPrintPreview - * object for previewing. - */ - -class WXDLLEXPORT wxPrintout: public wxObject -{ -public: - wxPrintout(const wxString& title = wxT("Printout")); - virtual ~wxPrintout(); - - virtual bool OnBeginDocument(int startPage, int endPage); - virtual void OnEndDocument(); - virtual void OnBeginPrinting(); - virtual void OnEndPrinting(); - - // Guaranteed to be before any other functions are called - virtual void OnPreparePrinting() { } - - virtual bool HasPage(int page); - virtual bool OnPrintPage(int page) = 0; - virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); - - virtual wxString GetTitle() const { return m_printoutTitle; } - - wxDC *GetDC() const { return m_printoutDC; } - void SetDC(wxDC *dc) { m_printoutDC = dc; } - - void FitThisSizeToPaper(const wxSize& imageSize); - void FitThisSizeToPage(const wxSize& imageSize); - void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData); - void MapScreenSizeToPaper(); - void MapScreenSizeToPage(); - void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData); - void MapScreenSizeToDevice(); - - wxRect GetLogicalPaperRect() const; - wxRect GetLogicalPageRect() const; - wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const; - - void SetLogicalOrigin(wxCoord x, wxCoord y); - void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff); - - void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; } - void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; } - void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; } - void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } - - void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } - void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } - void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } - void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } - - void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; } - wxRect GetPaperRectPixels() const { return m_paperRectPixels; } - - virtual bool IsPreview() const { return m_isPreview; } - - virtual void SetIsPreview(bool p) { m_isPreview = p; } - -private: - wxString m_printoutTitle; - wxDC* m_printoutDC; - - int m_pageWidthPixels; - int m_pageHeightPixels; - - int m_pageWidthMM; - int m_pageHeightMM; - - int m_PPIScreenX; - int m_PPIScreenY; - int m_PPIPrinterX; - int m_PPIPrinterY; - - wxRect m_paperRectPixels; - - bool m_isPreview; - -private: - DECLARE_ABSTRACT_CLASS(wxPrintout) - DECLARE_NO_COPY_CLASS(wxPrintout) -}; - -//---------------------------------------------------------------------------- -// wxPreviewCanvas -//---------------------------------------------------------------------------- - -/* - * Canvas upon which a preview is drawn. - */ - -class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow -{ -public: - wxPreviewCanvas(wxPrintPreviewBase *preview, - wxWindow *parent, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxT("canvas")); - virtual ~wxPreviewCanvas(); - - void OnPaint(wxPaintEvent& event); - void OnChar(wxKeyEvent &event); - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -private: -#if wxUSE_MOUSEWHEEL - void OnMouseWheel(wxMouseEvent& event); -#endif // wxUSE_MOUSEWHEEL - - wxPrintPreviewBase* m_printPreview; - - DECLARE_CLASS(wxPreviewCanvas) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewCanvas) -}; - -//---------------------------------------------------------------------------- -// wxPreviewFrame -//---------------------------------------------------------------------------- - -/* - * Default frame for showing preview. - */ - -class WXDLLEXPORT wxPreviewFrame: public wxFrame -{ -public: - wxPreviewFrame(wxPrintPreviewBase *preview, - wxWindow *parent, - const wxString& title = wxT("Print Preview"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, - const wxString& name = wxFrameNameStr); - virtual ~wxPreviewFrame(); - - void OnCloseWindow(wxCloseEvent& event); - virtual void Initialize(); - virtual void CreateCanvas(); - virtual void CreateControlBar(); - - inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; } - -protected: - wxPreviewCanvas* m_previewCanvas; - wxPreviewControlBar* m_controlBar; - wxPrintPreviewBase* m_printPreview; - wxWindowDisabler* m_windowDisabler; - -private: - DECLARE_CLASS(wxPreviewFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewFrame) -}; - -//---------------------------------------------------------------------------- -// wxPreviewControlBar -//---------------------------------------------------------------------------- - -/* - * A panel with buttons for controlling a print preview. - * The programmer may wish to use other means for controlling - * the print preview. - */ - -#define wxPREVIEW_PRINT 1 -#define wxPREVIEW_PREVIOUS 2 -#define wxPREVIEW_NEXT 4 -#define wxPREVIEW_ZOOM 8 -#define wxPREVIEW_FIRST 16 -#define wxPREVIEW_LAST 32 -#define wxPREVIEW_GOTO 64 - -#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\ - |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST) - -// Ids for controls -#define wxID_PREVIEW_CLOSE 1 -#define wxID_PREVIEW_NEXT 2 -#define wxID_PREVIEW_PREVIOUS 3 -#define wxID_PREVIEW_PRINT 4 -#define wxID_PREVIEW_ZOOM 5 -#define wxID_PREVIEW_FIRST 6 -#define wxID_PREVIEW_LAST 7 -#define wxID_PREVIEW_GOTO 8 - -class WXDLLEXPORT wxPreviewControlBar: public wxPanel -{ - DECLARE_CLASS(wxPreviewControlBar) - -public: - wxPreviewControlBar(wxPrintPreviewBase *preview, - long buttons, - wxWindow *parent, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL, - const wxString& name = wxT("panel")); - virtual ~wxPreviewControlBar(); - - virtual void CreateButtons(); - virtual void SetZoomControl(int zoom); - virtual int GetZoomControl(); - virtual wxPrintPreviewBase *GetPrintPreview() const - { return m_printPreview; } - - void OnWindowClose(wxCommandEvent& event); - void OnNext(); - void OnPrevious(); - void OnFirst(); - void OnLast(); - void OnGoto(); - void OnPrint(); - void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } - void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } - void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } - void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } - void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } - void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); } - void OnZoom(wxCommandEvent& event); - void OnPaint(wxPaintEvent& event); - -protected: - wxPrintPreviewBase* m_printPreview; - wxButton* m_closeButton; - wxButton* m_nextPageButton; - wxButton* m_previousPageButton; - wxButton* m_printButton; - wxChoice* m_zoomControl; - wxButton* m_firstPageButton; - wxButton* m_lastPageButton; - wxButton* m_gotoPageButton; - long m_buttonFlags; - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewControlBar) -}; - -//---------------------------------------------------------------------------- -// wxPrintPreviewBase -//---------------------------------------------------------------------------- - -/* - * Programmer creates an object of this class to preview a wxPrintout. - */ - -class WXDLLEXPORT wxPrintPreviewBase: public wxObject -{ -public: - wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting = (wxPrintout *) NULL, - wxPrintDialogData *data = (wxPrintDialogData *) NULL); - wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxPrintPreviewBase(); - - virtual bool SetCurrentPage(int pageNum); - virtual int GetCurrentPage() const; - - virtual void SetPrintout(wxPrintout *printout); - virtual wxPrintout *GetPrintout() const; - virtual wxPrintout *GetPrintoutForPrinting() const; - - virtual void SetFrame(wxFrame *frame); - virtual void SetCanvas(wxPreviewCanvas *canvas); - - virtual wxFrame *GetFrame() const; - virtual wxPreviewCanvas *GetCanvas() const; - - // This is a helper routine, used by the next 4 routines. - - virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect); - - // The preview canvas should call this from OnPaint - virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - - // This draws a blank page onto the preview canvas - virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - - // Adjusts the scrollbars for the current scale - virtual void AdjustScrollbars(wxPreviewCanvas *canvas); - - // This is called by wxPrintPreview to render a page into a wxMemoryDC. - virtual bool RenderPage(int pageNum); - - - virtual void SetZoom(int percent); - virtual int GetZoom() const; - - virtual wxPrintDialogData& GetPrintDialogData(); - - virtual int GetMaxPage() const; - virtual int GetMinPage() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - virtual void SetOk(bool ok); - - /////////////////////////////////////////////////////////////////////////// - // OVERRIDES - - // If we own a wxPrintout that can be used for printing, this - // will invoke the actual printing procedure. Called - // by the wxPreviewControlBar. - virtual bool Print(bool interactive) = 0; - - // Calculate scaling that needs to be done to get roughly - // the right scaling for the screen pretending to be - // the currently selected printer. - virtual void DetermineScaling() = 0; - -protected: - wxPrintDialogData m_printDialogData; - wxPreviewCanvas* m_previewCanvas; - wxFrame* m_previewFrame; - wxBitmap* m_previewBitmap; - wxPrintout* m_previewPrintout; - wxPrintout* m_printPrintout; - int m_currentPage; - int m_currentZoom; - float m_previewScaleX; - float m_previewScaleY; - int m_topMargin; - int m_leftMargin; - int m_pageWidth; - int m_pageHeight; - int m_minPage; - int m_maxPage; - - bool m_isOk; - bool m_printingPrepared; // Called OnPreparePrinting? - -private: - void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); - - // helpers for RenderPage(): - bool RenderPageIntoDC(wxDC& dc, int pageNum); - bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); - - DECLARE_NO_COPY_CLASS(wxPrintPreviewBase) - DECLARE_CLASS(wxPrintPreviewBase) -}; - -//---------------------------------------------------------------------------- -// wxPrintPreview -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase -{ -public: - wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = (wxPrintout *) NULL, - wxPrintDialogData *data = (wxPrintDialogData *) NULL); - wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxPrintPreview(); - - virtual bool SetCurrentPage(int pageNum); - virtual int GetCurrentPage() const; - virtual void SetPrintout(wxPrintout *printout); - virtual wxPrintout *GetPrintout() const; - virtual wxPrintout *GetPrintoutForPrinting() const; - virtual void SetFrame(wxFrame *frame); - virtual void SetCanvas(wxPreviewCanvas *canvas); - - virtual wxFrame *GetFrame() const; - virtual wxPreviewCanvas *GetCanvas() const; - virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual void AdjustScrollbars(wxPreviewCanvas *canvas); - virtual bool RenderPage(int pageNum); - virtual void SetZoom(int percent); - virtual int GetZoom() const; - - virtual bool Print(bool interactive); - virtual void DetermineScaling(); - - virtual wxPrintDialogData& GetPrintDialogData(); - - virtual int GetMaxPage() const; - virtual int GetMinPage() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - virtual void SetOk(bool ok); - -private: - wxPrintPreviewBase *m_pimpl; - -private: - DECLARE_CLASS(wxPrintPreview) - DECLARE_NO_COPY_CLASS(wxPrintPreview) -}; - -//---------------------------------------------------------------------------- -// wxPrintAbortDialog -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintAbortDialog: public wxDialog -{ -public: - wxPrintAbortDialog(wxWindow *parent, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxT("dialog")) - : wxDialog(parent, wxID_ANY, title, pos, size, style, name) - { - } - - void OnCancel(wxCommandEvent& event); - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPrintAbortDialog) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif - // _WX_PRNTBASEH__ diff --git a/Source/3rdParty/wx/include/wx/process.h b/Source/3rdParty/wx/include/wx/process.h deleted file mode 100644 index 2c2f6185e..000000000 --- a/Source/3rdParty/wx/include/wx/process.h +++ /dev/null @@ -1,172 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/process.h -// Purpose: wxProcess class -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin to check error codes, added Detach() method -// Created: 24/06/98 -// RCS-ID: $Id: process.h 42713 2006-10-30 11:56:12Z ABX $ -// Copyright: (c) 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROCESSH__ -#define _WX_PROCESSH__ - -#include "wx/event.h" - -#if wxUSE_STREAMS - #include "wx/stream.h" -#endif - -#include "wx/utils.h" // for wxSignal - -// the wxProcess creation flags -enum -{ - // no redirection - wxPROCESS_DEFAULT = 0, - - // redirect the IO of the child process - wxPROCESS_REDIRECT = 1 -}; - -// ---------------------------------------------------------------------------- -// A wxProcess object should be passed to wxExecute - than its OnTerminate() -// function will be called when the process terminates. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxProcess : public wxEvtHandler -{ -public: - // kill the process with the given PID - static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM, int flags = wxKILL_NOCHILDREN); - - // test if the given process exists - static bool Exists(int pid); - - // this function replaces the standard popen() one: it launches a process - // asynchronously and allows the caller to get the streams connected to its - // std{in|out|err} - // - // on error NULL is returned, in any case the process object will be - // deleted automatically when the process terminates and should *not* be - // deleted by the caller - static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); - - - // ctors - wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int nId = wxID_ANY) - { Init(parent, nId, wxPROCESS_DEFAULT); } - - wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } - - virtual ~wxProcess(); - - // get the process ID of the process executed by Open() - long GetPid() const { return m_pid; } - - // may be overridden to be notified about process termination - virtual void OnTerminate(int pid, int status); - - // call this before passing the object to wxExecute() to redirect the - // launched process stdin/stdout, then use GetInputStream() and - // GetOutputStream() to get access to them - void Redirect() { m_redirect = true; } - bool IsRedirected() const { return m_redirect; } - - // detach from the parent - should be called by the parent if it's deleted - // before the process it started terminates - void Detach(); - -#if wxUSE_STREAMS - // Pipe handling - wxInputStream *GetInputStream() const { return m_inputStream; } - wxInputStream *GetErrorStream() const { return m_errorStream; } - wxOutputStream *GetOutputStream() const { return m_outputStream; } - - // close the output stream indicating that nothing more will be written - void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } - - // return true if the child process stdout is not closed - bool IsInputOpened() const; - - // return true if any input is available on the child process stdout/err - bool IsInputAvailable() const; - bool IsErrorAvailable() const; - - // implementation only (for wxExecute) - // - // NB: the streams passed here should correspond to the child process - // stdout, stdin and stderr and here the normal naming convention is - // used unlike elsewhere in this class - void SetPipeStreams(wxInputStream *outStream, - wxOutputStream *inStream, - wxInputStream *errStream); -#endif // wxUSE_STREAMS - -protected: - void Init(wxEvtHandler *parent, int id, int flags); - void SetPid(long pid) { m_pid = pid; } - - int m_id; - long m_pid; - -#if wxUSE_STREAMS - // these streams are connected to stdout, stderr and stdin of the child - // process respectively (yes, m_inputStream corresponds to stdout -- very - // confusing but too late to change now) - wxInputStream *m_inputStream, - *m_errorStream; - wxOutputStream *m_outputStream; -#endif // wxUSE_STREAMS - - bool m_redirect; - - DECLARE_DYNAMIC_CLASS(wxProcess) - DECLARE_NO_COPY_CLASS(wxProcess) -}; - -// ---------------------------------------------------------------------------- -// wxProcess events -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, 440) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent -{ -public: - wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId) - { - m_eventType = wxEVT_END_PROCESS; - m_pid = pid; - m_exitcode = exitcode; - } - - // accessors - // PID of process which terminated - int GetPid() { return m_pid; } - - // the exit code - int GetExitCode() { return m_exitcode; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxProcessEvent(*this); } - -public: - int m_pid, - m_exitcode; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent) -}; - -typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); - -#define wxProcessEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxProcessEventFunction, &func) - -#define EVT_END_PROCESS(id, func) \ - wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func)) - -#endif // _WX_PROCESSH__ diff --git a/Source/3rdParty/wx/include/wx/progdlg.h b/Source/3rdParty/wx/include/wx/progdlg.h deleted file mode 100644 index 196192bce..000000000 --- a/Source/3rdParty/wx/include/wx/progdlg.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/progdlg.h -// Purpose: Base header for wxProgressDialog -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: progdlg.h 41089 2006-09-09 13:36:54Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROGDLG_H_BASE_ -#define _WX_PROGDLG_H_BASE_ - -#include "wx/defs.h" - -/* - * wxProgressDialog flags - */ -#define wxPD_CAN_ABORT 0x0001 -#define wxPD_APP_MODAL 0x0002 -#define wxPD_AUTO_HIDE 0x0004 -#define wxPD_ELAPSED_TIME 0x0008 -#define wxPD_ESTIMATED_TIME 0x0010 -#define wxPD_SMOOTH 0x0020 -#define wxPD_REMAINING_TIME 0x0040 -#define wxPD_CAN_SKIP 0x0080 - - -#ifdef __WXPALMOS__ - #include "wx/palmos/progdlg.h" -#else - #include "wx/generic/progdlgg.h" -#endif - -#endif // _WX_PROGDLG_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/ptr_scpd.h b/Source/3rdParty/wx/include/wx/ptr_scpd.h deleted file mode 100644 index 19c6588b7..000000000 --- a/Source/3rdParty/wx/include/wx/ptr_scpd.h +++ /dev/null @@ -1,222 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ptr_scpd.h -// Purpose: scoped smart pointer class -// Author: Jesse Lovelace -// Modified by: -// Created: 06/01/02 -// RCS-ID: $Id: ptr_scpd.h 35688 2005-09-25 19:59:19Z VZ $ -// Copyright: (c) Jesse Lovelace and original Boost authors (see below) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// This class closely follows the implementation of the boost -// library scoped_ptr and is an adaption for c++ macro's in -// the wxWidgets project. The original authors of the boost -// scoped_ptr are given below with their respective copyrights. - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. -// - -#ifndef __WX_SCOPED_POINTER__ -#define __WX_SCOPED_POINTER__ - -#include "wx/defs.h" - -/* - checked deleters are used to make sure that the type being deleted is really - a complete type.: otherwise sizeof() would result in a compile-time error - - do { ... } while ( 0 ) construct is used to have an anonymous scope - (otherwise we could have name clashes between different "complete"s) but - still force a semicolon after the macro -*/ - -#ifdef __WATCOMC__ - #define wxFOR_ONCE(name) for(int name=0; name<1; name++) - #define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name)) - #define wxPOST_NO_WARNING_SCOPE(name) -#else - #define wxPRE_NO_WARNING_SCOPE(name) do - #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse ) -#endif - -#define wxCHECKED_DELETE(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var1) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var1) - -#define wxCHECKED_DELETE_ARRAY(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var2) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete [] ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var2) - -/* These scoped pointers are *not* assignable and cannot be used - within a container. Look for wxDECLARE_SHARED_PTR for this - functionality. - - In addition, the type being used *must* be complete at the time - that wxDEFINE_SCOPED_* is called or a compiler error will result. - This is because the class checks for the completeness of the type - being used. -*/ - - -#define wxDECLARE_SCOPED_PTR(T, name) \ -class name \ -{ \ -private: \ - T * m_ptr; \ - \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * ptr = NULL) \ - : m_ptr(ptr) { } \ - \ - ~name(); \ - \ - void reset(T * ptr = NULL) \ - { \ - if (m_ptr != ptr) \ - { \ - delete m_ptr; \ - m_ptr = ptr; \ - } \ - } \ - \ - T *release() \ - { \ - T *ptr = m_ptr; \ - m_ptr = NULL; \ - return ptr; \ - } \ - \ - T & operator*() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return *m_ptr; \ - } \ - \ - T * operator->() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return m_ptr; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_PTR(T, name)\ -name::~name() \ -{ \ - wxCHECKED_DELETE(m_ptr); \ -} - -// this macro can be used for the most common case when you want to declare and -// define the scoped pointer at the same time and want to use the standard -// naming convention: auto pointer to Foo is called FooPtr -#define wxDEFINE_SCOPED_PTR_TYPE(T) \ - wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ - wxDEFINE_SCOPED_PTR(T, T ## Ptr) - -// the same but for arrays instead of simple pointers -#define wxDECLARE_SCOPED_ARRAY(T, name)\ -class name \ -{ \ -private: \ - T * m_ptr; \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * p = NULL) : m_ptr(p) \ - {} \ - \ - ~name(); \ - void reset(T * p = NULL); \ - \ - T & operator[](long int i) const\ - { \ - wxASSERT(m_ptr != NULL); \ - wxASSERT(i >= 0); \ - return m_ptr[i]; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_ARRAY(T, name) \ -name::~name() \ -{ \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ -} \ -void name::reset(T * p){ \ - if (m_ptr != p) \ - { \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ - m_ptr = p; \ - } \ -} - -// ---------------------------------------------------------------------------- -// "Tied" scoped pointer: same as normal one but also sets the value of -// some other variable to the pointer value -// ---------------------------------------------------------------------------- - -#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ - wxDEFINE_SCOPED_PTR_TYPE(T) \ - class T ## TiedPtr : public T ## Ptr \ - { \ - public: \ - T ## TiedPtr(T **pp, T *p) \ - : T ## Ptr(p), m_pp(pp) \ - { \ - m_pOld = *pp; \ - *pp = p; \ - } \ - \ - ~ T ## TiedPtr() \ - { \ - *m_pp = m_pOld; \ - } \ - \ - private: \ - T **m_pp; \ - T *m_pOld; \ - }; - -#endif // __WX_SCOPED_POINTER__ - diff --git a/Source/3rdParty/wx/include/wx/quantize.h b/Source/3rdParty/wx/include/wx/quantize.h deleted file mode 100644 index dd43f7a05..000000000 --- a/Source/3rdParty/wx/include/wx/quantize.h +++ /dev/null @@ -1,76 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/quantize.h -// Purpose: wxQuantizer class -// Author: Julian Smart -// Modified by: -// Created: 22/6/2000 -// RCS-ID: $Id: quantize.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_QUANTIZE_H_ -#define _WX_QUANTIZE_H_ - -#include "wx/object.h" - -/* - * From jquant2.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - */ - -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -/* - * wxQuantize - * Based on the JPEG quantization code. Reduces the number of colours in a wxImage. - */ - -#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01 -#define wxQUANTIZE_RETURN_8BIT_DATA 0x02 -#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04 - -class WXDLLEXPORT wxQuantize: public wxObject -{ -public: -DECLARE_DYNAMIC_CLASS(wxQuantize) - -//// Constructor - - wxQuantize() {} - virtual ~wxQuantize() {} - -//// Operations - - // Reduce the colours in the source image and put the result into the - // destination image. Both images may be the same, to overwrite the source image. - // Specify an optional palette pointer to receive the resulting palette. - // This palette may be passed to ConvertImageToBitmap, for example. - // If you pass a palette pointer, you must free the palette yourself. - - static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); - - // This version sets a palette in the destination image so you don't - // have to manage it yourself. - - static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); - -//// Helpers - - // Converts input bitmap(s) into 8bit representation with custom palette - - // in_rows and out_rows are arrays [0..h-1] of pointer to rows - // (in_rows contains w * 3 bytes per row, out_rows w bytes per row) - // fills out_rows with indexes into palette (which is also stored into palette variable) - static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours); - -}; - -#endif - // _WX_QUANTIZE_H_ diff --git a/Source/3rdParty/wx/include/wx/radiobox.h b/Source/3rdParty/wx/include/wx/radiobox.h deleted file mode 100644 index e54aa7e71..000000000 --- a/Source/3rdParty/wx/include/wx/radiobox.h +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/radiobox.h -// Purpose: wxRadioBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: radiobox.h 54930 2008-08-02 19:45:23Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBOX_H_BASE_ -#define _WX_RADIOBOX_H_BASE_ - -#if wxUSE_RADIOBOX - -#include "wx/ctrlsub.h" - -#if wxUSE_TOOLTIPS - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxToolTip; - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray); - -#endif // wxUSE_TOOLTIPS - -extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxRadioBoxBase is not a normal base class, but rather a mix-in because the -// real wxRadioBox derives from different classes on different platforms: for -// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable -{ -public: - virtual ~wxRadioBoxBase(); - - // change/query the individual radio button state - virtual bool Enable(unsigned int n, bool enable = true) = 0; - virtual bool Show(unsigned int n, bool show = true) = 0; - virtual bool IsItemEnabled(unsigned int n) const = 0; - virtual bool IsItemShown(unsigned int n) const = 0; - - // return number of columns/rows in this radiobox - unsigned int GetColumnCount() const { return m_numCols; } - unsigned int GetRowCount() const { return m_numRows; } - - // return the next active (i.e. shown and not disabled) item above/below/to - // the left/right of the given one - int GetNextItem(int item, wxDirection dir, long style) const; - -#if wxUSE_TOOLTIPS - // set the tooltip text for a radio item, empty string unsets any tooltip - void SetItemToolTip(unsigned int item, const wxString& text); - - // get the individual items tooltip; returns NULL if none - wxToolTip *GetItemToolTip(unsigned int item) const - { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; } -#endif // wxUSE_TOOLTIPS - -#if wxUSE_HELP - // set helptext for a particular item, pass an empty string to erase it - void SetItemHelpText(unsigned int n, const wxString& helpText); - - // retrieve helptext for a particular item, empty string means no help text - wxString GetItemHelpText(unsigned int n) const; -#else // wxUSE_HELP - // just silently ignore the help text, it's better than requiring using - // conditional compilation in all code using this function - void SetItemHelpText(unsigned int WXUNUSED(n), - const wxString& WXUNUSED(helpText)) - { - } -#endif // wxUSE_HELP - - // returns the radio item at the given position or wxNOT_FOUND if none - // (currently implemented only under MSW and GTK) - virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const - { - return wxNOT_FOUND; - } - - - // deprecated functions - // -------------------- - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( int GetNumberOfRowsOrCols() const ); - wxDEPRECATED( void SetNumberOfRowsOrCols(int n) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -protected: - wxRadioBoxBase() - { - m_numCols = - m_numRows = - m_majorDim = 0; - -#if wxUSE_TOOLTIPS - m_itemsTooltips = NULL; -#endif // wxUSE_TOOLTIPS - } - - // return the number of items in major direction (which depends on whether - // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) - unsigned int GetMajorDim() const { return m_majorDim; } - - // sets m_majorDim and also updates m_numCols/Rows - // - // the style parameter should be the style of the radiobox itself - void SetMajorDim(unsigned int majorDim, long style); - -#if wxUSE_TOOLTIPS - // called from SetItemToolTip() to really set the tooltip for the specified - // item in the box (or, if tooltip is NULL, to remove any existing one). - // - // NB: this function should really be pure virtual but to avoid breaking - // the build of the ports for which it's not implemented yet we provide - // an empty stub in the base class for now - virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip); - - // returns true if we have any item tooltips - bool HasItemToolTips() const { return m_itemsTooltips != NULL; } -#endif // wxUSE_TOOLTIPS - -#if wxUSE_HELP - // Retrieve help text for an item: this is a helper for the implementation - // of wxWindow::GetHelpTextAtPoint() in the real radiobox class - wxString DoGetHelpTextAtPoint(const wxWindow *derived, - const wxPoint& pt, - wxHelpEvent::Origin origin) const; -#endif // wxUSE_HELP - -private: - // the number of elements in major dimension (i.e. number of columns if - // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also - // the number of rows/columns calculated from it - unsigned int m_majorDim, - m_numCols, - m_numRows; - -#if wxUSE_TOOLTIPS - // array of tooltips for the individual items - // - // this array is initially NULL and initialized on first use - wxToolTipArray *m_itemsTooltips; -#endif - -#if wxUSE_HELP - // help text associated with a particular item or empty string if none - wxArrayString m_itemsHelpTexts; -#endif // wxUSE_HELP -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/radiobox.h" -#elif defined(__WXMSW__) - #include "wx/msw/radiobox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/radiobox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/radiobox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/radiobox.h" -#elif defined(__WXMAC__) - #include "wx/mac/radiobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobox.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobox.h" -#endif - -#endif // wxUSE_RADIOBOX - -#endif // _WX_RADIOBOX_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/radiobut.h b/Source/3rdParty/wx/include/wx/radiobut.h deleted file mode 100644 index 2543ea8dc..000000000 --- a/Source/3rdParty/wx/include/wx/radiobut.h +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/radiobut.h -// Purpose: wxRadioButton declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.09.00 -// RCS-ID: $Id: radiobut.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBUT_H_BASE_ -#define _WX_RADIOBUT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_RADIOBTN - -/* - There is no wxRadioButtonBase class as wxRadioButton interface is the same - as wxCheckBox(Base), but under some platforms wxRadioButton really - derives from wxCheckBox and on the others it doesn't. - - The pseudo-declaration of wxRadioButtonBase would look like this: - - class wxRadioButtonBase : public ... - { - public: - virtual void SetValue(bool value); - virtual bool GetValue() const; - }; - */ - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxRadioButtonNameStr[]; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/radiobut.h" -#elif defined(__WXMSW__) - #include "wx/msw/radiobut.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/radiobut.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/radiobut.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/radiobut.h" -#elif defined(__WXMAC__) - #include "wx/mac/radiobut.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobut.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobut.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobut.h" -#endif - -#endif // wxUSE_RADIOBTN - -#endif - // _WX_RADIOBUT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/rawbmp.h b/Source/3rdParty/wx/include/wx/rawbmp.h deleted file mode 100644 index c46028526..000000000 --- a/Source/3rdParty/wx/include/wx/rawbmp.h +++ /dev/null @@ -1,713 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/rawbmp.h -// Purpose: macros for fast, raw bitmap data access -// Author: Eric Kidd, Vadim Zeitlin -// Modified by: -// Created: 10.03.03 -// RCS-ID: $Id: rawbmp.h 41661 2006-10-06 16:34:45Z PC $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RAWBMP_H_BASE_ -#define _WX_RAWBMP_H_BASE_ - -#include "wx/image.h" - -// ---------------------------------------------------------------------------- -// Abstract Pixel API -// -// We need to access our raw bitmap data (1) portably and (2) efficiently. -// We do this using a two-dimensional "iteration" interface. Performance -// is extremely important here: these functions will be called hundreds -// of thousands of times in a row, and even small inefficiencies will -// make applications seem slow. -// -// We can't always rely on inline functions, because not all compilers actually -// bother to inline them unless we crank the optimization levels way up. -// Therefore, we also provide macros to wring maximum speed out of compiler -// unconditionally (e.g. even in debug builds). Of course, if the performance -// isn't absolutely crucial for you you shouldn't be using them but the inline -// functions instead. -// ---------------------------------------------------------------------------- - -/* - Usage example: - - typedef wxPixelData PixelData; - - wxBitmap bmp; - PixelData data(bmp); - if ( !data ) - { - ... raw access to bitmap data unavailable, do something else ... - return; - } - - if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) - { - ... complain: the bitmap it too small ... - return; - } - - PixelData::Iterator p(data); - - // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b - p.Offset(data, 10, 10); - - for ( int y = 0; y < 10; ++y ) - { - PixelData::Iterator rowStart = p; - - for ( int x = 0; x < 10; ++x, ++p ) - { - p.Red() = r; - p.Green() = g; - p.Blue() = b; - } - - p = rowStart; - p.OffsetY(data, 1); - } - */ - -/* - Note: we do not use WXDLLEXPORT with classes in this file because VC++ has - problems with exporting inner class defined inside a specialization of a - template class from a DLL. Besides, as all the methods are inline it's not - really necessary to put them in DLL at all. - */ - -// ---------------------------------------------------------------------------- -// wxPixelFormat -// ---------------------------------------------------------------------------- - -/* - wxPixelFormat is a template class describing the bitmap data format. It - contains the constants describing the format of pixel data, but does not - describe how the entire bitmap is stored (i.e. top-to-bottom, - bottom-to-top, ...). It is also a "traits"-like class, i.e. it only - contains some constants and maybe static methods but nothing more, so it - can be safely used without incurring any overhead as all accesses to it are - done at compile-time. - - Current limitations: we don't support RAGABA and ARAGAB formats supported - by Mac OS X. If there is sufficient interest, these classes could be - extended to deal with them. Neither do we support alpha channel having - different representation from the RGB ones (happens under QNX/Photon I - think), but again this could be achieved with some small extra effort. - - Template parameters are: - - type of a single pixel component - - size of the single pixel in bits - - indices of red, green and blue pixel components inside the pixel - - index of the alpha component or -1 if none - - type which can contain the full pixel value (all channels) - */ - -template - -struct wxPixelFormat -{ - // iterator over pixels is usually of type "ChannelType *" - typedef Channel ChannelType; - - // the type which may hold the entire pixel value - typedef Pixel PixelType; - - // NB: using static ints initialized inside the class declaration is not - // portable as it doesn't work with VC++ 6, so we must use enums - - // size of one pixel in bits - enum { BitsPerPixel = Bpp }; - - // size of one pixel in ChannelType units (usually bytes) - enum { SizePixel = Bpp / (8 * sizeof(Channel)) }; - - // the channels indices inside the pixel - enum - { - RED = R, - GREEN = G, - BLUE = B, - ALPHA = A - }; - - // true if we have an alpha channel (together with the other channels, this - // doesn't cover the case of wxImage which stores alpha separately) - enum { HasAlpha = A != -1 }; -}; - -// some "predefined" pixel formats -// ------------------------------- - -// wxImage format is common to all platforms -typedef wxPixelFormat wxImagePixelFormat; - -// the (most common) native bitmap format without alpha support -#if defined(__WXMSW__) - // under MSW the RGB components are reversed, they're in BGR order - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXMAC__) - // under Mac, first component is unused but still present, hence we use - // 32bpp, not 24 - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 0 -#elif defined(__WXCOCOA__) - // Cocoa is standard RGB or RGBA (normally it is RGBA) - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXGTK__) - // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#endif - -// the (most common) native format for bitmaps with alpha channel -#ifdef wxPIXEL_FORMAT_ALPHA - typedef wxPixelFormat wxAlphaPixelFormat; -#endif // wxPIXEL_FORMAT_ALPHA - -// we also define the (default/best) pixel format for the given class: this is -// used as default value for the pixel format in wxPixelIterator template -template struct wxPixelFormatFor; - -#if wxUSE_IMAGE -// wxPixelFormatFor is only defined for wxImage, attempt to use it with other -// classes (wxBitmap...) will result in compile errors which is exactly what we -// want -template <> -struct wxPixelFormatFor -{ - typedef wxImagePixelFormat Format; -}; -#endif //wxUSE_IMAGE - -// ---------------------------------------------------------------------------- -// wxPixelData -// ---------------------------------------------------------------------------- - -/* - wxPixelDataBase is just a helper for wxPixelData: it contains things common - to both wxImage and wxBitmap specializations. - */ -class wxPixelDataBase -{ -public: - // origin of the rectangular region we represent - wxPoint GetOrigin() const { return m_ptOrigin; } - - // width and height of the region we represent - int GetWidth() const { return m_width; } - int GetHeight() const { return m_height; } - - wxSize GetSize() const { return wxSize(m_width, m_height); } - - // the distance between two rows - int GetRowStride() const { return m_stride; } - -// private: -- see comment in the beginning of the file - - // the origin of this image inside the bigger bitmap (usually (0, 0)) - wxPoint m_ptOrigin; - - // the size of the image we address, in pixels - int m_width, - m_height; - - // this parameter is the offset of the start of the (N+1)st row from the - // Nth one and can be different from m_bypp*width in some cases: - // a) the most usual one is to force 32/64 bit alignment of rows - // b) another one is for bottom-to-top images where it's negative - // c) finally, it could conceivably be 0 for the images with all - // lines being identical - int m_stride; - -protected: - // ctor is protected because this class is only meant to be used as the - // base class by wxPixelData - wxPixelDataBase() - { - m_width = - m_height = - m_stride = 0; - } -}; - -/* - wxPixelData represents the entire bitmap data, i.e. unlike - wxPixelFormat (which it uses) it also stores the global bitmap - characteristics such as its size, inter-row separation and so on. - - Because of this it can be used to move the pixel iterators (which don't - have enough information about the bitmap themselves). This may seem a bit - unnatural but must be done in this way to keep the iterator objects as - small as possible for maximum efficiency as otherwise they wouldn't be put - into the CPU registers by the compiler any more. - - Implementation note: we use the standard workaround for lack of partial - template specialization support in VC (both 6 and 7): instead of partly - specializing the class Foo for some T we introduce FooOut and - FooIn nested in it, make Foo equivalent to FooOut::FooIn and - fully specialize FooOut. - - Also note that this class doesn't have any default definition because we - can't really do anything without knowing the exact image class. We do - provide wxPixelDataBase to make it simpler to write new wxPixelData - specializations. - */ - -// we need to define this skeleton template to mollify VC++ -template -struct wxPixelDataOut -{ - template - class wxPixelDataIn - { - public: - class Iterator { }; - }; -}; - -#if wxUSE_IMAGE -// wxPixelData specialization for wxImage: this is the simplest case as we -// don't have to care about different pixel formats here -template <> -struct wxPixelDataOut -{ - // NB: this is a template class even though it doesn't use its template - // parameter because otherwise wxPixelData couldn't compile - template - class wxPixelDataIn : public wxPixelDataBase - { - public: - // the type of the class we're working with - typedef wxImage ImageType; - - // the iterator which should be used for working with data in this - // format - class Iterator - { - public: - // the pixel format we use - typedef wxImagePixelFormat PixelFormat; - - // the type of the pixel components - typedef typename dummyPixelFormat::ChannelType ChannelType; - - // the pixel data we're working with - typedef - wxPixelDataOut::wxPixelDataIn PixelData; - - // go back to (0, 0) - void Reset(const PixelData& data) - { - *this = data.GetPixels(); - } - - // creates the iterator pointing to the beginning of data - Iterator(PixelData& data) - { - Reset(data); - } - - // creates the iterator initially pointing to the image origin - Iterator(const wxImage& image) - { - m_pRGB = image.GetData(); - - if ( image.HasAlpha() ) - { - m_pAlpha = image.GetAlpha(); - } - else // alpha is not used at all - { - m_pAlpha = NULL; - } - } - - // true if the iterator is valid - bool IsOk() const { return m_pRGB != NULL; } - - - // navigation - // ---------- - - // advance the iterator to the next pixel, prefix version - Iterator& operator++() - { - m_pRGB += PixelFormat::SizePixel; - if ( m_pAlpha ) - ++m_pAlpha; - - return *this; - } - - // postfix (hence less efficient -- don't use it unless you - // absolutely must) version - Iterator operator++(int) - { - Iterator p(*this); - ++*this; - return p; - } - - // move x pixels to the right and y down - // - // note that the rows don't wrap! - void Offset(const PixelData& data, int x, int y) - { - m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; - if ( m_pAlpha ) - m_pAlpha += data.GetWidth() + x; - } - - // move x pixels to the right (again, no row wrapping) - void OffsetX(const PixelData& WXUNUSED(data), int x) - { - m_pRGB += PixelFormat::SizePixel*x; - if ( m_pAlpha ) - m_pAlpha += x; - } - - // move y rows to the bottom - void OffsetY(const PixelData& data, int y) - { - m_pRGB += data.GetRowStride()*y; - if ( m_pAlpha ) - m_pAlpha += data.GetWidth(); - } - - // go to the given position - void MoveTo(const PixelData& data, int x, int y) - { - Reset(data); - Offset(data, x, y); - } - - - // data access - // ----------- - - // access to invidividual colour components - ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } - ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } - ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } - ChannelType& Alpha() { return *m_pAlpha; } - - // private: -- see comment in the beginning of the file - - // pointer into RGB buffer - unsigned char *m_pRGB; - - // pointer into alpha buffer or NULL if alpha isn't used - unsigned char *m_pAlpha; - }; - - // initializes us with the data of the given image - wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image) - { - m_width = image.GetWidth(); - m_height = image.GetHeight(); - m_stride = Iterator::SizePixel * m_width; - } - - // initializes us with the given region of the specified image - wxPixelDataIn(ImageType& image, - const wxPoint& pt, - const wxSize& sz) : m_image(image), m_pixels(image) - { - m_stride = Iterator::SizePixel * m_width; - - InitRect(pt, sz); - } - - // initializes us with the given region of the specified image - wxPixelDataIn(ImageType& image, - const wxRect& rect) : m_image(image), m_pixels(image) - { - m_stride = Iterator::SizePixel * m_width; - - InitRect(rect.GetPosition(), rect.GetSize()); - } - - // we evaluate to true only if we could get access to bitmap data - // successfully - operator bool() const { return m_pixels.IsOk(); } - - // get the iterator pointing to the origin - Iterator GetPixels() const { return m_pixels; } - - private: - void InitRect(const wxPoint& pt, const wxSize& sz) - { - m_width = sz.x; - m_height = sz.y; - - m_ptOrigin = pt; - m_pixels.Offset(*this, pt.x, pt.y); - } - - // the image we're working with - ImageType& m_image; - - // the iterator pointing to the image origin - Iterator m_pixels; - }; -}; -#endif //wxUSE_IMAGE - -#if wxUSE_GUI -// wxPixelData specialization for wxBitmap: here things are more interesting as -// we also have to support different pixel formats -template <> -struct wxPixelDataOut -{ - template - class wxPixelDataIn : public wxPixelDataBase - { - public: - // the type of the class we're working with - typedef wxBitmap ImageType; - - class Iterator - { - public: - // the pixel format we use - typedef Format PixelFormat; - - // the type of the pixel components - typedef typename PixelFormat::ChannelType ChannelType; - - // the pixel data we're working with - typedef wxPixelDataOut::wxPixelDataIn PixelData; - - - // go back to (0, 0) - void Reset(const PixelData& data) - { - *this = data.GetPixels(); - } - - // initializes the iterator to point to the origin of the given - // pixel data - Iterator(PixelData& data) - { - Reset(data); - } - - // initializes the iterator to point to the origin of the given - // bitmap - Iterator(wxBitmap& bmp, PixelData& data) - { - // using cast here is ugly but it should be safe as - // GetRawData() real return type should be consistent with - // BitsPerPixel (which is in turn defined by ChannelType) and - // this is the only thing we can do without making GetRawData() - // a template function which is undesirable - m_ptr = (ChannelType *) - bmp.GetRawData(data, PixelFormat::BitsPerPixel); - } - - // default constructor - Iterator() - { - m_ptr = NULL; - } - - // return true if this iterator is valid - bool IsOk() const { return m_ptr != NULL; } - - - // navigation - // ---------- - - // advance the iterator to the next pixel, prefix version - Iterator& operator++() - { - m_ptr += PixelFormat::SizePixel; - - return *this; - } - - // postfix (hence less efficient -- don't use it unless you - // absolutely must) version - Iterator operator++(int) - { - Iterator p(*this); - ++*this; - return p; - } - - // move x pixels to the right and y down - // - // note that the rows don't wrap! - void Offset(const PixelData& data, int x, int y) - { - m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x; - } - - // move x pixels to the right (again, no row wrapping) - void OffsetX(const PixelData& WXUNUSED(data), int x) - { - m_ptr += PixelFormat::SizePixel*x; - } - - // move y rows to the bottom - void OffsetY(const PixelData& data, int y) - { - m_ptr += data.GetRowStride()*y; - } - - // go to the given position - void MoveTo(const PixelData& data, int x, int y) - { - Reset(data); - Offset(data, x, y); - } - - - // data access - // ----------- - - // access to invidividual colour components - ChannelType& Red() { return m_ptr[PixelFormat::RED]; } - ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } - ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } - ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; } - - // address the pixel contents directly - // - // warning: the format is platform dependent - typename PixelFormat::PixelType& Data() - { return *(typename PixelFormat::PixelType *)m_ptr; } - - // private: -- see comment in the beginning of the file - - // for efficiency reasons this class should not have any other - // fields, otherwise it won't be put into a CPU register (as it - // should inside the inner loops) by some compilers, notably gcc - ChannelType *m_ptr; - }; - - // ctor associates this pointer with a bitmap and locks the bitmap for - // raw access, it will be unlocked only by our dtor and so these - // objects should normally be only created on the stack, i.e. have - // limited life-time - wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) - { - } - - wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) - : m_bmp(bmp), m_pixels(bmp, *this) - { - InitRect(rect.GetPosition(), rect.GetSize()); - } - - wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) - : m_bmp(bmp), m_pixels(bmp, *this) - { - InitRect(pt, sz); - } - - // we evaluate to true only if we could get access to bitmap data - // successfully - operator bool() const { return m_pixels.IsOk(); } - - // get the iterator pointing to the origin - Iterator GetPixels() const { return m_pixels; } - - // dtor unlocks the bitmap - ~wxPixelDataIn() - { - m_bmp.UngetRawData(*this); - } - - // call this to indicate that we should use the alpha channel - void UseAlpha() { m_bmp.UseAlpha(); } - - // private: -- see comment in the beginning of the file - - // the bitmap we're associated with - wxBitmap m_bmp; - - // the iterator pointing to the image origin - Iterator m_pixels; - - private: - void InitRect(const wxPoint& pt, const wxSize& sz) - { - m_pixels.Offset(*this, pt.x, pt.y); - - m_ptOrigin = pt; - m_width = sz.x; - m_height = sz.y; - } - }; -}; -#endif //wxUSE_GUI - -template > -class wxPixelData : - public wxPixelDataOut::template wxPixelDataIn -{ -public: - typedef - typename wxPixelDataOut::template wxPixelDataIn - Base; - - wxPixelData(Image& image) : Base(image) { } - - wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { } - - wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz) - : Base(i, pt, sz) - { - } -}; - - -// some "predefined" pixel data classes -#if wxUSE_IMAGE -typedef wxPixelData wxImagePixelData; -#endif //wxUSE_IMAGE -#if wxUSE_GUI -typedef wxPixelData wxNativePixelData; -typedef wxPixelData wxAlphaPixelData; - -#endif //wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxPixelIterator -// ---------------------------------------------------------------------------- - -/* - wxPixel::Iterator represents something which points to the pixel data and - allows us to iterate over it. In the simplest case of wxBitmap it is, - indeed, just a pointer, but it can be something more complicated and, - moreover, you are free to specialize it for other image classes and bitmap - formats. - - Note that although it would have been much more intuitive to have a real - class here instead of what we have now, this class would need two template - parameters, and this can't be done because we'd need compiler support for - partial template specialization then and neither VC6 nor VC7 provide it. - */ -template < class Image, class PixelFormat = wxPixelFormatFor > -struct wxPixelIterator : public wxPixelData::Iterator -{ -}; - -#endif // _WX_RAWBMP_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/recguard.h b/Source/3rdParty/wx/include/wx/recguard.h deleted file mode 100644 index 045c27b26..000000000 --- a/Source/3rdParty/wx/include/wx/recguard.h +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/recguard.h -// Purpose: declaration and implementation of wxRecursionGuard class -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.2003 -// RCS-ID: $Id: recguard.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RECGUARD_H_ -#define _WX_RECGUARD_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxRecursionGuardFlag is used with wxRecursionGuard -// ---------------------------------------------------------------------------- - -typedef int wxRecursionGuardFlag; - -// ---------------------------------------------------------------------------- -// wxRecursionGuard is the simplest way to protect a function from reentrancy -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRecursionGuard -{ -public: - wxRecursionGuard(wxRecursionGuardFlag& flag) - : m_flag(flag) - { - m_isInside = flag++ != 0; - } - - ~wxRecursionGuard() - { - wxASSERT_MSG( m_flag > 0, wxT("unbalanced wxRecursionGuards!?") ); - - m_flag--; - } - - bool IsInside() const { return m_isInside; } - -private: - wxRecursionGuardFlag& m_flag; - - // true if the flag had been already set when we were created - bool m_isInside; -}; - -#endif // _WX_RECGUARD_H_ - diff --git a/Source/3rdParty/wx/include/wx/regex.h b/Source/3rdParty/wx/include/wx/regex.h deleted file mode 100644 index 87f319126..000000000 --- a/Source/3rdParty/wx/include/wx/regex.h +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/regex.h -// Purpose: regular expression matching -// Author: Karsten Ballueder -// Modified by: VZ at 13.07.01 (integrated to wxWin) -// Created: 05.02.2000 -// RCS-ID: $Id: regex.h 57779 2009-01-02 17:35:16Z PC $ -// Copyright: (c) 2000 Karsten Ballueder -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_REGEX_H_ -#define _WX_REGEX_H_ - -#include "wx/defs.h" - -#if wxUSE_REGEX - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// flags for regex compilation: these can be used with Compile() -enum -{ - // use extended regex syntax - wxRE_EXTENDED = 0, - - // use advanced RE syntax (built-in regex only) -#ifdef wxHAS_REGEX_ADVANCED - wxRE_ADVANCED = 1, -#endif - - // use basic RE syntax - wxRE_BASIC = 2, - - // ignore case in match - wxRE_ICASE = 4, - - // only check match, don't set back references - wxRE_NOSUB = 8, - - // if not set, treat '\n' as an ordinary character, otherwise it is - // special: it is not matched by '.' and '^' and '$' always match - // after/before it regardless of the setting of wxRE_NOT[BE]OL - wxRE_NEWLINE = 16, - - // default flags - wxRE_DEFAULT = wxRE_EXTENDED -}; - -// flags for regex matching: these can be used with Matches() -// -// these flags are mainly useful when doing several matches in a long string, -// they can be used to prevent erroneous matches for '^' and '$' -enum -{ - // '^' doesn't match at the start of line - wxRE_NOTBOL = 32, - - // '$' doesn't match at the end of line - wxRE_NOTEOL = 64 -}; - -// ---------------------------------------------------------------------------- -// wxRegEx: a regular expression -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxRegExImpl; - -class WXDLLIMPEXP_BASE wxRegEx -{ -public: - // default ctor: use Compile() later - wxRegEx() { Init(); } - - // create and compile - wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT) - { - Init(); - (void)Compile(expr, flags); - } - - // return true if this is a valid compiled regular expression - bool IsValid() const { return m_impl != NULL; } - - // compile the string into regular expression, return true if ok or false - // if string has a syntax error - bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT); - - // matches the precompiled regular expression against a string, return - // true if matches and false otherwise - // - // flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL - // len may be the length of text (ignored by most system regex libs) - // - // may only be called after successful call to Compile() - bool Matches(const wxChar *text, int flags = 0) const; - bool Matches(const wxChar *text, int flags, size_t len) const; - bool Matches(const wxString& text, int flags = 0) const - { return Matches(text.c_str(), flags, text.length()); } - - // get the start index and the length of the match of the expression - // (index 0) or a bracketed subexpression (index != 0) - // - // may only be called after successful call to Matches() - // - // return false if no match or on error - bool GetMatch(size_t *start, size_t *len, size_t index = 0) const; - - // return the part of string corresponding to the match, empty string is - // returned if match failed - // - // may only be called after successful call to Matches() - wxString GetMatch(const wxString& text, size_t index = 0) const; - - // return the size of the array of matches, i.e. the number of bracketed - // subexpressions plus one for the expression itself, or 0 on error. - // - // may only be called after successful call to Compile() - size_t GetMatchCount() const; - - // replaces the current regular expression in the string pointed to by - // pattern, with the text in replacement and return number of matches - // replaced (maybe 0 if none found) or -1 on error - // - // the replacement text may contain backreferences (\number) which will be - // replaced with the value of the corresponding subexpression in the - // pattern match - // - // maxMatches may be used to limit the number of replacements made, setting - // it to 1, for example, will only replace first occurence (if any) of the - // pattern in the text while default value of 0 means replace all - int Replace(wxString *text, const wxString& replacement, - size_t maxMatches = 0) const; - - // replace the first occurence - int ReplaceFirst(wxString *text, const wxString& replacement) const - { return Replace(text, replacement, 1); } - - // replace all occurences: this is actually a synonym for Replace() - int ReplaceAll(wxString *text, const wxString& replacement) const - { return Replace(text, replacement, 0); } - - // dtor not virtual, don't derive from this class - ~wxRegEx(); - -private: - // common part of all ctors - void Init(); - - // the real guts of this class - wxRegExImpl *m_impl; - - // as long as the class wxRegExImpl is not ref-counted, - // instances of the handle wxRegEx must not be copied. - wxRegEx(const wxRegEx&); - wxRegEx &operator=(const wxRegEx&); -}; - -#endif // wxUSE_REGEX - -#endif // _WX_REGEX_H_ - diff --git a/Source/3rdParty/wx/include/wx/region.h b/Source/3rdParty/wx/include/wx/region.h deleted file mode 100644 index 2bbaed5e0..000000000 --- a/Source/3rdParty/wx/include/wx/region.h +++ /dev/null @@ -1,300 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/region.h -// Purpose: Base header for wxRegion -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: region.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_REGION_H_BASE_ -#define _WX_REGION_H_BASE_ - -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxRegion; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// result of wxRegion::Contains() call -enum wxRegionContain -{ - wxOutRegion = 0, - wxPartRegion = 1, - wxInRegion = 2 -}; - -// these constants are used with wxRegion::Combine() in the ports which have -// this method -enum wxRegionOp -{ - // Creates the intersection of the two combined regions. - wxRGN_AND, - - // Creates a copy of the region - wxRGN_COPY, - - // Combines the parts of first region that are not in the second one - wxRGN_DIFF, - - // Creates the union of two combined regions. - wxRGN_OR, - - // Creates the union of two regions except for any overlapping areas. - wxRGN_XOR -}; - -// ---------------------------------------------------------------------------- -// wxRegionBase defines wxRegion API -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRegionBase : public wxGDIObject -{ -public: - // ctors - // ----- - - // none are defined here but the following should be available: -#if 0 - wxRegion(); - wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRegion(const wxRect& rect); - wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE); - wxRegion(const wxBitmap& bmp); - wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); -#endif // 0 - - // operators - // --------- - - bool operator==(const wxRegion& region) const { return IsEqual(region); } - bool operator!=(const wxRegion& region) const { return !(*this == region); } - - - // accessors - // --------- - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // Is region empty? - virtual bool IsEmpty() const = 0; - bool Empty() const { return IsEmpty(); } - - // Is region equal (i.e. covers the same area as another one)? - bool IsEqual(const wxRegion& region) const; - - // Get the bounding box - bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const - { return DoGetBox(x, y, w, h); } - wxRect GetBox() const - { - wxCoord x, y, w, h; - return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect(); - } - - // Test if the given point or rectangle is inside this region - wxRegionContain Contains(wxCoord x, wxCoord y) const - { return DoContainsPoint(x, y); } - wxRegionContain Contains(const wxPoint& pt) const - { return DoContainsPoint(pt.x, pt.y); } - wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const - { return DoContainsRect(wxRect(x, y, w, h)); } - wxRegionContain Contains(const wxRect& rect) const - { return DoContainsRect(rect); } - - - // operations - // ---------- - - virtual void Clear() = 0; - - // Move the region - bool Offset(wxCoord x, wxCoord y) - { return DoOffset(x, y); } - bool Offset(const wxPoint& pt) - { return DoOffset(pt.x, pt.y); } - - // Union rectangle or region with this region. - bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { return DoUnionWithRect(wxRect(x, y, w, h)); } - bool Union(const wxRect& rect) - { return DoUnionWithRect(rect); } - bool Union(const wxRegion& region) - { return DoUnionWithRegion(region); } - -#if wxUSE_IMAGE - // Use the non-transparent pixels of a wxBitmap for the region to combine - // with this region. First version takes transparency from bitmap's mask, - // second lets the user specify the colour to be treated as transparent - // along with an optional tolerance value. - // NOTE: implemented in common/rgncmn.cpp - bool Union(const wxBitmap& bmp); - bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); -#endif // wxUSE_IMAGE - - // Intersect rectangle or region with this one. - bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Intersect(const wxRect& rect); - bool Intersect(const wxRegion& region) - { return DoIntersect(region); } - - // Subtract rectangle or region from this: - // Combines the parts of 'this' that are not part of the second region. - bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Subtract(const wxRect& rect); - bool Subtract(const wxRegion& region) - { return DoSubtract(region); } - - // XOR: the union of two combined regions except for any overlapping areas. - bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Xor(const wxRect& rect); - bool Xor(const wxRegion& region) - { return DoXor(region); } - - - // Convert the region to a B&W bitmap with the white pixels being inside - // the region. - wxBitmap ConvertToBitmap() const; - -protected: - virtual bool DoIsEqual(const wxRegion& region) const = 0; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0; - - virtual bool DoOffset(wxCoord x, wxCoord y) = 0; - - virtual bool DoUnionWithRect(const wxRect& rect) = 0; - virtual bool DoUnionWithRegion(const wxRegion& region) = 0; - - virtual bool DoIntersect(const wxRegion& region) = 0; - virtual bool DoSubtract(const wxRegion& region) = 0; - virtual bool DoXor(const wxRegion& region) = 0; -}; - -// some ports implement a generic Combine() function while others only -// implement individual wxRegion operations, factor out the common code for the -// ports with Combine() in this class -#if defined(__WXPALMOS__) || \ - defined(__WXMSW__) || \ - defined(__WXMAC__) || \ - defined(__WXPM__) - -#define wxHAS_REGION_COMBINE - -class WXDLLEXPORT wxRegionWithCombine : public wxRegionBase -{ -public: - // these methods are not part of public API as they're not implemented on - // all ports - bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op); - bool Combine(const wxRect& rect, wxRegionOp op); - bool Combine(const wxRegion& region, wxRegionOp op) - { return DoCombine(region, op); } - - -protected: - // the real Combine() method, to be defined in the derived class - virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0; - - // implement some wxRegionBase pure virtuals in terms of Combine() - virtual bool DoUnionWithRect(const wxRect& rect); - virtual bool DoUnionWithRegion(const wxRegion& region); - virtual bool DoIntersect(const wxRegion& region); - virtual bool DoSubtract(const wxRegion& region); - virtual bool DoXor(const wxRegion& region); -}; - -#endif // ports with wxRegion::Combine() - -#if defined(__WXPALMOS__) - #include "wx/palmos/region.h" -#elif defined(__WXMSW__) - #include "wx/msw/region.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/region.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/region.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) - #include "wx/x11/region.h" -#elif defined(__WXMGL__) - #include "wx/mgl/region.h" -#elif defined(__WXDFB__) - #include "wx/dfb/region.h" -#elif defined(__WXMAC__) - #include "wx/mac/region.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/region.h" -#elif defined(__WXPM__) - #include "wx/os2/region.h" -#endif - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -// NB: these functions couldn't be defined in the class declaration as they use -// wxRegion and so can be only defined after including the header declaring -// the real class - -inline bool wxRegionBase::Intersect(const wxRect& rect) -{ - return DoIntersect(wxRegion(rect)); -} - -inline bool wxRegionBase::Subtract(const wxRect& rect) -{ - return DoSubtract(wxRegion(rect)); -} - -inline bool wxRegionBase::Xor(const wxRect& rect) -{ - return DoXor(wxRegion(rect)); -} - -// ...and these functions are here because they call the ones above, and its -// not really proper to call an inline function before its defined inline. - -inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Intersect(wxRect(x, y, w, h)); -} - -inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Subtract(wxRect(x, y, w, h)); -} - -inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Xor(wxRect(x, y, w, h)); -} - -#ifdef wxHAS_REGION_COMBINE - -inline bool wxRegionWithCombine::Combine(wxCoord x, - wxCoord y, - wxCoord w, - wxCoord h, - wxRegionOp op) -{ - return DoCombine(wxRegion(x, y, w, h), op); -} - -inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op) -{ - return DoCombine(wxRegion(rect), op); -} - -#endif // wxHAS_REGION_COMBINE - -#endif // _WX_REGION_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/renderer.h b/Source/3rdParty/wx/include/wx/renderer.h deleted file mode 100644 index b28ec8531..000000000 --- a/Source/3rdParty/wx/include/wx/renderer.h +++ /dev/null @@ -1,436 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/renderer.h -// Purpose: wxRendererNative class declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.07.2003 -// RCS-ID: $Id: renderer.h 53667 2008-05-20 09:28:48Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Renderers are used in wxWidgets for two similar but different things: - (a) wxUniversal uses them to draw everything, i.e. all the control - (b) all the native ports use them to draw generic controls only - - wxUniversal needs more functionality than what is included in the base class - as it needs to draw stuff like scrollbars which are never going to be - generic. So we put the bare minimum needed by the native ports here and the - full wxRenderer class is declared in wx/univ/renderer.h and is only used by - wxUniveral (although note that native ports can load wxRenderer objects from - theme DLLs and use them as wxRendererNative ones, of course). - */ - -#ifndef _WX_RENDERER_H_ -#define _WX_RENDERER_H_ - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -#include "wx/gdicmn.h" // for wxPoint -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/bitmap.h" -#include "wx/string.h" - -// some platforms have their own renderers, others use the generic one -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__) - #define wxHAS_NATIVE_RENDERER -#else - #undef wxHAS_NATIVE_RENDERER -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// control state flags used in wxRenderer and wxColourScheme -enum -{ - wxCONTROL_DISABLED = 0x00000001, // control is disabled - wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus - wxCONTROL_PRESSED = 0x00000004, // (button) is pressed - wxCONTROL_SPECIAL = 0x00000008, // control-specific bit: - wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons - wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items - wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items - wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes - wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control - wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox - wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked - wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked - wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state - - wxCONTROL_FLAGS_MASK = 0x000000ff, - - // this is a pseudo flag not used directly by wxRenderer but rather by some - // controls internally - wxCONTROL_DIRTY = 0x80000000 -}; - -// ---------------------------------------------------------------------------- -// helper structs -// ---------------------------------------------------------------------------- - -// wxSplitterWindow parameters -struct WXDLLEXPORT wxSplitterRenderParams -{ - // the only way to initialize this struct is by using this ctor - wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_) - : widthSash(widthSash_), border(border_), isHotSensitive(isSens_) - { - } - - // the width of the splitter sash - const wxCoord widthSash; - - // the width of the border of the splitter window - const wxCoord border; - - // true if the splitter changes its appearance when the mouse is over it - const bool isHotSensitive; -}; - - -// extra optional parameters for DrawHeaderButton -struct WXDLLEXPORT wxHeaderButtonParams -{ - wxHeaderButtonParams() - : m_labelAlignment(wxALIGN_LEFT) - { } - - wxColour m_arrowColour; - wxColour m_selectionColour; - wxString m_labelText; - wxFont m_labelFont; - wxColour m_labelColour; - wxBitmap m_labelBitmap; - int m_labelAlignment; -}; - -enum wxHeaderSortIconType { - wxHDR_SORT_ICON_NONE, // Header button has no sort arrow - wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon - wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon -}; - - -// wxRendererNative interface version -struct WXDLLEXPORT wxRendererVersion -{ - wxRendererVersion(int version_, int age_) : version(version_), age(age_) { } - - // default copy ctor, assignment operator and dtor are ok - - // the current version and age of wxRendererNative interface: different - // versions are incompatible (in both ways) while the ages inside the same - // version are upwards compatible, i.e. the version of the renderer must - // match the version of the main program exactly while the age may be - // highergreater or equal to it - // - // NB: don't forget to increment age after adding any new virtual function! - enum - { - Current_Version = 1, - Current_Age = 5 - }; - - - // check if the given version is compatible with the current one - static bool IsCompatible(const wxRendererVersion& ver) - { - return ver.version == Current_Version && ver.age >= Current_Age; - } - - const int version; - const int age; -}; - -// ---------------------------------------------------------------------------- -// wxRendererNative: abstracts drawing methods needed by the native controls -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRendererNative -{ -public: - // drawing functions - // ----------------- - - // draw the header control button (used by wxListCtrl) Returns optimal - // width for the label contents. - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; - - - // Draw the contents of a header control button (label, sort arrows, etc.) - // Normally only called by DrawHeaderButton. - virtual int DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; - - // Returns the default height of a header button, either a fixed platform - // height if available, or a generic height based on the window's font. - virtual int GetHeaderButtonHeight(wxWindow *win) = 0; - - - // draw the expanded/collapsed icon for a tree control item - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw the border for sash window: this border must be such that the sash - // drawn by DrawSash() blends into it well - virtual void DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw a (vertical) sash - virtual void DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position, - wxOrientation orient, - int flags = 0) = 0; - - // draw a combobox dropdown button - // - // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT - virtual void DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw a dropdown arrow - // - // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT - virtual void DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw check button - // - // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT - virtual void DrawCheckBox(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw blank button - // - // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT - virtual void DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw rectangle indicating that an item in e.g. a list control - // has been selected or focused - // - // flags may use - // wxCONTROL_SELECTED (item is selected, e.g. draw background) - // wxCONTROL_CURRENT (item is the current item, e.g. dotted border) - // wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise) - virtual void DrawItemSelectionRect(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // geometry functions - // ------------------ - - // get the splitter parameters: the x field of the returned point is the - // sash width and the y field is the border width - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0; - - - // pseudo constructors - // ------------------- - - // return the currently used renderer - static wxRendererNative& Get(); - - // return the generic implementation of the renderer - static wxRendererNative& GetGeneric(); - - // return the default (native) implementation for this platform - static wxRendererNative& GetDefault(); - - - // changing the global renderer - // ---------------------------- - -#if wxUSE_DYNLIB_CLASS - // load the renderer from the specified DLL, the returned pointer must be - // deleted by caller if not NULL when it is not used any more - static wxRendererNative *Load(const wxString& name); -#endif // wxUSE_DYNLIB_CLASS - - // set the renderer to use, passing NULL reverts to using the default - // renderer - // - // return the previous renderer used with Set() or NULL if none - static wxRendererNative *Set(wxRendererNative *renderer); - - - // miscellaneous stuff - // ------------------- - - // this function is used for version checking: Load() refuses to load any - // DLLs implementing an older or incompatible version; it should be - // implemented simply by returning wxRendererVersion::Current_XXX values - virtual wxRendererVersion GetVersion() const = 0; - - // virtual dtor for any base class - virtual ~wxRendererNative(); -}; - -// ---------------------------------------------------------------------------- -// wxDelegateRendererNative: allows reuse of renderers code -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative -{ -public: - wxDelegateRendererNative() - : m_rendererNative(GetGeneric()) { } - - wxDelegateRendererNative(wxRendererNative& rendererNative) - : m_rendererNative(rendererNative) { } - - - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) - { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } - - virtual int DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) - { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } - - virtual int GetHeaderButtonHeight(wxWindow *win) - { return m_rendererNative.GetHeaderButtonHeight(win); } - - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); } - - virtual void DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); } - - virtual void DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position, - wxOrientation orient, - int flags = 0) - { m_rendererNative.DrawSplitterSash(win, dc, size, - position, orient, flags); } - - virtual void DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); } - - virtual void DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawDropArrow(win, dc, rect, flags); } - - virtual void DrawCheckBox(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } - - virtual void DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } - - virtual void DrawItemSelectionRect(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } - - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) - { return m_rendererNative.GetSplitterParams(win); } - - virtual wxRendererVersion GetVersion() const - { return m_rendererNative.GetVersion(); } - -protected: - wxRendererNative& m_rendererNative; - - DECLARE_NO_COPY_CLASS(wxDelegateRendererNative) -}; - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -#ifndef wxHAS_NATIVE_RENDERER - -// default native renderer is the generic one then -/* static */ inline -wxRendererNative& wxRendererNative::GetDefault() -{ - return GetGeneric(); -} - -#endif // !wxHAS_NATIVE_RENDERER - - -// ---------------------------------------------------------------------------- -// Other renderer functions to be merged in to wxRenderer class in 2.9, but -// they are standalone functions here to protect the ABI. -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) -#if wxABI_VERSION >= 20808 - -// Draw a native wxChoice -void WXDLLEXPORT wxRenderer_DrawChoice(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxComboBox -void WXDLLEXPORT wxRenderer_DrawComboBox(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxTextCtrl frame -void WXDLLEXPORT wxRenderer_DrawTextCtrl(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxRadioButton (just the graphical portion) -void WXDLLEXPORT wxRenderer_DrawRadioButton(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); -#endif // wxABI_VERSION -#endif // (platforms) - -#endif // _WX_RENDERER_H_ diff --git a/Source/3rdParty/wx/include/wx/scopeguard.h b/Source/3rdParty/wx/include/wx/scopeguard.h deleted file mode 100644 index 2517e86e4..000000000 --- a/Source/3rdParty/wx/include/wx/scopeguard.h +++ /dev/null @@ -1,373 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/scopeguard.h -// Purpose: declares wxwxScopeGuard and related macros -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.07.2003 -// RCS-ID: $Id: scopeguard.h 44111 2007-01-07 13:28:16Z SN $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Acknowledgements: this header is heavily based on (well, almost the exact - copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published - in December 2000 issue of C/C++ Users Journal. - http://www.cuj.com/documents/cujcexp1812alexandr/ - */ - -#ifndef _WX_SCOPEGUARD_H_ -#define _WX_SCOPEGUARD_H_ - -#include "wx/defs.h" - -#include "wx/except.h" - -// ---------------------------------------------------------------------------- -// helpers -// ---------------------------------------------------------------------------- - -#ifdef __WATCOMC__ - -// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created -// through template so it must be workarounded with dedicated inlined macro. -// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be -// replaced with wxPrivateOnScopeExit but in user code (for everyone who -// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works. - -#define wxPrivateOnScopeExit(guard) \ - { \ - if ( !(guard).WasDismissed() ) \ - { \ - wxTRY \ - { \ - (guard).Execute(); \ - } \ - wxCATCH_ALL(;) \ - } \ - } - -#define wxPrivateUse(n) wxUnusedVar(n) - -#else - -#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) -// namespace support was first implemented in gcc-2.95, -// so avoid using it for older versions. -namespace wxPrivate -{ -#else -#define wxPrivate -#endif - // in the original implementation this was a member template function of - // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't - // support member templates and so we must make it global - template - void OnScopeExit(ScopeGuardImpl& guard) - { - if ( !guard.WasDismissed() ) - { - // we're called from ScopeGuardImpl dtor and so we must not throw - wxTRY - { - guard.Execute(); - } - wxCATCH_ALL(;) // do nothing, just eat the exception - } - } - - // just to avoid the warning about unused variables - template - void Use(const T& WXUNUSED(t)) - { - } -#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) -} // namespace wxPrivate -#endif - -#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) -#define wxPrivateUse(n) wxPrivate::Use(n) - -#endif - -// ============================================================================ -// wxScopeGuard for functions and functors -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below -// ---------------------------------------------------------------------------- - -class wxScopeGuardImplBase -{ -public: - wxScopeGuardImplBase() : m_wasDismissed(false) { } - - void Dismiss() const { m_wasDismissed = true; } - - // for OnScopeExit() only (we can't make it friend, unfortunately)! - bool WasDismissed() const { return m_wasDismissed; } - -protected: - ~wxScopeGuardImplBase() { } - - wxScopeGuardImplBase(const wxScopeGuardImplBase& other) - : m_wasDismissed(other.m_wasDismissed) - { - other.Dismiss(); - } - - // must be mutable for copy ctor to work - mutable bool m_wasDismissed; - -private: - wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&); -}; - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl0: scope guard for actions without parameters -// ---------------------------------------------------------------------------- - -template -class wxScopeGuardImpl0 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl0 MakeGuard(F fun) - { - return wxScopeGuardImpl0(fun); - } - - ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_fun(); } - -protected: - wxScopeGuardImpl0(F fun) : m_fun(fun) { } - - F m_fun; - - wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&); -}; - -template -inline wxScopeGuardImpl0 wxMakeGuard(F fun) -{ - return wxScopeGuardImpl0::MakeGuard(fun); -} - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl1: scope guard for actions with 1 parameter -// ---------------------------------------------------------------------------- - -template -class wxScopeGuardImpl1 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl1 MakeGuard(F fun, P1 p1) - { - return wxScopeGuardImpl1(fun, p1); - } - - ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); } - - void Execute() { m_fun(m_p1); } - -protected: - wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { } - - F m_fun; - const P1 m_p1; - - wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&); -}; - -template -inline wxScopeGuardImpl1 wxMakeGuard(F fun, P1 p1) -{ - return wxScopeGuardImpl1::MakeGuard(fun, p1); -} - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl2: scope guard for actions with 2 parameters -// ---------------------------------------------------------------------------- - -template -class wxScopeGuardImpl2 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl2 MakeGuard(F fun, P1 p1, P2 p2) - { - return wxScopeGuardImpl2(fun, p1, p2); - } - - ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_fun(m_p1, m_p2); } - -protected: - wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { } - - F m_fun; - const P1 m_p1; - const P2 m_p2; - - wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&); -}; - -template -inline wxScopeGuardImpl2 wxMakeGuard(F fun, P1 p1, P2 p2) -{ - return wxScopeGuardImpl2::MakeGuard(fun, p1, p2); -} - -// ============================================================================ -// wxScopeGuards for object methods -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxObjScopeGuardImpl0 -// ---------------------------------------------------------------------------- - -template -class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl0 - MakeObjGuard(Obj& obj, MemFun memFun) - { - return wxObjScopeGuardImpl0(obj, memFun); - } - - ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(); } - -protected: - wxObjScopeGuardImpl0(Obj& obj, MemFun memFun) - : m_obj(obj), m_memfun(memFun) { } - - Obj& m_obj; - MemFun m_memfun; -}; - -template -inline wxObjScopeGuardImpl0 wxMakeObjGuard(Obj& obj, MemFun memFun) -{ - return wxObjScopeGuardImpl0::MakeObjGuard(obj, memFun); -} - -template -class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl1 - MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) - { - return wxObjScopeGuardImpl1(obj, memFun, p1); - } - - ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(m_p1); } - -protected: - wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) - : m_obj(obj), m_memfun(memFun), m_p1(p1) { } - - Obj& m_obj; - MemFun m_memfun; - const P1 m_p1; -}; - -template -inline wxObjScopeGuardImpl1 -wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1) -{ - return wxObjScopeGuardImpl1::MakeObjGuard(obj, memFun, p1); -} - -template -class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl2 - MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) - { - return wxObjScopeGuardImpl2(obj, memFun, p1, p2); - } - - ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); } - -protected: - wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) - : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { } - - Obj& m_obj; - MemFun m_memfun; - const P1 m_p1; - const P2 m_p2; -}; - -template -inline wxObjScopeGuardImpl2 -wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) -{ - return wxObjScopeGuardImpl2:: - MakeObjGuard(obj, memFun, p1, p2); -} - -// ============================================================================ -// public stuff -// ============================================================================ - -// wxScopeGuard is just a reference, see the explanation in CUJ article -typedef const wxScopeGuardImplBase& wxScopeGuard; - -// when an unnamed scope guard is needed, the macros below may be used -// -// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro -// but this results in compiler warnings about unused variables and I -// didn't find a way to work around this other than by having different -// macros with different names - -#define wxGuardName wxMAKE_UNIQUE_NAME(scopeGuard) - -#define wxON_BLOCK_EXIT0_IMPL(n, f) \ - wxScopeGuard n = wxMakeGuard(f); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT0(f) \ - wxON_BLOCK_EXIT0_IMPL(wxGuardName, f) - -#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \ - wxScopeGuard n = wxMakeObjGuard(o, m); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ0(o, m) \ - wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m) - -#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \ - wxScopeGuard n = wxMakeGuard(f, p1); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT1(f, p1) \ - wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1) - -#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \ - wxScopeGuard n = wxMakeObjGuard(o, m, p1); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \ - wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1) - -#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \ - wxScopeGuard n = wxMakeGuard(f, p1, p2); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT2(f, p1, p2) \ - wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2) - -#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \ - wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \ - wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2) - -#endif // _WX_SCOPEGUARD_H_ diff --git a/Source/3rdParty/wx/include/wx/scrolbar.h b/Source/3rdParty/wx/include/wx/scrolbar.h deleted file mode 100644 index 97dab1af9..000000000 --- a/Source/3rdParty/wx/include/wx/scrolbar.h +++ /dev/null @@ -1,80 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: scrolbar.h -// Purpose: wxScrollBar base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: scrolbar.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLBAR_H_BASE_ -#define _WX_SCROLBAR_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SCROLLBAR - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxScrollBarNameStr[]; - -// ---------------------------------------------------------------------------- -// wxScrollBar: a scroll bar control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollBarBase : public wxControl -{ -public: - wxScrollBarBase() { } - - // scrollbar construction - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - // accessors - virtual int GetThumbPosition() const = 0; - virtual int GetThumbSize() const = 0; - virtual int GetPageSize() const = 0; - virtual int GetRange() const = 0; - - bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; } - - // operations - virtual void SetThumbPosition(int viewStart) = 0; - virtual void SetScrollbar(int position, int thumbSize, - int range, int pageSize, - bool refresh = true) = 0; - -private: - DECLARE_NO_COPY_CLASS(wxScrollBarBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/scrolbar.h" -#elif defined(__WXMSW__) - #include "wx/msw/scrolbar.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/scrolbar.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/scrolbar.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/scrolbar.h" -#elif defined(__WXMAC__) - #include "wx/mac/scrolbar.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/scrolbar.h" -#elif defined(__WXPM__) - #include "wx/os2/scrolbar.h" -#endif - -#endif // wxUSE_SCROLLBAR - -#endif - // _WX_SCROLBAR_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/scrolwin.h b/Source/3rdParty/wx/include/wx/scrolwin.h deleted file mode 100644 index c5d06fa1e..000000000 --- a/Source/3rdParty/wx/include/wx/scrolwin.h +++ /dev/null @@ -1,314 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/scrolwin.h -// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.08.00 -// RCS-ID: $Id: scrolwin.h 50864 2007-12-20 18:36:19Z VS $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLWIN_H_BASE_ -#define _WX_SCROLWIN_H_BASE_ - -#include "wx/panel.h" - -class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; -class WXDLLIMPEXP_FWD_CORE wxTimer; - -// default scrolled window style: scroll in both directions -#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) - -// ---------------------------------------------------------------------------- -// The hierarchy of scrolling classes is a bit complicated because we want to -// put as much functionality as possible in a mix-in class not deriving from -// wxWindow so that other classes could derive from the same base class on all -// platforms irrespectively of whether they are native controls (and hence -// don't use our scrolling) or not. -// -// So we have -// -// wxScrollHelper -// | -// | -// \|/ -// wxWindow wxScrollHelperNative -// | \ / / -// | \ / / -// | _| |_ / -// | wxScrolledWindow / -// | / -// \|/ / -// wxControl / -// \ / -// \ / -// _| |_ -// wxScrolledControl -// -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollHelper -{ -public: - // ctor must be given the associated window - wxScrollHelper(wxWindow *winToScroll); - virtual ~wxScrollHelper(); - - // configure the scrolling - virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, - int noUnitsX, int noUnitsY, - int xPos = 0, int yPos = 0, - bool noRefresh = false ); - - // scroll to the given (in logical coords) position - virtual void Scroll(int x, int y); - - // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) - int GetScrollPageSize(int orient) const; - void SetScrollPageSize(int orient, int pageSize); - - // get the number of lines the window can scroll, - // returns 0 if no scrollbars are there. - int GetScrollLines( int orient ) const; - - // Set the x, y scrolling increments. - void SetScrollRate( int xstep, int ystep ); - - // get the size of one logical unit in physical ones - virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX, - int *pixelsPerUnitY) const; - - // Enable/disable Windows scrolling in either direction. If true, wxWidgets - // scrolls the canvas and only a bit of the canvas is invalidated; no - // Clear() is necessary. If false, the whole canvas is invalidated and a - // Clear() is necessary. Disable for when the scroll increment is used to - // actually scroll a non-constant distance - virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); - - // Get the view start - virtual void GetViewStart(int *x, int *y) const; - - // Set the scale factor, used in PrepareDC - void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } - double GetScaleX() const { return m_scaleX; } - double GetScaleY() const { return m_scaleY; } - - // translate between scrolled and unscrolled coordinates - void CalcScrolledPosition(int x, int y, int *xx, int *yy) const - { DoCalcScrolledPosition(x, y, xx, yy); } - wxPoint CalcScrolledPosition(const wxPoint& pt) const - { - wxPoint p2; - DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); - return p2; - } - - void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const - { DoCalcUnscrolledPosition(x, y, xx, yy); } - wxPoint CalcUnscrolledPosition(const wxPoint& pt) const - { - wxPoint p2; - DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); - return p2; - } - - virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; - virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; - - // Adjust the scrollbars - virtual void AdjustScrollbars(void); - - // Calculate scroll increment - virtual int CalcScrollInc(wxScrollWinEvent& event); - - // Normally the wxScrolledWindow will scroll itself, but in some rare - // occasions you might want it to scroll [part of] another window (e.g. a - // child of it in order to scroll only a portion the area between the - // scrollbars (spreadsheet: only cell area will move). - virtual void SetTargetWindow(wxWindow *target); - virtual wxWindow *GetTargetWindow() const; - - void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } - wxRect GetTargetRect() const { return m_rectToScroll; } - - // Override this function to draw the graphic (or just process EVT_PAINT) - virtual void OnDraw(wxDC& WXUNUSED(dc)) { } - - // change the DC origin according to the scroll position. - virtual void DoPrepareDC(wxDC& dc); - - // are we generating the autoscroll events? - bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } - - // stop generating the scroll events when mouse is held outside the window - void StopAutoScrolling(); - - // this method can be overridden in a derived class to forbid sending the - // auto scroll events - note that unlike StopAutoScrolling() it doesn't - // stop the timer, so it will be called repeatedly and will typically - // return different values depending on the current mouse position - // - // the base class version just returns true - virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; - - // the methods to be called from the window event handlers - void HandleOnScroll(wxScrollWinEvent& event); - void HandleOnSize(wxSizeEvent& event); - void HandleOnPaint(wxPaintEvent& event); - void HandleOnChar(wxKeyEvent& event); - void HandleOnMouseEnter(wxMouseEvent& event); - void HandleOnMouseLeave(wxMouseEvent& event); -#if wxUSE_MOUSEWHEEL - void HandleOnMouseWheel(wxMouseEvent& event); -#endif // wxUSE_MOUSEWHEEL - -#if wxABI_VERSION >= 20808 - void HandleOnChildFocus(wxChildFocusEvent& event); -#endif - - // FIXME: this is needed for now for wxPlot compilation, should be removed - // once it is fixed! - void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } - -protected: - // get pointer to our scroll rect if we use it or NULL - const wxRect *GetScrollRect() const - { - return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; - } - - // get the size of the target window - wxSize GetTargetSize() const - { - return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() - : m_targetWindow->GetClientSize(); - } - - void GetTargetSize(int *w, int *h) const - { - wxSize size = GetTargetSize(); - if ( w ) - *w = size.x; - if ( h ) - *h = size.y; - } - - // implementations of various wxWindow virtual methods which should be - // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) - bool ScrollLayout(); - void ScrollDoSetVirtualSize(int x, int y); - wxSize ScrollGetBestVirtualSize() const; - wxSize ScrollGetWindowSizeForVirtualSize(const wxSize& size) const; - - // change just the target window (unlike SetWindow which changes m_win as - // well) - void DoSetTargetWindow(wxWindow *target); - - // delete the event handler we installed - void DeleteEvtHandler(); - - - double m_scaleX; - double m_scaleY; - - wxWindow *m_win, - *m_targetWindow; - - wxRect m_rectToScroll; - - wxTimer *m_timerAutoScroll; - - int m_xScrollPixelsPerLine; - int m_yScrollPixelsPerLine; - int m_xScrollPosition; - int m_yScrollPosition; - int m_xScrollLines; - int m_yScrollLines; - int m_xScrollLinesPerPage; - int m_yScrollLinesPerPage; - - bool m_xScrollingEnabled; - bool m_yScrollingEnabled; - -#if wxUSE_MOUSEWHEEL - int m_wheelRotation; -#endif // wxUSE_MOUSEWHEEL - - wxScrollHelperEvtHandler *m_handler; - - DECLARE_NO_COPY_CLASS(wxScrollHelper) -}; - -// this macro can be used in a wxScrollHelper-derived class to forward wxWindow -// methods to corresponding wxScrollHelper methods -#define WX_FORWARD_TO_SCROLL_HELPER() \ -public: \ - virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ - virtual bool Layout() { return ScrollLayout(); } \ - virtual void DoSetVirtualSize(int x, int y) \ - { ScrollDoSetVirtualSize(x, y); } \ - virtual wxSize GetBestVirtualSize() const \ - { return ScrollGetBestVirtualSize(); } \ -protected: \ - virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const \ - { return ScrollGetWindowSizeForVirtualSize(size); } - -// include the declaration of wxScrollHelperNative if needed -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/scrolwin.h" -#elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk1/scrolwin.h" -#else - typedef wxScrollHelper wxScrollHelperNative; -#endif - -// ---------------------------------------------------------------------------- -// wxScrolledWindow: a wxWindow which knows how to scroll -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrolledWindow : public wxPanel, - public wxScrollHelperNative -{ -public: - wxScrolledWindow() : wxScrollHelperNative(this) { } - wxScrolledWindow(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr) - : wxScrollHelperNative(this) - { - Create(parent, winid, pos, size, style, name); - } - - virtual ~wxScrolledWindow(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr); - - // we need to return a special WM_GETDLGCODE value to process just the - // arrows but let the other navigation characters through -#ifdef __WXMSW__ - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif // __WXMSW__ - - WX_FORWARD_TO_SCROLL_HELPER() - -protected: - // this is needed for wxEVT_PAINT processing hack described in - // wxScrollHelperEvtHandler::ProcessEvent() - void OnPaint(wxPaintEvent& event); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_SCROLWIN_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/selstore.h b/Source/3rdParty/wx/include/wx/selstore.h deleted file mode 100644 index 56b11e4af..000000000 --- a/Source/3rdParty/wx/include/wx/selstore.h +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/selstore.h -// Purpose: wxSelectionStore stores selected items in a control -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.06.03 (extracted from src/generic/listctrl.cpp) -// RCS-ID: $Id: selstore.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2000-2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SELSTORE_H_ -#define _WX_SELSTORE_H_ - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// wxSelectedIndices is just a sorted array of indices -// ---------------------------------------------------------------------------- - -inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) -{ - return (int)(n1 - n2); -} - -WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t, - wxSizeTCmpFn, - wxSelectedIndices); - -// ---------------------------------------------------------------------------- -// wxSelectionStore is used to store the selected items in the virtual -// controls, i.e. it is well suited for storing even when the control contains -// a huge (practically infinite) number of items. -// -// Of course, internally it still has to store the selected items somehow (as -// an array currently) but the advantage is that it can handle the selection -// of all items (common operation) efficiently and that it could be made even -// smarter in the future (e.g. store the selections as an array of ranges + -// individual items) without changing its API. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSelectionStore -{ -public: - wxSelectionStore() : m_itemsSel(wxSizeTCmpFn) { Init(); } - - // set the total number of items we handle - void SetItemCount(size_t count) { m_count = count; } - - // special case of SetItemCount(0) - void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } - - // must be called when a new item is inserted/added - void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); } - - // must be called when an item is deleted - void OnItemDelete(size_t item); - - // select one item, use SelectRange() insted if possible! - // - // returns true if the items selection really changed - bool SelectItem(size_t item, bool select = true); - - // select the range of items - // - // return true and fill the itemsChanged array with the indices of items - // which have changed state if "few" of them did, otherwise return false - // (meaning that too many items changed state to bother counting them - // individually) - bool SelectRange(size_t itemFrom, size_t itemTo, - bool select = true, - wxArrayInt *itemsChanged = NULL); - - // return true if the given item is selected - bool IsSelected(size_t item) const; - - // return the total number of selected items - size_t GetSelectedCount() const - { - return m_defaultState ? m_count - m_itemsSel.GetCount() - : m_itemsSel.GetCount(); - } - -private: - // (re)init - void Init() { m_defaultState = false; } - - // the total number of items we handle - size_t m_count; - - // the default state: normally, false (i.e. off) but maybe set to true if - // there are more selected items than non selected ones - this allows to - // handle selection of all items efficiently - bool m_defaultState; - - // the array of items whose selection state is different from default - wxSelectedIndices m_itemsSel; - - DECLARE_NO_COPY_CLASS(wxSelectionStore) -}; - - -#endif // _WX_SELSTORE_H_ - diff --git a/Source/3rdParty/wx/include/wx/settings.h b/Source/3rdParty/wx/include/wx/settings.h deleted file mode 100644 index 5d732d0d2..000000000 --- a/Source/3rdParty/wx/include/wx/settings.h +++ /dev/null @@ -1,214 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/settings.h -// Purpose: wxSystemSettings class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: settings.h 67017 2011-02-25 09:37:28Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETTINGS_H_BASE_ -#define _WX_SETTINGS_H_BASE_ - -#include "wx/colour.h" -#include "wx/font.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// possible values for wxSystemSettings::GetFont() parameter -// -// NB: wxMSW assumes that they have the same values as the parameters of -// Windows GetStockObject() API, don't change the values! -enum wxSystemFont -{ - wxSYS_OEM_FIXED_FONT = 10, - wxSYS_ANSI_FIXED_FONT, - wxSYS_ANSI_VAR_FONT, - wxSYS_SYSTEM_FONT, - wxSYS_DEVICE_DEFAULT_FONT, - wxSYS_DEFAULT_PALETTE, - wxSYS_SYSTEM_FIXED_FONT, - wxSYS_DEFAULT_GUI_FONT, - - // this was just a temporary aberration, do not use it any more - wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT -}; - -// possible values for wxSystemSettings::GetColour() parameter -// -// NB: wxMSW assumes that they have the same values as the parameters of -// Windows GetSysColor() API, don't change the values! -enum wxSystemColour -{ - wxSYS_COLOUR_SCROLLBAR, - wxSYS_COLOUR_BACKGROUND, - wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND, - wxSYS_COLOUR_ACTIVECAPTION, - wxSYS_COLOUR_INACTIVECAPTION, - wxSYS_COLOUR_MENU, - wxSYS_COLOUR_WINDOW, - wxSYS_COLOUR_WINDOWFRAME, - wxSYS_COLOUR_MENUTEXT, - wxSYS_COLOUR_WINDOWTEXT, - wxSYS_COLOUR_CAPTIONTEXT, - wxSYS_COLOUR_ACTIVEBORDER, - wxSYS_COLOUR_INACTIVEBORDER, - wxSYS_COLOUR_APPWORKSPACE, - wxSYS_COLOUR_HIGHLIGHT, - wxSYS_COLOUR_HIGHLIGHTTEXT, - wxSYS_COLOUR_BTNFACE, - wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, - wxSYS_COLOUR_BTNSHADOW, - wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, - wxSYS_COLOUR_GRAYTEXT, - wxSYS_COLOUR_BTNTEXT, - wxSYS_COLOUR_INACTIVECAPTIONTEXT, - wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DDKSHADOW, - wxSYS_COLOUR_3DLIGHT, - wxSYS_COLOUR_INFOTEXT, - wxSYS_COLOUR_INFOBK, - wxSYS_COLOUR_LISTBOX, - wxSYS_COLOUR_HOTLIGHT, - wxSYS_COLOUR_GRADIENTACTIVECAPTION, - wxSYS_COLOUR_GRADIENTINACTIVECAPTION, - wxSYS_COLOUR_MENUHILIGHT, - wxSYS_COLOUR_MENUBAR, - wxSYS_COLOUR_LISTBOXTEXT, - wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, - - wxSYS_COLOUR_MAX -}; - -// possible values for wxSystemSettings::GetMetric() index parameter -// -// NB: update the conversion table in msw/settings.cpp if you change the values -// of the elements of this enum -enum wxSystemMetric -{ - wxSYS_MOUSE_BUTTONS = 1, - wxSYS_BORDER_X, - wxSYS_BORDER_Y, - wxSYS_CURSOR_X, - wxSYS_CURSOR_Y, - wxSYS_DCLICK_X, - wxSYS_DCLICK_Y, - wxSYS_DRAG_X, - wxSYS_DRAG_Y, - wxSYS_EDGE_X, - wxSYS_EDGE_Y, - wxSYS_HSCROLL_ARROW_X, - wxSYS_HSCROLL_ARROW_Y, - wxSYS_HTHUMB_X, - wxSYS_ICON_X, - wxSYS_ICON_Y, - wxSYS_ICONSPACING_X, - wxSYS_ICONSPACING_Y, - wxSYS_WINDOWMIN_X, - wxSYS_WINDOWMIN_Y, - wxSYS_SCREEN_X, - wxSYS_SCREEN_Y, - wxSYS_FRAMESIZE_X, - wxSYS_FRAMESIZE_Y, - wxSYS_SMALLICON_X, - wxSYS_SMALLICON_Y, - wxSYS_HSCROLL_Y, - wxSYS_VSCROLL_X, - wxSYS_VSCROLL_ARROW_X, - wxSYS_VSCROLL_ARROW_Y, - wxSYS_VTHUMB_Y, - wxSYS_CAPTION_Y, - wxSYS_MENU_Y, - wxSYS_NETWORK_PRESENT, - wxSYS_PENWINDOWS_PRESENT, - wxSYS_SHOW_SOUNDS, - wxSYS_SWAP_BUTTONS -}; - -// possible values for wxSystemSettings::HasFeature() parameter -enum wxSystemFeature -{ - wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, - wxSYS_CAN_ICONIZE_FRAME, - wxSYS_TABLET_PRESENT -}; - -// values for different screen designs -enum wxSystemScreenType -{ - wxSYS_SCREEN_NONE = 0, // not yet defined - - wxSYS_SCREEN_TINY, // < - wxSYS_SCREEN_PDA, // >= 320x240 - wxSYS_SCREEN_SMALL, // >= 640x480 - wxSYS_SCREEN_DESKTOP // >= 800x600 -}; - -// ---------------------------------------------------------------------------- -// wxSystemSettingsNative: defines the API for wxSystemSettings class -// ---------------------------------------------------------------------------- - -// this is a namespace rather than a class: it has only non virtual static -// functions -// -// also note that the methods are implemented in the platform-specific source -// files (i.e. this is not a real base class as we can't override its virtual -// functions because it doesn't have any) - -class WXDLLEXPORT wxSystemSettingsNative -{ -public: - // get a standard system colour - static wxColour GetColour(wxSystemColour index); - - // get a standard system font - static wxFont GetFont(wxSystemFont index); - - // get a system-dependent metric - static int GetMetric(wxSystemMetric index, wxWindow * win = NULL); - - // return true if the port has certain feature - static bool HasFeature(wxSystemFeature index); -}; - -// ---------------------------------------------------------------------------- -// include the declaration of the real platform-dependent class -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative -{ -public: -#ifdef __WXUNIVERSAL__ - // in wxUniversal we want to use the theme standard colours instead of the - // system ones, otherwise wxSystemSettings is just the same as - // wxSystemSettingsNative - static wxColour GetColour(wxSystemColour index); -#endif // __WXUNIVERSAL__ - - // Get system screen design (desktop, pda, ..) used for - // laying out various dialogs. - static wxSystemScreenType GetScreenType(); - - // Override default. - static void SetScreenType( wxSystemScreenType screen ); - - // Value - static wxSystemScreenType ms_screen; - -#if WXWIN_COMPATIBILITY_2_4 - // the backwards compatible versions of wxSystemSettingsNative functions, - // don't use these methods in the new code! - wxDEPRECATED(static wxColour GetSystemColour(int index)); - wxDEPRECATED(static wxFont GetSystemFont(int index)); - wxDEPRECATED(static int GetSystemMetric(int index)); -#endif -}; - -#endif - // _WX_SETTINGS_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/sizer.h b/Source/3rdParty/wx/include/wx/sizer.h deleted file mode 100644 index e95ab437e..000000000 --- a/Source/3rdParty/wx/include/wx/sizer.h +++ /dev/null @@ -1,1092 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/sizer.h -// Purpose: provide wxSizer class for layout -// Author: Robert Roebling and Robin Dunn -// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) -// Created: -// RCS-ID: $Id: sizer.h 52331 2008-03-05 15:02:22Z VS $ -// Copyright: (c) Robin Dunn, Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXSIZER_H__ -#define __WXSIZER_H__ - -#include "wx/defs.h" - -#include "wx/window.h" - -//--------------------------------------------------------------------------- -// classes -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxBoxSizer; -class WXDLLIMPEXP_FWD_CORE wxSizerItem; -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxFlexGridSizer; -class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; - -#ifndef wxUSE_BORDER_BY_DEFAULT - #ifdef __SMARTPHONE__ - // no borders by default on limited size screen - #define wxUSE_BORDER_BY_DEFAULT 0 - #else - #define wxUSE_BORDER_BY_DEFAULT 1 - #endif -#endif - -// ---------------------------------------------------------------------------- -// wxSizerFlags: flags used for an item in the sizer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerFlags -{ -public: - // construct the flags object initialized with the given proportion (0 by - // default) - wxSizerFlags(int proportion = 0) : m_proportion(proportion) - { - m_flags = 0; - m_borderInPixels = 0; - } - - // setters for all sizer flags, they all return the object itself so that - // calls to them can be chained - - wxSizerFlags& Proportion(int proportion) - { - m_proportion = proportion; - return *this; - } - - wxSizerFlags& Align(int alignment) // combination of wxAlignment values - { - m_flags &= ~wxALIGN_MASK; - m_flags |= alignment; - - return *this; - } - - wxSizerFlags& Expand() - { - m_flags |= wxEXPAND; - return *this; - } - - // some shortcuts for Align() - wxSizerFlags& Centre() { return Align(wxCENTRE); } - wxSizerFlags& Center() { return Centre(); } - wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } - wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } - -#if wxABI_VERSION >= 20802 - wxSizerFlags& Top() { return Align(wxALIGN_TOP); } - wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } -#endif // wxABI 2.8.2+ - - // default border size used by Border() below - static int GetDefaultBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - // FIXME: default border size shouldn't be hardcoded and at the very - // least they should depend on the current font size - return 5; -#else - return 0; -#endif - } - - - wxSizerFlags& Border(int direction, int borderInPixels) - { - m_flags &= ~wxALL; - m_flags |= direction; - - m_borderInPixels = borderInPixels; - - return *this; - } - - wxSizerFlags& Border(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, GetDefaultBorder()); -#else - // no borders by default on limited size screen - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& DoubleBorder(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, 2*GetDefaultBorder()); -#else - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& TripleBorder(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, 3*GetDefaultBorder()); -#else - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& HorzBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); -#else - return *this; -#endif - } - - wxSizerFlags& DoubleHorzBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); -#else - return *this; -#endif - } - -#if wxABI_VERSION >= 20802 - // setters for the others flags - wxSizerFlags& Shaped() - { - m_flags |= wxSHAPED; - - return *this; - } - - wxSizerFlags& FixedMinSize() - { - m_flags |= wxFIXED_MINSIZE; - - return *this; - } -#endif // wx 2.8.2+ - -#if wxABI_VERSION >= 20808 - // makes the item ignore window's visibility status - wxSizerFlags& ReserveSpaceEvenIfHidden(); -#endif - - // accessors for wxSizer only - int GetProportion() const { return m_proportion; } - int GetFlags() const { return m_flags; } - int GetBorderInPixels() const { return m_borderInPixels; } - -private: - int m_proportion; - int m_flags; - int m_borderInPixels; -}; - - -// ---------------------------------------------------------------------------- -// wxSizerSpacer: used by wxSizerItem to represent a spacer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerSpacer -{ -public: - wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } - - void SetSize(const wxSize& size) { m_size = size; } - const wxSize& GetSize() const { return m_size; } - - void Show(bool show) { m_isShown = show; } - bool IsShown() const { return m_isShown; } - -private: - // the size, in pixel - wxSize m_size; - - // is the spacer currently shown? - bool m_isShown; -}; - -// ---------------------------------------------------------------------------- -// wxSizerItem -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerItem : public wxObject -{ -public: - // window - wxSizerItem( wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData ); - - // window with flags - wxSizerItem(wxWindow *window, const wxSizerFlags& flags) - { - Init(flags); - - SetWindow(window); - } - - // subsizer - wxSizerItem( wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData ); - - // sizer with flags - wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) - { - Init(flags); - - SetSizer(sizer); - } - - // spacer - wxSizerItem( int width, - int height, - int proportion, - int flag, - int border, - wxObject* userData); - - // spacer with flags - wxSizerItem(int width, int height, const wxSizerFlags& flags) - { - Init(flags); - - SetSpacer(width, height); - } - - wxSizerItem(); - virtual ~wxSizerItem(); - - virtual void DeleteWindows(); - - // Enable deleting the SizerItem without destroying the contained sizer. - void DetachSizer() { m_sizer = NULL; } - - virtual wxSize GetSize() const; - virtual wxSize CalcMin(); - virtual void SetDimension( const wxPoint& pos, const wxSize& size ); - - wxSize GetMinSize() const - { return m_minSize; } - wxSize GetMinSizeWithBorder() const; - - void SetMinSize(const wxSize& size) - { - if ( IsWindow() ) - m_window->SetMinSize(size); - m_minSize = size; - } - void SetMinSize( int x, int y ) - { SetMinSize(wxSize(x, y)); } - void SetInitSize( int x, int y ) - { SetMinSize(wxSize(x, y)); } - - // if either of dimensions is zero, ratio is assumed to be 1 - // to avoid "divide by zero" errors - void SetRatio(int width, int height) - { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } - void SetRatio(const wxSize& size) - { SetRatio(size.x, size.y); } - void SetRatio(float ratio) - { m_ratio = ratio; } - float GetRatio() const - { return m_ratio; } - - virtual wxRect GetRect() { return m_rect; } - - bool IsWindow() const { return m_kind == Item_Window; } - bool IsSizer() const { return m_kind == Item_Sizer; } - bool IsSpacer() const { return m_kind == Item_Spacer; } - -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6, use {G,S}etProportion instead. - wxDEPRECATED( void SetOption( int option ) ); - wxDEPRECATED( int GetOption() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - void SetProportion( int proportion ) - { m_proportion = proportion; } - int GetProportion() const - { return m_proportion; } - void SetFlag( int flag ) - { m_flag = flag; } - int GetFlag() const - { return m_flag; } - void SetBorder( int border ) - { m_border = border; } - int GetBorder() const - { return m_border; } - - wxWindow *GetWindow() const - { return m_kind == Item_Window ? m_window : NULL; } - wxSizer *GetSizer() const - { return m_kind == Item_Sizer ? m_sizer : NULL; } - wxSize GetSpacer() const; - - // this function behaves obviously for the windows and spacers but for the - // sizers it returns true if any sizer element is shown and only returns - // false if all of them are hidden - bool IsShown() const; - void Show(bool show); - - void SetUserData(wxObject* userData) - { delete m_userData; m_userData = userData; } - wxObject* GetUserData() const - { return m_userData; } - wxPoint GetPosition() const - { return m_pos; } - - - // these functions do not free old sizer/spacer - void SetWindow(wxWindow *window); - void SetSizer(wxSizer *sizer); - void SetSpacer(const wxSize& size); - void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } - -protected: - // common part of several ctors - void Init() { m_userData = NULL; } - - // common part of ctors taking wxSizerFlags - void Init(const wxSizerFlags& flags); - - - // discriminated union: depending on m_kind one of the fields is valid - enum - { - Item_None, - Item_Window, - Item_Sizer, - Item_Spacer, - Item_Max - } m_kind; - union - { - wxWindow *m_window; - wxSizer *m_sizer; - wxSizerSpacer *m_spacer; - }; - - wxPoint m_pos; - wxSize m_minSize; - int m_proportion; - int m_border; - int m_flag; - - // on screen rectangle of this item (not including borders) - wxRect m_rect; - - // Aspect ratio can always be calculated from m_size, - // but this would cause precision loss when the window - // is shrunk. It is safer to preserve the initial value. - float m_ratio; - - wxObject *m_userData; - -private: - // 2.8-only implementation detail for wxRESERVE_SPACE_EVEN_IF_HIDDEN - bool ShouldAccountFor() const; - - DECLARE_CLASS(wxSizerItem) - DECLARE_NO_COPY_CLASS(wxSizerItem) - - friend class wxBoxSizer; - friend class wxFlexGridSizer; - friend class wxGridBagSizer; -}; - -WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); - - -//--------------------------------------------------------------------------- -// wxSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer -{ -public: - wxSizer() { m_containingWindow = NULL; } - virtual ~wxSizer(); - - // methods for adding elements to the sizer: there are Add/Insert/Prepend - // overloads for each of window/sizer/spacer/wxSizerItem - wxSizerItem* Add(wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add(wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add(int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); - wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Add( wxSizerItem *item); - - wxSizerItem* AddSpacer(int size); - wxSizerItem* AddStretchSpacer(int prop = 1); - - wxSizerItem* Insert(size_t index, - wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - wxWindow *window, - const wxSizerFlags& flags); - wxSizerItem* Insert(size_t index, - wxSizer *sizer, - const wxSizerFlags& flags); - virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); - - wxSizerItem* InsertSpacer(size_t index, int size); - wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); - - wxSizerItem* Prepend(wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); - wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Prepend(wxSizerItem *item); - - wxSizerItem* PrependSpacer(int size); - wxSizerItem* PrependStretchSpacer(int prop = 1); - - // set (or possibly unset if window is NULL) or get the window this sizer - // is used in - void SetContainingWindow(wxWindow *window); - wxWindow *GetContainingWindow() const { return m_containingWindow; } - -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6 since historically it does not delete the window, - // use Detach instead. - wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual bool Remove( wxSizer *sizer ); - virtual bool Remove( int index ); - - virtual bool Detach( wxWindow *window ); - virtual bool Detach( wxSizer *sizer ); - virtual bool Detach( int index ); - - virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); - virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); - virtual bool Replace( size_t index, wxSizerItem *newitem ); - - virtual void Clear( bool delete_windows = false ); - virtual void DeleteWindows(); - - void SetMinSize( int width, int height ) - { DoSetMinSize( width, height ); } - void SetMinSize( const wxSize& size ) - { DoSetMinSize( size.x, size.y ); } - - // Searches recursively - bool SetItemMinSize( wxWindow *window, int width, int height ) - { return DoSetItemMinSize( window, width, height ); } - bool SetItemMinSize( wxWindow *window, const wxSize& size ) - { return DoSetItemMinSize( window, size.x, size.y ); } - - // Searches recursively - bool SetItemMinSize( wxSizer *sizer, int width, int height ) - { return DoSetItemMinSize( sizer, width, height ); } - bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) - { return DoSetItemMinSize( sizer, size.x, size.y ); } - - bool SetItemMinSize( size_t index, int width, int height ) - { return DoSetItemMinSize( index, width, height ); } - bool SetItemMinSize( size_t index, const wxSize& size ) - { return DoSetItemMinSize( index, size.x, size.y ); } - - wxSize GetSize() const - { return m_size; } - wxPoint GetPosition() const - { return m_position; } - - // Calculate the minimal size or return m_minSize if bigger. - wxSize GetMinSize(); - - virtual void RecalcSizes() = 0; - virtual wxSize CalcMin() = 0; - - virtual void Layout(); - -#if wxABI_VERSION >= 20808 - wxSize ComputeFittingClientSize(wxWindow *window); - wxSize ComputeFittingWindowSize(wxWindow *window); -#endif - - wxSize Fit( wxWindow *window ); - void FitInside( wxWindow *window ); - void SetSizeHints( wxWindow *window ); - void SetVirtualSizeHints( wxWindow *window ); - - wxSizerItemList& GetChildren() - { return m_children; } - - void SetDimension( int x, int y, int width, int height ); - - wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); - wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); - wxSizerItem* GetItem( size_t index ); - - // Manage whether individual scene items are considered - // in the layout calculations or not. - bool Show( wxWindow *window, bool show = true, bool recursive = false ); - bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); - bool Show( size_t index, bool show = true ); - - bool Hide( wxSizer *sizer, bool recursive = false ) - { return Show( sizer, false, recursive ); } - bool Hide( wxWindow *window, bool recursive = false ) - { return Show( window, false, recursive ); } - bool Hide( size_t index ) - { return Show( index, false ); } - - bool IsShown( wxWindow *window ) const; - bool IsShown( wxSizer *sizer ) const; - bool IsShown( size_t index ) const; - - // Recursively call wxWindow::Show () on all sizer items. - virtual void ShowItems (bool show); - - void Show(bool show) { ShowItems(show); } - -protected: - wxSize m_size; - wxSize m_minSize; - wxPoint m_position; - wxSizerItemList m_children; - - // the window this sizer is used in, can be NULL - wxWindow *m_containingWindow; - - wxSize GetMaxWindowSize( wxWindow *window ) const; - wxSize GetMinWindowSize( wxWindow *window ); - wxSize GetMaxClientSize( wxWindow *window ) const; - wxSize GetMinClientSize( wxWindow *window ); - wxSize VirtualFitSize( wxWindow *window ); - - virtual void DoSetMinSize( int width, int height ); - virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); - virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); - virtual bool DoSetItemMinSize( size_t index, int width, int height ); - -private: - DECLARE_CLASS(wxSizer) -}; - -//--------------------------------------------------------------------------- -// wxGridSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxGridSizer: public wxSizer -{ -public: - wxGridSizer( int rows, int cols, int vgap, int hgap ); - wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); - - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - - void SetCols( int cols ) { m_cols = cols; } - void SetRows( int rows ) { m_rows = rows; } - void SetVGap( int gap ) { m_vgap = gap; } - void SetHGap( int gap ) { m_hgap = gap; } - int GetCols() const { return m_cols; } - int GetRows() const { return m_rows; } - int GetVGap() const { return m_vgap; } - int GetHGap() const { return m_hgap; } - -protected: - int m_rows; - int m_cols; - int m_vgap; - int m_hgap; - - // return the number of total items and the number of columns and rows - int CalcRowsCols(int& rows, int& cols) const; - - void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); - -private: - DECLARE_CLASS(wxGridSizer) -}; - -//--------------------------------------------------------------------------- -// wxFlexGridSizer -//--------------------------------------------------------------------------- - -// the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" -// direction -enum wxFlexSizerGrowMode -{ - // don't resize the cells in non-flexible direction at all - wxFLEX_GROWMODE_NONE, - - // uniformly resize only the specified ones (default) - wxFLEX_GROWMODE_SPECIFIED, - - // uniformly resize all cells - wxFLEX_GROWMODE_ALL -}; - -class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer -{ -public: - // ctors/dtor - wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); - wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); - virtual ~wxFlexGridSizer(); - - - // set the rows/columns which will grow (the others will remain of the - // constant initial size) - void AddGrowableRow( size_t idx, int proportion = 0 ); - void RemoveGrowableRow( size_t idx ); - void AddGrowableCol( size_t idx, int proportion = 0 ); - void RemoveGrowableCol( size_t idx ); - - - // the sizer cells may grow in both directions, not grow at all or only - // grow in one direction but not the other - - // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) - void SetFlexibleDirection(int direction) { m_flexDirection = direction; } - int GetFlexibleDirection() const { return m_flexDirection; } - - // note that the grow mode only applies to the direction which is not - // flexible - void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } - wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } - - // Read-only access to the row heights and col widths arrays - const wxArrayInt& GetRowHeights() const { return m_rowHeights; } - const wxArrayInt& GetColWidths() const { return m_colWidths; } - - // implementation - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - -protected: - void AdjustForFlexDirection(); - void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, - int nrows, int ncols); - - // the heights/widths of all rows/columns - wxArrayInt m_rowHeights, - m_colWidths; - - // indices of the growable columns and rows - wxArrayInt m_growableRows, - m_growableCols; - - // proportion values of the corresponding growable rows and columns - wxArrayInt m_growableRowsProportions, - m_growableColsProportions; - - // parameters describing whether the growable cells should be resized in - // both directions or only one - int m_flexDirection; - wxFlexSizerGrowMode m_growMode; - - // saves CalcMin result to optimize RecalcSizes - wxSize m_calculatedMinSize; - -private: - DECLARE_CLASS(wxFlexGridSizer) - DECLARE_NO_COPY_CLASS(wxFlexGridSizer) -}; - -//--------------------------------------------------------------------------- -// wxBoxSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxBoxSizer: public wxSizer -{ -public: - wxBoxSizer( int orient ); - - void RecalcSizes(); - wxSize CalcMin(); - - int GetOrientation() const - { return m_orient; } - - void SetOrientation(int orient) - { m_orient = orient; } - -protected: - int m_orient; - int m_stretchable; - int m_minWidth; - int m_minHeight; - int m_fixedWidth; - int m_fixedHeight; - -private: - DECLARE_CLASS(wxBoxSizer) -}; - -//--------------------------------------------------------------------------- -// wxStaticBoxSizer -//--------------------------------------------------------------------------- - -#if wxUSE_STATBOX - -class WXDLLIMPEXP_FWD_CORE wxStaticBox; - -class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer -{ -public: - wxStaticBoxSizer(wxStaticBox *box, int orient); - wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); - virtual ~wxStaticBoxSizer(); - - void RecalcSizes(); - wxSize CalcMin(); - - wxStaticBox *GetStaticBox() const - { return m_staticBox; } - - // override to hide/show the static box as well - virtual void ShowItems (bool show); - - virtual bool Detach( wxWindow *window ); - virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } - virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } - -protected: - wxStaticBox *m_staticBox; - -private: - DECLARE_CLASS(wxStaticBoxSizer) - DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) -}; - -#endif // wxUSE_STATBOX - -#if wxUSE_BUTTON - -class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer -{ -public: - // Constructor just creates a new wxBoxSizer, not much else. - // Box sizer orientation is automatically determined here: - // vertical for PDAs, horizontal for everything else? - wxStdDialogButtonSizer(); - - // Checks button ID against system IDs and sets one of the pointers below - // to this button. Does not do any sizer-related things here. - void AddButton(wxButton *button); - - // Use these if no standard ID can/should be used - void SetAffirmativeButton( wxButton *button ); - void SetNegativeButton( wxButton *button ); - void SetCancelButton( wxButton *button ); - - // All platform-specific code here, checks which buttons exist and add - // them to the sizer accordingly. - // Note - one potential hack on Mac we could use here, - // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE - // is set to _("Save") and m_buttonNegative is set to _("Don't Save") - // I wouldn't add any other hacks like that into here, - // but this one I can see being useful. - void Realize(); - - wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } - wxButton *GetApplyButton() const { return m_buttonApply; } - wxButton *GetNegativeButton() const { return m_buttonNegative; } - wxButton *GetCancelButton() const { return m_buttonCancel; } - wxButton *GetHelpButton() const { return m_buttonHelp; } - -protected: - wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here - wxButton *m_buttonApply; - wxButton *m_buttonNegative; // wxID_NO - wxButton *m_buttonCancel; - wxButton *m_buttonHelp; - -private: - DECLARE_CLASS(wxStdDialogButtonSizer) - DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) -}; - -#endif // wxUSE_BUTTON - -#if WXWIN_COMPATIBILITY_2_4 -// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they -// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. - -// ---------------------------------------------------------------------------- -// wxBookCtrlSizer -// ---------------------------------------------------------------------------- - -#if wxUSE_BOOKCTRL - -// this sizer works with wxNotebook/wxListbook/... and sizes the control to -// fit its pages -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; - -class WXDLLEXPORT wxBookCtrlSizer : public wxSizer -{ -public: -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - wxBookCtrlBase *GetControl() const { return m_bookctrl; } - - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - -protected: - // this protected ctor lets us mark the real one above as deprecated - // and still have warning-free build of the library itself: - wxBookCtrlSizer() {} - - wxBookCtrlBase *m_bookctrl; - -private: - DECLARE_CLASS(wxBookCtrlSizer) - DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) -}; - - -#if wxUSE_NOTEBOOK - -// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards -// compatibility -class WXDLLIMPEXP_FWD_CORE wxNotebook; - -class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer -{ -public: -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } - -private: - DECLARE_CLASS(wxNotebookSizer) - DECLARE_NO_COPY_CLASS(wxNotebookSizer) -}; - -#endif // wxUSE_NOTEBOOK - -#endif // wxUSE_BOOKCTRL - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -inline wxSizerItem* -wxSizer::Add( wxSizerItem *item ) -{ - return Insert( m_children.GetCount(), item ); -} - -inline wxSizerItem* -wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) -{ - return Add( new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Add( new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::AddSpacer(int size) -{ - return Add(size, size); -} - -inline wxSizerItem* -wxSizer::AddStretchSpacer(int prop) -{ - return Add(0, 0, prop); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizerItem *item ) -{ - return Insert( 0, item ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::PrependSpacer(int size) -{ - return Prepend(size, size); -} - -inline wxSizerItem* -wxSizer::PrependStretchSpacer(int prop) -{ - return Prepend(0, 0, prop); -} - -inline wxSizerItem* -wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) -{ - return Prepend( new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Prepend( new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - int width, - int height, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) -{ - return Insert( index, new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Insert( index, new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::InsertSpacer(size_t index, int size) -{ - return Insert(index, size, size); -} - -inline wxSizerItem* -wxSizer::InsertStretchSpacer(size_t index, int prop) -{ - return Insert(index, 0, 0, prop); -} - - -#endif // __WXSIZER_H__ diff --git a/Source/3rdParty/wx/include/wx/slider.h b/Source/3rdParty/wx/include/wx/slider.h deleted file mode 100644 index 77fcef253..000000000 --- a/Source/3rdParty/wx/include/wx/slider.h +++ /dev/null @@ -1,151 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/slider.h -// Purpose: wxSlider interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 09.02.01 -// RCS-ID: $Id: slider.h 38717 2006-04-14 17:01:16Z ABX $ -// Copyright: (c) 1996-2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SLIDER_H_BASE_ -#define _WX_SLIDER_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_SLIDER - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxSlider flags -// ---------------------------------------------------------------------------- - -#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */ -#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */ - -#define wxSL_TICKS 0x0010 -#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks -#define wxSL_LABELS 0x0020 -#define wxSL_LEFT 0x0040 -#define wxSL_TOP 0x0080 -#define wxSL_RIGHT 0x0100 -#define wxSL_BOTTOM 0x0200 -#define wxSL_BOTH 0x0400 -#define wxSL_SELRANGE 0x0800 -#define wxSL_INVERSE 0x1000 - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete - #define wxSL_NOTIFY_DRAG 0x0000 -#endif // WXWIN_COMPATIBILITY_2_6 - -extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[]; - -// ---------------------------------------------------------------------------- -// wxSliderBase: define wxSlider interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSliderBase : public wxControl -{ -public: - /* the ctor of the derived class should have the following form: - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - */ - wxSliderBase() { } - - // get/set the current slider value (should be in range) - virtual int GetValue() const = 0; - virtual void SetValue(int value) = 0; - - // retrieve/change the range - virtual void SetRange(int minValue, int maxValue) = 0; - virtual int GetMin() const = 0; - virtual int GetMax() const = 0; - void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; } - void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; } - - // the line/page size is the increment by which the slider moves when - // cursor arrow key/page up or down are pressed (clicking the mouse is like - // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range - virtual void SetLineSize(int lineSize) = 0; - virtual void SetPageSize(int pageSize) = 0; - virtual int GetLineSize() const = 0; - virtual int GetPageSize() const = 0; - - // these methods get/set the length of the slider pointer in pixels - virtual void SetThumbLength(int lenPixels) = 0; - virtual int GetThumbLength() const = 0; - - // warning: most of subsequent methods are currently only implemented in - // wxMSW under Win95 and are silently ignored on other platforms - - virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { } - virtual int GetTickFreq() const { return 0; } - virtual void ClearTicks() { } - virtual void SetTick(int WXUNUSED(tickPos)) { } - - virtual void ClearSel() { } - virtual int GetSelEnd() const { return GetMin(); } - virtual int GetSelStart() const { return GetMax(); } - virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } - -protected: - - // adjust value according to wxSL_INVERSE style - virtual int ValueInvertOrNot(int value) const - { - if (HasFlag(wxSL_INVERSE)) - return (GetMax() + GetMin()) - value; - else - return value; - } - -private: - DECLARE_NO_COPY_CLASS(wxSliderBase) -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/slider.h" -#elif defined(__WXMSW__) - #include "wx/msw/slider95.h" - #if WXWIN_COMPATIBILITY_2_4 - #define wxSlider95 wxSlider - #endif -#elif defined(__WXMOTIF__) - #include "wx/motif/slider.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/slider.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/slider.h" -#elif defined(__WXMAC__) - #include "wx/mac/slider.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/slider.h" -#elif defined(__WXPM__) - #include "wx/os2/slider.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/slider.h" -#endif - -#endif // wxUSE_SLIDER - -#endif - // _WX_SLIDER_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/snglinst.h b/Source/3rdParty/wx/include/wx/snglinst.h deleted file mode 100644 index 50a856332..000000000 --- a/Source/3rdParty/wx/include/wx/snglinst.h +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/snglinst.h -// Purpose: wxSingleInstanceChecker can be used to restrict the number of -// simultaneously running copies of a program to one -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.06.01 -// RCS-ID: $Id: snglinst.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SNGLINST_H_ -#define _WX_SNGLINST_H_ - -#if wxUSE_SNGLINST_CHECKER - -// ---------------------------------------------------------------------------- -// wxSingleInstanceChecker -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSingleInstanceChecker -{ -public: - // default ctor, use Create() after it - wxSingleInstanceChecker() { Init(); } - - // like Create() but no error checking (dangerous!) - wxSingleInstanceChecker(const wxString& name, - const wxString& path = wxEmptyString) - { - Init(); - Create(name, path); - } - - // name must be given and be as unique as possible, it is used as the mutex - // name under Win32 and the lock file name under Unix - - // wxTheApp->GetAppName() may be a good value for this parameter - // - // path is optional and is ignored under Win32 and used as the directory to - // create the lock file in under Unix (default is wxGetHomeDir()) - // - // returns false if initialization failed, it doesn't mean that another - // instance is running - use IsAnotherRunning() to check it - bool Create(const wxString& name, const wxString& path = wxEmptyString); - - // is another copy of this program already running? - bool IsAnotherRunning() const; - - // dtor is not virtual, this class is not meant to be used polymorphically - ~wxSingleInstanceChecker(); - -private: - // common part of all ctors - void Init() { m_impl = NULL; } - - // the implementation details (platform specific) - class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl; - - DECLARE_NO_COPY_CLASS(wxSingleInstanceChecker) -}; - -#endif // wxUSE_SNGLINST_CHECKER - -#endif // _WX_SNGLINST_H_ diff --git a/Source/3rdParty/wx/include/wx/spinbutt.h b/Source/3rdParty/wx/include/wx/spinbutt.h deleted file mode 100644 index c24f35f01..000000000 --- a/Source/3rdParty/wx/include/wx/spinbutt.h +++ /dev/null @@ -1,129 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/spinbutt.h -// Purpose: wxSpinButtonBase class -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 23.07.99 -// RCS-ID: $Id: spinbutt.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINBUTT_H_BASE_ -#define _WX_SPINBUTT_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_SPINBTN - -#include "wx/control.h" -#include "wx/event.h" - -#define wxSPIN_BUTTON_NAME wxT("wxSpinButton") - -// ---------------------------------------------------------------------------- -// The wxSpinButton is like a small scrollbar than is often placed next -// to a text control. -// -// Styles: -// wxSP_HORIZONTAL: horizontal spin button -// wxSP_VERTICAL: vertical spin button (the default) -// wxSP_ARROW_KEYS: arrow keys increment/decrement value -// wxSP_WRAP: value wraps at either end -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinButtonBase : public wxControl -{ -public: - // ctor initializes the range with the default (0..100) values - wxSpinButtonBase() { m_min = 0; m_max = 100; } - - // accessors - virtual int GetValue() const = 0; - virtual int GetMin() const { return m_min; } - virtual int GetMax() const { return m_max; } - - // operations - virtual void SetValue(int val) = 0; - virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; } - virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; } - virtual void SetRange(int minVal, int maxVal) - { - m_min = minVal; - m_max = maxVal; - } - - // is this spin button vertically oriented? - bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; } - -protected: - // the range value - int m_min; - int m_max; - - DECLARE_NO_COPY_CLASS(wxSpinButtonBase) -}; - -// ---------------------------------------------------------------------------- -// include the declaration of the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/spinbutt.h" -#elif defined(__WXMSW__) - #include "wx/msw/spinbutt.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/spinbutt.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/spinbutt.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/spinbutt.h" -#elif defined(__WXMAC__) - #include "wx/mac/spinbutt.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/spinbutt.h" -#elif defined(__WXPM__) - #include "wx/os2/spinbutt.h" -#endif - -// ---------------------------------------------------------------------------- -// the wxSpinButton event -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent -{ -public: - wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid) - { - } - - // get the current value of the control - int GetPosition() const { return m_commandInt; } - void SetPosition(int pos) { m_commandInt = pos; } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent) -}; - -typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); - -#define wxSpinEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSpinEventFunction, &func) - -// macros for handling spin events -#define EVT_SPIN_UP(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxSpinEventHandler(func)) -#define EVT_SPIN_DOWN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxSpinEventHandler(func)) -#define EVT_SPIN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxSpinEventHandler(func)) - -#endif // wxUSE_SPINBTN - -#endif - // _WX_SPINBUTT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/spinctrl.h b/Source/3rdParty/wx/include/wx/spinctrl.h deleted file mode 100644 index e27c1892d..000000000 --- a/Source/3rdParty/wx/include/wx/spinctrl.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: spinctrl.h -// Purpose: wxSpinCtrlBase class -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.07.99 -// RCS-ID: $Id: spinctrl.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINCTRL_H_ -#define _WX_SPINCTRL_H_ - -#include "wx/defs.h" - -#if wxUSE_SPINCTRL - -#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app - -// ---------------------------------------------------------------------------- -// a spin ctrl is a text control with a spin button which is usually used to -// prompt the user for a numeric input -// ---------------------------------------------------------------------------- - -/* there is no generic base class for this control because it's imlpemented - very differently under MSW and other platforms - -class WXDLLEXPORT wxSpinCtrlBase : public wxControl -{ -public: - wxSpinCtrlBase() { Init(); } - - // accessors - virtual int GetValue() const = 0; - virtual int GetMin() const { return m_min; } - virtual int GetMax() const { return m_max; } - - // operations - virtual void SetValue(const wxString& value) = 0; - virtual void SetValue(int val) = 0; - virtual void SetRange(int minVal, int maxVal) = 0; - - // as the wxTextCtrl method - virtual void SetSelection(long from, long to) = 0; - -protected: - // initialize m_min/max with the default values - void Init() { m_min = 0; m_max = 100; } - - int m_min; - int m_max; -}; -*/ - -// ---------------------------------------------------------------------------- -// include the platform-dependent class implementation -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/spinctlg.h" -#elif defined(__WXMSW__) - #include "wx/msw/spinctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/spinctrl.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/spinctrl.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/spinctrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/spinctlg.h" -#elif defined(__WXMAC__) - #include "wx/mac/spinctrl.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/spinctlg.h" -#endif // platform - -#define EVT_SPINCTRL(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxSpinEventHandler(fn)) - -#endif // wxUSE_SPINCTRL - -#endif // _WX_SPINCTRL_H_ diff --git a/Source/3rdParty/wx/include/wx/splitter.h b/Source/3rdParty/wx/include/wx/splitter.h deleted file mode 100644 index fb96799f1..000000000 --- a/Source/3rdParty/wx/include/wx/splitter.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/splitter.h -// Purpose: Base header for wxSplitterWindow -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: splitter.h 38717 2006-04-14 17:01:16Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPLITTER_H_BASE_ -#define _WX_SPLITTER_H_BASE_ - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// wxSplitterWindow flags -// ---------------------------------------------------------------------------- - -#define wxSP_NOBORDER 0x0000 -#define wxSP_NOSASH 0x0010 -#define wxSP_PERMIT_UNSPLIT 0x0040 -#define wxSP_LIVE_UPDATE 0x0080 -#define wxSP_3DSASH 0x0100 -#define wxSP_3DBORDER 0x0200 -#define wxSP_NO_XP_THEME 0x0400 -#define wxSP_BORDER wxSP_3DBORDER -#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete styles, don't do anything - #define wxSP_SASH_AQUA 0 - #define wxSP_FULLSASH 0 -#endif // WXWIN_COMPATIBILITY_2_6 - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 850) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 851) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 852) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT, 853) -END_DECLARE_EVENT_TYPES() - -#include "wx/generic/splitter.h" - -#endif - // _WX_SPLITTER_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/srchctrl.h b/Source/3rdParty/wx/include/wx/srchctrl.h deleted file mode 100644 index af831bd0b..000000000 --- a/Source/3rdParty/wx/include/wx/srchctrl.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: srchctrl.h -// Purpose: wxSearchCtrlBase class -// Author: Vince Harron -// Created: 2006-02-18 -// RCS-ID: $Id: srchctrl.h 45828 2007-05-05 14:51:51Z VZ $ -// Copyright: (c) Vince Harron -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SEARCHCTRL_H_BASE_ -#define _WX_SEARCHCTRL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SEARCHCTRL - -#include "wx/textctrl.h" - -#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \ - && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) - // search control was introduced in Mac OS X 10.3 Panther - #define wxUSE_NATIVE_SEARCH_CONTROL 1 - - #define wxSearchCtrlBaseBaseClass wxTextCtrl -#else - // no native version, use the generic one - #define wxUSE_NATIVE_SEARCH_CONTROL 0 - - #define wxSearchCtrlBaseBaseClass wxTextCtrlBase -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[]; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1119) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1120) -END_DECLARE_EVENT_TYPES() - -// ---------------------------------------------------------------------------- -// a search ctrl is a text control with a search button and a cancel button -// it is based on the MacOSX 10.3 control HISearchFieldCreate -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass -{ -public: - wxSearchCtrlBase() { } - virtual ~wxSearchCtrlBase() { } - - // search control -#if wxUSE_MENUS - virtual void SetMenu(wxMenu *menu) = 0; - virtual wxMenu *GetMenu() = 0; -#endif // wxUSE_MENUS - - // get/set options - virtual void ShowSearchButton( bool show ) = 0; - virtual bool IsSearchButtonVisible() const = 0; - - virtual void ShowCancelButton( bool show ) = 0; - virtual bool IsCancelButtonVisible() const = 0; -}; - - -// include the platform-dependent class implementation -#if wxUSE_NATIVE_SEARCH_CONTROL - #if defined(__WXMAC__) - #include "wx/mac/srchctrl.h" - #endif -#else - #include "wx/generic/srchctlg.h" -#endif - -// ---------------------------------------------------------------------------- -// macros for handling search events -// ---------------------------------------------------------------------------- - -#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn)) - -#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn)) - -#endif // wxUSE_SEARCHCTRL - -#endif // _WX_SEARCHCTRL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/sstream.h b/Source/3rdParty/wx/include/wx/sstream.h deleted file mode 100644 index febf2cf0d..000000000 --- a/Source/3rdParty/wx/include/wx/sstream.h +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/sstream.h -// Purpose: string-based streams -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-09-19 -// RCS-ID: $Id: sstream.h 45732 2007-05-01 13:52:19Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SSTREAM_H_ -#define _WX_SSTREAM_H_ - -#include "wx/stream.h" - -#if wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// wxStringInputStream is a stream reading from the given (fixed size) string -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream -{ -public: - // ctor associates the stream with the given string which makes a copy of - // it - wxStringInputStream(const wxString& s); - virtual ~wxStringInputStream(); - - virtual wxFileOffset GetLength() const; - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysRead(void *buffer, size_t size); - -private: - // the string that was passed in the ctor - wxString m_str; - - // the buffer we're reading from - char* m_buf; - - // length of the buffer we're reading from - size_t m_len; - - // position in the stream in bytes, *not* in chars - size_t m_pos; - - DECLARE_NO_COPY_CLASS(wxStringInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxStringOutputStream writes data to the given string, expanding it as needed -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream -{ -public: - // The stream will write data either to the provided string or to an - // internal string which can be retrieved using GetString() - wxStringOutputStream(wxString *pString = NULL) - { - m_str = pString ? pString : &m_strInternal; - m_pos = m_str->length() / sizeof(wxChar); - } - -#if wxABI_VERSION >= 20804 && wxUSE_UNICODE - virtual ~wxStringOutputStream(); -#endif // wx 2.8.4+ - - // get the string containing current output - const wxString& GetString() const { return *m_str; } - -protected: - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysWrite(const void *buffer, size_t size); - -private: - // internal string, not used if caller provided his own string - wxString m_strInternal; - - // pointer given by the caller or just pointer to m_strInternal - wxString *m_str; - - // position in the stream in bytes, *not* in chars - size_t m_pos; - -#if wxUSE_WCHAR_T - // string encoding converter (UTF8 is the standard) - wxMBConvUTF8 m_conv; -#else - wxMBConv m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxStringOutputStream) -}; - -#endif // wxUSE_STREAMS - -#endif // _WX_SSTREAM_H_ - diff --git a/Source/3rdParty/wx/include/wx/stack.h b/Source/3rdParty/wx/include/wx/stack.h deleted file mode 100644 index e58c0675d..000000000 --- a/Source/3rdParty/wx/include/wx/stack.h +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stack.h -// Purpose: STL stack clone -// Author: Lindsay Mathieson -// Modified by: -// Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STACK_H_ -#define _WX_STACK_H_ - -#include "wx/vector.h" - -#define WX_DECLARE_STACK(obj, cls)\ -class cls : public wxVectorBase\ -{\ - WX_DECLARE_VECTORBASE(obj, cls);\ -public:\ - void push(const obj& o)\ - {\ - bool rc = Alloc(size() + 1);\ - wxASSERT(rc);\ - Append(new obj(o));\ - };\ -\ - void pop()\ - {\ - RemoveAt(size() - 1);\ - };\ -\ - obj& top()\ - {\ - return *(obj *) GetItem(size() - 1);\ - };\ - const obj& top() const\ - {\ - return *(obj *) GetItem(size() - 1);\ - };\ -} - -#endif // _WX_STACK_H_ - diff --git a/Source/3rdParty/wx/include/wx/stackwalk.h b/Source/3rdParty/wx/include/wx/stackwalk.h deleted file mode 100644 index e051c71f1..000000000 --- a/Source/3rdParty/wx/include/wx/stackwalk.h +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wx/stackwalk.h -// Purpose: wxStackWalker and related classes, common part -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-07 -// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STACKWALK_H_ -#define _WX_STACKWALK_H_ - -#include "wx/defs.h" - -#if wxUSE_STACKWALKER - -class WXDLLIMPEXP_BASE wxStackFrame; - -// ---------------------------------------------------------------------------- -// wxStackFrame: a single stack level -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackFrameBase -{ -private: - // put this inline function here so that it is defined before use - wxStackFrameBase *ConstCast() const - { return wx_const_cast(wxStackFrameBase *, this); } - -public: - wxStackFrameBase(size_t level, void *address = NULL) - { - m_level = level; - - m_line = - m_offset = 0; - - m_address = address; - } - - // get the level of this frame (deepest/innermost one is 0) - size_t GetLevel() const { return m_level; } - - // return the address of this frame - void *GetAddress() const { return m_address; } - - - // return the unmangled (if possible) name of the function containing this - // frame - wxString GetName() const { ConstCast()->OnGetName(); return m_name; } - - // return the instruction pointer offset from the start of the function - size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; } - - // get the module this function belongs to (not always available) - wxString GetModule() const { ConstCast()->OnGetName(); return m_module; } - - - // return true if we have the filename and line number for this frame - bool HasSourceLocation() const { return !GetFileName().empty(); } - - // return the name of the file containing this frame, empty if - // unavailable (typically because debug info is missing) - wxString GetFileName() const - { ConstCast()->OnGetLocation(); return m_filename; } - - // return the line number of this frame, 0 if unavailable - size_t GetLine() const { ConstCast()->OnGetLocation(); return m_line; } - - - // return the number of parameters of this function (may return 0 if we - // can't retrieve the parameters info even although the function does have - // parameters) - virtual size_t GetParamCount() const { return 0; } - - // get the name, type and value (in text form) of the given parameter - // - // any pointer may be NULL - // - // return true if at least some values could be retrieved - virtual bool GetParam(size_t WXUNUSED(n), - wxString * WXUNUSED(type), - wxString * WXUNUSED(name), - wxString * WXUNUSED(value)) const - { - return false; - } - - - // although this class is not supposed to be used polymorphically, give it - // a virtual dtor to silence compiler warnings - virtual ~wxStackFrameBase() { } - -protected: - // hooks for derived classes to initialize some fields on demand - virtual void OnGetName() { } - virtual void OnGetLocation() { } - - - // fields are protected, not private, so that OnGetXXX() could modify them - // directly - size_t m_level; - - wxString m_name, - m_module, - m_filename; - - size_t m_line; - - void *m_address; - size_t m_offset; -}; - -// ---------------------------------------------------------------------------- -// wxStackWalker: class for enumerating stack frames -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackWalkerBase -{ -public: - // ctor does nothing, use Walk() to walk the stack - wxStackWalkerBase() { } - - // dtor does nothing neither but should be virtual - virtual ~wxStackWalkerBase() { } - - // enumerate stack frames from the current location, skipping the initial - // number of them (this can be useful when Walk() is called from some known - // location and you don't want to see the first few frames anyhow; also - // notice that Walk() frame itself is not included if skip >= 1) - virtual void Walk(size_t skip = 1, size_t maxDepth = 200) = 0; - - // enumerate stack frames from the location of uncaught exception - // - // this version can only be called from wxApp::OnFatalException() - virtual void WalkFromException() = 0; - -protected: - // this function must be overrided to process the given frame - virtual void OnStackFrame(const wxStackFrame& frame) = 0; -}; - -#ifdef __WXMSW__ - #include "wx/msw/stackwalk.h" -#elif defined(__UNIX__) - #include "wx/unix/stackwalk.h" -#else - #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0" -#endif - -#endif // wxUSE_STACKWALKER - -#endif // _WX_STACKWALK_H_ - diff --git a/Source/3rdParty/wx/include/wx/statbmp.h b/Source/3rdParty/wx/include/wx/statbmp.h deleted file mode 100644 index e32c0cca7..000000000 --- a/Source/3rdParty/wx/include/wx/statbmp.h +++ /dev/null @@ -1,74 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statbmp.h -// Purpose: wxStaticBitmap class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: statbmp.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBMP_H_BASE_ -#define _WX_STATBMP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATBMP - -#include "wx/control.h" -#include "wx/bitmap.h" -#include "wx/icon.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; - -// a control showing an icon or a bitmap -class WXDLLEXPORT wxStaticBitmapBase : public wxControl -{ -public: - wxStaticBitmapBase() { } - virtual ~wxStaticBitmapBase(); - - // our interface - virtual void SetIcon(const wxIcon& icon) = 0; - virtual void SetBitmap(const wxBitmap& bitmap) = 0; - virtual wxBitmap GetBitmap() const = 0; - virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */ - { - // stub it out here for now as not all ports implement it (but they - // should) - return wxIcon(); - } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - -protected: - virtual wxSize DoGetBestSize() const; - - DECLARE_NO_COPY_CLASS(wxStaticBitmapBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statbmp.h" -#elif defined(__WXMSW__) - #include "wx/msw/statbmp.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/statbmp.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statbmp.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statbmp.h" -#elif defined(__WXMAC__) - #include "wx/mac/statbmp.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbmp.h" -#elif defined(__WXPM__) - #include "wx/os2/statbmp.h" -#endif - -#endif // wxUSE_STATBMP - -#endif - // _WX_STATBMP_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/statbox.h b/Source/3rdParty/wx/include/wx/statbox.h deleted file mode 100644 index 182881c93..000000000 --- a/Source/3rdParty/wx/include/wx/statbox.h +++ /dev/null @@ -1,74 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: statbox.h -// Purpose: wxStaticBox base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: statbox.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBOX_H_BASE_ -#define _WX_STATBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATBOX - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxStaticBox: a grouping box with a label -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticBoxBase : public wxControl -{ -public: - wxStaticBoxBase() { } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - - // implementation only: this is used by wxStaticBoxSizer to account for the - // need for extra space taken by the static box - // - // the top border is the margin at the top (where the title is), - // borderOther is the margin on all other sides - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const - { - const int BORDER = 5; // FIXME: hardcoded value - - *borderTop = GetLabel().empty() ? BORDER : GetCharHeight(); - *borderOther = BORDER; - } - -private: - DECLARE_NO_COPY_CLASS(wxStaticBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/statbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/statbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/statbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbox.h" -#elif defined(__WXPM__) - #include "wx/os2/statbox.h" -#endif - -#endif // wxUSE_STATBOX - -#endif - // _WX_STATBOX_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/statline.h b/Source/3rdParty/wx/include/wx/statline.h deleted file mode 100644 index eac9078f4..000000000 --- a/Source/3rdParty/wx/include/wx/statline.h +++ /dev/null @@ -1,103 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statline.h -// Purpose: wxStaticLine class interface -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATLINE_H_BASE_ -#define _WX_STATLINE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// this defines wxUSE_STATLINE -#include "wx/defs.h" - -#if wxUSE_STATLINE - -// the base class declaration -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default name for objects of class wxStaticLine -extern WXDLLEXPORT_DATA(const wxChar) wxStaticLineNameStr[]; - -// ---------------------------------------------------------------------------- -// wxStaticLine - a line in a dialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLineBase : public wxControl -{ -public: - // constructor - wxStaticLineBase() { } - - // is the line vertical? - bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } - - // get the default size for the "lesser" dimension of the static line - static int GetDefaultSize() { return 2; } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - -protected: - // set the right size for the right dimension - wxSize AdjustSize(const wxSize& size) const - { - wxSize sizeReal(size); - if ( IsVertical() ) - { - if ( size.x == wxDefaultCoord ) - sizeReal.x = GetDefaultSize(); - } - else - { - if ( size.y == wxDefaultCoord ) - sizeReal.y = GetDefaultSize(); - } - - return sizeReal; - } - - virtual wxSize DoGetBestSize() const - { - return AdjustSize(wxDefaultSize); - } - - DECLARE_NO_COPY_CLASS(wxStaticLineBase) -}; - -// ---------------------------------------------------------------------------- -// now include the actual class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statline.h" -#elif defined(__WXMSW__) - #include "wx/msw/statline.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statline.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statline.h" -#elif defined(__WXPM__) - #include "wx/os2/statline.h" -#elif defined(__WXMAC__) - #include "wx/mac/statline.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statline.h" -#else // use generic implementation for all other platforms - #include "wx/generic/statline.h" -#endif - -#endif // wxUSE_STATLINE - -#endif // _WX_STATLINE_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/stattext.h b/Source/3rdParty/wx/include/wx/stattext.h deleted file mode 100644 index 99862b22e..000000000 --- a/Source/3rdParty/wx/include/wx/stattext.h +++ /dev/null @@ -1,69 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: stattext.h -// Purpose: wxStaticText base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: stattext.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATTEXT_H_BASE_ -#define _WX_STATTEXT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATTEXT - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[]; - -class WXDLLEXPORT wxStaticTextBase : public wxControl -{ -public: - wxStaticTextBase() { } - - // in wxGTK wxStaticText doesn't derive from wxStaticTextBase so we have to - // declare this function directly in gtk header -#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__) - // wrap the text of the control so that no line is longer than the given - // width (if possible: this function won't break words) - // - // NB: implemented in dlgcmn.cpp for now - void Wrap(int width); -#endif // ! native __WXGTK__ - - // overriden base virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - -private: - DECLARE_NO_COPY_CLASS(wxStaticTextBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/stattext.h" -#elif defined(__WXMSW__) - #include "wx/msw/stattext.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/stattext.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/stattext.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/stattext.h" -#elif defined(__WXMAC__) - #include "wx/mac/stattext.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/stattext.h" -#elif defined(__WXPM__) - #include "wx/os2/stattext.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/stattext.h" -#endif - -#endif // wxUSE_STATTEXT - -#endif - // _WX_STATTEXT_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/statusbr.h b/Source/3rdParty/wx/include/wx/statusbr.h deleted file mode 100644 index 5a19e7503..000000000 --- a/Source/3rdParty/wx/include/wx/statusbr.h +++ /dev/null @@ -1,174 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statusbr.h -// Purpose: wxStatusBar class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.02.00 -// RCS-ID: $Id: statusbr.h 41035 2006-09-06 17:36:22Z PC $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATUSBR_H_BASE_ -#define _WX_STATUSBR_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATUSBAR - -#include "wx/window.h" -#include "wx/list.h" -#include "wx/dynarray.h" - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[]; - -WX_DECLARE_LIST(wxString, wxListString); - -// ---------------------------------------------------------------------------- -// wxStatusBar constants -// ---------------------------------------------------------------------------- - -// style flags for fields -#define wxSB_NORMAL 0x0000 -#define wxSB_FLAT 0x0001 -#define wxSB_RAISED 0x0002 - -// ---------------------------------------------------------------------------- -// wxStatusBar: a window near the bottom of the frame used for status info -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStatusBarBase : public wxWindow -{ -public: - wxStatusBarBase(); - - virtual ~wxStatusBarBase(); - - // field count - // ----------- - - // set the number of fields and call SetStatusWidths(widths) if widths are - // given - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - int GetFieldsCount() const { return m_nFields; } - - // field text - // ---------- - - virtual void SetStatusText(const wxString& text, int number = 0) = 0; - virtual wxString GetStatusText(int number = 0) const = 0; - - void PushStatusText(const wxString& text, int number = 0); - void PopStatusText(int number = 0); - - // fields widths - // ------------- - - // set status field widths as absolute numbers: positive widths mean that - // the field has the specified absolute width, negative widths are - // interpreted as the sizer options, i.e. the extra space (total space - // minus the sum of fixed width fields) is divided between the fields with - // negative width according to the abs value of the width (field with width - // -2 grows twice as much as one with width -1 &c) - virtual void SetStatusWidths(int n, const int widths[]); - - // field styles - // ------------ - - // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D - // border around a field, wxSB_FLAT for no border around a field, so that it - // appears flat or wxSB_POPOUT to make the field appear raised. - // Setting field styles only works on wxMSW - virtual void SetStatusStyles(int n, const int styles[]); - - // geometry - // -------- - - // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const = 0; - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height) = 0; - - // get the dimensions of the horizontal and vertical borders - virtual int GetBorderX() const = 0; - virtual int GetBorderY() const = 0; - - // don't want status bars to accept the focus at all - virtual bool AcceptsFocus() const { return false; } - -protected: - // set the widths array to NULL - void InitWidths(); - - // free the status widths arrays - void FreeWidths(); - - // reset the widths - void ReinitWidths() { FreeWidths(); InitWidths(); } - - // same, for field styles - void InitStyles(); - void FreeStyles(); - void ReinitStyles() { FreeStyles(); InitStyles(); } - - // same, for text stacks - void InitStacks(); - void FreeStacks(); - void ReinitStacks() { FreeStacks(); InitStacks(); } - - // calculate the real field widths for the given total available size - wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; - - // use these functions to access the stacks of field strings - wxListString *GetStatusStack(int i) const; - wxListString *GetOrCreateStatusStack(int i); - - // the current number of fields - int m_nFields; - - // the widths of the fields in pixels if !NULL, all fields have the same - // width otherwise - int *m_statusWidths; - - // the styles of the fields - int *m_statusStyles; - - // stacks of previous values for PushStatusText/PopStatusText - // this is created on demand, use GetStatusStack/GetOrCreateStatusStack - wxListString **m_statusTextStacks; - - DECLARE_NO_COPY_CLASS(wxStatusBarBase) -}; - -// ---------------------------------------------------------------------------- -// include the actual wxStatusBar class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #define wxStatusBarUniv wxStatusBar - - #include "wx/univ/statusbr.h" -#elif defined(__WXPALMOS__) - #define wxStatusBarPalm wxStatusBar - - #include "wx/palmos/statusbr.h" -#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR - #define wxStatusBar95 wxStatusBar - - #include "wx/msw/statbr95.h" -#elif defined(__WXMAC__) - #define wxStatusBarMac wxStatusBar - - #include "wx/generic/statusbr.h" - #include "wx/mac/statusbr.h" -#else - #define wxStatusBarGeneric wxStatusBar - - #include "wx/generic/statusbr.h" -#endif - -#endif // wxUSE_STATUSBAR - -#endif - // _WX_STATUSBR_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/stdpaths.h b/Source/3rdParty/wx/include/wx/stdpaths.h deleted file mode 100644 index beb8b13b7..000000000 --- a/Source/3rdParty/wx/include/wx/stdpaths.h +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stdpaths.h -// Purpose: declaration of wxStandardPaths class -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-17 -// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STDPATHS_H_ -#define _WX_STDPATHS_H_ - -#include "wx/defs.h" - -#if wxUSE_STDPATHS - -#include "wx/string.h" -#include "wx/filefn.h" - -// ---------------------------------------------------------------------------- -// wxStandardPaths returns the standard locations in the file system -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPathsBase -{ -public: - // possible resources categorires - enum ResourceCat - { - // no special category - ResourceCat_None, - - // message catalog resources - ResourceCat_Messages, - - // end of enum marker - ResourceCat_Max - }; - - - // return the global standard paths object - static wxStandardPathsBase& Get(); - - // return the path (directory+filename) of the running executable or - // wxEmptyString if it couldn't be determined. - // The path is returned as an absolute path whenever possible. - // Default implementation only try to use wxApp->argv[0]. - virtual wxString GetExecutablePath() const; - - // return the directory with system config files: - // /etc under Unix, c:\Documents and Settings\All Users\Application Data - // under Windows, /Library/Preferences for Mac - virtual wxString GetConfigDir() const = 0; - - // return the directory for the user config files: - // $HOME under Unix, c:\Documents and Settings\username under Windows, - // ~/Library/Preferences under Mac - // - // only use this if you have a single file to put there, otherwise - // GetUserDataDir() is more appropriate - virtual wxString GetUserConfigDir() const = 0; - - // return the location of the applications global, i.e. not user-specific, - // data files - // - // prefix/share/appname under Unix, c:\Program Files\appname under Windows, - // appname.app/Contents/SharedSupport app bundle directory under Mac - virtual wxString GetDataDir() const = 0; - - // return the location for application data files which are host-specific - // - // same as GetDataDir() except under Unix where it is /etc/appname - virtual wxString GetLocalDataDir() const; - - // return the directory for the user-dependent application data files - // - // $HOME/.appname under Unix, - // c:\Documents and Settings\username\Application Data\appname under Windows - // and ~/Library/Application Support/appname under Mac - virtual wxString GetUserDataDir() const = 0; - - // return the directory for user data files which shouldn't be shared with - // the other machines - // - // same as GetUserDataDir() for all platforms except Windows where it is - // the "Local Settings\Application Data\appname" directory - virtual wxString GetUserLocalDataDir() const; - - // return the directory where the loadable modules (plugins) live - // - // prefix/lib/appname under Unix, program directory under Windows and - // Contents/Plugins app bundle subdirectory under Mac - virtual wxString GetPluginsDir() const = 0; - - // get resources directory: resources are auxiliary files used by the - // application and include things like image and sound files - // - // same as GetDataDir() for all platforms except Mac where it returns - // Contents/Resources subdirectory of the app bundle - virtual wxString GetResourcesDir() const { return GetDataDir(); } - - // get localized resources directory containing the resource files of the - // specified category for the given language - // - // in general this is just GetResourcesDir()/lang under Windows and Unix - // and GetResourcesDir()/lang.lproj under Mac but is something quite - // different under Unix for message catalog category (namely the standard - // prefix/share/locale/lang/LC_MESSAGES) - virtual wxString - GetLocalizedResourcesDir(const wxChar *lang, - ResourceCat WXUNUSED(category) - = ResourceCat_None) const - { - return GetResourcesDir() + wxFILE_SEP_PATH + lang; - } - - // return the "Documents" directory for the current user - // - // C:\Documents and Settings\username\Documents under Windows, - // $HOME under Unix and ~/Documents under Mac - virtual wxString GetDocumentsDir() const; - - // return the temporary directory for the current user - virtual wxString GetTempDir() const; - - - // virtual dtor for the base class - virtual ~wxStandardPathsBase(); - -protected: - // append "/appname" suffix if the app name is set (doesn't append the - // slash if dir already ends with a slash or dot) - static wxString AppendAppName(const wxString& dir); -}; - -#if defined(__WXMSW__) - #include "wx/msw/stdpaths.h" -// We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) -#elif defined(__WXMAC__) || defined(__DARWIN__) - #include "wx/mac/corefoundation/stdpaths.h" -#elif defined(__OS2__) - #include "wx/os2/stdpaths.h" -#elif defined(__UNIX__) - #include "wx/unix/stdpaths.h" -#elif defined(__PALMOS__) - #include "wx/palmos/stdpaths.h" -#else - -// ---------------------------------------------------------------------------- -// Minimal generic implementation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase -{ -public: - void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } - wxString GetInstallPrefix() const { return m_prefix; } - - virtual wxString GetExecutablePath() const { return m_prefix; } - virtual wxString GetConfigDir() const { return m_prefix; } - virtual wxString GetUserConfigDir() const { return m_prefix; } - virtual wxString GetDataDir() const { return m_prefix; } - virtual wxString GetLocalDataDir() const { return m_prefix; } - virtual wxString GetUserDataDir() const { return m_prefix; } - virtual wxString GetPluginsDir() const { return m_prefix; } - virtual wxString GetDocumentsDir() const { return m_prefix; } - -private: - wxString m_prefix; -}; - -#endif - -#endif // wxUSE_STDPATHS - -#endif // _WX_STDPATHS_H_ - diff --git a/Source/3rdParty/wx/include/wx/stockitem.h b/Source/3rdParty/wx/include/wx/stockitem.h deleted file mode 100644 index 31ac5213a..000000000 --- a/Source/3rdParty/wx/include/wx/stockitem.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stockitem.h -// Purpose: stock items helpers (privateh header) -// Author: Vaclav Slavik -// Modified by: -// Created: 2004-08-15 -// RCS-ID: $Id: stockitem.h 42935 2006-11-02 09:51:49Z JS $ -// Copyright: (c) Vaclav Slavik, 2004 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STOCKITEM_H_ -#define _WX_STOCKITEM_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" -#include "wx/string.h" -#include "wx/accel.h" - -// ---------------------------------------------------------------------------- -// Helper functions for stock items handling: -// ---------------------------------------------------------------------------- - -// Returns true if the ID is in the list of recognized stock actions -WXDLLEXPORT bool wxIsStockID(wxWindowID id); - -// Returns true of the label is empty or label of a stock button with -// given ID -WXDLLEXPORT bool wxIsStockLabel(wxWindowID id, const wxString& label); - -enum wxStockLabelQueryFlag -{ - wxSTOCK_NOFLAGS = 0, - - wxSTOCK_WITH_MNEMONIC = 1, - wxSTOCK_WITH_ACCELERATOR = 2 -}; - -// Returns label that should be used for given stock UI element (e.g. "&OK" -// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character -// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator -// for given ID is concatenated to the label using \t as separator -WXDLLEXPORT wxString wxGetStockLabel(wxWindowID id, - long flags = wxSTOCK_WITH_MNEMONIC); - -#if wxUSE_ACCEL - - // Returns the accelerator that should be used for given stock UI element - // (e.g. "Ctrl+x" for wxSTOCK_EXIT) - WXDLLEXPORT wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); - -#endif - -// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to -// wxGetStockHelpString() about the context where the help string is to be used -enum wxStockHelpStringClient -{ - wxSTOCK_MENU // help string to use for menu items -}; - -// Returns an help string for the given stock UI element and for the given "context". -WXDLLEXPORT wxString wxGetStockHelpString(wxWindowID id, - wxStockHelpStringClient client = wxSTOCK_MENU); - - -#ifdef __WXGTK20__ - -// Translates stock ID to GTK+'s stock item string indentifier: -WXDLLEXPORT const char *wxGetStockGtkID(wxWindowID id); - -#endif - -#endif // _WX_STOCKITEM_H_ diff --git a/Source/3rdParty/wx/include/wx/stopwatch.h b/Source/3rdParty/wx/include/wx/stopwatch.h deleted file mode 100644 index 8733708c8..000000000 --- a/Source/3rdParty/wx/include/wx/stopwatch.h +++ /dev/null @@ -1,102 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stopwatch.h -// Purpose: wxStopWatch and global time-related functions -// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch) -// Created: 26.06.03 (extracted from wx/timer.h) -// RCS-ID: $Id: stopwatch.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STOPWATCH_H_ -#define _WX_STOPWATCH_H_ - -#include "wx/defs.h" -#include "wx/longlong.h" - -// ---------------------------------------------------------------------------- -// wxStopWatch: measure time intervals with up to 1ms resolution -// ---------------------------------------------------------------------------- - -#if wxUSE_STOPWATCH - -class WXDLLIMPEXP_BASE wxStopWatch -{ -public: - // ctor starts the stop watch - wxStopWatch() { m_pauseCount = 0; Start(); } - - // start the stop watch at the moment t0 - void Start(long t0 = 0); - - // pause the stop watch - void Pause() - { - if ( m_pauseCount++ == 0 ) - m_pause = GetElapsedTime(); - } - - // resume it - void Resume() - { - wxASSERT_MSG( m_pauseCount > 0, - wxT("Resuming stop watch which is not paused") ); - - if ( --m_pauseCount == 0 ) - Start(m_pause); - } - - // get elapsed time since the last Start() in milliseconds - long Time() const; - -protected: - // returns the elapsed time since t0 - long GetElapsedTime() const; - -private: - // the time of the last Start() - wxLongLong m_t0; - - // the time of the last Pause() (only valid if m_pauseCount > 0) - long m_pause; - - // if > 0, the stop watch is paused, otherwise it is running - int m_pauseCount; -}; - -#endif // wxUSE_STOPWATCH - -#if wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - - // Starts a global timer - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( void WXDLLIMPEXP_BASE wxStartTimer() ); - - // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true) ); - -#endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// global time functions -// ---------------------------------------------------------------------------- - -// Get number of seconds since local time 00:00:00 Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetLocalTime(); - -// Get number of seconds since GMT 00:00:00, Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetUTCTime(); - -#if wxUSE_LONGLONG - typedef wxLongLong wxMilliClock_t; -#else - typedef double wxMilliClock_t; -#endif // wxUSE_LONGLONG - -// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 -extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); - -#define wxGetCurrentTime() wxGetLocalTime() - -#endif // _WX_STOPWATCH_H_ diff --git a/Source/3rdParty/wx/include/wx/strconv.h b/Source/3rdParty/wx/include/wx/strconv.h deleted file mode 100644 index 7d167fab7..000000000 --- a/Source/3rdParty/wx/include/wx/strconv.h +++ /dev/null @@ -1,553 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: strconv.h -// Purpose: conversion routines for char sets any Unicode -// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: strconv.h 45893 2007-05-08 20:05:16Z VZ $ -// Copyright: (c) 1998 Ove Kaaven, Robert Roebling -// (c) 1998-2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STRCONV_H_ -#define _WX_STRCONV_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" -#include "wx/buffer.h" - -#ifdef __DIGITALMARS__ -#include "typeinfo.h" -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -# undef __BSEXCPT__ -#endif - -#include - -#if wxUSE_WCHAR_T - -// the error value returned by wxMBConv methods -#define wxCONV_FAILED ((size_t)-1) - -// the default value for some length parameters meaning that the string is -// NUL-terminated -#define wxNO_LEN ((size_t)-1) - -// ---------------------------------------------------------------------------- -// wxMBConv (abstract base class for conversions) -// ---------------------------------------------------------------------------- - -// When deriving a new class from wxMBConv you must reimplement ToWChar() and -// FromWChar() methods which are not pure virtual only for historical reasons, -// don't let the fact that the existing classes implement MB2WC/WC2MB() instead -// confuse you. -// -// You also have to implement Clone() to allow copying the conversions -// polymorphically. -// -// And you might need to override GetMBNulLen() as well. -class WXDLLIMPEXP_BASE wxMBConv -{ -public: - // The functions doing actual conversion from/to narrow to/from wide - // character strings. - // - // On success, the return value is the length (i.e. the number of - // characters, not bytes) of the converted string including any trailing - // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if - // there is not enough space for everything, including the trailing NUL - // character(s), in the output buffer, wxCONV_FAILED is returned. - // - // In the special case when dstLen is 0 (outputBuf may be NULL then) the - // return value is the length of the needed buffer but nothing happens - // otherwise. If srcLen is wxNO_LEN, the entire string, up to and - // including the trailing NUL(s), is converted, otherwise exactly srcLen - // bytes are. - // - // Typical usage: - // - // size_t dstLen = conv.ToWChar(NULL, 0, src); - // if ( dstLen != wxCONV_FAILED ) - // ... handle error ... - // wchar_t *wbuf = new wchar_t[dstLen]; - // conv.ToWChar(wbuf, dstLen, src); - // - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - - - // Convenience functions for translating NUL-terminated strings: returns - // the buffer containing the converted string or NULL pointer if the - // conversion failed. - const wxWCharBuffer cMB2WC(const char *in) const; - const wxCharBuffer cWC2MB(const wchar_t *in) const; - - // Convenience functions for converting strings which may contain embedded - // NULs and don't have to be NUL-terminated. - // - // inLen is the length of the buffer including trailing NUL if any: if the - // last 4 bytes of the buffer are all NULs, these functions are more - // efficient as they avoid copying the string, but otherwise a copy is made - // internally which could be quite bad for (very) long strings. - // - // outLen receives, if not NULL, the length of the converted string or 0 if - // the conversion failed (returning 0 and not -1 in this case makes it - // difficult to distinguish between failed conversion and empty input but - // this is done for backwards compatibility) - const wxWCharBuffer - cMB2WC(const char *in, size_t inLen, size_t *outLen) const; - const wxCharBuffer - cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; - - // convenience functions for converting MB or WC to/from wxWin default -#if wxUSE_UNICODE - const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } - const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } - const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } - const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } -#else // ANSI - const char* cMB2WX(const char *psz) const { return psz; } - const char* cWX2MB(const char *psz) const { return psz; } - const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } - const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } -#endif // Unicode/ANSI - - // this function is used in the implementation of cMB2WC() to distinguish - // between the following cases: - // - // a) var width encoding with strings terminated by a single NUL - // (usual multibyte encodings): return 1 in this case - // b) fixed width encoding with 2 bytes/char and so terminated by - // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case - // c) fixed width encoding with 4 bytes/char and so terminated by - // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case - // - // anything else is not supported currently and -1 should be returned - virtual size_t GetMBNulLen() const { return 1; } - - // return the maximal value currently returned by GetMBNulLen() for any - // encoding - static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } - - - // The old conversion functions. The existing classes currently mostly - // implement these ones but we're in transition to using To/FromWChar() - // instead and any new classes should implement just the new functions. - // For now, however, we provide default implementation of To/FromWChar() in - // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all - // the conversions at once. - // - // On success, the return value is the length (i.e. the number of - // characters, not bytes) not counting the trailing NUL(s) of the converted - // string. On failure, (size_t)-1 is returned. In the special case when - // outputBuf is NULL the return value is the same one but nothing is - // written to the buffer. - // - // Note that outLen is the length of the output buffer, not the length of - // the input (which is always supposed to be terminated by one or more - // NULs, as appropriate for the encoding)! - virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const; - virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const; - - - // make a heap-allocated copy of this object - virtual wxMBConv *Clone() const = 0; - - // virtual dtor for any base class - virtual ~wxMBConv(); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for -// conversion (hence it depends on the current locale) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv -{ -public: - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvLibc; } -}; - -#ifdef __UNIX__ - -// ---------------------------------------------------------------------------- -// wxConvBrokenFileNames is made for Unix in Unicode mode when -// files are accidentally written in an encoding which is not -// the system encoding. Typically, the system encoding will be -// UTF8 but there might be files stored in ISO8859-1 on disk. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv -{ -public: - wxConvBrokenFileNames(const wxChar *charset); - wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) - : wxMBConv(), - m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) - { - } - virtual ~wxConvBrokenFileNames() { delete m_conv; } - - virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const - { - return m_conv->MB2WC(out, in, outLen); - } - - virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const - { - return m_conv->WC2MB(out, in, outLen); - } - - virtual size_t GetMBNulLen() const - { - // cast needed to call a private function - return m_conv->GetMBNulLen(); - } - - virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); } - -private: - // the conversion object we forward to - wxMBConv *m_conv; - - DECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames) -}; - -#endif // __UNIX__ - -// ---------------------------------------------------------------------------- -// wxMBConvUTF7 (for conversion using UTF7 encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv -{ -public: - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvUTF7; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF8 (for conversion using UTF8 encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConv -{ -public: - enum - { - MAP_INVALID_UTF8_NOT = 0, - MAP_INVALID_UTF8_TO_PUA = 1, - MAP_INVALID_UTF8_TO_OCTAL = 2 - }; - - wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); } - -private: - int m_options; -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16Base: for both LE and BE variants -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv -{ -public: - enum { BYTES_PER_CHAR = 2 }; - - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } - -protected: - // return the length of the buffer using srcLen if it's not wxNO_LEN and - // computing the length ourselves if it is; also checks that the length is - // even if specified as we need an entire number of UTF-16 characters and - // returns wxNO_LEN which indicates error if it is odd - static size_t GetLength(const char *src, size_t srcLen); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16LE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16BE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32Base: base class for both LE and BE variants -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv -{ -public: - enum { BYTES_PER_CHAR = 4 }; - - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } - -protected: - // this is similar to wxMBConvUTF16Base method with the same name except - // that, of course, it verifies that length is divisible by 4 if given and - // not by 2 - static size_t GetLength(const char *src, size_t srcLen); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32LE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32BE; } -}; - -// ---------------------------------------------------------------------------- -// wxCSConv (for conversion based on loadable char sets) -// ---------------------------------------------------------------------------- - -#include "wx/fontenc.h" - -class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv -{ -public: - // we can be created either from charset name or from an encoding constant - // but we can't have both at once - wxCSConv(const wxChar *charset); - wxCSConv(wxFontEncoding encoding); - - wxCSConv(const wxCSConv& conv); - virtual ~wxCSConv(); - - wxCSConv& operator=(const wxCSConv& conv); - - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - virtual size_t GetMBNulLen() const; - - virtual wxMBConv *Clone() const { return new wxCSConv(*this); } - - void Clear(); - -#if wxABI_VERSION >= 20802 - // return true if the conversion could be initilized successfully - bool IsOk() const; -#endif // wx 2.8.2+ - -private: - // common part of all ctors - void Init(); - - // creates m_convReal if necessary - void CreateConvIfNeeded() const; - - // do create m_convReal (unconditionally) - wxMBConv *DoCreate() const; - - // set the name (may be only called when m_name == NULL), makes copy of - // charset string - void SetName(const wxChar *charset); - - - // note that we can't use wxString here because of compilation - // dependencies: we're included from wx/string.h - wxChar *m_name; - wxFontEncoding m_encoding; - - // use CreateConvIfNeeded() before accessing m_convReal! - wxMBConv *m_convReal; - bool m_deferred; -}; - - -// ---------------------------------------------------------------------------- -// declare predefined conversion objects -// ---------------------------------------------------------------------------- - -// conversion to be used with all standard functions affected by locale, e.g. -// strtol(), strftime(), ... -extern WXDLLIMPEXP_DATA_BASE(wxMBConv&) wxConvLibc; - -// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t -extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1; -extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7; -extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8; - -// conversion used for the file names on the systems where they're not Unicode -// (basically anything except Windows) -// -// this is used by all file functions, can be changed by the application -// -// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used -// under Windows normally) -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; - -// backwards compatible define -#define wxConvFile (*wxConvFileName) - -// the current conversion object, may be set to any conversion, is used by -// default in a couple of places inside wx (initially same as wxConvLibc) -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; - -// the conversion corresponding to the current locale -extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal; - -// the conversion corresponding to the encoding of the standard UI elements -// -// by default this is the same as wxConvLocal but may be changed if the program -// needs to use a fixed encoding -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; - -// ---------------------------------------------------------------------------- -// endianness-dependent conversions -// ---------------------------------------------------------------------------- - -#ifdef WORDS_BIGENDIAN - typedef wxMBConvUTF16BE wxMBConvUTF16; - typedef wxMBConvUTF32BE wxMBConvUTF32; -#else - typedef wxMBConvUTF16LE wxMBConvUTF16; - typedef wxMBConvUTF32LE wxMBConvUTF32; -#endif - -// ---------------------------------------------------------------------------- -// filename conversion macros -// ---------------------------------------------------------------------------- - -// filenames are multibyte on Unix and widechar on Windows -#if defined(__UNIX__) || defined(__WXMAC__) - #define wxMBFILES 1 -#else - #define wxMBFILES 0 -#endif - -#if wxMBFILES && wxUSE_UNICODE - #define wxFNCONV(name) wxConvFileName->cWX2MB(name) - #define wxFNSTRINGCAST wxMBSTRINGCAST -#else -#if defined( __WXOSX__ ) && wxMBFILES - #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) -#else - #define wxFNCONV(name) name -#endif - #define wxFNSTRINGCAST WXSTRINGCAST -#endif - -#else // !wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// stand-ins in absence of wchar_t -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConv -{ -public: - const char* cMB2WX(const char *psz) const { return psz; } - const char* cWX2MB(const char *psz) const { return psz; } - wxMBConv *Clone() const { return NULL; } -}; - -#define wxConvFile wxConvLocal -#define wxConvUI wxConvCurrent - -typedef wxMBConv wxCSConv; - -extern WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc, - wxConvLocal, - wxConvISO8859_1, - wxConvUTF8; -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; - -#define wxFNCONV(name) name -#define wxFNSTRINGCAST WXSTRINGCAST - -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// macros for the most common conversions -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE - #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) - #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) - -#if wxABI_VERSION >= 20802 - // these functions should be used when the conversions really, really have - // to succeed (usually because we pass their results to a standard C - // function which would crash if we passed NULL to it), so these functions - // always return a valid pointer if their argument is non-NULL - - // this function safety is achieved by trying wxConvLibc first, wxConvUTF8 - // next if it fails and, finally, wxConvISO8859_1 which always succeeds - extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s); - - // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL) - // if it fails - extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws); -#endif // wxABI 2.8.2+ -#else // ANSI - // no conversions to do - #define wxConvertWX2MB(s) (s) - #define wxConvertMB2WX(s) (s) - #define wxSafeConvertMB2WX(s) (s) - #define wxSafeConvertWX2MB(s) (s) -#endif // Unicode/ANSI - -#endif // _WX_STRCONV_H_ - diff --git a/Source/3rdParty/wx/include/wx/stream.h b/Source/3rdParty/wx/include/wx/stream.h deleted file mode 100644 index bea273189..000000000 --- a/Source/3rdParty/wx/include/wx/stream.h +++ /dev/null @@ -1,609 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stream.h -// Purpose: stream classes -// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: stream.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXSTREAM_H__ -#define _WX_WXSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include -#include "wx/object.h" -#include "wx/string.h" -#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode - -class WXDLLIMPEXP_FWD_BASE wxStreamBase; -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_BASE wxOutputStream; - -typedef wxInputStream& (*__wxInputManip)(wxInputStream&); -typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&); - -WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxStreamError -{ - wxSTREAM_NO_ERROR = 0, // stream is in good state - wxSTREAM_EOF, // EOF reached in Read() or similar - wxSTREAM_WRITE_ERROR, // generic write error - wxSTREAM_READ_ERROR // generic read error -}; - -const int wxEOF = -1; - -// ============================================================================ -// base stream classes: wxInputStream and wxOutputStream -// ============================================================================ - -// --------------------------------------------------------------------------- -// wxStreamBase: common (but non virtual!) base for all stream classes -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStreamBase -{ -public: - wxStreamBase(); - virtual ~wxStreamBase(); - - // error testing - wxStreamError GetLastError() const { return m_lasterror; } - virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } - bool operator!() const { return !IsOk(); } - - // reset the stream state - void Reset() { m_lasterror = wxSTREAM_NO_ERROR; } - - // this doesn't make sense for all streams, always test its return value - virtual size_t GetSize() const; - virtual wxFileOffset GetLength() const { return wxInvalidOffset; } - - // returns true if the streams supports seeking to arbitrary offsets - virtual bool IsSeekable() const { return false; } - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - size_t m_lastcount; - wxStreamError m_lasterror; - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxStreamBase) -}; - -// ---------------------------------------------------------------------------- -// wxInputStream: base class for the input streams -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase -{ -public: - // ctor and dtor, nothing exciting - wxInputStream(); - virtual ~wxInputStream(); - - - // IO functions - // ------------ - - // return a character from the stream without removing it, i.e. it will - // still be returned by the next call to GetC() - // - // blocks until something appears in the stream if necessary, if nothing - // ever does (i.e. EOF) LastRead() will return 0 (and the return value is - // undefined), otherwise 1 - virtual char Peek(); - - // return one byte from the stream, blocking until it appears if - // necessary - // - // on success returns a value between 0 - 255, or wxEOF on EOF or error. - int GetC(); - - // read at most the given number of bytes from the stream - // - // there are 2 possible situations here: either there is nothing at all in - // the stream right now in which case Read() blocks until something appears - // (use CanRead() to avoid this) or there is already some data available in - // the stream and then Read() doesn't block but returns just the data it - // can read without waiting for more - // - // in any case, if there are not enough bytes in the stream right now, - // LastRead() value will be less than size but greater than 0. If it is 0, - // it means that EOF has been reached. - virtual wxInputStream& Read(void *buffer, size_t size); - - // copy the entire contents of this stream into streamOut, stopping only - // when EOF is reached or an error occurs - wxInputStream& Read(wxOutputStream& streamOut); - - - // status functions - // ---------------- - - // returns the number of bytes read by the last call to Read(), GetC() or - // Peek() - // - // this should be used to discover whether that call succeeded in reading - // all the requested data or not - virtual size_t LastRead() const { return wxStreamBase::m_lastcount; } - - // returns true if some data is available in the stream right now, so that - // calling Read() wouldn't block - virtual bool CanRead() const; - - // is the stream at EOF? - // - // note that this cannot be really implemented for all streams and - // CanRead() is more reliable than Eof() - virtual bool Eof() const; - - - // write back buffer - // ----------------- - - // put back the specified number of bytes into the stream, they will be - // fetched by the next call to the read functions - // - // returns the number of bytes really stuffed back - size_t Ungetch(const void *buffer, size_t size); - - // put back the specified character in the stream - // - // returns true if ok, false on error - bool Ungetch(char c); - - - // position functions - // ------------------ - - // move the stream pointer to the given position (if the stream supports - // it) - // - // returns wxInvalidOffset on error - virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); - - // return the current position of the stream pointer or wxInvalidOffset - virtual wxFileOffset TellI() const; - - - // stream-like operators - // --------------------- - - wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } - wxInputStream& operator>>(__wxInputManip func) { return func(*this); } - -protected: - // do read up to size bytes of data into the provided buffer - // - // this method should return 0 if EOF has been reached or an error occurred - // (m_lasterror should be set accordingly as well) or the number of bytes - // read - virtual size_t OnSysRead(void *buffer, size_t size) = 0; - - // write-back buffer support - // ------------------------- - - // return the pointer to a buffer big enough to hold sizeNeeded bytes - char *AllocSpaceWBack(size_t sizeNeeded); - - // read up to size data from the write back buffer, return the number of - // bytes read - size_t GetWBack(void *buf, size_t size); - - // write back buffer or NULL if none - char *m_wback; - - // the size of the buffer - size_t m_wbacksize; - - // the current position in the buffer - size_t m_wbackcur; - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxOutputStream: base for the output streams -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase -{ -public: - wxOutputStream(); - virtual ~wxOutputStream(); - - void PutC(char c); - virtual wxOutputStream& Write(const void *buffer, size_t size); - wxOutputStream& Write(wxInputStream& stream_in); - - virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); - virtual wxFileOffset TellO() const; - - virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; } - - virtual void Sync(); - virtual bool Close() { return true; } - - wxOutputStream& operator<<(wxInputStream& out) { return Write(out); } - wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } - -protected: - // to be implemented in the derived classes (it should have been pure - // virtual) - virtual size_t OnSysWrite(const void *buffer, size_t bufsize); - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxOutputStream) -}; - -// ============================================================================ -// helper stream classes -// ============================================================================ - -// --------------------------------------------------------------------------- -// A stream for measuring streamed output -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream -{ -public: - wxCountingOutputStream(); - - wxFileOffset GetLength() const; - bool Ok() const { return IsOk(); } - bool IsOk() const { return true; } - -protected: - virtual size_t OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - size_t m_currentPos; - - DECLARE_NO_COPY_CLASS(wxCountingOutputStream) -}; - -// --------------------------------------------------------------------------- -// "Filter" streams -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream -{ -public: - wxFilterInputStream(); - wxFilterInputStream(wxInputStream& stream); - wxFilterInputStream(wxInputStream *stream); - virtual ~wxFilterInputStream(); - - char Peek() { return m_parent_i_stream->Peek(); } - - wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); } - - wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; } - -protected: - wxInputStream *m_parent_i_stream; - bool m_owns; - - DECLARE_NO_COPY_CLASS(wxFilterInputStream) -}; - -class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream -{ -public: - wxFilterOutputStream(); - wxFilterOutputStream(wxOutputStream& stream); - wxFilterOutputStream(wxOutputStream *stream); - virtual ~wxFilterOutputStream(); - - wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); } - - wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; } - - bool Close(); - -protected: - wxOutputStream *m_parent_o_stream; - bool m_owns; - - DECLARE_NO_COPY_CLASS(wxFilterOutputStream) -}; - -enum wxStreamProtocolType -{ - wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one) - wxSTREAM_MIMETYPE, // MIME types the stream handles - wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles - wxSTREAM_FILEEXT // File extensions the stream handles -}; - -void WXDLLIMPEXP_BASE wxUseFilterClasses(); - -class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject -{ -public: - virtual ~wxFilterClassFactoryBase() { } - - wxString GetProtocol() const { return wxString(*GetProtocols()); } - wxString PopExtension(const wxString& location) const; - - virtual const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const = 0; - - bool CanHandle(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxString::size_type FindExtension(const wxChar *location) const; - - DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase) -}; - -class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase -{ -public: - virtual ~wxFilterClassFactory() { } - - virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0; - virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0; - virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0; - virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0; - - static const wxFilterClassFactory *Find(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL); - - static const wxFilterClassFactory *GetFirst(); - const wxFilterClassFactory *GetNext() const { return m_next; } - - void PushFront() { Remove(); m_next = sm_first; sm_first = this; } - void Remove(); - -protected: - wxFilterClassFactory() : m_next(this) { } - - wxFilterClassFactory& operator=(const wxFilterClassFactory&) - { return *this; } - -private: - static wxFilterClassFactory *sm_first; - wxFilterClassFactory *m_next; - - DECLARE_ABSTRACT_CLASS(wxFilterClassFactory) -}; - -// ============================================================================ -// buffered streams -// ============================================================================ - -// --------------------------------------------------------------------------- -// Stream buffer: this class can be derived from and passed to -// wxBufferedStreams to implement custom buffering -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStreamBuffer -{ -public: - enum BufMode - { - read, - write, - read_write - }; - - wxStreamBuffer(wxStreamBase& stream, BufMode mode); - wxStreamBuffer(const wxStreamBuffer& buf); - virtual ~wxStreamBuffer(); - - // Filtered IO - virtual size_t Read(void *buffer, size_t size); - size_t Read(wxStreamBuffer *buf); - virtual size_t Write(const void *buffer, size_t size); - size_t Write(wxStreamBuffer *buf); - - virtual char Peek(); - virtual char GetChar(); - virtual void PutChar(char c); - virtual wxFileOffset Tell() const; - virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode); - - // Buffer control - void ResetBuffer(); - - // NB: the buffer must always be allocated with malloc() if takeOwn is - // true as it will be deallocated by free() - void SetBufferIO(void *start, void *end, bool takeOwnership = false); - void SetBufferIO(void *start, size_t len, bool takeOwnership = false); - void SetBufferIO(size_t bufsize); - void *GetBufferStart() const { return m_buffer_start; } - void *GetBufferEnd() const { return m_buffer_end; } - void *GetBufferPos() const { return m_buffer_pos; } - size_t GetBufferSize() const { return m_buffer_size; } - size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; } - void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; } - size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } - size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; } - - void Fixed(bool fixed) { m_fixed = fixed; } - void Flushable(bool f) { m_flushable = f; } - - bool FlushBuffer(); - bool FillBuffer(); - size_t GetDataLeft(); - - // misc accessors - wxStreamBase *GetStream() const { return m_stream; } - bool HasBuffer() const { return m_buffer_size != 0; } - - bool IsFixed() const { return m_fixed; } - bool IsFlushable() const { return m_flushable; } - - // only for input/output buffers respectively, returns NULL otherwise - wxInputStream *GetInputStream() const; - wxOutputStream *GetOutputStream() const; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBase *Stream() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // this constructs a dummy wxStreamBuffer, used by (and exists for) - // wxMemoryStreams only, don't use! - wxStreamBuffer(BufMode mode); - -protected: - void GetFromBuffer(void *buffer, size_t size); - void PutToBuffer(const void *buffer, size_t size); - - // set the last error to the specified value if we didn't have it before - void SetError(wxStreamError err); - - // common part of several ctors - void Init(); - - // init buffer variables to be empty - void InitBuffer(); - - // free the buffer (always safe to call) - void FreeBuffer(); - - // the buffer itself: the pointers to its start and end and the current - // position in the buffer - char *m_buffer_start, - *m_buffer_end, - *m_buffer_pos; - - // the buffer size - // FIXME: isn't it the same as m_buffer_end - m_buffer_start? (VZ) - size_t m_buffer_size; - - // the stream we're associated with - wxStreamBase *m_stream; - - // its mode - BufMode m_mode; - - // flags - bool m_destroybuf, // deallocate buffer? - m_fixed, - m_flushable; - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxStreamBuffer) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxStreamBuffer& operator=(const wxStreamBuffer&); -}; - -// --------------------------------------------------------------------------- -// wxBufferedInputStream -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream -{ -public: - // if a non NULL buffer is given to the stream, it will be deleted by it - wxBufferedInputStream(wxInputStream& stream, - wxStreamBuffer *buffer = NULL); - virtual ~wxBufferedInputStream(); - - char Peek(); - wxInputStream& Read(void *buffer, size_t size); - - // Position functions - wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellI() const; - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } - - // the buffer given to the stream will be deleted by it - void SetInputStreamBuffer(wxStreamBuffer *buffer); - wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual size_t OnSysRead(void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - wxStreamBuffer *m_i_streambuf; - - DECLARE_NO_COPY_CLASS(wxBufferedInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxBufferedOutputStream -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream -{ -public: - // if a non NULL buffer is given to the stream, it will be deleted by it - wxBufferedOutputStream(wxOutputStream& stream, - wxStreamBuffer *buffer = NULL); - virtual ~wxBufferedOutputStream(); - - wxOutputStream& Write(const void *buffer, size_t size); - - // Position functions - wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellO() const; - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } - - void Sync(); - bool Close(); - - wxFileOffset GetLength() const; - - // the buffer given to the stream will be deleted by it - void SetOutputStreamBuffer(wxStreamBuffer *buffer); - wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual size_t OnSysWrite(const void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - wxStreamBuffer *m_o_streambuf; - - DECLARE_NO_COPY_CLASS(wxBufferedOutputStream) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBase *wxStreamBuffer::Stream() { return m_stream; } - inline wxStreamBuffer *wxBufferedInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // wxUSE_STREAMS - -#endif // _WX_WXSTREAM_H__ diff --git a/Source/3rdParty/wx/include/wx/string.h b/Source/3rdParty/wx/include/wx/string.h deleted file mode 100644 index b478747c8..000000000 --- a/Source/3rdParty/wx/include/wx/string.h +++ /dev/null @@ -1,1653 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/string.h -// Purpose: wxString and wxArrayString classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: string.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Efficient string class [more or less] compatible with MFC CString, - wxWidgets version 1 wxString and std::string and some handy functions - missing from string.h. -*/ - -#ifndef _WX_WXSTRINGH__ -#define _WX_WXSTRINGH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" // everybody should include this - -#if defined(__WXMAC__) || defined(__VISAGECPP__) - #include -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 - // problem in VACPP V4 with including stdlib.h multiple times - // strconv includes it anyway -# include -# include -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#ifdef HAVE_STRCASECMP_IN_STRINGS_H - #include // for strcasecmp() -#endif // HAVE_STRCASECMP_IN_STRINGS_H - -#ifdef __WXPALMOS__ - #include -#endif - -#include "wx/wxchar.h" // for wxChar -#include "wx/buffer.h" // for wxCharBuffer -#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes - -class WXDLLIMPEXP_FWD_BASE wxString; - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -// casts [unfortunately!] needed to call some broken functions which require -// "char *" instead of "const char *" -#define WXSTRINGCAST (wxChar *)(const wxChar *) -#define wxCSTRINGCAST (wxChar *)(const wxChar *) -#define wxMBSTRINGCAST (char *)(const char *) -#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) - -// implementation only -#define wxASSERT_VALID_INDEX(i) \ - wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") ) - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 - -// deprecated in favour of wxString::npos, don't use in new code -// -// maximum possible length for a string means "take all string" everywhere -#define wxSTRING_MAXLEN wxStringBase::npos - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -// global pointer to empty string -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; - -// --------------------------------------------------------------------------- -// global functions complementing standard C string library replacements for -// strlen() and portable strcasecmp() -//--------------------------------------------------------------------------- - -// Use wxXXX() functions from wxchar.h instead! These functions are for -// backwards compatibility only. - -// checks whether the passed in pointer is NULL and if the string is empty -inline bool IsEmpty(const char *p) { return (!p || !*p); } - -// safe version of strlen() (returns 0 if passed NULL pointer) -inline size_t Strlen(const char *psz) - { return psz ? strlen(psz) : 0; } - -// portable strcasecmp/_stricmp -inline int Stricmp(const char *psz1, const char *psz2) -{ -#if defined(__VISUALC__) && defined(__WXWINCE__) - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; -#elif defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) ) - return _stricmp(psz1, psz2); -#elif defined(__SC__) - return _stricmp(psz1, psz2); -#elif defined(__SALFORDC__) - return stricmp(psz1, psz2); -#elif defined(__BORLANDC__) - return stricmp(psz1, psz2); -#elif defined(__WATCOMC__) - return stricmp(psz1, psz2); -#elif defined(__DJGPP__) - return stricmp(psz1, psz2); -#elif defined(__EMX__) - return stricmp(psz1, psz2); -#elif defined(__WXPM__) - return stricmp(psz1, psz2); -#elif defined(__WXPALMOS__) || \ - defined(HAVE_STRCASECMP_IN_STRING_H) || \ - defined(HAVE_STRCASECMP_IN_STRINGS_H) || \ - defined(__GNUWIN32__) - return strcasecmp(psz1, psz2); -#elif defined(__MWERKS__) && !defined(__INTEL__) - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; -#else - // almost all compilers/libraries provide this function (unfortunately under - // different names), that's why we don't implement our own which will surely - // be more efficient than this code (uncomment to use): - /* - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; - */ - - #error "Please define string case-insensitive compare for your OS/compiler" -#endif // OS/compiler -} - -// ---------------------------------------------------------------------------- -// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING -// ---------------------------------------------------------------------------- - -// in both cases we need to define wxStdString -#if wxUSE_STL || wxUSE_STD_STRING - -#include "wx/beforestd.h" -#include -#include "wx/afterstd.h" - -#if wxUSE_UNICODE - #ifdef HAVE_STD_WSTRING - typedef std::wstring wxStdString; - #else - typedef std::basic_string wxStdString; - #endif -#else - typedef std::string wxStdString; -#endif - -#endif // need - -#if wxUSE_STL - - // we don't need an extra ctor from std::string when copy ctor already does - // the work - #undef wxUSE_STD_STRING - #define wxUSE_STD_STRING 0 - - #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ - (defined(_MSC_VER) && (_MSC_VER <= 1200)) - #define wxSTRING_BASE_HASNT_CLEAR - #endif - - typedef wxStdString wxStringBase; -#else // if !wxUSE_STL - -#if !defined(HAVE_STD_STRING_COMPARE) && \ - (!defined(__WX_SETUP_H__) || wxUSE_STL == 0) - #define HAVE_STD_STRING_COMPARE -#endif - -// --------------------------------------------------------------------------- -// string data prepended with some housekeeping info (used by wxString class), -// is never used directly (but had to be put here to allow inlining) -// --------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxStringData -{ - int nRefs; // reference count - size_t nDataLength, // actual string length - nAllocLength; // allocated memory size - - // mimics declaration 'wxChar data[nAllocLength]' - wxChar* data() const { return (wxChar*)(this + 1); } - - // empty string has a special ref count so it's never deleted - bool IsEmpty() const { return (nRefs == -1); } - bool IsShared() const { return (nRefs > 1); } - - // lock/unlock - void Lock() { if ( !IsEmpty() ) nRefs++; } - - // VC++ will refuse to inline Unlock but profiling shows that it is wrong -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - __forceinline -#endif - // VC++ free must take place in same DLL as allocation when using non dll - // run-time library (e.g. Multithreaded instead of Multithreaded DLL) -#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) - void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } - // we must not inline deallocation since allocation is not inlined - void Free(); -#else - void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } -#endif - - // if we had taken control over string memory (GetWriteBuf), it's - // intentionally put in invalid state - void Validate(bool b) { nRefs = (b ? 1 : 0); } - bool IsValid() const { return (nRefs != 0); } -}; - -class WXDLLIMPEXP_BASE wxStringBase -{ -#if !wxUSE_STL -friend class WXDLLIMPEXP_FWD_BASE wxArrayString; -#endif -public : - // an 'invalid' value for string index, moved to this place due to a CW bug - static const size_t npos; -protected: - // points to data preceded by wxStringData structure with ref count info - wxChar *m_pchData; - - // accessor to string data - wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } - - // string (re)initialization functions - // initializes the string to the empty value (must be called only from - // ctors, use Reinit() otherwise) - void Init() { m_pchData = (wxChar *)wxEmptyString; } - // initializes the string with (a part of) C-string - void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = npos); - // as Init, but also frees old data - void Reinit() { GetStringData()->Unlock(); Init(); } - - // memory allocation - // allocates memory for string of length nLen - bool AllocBuffer(size_t nLen); - // copies data to another string - bool AllocCopy(wxString&, int, int) const; - // effectively copies data to string - bool AssignCopy(size_t, const wxChar *); - - // append a (sub)string - bool ConcatSelf(size_t nLen, const wxChar *src, size_t nMaxLen); - bool ConcatSelf(size_t nLen, const wxChar *src) - { return ConcatSelf(nLen, src, nLen); } - - // functions called before writing to the string: they copy it if there - // are other references to our data (should be the only owner when writing) - bool CopyBeforeWrite(); - bool AllocBeforeWrite(size_t); - - // compatibility with wxString - bool Alloc(size_t nLen); -public: - // standard types - typedef wxChar value_type; - typedef wxChar char_type; - typedef size_t size_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type *iterator; - typedef const value_type *const_iterator; - -#define wxSTRING_REVERSE_ITERATOR(name, const_or_not) \ - class name \ - { \ - public: \ - typedef wxChar value_type; \ - typedef const_or_not value_type& reference; \ - typedef const_or_not value_type *pointer; \ - typedef const_or_not value_type *iterator_type; \ - \ - name(iterator_type i) : m_cur(i) { } \ - name(const name& ri) : m_cur(ri.m_cur) { } \ - \ - iterator_type base() const { return m_cur; } \ - \ - reference operator*() const { return *(m_cur - 1); } \ - \ - name& operator++() { --m_cur; return *this; } \ - name operator++(int) { name tmp = *this; --m_cur; return tmp; } \ - name& operator--() { ++m_cur; return *this; } \ - name operator--(int) { name tmp = *this; ++m_cur; return tmp; } \ - \ - bool operator==(name ri) const { return m_cur == ri.m_cur; } \ - bool operator!=(name ri) const { return !(*this == ri); } \ - \ - private: \ - iterator_type m_cur; \ - } - - wxSTRING_REVERSE_ITERATOR(const_reverse_iterator, const); - - #define wxSTRING_CONST - wxSTRING_REVERSE_ITERATOR(reverse_iterator, wxSTRING_CONST); - #undef wxSTRING_CONST - - #undef wxSTRING_REVERSE_ITERATOR - - - // constructors and destructor - // ctor for an empty string - wxStringBase() { Init(); } - // copy ctor - wxStringBase(const wxStringBase& stringSrc) - { - wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), - wxT("did you forget to call UngetWriteBuf()?") ); - - if ( stringSrc.empty() ) { - // nothing to do for an empty string - Init(); - } - else { - m_pchData = stringSrc.m_pchData; // share same data - GetStringData()->Lock(); // => one more copy - } - } - // string containing nRepeat copies of ch - wxStringBase(size_type nRepeat, wxChar ch); - // ctor takes first nLength characters from C string - // (default value of npos means take all the string) - wxStringBase(const wxChar *psz) - { InitWith(psz, 0, npos); } - wxStringBase(const wxChar *psz, size_t nLength) - { InitWith(psz, 0, nLength); } - wxStringBase(const wxChar *psz, - const wxMBConv& WXUNUSED(conv), - size_t nLength = npos) - { InitWith(psz, 0, nLength); } - // take nLen chars starting at nPos - wxStringBase(const wxStringBase& str, size_t nPos, size_t nLen) - { - wxASSERT_MSG( str.GetStringData()->IsValid(), - wxT("did you forget to call UngetWriteBuf()?") ); - Init(); - size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; - InitWith(str.c_str(), nPos, nLen); - } - // take all characters from pStart to pEnd - wxStringBase(const void *pStart, const void *pEnd); - - // dtor is not virtual, this class must not be inherited from! - ~wxStringBase() - { -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - //RN - according to the above VC++ does indeed inline this, - //even though it spits out two warnings - #pragma warning (disable:4714) -#endif - - GetStringData()->Unlock(); - } - -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - //re-enable inlining warning - #pragma warning (default:4714) -#endif - // overloaded assignment - // from another wxString - wxStringBase& operator=(const wxStringBase& stringSrc); - // from a character - wxStringBase& operator=(wxChar ch); - // from a C string - wxStringBase& operator=(const wxChar *psz); - - // return the length of the string - size_type length() const { return GetStringData()->nDataLength; } - // return the length of the string - size_type size() const { return length(); } - // return the maximum size of the string - size_type max_size() const { return npos; } - // resize the string, filling the space with c if c != 0 - void resize(size_t nSize, wxChar ch = wxT('\0')); - // delete the contents of the string - void clear() { erase(0, npos); } - // returns true if the string is empty - bool empty() const { return length() == 0; } - // inform string about planned change in size - void reserve(size_t sz) { Alloc(sz); } - size_type capacity() const { return GetStringData()->nAllocLength; } - - // lib.string.access - // return the character at position n - value_type at(size_type n) const - { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } - // returns the writable character at position n - reference at(size_type n) - { wxASSERT_VALID_INDEX( n ); CopyBeforeWrite(); return m_pchData[n]; } - - // lib.string.modifiers - // append elements str[pos], ..., str[pos+n] - wxStringBase& append(const wxStringBase& str, size_t pos, size_t n) - { - wxASSERT(pos <= str.length()); - ConcatSelf(n, str.c_str() + pos, str.length() - pos); - return *this; - } - // append a string - wxStringBase& append(const wxStringBase& str) - { ConcatSelf(str.length(), str.c_str()); return *this; } - // append first n (or all if n == npos) characters of sz - wxStringBase& append(const wxChar *sz) - { ConcatSelf(wxStrlen(sz), sz); return *this; } - wxStringBase& append(const wxChar *sz, size_t n) - { ConcatSelf(n, sz); return *this; } - // append n copies of ch - wxStringBase& append(size_t n, wxChar ch); - // append from first to last - wxStringBase& append(const_iterator first, const_iterator last) - { ConcatSelf(last - first, first); return *this; } - - // same as `this_string = str' - wxStringBase& assign(const wxStringBase& str) - { return *this = str; } - // same as ` = str[pos..pos + n] - wxStringBase& assign(const wxStringBase& str, size_t pos, size_t n) - { clear(); return append(str, pos, n); } - // same as `= first n (or all if n == npos) characters of sz' - wxStringBase& assign(const wxChar *sz) - { clear(); return append(sz, wxStrlen(sz)); } - wxStringBase& assign(const wxChar *sz, size_t n) - { clear(); return append(sz, n); } - // same as `= n copies of ch' - wxStringBase& assign(size_t n, wxChar ch) - { clear(); return append(n, ch); } - // assign from first to last - wxStringBase& assign(const_iterator first, const_iterator last) - { clear(); return append(first, last); } - - // first valid index position - const_iterator begin() const { return m_pchData; } - iterator begin(); - // position one after the last valid one - const_iterator end() const { return m_pchData + length(); } - iterator end(); - - // first element of the reversed string - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rbegin() { return reverse_iterator(end()); } - // one beyond the end of the reversed string - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - - // insert another string - wxStringBase& insert(size_t nPos, const wxStringBase& str) - { - wxASSERT( str.GetStringData()->IsValid() ); - return insert(nPos, str.c_str(), str.length()); - } - // insert n chars of str starting at nStart (in str) - wxStringBase& insert(size_t nPos, const wxStringBase& str, size_t nStart, size_t n) - { - wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart < str.length() ); - size_t strLen = str.length() - nStart; - n = strLen < n ? strLen : n; - return insert(nPos, str.c_str() + nStart, n); - } - // insert first n (or all if n == npos) characters of sz - wxStringBase& insert(size_t nPos, const wxChar *sz, size_t n = npos); - // insert n copies of ch - wxStringBase& insert(size_t nPos, size_t n, wxChar ch) - { return insert(nPos, wxStringBase(n, ch)); } - iterator insert(iterator it, wxChar ch) - { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } - void insert(iterator it, const_iterator first, const_iterator last) - { insert(it - begin(), first, last - first); } - void insert(iterator it, size_type n, wxChar ch) - { insert(it - begin(), n, ch); } - - // delete characters from nStart to nStart + nLen - wxStringBase& erase(size_type pos = 0, size_type n = npos); - iterator erase(iterator first, iterator last) - { - size_t idx = first - begin(); - erase(idx, last - first); - return begin() + idx; - } - iterator erase(iterator first); - - // explicit conversion to C string (use this with printf()!) - const wxChar* c_str() const { return m_pchData; } - const wxChar* data() const { return m_pchData; } - - // replaces the substring of length nLen starting at nStart - wxStringBase& replace(size_t nStart, size_t nLen, const wxChar* sz); - // replaces the substring of length nLen starting at nStart - wxStringBase& replace(size_t nStart, size_t nLen, const wxStringBase& str) - { return replace(nStart, nLen, str.c_str()); } - // replaces the substring with nCount copies of ch - wxStringBase& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch); - // replaces a substring with another substring - wxStringBase& replace(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2); - // replaces the substring with first nCount chars of sz - wxStringBase& replace(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount); - wxStringBase& replace(iterator first, iterator last, const_pointer s) - { return replace(first - begin(), last - first, s); } - wxStringBase& replace(iterator first, iterator last, const_pointer s, - size_type n) - { return replace(first - begin(), last - first, s, n); } - wxStringBase& replace(iterator first, iterator last, const wxStringBase& s) - { return replace(first - begin(), last - first, s); } - wxStringBase& replace(iterator first, iterator last, size_type n, wxChar c) - { return replace(first - begin(), last - first, n, c); } - wxStringBase& replace(iterator first, iterator last, - const_iterator first1, const_iterator last1) - { return replace(first - begin(), last - first, first1, last1 - first1); } - - // swap two strings - void swap(wxStringBase& str); - - // All find() functions take the nStart argument which specifies the - // position to start the search on, the default value is 0. All functions - // return npos if there were no match. - - // find a substring - size_t find(const wxStringBase& str, size_t nStart = 0) const; - - // find first n characters of sz - size_t find(const wxChar* sz, size_t nStart = 0, size_t n = npos) const; - - // find the first occurence of character ch after nStart - size_t find(wxChar ch, size_t nStart = 0) const; - - // rfind() family is exactly like find() but works right to left - - // as find, but from the end - size_t rfind(const wxStringBase& str, size_t nStart = npos) const; - - // as find, but from the end - size_t rfind(const wxChar* sz, size_t nStart = npos, - size_t n = npos) const; - // as find, but from the end - size_t rfind(wxChar ch, size_t nStart = npos) const; - - // find first/last occurence of any character in the set - - // as strpbrk() but starts at nStart, returns npos if not found - size_t find_first_of(const wxStringBase& str, size_t nStart = 0) const - { return find_first_of(str.c_str(), nStart); } - // same as above - size_t find_first_of(const wxChar* sz, size_t nStart = 0) const; - size_t find_first_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as find(char, size_t) - size_t find_first_of(wxChar c, size_t nStart = 0) const - { return find(c, nStart); } - // find the last (starting from nStart) char from str in this string - size_t find_last_of (const wxStringBase& str, size_t nStart = npos) const - { return find_last_of(str.c_str(), nStart); } - // same as above - size_t find_last_of (const wxChar* sz, size_t nStart = npos) const; - size_t find_last_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_of(wxChar c, size_t nStart = npos) const - { return rfind(c, nStart); } - - // find first/last occurence of any character not in the set - - // as strspn() (starting from nStart), returns npos on failure - size_t find_first_not_of(const wxStringBase& str, size_t nStart = 0) const - { return find_first_not_of(str.c_str(), nStart); } - // same as above - size_t find_first_not_of(const wxChar* sz, size_t nStart = 0) const; - size_t find_first_not_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_first_not_of(wxChar ch, size_t nStart = 0) const; - // as strcspn() - size_t find_last_not_of(const wxStringBase& str, size_t nStart = npos) const - { return find_last_not_of(str.c_str(), nStart); } - // same as above - size_t find_last_not_of(const wxChar* sz, size_t nStart = npos) const; - size_t find_last_not_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_not_of(wxChar ch, size_t nStart = npos) const; - - // All compare functions return -1, 0 or 1 if the [sub]string is less, - // equal or greater than the compare() argument. - - // comparison with another string - int compare(const wxStringBase& str) const; - // comparison with a substring - int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; - // comparison of 2 substrings - int compare(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2) const; - // comparison with a c string - int compare(const wxChar* sz) const; - // substring comparison with first nCount characters of sz - int compare(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount = npos) const; - - size_type copy(wxChar* s, size_type n, size_type pos = 0); - - // substring extraction - wxStringBase substr(size_t nStart = 0, size_t nLen = npos) const; - - // string += string - wxStringBase& operator+=(const wxStringBase& s) { return append(s); } - // string += C string - wxStringBase& operator+=(const wxChar *psz) { return append(psz); } - // string += char - wxStringBase& operator+=(wxChar ch) { return append(1, ch); } -}; - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxString: string class trying to be compatible with std::string, MFC -// CString and wxWindows 1.x wxString all at once -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxString : public wxStringBase -{ -#if !wxUSE_STL -friend class WXDLLIMPEXP_FWD_BASE wxArrayString; -#endif - - // NB: special care was taken in arranging the member functions in such order - // that all inline functions can be effectively inlined, verify that all - // performance critical functions are still inlined if you change order! -private: - // if we hadn't made these operators private, it would be possible to - // compile "wxString s; s = 17;" without any warnings as 17 is implicitly - // converted to char in C and we do have operator=(char) - // - // NB: we don't need other versions (short/long and unsigned) as attempt - // to assign another numeric type to wxString will now result in - // ambiguity between operator=(char) and operator=(int) - wxString& operator=(int); - - // these methods are not implemented - there is _no_ conversion from int to - // string, you're doing something wrong if the compiler wants to call it! - // - // try `s << i' or `s.Printf("%d", i)' instead - wxString(int); - -public: - // constructors and destructor - // ctor for an empty string - wxString() : wxStringBase() { } - // copy ctor - wxString(const wxStringBase& stringSrc) : wxStringBase(stringSrc) { } - wxString(const wxString& stringSrc) : wxStringBase(stringSrc) { } - // string containing nRepeat copies of ch - wxString(wxChar ch, size_t nRepeat = 1) - : wxStringBase(nRepeat, ch) { } - wxString(size_t nRepeat, wxChar ch) - : wxStringBase(nRepeat, ch) { } - // ctor takes first nLength characters from C string - // (default value of npos means take all the string) - wxString(const wxChar *psz) - : wxStringBase(psz ? psz : wxT("")) { } - wxString(const wxChar *psz, size_t nLength) - : wxStringBase(psz, nLength) { } - wxString(const wxChar *psz, - const wxMBConv& WXUNUSED(conv), - size_t nLength = npos) - : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { } - - // even if we're not built with wxUSE_STL == 1 it is very convenient to allow - // implicit conversions from std::string to wxString as this allows to use - // the same strings in non-GUI and GUI code, however we don't want to - // unconditionally add this ctor as it would make wx lib dependent on - // libstdc++ on some Linux versions which is bad, so instead we ask the - // client code to define this wxUSE_STD_STRING symbol if they need it -#if wxUSE_STD_STRING - wxString(const wxStdString& s) - : wxStringBase(s.c_str()) { } -#endif // wxUSE_STD_STRING - -#if wxUSE_UNICODE - // from multibyte string - wxString(const char *psz, const wxMBConv& conv, size_t nLength = npos); - // from wxWCharBuffer (i.e. return from wxGetString) - wxString(const wxWCharBuffer& psz) : wxStringBase(psz.data()) { } -#else // ANSI - // from C string (for compilers using unsigned char) - wxString(const unsigned char* psz) - : wxStringBase((const char*)psz) { } - // from part of C string (for compilers using unsigned char) - wxString(const unsigned char* psz, size_t nLength) - : wxStringBase((const char*)psz, nLength) { } - -#if wxUSE_WCHAR_T - // from wide (Unicode) string - wxString(const wchar_t *pwz, - const wxMBConv& conv = wxConvLibc, - size_t nLength = npos); -#endif // !wxUSE_WCHAR_T - - // from wxCharBuffer - wxString(const wxCharBuffer& psz) - : wxStringBase(psz) { } -#endif // Unicode/ANSI - - // generic attributes & operations - // as standard strlen() - size_t Len() const { return length(); } - // string contains any characters? - bool IsEmpty() const { return empty(); } - // empty string is "false", so !str will return true - bool operator!() const { return empty(); } - // truncate the string to given length - wxString& Truncate(size_t uiLen); - // empty string contents - void Empty() - { - Truncate(0); - - wxASSERT_MSG( empty(), wxT("string not empty after call to Empty()?") ); - } - // empty the string and free memory - void Clear() - { - wxString tmp(wxEmptyString); - swap(tmp); - } - - // contents test - // Is an ascii value - bool IsAscii() const; - // Is a number - bool IsNumber() const; - // Is a word - bool IsWord() const; - - // data access (all indexes are 0 based) - // read access - wxChar GetChar(size_t n) const - { return at(n); } - // read/write access - wxChar& GetWritableChar(size_t n) - { return at(n); } - // write access - void SetChar(size_t n, wxChar ch) - { at(n) = ch; } - - // get last character - wxChar Last() const - { - wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); - - return at(length() - 1); - } - - // get writable last character - wxChar& Last() - { - wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); - return at(length() - 1); - } - - /* - Note that we we must define all of the overloads below to avoid - ambiguity when using str[0]. Also note that for a conforming compiler we - don't need const version of operatorp[] at all as indexed access to - const string is provided by implicit conversion to "const wxChar *" - below and defining them would only result in ambiguities, but some other - compilers refuse to compile "str[0]" without them. - */ - -#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__) - wxChar operator[](int n) const - { return wxStringBase::at(n); } - wxChar operator[](size_type n) const - { return wxStringBase::at(n); } -#ifndef wxSIZE_T_IS_UINT - wxChar operator[](unsigned int n) const - { return wxStringBase::at(n); } -#endif // size_t != unsigned int -#endif // broken compiler - - - // operator versions of GetWriteableChar() - wxChar& operator[](int n) - { return wxStringBase::at(n); } - wxChar& operator[](size_type n) - { return wxStringBase::at(n); } -#ifndef wxSIZE_T_IS_UINT - wxChar& operator[](unsigned int n) - { return wxStringBase::at(n); } -#endif // size_t != unsigned int - - // implicit conversion to C string - operator const wxChar*() const { return c_str(); } - - // identical to c_str(), for wxWin 1.6x compatibility - const wxChar* wx_str() const { return c_str(); } - // identical to c_str(), for MFC compatibility - const wxChar* GetData() const { return c_str(); } - -#if wxABI_VERSION >= 20804 - // conversion to *non-const* multibyte or widestring buffer; modifying - // returned buffer won't affect the string, these methods are only useful - // for passing values to const-incorrect functions - wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const - { return mb_str(conv); } -#if wxUSE_WCHAR_T - wxWritableWCharBuffer wchar_str() const { return wc_str(wxConvLibc); } -#endif -#endif // wxABI_VERSION >= 20804 - - // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for - // converting numbers or strings which are certain not to contain special - // chars (typically system functions, X atoms, environment variables etc.) - // - // the behaviour of these functions with the strings containing anything - // else than 7 bit ASCII characters is undefined, use at your own risk. -#if wxUSE_UNICODE - static wxString FromAscii(const char *ascii); // string - static wxString FromAscii(const char ascii); // char - const wxCharBuffer ToAscii() const; -#else // ANSI - static wxString FromAscii(const char *ascii) { return wxString( ascii ); } - static wxString FromAscii(const char ascii) { return wxString( ascii ); } - const char *ToAscii() const { return c_str(); } -#endif // Unicode/!Unicode - -#if wxABI_VERSION >= 20804 - // conversion to/from UTF-8: -#if wxUSE_UNICODE - static wxString FromUTF8(const char *utf8) - { return wxString(utf8, wxConvUTF8); } - static wxString FromUTF8(const char *utf8, size_t len) - { return wxString(utf8, wxConvUTF8, len); } - const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); } - const wxCharBuffer ToUTF8() const { return utf8_str(); } -#elif wxUSE_WCHAR_T // ANSI - static wxString FromUTF8(const char *utf8) - { return wxString(wxConvUTF8.cMB2WC(utf8)); } - static wxString FromUTF8(const char *utf8, size_t len) - { - size_t wlen; - wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); - return wxString(buf.data(), wxConvLibc, wlen); - } - const wxCharBuffer utf8_str() const - { return wxConvUTF8.cWC2MB(wc_str(wxConvLibc)); } - const wxCharBuffer ToUTF8() const { return utf8_str(); } -#endif // Unicode/ANSI -#endif // wxABI_VERSION >= 20804 - -#if wxABI_VERSION >= 20804 - // functions for storing binary data in wxString: -#if wxUSE_UNICODE - static wxString From8BitData(const char *data, size_t len) - { return wxString(data, wxConvISO8859_1, len); } - // version for NUL-terminated data: - static wxString From8BitData(const char *data) - { return wxString(data, wxConvISO8859_1); } - const wxCharBuffer To8BitData() const { return mb_str(wxConvISO8859_1); } -#else // ANSI - static wxString From8BitData(const char *data, size_t len) - { return wxString(data, len); } - // version for NUL-terminated data: - static wxString From8BitData(const char *data) - { return wxString(data); } - const char *To8BitData() const { return c_str(); } -#endif // Unicode/ANSI -#endif // wxABI_VERSION >= 20804 - - // conversions with (possible) format conversions: have to return a - // buffer with temporary data - // - // the functions defined (in either Unicode or ANSI) mode are mb_str() to - // return an ANSI (multibyte) string, wc_str() to return a wide string and - // fn_str() to return a string which should be used with the OS APIs - // accepting the file names. The return value is always the same, but the - // type differs because a function may either return pointer to the buffer - // directly or have to use intermediate buffer for translation. -#if wxUSE_UNICODE - const wxCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const; - - const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } - - const wxChar* wc_str() const { return c_str(); } - - // for compatibility with !wxUSE_UNICODE version - const wxChar* wc_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } - -#if wxMBFILES - const wxCharBuffer fn_str() const { return mb_str(wxConvFile); } -#else // !wxMBFILES - const wxChar* fn_str() const { return c_str(); } -#endif // wxMBFILES/!wxMBFILES -#else // ANSI - const wxChar* mb_str() const { return c_str(); } - - // for compatibility with wxUSE_UNICODE version - const wxChar* mb_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } - - const wxWX2MBbuf mbc_str() const { return mb_str(); } - -#if wxUSE_WCHAR_T - const wxWCharBuffer wc_str(const wxMBConv& conv) const; -#endif // wxUSE_WCHAR_T -#ifdef __WXOSX__ - const wxCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLocal ) ); } -#else - const wxChar* fn_str() const { return c_str(); } -#endif -#endif // Unicode/ANSI - - // overloaded assignment - // from another wxString - wxString& operator=(const wxStringBase& stringSrc) - { return (wxString&)wxStringBase::operator=(stringSrc); } - // from a character - wxString& operator=(wxChar ch) - { return (wxString&)wxStringBase::operator=(ch); } - // from a C string - STL probably will crash on NULL, - // so we need to compensate in that case -#if wxUSE_STL - wxString& operator=(const wxChar *psz) - { if(psz) wxStringBase::operator=(psz); else Clear(); return *this; } -#else - wxString& operator=(const wxChar *psz) - { return (wxString&)wxStringBase::operator=(psz); } -#endif - -#if wxUSE_UNICODE - // from wxWCharBuffer - wxString& operator=(const wxWCharBuffer& psz) - { (void) operator=((const wchar_t *)psz); return *this; } -#else // ANSI - // from another kind of C string - wxString& operator=(const unsigned char* psz); -#if wxUSE_WCHAR_T - // from a wide string - wxString& operator=(const wchar_t *pwz); -#endif - // from wxCharBuffer - wxString& operator=(const wxCharBuffer& psz) - { (void) operator=((const char *)psz); return *this; } -#endif // Unicode/ANSI - - // string concatenation - // in place concatenation - /* - Concatenate and return the result. Note that the left to right - associativity of << allows to write things like "str << str1 << str2 - << ..." (unlike with +=) - */ - // string += string - wxString& operator<<(const wxString& s) - { -#if !wxUSE_STL - wxASSERT_MSG( s.GetStringData()->IsValid(), - wxT("did you forget to call UngetWriteBuf()?") ); -#endif - - append(s); - return *this; - } - // string += C string - wxString& operator<<(const wxChar *psz) - { append(psz); return *this; } - // string += char - wxString& operator<<(wxChar ch) { append(1, ch); return *this; } - - // string += buffer (i.e. from wxGetString) -#if wxUSE_UNICODE - wxString& operator<<(const wxWCharBuffer& s) - { (void)operator<<((const wchar_t *)s); return *this; } - void operator+=(const wxWCharBuffer& s) - { (void)operator<<((const wchar_t *)s); } -#else // !wxUSE_UNICODE - wxString& operator<<(const wxCharBuffer& s) - { (void)operator<<((const char *)s); return *this; } - void operator+=(const wxCharBuffer& s) - { (void)operator<<((const char *)s); } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - - // string += C string - wxString& Append(const wxString& s) - { - // test for empty() to share the string if possible - if ( empty() ) - *this = s; - else - append(s); - return *this; - } - wxString& Append(const wxChar* psz) - { append(psz); return *this; } - // append count copies of given character - wxString& Append(wxChar ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(const wxChar* psz, size_t nLen) - { append(psz, nLen); return *this; } - - // prepend a string, return the string itself - wxString& Prepend(const wxString& str) - { *this = str + *this; return *this; } - - // non-destructive concatenation - // two strings - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, - const wxString& string2); - // string with a single char - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); - // char with a string - friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); - // string with C string - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, - const wxChar *psz); - // C string with string - friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, - const wxString& string); - - // stream-like functions - // insert an int into string - wxString& operator<<(int i) - { return (*this) << Format(wxT("%d"), i); } - // insert an unsigned int into string - wxString& operator<<(unsigned int ui) - { return (*this) << Format(wxT("%u"), ui); } - // insert a long into string - wxString& operator<<(long l) - { return (*this) << Format(wxT("%ld"), l); } - // insert an unsigned long into string - wxString& operator<<(unsigned long ul) - { return (*this) << Format(wxT("%lu"), ul); } -#if defined wxLongLong_t && !defined wxLongLongIsLong - // insert a long long if they exist and aren't longs - wxString& operator<<(wxLongLong_t ll) - { - const wxChar *fmt = wxT("%") wxLongLongFmtSpec wxT("d"); - return (*this) << Format(fmt, ll); - } - // insert an unsigned long long - wxString& operator<<(wxULongLong_t ull) - { - const wxChar *fmt = wxT("%") wxLongLongFmtSpec wxT("u"); - return (*this) << Format(fmt , ull); - } -#endif - // insert a float into string - wxString& operator<<(float f) - { return (*this) << Format(wxT("%f"), f); } - // insert a double into string - wxString& operator<<(double d) - { return (*this) << Format(wxT("%g"), d); } - - // string comparison - // case-sensitive comparison (returns a value < 0, = 0 or > 0) - int Cmp(const wxChar *psz) const; - int Cmp(const wxString& s) const; - // same as Cmp() but not case-sensitive - int CmpNoCase(const wxChar *psz) const; - int CmpNoCase(const wxString& s) const; - // test for the string equality, either considering case or not - // (if compareWithCase then the case matters) - bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const - { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; } - // comparison with a single character: returns true if equal - bool IsSameAs(wxChar c, bool compareWithCase = true) const - { - return (length() == 1) && (compareWithCase ? GetChar(0u) == c - : wxToupper(GetChar(0u)) == wxToupper(c)); - } - - // simple sub-string extraction - // return substring starting at nFirst of length nCount (or till the end - // if nCount = default value) - wxString Mid(size_t nFirst, size_t nCount = npos) const; - - // operator version of Mid() - wxString operator()(size_t start, size_t len) const - { return Mid(start, len); } - - // check if the string starts with the given prefix and return the rest - // of the string in the provided pointer if it is not NULL; otherwise - // return false - bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; - // check if the string ends with the given suffix and return the - // beginning of the string before the suffix in the provided pointer if - // it is not NULL; otherwise return false - bool EndsWith(const wxChar *suffix, wxString *rest = NULL) const; - - // get first nCount characters - wxString Left(size_t nCount) const; - // get last nCount characters - wxString Right(size_t nCount) const; - // get all characters before the first occurance of ch - // (returns the whole string if ch not found) - wxString BeforeFirst(wxChar ch) const; - // get all characters before the last occurence of ch - // (returns empty string if ch not found) - wxString BeforeLast(wxChar ch) const; - // get all characters after the first occurence of ch - // (returns empty string if ch not found) - wxString AfterFirst(wxChar ch) const; - // get all characters after the last occurence of ch - // (returns the whole string if ch not found) - wxString AfterLast(wxChar ch) const; - - // for compatibility only, use more explicitly named functions above - wxString Before(wxChar ch) const { return BeforeLast(ch); } - wxString After(wxChar ch) const { return AfterFirst(ch); } - - // case conversion - // convert to upper case in place, return the string itself - wxString& MakeUpper(); - // convert to upper case, return the copy of the string - // Here's something to remember: BC++ doesn't like returns in inlines. - wxString Upper() const ; - // convert to lower case in place, return the string itself - wxString& MakeLower(); - // convert to lower case, return the copy of the string - wxString Lower() const ; - - // trimming/padding whitespace (either side) and truncating - // remove spaces from left or from right (default) side - wxString& Trim(bool bFromRight = true); - // add nCount copies chPad in the beginning or at the end (default) - wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true); - - // searching and replacing - // searching (return starting index, or -1 if not found) - int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr - // searching (return starting index, or -1 if not found) - int Find(const wxChar *pszSub) const; // like strstr - // replace first (or all of bReplaceAll) occurences of substring with - // another string, returns the number of replacements made - size_t Replace(const wxChar *szOld, - const wxChar *szNew, - bool bReplaceAll = true); - - // check if the string contents matches a mask containing '*' and '?' - bool Matches(const wxChar *szMask) const; - - // conversion to numbers: all functions return true only if the whole - // string is a number and put the value of this number into the pointer - // provided, the base is the numeric base in which the conversion should be - // done and must be comprised between 2 and 36 or be 0 in which case the - // standard C rules apply (leading '0' => octal, "0x" => hex) - // convert to a signed integer - bool ToLong(long *val, int base = 10) const; - // convert to an unsigned integer - bool ToULong(unsigned long *val, int base = 10) const; - // convert to wxLongLong -#if defined(wxLongLong_t) - bool ToLongLong(wxLongLong_t *val, int base = 10) const; - // convert to wxULongLong - bool ToULongLong(wxULongLong_t *val, int base = 10) const; -#endif // wxLongLong_t - // convert to a double - bool ToDouble(double *val) const; - - - - // formatted input/output - // as sprintf(), returns the number of characters written or < 0 on error - // (take 'this' into account in attribute parameter count) - int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; - // as vprintf(), returns the number of characters written or < 0 on error - int PrintfV(const wxChar* pszFormat, va_list argptr); - - // returns the string containing the result of Printf() to it - static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1; - // the same as above, but takes a va_list - static wxString FormatV(const wxChar *pszFormat, va_list argptr); - - // raw access to string memory - // ensure that string has space for at least nLen characters - // only works if the data of this string is not shared - bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; } - // minimize the string's memory - // only works if the data of this string is not shared - bool Shrink(); -#if !wxUSE_STL - // get writable buffer of at least nLen bytes. Unget() *must* be called - // a.s.a.p. to put string back in a reasonable state! - wxChar *GetWriteBuf(size_t nLen); - // call this immediately after GetWriteBuf() has been used - void UngetWriteBuf(); - void UngetWriteBuf(size_t nLen); -#endif - - // wxWidgets version 1 compatibility functions - - // use Mid() - wxString SubString(size_t from, size_t to) const - { return Mid(from, (to - from + 1)); } - // values for second parameter of CompareTo function - enum caseCompare {exact, ignoreCase}; - // values for first parameter of Strip function - enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; - - // use Printf() - // (take 'this' into account in attribute parameter count) - int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; - - // use Cmp() - inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const - { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } - - // use Len - size_t Length() const { return length(); } - // Count the number of characters - int Freq(wxChar ch) const; - // use MakeLower - void LowerCase() { MakeLower(); } - // use MakeUpper - void UpperCase() { MakeUpper(); } - // use Trim except that it doesn't change this string - wxString Strip(stripType w = trailing) const; - - // use Find (more general variants not yet supported) - size_t Index(const wxChar* psz) const { return Find(psz); } - size_t Index(wxChar ch) const { return Find(ch); } - // use Truncate - wxString& Remove(size_t pos) { return Truncate(pos); } - wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } - - wxString& Remove(size_t nStart, size_t nLen) - { return (wxString&)erase( nStart, nLen ); } - - // use Find() - int First( const wxChar ch ) const { return Find(ch); } - int First( const wxChar* psz ) const { return Find(psz); } - int First( const wxString &str ) const { return Find(str); } - int Last( const wxChar ch ) const { return Find(ch, true); } - bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } - - // use empty() - bool IsNull() const { return empty(); } - - // std::string compatibility functions - - // take nLen chars starting at nPos - wxString(const wxString& str, size_t nPos, size_t nLen) - : wxStringBase(str, nPos, nLen) { } - // take all characters from pStart to pEnd - wxString(const void *pStart, const void *pEnd) - : wxStringBase((const wxChar*)pStart, (const wxChar*)pEnd) { } -#if wxUSE_STL - wxString(const_iterator first, const_iterator last) - : wxStringBase(first, last) { } -#endif - - // lib.string.modifiers - // append elements str[pos], ..., str[pos+n] - wxString& append(const wxString& str, size_t pos, size_t n) - { return (wxString&)wxStringBase::append(str, pos, n); } - // append a string - wxString& append(const wxString& str) - { return (wxString&)wxStringBase::append(str); } - // append first n (or all if n == npos) characters of sz - wxString& append(const wxChar *sz) - { return (wxString&)wxStringBase::append(sz); } - wxString& append(const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::append(sz, n); } - // append n copies of ch - wxString& append(size_t n, wxChar ch) - { return (wxString&)wxStringBase::append(n, ch); } - // append from first to last - wxString& append(const_iterator first, const_iterator last) - { return (wxString&)wxStringBase::append(first, last); } - - // same as `this_string = str' - wxString& assign(const wxString& str) - { return (wxString&)wxStringBase::assign(str); } - // same as ` = str[pos..pos + n] - wxString& assign(const wxString& str, size_t pos, size_t n) - { return (wxString&)wxStringBase::assign(str, pos, n); } - // same as `= first n (or all if n == npos) characters of sz' - wxString& assign(const wxChar *sz) - { return (wxString&)wxStringBase::assign(sz); } - wxString& assign(const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::assign(sz, n); } - // same as `= n copies of ch' - wxString& assign(size_t n, wxChar ch) - { return (wxString&)wxStringBase::assign(n, ch); } - // assign from first to last - wxString& assign(const_iterator first, const_iterator last) - { return (wxString&)wxStringBase::assign(first, last); } - - // string comparison -#if !defined(HAVE_STD_STRING_COMPARE) - int compare(const wxStringBase& str) const; - // comparison with a substring - int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; - // comparison of 2 substrings - int compare(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2) const; - // just like strcmp() - int compare(const wxChar* sz) const; - // substring comparison with first nCount characters of sz - int compare(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount = npos) const; -#endif // !defined HAVE_STD_STRING_COMPARE - - // insert another string - wxString& insert(size_t nPos, const wxString& str) - { return (wxString&)wxStringBase::insert(nPos, str); } - // insert n chars of str starting at nStart (in str) - wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) - { return (wxString&)wxStringBase::insert(nPos, str, nStart, n); } - // insert first n (or all if n == npos) characters of sz - wxString& insert(size_t nPos, const wxChar *sz) - { return (wxString&)wxStringBase::insert(nPos, sz); } - wxString& insert(size_t nPos, const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::insert(nPos, sz, n); } - // insert n copies of ch - wxString& insert(size_t nPos, size_t n, wxChar ch) - { return (wxString&)wxStringBase::insert(nPos, n, ch); } - iterator insert(iterator it, wxChar ch) - { return wxStringBase::insert(it, ch); } - void insert(iterator it, const_iterator first, const_iterator last) - { wxStringBase::insert(it, first, last); } - void insert(iterator it, size_type n, wxChar ch) - { wxStringBase::insert(it, n, ch); } - - // delete characters from nStart to nStart + nLen - wxString& erase(size_type pos = 0, size_type n = npos) - { return (wxString&)wxStringBase::erase(pos, n); } - iterator erase(iterator first, iterator last) - { return wxStringBase::erase(first, last); } - iterator erase(iterator first) - { return wxStringBase::erase(first); } - -#ifdef wxSTRING_BASE_HASNT_CLEAR - void clear() { erase(); } -#endif - - // replaces the substring of length nLen starting at nStart - wxString& replace(size_t nStart, size_t nLen, const wxChar* sz) - { return (wxString&)wxStringBase::replace(nStart, nLen, sz); } - // replaces the substring of length nLen starting at nStart - wxString& replace(size_t nStart, size_t nLen, const wxString& str) - { return (wxString&)wxStringBase::replace(nStart, nLen, str); } - // replaces the substring with nCount copies of ch - wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch) - { return (wxString&)wxStringBase::replace(nStart, nLen, nCount, ch); } - // replaces a substring with another substring - wxString& replace(size_t nStart, size_t nLen, - const wxString& str, size_t nStart2, size_t nLen2) - { return (wxString&)wxStringBase::replace(nStart, nLen, str, - nStart2, nLen2); } - // replaces the substring with first nCount chars of sz - wxString& replace(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount) - { return (wxString&)wxStringBase::replace(nStart, nLen, sz, nCount); } - wxString& replace(iterator first, iterator last, const_pointer s) - { return (wxString&)wxStringBase::replace(first, last, s); } - wxString& replace(iterator first, iterator last, const_pointer s, - size_type n) - { return (wxString&)wxStringBase::replace(first, last, s, n); } - wxString& replace(iterator first, iterator last, const wxString& s) - { return (wxString&)wxStringBase::replace(first, last, s); } - wxString& replace(iterator first, iterator last, size_type n, wxChar c) - { return (wxString&)wxStringBase::replace(first, last, n, c); } - wxString& replace(iterator first, iterator last, - const_iterator first1, const_iterator last1) - { return (wxString&)wxStringBase::replace(first, last, first1, last1); } - - // string += string - wxString& operator+=(const wxString& s) - { return (wxString&)wxStringBase::operator+=(s); } - // string += C string - wxString& operator+=(const wxChar *psz) - { return (wxString&)wxStringBase::operator+=(psz); } - // string += char - wxString& operator+=(wxChar ch) - { return (wxString&)wxStringBase::operator+=(ch); } -}; - -// notice that even though for many compilers the friend declarations above are -// enough, from the point of view of C++ standard we must have the declarations -// here as friend ones are not injected in the enclosing namespace and without -// them the code fails to compile with conforming compilers such as xlC or g++4 -wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); -wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); -wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); - - -// define wxArrayString, for compatibility -#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL - #include "wx/arrstr.h" -#endif - -#if wxUSE_STL - // return an empty wxString (not very useful with wxUSE_STL == 1) - inline const wxString wxGetEmptyString() { return wxString(); } -#else // !wxUSE_STL - // return an empty wxString (more efficient than wxString() here) - inline const wxString& wxGetEmptyString() - { - return *(wxString *)&wxEmptyString; - } -#endif // wxUSE_STL/!wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxStringBuffer: a tiny class allowing to get a writable pointer into string -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -class WXDLLIMPEXP_BASE wxStringBuffer -{ -public: - wxStringBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(lenWanted) - { } - - ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); } - - operator wxChar*() { return m_buf.data(); } - -private: - wxString& m_str; -#if wxUSE_UNICODE - wxWCharBuffer m_buf; -#else - wxCharBuffer m_buf; -#endif - - DECLARE_NO_COPY_CLASS(wxStringBuffer) -}; - -class WXDLLIMPEXP_BASE wxStringBufferLength -{ -public: - wxStringBufferLength(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false) - { } - - ~wxStringBufferLength() - { - wxASSERT(m_lenSet); - m_str.assign(m_buf.data(), m_len); - } - - operator wxChar*() { return m_buf.data(); } - void SetLength(size_t length) { m_len = length; m_lenSet = true; } - -private: - wxString& m_str; -#if wxUSE_UNICODE - wxWCharBuffer m_buf; -#else - wxCharBuffer m_buf; -#endif - size_t m_len; - bool m_lenSet; - - DECLARE_NO_COPY_CLASS(wxStringBufferLength) -}; - -#else // if !wxUSE_STL - -class WXDLLIMPEXP_BASE wxStringBuffer -{ -public: - wxStringBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL) - { m_buf = m_str.GetWriteBuf(lenWanted); } - - ~wxStringBuffer() { m_str.UngetWriteBuf(); } - - operator wxChar*() const { return m_buf; } - -private: - wxString& m_str; - wxChar *m_buf; - - DECLARE_NO_COPY_CLASS(wxStringBuffer) -}; - -class WXDLLIMPEXP_BASE wxStringBufferLength -{ -public: - wxStringBufferLength(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) - { - m_buf = m_str.GetWriteBuf(lenWanted); - wxASSERT(m_buf != NULL); - } - - ~wxStringBufferLength() - { - wxASSERT(m_lenSet); - m_str.UngetWriteBuf(m_len); - } - - operator wxChar*() const { return m_buf; } - void SetLength(size_t length) { m_len = length; m_lenSet = true; } - -private: - wxString& m_str; - wxChar *m_buf; - size_t m_len; - bool m_lenSet; - - DECLARE_NO_COPY_CLASS(wxStringBufferLength) -}; - -#endif // !wxUSE_STL - -// --------------------------------------------------------------------------- -// wxString comparison functions: operator versions are always case sensitive -// --------------------------------------------------------------------------- - -// note that when wxUSE_STL == 1 the comparison operators taking std::string -// are used and defining them also for wxString would only result in -// compilation ambiguities when comparing std::string and wxString -#if !wxUSE_STL - -inline bool operator==(const wxString& s1, const wxString& s2) - { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); } -inline bool operator==(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) == 0; } -inline bool operator==(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) == 0; } -inline bool operator!=(const wxString& s1, const wxString& s2) - { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); } -inline bool operator!=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) != 0; } -inline bool operator!=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) != 0; } -inline bool operator< (const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) < 0; } -inline bool operator< (const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) < 0; } -inline bool operator< (const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) > 0; } -inline bool operator> (const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) > 0; } -inline bool operator> (const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) > 0; } -inline bool operator> (const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) < 0; } -inline bool operator<=(const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) <= 0; } -inline bool operator<=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) <= 0; } -inline bool operator<=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) >= 0; } -inline bool operator>=(const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) >= 0; } -inline bool operator>=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) >= 0; } -inline bool operator>=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) <= 0; } - -#if wxUSE_UNICODE -inline bool operator==(const wxString& s1, const wxWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) == 0); } -inline bool operator==(const wxWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) != 0); } -inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) != 0); } -#else // !wxUSE_UNICODE -inline bool operator==(const wxString& s1, const wxCharBuffer& s2) - { return (s1.Cmp((const char *)s2) == 0); } -inline bool operator==(const wxCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxCharBuffer& s2) - { return (s1.Cmp((const char *)s2) != 0); } -inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) != 0); } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -#if wxUSE_UNICODE -inline wxString operator+(const wxString& string, const wxWCharBuffer& buf) - { return string + (const wchar_t *)buf; } -inline wxString operator+(const wxWCharBuffer& buf, const wxString& string) - { return (const wchar_t *)buf + string; } -#else // !wxUSE_UNICODE -inline wxString operator+(const wxString& string, const wxCharBuffer& buf) - { return string + (const char *)buf; } -inline wxString operator+(const wxCharBuffer& buf, const wxString& string) - { return (const char *)buf + string; } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -#endif // !wxUSE_STL - -// comparison with char (those are not defined by std::[w]string and so should -// be always available) -inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); } -inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); } - -// --------------------------------------------------------------------------- -// Implementation only from here until the end of file -// --------------------------------------------------------------------------- - -// don't pollute the library user's name space -#undef wxASSERT_VALID_INDEX - -#if wxUSE_STD_IOSTREAM - -#include "wx/iosfwrap.h" - -WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); - -#endif // wxSTD_STRING_COMPATIBILITY - -#endif // _WX_WXSTRINGH__ diff --git a/Source/3rdParty/wx/include/wx/sysopt.h b/Source/3rdParty/wx/include/wx/sysopt.h deleted file mode 100644 index 5c79a5478..000000000 --- a/Source/3rdParty/wx/include/wx/sysopt.h +++ /dev/null @@ -1,71 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sysopt.h -// Purpose: wxSystemOptions -// Author: Julian Smart -// Modified by: -// Created: 2001-07-10 -// RCS-ID: $Id: sysopt.h 33004 2005-03-23 20:48:50Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SYSOPT_H_ -#define _WX_SYSOPT_H_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// Enables an application to influence the wxWidgets implementation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject -{ -public: - wxSystemOptions() { } - - // User-customizable hints to wxWidgets or associated libraries - // These could also be used to influence GetSystem... calls, indeed - // to implement SetSystemColour/Font/Metric - -#if wxUSE_SYSTEM_OPTIONS - static void SetOption(const wxString& name, const wxString& value); - static void SetOption(const wxString& name, int value); -#endif // wxUSE_SYSTEM_OPTIONS - static wxString GetOption(const wxString& name); - static int GetOptionInt(const wxString& name); - static bool HasOption(const wxString& name); - - static bool IsFalse(const wxString& name) - { - return HasOption(name) && GetOptionInt(name) == 0; - } -}; - -#if !wxUSE_SYSTEM_OPTIONS - -// define inline stubs for accessors to make it possible to use wxSystemOptions -// in the library itself without checking for wxUSE_SYSTEM_OPTIONS all the time - -/* static */ inline -wxString wxSystemOptions::GetOption(const wxString& WXUNUSED(name)) -{ - return wxEmptyString; -} - -/* static */ inline -int wxSystemOptions::GetOptionInt(const wxString& WXUNUSED(name)) -{ - return 0; -} - -/* static */ inline -bool wxSystemOptions::HasOption(const wxString& WXUNUSED(name)) -{ - return false; -} - -#endif // !wxUSE_SYSTEM_OPTIONS - -#endif - // _WX_SYSOPT_H_ - diff --git a/Source/3rdParty/wx/include/wx/tarstrm.h b/Source/3rdParty/wx/include/wx/tarstrm.h deleted file mode 100644 index c18400225..000000000 --- a/Source/3rdParty/wx/include/wx/tarstrm.h +++ /dev/null @@ -1,352 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tarstrm.h -// Purpose: Streams for Tar files -// Author: Mike Wetherell -// RCS-ID: $Id: tarstrm.h 43887 2006-12-09 22:28:11Z MW $ -// Copyright: (c) 2004 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXTARSTREAM_H__ -#define _WX_WXTARSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_TARSTREAM - -#include "wx/archive.h" -#include "wx/hashmap.h" - - -///////////////////////////////////////////////////////////////////////////// -// Constants - -// TypeFlag values -enum { - wxTAR_REGTYPE = '0', // regular file - wxTAR_LNKTYPE = '1', // hard link - wxTAR_SYMTYPE = '2', // symbolic link - wxTAR_CHRTYPE = '3', // character special - wxTAR_BLKTYPE = '4', // block special - wxTAR_DIRTYPE = '5', // directory - wxTAR_FIFOTYPE = '6', // named pipe - wxTAR_CONTTYPE = '7' // contiguous file -}; - -// Archive Formats (use wxTAR_PAX, it's backward compatible) -enum wxTarFormat -{ - wxTAR_USTAR, // POSIX.1-1990 tar format - wxTAR_PAX // POSIX.1-2001 tar format -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarNotifier - -class WXDLLIMPEXP_BASE wxTarNotifier -{ -public: - virtual ~wxTarNotifier() { } - - virtual void OnEntryUpdated(class wxTarEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// Tar Entry - hold the meta data for a file in the tar - -class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry -{ -public: - wxTarEntry(const wxString& name = wxEmptyString, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - virtual ~wxTarEntry(); - - wxTarEntry(const wxTarEntry& entry); - wxTarEntry& operator=(const wxTarEntry& entry); - - // Get accessors - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; - wxString GetInternalName() const { return m_Name; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } - int GetMode() const; - int GetUserId() const { return m_UserId; } - int GetGroupId() const { return m_GroupId; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxDateTime GetDateTime() const { return m_ModifyTime; } - wxDateTime GetAccessTime() const { return m_AccessTime; } - wxDateTime GetCreateTime() const { return m_CreateTime; } - int GetTypeFlag() const { return m_TypeFlag; } - wxString GetLinkName() const { return m_LinkName; } - wxString GetUserName() const { return m_UserName; } - wxString GetGroupName() const { return m_GroupName; } - int GetDevMajor() const { return m_DevMajor; } - int GetDevMinor() const { return m_DevMinor; } - - // is accessors - bool IsDir() const; - bool IsReadOnly() const { return !(m_Mode & 0222); } - - // set accessors - void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE); - void SetUserId(int id) { m_UserId = id; } - void SetGroupId(int id) { m_GroupId = id; } - void SetMode(int mode); - void SetSize(wxFileOffset size) { m_Size = size; } - void SetDateTime(const wxDateTime& dt) { m_ModifyTime = dt; } - void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } - void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } - void SetTypeFlag(int type) { m_TypeFlag = type; } - void SetLinkName(const wxString& link) { m_LinkName = link; } - void SetUserName(const wxString& user) { m_UserName = user; } - void SetGroupName(const wxString& group) { m_GroupName = group; } - void SetDevMajor(int dev) { m_DevMajor = dev; } - void SetDevMinor(int dev) { m_DevMinor = dev; } - - // set is accessors - void SetIsDir(bool isDir = true); - void SetIsReadOnly(bool isReadOnly = true); - - static wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); - - wxTarEntry *Clone() const { return new wxTarEntry(*this); } - - void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } - -private: - void SetOffset(wxFileOffset offset) { m_Offset = offset; } - - virtual wxArchiveEntry* DoClone() const { return Clone(); } - - wxString m_Name; - int m_Mode; - bool m_IsModeSet; - int m_UserId; - int m_GroupId; - wxFileOffset m_Size; - wxFileOffset m_Offset; - wxDateTime m_ModifyTime; - wxDateTime m_AccessTime; - wxDateTime m_CreateTime; - int m_TypeFlag; - wxString m_LinkName; - wxString m_UserName; - wxString m_GroupName; - int m_DevMajor; - int m_DevMinor; - - friend class wxTarInputStream; - - DECLARE_DYNAMIC_CLASS(wxTarEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarInputStream - -WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords); - -class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream -{ -public: - typedef wxTarEntry entry_type; - - wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); - wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); - virtual ~wxTarInputStream(); - - bool OpenEntry(wxTarEntry& entry); - bool CloseEntry(); - - wxTarEntry *GetNextEntry(); - - wxFileOffset GetLength() const { return m_size; } - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } - -protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - -private: - void Init(); - - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } - bool OpenEntry(wxArchiveEntry& entry); - bool IsOpened() const { return m_pos != wxInvalidOffset; } - - wxStreamError ReadHeaders(); - bool ReadExtendedHeader(wxTarHeaderRecords*& recs); - - wxString GetExtendedHeader(const wxString& key) const; - wxString GetHeaderPath() const; - wxFileOffset GetHeaderNumber(int id) const; - wxString GetHeaderString(int id) const; - wxDateTime GetHeaderDate(const wxString& key) const; - - wxFileOffset m_pos; // position within the current entry - wxFileOffset m_offset; // offset to the start of the entry's data - wxFileOffset m_size; // size of the current entry's data - - int m_sumType; - int m_tarType; - class wxTarHeaderBlock *m_hdr; - wxTarHeaderRecords *m_HeaderRecs; - wxTarHeaderRecords *m_GlobalHeaderRecs; - - DECLARE_NO_COPY_CLASS(wxTarInputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarOutputStream - -class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream -{ -public: - wxTarOutputStream(wxOutputStream& stream, - wxTarFormat format = wxTAR_PAX, - wxMBConv& conv = wxConvLocal); - wxTarOutputStream(wxOutputStream *stream, - wxTarFormat format = wxTAR_PAX, - wxMBConv& conv = wxConvLocal); - virtual ~wxTarOutputStream(); - - bool PutNextEntry(wxTarEntry *entry); - - bool PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - - bool PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); - - bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); - bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } - - void Sync(); - bool CloseEntry(); - bool Close(); - - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } - - void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } - int GetBlockingFactor() const { return m_BlockingFactor; } - -protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - -private: - void Init(wxTarFormat format); - - bool PutNextEntry(wxArchiveEntry *entry); - bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) { return true; } - bool IsOpened() const { return m_pos != wxInvalidOffset; } - - bool WriteHeaders(wxTarEntry& entry); - bool ModifyHeader(); - wxString PaxHeaderPath(const wxString& format, const wxString& path); - - void SetExtendedHeader(const wxString& key, const wxString& value); - void SetHeaderPath(const wxString& name); - bool SetHeaderNumber(int id, wxFileOffset n); - void SetHeaderString(int id, const wxString& str); - void SetHeaderDate(const wxString& key, const wxDateTime& datetime); - - wxFileOffset m_pos; // position within the current entry - wxFileOffset m_maxpos; // max pos written - wxFileOffset m_size; // expected entry size - - wxFileOffset m_headpos; // offset within the file to the entry's header - wxFileOffset m_datapos; // offset within the file to the entry's data - - wxFileOffset m_tarstart;// offset within the file to the tar - wxFileOffset m_tarsize; // size of tar so far - - bool m_pax; - int m_BlockingFactor; - wxUint32 m_chksum; - bool m_large; - class wxTarHeaderBlock *m_hdr; - class wxTarHeaderBlock *m_hdr2; - char *m_extendedHdr; - size_t m_extendedSize; - wxString m_badfit; - - DECLARE_NO_COPY_CLASS(wxTarOutputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// Iterators - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -typedef wxArchiveIterator wxTarIter; -typedef wxArchiveIterator > wxTarPairIter; -#endif - - -///////////////////////////////////////////////////////////////////////////// -// wxTarClassFactory - -class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory -{ -public: - typedef wxTarEntry entry_type; - typedef wxTarInputStream instream_type; - typedef wxTarOutputStream outstream_type; - typedef wxTarNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxTarIter iter_type; - typedef wxTarPairIter pairiter_type; -#endif - - wxTarClassFactory(); - - wxTarEntry *NewEntry() const - { return new wxTarEntry; } - wxTarInputStream *NewStream(wxInputStream& stream) const - { return new wxTarInputStream(stream, GetConv()); } - wxTarOutputStream *NewStream(wxOutputStream& stream) const - { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } - wxTarInputStream *NewStream(wxInputStream *stream) const - { return new wxTarInputStream(stream, GetConv()); } - wxTarOutputStream *NewStream(wxOutputStream *stream) const - { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } - - wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const - { return wxTarEntry::GetInternalName(name, format); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxArchiveEntry *DoNewEntry() const - { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const - { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const - { return NewStream(stream); } - -private: - DECLARE_DYNAMIC_CLASS(wxTarClassFactory) -}; - - -#endif // wxUSE_TARSTREAM - -#endif // _WX_WXTARSTREAM_H__ diff --git a/Source/3rdParty/wx/include/wx/tbarbase.h b/Source/3rdParty/wx/include/wx/tbarbase.h deleted file mode 100644 index 1c0814955..000000000 --- a/Source/3rdParty/wx/include/wx/tbarbase.h +++ /dev/null @@ -1,607 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tbarbase.h -// Purpose: Base class for toolbar classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tbarbase.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TBARBASE_H_ -#define _WX_TBARBASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TOOLBAR - -#include "wx/bitmap.h" -#include "wx/list.h" -#include "wx/control.h" - -class WXDLLIMPEXP_FWD_CORE wxToolBarBase; -class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase; -class WXDLLIMPEXP_FWD_CORE wxImage; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; -extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; -extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; - -enum wxToolBarToolStyle -{ - wxTOOL_STYLE_BUTTON = 1, - wxTOOL_STYLE_SEPARATOR = 2, - wxTOOL_STYLE_CONTROL -}; - -// ---------------------------------------------------------------------------- -// wxToolBarTool is a toolbar element. -// -// It has a unique id (except for the separators which always have id wxID_ANY), the -// style (telling whether it is a normal button, separator or a control), the -// state (toggled or not, enabled or not) and short and long help strings. The -// default implementations use the short help string for the tooltip text which -// is popped up when the mouse pointer enters the tool and the long help string -// for the applications status bar. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolBarToolBase : public wxObject -{ -public: - // ctors & dtor - // ------------ - - wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL, - int toolid = wxID_SEPARATOR, - const wxString& label = wxEmptyString, - const wxBitmap& bmpNormal = wxNullBitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = (wxObject *) NULL, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - : m_label(label), - m_shortHelpString(shortHelpString), - m_longHelpString(longHelpString) - { - m_tbar = tbar; - m_id = toolid; - if (m_id == wxID_ANY) - m_id = wxNewId(); - m_clientData = clientData; - - m_bmpNormal = bmpNormal; - m_bmpDisabled = bmpDisabled; - - m_kind = kind; - - m_enabled = true; - m_toggled = false; - - m_toolStyle = toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR - : wxTOOL_STYLE_BUTTON; - } - - wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control) - { - m_tbar = tbar; - m_control = control; - m_id = control->GetId(); - - m_kind = wxITEM_MAX; // invalid value - - m_enabled = true; - m_toggled = false; - - m_toolStyle = wxTOOL_STYLE_CONTROL; - } - - virtual ~wxToolBarToolBase(){} - - // accessors - // --------- - - // general - int GetId() const { return m_id; } - - wxControl *GetControl() const - { - wxASSERT_MSG( IsControl(), wxT("this toolbar tool is not a control") ); - - return m_control; - } - - wxToolBarBase *GetToolBar() const { return m_tbar; } - - // style - bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; } - bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; } - bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; } - int GetStyle() const { return m_toolStyle; } - wxItemKind GetKind() const - { - wxASSERT_MSG( IsButton(), wxT("only makes sense for buttons") ); - - return m_kind; - } - - // state - bool IsEnabled() const { return m_enabled; } - bool IsToggled() const { return m_toggled; } - bool CanBeToggled() const - { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } - - // attributes - const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; } - const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; } - - const wxBitmap& GetBitmap() const - { return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); } - - const wxString& GetLabel() const { return m_label; } - - const wxString& GetShortHelp() const { return m_shortHelpString; } - const wxString& GetLongHelp() const { return m_longHelpString; } - - wxObject *GetClientData() const - { - if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) - { - return (wxObject*)m_control->GetClientData(); - } - else - { - return m_clientData; - } - } - - // modifiers: return true if the state really changed - bool Enable(bool enable); - bool Toggle(bool toggle); - bool SetToggle(bool toggle); - bool SetShortHelp(const wxString& help); - bool SetLongHelp(const wxString& help); - - void Toggle() { Toggle(!IsToggled()); } - - void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } - void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } - - virtual void SetLabel(const wxString& label) { m_label = label; } - - void SetClientData(wxObject *clientData) - { - if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) - { - m_control->SetClientData(clientData); - } - else - { - m_clientData = clientData; - } - } - - // add tool to/remove it from a toolbar - virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; } - virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } - -protected: - wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) - - // tool parameters - int m_toolStyle; // see enum wxToolBarToolStyle - int m_id; // the tool id, wxID_SEPARATOR for separator - wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO - - // as controls have their own client data, no need to waste memory - union - { - wxObject *m_clientData; - wxControl *m_control; - }; - - // tool state - bool m_toggled; - bool m_enabled; - - // normal and disabled bitmaps for the tool, both can be invalid - wxBitmap m_bmpNormal; - wxBitmap m_bmpDisabled; - - // the button label - wxString m_label; - - // short and long help strings - wxString m_shortHelpString; - wxString m_longHelpString; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase) -}; - -// a list of toolbar tools -WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); - -// ---------------------------------------------------------------------------- -// the base class for all toolbars -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolBarBase : public wxControl -{ -public: - wxToolBarBase(); - virtual ~wxToolBarBase(); - - // toolbar construction - // -------------------- - - // the full AddTool() function - // - // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap - // is created and used as the disabled image. - wxToolBarToolBase *AddTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind = wxITEM_NORMAL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return DoAddTool(toolid, label, bitmap, bmpDisabled, kind, - shortHelp, longHelp, data); - } - - // the most common AddTool() version - wxToolBarToolBase *AddTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxString& shortHelp = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp); - } - - // add a check tool, i.e. a tool which can be toggled - wxToolBarToolBase *AddCheckTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, - shortHelp, longHelp, data); - } - - // add a radio tool, i.e. a tool which can be toggled and releases any - // other toggled radio tools in the same group when it happens - wxToolBarToolBase *AddRadioTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO, - shortHelp, longHelp, data); - } - - - // insert the new tool at the given position, if pos == GetToolsCount(), it - // is equivalent to AddTool() - virtual wxToolBarToolBase *InsertTool - ( - size_t pos, - int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL - ); - - virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); - virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool); - - // add an arbitrary control to the toolbar (notice that - // the control will be deleted by the toolbar and that it will also adjust - // its position/size) - // - // NB: the control should have toolbar as its parent - virtual wxToolBarToolBase *AddControl(wxControl *control); - virtual wxToolBarToolBase *InsertControl(size_t pos, wxControl *control); - - // get the control with the given id or return NULL - virtual wxControl *FindControl( int toolid ); - - // add a separator to the toolbar - virtual wxToolBarToolBase *AddSeparator(); - virtual wxToolBarToolBase *InsertSeparator(size_t pos); - - // remove the tool from the toolbar: the caller is responsible for actually - // deleting the pointer - virtual wxToolBarToolBase *RemoveTool(int toolid); - - // delete tool either by index or by position - virtual bool DeleteToolByPos(size_t pos); - virtual bool DeleteTool(int toolid); - - // delete all tools - virtual void ClearTools(); - - // must be called after all buttons have been created to finish toolbar - // initialisation - virtual bool Realize(); - - // tools state - // ----------- - - virtual void EnableTool(int toolid, bool enable); - virtual void ToggleTool(int toolid, bool toggle); - - // Set this to be togglable (or not) - virtual void SetToggle(int toolid, bool toggle); - - // set/get tools client data (not for controls) - virtual wxObject *GetToolClientData(int toolid) const; - virtual void SetToolClientData(int toolid, wxObject *clientData); - - // returns tool pos, or wxNOT_FOUND if tool isn't found - virtual int GetToolPos(int id) const; - - // return true if the tool is toggled - virtual bool GetToolState(int toolid) const; - - virtual bool GetToolEnabled(int toolid) const; - - virtual void SetToolShortHelp(int toolid, const wxString& helpString); - virtual wxString GetToolShortHelp(int toolid) const; - virtual void SetToolLongHelp(int toolid, const wxString& helpString); - virtual wxString GetToolLongHelp(int toolid) const; - - // margins/packing/separation - // -------------------------- - - virtual void SetMargins(int x, int y); - void SetMargins(const wxSize& size) - { SetMargins((int) size.x, (int) size.y); } - virtual void SetToolPacking(int packing) - { m_toolPacking = packing; } - virtual void SetToolSeparation(int separation) - { m_toolSeparation = separation; } - - virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); } - virtual int GetToolPacking() const { return m_toolPacking; } - virtual int GetToolSeparation() const { return m_toolSeparation; } - - // toolbar geometry - // ---------------- - - // set the number of toolbar rows - virtual void SetRows(int nRows); - - // the toolbar can wrap - limit the number of columns or rows it may take - void SetMaxRowsCols(int rows, int cols) - { m_maxRows = rows; m_maxCols = cols; } - int GetMaxRows() const { return m_maxRows; } - int GetMaxCols() const { return m_maxCols; } - - // get/set the size of the bitmaps used by the toolbar: should be called - // before adding any tools to the toolbar - virtual void SetToolBitmapSize(const wxSize& size) - { m_defaultWidth = size.x; m_defaultHeight = size.y; } - virtual wxSize GetToolBitmapSize() const - { return wxSize(m_defaultWidth, m_defaultHeight); } - - // the button size in some implementations is bigger than the bitmap size: - // get the total button size (by default the same as bitmap size) - virtual wxSize GetToolSize() const - { return GetToolBitmapSize(); } - - // returns a (non separator) tool containing the point (x, y) or NULL if - // there is no tool at this point (corrdinates are client) - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, - wxCoord y) const = 0; - - // find the tool by id - wxToolBarToolBase *FindById(int toolid) const; - - // return true if this is a vertical toolbar, otherwise false - bool IsVertical() const { return HasFlag(wxTB_LEFT | wxTB_RIGHT); } - - - // the old versions of the various methods kept for compatibility - // don't use in the new code! - // -------------------------------------------------------------- - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - bool toggle = false, - wxObject *clientData = NULL, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - { - return AddTool(toolid, wxEmptyString, - bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelpString, longHelpString, clientData); - } - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - { - return AddTool(toolid, wxEmptyString, - bitmap, wxNullBitmap, wxITEM_NORMAL, - shortHelpString, longHelpString, NULL); - } - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - bool toggle, - wxCoord xPos, - wxCoord yPos = wxDefaultCoord, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString) - { - return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelp, longHelp, clientData, xPos, yPos); - } - - wxToolBarToolBase *InsertTool(size_t pos, - int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - bool toggle = false, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString) - { - return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelp, longHelp, clientData); - } - - // event handlers - // -------------- - - // NB: these functions are deprecated, use EVT_TOOL_XXX() instead! - - // Only allow toggle if returns true. Call when left button up. - virtual bool OnLeftClick(int toolid, bool toggleDown); - - // Call when right button down. - virtual void OnRightClick(int toolid, long x, long y); - - // Called when the mouse cursor enters a tool bitmap. - // Argument is wxID_ANY if mouse is exiting the toolbar. - virtual void OnMouseEnter(int toolid); - - // more deprecated functions - // ------------------------- - - // use GetToolMargins() instead - wxSize GetMargins() const { return GetToolMargins(); } - - // implementation only from now on - // ------------------------------- - - size_t GetToolsCount() const { return m_tools.GetCount(); } - - // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ; - - // don't want toolbars to accept the focus - virtual bool AcceptsFocus() const { return false; } - -protected: - // to implement in derived classes - // ------------------------------- - - // create a new toolbar tool and add it to the toolbar, this is typically - // implemented by just calling InsertTool() - virtual wxToolBarToolBase *DoAddTool - ( - int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL, - wxCoord xPos = wxDefaultCoord, - wxCoord yPos = wxDefaultCoord - ); - - // the tool is not yet inserted into m_tools list when this function is - // called and will only be added to it if this function succeeds - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0; - - // the tool is still in m_tools list when this function is called, it will - // only be deleted from it if it succeeds - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0; - - // called when the tools enabled flag changes - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0; - - // called when the tool is toggled - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0; - - // called when the tools "can be toggled" flag changes - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; - - // the functions to create toolbar tools - virtual wxToolBarToolBase *CreateTool(int toolid, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) = 0; - - virtual wxToolBarToolBase *CreateTool(wxControl *control) = 0; - - // helper functions - // ---------------- - - // call this from derived class ctor/Create() to ensure that we have either - // wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code - // which randomly checks either one or the other of them and gets confused - // if neither is set (and making one of them 0 is not an option neither as - // then the existing tests would break down) - void FixupStyle(); - - // un-toggle all buttons in the same radio group - void UnToggleRadioGroup(wxToolBarToolBase *tool); - - // the list of all our tools - wxToolBarToolsList m_tools; - - // the offset of the first tool - int m_xMargin; - int m_yMargin; - - // the maximum number of toolbar rows/columns - int m_maxRows; - int m_maxCols; - - // the tool packing and separation - int m_toolPacking, - m_toolSeparation; - - // the size of the toolbar bitmaps - wxCoord m_defaultWidth, m_defaultHeight; - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxToolBarBase) -}; - -// Helper function for creating the image for disabled buttons -bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ; - -#endif // wxUSE_TOOLBAR - -#endif - // _WX_TBARBASE_H_ - diff --git a/Source/3rdParty/wx/include/wx/textbuf.h b/Source/3rdParty/wx/include/wx/textbuf.h deleted file mode 100644 index 97246b6b2..000000000 --- a/Source/3rdParty/wx/include/wx/textbuf.h +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textbuf.h -// Purpose: class wxTextBuffer to work with text buffers of _small_ size -// (buffer is fully loaded in memory) and which understands CR/LF -// differences between platforms. -// Created: 14.11.01 -// Author: Morten Hanssen, Vadim Zeitlin -// Copyright: (c) 1998-2001 Morten Hanssen, Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTBUFFER_H -#define _WX_TEXTBUFFER_H - -#include "wx/defs.h" -#include "wx/arrstr.h" -#include "wx/convauto.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the line termination type (kept wxTextFileType name for compability) -enum wxTextFileType -{ - wxTextFileType_None, // incomplete (the last line of the file only) - wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n' - wxTextFileType_Dos, // 'CR' 'LF' - wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r' - wxTextFileType_Os2 // 'CR' 'LF' -}; - -#include "wx/string.h" - -#if wxUSE_TEXTBUFFER - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// wxTextBuffer -// ---------------------------------------------------------------------------- - -WX_DEFINE_USER_EXPORTED_ARRAY_INT(wxTextFileType, - wxArrayLinesType, - class WXDLLIMPEXP_BASE); - -#endif // wxUSE_TEXTBUFFER - -class WXDLLIMPEXP_BASE wxTextBuffer -{ -public: - // constants and static functions - // default type for current platform (determined at compile time) - static const wxTextFileType typeDefault; - - // this function returns a string which is identical to "text" passed in - // except that the line terminator characters are changed to correspond the - // given type. Called with the default argument, the function translates - // the string to the native format (Unix for Unix, DOS for Windows, ...). - static wxString Translate(const wxString& text, - wxTextFileType type = typeDefault); - - // get the buffer termination string - static const wxChar *GetEOL(wxTextFileType type = typeDefault); - - // the static methods of this class are compiled in even when - // !wxUSE_TEXTBUFFER because they are used by the library itself, but the - // rest can be left out -#if wxUSE_TEXTBUFFER - - // buffer operations - // ----------------- - - // buffer exists? - bool Exists() const; - - // create the buffer if it doesn't already exist - bool Create(); - - // same as Create() but with (another) buffer name - bool Create(const wxString& strBufferName); - - // Open() also loads buffer in memory on success - bool Open(const wxMBConv& conv = wxConvAuto()); - - // same as Open() but with (another) buffer name - bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto()); - - // closes the buffer and frees memory, losing all changes - bool Close(); - - // is buffer currently opened? - bool IsOpened() const { return m_isOpened; } - - // accessors - // --------- - - // get the number of lines in the buffer - size_t GetLineCount() const { return m_aLines.size(); } - - // the returned line may be modified (but don't add CR/LF at the end!) - wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; } - wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; } - - // the current line has meaning only when you're using - // GetFirstLine()/GetNextLine() functions, it doesn't get updated when - // you're using "direct access" i.e. GetLine() - size_t GetCurrentLine() const { return m_nCurLine; } - void GoToLine(size_t n) { m_nCurLine = n; } - bool Eof() const { return m_nCurLine == m_aLines.size(); } - - // these methods allow more "iterator-like" traversal of the list of - // lines, i.e. you may write something like: - // for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... } - - // NB: const is commented out because not all compilers understand - // 'mutable' keyword yet (m_nCurLine should be mutable) - wxString& GetFirstLine() /* const */ - { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; } - wxString& GetNextLine() /* const */ - { return ++m_nCurLine == m_aLines.size() ? ms_eof - : m_aLines[m_nCurLine]; } - wxString& GetPrevLine() /* const */ - { wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; } - wxString& GetLastLine() /* const */ - { m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); } - - // get the type of the line (see also GetEOL) - wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; } - - // guess the type of buffer - wxTextFileType GuessType() const; - - // get the name of the buffer - const wxChar *GetName() const { return m_strBufferName.c_str(); } - - // add/remove lines - // ---------------- - - // add a line to the end - void AddLine(const wxString& str, wxTextFileType type = typeDefault) - { m_aLines.push_back(str); m_aTypes.push_back(type); } - // insert a line before the line number n - void InsertLine(const wxString& str, - size_t n, - wxTextFileType type = typeDefault) - { - m_aLines.insert(m_aLines.begin() + n, str); - m_aTypes.insert(m_aTypes.begin()+n, type); - } - - // delete one line - void RemoveLine(size_t n) - { - m_aLines.erase(m_aLines.begin() + n); - m_aTypes.erase(m_aTypes.begin() + n); - } - - // remove all lines - void Clear() { m_aLines.clear(); m_aTypes.clear(); m_nCurLine = 0; } - - // change the buffer (default argument means "don't change type") - // possibly in another format - bool Write(wxTextFileType typeNew = wxTextFileType_None, - const wxMBConv& conv = wxConvAuto()); - - // dtor - virtual ~wxTextBuffer(); - -protected: - // ctors - // ----- - - // default ctor, use Open(string) - wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; } - - // ctor from filename - wxTextBuffer(const wxString& strBufferName); - - enum wxTextBufferOpenMode { ReadAccess, WriteAccess }; - - // Must implement these in derived classes. - virtual bool OnExists() const = 0; - virtual bool OnOpen(const wxString &strBufferName, - wxTextBufferOpenMode openmode) = 0; - virtual bool OnClose() = 0; - virtual bool OnRead(const wxMBConv& conv) = 0; - virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0; - - static wxString ms_eof; // dummy string returned at EOF - wxString m_strBufferName; // name of the buffer - -private: - wxArrayLinesType m_aTypes; // type of each line - wxArrayString m_aLines; // lines of file - - size_t m_nCurLine; // number of current line in the buffer - - bool m_isOpened; // was the buffer successfully opened the last time? -#endif // wxUSE_TEXTBUFFER - - // copy ctor/assignment operator not implemented - wxTextBuffer(const wxTextBuffer&); - wxTextBuffer& operator=(const wxTextBuffer&); -}; - -#endif // _WX_TEXTBUFFER_H - diff --git a/Source/3rdParty/wx/include/wx/textctrl.h b/Source/3rdParty/wx/include/wx/textctrl.h deleted file mode 100644 index b1b4c0a25..000000000 --- a/Source/3rdParty/wx/include/wx/textctrl.h +++ /dev/null @@ -1,601 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textctrl.h -// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.07.99 -// RCS-ID: $Id: textctrl.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRL_H_BASE_ -#define _WX_TEXTCTRL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TEXTCTRL - -#include "wx/control.h" // the base class -#include "wx/dynarray.h" // wxArrayInt -#include "wx/gdicmn.h" // wxPoint - -// Open Watcom 1.3 does allow only ios::rdbuf() while -// we want something with streambuf parameter -// Also, can't use streambuf if making or using a DLL :-( - -#if defined(__WATCOMC__) || \ - defined(__MWERKS__) || \ - (defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL))) - #define wxHAS_TEXT_WINDOW_STREAM 0 -#elif wxUSE_STD_IOSTREAM - #include "wx/ioswrap.h" - #define wxHAS_TEXT_WINDOW_STREAM 1 -#else - #define wxHAS_TEXT_WINDOW_STREAM 0 -#endif - -#if WXWIN_COMPATIBILITY_2_4 && !wxHAS_TEXT_WINDOW_STREAM - // define old flag if one could use it somewhere - #define NO_TEXT_WINDOW_STREAM -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; - -// ---------------------------------------------------------------------------- -// wxTextCtrl types -// ---------------------------------------------------------------------------- - -// wxTextPos is the position in the text -typedef long wxTextPos; - -// wxTextCoord is the line or row number (which should have been unsigned but -// is long for backwards compatibility) -typedef long wxTextCoord; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxTextCtrlNameStr[]; - -// this is intentionally not enum to avoid warning fixes with -// typecasting from enum type to wxTextCoord -const wxTextCoord wxOutOfRangeTextCoord = -1; -const wxTextCoord wxInvalidTextCoord = -2; - -// ---------------------------------------------------------------------------- -// wxTextCtrl style flags -// ---------------------------------------------------------------------------- - -#define wxTE_NO_VSCROLL 0x0002 -#define wxTE_AUTO_SCROLL 0x0008 - -#define wxTE_READONLY 0x0010 -#define wxTE_MULTILINE 0x0020 -#define wxTE_PROCESS_TAB 0x0040 - -// alignment flags -#define wxTE_LEFT 0x0000 // 0x0000 -#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100 -#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200 -#define wxTE_CENTRE wxTE_CENTER - -// this style means to use RICHEDIT control and does something only under wxMSW -// and Win32 and is silently ignored under all other platforms -#define wxTE_RICH 0x0080 - -#define wxTE_PROCESS_ENTER 0x0400 -#define wxTE_PASSWORD 0x0800 - -// automatically detect the URLs and generate the events when mouse is -// moved/clicked over an URL -// -// this is for Win32 richedit and wxGTK2 multiline controls only so far -#define wxTE_AUTO_URL 0x1000 - -// by default, the Windows text control doesn't show the selection when it -// doesn't have focus - use this style to force it to always show it -#define wxTE_NOHIDESEL 0x2000 - -// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any -// position and wxTE_WORDWRAP to wrap at words boundary -// -// if no wrapping style is given at all, the control wraps at word boundary -#define wxTE_DONTWRAP wxHSCROLL -#define wxTE_CHARWRAP 0x4000 // wrap at any position -#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries -#define wxTE_BESTWRAP 0x0000 // this is the default - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete synonym - #define wxTE_LINEWRAP wxTE_CHARWRAP -#endif // WXWIN_COMPATIBILITY_2_6 - -// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for -// wxTE_RICH controls - can be used together with or instead of wxTE_RICH -#define wxTE_RICH2 0x8000 - -// reuse wxTE_RICH2's value for CAPEDIT control on Windows CE -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -#define wxTE_CAPITALIZE wxTE_RICH2 -#else -#define wxTE_CAPITALIZE 0 -#endif - -// ---------------------------------------------------------------------------- -// wxTextCtrl file types -// ---------------------------------------------------------------------------- - -#define wxTEXT_TYPE_ANY 0 - -// ---------------------------------------------------------------------------- -// wxTextCtrl::HitTest return values -// ---------------------------------------------------------------------------- - -// the point asked is ... -enum wxTextCtrlHitTestResult -{ - wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented - wxTE_HT_BEFORE, // either to the left or upper - wxTE_HT_ON_TEXT, // directly on - wxTE_HT_BELOW, // below [the last line] - wxTE_HT_BEYOND // after [the end of line] -}; -// ... the character returned - -// ---------------------------------------------------------------------------- -// Types for wxTextAttr -// ---------------------------------------------------------------------------- - -// Alignment - -enum wxTextAttrAlignment -{ - wxTEXT_ALIGNMENT_DEFAULT, - wxTEXT_ALIGNMENT_LEFT, - wxTEXT_ALIGNMENT_CENTRE, - wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE, - wxTEXT_ALIGNMENT_RIGHT, - wxTEXT_ALIGNMENT_JUSTIFIED -}; - -// Flags to indicate which attributes are being applied - -#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 -#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002 -#define wxTEXT_ATTR_FONT_FACE 0x0004 -#define wxTEXT_ATTR_FONT_SIZE 0x0008 -#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 -#define wxTEXT_ATTR_FONT_ITALIC 0x0020 -#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 -#define wxTEXT_ATTR_FONT \ - ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ - wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE ) -#define wxTEXT_ATTR_ALIGNMENT 0x0080 -#define wxTEXT_ATTR_LEFT_INDENT 0x0100 -#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 -#define wxTEXT_ATTR_TABS 0x0400 - -// ---------------------------------------------------------------------------- -// wxTextAttr: a structure containing the visual attributes of a text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextAttr -{ -public: - // ctors - wxTextAttr() { Init(); } - wxTextAttr(const wxColour& colText, - const wxColour& colBack = wxNullColour, - const wxFont& font = wxNullFont, - wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); - - // operations - void Init(); - - // merges the attributes of the base and the overlay objects and returns - // the result; the parameter attributes take precedence - // - // WARNING: the order of arguments is the opposite of Combine() - static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay) - { - return Combine(overlay, base, NULL); - } - - // merges the attributes of this object and overlay - void Merge(const wxTextAttr& overlay) - { - *this = Merge(*this, overlay); - } - - - // operators - void operator= (const wxTextAttr& attr); - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } - void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; } - void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } - void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } - void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } - void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } - void SetFlags(long flags) { m_flags = flags; } - - // accessors - bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } - bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } - bool HasFont() const { return m_font.Ok() && HasFlag(wxTEXT_ATTR_FONT) ; } - bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } - bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } - bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } - bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } - bool HasFlag(long flag) const { return (m_flags & flag) != 0; } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } - const wxArrayInt& GetTabs() const { return m_tabs; } - long GetLeftIndent() const { return m_leftIndent; } - long GetLeftSubIndent() const { return m_leftSubIndent; } - long GetRightIndent() const { return m_rightIndent; } - long GetFlags() const { return m_flags; } - - // returns false if we have any attributes set, true otherwise - bool IsDefault() const - { - return !HasTextColour() && !HasBackgroundColour() && !HasFont() && !HasAlignment() && - !HasTabs() && !HasLeftIndent() && !HasRightIndent() ; - } - - // return the attribute having the valid font and colours: it uses the - // attributes set in attr and falls back first to attrDefault and then to - // the text control font/colours for those attributes which are not set - static wxTextAttr Combine(const wxTextAttr& attr, - const wxTextAttr& attrDef, - const wxTextCtrlBase *text); - -private: - long m_flags; - wxColour m_colText, - m_colBack; - wxFont m_font; - wxTextAttrAlignment m_textAlignment; - wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm - int m_leftIndent; // left indent in 1/10 mm - int m_leftSubIndent; // left indent for all but the first - // line in a paragraph relative to the - // first line, in 1/10 mm - int m_rightIndent; // right indent in 1/10 mm -}; - -// ---------------------------------------------------------------------------- -// wxTextCtrl: a single or multiple line text zone where user can enter and -// edit text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextCtrlBase : public wxControl -#if wxHAS_TEXT_WINDOW_STREAM - , public wxSTD streambuf -#endif - -{ -public: - // creation - // -------- - - wxTextCtrlBase(){} - virtual ~wxTextCtrlBase(){} - - // accessors - // --------- - - virtual wxString GetValue() const = 0; - virtual bool IsEmpty() const { return GetValue().empty(); } - - virtual void SetValue(const wxString& value) - { DoSetValue(value, SetValue_SendEvent); } - virtual void ChangeValue(const wxString& value) - { DoSetValue(value); } - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const = 0; - virtual wxString GetLineText(long lineNo) const = 0; - virtual int GetNumberOfLines() const = 0; - - virtual bool IsModified() const = 0; - virtual bool IsEditable() const = 0; - - // more readable flag testing methods - bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } - bool IsMultiLine() const { return !IsSingleLine(); } - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const = 0; - - virtual wxString GetStringSelection() const; - - // operations - // ---------- - - // editing - virtual void Clear() = 0; - virtual void Replace(long from, long to, const wxString& value) = 0; - virtual void Remove(long from, long to) = 0; - - // load/save the control's contents from/to a file - bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); } - bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); - - // implementation for loading/saving - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file, int fileType); - - // sets/clears the dirty flag - virtual void MarkDirty() = 0; - virtual void DiscardEdits() = 0; - void SetModified(bool modified) - { - if ( modified ) - MarkDirty(); - else - DiscardEdits(); - } - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text) = 0; - virtual void AppendText(const wxString& text) = 0; - - // insert the character which would have resulted from this key event, - // return true if anything has been inserted - virtual bool EmulateKeyPress(const wxKeyEvent& event); - - // text control under some platforms supports the text styles: these - // methods allow to apply the given text style to the given selection or to - // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual const wxTextAttr& GetDefaultStyle() const; - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const = 0; - virtual bool PositionToXY(long pos, long *x, long *y) const = 0; - - virtual void ShowPosition(long pos) = 0; - - // find the character at position given in pixels - // - // NB: pt is in device coords (not adjusted for the client area origin nor - // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // Clipboard operations - virtual void Copy() = 0; - virtual void Cut() = 0; - virtual void Paste() = 0; - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo() = 0; - virtual void Redo() = 0; - - virtual bool CanUndo() const = 0; - virtual bool CanRedo() const = 0; - - // Insertion point - virtual void SetInsertionPoint(long pos) = 0; - virtual void SetInsertionPointEnd() = 0; - virtual long GetInsertionPoint() const = 0; - virtual wxTextPos GetLastPosition() const = 0; - - virtual void SetSelection(long from, long to) = 0; - virtual void SelectAll(); - virtual void SetEditable(bool editable) = 0; - - // stream-like insertion operators: these are always available, whether we - // were, or not, compiled with streambuf support - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); - - // generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does - void SendTextUpdatedEvent(); - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - virtual bool ShouldInheritColours() const { return false; } - -protected: - // override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - - // flags for DoSetValue(): common part of SetValue() and ChangeValue() and - // also used to implement WriteText() in wxMSW - enum - { - SetValue_SendEvent = 1, - SetValue_SelectionOnly = 2 - }; - - virtual void DoSetValue(const wxString& value, int flags = 0) = 0; - - - // the name of the last file loaded with LoadFile() which will be used by - // SaveFile() by default - wxString m_filename; - - // the text style which will be used for any new text added to the control - wxTextAttr m_defaultStyle; - - DECLARE_NO_COPY_CLASS(wxTextCtrlBase) - DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent class definition -// ---------------------------------------------------------------------------- - -#if defined(__WXX11__) - #include "wx/x11/textctrl.h" -#elif defined(__WXUNIVERSAL__) - #include "wx/univ/textctrl.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/textctrlce.h" -#elif defined(__WXMSW__) - #include "wx/msw/textctrl.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/textctrl.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/textctrl.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/textctrl.h" -#elif defined(__WXMAC__) - #include "wx/mac/textctrl.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/textctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/textctrl.h" -#endif - -// ---------------------------------------------------------------------------- -// wxTextCtrl events -// ---------------------------------------------------------------------------- - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) -END_DECLARE_EVENT_TYPES() - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent -{ -public: - wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse, - long start, long end) - : wxCommandEvent(wxEVT_COMMAND_TEXT_URL, winid) - , m_evtMouse(evtMouse), m_start(start), m_end(end) - { } - - // get the mouse event which happend over the URL - const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; } - - // get the start of the URL - long GetURLStart() const { return m_start; } - - // get the end of the URL - long GetURLEnd() const { return m_end; } - -protected: - // the corresponding mouse event - wxMouseEvent m_evtMouse; - - // the start and end indices of the URL in the text control - long m_start, - m_end; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextUrlEvent) - -public: - // for wxWin RTTI only, don't use - wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { } -}; - -typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); - -#define wxTextEventHandler(func) wxCommandEventHandler(func) -#define wxTextUrlEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) - -#define wx__DECLARE_TEXTEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn)) - -#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextUrlEventHandler(fn)) - -#define EVT_TEXT(id, fn) wx__DECLARE_TEXTEVT(UPDATED, id, fn) -#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn) -#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn) -#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn) - -#if wxHAS_TEXT_WINDOW_STREAM - -// ---------------------------------------------------------------------------- -// wxStreamToTextRedirector: this class redirects all data sent to the given -// C++ stream to the wxTextCtrl given to its ctor during its lifetime. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStreamToTextRedirector -{ -private: - void Init(wxTextCtrl *text) - { - m_sbufOld = m_ostr.rdbuf(); - m_ostr.rdbuf(text); - } - -public: - wxStreamToTextRedirector(wxTextCtrl *text) - : m_ostr(wxSTD cout) - { - Init(text); - } - - wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr) - : m_ostr(*ostr) - { - Init(text); - } - - ~wxStreamToTextRedirector() - { - m_ostr.rdbuf(m_sbufOld); - } - -private: - // the stream we're redirecting - wxSTD ostream& m_ostr; - - // the old streambuf (before we changed it) - wxSTD streambuf *m_sbufOld; -}; - -#endif // wxHAS_TEXT_WINDOW_STREAM - -#endif // wxUSE_TEXTCTRL - -#endif - // _WX_TEXTCTRL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/textdlg.h b/Source/3rdParty/wx/include/wx/textdlg.h deleted file mode 100644 index 787233d4f..000000000 --- a/Source/3rdParty/wx/include/wx/textdlg.h +++ /dev/null @@ -1,23 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: textdlg.h -// Purpose: wxTextEntryDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textdlg.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTDLG_H_BASE_ -#define _WX_TEXTDLG_H_BASE_ - -#include "wx/generic/textdlgg.h" - -#if WXWIN_COMPATIBILITY_2_4 - // for wxGetNumberFromUser() - #include "wx/numdlg.h" -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // _WX_TEXTDLG_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/textfile.h b/Source/3rdParty/wx/include/wx/textfile.h deleted file mode 100644 index 5d9bcdb4a..000000000 --- a/Source/3rdParty/wx/include/wx/textfile.h +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textfile.h -// Purpose: class wxTextFile to work with text files of _small_ size -// (file is fully loaded in memory) and which understands CR/LF -// differences between platforms. -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.98 -// RCS-ID: $Id: textfile.h 38570 2006-04-05 14:37:47Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTFILE_H -#define _WX_TEXTFILE_H - -#include "wx/defs.h" - -#include "wx/textbuf.h" - -#if wxUSE_TEXTFILE - -#include "wx/file.h" - -// ---------------------------------------------------------------------------- -// wxTextFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer -{ -public: - // constructors - wxTextFile() { } - wxTextFile(const wxString& strFileName); - -protected: - // implement the base class pure virtuals - virtual bool OnExists() const; - virtual bool OnOpen(const wxString &strBufferName, - wxTextBufferOpenMode OpenMode); - virtual bool OnClose(); - virtual bool OnRead(const wxMBConv& conv); - virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv); - -private: - - wxFile m_file; - - DECLARE_NO_COPY_CLASS(wxTextFile) -}; - -#else // !wxUSE_TEXTFILE - -// old code relies on the static methods of wxTextFile being always available -// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so -// make it possible to use them in a backwards compatible way -typedef wxTextBuffer wxTextFile; - -#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE - -#endif // _WX_TEXTFILE_H - diff --git a/Source/3rdParty/wx/include/wx/tglbtn.h b/Source/3rdParty/wx/include/wx/tglbtn.h deleted file mode 100644 index c20b9e4a0..000000000 --- a/Source/3rdParty/wx/include/wx/tglbtn.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tglbtn.h -// Purpose: This dummy header includes the proper header file for the -// system we're compiling under. -// Author: John Norris, minor changes by Axel Schlueter -// Modified by: -// Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 39293 2006-05-23 17:53:50Z JS $ -// Copyright: (c) 2000 Johnny C. Norris II -// License: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOGGLEBUTTON_H_BASE_ -#define _WX_TOGGLEBUTTON_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TOGGLEBTN - -#include "wx/event.h" -#include "wx/control.h" // base class - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19) -END_DECLARE_EVENT_TYPES() - -#define EVT_TOGGLEBUTTON(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn)) - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/tglbtn.h" -#elif defined(__WXMSW__) - #include "wx/msw/tglbtn.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/tglbtn.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/tglbtn.h" -# elif defined(__WXMOTIF__) - #include "wx/motif/tglbtn.h" -#elif defined(__WXMAC__) - #include "wx/mac/tglbtn.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/tglbtn.h" -#elif defined(__WXPM__) - #include "wx/os2/tglbtn.h" -#endif - -#endif // wxUSE_TOGGLEBTN - -#endif // _WX_TOGGLEBUTTON_H_BASE_ - diff --git a/Source/3rdParty/wx/include/wx/thread.h b/Source/3rdParty/wx/include/wx/thread.h deleted file mode 100644 index bd913fe81..000000000 --- a/Source/3rdParty/wx/include/wx/thread.h +++ /dev/null @@ -1,764 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/thread.h -// Purpose: Thread API -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads -// package from Olivetti & Oracle Research Laboratory) -// Created: 04/13/98 -// RCS-ID: $Id: thread.h 66924 2011-02-16 22:58:53Z JS $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_THREAD_H_ -#define _WX_THREAD_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// get the value of wxUSE_THREADS configuration flag -#include "wx/defs.h" - -#if wxUSE_THREADS - -// Windows headers define it -#ifdef Yield - #undef Yield -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxMutexError -{ - wxMUTEX_NO_ERROR = 0, // operation completed successfully - wxMUTEX_INVALID, // mutex hasn't been initialized - wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread - wxMUTEX_BUSY, // mutex is already locked by another thread - wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked - wxMUTEX_MISC_ERROR // any other error -}; - -enum wxCondError -{ - wxCOND_NO_ERROR = 0, - wxCOND_INVALID, - wxCOND_TIMEOUT, // WaitTimeout() has timed out - wxCOND_MISC_ERROR -}; - -enum wxSemaError -{ - wxSEMA_NO_ERROR = 0, - wxSEMA_INVALID, // semaphore hasn't been initialized successfully - wxSEMA_BUSY, // returned by TryWait() if Wait() would block - wxSEMA_TIMEOUT, // returned by WaitTimeout() - wxSEMA_OVERFLOW, // Post() would increase counter past the max - wxSEMA_MISC_ERROR -}; - -enum wxThreadError -{ - wxTHREAD_NO_ERROR = 0, // No error - wxTHREAD_NO_RESOURCE, // No resource left to create a new thread - wxTHREAD_RUNNING, // The thread is already running - wxTHREAD_NOT_RUNNING, // The thread isn't running - wxTHREAD_KILLED, // Thread we waited for had to be killed - wxTHREAD_MISC_ERROR // Some other error -}; - -enum wxThreadKind -{ - wxTHREAD_DETACHED, - wxTHREAD_JOINABLE -}; - -// defines the interval of priority -enum -{ - WXTHREAD_MIN_PRIORITY = 0u, - WXTHREAD_DEFAULT_PRIORITY = 50u, - WXTHREAD_MAX_PRIORITY = 100u -}; - -// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt -// to lock a normal mutex by a thread which already owns it results in -// undefined behaviour (it always works under Windows, it will almost always -// result in a deadlock under Unix). Locking a recursive mutex in such -// situation always succeeds and it must be unlocked as many times as it has -// been locked. -// -// However recursive mutexes have several important drawbacks: first, in the -// POSIX implementation, they're less efficient. Second, and more importantly, -// they CAN NOT BE USED WITH CONDITION VARIABLES under Unix! Using them with -// wxCondition will work under Windows and some Unices (notably Linux) but will -// deadlock under other Unix versions (e.g. Solaris). As it might be difficult -// to ensure that a recursive mutex is not used with wxCondition, it is a good -// idea to avoid using recursive mutexes at all. Also, the last problem with -// them is that some (older) Unix versions don't support this at all -- which -// results in a configure warning when building and a deadlock when using them. -enum wxMutexType -{ - // normal mutex: try to always use this one - wxMUTEX_DEFAULT, - - // recursive mutex: don't use these ones with wxCondition - wxMUTEX_RECURSIVE -}; - -// forward declarations -class WXDLLIMPEXP_FWD_BASE wxThreadHelper; -class WXDLLIMPEXP_FWD_BASE wxConditionInternal; -class WXDLLIMPEXP_FWD_BASE wxMutexInternal; -class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal; -class WXDLLIMPEXP_FWD_BASE wxThreadInternal; - -// ---------------------------------------------------------------------------- -// A mutex object is a synchronization object whose state is set to signaled -// when it is not owned by any thread, and nonsignaled when it is owned. Its -// name comes from its usefulness in coordinating mutually-exclusive access to -// a shared resource. Only one thread at a time can own a mutex object. -// ---------------------------------------------------------------------------- - -// you should consider wxMutexLocker whenever possible instead of directly -// working with wxMutex class - it is safer -class WXDLLIMPEXP_BASE wxMutex -{ -public: - // constructor & destructor - // ------------------------ - - // create either default (always safe) or recursive mutex - wxMutex(wxMutexType mutexType = wxMUTEX_DEFAULT); - - // destroys the mutex kernel object - ~wxMutex(); - - // test if the mutex has been created successfully - bool IsOk() const; - - // mutex operations - // ---------------- - - // Lock the mutex, blocking on it until it is unlocked by the other thread. - // The result of locking a mutex already locked by the current thread - // depend on the mutex type. - // - // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR. - wxMutexError Lock(); - - // Try to lock the mutex: if it is currently locked, return immediately - // with an error. Otherwise the caller must call Unlock(). - wxMutexError TryLock(); - - // Unlock the mutex. It is an error to unlock an already unlocked mutex - wxMutexError Unlock(); - -protected: - wxMutexInternal *m_internal; - - friend class wxConditionInternal; - - DECLARE_NO_COPY_CLASS(wxMutex) -}; - -// a helper class which locks the mutex in the ctor and unlocks it in the dtor: -// this ensures that mutex is always unlocked, even if the function returns or -// throws an exception before it reaches the end -class WXDLLIMPEXP_BASE wxMutexLocker -{ -public: - // lock the mutex in the ctor - wxMutexLocker(wxMutex& mutex) - : m_isOk(false), m_mutex(mutex) - { m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); } - - // returns true if mutex was successfully locked in ctor - bool IsOk() const - { return m_isOk; } - - // unlock the mutex in dtor - ~wxMutexLocker() - { if ( IsOk() ) m_mutex.Unlock(); } - -private: - // no assignment operator nor copy ctor - wxMutexLocker(const wxMutexLocker&); - wxMutexLocker& operator=(const wxMutexLocker&); - - bool m_isOk; - wxMutex& m_mutex; -}; - -// ---------------------------------------------------------------------------- -// Critical section: this is the same as mutex but is only visible to the -// threads of the same process. For the platforms which don't have native -// support for critical sections, they're implemented entirely in terms of -// mutexes. -// -// NB: wxCriticalSection object does not allocate any memory in its ctor -// which makes it possible to have static globals of this class -// ---------------------------------------------------------------------------- - -// in order to avoid any overhead under platforms where critical sections are -// just mutexes make all wxCriticalSection class functions inline -#if !defined(__WXMSW__) && !defined(__WXMAC__) - #define wxCRITSECT_IS_MUTEX 1 - - #define wxCRITSECT_INLINE inline -#else // MSW - #define wxCRITSECT_IS_MUTEX 0 - - #define wxCRITSECT_INLINE -#endif // MSW/!MSW - -// you should consider wxCriticalSectionLocker whenever possible instead of -// directly working with wxCriticalSection class - it is safer -class WXDLLIMPEXP_BASE wxCriticalSection -{ -public: - // ctor & dtor - wxCRITSECT_INLINE wxCriticalSection(); - wxCRITSECT_INLINE ~wxCriticalSection(); - - // enter the section (the same as locking a mutex) - wxCRITSECT_INLINE void Enter(); - - // leave the critical section (same as unlocking a mutex) - wxCRITSECT_INLINE void Leave(); - -private: -#if wxCRITSECT_IS_MUTEX - wxMutex m_mutex; -#elif defined(__WXMSW__) - // we can't allocate any memory in the ctor, so use placement new - - // unfortunately, we have to hardcode the sizeof() here because we can't - // include windows.h from this public header and we also have to use the - // union to force the correct (i.e. maximal) alignment - // - // if CRITICAL_SECTION size changes in Windows, you'll get an assert from - // thread.cpp and will need to increase the buffer size - // - // finally, we need this typedef instead of declaring m_buffer directly - // because otherwise the assert mentioned above wouldn't compile with some - // compilers (notably CodeWarrior 8) -#ifdef __WIN64__ - typedef char wxCritSectBuffer[40]; -#else // __WIN32__ - typedef char wxCritSectBuffer[24]; -#endif - union - { - unsigned long m_dummy1; - void *m_dummy2; - - wxCritSectBuffer m_buffer; - }; -#elif defined(__WXMAC__) - void *m_critRegion ; -#endif // Unix&OS2/Win32 - - DECLARE_NO_COPY_CLASS(wxCriticalSection) -}; - -#if wxCRITSECT_IS_MUTEX - // implement wxCriticalSection using mutexes - inline wxCriticalSection::wxCriticalSection() { } - inline wxCriticalSection::~wxCriticalSection() { } - - inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } - inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } -#endif // wxCRITSECT_IS_MUTEX - -#undef wxCRITSECT_INLINE -#undef wxCRITSECT_IS_MUTEX - -// wxCriticalSectionLocker is the same to critical sections as wxMutexLocker is -// to mutexes -class WXDLLIMPEXP_BASE wxCriticalSectionLocker -{ -public: - wxCriticalSectionLocker(wxCriticalSection& cs) - : m_critsect(cs) - { - m_critsect.Enter(); - } - - ~wxCriticalSectionLocker() - { - m_critsect.Leave(); - } - -private: - wxCriticalSection& m_critsect; - - DECLARE_NO_COPY_CLASS(wxCriticalSectionLocker) -}; - -// ---------------------------------------------------------------------------- -// wxCondition models a POSIX condition variable which allows one (or more) -// thread(s) to wait until some condition is fulfilled -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCondition -{ -public: - // Each wxCondition object is associated with a (single) wxMutex object. - // The mutex object MUST be locked before calling Wait() - wxCondition(wxMutex& mutex); - - // dtor is not virtual, don't use this class polymorphically - ~wxCondition(); - - // return true if the condition has been created successfully - bool IsOk() const; - - // NB: the associated mutex MUST be locked beforehand by the calling thread - // - // it atomically releases the lock on the associated mutex - // and starts waiting to be woken up by a Signal()/Broadcast() - // once its signaled, then it will wait until it can reacquire - // the lock on the associated mutex object, before returning. - wxCondError Wait(); - - // exactly as Wait() except that it may also return if the specified - // timeout elapses even if the condition hasn't been signalled: in this - // case, the return value is false, otherwise (i.e. in case of a normal - // return) it is true - // - // the timeout parameter specifies an interval that needs to be waited for - // in milliseconds - wxCondError WaitTimeout(unsigned long milliseconds); - - // NB: the associated mutex may or may not be locked by the calling thread - // - // this method unblocks one thread if any are blocking on the condition. - // if no thread is blocking in Wait(), then the signal is NOT remembered - // The thread which was blocking on Wait() will then reacquire the lock - // on the associated mutex object before returning - wxCondError Signal(); - - // NB: the associated mutex may or may not be locked by the calling thread - // - // this method unblocks all threads if any are blocking on the condition. - // if no thread is blocking in Wait(), then the signal is NOT remembered - // The threads which were blocking on Wait() will then reacquire the lock - // on the associated mutex object before returning. - wxCondError Broadcast(); - - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated version, don't use - wxDEPRECATED( bool Wait(unsigned long milliseconds) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -private: - wxConditionInternal *m_internal; - - DECLARE_NO_COPY_CLASS(wxCondition) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxCondition::Wait(unsigned long milliseconds) - { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// wxSemaphore: a counter limiting the number of threads concurrently accessing -// a shared resource -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSemaphore -{ -public: - // specifying a maxcount of 0 actually makes wxSemaphore behave as if there - // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex - wxSemaphore( int initialcount = 0, int maxcount = 0 ); - - // dtor is not virtual, don't use this class polymorphically - ~wxSemaphore(); - - // return true if the semaphore has been created successfully - bool IsOk() const; - - // wait indefinitely, until the semaphore count goes beyond 0 - // and then decrement it and return (this method might have been called - // Acquire()) - wxSemaError Wait(); - - // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if - // successful and wxSEMA_BUSY if the count is currently zero - wxSemaError TryWait(); - - // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the - // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has elapsed - wxSemaError WaitTimeout(unsigned long milliseconds); - - // increments the semaphore count and signals one of the waiting threads - wxSemaError Post(); - -private: - wxSemaphoreInternal *m_internal; - - DECLARE_NO_COPY_CLASS(wxSemaphore) -}; - -// ---------------------------------------------------------------------------- -// wxThread: class encapsulating a thread of execution -// ---------------------------------------------------------------------------- - -// there are two different kinds of threads: joinable and detached (default) -// ones. Only joinable threads can return a return code and only detached -// threads auto-delete themselves - the user should delete the joinable -// threads manually. - -// NB: in the function descriptions the words "this thread" mean the thread -// created by the wxThread object while "main thread" is the thread created -// during the process initialization (a.k.a. the GUI thread) - -// On VMS thread pointers are 64 bits (also needed for other systems??? -#ifdef __VMS - typedef unsigned long long wxThreadIdType; -#else - typedef unsigned long wxThreadIdType; -#endif - -class WXDLLIMPEXP_BASE wxThread -{ -public: - // the return type for the thread function - typedef void *ExitCode; - - // static functions - // Returns the wxThread object for the calling thread. NULL is returned - // if the caller is the main thread (but it's recommended to use - // IsMain() and only call This() for threads other than the main one - // because NULL is also returned on error). If the thread wasn't - // created with wxThread class, the returned value is undefined. - static wxThread *This(); - - // Returns true if current thread is the main thread. - static bool IsMain(); - - // Release the rest of our time slice letting the other threads run - static void Yield(); - - // Sleep during the specified period of time in milliseconds - // - // NB: at least under MSW worker threads can not call ::wxSleep()! - static void Sleep(unsigned long milliseconds); - - // get the number of system CPUs - useful with SetConcurrency() - // (the "best" value for it is usually number of CPUs + 1) - // - // Returns -1 if unknown, number of CPUs otherwise - static int GetCPUCount(); - - // Get the platform specific thread ID and return as a long. This - // can be used to uniquely identify threads, even if they are not - // wxThreads. This is used by wxPython. - static wxThreadIdType GetCurrentId(); - - // sets the concurrency level: this is, roughly, the number of threads - // the system tries to schedule to run in parallel. 0 means the - // default value (usually acceptable, but may not yield the best - // performance for this process) - // - // Returns true on success, false otherwise (if not implemented, for - // example) - static bool SetConcurrency(size_t level); - - // constructor only creates the C++ thread object and doesn't create (or - // start) the real thread - wxThread(wxThreadKind kind = wxTHREAD_DETACHED); - - // functions that change the thread state: all these can only be called - // from _another_ thread (typically the thread that created this one, e.g. - // the main thread), not from the thread itself - - // create a new thread and optionally set the stack size on - // platforms that support that - call Run() to start it - // (special cased for watcom which won't accept 0 default) - - wxThreadError Create(unsigned int stackSize = 0); - - // starts execution of the thread - from the moment Run() is called - // the execution of wxThread::Entry() may start at any moment, caller - // shouldn't suppose that it starts after (or before) Run() returns. - wxThreadError Run(); - - // stops the thread if it's running and deletes the wxThread object if - // this is a detached thread freeing its memory - otherwise (for - // joinable threads) you still need to delete wxThread object - // yourself. - // - // this function only works if the thread calls TestDestroy() - // periodically - the thread will only be deleted the next time it - // does it! - // - // will fill the rc pointer with the thread exit code if it's !NULL - wxThreadError Delete(ExitCode *rc = (ExitCode *)NULL); - - // waits for a joinable thread to finish and returns its exit code - // - // Returns (ExitCode)-1 on error (for example, if the thread is not - // joinable) - ExitCode Wait(); - - // kills the thread without giving it any chance to clean up - should - // not be used under normal circumstances, use Delete() instead. - // It is a dangerous function that should only be used in the most - // extreme cases! - // - // The wxThread object is deleted by Kill() if the thread is - // detachable, but you still have to delete it manually for joinable - // threads. - wxThreadError Kill(); - - // pause a running thread: as Delete(), this only works if the thread - // calls TestDestroy() regularly - wxThreadError Pause(); - - // resume a paused thread - wxThreadError Resume(); - - // priority - // Sets the priority to "prio": see WXTHREAD_XXX_PRIORITY constants - // - // NB: the priority can only be set before the thread is created - void SetPriority(unsigned int prio); - - // Get the current priority. - unsigned int GetPriority() const; - - // thread status inquiries - // Returns true if the thread is alive: i.e. running or suspended - bool IsAlive() const; - // Returns true if the thread is running (not paused, not killed). - bool IsRunning() const; - // Returns true if the thread is suspended - bool IsPaused() const; - - // is the thread of detached kind? - bool IsDetached() const { return m_isDetached; } - - // Get the thread ID - a platform dependent number which uniquely - // identifies a thread inside a process - wxThreadIdType GetId() const; - - // called when the thread exits - in the context of this thread - // - // NB: this function will not be called if the thread is Kill()ed - virtual void OnExit() { } - - // Returns true if the thread was asked to terminate: this function should - // be called by the thread from time to time, otherwise the main thread - // will be left forever in Delete()! - virtual bool TestDestroy(); - - // dtor is public, but the detached threads should never be deleted - use - // Delete() instead (or leave the thread terminate by itself) - virtual ~wxThread(); - -protected: - // exits from the current thread - can be called only from this thread - void Exit(ExitCode exitcode = 0); - - // entry point for the thread - called by Run() and executes in the context - // of this thread. - virtual void *Entry() = 0; - -private: - // no copy ctor/assignment operator - wxThread(const wxThread&); - wxThread& operator=(const wxThread&); - - friend class wxThreadInternal; - - // the (platform-dependent) thread class implementation - wxThreadInternal *m_internal; - - // protects access to any methods of wxThreadInternal object - wxCriticalSection m_critsect; - - // true if the thread is detached, false if it is joinable - bool m_isDetached; -}; - -// wxThreadHelperThread class -// -------------------------- - -class WXDLLIMPEXP_BASE wxThreadHelperThread : public wxThread -{ -public: - // constructor only creates the C++ thread object and doesn't create (or - // start) the real thread - wxThreadHelperThread(wxThreadHelper& owner) - : wxThread(wxTHREAD_JOINABLE), m_owner(owner) - { } - -protected: - // entry point for the thread -- calls Entry() in owner. - virtual void *Entry(); - -private: - // the owner of the thread - wxThreadHelper& m_owner; - - // no copy ctor/assignment operator - wxThreadHelperThread(const wxThreadHelperThread&); - wxThreadHelperThread& operator=(const wxThreadHelperThread&); -}; - -// ---------------------------------------------------------------------------- -// wxThreadHelper: this class implements the threading logic to run a -// background task in another object (such as a window). It is a mix-in: just -// derive from it to implement a threading background task in your class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxThreadHelper -{ -private: - void KillThread() - { - if ( m_thread ) - { - m_thread->Kill(); - delete m_thread; - } - } - -public: - // constructor only initializes m_thread to NULL - wxThreadHelper() : m_thread(NULL) { } - - // destructor deletes m_thread - virtual ~wxThreadHelper() { KillThread(); } - - // create a new thread (and optionally set the stack size on platforms that - // support/need that), call Run() to start it - wxThreadError Create(unsigned int stackSize = 0) - { - KillThread(); - - m_thread = new wxThreadHelperThread(*this); - - return m_thread->Create(stackSize); - } - - // entry point for the thread - called by Run() and executes in the context - // of this thread. - virtual void *Entry() = 0; - - // returns a pointer to the thread which can be used to call Run() - wxThread *GetThread() const { return m_thread; } - -protected: - wxThread *m_thread; -}; - -// call Entry() in owner, put it down here to avoid circular declarations -inline void *wxThreadHelperThread::Entry() -{ - return m_owner.Entry(); -} - -// ---------------------------------------------------------------------------- -// Automatic initialization -// ---------------------------------------------------------------------------- - -// GUI mutex handling. -void WXDLLIMPEXP_BASE wxMutexGuiEnter(); -void WXDLLIMPEXP_BASE wxMutexGuiLeave(); - -// macros for entering/leaving critical sections which may be used without -// having to take them inside "#if wxUSE_THREADS" -#define wxENTER_CRIT_SECT(cs) (cs).Enter() -#define wxLEAVE_CRIT_SECT(cs) (cs).Leave() -#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs -#define wxCRIT_SECT_DECLARE_MEMBER(cs) wxCriticalSection cs -#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs) - -// function for checking if we're in the main thread which may be used whether -// wxUSE_THREADS is 0 or 1 -inline bool wxIsMainThread() { return wxThread::IsMain(); } - -#else // !wxUSE_THREADS - -// no thread support -inline void WXDLLIMPEXP_BASE wxMutexGuiEnter() { } -inline void WXDLLIMPEXP_BASE wxMutexGuiLeave() { } - -// macros for entering/leaving critical sections which may be used without -// having to take them inside "#if wxUSE_THREADS" -// (the implementation uses dummy structs to force semicolon after the macro; -// also notice that Watcom doesn't like declaring a struct as a member so we -// need to actually define it in wxCRIT_SECT_DECLARE_MEMBER) -#define wxENTER_CRIT_SECT(cs) do {} while (0) -#define wxLEAVE_CRIT_SECT(cs) do {} while (0) -#define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs -#define wxCRIT_SECT_DECLARE_MEMBER(cs) struct wxDummyCSMember##cs { } -#define wxCRIT_SECT_LOCKER(name, cs) struct wxDummyCSLocker##name - -// if there is only one thread, it is always the main one -inline bool wxIsMainThread() { return true; } - -#endif // wxUSE_THREADS/!wxUSE_THREADS - -// mark part of code as being a critical section: this macro declares a -// critical section with the given name and enters it immediately and leaves -// it at the end of the current scope -// -// example: -// -// int Count() -// { -// static int s_counter = 0; -// -// wxCRITICAL_SECTION(counter); -// -// return ++s_counter; -// } -// -// this function is MT-safe in presence of the threads but there is no -// overhead when the library is compiled without threads -#define wxCRITICAL_SECTION(name) \ - wxCRIT_SECT_DECLARE(s_cs##name); \ - wxCRIT_SECT_LOCKER(cs##name##Locker, s_cs##name) - -// automatically lock GUI mutex in ctor and unlock it in dtor -class WXDLLIMPEXP_BASE wxMutexGuiLocker -{ -public: - wxMutexGuiLocker() { wxMutexGuiEnter(); } - ~wxMutexGuiLocker() { wxMutexGuiLeave(); } -}; - -// ----------------------------------------------------------------------------- -// implementation only until the end of file -// ----------------------------------------------------------------------------- - -#if wxUSE_THREADS - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__) - // unlock GUI if there are threads waiting for and lock it back when - // there are no more of them - should be called periodically by the main - // thread - extern void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter(); - - // returns true if the main thread has GUI lock - extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread(); - - // wakes up the main thread if it's sleeping inside ::GetMessage() - extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); - - // return true if the main thread is waiting for some other to terminate: - // wxApp then should block all "dangerous" messages - extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); -#endif // MSW, Mac, OS/2 - -#endif // wxUSE_THREADS - -#endif // _WX_THREAD_H_ diff --git a/Source/3rdParty/wx/include/wx/thrimpl.cpp b/Source/3rdParty/wx/include/wx/thrimpl.cpp deleted file mode 100644 index 27780b8ab..000000000 --- a/Source/3rdParty/wx/include/wx/thrimpl.cpp +++ /dev/null @@ -1,332 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/thrimpl.cpp -// Purpose: common part of wxThread Implementations -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.06.02 (extracted from src/*/thread.cpp files) -// RCS-ID: $Id: thrimpl.cpp 66922 2011-02-16 22:26:57Z JS $ -// Copyright: (c) Vadim Zeitlin (2002) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// this file is supposed to be included only by the various thread.cpp - -// ---------------------------------------------------------------------------- -// wxMutex -// ---------------------------------------------------------------------------- - -wxMutex::wxMutex(wxMutexType mutexType) -{ - m_internal = new wxMutexInternal(mutexType); - - if ( !m_internal->IsOk() ) - { - delete m_internal; - m_internal = NULL; - } -} - -wxMutex::~wxMutex() -{ - delete m_internal; -} - -bool wxMutex::IsOk() const -{ - return m_internal != NULL; -} - -wxMutexError wxMutex::Lock() -{ - wxCHECK_MSG( m_internal, wxMUTEX_INVALID, - wxT("wxMutex::Lock(): not initialized") ); - - return m_internal->Lock(); -} - -wxMutexError wxMutex::TryLock() -{ - wxCHECK_MSG( m_internal, wxMUTEX_INVALID, - wxT("wxMutex::TryLock(): not initialized") ); - - return m_internal->TryLock(); -} - -wxMutexError wxMutex::Unlock() -{ - wxCHECK_MSG( m_internal, wxMUTEX_INVALID, - wxT("wxMutex::Unlock(): not initialized") ); - - return m_internal->Unlock(); -} - -// -------------------------------------------------------------------------- -// wxConditionInternal -// -------------------------------------------------------------------------- - -// Win32 and OS/2 don't have explicit support for the POSIX condition -// variables and their events/event semaphores have quite different semantics, -// so we reimplement the conditions from scratch using the mutexes and -// semaphores -#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__) - -class wxConditionInternal -{ -public: - wxConditionInternal(wxMutex& mutex); - - bool IsOk() const { return m_mutex.IsOk() && m_semaphore.IsOk(); } - - wxCondError Wait(); - wxCondError WaitTimeout(unsigned long milliseconds); - - wxCondError Signal(); - wxCondError Broadcast(); - -private: - // the number of threads currently waiting for this condition - LONG m_numWaiters; - - // the critical section protecting m_numWaiters - wxCriticalSection m_csWaiters; - - wxMutex& m_mutex; - wxSemaphore m_semaphore; - - DECLARE_NO_COPY_CLASS(wxConditionInternal) -}; - -wxConditionInternal::wxConditionInternal(wxMutex& mutex) - : m_mutex(mutex) -{ - // another thread can't access it until we return from ctor, so no need to - // protect access to m_numWaiters here - m_numWaiters = 0; -} - -wxCondError wxConditionInternal::Wait() -{ - // increment the number of waiters - { - wxCriticalSectionLocker lock(m_csWaiters); - m_numWaiters++; - } - - m_mutex.Unlock(); - - // after unlocking the mutex other threads may Signal() us, but it is ok - // now as we had already incremented m_numWaiters so Signal() will post the - // semaphore and decrement m_numWaiters back even if it is called before we - // start to Wait() - const wxSemaError err = m_semaphore.Wait(); - - m_mutex.Lock(); - - if ( err == wxSEMA_NO_ERROR ) - { - // m_numWaiters was decremented by Signal() - return wxCOND_NO_ERROR; - } - - // but in case of an error we need to do it manually - { - wxCriticalSectionLocker lock(m_csWaiters); - m_numWaiters--; - } - - return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; -} - -wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds) -{ - { - wxCriticalSectionLocker lock(m_csWaiters); - m_numWaiters++; - } - - m_mutex.Unlock(); - - wxSemaError err = m_semaphore.WaitTimeout(milliseconds); - - m_mutex.Lock(); - - if ( err == wxSEMA_NO_ERROR ) - return wxCOND_NO_ERROR; - - if ( err == wxSEMA_TIMEOUT ) - { - // a potential race condition exists here: it happens when a waiting - // thread times out but doesn't have time to decrement m_numWaiters yet - // before Signal() is called in another thread - // - // to handle this particular case, check the semaphore again after - // acquiring m_csWaiters lock -- this will catch the signals missed - // during this window - wxCriticalSectionLocker lock(m_csWaiters); - - err = m_semaphore.WaitTimeout(0); - if ( err == wxSEMA_NO_ERROR ) - return wxCOND_NO_ERROR; - - // we need to decrement m_numWaiters ourselves as it wasn't done by - // Signal() - m_numWaiters--; - - return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; - } - - // undo m_numWaiters++ above in case of an error - { - wxCriticalSectionLocker lock(m_csWaiters); - m_numWaiters--; - } - - return wxCOND_MISC_ERROR; -} - -wxCondError wxConditionInternal::Signal() -{ - wxCriticalSectionLocker lock(m_csWaiters); - - if ( m_numWaiters > 0 ) - { - // increment the semaphore by 1 - if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) - return wxCOND_MISC_ERROR; - - m_numWaiters--; - } - - return wxCOND_NO_ERROR; -} - -wxCondError wxConditionInternal::Broadcast() -{ - wxCriticalSectionLocker lock(m_csWaiters); - - while ( m_numWaiters > 0 ) - { - if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) - return wxCOND_MISC_ERROR; - - m_numWaiters--; - } - - return wxCOND_NO_ERROR; -} - -#endif // MSW or OS2 - -// ---------------------------------------------------------------------------- -// wxCondition -// ---------------------------------------------------------------------------- - -wxCondition::wxCondition(wxMutex& mutex) -{ - m_internal = new wxConditionInternal(mutex); - - if ( !m_internal->IsOk() ) - { - delete m_internal; - m_internal = NULL; - } -} - -wxCondition::~wxCondition() -{ - delete m_internal; -} - -bool wxCondition::IsOk() const -{ - return m_internal != NULL; -} - -wxCondError wxCondition::Wait() -{ - wxCHECK_MSG( m_internal, wxCOND_INVALID, - wxT("wxCondition::Wait(): not initialized") ); - - return m_internal->Wait(); -} - -wxCondError wxCondition::WaitTimeout(unsigned long milliseconds) -{ - wxCHECK_MSG( m_internal, wxCOND_INVALID, - wxT("wxCondition::Wait(): not initialized") ); - - return m_internal->WaitTimeout(milliseconds); -} - -wxCondError wxCondition::Signal() -{ - wxCHECK_MSG( m_internal, wxCOND_INVALID, - wxT("wxCondition::Signal(): not initialized") ); - - return m_internal->Signal(); -} - -wxCondError wxCondition::Broadcast() -{ - wxCHECK_MSG( m_internal, wxCOND_INVALID, - wxT("wxCondition::Broadcast(): not initialized") ); - - return m_internal->Broadcast(); -} - -// -------------------------------------------------------------------------- -// wxSemaphore -// -------------------------------------------------------------------------- - -wxSemaphore::wxSemaphore(int initialcount, int maxcount) -{ - m_internal = new wxSemaphoreInternal( initialcount, maxcount ); - if ( !m_internal->IsOk() ) - { - delete m_internal; - m_internal = NULL; - } -} - -wxSemaphore::~wxSemaphore() -{ - delete m_internal; -} - -bool wxSemaphore::IsOk() const -{ - return m_internal != NULL; -} - -wxSemaError wxSemaphore::Wait() -{ - wxCHECK_MSG( m_internal, wxSEMA_INVALID, - wxT("wxSemaphore::Wait(): not initialized") ); - - return m_internal->Wait(); -} - -wxSemaError wxSemaphore::TryWait() -{ - wxCHECK_MSG( m_internal, wxSEMA_INVALID, - wxT("wxSemaphore::TryWait(): not initialized") ); - - return m_internal->TryWait(); -} - -wxSemaError wxSemaphore::WaitTimeout(unsigned long milliseconds) -{ - wxCHECK_MSG( m_internal, wxSEMA_INVALID, - wxT("wxSemaphore::WaitTimeout(): not initialized") ); - - return m_internal->WaitTimeout(milliseconds); -} - -wxSemaError wxSemaphore::Post() -{ - wxCHECK_MSG( m_internal, wxSEMA_INVALID, - wxT("wxSemaphore::Post(): not initialized") ); - - return m_internal->Post(); -} - diff --git a/Source/3rdParty/wx/include/wx/timer.h b/Source/3rdParty/wx/include/wx/timer.h deleted file mode 100644 index f81cd3860..000000000 --- a/Source/3rdParty/wx/include/wx/timer.h +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/timer.h -// Purpose: wxTimer, wxStopWatch and global time-related functions -// Author: Julian Smart -// Modified by: Vadim Zeitlin (wxTimerBase) -// Guillermo Rodriguez (global clean up) -// Created: 04/01/98 -// RCS-ID: $Id: timer.h 44244 2007-01-18 17:00:52Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIMER_H_BASE_ -#define _WX_TIMER_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_GUI && wxUSE_TIMER - -#include "wx/object.h" -#include "wx/longlong.h" -#include "wx/event.h" -#include "wx/stopwatch.h" // for backwards compatibility -#include "wx/window.h" // only for NewControlId() - - -// more readable flags for Start(): - -// generate notifications periodically until the timer is stopped (default) -#define wxTIMER_CONTINUOUS false - -// only send the notification once and then stop the timer -#define wxTIMER_ONE_SHOT true - -// the interface of wxTimer class -class WXDLLEXPORT wxTimerBase : public wxEvtHandler -{ -public: - // ctors and initializers - // ---------------------- - - // default: if you don't call SetOwner(), your only chance to get timer - // notifications is to override Notify() in the derived class - wxTimerBase() - { Init(); SetOwner(this); } - - // ctor which allows to avoid having to override Notify() in the derived - // class: the owner will get timer notifications which can be handled with - // EVT_TIMER - wxTimerBase(wxEvtHandler *owner, int timerid = wxID_ANY) - { Init(); SetOwner(owner, timerid); } - - // same as ctor above - void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY) - { - m_owner = owner; - m_idTimer = timerid == wxID_ANY ? wxWindow::NewControlId() : timerid; - } - - wxEvtHandler *GetOwner() const { return m_owner; } - - virtual ~wxTimerBase(); - - // working with the timer - // ---------------------- - - // start the timer: if milliseconds == -1, use the same value as for the - // last Start() - // - // it is now valid to call Start() multiple times: this just restarts the - // timer if it is already running - virtual bool Start(int milliseconds = -1, bool oneShot = false); - - // stop the timer - virtual void Stop() = 0; - - // override this in your wxTimer-derived class if you want to process timer - // messages in it, use non default ctor or SetOwner() otherwise - virtual void Notify(); - - // getting info - // ------------ - - // return true if the timer is running - virtual bool IsRunning() const = 0; - - // return the timer ID - int GetId() const { return m_idTimer; } - - // get the (last) timer interval in milliseconds - int GetInterval() const { return m_milli; } - - // return true if the timer is one shot - bool IsOneShot() const { return m_oneShot; } - -protected: - // common part of all ctors - void Init() - { m_owner = NULL; m_idTimer = wxID_ANY; m_milli = 0; m_oneShot = false; } - - wxEvtHandler *m_owner; - int m_idTimer; - int m_milli; // the timer interval - bool m_oneShot; // true if one shot - - DECLARE_NO_COPY_CLASS(wxTimerBase) -}; - -// ---------------------------------------------------------------------------- -// wxTimer itself -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/timer.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/timer.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/timer.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/timer.h" -#elif defined(__WXX11__) || defined(__WXMGL__) || defined(__WXDFB__) - #include "wx/generic/timer.h" -#elif defined (__WXCOCOA__) - #include "wx/cocoa/timer.h" -#elif defined(__WXMAC__) - #include "wx/mac/timer.h" -#elif defined(__WXPM__) - #include "wx/os2/timer.h" -#endif - -// ---------------------------------------------------------------------------- -// wxTimerRunner: starts the timer in its ctor, stops in the dtor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTimerRunner -{ -public: - wxTimerRunner(wxTimer& timer) : m_timer(timer) { } - wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false) - : m_timer(timer) - { - m_timer.Start(milli, oneShot); - } - - void Start(int milli, bool oneShot = false) - { - m_timer.Start(milli, oneShot); - } - - ~wxTimerRunner() - { - if ( m_timer.IsRunning() ) - { - m_timer.Stop(); - } - } - -private: - wxTimer& m_timer; - - DECLARE_NO_COPY_CLASS(wxTimerRunner) -}; - -// ---------------------------------------------------------------------------- -// wxTimerEvent -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTimerEvent : public wxEvent -{ -public: - wxTimerEvent(int timerid = 0, int interval = 0) : wxEvent(timerid) - { - m_eventType = wxEVT_TIMER; - - m_interval = interval; - } - - // accessors - int GetInterval() const { return m_interval; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxTimerEvent(*this); } - -private: - int m_interval; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent) -}; - -typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); - -#define wxTimerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTimerEventFunction, &func) - -#define EVT_TIMER(timerid, func) \ - wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func)) - -#endif // wxUSE_GUI && wxUSE_TIMER - -#endif - // _WX_TIMER_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/tipwin.h b/Source/3rdParty/wx/include/wx/tipwin.h deleted file mode 100644 index b6c8d350a..000000000 --- a/Source/3rdParty/wx/include/wx/tipwin.h +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/tipwin.h -// Purpose: wxTipWindow is a window like the one typically used for -// showing the tooltips -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: tipwin.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIPWIN_H_ -#define _WX_TIPWIN_H_ - -#if wxUSE_TIPWINDOW - -#if wxUSE_POPUPWIN - #include "wx/popupwin.h" - - #define wxTipWindowBase wxPopupTransientWindow -#else - #include "wx/frame.h" - - #define wxTipWindowBase wxFrame -#endif -#include "wx/arrstr.h" - -class WXDLLIMPEXP_FWD_CORE wxTipWindowView; - -// ---------------------------------------------------------------------------- -// wxTipWindow -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTipWindow : public wxTipWindowBase -{ -public: - // the mandatory ctor parameters are: the parent window and the text to - // show - // - // optionally you may also specify the length at which the lines are going - // to be broken in rows (100 pixels by default) - // - // windowPtr and rectBound are just passed to SetTipWindowPtr() and - // SetBoundingRect() - see below - wxTipWindow(wxWindow *parent, - const wxString& text, - wxCoord maxLength = 100, - wxTipWindow** windowPtr = NULL, - wxRect *rectBound = NULL); - - virtual ~wxTipWindow(); - - // If windowPtr is not NULL the given address will be NULLed when the - // window has closed - void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } - - // If rectBound is not NULL, the window will disappear automatically when - // the mouse leave the specified rect: note that rectBound should be in the - // screen coordinates! - void SetBoundingRect(const wxRect& rectBound); - - // Hide and destroy the window - void Close(); - -protected: - // called by wxTipWindowView only - bool CheckMouseInBounds(const wxPoint& pos); - - // event handlers - void OnMouseClick(wxMouseEvent& event); - -#if !wxUSE_POPUPWIN - void OnActivate(wxActivateEvent& event); - void OnKillFocus(wxFocusEvent& event); -#else // wxUSE_POPUPWIN - virtual void OnDismiss(); -#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN - -private: - wxArrayString m_textLines; - wxCoord m_heightLine; - - wxTipWindowView *m_view; - - wxTipWindow** m_windowPtr; - wxRect m_rectBound; - - DECLARE_EVENT_TABLE() - - friend class wxTipWindowView; - - DECLARE_NO_COPY_CLASS(wxTipWindow) -}; - -#endif // wxUSE_TIPWINDOW - -#endif // _WX_TIPWIN_H_ diff --git a/Source/3rdParty/wx/include/wx/tokenzr.h b/Source/3rdParty/wx/include/wx/tokenzr.h deleted file mode 100644 index e67b20176..000000000 --- a/Source/3rdParty/wx/include/wx/tokenzr.h +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tokenzr.h -// Purpose: String tokenizer - a C++ replacement for strtok(3) -// Author: Guilhem Lavaux -// Modified by: (or rather rewritten by) Vadim Zeitlin -// Created: 04/22/98 -// RCS-ID: $Id: tokenzr.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOKENZRH -#define _WX_TOKENZRH - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// default: delimiters are usual white space characters -#define wxDEFAULT_DELIMITERS (wxT(" \t\r\n")) - -// wxStringTokenizer mode flags which determine its behaviour -enum wxStringTokenizerMode -{ - wxTOKEN_INVALID = -1, // set by def ctor until SetString() is called - wxTOKEN_DEFAULT, // strtok() for whitespace delims, RET_EMPTY else - wxTOKEN_RET_EMPTY, // return empty token in the middle of the string - wxTOKEN_RET_EMPTY_ALL, // return trailing empty tokens too - wxTOKEN_RET_DELIMS, // return the delim with token (implies RET_EMPTY) - wxTOKEN_STRTOK // behave exactly like strtok(3) -}; - -// ---------------------------------------------------------------------------- -// wxStringTokenizer: replaces infamous strtok() and has some other features -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject -{ -public: - // ctors and initializers - // default ctor, call SetString() later - wxStringTokenizer() { m_mode = wxTOKEN_INVALID; } - // ctor which gives us the string - wxStringTokenizer(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - - // args are same as for the non default ctor above - void SetString(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - - // reinitialize the tokenizer with the same delimiters/mode - void Reinit(const wxString& str); - - // tokens access - // return the number of remaining tokens - size_t CountTokens() const; - // did we reach the end of the string? - bool HasMoreTokens() const; - // get the next token, will return empty string if !HasMoreTokens() - wxString GetNextToken(); - // get the delimiter which terminated the token last retrieved by - // GetNextToken() or NUL if there had been no tokens yet or the last - // one wasn't terminated (but ran to the end of the string) - wxChar GetLastDelimiter() const { return m_lastDelim; } - - // get current tokenizer state - // returns the part of the string which remains to tokenize (*not* the - // initial string) - wxString GetString() const { return m_string.substr(m_pos); } - - // returns the current position (i.e. one index after the last - // returned token or 0 if GetNextToken() has never been called) in the - // original string - size_t GetPosition() const { return m_pos; } - - // misc - // get the current mode - can be different from the one passed to the - // ctor if it was wxTOKEN_DEFAULT - wxStringTokenizerMode GetMode() const { return m_mode; } - // do we return empty tokens? - bool AllowEmpty() const { return m_mode != wxTOKEN_STRTOK; } - - - // backwards compatibility section from now on - // ------------------------------------------- - - // for compatibility only, use GetNextToken() instead - wxString NextToken() { return GetNextToken(); } - - // compatibility only, don't use - void SetString(const wxString& to_tokenize, - const wxString& delims, - bool WXUNUSED(ret_delim)) - { - SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS); - } - - wxStringTokenizer(const wxString& to_tokenize, - const wxString& delims, - bool ret_delim) - { - SetString(to_tokenize, delims, ret_delim); - } - -protected: - bool IsOk() const { return m_mode != wxTOKEN_INVALID; } - - wxString m_string, // the string we tokenize - m_delims; // all possible delimiters - - size_t m_pos; // the current position in m_string - - wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values - - wxChar m_lastDelim; // delimiter after last token or '\0' -}; - -// ---------------------------------------------------------------------------- -// convenience function which returns all tokens at once -// ---------------------------------------------------------------------------- - -// the function takes the same parameters as wxStringTokenizer ctor and returns -// the array containing all tokens -wxArrayString WXDLLIMPEXP_BASE -wxStringTokenize(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - -#endif // _WX_TOKENZRH diff --git a/Source/3rdParty/wx/include/wx/toolbar.h b/Source/3rdParty/wx/include/wx/toolbar.h deleted file mode 100644 index a64868e48..000000000 --- a/Source/3rdParty/wx/include/wx/toolbar.h +++ /dev/null @@ -1,93 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/toolbar.h -// Purpose: wxToolBar interface declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.11.99 -// RCS-ID: $Id: toolbar.h 42645 2006-10-29 19:12:52Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLBAR_H_BASE_ -#define _WX_TOOLBAR_H_BASE_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxToolBar style flags -// ---------------------------------------------------------------------------- - -enum -{ - // lay out the toolbar horizontally - wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004 - wxTB_TOP = wxTB_HORIZONTAL, - - // lay out the toolbar vertically - wxTB_VERTICAL = wxVERTICAL, // == 0x0008 - wxTB_LEFT = wxTB_VERTICAL, - - // show 3D buttons (wxToolBarSimple only) - wxTB_3DBUTTONS = 0x0010, - - // "flat" buttons (Win32/GTK only) - wxTB_FLAT = 0x0020, - - // dockable toolbar (GTK only) - wxTB_DOCKABLE = 0x0040, - - // don't show the icons (they're shown by default) - wxTB_NOICONS = 0x0080, - - // show the text (not shown by default) - wxTB_TEXT = 0x0100, - - // don't show the divider between toolbar and the window (Win32 only) - wxTB_NODIVIDER = 0x0200, - - // no automatic alignment (Win32 only, useless) - wxTB_NOALIGN = 0x0400, - - // show the text and the icons alongside, not vertically stacked (Win32/GTK) - wxTB_HORZ_LAYOUT = 0x0800, - wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT, - - // don't show the toolbar short help tooltips - wxTB_NO_TOOLTIPS = 0x1000, - - // lay out toolbar at the bottom of the window - wxTB_BOTTOM = 0x2000, - - // lay out toolbar at the right edge of the window - wxTB_RIGHT = 0x4000 -}; - -#if wxUSE_TOOLBAR - #include "wx/tbarbase.h" // the base class for all toolbars - - #if defined(__WXUNIVERSAL__) - #include "wx/univ/toolbar.h" - #elif defined(__WXPALMOS__) - #include "wx/palmos/toolbar.h" - #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) - #include "wx/msw/tbar95.h" - #elif defined(__WXWINCE__) - #include "wx/msw/wince/tbarwce.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/toolbar.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/tbargtk.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/tbargtk.h" - #elif defined(__WXMAC__) - #include "wx/mac/toolbar.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/toolbar.h" - #elif defined(__WXPM__) - #include "wx/os2/toolbar.h" - #endif -#endif // wxUSE_TOOLBAR - -#endif - // _WX_TOOLBAR_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/toolbook.h b/Source/3rdParty/wx/include/wx/toolbook.h deleted file mode 100644 index 695ffa883..000000000 --- a/Source/3rdParty/wx/include/wx/toolbook.h +++ /dev/null @@ -1,163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/toolbook.h -// Purpose: wxToolbook: wxToolBar and wxNotebook combination -// Author: Julian Smart -// Modified by: -// Created: 2006-01-29 -// RCS-ID: $Id: toolbook.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2006 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLBOOK_H_ -#define _WX_TOOLBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_TOOLBOOK - -#include "wx/bookctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxToolBarBase; -class WXDLLIMPEXP_FWD_CORE wxCommandEvent; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING; - - -// Use wxButtonToolBar -#define wxBK_BUTTONBAR 0x0100 - -// ---------------------------------------------------------------------------- -// wxToolbook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolbook : public wxBookCtrlBase -{ -public: - wxToolbook() - { - Init(); - } - - wxToolbook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - // implement base class virtuals - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - - // methods which are not part of base wxBookctrl API - - // get the underlying toolbar - wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; } - - // must be called in OnIdle or by application to realize the toolbar and - // select the initial page. - void Realize(); - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the list control should have - virtual wxSize GetControllerSize() const; - - // event handlers - void OnToolSelected(wxCommandEvent& event); - void OnSize(wxSizeEvent& event); - void OnIdle(wxIdleEvent& event); - - void UpdateSelectedPage(size_t newsel); - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - - // whether the toolbar needs to be realized - bool m_needsRealizing; - - // maximum bitmap size - wxSize m_maxBitmapSize; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook) -}; - -// ---------------------------------------------------------------------------- -// listbook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxToolbookEvent(const wxToolbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent) -}; - -typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&); - -#define wxToolbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func) - -#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn)) - -#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn)) - -#endif // wxUSE_TOOLBOOK - -#endif // _WX_TOOLBOOK_H_ diff --git a/Source/3rdParty/wx/include/wx/tooltip.h b/Source/3rdParty/wx/include/wx/tooltip.h deleted file mode 100644 index af29741f4..000000000 --- a/Source/3rdParty/wx/include/wx/tooltip.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tooltip.h -// Purpose: wxToolTip base header -// Author: Robert Roebling -// Modified by: -// Created: -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: tooltip.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLTIP_H_BASE_ -#define _WX_TOOLTIP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TOOLTIPS - -#if defined(__WXMSW__) -#include "wx/msw/tooltip.h" -#elif defined(__WXMOTIF__) -// #include "wx/motif/tooltip.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/tooltip.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/tooltip.h" -#elif defined(__WXMAC__) -#include "wx/mac/tooltip.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/tooltip.h" -#elif defined(__WXPM__) -#include "wx/os2/tooltip.h" -#endif - -#endif - // wxUSE_TOOLTIPS - -#endif - // _WX_TOOLTIP_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/toplevel.h b/Source/3rdParty/wx/include/wx/toplevel.h deleted file mode 100644 index 2351d7cd9..000000000 --- a/Source/3rdParty/wx/include/wx/toplevel.h +++ /dev/null @@ -1,375 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/toplevel.h -// Purpose: declares wxTopLevelWindow class, the base class for all -// top level windows (such as frames and dialogs) -// Author: Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 06.08.01 -// RCS-ID: $Id: toplevel.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// Vaclav Slavik -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOPLEVEL_BASE_H_ -#define _WX_TOPLEVEL_BASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/iconbndl.h" - -// the default names for various classes -extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// style common to both wxFrame and wxDialog -#define wxSTAY_ON_TOP 0x8000 -#define wxICONIZE 0x4000 -#define wxMINIMIZE wxICONIZE -#define wxMAXIMIZE 0x2000 -#define wxCLOSE_BOX 0x1000 - -#define wxSYSTEM_MENU 0x0800 -#define wxMINIMIZE_BOX 0x0400 -#define wxMAXIMIZE_BOX 0x0200 -#define wxTINY_CAPTION_HORIZ 0x0100 -#define wxTINY_CAPTION_VERT 0x0080 -#define wxRESIZE_BORDER 0x0040 - -#if WXWIN_COMPATIBILITY_2_6 - - // deprecated versions defined for compatibility reasons - #define wxRESIZE_BOX wxMAXIMIZE_BOX - #define wxTHICK_FRAME wxRESIZE_BORDER - - // obsolete styles, unused any more - #define wxDIALOG_MODAL 0 - #define wxDIALOG_MODELESS 0 - #define wxNO_3D 0 - #define wxUSER_COLOURS 0 - -#endif // WXWIN_COMPATIBILITY_2_6 - -// default style -// -// under Windows CE (at least when compiling with eVC 4) we should create -// top level windows without any styles at all for them to appear -// "correctly", i.e. as full screen windows with a "hide" button (same as -// "close" but round instead of squared and just hides the applications -// instead of closing it) in the title bar -#if defined(__WXWINCE__) - #if defined(__SMARTPHONE__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE) - #elif defined(__WINCE_STANDARDSDK__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX) - #else - #define wxDEFAULT_FRAME_STYLE (wxNO_BORDER) - #endif -#else // !__WXWINCE__ - #define wxDEFAULT_FRAME_STYLE \ - (wxSYSTEM_MENU | \ - wxRESIZE_BORDER | \ - wxMINIMIZE_BOX | \ - wxMAXIMIZE_BOX | \ - wxCLOSE_BOX | \ - wxCAPTION | \ - wxCLIP_CHILDREN) -#endif - - -// Dialogs are created in a special way -#define wxTOPLEVEL_EX_DIALOG 0x00000008 - -// Styles for ShowFullScreen -// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and -// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow) -enum -{ - wxFULLSCREEN_NOMENUBAR = 0x0001, - wxFULLSCREEN_NOTOOLBAR = 0x0002, - wxFULLSCREEN_NOSTATUSBAR = 0x0004, - wxFULLSCREEN_NOBORDER = 0x0008, - wxFULLSCREEN_NOCAPTION = 0x0010, - - wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | - wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | - wxFULLSCREEN_NOCAPTION -}; - -// Styles for RequestUserAttention -enum -{ - wxUSER_ATTENTION_INFO = 1, - wxUSER_ATTENTION_ERROR = 2 -}; - -// ---------------------------------------------------------------------------- -// wxTopLevelWindow: a top level (as opposed to child) window -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow -{ -public: - // construction - wxTopLevelWindowBase(); - virtual ~wxTopLevelWindowBase(); - - // top level wnd state - // -------------------- - - // maximize = true => maximize, otherwise - restore - virtual void Maximize(bool maximize = true) = 0; - - // undo Maximize() or Iconize() - virtual void Restore() = 0; - - // iconize = true => iconize, otherwise - restore - virtual void Iconize(bool iconize = true) = 0; - - // return true if the frame is maximized - virtual bool IsMaximized() const = 0; - - // return true if the frame is always maximized - // due to native guidelines or current policy - virtual bool IsAlwaysMaximized() const; - - // return true if the frame is iconized - virtual bool IsIconized() const = 0; - - // get the frame icon - const wxIcon& GetIcon() const { return m_icons.GetIcon( -1 ); } - - // get the frame icons - const wxIconBundle& GetIcons() const { return m_icons; } - - // set the frame icon - virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); } - - // set the frame icons - virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; } - - // maximize the window to cover entire screen - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; - - // return true if the frame is in fullscreen mode - virtual bool IsFullScreen() const = 0; - - // the title of the top level window: the text which the - // window shows usually at the top of the frame/dialog in dedicated bar - virtual void SetTitle(const wxString& title) = 0; - virtual wxString GetTitle() const = 0; - - // enable/disable close button [x] - virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } - - // Set the shape of the window to the given region. - // Returns true if the platform supports this feature (and the - // operation is successful.) - virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } - - // Attracts the users attention to this window if the application is - // inactive (should be called when a background event occurs) - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - - // Is this the active frame (highlighted in the taskbar)? - virtual bool IsActive() { return wxGetTopLevelParent(FindFocus()) == this; } - - // this function may be overridden to return false to allow closing the - // application even when this top level window is still open - // - // notice that the window is still closed prior to the application exit and - // so it can still veto it even if it returns false from here - virtual bool ShouldPreventAppExit() const { return true; } - - -#if defined(__SMARTPHONE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; -#endif // __SMARTPHONE__ - - // centre the window on screen: this is just a shortcut - void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } - void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } - - - // default item access: we have a permanent default item which is the one - // set by the user code but we may also have a temporary default item which - // would be chosen if the user pressed "Enter" now but the default action - // reverts to the "permanent" default as soon as this temporary default - // item loses focus - - // used to reset default if pointing to removed child - virtual void RemoveChild(wxWindowBase *child); - - // get the default item, temporary or permanent - wxWindow *GetDefaultItem() const - { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; } - - // set the permanent default item, return the old default - wxWindow *SetDefaultItem(wxWindow *win) - { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; } - - // return the temporary default item, can be NULL - wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; } - - // set a temporary default item, SetTmpDefaultItem(NULL) should be called - // soon after a call to SetTmpDefaultItem(window), return the old default - wxWindow *SetTmpDefaultItem(wxWindow *win) - { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; } - - - // implementation only from now on - // ------------------------------- - - // override some base class virtuals - virtual bool Destroy(); - virtual bool IsTopLevel() const { return true; } - virtual bool IsVisible() const { return IsShown(); } - - // event handlers - void OnCloseWindow(wxCloseEvent& event); - void OnSize(wxSizeEvent& WXUNUSED(event)) { DoLayout(); } - - // Get rect to be used to center top-level children - virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); - - // this should go away, but for now it's called from docview.cpp, - // so should be there for all platforms - void OnActivate(wxActivateEvent &WXUNUSED(event)) { } - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; - - // a different API for SetSizeHints - virtual void SetMinSize(const wxSize& minSize); - virtual void SetMaxSize(const wxSize& maxSize); - - // set size hints for "window manager" - virtual void DoSetSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, - int incW = wxDefaultCoord, int incH = wxDefaultCoord ); - -protected: - // the frame client to screen translation should take account of the - // toolbar which may shift the origin of the client area - virtual void DoClientToScreen(int *x, int *y) const; - virtual void DoScreenToClient(int *x, int *y) const; - - // add support for wxCENTRE_ON_SCREEN - virtual void DoCentre(int dir); - - // no need to do client to screen translation to get our position in screen - // coordinates: this is already the case - virtual void DoGetScreenPosition(int *x, int *y) const - { - DoGetPosition(x, y); - } - - // test whether this window makes part of the frame - // (menubar, toolbar and statusbar are excluded from automatic layout) - virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const - { return false; } - - // check if we should exit the program after deleting this window - bool IsLastBeforeExit() const; - - // send the iconize event, return true if processed - bool SendIconizeEvent(bool iconized = true); - - // do TLW-specific layout: we resize our unique child to fill the entire - // client area - void DoLayout(); - - // Get the default size for the new window if no explicit size given. If - // there are better default sizes then these can be changed, just as long - // as they are not too small for TLWs (and not larger than screen). - static wxSize GetDefaultSize(); - static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; } - static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; } - - // the frame icon - wxIconBundle m_icons; - - // a default window (usually a button) or NULL - wxWindow *m_winDefault; - - // a temporary override of m_winDefault, use the latter if NULL - wxWindow *m_winTmpDefault; - - DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase) - DECLARE_EVENT_TABLE() -}; - - -// include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowPalm -#elif defined(__WXMSW__) - #include "wx/msw/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMSW -#elif defined(__WXGTK20__) - #include "wx/gtk/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowGTK -#elif defined(__WXGTK__) - #include "wx/gtk1/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowGTK -#elif defined(__WXX11__) - #include "wx/x11/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowX11 -#elif defined(__WXMGL__) - #include "wx/mgl/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMGL -#elif defined(__WXDFB__) - #include "wx/dfb/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowDFB -#elif defined(__WXMAC__) - #include "wx/mac/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowCocoa -#elif defined(__WXPM__) - #include "wx/os2/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowOS2 -#elif defined(__WXMOTIF__) - #include "wx/motif/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMotif -#endif - -#ifdef __WXUNIVERSAL__ - #include "wx/univ/toplevel.h" -#else // !__WXUNIVERSAL__ - #ifdef wxTopLevelWindowNative - class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative - { - public: - // construction - wxTopLevelWindow() { Init(); } - wxTopLevelWindow(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) - }; - #endif // wxTopLevelWindowNative -#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ - - -#endif // _WX_TOPLEVEL_BASE_H_ diff --git a/Source/3rdParty/wx/include/wx/treebase.h b/Source/3rdParty/wx/include/wx/treebase.h deleted file mode 100644 index a89786268..000000000 --- a/Source/3rdParty/wx/include/wx/treebase.h +++ /dev/null @@ -1,426 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/treebase.h -// Purpose: wxTreeCtrl base classes and types -// Author: Julian Smart et al -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: treebase.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1997,1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREEBASE_H_ -#define _WX_TREEBASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TREECTRL - -#include "wx/window.h" // for wxClientData -#include "wx/event.h" -#include "wx/dynarray.h" - -#if WXWIN_COMPATIBILITY_2_6 - -// flags for deprecated `Expand(int action)', will be removed in next versions -enum -{ - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// wxTreeItemId identifies an element of the tree. In this implementation, it's -// just a trivial wrapper around Win32 HTREEITEM or a pointer to some private -// data structure in the generic version. It's opaque for the application and -// the only method which can be used by user code is IsOk(). -// ---------------------------------------------------------------------------- - -// Using this typedef removes an ambiguity when calling Remove() -typedef void *wxTreeItemIdValue; - -class WXDLLEXPORT wxTreeItemId -{ - friend bool operator==(const wxTreeItemId&, const wxTreeItemId&); -public: - // ctors - // 0 is invalid value for HTREEITEM - wxTreeItemId() { m_pItem = 0; } - - // construct wxTreeItemId from the native item id - wxTreeItemId(void *pItem) { m_pItem = pItem; } - - // default copy ctor/assignment operator are ok for us - - // accessors - // is this a valid tree item? - bool IsOk() const { return m_pItem != 0; } - // return true if this item is not valid - bool operator!() const { return !IsOk(); } - - // operations - // invalidate the item - void Unset() { m_pItem = 0; } - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated: only for compatibility, don't work on 64 bit archs - wxTreeItemId(long item) { m_pItem = wxUIntToPtr(item); } - operator long() const { return (long)wxPtrToUInt(m_pItem); } -#else // !WXWIN_COMPATIBILITY_2_4 - operator bool() const { return IsOk(); } -#endif // WXWIN_COMPATIBILITY_2_4/!WXWIN_COMPATIBILITY_2_4 - - wxTreeItemIdValue m_pItem; -}; - -inline bool operator==(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem == i2.m_pItem; -} - -inline bool operator!=(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem != i2.m_pItem; -} - -// ---------------------------------------------------------------------------- -// wxTreeItemData is some (arbitrary) user class associated with some item. The -// main advantage of having this class (compared to old untyped interface) is -// that wxTreeItemData's are destroyed automatically by the tree and, as this -// class has virtual dtor, it means that the memory will be automatically -// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because -// the size of this class is critical: in any real application, each tree leaf -// will have wxTreeItemData associated with it and number of leaves may be -// quite big. -// -// Because the objects of this class are deleted by the tree, they should -// always be allocated on the heap! -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeItemData: public wxClientData -{ -friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; -friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; -public: - // creation/destruction - // -------------------- - // default ctor - wxTreeItemData() { } - - // default copy ctor/assignment operator are ok - - // accessor: get the item associated with us - const wxTreeItemId& GetId() const { return m_pItem; } - void SetId(const wxTreeItemId& id) { m_pItem = id; } - -protected: - wxTreeItemId m_pItem; -}; - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); - -// this is a wrapper around the array class defined above which allow to wok -// with vaue of natural wxTreeItemId type instead of using wxTreeItemIdValue -// and does it without any loss of efficiency -class WXDLLEXPORT wxArrayTreeItemIds : public wxArrayTreeItemIdsBase -{ -public: - void Add(const wxTreeItemId& id) - { wxArrayTreeItemIdsBase::Add(id.m_pItem); } - void Insert(const wxTreeItemId& id, size_t pos) - { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } - wxTreeItemId Item(size_t i) const - { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } - wxTreeItemId operator[](size_t i) const { return Item(i); } -}; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// enum for different images associated with a treectrl item -enum wxTreeItemIcon -{ - wxTreeItemIcon_Normal, // not selected, not expanded - wxTreeItemIcon_Selected, // selected, not expanded - wxTreeItemIcon_Expanded, // not selected, expanded - wxTreeItemIcon_SelectedExpanded, // selected, expanded - wxTreeItemIcon_Max -}; - -// ---------------------------------------------------------------------------- -// wxTreeCtrl flags -// ---------------------------------------------------------------------------- - -#define wxTR_NO_BUTTONS 0x0000 // for convenience -#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns -#define wxTR_NO_LINES 0x0004 // don't draw lines at all -#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes -#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl - -#define wxTR_SINGLE 0x0000 // for convenience -#define wxTR_MULTIPLE 0x0020 // can select multiple items -#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection -#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says - -#define wxTR_EDIT_LABELS 0x0200 // can edit item labels -#define wxTR_ROW_LINES 0x0400 // put border around items -#define wxTR_HIDE_ROOT 0x0800 // don't display root node - -#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space - -#ifdef __WXGTK20__ -#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) -#else -#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) -#endif - -#if WXWIN_COMPATIBILITY_2_6 -// deprecated, don't use -#define wxTR_MAC_BUTTONS 0 -#define wxTR_AQUA_BUTTONS 0 -#endif // WXWIN_COMPATIBILITY_2_6 - - -// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine -// where exactly the specified point is situated: - -static const int wxTREE_HITTEST_ABOVE = 0x0001; -static const int wxTREE_HITTEST_BELOW = 0x0002; -static const int wxTREE_HITTEST_NOWHERE = 0x0004; - // on the button associated with an item. -static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; - // on the bitmap associated with an item. -static const int wxTREE_HITTEST_ONITEMICON = 0x0010; - // on the indent associated with an item. -static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; - // on the label (string) associated with an item. -static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; - // on the right of the label associated with an item. -static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; - // on the label (string) associated with an item. -static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; - // on the left of the wxTreeCtrl. -static const int wxTREE_HITTEST_TOLEFT = 0x0200; - // on the right of the wxTreeCtrl. -static const int wxTREE_HITTEST_TORIGHT = 0x0400; - // on the upper part (first half) of the item. -static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; - // on the lower part (second half) of the item. -static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; - - // anywhere on the item -static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | - wxTREE_HITTEST_ONITEMLABEL; - -// tree ctrl default name -extern WXDLLEXPORT_DATA(const wxChar) wxTreeCtrlNameStr[]; - -// ---------------------------------------------------------------------------- -// wxTreeItemAttr: a structure containing the visual attributes of an item -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeItemAttr -{ -public: - // ctors - wxTreeItemAttr() { } - wxTreeItemAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font) - : m_colText(colText), m_colBack(colBack), m_font(font) { } - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetFont(const wxFont& font) { m_font = font; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - -private: - wxColour m_colText, - m_colBack; - wxFont m_font; -}; - -// ---------------------------------------------------------------------------- -// wxTreeEvent is a special class for all events associated with tree controls -// -// NB: note that not all accessors make sense for all events, see the event -// descriptions below -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; - -class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent -{ -public: - wxTreeEvent(wxEventType commandType, - wxTreeCtrlBase *tree, - const wxTreeItemId &item = wxTreeItemId()); - wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); - wxTreeEvent(const wxTreeEvent& event); - - virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } - - // accessors - // get the item on which the operation was performed or the newly - // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events - wxTreeItemId GetItem() const { return m_item; } - void SetItem(const wxTreeItemId& item) { m_item = item; } - - // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously - // selected item - wxTreeItemId GetOldItem() const { return m_itemOld; } - void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } - - // the point where the mouse was when the drag operation started (for - // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only) or click position - wxPoint GetPoint() const { return m_pointDrag; } - void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } - - // keyboard data (for wxEVT_COMMAND_TREE_KEY_DOWN only) - const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } - int GetKeyCode() const { return m_evtKey.GetKeyCode(); } - void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } - - // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) - const wxString& GetLabel() const { return m_label; } - void SetLabel(const wxString& label) { m_label = label; } - - // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) - bool IsEditCancelled() const { return m_editCancelled; } - void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - - // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events) - void SetToolTip(const wxString& toolTip) { m_label = toolTip; } - wxString GetToolTip() { return m_label; } - -private: - // not all of the members are used (or initialized) for all events - wxKeyEvent m_evtKey; - wxTreeItemId m_item, - m_itemOld; - wxPoint m_pointDrag; - wxString m_label; - bool m_editCancelled; - - friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; - friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; - - DECLARE_DYNAMIC_CLASS(wxTreeEvent) -}; - -typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); - -// ---------------------------------------------------------------------------- -// tree control events and macros for handling them -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG, 600) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG, 601) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 602) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT, 603) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM, 604) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO, 605) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO, 606) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED, 607) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 608) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 609) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 610) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED, 611) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING, 612) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN, 613) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 614) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 615) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 616) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU, 620) -END_DECLARE_EVENT_TYPES() - -#define wxTreeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreeEventFunction, &func) - -#define wx__DECLARE_TREEEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn)) - -// GetItem() returns the item being dragged, GetPoint() the mouse coords -// -// if you call event.Allow(), the drag operation will start and a -// EVT_TREE_END_DRAG event will be sent when the drag is over. -#define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) -#define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) - -// GetItem() is the item on which the drop occurred (if any) and GetPoint() the -// current mouse coords -#define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) - -// GetItem() returns the itme whose label is being edited, GetLabel() returns -// the current item label for BEGIN and the would be new one for END. -// -// Vetoing BEGIN event means that label editing won't happen at all, -// vetoing END means that the new value is discarded and the old one kept -#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) -#define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) - -// provide/update information about GetItem() item -#define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) -#define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) - -// GetItem() is the item being expanded/collapsed, the "ING" versions can use -#define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) -#define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) -#define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) -#define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) - -// GetOldItem() is the item which had the selection previously, GetItem() is -// the item which acquires selection -#define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) -#define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) - -// GetKeyCode() returns the key code -// NB: this is the only message for which GetItem() is invalid (you may get the -// item from GetSelection()) -#define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) - -// GetItem() returns the item being deleted, the associated data (if any) will -// be deleted just after the return of this event handler (if any) -#define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) - -// GetItem() returns the item that was activated (double click, enter, space) -#define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) - -// GetItem() returns the item for which the context menu shall be shown -#define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) - -// GetItem() returns the item that was clicked on -#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) -#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) - -// GetItem() returns the item whose state image was clicked on -#define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) - -// GetItem() is the item for which the tooltip is being requested -#define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) - -#endif // wxUSE_TREECTRL - -#endif // _WX_TREEBASE_H_ diff --git a/Source/3rdParty/wx/include/wx/treebook.h b/Source/3rdParty/wx/include/wx/treebook.h deleted file mode 100644 index dba636352..000000000 --- a/Source/3rdParty/wx/include/wx/treebook.h +++ /dev/null @@ -1,283 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/treebook.h -// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree -// Author: Evgeniy Tarassov, Vadim Zeitlin -// Modified by: -// Created: 2005-09-15 -// RCS-ID: $Id: treebook.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREEBOOK_H_ -#define _WX_TREEBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_TREEBOOK - -#include "wx/bookctrl.h" -#include "wx/treectrl.h" // for wxArrayTreeItemIds -#include "wx/containr.h" - -typedef wxWindow wxTreebookPage; - -class WXDLLIMPEXP_FWD_CORE wxTreeEvent; - -// ---------------------------------------------------------------------------- -// wxTreebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreebook : public wxBookCtrlBase -{ -public: - // Constructors and such - // --------------------- - - // Default ctor doesn't create the control, use Create() afterwards - wxTreebook() - { - Init(); - } - - // This ctor creates the tree book control - wxTreebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBK_DEFAULT, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // Really creates the control - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBK_DEFAULT, - const wxString& name = wxEmptyString); - - - // Page insertion operations - // ------------------------- - - // Notice that page pointer may be NULL in which case the next non NULL - // page (usually the first child page of a node) is shown when this page is - // selected - - // Inserts a new page just before the page indicated by page. - // The new page is placed on the same level as page. - virtual bool InsertPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Inserts a new sub-page to the end of children of the page at given pos. - virtual bool InsertSubPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Adds a new page at top level after all other pages. - virtual bool AddPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Adds a new child-page to the last top-level page inserted. - // Useful when constructing 1 level tree structure. - virtual bool AddSubPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Deletes the page and ALL its children. Could trigger page selection - // change in a case when selected page is removed. In that case its parent - // is selected (or the next page if no parent). - virtual bool DeletePage(size_t pos); - - - // Tree operations - // --------------- - - // Gets the page node state -- node is expanded or collapsed - virtual bool IsNodeExpanded(size_t pos) const; - - // Expands or collapses the page node. Returns the previous state. - // May generate page changing events (if selected page - // is under the collapsed branch, then parent is autoselected). - virtual bool ExpandNode(size_t pos, bool expand = true); - - // shortcut for ExpandNode(pos, false) - bool CollapseNode(size_t pos) { return ExpandNode(pos, false); } - - // get the parent page or wxNOT_FOUND if this is a top level page - int GetPageParent(size_t pos) const; - - // the tree control we use for showing the pages index tree - wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; } - - - // Standard operations inherited from wxBookCtrlBase - // ------------------------------------------------- - - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - virtual void SetImageList(wxImageList *imageList); - virtual void AssignImageList(wxImageList *imageList); - virtual bool DeleteAllPages(); - -protected: - // Implementation of a page removal. See DeletPage for comments. - wxTreebookPage *DoRemovePage(size_t pos); - - // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) - virtual bool AllowNullPage() const { return true; } - - // event handlers - void OnTreeSelectionChange(wxTreeEvent& event); - void OnTreeNodeExpandedCollapsed(wxTreeEvent& event); - - // array of page ids and page windows - wxArrayTreeItemIds m_treeIds; - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - - // in the situation when m_selection page is not wxNOT_FOUND but page is - // NULL this is the first (sub)child that has a non-NULL page - int m_actualSelection; - -private: - // common part of all constructors - void Init(); - - // The real implementations of page insertion functions - // ------------------------------------------------------ - // All DoInsert/Add(Sub)Page functions add the page into : - // - the base class - // - the tree control - // - update the index/TreeItemId corespondance array - bool DoInsertPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - bool DoInsertSubPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - bool DoAddSubPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Sets selection in the tree control and updates the page being shown. - int DoSetSelection(size_t pos, int flags = 0); - - // Returns currently shown page. In a case when selected the node - // has empty (NULL) page finds first (sub)child with not-empty page. - wxTreebookPage *DoGetCurrentPage() const; - - // Does the selection update. Called from page insertion functions - // to update selection if the selected page was pushed by the newly inserted - void DoUpdateSelection(bool bSelect, int page); - - - // Operations on the internal private members of the class - // ------------------------------------------------------- - // Returns the page TreeItemId for the page. - // Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false) - wxTreeItemId DoInternalGetPage(size_t pos) const; - - // Linear search for a page with the id specified. If no page - // found wxNOT_FOUND is returned. The function is used when we catch an event - // from m_tree (wxTreeCtrl) component. - int DoInternalFindPageById(wxTreeItemId page) const; - - // Updates page and wxTreeItemId correspondance. - void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId); - - // Removes the page from internal structure. - void DoInternalRemovePage(size_t pos) - { DoInternalRemovePageRange(pos, 0); } - - // Removes the page and all its children designated by subCount - // from internal structures of the control. - void DoInternalRemovePageRange(size_t pos, size_t subCount); - - // Returns internal number of pages which can be different from - // GetPageCount() while performing a page insertion or removal. - size_t DoInternalGetPageCount() const { return m_treeIds.Count(); } - - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook) - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -// ---------------------------------------------------------------------------- -// treebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxTreebookEvent(const wxTreebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent) -}; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED; - -typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&); - -#define wxTreebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func) - -#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn)) - - -#endif // wxUSE_TREEBOOK - -#endif // _WX_TREEBOOK_H_ diff --git a/Source/3rdParty/wx/include/wx/treectrl.h b/Source/3rdParty/wx/include/wx/treectrl.h deleted file mode 100644 index 2b919cbd5..000000000 --- a/Source/3rdParty/wx/include/wx/treectrl.h +++ /dev/null @@ -1,459 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/treectrl.h -// Purpose: wxTreeCtrl base header -// Author: Karsten Ballueder -// Modified by: -// Created: -// Copyright: (c) Karsten Ballueder -// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREECTRL_H_BASE_ -#define _WX_TREECTRL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TREECTRL - -#include "wx/control.h" -#include "wx/treebase.h" -#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through CLASSINFO macro - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -// ---------------------------------------------------------------------------- -// wxTreeCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeCtrlBase : public wxControl -{ -public: - wxTreeCtrlBase() - { - m_imageListNormal = - m_imageListState = NULL; - m_ownsImageListNormal = - m_ownsImageListState = false; - - // arbitrary default - m_spacing = 18; - - // quick DoGetBestSize calculation - m_quickBestSize = true; - } - - virtual ~wxTreeCtrlBase(); - - // accessors - // --------- - - // get the total number of items in the control - virtual unsigned int GetCount() const = 0; - - // indent is the number of pixels the children are indented relative to - // the parents position. SetIndent() also redraws the control - // immediately. - virtual unsigned int GetIndent() const = 0; - virtual void SetIndent(unsigned int indent) = 0; - - // spacing is the number of pixels between the start and the Text - // (has no effect under wxMSW) - unsigned int GetSpacing() const { return m_spacing; } - void SetSpacing(unsigned int spacing) { m_spacing = spacing; } - - // image list: these functions allow to associate an image list with - // the control and retrieve it. Note that the control does _not_ delete - // the associated image list when it's deleted in order to allow image - // lists to be shared between different controls. - // - // The normal image list is for the icons which correspond to the - // normal tree item state (whether it is selected or not). - // Additionally, the application might choose to show a state icon - // which corresponds to an app-defined item state (for example, - // checked/unchecked) which are taken from the state image list. - wxImageList *GetImageList() const { return m_imageListNormal; } - wxImageList *GetStateImageList() const { return m_imageListState; } - - virtual void SetImageList(wxImageList *imageList) = 0; - virtual void SetStateImageList(wxImageList *imageList) = 0; - void AssignImageList(wxImageList *imageList) - { - SetImageList(imageList); - m_ownsImageListNormal = true; - } - void AssignStateImageList(wxImageList *imageList) - { - SetStateImageList(imageList); - m_ownsImageListState = true; - } - - - // Functions to work with tree ctrl items. Unfortunately, they can _not_ be - // member functions of wxTreeItem because they must know the tree the item - // belongs to for Windows implementation and storing the pointer to - // wxTreeCtrl in each wxTreeItem is just too much waste. - - // accessors - // --------- - - // retrieve items label - virtual wxString GetItemText(const wxTreeItemId& item) const = 0; - // get one of the images associated with the item (normal by default) - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0; - // get the data associated with the item - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0; - - // get the item's text colour - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0; - - // get the item's background colour - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0; - - // get the item's font - virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0; - - // modifiers - // --------- - - // set items label - virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0; - // get one of the images associated with the item (normal by default) - virtual void SetItemImage(const wxTreeItemId& item, - int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0; - // associate some data with the item - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0; - - // force appearance of [+] button near the item. This is useful to - // allow the user to expand the items which don't have any children now - // - but instead add them only when needed, thus minimizing memory - // usage and loading time. - virtual void SetItemHasChildren(const wxTreeItemId& item, - bool has = true) = 0; - - // the item will be shown in bold - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0; - - // the item will be shown with a drop highlight - virtual void SetItemDropHighlight(const wxTreeItemId& item, - bool highlight = true) = 0; - - // set the items text colour - virtual void SetItemTextColour(const wxTreeItemId& item, - const wxColour& col) = 0; - - // set the items background colour - virtual void SetItemBackgroundColour(const wxTreeItemId& item, - const wxColour& col) = 0; - - // set the items font (should be of the same height for all items) - virtual void SetItemFont(const wxTreeItemId& item, - const wxFont& font) = 0; - - // item status inquiries - // --------------------- - - // is the item visible (it might be outside the view or not expanded)? - virtual bool IsVisible(const wxTreeItemId& item) const = 0; - // does the item has any children? - virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0; - // same as above - bool HasChildren(const wxTreeItemId& item) const - { return ItemHasChildren(item); } - // is the item expanded (only makes sense if HasChildren())? - virtual bool IsExpanded(const wxTreeItemId& item) const = 0; - // is this item currently selected (the same as has focus)? - virtual bool IsSelected(const wxTreeItemId& item) const = 0; - // is item text in bold font? - virtual bool IsBold(const wxTreeItemId& item) const = 0; -#if wxABI_VERSION >= 20801 - // is the control empty? - bool IsEmpty() const; -#endif // wxABI 2.8.1+ - - - // number of children - // ------------------ - - // if 'recursively' is false, only immediate children count, otherwise - // the returned number is the number of all items in this branch - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const = 0; - - // navigation - // ---------- - - // wxTreeItemId.IsOk() will return false if there is no such item - - // get the root tree item - virtual wxTreeItemId GetRootItem() const = 0; - - // get the item currently selected (may return NULL if no selection) - virtual wxTreeItemId GetSelection() const = 0; - - // get the items currently selected, return the number of such item - // - // NB: this operation is expensive and can take a long time for a - // control with a lot of items (~ O(number of items)). - virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0; - - // get the parent of this item (may return NULL if root) - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; - - // for this enumeration function you must pass in a "cookie" parameter - // which is opaque for the application but is necessary for the library - // to make these functions reentrant (i.e. allow more than one - // enumeration on one and the same object simultaneously). Of course, - // the "cookie" passed to GetFirstChild() and GetNextChild() should be - // the same! - - // get the first child of this item - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const = 0; - // get the next child - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const = 0; - // get the last child of this item - this method doesn't use cookies - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0; - - // get the next sibling of this item - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0; - // get the previous sibling - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0; - - // get first visible item - virtual wxTreeItemId GetFirstVisibleItem() const = 0; - // get the next visible item: item must be visible itself! - // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0; - // get the previous visible item: item must be visible itself! - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0; - - // operations - // ---------- - - // add the root node to the tree - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; - - // insert a new item in as the first child of the parent - wxTreeItemId PrependItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, 0u, text, image, selImage, data); - } - - // insert a new item after a given one - wxTreeItemId InsertItem(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertAfter(parent, idPrevious, text, image, selImage, data); - } - - // insert a new item before the one with the given index - wxTreeItemId InsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, pos, text, image, selImage, data); - } - - // insert a new item in as the last child of the parent - wxTreeItemId AppendItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, (size_t)-1, text, image, selImage, data); - } - - // delete this item and associated data if any - virtual void Delete(const wxTreeItemId& item) = 0; - // delete all children (but don't delete the item itself) - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - virtual void DeleteChildren(const wxTreeItemId& item) = 0; - // delete all items from the tree - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - virtual void DeleteAllItems() = 0; - - // expand this item - virtual void Expand(const wxTreeItemId& item) = 0; - // expand the item and all its childs and thats childs - void ExpandAllChildren(const wxTreeItemId& item); - // expand all items - void ExpandAll(); - // collapse the item without removing its children - virtual void Collapse(const wxTreeItemId& item) = 0; -#if wxABI_VERSION >= 20801 - // collapse the item and all its childs and thats childs - void CollapseAllChildren(const wxTreeItemId& item); - // collapse all items - void CollapseAll(); -#endif // wxABI 2.8.1+ - // collapse the item and remove all children - virtual void CollapseAndReset(const wxTreeItemId& item) = 0; - // toggles the current state - virtual void Toggle(const wxTreeItemId& item) = 0; - - // remove the selection from currently selected item (if any) - virtual void Unselect() = 0; - // unselect all items (only makes sense for multiple selection control) - virtual void UnselectAll() = 0; - // select this item - virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0; - // unselect this item - void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } - // toggle item selection - void ToggleItemSelection(const wxTreeItemId& item) - { - SelectItem(item, !IsSelected(item)); - } - - // make sure this item is visible (expanding the parent item and/or - // scrolling to this item if necessary) - virtual void EnsureVisible(const wxTreeItemId& item) = 0; - // scroll to this item (but don't expand its parent) - virtual void ScrollTo(const wxTreeItemId& item) = 0; - - // start editing the item label: this (temporarily) replaces the item - // with a one line edit control. The item will be selected if it hadn't - // been before. textCtrlClass parameter allows you to create an edit - // control of arbitrary user-defined class deriving from wxTextCtrl. - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) = 0; - // returns the same pointer as StartEdit() if the item is being edited, - // NULL otherwise (it's assumed that no more than one item may be - // edited simultaneously) - virtual wxTextCtrl *GetEditControl() const = 0; - // end editing and accept or discard the changes to item label - virtual void EndEditLabel(const wxTreeItemId& item, - bool discardChanges = false) = 0; - - // sorting - // ------- - - // this function is called to compare 2 items and should return -1, 0 - // or +1 if the first item is less than, equal to or greater than the - // second one. The base class version performs alphabetic comparaison - // of item labels (GetText) - virtual int OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2) - { - return wxStrcmp(GetItemText(item1), GetItemText(item2)); - } - - // sort the children of this item using OnCompareItems - // - // NB: this function is not reentrant and not MT-safe (FIXME)! - virtual void SortChildren(const wxTreeItemId& item) = 0; - - // items geometry - // -------------- - - // determine to which item (if any) belongs the given point (the - // coordinates specified are relative to the client area of tree ctrl) - // and, in the second variant, fill the flags parameter with a bitmask - // of wxTREE_HITTEST_xxx constants. - wxTreeItemId HitTest(const wxPoint& point) const - { int dummy; return DoTreeHitTest(point, dummy); } - wxTreeItemId HitTest(const wxPoint& point, int& flags) const - { return DoTreeHitTest(point, flags); } - - // get the bounding rectangle of the item (or of its label only) - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const = 0; - - - // implementation - // -------------- - - virtual bool ShouldInheritColours() const { return false; } - - // hint whether to calculate best size quickly or accurately - void SetQuickBestSize(bool q) { m_quickBestSize = q; } - bool GetQuickBestSize() const { return m_quickBestSize; } - -protected: - virtual wxSize DoGetBestSize() const; - - // common part of Append/Prepend/InsertItem() - // - // pos is the position at which to insert the item or (size_t)-1 to append - // it to the end - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image, int selImage, - wxTreeItemData *data) = 0; - - // and this function implements overloaded InsertItem() taking wxTreeItemId - // (it can't be called InsertItem() as we'd have virtual function hiding - // problem in derived classes then) - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; - - // real HitTest() implementation: again, can't be called just HitTest() - // because it's overloaded and so the non-virtual overload would be hidden - // (and can't be called DoHitTest() because this is already in wxWindow) - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, - int& flags) const = 0; - - - wxImageList *m_imageListNormal, // images for tree elements - *m_imageListState; // special images for app defined states - bool m_ownsImageListNormal, - m_ownsImageListState; - - // spacing between left border and the text - unsigned int m_spacing; - - // whether full or quick calculation is done in DoGetBestSize - bool m_quickBestSize; - - - DECLARE_NO_COPY_CLASS(wxTreeCtrlBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent wxTreeCtrl class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/treectlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/treectrl.h" -#elif defined(__WXMSW__) - #include "wx/msw/treectrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/treectlg.h" -#elif defined(__WXGTK__) - #include "wx/generic/treectlg.h" -#elif defined(__WXMAC__) - #include "wx/generic/treectlg.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/treectlg.h" -#elif defined(__WXPM__) - #include "wx/generic/treectlg.h" -#endif - -#endif // wxUSE_TREECTRL - -#endif // _WX_TREECTRL_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/txtstrm.h b/Source/3rdParty/wx/include/wx/txtstrm.h deleted file mode 100644 index 0e2b0c955..000000000 --- a/Source/3rdParty/wx/include/wx/txtstrm.h +++ /dev/null @@ -1,160 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/txtstrm.h -// Purpose: Text stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 28/06/1998 -// RCS-ID: $Id: txtstrm.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TXTSTREAM_H_ -#define _WX_TXTSTREAM_H_ - -#include "wx/stream.h" -#include "wx/convauto.h" - -#if wxUSE_STREAMS - -class WXDLLIMPEXP_FWD_BASE wxTextInputStream; -class WXDLLIMPEXP_FWD_BASE wxTextOutputStream; - -typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&); -typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&); - -WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream ); - - -#define wxEOT wxT('\4') // the End-Of-Text control code (used only inside wxTextInputStream) - -// If you're scanning through a file using wxTextInputStream, you should check for EOF _before_ -// reading the next item (word / number), because otherwise the last item may get lost. -// You should however be prepared to receive an empty item (empty string / zero number) at the -// end of file, especially on Windows systems. This is unavoidable because most (but not all) files end -// with whitespace (i.e. usually a newline). -class WXDLLIMPEXP_BASE wxTextInputStream -{ -public: -#if wxUSE_UNICODE - wxTextInputStream(wxInputStream& s, - const wxString &sep=wxT(" \t"), - const wxMBConv& conv = wxConvAuto()); -#else - wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t")); -#endif - ~wxTextInputStream(); - - wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format) - wxUint16 Read16(int base = 10); - wxUint8 Read8(int base = 10); - wxInt32 Read32S(int base = 10); - wxInt16 Read16S(int base = 10); - wxInt8 Read8S(int base = 10); - double ReadDouble(); - wxString ReadLine(); - wxString ReadWord(); - wxChar GetChar() { wxChar c = NextChar(); return (wxChar)(c != wxEOT ? c : 0); } - - wxString GetStringSeparators() const { return m_separators; } - void SetStringSeparators(const wxString &c) { m_separators = c; } - - // Operators - wxTextInputStream& operator>>(wxString& word); - wxTextInputStream& operator>>(char& c); -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - wxTextInputStream& operator>>(wchar_t& wc); -#endif // wxUSE_UNICODE - wxTextInputStream& operator>>(wxInt16& i); - wxTextInputStream& operator>>(wxInt32& i); - wxTextInputStream& operator>>(wxUint16& i); - wxTextInputStream& operator>>(wxUint32& i); - wxTextInputStream& operator>>(double& i); - wxTextInputStream& operator>>(float& f); - - wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxString ReadString() ); // use ReadLine or ReadWord instead -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxInputStream &m_input; - wxString m_separators; - char m_lastBytes[10]; // stores the bytes that were read for the last character - -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - bool EatEOL(const wxChar &c); - void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues - // returns EOT (\4) if there is a stream error, or end of file - wxChar NextChar(); // this should be used instead of GetC() because of Unicode issues - wxChar NextNonSeparators(); - - DECLARE_NO_COPY_CLASS(wxTextInputStream) -}; - -typedef enum -{ - wxEOL_NATIVE, - wxEOL_UNIX, - wxEOL_MAC, - wxEOL_DOS -} wxEOL; - -class WXDLLIMPEXP_BASE wxTextOutputStream -{ -public: -#if wxUSE_UNICODE - wxTextOutputStream(wxOutputStream& s, - wxEOL mode = wxEOL_NATIVE, - const wxMBConv& conv = wxConvAuto()); -#else - wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE); -#endif - virtual ~wxTextOutputStream(); - - void SetMode( wxEOL mode = wxEOL_NATIVE ); - wxEOL GetMode() { return m_mode; } - - void Write32(wxUint32 i); - void Write16(wxUint16 i); - void Write8(wxUint8 i); - virtual void WriteDouble(double d); - virtual void WriteString(const wxString& string); - - wxTextOutputStream& PutChar(wxChar c); - - wxTextOutputStream& operator<<(const wxChar *string); - wxTextOutputStream& operator<<(const wxString& string); - wxTextOutputStream& operator<<(char c); -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - wxTextOutputStream& operator<<(wchar_t wc); -#endif // wxUSE_UNICODE - wxTextOutputStream& operator<<(wxInt16 c); - wxTextOutputStream& operator<<(wxInt32 c); - wxTextOutputStream& operator<<(wxUint16 c); - wxTextOutputStream& operator<<(wxUint32 c); - wxTextOutputStream& operator<<(double f); - wxTextOutputStream& operator<<(float f); - - wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } - -protected: - wxOutputStream &m_output; - wxEOL m_mode; - -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxTextOutputStream) -}; - -#endif - // wxUSE_STREAMS - -#endif - // _WX_DATSTREAM_H_ diff --git a/Source/3rdParty/wx/include/wx/uri.h b/Source/3rdParty/wx/include/wx/uri.h deleted file mode 100644 index 33d843c60..000000000 --- a/Source/3rdParty/wx/include/wx/uri.h +++ /dev/null @@ -1,151 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: uri.h -// Purpose: wxURI - Class for parsing URIs -// Author: Ryan Norton -// Modified By: -// Created: 07/01/2004 -// RCS-ID: $Id: uri.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Ryan Norton -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_URI_H_ -#define _WX_URI_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -// Host Type that the server component can be -enum wxURIHostType -{ - wxURI_REGNAME, // Host is a normal register name (www.mysite.com etc.) - wxURI_IPV4ADDRESS, // Host is a version 4 ip address (192.168.1.100) - wxURI_IPV6ADDRESS, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050 - wxURI_IPVFUTURE // Host is a future ip address (wxURI is unsure what kind) -}; - -// Component Flags -enum wxURIFieldType -{ - wxURI_SCHEME = 1, - wxURI_USERINFO = 2, - wxURI_SERVER = 4, - wxURI_PORT = 8, - wxURI_PATH = 16, - wxURI_QUERY = 32, - wxURI_FRAGMENT = 64 -}; - -// Miscellaneous other flags -enum wxURIFlags -{ - wxURI_STRICT = 1 -}; - - -// Generic class for parsing URIs. -// -// See RFC 3986 -class WXDLLIMPEXP_BASE wxURI : public wxObject -{ -public: - wxURI(); - wxURI(const wxString& uri); - wxURI(const wxURI& uri); - - virtual ~wxURI(); - - const wxChar* Create(const wxString& uri); - - bool HasScheme() const { return (m_fields & wxURI_SCHEME) == wxURI_SCHEME; } - bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) == wxURI_USERINFO; } - bool HasServer() const { return (m_fields & wxURI_SERVER) == wxURI_SERVER; } - bool HasPort() const { return (m_fields & wxURI_PORT) == wxURI_PORT; } - bool HasPath() const { return (m_fields & wxURI_PATH) == wxURI_PATH; } - bool HasQuery() const { return (m_fields & wxURI_QUERY) == wxURI_QUERY; } - bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) == wxURI_FRAGMENT; } - - const wxString& GetScheme() const { return m_scheme; } - const wxString& GetPath() const { return m_path; } - const wxString& GetQuery() const { return m_query; } - const wxString& GetFragment() const { return m_fragment; } - const wxString& GetPort() const { return m_port; } - const wxString& GetUserInfo() const { return m_userinfo; } - const wxString& GetServer() const { return m_server; } - const wxURIHostType& GetHostType() const { return m_hostType; } - - //Note that the following two get functions are explicitly depreciated by RFC 2396 - wxString GetUser() const; - wxString GetPassword() const; - - wxString BuildURI() const; - wxString BuildUnescapedURI() const; - - void Resolve(const wxURI& base, int flags = wxURI_STRICT); - bool IsReference() const; - - wxURI& operator = (const wxURI& uri); - wxURI& operator = (const wxString& string); - bool operator == (const wxURI& uri) const; - - static wxString Unescape (const wxString& szEscapedURI); - -protected: - wxURI& Assign(const wxURI& uri); - - void Clear(); - - const wxChar* Parse (const wxChar* uri); - const wxChar* ParseAuthority (const wxChar* uri); - const wxChar* ParseScheme (const wxChar* uri); - const wxChar* ParseUserInfo (const wxChar* uri); - const wxChar* ParseServer (const wxChar* uri); - const wxChar* ParsePort (const wxChar* uri); - const wxChar* ParsePath (const wxChar* uri, - bool bReference = false, - bool bNormalize = true); - const wxChar* ParseQuery (const wxChar* uri); - const wxChar* ParseFragment (const wxChar* uri); - - - static bool ParseH16(const wxChar*& uri); - static bool ParseIPv4address(const wxChar*& uri); - static bool ParseIPv6address(const wxChar*& uri); - static bool ParseIPvFuture(const wxChar*& uri); - - static void Normalize(wxChar* uri, bool bIgnoreLeads = false); - static void UpTree(const wxChar* uristart, const wxChar*& uri); - - static wxChar TranslateEscape(const wxChar* s); - static void Escape (wxString& s, const wxChar& c); - static bool IsEscape(const wxChar*& uri); - - static wxChar CharToHex(const wxChar& c); - - static bool IsUnreserved (const wxChar& c); - static bool IsReserved (const wxChar& c); - static bool IsGenDelim (const wxChar& c); - static bool IsSubDelim (const wxChar& c); - static bool IsHex(const wxChar& c); - static bool IsAlpha(const wxChar& c); - static bool IsDigit(const wxChar& c); - - wxString m_scheme; - wxString m_path; - wxString m_query; - wxString m_fragment; - - wxString m_userinfo; - wxString m_server; - wxString m_port; - - wxURIHostType m_hostType; - - size_t m_fields; - - DECLARE_DYNAMIC_CLASS(wxURI) -}; - -#endif // _WX_URI_H_ - diff --git a/Source/3rdParty/wx/include/wx/utils.h b/Source/3rdParty/wx/include/wx/utils.h deleted file mode 100644 index 3ceca747a..000000000 --- a/Source/3rdParty/wx/include/wx/utils.h +++ /dev/null @@ -1,746 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/utils.h -// Purpose: Miscellaneous utilities -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: utils.h 62544 2009-11-03 14:11:30Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_UTILSH__ -#define _WX_UTILSH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" -#include "wx/list.h" -#include "wx/filefn.h" -#if wxUSE_GUI - #include "wx/gdicmn.h" -#endif - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -class WXDLLIMPEXP_FWD_BASE wxArrayInt; - -// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare -// wxLongLong -#include "wx/longlong.h" - -// need for wxOperatingSystemId -#include "wx/platinfo.h" - -#ifdef __WATCOMC__ - #include -#elif defined(__X__) - #include - #include -#endif - -#include - -// ---------------------------------------------------------------------------- -// Forward declaration -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxProcess; -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowList; - -// ---------------------------------------------------------------------------- -// Macros -// ---------------------------------------------------------------------------- - -#define wxMax(a,b) (((a) > (b)) ? (a) : (b)) -#define wxMin(a,b) (((a) < (b)) ? (a) : (b)) -#define wxClip(a,b,c) (((a) < (b)) ? (b) : (((a) > (c)) ? (c) : (a))) - -// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well -// so to always use long long for its result type on all platforms which -// support it -#if wxUSE_LONGLONG - typedef wxLongLong wxMemorySize; -#else - typedef long wxMemorySize; -#endif - -// ---------------------------------------------------------------------------- -// String functions (deprecated, use wxString) -// ---------------------------------------------------------------------------- - -// Make a copy of this string using 'new' -#if WXWIN_COMPATIBILITY_2_4 -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) ); -#endif - -// A shorter way of using strcmp -#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) - -// ---------------------------------------------------------------------------- -// Miscellaneous functions -// ---------------------------------------------------------------------------- - -// Sound the bell -#if !defined __EMX__ && \ - (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__) -WXDLLIMPEXP_CORE void wxBell(); -#else -WXDLLIMPEXP_BASE void wxBell(); -#endif - -// Get OS description as a user-readable string -WXDLLIMPEXP_BASE wxString wxGetOsDescription(); - -// Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, - int *minorVsn = (int *) NULL); - -// Get platform endianness -WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); - -// Get platform architecture -WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); - -// Return a string with the current date/time -WXDLLIMPEXP_BASE wxString wxNow(); - -// Return path where wxWidgets is installed (mostly useful in Unices) -WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); -// Return path to wxWin data (/usr/share/wx/%{version}) (Unices) -WXDLLIMPEXP_BASE wxString wxGetDataDir(); - -/* - * Class to make it easier to specify platform-dependent values - * - * Examples: - * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3); - * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other")); - * - * A custom platform symbol: - * - * #define stPDA 100 - * #ifdef __WXWINCE__ - * wxPlatform::AddPlatform(stPDA); - * #endif - * - * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER); - * - */ - -class WXDLLIMPEXP_BASE wxPlatform -{ -public: - wxPlatform() { Init(); } - wxPlatform(const wxPlatform& platform) { Copy(platform); } - void operator = (const wxPlatform& platform) { Copy(platform); } - void Copy(const wxPlatform& platform); - - // Specify an optional default value - wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; } - wxPlatform(long defValue) { Init(); m_longValue = defValue; } - wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; } - wxPlatform(double defValue) { Init(); m_doubleValue = defValue; } - - static wxPlatform If(int platform, long value); - static wxPlatform IfNot(int platform, long value); - wxPlatform& ElseIf(int platform, long value); - wxPlatform& ElseIfNot(int platform, long value); - wxPlatform& Else(long value); - - static wxPlatform If(int platform, int value) { return If(platform, (long)value); } - static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); } - wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); } - wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); } - wxPlatform& Else(int value) { return Else((long) value); } - - static wxPlatform If(int platform, double value); - static wxPlatform IfNot(int platform, double value); - wxPlatform& ElseIf(int platform, double value); - wxPlatform& ElseIfNot(int platform, double value); - wxPlatform& Else(double value); - - static wxPlatform If(int platform, const wxString& value); - static wxPlatform IfNot(int platform, const wxString& value); - wxPlatform& ElseIf(int platform, const wxString& value); - wxPlatform& ElseIfNot(int platform, const wxString& value); - wxPlatform& Else(const wxString& value); - - long GetInteger() const { return m_longValue; } - const wxString& GetString() const { return m_stringValue; } - double GetDouble() const { return m_doubleValue; } - - operator int() const { return (int) GetInteger(); } - operator long() const { return GetInteger(); } - operator double() const { return GetDouble(); } - operator const wxString() const { return GetString(); } - operator const wxChar*() const { return (const wxChar*) GetString(); } - - static void AddPlatform(int platform); - static bool Is(int platform); - static void ClearPlatforms(); - -private: - - void Init() { m_longValue = 0; m_doubleValue = 0.0; } - - long m_longValue; - double m_doubleValue; - wxString m_stringValue; - static wxArrayInt* sm_customPlatforms; -}; - -/// Function for testing current platform -inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } - -#if wxUSE_GUI - -// Get the state of a key (true if pressed, false if not) -// This is generally most useful getting the state of -// the modifier or toggle keys. -WXDLLEXPORT bool wxGetKeyState(wxKeyCode key); - - -// Don't synthesize KeyUp events holding down a key and producing -// KeyDown events with autorepeat. On by default and always on -// in wxMSW. -WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag ); - - -// wxMouseState is used to hold information about button and modifier state -// and is what is returned from wxGetMouseState. -class WXDLLEXPORT wxMouseState -{ -public: - wxMouseState() - : m_x(0), m_y(0), - m_leftDown(false), m_middleDown(false), m_rightDown(false), - m_controlDown(false), m_shiftDown(false), m_altDown(false), - m_metaDown(false) - {} - - wxCoord GetX() { return m_x; } - wxCoord GetY() { return m_y; } - - bool LeftDown() { return m_leftDown; } - bool MiddleDown() { return m_middleDown; } - bool RightDown() { return m_rightDown; } - -#if wxABI_VERSION >= 20811 - bool LeftIsDown() { return m_leftDown; } - bool MiddleIsDown() { return m_middleDown; } - bool RightIsDown() { return m_rightDown; } -#endif // wx >= 2.8.11 - - bool ControlDown() { return m_controlDown; } - bool ShiftDown() { return m_shiftDown; } - bool AltDown() { return m_altDown; } - bool MetaDown() { return m_metaDown; } - bool CmdDown() - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - void SetX(wxCoord x) { m_x = x; } - void SetY(wxCoord y) { m_y = y; } - - void SetLeftDown(bool down) { m_leftDown = down; } - void SetMiddleDown(bool down) { m_middleDown = down; } - void SetRightDown(bool down) { m_rightDown = down; } - - void SetControlDown(bool down) { m_controlDown = down; } - void SetShiftDown(bool down) { m_shiftDown = down; } - void SetAltDown(bool down) { m_altDown = down; } - void SetMetaDown(bool down) { m_metaDown = down; } - -private: - wxCoord m_x; - wxCoord m_y; - - bool m_leftDown : 1; - bool m_middleDown : 1; - bool m_rightDown : 1; - - bool m_controlDown : 1; - bool m_shiftDown : 1; - bool m_altDown : 1; - bool m_metaDown : 1; -}; - - -// Returns the current state of the mouse position, buttons and modifers -WXDLLEXPORT wxMouseState wxGetMouseState(); - - -// ---------------------------------------------------------------------------- -// Window ID management -// ---------------------------------------------------------------------------- - -// Generate a unique ID -WXDLLEXPORT long wxNewId(); - -// Ensure subsequent IDs don't clash with this one -WXDLLEXPORT void wxRegisterId(long id); - -// Return the current ID -WXDLLEXPORT long wxGetCurrentId(); - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// Various conversions -// ---------------------------------------------------------------------------- - -// these functions are deprecated, use wxString methods instead! -#if WXWIN_COMPATIBILITY_2_4 - -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr; -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr; - -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) ); - -#endif // WXWIN_COMPATIBILITY_2_4 - -// Convert 2-digit hex number to decimal -WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); - -// Convert decimal integer to 2-character hex string -WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf); -WXDLLIMPEXP_BASE wxString wxDecToHex(int dec); - -// ---------------------------------------------------------------------------- -// Process management -// ---------------------------------------------------------------------------- - -// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must* -// be 0 and 1, don't change! - -enum -{ - // execute the process asynchronously - wxEXEC_ASYNC = 0, - - // execute it synchronously, i.e. wait until it finishes - wxEXEC_SYNC = 1, - - // under Windows, don't hide the child even if it's IO is redirected (this - // is done by default) - wxEXEC_NOHIDE = 2, - - // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill - // kills all children as well as pid - wxEXEC_MAKE_GROUP_LEADER = 4, - - // by default synchronous execution disables all program windows to avoid - // that the user interacts with the program while the child process is - // running, you can use this flag to prevent this from happening - wxEXEC_NODISABLE = 8 -}; - -// Execute another program. -// -// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the -// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on -// failure and the PID of the launched process if ok. -WXDLLIMPEXP_BASE long wxExecute(wxChar **argv, int flags = wxEXEC_ASYNC, - wxProcess *process = (wxProcess *) NULL); -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, - wxProcess *process = (wxProcess *) NULL); - -// execute the command capturing its output into an array line by line, this is -// always synchronous -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, - wxArrayString& output, - int flags = 0); - -// also capture stderr (also synchronous) -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, - wxArrayString& output, - wxArrayString& error, - int flags = 0); - -#if defined(__WXMSW__) && wxUSE_IPC -// ask a DDE server to execute the DDE request with given parameters -WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, - const wxString& ddeTopic, - const wxString& ddeCommand); -#endif // __WXMSW__ && wxUSE_IPC - -enum wxSignal -{ - wxSIGNONE = 0, // verify if the process exists under Unix - wxSIGHUP, - wxSIGINT, - wxSIGQUIT, - wxSIGILL, - wxSIGTRAP, - wxSIGABRT, - wxSIGIOT = wxSIGABRT, // another name - wxSIGEMT, - wxSIGFPE, - wxSIGKILL, - wxSIGBUS, - wxSIGSEGV, - wxSIGSYS, - wxSIGPIPE, - wxSIGALRM, - wxSIGTERM - - // further signals are different in meaning between different Unix systems -}; - -enum wxKillError -{ - wxKILL_OK, // no error - wxKILL_BAD_SIGNAL, // no such signal - wxKILL_ACCESS_DENIED, // permission denied - wxKILL_NO_PROCESS, // no such process - wxKILL_ERROR // another, unspecified error -}; - -enum wxKillFlags -{ - wxKILL_NOCHILDREN = 0, // don't kill children - wxKILL_CHILDREN = 1 // kill children -}; - -enum wxShutdownFlags -{ - wxSHUTDOWN_POWEROFF, // power off the computer - wxSHUTDOWN_REBOOT // shutdown and reboot -}; - -// Shutdown or reboot the PC -WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags); - -// send the given signal to the process (only NONE and KILL are supported under -// Windows, all others mean TERM), return 0 if ok and -1 on error -// -// return detailed error in rc if not NULL -WXDLLIMPEXP_BASE int wxKill(long pid, - wxSignal sig = wxSIGTERM, - wxKillError *rc = NULL, - int flags = wxKILL_NOCHILDREN); - -// Execute a command in an interactive shell window (always synchronously) -// If no command then just the shell -WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString); - -// As wxShell(), but must give a (non interactive) command and its output will -// be returned in output array -WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output); - -// Sleep for nSecs seconds -WXDLLIMPEXP_BASE void wxSleep(int nSecs); - -// Sleep for a given amount of milliseconds -WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); - -// Sleep for a given amount of microseconds -WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); - -// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep -wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); - -// Get the process id of the current process -WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); - -// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) -WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory(); - -#if wxUSE_ON_FATAL_EXCEPTION - -// should wxApp::OnFatalException() be called? -WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); - -#endif // wxUSE_ON_FATAL_EXCEPTION - -// flags for wxLaunchDefaultBrowser -enum -{ - wxBROWSER_NEW_WINDOW = 1 -}; - -// Launch url in the user's default internet browser -WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); - -// ---------------------------------------------------------------------------- -// Environment variables -// ---------------------------------------------------------------------------- - -// returns true if variable exists (value may be NULL if you just want to check -// for this) -WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); - -// set the env var name to the given value, return true on success -WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value); - -// remove the env var from environment -inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); } - -// ---------------------------------------------------------------------------- -// Network and username functions. -// ---------------------------------------------------------------------------- - -// NB: "char *" functions are deprecated, use wxString ones! - -// Get eMail address -WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetEmailAddress(); - -// Get hostname. -WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetHostName(); - -// Get FQDN -WXDLLIMPEXP_BASE wxString wxGetFullHostName(); -WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize); - -// Get user ID e.g. jacs (this is known as login name under Unix) -WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetUserId(); - -// Get user name e.g. Julian Smart -WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetUserName(); - -// Get current Home dir and copy to dest (returns pstr->c_str()) -WXDLLIMPEXP_BASE wxString wxGetHomeDir(); -WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); - -// Get the user's home dir (caller must copy --- volatile) -// returns NULL is no HOME dir is known -#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WINE__) -WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString); -#else -WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString); -#endif - -#if wxUSE_LONGLONG - typedef wxLongLong wxDiskspaceSize_t; -#else - typedef long wxDiskspaceSize_t; -#endif - -// get number of total/free bytes on the disk where path belongs -WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, - wxDiskspaceSize_t *pTotal = NULL, - wxDiskspaceSize_t *pFree = NULL); - -#if wxUSE_GUI // GUI only things from now on - -// ---------------------------------------------------------------------------- -// Menu accelerators related things -// ---------------------------------------------------------------------------- - -// flags for wxStripMenuCodes -enum -{ - // strip '&' characters - wxStrip_Mnemonics = 1, - - // strip everything after '\t' - wxStrip_Accel = 2, - - // strip everything (this is the default) - wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel -}; - -// strip mnemonics and/or accelerators from the label -WXDLLEXPORT wxString -wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); - -#if WXWIN_COMPATIBILITY_2_6 -// obsolete and deprecated version, do not use, use the above overload instead -wxDEPRECATED( - WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) -); - -#if wxUSE_ACCEL -class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; - -// use wxAcceleratorEntry::Create() or FromString() methods instead -wxDEPRECATED( - WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) -); -#endif // wxUSE_ACCEL - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// Window search -// ---------------------------------------------------------------------------- - -// Returns menu item id or wxNOT_FOUND if none. -WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); - -// Find the wxWindow at the given point. wxGenericFindWindowAtPoint -// is always present but may be less reliable than a native version. -WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); -WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt); - -// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead -// -// Find the window/widget with the given title or label. -// Pass a parent to begin the search from, or NULL to look through -// all windows. -WXDLLEXPORT wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); - -// NB: this function is obsolete, use wxWindow::FindWindowByName() instead -// -// Find window by name, and if that fails, by label. -WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); - -// ---------------------------------------------------------------------------- -// Message/event queue helpers -// ---------------------------------------------------------------------------- - -// Yield to other apps/messages and disable user input -WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); - -// Enable or disable input to all top level windows -WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = true); - -// Check whether this window wants to process messages, e.g. Stop button -// in long calculations. -WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd); - -// Consume all events until no more left -WXDLLEXPORT void wxFlushEvents(); - -// a class which disables all windows (except, may be, thegiven one) in its -// ctor and enables them back in its dtor -class WXDLLEXPORT wxWindowDisabler -{ -public: - wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); - ~wxWindowDisabler(); - -private: - wxWindowList *m_winDisabled; - - DECLARE_NO_COPY_CLASS(wxWindowDisabler) -}; - -// ---------------------------------------------------------------------------- -// Cursors -// ---------------------------------------------------------------------------- - -// Set the cursor to the busy cursor for all windows -WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR); - -// Restore cursor to normal -WXDLLEXPORT void wxEndBusyCursor(); - -// true if we're between the above two calls -WXDLLEXPORT bool wxIsBusy(); - -// Convenience class so we can just create a wxBusyCursor object on the stack -class WXDLLEXPORT wxBusyCursor -{ -public: - wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR) - { wxBeginBusyCursor(cursor); } - ~wxBusyCursor() - { wxEndBusyCursor(); } - - // FIXME: These two methods are currently only implemented (and needed?) - // in wxGTK. BusyCursor handling should probably be moved to - // common code since the wxGTK and wxMSW implementations are very - // similar except for wxMSW using HCURSOR directly instead of - // wxCursor.. -- RL. - static const wxCursor &GetStoredCursor(); - static const wxCursor GetBusyCursor(); -}; - - -// ---------------------------------------------------------------------------- -// Reading and writing resources (eg WIN.INI, .Xdefaults) -// ---------------------------------------------------------------------------- - -#if wxUSE_RESOURCES -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString); - -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString); -#endif // wxUSE_RESOURCES - -void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); - -// MSW only: get user-defined resource from the .res file. -// Returns NULL or newly-allocated memory, so use delete[] to clean up. -#ifdef __WXMSW__ - extern WXDLLEXPORT const wxChar* wxUserResourceStr; - WXDLLEXPORT wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); -#endif // MSW - -// ---------------------------------------------------------------------------- -// Display and colorss (X only) -// ---------------------------------------------------------------------------- - -#ifdef __WXGTK__ - void *wxGetDisplay(); -#endif - -#ifdef __X__ - WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay(); - WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name); - WXDLLIMPEXP_CORE wxString wxGetDisplayName(); -#endif // X or GTK+ - -#ifdef __X__ - -#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++ - // The resulting warnings are switched off here -#pragma message disable nosimpint -#endif -// #include -#ifdef __VMS__ -#pragma message enable nosimpint -#endif - -#endif //__X__ - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxYield(): these functions are obsolete, please use wxApp methods instead! -// ---------------------------------------------------------------------------- - -// avoid redeclaring this function here if it had been already declated by -// wx/app.h, this results in warnings from g++ with -Wredundant-decls -#ifndef wx_YIELD_DECLARED -#define wx_YIELD_DECLARED - -// Yield to other apps/messages -WXDLLIMPEXP_BASE bool wxYield(); - -#endif // wx_YIELD_DECLARED - -// Like wxYield, but fails silently if the yield is recursive. -WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); - -// ---------------------------------------------------------------------------- -// Error message functions used by wxWidgets (deprecated, use wxLog) -// ---------------------------------------------------------------------------- - -#endif - // _WX_UTILSH__ diff --git a/Source/3rdParty/wx/include/wx/valgen.h b/Source/3rdParty/wx/include/wx/valgen.h deleted file mode 100644 index fd39c7e7d..000000000 --- a/Source/3rdParty/wx/include/wx/valgen.h +++ /dev/null @@ -1,69 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: valgen.h -// Purpose: wxGenericValidator class -// Author: Kevin Smith -// Modified by: -// Created: Jan 22 1999 -// RCS-ID: -// Copyright: (c) 1999 Julian Smart (assigned from Kevin) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALGENH__ -#define _WX_VALGENH__ - -#include "wx/validate.h" - -#if wxUSE_VALIDATORS - -class WXDLLEXPORT wxGenericValidator: public wxValidator -{ -DECLARE_CLASS(wxGenericValidator) -public: - wxGenericValidator(bool* val); - wxGenericValidator(int* val); - wxGenericValidator(wxString* val); - wxGenericValidator(wxArrayInt* val); - wxGenericValidator(const wxGenericValidator& copyFrom); - - virtual ~wxGenericValidator(){} - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxGenericValidator(*this); } - bool Copy(const wxGenericValidator& val); - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } - - // Called to transfer data to the window - virtual bool TransferToWindow(); - - // Called to transfer data to the window - virtual bool TransferFromWindow(); - -protected: - void Initialize(); - - bool* m_pBool; - int* m_pInt; - wxString* m_pString; - wxArrayInt* m_pArrayInt; - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxGenericValidator) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxGenericValidator& operator=(const wxGenericValidator&); -}; - -#endif - // wxUSE_VALIDATORS - -#endif - // _WX_VALGENH__ diff --git a/Source/3rdParty/wx/include/wx/validate.h b/Source/3rdParty/wx/include/wx/validate.h deleted file mode 100644 index ea8c80897..000000000 --- a/Source/3rdParty/wx/include/wx/validate.h +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/validate.h -// Purpose: wxValidator class -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: validate.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALIDATE_H_ -#define _WX_VALIDATE_H_ - -#include "wx/defs.h" - -#if wxUSE_VALIDATORS - -#include "wx/event.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -/* - A validator has up to three purposes: - - 1) To validate the data in the window that's associated - with the validator. - 2) To transfer data to and from the window. - 3) To filter input, using its role as a wxEvtHandler - to intercept e.g. OnChar. - - Note that wxValidator and derived classes use reference counting. -*/ - -class WXDLLEXPORT wxValidator : public wxEvtHandler -{ -public: - wxValidator(); - virtual ~wxValidator(); - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const - { return (wxValidator *)NULL; } - bool Copy(const wxValidator& val) - { m_validatorWindow = val.m_validatorWindow; return true; } - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; } - - // Called to transfer data to the window - virtual bool TransferToWindow() { return false; } - - // Called to transfer data from the window - virtual bool TransferFromWindow() { return false; } - - // accessors - wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; } - void SetWindow(wxWindowBase *win) { m_validatorWindow = win; } - - // validators beep by default if invalid key is pressed, these functions - // allow to change it - static bool IsSilent() { return ms_isSilent; } - static void SetBellOnError(bool doIt = true) { ms_isSilent = doIt; } - -protected: - wxWindowBase *m_validatorWindow; - -private: - static bool ms_isSilent; - - DECLARE_DYNAMIC_CLASS(wxValidator) - DECLARE_NO_COPY_CLASS(wxValidator) -}; - -extern WXDLLEXPORT_DATA(const wxValidator) wxDefaultValidator; - -#define wxVALIDATOR_PARAM(val) val - -#else // !wxUSE_VALIDATORS - // wxWidgets is compiled without support for wxValidator, but we still - // want to be able to pass wxDefaultValidator to the functions which take - // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" - // everywhere - class WXDLLEXPORT wxValidator; - #define wxDefaultValidator (*((wxValidator *)NULL)) - - // this macro allows to avoid warnings about unused parameters when - // wxUSE_VALIDATORS == 0 - #define wxVALIDATOR_PARAM(val) -#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS - -#endif // _WX_VALIDATE_H_ - diff --git a/Source/3rdParty/wx/include/wx/valtext.h b/Source/3rdParty/wx/include/wx/valtext.h deleted file mode 100644 index 7f2e1e693..000000000 --- a/Source/3rdParty/wx/include/wx/valtext.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: valtext.h -// Purpose: wxTextValidator class -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: valtext.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALTEXTH__ -#define _WX_VALTEXTH__ - -#include "wx/defs.h" - -#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL - -#include "wx/textctrl.h" -#include "wx/validate.h" - -#define wxFILTER_NONE 0x0000 -#define wxFILTER_ASCII 0x0001 -#define wxFILTER_ALPHA 0x0002 -#define wxFILTER_ALPHANUMERIC 0x0004 -#define wxFILTER_NUMERIC 0x0008 -#define wxFILTER_INCLUDE_LIST 0x0010 -#define wxFILTER_EXCLUDE_LIST 0x0020 -#define wxFILTER_INCLUDE_CHAR_LIST 0x0040 -#define wxFILTER_EXCLUDE_CHAR_LIST 0x0080 - -class WXDLLEXPORT wxTextValidator: public wxValidator -{ -DECLARE_DYNAMIC_CLASS(wxTextValidator) -public: - - wxTextValidator(long style = wxFILTER_NONE, wxString *val = 0); - wxTextValidator(const wxTextValidator& val); - - virtual ~wxTextValidator(){} - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxTextValidator(*this); } - bool Copy(const wxTextValidator& val); - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow *parent); - - // Called to transfer data to the window - virtual bool TransferToWindow(); - - // Called to transfer data from the window - virtual bool TransferFromWindow(); - - // ACCESSORS - inline long GetStyle() const { return m_validatorStyle; } - inline void SetStyle(long style) { m_validatorStyle = style; } - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void SetIncludeList(const wxStringList& list) ); - wxDEPRECATED( wxStringList& GetIncludeList() ); - - wxDEPRECATED( void SetExcludeList(const wxStringList& list) ); - wxDEPRECATED( wxStringList& GetExcludeList() ); - - wxDEPRECATED( bool IsInCharIncludeList(const wxString& val) ); - wxDEPRECATED( bool IsNotInCharExcludeList(const wxString& val) ); -#endif - - void SetIncludes(const wxArrayString& includes) { m_includes = includes; } - inline wxArrayString& GetIncludes() { return m_includes; } - - void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; } - inline wxArrayString& GetExcludes() { return m_excludes; } - - bool IsInCharIncludes(const wxString& val); - bool IsNotInCharExcludes(const wxString& val); - - // Filter keystrokes - void OnChar(wxKeyEvent& event); - - -DECLARE_EVENT_TABLE() - -protected: - long m_validatorStyle; - wxString * m_stringValue; -#if WXWIN_COMPATIBILITY_2_4 - wxStringList m_includeList; - wxStringList m_excludeList; -#endif - wxArrayString m_includes; - wxArrayString m_excludes; - - bool CheckValidator() const - { - wxCHECK_MSG( m_validatorWindow, false, - wxT("No window associated with validator") ); - wxCHECK_MSG( m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), false, - wxT("wxTextValidator is only for wxTextCtrl's") ); - - return true; - } - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxTextValidator) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxTextValidator& operator=(const wxTextValidator&); -}; - -#endif - // wxUSE_VALIDATORS && wxUSE_TEXTCTRL - -#endif - // _WX_VALTEXTH__ diff --git a/Source/3rdParty/wx/include/wx/variant.h b/Source/3rdParty/wx/include/wx/variant.h deleted file mode 100644 index bccf32e88..000000000 --- a/Source/3rdParty/wx/include/wx/variant.h +++ /dev/null @@ -1,423 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/variant.h -// Purpose: wxVariant class, container for any type -// Author: Julian Smart -// Modified by: -// Created: 10/09/98 -// RCS-ID: $Id: variant.h 42997 2006-11-03 21:37:08Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VARIANT_H_ -#define _WX_VARIANT_H_ - -#include "wx/defs.h" - -#if wxUSE_VARIANT - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/arrstr.h" -#include "wx/list.h" -#include "wx/cpp.h" - -#if wxUSE_DATETIME - #include "wx/datetime.h" -#endif // wxUSE_DATETIME - -#if wxUSE_ODBC - #include "wx/db.h" // will #include sqltypes.h -#endif //ODBC - -#include "wx/iosfwrap.h" - -/* - * wxVariantData stores the actual data in a wxVariant object, - * to allow it to store any type of data. - * Derive from this to provide custom data handling. - * - * NB: To prevent addition of extra vtbl pointer to wxVariantData, - * we don't multiple-inherit from wxObjectRefData. Instead, - * we simply replicate the wxObject ref-counting scheme. - * - * NB: When you construct a wxVariantData, it will have refcount - * of one. Refcount will not be further increased when - * it is passed to wxVariant. This simulates old common - * scenario where wxVariant took ownership of wxVariantData - * passed to it. - * If you create wxVariantData for other reasons than passing - * it to wxVariant, technically you are not required to call - * DecRef() before deleting it. - * - * TODO: in order to replace wxPropertyValue, we would need - * to consider adding constructors that take pointers to C++ variables, - * or removing that functionality from the wxProperty library. - * Essentially wxPropertyValue takes on some of the wxValidator functionality - * by storing pointers and not just actual values, allowing update of C++ data - * to be handled automatically. Perhaps there's another way of doing this without - * overloading wxVariant with unnecessary functionality. - */ - -class WXDLLIMPEXP_BASE wxVariantData: public wxObject -{ - friend class wxVariant; -public: - wxVariantData() - : wxObject(), m_count(1) - { } - - // Override these to provide common functionality - virtual bool Eq(wxVariantData& data) const = 0; - -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; } -#endif - virtual bool Write(wxString& WXUNUSED(str)) const { return false; } -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } -#endif - virtual bool Read(wxString& WXUNUSED(str)) { return false; } - // What type is it? Return a string name. - virtual wxString GetType() const = 0; - // If it based on wxObject return the ClassInfo. - virtual wxClassInfo* GetValueClassInfo() { return NULL; } - - void IncRef() { m_count++; } - void DecRef() - { - if ( --m_count == 0 ) - delete this; - } - - int GetRefCount() const { return m_count; } - -protected: - // Protected dtor should make some incompatible code - // break more louder. That is, they should do data->DecRef() - // instead of delete data. - virtual ~wxVariantData() { } - -private: - int m_count; - -private: - DECLARE_ABSTRACT_CLASS(wxVariantData) -}; - -/* - * wxVariant can store any kind of data, but has some basic types - * built in. - */ - -class WXDLLIMPEXP_BASE wxVariant: public wxObject -{ -public: - wxVariant(); - - wxVariant(const wxVariant& variant); - wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); - virtual ~wxVariant(); - - // generic assignment - void operator= (const wxVariant& variant); - - // Assignment using data, e.g. - // myVariant = new wxStringVariantData("hello"); - void operator= (wxVariantData* variantData); - - bool operator== (const wxVariant& variant) const; - bool operator!= (const wxVariant& variant) const; - - // Sets/gets name - inline void SetName(const wxString& name) { m_name = name; } - inline const wxString& GetName() const { return m_name; } - - // Tests whether there is data - bool IsNull() const; - - // For compatibility with wxWidgets <= 2.6, this doesn't increase - // reference count. - wxVariantData* GetData() const { return m_data; } - void SetData(wxVariantData* data) ; - - // make a 'clone' of the object - void Ref(const wxVariant& clone); - - // destroy a reference - void UnRef(); - - // Make NULL (i.e. delete the data) - void MakeNull(); - - // Delete data and name - void Clear(); - - // Returns a string representing the type of the variant, - // e.g. "string", "bool", "stringlist", "list", "double", "long" - wxString GetType() const; - - bool IsType(const wxString& type) const; - bool IsValueKindOf(const wxClassInfo* type) const; - - // write contents to a string (e.g. for debugging) - wxString MakeString() const; - - // double - wxVariant(double val, const wxString& name = wxEmptyString); - bool operator== (double value) const; - bool operator!= (double value) const; - void operator= (double value) ; - inline operator double () const { return GetDouble(); } - inline double GetReal() const { return GetDouble(); } - double GetDouble() const; - - // long - wxVariant(long val, const wxString& name = wxEmptyString); - wxVariant(int val, const wxString& name = wxEmptyString); - wxVariant(short val, const wxString& name = wxEmptyString); - bool operator== (long value) const; - bool operator!= (long value) const; - void operator= (long value) ; - inline operator long () const { return GetLong(); } - inline long GetInteger() const { return GetLong(); } - long GetLong() const; - - // bool -#ifdef HAVE_BOOL - wxVariant(bool val, const wxString& name = wxEmptyString); - bool operator== (bool value) const; - bool operator!= (bool value) const; - void operator= (bool value) ; - inline operator bool () const { return GetBool(); } - bool GetBool() const ; -#endif - - // wxDateTime -#if wxUSE_DATETIME - wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString); -#if wxUSE_ODBC - wxVariant(const DATE_STRUCT* valptr, const wxString& name = wxEmptyString); - wxVariant(const TIME_STRUCT* valptr, const wxString& name = wxEmptyString); - wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name = wxEmptyString); -#endif - bool operator== (const wxDateTime& value) const; - bool operator!= (const wxDateTime& value) const; - void operator= (const wxDateTime& value) ; -#if wxUSE_ODBC - void operator= (const DATE_STRUCT* value) ; - void operator= (const TIME_STRUCT* value) ; - void operator= (const TIMESTAMP_STRUCT* value) ; -#endif - inline operator wxDateTime () const { return GetDateTime(); } - wxDateTime GetDateTime() const; -#endif - - // wxString - wxVariant(const wxString& val, const wxString& name = wxEmptyString); - wxVariant(const wxChar* val, const wxString& name = wxEmptyString); // Necessary or VC++ assumes bool! - bool operator== (const wxString& value) const; - bool operator!= (const wxString& value) const; - void operator= (const wxString& value) ; - void operator= (const wxChar* value) ; // Necessary or VC++ assumes bool! - inline operator wxString () const { return MakeString(); } - wxString GetString() const; - - // wxChar - wxVariant(wxChar val, const wxString& name = wxEmptyString); - bool operator== (wxChar value) const; - bool operator!= (wxChar value) const; - void operator= (wxChar value) ; - inline operator wxChar () const { return GetChar(); } - wxChar GetChar() const ; - - // wxArrayString - wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString); - bool operator== (const wxArrayString& value) const; - bool operator!= (const wxArrayString& value) const; - void operator= (const wxArrayString& value); - inline operator wxArrayString () const { return GetArrayString(); } - wxArrayString GetArrayString() const; - - // void* - wxVariant(void* ptr, const wxString& name = wxEmptyString); - bool operator== (void* value) const; - bool operator!= (void* value) const; - void operator= (void* value); - inline operator void* () const { return GetVoidPtr(); } - void* GetVoidPtr() const; - - // wxObject* - wxVariant(wxObject* ptr, const wxString& name = wxEmptyString); - bool operator== (wxObject* value) const; - bool operator!= (wxObject* value) const; - void operator= (wxObject* value); - wxObject* GetWxObjectPtr() const; - - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxVariant(const wxStringList& val, const wxString& name = wxEmptyString) ); - wxDEPRECATED( bool operator== (const wxStringList& value) const ); - wxDEPRECATED( bool operator!= (const wxStringList& value) const ); - wxDEPRECATED( void operator= (const wxStringList& value) ); - wxDEPRECATED( wxStringList& GetStringList() const ); -#endif - - // ------------------------------ - // list operations - // ------------------------------ - - wxVariant(const wxList& val, const wxString& name = wxEmptyString); // List of variants - bool operator== (const wxList& value) const; - bool operator!= (const wxList& value) const; - void operator= (const wxList& value) ; - // Treat a list variant as an array - wxVariant operator[] (size_t idx) const; - wxVariant& operator[] (size_t idx) ; - wxList& GetList() const ; - - // Return the number of elements in a list - size_t GetCount() const; - - // Make empty list - void NullList(); - - // Append to list - void Append(const wxVariant& value); - - // Insert at front of list - void Insert(const wxVariant& value); - - // Returns true if the variant is a member of the list - bool Member(const wxVariant& value) const; - - // Deletes the nth element of the list - bool Delete(size_t item); - - // Clear list - void ClearList(); - -public: - // Type conversion - bool Convert(long* value) const; - bool Convert(bool* value) const; - bool Convert(double* value) const; - bool Convert(wxString* value) const; - bool Convert(wxChar* value) const; -#if wxUSE_DATETIME - bool Convert(wxDateTime* value) const; -#endif // wxUSE_DATETIME - -// Attributes -protected: - wxVariantData* m_data; - wxString m_name; - -private: - DECLARE_DYNAMIC_CLASS(wxVariant) -}; - -#define DECLARE_VARIANT_OBJECT(classname) \ - DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) - -#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ -expdecl classname& operator << ( classname &object, const wxVariant &variant ); \ -expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); - -#define IMPLEMENT_VARIANT_OBJECT(classname) \ - IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) - -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \ -class classname##VariantData: public wxVariantData \ -{ \ -public:\ - classname##VariantData() {} \ - classname##VariantData( const classname &value ) { m_value = value; } \ -\ - classname &GetValue() { return m_value; } \ -\ - virtual bool Eq(wxVariantData& data) const; \ -\ - virtual wxString GetType() const; \ - virtual wxClassInfo* GetValueClassInfo(); \ -\ -protected:\ - classname m_value; \ -\ -private: \ - DECLARE_CLASS(classname##VariantData) \ -};\ -\ -IMPLEMENT_CLASS(classname##VariantData, wxVariantData)\ -\ -wxString classname##VariantData::GetType() const\ -{\ - return m_value.GetClassInfo()->GetClassName();\ -}\ -\ -wxClassInfo* classname##VariantData::GetValueClassInfo()\ -{\ - return m_value.GetClassInfo();\ -}\ -\ -expdecl classname& operator << ( classname &value, const wxVariant &variant )\ -{\ - wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\ - \ - classname##VariantData *data = (classname##VariantData*) variant.GetData();\ - value = data->GetValue();\ - return value;\ -}\ -\ -expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ -{\ - classname##VariantData *data = new classname##VariantData( value );\ - variant.SetData( data );\ - return variant;\ -} - -// implements a wxVariantData-derived class using for the Eq() method the -// operator== which must have been provided by "classname" -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ -IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ -\ -bool classname##VariantData::Eq(wxVariantData& data) const \ -{\ - wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ -\ - classname##VariantData & otherData = (classname##VariantData &) data;\ -\ - return otherData.m_value == m_value;\ -}\ - - -// implements a wxVariantData-derived class using for the Eq() method a shallow -// comparison (through wxObject::IsSameAs function) -#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \ - IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE) -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \ -IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ -\ -bool classname##VariantData::Eq(wxVariantData& data) const \ -{\ - wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ -\ - classname##VariantData & otherData = (classname##VariantData &) data;\ -\ - return (otherData.m_value.IsSameAs(m_value));\ -}\ - - -// Since we want type safety wxVariant we need to fetch and dynamic_cast -// in a seemingly safe way so the compiler can check, so we define -// a dynamic_cast /wxDynamicCast analogue. - -#define wxGetVariantCast(var,classname) \ - ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ - var.GetWxObjectPtr() : NULL)); - -extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; - -#endif // wxUSE_VARIANT - -#endif // _WX_VARIANT_H_ diff --git a/Source/3rdParty/wx/include/wx/vector.h b/Source/3rdParty/wx/include/wx/vector.h deleted file mode 100644 index b05d779ec..000000000 --- a/Source/3rdParty/wx/include/wx/vector.h +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vector.h -// Purpose: STL vector clone -// Author: Lindsay Mathieson -// Modified by: -// Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VECTOR_H_ -#define _WX_VECTOR_H_ - -#include "wx/defs.h" - -class WXDLLIMPEXP_BASE wxVectorBase -{ -public: - typedef size_t size_type; -private: - size_type m_allocsize; - size_type m_size, - m_capacity; - void **m_objects; - -protected: - bool Alloc(size_type sz) - { - // work in multiples of m_allocsize; - sz = (sz / m_allocsize + 1) * m_allocsize; - if (sz <= m_capacity) - return true; - - // try to realloc - void *mem = realloc(m_objects, sizeof(void *) * sz); - if (! mem) - return false; // failed - // success - m_objects = (void **) mem; - m_capacity = sz; - return true; - } - - // untyped destructor of elements - must be overriden - virtual void Free(void *) = 0; - // untyped copy constructor of elements - must be overriden - virtual void *Copy(const void *) const = 0; - - const void *GetItem(size_type idx) const - { - wxASSERT(idx < m_size); - return m_objects[idx]; - } - - void Append(void *obj) - { - wxASSERT(m_size < m_capacity); - m_objects[m_size] = obj; - m_size++; - } - - void RemoveAt(size_type idx) - { - wxASSERT(idx < m_size); - Free(m_objects[idx]); - if (idx < m_size - 1) - memcpy( - m_objects + idx, - m_objects + idx + 1, - ( m_size - idx - 1 ) * sizeof(void*) ); - m_size--; - } - - bool copy(const wxVectorBase& vb) - { - clear(); - if (! Alloc(vb.size())) - return false; - - for (size_type i = 0; i < vb.size(); i++) - { - void *o = vb.Copy(vb.GetItem(i)); - if (! o) - return false; - Append(o); - } - - return true; - } - -public: - wxVectorBase() : m_allocsize(16), m_size(0), m_capacity(0), m_objects(0) {} - virtual ~wxVectorBase() {} // calm down GCC - - void clear() - { - for (size_type i = 0; i < size(); i++) - Free(m_objects[i]); - free(m_objects); - m_objects = 0; - m_size = m_capacity = 0; - } - - void reserve(size_type n) - { - if ( !Alloc(n) ) - { - wxFAIL_MSG( wxT("out of memory in wxVector::reserve()") ); - } - } - - size_type size() const - { - return m_size; - } - - size_type capacity() const - { - return m_capacity; - } - - bool empty() const - { - return size() == 0; - } - - wxVectorBase& operator = (const wxVectorBase& vb) - { - wxCHECK(copy(vb), *this); - return *this; - } -}; - -#define WX_DECLARE_VECTORBASE(obj, cls)\ -protected:\ - virtual void Free(void *o)\ - {\ - delete (obj *) o;\ - }\ - virtual void *Copy(const void *o) const\ - {\ - return new obj(*(obj *) o);\ - }\ -public:\ - cls() {}\ - cls(const cls& c) : wxVectorBase()\ - {\ - wxCHECK2(copy(c), return);\ - }\ - ~cls()\ - {\ - clear();\ - } - -#define _WX_DECLARE_VECTOR(obj, cls, exp)\ -class exp cls : public wxVectorBase\ -{\ - WX_DECLARE_VECTORBASE(obj, cls)\ -public:\ - void push_back(const obj& o)\ - {\ - wxCHECK2(Alloc(size() + 1), return);\ - Append(new obj(o));\ - }\ - void pop_back()\ - {\ - RemoveAt(size() - 1);\ - }\ - const obj& at(size_type idx) const\ - {\ - return *(obj *) GetItem(idx);\ - }\ - obj& at(size_type idx)\ - {\ - return *(obj *) GetItem(idx);\ - }\ - const obj& operator[](size_type idx) const\ - {\ - return at(idx);\ - }\ - obj& operator[](size_type idx)\ - {\ - return at(idx);\ - }\ - const obj& front() const\ - {\ - return at(0);\ - }\ - obj& front()\ - {\ - return at(0);\ - }\ - const obj& back() const\ - {\ - return at(size() - 1);\ - }\ - obj& back()\ - {\ - return at(size() - 1);\ - }\ - size_type erase(size_type idx)\ - {\ - RemoveAt(idx);\ - return idx;\ - }\ -} - -#define WX_DECLARE_VECTOR(obj, cls) \ - _WX_DECLARE_VECTOR(obj, cls, WXDLLEXPORT) - -#endif // _WX_VECTOR_H_ - diff --git a/Source/3rdParty/wx/include/wx/version.h b/Source/3rdParty/wx/include/wx/version.h deleted file mode 100644 index 11cf33112..000000000 --- a/Source/3rdParty/wx/include/wx/version.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Name: wx/version.h - * Purpose: wxWidgets version numbers - * Author: Julian Smart - * Modified by: Ryan Norton (Converted to C) - * Created: 29/01/98 - * RCS-ID: $Id: version.h 66910 2011-02-16 20:53:53Z JS $ - * Copyright: (c) 1998 Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_VERSION_H_ -#define _WX_VERSION_H_ - -#include "wx/cpp.h" /* for wxSTRINGIZE */ - -/* the constants below must be changed with each new version */ -/* ---------------------------------------------------------------------------- */ - -/* - Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in - build/bakefiles/version.bkl and regenerate the makefiles when you change - this! - */ - -/* NB: this file is parsed by automatic tools so don't change its format! */ -#define wxMAJOR_VERSION 2 -#define wxMINOR_VERSION 8 -#define wxRELEASE_NUMBER 12 -#define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING wxT("wxWidgets 2.8.12") - -/* nothing to update below this line when updating the version */ -/* ---------------------------------------------------------------------------- */ - -/* Users can pre-define wxABI_VERSION to a lower value in their - * makefile/project settings to compile code that will be binary compatible - * with earlier versions of the ABI within the same minor version (between - * minor versions binary compatibility breaks anyway). The default is the - * version of wxWidgets being used. A single number with two decimal digits - * for each component, e.g. 20601 for 2.6.1 */ -#ifndef wxABI_VERSION -#define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 ) -#endif - -/* helpers for wxVERSION_NUM_XXX */ -#define wxMAKE_VERSION_STRING(x, y, z) \ - wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z) -#define wxMAKE_VERSION_DOT_STRING(x, y, z) \ - wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z) - -#define wxMAKE_VERSION_STRING_T(x, y, z) \ - wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z) -#define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \ - wxSTRINGIZE_T(x) wxT(".") wxSTRINGIZE_T(y) wxT(".") wxSTRINGIZE_T(z) - -/* these are used by src/msw/version.rc and should always be ASCII, not Unicode */ -#define wxVERSION_NUM_STRING \ - wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) -#define wxVERSION_NUM_DOT_STRING \ - wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) - -/* those are Unicode-friendly */ -#define wxVERSION_NUM_STRING_T \ - wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) -#define wxVERSION_NUM_DOT_STRING_T \ - wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) - -/* some more defines, not really sure if they're [still] useful */ -#define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER ) -#define wxBETA_NUMBER 0 -#define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) ) - -/* check if the current version is at least major.minor.release */ -#define wxCHECK_VERSION(major,minor,release) \ - (wxMAJOR_VERSION > (major) || \ - (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ - (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) - -/* the same but check the subrelease also */ -#define wxCHECK_VERSION_FULL(major,minor,release,subrel) \ - (wxCHECK_VERSION(major, minor, release) && \ - ((major) != wxMAJOR_VERSION || \ - (minor) != wxMINOR_VERSION || \ - (release) != wxRELEASE_NUMBER || \ - (subrel) <= wxSUBRELEASE_NUMBER)) - -#endif /* _WX_VERSION_H_ */ - diff --git a/Source/3rdParty/wx/include/wx/vidmode.h b/Source/3rdParty/wx/include/wx/vidmode.h deleted file mode 100644 index 343d0de94..000000000 --- a/Source/3rdParty/wx/include/wx/vidmode.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vidmode.h -// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.09.2003 (extracted from wx/display.h) -// RCS-ID: $Id: vidmode.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VMODE_H_ -#define _WX_VMODE_H_ - -// ---------------------------------------------------------------------------- -// wxVideoMode: a simple struct containing video mode parameters for a display -// ---------------------------------------------------------------------------- - -struct WXDLLEXPORT wxVideoMode -{ - wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) - { - w = width; - h = height; - - bpp = depth; - - refresh = freq; - } - - // default copy ctor and assignment operator are ok - - bool operator==(const wxVideoMode& m) const - { - return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; - } - bool operator!=(const wxVideoMode& mode) const - { - return !operator==(mode); - } - - // returns true if this mode matches the other one in the sense that all - // non zero fields of the other mode have the same value in this one - // (except for refresh which is allowed to have a greater value) - bool Matches(const wxVideoMode& other) const - { - return (!other.w || w == other.w) && - (!other.h || h == other.h) && - (!other.bpp || bpp == other.bpp) && - (!other.refresh || refresh >= other.refresh); - } - - // trivial accessors - int GetWidth() const { return w; } - int GetHeight() const { return h; } - int GetDepth() const { return bpp; } - - // returns true if the object has been initialized - bool IsOk() const { return w && h; } - - - // the screen size in pixels (e.g. 640*480), 0 means unspecified - int w, h; - - // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known - int bpp; - - // refresh frequency in Hz, 0 means unspecified/unknown - int refresh; -}; - -#endif // _WX_VMODE_H_ - diff --git a/Source/3rdParty/wx/include/wx/vlbox.h b/Source/3rdParty/wx/include/wx/vlbox.h deleted file mode 100644 index 4aa3bf5d3..000000000 --- a/Source/3rdParty/wx/include/wx/vlbox.h +++ /dev/null @@ -1,296 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vlbox.h -// Purpose: wxVListBox is a virtual listbox with lines of variable height -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.05.03 -// RCS-ID: $Id: vlbox.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VLBOX_H_ -#define _WX_VLBOX_H_ - -#include "wx/vscroll.h" // base class -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxSelectionStore; - -#define wxVListBoxNameStr wxT("wxVListBox") - -// ---------------------------------------------------------------------------- -// wxVListBox -// ---------------------------------------------------------------------------- - -/* - This class has two main differences from a regular listbox: it can have an - arbitrarily huge number of items because it doesn't store them itself but - uses OnDrawItem() callback to draw them and its items can have variable - height as determined by OnMeasureItem(). - - It emits the same events as wxListBox and the same event macros may be used - with it. - */ -class WXDLLEXPORT wxVListBox : public wxVScrolledWindow -{ -public: - // constructors and such - // --------------------- - - // default constructor, you must call Create() later - wxVListBox() { Init(); } - - // normal constructor which calls Create() internally - wxVListBox(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxVListBoxNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // really creates the control and sets the initial number of items in it - // (which may be changed later with SetItemCount()) - // - // the only special style which may be specified here is wxLB_MULTIPLE - // - // returns true on success or false if the control couldn't be created - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxVListBoxNameStr); - - // dtor does some internal cleanup (deletes m_selStore if any) - virtual ~wxVListBox(); - - - // accessors - // --------- - - // get the number of items in the control - size_t GetItemCount() const { return GetLineCount(); } - - // does this control use multiple selection? - bool HasMultipleSelection() const { return m_selStore != NULL; } - - // get the currently selected item or wxNOT_FOUND if there is no selection - // - // this method is only valid for the single selection listboxes - int GetSelection() const - { - wxASSERT_MSG( !HasMultipleSelection(), - wxT("GetSelection() can't be used with wxLB_MULTIPLE") ); - - return m_current; - } - - // is this item the current one? - bool IsCurrent(size_t item) const { return item == (size_t)m_current; } - #ifdef __WXUNIVERSAL__ - bool IsCurrent() const { return wxVScrolledWindow::IsCurrent(); } - #endif - - // is this item selected? - bool IsSelected(size_t item) const; - - // get the number of the selected items (maybe 0) - // - // this method is valid for both single and multi selection listboxes - size_t GetSelectedCount() const; - - // get the first selected item, returns wxNOT_FOUND if none - // - // cookie is an opaque parameter which should be passed to - // GetNextSelected() later - // - // this method is only valid for the multi selection listboxes - int GetFirstSelected(unsigned long& cookie) const; - - // get next selection item, return wxNOT_FOUND if no more - // - // cookie must be the same parameter that was passed to GetFirstSelected() - // before - // - // this method is only valid for the multi selection listboxes - int GetNextSelected(unsigned long& cookie) const; - - // get the margins around each item - wxPoint GetMargins() const { return m_ptMargins; } - - // get the background colour of selected cells - const wxColour& GetSelectionBackground() const { return m_colBgSel; } - - - // operations - // ---------- - - // set the number of items to be shown in the control - // - // this is just a synonym for wxVScrolledWindow::SetLineCount() - virtual void SetItemCount(size_t count); - - // delete all items from the control - void Clear() { SetItemCount(0); } - - // set the selection to the specified item, if it is wxNOT_FOUND the - // selection is unset - // - // this function is only valid for the single selection listboxes - void SetSelection(int selection); - - // selects or deselects the specified item which must be valid (i.e. not - // equal to wxNOT_FOUND) - // - // return true if the items selection status has changed or false - // otherwise - // - // this function is only valid for the multiple selection listboxes - bool Select(size_t item, bool select = true); - - // selects the items in the specified range whose end points may be given - // in any order - // - // return true if any items selection status has changed, false otherwise - // - // this function is only valid for the single selection listboxes - bool SelectRange(size_t from, size_t to); - - // toggle the selection of the specified item (must be valid) - // - // this function is only valid for the multiple selection listboxes - void Toggle(size_t item) { Select(item, !IsSelected(item)); } - - // select all items in the listbox - // - // the return code indicates if any items were affected by this operation - // (true) or if nothing has changed (false) - bool SelectAll() { return DoSelectAll(true); } - - // unselect all items in the listbox - // - // the return code has the same meaning as for SelectAll() - bool DeselectAll() { return DoSelectAll(false); } - - // set the margins: horizontal margin is the distance between the window - // border and the item contents while vertical margin is half of the - // distance between items - // - // by default both margins are 0 - void SetMargins(const wxPoint& pt); - void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } - - // change the background colour of the selected cells - void SetSelectionBackground(const wxColour& col); - - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - -protected: - // the derived class must implement this function to actually draw the item - // with the given index on the provided DC - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0; - - // the derived class must implement this method to return the height of the - // specified item - virtual wxCoord OnMeasureItem(size_t n) const = 0; - - // this method may be used to draw separators between the lines; note that - // the rectangle may be modified, typically to deflate it a bit before - // passing to OnDrawItem() - // - // the base class version doesn't do anything - virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const; - - // this method is used to draw the items background and, maybe, a border - // around it - // - // the base class version implements a reasonable default behaviour which - // consists in drawing the selected item with the standard background - // colour and drawing a border around the item if it is either selected or - // current - virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; - - // we implement OnGetLineHeight() in terms of OnMeasureItem() because this - // allows us to add borders to the items easily - // - // this function is not supposed to be overridden by the derived classes - virtual wxCoord OnGetLineHeight(size_t line) const; - - - // event handlers - void OnPaint(wxPaintEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnLeftDown(wxMouseEvent& event); - void OnLeftDClick(wxMouseEvent& event); - - - // common part of all ctors - void Init(); - - // send the wxEVT_COMMAND_LISTBOX_SELECTED event - void SendSelectedEvent(); - - // common implementation of SelectAll() and DeselectAll() - bool DoSelectAll(bool select); - - // change the current item (in single selection listbox it also implicitly - // changes the selection); current may be wxNOT_FOUND in which case there - // will be no current item any more - // - // return true if the current item changed, false otherwise - bool DoSetCurrent(int current); - - // flags for DoHandleItemClick - enum - { - ItemClick_Shift = 1, // item shift-clicked - ItemClick_Ctrl = 2, // ctrl - ItemClick_Kbd = 4 // item selected from keyboard - }; - - // common part of keyboard and mouse handling processing code - void DoHandleItemClick(int item, int flags); - -private: - // the current item or wxNOT_FOUND - // - // if m_selStore == NULL this is also the selected item, otherwise the - // selections are managed by m_selStore - int m_current; - - // the anchor of the selection for the multiselection listboxes: - // shift-clicking an item extends the selection from m_anchor to the item - // clicked, for example - // - // always wxNOT_FOUND for single selection listboxes - int m_anchor; - - // the object managing our selected items if not NULL - wxSelectionStore *m_selStore; - - // margins - wxPoint m_ptMargins; - - // the selection bg colour - wxColour m_colBgSel; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxVListBox) - DECLARE_ABSTRACT_CLASS(wxVListBox) -}; - -#endif // _WX_VLBOX_H_ - diff --git a/Source/3rdParty/wx/include/wx/volume.h b/Source/3rdParty/wx/include/wx/volume.h deleted file mode 100644 index 7a958b98a..000000000 --- a/Source/3rdParty/wx/include/wx/volume.h +++ /dev/null @@ -1,146 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/volume.h -// Purpose: wxFSVolume - encapsulates system volume information -// Author: George Policello -// Modified by: -// Created: 28 Jan 02 -// RCS-ID: $Id: volume.h 39399 2006-05-28 23:08:31Z ABX $ -// Copyright: (c) 2002 George Policello -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// wxFSVolume represents a volume/drive/mount point in a file system -// ---------------------------------------------------------------------------- - -#ifndef _WX_FSVOLUME_H_ -#define _WX_FSVOLUME_H_ - -#include "wx/defs.h" - -#if wxUSE_FSVOLUME - -#include "wx/arrstr.h" - -// the volume flags -enum -{ - // is the volume mounted? - wxFS_VOL_MOUNTED = 0x0001, - - // is the volume removable (floppy, CD, ...)? - wxFS_VOL_REMOVABLE = 0x0002, - - // read only? (otherwise read write) - wxFS_VOL_READONLY = 0x0004, - - // network resources - wxFS_VOL_REMOTE = 0x0008 -}; - -// the volume types -enum wxFSVolumeKind -{ - wxFS_VOL_FLOPPY, - wxFS_VOL_DISK, - wxFS_VOL_CDROM, - wxFS_VOL_DVDROM, - wxFS_VOL_NETWORK, - wxFS_VOL_OTHER, - wxFS_VOL_MAX -}; - -class WXDLLIMPEXP_BASE wxFSVolumeBase -{ -public: - // return the array containing the names of the volumes - // - // only the volumes with the flags such that - // (flags & flagsSet) == flagsSet && !(flags & flagsUnset) - // are returned (by default, all mounted ones) - static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED, - int flagsUnset = 0); - - // stop execution of GetVolumes() called previously (should be called from - // another thread, of course) - static void CancelSearch(); - - // create the volume object with this name (should be one of those returned - // by GetVolumes()). - wxFSVolumeBase(); - wxFSVolumeBase(const wxString& name); - bool Create(const wxString& name); - - // accessors - // --------- - - // is this a valid volume? - bool IsOk() const; - - // kind of this volume? - wxFSVolumeKind GetKind() const; - - // flags of this volume? - int GetFlags() const; - - // can we write to this volume? - bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); } - - // get the name of the volume and the name which should be displayed to the - // user - wxString GetName() const { return m_volName; } - wxString GetDisplayName() const { return m_dispName; } - - // TODO: operatios (Mount(), Unmount(), Eject(), ...)? - -protected: - // the internal volume name - wxString m_volName; - - // the volume name as it is displayed to the user - wxString m_dispName; - - // have we been initialized correctly? - bool m_isOk; -}; - -#if wxUSE_GUI - -#include "wx/icon.h" -#include "wx/iconbndl.h" // only for wxIconArray - -enum wxFSIconType -{ - wxFS_VOL_ICO_SMALL = 0, - wxFS_VOL_ICO_LARGE, - wxFS_VOL_ICO_SEL_SMALL, - wxFS_VOL_ICO_SEL_LARGE, - wxFS_VOL_ICO_MAX -}; - -// wxFSVolume adds GetIcon() to wxFSVolumeBase -class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase -{ -public: - wxFSVolume() : wxFSVolumeBase() { InitIcons(); } - wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); } - - wxIcon GetIcon(wxFSIconType type) const; - -private: - void InitIcons(); - - // the different icons for this volume (created on demand) - wxIconArray m_icons; -}; - -#else // !wxUSE_GUI - -// wxFSVolume is the same thing as wxFSVolume in wxBase -typedef wxFSVolumeBase wxFSVolume; - -#endif // wxUSE_GUI/!wxUSE_GUI - -#endif // wxUSE_FSVOLUME - -#endif // _WX_FSVOLUME_H_ diff --git a/Source/3rdParty/wx/include/wx/vscroll.h b/Source/3rdParty/wx/include/wx/vscroll.h deleted file mode 100644 index 9063e108b..000000000 --- a/Source/3rdParty/wx/include/wx/vscroll.h +++ /dev/null @@ -1,223 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/vscroll.h -// Purpose: wxVScrolledWindow: generalization of wxScrolledWindow -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.05.03 -// RCS-ID: $Id: vscroll.h 38917 2006-04-26 00:17:52Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VSCROLL_H_ -#define _WX_VSCROLL_H_ - -#include "wx/panel.h" // base class - -// ---------------------------------------------------------------------------- -// wxVScrolledWindow -// ---------------------------------------------------------------------------- - -/* - In the name of this class, "V" may stand for "variable" because it can be - used for scrolling lines of variable heights; "virtual" because it is not - necessary to know the heights of all lines in advance -- only those which - are shown on the screen need to be measured; or, even, "vertical" because - this class only supports scrolling in one direction currently (this could - and probably will change in the future however). - - In any case, this is a generalization of the wxScrolledWindow class which - can be only used when all lines have the same height. It lacks some other - wxScrolledWindow features however, notably it currently lacks support for - horizontal scrolling; it can't scroll another window nor only a rectangle - of the window and not its entire client area. - */ -class WXDLLEXPORT wxVScrolledWindow : public wxPanel -{ -public: - // constructors and such - // --------------------- - - // default ctor, you must call Create() later - wxVScrolledWindow() { Init(); } - - // normal ctor, no need to call Create() after this one - // - // note that wxVSCROLL is always automatically added to our style, there is - // no need to specify it explicitly - wxVScrolledWindow(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // same as the previous ctor but returns status code: true if ok - // - // just as with the ctor above, wxVSCROLL style is always used, there is no - // need to specify it - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name); - } - - - // operations - // ---------- - - // set the number of lines the window contains: the derived class must - // provide the heights for all lines with indices up to the one given here - // in its OnGetLineHeight() - void SetLineCount(size_t count); - - // scroll to the specified line: it will become the first visible line in - // the window - // - // return true if we scrolled the window, false if nothing was done - bool ScrollToLine(size_t line); - - // scroll by the specified number of lines/pages - virtual bool ScrollLines(int lines); - virtual bool ScrollPages(int pages); - - // redraw the specified line - virtual void RefreshLine(size_t line); - - // redraw all lines in the specified range (inclusive) - virtual void RefreshLines(size_t from, size_t to); - - // return the item at the specified (in physical coordinates) position or. - - // wxNOT_FOUND if none, i.e. if it is below the last item - int HitTest(wxCoord x, wxCoord y) const; - int HitTest(const wxPoint& pt) const { return HitTest(pt.x, pt.y); } - - // recalculate all our parameters and redisplay all lines - virtual void RefreshAll(); - - - // accessors - // --------- - - // get the number of lines this window contains (previously set by - // SetLineCount()) - size_t GetLineCount() const { return m_lineMax; } - - // get the first currently visible line - size_t GetVisibleBegin() const { return m_lineFirst; } - - // get the first currently visible line - size_t GetVisibleEnd() const { return m_lineFirst + m_nVisible; } - - // is this line currently visible? - bool IsVisible(size_t line) const - { return line >= GetVisibleBegin() && line < GetVisibleEnd(); } - - - // this is the same as GetVisibleBegin(), exists to match - // GetLastVisibleLine() and for backwards compatibility only - size_t GetFirstVisibleLine() const { return m_lineFirst; } - - // get the last currently visible line - // - // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive - // number) if the control is empty, use GetVisibleEnd() instead, this one - // is kept for backwards compatibility - size_t GetLastVisibleLine() const { return GetVisibleEnd() - 1; } - - // layout the children (including the sizer if needed) - virtual bool Layout(); - -protected: - // this function must be overridden in the derived class and it should - // return the height of the given line in pixels - virtual wxCoord OnGetLineHeight(size_t n) const = 0; - - // this function doesn't have to be overridden but it may be useful to do - // it if calculating the lines heights is a relatively expensive operation - // as it gives the user code a possibility to calculate several of them at - // once - // - // OnGetLinesHint() is normally called just before OnGetLineHeight() but you - // shouldn't rely on the latter being called for all lines in the interval - // specified here. It is also possible that OnGetLineHeight() will be - // called for the lines outside of this interval, so this is really just a - // hint, not a promise. - // - // finally note that lineMin is inclusive, while lineMax is exclusive, as - // usual - virtual void OnGetLinesHint(size_t WXUNUSED(lineMin), - size_t WXUNUSED(lineMax)) const { } - - // when the number of lines changes, we try to estimate the total height - // of all lines which is a rather expensive operation in terms of lines - // access, so if the user code may estimate the average height - // better/faster than we do, it should override this function to implement - // its own logic - // - // this function should return the best guess for the total height it may - // make - virtual wxCoord EstimateTotalHeight() const; - - - // the event handlers - void OnSize(wxSizeEvent& event); - void OnScroll(wxScrollWinEvent& event); -#if wxUSE_MOUSEWHEEL - void OnMouseWheel(wxMouseEvent& event); -#endif - - // find the index of the line we need to show at the top of the window such - // that the last (fully or partially) visible line is the given one - size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false); - - // get the total height of the lines between lineMin (inclusive) and - // lineMax (exclusive) - wxCoord GetLinesHeight(size_t lineMin, size_t lineMax) const; - - // update the thumb size shown by the scrollbar - void UpdateScrollbar(); - - // remove the scrollbar completely because we don't need it - void RemoveScrollbar(); - -private: - // common part of all ctors - void Init(); - - - // the total number of (logical) lines - size_t m_lineMax; - - // the total (estimated) height - wxCoord m_heightTotal; - - // the first currently visible line - size_t m_lineFirst; - - // the number of currently visible lines (including the last, possibly only - // partly, visible one) - size_t m_nVisible; - - // accumulated mouse wheel rotation -#if wxUSE_MOUSEWHEEL - int m_sumWheelRotation; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxVScrolledWindow) - DECLARE_ABSTRACT_CLASS(wxVScrolledWindow) -}; - -#endif // _WX_VSCROLL_H_ - diff --git a/Source/3rdParty/wx/include/wx/wfstream.h b/Source/3rdParty/wx/include/wx/wfstream.h deleted file mode 100644 index ead92d641..000000000 --- a/Source/3rdParty/wx/include/wx/wfstream.h +++ /dev/null @@ -1,204 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wfstream.h -// Purpose: File stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: wfstream.h 61872 2009-09-09 22:37:05Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXFSTREAM_H__ -#define _WX_WXFSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/stream.h" -#include "wx/file.h" -#include "wx/ffile.h" - -#if wxUSE_FILE - -// ---------------------------------------------------------------------------- -// wxFileStream using wxFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileInputStream : public wxInputStream -{ -public: - wxFileInputStream(const wxString& ifileName); - wxFileInputStream(wxFile& file); - wxFileInputStream(int fd); - virtual ~wxFileInputStream(); - - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFileInputStream(); - - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFileInputStream) -}; - -class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream -{ -public: - wxFileOutputStream(const wxString& fileName); - wxFileOutputStream(wxFile& file); - wxFileOutputStream(int fd); - virtual ~wxFileOutputStream(); - - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFileOutputStream(); - - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream -{ -public: - wxTempFileOutputStream(const wxString& fileName); - virtual ~wxTempFileOutputStream(); - - bool Close() { return Commit(); } - virtual bool Commit() { return m_file->Commit(); } - virtual void Discard() { m_file->Discard(); } - - wxFileOffset GetLength() const { return m_file->Length(); } - bool IsSeekable() const { return true; } - -protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) - { return m_file->Seek(pos, mode); } - wxFileOffset OnSysTell() const { return m_file->Tell(); } - -private: - wxTempFile *m_file; - - DECLARE_NO_COPY_CLASS(wxTempFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, - public wxFileOutputStream -{ -public: - wxFileStream(const wxString& fileName); - -private: - DECLARE_NO_COPY_CLASS(wxFileStream) -}; - -#endif //wxUSE_FILE - -#if wxUSE_FFILE - -// ---------------------------------------------------------------------------- -// wxFFileStream using wxFFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream -{ -public: - wxFFileInputStream(const wxString& fileName, const wxChar *mode = wxT("rb")); - wxFFileInputStream(wxFFile& file); - wxFFileInputStream(FILE *file); - virtual ~wxFFileInputStream(); - - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFFileInputStream(); - - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFFileInputStream) -}; - -class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream -{ -public: - wxFFileOutputStream(const wxString& fileName, const wxChar *mode = wxT("w+b")); - wxFFileOutputStream(wxFFile& file); - wxFFileOutputStream(FILE *file); - virtual ~wxFFileOutputStream(); - - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const ; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFFileOutputStream(); - - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream, - public wxFFileOutputStream -{ -public: - wxFFileStream(const wxString& fileName); - -private: - DECLARE_NO_COPY_CLASS(wxFFileStream) -}; - -#endif //wxUSE_FFILE - -#endif // wxUSE_STREAMS - -#endif // _WX_WXFSTREAM_H__ diff --git a/Source/3rdParty/wx/include/wx/window.h b/Source/3rdParty/wx/include/wx/window.h deleted file mode 100644 index fc9e13e88..000000000 --- a/Source/3rdParty/wx/include/wx/window.h +++ /dev/null @@ -1,1671 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/window.h -// Purpose: wxWindowBase class - the interface of wxWindow -// Author: Vadim Zeitlin -// Modified by: Ron Lee -// Created: 01/02/97 -// RCS-ID: $Id: window.h 56758 2008-11-13 22:32:21Z VS $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINDOW_H_BASE_ -#define _WX_WINDOW_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers which we must include here -// ---------------------------------------------------------------------------- - -#include "wx/event.h" // the base class - -#include "wx/list.h" // defines wxWindowList - -#include "wx/cursor.h" // we have member variables of these classes -#include "wx/font.h" // so we can't do without them -#include "wx/colour.h" -#include "wx/region.h" -#include "wx/utils.h" -#include "wx/intl.h" - -#include "wx/validate.h" // for wxDefaultValidator (always include it) - -#if wxUSE_PALETTE - #include "wx/palette.h" -#endif // wxUSE_PALETTE - -#if wxUSE_ACCEL - #include "wx/accel.h" -#endif // wxUSE_ACCEL - -#if wxUSE_ACCESSIBILITY -#include "wx/access.h" -#endif - -// when building wxUniv/Foo we don't want the code for native menu use to be -// compiled in - it should only be used when building real wxFoo -#ifdef __WXUNIVERSAL__ - #define wxUSE_MENUS_NATIVE 0 -#else // !__WXUNIVERSAL__ - #define wxUSE_MENUS_NATIVE wxUSE_MENUS -#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxCaret; -class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxDropTarget; -class WXDLLIMPEXP_FWD_CORE wxItemResource; -class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; -class WXDLLIMPEXP_FWD_CORE wxResourceTable; -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxToolTip; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxScrollHelper; - -#if wxUSE_ACCESSIBILITY -class WXDLLIMPEXP_FWD_CORE wxAccessible; -#endif - -// ---------------------------------------------------------------------------- -// helper stuff used by wxWindow -// ---------------------------------------------------------------------------- - -// struct containing all the visual attributes of a control -struct WXDLLEXPORT wxVisualAttributes -{ - // the font used for control label/text inside it - wxFont font; - - // the foreground colour - wxColour colFg; - - // the background colour, may be wxNullColour if the controls background - // colour is not solid - wxColour colBg; -}; - -// different window variants, on platforms like eg mac uses different -// rendering sizes -enum wxWindowVariant -{ - wxWINDOW_VARIANT_NORMAL, // Normal size - wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) - wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal) - wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal) - wxWINDOW_VARIANT_MAX -}; - -#if wxUSE_SYSTEM_OPTIONS - #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") -#endif - -// ---------------------------------------------------------------------------- -// (pseudo)template list classes -// ---------------------------------------------------------------------------- - -WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT); - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(wxWindowList) wxTopLevelWindows; -extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; - -// ---------------------------------------------------------------------------- -// wxWindowBase is the base class for all GUI controls/widgets, this is the public -// interface of this class. -// -// Event handler: windows have themselves as their event handlers by default, -// but their event handlers could be set to another object entirely. This -// separation can reduce the amount of derivation required, and allow -// alteration of a window's functionality (e.g. by a resource editor that -// temporarily switches event handlers). -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowBase : public wxEvtHandler -{ -public: - // creating the window - // ------------------- - - // default ctor, initializes everything which can be initialized before - // Create() - wxWindowBase() ; - - // pseudo ctor (can't be virtual, called from ctor) - bool CreateBase(wxWindowBase *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPanelNameStr); - - virtual ~wxWindowBase(); - - // deleting the window - // ------------------- - - // ask the window to close itself, return true if the event handler - // honoured our request - bool Close( bool force = false ); - - // the following functions delete the C++ objects (the window itself - // or its children) as well as the GUI windows and normally should - // never be used directly - - // delete window unconditionally (dangerous!), returns true if ok - virtual bool Destroy(); - // delete all children of this window, returns true if ok - bool DestroyChildren(); - - // is the window being deleted? - bool IsBeingDeleted() const { return m_isBeingDeleted; } - - // window attributes - // ----------------- - - // label is just the same as the title (but for, e.g., buttons it - // makes more sense to speak about labels), title access - // is available from wxTLW classes only (frames, dialogs) - virtual void SetLabel(const wxString& label) = 0; - virtual wxString GetLabel() const = 0; - - // the window name is used for ressource setting in X, it is not the - // same as the window title/label - virtual void SetName( const wxString &name ) { m_windowName = name; } - virtual wxString GetName() const { return m_windowName; } - - // sets the window variant, calls internally DoSetVariant if variant - // has changed - void SetWindowVariant(wxWindowVariant variant); - wxWindowVariant GetWindowVariant() const { return m_windowVariant; } - - - // window id uniquely identifies the window among its siblings unless - // it is wxID_ANY which means "don't care" - void SetId( wxWindowID winid ) { m_windowId = winid; } - wxWindowID GetId() const { return m_windowId; } - - // get or change the layout direction (LTR or RTL) for this window, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const - { return wxLayout_Default; } - virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) - { } - - // mirror coordinates for RTL layout if this window uses it and if the - // mirroring is not done automatically like Win32 - virtual wxCoord AdjustForLayoutDirection(wxCoord x, - wxCoord width, - wxCoord widthTotal) const; - - // generate a control id for the controls which were not given one by - // user - static int NewControlId() { return --ms_lastControlId; } - // get the id of the control following the one with the given - // (autogenerated) id - static int NextControlId(int winid) { return winid - 1; } - // get the id of the control preceding the one with the given - // (autogenerated) id - static int PrevControlId(int winid) { return winid + 1; } - - // moving/resizing - // --------------- - - // set the window size and/or position - void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ) - { DoSetSize(x, y, width, height, sizeFlags); } - - void SetSize( int width, int height ) - { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); } - - void SetSize( const wxSize& size ) - { SetSize( size.x, size.y); } - - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } - - void Move(int x, int y, int flags = wxSIZE_USE_EXISTING) - { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); } - - void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING) - { Move(pt.x, pt.y, flags); } - - void SetPosition(const wxPoint& pt) { Move(pt); } - - // Z-order - virtual void Raise() = 0; - virtual void Lower() = 0; - - // client size is the size of area available for subwindows - void SetClientSize( int width, int height ) - { DoSetClientSize(width, height); } - - void SetClientSize( const wxSize& size ) - { DoSetClientSize(size.x, size.y); } - - void SetClientSize(const wxRect& rect) - { SetClientSize( rect.width, rect.height ); } - - // get the window position (pointers may be NULL): notice that it is in - // client coordinates for child windows and screen coordinates for the - // top level ones, use GetScreenPosition() if you need screen - // coordinates for all kinds of windows - void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); } - wxPoint GetPosition() const - { - int x, y; - DoGetPosition(&x, &y); - - return wxPoint(x, y); - } - - // get the window position in screen coordinates - void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); } - wxPoint GetScreenPosition() const - { - int x, y; - DoGetScreenPosition(&x, &y); - - return wxPoint(x, y); - } - - // get the window size (pointers may be NULL) - void GetSize( int *w, int *h ) const { DoGetSize(w, h); } - wxSize GetSize() const - { - int w, h; - DoGetSize(& w, & h); - return wxSize(w, h); - } - - void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); } - wxSize GetClientSize() const - { - int w, h; - DoGetClientSize(&w, &h); - - return wxSize(w, h); - } - - // get the position and size at once - wxRect GetRect() const - { - int x, y, w, h; - GetPosition(&x, &y); - GetSize(&w, &h); - - return wxRect(x, y, w, h); - } - - wxRect GetScreenRect() const - { - int x, y, w, h; - GetScreenPosition(&x, &y); - GetSize(&w, &h); - - return wxRect(x, y, w, h); - } - - // get the origin of the client area of the window relative to the - // window top left corner (the client area may be shifted because of - // the borders, scrollbars, other decorations...) - virtual wxPoint GetClientAreaOrigin() const; - - // get the client rectangle in window (i.e. client) coordinates - wxRect GetClientRect() const - { - return wxRect(GetClientAreaOrigin(), GetClientSize()); - } - -#if wxABI_VERSION >= 20808 - // client<->window size conversion - wxSize ClientToWindowSize(const wxSize& size) const; - wxSize WindowToClientSize(const wxSize& size) const; -#endif - - // get the size best suited for the window (in fact, minimal - // acceptable size using which it will still look "nice" in - // most situations) - wxSize GetBestSize() const - { - if (m_bestSizeCache.IsFullySpecified()) - return m_bestSizeCache; - return DoGetBestSize(); - } - void GetBestSize(int *w, int *h) const - { - wxSize s = GetBestSize(); - if ( w ) - *w = s.x; - if ( h ) - *h = s.y; - } - - void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } - wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } - - // reset the cached best size value so it will be recalculated the - // next time it is needed. - void InvalidateBestSize(); - void CacheBestSize(const wxSize& size) const - { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; } - - - // This function will merge the window's best size into the window's - // minimum size, giving priority to the min size components, and - // returns the results. - wxSize GetEffectiveMinSize() const; - wxDEPRECATED( wxSize GetBestFittingSize() const ); // replaced by GetEffectiveMinSize - wxDEPRECATED( wxSize GetAdjustedMinSize() const ); // replaced by GetEffectiveMinSize - - // A 'Smart' SetSize that will fill in default size values with 'best' - // size. Sets the minsize to what was passed in. - void SetInitialSize(const wxSize& size=wxDefaultSize); - wxDEPRECATED( void SetBestFittingSize(const wxSize& size=wxDefaultSize) ); // replaced by SetInitialSize - - - // the generic centre function - centers the window on parent by` - // default or on screen if it doesn't have parent or - // wxCENTER_ON_SCREEN flag is given - void Centre(int dir = wxBOTH) { DoCentre(dir); } - void Center(int dir = wxBOTH) { DoCentre(dir); } - - // centre with respect to the the parent window - void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } - void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } - - // set window size to wrap around its children - virtual void Fit(); - - // set virtual size to satisfy children - virtual void FitInside(); - - - // SetSizeHints is actually for setting the size hints - // for the wxTLW for a Window Manager - hence the name - - // and it is therefore overridden in wxTLW to do that. - // In wxWindow(Base), it has (unfortunately) been abused - // to mean the same as SetMinSize() and SetMaxSize(). - - virtual void SetSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, - int incW = wxDefaultCoord, int incH = wxDefaultCoord ) - { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); } - - void SetSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize, - const wxSize& incSize=wxDefaultSize) - { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } - - virtual void DoSetSizeHints( int minW, int minH, - int maxW, int maxH, - int incW, int incH ); - - // Methods for setting virtual size hints - // FIXME: What are virtual size hints? - - virtual void SetVirtualSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ); - void SetVirtualSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize) - { - SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y); - } - - - // Call these to override what GetBestSize() returns. This - // method is only virtual because it is overriden in wxTLW - // as a different API for SetSizeHints(). - virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; } - virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; } - - // Override these methods to impose restrictions on min/max size. - // The easier way is to call SetMinSize() and SetMaxSize() which - // will have the same effect. Doing both is non-sense. - virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } - virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } - - // Get the min and max values one by one - int GetMinWidth() const { return GetMinSize().x; } - int GetMinHeight() const { return GetMinSize().y; } - int GetMaxWidth() const { return GetMaxSize().x; } - int GetMaxHeight() const { return GetMaxSize().y; } - - - // Methods for accessing the virtual size of a window. For most - // windows this is just the client area of the window, but for - // some like scrolled windows it is more or less independent of - // the screen window size. You may override the DoXXXVirtual - // methods below for classes where that is is the case. - - void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } - void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } - - wxSize GetVirtualSize() const { return DoGetVirtualSize(); } - void GetVirtualSize( int *x, int *y ) const - { - wxSize s( DoGetVirtualSize() ); - - if( x ) - *x = s.GetWidth(); - if( y ) - *y = s.GetHeight(); - } - - // Override these methods for windows that have a virtual size - // independent of their client size. eg. the virtual area of a - // wxScrolledWindow. - - virtual void DoSetVirtualSize( int x, int y ); - virtual wxSize DoGetVirtualSize() const; - - // Return the largest of ClientSize and BestSize (as determined - // by a sizer, interior children, or other means) - - virtual wxSize GetBestVirtualSize() const - { - wxSize client( GetClientSize() ); - wxSize best( GetBestSize() ); - - return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) ); - } - - // return the size of the left/right and top/bottom borders in x and y - // components of the result respectively - virtual wxSize GetWindowBorderSize() const; - - - // window state - // ------------ - - // returns true if window was shown/hidden, false if the nothing was - // done (window was already shown/hidden) - virtual bool Show( bool show = true ); - bool Hide() { return Show(false); } - - // returns true if window was enabled/disabled, false if nothing done - virtual bool Enable( bool enable = true ); - bool Disable() { return Enable(false); } - - virtual bool IsShown() const { return m_isShown; } - virtual bool IsEnabled() const { return m_isEnabled; } - - // returns true if the window is visible, i.e. IsShown() returns true - // if called on it and all its parents up to the first TLW - virtual bool IsShownOnScreen() const; - - // get/set window style (setting style won't update the window and so - // is only useful for internal usage) - virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } - virtual long GetWindowStyleFlag() const { return m_windowStyle; } - - // just some (somewhat shorter) synonims - void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } - long GetWindowStyle() const { return GetWindowStyleFlag(); } - - // check if the flag is set - bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; } - virtual bool IsRetained() const { return HasFlag(wxRETAINED); } - - // turn the flag on if it had been turned off before and vice versa, - // return true if the flag is currently turned on - bool ToggleWindowStyle(int flag); - - // extra style: the less often used style bits which can't be set with - // SetWindowStyleFlag() - virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } - long GetExtraStyle() const { return m_exStyle; } - - // make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal = true); - - - // (primitive) theming support - // --------------------------- - - virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } - virtual bool GetThemeEnabled() const { return m_themeEnabled; } - - - // focus and keyboard handling - // --------------------------- - - // set focus to this window - virtual void SetFocus() = 0; - - // set focus to this window as the result of a keyboard action - virtual void SetFocusFromKbd() { SetFocus(); } - - // return the window which currently has the focus or NULL - static wxWindow *FindFocus(); - - static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; - - // can this window have focus? - virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); } - - // can this window be given focus by keyboard navigation? if not, the - // only way to give it focus (provided it accepts it at all) is to - // click it - virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); } - - // navigates in the specified direction by sending a wxNavigationKeyEvent - virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward); - - // move this window just before/after the specified one in tab order - // (the other window must be our sibling!) - void MoveBeforeInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, MoveBefore); } - void MoveAfterInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, MoveAfter); } - - - // parent/children relations - // ------------------------- - - // get the list of children - const wxWindowList& GetChildren() const { return m_children; } - wxWindowList& GetChildren() { return m_children; } - - // needed just for extended runtime - const wxWindowList& GetWindowChildren() const { return GetChildren() ; } - -#if wxABI_VERSION >= 20808 - // get the window before/after this one in the parents children list, - // returns NULL if this is the first/last window - wxWindow *GetPrevSibling() const { return DoGetSibling(MoveBefore); } - wxWindow *GetNextSibling() const { return DoGetSibling(MoveAfter); } -#endif // wx 2.8.8+ - - // get the parent or the parent of the parent - wxWindow *GetParent() const { return m_parent; } - inline wxWindow *GetGrandParent() const; - - // is this window a top level one? - virtual bool IsTopLevel() const; - - // it doesn't really change parent, use Reparent() instead - void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; } - // change the real parent of this window, return true if the parent - // was changed, false otherwise (error or newParent == oldParent) - virtual bool Reparent( wxWindowBase *newParent ); - - // implementation mostly - virtual void AddChild( wxWindowBase *child ); - virtual void RemoveChild( wxWindowBase *child ); - - // looking for windows - // ------------------- - - // find window among the descendants of this one either by id or by - // name (return NULL if not found) - wxWindow *FindWindow(long winid) const; - wxWindow *FindWindow(const wxString& name) const; - - // Find a window among any window (all return NULL if not found) - static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); - static wxWindow *FindWindowByName( const wxString& name, - const wxWindow *parent = NULL ); - static wxWindow *FindWindowByLabel( const wxString& label, - const wxWindow *parent = NULL ); - - // event handler stuff - // ------------------- - - // get the current event handler - wxEvtHandler *GetEventHandler() const { return m_eventHandler; } - - // replace the event handler (allows to completely subclass the - // window) - void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; } - - // push/pop event handler: allows to chain a custom event handler to - // alreasy existing ones - void PushEventHandler( wxEvtHandler *handler ); - wxEvtHandler *PopEventHandler( bool deleteHandler = false ); - - // find the given handler in the event handler chain and remove (but - // not delete) it from the event handler chain, return true if it was - // found and false otherwise (this also results in an assert failure so - // this function should only be called when the handler is supposed to - // be there) - bool RemoveEventHandler(wxEvtHandler *handler); - - // validators - // ---------- - -#if wxUSE_VALIDATORS - // a window may have an associated validator which is used to control - // user input - virtual void SetValidator( const wxValidator &validator ); - virtual wxValidator *GetValidator() { return m_windowValidator; } -#endif // wxUSE_VALIDATORS - - - // dialog oriented functions - // ------------------------- - - // validate the correctness of input, return true if ok - virtual bool Validate(); - - // transfer data between internal and GUI representations - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - - virtual void InitDialog(); - -#if wxUSE_ACCEL - // accelerators - // ------------ - virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) - { m_acceleratorTable = accel; } - wxAcceleratorTable *GetAcceleratorTable() - { return &m_acceleratorTable; } - -#endif // wxUSE_ACCEL - -#if wxUSE_HOTKEY - // hot keys (system wide accelerators) - // ----------------------------------- - - virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); - virtual bool UnregisterHotKey(int hotkeyId); -#endif // wxUSE_HOTKEY - - - // dialog units translations - // ------------------------- - - wxPoint ConvertPixelsToDialog( const wxPoint& pt ); - wxPoint ConvertDialogToPixels( const wxPoint& pt ); - wxSize ConvertPixelsToDialog( const wxSize& sz ) - { - wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); - - return wxSize(pt.x, pt.y); - } - - wxSize ConvertDialogToPixels( const wxSize& sz ) - { - wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); - - return wxSize(pt.x, pt.y); - } - - // mouse functions - // --------------- - - // move the mouse to the specified position - virtual void WarpPointer(int x, int y) = 0; - - // start or end mouse capture, these functions maintain the stack of - // windows having captured the mouse and after calling ReleaseMouse() - // the mouse is not released but returns to the window which had had - // captured it previously (if any) - void CaptureMouse(); - void ReleaseMouse(); - - // get the window which currently captures the mouse or NULL - static wxWindow *GetCapture(); - - // does this window have the capture? - virtual bool HasCapture() const - { return (wxWindow *)this == GetCapture(); } - - // painting the window - // ------------------- - - // mark the specified rectangle (or the whole window) as "dirty" so it - // will be repainted - virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) = 0; - - // a less awkward wrapper for Refresh - void RefreshRect(const wxRect& rect, bool eraseBackground = true) - { - Refresh(eraseBackground, &rect); - } - - // repaint all invalid areas of the window immediately - virtual void Update() { } - - // clear the window background - virtual void ClearBackground(); - - // freeze the window: don't redraw it until it is thawed - virtual void Freeze() { } - - // thaw the window: redraw it after it had been frozen - virtual void Thaw() { } - - // return true if window had been frozen and not unthawed yet - virtual bool IsFrozen() const { return false; } - - // adjust DC for drawing on this window - virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } - - // return true if the window contents is double buffered by the system - virtual bool IsDoubleBuffered() const { return false; } - - // the update region of the window contains the areas which must be - // repainted by the program - const wxRegion& GetUpdateRegion() const { return m_updateRegion; } - wxRegion& GetUpdateRegion() { return m_updateRegion; } - - // get the update rectangleregion bounding box in client coords - wxRect GetUpdateClientRect() const; - - // these functions verify whether the given point/rectangle belongs to - // (or at least intersects with) the update region - virtual bool DoIsExposed( int x, int y ) const; - virtual bool DoIsExposed( int x, int y, int w, int h ) const; - - bool IsExposed( int x, int y ) const - { return DoIsExposed(x, y); } - bool IsExposed( int x, int y, int w, int h ) const - { return DoIsExposed(x, y, w, h); } - bool IsExposed( const wxPoint& pt ) const - { return DoIsExposed(pt.x, pt.y); } - bool IsExposed( const wxRect& rect ) const - { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); } - - // colours, fonts and cursors - // -------------------------- - - // get the default attributes for the controls of this class: we - // provide a virtual function which can be used to query the default - // attributes of an existing control and a static function which can - // be used even when no existing object of the given class is - // available, but which won't return any styles specific to this - // particular control, of course (e.g. "Ok" button might have - // different -- bold for example -- font) - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // set/retrieve the window colours (system defaults are used by - // default): SetXXX() functions return true if colour was changed, - // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the - // value to prevent it from being inherited by our children - virtual bool SetBackgroundColour(const wxColour& colour); - void SetOwnBackgroundColour(const wxColour& colour) - { - if ( SetBackgroundColour(colour) ) - m_inheritBgCol = false; - } - wxColour GetBackgroundColour() const; - bool InheritsBackgroundColour() const - { - return m_inheritBgCol; - } - bool UseBgCol() const - { - return m_hasBgCol; - } - - virtual bool SetForegroundColour(const wxColour& colour); - void SetOwnForegroundColour(const wxColour& colour) - { - if ( SetForegroundColour(colour) ) - m_inheritFgCol = false; - } - wxColour GetForegroundColour() const; - - // Set/get the background style. - // Pass one of wxBG_STYLE_SYSTEM, wxBG_STYLE_COLOUR, wxBG_STYLE_CUSTOM - virtual bool SetBackgroundStyle(wxBackgroundStyle style) { m_backgroundStyle = style; return true; } - virtual wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } - - // returns true if the control has "transparent" areas such as a - // wxStaticText and wxCheckBox and the background should be adapted - // from a parent window - virtual bool HasTransparentBackground() { return false; } - - // set/retrieve the font for the window (SetFont() returns true if the - // font really changed) - virtual bool SetFont(const wxFont& font) = 0; - void SetOwnFont(const wxFont& font) - { - if ( SetFont(font) ) - m_inheritFont = false; - } - wxFont GetFont() const; - - // set/retrieve the cursor for this window (SetCursor() returns true - // if the cursor was really changed) - virtual bool SetCursor( const wxCursor &cursor ); - const wxCursor& GetCursor() const { return m_cursor; } - -#if wxUSE_CARET - // associate a caret with the window - void SetCaret(wxCaret *caret); - // get the current caret (may be NULL) - wxCaret *GetCaret() const { return m_caret; } -#endif // wxUSE_CARET - - // get the (average) character size for the current font - virtual int GetCharHeight() const = 0; - virtual int GetCharWidth() const = 0; - - // get the width/height/... of the text using current or specified - // font - virtual void GetTextExtent(const wxString& string, - int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL) - const = 0; - - // client <-> screen coords - // ------------------------ - - // translate to/from screen/client coordinates (pointers may be NULL) - void ClientToScreen( int *x, int *y ) const - { DoClientToScreen(x, y); } - void ScreenToClient( int *x, int *y ) const - { DoScreenToClient(x, y); } - - // wxPoint interface to do the same thing - wxPoint ClientToScreen(const wxPoint& pt) const - { - int x = pt.x, y = pt.y; - DoClientToScreen(&x, &y); - - return wxPoint(x, y); - } - - wxPoint ScreenToClient(const wxPoint& pt) const - { - int x = pt.x, y = pt.y; - DoScreenToClient(&x, &y); - - return wxPoint(x, y); - } - - // test where the given (in client coords) point lies - wxHitTest HitTest(wxCoord x, wxCoord y) const - { return DoHitTest(x, y); } - - wxHitTest HitTest(const wxPoint& pt) const - { return DoHitTest(pt.x, pt.y); } - - // misc - // ---- - - // get the window border style from the given flags: this is different from - // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to - // translate wxBORDER_DEFAULT to something reasonable - wxBorder GetBorder(long flags) const; - - // get border for the flags of this window - wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); } - - // send wxUpdateUIEvents to this window, and children if recurse is true - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; - -#if wxUSE_MENUS - bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) - { return DoPopupMenu(menu, pos.x, pos.y); } - bool PopupMenu(wxMenu *menu, int x, int y) - { return DoPopupMenu(menu, x, y); } -#endif // wxUSE_MENUS - - // override this method to return true for controls having multiple pages - virtual bool HasMultiplePages() const { return false; } - - - // scrollbars - // ---------- - - // does the window have the scrollbar for this orientation? - bool HasScrollbar(int orient) const - { - return (m_windowStyle & - (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0; - } - - // configure the window scrollbars - virtual void SetScrollbar( int orient, - int pos, - int thumbvisible, - int range, - bool refresh = true ) = 0; - virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0; - virtual int GetScrollPos( int orient ) const = 0; - virtual int GetScrollThumb( int orient ) const = 0; - virtual int GetScrollRange( int orient ) const = 0; - - // scroll window to the specified position - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ) = 0; - - // scrolls window by line/page: note that not all controls support this - // - // return true if the position changed, false otherwise - virtual bool ScrollLines(int WXUNUSED(lines)) { return false; } - virtual bool ScrollPages(int WXUNUSED(pages)) { return false; } - - // convenient wrappers for ScrollLines/Pages - bool LineUp() { return ScrollLines(-1); } - bool LineDown() { return ScrollLines(1); } - bool PageUp() { return ScrollPages(-1); } - bool PageDown() { return ScrollPages(1); } - - // context-sensitive help - // ---------------------- - - // these are the convenience functions wrapping wxHelpProvider methods - -#if wxUSE_HELP - // associate this help text with this window - void SetHelpText(const wxString& text); - // associate this help text with all windows with the same id as this - // one - void SetHelpTextForId(const wxString& text); - // get the help string associated with the given position in this window - // - // notice that pt may be invalid if event origin is keyboard or unknown - // and this method should return the global window help text then - virtual wxString GetHelpTextAtPoint(const wxPoint& pt, - wxHelpEvent::Origin origin) const; - // returns the position-independent help text - wxString GetHelpText() const - { - return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown); - } - -#else // !wxUSE_HELP - // silently ignore SetHelpText() calls - void SetHelpText(const wxString& WXUNUSED(text)) { } - void SetHelpTextForId(const wxString& WXUNUSED(text)) { } -#endif // wxUSE_HELP - - // tooltips - // -------- - -#if wxUSE_TOOLTIPS - // the easiest way to set a tooltip for a window is to use this method - void SetToolTip( const wxString &tip ); - // attach a tooltip to the window - void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } -#if wxABI_VERSION >= 20809 - // more readable synonym for SetToolTip(NULL) - void UnsetToolTip() { SetToolTip(NULL); } -#endif // wxABI_VERSION >= 2.8.9 - // get the associated tooltip or NULL if none - wxToolTip* GetToolTip() const { return m_tooltip; } - wxString GetToolTipText() const ; -#else // !wxUSE_TOOLTIPS - // make it much easier to compile apps in an environment - // that doesn't support tooltips, such as PocketPC - void SetToolTip( const wxString & WXUNUSED(tip) ) {} -#if wxABI_VERSION >= 20809 - void UnsetToolTip() { } -#endif // wxABI_VERSION >= 2.8.9 -#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS - - // drag and drop - // ------------- -#if wxUSE_DRAG_AND_DROP - // set/retrieve the drop target associated with this window (may be - // NULL; it's owned by the window and will be deleted by it) - virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; - virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } - -#ifndef __WXMSW__ // MSW version is in msw/window.h -#if wxABI_VERSION >= 20810 - // Accept files for dragging - void DragAcceptFiles(bool accept); -#endif // wxABI_VERSION >= 20810 -#endif // !__WXMSW__ - -#endif // wxUSE_DRAG_AND_DROP - - // constraints and sizers - // ---------------------- -#if wxUSE_CONSTRAINTS - // set the constraints for this window or retrieve them (may be NULL) - void SetConstraints( wxLayoutConstraints *constraints ); - wxLayoutConstraints *GetConstraints() const { return m_constraints; } - - // implementation only - void UnsetConstraints(wxLayoutConstraints *c); - wxWindowList *GetConstraintsInvolvedIn() const - { return m_constraintsInvolvedIn; } - void AddConstraintReference(wxWindowBase *otherWin); - void RemoveConstraintReference(wxWindowBase *otherWin); - void DeleteRelatedConstraints(); - void ResetConstraints(); - - // these methods may be overridden for special layout algorithms - virtual void SetConstraintSizes(bool recurse = true); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int phase); - - // these methods are virtual but normally won't be overridden - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; - -#endif // wxUSE_CONSTRAINTS - - // when using constraints or sizers, it makes sense to update - // children positions automatically whenever the window is resized - // - this is done if autoLayout is on - void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; } - bool GetAutoLayout() const { return m_autoLayout; } - - // lay out the window and its children - virtual bool Layout(); - - // sizers - void SetSizer(wxSizer *sizer, bool deleteOld = true ); - void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ); - - wxSizer *GetSizer() const { return m_windowSizer; } - - // Track if this window is a member of a sizer - void SetContainingSizer(wxSizer* sizer); - wxSizer *GetContainingSizer() const { return m_containingSizer; } - - // accessibility - // ---------------------- -#if wxUSE_ACCESSIBILITY - // Override to create a specific accessible object. - virtual wxAccessible* CreateAccessible(); - - // Sets the accessible object. - void SetAccessible(wxAccessible* accessible) ; - - // Returns the accessible object. - wxAccessible* GetAccessible() { return m_accessible; } - - // Returns the accessible object, creating if necessary. - wxAccessible* GetOrCreateAccessible() ; -#endif - - - // Set window transparency if the platform supports it - virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } - virtual bool CanSetTransparent() { return false; } - - - // implementation - // -------------- - - // event handlers - void OnSysColourChanged( wxSysColourChangedEvent& event ); - void OnInitDialog( wxInitDialogEvent &event ); - void OnMiddleClick( wxMouseEvent& event ); -#if wxUSE_HELP - void OnHelp(wxHelpEvent& event); -#endif // wxUSE_HELP - - // virtual function for implementing internal idle - // behaviour - virtual void OnInternalIdle() {} - - // call internal idle recursively -// void ProcessInternalIdle() ; - - // get the handle of the window for the underlying window system: this - // is only used for wxWin itself or for user code which wants to call - // platform-specific APIs - virtual WXWidget GetHandle() const = 0; - // associate the window with a new native handle - virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { } - // dissociate the current native handle from the window - virtual void DissociateHandle() { } - -#if wxUSE_PALETTE - // Store the palette used by DCs in wxWindow so that the dcs can share - // a palette. And we can respond to palette messages. - wxPalette GetPalette() const { return m_palette; } - - // When palette is changed tell the DC to set the system palette to the - // new one. - void SetPalette(const wxPalette& pal); - - // return true if we have a specific palette - bool HasCustomPalette() const { return m_hasCustomPalette; } - - // return the first parent window with a custom palette or NULL - wxWindow *GetAncestorWithCustomPalette() const; -#endif // wxUSE_PALETTE - - // inherit the parents visual attributes if they had been explicitly set - // by the user (i.e. we don't inherit default attributes) and if we don't - // have our own explicitly set - virtual void InheritAttributes(); - - // returns false from here if this window doesn't want to inherit the - // parents colours even if InheritAttributes() would normally do it - // - // this just provides a simple way to customize InheritAttributes() - // behaviour in the most common case - virtual bool ShouldInheritColours() const { return false; } - -protected: - // event handling specific to wxWindow - virtual bool TryValidator(wxEvent& event); - virtual bool TryParent(wxEvent& event); - - enum MoveKind - { - MoveBefore, // insert before the given window - MoveAfter // insert after the given window - }; - -#if wxABI_VERSION >= 20808 - // common part of GetPrev/NextSibling() - wxWindow *DoGetSibling(MoveKind order) const; -#endif // wx 2.8.8+ - - // common part of MoveBefore/AfterInTabOrder() - virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move); - -#if wxUSE_CONSTRAINTS - // satisfy the constraints for the windows but don't set the window sizes - void SatisfyConstraints(); -#endif // wxUSE_CONSTRAINTS - - // Send the wxWindowDestroyEvent - void SendDestroyEvent(); - - // returns the main window of composite control; this is the window - // that FindFocus returns if the focus is in one of composite control's - // windows - virtual wxWindow *GetMainWindowOfCompositeControl() - { return (wxWindow*)this; } - - // the window id - a number which uniquely identifies a window among - // its siblings unless it is wxID_ANY - wxWindowID m_windowId; - - // the parent window of this window (or NULL) and the list of the children - // of this window - wxWindow *m_parent; - wxWindowList m_children; - - // the minimal allowed size for the window (no minimal size if variable(s) - // contain(s) wxDefaultCoord) - int m_minWidth, - m_minHeight, - m_maxWidth, - m_maxHeight; - - // event handler for this window: usually is just 'this' but may be - // changed with SetEventHandler() - wxEvtHandler *m_eventHandler; - -#if wxUSE_VALIDATORS - // associated validator or NULL if none - wxValidator *m_windowValidator; -#endif // wxUSE_VALIDATORS - -#if wxUSE_DRAG_AND_DROP - wxDropTarget *m_dropTarget; -#endif // wxUSE_DRAG_AND_DROP - - // visual window attributes - wxCursor m_cursor; - wxFont m_font; // see m_hasFont - wxColour m_backgroundColour, // m_hasBgCol - m_foregroundColour; // m_hasFgCol - -#if wxUSE_CARET - wxCaret *m_caret; -#endif // wxUSE_CARET - - // the region which should be repainted in response to paint event - wxRegion m_updateRegion; - -#if wxUSE_ACCEL - // the accelerator table for the window which translates key strokes into - // command events - wxAcceleratorTable m_acceleratorTable; -#endif // wxUSE_ACCEL - - // the tooltip for this window (may be NULL) -#if wxUSE_TOOLTIPS - wxToolTip *m_tooltip; -#endif // wxUSE_TOOLTIPS - - // constraints and sizers -#if wxUSE_CONSTRAINTS - // the constraints for this window or NULL - wxLayoutConstraints *m_constraints; - - // constraints this window is involved in - wxWindowList *m_constraintsInvolvedIn; -#endif // wxUSE_CONSTRAINTS - - // this window's sizer - wxSizer *m_windowSizer; - - // The sizer this window is a member of, if any - wxSizer *m_containingSizer; - - // Layout() window automatically when its size changes? - bool m_autoLayout:1; - - // window state - bool m_isShown:1; - bool m_isEnabled:1; - bool m_isBeingDeleted:1; - - // was the window colours/font explicitly changed by user? - bool m_hasBgCol:1; - bool m_hasFgCol:1; - bool m_hasFont:1; - - // and should it be inherited by children? - bool m_inheritBgCol:1; - bool m_inheritFgCol:1; - bool m_inheritFont:1; - - // window attributes - long m_windowStyle, - m_exStyle; - wxString m_windowName; - bool m_themeEnabled; - wxBackgroundStyle m_backgroundStyle; -#if wxUSE_PALETTE - wxPalette m_palette; - bool m_hasCustomPalette; -#endif // wxUSE_PALETTE - -#if wxUSE_ACCESSIBILITY - wxAccessible* m_accessible; -#endif - - // Virtual size (scrolling) - wxSize m_virtualSize; - - wxScrollHelper *m_scrollHelper; - - int m_minVirtualWidth; // VirtualSizeHints - int m_minVirtualHeight; - int m_maxVirtualWidth; - int m_maxVirtualHeight; - - wxWindowVariant m_windowVariant ; - - // override this to change the default (i.e. used when no style is - // specified) border for the window class - virtual wxBorder GetDefaultBorder() const; - - // Get the default size for the new window if no explicit size given. TLWs - // have their own default size so this is just for non top-level windows. - static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } - static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; } - - - // Used to save the results of DoGetBestSize so it doesn't need to be - // recalculated each time the value is needed. - wxSize m_bestSizeCache; - - wxDEPRECATED( void SetBestSize(const wxSize& size) ); // use SetInitialSize - wxDEPRECATED( virtual void SetInitialBestSize(const wxSize& size) ); // use SetInitialSize - - - - // more pure virtual functions - // --------------------------- - - // NB: we must have DoSomething() function when Something() is an overloaded - // method: indeed, we can't just have "virtual Something()" in case when - // the function is overloaded because then we'd have to make virtual all - // the variants (otherwise only the virtual function may be called on a - // pointer to derived class according to C++ rules) which is, in - // general, absolutely not needed. So instead we implement all - // overloaded Something()s in terms of DoSomething() which will be the - // only one to be virtual. - - // coordinates translation - virtual void DoClientToScreen( int *x, int *y ) const = 0; - virtual void DoScreenToClient( int *x, int *y ) const = 0; - - virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; - - // capture/release the mouse, used by Capture/ReleaseMouse() - virtual void DoCaptureMouse() = 0; - virtual void DoReleaseMouse() = 0; - - // retrieve the position/size of the window - virtual void DoGetPosition(int *x, int *y) const = 0; - virtual void DoGetScreenPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const = 0; - virtual void DoGetClientSize(int *width, int *height) const = 0; - - // get the size which best suits the window: for a control, it would be - // the minimal size which doesn't truncate the control, for a panel - the - // same size as it would have after a call to Fit() - virtual wxSize DoGetBestSize() const; - - // called from DoGetBestSize() to convert best virtual size (returned by - // the window sizer) to the best size for the window itself; this is - // overridden at wxScrolledWindow level to clump down virtual size to real - virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const - { - return size; - } - - // this is the virtual function to be overriden in any derived class which - // wants to change how SetSize() or Move() works - it is called by all - // versions of these functions in the base class - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO) = 0; - - // same as DoSetSize() for the client size - virtual void DoSetClientSize(int width, int height) = 0; - - // move the window to the specified location and resize it: this is called - // from both DoSetSize() and DoSetClientSize() and would usually just - // reposition this window except for composite controls which will want to - // arrange themselves inside the given rectangle - // - // Important note: the coordinates passed to this method are in parent's - // *window* coordinates and not parent's client coordinates (as the values - // passed to DoSetSize and returned by DoGetPosition are)! - virtual void DoMoveWindow(int x, int y, int width, int height) = 0; - - // centre the window in the specified direction on parent, note that - // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for - // TLWs - virtual void DoCentre(int dir); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS - -#if wxUSE_MENUS - virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; -#endif // wxUSE_MENUS - - // Makes an adjustment to the window position to make it relative to the - // parents client area, e.g. if the parent is a frame with a toolbar, its - // (0, 0) is just below the toolbar - virtual void AdjustForParentClientOrigin(int& x, int& y, - int sizeFlags = 0) const; - - // implements the window variants - virtual void DoSetWindowVariant( wxWindowVariant variant ) ; - - // Must be called when mouse capture is lost to send - // wxMouseCaptureLostEvent to windows on capture stack. - static void NotifyCaptureLost(); - -private: - // contains the last id generated by NewControlId - static int ms_lastControlId; - - // the stack of windows which have captured the mouse - static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext; - // the window that currently has mouse capture - static wxWindow *ms_winCaptureCurrent; - // indicates if execution is inside CaptureMouse/ReleaseMouse - static bool ms_winCaptureChanging; - - DECLARE_ABSTRACT_CLASS(wxWindowBase) - DECLARE_NO_COPY_CLASS(wxWindowBase) - DECLARE_EVENT_TABLE() -}; - - - -// Inlines for some deprecated methods -inline wxSize wxWindowBase::GetBestFittingSize() const -{ - return GetEffectiveMinSize(); -} - -inline void wxWindowBase::SetBestFittingSize(const wxSize& size) -{ - SetInitialSize(size); -} - -inline void wxWindowBase::SetBestSize(const wxSize& size) -{ - SetInitialSize(size); -} - -inline void wxWindowBase::SetInitialBestSize(const wxSize& size) -{ - SetInitialSize(size); -} - - -// ---------------------------------------------------------------------------- -// now include the declaration of wxWindow class -// ---------------------------------------------------------------------------- - -// include the declaration of the platform-specific class -#if defined(__WXPALMOS__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowPalm - #else // !wxUniv - #define wxWindowPalm wxWindow - #endif // wxUniv/!wxUniv - #include "wx/palmos/window.h" -#elif defined(__WXMSW__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowMSW - #else // !wxUniv - #define wxWindowMSW wxWindow - #endif // wxUniv/!wxUniv - #include "wx/msw/window.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/window.h" -#elif defined(__WXGTK20__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowGTK - #else // !wxUniv - #define wxWindowGTK wxWindow - #endif // wxUniv - #include "wx/gtk/window.h" -#elif defined(__WXGTK__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowGTK - #else // !wxUniv - #define wxWindowGTK wxWindow - #endif // wxUniv - #include "wx/gtk1/window.h" -#elif defined(__WXX11__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowX11 - #else // !wxUniv - #define wxWindowX11 wxWindow - #endif // wxUniv - #include "wx/x11/window.h" -#elif defined(__WXMGL__) - #define wxWindowNative wxWindowMGL - #include "wx/mgl/window.h" -#elif defined(__WXDFB__) - #define wxWindowNative wxWindowDFB - #include "wx/dfb/window.h" -#elif defined(__WXMAC__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowMac - #else // !wxUniv - #define wxWindowMac wxWindow - #endif // wxUniv - #include "wx/mac/window.h" -#elif defined(__WXCOCOA__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowCocoa - #else // !wxUniv - #define wxWindowCocoa wxWindow - #endif // wxUniv - #include "wx/cocoa/window.h" -#elif defined(__WXPM__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowOS2 - #else // !wxUniv - #define wxWindowOS2 wxWindow - #endif // wxUniv/!wxUniv - #include "wx/os2/window.h" -#endif - -// for wxUniversal, we now derive the real wxWindow from wxWindow, -// for the native ports we already have defined it above -#if defined(__WXUNIVERSAL__) - #ifndef wxWindowNative - #error "wxWindowNative must be defined above!" - #endif - - #include "wx/univ/window.h" -#endif // wxUniv - -// ---------------------------------------------------------------------------- -// inline functions which couldn't be declared in the class body because of -// forward dependencies -// ---------------------------------------------------------------------------- - -inline wxWindow *wxWindowBase::GetGrandParent() const -{ - return m_parent ? m_parent->GetParent() : (wxWindow *)NULL; -} - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// Find the wxWindow at the current mouse position, also returning the mouse -// position. -extern WXDLLEXPORT wxWindow* wxFindWindowAtPointer(wxPoint& pt); - -// Get the current mouse position. -extern WXDLLEXPORT wxPoint wxGetMousePosition(); - -// get the currently active window of this application or NULL -extern WXDLLEXPORT wxWindow *wxGetActiveWindow(); - -// get the (first) top level parent window -WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId() - wxDEPRECATED( int NewControlId() ); - inline int NewControlId() { return wxWindowBase::NewControlId(); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_ACCESSIBILITY -// ---------------------------------------------------------------------------- -// accessible object for windows -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowAccessible: public wxAccessible -{ -public: - wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } - virtual ~wxWindowAccessible() {} - -// Overridables - - // Can return either a child object, or an integer - // representing the child element, starting from 1. - virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject); - - // Returns the rectangle for this object (id = 0) or a child element (id > 0). - virtual wxAccStatus GetLocation(wxRect& rect, int elementId); - - // Navigates from fromId to toId/toObject. - virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, - int* toId, wxAccessible** toObject); - - // Gets the name of the specified object. - virtual wxAccStatus GetName(int childId, wxString* name); - - // Gets the number of children. - virtual wxAccStatus GetChildCount(int* childCount); - - // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, - // this means that the child is a simple element and - // not an accessible object. - virtual wxAccStatus GetChild(int childId, wxAccessible** child); - - // Gets the parent, or NULL. - virtual wxAccStatus GetParent(wxAccessible** parent); - - // Performs the default action. childId is 0 (the action for this object) - // or > 0 (the action for a child). - // Return wxACC_NOT_SUPPORTED if there is no default action for this - // window (e.g. an edit control). - virtual wxAccStatus DoDefaultAction(int childId); - - // Gets the default action for this object (0) or > 0 (the action for a child). - // Return wxACC_OK even if there is no action. actionName is the action, or the empty - // string if there is no action. - // The retrieved string describes the action that is performed on an object, - // not what the object does as a result. For example, a toolbar button that prints - // a document has a default action of "Press" rather than "Prints the current document." - virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName); - - // Returns the description for this object or a child. - virtual wxAccStatus GetDescription(int childId, wxString* description); - - // Returns help text for this object or a child, similar to tooltip text. - virtual wxAccStatus GetHelpText(int childId, wxString* helpText); - - // Returns the keyboard shortcut for this object or child. - // Return e.g. ALT+K - virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut); - - // Returns a role constant. - virtual wxAccStatus GetRole(int childId, wxAccRole* role); - - // Returns a state constant. - virtual wxAccStatus GetState(int childId, long* state); - - // Returns a localized string representing the value for the object - // or child. - virtual wxAccStatus GetValue(int childId, wxString* strValue); - - // Selects the object or child. - virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags); - - // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in - // this subhierarchy has the focus. - // If this object has the focus, child should be 'this'. - virtual wxAccStatus GetFocus(int* childId, wxAccessible** child); - -#if wxUSE_VARIANT - // Gets a variant representing the selected children - // of this object. - // Acceptable values: - // - a null variant (IsNull() returns true) - // - a list variant (GetType() == wxT("list") - // - an integer representing the selected child element, - // or 0 if this object is selected (GetType() == wxT("long") - // - a "void*" pointer to a wxAccessible child object - virtual wxAccStatus GetSelections(wxVariant* selections); -#endif // wxUSE_VARIANT -}; - -#endif // wxUSE_ACCESSIBILITY - - -#endif // _WX_WINDOW_H_BASE_ diff --git a/Source/3rdParty/wx/include/wx/wupdlock.h b/Source/3rdParty/wx/include/wx/wupdlock.h deleted file mode 100644 index c30ae00b1..000000000 --- a/Source/3rdParty/wx/include/wx/wupdlock.h +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wupdlock.h -// Purpose: wxWindowUpdateLocker prevents window redrawing -// Author: Vadim Zeitlin -// Created: 2006-03-06 -// RCS-ID: $Id: wupdlock.h 37842 2006-03-07 01:50:21Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WUPDLOCK_H_ -#define _WX_WUPDLOCK_H_ - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxWindowUpdateLocker prevents updates to the window during its lifetime -// ---------------------------------------------------------------------------- - -class wxWindowUpdateLocker -{ -public: - // create an object preventing updates of the given window (which must have - // a lifetime at least as great as ours) - wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); } - - // dtor thaws the window to permit updates again - ~wxWindowUpdateLocker() { m_win->Thaw(); } - -private: - wxWindow *m_win; - - DECLARE_NO_COPY_CLASS(wxWindowUpdateLocker) -}; - -#endif // _WX_WUPDLOCK_H_ - diff --git a/Source/3rdParty/wx/include/wx/wx.h b/Source/3rdParty/wx/include/wx/wx.h deleted file mode 100644 index 8c71e8ba1..000000000 --- a/Source/3rdParty/wx/include/wx/wx.h +++ /dev/null @@ -1,105 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx.h -// Purpose: wxWidgets central header including the most often used ones -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: wx.h 40943 2006-08-31 19:31:43Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WX_H_ -#define _WX_WX_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/dynarray.h" -#include "wx/list.h" -#include "wx/hash.h" -#include "wx/string.h" -#include "wx/hashmap.h" -#include "wx/arrstr.h" -#include "wx/intl.h" -#include "wx/log.h" -#include "wx/event.h" -#include "wx/app.h" -#include "wx/utils.h" -#include "wx/stream.h" -#include "wx/memory.h" -#include "wx/math.h" -#include "wx/stopwatch.h" -#include "wx/module.h" - -#if wxUSE_GUI - -#include "wx/window.h" -#include "wx/containr.h" -#include "wx/panel.h" -#include "wx/toplevel.h" -#include "wx/frame.h" -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" -#include "wx/region.h" -#include "wx/bitmap.h" -#include "wx/image.h" -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/dc.h" -#include "wx/dcclient.h" -#include "wx/dcmemory.h" -#include "wx/dcprint.h" -#include "wx/dcscreen.h" -#include "wx/button.h" -#include "wx/menuitem.h" -#include "wx/menu.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/palette.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/dialog.h" -#include "wx/timer.h" -#include "wx/settings.h" -#include "wx/msgdlg.h" -#include "wx/cmndata.h" -#include "wx/dataobj.h" - -#include "wx/control.h" -#include "wx/ctrlsub.h" -#include "wx/bmpbuttn.h" -#include "wx/checkbox.h" -#include "wx/checklst.h" -#include "wx/choice.h" -#include "wx/scrolbar.h" -#include "wx/stattext.h" -#include "wx/statbmp.h" -#include "wx/statbox.h" -#include "wx/listbox.h" -#include "wx/radiobox.h" -#include "wx/radiobut.h" -#include "wx/textctrl.h" -#include "wx/slider.h" -#include "wx/gauge.h" -#include "wx/scrolwin.h" -#include "wx/dirdlg.h" -#include "wx/toolbar.h" -#include "wx/combobox.h" -#include "wx/layout.h" -#include "wx/sizer.h" -#include "wx/mdi.h" -#include "wx/statusbr.h" -#include "wx/choicdlg.h" -#include "wx/textdlg.h" -#include "wx/filedlg.h" - -// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator -#include "wx/validate.h" - -#if wxUSE_VALIDATORS - #include "wx/valtext.h" -#endif // wxUSE_VALIDATORS - -#endif // wxUSE_GUI - -#endif // _WX_WX_H_ diff --git a/Source/3rdParty/wx/include/wx/wxchar.h b/Source/3rdParty/wx/include/wx/wxchar.h deleted file mode 100644 index 0c33d6c96..000000000 --- a/Source/3rdParty/wx/include/wx/wxchar.h +++ /dev/null @@ -1,1413 +0,0 @@ -/* - * Name: wx/wxchar.h - * Purpose: Declarations common to wx char/wchar_t usage (wide chars) - * Author: Joel Farley, Ove Kaaven - * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee - * Created: 1998/06/12 - * RCS-ID: $Id: wxchar.h 66970 2011-02-19 13:54:14Z VZ $ - * Copyright: (c) 1998-2006 wxWidgets dev team - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_WXCHAR_H_ -#define _WX_WXCHAR_H_ - -/* defs.h indirectly includes this file, so don't include it here */ -#include "wx/platform.h" -#include "wx/dlimpexp.h" - -#include /* we use FILE below */ - -#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - char *strtok_r(char *, const char *, char **); -#endif - -/* check whether we have wchar_t and which size it is if we do */ -#if !defined(wxUSE_WCHAR_T) - #if defined(__UNIX__) - #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__) - #define wxUSE_WCHAR_T 1 - #else - #define wxUSE_WCHAR_T 0 - #endif - #elif defined(__GNUWIN32__) && !defined(__MINGW32__) - #define wxUSE_WCHAR_T 0 - #elif defined(__WATCOMC__) - #define wxUSE_WCHAR_T 0 - #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) - #define wxUSE_WCHAR_T 0 - #else - /* add additional compiler checks if this fails */ - #define wxUSE_WCHAR_T 1 - #endif -#endif /* !defined(wxUSE_WCHAR_T) */ - -/* Unicode support requires wchar_t */ -#if wxUSE_UNICODE && !wxUSE_WCHAR_T - #error "wchar_t must be available in Unicode build" -#endif /* Unicode */ - -/* - Standard headers we need here. - - NB: don't include any wxWidgets headers here because almost all of them include - this one! - */ - -/* Required for wxPrintf() etc */ -#include - -/* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */ -/* and VC++ for Windows CE don't provide it */ -#if defined(__VISUALC__) && __VISUALC__ >= 1400 - #define wxStrdupA _strdup -#elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__) - /* use #define, not inline wrapper, as it is tested with #ifndef below */ - #define wxStrdupA strdup -#endif - -/* - non Unix compilers which do have wchar.h (but not tchar.h which is included - below and which includes wchar.h anyhow). - - Actually MinGW has tchar.h, but it does not include wchar.h - */ -#if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) - #ifndef HAVE_WCHAR_H - #define HAVE_WCHAR_H - #endif -#endif -#if defined(__MWERKS__) && !defined(__MACH__) - #ifndef HAVE_WCSLEN - #define HAVE_WCSLEN - #endif -#endif - -#if wxUSE_WCHAR_T - #ifdef HAVE_WCHAR_H - /* the current (as of Nov 2002) version of cygwin has a bug in its */ - /* wchar.h -- there is no extern "C" around the declarations in it and */ - /* this results in linking errors later; also, at least on some */ - /* Cygwin versions, wchar.h requires sys/types.h */ - #ifdef __CYGWIN__ - #include - #ifdef __cplusplus - extern "C" { - #endif - #endif /* Cygwin */ - - #include - - #if defined(__CYGWIN__) && defined(__cplusplus) - } - #endif /* Cygwin and C++ */ - - #elif defined(HAVE_WCSTR_H) - /* old compilers have relevant declarations here */ - #include - #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) - /* include stdlib.h for wchar_t */ - #include - #endif /* HAVE_WCHAR_H */ - - #ifdef HAVE_WIDEC_H - #include - #endif -#endif /* wxUSE_WCHAR_T */ - -/* ---------------------------------------------------------------------------- */ -/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */ -/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and have */ -/* the function mapping _tfoo() -> foo() or wfoo() */ -/* ---------------------------------------------------------------------------- */ - -/* VC++ and BC++ starting with 5.2 have TCHAR support */ -#ifdef __VISUALC__ - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) - #define wxHAVE_TCHAR_SUPPORT - #include - #include -#elif defined(__WATCOMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__DMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__WXPALMOS__) - #include -#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) - #define wxHAVE_TCHAR_SUPPORT - #include - #include - #include -#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) - /* VZ: the old VisualAge definitions were completely wrong and had no */ - /* chance at all to work in Unicode build anyhow so let's pretend that */ - /* VisualAge does _not_ support TCHAR for the moment (as indicated by */ - /* "0 &&" above) until someone really has time to delve into Unicode */ - /* issues under OS/2 */ - - /* VisualAge 4.0+ supports TCHAR */ - #define wxHAVE_TCHAR_SUPPORT -#endif /* compilers with (good) TCHAR support */ - -#if defined(__MWERKS__) - /* Metrowerks only has wide char support for OS X >= 10.3 */ - #if !defined(__DARWIN__) || \ - (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) - #define wxHAVE_MWERKS_UNICODE - #endif - - #ifdef wxHAVE_MWERKS_UNICODE - #define HAVE_WPRINTF 1 - #define HAVE_WCSRTOMBS 1 - #define HAVE_VSWPRINTF 1 - #endif -#endif /* __MWERKS__ */ - -#ifdef wxHAVE_TCHAR_SUPPORT - /* get TCHAR definition if we've got it */ - #include - - /* we surely do have wchar_t if we have TCHAR */ - #ifndef wxUSE_WCHAR_T - #define wxUSE_WCHAR_T 1 - #endif /* !defined(wxUSE_WCHAR_T) */ - - /* and we also do have wcslen() */ - #ifndef HAVE_WCSLEN - #define HAVE_WCSLEN - #endif -#endif /* wxHAVE_TCHAR_SUPPORT */ - -/* ---------------------------------------------------------------------------- */ -/* define wxChar type */ -/* ---------------------------------------------------------------------------- */ - -/* TODO: define wxCharInt to be equal to either int or wint_t? */ - -#if !wxUSE_UNICODE - typedef char wxChar; - typedef signed char wxSChar; - typedef unsigned char wxUChar; -#else /* Unicode */ - /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */ - /* signed/unsigned version of it which (a) makes sense to me (unlike */ - /* char wchar_t is always unsigned) and (b) was how the previous */ - /* definitions worked so keep it like this */ - - /* Sun's SunPro compiler supports the wchar_t type and wide character */ - /* functions, but does not define __WCHAR_TYPE__. Define it here to */ - /* allow unicode enabled builds. */ - #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) - #define __WCHAR_TYPE__ wxchar_t - #endif - - /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ - /* comment below */ - #if !defined(__WCHAR_TYPE__) || \ - (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) - /* standard case */ - typedef wchar_t wxChar; - typedef wchar_t wxSChar; - typedef wchar_t wxUChar; - #else /* __WCHAR_TYPE__ and gcc < 2.96 */ - /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. However, */ - /* this doesn't work with new GCC 3.x compilers because wchar_t is */ - /* C++'s builtin type in the new standard. OTOH, old compilers (GCC */ - /* 2.x) won't accept new definition of wx{S,U}Char, therefore we */ - /* have to define wxChar conditionally depending on detected */ - /* compiler & compiler version. */ - /* with old definition of wxChar. */ - typedef __WCHAR_TYPE__ wxChar; - typedef __WCHAR_TYPE__ wxSChar; - typedef __WCHAR_TYPE__ wxUChar; - #endif /* __WCHAR_TYPE__ */ -#endif /* ASCII/Unicode */ - -/* ---------------------------------------------------------------------------- */ -/* define wxT() and related macros */ -/* ---------------------------------------------------------------------------- */ - -#if wxUSE_UNICODE - /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */ - #define wxT(x) wxCONCAT_HELPER(L, x) -#else /* !Unicode */ - #define wxT(x) x -#endif /* Unicode/!Unicode */ - -/* - This macro is defined for forward compatibility with wxWidgets 3. It should - be used in the places where wxWidgets 2 API requires wxT() (in Unicode - build) but wxWidgets 3 doesn't accept it, e.g. wxCmdLineEntryDesc struct - elements initializers. - */ -#define wxT_2(x) wxT(x) - -/* - We define _T() as a synonym of wxT() for backwards compatibility and also - for the benefit of Windows programmers used to it. But this identifier is a - reserved one and this does create problems in practice, notably with Sun CC - which uses it in the recent versions of its standard headers. So avoid - defining it for this compiler at all, unless it was explicitly requested by - predefining wxNEEDS__T macro before including this header or if we're - building wx itself which does need and compiles fine thanks to the special - workarounds for Sun CC in wx/{before,after}std.h. - */ -#ifndef wxNEEDS__T - #if defined(WXBUILDING) || !(defined (__SUNPRO_C) || defined(__SUNPRO_CC)) - #define wxNEEDS__T - #endif -#endif - -#ifdef wxNEEDS__T - /* BSDs define _T() to be something different in ctype.h, override it */ - #if defined(__FreeBSD__) || defined(__DARWIN__) - #include - #endif - #undef _T - - #define _T(x) wxT(x) -#endif /* wxNEEDS__T */ - -/* this macro exists only for forward compatibility with wx 3.0 */ -#define wxS(x) wxT(x) - -/* a helper macro allowing to make another macro Unicode-friendly, see below */ -#define wxAPPLY_T(x) wxT(x) - -/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */ -#ifndef __TFILE__ - #define __TFILE__ wxAPPLY_T(__FILE__) -#endif - -#ifndef __TDATE__ - #define __TDATE__ wxAPPLY_T(__DATE__) -#endif - -#ifndef __TTIME__ - #define __TTIME__ wxAPPLY_T(__TIME__) -#endif - -/* - define wxFoo() function for each standard foo() function whose signature - (exceptionally including the return type) includes any mention of char: - wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have - the same signature but with char replaced by wxChar which allows us to use - it in Unicode build as well - */ - -#ifdef wxHAVE_TCHAR_SUPPORT - #include - - #if defined(__WATCOMC__) && defined(UNICODE) - #define WXWCHAR_T_CAST(c) (wint_t)(c) - #else - #define WXWCHAR_T_CAST(c) c - #endif - - /* ctype.h functions */ - #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c)) - #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c)) - #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c)) - #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c)) - #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c)) - #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c)) - #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c)) - #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c)) - #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c)) - #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c)) - #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c)) - - /* - There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with - signed chars < 0, so "fix" it here. - */ - #define wxTolower(c) _totlower((wxUChar)(c)) - #define wxToupper(c) _totupper((wxUChar)(c)) - - /* locale.h functons */ - #define wxSetlocale _tsetlocale - - /* string.h functions */ - #define wxStrcat _tcscat - #define wxStrchr _tcschr - #define wxStrcmp _tcscmp - #define wxStrcoll _tcscoll - #define wxStrcpy _tcscpy - #define wxStrcspn _tcscspn - #define wxStrdupW _wcsdup /* notice the 'W'! */ - #define wxStrftime _tcsftime - #define wxStricmp _tcsicmp - #define wxStrnicmp _tcsnicmp - #define wxStrlen_ _tcslen /* used in wxStrlen inline function */ - #define wxStrncat _tcsncat - #define wxStrncmp _tcsncmp - #define wxStrncpy _tcsncpy - #define wxStrpbrk _tcspbrk - #define wxStrrchr _tcsrchr - #define wxStrspn _tcsspn - #define wxStrstr _tcsstr - #define wxStrtod _tcstod - #define wxStrtol _tcstol - #define wxStrtoul _tcstoul - #ifdef __VISUALC__ - #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) - #define wxStrtoll _tcstoi64 - #define wxStrtoull _tcstoui64 - #endif /* VC++ 7+ */ - #endif - #define wxStrxfrm _tcsxfrm - - /* stdio.h functions */ - #define wxFgetc _fgettc - #define wxFgetchar _fgettchar - #define wxFgets _fgetts - #if wxUSE_UNICODE_MSLU - WXDLLIMPEXP_BASE FILE * wxMSLU__tfopen(const wxChar *name, const wxChar *mode); - - #define wxFopen wxMSLU__tfopen - #else - #define wxFopen _tfopen - #endif - #define wxFputc _fputtc - #define wxFputchar _fputtchar - #define wxFprintf _ftprintf - #define wxFputs _fputts - #define wxFreopen _tfreopen - #define wxFscanf _ftscanf - #define wxGetc _gettc - #define wxGetchar _gettchar - #define wxGets _getts - #define wxPerror _tperror - #define wxPrintf _tprintf - #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f) - #define wxPutchar _puttchar - #define wxPuts _putts - #define wxScanf _tscanf - #if defined(__DMC__) - #if wxUSE_UNICODE - /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */ - int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ; - #else - /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */ - #define wxSprintf sprintf - #endif - #elif defined(__MINGW32__) && ( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) - #if wxUSE_UNICODE - /* MinGW with STLPort 5.1 adds count to swprintf (C99) so prototype conversion see wxchar.cpp */ - int wxSprintf (wchar_t*, const wchar_t*, ...); - #else - /* MinGW with STLPort 5.1 has clashing defines for _stprintf so use sprintf */ - #define wxSprintf sprintf - #endif - #else - #define wxSprintf _stprintf - #endif - - #define wxSscanf _stscanf - #define wxTmpnam _ttmpnam - #define wxUngetc _tungetc - #define wxVfprintf _vftprintf - #define wxVprintf _vtprintf - #define wxVsscanf _vstscanf - #define wxVsprintf _vstprintf - - /* special case: these functions are missing under Win9x with Unicows so we */ - /* have to implement them ourselves */ - #if wxUSE_UNICODE_MSLU - WXDLLIMPEXP_BASE int wxMSLU__trename(const wxChar *oldname, const wxChar *newname); - WXDLLIMPEXP_BASE int wxMSLU__tremove(const wxChar *name); - - #define wxRemove wxMSLU__tremove - #define wxRename wxMSLU__trename - #else - #ifdef __WXWINCE__ - /* carefully: wxRemove() must return 0 on success while DeleteFile() - returns 0 on error, so don't just define one as the other */ - int wxRemove(const wxChar *path); - #else - #define wxRemove _tremove - #define wxRename _trename - #endif - #endif - - /* stdlib.h functions */ - #define wxAtoi _ttoi - #define wxAtol _ttol - /* #define wxAtof _tttof -- notice that there is no such thing (why?) */ - /* there are no env vars at all under CE, so no _tgetenv neither */ - #ifdef __WXWINCE__ - /* can't define as inline function as this is a C file... */ - #define wxGetenv(name) ((wxChar *)NULL) - #else - #define wxGetenv _tgetenv - #endif - #define wxSystem _tsystem - - /* time.h functions */ - #define wxAsctime _tasctime - #define wxCtime _tctime - - #define wxMbstowcs mbstowcs - #define wxWcstombs wcstombs -#else /* !TCHAR-aware compilers */ - /* - There are 2 unrelated problems with these functions under Mac: - a) Metrowerks MSL CRT implements them strictly in C99 sense and - doesn't support (very common) extension of allowing to call - mbstowcs(NULL, ...) which makes it pretty useless as you can't - know the size of the needed buffer - b) OS X <= 10.2 declares and even defined these functions but - doesn't really implement them -- they always return an error - - So use our own replacements in both cases. - */ - #if defined(__MWERKS__) && defined(__MSL__) - #define wxNEED_WX_MBSTOWCS - #endif - - #ifdef __DARWIN__ - #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 - #define wxNEED_WX_MBSTOWCS - #endif - #endif - - #ifdef wxNEED_WX_MBSTOWCS - /* even though they are defined and "implemented", they are bad and just - stubs so we need our own - we need these even in ANSI builds!! */ - WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t); - WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t); - #else - #define wxMbstowcs mbstowcs - #define wxWcstombs wcstombs - #endif - - /* - The system C library on Mac OS X 10.2 and below does not support - unicode: in other words all wide-character functions such as towupper et - al. do simply not exist so we need to provide our own in that context, - except for the wchar_t definition/typedef itself. - - We need to do this for both project builder and CodeWarrior as - the latter uses the system C library in Mach builds for wide character - support, which as mentioned does not exist on 10.2 and below. - */ - #if wxUSE_UNICODE && \ - defined(__DARWIN__) && \ - ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) - /* we need everything! */ - #define wxNEED_WX_STRING_H - #define wxNEED_WX_CTYPE_H - - #define wxFgetchar(c) wxFgetc(c, stdin) - #define wxFputc wxPutc - #define wxFputchar(c) wxPutc(c, stdout) - #define wxGetc wxFgetc - #define wxGetchar(c) wxFgetc(c, stdin) - - #include - - #define wxNEED_FGETC - #define wxNEED_FGETS - #define wxNEED_GETS - #define wxNEED_UNGETC - - #define wxNEED_FPUTS - #define wxNEED_PUTS - #define wxNEED_PUTC - - int wxFputs(const wxChar *ch, FILE *stream); - int wxPuts(const wxChar *ws); - int wxPutc(wxChar ch, FILE *stream); - - #ifdef __cplusplus - extern "C" { - #endif - WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s); - #ifdef __cplusplus - } - #endif - - #define wxPutchar(wch) wxPutc(wch, stdout) - - #define wxNEED_PRINTF_CONVERSION - #define wxNEED_WX_STDIO_H - #define wxNEED_WX_STDLIB_H - #define wxNEED_WX_TIME_H - - #elif wxUSE_UNICODE - #include - - /* this is probably glibc-specific */ - #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__) - /* ctype.h functions (wctype.h) */ - #define wxIsalnum iswalnum - #define wxIsalpha iswalpha - #define wxIscntrl iswcntrl - #define wxIsdigit iswdigit - #define wxIsgraph iswgraph - #define wxIslower iswlower - #define wxIsprint iswprint - #define wxIspunct iswpunct - #define wxIsspace iswspace - #define wxIsupper iswupper - #define wxIsxdigit iswxdigit - - #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) - /* /usr/include/wctype.h incorrectly declares translations */ - /* tables which provokes tons of compile-time warnings -- try */ - /* to correct this */ - #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) - #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) - #else /* !glibc 2.0 */ - #define wxTolower towlower - #define wxToupper towupper - #endif /* gcc/!gcc */ - - /* string.h functions (wchar.h) */ - #define wxStrcat wcscat - #define wxStrchr wcschr - #define wxStrcmp wcscmp - #define wxStrcoll wcscoll - #define wxStrcpy wcscpy - #define wxStrcspn wcscspn - #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ - #define wxStrncat wcsncat - #define wxStrncmp wcsncmp - #define wxStrncpy wcsncpy - #define wxStrpbrk wcspbrk - #define wxStrrchr wcsrchr - #define wxStrspn wcsspn - #define wxStrstr wcsstr - #define wxStrtod wcstod - #define wxStrtol wcstol - #define wxStrtoul wcstoul - #ifdef HAVE_WCSTOULL - /* assume that we have wcstoull(), which is also C99, too */ - #define wxStrtoll wcstoll - #define wxStrtoull wcstoull - #endif /* HAVE_WCSTOULL */ - #define wxStrxfrm wcsxfrm - - #define wxFgetc fgetwc - #define wxFgetchar fgetwchar - #define wxFgets fgetws - #define wxFputc fputwc - #define wxFputchar fputwchar - #define wxGetc getwc - #define wxGetchar getwchar - #define wxGets getws - #define wxUngetc ungetwc - - #ifdef HAVE_FPUTWS - #define wxFputs fputws - #else - #define wxNEED_FPUTS - #include - int wxFputs(const wxChar *ch, FILE *stream); - #endif - - #ifdef HAVE_WPUTC - #define wxPutc wputc - #else - #define wxNEED_PUTC - #include - int wxPutc(wxChar ch, FILE *stream); - #endif - - #ifdef HAVE_WPUTCHAR - #define wxPutchar wputchar - #else - #define wxPutchar(wch) wxPutc(wch, stdout) - #endif - - #ifdef HAVE_PUTWS - #define wxPuts putws - #else - #define wxNEED_PUTS - int wxPuts(const wxChar *ws); - #endif - - /* we need %s to %ls conversion for printf and scanf etc */ - #define wxNEED_PRINTF_CONVERSION - - /* glibc doesn't have wide char equivalents of the other stuff so */ - /* use our own versions */ - #define wxNEED_WX_STDIO_H - #define wxNEED_WX_STDLIB_H - #define wxNEED_WX_TIME_H - #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) ) - /* ctype.h functions (wctype.h) */ - #define wxIsalnum iswalnum - #define wxIsalpha iswalpha - #define wxIscntrl iswcntrl - #define wxIsdigit iswdigit - #define wxIsgraph iswgraph - #define wxIslower iswlower - #define wxIsprint iswprint - #define wxIspunct iswpunct - #define wxIsspace iswspace - #define wxIsupper iswupper - #define wxIsxdigit iswxdigit - #define wxTolower towlower - #define wxToupper towupper - - /* string.h functions (wchar.h) */ - #define wxStrcat wcscat - #define wxStrchr wcschr - #define wxStrcmp wcscmp - #define wxStrcoll wcscoll - #define wxStrcpy wcscpy - #define wxStrcspn wcscspn - #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ - #define wxStrncat wcsncat - #define wxStrncmp wcsncmp - #define wxStrncpy wcsncpy - #define wxStrpbrk wcspbrk - #define wxStrrchr wcsrchr - #define wxStrspn wcsspn - #define wxStrstr wcsstr - #define wxStrtod wcstod - #define wxStrtol wcstol - #define wxStrtoul wcstoul - #define wxStrxfrm wcsxfrm - - #define wxFgetc fgetwc - #define wxFgetchar fgetwchar - #define wxFgets fgetws - #define wxFputc fputwc - #define wxFputchar fputwchar - #define wxGetc getwc - #define wxGetchar getwchar - #define wxGets getws - #define wxUngetc ungetwc - - #define wxNEED_PRINTF_CONVERSION - - #define wxPutc putwc - #define wxPutchar putwchar - #define wxFputs fputws - - /* stdio.h functions */ - - #define wxNEED_WX_STDIO_H - - /* stdlib.h functions */ - #ifdef __MACH__ - #define wxNEED_WX_STDLIB_H - #else - #define wxAtof watof - #define wxAtoi watoi - #define wxAtol watol - #define wxGetenv(a) ((wxChar*)NULL) - #define wxSystem(a) ((int)NULL) - #endif - /* time.h functions */ - #define wxAsctime wasciitime - #define wxCtime wctime - /* #define wxStrftime wcsftime */ - - #define wxNEED_WX_TIME_H - #else /* !metrowerks for apple */ - #error "Please define wide character functions for your environment" - #endif - #else /* ASCII */ - #include - #include - - /* ctype.h functions */ - #define wxIsalnum isalnum - #define wxIsalpha isalpha - #define wxIscntrl iscntrl - #define wxIsdigit isdigit - #define wxIsgraph isgraph - #define wxIslower islower - #define wxIsprint isprint - #define wxIspunct ispunct - #define wxIsspace isspace - #define wxIsupper isupper - #define wxIsxdigit isxdigit - #define wxTolower tolower - #define wxToupper toupper - - /* locale.h functons */ - #define wxSetlocale setlocale - - /* string.h functions */ - #define wxStrcat strcat - #define wxStrchr strchr - #define wxStrcmp strcmp - #define wxStrcoll strcoll - #define wxStrcpy strcpy - #define wxStrcspn strcspn - - /* wxStricmp and wxStrnicmp are defined below */ - #define wxStrlen_ strlen /* used in wxStrlen inline function */ - #define wxStrncat strncat - #define wxStrncmp strncmp - #define wxStrncpy strncpy - #define wxStrpbrk strpbrk - #define wxStrrchr strrchr - #define wxStrspn strspn - #define wxStrstr strstr - #define wxStrtod strtod - #ifdef HAVE_STRTOK_R - #define wxStrtok(str, sep, last) strtok_r(str, sep, last) - #endif - #define wxStrtol strtol - #define wxStrtoul strtoul - #ifdef HAVE_STRTOULL - /* assume that we have wcstoull(), which is also C99, too */ - #define wxStrtoll strtoll - #define wxStrtoull strtoull - #endif /* HAVE_WCSTOULL */ - #define wxStrxfrm strxfrm - - /* stdio.h functions */ - #define wxFopen fopen - #define wxFreopen freopen - #define wxRemove remove - #define wxRename rename - - #define wxPerror perror - #define wxTmpnam tmpnam - - #define wxFgetc fgetc - #define wxFgetchar fgetchar - #define wxFgets fgets - #define wxFputc fputc - #define wxFputs fputs - #define wxFputchar fputchar - #define wxFprintf fprintf - #define wxFscanf fscanf - #define wxGetc getc - #define wxGetchar getchar - #define wxGets gets - #define wxPrintf printf - #define wxPutc putc - #define wxPutchar putchar - #define wxPuts puts - #define wxScanf scanf - #define wxSprintf sprintf - #define wxSscanf sscanf - #define wxUngetc ungetc - #define wxVfprintf vfprintf - #define wxVprintf vprintf - #define wxVsscanf vsscanf - #define wxVsprintf vsprintf - - /* stdlib.h functions */ - #define wxAtof atof - #define wxAtoi atoi - #define wxAtol atol - #define wxGetenv getenv - #define wxSystem system - - /* time.h functions */ - #define wxAsctime asctime - #define wxCtime ctime - #define wxStrftime strftime - #endif /* Unicode/ASCII */ -#endif /* TCHAR-aware compilers/the others */ - -#ifdef wxStrtoll - #define wxHAS_STRTOLL -#endif - -/* - various special cases - */ - -/* define wxStricmp and wxStrnicmp for various compilers */ - -/* note that in Unicode mode we definitely are going to need our own version */ -#if !defined(wxStricmp) && !wxUSE_UNICODE - #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ - defined(__SALFORDC__) || defined(__VISAGECPP__) || \ - defined(__EMX__) || defined(__DJGPP__) - #define wxStricmp stricmp - #define wxStrnicmp strnicmp - #elif defined(__WXPALMOS__) - /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This - * quick hack should do until one can be written. - */ - #define wxStricmp StrCaselessCompare - #define wxStrnicmp strnicmp - #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ - (defined(__MWERKS__) && defined(__INTEL__)) - #define wxStricmp _stricmp - #define wxStrnicmp _strnicmp - #elif defined(__UNIX__) || defined(__GNUWIN32__) - #define wxStricmp strcasecmp - #define wxStrnicmp strncasecmp - /* #else -- use wxWidgets implementation */ - #endif -#endif /* !defined(wxStricmp) */ - -/* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */ -/* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */ -/* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */ -#if wxUSE_WCHAR_T - #ifdef HAVE_WCSLEN - #define wxWcslen wcslen - #else - WXDLLIMPEXP_BASE size_t wxWcslen(const wchar_t *s); - #endif -#endif /* wxUSE_WCHAR_T */ - -#ifdef __cplusplus -/* checks whether the passed in pointer is NULL and if the string is empty */ -inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } - -/* safe version of strlen() (returns 0 if passed NULL pointer) */ -inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; } -#endif - -/* - each of strdup() and wcsdup() may or may not be available but we need both - of them anyhow for wx/buffer.h so we define the missing one(s) in - wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW - defined -- if this is somehow not the case in some situations, please - correct that and not the lines here - */ -#if wxUSE_UNICODE - #define wxStrdup wxStrdupW -#else - #define wxStrdup wxStrdupA -#endif - -#ifdef __cplusplus -WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ -#endif - -/* printf() family saga */ - -/* - For some systems [v]snprintf() exists in the system libraries but not in the - headers, so we need to declare it ourselves to be able to use it. - */ -#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - int vsnprintf(char *str, size_t size, const char *format, va_list ap); -#endif /* !HAVE_VSNPRINTF_DECL */ - -#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...); -#endif /* !HAVE_SNPRINTF_DECL */ - -/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the - * same isn't done for snprintf below, the builtin wxSnprintf_ is used - * instead since it's already a simple wrapper */ -#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL - inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) - { - return vsnprintf(str, size, (char*)format, ap); - } -#endif - -/* - MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility - presumably) and normally _vsnwprintf() is used instead (but as - STLPort 5.1 defines standard vswprintf(), don't do this for it) - */ -#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__) && !( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) - #undef HAVE_VSWPRINTF -#endif - -#if wxUSE_PRINTF_POS_PARAMS - /* - The systems where vsnprintf() supports positional parameters should - define the HAVE_UNIX98_PRINTF symbol. - - On systems which don't (e.g. Windows) we are forced to use - our wxVsnprintf() implementation. - */ - #if defined(HAVE_UNIX98_PRINTF) - #if wxUSE_UNICODE - #ifdef HAVE_VSWPRINTF - #define wxVsnprintf_ vswprintf - #endif - #else /* ASCII */ - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxVsnprintf_ wx_fixed_vsnprintf - #else - #define wxVsnprintf_ vsnprintf - #endif - #endif - #else /* !HAVE_UNIX98_PRINTF */ - /* - The only compiler with positional parameters support under Windows - is VC++ 8.0 which provides a new xxprintf_p() functions family. - The 2003 PSDK includes a slightly earlier version of VC8 than the - main release and does not have the printf_p functions. - */ - #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ - #if wxUSE_UNICODE - #define wxVsnprintf_ _vswprintf_p - #else - #define wxVsnprintf_ _vsprintf_p - #endif - #endif - #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ -#else /* !wxUSE_PRINTF_POS_PARAMS */ - /* - We always want to define safe snprintf() function to be used instead of - sprintf(). Some compilers already have it (or rather vsnprintf() which - we really need...), otherwise we implement it using our own printf() - code. - - We define function with a trailing underscore here because the real one - is a wrapper around it as explained below - */ - - /* first deal with TCHAR-aware compilers which have _vsntprintf */ - #ifndef wxVsnprintf_ - #if defined(__VISUALC__) || \ - (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) - #define wxVsnprintf_ _vsntprintf - #define wxSnprintf_ _sntprintf - #endif - #endif - - /* if this didn't work, define it separately for Unicode and ANSI builds */ - #ifndef wxVsnprintf_ - #if wxUSE_UNICODE - #if defined(HAVE__VSNWPRINTF) - #define wxVsnprintf_ _vsnwprintf - #elif defined(HAVE_VSWPRINTF) - #define wxVsnprintf_ vswprintf - #elif defined(__WATCOMC__) - #define wxVsnprintf_ _vsnwprintf - #define wxSnprintf_ _snwprintf - #endif - #else /* ASCII */ - /* - All versions of CodeWarrior supported by wxWidgets apparently - have both snprintf() and vsnprintf() - */ - #if defined(HAVE_SNPRINTF) \ - || defined(__MWERKS__) || defined(__WATCOMC__) - #ifndef HAVE_BROKEN_SNPRINTF_DECL - #define wxSnprintf_ snprintf - #endif - #endif - #if defined(HAVE_VSNPRINTF) \ - || defined(__MWERKS__) || defined(__WATCOMC__) - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxVsnprintf_ wx_fixed_vsnprintf - #else - #define wxVsnprintf_ vsnprintf - #endif - #endif - #endif /* Unicode/ASCII */ - #endif /* wxVsnprintf_ */ -#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ - -#ifndef wxSnprintf_ - /* no snprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) ATTRIBUTE_PRINTF_3; -#endif -#ifndef wxVsnprintf_ - /* no (suitable) vsnprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxVsnprintf_(wxChar *buf, size_t len, const wxChar *format, va_list argptr); - - #define wxUSE_WXVSNPRINTF 1 -#else - #define wxUSE_WXVSNPRINTF 0 -#endif - -/* - In Unicode mode we need to have all standard functions such as wprintf() and - so on but not all systems have them so use our own implementations in this - case. - */ -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) - #define wxNEED_WPRINTF -#endif - -/* - More Unicode complications: although both ANSI C and C++ define a number of - wide character functions such as wprintf(), not all environments have them. - Worse, those which do have different behaviours: under Windows, %s format - specifier changes its meaning in Unicode build and expects a Unicode string - while under Unix/POSIX it still means an ASCII string even for wprintf() and - %ls has to be used for wide strings. - - We choose to always emulate Windows behaviour as more useful for us so even - if we have wprintf() we still must wrap it in a non trivial wxPrintf(). - -*/ - -#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF) - /* - we need to implement all wide character printf and scanf functions - either because we don't have them at all or because they don't have the - semantics we need - */ - int wxScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; - int wxSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap ); - int wxPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; - int wxSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxVfprintf( FILE *stream, const wxChar *format, va_list ap ); - int wxVprintf( const wxChar *format, va_list ap ); - int wxVsprintf( wxChar *str, const wxChar *format, va_list ap ); -#endif /* wxNEED_PRINTF_CONVERSION */ - -/* these 2 can be simply mapped to the versions with underscore at the end */ -/* if we don't have to do the conversion */ -/* - However, if we don't have any vswprintf() at all we don't need to redefine - anything as our own wxVsnprintf_() already behaves as needed. -*/ -#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_) - int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3; - int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap ); -#else - #define wxSnprintf wxSnprintf_ - #define wxVsnprintf wxVsnprintf_ -#endif - -/* - various functions which might not be available in libc and for which we - provide our own replacements in wxchar.cpp - */ - -/* ctype.h functions */ - -/* RN: Used only under OSX <= 10.2 currently */ -#ifdef wxNEED_WX_CTYPE_H - WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch); - WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch); - WXDLLIMPEXP_BASE int wxIscntrl(wxChar ch); - WXDLLIMPEXP_BASE int wxIsdigit(wxChar ch); - WXDLLIMPEXP_BASE int wxIsgraph(wxChar ch); - WXDLLIMPEXP_BASE int wxIslower(wxChar ch); - WXDLLIMPEXP_BASE int wxIsprint(wxChar ch); - WXDLLIMPEXP_BASE int wxIspunct(wxChar ch); - WXDLLIMPEXP_BASE int wxIsspace(wxChar ch); - WXDLLIMPEXP_BASE int wxIsupper(wxChar ch); - WXDLLIMPEXP_BASE int wxIsxdigit(wxChar ch); - WXDLLIMPEXP_BASE int wxTolower(wxChar ch); - WXDLLIMPEXP_BASE int wxToupper(wxChar ch); -#endif /* wxNEED_WX_CTYPE_H */ - -/* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */ -/* the file parsing -- this may be true for 5.0 as well, update #ifdef then */ -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE - #undef wxIsspace - #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c)) -#endif /* VC++ */ - -/* - a few compilers don't have the (non standard but common) isascii function, - define it ourselves for them - */ -#ifndef isascii - #if defined(__MWERKS__) - #define wxNEED_ISASCII - #elif defined(_WIN32_WCE) - #if _WIN32_WCE <= 211 - #define wxNEED_ISASCII - #endif - #endif -#endif /* isascii */ - -#ifdef wxNEED_ISASCII - inline int isascii(int c) { return (unsigned)c < 0x80; } -#endif - -#ifdef _WIN32_WCE - #if _WIN32_WCE <= 211 - #define isspace(c) ((c) == wxT(' ') || (c) == wxT('\t')) - #endif -#endif /* _WIN32_WCE */ - -/* - we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the - initial versions of this header -- now it is too late to remove it so - although we fixed the function/macro name above, still provide the - backwards-compatible synonym. - */ -#define wxIsctrl wxIscntrl - -/* string.h functions */ -#ifndef strdup - #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000) - #define wxNEED_STRDUP - #elif defined(__WXWINCE__) - #if _WIN32_WCE <= 211 - #define wxNEED_STRDUP - #endif - #endif -#endif /* strdup */ - -#ifdef wxNEED_STRDUP - WXDLLIMPEXP_BASE char *strdup(const char* s); -#endif - -/* RN: Used only under OSX <= 10.2 currently - The __cplusplus ifdefs are messy, but they are required to build - the regex library, since c does not support function overloading -*/ -#ifdef wxNEED_WX_STRING_H -# ifdef __cplusplus - extern "C" { -# endif - WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src); - WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2); - WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2); - WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src); - WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject); - WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); - WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); - WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); - WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); - WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept); - WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); -# ifdef __cplusplus - } -# endif - - /* These functions use C++, so we can't c extern them */ - WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr); - WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); - WXDLLIMPEXP_BASE unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); - WXDLLIMPEXP_BASE size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); - - /* inlined versions */ - #ifdef __cplusplus - inline wxChar * wxStrchr(wxChar *s, wxChar c) - { return (wxChar *)wxStrchr((const wxChar *)s, c); } - inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) - { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); } - inline wxChar * wxStrrchr(wxChar *s, wxChar c) - { return (wxChar *)wxStrrchr((const wxChar *)s, c); } - inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) - { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); } - #endif - -#endif /* wxNEED_WX_STRING_H */ - -#ifndef wxStrdupA -WXDLLIMPEXP_BASE char *wxStrdupA(const char *psz); -#endif - -#ifndef wxStrdupW -WXDLLIMPEXP_BASE wchar_t *wxStrdupW(const wchar_t *pwz); -#endif - -#ifndef wxStricmp -WXDLLIMPEXP_BASE int wxStricmp(const wxChar *psz1, const wxChar *psz2); -#endif - -#ifndef wxStrnicmp -WXDLLIMPEXP_BASE int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len); -#endif - -#ifndef wxStrtok -WXDLLIMPEXP_BASE wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); -#endif - -#ifdef __cplusplus -#ifndef wxSetlocale -class WXDLLIMPEXP_BASE wxWCharBuffer; -WXDLLIMPEXP_BASE wxWCharBuffer wxSetlocale(int category, const wxChar *locale); -#endif -#endif - -/* stdio.h functions */ -#ifdef wxNEED_WX_STDIO_H - #include - WXDLLIMPEXP_BASE FILE * wxFopen(const wxChar *path, const wxChar *mode); - WXDLLIMPEXP_BASE FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); - WXDLLIMPEXP_BASE int wxRemove(const wxChar *path); - WXDLLIMPEXP_BASE int wxRename(const wxChar *oldpath, const wxChar *newpath); - - /* *printf() family is handled separately */ -#endif /* wxNEED_WX_STDIO_H */ - - -/* stdlib.h functions */ -#ifndef wxAtof -WXDLLIMPEXP_BASE double wxAtof(const wxChar *psz); -#endif - -/* - mingw32 doesn't provide _tsystem() even though it does provide all the other - stdlib.h functions wrappers so check for it separately: - */ -#if defined(__MINGW32__) && wxUSE_UNICODE && !defined(_tsystem) - #define wxNEED_WXSYSTEM -#endif - -#ifdef wxNEED_WX_STDLIB_H -WXDLLIMPEXP_BASE int wxAtoi(const wxChar *psz); -WXDLLIMPEXP_BASE long wxAtol(const wxChar *psz); -WXDLLIMPEXP_BASE wxChar * wxGetenv(const wxChar *name); -#define wxNEED_WXSYSTEM -#endif - -#ifdef wxNEED_WXSYSTEM -WXDLLIMPEXP_BASE int wxSystem(const wxChar *psz); -#endif - - -/* time.h functions */ -#ifdef wxNEED_WX_TIME_H -#if defined(__MWERKS__) && defined(macintosh) - #include -#endif - /*silent gabby compilers*/ - struct tm; - WXDLLIMPEXP_BASE size_t wxStrftime(wxChar *s, size_t max, - const wxChar *fmt, const struct tm *tm); -#endif /* wxNEED_WX_TIME_H */ - -#ifndef wxCtime -#include -WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep); -#endif - - -/* missing functions in some WinCE versions */ -#ifdef _WIN32_WCE -#if (_WIN32_WCE < 300) -WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); -#endif -#endif /* _WIN32_WCE */ - -/* multibyte to wide char conversion functions and macros */ - -#if wxUSE_WCHAR_T - /* multibyte<->widechar conversion */ - WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); - WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); - - #if wxUSE_UNICODE - #define wxMB2WX wxMB2WC - #define wxWX2MB wxWC2MB - #define wxWC2WX wxStrncpy - #define wxWX2WC wxStrncpy - #else - #define wxMB2WX wxStrncpy - #define wxWX2MB wxStrncpy - #define wxWC2WX wxWC2MB - #define wxWX2WC wxMB2WC - #endif -#else /* !wxUSE_UNICODE */ -/* Why is this here? -#error ha */ - /* No wxUSE_WCHAR_T: we have to do something (JACS) */ - #define wxMB2WC wxStrncpy - #define wxWC2MB wxStrncpy - #define wxMB2WX wxStrncpy - #define wxWX2MB wxStrncpy - #define wxWC2WX wxWC2MB - #define wxWX2WC wxMB2WC -#endif - -/* - RN: The following are not normal versions of memcpy et al., rather - these are either char or widechar versions depending on - if unicode is used or not. -*/ - -#ifdef __cplusplus - - // - // RN: We could do the usual tricky compiler detection here, - // and use their variant (such as wmemchr, etc.). The problem - // is that these functions are quite rare, even though they are - // part of the current POSIX standard. In addition, most compilers - // (including even MSC) inline them just like we do right in their - // headers. - // - #include - #if wxUSE_UNICODE - //implement our own wmem variants - inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) - { - for(;l && *s != c;--l, ++s) {} - - if(l) - return (wxChar*)s; - return NULL; - } - - inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) - { - for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} - - if(len) - return *sz1 < *sz2 ? -1 : *sz1 > *sz2; - else - return 0; - } - - inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) - { - wxChar* szRet = szOut; - - while (len--) - *szOut++ = cIn; - - return szRet; - } - #else /* !wxUSE_UNICODE */ - #if wxABI_VERSION >= 20805 - // for compatibility with earlier versions, these functions take - // "void *" but in the next wx version they will take "char *" so - // don't use them with void pointers (use the standard memxxx() - // with them) - inline char* wxTmemchr(const void* s, int c, size_t len) - { return (char*)memchr(s, c, len); } - inline int wxTmemcmp(const void* sz1, const void* sz2, size_t len) - { return memcmp(sz1, sz2, len); } - inline char* wxTmemcpy(void* szOut, const void* szIn, size_t len) - { return (char*)memcpy(szOut, szIn, len); } - inline char* wxTmemmove(void* szOut, const void* szIn, size_t len) - { return (char*)memmove(szOut, szIn, len); } - inline char* wxTmemset(void* szOut, int c, size_t len) - { return (char*)memset(szOut, c, len); } - #else - # define wxTmemchr memchr - # define wxTmemcmp memcmp - # define wxTmemcpy memcpy - # define wxTmemmove memmove - # define wxTmemset memset - #endif - #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */ - -#endif /*__cplusplus*/ - - -#endif /* _WX_WXCHAR_H_ */ - diff --git a/Source/3rdParty/wx/include/wx/wxprec.h b/Source/3rdParty/wx/include/wx/wxprec.h deleted file mode 100644 index 184914e6c..000000000 --- a/Source/3rdParty/wx/include/wx/wxprec.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxprec.h -// Purpose: Includes the appropriate files for precompiled headers -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: wxprec.h 39484 2006-05-31 12:18:02Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// compiler detection; includes setup.h -#include "wx/defs.h" - -// check if to use precompiled headers: do it for most Windows compilers unless -// explicitly disabled by defining NOPCH -#if defined(__VISUALC__) || \ - defined(__DMC__) || \ - defined(__VISAGECPP__) || \ - defined(__MWERKS__) || \ - defined(__WATCOMC__) || \ - defined(__BORLANDC__) - - - // If user did not request NOCPH and we're not building using configure - // then assume user wants precompiled headers. - #if !defined(NOPCH) && !defined(__WX_SETUP_H__) - #define WX_PRECOMP - #endif -#endif - -// For some reason, this must be defined for common dialogs to work. -#ifdef __WATCOMC__ - #define INCLUDE_COMMDLG_H 1 -#endif - -#ifdef WX_PRECOMP - -// include "wx/wxchar.h" first to ensure that UNICODE macro is correctly set -// _before_ including -#include "wx/wxchar.h" - -// include standard Windows headers -#if defined(__WXMSW__) - #include "wx/msw/wrapwin.h" - #include "wx/msw/wrapcctl.h" - #include "wx/msw/wrapcdlg.h" - #include "wx/msw/private.h" - #include "wx/msw/missing.h" -#endif - -// include all PalmOS headers at once -#ifdef __WXPALMOS__ -# include -#endif - -// include -#ifdef __OS2__ -# include "wx/os2/private.h" -#endif - -// include mgl headers -#ifdef __WXMGL__ -# include "wx/mgl/private.h" -#endif - -// include the most common wx headers -#include "wx/wx.h" - -#endif // WX_PRECOMP diff --git a/Source/3rdParty/wx/include/wx/xpmdecod.h b/Source/3rdParty/wx/include/wx/xpmdecod.h deleted file mode 100644 index 8cb516ae3..000000000 --- a/Source/3rdParty/wx/include/wx/xpmdecod.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xpmdecod.h -// Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap -// Author: Vaclav Slavik -// CVS-ID: $Id: xpmdecod.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XPMDECOD_H_ -#define _WX_XPMDECOD_H_ - -#include "wx/defs.h" - -#if wxUSE_IMAGE && wxUSE_XPM - -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_BASE wxInputStream; - -// -------------------------------------------------------------------------- -// wxXPMDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxXPMDecoder -{ -public: - // constructor, destructor, etc. - wxXPMDecoder() {} - ~wxXPMDecoder() {} - -#if wxUSE_STREAMS - // Is the stream XPM file? - bool CanRead(wxInputStream& stream); - // Read XPM file from the stream, parse it and create image from it - wxImage ReadFile(wxInputStream& stream); -#endif - // Read directly from XPM data (as passed to wxBitmap ctor): - wxImage ReadData(const char* const* xpm_data); -#ifdef __BORLANDC__ - // needed for Borland 5.5 - wxImage ReadData(char** xpm_data) { return ReadData(wx_const_cast(const char* const*, xpm_data)); } -#endif -}; - -#endif // wxUSE_IMAGE && wxUSE_XPM - -#endif // _WX_XPM_H_ diff --git a/Source/3rdParty/wx/include/wx/xti.h b/Source/3rdParty/wx/include/wx/xti.h deleted file mode 100644 index 5fd35efb4..000000000 --- a/Source/3rdParty/wx/include/wx/xti.h +++ /dev/null @@ -1,2102 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xti.h -// Purpose: runtime metadata information (extended class info) -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xti.h 52488 2008-03-14 14:13:05Z JS $ -// Copyright: (c) 1997 Julian Smart -// (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XTIH__ -#define _WX_XTIH__ - -// We want to support properties, event sources and events sinks through -// explicit declarations, using templates and specialization to make the -// effort as painless as possible. -// -// This means we have the following domains : -// -// - Type Information for categorizing built in types as well as custom types -// this includes information about enums, their values and names -// - Type safe value storage : a kind of wxVariant, called right now wxxVariant -// which will be merged with wxVariant -// - Property Information and Property Accessors providing access to a class' -// values and exposed event delegates -// - Information about event handlers -// - extended Class Information for accessing all these - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/memory.h" -#include "wx/flags.h" -#include "wx/string.h" -#include "wx/arrstr.h" -#include "wx/hashmap.h" -#include "wx/log.h" -#include "wx/intl.h" - -#include - -// we will move this later to defs.h - -#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3 , 4 ) -# define wxUSE_MEMBER_TEMPLATES 0 -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxUSE_MEMBER_TEMPLATES 0 -# define wxUSE_FUNC_TEMPLATE_POINTER 0 -#endif - -#ifndef wxUSE_MEMBER_TEMPLATES -# define wxUSE_MEMBER_TEMPLATES 1 -#endif - -#ifndef wxUSE_FUNC_TEMPLATE_POINTER -# define wxUSE_FUNC_TEMPLATE_POINTER 1 -#endif - -#if wxUSE_MEMBER_TEMPLATES -# define wxTEMPLATED_MEMBER_CALL( method , type ) method() -# define wxTEMPLATED_MEMBER_FIX( type ) -#else -# define wxTEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL) -# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxTEMPLATED_FUNCTION_FIX( type ) , wxTEMPLATED_MEMBER_FIX(type) -# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; -#else -# define wxTEMPLATED_FUNCTION_FIX( type ) -# define wxINFUNC_CLASS_TYPE_FIX( type ) -#endif - -#define EMPTY_MACROVALUE /**/ - -class WXDLLIMPEXP_BASE wxObject; -class WXDLLIMPEXP_BASE wxClassInfo; -class WXDLLIMPEXP_BASE wxDynamicClassInfo; -class WXDLLIMPEXP_BASE wxHashTable; -class WXDLLIMPEXP_BASE wxObjectRefData; -class WXDLLIMPEXP_BASE wxEvent; -class WXDLLIMPEXP_BASE wxEvtHandler; - -typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); - -#if wxUSE_FUNC_TEMPLATE_POINTER -# define wxTO_STRING(type) wxToStringConverter -# define wxTO_STRING_IMP(type) -# define wxFROM_STRING(type) wxFromStringConverter -# define wxFROM_STRING_IMP(type) -#else -# define wxTO_STRING(type) ToString##type -# define wxTO_STRING_IMP(type) inline void ToString##type( const wxxVariant& data , wxString &result ) { wxToStringConverter(data, result); } -# define wxFROM_STRING(type) FromString##type -# define wxFROM_STRING_IMP(type) inline void FromString##type( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } -#endif - -// ---------------------------------------------------------------------------- -// Enum Support -// -// In the header files there would no change from pure c++ code, in the -// implementation, an enum would have -// to be enumerated eg : -// -// wxBEGIN_ENUM( wxFlavor ) -// wxENUM_MEMBER( Vanilla ) -// wxENUM_MEMBER( Chocolate ) -// wxENUM_MEMBER( Strawberry ) -// wxEND_ENUM( wxFlavor ) -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxEnumMemberData -{ - const wxChar* m_name; - int m_value; -}; - -class WXDLLIMPEXP_BASE wxEnumData -{ -public : - wxEnumData( wxEnumMemberData* data ) ; - - // returns true if the member has been found and sets the int value - // pointed to accordingly (if ptr != null ) - // if not found returns false, value left unchanged - bool HasEnumMemberValue( const wxChar *name , int *value = NULL ) const ; - - // returns the value of the member, if not found in debug mode an - // assert is issued, in release 0 is returned - int GetEnumMemberValue(const wxChar *name ) const ; - - // returns the name of the enum member having the passed in value - // returns an emtpy string if not found - const wxChar *GetEnumMemberName(int value) const ; - - // returns the number of members in this enum - int GetEnumCount() const { return m_count ; } - - // returns the value of the nth member - int GetEnumMemberValueByIndex( int n ) const ; - - // returns the value of the nth member - const wxChar *GetEnumMemberNameByIndex( int n ) const ; -private : - wxEnumMemberData *m_members; - int m_count ; -}; - -#define wxBEGIN_ENUM( e ) \ - wxEnumMemberData s_enumDataMembers##e[] = { - -#define wxENUM_MEMBER( v ) { wxT(#v), v } , - -#define wxEND_ENUM( e ) { NULL , 0 } } ; \ - wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ - wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \ - template<> void wxStringReadValue(const wxString& s , e &data ) \ -{ \ - data = (e) s_enumData##e.GetEnumMemberValue(s) ; \ -} \ - template<> void wxStringWriteValue(wxString &s , const e &data ) \ -{ \ - s = s_enumData##e.GetEnumMemberName((int)data) ; \ -} \ - void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant((e)data) ;} \ - void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e) ;} \ - wxTO_STRING_IMP( e ) \ - wxFROM_STRING_IMP( e ) \ - wxEnumTypeInfo s_typeInfo##e(wxT_ENUM , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e , typeid(e).name() ) ; - -// ---------------------------------------------------------------------------- -// Set Support -// -// in the header : -// -// enum wxFlavor -// { -// Vanilla, -// Chocolate, -// Strawberry, -// }; -// -// typedef wxBitset wxCoupe ; -// -// in the implementation file : -// -// wxBEGIN_ENUM( wxFlavor ) -// wxENUM_MEMBER( Vanilla ) -// wxENUM_MEMBER( Chocolate ) -// wxENUM_MEMBER( Strawberry ) -// wxEND_ENUM( wxFlavor ) -// -// wxIMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor ) -// -// implementation note : no partial specialization for streaming, but a delegation to a -// different class -// -// ---------------------------------------------------------------------------- - -// in order to remove dependancy on string tokenizer -void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s , wxArrayString &array ) ; - -template -void wxSetFromString(const wxString &s , wxBitset &data ) -{ - wxEnumData* edata = wxGetEnumData((e) 0) ; - data.reset() ; - - wxArrayString array ; - wxSetStringToArray( s , array ) ; - wxString flag; - for ( int i = 0 ; i < array.Count() ; ++i ) - { - flag = array[i] ; - int ivalue ; - if ( edata->HasEnumMemberValue( flag , &ivalue ) ) - { - data.set( (e) ivalue ) ; - } - } -} - -template -void wxSetToString( wxString &s , const wxBitset &data ) -{ - wxEnumData* edata = wxGetEnumData((e) 0) ; - int count = edata->GetEnumCount() ; - int i ; - s.Clear() ; - for ( i = 0 ; i < count ; i++ ) - { - e value = (e) edata->GetEnumMemberValueByIndex(i) ; - if ( data.test( value ) ) - { - // this could also be done by the templated calls - if ( !s.empty() ) - s +=wxT("|") ; - s += edata->GetEnumMemberNameByIndex(i) ; - } - } -} - -#define wxIMPLEMENT_SET_STREAMING(SetName,e) \ - template<> void wxStringReadValue(const wxString &s , wxBitset &data ) \ -{ \ - wxSetFromString( s , data ) ; \ -} \ - template<> void wxStringWriteValue( wxString &s , const wxBitset &data ) \ -{ \ - wxSetToString( s , data ) ; \ -} \ - void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \ - void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , SetName).to_ulong() ;} \ - wxTO_STRING_IMP( SetName ) \ - wxFROM_STRING_IMP( SetName ) \ - wxEnumTypeInfo s_typeInfo##SetName(wxT_SET , &s_enumData##e , &wxTO_STRING( SetName ) , &wxFROM_STRING( SetName ) , &ToLong##SetName , &FromLong##SetName, typeid(SetName).name() ) ; \ -} - -template -void wxFlagsFromString(const wxString &s , e &data ) -{ - wxEnumData* edata = wxGetEnumData((e*) 0) ; - data.m_data = 0 ; - - wxArrayString array ; - wxSetStringToArray( s , array ) ; - wxString flag; - for ( size_t i = 0 ; i < array.Count() ; ++i ) - { - flag = array[i] ; - int ivalue ; - if ( edata->HasEnumMemberValue( flag , &ivalue ) ) - { - data.m_data |= ivalue ; - } - } -} - -template -void wxFlagsToString( wxString &s , const e& data ) -{ - wxEnumData* edata = wxGetEnumData((e*) 0) ; - int count = edata->GetEnumCount() ; - int i ; - s.Clear() ; - long dataValue = data.m_data ; - for ( i = 0 ; i < count ; i++ ) - { - int value = edata->GetEnumMemberValueByIndex(i) ; - // make this to allow for multi-bit constants to work - if ( value && ( dataValue & value ) == value ) - { - // clear the flags we just set - dataValue &= ~value ; - // this could also be done by the templated calls - if ( !s.empty() ) - s +=wxT("|") ; - s += edata->GetEnumMemberNameByIndex(i) ; - } - } -} - -#define wxBEGIN_FLAGS( e ) \ - wxEnumMemberData s_enumDataMembers##e[] = { - -#define wxFLAGS_MEMBER( v ) { wxT(#v), v } , - -#define wxEND_FLAGS( e ) { NULL , 0 } } ; \ - wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ - wxEnumData *wxGetEnumData(e*) { return &s_enumData##e ; } \ - template<> void wxStringReadValue(const wxString &s , e &data ) \ -{ \ - wxFlagsFromString( s , data ) ; \ -} \ - template<> void wxStringWriteValue( wxString &s , const e& data ) \ -{ \ - wxFlagsToString( s , data ) ; \ -} \ - void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \ - void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e).m_data ;} \ - wxTO_STRING_IMP( e ) \ - wxFROM_STRING_IMP( e ) \ - wxEnumTypeInfo s_typeInfo##e(wxT_SET , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e, typeid(e).name() ) ; -// ---------------------------------------------------------------------------- -// Type Information -// ---------------------------------------------------------------------------- -// -// -// All data exposed by the RTTI is characterized using the following classes. -// The first characterization is done by wxTypeKind. All enums up to and including -// wxT_CUSTOM represent so called simple types. These cannot be divided any further. -// They can be converted to and from wxStrings, that's all. - - -enum wxTypeKind -{ - wxT_VOID = 0, // unknown type - wxT_BOOL, - wxT_CHAR, - wxT_UCHAR, - wxT_INT, - wxT_UINT, - wxT_LONG, - wxT_ULONG, - wxT_FLOAT, - wxT_DOUBLE, - wxT_STRING, // must be wxString - wxT_SET, // must be wxBitset<> template - wxT_ENUM, - wxT_CUSTOM, // user defined type (e.g. wxPoint) - - wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM , - - wxT_OBJECT_PTR, // object reference - wxT_OBJECT , // embedded object - wxT_COLLECTION , // collection - - wxT_DELEGATE , // for connecting against an event source - - wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging -}; - -class WXDLLIMPEXP_BASE wxxVariant ; -class WXDLLIMPEXP_BASE wxTypeInfo ; - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo* , wxTypeInfoMap , class WXDLLIMPEXP_BASE ) ; - -class WXDLLIMPEXP_BASE wxTypeInfo -{ -public : - typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ; - typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ; - - wxTypeInfo(wxTypeKind kind, - converterToString_t to = NULL, converterFromString_t from = NULL, - const wxString &name = wxEmptyString): - m_toString(to), m_fromString(from), m_kind(kind), m_name(name) - { - Register(); - } -#if wxUSE_UNICODE - wxTypeInfo(wxTypeKind kind, - converterToString_t to, converterFromString_t from, - const char *name): - m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) - { - Register(); - } -#endif - - virtual ~wxTypeInfo() - { - Unregister() ; - } - - // return the kind of this type (wxT_... constants) - wxTypeKind GetKind() const { return m_kind ; } - - // returns the unique name of this type - const wxString& GetTypeName() const { return m_name ; } - - // is this type a delegate type - bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; } - - // is this type a custom type - bool IsCustomType() const { return m_kind == wxT_CUSTOM ; } - - // is this type an object type - bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; } - - // can the content of this type be converted to and from strings ? - bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; } - - // convert a wxxVariant holding data of this type into a string - void ConvertToString( const wxxVariant& data , wxString &result ) const - - { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } - - // convert a string into a wxxVariant holding the corresponding data in this type - void ConvertFromString( const wxString& data , wxxVariant &result ) const - { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } - -#if wxUSE_UNICODE - static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } -#endif - static wxTypeInfo *FindType(const wxChar *typeName); - -private : - - void Register(); - void Unregister(); - - converterToString_t m_toString ; - converterFromString_t m_fromString ; - - static wxTypeInfoMap* ms_typeTable ; - - wxTypeKind m_kind; - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo -{ -public : - wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString ) : - wxTypeInfo( kind , to , from , name ) - { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } -#if wxUSE_UNICODE - wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to , converterFromString_t from , const char *name ) : - wxTypeInfo( kind , to , from , name ) - { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } -#endif -} ; - -class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo -{ -public : - wxCustomTypeInfo( const wxString &name , converterToString_t to , converterFromString_t from ) : - wxTypeInfo( wxT_CUSTOM , to , from , name ) - {} -#if wxUSE_UNICODE - wxCustomTypeInfo( const char *name , converterToString_t to , converterFromString_t from ) : - wxTypeInfo( wxT_CUSTOM , to , from , name ) - {} -#endif -} ; - -class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo -{ -public : - typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ; - typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ; - - wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , - converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name ) : - wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) - { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} - -#if wxUSE_UNICODE - wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , - converterToLong_t toLong , converterFromLong_t fromLong , const char * name ) : - wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) - { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} -#endif - const wxEnumData* GetEnumData() const { return m_enumInfo ; } - - // convert a wxxVariant holding data of this type into a long - void ConvertToLong( const wxxVariant& data , long &result ) const - - { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; } - - // convert a long into a wxxVariant holding the corresponding data in this type - void ConvertFromLong( long data , wxxVariant &result ) const - { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;} - -private : - converterToLong_t m_toLong ; - converterFromLong_t m_fromLong ; - - wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET -} ; - -class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo -{ -public : - wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString) ; -#if wxUSE_UNICODE - wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name ) ; -#endif - const wxClassInfo *GetClassInfo() const { return m_classInfo ; } -private : - wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL -} ; - -class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo -{ -public : - wxCollectionTypeInfo( const wxString &elementName , converterToString_t to , converterFromString_t from , const wxString &name) : - wxTypeInfo( wxT_COLLECTION , to , from , name ) - { m_elementTypeName = elementName ; m_elementType = NULL ;} -#if wxUSE_UNICODE - wxCollectionTypeInfo( const char *elementName , converterToString_t to , converterFromString_t from , const char *name ) : - wxTypeInfo( wxT_COLLECTION , to , from , name ) - { m_elementTypeName = wxString::FromAscii( elementName ) ; m_elementType = NULL ;} -#endif - const wxTypeInfo* GetElementType() const - { - if ( m_elementType == NULL ) - m_elementType = wxTypeInfo::FindType( m_elementTypeName ) ; - return m_elementType ; } -private : - mutable wxTypeInfo * m_elementType ; - wxString m_elementTypeName ; -} ; - -// a delegate is an exposed event source - -class WXDLLIMPEXP_BASE wxDelegateTypeInfo : public wxTypeInfo -{ -public : - wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; - wxDelegateTypeInfo( int eventType , int lastEventType, wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; - int GetEventType() const { return m_eventType ; } - int GetLastEventType() const { return m_lastEventType ; } - const wxClassInfo* GetEventClass() const { return m_eventClass ; } -private : - const wxClassInfo *m_eventClass; // (extended will merge into classinfo) - int m_eventType ; - int m_lastEventType ; -} ; - -template const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()) ; } - -// this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type - -#if wxUSE_FUNC_TEMPLATE_POINTER -#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ - wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &toString , &fromString) ; -#else -#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ - void ToString##e( const wxxVariant& data , wxString &result ) { toString(data, result); } \ - void FromString##e( const wxString& data , wxxVariant &result ) { fromString(data, result); } \ - wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &ToString##e , &FromString##e) ; -#endif - -#define wxCOLLECTION_TYPE_INFO( element , collection ) \ - wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ; - -// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs, currently -// we don't have to play tricks, but if we will have to according to the compiler, we will use that macro for that - -#define wxILLEGAL_TYPE_SPECIALIZATION( a ) - -// ---------------------------------------------------------------------------- -// wxxVariant as typesafe data holder -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxxVariantData -{ -public: - virtual ~wxxVariantData() {} - - // return a heap allocated duplicate - virtual wxxVariantData* Clone() const = 0 ; - - // returns the type info of the contentc - virtual const wxTypeInfo* GetTypeInfo() const = 0 ; -} ; - -template class wxxVariantDataT : public wxxVariantData -{ -public: - wxxVariantDataT(const T& d) : m_data(d) {} - virtual ~wxxVariantDataT() {} - - // get a ref to the stored data - T & Get() { return m_data; } - - // get a const ref to the stored data - const T & Get() const { return m_data; } - - // set the data - void Set(const T& d) { m_data = d; } - - // return a heap allocated duplicate - virtual wxxVariantData* Clone() const { return new wxxVariantDataT( Get() ) ; } - - // returns the type info of the contentc - virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ) ; } - -private: - T m_data; -}; - -class WXDLLIMPEXP_BASE wxxVariant -{ -public : - wxxVariant() { m_data = NULL ; } - wxxVariant( wxxVariantData* data , const wxString& name = wxEmptyString ) : m_data(data) , m_name(name) {} - wxxVariant( const wxxVariant &d ) { if ( d.m_data ) m_data = d.m_data->Clone() ; else m_data = NULL ; m_name = d.m_name ; } - - template wxxVariant( const T& data , const wxString& name = wxEmptyString ) : - m_data(new wxxVariantDataT(data) ), m_name(name) {} - - ~wxxVariant() { delete m_data ; } - - // get a ref to the stored data - template T& Get(wxTEMPLATED_MEMBER_FIX(T)) - { - wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; - return dataptr->Get() ; - } - - // get a ref to the stored data - template const T& Get(wxTEMPLATED_MEMBER_FIX(T)) const - { - const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; - return dataptr->Get() ; - } - - bool IsEmpty() const { return m_data == NULL ; } - - template bool HasData(wxTEMPLATED_MEMBER_FIX(T)) const - { - const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - return dataptr != NULL ; - } - - // stores the data - template void Set(const T& data) const - { - delete m_data ; - m_data = new wxxVariantDataT(data) ; - } - - wxxVariant& operator=(const wxxVariant &d) - { - delete m_data; - m_data = d.m_data ? d.m_data->Clone() : NULL ; - m_name = d.m_name ; - return *this ; - } - - // gets the stored data casted to a wxObject* , returning NULL if cast is not possible - wxObject* GetAsObject() ; - - // get the typeinfo of the stored object - const wxTypeInfo* GetTypeInfo() const { return m_data->GetTypeInfo() ; } - - // returns this value as string - wxString GetAsString() const - { - wxString s ; - GetTypeInfo()->ConvertToString( *this , s ) ; - return s ; - } - const wxString& GetName() const { return m_name ; } -private : - wxxVariantData* m_data ; - wxString m_name ; -} ; - -#include "wx/dynarray.h" - -WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE); - -// templated streaming, every type must have their specialization for these methods - -template -void wxStringReadValue( const wxString &s , T &data ); - -template -void wxStringWriteValue( wxString &s , const T &data); - -template -void wxToStringConverter( const wxxVariant &v, wxString &s wxTEMPLATED_FUNCTION_FIX(T)) { wxStringWriteValue( s , v.wxTEMPLATED_MEMBER_CALL(Get , T) ) ; } - -template -void wxFromStringConverter( const wxString &s, wxxVariant &v wxTEMPLATED_FUNCTION_FIX(T)) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } - -// ---------------------------------------------------------------------------- -// Property Support -// -// wxPropertyInfo is used to inquire of the property by name. It doesn't -// provide access to the property, only information about it. If you -// want access, look at wxPropertyAccessor. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSetter -{ -public: - wxSetter( const wxString name ) { m_name = name ; } - virtual ~wxSetter() {} - virtual void Set( wxObject *object, const wxxVariant &variantValue ) const = 0; - const wxString& GetName() const { return m_name ; } -private: - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxGetter -{ -public: - wxGetter( const wxString name ) { m_name = name ; } - virtual ~wxGetter() {} - virtual void Get( const wxObject *object , wxxVariant& result) const = 0; - const wxString& GetName() const { return m_name ; } -private: - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxCollectionGetter -{ -public : - wxCollectionGetter( const wxString name ) { m_name = name ; } - virtual ~wxCollectionGetter() {} - virtual void Get( const wxObject *object , wxxVariantArray& result) const = 0; - const wxString& GetName() const { return m_name ; } -private : - wxString m_name ; -} ; - -template void WXDLLIMPEXP_BASE wxCollectionToVariantArray( const coll_t& coll , wxxVariantArray& result ) ; - -class WXDLLIMPEXP_BASE wxAdder -{ -public : - wxAdder( const wxString name ) { m_name = name ; } - virtual ~wxAdder() {} - virtual void Add( wxObject *object, const wxxVariant &variantValue ) const= 0; - const wxString& GetName() const { return m_name ; } -private : - wxString m_name ; -} ; - - -#define wxSETTER( property, Klass, valueType, setterMethod ) \ -class wxSetter##property : public wxSetter \ -{ \ -public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxSetter##property() : wxSetter( wxT(#setterMethod) ) {} \ - virtual ~wxSetter##property() {} \ - void Set( wxObject *object, const wxxVariant &variantValue ) const \ -{ \ - Klass *obj = dynamic_cast(object) ; \ - if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ - obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ - else \ - obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ -} \ -} ; - -#define wxGETTER( property, Klass, valueType , gettermethod ) \ -class wxGetter##property : public wxGetter \ -{ \ -public : \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxGetter##property() : wxGetter( wxT(#gettermethod) ) {} \ - virtual ~wxGetter##property() {} \ - void Get( const wxObject *object , wxxVariant &result) const \ -{ \ - const Klass *obj = dynamic_cast(object) ; \ - result = wxxVariant( obj->gettermethod() ) ; \ -} \ -} ; - -#define wxADDER( property, Klass, valueType , addermethod ) \ -class wxAdder##property : public wxAdder \ -{ \ -public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxAdder##property() : wxAdder( wxT(#addermethod) ) {} \ - virtual ~wxAdder##property() {} \ - void Add( wxObject *object, const wxxVariant &variantValue ) const \ -{ \ - Klass *obj = dynamic_cast(object) ; \ - if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ - obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ - else \ - obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ -} \ -} ; - -#define wxCOLLECTION_GETTER( property, Klass, valueType , gettermethod ) \ -class wxCollectionGetter##property : public wxCollectionGetter \ -{ \ -public : \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxCollectionGetter##property() : wxCollectionGetter( wxT(#gettermethod) ) {} \ - virtual ~wxCollectionGetter##property() {} \ - void Get( const wxObject *object , wxxVariantArray &result) const \ -{ \ - const Klass *obj = dynamic_cast(object) ; \ - wxCollectionToVariantArray( obj->gettermethod() , result ) ; \ -} \ -} ; - -class WXDLLIMPEXP_BASE wxPropertyAccessor -{ -public : - wxPropertyAccessor( wxSetter *setter , wxGetter *getter , wxAdder *adder , wxCollectionGetter *collectionGetter ) - { m_setter = setter ; m_getter = getter ; m_adder = adder ; m_collectionGetter = collectionGetter ;} - - virtual ~wxPropertyAccessor() {} - - // Setting a simple property (non-collection) - virtual void SetProperty(wxObject *object, const wxxVariant &value) const - { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( _("SetProperty called w/o valid setter") ) ;} - - // Getting a simple property (non-collection) - virtual void GetProperty(const wxObject *object, wxxVariant &result) const - { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;} - - // Adding an element to a collection property - virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const - { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;} - - // Getting a collection property - virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const - { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;} - - virtual bool HasSetter() const { return m_setter != NULL ; } - virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } - virtual bool HasGetter() const { return m_getter != NULL ; } - virtual bool HasAdder() const { return m_adder != NULL ; } - - virtual const wxString& GetCollectionGetterName() const - { return m_collectionGetter->GetName() ; } - virtual const wxString& GetGetterName() const - { return m_getter->GetName() ; } - virtual const wxString& GetSetterName() const - { return m_setter->GetName() ; } - virtual const wxString& GetAdderName() const - { return m_adder->GetName() ; } - -protected : - wxSetter *m_setter ; - wxAdder *m_adder ; - wxGetter *m_getter ; - wxCollectionGetter* m_collectionGetter ; -}; - -class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor -{ -public : - wxGenericPropertyAccessor( const wxString &propName ) ; - virtual ~wxGenericPropertyAccessor() ; - - void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName), - const wxString& newName ) - { - wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ; - } - virtual bool HasSetter() const { return true ; } - virtual bool HasGetter() const { return true ; } - virtual bool HasAdder() const { return false ; } - virtual bool HasCollectionGetter() const { return false ; } - - virtual const wxString& GetGetterName() const - { return m_getterName ; } - virtual const wxString& GetSetterName() const - { return m_setterName ; } - - virtual void SetProperty(wxObject *object, const wxxVariant &value) const ; - virtual void GetProperty(const wxObject *object, wxxVariant &value) const ; - - // Adding an element to a collection property - virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const - { wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;} - - // Getting a collection property - virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const - { wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;} -private : - struct wxGenericPropertyAccessorInternal ; - wxGenericPropertyAccessorInternal* m_data ; - wxString m_propertyName ; - wxString m_setterName ; - wxString m_getterName ; -} ; - -typedef long wxPropertyInfoFlags ; -enum { - // will be removed in future releases - wxPROP_DEPRECATED = 0x00000001 , - // object graph property, will be streamed with priority (after constructor properties) - wxPROP_OBJECT_GRAPH = 0x00000002 , - // this will only be streamed out and in as enum/set, the internal representation is still a long - wxPROP_ENUM_STORE_LONG = 0x00000004 , - // don't stream out this property, needed eg to avoid streaming out children that are always created by their parents - wxPROP_DONT_STREAM = 0x00000008 , -} ; - -class WXDLLIMPEXP_BASE wxPropertyInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public : - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - const wxString& typeName, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(typeName) , - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - -#if wxUSE_UNICODE - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - const char* typeName, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(wxString::FromAscii(typeName)) , - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } -#endif - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - wxDelegateTypeInfo* type, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(type), - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, const wxString& name, - const wxString& collectionTypeName, - const wxString& elementTypeName, - wxPropertyAccessor *accessor, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(collectionTypeName) , - m_collectionElementTypeInfo(NULL), - m_collectionElementTypeName(elementTypeName), - m_accessor(accessor) , - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - -#if wxUSE_UNICODE - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, const wxString& name, - const char* collectionTypeName, - const char* elementTypeName, - wxPropertyAccessor *accessor, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(wxString::FromAscii(collectionTypeName)) , - m_collectionElementTypeInfo(NULL), - m_collectionElementTypeName(wxString::FromAscii(elementTypeName)), - m_accessor(accessor) , - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } -#endif - ~wxPropertyInfo() ; - - // return the class this property is declared in - const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } - - // return the name of this property - const wxString& GetName() const { return m_name ; } - - // returns the flags of this property - wxPropertyInfoFlags GetFlags() const { return m_flags ;} - - // returns the short help string of this property - const wxString& GetHelpString() const { return m_helpString ; } - - // returns the group string of this property - const wxString& GetGroupString() const { return m_groupString ; } - - // return the element type info of this property (for collections, otherwise NULL) - const wxTypeInfo * GetCollectionElementTypeInfo() const - { - if ( m_collectionElementTypeInfo == NULL ) - m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName) ; - return m_collectionElementTypeInfo ; - } - - // return the type info of this property - const wxTypeInfo * GetTypeInfo() const - { - if ( m_typeInfo == NULL ) - m_typeInfo = wxTypeInfo::FindType(m_typeName) ; - return m_typeInfo ; - } - - // return the accessor for this property - wxPropertyAccessor* GetAccessor() const { return m_accessor ; } - - // returns NULL if this is the last property of this class - wxPropertyInfo* GetNext() const { return m_next ; } - - // returns the default value of this property, its kind may be wxT_VOID if it is not valid - wxxVariant GetDefaultValue() const { return m_defaultValue ; } -private : - void Insert(wxPropertyInfo* &iter) - { - m_next = NULL ; - if ( iter == NULL ) - iter = this ; - else - { - wxPropertyInfo* i = iter ; - while( i->m_next ) - i = i->m_next ; - - i->m_next = this ; - } - } - - wxClassInfo* m_itsClass ; - wxString m_name ; - mutable wxTypeInfo* m_typeInfo ; - wxString m_typeName ; - mutable wxTypeInfo* m_collectionElementTypeInfo ; - wxString m_collectionElementTypeName ; - wxPropertyAccessor* m_accessor ; - wxxVariant m_defaultValue; - wxPropertyInfoFlags m_flags ; - wxString m_helpString ; - wxString m_groupString ; - // string representation of the default value - // to be assigned by the designer to the property - // when the component is dropped on the container. - wxPropertyInfo* m_next ; -}; - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo* , wxPropertyInfoMap , class WXDLLIMPEXP_BASE ) ; - -#define wxBEGIN_PROPERTIES_TABLE(theClass) \ - wxPropertyInfo *theClass::GetPropertiesStatic() \ -{ \ - typedef theClass class_t; \ - static wxPropertyInfo* first = NULL ; - -#define wxEND_PROPERTIES_TABLE() \ - return first ; } - -#define wxHIDE_PROPERTY( pname ) \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(void).name() ,NULL , wxxVariant() , wxPROP_DONT_STREAM , wxEmptyString , wxEmptyString ) ; - -#define wxPROPERTY( pname , type , setter , getter , defaultValue , flags , help , group) \ - wxSETTER( pname , class_t , type , setter ) \ - static wxSetter##pname _setter##pname ; \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue) , flags , group , help ) ; - -#define wxPROPERTY_FLAGS( pname , flags , type , setter , getter ,defaultValue , pflags , help , group) \ - wxSETTER( pname , class_t , type , setter ) \ - static wxSetter##pname _setter##pname ; \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; - -#define wxREADONLY_PROPERTY( pname , type , getter ,defaultValue , flags , help , group) \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue), flags , help , group ) ; - -#define wxREADONLY_PROPERTY_FLAGS( pname , flags , type , getter ,defaultValue , pflags , help , group) \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; - -#define wxPROPERTY_COLLECTION( pname , colltype , addelemtype , adder , getter , flags , help , group ) \ - wxADDER( pname , class_t , addelemtype , adder ) \ - static wxAdder##pname _adder##pname ; \ - wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ - static wxCollectionGetter##pname _collectionGetter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , NULL ,&_adder##pname , &_collectionGetter##pname ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; - -#define wxREADONLY_PROPERTY_COLLECTION( pname , colltype , addelemtype , getter , flags , help , group) \ - wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ - static wxCollectionGetter##pname _collectionGetter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , NULL , NULL , &_collectionGetter##pname ) ; \ - static wxPropertyInfo _propertyInfo##pname( first ,class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; - - -#define wxEVENT_PROPERTY( name , eventType , eventClass ) \ - static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \ - static wxPropertyInfo _propertyInfo##name( first ,class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ - -#define wxEVENT_RANGE_PROPERTY( name , eventType , lastEventType , eventClass ) \ - static wxDelegateTypeInfo _typeInfo##name( eventType , lastEventType , CLASSINFO( eventClass ) ) ; \ - static wxPropertyInfo _propertyInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ - -// ---------------------------------------------------------------------------- -// Implementation Helper for Simple Properties -// ---------------------------------------------------------------------------- - -#define wxIMPLEMENT_PROPERTY(name, type) \ -private:\ - type m_##name; \ -public: \ - void Set##name( type const & p) { m_##name = p; } \ - type const & Get##name() const { return m_##name; } - -// ---------------------------------------------------------------------------- -// Handler Info -// -// this is describing an event sink -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxHandlerInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public : - wxHandlerInfo(wxHandlerInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - wxObjectEventFunction address, - const wxClassInfo* eventClassInfo) : - m_eventFunction(address), - m_name(name), - m_eventClassInfo(eventClassInfo) , - m_itsClass(itsClass) - { - m_next = NULL ; - if ( iter == NULL ) - iter = this ; - else - { - wxHandlerInfo* i = iter ; - while( i->m_next ) - i = i->m_next ; - - i->m_next = this ; - } - } - - ~wxHandlerInfo() ; - - // return the name of this handler - const wxString& GetName() const { return m_name ; } - - // return the class info of the event - const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo ; } - - // get the handler function pointer - wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; } - - // returns NULL if this is the last handler of this class - wxHandlerInfo* GetNext() const { return m_next ; } - - // return the class this property is declared in - const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } - -private : - wxObjectEventFunction m_eventFunction ; - wxString m_name; - const wxClassInfo* m_eventClassInfo ; - wxHandlerInfo* m_next ; - wxClassInfo* m_itsClass ; -}; - -#define wxHANDLER(name,eventClassType) \ - static wxHandlerInfo _handlerInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ; - -#define wxBEGIN_HANDLERS_TABLE(theClass) \ - wxHandlerInfo *theClass::GetHandlersStatic() \ -{ \ - typedef theClass class_t; \ - static wxHandlerInfo* first = NULL ; - -#define wxEND_HANDLERS_TABLE() \ - return first ; } - -// ---------------------------------------------------------------------------- -// Constructor Bridges -// -// allow to set up constructors with params during runtime -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConstructorBridge -{ -public : - virtual void Create(wxObject * &o, wxxVariant *args) = 0; -}; - -// a direct constructor bridge calls the operator new for this class and -// passes all params to the constructor. needed for classes that cannot be -// instantiated using alloc-create semantics -class WXDLLIMPEXP_BASE wxDirectConstructorBrigde : public wxConstructorBridge -{ -public : - virtual void Create(wxObject * &o, wxxVariant *args) = 0; -} ; - -// Creator Bridges for all Numbers of Params - -// no params - -template -struct wxConstructorBridge_0 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *) - { - Class *obj = dynamic_cast(o); - obj->Create(); - } -}; - -struct wxConstructorBridge_Dummy : public wxConstructorBridge -{ - void Create(wxObject *&, wxxVariant *) - { - } -} ; - -#define wxCONSTRUCTOR_0(klass) \ - wxConstructorBridge_0 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ - const int klass::ms_constructorPropertiesCount = 0 ; - -#define wxCONSTRUCTOR_DUMMY(klass) \ - wxConstructorBridge_Dummy constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ - const int klass::ms_constructorPropertiesCount = 0 ; - -// 1 param - -template -struct wxConstructorBridge_1 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) - ); - } -}; - -#define wxCONSTRUCTOR_1(klass,t0,v0) \ - wxConstructorBridge_1 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) } ; \ - const int klass::ms_constructorPropertiesCount = 1 ; - -// 2 params - -template -struct wxConstructorBridge_2 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) - ); - } -}; - -#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxConstructorBridge_2 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ - const int klass::ms_constructorPropertiesCount = 2; - -// direct constructor version - -template -struct wxDirectConstructorBridge_2 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxDirectConstructorBridge_2 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ - const int klass::ms_constructorPropertiesCount = 2; - - -// 3 params - -template -struct wxConstructorBridge_3 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) - ); - } -}; - -#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxConstructorBridge_3 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ - const int klass::ms_constructorPropertiesCount = 3 ; - -// direct constructor version - -template -struct wxDirectConstructorBridge_3 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxDirectConstructorBridge_3 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ - const int klass::ms_constructorPropertiesCount = 3; - -// 4 params - -template -struct wxConstructorBridge_4 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) - ); - } -}; - -#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ - wxConstructorBridge_4 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) } ; \ - const int klass::ms_constructorPropertiesCount = 4 ; - -// 5 params - -template -struct wxConstructorBridge_5 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) - ); - } -}; - -#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ - wxConstructorBridge_5 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) } ; \ - const int klass::ms_constructorPropertiesCount = 5; - -// 6 params - -template -struct wxConstructorBridge_6 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) - ); - } -}; - -#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxConstructorBridge_6 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ - const int klass::ms_constructorPropertiesCount = 6; - -// direct constructor version - -template -struct wxDirectConstructorBridge_6 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxDirectConstructorBridge_6 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ - const int klass::ms_constructorPropertiesCount = 6; - -// 7 params - -template -struct wxConstructorBridge_7 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , - args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) - ); - } -}; - -#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ - wxConstructorBridge_7 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) } ; \ - const int klass::ms_constructorPropertiesCount = 7; - -// 8 params - -template -struct wxConstructorBridge_8 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , - args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) , - args[7].wxTEMPLATED_MEMBER_CALL(Get , T7) - ); - } -}; - -#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ - wxConstructorBridge_8 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) , wxT(#v7) } ; \ - const int klass::ms_constructorPropertiesCount = 8; -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -typedef wxObject *(*wxObjectConstructorFn)(void); -typedef wxObject* (*wxVariantToObjectConverter)( wxxVariant &data ) ; -typedef wxxVariant (*wxObjectToVariantConverter)( wxObject* ) ; - -class WXDLLIMPEXP_BASE wxWriter; -class WXDLLIMPEXP_BASE wxPersister; - -typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxWriter * , wxPersister * , wxxVariantArray & ) ; - -class WXDLLIMPEXP_BASE wxClassInfo -{ - friend class WXDLLIMPEXP_BASE wxPropertyInfo ; - friend class WXDLLIMPEXP_BASE wxHandlerInfo ; -public: - wxClassInfo(const wxClassInfo **_Parents, - const wxChar *_UnitName, - const wxChar *_ClassName, - int size, - wxObjectConstructorFn ctor , - wxPropertyInfo *_Props , - wxHandlerInfo *_Handlers , - wxConstructorBridge* _Constructor , - const wxChar ** _ConstructorProperties , - const int _ConstructorPropertiesCount , - wxVariantToObjectConverter _PtrConverter1 , - wxVariantToObjectConverter _Converter2 , - wxObjectToVariantConverter _Converter3 , - wxObjectStreamingCallback _streamingCallback = NULL - ) : - - m_className(_ClassName), - m_objectSize(size), - m_objectConstructor(ctor), - m_next(sm_first), - m_firstProperty(_Props), - m_firstHandler(_Handlers), - m_parents(_Parents), - m_unitName(_UnitName), - m_constructor(_Constructor), - m_constructorProperties(_ConstructorProperties), - m_constructorPropertiesCount(_ConstructorPropertiesCount), - m_variantOfPtrToObjectConverter(_PtrConverter1), - m_variantToObjectConverter(_Converter2), - m_objectToVariantConverter(_Converter3), - m_streamingCallback(_streamingCallback) - { - sm_first = this; - Register() ; - } - - wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, - const wxClassInfo **_Parents) : - m_className(_ClassName), - m_objectSize(0), - m_objectConstructor(NULL), - m_next(sm_first), - m_firstProperty(NULL), - m_firstHandler(NULL), - m_parents(_Parents), - m_unitName(_UnitName), - m_constructor(NULL), - m_constructorProperties(NULL), - m_constructorPropertiesCount(0), - m_variantOfPtrToObjectConverter(NULL), - m_variantToObjectConverter(NULL), - m_objectToVariantConverter(NULL), - m_streamingCallback(NULL) - { - sm_first = this; - Register() ; - } - - virtual ~wxClassInfo() ; - - // allocates an instance of this class, this object does not have to be initialized or fully constructed - // as this call will be followed by a call to Create - virtual wxObject *AllocateObject() const { return m_objectConstructor ? (*m_objectConstructor)() : 0; } - - // 'old naming' for AllocateObject staying here for backward compatibility - wxObject *CreateObject() const { return AllocateObject() ; } - - // direct construction call for classes that cannot construct instances via alloc/create - wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const - { - if ( ParamCount != m_constructorPropertiesCount ) - { - wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ; - return NULL ; - } - wxObject *object = NULL ; - m_constructor->Create( object , Params ) ; - return object ; - } - - bool NeedsDirectConstruction() const { return dynamic_cast( m_constructor) != NULL ; } - - const wxChar *GetClassName() const { return m_className; } - const wxChar *GetBaseClassName1() const - { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } - const wxChar *GetBaseClassName2() const - { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } - const wxChar *GetIncludeName() const { return m_unitName ; } - const wxClassInfo **GetParents() const { return m_parents; } - int GetSize() const { return m_objectSize; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } - - wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } - static const wxClassInfo *GetFirst() { return sm_first; } - const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxChar *className); - - // Climb upwards through inheritance hierarchy. - // Dual inheritance is catered for. - - bool IsKindOf(const wxClassInfo *info) const - { - if ( info != 0 ) - { - if ( info == this ) - return true ; - - for ( int i = 0 ; m_parents[i] ; ++ i ) - { - if ( m_parents[i]->IsKindOf( info ) ) - return true ; - } - } - return false ; - } - - // if there is a callback registered with that class it will be called - // before this object will be written to disk, it can veto streaming out - // this object by returning false, if this class has not registered a - // callback, the search will go up the inheritance tree if no callback has - // been registered true will be returned by default - bool BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const ; - - // gets the streaming callback from this class or any superclass - wxObjectStreamingCallback GetStreamingCallback() const ; - -#if WXWIN_COMPATIBILITY_2_4 - // Initializes parent pointers and hash table for fast searching. - wxDEPRECATED( static void InitializeClasses() ); - // Cleans up hash table used for fast searching. - wxDEPRECATED( static void CleanUpClasses() ); -#endif - static void CleanUp(); - - // returns the first property - const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; } - - // returns the first handler - const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; } - - // Call the Create upon an instance of the class, in the end the object is fully - // initialized - virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const - { - if ( ParamCount != m_constructorPropertiesCount ) - { - wxLogError( _("Illegal Parameter Count for Create Method") ) ; - return ; - } - m_constructor->Create( object , Params ) ; - } - - // get number of parameters for constructor - virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; } - - // get n-th constructor parameter - virtual const wxChar* GetCreateParamName(int n) const { return m_constructorProperties[n] ; } - - // Runtime access to objects for simple properties (get/set) by property name, and variant data - virtual void SetProperty (wxObject *object, const wxChar *propertyName, const wxxVariant &value) const ; - virtual wxxVariant GetProperty (wxObject *object, const wxChar *propertyName) const; - - // Runtime access to objects for collection properties by property name - virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ; - virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ; - - // we must be able to cast variants to wxObject pointers, templates seem not to be suitable - wxObject* VariantToInstance( wxxVariant &data ) const - { - if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) - return m_variantToObjectConverter( data ) ; - else - return m_variantOfPtrToObjectConverter( data ) ; - } - - wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; } - - // find property by name - virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ; - - // find handler by name - virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ; - - // find property by name - virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const ; - - // find handler by name - virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *PropertyName) const ; - - // puts all the properties of this class and its superclasses in the map, as long as there is not yet - // an entry with the same name (overriding mechanism) - void GetProperties( wxPropertyInfoMap &map ) const ; -public: - const wxChar *m_className; - int m_objectSize; - wxObjectConstructorFn m_objectConstructor; - - // class info object live in a linked list: - // pointers to its head and the next element in it - - static wxClassInfo *sm_first; - wxClassInfo *m_next; - - // FIXME: this should be private (currently used directly by way too - // many clients) - static wxHashTable *sm_classTable; - -protected : - wxPropertyInfo * m_firstProperty ; - wxHandlerInfo * m_firstHandler ; -private: - const wxClassInfo** m_parents ; - const wxChar* m_unitName; - - wxConstructorBridge* m_constructor ; - const wxChar ** m_constructorProperties ; - const int m_constructorPropertiesCount ; - wxVariantToObjectConverter m_variantOfPtrToObjectConverter ; - wxVariantToObjectConverter m_variantToObjectConverter ; - wxObjectToVariantConverter m_objectToVariantConverter ; - wxObjectStreamingCallback m_streamingCallback ; - const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const ; - - - // InitializeClasses() helper - static wxClassInfo *GetBaseByName(const wxChar *name) ; - -protected: - // registers the class - void Register(); - void Unregister(); - - DECLARE_NO_COPY_CLASS(wxClassInfo) -}; - - -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); - -// ---------------------------------------------------------------------------- -// wxDynamicObject -// ---------------------------------------------------------------------------- -// -// this object leads to having a pure runtime-instantiation - -class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicObject ; -public : - wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ; - virtual ~wxDynamicClassInfo() ; - - // constructs a wxDynamicObject with an instance - virtual wxObject *AllocateObject() const ; - - // Call the Create method for a class - virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const ; - - // get number of parameters for constructor - virtual int GetCreateParamCount() const ; - - // get i-th constructor parameter - virtual const wxChar* GetCreateParamName(int i) const ; - - // Runtime access to objects by property name, and variant data - virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ; - virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ; - - // adds a property to this class at runtime - void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ; - - // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ) ; - - // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; - - // as a handler to this class at runtime - void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ; - - // removes an existing runtime-handler - void RemoveHandler( const wxChar *handlerName ) ; - - // renames an existing runtime-handler - void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ; -private : - struct wxDynamicClassInfoInternal ; - wxDynamicClassInfoInternal* m_data ; -} ; - -// ---------------------------------------------------------------------------- -// Dynamic class macros -// ---------------------------------------------------------------------------- - -#define _DECLARE_DYNAMIC_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - static const wxClassInfo* ms_classParents[] ; \ - static wxPropertyInfo* GetPropertiesStatic() ; \ - static wxHandlerInfo* GetHandlersStatic() ; \ - static wxClassInfo *GetClassInfoStatic() \ -{ return &name::ms_classInfo; } \ - virtual wxClassInfo *GetClassInfo() const \ -{ return &name::ms_classInfo; } - -/* -#define _DECLARE_DYNAMIC_CLASS(name) \ - public: \ - static wxClassInfo ms_class##name; \ - static const wxClassInfo* ms_classParents##name[] ; \ - static wxPropertyInfo* GetPropertiesStatic() ; \ - static wxHandlerInfo* GetHandlersStatic() ; \ - static wxClassInfo *GetClassInfoStatic() \ -{ return &name::ms_class##name; } \ - virtual wxClassInfo *GetClassInfo() const \ -{ return &name::ms_class##name; } -*/ -#define DECLARE_DYNAMIC_CLASS(name) \ - static wxConstructorBridge* ms_constructor ; \ - static const wxChar * ms_constructorProperties[] ; \ - static const int ms_constructorPropertiesCount ; \ - _DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - DECLARE_NO_ASSIGN_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - DECLARE_NO_COPY_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) -#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) - -// ----------------------------------- -// for concrete classes -// ----------------------------------- - -// Single inheritance with one base class - -#define _TYPEINFO_CLASSES(n , toString , fromString ) \ - wxClassTypeInfo s_typeInfo##n(wxT_OBJECT , &n::ms_classInfo , toString , fromString , typeid(n).name()) ; \ - wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR , &n::ms_classInfo , toString , fromString , typeid(n*).name()) ; - -#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit , callback) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ - name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); - -#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.wxTEMPLATED_MEMBER_CALL(Get , name) ; } \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties, \ - name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name, callback); - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name , basename , unit , callback ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , &callback ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name , basename , unit , toString , fromString ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, toString , fromString) - -// this is for classes that do not derive from wxobject, there are no creators for these - -#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \ - const wxClassInfo* name::ms_classParents[] = { NULL } ; \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , 0 , 0 ); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -// this is for subclasses that still do not derive from wxobject - -#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , 0 , 0 ); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - - -// Multiple inheritance with two base classes - -#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,&basename2::ms_classInfo , NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ - name::ms_constructorPropertiesCount , wxVariantToObjectConverter##name, wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ - -#define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ - _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ - _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - - -// ----------------------------------- -// for abstract classes -// ----------------------------------- - -// Single inheritance with one base class - -#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ - _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } - -// Multiple inheritance with two base classes - -#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ - wxT(#basename2), (int) sizeof(name), \ - (wxObjectConstructorFn) 0); - -#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS -#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 - -#define wxBEGIN_EVENT_TABLE( a , b ) BEGIN_EVENT_TABLE( a , b ) -#define wxEND_EVENT_TABLE() END_EVENT_TABLE() - -// -------------------------------------------------------------------------- -// Collection Support -// -------------------------------------------------------------------------- - -template void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) -{ - iter current = coll.GetFirst() ; - while (current) - { - value.Add( new wxxVariant(current->GetData()) ) ; - current = current->GetNext(); - } -} - -template void wxArrayCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) -{ - for( size_t i = 0 ; i < coll.GetCount() ; i++ ) - { - value.Add( new wxxVariant(coll[i]) ) ; - } -} - - -#endif // _WX_XTIH__ diff --git a/Source/3rdParty/wx/include/wx/zipstrm.h b/Source/3rdParty/wx/include/wx/zipstrm.h deleted file mode 100644 index 572b88a9f..000000000 --- a/Source/3rdParty/wx/include/wx/zipstrm.h +++ /dev/null @@ -1,574 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/zipstrm.h -// Purpose: Streams for Zip files -// Author: Mike Wetherell -// RCS-ID: $Id: zipstrm.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXZIPSTREAM_H__ -#define _WX_WXZIPSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_ZIPSTREAM - -#include "wx/archive.h" -#include "wx/filename.h" - -// some methods from wxZipInputStream and wxZipOutputStream stream do not get -// exported/imported when compiled with Mingw versions before 3.4.2. So they -// are imported/exported individually as a workaround -#if (defined(__GNUWIN32__) || defined(__MINGW32__)) \ - && (!defined __GNUC__ \ - || !defined __GNUC_MINOR__ \ - || !defined __GNUC_PATCHLEVEL__ \ - || __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402) -#define WXZIPFIX WXDLLIMPEXP_BASE -#else -#define WXZIPFIX -#endif - -///////////////////////////////////////////////////////////////////////////// -// constants - -// Compression Method, only 0 (store) and 8 (deflate) are supported here -// -enum wxZipMethod -{ - wxZIP_METHOD_STORE, - wxZIP_METHOD_SHRINK, - wxZIP_METHOD_REDUCE1, - wxZIP_METHOD_REDUCE2, - wxZIP_METHOD_REDUCE3, - wxZIP_METHOD_REDUCE4, - wxZIP_METHOD_IMPLODE, - wxZIP_METHOD_TOKENIZE, - wxZIP_METHOD_DEFLATE, - wxZIP_METHOD_DEFLATE64, - wxZIP_METHOD_BZIP2 = 12, - wxZIP_METHOD_DEFAULT = 0xffff -}; - -// Originating File-System. -// -// These are Pkware's values. Note that Info-zip disagree on some of them, -// most notably NTFS. -// -enum wxZipSystem -{ - wxZIP_SYSTEM_MSDOS, - wxZIP_SYSTEM_AMIGA, - wxZIP_SYSTEM_OPENVMS, - wxZIP_SYSTEM_UNIX, - wxZIP_SYSTEM_VM_CMS, - wxZIP_SYSTEM_ATARI_ST, - wxZIP_SYSTEM_OS2_HPFS, - wxZIP_SYSTEM_MACINTOSH, - wxZIP_SYSTEM_Z_SYSTEM, - wxZIP_SYSTEM_CPM, - wxZIP_SYSTEM_WINDOWS_NTFS, - wxZIP_SYSTEM_MVS, - wxZIP_SYSTEM_VSE, - wxZIP_SYSTEM_ACORN_RISC, - wxZIP_SYSTEM_VFAT, - wxZIP_SYSTEM_ALTERNATE_MVS, - wxZIP_SYSTEM_BEOS, - wxZIP_SYSTEM_TANDEM, - wxZIP_SYSTEM_OS_400 -}; - -// Dos/Win file attributes -// -enum wxZipAttributes -{ - wxZIP_A_RDONLY = 0x01, - wxZIP_A_HIDDEN = 0x02, - wxZIP_A_SYSTEM = 0x04, - wxZIP_A_SUBDIR = 0x10, - wxZIP_A_ARCH = 0x20, - - wxZIP_A_MASK = 0x37 -}; - -// Values for the flags field in the zip headers -// -enum wxZipFlags -{ - wxZIP_ENCRYPTED = 0x0001, - wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression - wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression - wxZIP_DEFLATE_FAST = 0x0004, // fast compression - wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression - wxZIP_DEFLATE_MASK = 0x0006, - wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data - wxZIP_ENHANCED = 0x0010, - wxZIP_PATCH = 0x0020, - wxZIP_STRONG_ENC = 0x0040, - wxZIP_UNUSED = 0x0F80, - wxZIP_RESERVED = 0xF000 -}; - -// Forward decls -// -class WXDLLIMPEXP_FWD_BASE wxZipEntry; -class WXDLLIMPEXP_FWD_BASE wxZipInputStream; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipNotifier - -class WXDLLIMPEXP_BASE wxZipNotifier -{ -public: - virtual ~wxZipNotifier() { } - - virtual void OnEntryUpdated(wxZipEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// Zip Entry - holds the meta data for a file in the zip - -class WXDLLIMPEXP_BASE wxZipEntry : public wxArchiveEntry -{ -public: - wxZipEntry(const wxString& name = wxEmptyString, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - virtual ~wxZipEntry(); - - wxZipEntry(const wxZipEntry& entry); - wxZipEntry& operator=(const wxZipEntry& entry); - - // Get accessors - wxDateTime GetDateTime() const { return m_DateTime; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxString GetInternalName() const { return m_Name; } - int GetMethod() const { return m_Method; } - int GetFlags() const { return m_Flags; } - wxUint32 GetCrc() const { return m_Crc; } - wxFileOffset GetCompressedSize() const { return m_CompressedSize; } - int GetSystemMadeBy() const { return m_SystemMadeBy; } - wxString GetComment() const { return m_Comment; } - wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } - int GetMode() const; - const char *GetLocalExtra() const; - size_t GetLocalExtraLen() const; - const char *GetExtra() const; - size_t GetExtraLen() const; - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; - - // is accessors - inline bool IsDir() const; - inline bool IsText() const; - inline bool IsReadOnly() const; - inline bool IsMadeByUnix() const; - - // set accessors - void SetDateTime(const wxDateTime& dt) { m_DateTime = dt; } - void SetSize(wxFileOffset size) { m_Size = size; } - void SetMethod(int method) { m_Method = (wxUint16)method; } - void SetComment(const wxString& comment) { m_Comment = comment; } - void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; } - void SetSystemMadeBy(int system); - void SetMode(int mode); - void SetExtra(const char *extra, size_t len); - void SetLocalExtra(const char *extra, size_t len); - - inline void SetName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE); - - static wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); - - // set is accessors - void SetIsDir(bool isDir = true); - inline void SetIsReadOnly(bool isReadOnly = true); - inline void SetIsText(bool isText = true); - - wxZipEntry *Clone() const { return ZipClone(); } - - void SetNotifier(wxZipNotifier& notifier); - void UnsetNotifier(); - -protected: - // Internal attributes - enum { TEXT_ATTR = 1 }; - - // protected Get accessors - int GetVersionNeeded() const { return m_VersionNeeded; } - wxFileOffset GetKey() const { return m_Key; } - int GetVersionMadeBy() const { return m_VersionMadeBy; } - int GetDiskStart() const { return m_DiskStart; } - int GetInternalAttributes() const { return m_InternalAttributes; } - - void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; } - void SetOffset(wxFileOffset offset) { m_Offset = offset; } - void SetFlags(int flags) { m_Flags = (wxUint16)flags; } - void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; } - void SetCrc(wxUint32 crc) { m_Crc = crc; } - void SetCompressedSize(wxFileOffset size) { m_CompressedSize = size; } - void SetKey(wxFileOffset offset) { m_Key = offset; } - void SetDiskStart(int start) { m_DiskStart = (wxUint16)start; } - void SetInternalAttributes(int attr) { m_InternalAttributes = (wxUint16)attr; } - - virtual wxZipEntry *ZipClone() const { return new wxZipEntry(*this); } - - void Notify(); - -private: - wxArchiveEntry* DoClone() const { return ZipClone(); } - - size_t ReadLocal(wxInputStream& stream, wxMBConv& conv); - size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const; - - size_t ReadCentral(wxInputStream& stream, wxMBConv& conv); - size_t WriteCentral(wxOutputStream& stream, wxMBConv& conv) const; - - size_t ReadDescriptor(wxInputStream& stream); - size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc, - wxFileOffset compressedSize, wxFileOffset size); - - wxUint8 m_SystemMadeBy; // one of enum wxZipSystem - wxUint8 m_VersionMadeBy; // major * 10 + minor - - wxUint16 m_VersionNeeded; // ver needed to extract (20 i.e. v2.0) - wxUint16 m_Flags; - wxUint16 m_Method; // compression method (one of wxZipMethod) - wxDateTime m_DateTime; - wxUint32 m_Crc; - wxFileOffset m_CompressedSize; - wxFileOffset m_Size; - wxString m_Name; // in internal format - wxFileOffset m_Key; // the original offset for copied entries - wxFileOffset m_Offset; // file offset of the entry - - wxString m_Comment; - wxUint16 m_DiskStart; // for multidisk archives, not unsupported - wxUint16 m_InternalAttributes; // bit 0 set for text files - wxUint32 m_ExternalAttributes; // system specific depends on SystemMadeBy - - class wxZipMemory *m_Extra; - class wxZipMemory *m_LocalExtra; - - wxZipNotifier *m_zipnotifier; - class wxZipWeakLinks *m_backlink; - - friend class wxZipInputStream; - friend class wxZipOutputStream; - - DECLARE_DYNAMIC_CLASS(wxZipEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipOutputStream - -WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream -{ -public: - wxZipOutputStream(wxOutputStream& stream, - int level = -1, - wxMBConv& conv = wxConvLocal); - wxZipOutputStream(wxOutputStream *stream, - int level = -1, - wxMBConv& conv = wxConvLocal); - virtual WXZIPFIX ~wxZipOutputStream(); - - bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); } - - bool WXZIPFIX PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - - bool WXZIPFIX PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); - - bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream); - bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream); - - void WXZIPFIX Sync(); - bool WXZIPFIX CloseEntry(); - bool WXZIPFIX Close(); - - void SetComment(const wxString& comment) { m_Comment = comment; } - - int GetLevel() const { return m_level; } - void WXZIPFIX SetLevel(int level); - -protected: - virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_entrySize; } - - // this protected interface isn't yet finalised - struct Buffer { const char *m_data; size_t m_size; }; - virtual wxOutputStream* WXZIPFIX OpenCompressor(wxOutputStream& stream, - wxZipEntry& entry, - const Buffer bufs[]); - virtual bool WXZIPFIX CloseCompressor(wxOutputStream *comp); - - bool IsParentSeekable() const - { return m_offsetAdjustment != wxInvalidOffset; } - -private: - void Init(int level); - - bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry); - bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream); - - bool IsOpened() const { return m_comp || m_pending; } - - bool DoCreate(wxZipEntry *entry, bool raw = false); - void CreatePendingEntry(const void *buffer, size_t size); - void CreatePendingEntry(); - - class wxStoredOutputStream *m_store; - class wxZlibOutputStream2 *m_deflate; - class wxZipStreamLink *m_backlink; - wxZipEntryList_ m_entries; - char *m_initialData; - size_t m_initialSize; - wxZipEntry *m_pending; - bool m_raw; - wxFileOffset m_headerOffset; - size_t m_headerSize; - wxFileOffset m_entrySize; - wxUint32 m_crcAccumulator; - wxOutputStream *m_comp; - int m_level; - wxFileOffset m_offsetAdjustment; - wxString m_Comment; - - DECLARE_NO_COPY_CLASS(wxZipOutputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipInputStream - -class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream -{ -public: - typedef wxZipEntry entry_type; - - wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); - wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); - -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - wxZipInputStream(const wxString& archive, const wxString& file) - : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); } -#endif - - virtual WXZIPFIX ~wxZipInputStream(); - - bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); } - bool WXZIPFIX CloseEntry(); - - wxZipEntry *GetNextEntry(); - - wxString WXZIPFIX GetComment(); - int WXZIPFIX GetTotalEntries(); - - virtual wxFileOffset GetLength() const { return m_entry.GetSize(); } - -protected: - size_t WXZIPFIX OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; } - -#if WXWIN_COMPATIBILITY_2_6 - wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode); -#endif - - // this protected interface isn't yet finalised - virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream); - virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp); - -private: - void Init(); - void Init(const wxString& file); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - static wxInputStream *OpenFile(const wxString& archive); -#endif - - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } - - bool WXZIPFIX OpenEntry(wxArchiveEntry& entry); - - wxStreamError ReadLocal(bool readEndRec = false); - wxStreamError ReadCentral(); - - wxUint32 ReadSignature(); - bool FindEndRecord(); - bool LoadEndRecord(); - - bool AtHeader() const { return m_headerSize == 0; } - bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; } - bool IsOpened() const { return m_decomp != NULL; } - - wxZipStreamLink *MakeLink(wxZipOutputStream *out); - - bool DoOpen(wxZipEntry *entry = NULL, bool raw = false); - bool OpenDecompressor(bool raw = false); - - class wxStoredInputStream *m_store; - class wxZlibInputStream2 *m_inflate; - class wxRawInputStream *m_rawin; - wxZipEntry m_entry; - bool m_raw; - size_t m_headerSize; - wxUint32 m_crcAccumulator; - wxInputStream *m_decomp; - bool m_parentSeekable; - class wxZipWeakLinks *m_weaklinks; - class wxZipStreamLink *m_streamlink; - wxFileOffset m_offsetAdjustment; - wxFileOffset m_position; - wxUint32 m_signature; - size_t m_TotalEntries; - wxString m_Comment; - - friend bool wxZipOutputStream::CopyEntry( - wxZipEntry *entry, wxZipInputStream& inputStream); - friend bool wxZipOutputStream::CopyArchiveMetaData( - wxZipInputStream& inputStream); - -#if WXWIN_COMPATIBILITY_2_6 - bool m_allowSeeking; - friend class wxArchiveFSHandler; -#endif - - DECLARE_NO_COPY_CLASS(wxZipInputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// Iterators - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -typedef wxArchiveIterator wxZipIter; -typedef wxArchiveIterator > wxZipPairIter; -#endif - - -///////////////////////////////////////////////////////////////////////////// -// wxZipClassFactory - -class WXDLLIMPEXP_BASE wxZipClassFactory : public wxArchiveClassFactory -{ -public: - typedef wxZipEntry entry_type; - typedef wxZipInputStream instream_type; - typedef wxZipOutputStream outstream_type; - typedef wxZipNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxZipIter iter_type; - typedef wxZipPairIter pairiter_type; -#endif - - wxZipClassFactory(); - - wxZipEntry *NewEntry() const - { return new wxZipEntry; } - wxZipInputStream *NewStream(wxInputStream& stream) const - { return new wxZipInputStream(stream, GetConv()); } - wxZipOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZipOutputStream(stream, -1, GetConv()); } - wxZipInputStream *NewStream(wxInputStream *stream) const - { return new wxZipInputStream(stream, GetConv()); } - wxZipOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZipOutputStream(stream, -1, GetConv()); } - - wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const - { return wxZipEntry::GetInternalName(name, format); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxArchiveEntry *DoNewEntry() const - { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const - { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const - { return NewStream(stream); } - -private: - DECLARE_DYNAMIC_CLASS(wxZipClassFactory) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipEntry inlines - -inline bool wxZipEntry::IsText() const -{ - return (m_InternalAttributes & TEXT_ATTR) != 0; -} - -inline bool wxZipEntry::IsDir() const -{ - return (m_ExternalAttributes & wxZIP_A_SUBDIR) != 0; -} - -inline bool wxZipEntry::IsReadOnly() const -{ - return (m_ExternalAttributes & wxZIP_A_RDONLY) != 0; -} - -inline bool wxZipEntry::IsMadeByUnix() const -{ - const int pattern = - (1 << wxZIP_SYSTEM_OPENVMS) | - (1 << wxZIP_SYSTEM_UNIX) | - (1 << wxZIP_SYSTEM_ATARI_ST) | - (1 << wxZIP_SYSTEM_ACORN_RISC) | - (1 << wxZIP_SYSTEM_BEOS) | (1 << wxZIP_SYSTEM_TANDEM); - - // note: some unix zippers put madeby = dos - return (m_SystemMadeBy == wxZIP_SYSTEM_MSDOS - && (m_ExternalAttributes & ~0xFFFF)) - || ((pattern >> m_SystemMadeBy) & 1); -} - -inline void wxZipEntry::SetIsText(bool isText) -{ - if (isText) - m_InternalAttributes |= TEXT_ATTR; - else - m_InternalAttributes &= ~TEXT_ATTR; -} - -inline void wxZipEntry::SetIsReadOnly(bool isReadOnly) -{ - if (isReadOnly) - SetMode(GetMode() & ~0222); - else - SetMode(GetMode() | 0200); -} - -inline void wxZipEntry::SetName(const wxString& name, - wxPathFormat format /*=wxPATH_NATIVE*/) -{ - bool isDir; - m_Name = GetInternalName(name, format, &isDir); - SetIsDir(isDir); -} - - -#endif // wxUSE_ZIPSTREAM - -#endif // _WX_WXZIPSTREAM_H__ diff --git a/Source/3rdParty/wx/include/wx/zstream.h b/Source/3rdParty/wx/include/wx/zstream.h deleted file mode 100644 index cb7011d1f..000000000 --- a/Source/3rdParty/wx/include/wx/zstream.h +++ /dev/null @@ -1,146 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/zstream.h -// Purpose: Memory stream classes -// Author: Guilhem Lavaux -// Modified by: Mike Wetherell -// Created: 11/07/98 -// RCS-ID: $Id: zstream.h 54688 2008-07-18 08:06:44Z MW $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_WXZSTREAM_H__ -#define _WX_WXZSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_ZLIB && wxUSE_STREAMS - -#include "wx/stream.h" - -// Compression level -enum { - wxZ_DEFAULT_COMPRESSION = -1, - wxZ_NO_COMPRESSION = 0, - wxZ_BEST_SPEED = 1, - wxZ_BEST_COMPRESSION = 9 -}; - -// Flags -enum { -#if WXWIN_COMPATIBILITY_2_4 - wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error -#endif - wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum - wxZLIB_ZLIB = 1, // zlib header and checksum - wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ - wxZLIB_AUTO = 3 // autodetect header zlib or gzip -}; - -class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { - public: - wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); - wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); - virtual ~wxZlibInputStream(); - - char Peek() { return wxInputStream::Peek(); } - wxFileOffset GetLength() const { return wxInputStream::GetLength(); } - - static bool CanHandleGZip(); - - protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - - private: - void Init(int flags); - - protected: - size_t m_z_size; - unsigned char *m_z_buffer; - struct z_stream_s *m_inflate; - wxFileOffset m_pos; -#if WXWIN_COMPATIBILITY_2_4 - bool m_24compatibilty; -#endif - - DECLARE_NO_COPY_CLASS(wxZlibInputStream) -}; - -class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { - public: - wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB); - wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); - virtual ~wxZlibOutputStream() { Close(); } - - void Sync() { DoFlush(false); } - bool Close(); - wxFileOffset GetLength() const { return m_pos; } - - static bool CanHandleGZip(); - - protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - - virtual void DoFlush(bool final); - - private: - void Init(int level, int flags); - - protected: - size_t m_z_size; - unsigned char *m_z_buffer; - struct z_stream_s *m_deflate; - wxFileOffset m_pos; - - DECLARE_NO_COPY_CLASS(wxZlibOutputStream) -}; - -class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory -{ -public: - wxZlibClassFactory(); - - wxFilterInputStream *NewStream(wxInputStream& stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZlibOutputStream(stream, -1); } - wxFilterInputStream *NewStream(wxInputStream *stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZlibOutputStream(stream, -1); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -private: - DECLARE_DYNAMIC_CLASS(wxZlibClassFactory) -}; - -class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory -{ -public: - wxGzipClassFactory(); - - wxFilterInputStream *NewStream(wxInputStream& stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); } - wxFilterInputStream *NewStream(wxInputStream *stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -private: - DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) -}; - -#endif - // wxUSE_ZLIB && wxUSE_STREAMS - -#endif - // _WX_WXZSTREAM_H__ - diff --git a/Source/3rdParty/wx/lib/vc_lib/msw/wx/msw/rcdefs.h b/Source/3rdParty/wx/lib/vc_lib/msw/wx/msw/rcdefs.h deleted file mode 100644 index 9f9e03b93..000000000 --- a/Source/3rdParty/wx/lib/vc_lib/msw/wx/msw/rcdefs.h +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - -#ifndef _WX_RCDEFS_H -#define _WX_RCDEFS_H - - -#define WX_MSC_FULL_VER 150021022 - - - - - - - - - - - - - - - -#define WX_CPU_X86 - - - - - - - - - - -#endif diff --git a/Source/3rdParty/wx/src/common/accesscmn.cpp b/Source/3rdParty/wx/src/common/accesscmn.cpp deleted file mode 100644 index 168425822..000000000 --- a/Source/3rdParty/wx/src/common/accesscmn.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/accesscmn.cpp -// Author: Julian Smart -// Modified by: -// Created: 2003-02-12 -// RCS-ID: $Id: accesscmn.cpp 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ACCESSIBILITY - -#include "wx/access.h" - -#endif - diff --git a/Source/3rdParty/wx/src/common/anidecod.cpp b/Source/3rdParty/wx/src/common/anidecod.cpp deleted file mode 100644 index 4a905f802..000000000 --- a/Source/3rdParty/wx/src/common/anidecod.cpp +++ /dev/null @@ -1,345 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/anidecod.cpp -// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation -// Author: Francesco Montorsi -// RCS-ID: $Id: anidecod.cpp 43898 2006-12-10 14:18:37Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS && wxUSE_ICO_CUR - -#include "wx/anidecod.h" - -#ifndef WX_PRECOMP - #include "wx/palette.h" -#endif - -#include -#include - -// static -wxCURHandler wxANIDecoder::sm_handler; - -//--------------------------------------------------------------------------- -// wxANIFrameInfo -//--------------------------------------------------------------------------- - -class wxANIFrameInfo -{ -public: - wxANIFrameInfo(unsigned int delay = 0, int idx = -1) - { m_delay=delay; m_imageIndex=idx; } - - unsigned int m_delay; - int m_imageIndex; -}; - -#include "wx/arrimpl.cpp" // this is a magic incantation which must be done! -WX_DEFINE_OBJARRAY(wxImageArray) - -#include "wx/arrimpl.cpp" // this is a magic incantation which must be done! -WX_DEFINE_OBJARRAY(wxANIFrameInfoArray) - - -//--------------------------------------------------------------------------- -// wxANIDecoder -//--------------------------------------------------------------------------- - -wxANIDecoder::wxANIDecoder() -{ -} - -wxANIDecoder::~wxANIDecoder() -{ -} - -bool wxANIDecoder::ConvertToImage(unsigned int frame, wxImage *image) const -{ - unsigned int idx = m_info[frame].m_imageIndex; - *image = m_images[idx]; // copy - return image->IsOk(); -} - - -//--------------------------------------------------------------------------- -// Data accessors -//--------------------------------------------------------------------------- - -wxSize wxANIDecoder::GetFrameSize(unsigned int WXUNUSED(frame)) const -{ - // all frames are of the same size... - return m_szAnimation; -} - -wxPoint wxANIDecoder::GetFramePosition(unsigned int WXUNUSED(frame)) const -{ - // all frames are of the same size... - return wxPoint(0,0); -} - -wxAnimationDisposal wxANIDecoder::GetDisposalMethod(unsigned int WXUNUSED(frame)) const -{ - // this disposal is implicit for all frames inside an ANI file - return wxANIM_TOBACKGROUND; -} - -long wxANIDecoder::GetDelay(unsigned int frame) const -{ - return m_info[frame].m_delay; -} - -wxColour wxANIDecoder::GetTransparentColour(unsigned int frame) const -{ - unsigned int idx = m_info[frame].m_imageIndex; - - if (!m_images[idx].HasMask()) - return wxNullColour; - - return wxColour(m_images[idx].GetMaskRed(), - m_images[idx].GetMaskGreen(), - m_images[idx].GetMaskBlue()); -} - - -//--------------------------------------------------------------------------- -// ANI reading and decoding -//--------------------------------------------------------------------------- - -bool wxANIDecoder::CanRead(wxInputStream& stream) const -{ - wxInt32 FCC1, FCC2; - wxUint32 datalen ; - - wxInt32 riff32; - memcpy( &riff32, "RIFF", 4 ); - wxInt32 list32; - memcpy( &list32, "LIST", 4 ); - wxInt32 ico32; - memcpy( &ico32, "icon", 4 ); - wxInt32 anih32; - memcpy( &anih32, "anih", 4 ); - - stream.SeekI(0); - if ( !stream.Read(&FCC1, 4) ) - return false; - - if ( FCC1 != riff32 ) - return false; - - // we have a riff file: - while ( stream.IsOk() ) - { - if ( FCC1 == anih32 ) - return true; // found the ANIH chunk - this should be an ANI file - - // we always have a data size: - stream.Read(&datalen, 4); - datalen = wxINT32_SWAP_ON_BE(datalen) ; - - // data should be padded to make even number of bytes - if (datalen % 2 == 1) datalen ++ ; - - // now either data or a FCC: - if ( (FCC1 == riff32) || (FCC1 == list32) ) - { - stream.Read(&FCC2, 4); - } - else - { - stream.SeekI(stream.TellI() + datalen); - } - - // try to read next data chunk: - if ( !stream.Read(&FCC1, 4) ) - { - // reading failed -- either EOF or IO error, bail out anyhow - return false; - } - } - - return false; -} - -// the "anih" RIFF chunk -struct wxANIHeader -{ - wxInt32 cbSizeOf; // Num bytes in AniHeader (36 bytes) - wxInt32 cFrames; // Number of unique Icons in this cursor - wxInt32 cSteps; // Number of Blits before the animation cycles - wxInt32 cx; // width of the frames - wxInt32 cy; // height of the frames - wxInt32 cBitCount; // bit depth - wxInt32 cPlanes; // 1 - wxInt32 JifRate; // Default Jiffies (1/60th of a second) if rate chunk not present. - wxInt32 flags; // Animation Flag (see AF_ constants) - - // ANI files are always little endian so we need to swap bytes on big - // endian architectures -#ifdef WORDS_BIGENDIAN - void AdjustEndianness() - { - // this works because all our fields are wxInt32 and they must be - // packed without holes between them (if they're not, they wouldn't map - // to the file header!) - wxInt32 * const start = (wxInt32 *)this; - wxInt32 * const end = start + sizeof(wxANIHeader)/sizeof(wxInt32); - for ( wxInt32 *p = start; p != end; p++ ) - { - *p = wxINT32_SWAP_ALWAYS(*p); - } - } -#else - void AdjustEndianness() { } -#endif -}; - -bool wxANIDecoder::Load( wxInputStream& stream ) -{ - wxInt32 FCC1, FCC2; - wxUint32 datalen; - unsigned int globaldelay=0; - - wxInt32 riff32; - memcpy( &riff32, "RIFF", 4 ); - wxInt32 list32; - memcpy( &list32, "LIST", 4 ); - wxInt32 ico32; - memcpy( &ico32, "icon", 4 ); - wxInt32 anih32; - memcpy( &anih32, "anih", 4 ); - wxInt32 rate32; - memcpy( &rate32, "rate", 4 ); - wxInt32 seq32; - memcpy( &seq32, "seq ", 4 ); - - stream.SeekI(0); - stream.Read(&FCC1, 4); - if ( FCC1 != riff32 ) - return false; - - m_nFrames = 0; - m_szAnimation = wxDefaultSize; - - m_images.Clear(); - m_info.Clear(); - - // we have a riff file: - while ( stream.IsOk() ) - { - // we always have a data size: - stream.Read(&datalen, 4); - datalen = wxINT32_SWAP_ON_BE(datalen); - - //data should be padded to make even number of bytes - if (datalen % 2 == 1) datalen++; - - // now either data or a FCC: - if ( (FCC1 == riff32) || (FCC1 == list32) ) - { - stream.Read(&FCC2, 4); - } - else if ( FCC1 == anih32 ) - { - if ( datalen != sizeof(wxANIHeader) ) - return false; - - if (m_nFrames > 0) - return false; // already parsed an ani header? - - struct wxANIHeader header; - stream.Read(&header, sizeof(wxANIHeader)); - header.AdjustEndianness(); - - // we should have a global frame size - m_szAnimation = wxSize(header.cx, header.cy); - - // save interesting info from the header - m_nFrames = header.cSteps; // NB: not cFrames!! - if ( m_nFrames == 0 ) - return false; - - globaldelay = header.JifRate * 1000 / 60; - - m_images.Alloc(header.cFrames); - m_info.Add(wxANIFrameInfo(), m_nFrames); - } - else if ( FCC1 == rate32 ) - { - // did we already process the anih32 chunk? - if (m_nFrames == 0) - return false; // rate chunks should always be placed after anih chunk - - wxASSERT(m_info.GetCount() == m_nFrames); - for (unsigned int i=0; i -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox() - #endif - #include "wx/list.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif //WX_PRECOMP - -#include "wx/apptrait.h" -#include "wx/cmdline.h" -#include "wx/confbase.h" -#include "wx/filename.h" -#include "wx/msgout.h" -#include "wx/tokenzr.h" - -#if !defined(__WXMSW__) || defined(__WXMICROWIN__) - #include // for SIGTRAP used by wxTrap() -#endif //Win/Unix - -#if wxUSE_FONTMAP - #include "wx/fontmap.h" -#endif // wxUSE_FONTMAP - -#if defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - // For MacTypes.h for Debugger function - #include -#endif - -#if defined(__WXMAC__) - #ifdef __DARWIN__ - #include - #else - #include "wx/mac/private.h" // includes mac headers - #endif -#endif // __WXMAC__ - -#ifdef __WXDEBUG__ - #if wxUSE_STACKWALKER - #include "wx/stackwalk.h" - #ifdef __WXMSW__ - #include "wx/msw/debughlp.h" - #endif - #endif // wxUSE_STACKWALKER - - #include "wx/recguard.h" -#endif // __WXDEBUG__ - -// wxABI_VERSION can be defined when compiling applications but it should be -// left undefined when compiling the library itself, it is then set to its -// default value in version.h -#if wxABI_VERSION != wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 -#error "wxABI_VERSION should not be defined when compiling the library" -#endif - -// ---------------------------------------------------------------------------- -// private functions prototypes -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - // really just show the assert dialog - static bool DoShowAssertDialog(const wxString& msg); - - // prepare for showing the assert dialog, use the given traits or - // DoShowAssertDialog() as last fallback to really show it - static - void ShowAssertDialog(const wxChar *szFile, - int nLine, - const wxChar *szFunc, - const wxChar *szCond, - const wxChar *szMsg, - wxAppTraits *traits = NULL); - - // turn on the trace masks specified in the env variable WXTRACE - static void LINKAGEMODE SetTraceMasks(); -#endif // __WXDEBUG__ - -// ---------------------------------------------------------------------------- -// global vars -// ---------------------------------------------------------------------------- - -wxAppConsole *wxAppConsole::ms_appInstance = NULL; - -wxAppInitializerFunction wxAppConsole::ms_appInitFn = NULL; - -// ============================================================================ -// wxAppConsole implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// ctor/dtor -// ---------------------------------------------------------------------------- - -wxAppConsole::wxAppConsole() -{ - m_traits = NULL; - - ms_appInstance = this; - -#ifdef __WXDEBUG__ - SetTraceMasks(); -#if wxUSE_UNICODE - // In unicode mode the SetTraceMasks call can cause an apptraits to be - // created, but since we are still in the constructor the wrong kind will - // be created for GUI apps. Destroy it so it can be created again later. - delete m_traits; - m_traits = NULL; -#endif -#endif -} - -wxAppConsole::~wxAppConsole() -{ - delete m_traits; -} - -// ---------------------------------------------------------------------------- -// initilization/cleanup -// ---------------------------------------------------------------------------- - -bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig) -{ - // remember the command line arguments - argc = argcOrig; - argv = argvOrig; - -#ifndef __WXPALMOS__ - if ( m_appName.empty() && argv ) - { - // the application name is, by default, the name of its executable file - wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); - } -#endif - - return true; -} - -void wxAppConsole::CleanUp() -{ -} - -// ---------------------------------------------------------------------------- -// OnXXX() callbacks -// ---------------------------------------------------------------------------- - -bool wxAppConsole::OnInit() -{ -#if wxUSE_CMDLINE_PARSER - wxCmdLineParser parser(argc, argv); - - OnInitCmdLine(parser); - - bool cont; - switch ( parser.Parse(false /* don't show usage */) ) - { - case -1: - cont = OnCmdLineHelp(parser); - break; - - case 0: - cont = OnCmdLineParsed(parser); - break; - - default: - cont = OnCmdLineError(parser); - break; - } - - if ( !cont ) - return false; -#endif // wxUSE_CMDLINE_PARSER - - return true; -} - -int wxAppConsole::OnExit() -{ -#if wxUSE_CONFIG - // delete the config object if any (don't use Get() here, but Set() - // because Get() could create a new config object) - delete wxConfigBase::Set((wxConfigBase *) NULL); -#endif // wxUSE_CONFIG - - return 0; -} - -void wxAppConsole::Exit() -{ - exit(-1); -} - -// ---------------------------------------------------------------------------- -// traits stuff -// ---------------------------------------------------------------------------- - -wxAppTraits *wxAppConsole::CreateTraits() -{ - return new wxConsoleAppTraits; -} - -wxAppTraits *wxAppConsole::GetTraits() -{ - // FIXME-MT: protect this with a CS? - if ( !m_traits ) - { - m_traits = CreateTraits(); - - wxASSERT_MSG( m_traits, _T("wxApp::CreateTraits() failed?") ); - } - - return m_traits; -} - -// we must implement CreateXXX() in wxApp itself for backwards compatibility -#if WXWIN_COMPATIBILITY_2_4 - -#if wxUSE_LOG - -wxLog *wxAppConsole::CreateLogTarget() -{ - wxAppTraits *traits = GetTraits(); - return traits ? traits->CreateLogTarget() : NULL; -} - -#endif // wxUSE_LOG - -wxMessageOutput *wxAppConsole::CreateMessageOutput() -{ - wxAppTraits *traits = GetTraits(); - return traits ? traits->CreateMessageOutput() : NULL; -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// event processing -// ---------------------------------------------------------------------------- - -void wxAppConsole::ProcessPendingEvents() -{ -#if wxUSE_THREADS - if ( !wxPendingEventsLocker ) - return; -#endif - - // ensure that we're the only thread to modify the pending events list - wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - - if ( !wxPendingEvents ) - { - wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - return; - } - - // iterate until the list becomes empty - wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); - while (node) - { - wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); - wxPendingEvents->Erase(node); - - // In ProcessPendingEvents(), new handlers might be add - // and we can safely leave the critical section here. - wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - - handler->ProcessPendingEvents(); - - wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - - node = wxPendingEvents->GetFirst(); - } - - wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); -} - -int wxAppConsole::FilterEvent(wxEvent& WXUNUSED(event)) -{ - // process the events normally by default - return -1; -} - -// ---------------------------------------------------------------------------- -// exception handling -// ---------------------------------------------------------------------------- - -#if wxUSE_EXCEPTIONS - -void -wxAppConsole::HandleEvent(wxEvtHandler *handler, - wxEventFunction func, - wxEvent& event) const -{ - // by default, simply call the handler - (handler->*func)(event); -} - -#endif // wxUSE_EXCEPTIONS - -// ---------------------------------------------------------------------------- -// cmd line parsing -// ---------------------------------------------------------------------------- - -#if wxUSE_CMDLINE_PARSER - -#define OPTION_VERBOSE _T("verbose") - -void wxAppConsole::OnInitCmdLine(wxCmdLineParser& parser) -{ - // the standard command line options - static const wxCmdLineEntryDesc cmdLineDesc[] = - { - { - wxCMD_LINE_SWITCH, - _T("h"), - _T("help"), - gettext_noop("show this help message"), - wxCMD_LINE_VAL_NONE, - wxCMD_LINE_OPTION_HELP - }, - -#if wxUSE_LOG - { - wxCMD_LINE_SWITCH, - wxEmptyString, - OPTION_VERBOSE, - gettext_noop("generate verbose log messages"), - wxCMD_LINE_VAL_NONE, - 0x0 - }, -#endif // wxUSE_LOG - - // terminator - { - wxCMD_LINE_NONE, - wxEmptyString, - wxEmptyString, - wxEmptyString, - wxCMD_LINE_VAL_NONE, - 0x0 - } - }; - - parser.SetDesc(cmdLineDesc); -} - -bool wxAppConsole::OnCmdLineParsed(wxCmdLineParser& parser) -{ -#if wxUSE_LOG - if ( parser.Found(OPTION_VERBOSE) ) - { - wxLog::SetVerbose(true); - } -#else - wxUnusedVar(parser); -#endif // wxUSE_LOG - - return true; -} - -bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser) -{ - parser.Usage(); - - return false; -} - -bool wxAppConsole::OnCmdLineError(wxCmdLineParser& parser) -{ - parser.Usage(); - - return false; -} - -#endif // wxUSE_CMDLINE_PARSER - -// ---------------------------------------------------------------------------- -// debugging support -// ---------------------------------------------------------------------------- - -/* static */ -bool wxAppConsole::CheckBuildOptions(const char *optionsSignature, - const char *componentName) -{ -#if 0 // can't use wxLogTrace, not up and running yet - printf("checking build options object '%s' (ptr %p) in '%s'\n", - optionsSignature, optionsSignature, componentName); -#endif - - if ( strcmp(optionsSignature, WX_BUILD_OPTIONS_SIGNATURE) != 0 ) - { - wxString lib = wxString::FromAscii(WX_BUILD_OPTIONS_SIGNATURE); - wxString prog = wxString::FromAscii(optionsSignature); - wxString progName = wxString::FromAscii(componentName); - wxString msg; - - msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."), - lib.c_str(), progName.c_str(), prog.c_str()); - - wxLogFatalError(msg.c_str()); - - // normally wxLogFatalError doesn't return - return false; - } -#undef wxCMP - - return true; -} - -#ifdef __WXDEBUG__ - -void wxAppConsole::OnAssertFailure(const wxChar *file, - int line, - const wxChar *func, - const wxChar *cond, - const wxChar *msg) -{ - ShowAssertDialog(file, line, func, cond, msg, GetTraits()); -} - -void wxAppConsole::OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg) -{ - OnAssertFailure(file, line, NULL, cond, msg); -} - -#endif // __WXDEBUG__ - -#if WXWIN_COMPATIBILITY_2_4 - -bool wxAppConsole::CheckBuildOptions(const wxBuildOptions& buildOptions) -{ - return CheckBuildOptions(buildOptions.m_signature, "your program"); -} - -#endif - -// ============================================================================ -// other classes implementations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxConsoleAppTraitsBase -// ---------------------------------------------------------------------------- - -#if wxUSE_LOG - -wxLog *wxConsoleAppTraitsBase::CreateLogTarget() -{ - return new wxLogStderr; -} - -#endif // wxUSE_LOG - -wxMessageOutput *wxConsoleAppTraitsBase::CreateMessageOutput() -{ - return new wxMessageOutputStderr; -} - -#if wxUSE_FONTMAP - -wxFontMapper *wxConsoleAppTraitsBase::CreateFontMapper() -{ - return (wxFontMapper *)new wxFontMapperBase; -} - -#endif // wxUSE_FONTMAP - -wxRendererNative *wxConsoleAppTraitsBase::CreateRenderer() -{ - // console applications don't use renderers - return NULL; -} - -#ifdef __WXDEBUG__ -bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString& msg) -{ - return wxAppTraitsBase::ShowAssertDialog(msg); -} -#endif - -bool wxConsoleAppTraitsBase::HasStderr() -{ - // console applications always have stderr, even under Mac/Windows - return true; -} - -void wxConsoleAppTraitsBase::ScheduleForDestroy(wxObject *object) -{ - delete object; -} - -void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject * WXUNUSED(object)) -{ - // nothing to do -} - -#if wxUSE_SOCKETS -GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() -{ - return NULL; -} -#endif - -// ---------------------------------------------------------------------------- -// wxAppTraits -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - -bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal) -{ - wxString msg = msgOriginal; - -#if wxUSE_STACKWALKER -#if !defined(__WXMSW__) - // on Unix stack frame generation may take some time, depending on the - // size of the executable mainly... warn the user that we are working - wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait")); - fflush(stderr); -#endif - - const wxString stackTrace = GetAssertStackTrace(); - if ( !stackTrace.empty() ) - msg << _T("\n\nCall stack:\n") << stackTrace; -#endif // wxUSE_STACKWALKER - - return DoShowAssertDialog(msg); -} - -#if wxUSE_STACKWALKER -wxString wxAppTraitsBase::GetAssertStackTrace() -{ - wxString stackTrace; - - class StackDump : public wxStackWalker - { - public: - StackDump() { } - - const wxString& GetStackTrace() const { return m_stackTrace; } - - protected: - virtual void OnStackFrame(const wxStackFrame& frame) - { - m_stackTrace << wxString::Format - ( - _T("[%02d] "), - wx_truncate_cast(int, frame.GetLevel()) - ); - - wxString name = frame.GetName(); - if ( !name.empty() ) - { - m_stackTrace << wxString::Format(_T("%-40s"), name.c_str()); - } - else - { - m_stackTrace << wxString::Format(_T("%p"), frame.GetAddress()); - } - - if ( frame.HasSourceLocation() ) - { - m_stackTrace << _T('\t') - << frame.GetFileName() - << _T(':') - << frame.GetLine(); - } - - m_stackTrace << _T('\n'); - } - - private: - wxString m_stackTrace; - }; - - // don't show more than maxLines or we could get a dialog too tall to be - // shown on screen: 20 should be ok everywhere as even with 15 pixel high - // characters it is still only 300 pixels... - static const int maxLines = 20; - - StackDump dump; - dump.Walk(2, maxLines); // don't show OnAssert() call itself - stackTrace = dump.GetStackTrace(); - - const int count = stackTrace.Freq(wxT('\n')); - for ( int i = 0; i < count - maxLines; i++ ) - stackTrace = stackTrace.BeforeLast(wxT('\n')); - - return stackTrace; -} -#endif // wxUSE_STACKWALKER - - -#endif // __WXDEBUG__ - -// ============================================================================ -// global functions implementation -// ============================================================================ - -void wxExit() -{ - if ( wxTheApp ) - { - wxTheApp->Exit(); - } - else - { - // what else can we do? - exit(-1); - } -} - -void wxWakeUpIdle() -{ - if ( wxTheApp ) - { - wxTheApp->WakeUpIdle(); - } - //else: do nothing, what can we do? -} - -#ifdef __WXDEBUG__ - -// wxASSERT() helper -bool wxAssertIsEqual(int x, int y) -{ - return x == y; -} - -// break into the debugger -void wxTrap() -{ -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - DebugBreak(); -#elif defined(__WXMAC__) && !defined(__DARWIN__) - #if __powerc - Debugger(); - #else - SysBreak(); - #endif -#elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - Debugger(); -#elif defined(__UNIX__) - raise(SIGTRAP); -#else - // TODO -#endif // Win/Unix -} - -// this function is called when an assert fails -void wxOnAssert(const wxChar *szFile, - int nLine, - const char *szFunc, - const wxChar *szCond, - const wxChar *szMsg) -{ - // FIXME MT-unsafe - static int s_bInAssert = 0; - - wxRecursionGuard guard(s_bInAssert); - if ( guard.IsInside() ) - { - // can't use assert here to avoid infinite loops, so just trap - wxTrap(); - - return; - } - - // __FUNCTION__ is always in ASCII, convert it to wide char if needed - const wxString strFunc = wxString::FromAscii(szFunc); - - if ( !wxTheApp ) - { - // by default, show the assert dialog box -- we can't customize this - // behaviour - ShowAssertDialog(szFile, nLine, strFunc, szCond, szMsg); - } - else - { - // let the app process it as it wants - wxTheApp->OnAssertFailure(szFile, nLine, strFunc, szCond, szMsg); - } -} - -#endif // __WXDEBUG__ - -// ============================================================================ -// private functions implementation -// ============================================================================ - -#ifdef __WXDEBUG__ - -static void LINKAGEMODE SetTraceMasks() -{ -#if wxUSE_LOG - wxString mask; - if ( wxGetEnv(wxT("WXTRACE"), &mask) ) - { - wxStringTokenizer tkn(mask, wxT(",;:")); - while ( tkn.HasMoreTokens() ) - wxLog::AddTraceMask(tkn.GetNextToken()); - } -#endif // wxUSE_LOG -} - -bool DoShowAssertDialog(const wxString& msg) -{ - // under MSW we can show the dialog even in the console mode -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - wxString msgDlg(msg); - - // this message is intentionally not translated -- it is for - // developpers only - msgDlg += wxT("\nDo you want to stop the program?\n") - wxT("You can also choose [Cancel] to suppress ") - wxT("further warnings."); - - switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"), - MB_YESNOCANCEL | MB_ICONSTOP ) ) - { - case IDYES: - wxTrap(); - break; - - case IDCANCEL: - // stop the asserts - return true; - - //case IDNO: nothing to do - } -#else // !__WXMSW__ - wxFprintf(stderr, wxT("%s\n"), msg.c_str()); - fflush(stderr); - - // TODO: ask the user to enter "Y" or "N" on the console? - wxTrap(); -#endif // __WXMSW__/!__WXMSW__ - - // continue with the asserts - return false; -} - -// show the assert modal dialog -static -void ShowAssertDialog(const wxChar *szFile, - int nLine, - const wxChar *szFunc, - const wxChar *szCond, - const wxChar *szMsg, - wxAppTraits *traits) -{ - // this variable can be set to true to suppress "assert failure" messages - static bool s_bNoAsserts = false; - - wxString msg; - msg.reserve(2048); - - // make life easier for people using VC++ IDE by using this format: like - // this, clicking on the message will take us immediately to the place of - // the failed assert - msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond); - - // add the function name, if any - if ( szFunc && *szFunc ) - msg << _T(" in ") << szFunc << _T("()"); - - // and the message itself - if ( szMsg ) - { - msg << _T(": ") << szMsg; - } - else // no message given - { - msg << _T('.'); - } - -#if wxUSE_THREADS - // if we are not in the main thread, output the assert directly and trap - // since dialogs cannot be displayed - if ( !wxThread::IsMain() ) - { - msg += wxT(" [in child thread]"); - -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - msg << wxT("\r\n"); - OutputDebugString(msg ); -#else - // send to stderr - wxFprintf(stderr, wxT("%s\n"), msg.c_str()); - fflush(stderr); -#endif - // He-e-e-e-elp!! we're asserting in a child thread - wxTrap(); - } - else -#endif // wxUSE_THREADS - - if ( !s_bNoAsserts ) - { - // send it to the normal log destination - wxLogDebug(_T("%s"), msg.c_str()); - - if ( traits ) - { - // delegate showing assert dialog (if possible) to that class - s_bNoAsserts = traits->ShowAssertDialog(msg); - } - else // no traits object - { - // fall back to the function of last resort - s_bNoAsserts = DoShowAssertDialog(msg); - } - } -} - -#endif // __WXDEBUG__ diff --git a/Source/3rdParty/wx/src/common/appcmn.cpp b/Source/3rdParty/wx/src/common/appcmn.cpp deleted file mode 100644 index bc1a30c11..000000000 --- a/Source/3rdParty/wx/src/common/appcmn.cpp +++ /dev/null @@ -1,691 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/appcmn.cpp -// Purpose: wxAppConsole and wxAppBase methods common to all platforms -// Author: Vadim Zeitlin -// Modified by: -// Created: 18.10.99 -// RCS-ID: $Id: appcmn.cpp 47229 2007-07-08 05:31:32Z PC $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/window.h" - #include "wx/bitmap.h" - #include "wx/log.h" - #include "wx/msgdlg.h" - #include "wx/confbase.h" - #include "wx/utils.h" -#endif - -#include "wx/apptrait.h" -#include "wx/cmdline.h" -#include "wx/evtloop.h" -#include "wx/msgout.h" -#include "wx/thread.h" -#include "wx/vidmode.h" -#include "wx/ptr_scpd.h" - -#ifdef __WXDEBUG__ - #if wxUSE_STACKWALKER - #include "wx/stackwalk.h" - #endif // wxUSE_STACKWALKER -#endif // __WXDEBUG__ - -#if defined(__WXMSW__) - #include "wx/msw/private.h" // includes windows.h for LOGFONT -#endif - -#if defined(__WXMAC__) - #include "wx/mac/private.h" -#endif - -#if wxUSE_FONTMAP - #include "wx/fontmap.h" -#endif // wxUSE_FONTMAP - -// DLL options compatibility check: -#include "wx/build.h" -WX_CHECK_BUILD_OPTIONS("wxCore") - -WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; - -// ---------------------------------------------------------------------------- -// wxEventLoopPtr -// ---------------------------------------------------------------------------- - -// this defines wxEventLoopPtr -wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop) - -// ============================================================================ -// wxAppBase implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// initialization -// ---------------------------------------------------------------------------- - -wxAppBase::wxAppBase() -{ - m_topWindow = (wxWindow *)NULL; - - m_useBestVisual = false; - m_forceTrueColour = false; - - m_isActive = true; - - m_mainLoop = NULL; - - // We don't want to exit the app if the user code shows a dialog from its - // OnInit() -- but this is what would happen if we set m_exitOnFrameDelete - // to Yes initially as this dialog would be the last top level window. - // OTOH, if we set it to No initially we'll have to overwrite it with Yes - // when we enter our OnRun() because we do want the default behaviour from - // then on. But this would be a problem if the user code calls - // SetExitOnFrameDelete(false) from OnInit(). - // - // So we use the special "Later" value which is such that - // GetExitOnFrameDelete() returns false for it but which we know we can - // safely (i.e. without losing the effect of the users SetExitOnFrameDelete - // call) overwrite in OnRun() - m_exitOnFrameDelete = Later; -} - -bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig) -{ - if ( !wxAppConsole::Initialize(argcOrig, argvOrig) ) - return false; - -#if wxUSE_THREADS - wxPendingEventsLocker = new wxCriticalSection; -#endif - - wxInitializeStockLists(); - - wxBitmap::InitStandardHandlers(); - - return true; -} - -// ---------------------------------------------------------------------------- -// cleanup -// ---------------------------------------------------------------------------- - -wxAppBase::~wxAppBase() -{ - // this destructor is required for Darwin -} - -void wxAppBase::CleanUp() -{ - // clean up all the pending objects - DeletePendingObjects(); - - // and any remaining TLWs (they remove themselves from wxTopLevelWindows - // when destroyed, so iterate until none are left) - while ( !wxTopLevelWindows.empty() ) - { - // do not use Destroy() here as it only puts the TLW in pending list - // but we want to delete them now - delete wxTopLevelWindows.GetFirst()->GetData(); - } - - // undo everything we did in Initialize() above - wxBitmap::CleanUpHandlers(); - - wxStockGDI::DeleteAll(); - - wxDeleteStockLists(); - - delete wxTheColourDatabase; - wxTheColourDatabase = NULL; - - delete wxPendingEvents; - wxPendingEvents = NULL; - -#if wxUSE_THREADS - delete wxPendingEventsLocker; - wxPendingEventsLocker = NULL; - - #if wxUSE_VALIDATORS - // If we don't do the following, we get an apparent memory leak. - ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); - #endif // wxUSE_VALIDATORS -#endif // wxUSE_THREADS -} - -// ---------------------------------------------------------------------------- -// various accessors -// ---------------------------------------------------------------------------- - -wxWindow* wxAppBase::GetTopWindow() const -{ - wxWindow* window = m_topWindow; - if (window == NULL && wxTopLevelWindows.GetCount() > 0) - window = wxTopLevelWindows.GetFirst()->GetData(); - return window; -} - -wxVideoMode wxAppBase::GetDisplayMode() const -{ - return wxVideoMode(); -} - -wxLayoutDirection wxAppBase::GetLayoutDirection() const -{ -#if wxUSE_INTL - const wxLocale *const locale = wxGetLocale(); - if ( locale ) - { - const wxLanguageInfo *const - info = wxLocale::GetLanguageInfo(locale->GetLanguage()); - - if ( info ) - return info->LayoutDirection; - } -#endif // wxUSE_INTL - - // we don't know - return wxLayout_Default; -} - -#if wxUSE_CMDLINE_PARSER - -// ---------------------------------------------------------------------------- -// GUI-specific command line options handling -// ---------------------------------------------------------------------------- - -#define OPTION_THEME _T("theme") -#define OPTION_MODE _T("mode") - -void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) -{ - // first add the standard non GUI options - wxAppConsole::OnInitCmdLine(parser); - - // the standard command line options - static const wxCmdLineEntryDesc cmdLineGUIDesc[] = - { -#ifdef __WXUNIVERSAL__ - { - wxCMD_LINE_OPTION, - wxEmptyString, - OPTION_THEME, - gettext_noop("specify the theme to use"), - wxCMD_LINE_VAL_STRING, - 0x0 - }, -#endif // __WXUNIVERSAL__ - -#if defined(__WXMGL__) - // VS: this is not specific to wxMGL, all fullscreen (framebuffer) ports - // should provide this option. That's why it is in common/appcmn.cpp - // and not mgl/app.cpp - { - wxCMD_LINE_OPTION, - wxEmptyString, - OPTION_MODE, - gettext_noop("specify display mode to use (e.g. 640x480-16)"), - wxCMD_LINE_VAL_STRING, - 0x0 - }, -#endif // __WXMGL__ - - // terminator - { - wxCMD_LINE_NONE, - wxEmptyString, - wxEmptyString, - wxEmptyString, - wxCMD_LINE_VAL_NONE, - 0x0 - } - }; - - parser.SetDesc(cmdLineGUIDesc); -} - -bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) -{ -#ifdef __WXUNIVERSAL__ - wxString themeName; - if ( parser.Found(OPTION_THEME, &themeName) ) - { - wxTheme *theme = wxTheme::Create(themeName); - if ( !theme ) - { - wxLogError(_("Unsupported theme '%s'."), themeName.c_str()); - return false; - } - - // Delete the defaultly created theme and set the new theme. - delete wxTheme::Get(); - wxTheme::Set(theme); - } -#endif // __WXUNIVERSAL__ - -#if defined(__WXMGL__) - wxString modeDesc; - if ( parser.Found(OPTION_MODE, &modeDesc) ) - { - unsigned w, h, bpp; - if ( wxSscanf(modeDesc.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3 ) - { - wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str()); - return false; - } - - if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) ) - return false; - } -#endif // __WXMGL__ - - return wxAppConsole::OnCmdLineParsed(parser); -} - -#endif // wxUSE_CMDLINE_PARSER - -// ---------------------------------------------------------------------------- -// main event loop implementation -// ---------------------------------------------------------------------------- - -int wxAppBase::MainLoop() -{ - wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop); - - return m_mainLoop->Run(); -} - -void wxAppBase::ExitMainLoop() -{ - // we should exit from the main event loop, not just any currently active - // (e.g. modal dialog) event loop - if ( m_mainLoop && m_mainLoop->IsRunning() ) - { - m_mainLoop->Exit(0); - } -} - -bool wxAppBase::Pending() -{ - // use the currently active message loop here, not m_mainLoop, because if - // we're showing a modal dialog (with its own event loop) currently the - // main event loop is not running anyhow - wxEventLoop * const loop = wxEventLoop::GetActive(); - - return loop && loop->Pending(); -} - -bool wxAppBase::Dispatch() -{ - // see comment in Pending() - wxEventLoop * const loop = wxEventLoop::GetActive(); - - return loop && loop->Dispatch(); -} - -// ---------------------------------------------------------------------------- -// OnXXX() hooks -// ---------------------------------------------------------------------------- - -bool wxAppBase::OnInitGui() -{ -#ifdef __WXUNIVERSAL__ - if ( !wxTheme::Get() && !wxTheme::CreateDefault() ) - return false; -#endif // __WXUNIVERSAL__ - - return true; -} - -int wxAppBase::OnRun() -{ - // see the comment in ctor: if the initial value hasn't been changed, use - // the default Yes from now on - if ( m_exitOnFrameDelete == Later ) - { - m_exitOnFrameDelete = Yes; - } - //else: it has been changed, assume the user knows what he is doing - - return MainLoop(); -} - -int wxAppBase::OnExit() -{ -#ifdef __WXUNIVERSAL__ - delete wxTheme::Set(NULL); -#endif // __WXUNIVERSAL__ - - return wxAppConsole::OnExit(); -} - -void wxAppBase::Exit() -{ - ExitMainLoop(); -} - -wxAppTraits *wxAppBase::CreateTraits() -{ - return new wxGUIAppTraits; -} - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus)) -{ - if ( active == m_isActive ) - return; - - m_isActive = active; - - wxActivateEvent event(wxEVT_ACTIVATE_APP, active); - event.SetEventObject(this); - - (void)ProcessEvent(event); -} - -// ---------------------------------------------------------------------------- -// idle handling -// ---------------------------------------------------------------------------- - -void wxAppBase::DeletePendingObjects() -{ - wxList::compatibility_iterator node = wxPendingDelete.GetFirst(); - while (node) - { - wxObject *obj = node->GetData(); - - // remove it from the list first so that if we get back here somehow - // during the object deletion (e.g. wxYield called from its dtor) we - // wouldn't try to delete it the second time - if ( wxPendingDelete.Member(obj) ) - wxPendingDelete.Erase(node); - - delete obj; - - // Deleting one object may have deleted other pending - // objects, so start from beginning of list again. - node = wxPendingDelete.GetFirst(); - } -} - -// Returns true if more time is needed. -bool wxAppBase::ProcessIdle() -{ - // process pending wx events before sending idle events - ProcessPendingEvents(); - - wxIdleEvent event; - bool needMore = false; - wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); - while (node) - { - wxWindow* win = node->GetData(); - if (SendIdleEvents(win, event)) - needMore = true; - node = node->GetNext(); - } - - event.SetEventObject(this); - (void) ProcessEvent(event); - if (event.MoreRequested()) - needMore = true; - - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); - -#if wxUSE_LOG - // flush the logged messages if any - wxLog::FlushActive(); -#endif - - wxUpdateUIEvent::ResetUpdateTime(); - - return needMore; -} - -// Send idle event to window and all subwindows -bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event) -{ - bool needMore = false; - - win->OnInternalIdle(); - - if (wxIdleEvent::CanSend(win)) - { - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); - - if (event.MoreRequested()) - needMore = true; - } - wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - while ( node ) - { - wxWindow *child = node->GetData(); - if (SendIdleEvents(child, event)) - needMore = true; - - node = node->GetNext(); - } - - return needMore; -} - -void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event)) -{ -} - -// ---------------------------------------------------------------------------- -// exceptions support -// ---------------------------------------------------------------------------- - -#if wxUSE_EXCEPTIONS - -bool wxAppBase::OnExceptionInMainLoop() -{ - throw; - - // some compilers are too stupid to know that we never return after throw -#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200) - return false; -#endif -} - -#endif // wxUSE_EXCEPTIONS - -// ---------------------------------------------------------------------------- -// wxGUIAppTraitsBase -// ---------------------------------------------------------------------------- - -#if wxUSE_LOG - -wxLog *wxGUIAppTraitsBase::CreateLogTarget() -{ -#if wxUSE_LOGGUI - return new wxLogGui; -#else - // we must have something! - return new wxLogStderr; -#endif -} - -#endif // wxUSE_LOG - -wxMessageOutput *wxGUIAppTraitsBase::CreateMessageOutput() -{ - // The standard way of printing help on command line arguments (app --help) - // is (according to common practice): - // - console apps: to stderr (on any platform) - // - GUI apps: stderr on Unix platforms (!) - // message box under Windows and others -#ifdef __UNIX__ - return new wxMessageOutputStderr; -#else // !__UNIX__ - // wxMessageOutputMessageBox doesn't work under Motif - #ifdef __WXMOTIF__ - return new wxMessageOutputLog; - #else - return new wxMessageOutputMessageBox; - #endif -#endif // __UNIX__/!__UNIX__ -} - -#if wxUSE_FONTMAP - -wxFontMapper *wxGUIAppTraitsBase::CreateFontMapper() -{ - return new wxFontMapper; -} - -#endif // wxUSE_FONTMAP - -wxRendererNative *wxGUIAppTraitsBase::CreateRenderer() -{ - // use the default native renderer by default - return NULL; -} - -#ifdef __WXDEBUG__ - -bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) -{ -#if defined(__WXMSW__) || !wxUSE_MSGDLG - // under MSW we prefer to use the base class version using ::MessageBox() - // even if wxMessageBox() is available because it has less chances to - // double fault our app than our wxMessageBox() - return wxAppTraitsBase::ShowAssertDialog(msg); -#else // wxUSE_MSGDLG - wxString msgDlg = msg; - -#if wxUSE_STACKWALKER - // on Unix stack frame generation may take some time, depending on the - // size of the executable mainly... warn the user that we are working - wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait")); - fflush(stderr); - - const wxString stackTrace = GetAssertStackTrace(); - if ( !stackTrace.empty() ) - msgDlg << _T("\n\nCall stack:\n") << stackTrace; -#endif // wxUSE_STACKWALKER - - // this message is intentionally not translated -- it is for - // developpers only - msgDlg += wxT("\nDo you want to stop the program?\n") - wxT("You can also choose [Cancel] to suppress ") - wxT("further warnings."); - -#ifdef __WXMAC__ - // in order to avoid reentrancy problems, use the lowest alert API available - CFOptionFlags exitButton; - wxMacCFStringHolder cfText(msgDlg); - OSStatus err = CFUserNotificationDisplayAlert( - 0, kAlertStopAlert, NULL, NULL, NULL, CFSTR("wxWidgets Debug Alert"), cfText, - CFSTR("Yes"), CFSTR("No"), CFSTR("Cancel"), &exitButton ); - if ( err == noErr ) - { - switch( exitButton ) - { - case 0 : // yes - wxTrap(); - break; - case 2 : // cancel - // no more asserts - return true; - case 1 : // no -> nothing to do - break ; - } - } -#else - switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), - wxYES_NO | wxCANCEL | wxICON_STOP ) ) - { - case wxYES: - wxTrap(); - break; - - case wxCANCEL: - // no more asserts - return true; - - //case wxNO: nothing to do - } -#endif - return false; -#endif // !wxUSE_MSGDLG/wxUSE_MSGDLG -} - -#endif // __WXDEBUG__ - -bool wxGUIAppTraitsBase::HasStderr() -{ - // we consider that under Unix stderr always goes somewhere, even if the - // user doesn't always see it under GUI desktops -#ifdef __UNIX__ - return true; -#else - return false; -#endif -} - -void wxGUIAppTraitsBase::ScheduleForDestroy(wxObject *object) -{ - if ( !wxPendingDelete.Member(object) ) - wxPendingDelete.Append(object); -} - -void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) -{ - wxPendingDelete.DeleteObject(object); -} - -#if wxUSE_SOCKETS - -#if defined(__WINDOWS__) - #include "wx/msw/gsockmsw.h" -#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__) - #include "wx/unix/gsockunx.h" -#elif defined(__WXMAC__) - #include - #define OTUNIXERRORS 1 - #include - #include - #include - - #include "wx/mac/gsockmac.h" -#else - #error "Must include correct GSocket header here" -#endif - -GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() -{ -#if defined(__WXMAC__) && !defined(__DARWIN__) - // NB: wxMac CFM does not have any GUI-specific functions in gsocket.c and - // so it doesn't need this table at all - return NULL; -#else // !__WXMAC__ || __DARWIN__ - static GSocketGUIFunctionsTableConcrete table; - return &table; -#endif // !__WXMAC__ || __DARWIN__ -} - -#endif diff --git a/Source/3rdParty/wx/src/common/arcall.cpp b/Source/3rdParty/wx/src/common/arcall.cpp deleted file mode 100644 index bedf19bec..000000000 --- a/Source/3rdParty/wx/src/common/arcall.cpp +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/arcall.cpp -// Purpose: wxArchive link all archive streams -// Author: Mike Wetherell -// RCS-ID: $Id: arcall.cpp 42508 2006-10-27 09:53:38Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ARCHIVE_STREAMS - -#if wxUSE_ZIPSTREAM -#include "wx/zipstrm.h" -#endif -#if wxUSE_TARSTREAM -#include "wx/tarstrm.h" -#endif - -// Reference archive classes to ensure they are linked into a statically -// linked program that uses Find or GetFirst to look for an archive handler. -// It is in its own file so that the user can override this behaviour by -// providing their own implementation. - -void wxUseArchiveClasses() -{ -#if wxUSE_ZIPSTREAM - wxZipClassFactory(); -#endif -#if wxUSE_TARSTREAM - wxTarClassFactory(); -#endif -} - -#endif // wxUSE_ARCHIVE_STREAMS diff --git a/Source/3rdParty/wx/src/common/arcfind.cpp b/Source/3rdParty/wx/src/common/arcfind.cpp deleted file mode 100644 index c105dc640..000000000 --- a/Source/3rdParty/wx/src/common/arcfind.cpp +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/arcfind.cpp -// Purpose: Streams for archive formats -// Author: Mike Wetherell -// RCS-ID: $Id: arcfind.cpp 42508 2006-10-27 09:53:38Z MW $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ARCHIVE_STREAMS - -#include "wx/archive.h" - -// These functions are in a separate file so that statically linked apps -// that do not call them to search for archive handlers will only link in -// the archive classes they use. - -const wxArchiveClassFactory * -wxArchiveClassFactory::Find(const wxChar *protocol, wxStreamProtocolType type) -{ - for (const wxArchiveClassFactory *f = GetFirst(); f; f = f->GetNext()) - if (f->CanHandle(protocol, type)) - return f; - - return NULL; -} - -// static -const wxArchiveClassFactory *wxArchiveClassFactory::GetFirst() -{ - if (!sm_first) - wxUseArchiveClasses(); - return sm_first; -} - -#endif // wxUSE_ARCHIVE_STREAMS diff --git a/Source/3rdParty/wx/src/common/archive.cpp b/Source/3rdParty/wx/src/common/archive.cpp deleted file mode 100644 index 1c2dfdb44..000000000 --- a/Source/3rdParty/wx/src/common/archive.cpp +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/archive.cpp -// Purpose: Streams for archive formats -// Author: Mike Wetherell -// RCS-ID: $Id: archive.cpp 42508 2006-10-27 09:53:38Z MW $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS - -#include "wx/archive.h" - -IMPLEMENT_ABSTRACT_CLASS(wxArchiveEntry, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxArchiveClassFactory, wxFilterClassFactoryBase) - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveInputStream - -wxArchiveInputStream::wxArchiveInputStream(wxInputStream& stream, - wxMBConv& conv) - : wxFilterInputStream(stream), - m_conv(conv) -{ -} - -wxArchiveInputStream::wxArchiveInputStream(wxInputStream *stream, - wxMBConv& conv) - : wxFilterInputStream(stream), - m_conv(conv) -{ -} - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveOutputStream - -wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream& stream, - wxMBConv& conv) - : wxFilterOutputStream(stream), - m_conv(conv) -{ -} - -wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream *stream, - wxMBConv& conv) - : wxFilterOutputStream(stream), - m_conv(conv) -{ -} - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveEntry - -void wxArchiveEntry::SetNotifier(wxArchiveNotifier& notifier) -{ - UnsetNotifier(); - m_notifier = ¬ifier; - m_notifier->OnEntryUpdated(*this); -} - -wxArchiveEntry& wxArchiveEntry::operator=(const wxArchiveEntry& WXUNUSED(e)) -{ - m_notifier = NULL; - return *this; -} - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveClassFactory - -wxArchiveClassFactory *wxArchiveClassFactory::sm_first = NULL; - -void wxArchiveClassFactory::Remove() -{ - if (m_next != this) - { - wxArchiveClassFactory **pp = &sm_first; - - while (*pp != this) - pp = &(*pp)->m_next; - - *pp = m_next; - - m_next = this; - } -} - -#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS diff --git a/Source/3rdParty/wx/src/common/artprov.cpp b/Source/3rdParty/wx/src/common/artprov.cpp deleted file mode 100644 index 5fec0e1c9..000000000 --- a/Source/3rdParty/wx/src/common/artprov.cpp +++ /dev/null @@ -1,354 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/artprov.cpp -// Purpose: wxArtProvider class -// Author: Vaclav Slavik -// Modified by: -// Created: 18/03/2002 -// RCS-ID: $Id: artprov.cpp 57701 2008-12-31 23:40:06Z VS $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#include "wx/artprov.h" - -#ifndef WX_PRECOMP - #include "wx/list.h" - #include "wx/log.h" - #include "wx/hashmap.h" - #include "wx/image.h" - #include "wx/module.h" -#endif - -#ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" -#endif - -// =========================================================================== -// implementation -// =========================================================================== - -#include "wx/listimpl.cpp" -WX_DECLARE_LIST(wxArtProvider, wxArtProvidersList); -WX_DEFINE_LIST(wxArtProvidersList) - -// ---------------------------------------------------------------------------- -// Cache class - stores already requested bitmaps -// ---------------------------------------------------------------------------- - -WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmap, wxArtProviderBitmapsHash); - -class WXDLLEXPORT wxArtProviderCache -{ -public: - bool GetBitmap(const wxString& full_id, wxBitmap* bmp); - void PutBitmap(const wxString& full_id, const wxBitmap& bmp) - { m_bitmapsHash[full_id] = bmp; } - - void Clear(); - - static wxString ConstructHashID(const wxArtID& id, - const wxArtClient& client, - const wxSize& size); - -private: - wxArtProviderBitmapsHash m_bitmapsHash; -}; - -bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp) -{ - wxArtProviderBitmapsHash::iterator entry = m_bitmapsHash.find(full_id); - if ( entry == m_bitmapsHash.end() ) - { - return false; - } - else - { - *bmp = entry->second; - return true; - } -} - -void wxArtProviderCache::Clear() -{ - m_bitmapsHash.clear(); -} - -/*static*/ wxString wxArtProviderCache::ConstructHashID( - const wxArtID& id, const wxArtClient& client, - const wxSize& size) -{ - wxString str; - str.Printf(wxT("%s-%s-%i-%i"), id.c_str(), client.c_str(), size.x, size.y); - return str; -} - - -// ============================================================================ -// wxArtProvider class -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxArtProvider, wxObject) - -wxArtProvidersList *wxArtProvider::sm_providers = NULL; -wxArtProviderCache *wxArtProvider::sm_cache = NULL; - -// ---------------------------------------------------------------------------- -// wxArtProvider ctors/dtor -// ---------------------------------------------------------------------------- - -wxArtProvider::~wxArtProvider() -{ - Remove(this); -} - -// ---------------------------------------------------------------------------- -// wxArtProvider operations on provider stack -// ---------------------------------------------------------------------------- - -/*static*/ void wxArtProvider::CommonAddingProvider() -{ - if ( !sm_providers ) - { - sm_providers = new wxArtProvidersList; - sm_cache = new wxArtProviderCache; - } - - sm_cache->Clear(); -} - -/*static*/ void wxArtProvider::Push(wxArtProvider *provider) -{ - CommonAddingProvider(); - sm_providers->Insert(provider); -} - -/*static*/ void wxArtProvider::Insert(wxArtProvider *provider) -{ - CommonAddingProvider(); - sm_providers->Append(provider); -} - -/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider) -{ - Insert(provider); -} - -/*static*/ bool wxArtProvider::Pop() -{ - wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") ); - wxCHECK_MSG( !sm_providers->empty(), false, _T("wxArtProviders stack is empty") ); - - delete sm_providers->GetFirst()->GetData(); - sm_cache->Clear(); - return true; -} - -/*static*/ bool wxArtProvider::Remove(wxArtProvider *provider) -{ - wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") ); - - if ( sm_providers->DeleteObject(provider) ) - { - sm_cache->Clear(); - return true; - } - - return false; -} - -/*static*/ bool wxArtProvider::Delete(wxArtProvider *provider) -{ - // provider will remove itself from the stack in its dtor - delete provider; - - return true; -} - -/*static*/ void wxArtProvider::CleanUpProviders() -{ - if ( sm_providers ) - { - while ( !sm_providers->empty() ) - delete *sm_providers->begin(); - - delete sm_providers; - sm_providers = NULL; - - delete sm_cache; - sm_cache = NULL; - } -} - -// ---------------------------------------------------------------------------- -// wxArtProvider: retrieving bitmaps/icons -// ---------------------------------------------------------------------------- - -/*static*/ wxBitmap wxArtProvider::GetBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& size) -{ - // safety-check against writing client,id,size instead of id,client,size: - wxASSERT_MSG( client.Last() == _T('C'), _T("invalid 'client' parameter") ); - - wxCHECK_MSG( sm_providers, wxNullBitmap, _T("no wxArtProvider exists") ); - - wxString hashId = wxArtProviderCache::ConstructHashID(id, client, size); - - wxBitmap bmp; - if ( !sm_cache->GetBitmap(hashId, &bmp) ) - { - for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst(); - node; node = node->GetNext()) - { - bmp = node->GetData()->CreateBitmap(id, client, size); - if ( bmp.Ok() ) - { -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - if ( size != wxDefaultSize && - (bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) ) - { - wxImage img = bmp.ConvertToImage(); - img.Rescale(size.x, size.y); - bmp = wxBitmap(img); - } -#endif - break; - } - } - - sm_cache->PutBitmap(hashId, bmp); - } - - return bmp; -} - -/*static*/ wxIcon wxArtProvider::GetIcon(const wxArtID& id, - const wxArtClient& client, - const wxSize& size) -{ - wxCHECK_MSG( sm_providers, wxNullIcon, _T("no wxArtProvider exists") ); - - wxBitmap bmp = GetBitmap(id, client, size); - if ( !bmp.Ok() ) - return wxNullIcon; - - wxIcon icon; - icon.CopyFromBitmap(bmp); - return icon; -} - -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/private.h" - extern GtkIconSize wxArtClientToIconSize(const wxArtClient& client); -#endif // defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - -/*static*/ wxSize wxArtProvider::GetSizeHint(const wxArtClient& client, - bool platform_dependent) -{ - if (!platform_dependent) - { - wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst(); - if (node) - return node->GetData()->DoGetSizeHint(client); - } - - // else return platform dependent size - -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - // Gtk has specific sizes for each client, see artgtk.cpp - GtkIconSize gtk_size = wxArtClientToIconSize(client); - // no size hints for this client - if (gtk_size == GTK_ICON_SIZE_INVALID) - return wxDefaultSize; - gint width, height; - gtk_icon_size_lookup( gtk_size, &width, &height); - return wxSize(width, height); -#else // !GTK+ 2 - // NB: These size hints may have to be adjusted per platform - if (client == wxART_TOOLBAR) - return wxSize(16, 15); - else if (client == wxART_MENU) - return wxSize(16, 15); - else if (client == wxART_FRAME_ICON) - { -#ifdef __WXMSW__ - return wxSize(::GetSystemMetrics(SM_CXSMICON), - ::GetSystemMetrics(SM_CYSMICON)); -#else - return wxSize(16, 16); -#endif // __WXMSW__/!__WXMSW__ - } - else if (client == wxART_CMN_DIALOG || client == wxART_MESSAGE_BOX) - return wxSize(32, 32); - else if (client == wxART_HELP_BROWSER) - return wxSize(16, 15); - else if (client == wxART_BUTTON) - return wxSize(16, 15); - else // wxART_OTHER or perhaps a user's client, no specified size - return wxDefaultSize; -#endif // GTK+ 2/else -} - -// ---------------------------------------------------------------------------- -// deprecated wxArtProvider methods -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 - -/* static */ void wxArtProvider::PushProvider(wxArtProvider *provider) -{ - Push(provider); -} - -/* static */ void wxArtProvider::InsertProvider(wxArtProvider *provider) -{ - Insert(provider); -} - -/* static */ bool wxArtProvider::PopProvider() -{ - return Pop(); -} - -/* static */ bool wxArtProvider::RemoveProvider(wxArtProvider *provider) -{ - // RemoveProvider() used to delete the provider being removed so this is - // not a typo, we must call Delete() and not Remove() here - return Delete(provider); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ============================================================================ -// wxArtProviderModule -// ============================================================================ - -class wxArtProviderModule: public wxModule -{ -public: - bool OnInit() - { - wxArtProvider::InitStdProvider(); - wxArtProvider::InitNativeProvider(); - return true; - } - void OnExit() - { - wxArtProvider::CleanUpProviders(); - } - - DECLARE_DYNAMIC_CLASS(wxArtProviderModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxArtProviderModule, wxModule) diff --git a/Source/3rdParty/wx/src/common/artstd.cpp b/Source/3rdParty/wx/src/common/artstd.cpp deleted file mode 100644 index c50aae5f6..000000000 --- a/Source/3rdParty/wx/src/common/artstd.cpp +++ /dev/null @@ -1,267 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/artstd.cpp -// Purpose: stock wxArtProvider instance with default wxWin art -// Author: Vaclav Slavik -// Modified by: -// Created: 18/03/2002 -// RCS-ID: $Id: artstd.cpp 52561 2008-03-16 00:36:37Z VS $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/image.h" -#endif - -#include "wx/artprov.h" - -// ---------------------------------------------------------------------------- -// wxDefaultArtProvider -// ---------------------------------------------------------------------------- - -class wxDefaultArtProvider : public wxArtProvider -{ -protected: - virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size); -}; - -// ---------------------------------------------------------------------------- -// helper macros -// ---------------------------------------------------------------------------- - -// Standard macro for getting a resource from XPM file: -#define ART(artId, xpmRc) \ - if ( id == artId ) return wxBitmap(xpmRc##_xpm); - -// There are two ways of getting the standard icon: either via XPMs or via -// wxIcon ctor. This depends on the platform: -#if defined(__WXUNIVERSAL__) - #define CREATE_STD_ICON(iconId, xpmRc) return wxNullBitmap; -#elif defined(__WXGTK__) || defined(__WXMOTIF__) - #define CREATE_STD_ICON(iconId, xpmRc) return wxBitmap(xpmRc##_xpm); -#else - #define CREATE_STD_ICON(iconId, xpmRc) \ - { \ - wxIcon icon(_T(iconId)); \ - wxBitmap bmp; \ - bmp.CopyFromIcon(icon); \ - return bmp; \ - } -#endif - -// Macro used in CreateBitmap to get wxICON_FOO icons: -#define ART_MSGBOX(artId, iconId, xpmRc) \ - if ( id == artId ) \ - { \ - CREATE_STD_ICON(#iconId, xpmRc) \ - } - -// ---------------------------------------------------------------------------- -// wxArtProvider::InitStdProvider -// ---------------------------------------------------------------------------- - -/*static*/ void wxArtProvider::InitStdProvider() -{ - wxArtProvider::Push(new wxDefaultArtProvider); -} - -#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__) -/*static*/ void wxArtProvider::InitNativeProvider() -{ -} -#endif - - -// ---------------------------------------------------------------------------- -// XPMs with the art -// ---------------------------------------------------------------------------- - - -#if defined(__WXGTK__) - #include "../../art/gtk/info.xpm" - #include "../../art/gtk/error.xpm" - #include "../../art/gtk/warning.xpm" - #include "../../art/gtk/question.xpm" -#elif defined(__WXMOTIF__) - #include "../../art/motif/info.xpm" - #include "../../art/motif/error.xpm" - #include "../../art/motif/warning.xpm" - #include "../../art/motif/question.xpm" -#endif - -#if wxUSE_HTML - #include "../../art/htmsidep.xpm" - #include "../../art/htmoptns.xpm" - #include "../../art/htmbook.xpm" - #include "../../art/htmfoldr.xpm" - #include "../../art/htmpage.xpm" -#endif // wxUSE_HTML - -#include "../../art/missimg.xpm" -#include "../../art/addbookm.xpm" -#include "../../art/delbookm.xpm" -#include "../../art/back.xpm" -#include "../../art/forward.xpm" -#include "../../art/up.xpm" -#include "../../art/down.xpm" -#include "../../art/toparent.xpm" -#include "../../art/fileopen.xpm" -#include "../../art/print.xpm" -#include "../../art/helpicon.xpm" -#include "../../art/tipicon.xpm" -#include "../../art/home.xpm" -#include "../../art/repview.xpm" -#include "../../art/listview.xpm" -#include "../../art/new_dir.xpm" -#include "../../art/harddisk.xpm" -#include "../../art/cdrom.xpm" -#include "../../art/floppy.xpm" -#include "../../art/removable.xpm" -#include "../../art/folder.xpm" -#include "../../art/folder_open.xpm" -#include "../../art/dir_up.xpm" -#include "../../art/exefile.xpm" -#include "../../art/deffile.xpm" -#include "../../art/tick.xpm" -#include "../../art/cross.xpm" - -#include "../../art/filesave.xpm" -#include "../../art/filesaveas.xpm" -#include "../../art/copy.xpm" -#include "../../art/cut.xpm" -#include "../../art/paste.xpm" -#include "../../art/delete.xpm" -#include "../../art/new.xpm" -#include "../../art/undo.xpm" -#include "../../art/redo.xpm" -#include "../../art/quit.xpm" -#include "../../art/find.xpm" -#include "../../art/findrepl.xpm" - - - -wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) -{ - // wxMessageBox icons: - ART_MSGBOX(wxART_ERROR, wxICON_ERROR, error) - ART_MSGBOX(wxART_INFORMATION, wxICON_INFORMATION, info) - ART_MSGBOX(wxART_WARNING, wxICON_WARNING, warning) - ART_MSGBOX(wxART_QUESTION, wxICON_QUESTION, question) - - // standard icons: -#if wxUSE_HTML - ART(wxART_HELP_SIDE_PANEL, htmsidep) - ART(wxART_HELP_SETTINGS, htmoptns) - ART(wxART_HELP_BOOK, htmbook) - ART(wxART_HELP_FOLDER, htmfoldr) - ART(wxART_HELP_PAGE, htmpage) -#endif // wxUSE_HTML - ART(wxART_MISSING_IMAGE, missimg) - ART(wxART_ADD_BOOKMARK, addbookm) - ART(wxART_DEL_BOOKMARK, delbookm) - ART(wxART_GO_BACK, back) - ART(wxART_GO_FORWARD, forward) - ART(wxART_GO_UP, up) - ART(wxART_GO_DOWN, down) - ART(wxART_GO_TO_PARENT, toparent) - ART(wxART_GO_HOME, home) - ART(wxART_FILE_OPEN, fileopen) - ART(wxART_PRINT, print) - ART(wxART_HELP, helpicon) - ART(wxART_TIP, tipicon) - ART(wxART_REPORT_VIEW, repview) - ART(wxART_LIST_VIEW, listview) - ART(wxART_NEW_DIR, new_dir) - ART(wxART_HARDDISK, harddisk) - ART(wxART_FLOPPY, floppy) - ART(wxART_CDROM, cdrom) - ART(wxART_REMOVABLE, removable) - ART(wxART_FOLDER, folder) - ART(wxART_FOLDER_OPEN, folder_open) - ART(wxART_GO_DIR_UP, dir_up) - ART(wxART_EXECUTABLE_FILE, exefile) - ART(wxART_NORMAL_FILE, deffile) - ART(wxART_TICK_MARK, tick) - ART(wxART_CROSS_MARK, cross) - - ART(wxART_FILE_SAVE, filesave) - ART(wxART_FILE_SAVE_AS, filesaveas) - ART(wxART_COPY, copy) - ART(wxART_CUT, cut) - ART(wxART_PASTE, paste) - ART(wxART_DELETE, delete) - ART(wxART_UNDO, undo) - ART(wxART_REDO, redo) - ART(wxART_QUIT, quit) - ART(wxART_FIND, find) - ART(wxART_FIND_AND_REPLACE, findrepl) - ART(wxART_NEW, new) - - - return wxNullBitmap; -} - -// ---------------------------------------------------------------------------- -// CreateBitmap routine -// ---------------------------------------------------------------------------- - -wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& reqSize) -{ - wxBitmap bmp = wxDefaultArtProvider_CreateBitmap(id); - -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - if (bmp.Ok()) - { - // fit into transparent image with desired size hint from the client - if (reqSize == wxDefaultSize) - { - // find out if there is a desired size for this client - wxSize bestSize = GetSizeHint(client); - if (bestSize != wxDefaultSize) - { - int bmp_w = bmp.GetWidth(); - int bmp_h = bmp.GetHeight(); - - if ((bmp_h < bestSize.x) && (bmp_w < bestSize.y)) - { - // the caller wants default size, which is larger than - // the image we have; to avoid degrading it visually by - // scaling it up, paste it into transparent image instead: - wxPoint offset((bestSize.x - bmp_w)/2, (bestSize.y - bmp_h)/2); - wxImage img = bmp.ConvertToImage(); - img.Resize(bestSize, offset); - bmp = wxBitmap(img); - } - else // scale (down or mixed, but not up) - { - wxImage img = bmp.ConvertToImage(); - bmp = wxBitmap - ( - img.Scale(bestSize.x, bestSize.y, - wxIMAGE_QUALITY_HIGH) - ); - } - } - } - } -#else - wxUnusedVar(client); - wxUnusedVar(reqSize); -#endif // wxUSE_IMAGE - - return bmp; -} diff --git a/Source/3rdParty/wx/src/common/bmpbase.cpp b/Source/3rdParty/wx/src/common/bmpbase.cpp deleted file mode 100644 index 0c7edd3ac..000000000 --- a/Source/3rdParty/wx/src/common/bmpbase.cpp +++ /dev/null @@ -1,211 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/bmpbase.cpp -// Purpose: wxBitmapBase -// Author: VaclavSlavik -// Created: 2001/04/11 -// RCS-ID: $Id: bmpbase.cpp 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) 2001, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/bitmap.h" - -#ifndef WX_PRECOMP - #include "wx/colour.h" - #include "wx/icon.h" - #include "wx/image.h" -#endif // WX_PRECOMP - -// ---------------------------------------------------------------------------- -// wxVariant support -// ---------------------------------------------------------------------------- - -#if wxUSE_VARIANT -IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxBitmap,WXDLLEXPORT) -IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT) -#endif - -// ---------------------------------------------------------------------------- -// wxBitmapBase -// ---------------------------------------------------------------------------- - -#if wxUSE_BITMAP_BASE - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/palette.h" - #include "wx/module.h" -#endif // WX_PRECOMP - - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject) -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject) - -wxList wxBitmapBase::sm_handlers; - -void wxBitmapBase::AddHandler(wxBitmapHandlerBase *handler) -{ - sm_handlers.Append(handler); -} - -void wxBitmapBase::InsertHandler(wxBitmapHandlerBase *handler) -{ - sm_handlers.Insert(handler); -} - -bool wxBitmapBase::RemoveHandler(const wxString& name) -{ - wxBitmapHandler *handler = FindHandler(name); - if ( handler ) - { - sm_handlers.DeleteObject(handler); - return true; - } - else - return false; -} - -wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while ( node ) - { - wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); - if ( handler->GetName() == name ) - return handler; - node = node->GetNext(); - } - return NULL; -} - -wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while ( node ) - { - wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); - if ( handler->GetExtension() == extension && - (bitmapType == wxBITMAP_TYPE_ANY || handler->GetType() == bitmapType) ) - return handler; - node = node->GetNext(); - } - return NULL; -} - -wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while ( node ) - { - wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); - if (handler->GetType() == bitmapType) - return handler; - node = node->GetNext(); - } - return NULL; -} - -void wxBitmapBase::CleanUpHandlers() -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while ( node ) - { - wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); - wxList::compatibility_iterator next = node->GetNext(); - delete handler; - sm_handlers.Erase(node); - node = next; - } -} - -bool wxBitmapHandlerBase::Create(wxBitmap*, const void*, long, int, int, int) -{ - return false; -} - -bool wxBitmapHandlerBase::LoadFile(wxBitmap*, const wxString&, long, int, int) -{ - return false; -} - -bool wxBitmapHandlerBase::SaveFile(const wxBitmap*, const wxString&, int, const wxPalette*) -{ - return false; -} - -class wxBitmapBaseModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) -public: - wxBitmapBaseModule() {} - bool OnInit() { wxBitmap::InitStandardHandlers(); return true; } - void OnExit() { wxBitmap::CleanUpHandlers(); } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule) - -#endif // wxUSE_BITMAP_BASE - -// ---------------------------------------------------------------------------- -// wxBitmap common -// ---------------------------------------------------------------------------- - -#if !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__)) - -wxBitmap::wxBitmap(const char* const* bits) -{ - wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data")); - -#if wxUSE_IMAGE && wxUSE_XPM - wxImage image(bits); - wxCHECK2_MSG(image.Ok(), return, wxT("invalid bitmap data")); - - *this = wxBitmap(image); -#else - wxFAIL_MSG(_T("creating bitmaps from XPMs not supported")); -#endif // wxUSE_IMAGE && wxUSE_XPM -} -#endif // !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__)) - -// ---------------------------------------------------------------------------- -// wxMaskBase -// ---------------------------------------------------------------------------- - -bool wxMaskBase::Create(const wxBitmap& bitmap, const wxColour& colour) -{ - FreeData(); - - return InitFromColour(bitmap, colour); -} - -#if wxUSE_PALETTE - -bool wxMaskBase::Create(const wxBitmap& bitmap, int paletteIndex) -{ - wxPalette *pal = bitmap.GetPalette(); - - wxCHECK_MSG( pal, false, - wxT("Cannot create mask from palette index of a bitmap without palette") ); - - unsigned char r,g,b; - pal->GetRGB(paletteIndex, &r, &g, &b); - - return Create(bitmap, wxColour(r, g, b)); -} - -#endif // wxUSE_PALETTE - -bool wxMaskBase::Create(const wxBitmap& bitmap) -{ - FreeData(); - - return InitFromMonoBitmap(bitmap); -} diff --git a/Source/3rdParty/wx/src/common/bookctrl.cpp b/Source/3rdParty/wx/src/common/bookctrl.cpp deleted file mode 100644 index ca6c2a590..000000000 --- a/Source/3rdParty/wx/src/common/bookctrl.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/bookctrl.cpp -// Purpose: wxBookCtrlBase implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: bookctrl.cpp 53783 2008-05-27 14:15:14Z SC $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BOOKCTRL - -#include "wx/imaglist.h" - -#include "wx/bookctrl.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxBookCtrlBase, wxControl) - -BEGIN_EVENT_TABLE(wxBookCtrlBase, wxControl) - EVT_SIZE(wxBookCtrlBase::OnSize) -#if wxUSE_HELP - EVT_HELP(wxID_ANY, wxBookCtrlBase::OnHelp) -#endif // wxUSE_HELP -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// constructors and destructors -// ---------------------------------------------------------------------------- - -void wxBookCtrlBase::Init() -{ - m_bookctrl = NULL; - m_imageList = NULL; - m_ownsImageList = false; - m_fitToCurrentPage = false; - -#if defined(__WXWINCE__) - m_internalBorder = 1; -#else - m_internalBorder = 5; -#endif - - m_controlMargin = 0; - m_controlSizer = NULL; -} - -bool -wxBookCtrlBase::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - return wxControl::Create - ( - parent, - id, - pos, - size, - style, - wxDefaultValidator, - name - ); -} - -wxBookCtrlBase::~wxBookCtrlBase() -{ - if ( m_ownsImageList ) - { - // may be NULL, ok - delete m_imageList; - } -} - -// ---------------------------------------------------------------------------- -// image list -// ---------------------------------------------------------------------------- - -void wxBookCtrlBase::SetImageList(wxImageList *imageList) -{ - if ( m_ownsImageList ) - { - // may be NULL, ok - delete m_imageList; - - m_ownsImageList = false; - } - - m_imageList = imageList; -} - -void wxBookCtrlBase::AssignImageList(wxImageList* imageList) -{ - SetImageList(imageList); - - m_ownsImageList = true; -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -void wxBookCtrlBase::DoInvalidateBestSize() -{ - // notice that it is not necessary to invalidate our own best size - // explicitly if we have m_bookctrl as it will already invalidate the best - // size of its parent when its own size is invalidated and its parent is - // this control - if ( m_bookctrl ) - m_bookctrl->InvalidateBestSize(); - else - wxControl::InvalidateBestSize(); -} - -void wxBookCtrlBase::SetPageSize(const wxSize& size) -{ - SetClientSize(CalcSizeFromPage(size)); -} - -wxSize wxBookCtrlBase::DoGetBestSize() const -{ - wxSize bestSize; - - // iterate over all pages, get the largest width and height - const size_t nCount = m_pages.size(); - for ( size_t nPage = 0; nPage < nCount; nPage++ ) - { - const wxWindow * const pPage = m_pages[nPage]; - if( pPage ) - { - wxSize childBestSize(pPage->GetBestSize()); - - if ( childBestSize.x > bestSize.x ) - bestSize.x = childBestSize.x; - - if ( childBestSize.y > bestSize.y ) - bestSize.y = childBestSize.y; - } - } - - if (m_fitToCurrentPage && GetCurrentPage()) - bestSize = GetCurrentPage()->GetBestSize(); - - // convert display area to window area, adding the size necessary for the - // tabs - wxSize best = CalcSizeFromPage(bestSize); - CacheBestSize(best); - return best; -} - -wxRect wxBookCtrlBase::GetPageRect() const -{ - const wxSize size = GetControllerSize(); - - wxPoint pt; - wxRect rectPage(pt, GetClientSize()); - - switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) - { - default: - wxFAIL_MSG( _T("unexpected alignment") ); - // fall through - - case wxBK_TOP: - rectPage.y = size.y + GetInternalBorder(); - // fall through - - case wxBK_BOTTOM: - rectPage.height -= size.y + GetInternalBorder(); - if (rectPage.height < 0) - rectPage.height = 0; - break; - - case wxBK_LEFT: - rectPage.x = size.x + GetInternalBorder(); - // fall through - - case wxBK_RIGHT: - rectPage.width -= size.x + GetInternalBorder(); - if (rectPage.width < 0) - rectPage.width = 0; - break; - } - - return rectPage; -} - -// Lay out controls -void wxBookCtrlBase::DoSize() -{ - if ( !m_bookctrl ) - { - // we're not fully created yet or OnSize() should be hidden by derived class - return; - } - - if (GetSizer()) - Layout(); - else - { - // resize controller and the page area to fit inside our new size - const wxSize sizeClient( GetClientSize() ), - sizeBorder( m_bookctrl->GetSize() - m_bookctrl->GetClientSize() ), - sizeCtrl( GetControllerSize() ); - - m_bookctrl->SetClientSize( sizeCtrl.x - sizeBorder.x, sizeCtrl.y - sizeBorder.y ); - // if this changes the visibility of the scrollbars the best size changes, relayout in this case - wxSize sizeCtrl2 = GetControllerSize(); - if ( sizeCtrl != sizeCtrl2 ) - { - wxSize sizeBorder2 = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(); - m_bookctrl->SetClientSize( sizeCtrl2.x - sizeBorder2.x, sizeCtrl2.y - sizeBorder2.y ); - } - - const wxSize sizeNew = m_bookctrl->GetSize(); - wxPoint posCtrl; - switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) - { - default: - wxFAIL_MSG( _T("unexpected alignment") ); - // fall through - - case wxBK_TOP: - case wxBK_LEFT: - // posCtrl is already ok - break; - - case wxBK_BOTTOM: - posCtrl.y = sizeClient.y - sizeNew.y; - break; - - case wxBK_RIGHT: - posCtrl.x = sizeClient.x - sizeNew.x; - break; - } - - if ( m_bookctrl->GetPosition() != posCtrl ) - m_bookctrl->Move(posCtrl); - } - - // resize all pages to fit the new control size - const wxRect pageRect = GetPageRect(); - const unsigned pagesCount = m_pages.Count(); - for ( unsigned int i = 0; i < pagesCount; ++i ) - { - wxWindow * const page = m_pages[i]; - if ( !page ) - { - wxASSERT_MSG( AllowNullPage(), - _T("Null page in a control that does not allow null pages?") ); - continue; - } - - page->SetSize(pageRect); - } -} - -void wxBookCtrlBase::OnSize(wxSizeEvent& event) -{ - event.Skip(); - - DoSize(); -} - -wxSize wxBookCtrlBase::GetControllerSize() const -{ - if(!m_bookctrl) - return wxSize(0,0); - - const wxSize sizeClient = GetClientSize(), - sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), - sizeCtrl = m_bookctrl->GetBestSize() + sizeBorder; - - wxSize size; - - if ( IsVertical() ) - { - size.x = sizeClient.x; - size.y = sizeCtrl.y; - } - else // left/right aligned - { - size.x = sizeCtrl.x; - size.y = sizeClient.y; - } - - return size; -} - -// ---------------------------------------------------------------------------- -// miscellaneous stuff -// ---------------------------------------------------------------------------- - -#if wxUSE_HELP - -void wxBookCtrlBase::OnHelp(wxHelpEvent& event) -{ - // determine where does this even originate from to avoid redirecting it - // back to the page which generated it (resulting in an infinite loop) - - // notice that we have to check in the hard(er) way instead of just testing - // if the event object == this because the book control can have other - // subcontrols inside it (e.g. wxSpinButton in case of a notebook in wxUniv) - wxWindow *source = wxStaticCast(event.GetEventObject(), wxWindow); - while ( source && source != this && source->GetParent() != this ) - { - source = source->GetParent(); - } - - if ( source && m_pages.Index(source) == wxNOT_FOUND ) - { - // this event is for the book control itself, redirect it to the - // corresponding page - wxWindow *page = NULL; - - if ( event.GetOrigin() == wxHelpEvent::Origin_HelpButton ) - { - // show help for the page under the mouse - const int pagePos = HitTest(ScreenToClient(event.GetPosition())); - - if ( pagePos != wxNOT_FOUND) - { - page = GetPage((size_t)pagePos); - } - } - else // event from keyboard or unknown source - { - // otherwise show the current page help - page = GetCurrentPage(); - } - - if ( page ) - { - // change event object to the page to avoid infinite recursion if - // we get this event ourselves if the page doesn't handle it - event.SetEventObject(page); - - if ( page->GetEventHandler()->ProcessEvent(event) ) - { - // don't call event.Skip() - return; - } - } - } - //else: event coming from one of our pages already - - event.Skip(); -} - -#endif // wxUSE_HELP - -// ---------------------------------------------------------------------------- -// pages management -// ---------------------------------------------------------------------------- - -bool -wxBookCtrlBase::InsertPage(size_t nPage, - wxWindow *page, - const wxString& WXUNUSED(text), - bool WXUNUSED(bSelect), - int WXUNUSED(imageId)) -{ - wxCHECK_MSG( page || AllowNullPage(), false, - _T("NULL page in wxBookCtrlBase::InsertPage()") ); - wxCHECK_MSG( nPage <= m_pages.size(), false, - _T("invalid page index in wxBookCtrlBase::InsertPage()") ); - - m_pages.Insert(page, nPage); - if ( page ) - page->SetSize(GetPageRect()); - - DoInvalidateBestSize(); - - return true; -} - -bool wxBookCtrlBase::DeletePage(size_t nPage) -{ - wxWindow *page = DoRemovePage(nPage); - if ( !(page || AllowNullPage()) ) - return false; - - // delete NULL is harmless - delete page; - - return true; -} - -wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage) -{ - wxCHECK_MSG( nPage < m_pages.size(), NULL, - _T("invalid page index in wxBookCtrlBase::DoRemovePage()") ); - - wxWindow *pageRemoved = m_pages[nPage]; - m_pages.RemoveAt(nPage); - DoInvalidateBestSize(); - - return pageRemoved; -} - -int wxBookCtrlBase::GetNextPage(bool forward) const -{ - int nPage; - - int nMax = GetPageCount(); - if ( nMax-- ) // decrement it to get the last valid index - { - int nSel = GetSelection(); - - // change selection wrapping if it becomes invalid - nPage = forward ? nSel == nMax ? 0 - : nSel + 1 - : nSel == 0 ? nMax - : nSel - 1; - } - else // notebook is empty, no next page - { - nPage = wxNOT_FOUND; - } - - return nPage; -} - -int wxBookCtrlBase::DoSetSelection(size_t n, int flags) -{ - wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND, - wxT("invalid page index in wxBookCtrlBase::DoSetSelection()") ); - - const int oldSel = GetSelection(); - - if ( n != (size_t)oldSel ) - { - wxBookCtrlBaseEvent *event = CreatePageChangingEvent(); - bool allowed = false; - - if ( flags & SetSelection_SendEvent ) - { - event->SetSelection(n); - event->SetOldSelection(oldSel); - event->SetEventObject(this); - - allowed = !GetEventHandler()->ProcessEvent(*event) || event->IsAllowed(); - } - - if ( !(flags & SetSelection_SendEvent) || allowed) - { - if ( oldSel != wxNOT_FOUND ) - m_pages[oldSel]->Hide(); - - wxWindow *page = m_pages[n]; - page->SetSize(GetPageRect()); - page->Show(); - - // change selection now to ignore the selection change event - UpdateSelectedPage(n); - - if ( flags & SetSelection_SendEvent ) - { - // program allows the page change - MakeChangedEvent(*event); - (void)GetEventHandler()->ProcessEvent(*event); - } - } - - delete event; - } - - return oldSel; -} - - -#endif // wxUSE_BOOKCTRL diff --git a/Source/3rdParty/wx/src/common/choiccmn.cpp b/Source/3rdParty/wx/src/common/choiccmn.cpp deleted file mode 100644 index 7febe79e6..000000000 --- a/Source/3rdParty/wx/src/common/choiccmn.cpp +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/choiccmn.cpp -// Purpose: common (to all ports) wxChoice functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: choiccmn.cpp 39470 2006-05-30 07:34:30Z ABX $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHOICE - -#include "wx/choice.h" - -#ifndef WX_PRECOMP -#endif - -const wxChar wxChoiceNameStr[] = wxT("choice"); - -// ============================================================================ -// implementation -// ============================================================================ - -wxChoiceBase::~wxChoiceBase() -{ - // this destructor is required for Darwin -} - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -void wxChoiceBase::Command(wxCommandEvent& event) -{ - SetSelection(event.GetInt()); - (void)ProcessEvent(event); -} - -#endif // wxUSE_CHOICE diff --git a/Source/3rdParty/wx/src/common/clipcmn.cpp b/Source/3rdParty/wx/src/common/clipcmn.cpp deleted file mode 100644 index 2421c48fe..000000000 --- a/Source/3rdParty/wx/src/common/clipcmn.cpp +++ /dev/null @@ -1,63 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/clipcmn.cpp -// Purpose: common (to all ports) wxClipboard functions -// Author: Robert Roebling -// Modified by: -// Created: 28.06.99 -// RCS-ID: $Id: clipcmn.cpp 40943 2006-08-31 19:31:43Z ABX $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CLIPBOARD - -#include "wx/clipbrd.h" - -#ifndef WX_PRECOMP - #include "wx/module.h" -#endif - -static wxClipboard *gs_clipboard = NULL; - -/*static*/ wxClipboard *wxClipboardBase::Get() -{ - if ( !gs_clipboard ) - { - gs_clipboard = new wxClipboard; - } - return gs_clipboard; -} - -// ---------------------------------------------------------------------------- -// wxClipboardModule: module responsible for destroying the global clipboard -// object -// ---------------------------------------------------------------------------- - -class wxClipboardModule : public wxModule -{ -public: - bool OnInit() { return true; } - void OnExit() { wxDELETE(gs_clipboard); } - -private: - DECLARE_DYNAMIC_CLASS(wxClipboardModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule) - -#endif // wxUSE_CLIPBOARD diff --git a/Source/3rdParty/wx/src/common/clntdata.cpp b/Source/3rdParty/wx/src/common/clntdata.cpp deleted file mode 100644 index d226f15b3..000000000 --- a/Source/3rdParty/wx/src/common/clntdata.cpp +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: common/clntdata.cpp -// Purpose: A mixin class for holding a wxClientData or void pointer -// Author: Robin Dunn -// Modified by: -// Created: 9-Oct-2001 -// RCS-ID: $Id: clntdata.cpp 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/clntdata.h" - - -// ---------------------------------------------------------------------------- - - -wxClientDataContainer::wxClientDataContainer() -{ - // no client data (yet) - m_clientData = NULL; - m_clientDataType = wxClientData_None; -} - -wxClientDataContainer::~wxClientDataContainer() -{ - // we only delete object data, not untyped - if ( m_clientDataType == wxClientData_Object ) - delete m_clientObject; -} - -void wxClientDataContainer::DoSetClientObject( wxClientData *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("can't have both object and void client data") ); - - if ( m_clientObject ) - delete m_clientObject; - - m_clientObject = data; - m_clientDataType = wxClientData_Object; -} - -wxClientData *wxClientDataContainer::DoGetClientObject() const -{ - // it's not an error to call GetClientObject() on a window which doesn't - // have client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("this window doesn't have object client data") ); - - return m_clientObject; -} - -void wxClientDataContainer::DoSetClientData( void *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("can't have both object and void client data") ); - - m_clientData = data; - m_clientDataType = wxClientData_Void; -} - -void *wxClientDataContainer::DoGetClientData() const -{ - // it's not an error to call GetClientData() on a window which doesn't have - // client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("this window doesn't have void client data") ); - - return m_clientData; -} - - -// ---------------------------------------------------------------------------- - - diff --git a/Source/3rdParty/wx/src/common/clrpickercmn.cpp b/Source/3rdParty/wx/src/common/clrpickercmn.cpp deleted file mode 100644 index 8e21d7f6e..000000000 --- a/Source/3rdParty/wx/src/common/clrpickercmn.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/clrpickercmn.cpp -// Purpose: wxColourPickerCtrl class implementation -// Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: clrpickercmn.cpp 42219 2006-10-21 19:53:05Z PC $ -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COLOURPICKERCTRL - -#include "wx/clrpicker.h" - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" -#endif - -const wxChar wxColourPickerCtrlNameStr[] = wxT("colourpicker"); -const wxChar wxColourPickerWidgetNameStr[] = wxT("colourpickerwidget"); - -// ============================================================================ -// implementation -// ============================================================================ - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLOURPICKER_CHANGED) -IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrl, wxPickerBase) -IMPLEMENT_DYNAMIC_CLASS(wxColourPickerEvent, wxEvent) - -// ---------------------------------------------------------------------------- -// wxColourPickerCtrl -// ---------------------------------------------------------------------------- - -#define M_PICKER ((wxColourPickerWidget*)m_picker) - -bool wxColourPickerCtrl::Create( wxWindow *parent, wxWindowID id, - const wxColour &col, - const wxPoint &pos, const wxSize &size, - long style, const wxValidator& validator, - const wxString &name ) -{ - if (!wxPickerBase::CreateBase(parent, id, col.GetAsString(), pos, size, - style, validator, name)) - return false; - - // we are not interested to the ID of our picker as we connect - // to its "changed" event dynamically... - m_picker = new wxColourPickerWidget(this, wxID_ANY, col, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(style)); - - // complete sizer creation - wxPickerBase::PostCreation(); - - m_picker->Connect(wxEVT_COMMAND_COLOURPICKER_CHANGED, - wxColourPickerEventHandler(wxColourPickerCtrl::OnColourChange), - NULL, this); - - return true; -} - -void wxColourPickerCtrl::SetColour(const wxColour &col) -{ - M_PICKER->SetColour(col); - UpdateTextCtrlFromPicker(); -} - -bool wxColourPickerCtrl::SetColour(const wxString &text) -{ - wxColour col(text); // smart wxString->wxColour conversion - if ( !col.Ok() ) - return false; - M_PICKER->SetColour(col); - UpdateTextCtrlFromPicker(); - - return true; -} - -void wxColourPickerCtrl::UpdatePickerFromTextCtrl() -{ - wxASSERT(m_text); - - if (m_bIgnoreNextTextCtrlUpdate) - { - // ignore this update - m_bIgnoreNextTextCtrlUpdate = false; - return; - } - - // wxString -> wxColour conversion - wxColour col(m_text->GetValue()); - if ( !col.Ok() ) - return; // invalid user input - - if (M_PICKER->GetColour() != col) - { - M_PICKER->SetColour(col); - - // fire an event - wxColourPickerEvent event(this, GetId(), col); - GetEventHandler()->ProcessEvent(event); - } -} - -void wxColourPickerCtrl::UpdateTextCtrlFromPicker() -{ - if (!m_text) - return; // no textctrl to update - - // NOTE: this SetValue() will generate an unwanted wxEVT_COMMAND_TEXT_UPDATED - // which will trigger a unneeded UpdateFromTextCtrl(); thus before using - // SetValue() we set the m_bIgnoreNextTextCtrlUpdate flag... - m_bIgnoreNextTextCtrlUpdate = true; - m_text->SetValue(M_PICKER->GetColour().GetAsString()); -} - - - -// ---------------------------------------------------------------------------- -// wxColourPickerCtrl - event handlers -// ---------------------------------------------------------------------------- - -void wxColourPickerCtrl::OnColourChange(wxColourPickerEvent &ev) -{ - UpdateTextCtrlFromPicker(); - - // the wxColourPickerWidget sent us a colour-change notification. - // forward this event to our parent - wxColourPickerEvent event(this, GetId(), ev.GetColour()); - GetEventHandler()->ProcessEvent(event); -} - -#endif // wxUSE_COLOURPICKERCTRL diff --git a/Source/3rdParty/wx/src/common/cmdline.cpp b/Source/3rdParty/wx/src/common/cmdline.cpp deleted file mode 100644 index c7b135d0c..000000000 --- a/Source/3rdParty/wx/src/common/cmdline.cpp +++ /dev/null @@ -1,1246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/cmdline.cpp -// Purpose: wxCmdLineParser implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.01.00 -// RCS-ID: $Id: cmdline.cpp 66920 2011-02-16 22:00:30Z JS $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/string.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/app.h" -#endif //WX_PRECOMP - -#include "wx/cmdline.h" - -#if wxUSE_CMDLINE_PARSER - -#include - -#include "wx/datetime.h" -#include "wx/msgout.h" -#include "wx/filename.h" - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -static wxString GetTypeName(wxCmdLineParamType type); - -static wxString GetOptionName(const wxChar *p, const wxChar *allowedChars); - -static wxString GetShortOptionName(const wxChar *p); - -static wxString GetLongOptionName(const wxChar *p); - -// ---------------------------------------------------------------------------- -// private structs -// ---------------------------------------------------------------------------- - -// an internal representation of an option -struct wxCmdLineOption -{ - wxCmdLineOption(wxCmdLineEntryType k, - const wxString& shrt, - const wxString& lng, - const wxString& desc, - wxCmdLineParamType typ, - int fl) - { - wxASSERT_MSG( !shrt.empty() || !lng.empty(), - _T("option should have at least one name") ); - - wxASSERT_MSG - ( - GetShortOptionName(shrt).Len() == shrt.Len(), - wxT("Short option contains invalid characters") - ); - - wxASSERT_MSG - ( - GetLongOptionName(lng).Len() == lng.Len(), - wxT("Long option contains invalid characters") - ); - - - kind = k; - - shortName = shrt; - longName = lng; - description = desc; - - type = typ; - flags = fl; - - m_hasVal = false; - } - - // can't use union easily here, so just store all possible data fields, we - // don't waste much (might still use union later if the number of supported - // types increases, so always use the accessor functions and don't access - // the fields directly!) - - void Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const - { - wxASSERT_MSG( type == typ, _T("type mismatch in wxCmdLineOption") ); - } - - long GetLongVal() const - { Check(wxCMD_LINE_VAL_NUMBER); return m_longVal; } - const wxString& GetStrVal() const - { Check(wxCMD_LINE_VAL_STRING); return m_strVal; } -#if wxUSE_DATETIME - const wxDateTime& GetDateVal() const - { Check(wxCMD_LINE_VAL_DATE); return m_dateVal; } -#endif // wxUSE_DATETIME - - void SetLongVal(long val) - { Check(wxCMD_LINE_VAL_NUMBER); m_longVal = val; m_hasVal = true; } - void SetStrVal(const wxString& val) - { Check(wxCMD_LINE_VAL_STRING); m_strVal = val; m_hasVal = true; } -#if wxUSE_DATETIME - void SetDateVal(const wxDateTime& val) - { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; } -#endif // wxUSE_DATETIME - - void SetHasValue(bool hasValue = true) { m_hasVal = hasValue; } - bool HasValue() const { return m_hasVal; } - -public: - wxCmdLineEntryType kind; - wxString shortName, - longName, - description; - wxCmdLineParamType type; - int flags; - -private: - bool m_hasVal; - - long m_longVal; - wxString m_strVal; -#if wxUSE_DATETIME - wxDateTime m_dateVal; -#endif // wxUSE_DATETIME -}; - -struct wxCmdLineParam -{ - wxCmdLineParam(const wxString& desc, - wxCmdLineParamType typ, - int fl) - : description(desc) - { - type = typ; - flags = fl; - } - - wxString description; - wxCmdLineParamType type; - int flags; -}; - -WX_DECLARE_OBJARRAY(wxCmdLineOption, wxArrayOptions); -WX_DECLARE_OBJARRAY(wxCmdLineParam, wxArrayParams); - -#include "wx/arrimpl.cpp" - -WX_DEFINE_OBJARRAY(wxArrayOptions) -WX_DEFINE_OBJARRAY(wxArrayParams) - -// the parser internal state -struct wxCmdLineParserData -{ - // options - wxString m_switchChars; // characters which may start an option - bool m_enableLongOptions; // true if long options are enabled - wxString m_logo; // some extra text to show in Usage() - - // cmd line data - wxArrayString m_arguments; // == argv, argc == m_arguments.GetCount() - wxArrayOptions m_options; // all possible options and switchrs - wxArrayParams m_paramDesc; // description of all possible params - wxArrayString m_parameters; // all params found - - // methods - wxCmdLineParserData(); - void SetArguments(int argc, char **argv); -#if wxUSE_UNICODE - void SetArguments(int argc, wxChar **argv); -#endif // wxUSE_UNICODE - void SetArguments(const wxString& cmdline); - - int FindOption(const wxString& name); - int FindOptionByLongName(const wxString& name); -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxCmdLineParserData -// ---------------------------------------------------------------------------- - -wxCmdLineParserData::wxCmdLineParserData() -{ - m_enableLongOptions = true; -#ifdef __UNIX_LIKE__ - m_switchChars = _T("-"); -#else // !Unix - m_switchChars = _T("/-"); -#endif -} - -void wxCmdLineParserData::SetArguments(int argc, char **argv) -{ - m_arguments.clear(); - - for ( int n = 0; n < argc; n++ ) - { - m_arguments.push_back(wxString::FromAscii(argv[n])); - } -} - -#if wxUSE_UNICODE - -void wxCmdLineParserData::SetArguments(int argc, wxChar **argv) -{ - m_arguments.clear(); - - for ( int n = 0; n < argc; n++ ) - { - m_arguments.push_back(argv[n]); - } -} - -#endif // wxUSE_UNICODE - -void wxCmdLineParserData::SetArguments(const wxString& cmdLine) -{ - m_arguments.clear(); - - if(wxTheApp && wxTheApp->argc > 0) - m_arguments.push_back(wxTheApp->argv[0]); - else - m_arguments.push_back(wxEmptyString); - - wxArrayString args = wxCmdLineParser::ConvertStringToArgs(cmdLine); - - WX_APPEND_ARRAY(m_arguments, args); -} - -int wxCmdLineParserData::FindOption(const wxString& name) -{ - if ( !name.empty() ) - { - size_t count = m_options.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( m_options[n].shortName == name ) - { - // found - return n; - } - } - } - - return wxNOT_FOUND; -} - -int wxCmdLineParserData::FindOptionByLongName(const wxString& name) -{ - size_t count = m_options.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( m_options[n].longName == name ) - { - // found - return n; - } - } - - return wxNOT_FOUND; -} - -// ---------------------------------------------------------------------------- -// construction and destruction -// ---------------------------------------------------------------------------- - -void wxCmdLineParser::Init() -{ - m_data = new wxCmdLineParserData; -} - -void wxCmdLineParser::SetCmdLine(int argc, char **argv) -{ - m_data->SetArguments(argc, argv); -} - -#if wxUSE_UNICODE - -void wxCmdLineParser::SetCmdLine(int argc, wxChar **argv) -{ - m_data->SetArguments(argc, argv); -} - -#endif // wxUSE_UNICODE - -void wxCmdLineParser::SetCmdLine(const wxString& cmdline) -{ - m_data->SetArguments(cmdline); -} - -wxCmdLineParser::~wxCmdLineParser() -{ - delete m_data; -} - -// ---------------------------------------------------------------------------- -// options -// ---------------------------------------------------------------------------- - -void wxCmdLineParser::SetSwitchChars(const wxString& switchChars) -{ - m_data->m_switchChars = switchChars; -} - -void wxCmdLineParser::EnableLongOptions(bool enable) -{ - m_data->m_enableLongOptions = enable; -} - -bool wxCmdLineParser::AreLongOptionsEnabled() -{ - return m_data->m_enableLongOptions; -} - -void wxCmdLineParser::SetLogo(const wxString& logo) -{ - m_data->m_logo = logo; -} - -// ---------------------------------------------------------------------------- -// command line construction -// ---------------------------------------------------------------------------- - -void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc) -{ - for ( ;; desc++ ) - { - switch ( desc->kind ) - { - case wxCMD_LINE_SWITCH: - AddSwitch(desc->shortName, desc->longName, desc->description, - desc->flags); - break; - - case wxCMD_LINE_OPTION: - AddOption(desc->shortName, desc->longName, desc->description, - desc->type, desc->flags); - break; - - case wxCMD_LINE_PARAM: - AddParam(desc->description, desc->type, desc->flags); - break; - - default: - wxFAIL_MSG( _T("unknown command line entry type") ); - // still fall through - - case wxCMD_LINE_NONE: - return; - } - } -} - -void wxCmdLineParser::AddSwitch(const wxString& shortName, - const wxString& longName, - const wxString& desc, - int flags) -{ - wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND, - _T("duplicate switch") ); - - wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_SWITCH, - shortName, longName, desc, - wxCMD_LINE_VAL_NONE, flags); - - m_data->m_options.Add(option); -} - -void wxCmdLineParser::AddOption(const wxString& shortName, - const wxString& longName, - const wxString& desc, - wxCmdLineParamType type, - int flags) -{ - wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND, - _T("duplicate option") ); - - wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_OPTION, - shortName, longName, desc, - type, flags); - - m_data->m_options.Add(option); -} - -void wxCmdLineParser::AddParam(const wxString& desc, - wxCmdLineParamType type, - int flags) -{ - // do some consistency checks: a required parameter can't follow an - // optional one and nothing should follow a parameter with MULTIPLE flag -#ifdef __WXDEBUG__ - if ( !m_data->m_paramDesc.IsEmpty() ) - { - wxCmdLineParam& param = m_data->m_paramDesc.Last(); - - wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE), - _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style will be ignored") ); - - if ( !(flags & wxCMD_LINE_PARAM_OPTIONAL) ) - { - wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_OPTIONAL), - _T("a required parameter can't follow an optional one") ); - } - } -#endif // Debug - - wxCmdLineParam *param = new wxCmdLineParam(desc, type, flags); - - m_data->m_paramDesc.Add(param); -} - -// ---------------------------------------------------------------------------- -// access to parse command line -// ---------------------------------------------------------------------------- - -bool wxCmdLineParser::Found(const wxString& name) const -{ - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); - - wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown switch") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) - return false; - - return true; -} - -bool wxCmdLineParser::Found(const wxString& name, wxString *value) const -{ - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); - - wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) - return false; - - wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); - - *value = opt.GetStrVal(); - - return true; -} - -bool wxCmdLineParser::Found(const wxString& name, long *value) const -{ - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); - - wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) - return false; - - wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); - - *value = opt.GetLongVal(); - - return true; -} - -#if wxUSE_DATETIME -bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const -{ - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); - - wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) - return false; - - wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); - - *value = opt.GetDateVal(); - - return true; -} -#endif // wxUSE_DATETIME - -size_t wxCmdLineParser::GetParamCount() const -{ - return m_data->m_parameters.size(); -} - -wxString wxCmdLineParser::GetParam(size_t n) const -{ - wxCHECK_MSG( n < GetParamCount(), wxEmptyString, _T("invalid param index") ); - - return m_data->m_parameters[n]; -} - -// Resets switches and options -void wxCmdLineParser::Reset() -{ - for ( size_t i = 0; i < m_data->m_options.Count(); i++ ) - { - wxCmdLineOption& opt = m_data->m_options[i]; - opt.SetHasValue(false); - } -} - - -// ---------------------------------------------------------------------------- -// the real work is done here -// ---------------------------------------------------------------------------- - -int wxCmdLineParser::Parse(bool showUsage) -{ - bool maybeOption = true; // can the following arg be an option? - bool ok = true; // true until an error is detected - bool helpRequested = false; // true if "-h" was given - bool hadRepeatableParam = false; // true if found param with MULTIPLE flag - - size_t currentParam = 0; // the index in m_paramDesc - - size_t countParam = m_data->m_paramDesc.GetCount(); - wxString errorMsg; - - Reset(); - - // parse everything - wxString arg; - size_t count = m_data->m_arguments.size(); - for ( size_t n = 1; ok && (n < count); n++ ) // 0 is program name - { - arg = m_data->m_arguments[n]; - - // special case: "--" should be discarded and all following arguments - // should be considered as parameters, even if they start with '-' and - // not like options (this is POSIX-like) - if ( arg == _T("--") ) - { - maybeOption = false; - - continue; - } - - // empty argument or just '-' is not an option but a parameter - if ( maybeOption && arg.length() > 1 && - wxStrchr(m_data->m_switchChars, arg[0u]) ) - { - bool isLong; - wxString name; - int optInd = wxNOT_FOUND; // init to suppress warnings - - // an option or a switch: find whether it's a long or a short one - if ( arg[0u] == _T('-') && arg[1u] == _T('-') ) - { - // a long one - isLong = true; - - // Skip leading "--" - const wxChar *p = arg.c_str() + 2; - - bool longOptionsEnabled = AreLongOptionsEnabled(); - - name = GetLongOptionName(p); - - if (longOptionsEnabled) - { - optInd = m_data->FindOptionByLongName(name); - if ( optInd == wxNOT_FOUND ) - { - errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) - << _T('\n'); - } - } - else - { - optInd = wxNOT_FOUND; // Sanity check - - // Print the argument including leading "--" - name.Prepend( wxT("--") ); - errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) - << _T('\n'); - } - - } - else // not a long option - { - isLong = false; - - // a short one: as they can be cumulated, we try to find the - // longest substring which is a valid option - const wxChar *p = arg.c_str() + 1; - - name = GetShortOptionName(p); - - size_t len = name.length(); - do - { - if ( len == 0 ) - { - // we couldn't find a valid option name in the - // beginning of this string - errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) - << _T('\n'); - - break; - } - else - { - optInd = m_data->FindOption(name.Left(len)); - - // will try with one character less the next time - len--; - } - } - while ( optInd == wxNOT_FOUND ); - - len++; // compensates extra len-- above - if ( (optInd != wxNOT_FOUND) && (len != name.length()) ) - { - // first of all, the option name is only part of this - // string - name = name.Left(len); - - // our option is only part of this argument, there is - // something else in it - it is either the value of this - // option or other switches if it is a switch - if ( m_data->m_options[(size_t)optInd].kind - == wxCMD_LINE_SWITCH ) - { - // pretend that all the rest of the argument is the - // next argument, in fact - wxString arg2 = arg[0u]; - arg2 += arg.Mid(len + 1); // +1 for leading '-' - - m_data->m_arguments.insert - (m_data->m_arguments.begin() + n + 1, arg2); - count++; - } - //else: it's our value, we'll deal with it below - } - } - - if ( optInd == wxNOT_FOUND ) - { - ok = false; - - continue; // will break, in fact - } - - // look at what follows: - - // +1 for leading '-' - const wxChar *p = arg.c_str() + 1 + name.length(); - if ( isLong ) - p++; // for another leading '-' - - wxCmdLineOption& opt = m_data->m_options[(size_t)optInd]; - if ( opt.kind == wxCMD_LINE_SWITCH ) - { - // we must check that there is no value following the switch - if ( *p != _T('\0') ) - { - errorMsg << wxString::Format(_("Unexpected characters following option '%s'."), name.c_str()) - << _T('\n'); - ok = false; - } - else // no value, as expected - { - // nothing more to do - opt.SetHasValue(); - - if ( opt.flags & wxCMD_LINE_OPTION_HELP ) - { - helpRequested = true; - - // it's not an error, but we still stop here - ok = false; - } - } - } - else // it's an option. not a switch - { - // get the value - if ( isLong ) - { - if ( *p++ != _T('=') ) - { - errorMsg << wxString::Format(_("Option '%s' requires a value, '=' expected."), name.c_str()) - << _T('\n'); - - ok = false; - } - } - else // short option - { - switch ( *p ) - { - case _T('='): - case _T(':'): - // the value follows - p++; - break; - - case 0: - // the value is in the next argument - if ( ++n == count ) - { - // ... but there is none - errorMsg << wxString::Format(_("Option '%s' requires a value."), - name.c_str()) - << _T('\n'); - - ok = false; - } - else - { - // ... take it from there - p = m_data->m_arguments[n].c_str(); - } - break; - - default: - // the value is right here: this may be legal or - // not depending on the option style - if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR ) - { - errorMsg << wxString::Format(_("Separator expected after the option '%s'."), - name.c_str()) - << _T('\n'); - - ok = false; - } - } - } - - if ( ok ) - { - wxString value = p; - switch ( opt.type ) - { - default: - wxFAIL_MSG( _T("unknown option type") ); - // still fall through - - case wxCMD_LINE_VAL_STRING: - opt.SetStrVal(value); - break; - - case wxCMD_LINE_VAL_NUMBER: - { - long val; - if ( value.ToLong(&val) ) - { - opt.SetLongVal(val); - } - else - { - errorMsg << wxString::Format(_("'%s' is not a correct numeric value for option '%s'."), - value.c_str(), name.c_str()) - << _T('\n'); - - ok = false; - } - } - break; - -#if wxUSE_DATETIME - case wxCMD_LINE_VAL_DATE: - { - wxDateTime dt; - const wxChar *res = dt.ParseDate(value); - if ( !res || *res ) - { - errorMsg << wxString::Format(_("Option '%s': '%s' cannot be converted to a date."), - name.c_str(), value.c_str()) - << _T('\n'); - - ok = false; - } - else - { - opt.SetDateVal(dt); - } - } - break; -#endif // wxUSE_DATETIME - } - } - } - } - else // not an option, must be a parameter - { - if ( currentParam < countParam ) - { - wxCmdLineParam& param = m_data->m_paramDesc[currentParam]; - - // TODO check the param type - - m_data->m_parameters.push_back(arg); - - if ( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE) ) - { - currentParam++; - } - else - { - wxASSERT_MSG( currentParam == countParam - 1, - _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style are ignored") ); - - // remember that we did have this last repeatable parameter - hadRepeatableParam = true; - } - } - else - { - errorMsg << wxString::Format(_("Unexpected parameter '%s'"), arg.c_str()) - << _T('\n'); - - ok = false; - } - } - } - - // verify that all mandatory options were given - if ( ok ) - { - size_t countOpt = m_data->m_options.GetCount(); - for ( size_t n = 0; ok && (n < countOpt); n++ ) - { - wxCmdLineOption& opt = m_data->m_options[n]; - if ( (opt.flags & wxCMD_LINE_OPTION_MANDATORY) && !opt.HasValue() ) - { - wxString optName; - if ( !opt.longName ) - { - optName = opt.shortName; - } - else - { - if ( AreLongOptionsEnabled() ) - { - optName.Printf( _("%s (or %s)"), - opt.shortName.c_str(), - opt.longName.c_str() ); - } - else - { - optName.Printf( wxT("%s"), - opt.shortName.c_str() ); - } - } - - errorMsg << wxString::Format(_("The value for the option '%s' must be specified."), - optName.c_str()) - << _T('\n'); - - ok = false; - } - } - - for ( ; ok && (currentParam < countParam); currentParam++ ) - { - wxCmdLineParam& param = m_data->m_paramDesc[currentParam]; - if ( (currentParam == countParam - 1) && - (param.flags & wxCMD_LINE_PARAM_MULTIPLE) && - hadRepeatableParam ) - { - // special case: currentParam wasn't incremented, but we did - // have it, so don't give error - continue; - } - - if ( !(param.flags & wxCMD_LINE_PARAM_OPTIONAL) ) - { - errorMsg << wxString::Format(_("The required parameter '%s' was not specified."), - param.description.c_str()) - << _T('\n'); - - ok = false; - } - } - } - - // if there was an error during parsing the command line, show this error - // and also the usage message if it had been requested - if ( !ok && (!errorMsg.empty() || (helpRequested && showUsage)) ) - { - wxMessageOutput* msgOut = wxMessageOutput::Get(); - if ( msgOut ) - { - wxString usage; - if ( showUsage ) - usage = GetUsageString(); - - msgOut->Printf( wxT("%s%s"), usage.c_str(), errorMsg.c_str() ); - } - else - { - wxFAIL_MSG( _T("no wxMessageOutput object?") ); - } - } - - return ok ? 0 : helpRequested ? -1 : 1; -} - -// ---------------------------------------------------------------------------- -// give the usage message -// ---------------------------------------------------------------------------- - -void wxCmdLineParser::Usage() -{ - wxMessageOutput* msgOut = wxMessageOutput::Get(); - if ( msgOut ) - { - msgOut->Printf( wxT("%s"), GetUsageString().c_str() ); - } - else - { - wxFAIL_MSG( _T("no wxMessageOutput object?") ); - } -} - -wxString wxCmdLineParser::GetUsageString() -{ - wxString appname; - if ( wxTheApp ) - { - appname = wxFileName(wxTheApp->argv[0]).GetFullName(); - } - else if (!m_data->m_arguments.empty() ) - { - appname = wxFileName(m_data->m_arguments[0]).GetFullName(); - } - - // we construct the brief cmd line desc on the fly, but not the detailed - // help message below because we want to align the options descriptions - // and for this we must first know the longest one of them - wxString usage; - wxArrayString namesOptions, descOptions; - - if ( !m_data->m_logo.empty() ) - { - usage << m_data->m_logo << _T('\n'); - } - - usage << wxString::Format(_("Usage: %s"), appname.c_str()); - - // the switch char is usually '-' but this can be changed with - // SetSwitchChars() and then the first one of possible chars is used - wxChar chSwitch = !m_data->m_switchChars ? _T('-') - : m_data->m_switchChars[0u]; - - bool areLongOptionsEnabled = AreLongOptionsEnabled(); - size_t n, count = m_data->m_options.GetCount(); - for ( n = 0; n < count; n++ ) - { - wxCmdLineOption& opt = m_data->m_options[n]; - - usage << _T(' '); - if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) - { - usage << _T('['); - } - - if ( !opt.shortName.empty() ) - { - usage << chSwitch << opt.shortName; - } - else if ( areLongOptionsEnabled && !opt.longName.empty() ) - { - usage << _T("--") << opt.longName; - } - else - { - if (!opt.longName.empty()) - { - wxFAIL_MSG( wxT("option with only a long name while long ") - wxT("options are disabled") ); - } - else - { - wxFAIL_MSG( _T("option without neither short nor long name") ); - } - } - - wxString option; - - if ( !opt.shortName.empty() ) - { - option << _T(" ") << chSwitch << opt.shortName; - } - - if ( areLongOptionsEnabled && !opt.longName.empty() ) - { - option << (option.empty() ? _T(" ") : _T(", ")) - << _T("--") << opt.longName; - } - - if ( opt.kind != wxCMD_LINE_SWITCH ) - { - wxString val; - val << _T('<') << GetTypeName(opt.type) << _T('>'); - usage << _T(' ') << val; - option << (!opt.longName ? _T(':') : _T('=')) << val; - } - - if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) - { - usage << _T(']'); - } - - namesOptions.push_back(option); - descOptions.push_back(opt.description); - } - - count = m_data->m_paramDesc.GetCount(); - for ( n = 0; n < count; n++ ) - { - wxCmdLineParam& param = m_data->m_paramDesc[n]; - - usage << _T(' '); - if ( param.flags & wxCMD_LINE_PARAM_OPTIONAL ) - { - usage << _T('['); - } - - usage << param.description; - - if ( param.flags & wxCMD_LINE_PARAM_MULTIPLE ) - { - usage << _T("..."); - } - - if ( param.flags & wxCMD_LINE_PARAM_OPTIONAL ) - { - usage << _T(']'); - } - } - - usage << _T('\n'); - - // now construct the detailed help message - size_t len, lenMax = 0; - count = namesOptions.size(); - for ( n = 0; n < count; n++ ) - { - len = namesOptions[n].length(); - if ( len > lenMax ) - lenMax = len; - } - - for ( n = 0; n < count; n++ ) - { - len = namesOptions[n].length(); - usage << namesOptions[n] - << wxString(_T(' '), lenMax - len) << _T('\t') - << descOptions[n] - << _T('\n'); - } - - return usage; -} - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -static wxString GetTypeName(wxCmdLineParamType type) -{ - wxString s; - switch ( type ) - { - default: - wxFAIL_MSG( _T("unknown option type") ); - // still fall through - - case wxCMD_LINE_VAL_STRING: - s = _("str"); - break; - - case wxCMD_LINE_VAL_NUMBER: - s = _("num"); - break; - - case wxCMD_LINE_VAL_DATE: - s = _("date"); - break; - } - - return s; -} - -/* -Returns a string which is equal to the string pointed to by p, but up to the -point where p contains an character that's not allowed. -Allowable characters are letters and numbers, and characters pointed to by -the parameter allowedChars. - -For example, if p points to "abcde-@-_", and allowedChars is "-_", -this function returns "abcde-". -*/ -static wxString GetOptionName(const wxChar *p, - const wxChar *allowedChars) -{ - wxString argName; - - while ( *p && (wxIsalnum(*p) || wxStrchr(allowedChars, *p)) ) - { - argName += *p++; - } - - return argName; -} - -// Besides alphanumeric characters, short and long options can -// have other characters. - -// A short option additionally can have these -#define wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION wxT("_?") - -// A long option can have the same characters as a short option and a '-'. -#define wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION \ - wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION wxT("-") - -static wxString GetShortOptionName(const wxChar *p) -{ - return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION); -} - -static wxString GetLongOptionName(const wxChar *p) -{ - return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION); -} - -#endif // wxUSE_CMDLINE_PARSER - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -/* - This function is mainly used under Windows (as under Unix we always get the - command line arguments as argc/argv anyhow) and so it tries to follow - Windows conventions for the command line handling, not Unix ones. For - instance, backslash is not special except when it precedes double quote when - it does quote it. - */ - -/* static */ -wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p) -{ - wxArrayString args; - - wxString arg; - arg.reserve(1024); - - bool isInsideQuotes = false; - for ( ;; ) - { - // skip white space - while ( *p == _T(' ') || *p == _T('\t') ) - p++; - - // anything left? - if ( *p == _T('\0') ) - break; - - // parse this parameter - bool endParam = false; - bool lastBS = false; - for ( arg.clear(); !endParam; p++ ) - { - switch ( *p ) - { - case _T('"'): - if ( !lastBS ) - { - isInsideQuotes = !isInsideQuotes; - - // don't put quote in arg - continue; - } - //else: quote has no special meaning but the backslash - // still remains -- makes no sense but this is what - // Windows does - break; - - case _T(' '): - case _T('\t'): - // backslash does *not* quote the space, only quotes do - if ( isInsideQuotes ) - { - // skip assignment below - break; - } - // fall through - - case _T('\0'): - endParam = true; - - break; - } - - if ( endParam ) - { - break; - } - - lastBS = !lastBS && *p == _T('\\'); - - arg += *p; - } - - args.push_back(arg); - } - - return args; -} diff --git a/Source/3rdParty/wx/src/common/cmdproc.cpp b/Source/3rdParty/wx/src/common/cmdproc.cpp deleted file mode 100644 index 808f7bd95..000000000 --- a/Source/3rdParty/wx/src/common/cmdproc.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/cmdproc.cpp -// Purpose: wxCommand and wxCommandProcessor classes -// Author: Julian Smart (extracted from docview.h by VZ) -// Modified by: -// Created: 05.11.00 -// RCS-ID: $Id: cmdproc.cpp 65725 2010-10-02 13:05:08Z TIK $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/string.h" - #include "wx/menu.h" -#endif //WX_PRECOMP - -#include "wx/cmdproc.h" - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_CLASS(wxCommand, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject) - -// ---------------------------------------------------------------------------- -// wxCommand -// ---------------------------------------------------------------------------- - -wxCommand::wxCommand(bool canUndoIt, const wxString& name) -{ - m_canUndo = canUndoIt; - m_commandName = name; -} - -// ---------------------------------------------------------------------------- -// Command processor -// ---------------------------------------------------------------------------- - -wxCommandProcessor::wxCommandProcessor(int maxCommands) -{ - m_maxNoCommands = maxCommands; -#if wxUSE_MENUS - m_commandEditMenu = (wxMenu *) NULL; -#endif // wxUSE_MENUS - m_undoAccelerator = wxT("\tCtrl+Z"); - m_redoAccelerator = wxT("\tCtrl+Y"); - - m_lastSavedCommand = - m_currentCommand = wxList::compatibility_iterator(); -} - -wxCommandProcessor::~wxCommandProcessor() -{ - ClearCommands(); -} - -bool wxCommandProcessor::DoCommand(wxCommand& cmd) -{ - return cmd.Do(); -} - -bool wxCommandProcessor::UndoCommand(wxCommand& cmd) -{ - return cmd.Undo(); -} - -// Pass a command to the processor. The processor calls Do(); -// if successful, is appended to the command history unless -// storeIt is false. -bool wxCommandProcessor::Submit(wxCommand *command, bool storeIt) -{ - wxCHECK_MSG( command, false, _T("no command in wxCommandProcessor::Submit") ); - - if ( !DoCommand(*command) ) - { - // the user code expects the command to be deleted anyhow - delete command; - - return false; - } - - if ( storeIt ) - Store(command); - else - delete command; - - return true; -} - -void wxCommandProcessor::Store(wxCommand *command) -{ - wxCHECK_RET( command, _T("no command in wxCommandProcessor::Store") ); - - // Correct a bug: we must chop off the current 'branch' - // so that we're at the end of the command list. - if (!m_currentCommand) - ClearCommands(); - else - { - wxList::compatibility_iterator node = m_currentCommand->GetNext(); - while (node) - { - wxList::compatibility_iterator next = node->GetNext(); - delete (wxCommand *)node->GetData(); - m_commands.Erase(node); - - // Make sure m_lastSavedCommand won't point to freed memory - if ( m_lastSavedCommand == node ) - m_lastSavedCommand = wxList::compatibility_iterator(); - - node = next; - } - } - - if ( (int)m_commands.GetCount() == m_maxNoCommands ) - { - wxList::compatibility_iterator firstNode = m_commands.GetFirst(); - wxCommand *firstCommand = (wxCommand *)firstNode->GetData(); - delete firstCommand; - m_commands.Erase(firstNode); - - // Make sure m_lastSavedCommand won't point to freed memory - if ( m_lastSavedCommand == firstNode ) - m_lastSavedCommand = wxList::compatibility_iterator(); - } - - m_commands.Append(command); - m_currentCommand = m_commands.GetLast(); - SetMenuStrings(); -} - -bool wxCommandProcessor::Undo() -{ - wxCommand *command = GetCurrentCommand(); - if ( command && command->CanUndo() ) - { - if ( UndoCommand(*command) ) - { - m_currentCommand = m_currentCommand->GetPrevious(); - SetMenuStrings(); - return true; - } - } - - return false; -} - -bool wxCommandProcessor::Redo() -{ - wxCommand *redoCommand = (wxCommand *) NULL; - wxList::compatibility_iterator redoNode -#if !wxUSE_STL - = NULL // just to avoid warnings -#endif // !wxUSE_STL - ; - - if ( m_currentCommand ) - { - // is there anything to redo? - if ( m_currentCommand->GetNext() ) - { - redoCommand = (wxCommand *)m_currentCommand->GetNext()->GetData(); - redoNode = m_currentCommand->GetNext(); - } - } - else // no current command, redo the first one - { - if (m_commands.GetCount() > 0) - { - redoCommand = (wxCommand *)m_commands.GetFirst()->GetData(); - redoNode = m_commands.GetFirst(); - } - } - - if (redoCommand) - { - bool success = DoCommand(*redoCommand); - if (success) - { - m_currentCommand = redoNode; - SetMenuStrings(); - return true; - } - } - return false; -} - -bool wxCommandProcessor::CanUndo() const -{ - wxCommand *command = GetCurrentCommand(); - - return command && command->CanUndo(); -} - -bool wxCommandProcessor::CanRedo() const -{ - if (m_currentCommand && !m_currentCommand->GetNext()) - return false; - - if (m_currentCommand && m_currentCommand->GetNext()) - return true; - - if (!m_currentCommand && (m_commands.GetCount() > 0)) - return true; - - return false; -} - -void wxCommandProcessor::Initialize() -{ - m_currentCommand = m_commands.GetLast(); - SetMenuStrings(); -} - -void wxCommandProcessor::SetMenuStrings() -{ -#if wxUSE_MENUS - if (m_commandEditMenu) - { - wxString undoLabel = GetUndoMenuLabel(); - wxString redoLabel = GetRedoMenuLabel(); - - m_commandEditMenu->SetLabel(wxID_UNDO, undoLabel); - m_commandEditMenu->Enable(wxID_UNDO, CanUndo()); - - m_commandEditMenu->SetLabel(wxID_REDO, redoLabel); - m_commandEditMenu->Enable(wxID_REDO, CanRedo()); - } -#endif // wxUSE_MENUS -} - -// Gets the current Undo menu label. -wxString wxCommandProcessor::GetUndoMenuLabel() const -{ - wxString buf; - if (m_currentCommand) - { - wxCommand *command = (wxCommand *)m_currentCommand->GetData(); - wxString commandName(command->GetName()); - if (commandName.empty()) commandName = _("Unnamed command"); - bool canUndo = command->CanUndo(); - if (canUndo) - buf = wxString(_("&Undo ")) + commandName + m_undoAccelerator; - else - buf = wxString(_("Can't &Undo ")) + commandName + m_undoAccelerator; - } - else - { - buf = _("&Undo") + m_undoAccelerator; - } - - return buf; -} - -// Gets the current Undo menu label. -wxString wxCommandProcessor::GetRedoMenuLabel() const -{ - wxString buf; - if (m_currentCommand) - { - // We can redo, if we're not at the end of the history. - if (m_currentCommand->GetNext()) - { - wxCommand *redoCommand = (wxCommand *)m_currentCommand->GetNext()->GetData(); - wxString redoCommandName(redoCommand->GetName()); - if (redoCommandName.empty()) redoCommandName = _("Unnamed command"); - buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator; - } - else - { - buf = _("&Redo") + m_redoAccelerator; - } - } - else - { - if (m_commands.GetCount() == 0) - { - buf = _("&Redo") + m_redoAccelerator; - } - else - { - // currentCommand is NULL but there are commands: this means that - // we've undone to the start of the list, but can redo the first. - wxCommand *redoCommand = (wxCommand *)m_commands.GetFirst()->GetData(); - wxString redoCommandName(redoCommand->GetName()); - if (redoCommandName.empty()) redoCommandName = _("Unnamed command"); - buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator; - } - } - return buf; -} - -void wxCommandProcessor::ClearCommands() -{ - wxList::compatibility_iterator node = m_commands.GetFirst(); - while (node) - { - wxCommand *command = (wxCommand *)node->GetData(); - delete command; - m_commands.Erase(node); - node = m_commands.GetFirst(); - } - - m_currentCommand = wxList::compatibility_iterator(); - m_lastSavedCommand = wxList::compatibility_iterator(); -} - - diff --git a/Source/3rdParty/wx/src/common/cmndata.cpp b/Source/3rdParty/wx/src/common/cmndata.cpp deleted file mode 100644 index a6edb97b2..000000000 --- a/Source/3rdParty/wx/src/common/cmndata.cpp +++ /dev/null @@ -1,660 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/cmndata.cpp -// Purpose: Common GDI data -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: cmndata.cpp 60700 2009-05-20 13:18:11Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/cmndata.h" - -#ifndef WX_PRECOMP - #if defined(__WXMSW__) - #include "wx/msw/wrapcdlg.h" - #endif // MSW - #include - #include "wx/string.h" - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/log.h" - #include "wx/gdicmn.h" -#endif - -#include "wx/prntbase.h" -#include "wx/printdlg.h" - -#if wxUSE_FONTDLG - #include "wx/fontdlg.h" -#endif // wxUSE_FONTDLG - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/paper.h" - -#if defined(__WXMAC__) - #include "wx/mac/private/print.h" -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject) - -#endif // wxUSE_PRINTING_ARCHITECTURE - -IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxColourData -// ---------------------------------------------------------------------------- - -wxColourData::wxColourData() -{ - m_chooseFull = false; - m_dataColour.Set(0,0,0); - // m_custColours are wxNullColours initially -} - -wxColourData::wxColourData(const wxColourData& data) - : wxObject() -{ - (*this) = data; -} - -wxColourData::~wxColourData() -{ -} - -void wxColourData::SetCustomColour(int i, const wxColour& colour) -{ - wxCHECK_RET( (i >= 0 && i < 16), _T("custom colour index out of range") ); - - m_custColours[i] = colour; -} - -wxColour wxColourData::GetCustomColour(int i) -{ - wxCHECK_MSG( (i >= 0 && i < 16), wxColour(0,0,0), - _T("custom colour index out of range") ); - - return m_custColours[i]; -} - -void wxColourData::operator=(const wxColourData& data) -{ - int i; - for (i = 0; i < 16; i++) - m_custColours[i] = data.m_custColours[i]; - - m_dataColour = (wxColour&)data.m_dataColour; - m_chooseFull = data.m_chooseFull; -} - -// ---------------------------------------------------------------------------- -// Font data -// ---------------------------------------------------------------------------- - -wxFontData::wxFontData() -{ - // Intialize colour to black. - m_fontColour = wxNullColour; - - m_showHelp = false; - m_allowSymbols = true; - m_enableEffects = true; - m_minSize = 0; - m_maxSize = 0; - - m_encoding = wxFONTENCODING_SYSTEM; -} - -wxFontData::~wxFontData() -{ -} - -#if wxUSE_FONTDLG - -wxFontDialogBase::~wxFontDialogBase() -{ -} - -#endif // wxUSE_FONTDLG - -#if wxUSE_PRINTING_ARCHITECTURE -// ---------------------------------------------------------------------------- -// Print data -// ---------------------------------------------------------------------------- - -wxPrintData::wxPrintData() -{ - m_bin = wxPRINTBIN_DEFAULT; - m_media = wxPRINTMEDIA_DEFAULT; - m_printMode = wxPRINT_MODE_PRINTER; - m_printOrientation = wxPORTRAIT; - m_printOrientationReversed = false; - m_printNoCopies = 1; - m_printCollate = false; - - // New, 24/3/99 - m_printerName = wxEmptyString; - m_colour = true; - m_duplexMode = wxDUPLEX_SIMPLEX; - m_printQuality = wxPRINT_QUALITY_HIGH; - - // we intentionally don't initialize paper id and size at all, like this - // the default system settings will be used for them - m_paperId = wxPAPER_NONE; - m_paperSize = wxDefaultSize; - - m_privData = NULL; - m_privDataLen = 0; - - m_nativeData = wxPrintFactory::GetFactory()->CreatePrintNativeData(); -} - -wxPrintData::wxPrintData(const wxPrintData& printData) - : wxObject() -{ - m_nativeData = NULL; - m_privData = NULL; - (*this) = printData; -} - -void wxPrintData::SetPrivData( char *privData, int len ) -{ - if (m_privData) - { - delete [] m_privData; - m_privData = NULL; - } - m_privDataLen = len; - if (m_privDataLen > 0) - { - m_privData = new char[m_privDataLen]; - memcpy( m_privData, privData, m_privDataLen ); - } -} - -wxPrintData::~wxPrintData() -{ - m_nativeData->m_ref--; - if (m_nativeData->m_ref == 0) - delete m_nativeData; - - if (m_privData) - delete [] m_privData; -} - -void wxPrintData::ConvertToNative() -{ - m_nativeData->TransferFrom( *this ) ; -} - -void wxPrintData::ConvertFromNative() -{ - m_nativeData->TransferTo( *this ) ; -} - -void wxPrintData::operator=(const wxPrintData& data) -{ - m_printNoCopies = data.m_printNoCopies; - m_printCollate = data.m_printCollate; - m_printOrientation = data.m_printOrientation; - m_printOrientationReversed = data.m_printOrientationReversed; - m_printerName = data.m_printerName; - m_colour = data.m_colour; - m_duplexMode = data.m_duplexMode; - m_printQuality = data.m_printQuality; - m_paperId = data.m_paperId; - m_paperSize = data.m_paperSize; - m_bin = data.m_bin; - m_media = data.m_media; - m_printMode = data.m_printMode; - m_filename = data.m_filename; - - // UnRef old m_nativeData - if (m_nativeData) - { - m_nativeData->m_ref--; - if (m_nativeData->m_ref == 0) - delete m_nativeData; - } - // Set Ref new one - m_nativeData = data.GetNativeData(); - m_nativeData->m_ref++; - - if (m_privData) - { - delete [] m_privData; - m_privData = NULL; - } - m_privDataLen = data.GetPrivDataLen(); - if (m_privDataLen > 0) - { - m_privData = new char[m_privDataLen]; - memcpy( m_privData, data.GetPrivData(), m_privDataLen ); - } -} - -// Is this data OK for showing the print dialog? -bool wxPrintData::IsOk() const -{ - m_nativeData->TransferFrom( *this ); - - return m_nativeData->Ok(); -} - -// What should happen here? wxPostScriptPrintNativeData is not -// defined unless all this is true on MSW. -#if WXWIN_COMPATIBILITY_2_4 && wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) - -#include "wx/generic/prntdlgg.h" - -#if wxUSE_POSTSCRIPT - #define WXUNUSED_WITHOUT_PS(name) name -#else - #define WXUNUSED_WITHOUT_PS(name) WXUNUSED(name) -#endif - -wxString wxPrintData::GetPrinterCommand() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand(); -#endif - return wxEmptyString; -} - -wxString wxPrintData::GetPrinterOptions() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions(); -#endif - return wxEmptyString; -} - -wxString wxPrintData::GetPreviewCommand() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand(); -#endif - return wxEmptyString; -} - -wxString wxPrintData::GetFontMetricPath() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath(); -#endif - return wxEmptyString; -} - -double wxPrintData::GetPrinterScaleX() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleX(); -#endif - return 1.0; -} - -double wxPrintData::GetPrinterScaleY() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleY(); -#endif - return 1.0; -} - -long wxPrintData::GetPrinterTranslateX() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateX(); -#endif - return 0; -} - -long wxPrintData::GetPrinterTranslateY() const -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateY(); -#endif - return 0; -} - -void wxPrintData::SetPrinterCommand(const wxString& WXUNUSED_WITHOUT_PS(command)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterCommand( command ); -#endif -} - -void wxPrintData::SetPrinterOptions(const wxString& WXUNUSED_WITHOUT_PS(options)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterOptions( options ); -#endif -} - -void wxPrintData::SetPreviewCommand(const wxString& WXUNUSED_WITHOUT_PS(command)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPreviewCommand( command ); -#endif -} - -void wxPrintData::SetFontMetricPath(const wxString& WXUNUSED_WITHOUT_PS(path)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetFontMetricPath( path ); -#endif -} - -void wxPrintData::SetPrinterScaleX(double WXUNUSED_WITHOUT_PS(x)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleX( x ); -#endif -} - -void wxPrintData::SetPrinterScaleY(double WXUNUSED_WITHOUT_PS(y)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleY( y ); -#endif -} - -void wxPrintData::SetPrinterScaling(double WXUNUSED_WITHOUT_PS(x), double WXUNUSED_WITHOUT_PS(y)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaling( x, y ); -#endif -} - -void wxPrintData::SetPrinterTranslateX(long WXUNUSED_WITHOUT_PS(x)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateX( x ); -#endif -} - -void wxPrintData::SetPrinterTranslateY(long WXUNUSED_WITHOUT_PS(y)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateY( y ); -#endif -} - -void wxPrintData::SetPrinterTranslation(long WXUNUSED_WITHOUT_PS(x), long WXUNUSED_WITHOUT_PS(y)) -{ -#if wxUSE_POSTSCRIPT - if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) - ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslation( x, y ); -#endif -} -#endif - -// ---------------------------------------------------------------------------- -// Print dialog data -// ---------------------------------------------------------------------------- - -wxPrintDialogData::wxPrintDialogData() -{ - m_printFromPage = 0; - m_printToPage = 0; - m_printMinPage = 0; - m_printMaxPage = 0; - m_printNoCopies = 1; - m_printAllPages = false; - m_printCollate = false; - m_printToFile = false; - m_printSelection = false; - m_printEnableSelection = false; - m_printEnablePageNumbers = true; - - wxPrintFactory* factory = wxPrintFactory::GetFactory(); - m_printEnablePrintToFile = ! factory->HasOwnPrintToFile(); - - m_printEnableHelp = false; -#if WXWIN_COMPATIBILITY_2_4 - m_printSetupDialog = false; -#endif -} - -wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData) - : wxObject() -{ - (*this) = dialogData; -} - -wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData) -{ - m_printFromPage = 1; - m_printToPage = 0; - m_printMinPage = 1; - m_printMaxPage = 9999; - m_printNoCopies = 1; - m_printAllPages = false; - m_printCollate = false; - m_printToFile = false; - m_printSelection = false; - m_printEnableSelection = false; - m_printEnablePageNumbers = true; - m_printEnablePrintToFile = true; - m_printEnableHelp = false; -#if WXWIN_COMPATIBILITY_2_4 - m_printSetupDialog = false; -#endif - m_printData = printData; -} - -wxPrintDialogData::~wxPrintDialogData() -{ -} - -void wxPrintDialogData::operator=(const wxPrintDialogData& data) -{ - m_printFromPage = data.m_printFromPage; - m_printToPage = data.m_printToPage; - m_printMinPage = data.m_printMinPage; - m_printMaxPage = data.m_printMaxPage; - m_printNoCopies = data.m_printNoCopies; - m_printAllPages = data.m_printAllPages; - m_printCollate = data.m_printCollate; - m_printToFile = data.m_printToFile; - m_printSelection = data.m_printSelection; - m_printEnableSelection = data.m_printEnableSelection; - m_printEnablePageNumbers = data.m_printEnablePageNumbers; - m_printEnableHelp = data.m_printEnableHelp; - m_printEnablePrintToFile = data.m_printEnablePrintToFile; -#if WXWIN_COMPATIBILITY_2_4 - m_printSetupDialog = data.m_printSetupDialog; -#endif - m_printData = data.m_printData; -} - -void wxPrintDialogData::operator=(const wxPrintData& data) -{ - m_printData = data; -} - -// ---------------------------------------------------------------------------- -// wxPageSetupDialogData -// ---------------------------------------------------------------------------- - -wxPageSetupDialogData::wxPageSetupDialogData() -{ - m_paperSize = wxSize(0,0); - - CalculatePaperSizeFromId(); - - m_minMarginTopLeft = - m_minMarginBottomRight = - m_marginTopLeft = - m_marginBottomRight = wxPoint(0,0); - - // Flags - m_defaultMinMargins = false; - m_enableMargins = true; - m_enableOrientation = true; - m_enablePaper = true; - m_enablePrinter = true; - m_enableHelp = false; - m_getDefaultInfo = false; -} - -wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData) - : wxObject() -{ - (*this) = dialogData; -} - -wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData) -{ - m_paperSize = wxSize(0,0); - m_minMarginTopLeft = - m_minMarginBottomRight = - m_marginTopLeft = - m_marginBottomRight = wxPoint(0,0); - - // Flags - m_defaultMinMargins = false; - m_enableMargins = true; - m_enableOrientation = true; - m_enablePaper = true; - m_enablePrinter = true; - m_enableHelp = false; - m_getDefaultInfo = false; - - m_printData = printData; - - // The wxPrintData paper size overrides these values, unless the size cannot - // be found. - CalculatePaperSizeFromId(); -} - -wxPageSetupDialogData::~wxPageSetupDialogData() -{ -} - -wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data) -{ - m_paperSize = data.m_paperSize; - m_minMarginTopLeft = data.m_minMarginTopLeft; - m_minMarginBottomRight = data.m_minMarginBottomRight; - m_marginTopLeft = data.m_marginTopLeft; - m_marginBottomRight = data.m_marginBottomRight; - m_defaultMinMargins = data.m_defaultMinMargins; - m_enableMargins = data.m_enableMargins; - m_enableOrientation = data.m_enableOrientation; - m_enablePaper = data.m_enablePaper; - m_enablePrinter = data.m_enablePrinter; - m_getDefaultInfo = data.m_getDefaultInfo; - m_enableHelp = data.m_enableHelp; - - m_printData = data.m_printData; - - return *this; -} - -wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data) -{ - m_printData = data; - CalculatePaperSizeFromId(); - - return *this; -} - -// If a corresponding paper type is found in the paper database, will set the m_printData -// paper size id member as well. -void wxPageSetupDialogData::SetPaperSize(const wxSize& sz) -{ - m_paperSize = sz; - - CalculateIdFromPaperSize(); -} - -// Sets the wxPrintData id, plus the paper width/height if found in the paper database. -void wxPageSetupDialogData::SetPaperSize(wxPaperSize id) -{ - m_printData.SetPaperId(id); - - CalculatePaperSizeFromId(); -} - -void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData) -{ - m_printData = printData; - CalculatePaperSizeFromId(); -} - -// Use paper size defined in this object to set the wxPrintData -// paper id -void wxPageSetupDialogData::CalculateIdFromPaperSize() -{ - wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), - wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); - - wxSize sz = GetPaperSize(); - - wxPaperSize id = wxThePrintPaperDatabase->GetSize(wxSize(sz.x* 10, sz.y * 10)); - if (id != wxPAPER_NONE) - { - m_printData.SetPaperId(id); - } -} - -// Use paper id in wxPrintData to set this object's paper size -void wxPageSetupDialogData::CalculatePaperSizeFromId() -{ - wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), - wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); - - wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId()); - - if (sz != wxSize(0, 0)) - { - // sz is in 10ths of a mm, while paper size is in mm - m_paperSize.x = sz.x / 10; - m_paperSize.y = sz.y / 10; - } -} - -#endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Source/3rdParty/wx/src/common/colourcmn.cpp b/Source/3rdParty/wx/src/common/colourcmn.cpp deleted file mode 100644 index 5851dfcdf..000000000 --- a/Source/3rdParty/wx/src/common/colourcmn.cpp +++ /dev/null @@ -1,126 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/colourcmn.cpp -// Purpose: wxColourBase implementation -// Author: Francesco Montorsi -// Modified by: -// Created: 20/4/2006 -// RCS-ID: $Id: colourcmn.cpp 41538 2006-09-30 20:45:15Z RR $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/colour.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/gdicmn.h" -#endif - -#if wxUSE_VARIANT -IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) -#endif - -// ============================================================================ -// wxString <-> wxColour conversions -// ============================================================================ - -bool wxColourBase::FromString(const wxChar *str) -{ - if ( str == NULL || str[0] == wxT('\0')) - return false; // invalid or empty string - - if ( wxStrncmp(str, wxT("RGB"), 3) == 0 || - wxStrncmp(str, wxT("rgb"), 3) == 0 ) - { - // CSS-like RGB specification - // according to http://www.w3.org/TR/REC-CSS2/syndata.html#color-units - // values outside 0-255 range are allowed but should be clipped - int red, green, blue; - if (wxSscanf(&str[3], wxT("(%d, %d, %d)"), &red, &green, &blue) != 3) - return false; - - Set((unsigned char)wxClip(red,0,255), - (unsigned char)wxClip(green,0,255), - (unsigned char)wxClip(blue,0,255)); - } - else if ( str[0] == wxT('#') && wxStrlen(str) == 7 ) - { - // hexadecimal prefixed with # (HTML syntax) - unsigned long tmp; - if (wxSscanf(&str[1], wxT("%lx"), &tmp) != 1) - return false; - - Set((unsigned char)(tmp >> 16), - (unsigned char)(tmp >> 8), - (unsigned char)tmp); - } - else if (wxTheColourDatabase) // a colour name ? - { - // we can't do - // *this = wxTheColourDatabase->Find(str) - // because this place can be called from constructor - // and 'this' could not be available yet - wxColour clr = wxTheColourDatabase->Find(str); - if (clr.Ok()) - Set((unsigned char)clr.Red(), - (unsigned char)clr.Green(), - (unsigned char)clr.Blue()); - } - - if (Ok()) - return true; - - wxLogDebug(wxT("wxColour::Set - couldn't set to colour string '%s'"), str); - return false; -} - -wxString wxColourBase::GetAsString(long flags) const -{ - wxString colName; - - if (flags & wxC2S_NAME) - colName = wxTheColourDatabase->FindName((const wxColour &)(*this)).MakeLower(); - - if ( colName.empty() && (flags & wxC2S_CSS_SYNTAX) ) - { - // no name for this colour; return it in CSS syntax - colName.Printf(wxT("rgb(%d, %d, %d)"), - Red(), Green(), Blue()); - } - else if ( colName.empty() && (flags & wxC2S_HTML_SYNTAX) ) - { - // no name for this colour; return it in HTML syntax - colName.Printf(wxT("#%02X%02X%02X"), - Red(), Green(), Blue()); - } - - // this function always returns a non-empty string - wxASSERT_MSG(!colName.empty(), - wxT("Invalid wxColour -> wxString conversion flags")); - - return colName; -} - -#if WXWIN_COMPATIBILITY_2_6 - -// static -wxColour wxColourBase::CreateByName(const wxString& name) -{ - return wxColour(name); -} - -void wxColourBase::InitFromName(const wxString& col) -{ - Set(col); -} - -#endif // WXWIN_COMPATIBILITY_2_6 diff --git a/Source/3rdParty/wx/src/common/combocmn.cpp b/Source/3rdParty/wx/src/common/combocmn.cpp deleted file mode 100644 index f67061a3c..000000000 --- a/Source/3rdParty/wx/src/common/combocmn.cpp +++ /dev/null @@ -1,2340 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/combocmn.cpp -// Purpose: wxComboCtrlBase -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combocmn.cpp 67178 2011-03-13 09:32:19Z JMS $ -// Copyright: (c) 2005 Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COMBOCTRL - -#include "wx/combobox.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/log.h" - #include "wx/dcclient.h" - #include "wx/settings.h" - #include "wx/dialog.h" - #include "wx/timer.h" -#endif - -#include "wx/tooltip.h" - -#include "wx/combo.h" - - - -// constants -// ---------------------------------------------------------------------------- - -#define DEFAULT_DROPBUTTON_WIDTH 19 - -#define BMP_BUTTON_MARGIN 4 - -#define DEFAULT_POPUP_HEIGHT 400 - -#define DEFAULT_TEXT_INDENT 3 - -#define COMBO_MARGIN 2 // spacing right of wxTextCtrl - - -#if defined(__WXMSW__) - -#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common - // native controls work on it like normal. -#define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window. -#define TEXTCTRL_TEXT_CENTERED 0 // 1 if text in textctrl is vertically centered -#define FOCUS_RING 0 // No focus ring on wxMSW - -//#undef wxUSE_POPUPWIN -//#define wxUSE_POPUPWIN 0 - -#elif defined(__WXGTK__) - -// NB: It is not recommended to use wxDialog as popup on wxGTK, because of -// this bug: If wxDialog is hidden, its position becomes corrupt -// between hide and next show, but without internal coordinates being -// reflected (or something like that - atleast commenting out ->Hide() -// seemed to eliminate the position change). - -#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common - // native controls work on it like normal. -#define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window. -#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered -#define FOCUS_RING 0 // No focus ring on wxGTK - -#elif defined(__WXMAC__) - -#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common - // native controls work on it like normal. -#define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window. -#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered -#define FOCUS_RING 3 // Reserve room for the textctrl's focus ring to display - -#undef DEFAULT_DROPBUTTON_WIDTH -#define DEFAULT_DROPBUTTON_WIDTH 22 -#undef COMBO_MARGIN -#define COMBO_MARGIN FOCUS_RING - -#else - -#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common - // native controls work on it like normal. -#define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window. -#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered -#define FOCUS_RING 0 - -#endif - - -// Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless -// what the wxUSE_POPUPWIN says. -// FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2) -#if (!defined(__WXMSW__) && !defined(__WXGTK__)) || defined(__WXWINCE__) -#undef wxUSE_POPUPWIN -#define wxUSE_POPUPWIN 0 -#endif - - -#if wxUSE_POPUPWIN - #include "wx/popupwin.h" -#else - #undef USE_TRANSIENT_POPUP - #define USE_TRANSIENT_POPUP 0 -#endif - - -// Define different types of popup windows -enum -{ - POPUPWIN_NONE = 0, - POPUPWIN_WXPOPUPTRANSIENTWINDOW = 1, - POPUPWIN_WXPOPUPWINDOW = 2, - POPUPWIN_WXDIALOG = 3 -}; - - -#if USE_TRANSIENT_POPUP - // wxPopupTransientWindow is implemented - - #define wxComboPopupWindowBase wxPopupTransientWindow - #define PRIMARY_POPUP_TYPE POPUPWIN_WXPOPUPTRANSIENTWINDOW - #define USES_WXPOPUPTRANSIENTWINDOW 1 - - #if TRANSIENT_POPUPWIN_IS_PERFECT - // - #elif POPUPWIN_IS_PERFECT - #define wxComboPopupWindowBase2 wxPopupWindow - #define SECONDARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW - #define USES_WXPOPUPWINDOW 1 - #else - #define wxComboPopupWindowBase2 wxDialog - #define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG - #define USES_WXDIALOG 1 - #endif - -#elif wxUSE_POPUPWIN - // wxPopupWindow (but not wxPopupTransientWindow) is properly implemented - - #define wxComboPopupWindowBase wxPopupWindow - #define PRIMARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW - #define USES_WXPOPUPWINDOW 1 - - #if !POPUPWIN_IS_PERFECT - #define wxComboPopupWindowBase2 wxDialog - #define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG - #define USES_WXDIALOG 1 - #endif - -#else - // wxPopupWindow is not implemented - - #define wxComboPopupWindowBase wxDialog - #define PRIMARY_POPUP_TYPE POPUPWIN_WXDIALOG - #define USES_WXDIALOG 1 - -#endif - - -#ifndef USES_WXPOPUPTRANSIENTWINDOW - #define USES_WXPOPUPTRANSIENTWINDOW 0 -#endif - -#ifndef USES_WXPOPUPWINDOW - #define USES_WXPOPUPWINDOW 0 -#endif - -#ifndef USES_WXDIALOG - #define USES_WXDIALOG 0 -#endif - - -#if USES_WXPOPUPWINDOW - #define INSTALL_TOPLEV_HANDLER 1 -#else - #define INSTALL_TOPLEV_HANDLER 0 -#endif - - -// -// ** TODO ** -// * wxComboPopupWindow for external use (ie. replace old wxUniv wxPopupComboWindow) -// - - -// ---------------------------------------------------------------------------- -// wxComboFrameEventHandler takes care of hiding the popup when events happen -// in its top level parent. -// ---------------------------------------------------------------------------- - -#if INSTALL_TOPLEV_HANDLER - -// -// This will no longer be necessary after wxTransientPopupWindow -// works well on all platforms. -// - -class wxComboFrameEventHandler : public wxEvtHandler -{ -public: - wxComboFrameEventHandler( wxComboCtrlBase* pCb ); - virtual ~wxComboFrameEventHandler(); - - void OnPopup(); - - void OnIdle( wxIdleEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - void OnActivate( wxActivateEvent& event ); - void OnResize( wxSizeEvent& event ); - void OnMove( wxMoveEvent& event ); - void OnMenuEvent( wxMenuEvent& event ); - void OnClose( wxCloseEvent& event ); - -protected: - wxWindow* m_focusStart; - wxComboCtrlBase* m_combo; - -private: - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxComboFrameEventHandler, wxEvtHandler) - EVT_IDLE(wxComboFrameEventHandler::OnIdle) - EVT_LEFT_DOWN(wxComboFrameEventHandler::OnMouseEvent) - EVT_RIGHT_DOWN(wxComboFrameEventHandler::OnMouseEvent) - EVT_SIZE(wxComboFrameEventHandler::OnResize) - EVT_MOVE(wxComboFrameEventHandler::OnMove) - EVT_MENU_HIGHLIGHT(wxID_ANY,wxComboFrameEventHandler::OnMenuEvent) - EVT_MENU_OPEN(wxComboFrameEventHandler::OnMenuEvent) - EVT_ACTIVATE(wxComboFrameEventHandler::OnActivate) - EVT_CLOSE(wxComboFrameEventHandler::OnClose) -END_EVENT_TABLE() - -wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboCtrlBase* combo ) - : wxEvtHandler() -{ - m_combo = combo; -} - -wxComboFrameEventHandler::~wxComboFrameEventHandler() -{ -} - -void wxComboFrameEventHandler::OnPopup() -{ - m_focusStart = ::wxWindow::FindFocus(); -} - -void wxComboFrameEventHandler::OnIdle( wxIdleEvent& event ) -{ - wxWindow* winFocused = ::wxWindow::FindFocus(); - - wxWindow* popup = m_combo->GetPopupControl()->GetControl(); - wxWindow* winpopup = m_combo->GetPopupWindow(); - - if ( - winFocused != m_focusStart && - winFocused != popup && - winFocused->GetParent() != popup && - winFocused != winpopup && - winFocused->GetParent() != winpopup && - winFocused != m_combo && - winFocused != m_combo->GetButton() // GTK (atleast) requires this - ) - { - m_combo->HidePopup(); - } - - event.Skip(); -} - -void wxComboFrameEventHandler::OnMenuEvent( wxMenuEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -void wxComboFrameEventHandler::OnMouseEvent( wxMouseEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -void wxComboFrameEventHandler::OnClose( wxCloseEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -void wxComboFrameEventHandler::OnActivate( wxActivateEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -void wxComboFrameEventHandler::OnResize( wxSizeEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -void wxComboFrameEventHandler::OnMove( wxMoveEvent& event ) -{ - m_combo->HidePopup(); - event.Skip(); -} - -#endif // INSTALL_TOPLEV_HANDLER - -// ---------------------------------------------------------------------------- -// wxComboPopupWindow is, in essence, wxPopupWindow customized for -// wxComboCtrl. -// ---------------------------------------------------------------------------- - -class wxComboPopupWindow : public wxComboPopupWindowBase -{ -public: - - wxComboPopupWindow( wxComboCtrlBase *parent, - int style ) - #if USES_WXPOPUPWINDOW || USES_WXPOPUPTRANSIENTWINDOW - : wxComboPopupWindowBase(parent,style) - #else - : wxComboPopupWindowBase(parent, - wxID_ANY, - wxEmptyString, - wxPoint(-21,-21), - wxSize(20,20), - style) - #endif - { - m_inShow = 0; - } - -#if USES_WXPOPUPTRANSIENTWINDOW - virtual bool Show( bool show ); - virtual bool ProcessLeftDown(wxMouseEvent& event); -protected: - virtual void OnDismiss(); -#endif - -private: - wxByte m_inShow; -}; - - -#if USES_WXPOPUPTRANSIENTWINDOW -bool wxComboPopupWindow::Show( bool show ) -{ - // Guard against recursion - if ( m_inShow ) - return wxComboPopupWindowBase::Show(show); - - m_inShow++; - - wxASSERT( IsKindOf(CLASSINFO(wxPopupTransientWindow)) ); - - wxPopupTransientWindow* ptw = (wxPopupTransientWindow*) this; - wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent(); - - if ( show != ptw->IsShown() ) - { - if ( show ) - ptw->Popup(combo->GetPopupControl()->GetControl()); - else - ptw->Dismiss(); - } - - m_inShow--; - - return true; -} - -bool wxComboPopupWindow::ProcessLeftDown(wxMouseEvent& event) -{ - return wxPopupTransientWindow::ProcessLeftDown(event); -} - -// First thing that happens when a transient popup closes is that this method gets called. -void wxComboPopupWindow::OnDismiss() -{ - wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent(); - wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboCtrlBase)), - wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") ); - - combo->OnPopupDismiss(); -} -#endif // USES_WXPOPUPTRANSIENTWINDOW - - -// ---------------------------------------------------------------------------- -// wxComboPopupWindowEvtHandler does bulk of the custom event handling -// of a popup window. It is separate so we can have different types -// of popup windows. -// ---------------------------------------------------------------------------- - -class wxComboPopupWindowEvtHandler : public wxEvtHandler -{ -public: - - wxComboPopupWindowEvtHandler( wxComboCtrlBase *parent ) - { - m_combo = parent; - } - - void OnSizeEvent( wxSizeEvent& event ); - void OnKeyEvent(wxKeyEvent& event); -#if USES_WXDIALOG - void OnActivate( wxActivateEvent& event ); -#endif - -private: - wxComboCtrlBase* m_combo; - - DECLARE_EVENT_TABLE() -}; - - -BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler) - EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent) - EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent) -#if USES_WXDIALOG - EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate) -#endif - EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent) -END_EVENT_TABLE() - - -void wxComboPopupWindowEvtHandler::OnSizeEvent( wxSizeEvent& WXUNUSED(event) ) -{ - // Block the event so that the popup control does not get auto-resized. -} - -void wxComboPopupWindowEvtHandler::OnKeyEvent( wxKeyEvent& event ) -{ - // Relay keyboard event to the main child controls - wxWindowList children = m_combo->GetPopupWindow()->GetChildren(); - wxWindowList::iterator node = children.begin(); - wxWindow* child = (wxWindow*)*node; - child->AddPendingEvent(event); -} - -#if USES_WXDIALOG -void wxComboPopupWindowEvtHandler::OnActivate( wxActivateEvent& event ) -{ - if ( !event.GetActive() ) - { - // Tell combo control that we are dismissed. - m_combo->HidePopup(); - - event.Skip(); - } -} -#endif - - -// ---------------------------------------------------------------------------- -// wxComboPopup -// -// ---------------------------------------------------------------------------- - -wxComboPopup::~wxComboPopup() -{ -} - -void wxComboPopup::OnPopup() -{ -} - -void wxComboPopup::OnDismiss() -{ -} - -wxSize wxComboPopup::GetAdjustedSize( int minWidth, - int prefHeight, - int WXUNUSED(maxHeight) ) -{ - return wxSize(minWidth,prefHeight); -} - -void wxComboPopup::DefaultPaintComboControl( wxComboCtrlBase* combo, - wxDC& dc, const wxRect& rect ) -{ - if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl - { - combo->PrepareBackground(dc,rect,0); - - dc.DrawText( combo->GetValue(), - rect.x + combo->GetTextIndent(), - (rect.height-dc.GetCharHeight())/2 + rect.y ); - } -} - -void wxComboPopup::PaintComboControl( wxDC& dc, const wxRect& rect ) -{ - DefaultPaintComboControl(m_combo,dc,rect); -} - -void wxComboPopup::OnComboKeyEvent( wxKeyEvent& event ) -{ - event.Skip(); -} - -void wxComboPopup::OnComboDoubleClick() -{ -} - -void wxComboPopup::SetStringValue( const wxString& WXUNUSED(value) ) -{ -} - -bool wxComboPopup::LazyCreate() -{ - return false; -} - -void wxComboPopup::Dismiss() -{ - m_combo->HidePopup(); -} - -// ---------------------------------------------------------------------------- -// input handling -// ---------------------------------------------------------------------------- - -// -// This is pushed to the event handler queue of the child textctrl. -// -class wxComboBoxExtraInputHandler : public wxEvtHandler -{ -public: - - wxComboBoxExtraInputHandler( wxComboCtrlBase* combo ) - : wxEvtHandler() - { - m_combo = combo; - } - virtual ~wxComboBoxExtraInputHandler() { } - void OnKey(wxKeyEvent& event); - void OnFocus(wxFocusEvent& event); - -protected: - wxComboCtrlBase* m_combo; - -private: - DECLARE_EVENT_TABLE() -}; - - -BEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler, wxEvtHandler) - EVT_KEY_DOWN(wxComboBoxExtraInputHandler::OnKey) - EVT_KEY_UP(wxComboBoxExtraInputHandler::OnKey) - EVT_CHAR(wxComboBoxExtraInputHandler::OnKey) - EVT_SET_FOCUS(wxComboBoxExtraInputHandler::OnFocus) -END_EVENT_TABLE() - - -void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) -{ - // Let the wxComboCtrl event handler have a go first. - wxComboCtrlBase* combo = m_combo; - - wxKeyEvent redirectedEvent(event); - redirectedEvent.SetId(combo->GetId()); - redirectedEvent.SetEventObject(combo); - - if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) ) - { - // Don't let TAB through to the text ctrl - looks ugly - if ( event.GetKeyCode() != WXK_TAB ) - event.Skip(); - } -} - -void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) -{ - // FIXME: This code does run when control is clicked, - // yet on Windows it doesn't select all the text. - if ( !(m_combo->GetInternalFlags() & wxCC_NO_TEXT_AUTO_SELECT) ) - { - if ( m_combo->GetTextCtrl() ) - m_combo->GetTextCtrl()->SelectAll(); - else - m_combo->SetSelection(-1,-1); - } - - // Send focus indication to parent. - // NB: This is needed for cases where the textctrl gets focus - // instead of its parent. While this may trigger multiple - // wxEVT_SET_FOCUSes (since m_text->SetFocus is called - // from combo's focus event handler), they should be quite - // harmless. - wxFocusEvent evt2(wxEVT_SET_FOCUS,m_combo->GetId()); - evt2.SetEventObject(m_combo); - m_combo->GetEventHandler()->ProcessEvent(evt2); - - event.Skip(); -} - - -// -// This is pushed to the event handler queue of the control in popup. -// - -class wxComboPopupExtraEventHandler : public wxEvtHandler -{ -public: - - wxComboPopupExtraEventHandler( wxComboCtrlBase* combo ) - : wxEvtHandler() - { - m_combo = combo; - m_beenInside = false; - } - virtual ~wxComboPopupExtraEventHandler() { } - - void OnMouseEvent( wxMouseEvent& event ); - - // Called from wxComboCtrlBase::OnPopupDismiss - void OnPopupDismiss() - { - m_beenInside = false; - } - -protected: - wxComboCtrlBase* m_combo; - - bool m_beenInside; - -private: - DECLARE_EVENT_TABLE() -}; - - -BEGIN_EVENT_TABLE(wxComboPopupExtraEventHandler, wxEvtHandler) - EVT_MOUSE_EVENTS(wxComboPopupExtraEventHandler::OnMouseEvent) -END_EVENT_TABLE() - - -void wxComboPopupExtraEventHandler::OnMouseEvent( wxMouseEvent& event ) -{ - wxPoint pt = event.GetPosition(); - wxSize sz = m_combo->GetPopupControl()->GetControl()->GetClientSize(); - int evtType = event.GetEventType(); - bool isInside = pt.x >= 0 && pt.y >= 0 && pt.x < sz.x && pt.y < sz.y; - - if ( evtType == wxEVT_MOTION || - evtType == wxEVT_LEFT_DOWN || - evtType == wxEVT_RIGHT_DOWN ) - { - // Block motion and click events outside the popup - if ( !isInside || !m_combo->IsPopupShown() ) - { - event.Skip(false); - return; - } - } - else if ( evtType == wxEVT_LEFT_UP ) - { - if ( !m_combo->IsPopupShown() ) - { - event.Skip(false); - return; - } - - if ( !m_beenInside ) - { - if ( isInside ) - { - m_beenInside = true; - } - else - { - // - // Some mouse events to popup that happen outside it, before cursor - // has been inside the popu, need to be ignored by it but relayed to - // the dropbutton. - // - wxWindow* btn = m_combo->GetButton(); - if ( btn ) - btn->GetEventHandler()->AddPendingEvent(event); - else - m_combo->GetEventHandler()->AddPendingEvent(event); - - return; - } - - event.Skip(); - } - } - - event.Skip(); -} - -// ---------------------------------------------------------------------------- -// wxComboCtrlBase -// ---------------------------------------------------------------------------- - - -BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) - EVT_TEXT(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) - EVT_SIZE(wxComboCtrlBase::OnSizeEvent) - EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent) - EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent) - EVT_IDLE(wxComboCtrlBase::OnIdleEvent) - //EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent) - EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent) - EVT_TEXT_ENTER(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) - EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged) -END_EVENT_TABLE() - - -IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl) - -void wxComboCtrlBase::Init() -{ - m_winPopup = (wxWindow *)NULL; - m_popup = (wxWindow *)NULL; - m_popupWinState = Hidden; - m_btn = (wxWindow*) NULL; - m_text = (wxTextCtrl*) NULL; - m_popupInterface = (wxComboPopup*) NULL; - - m_popupExtraHandler = (wxEvtHandler*) NULL; - m_textEvtHandler = (wxEvtHandler*) NULL; - -#if INSTALL_TOPLEV_HANDLER - m_toplevEvtHandler = (wxEvtHandler*) NULL; -#endif - - m_mainCtrlWnd = this; - - m_heightPopup = -1; - m_widthMinPopup = -1; - m_anchorSide = 0; - m_widthCustomPaint = 0; - m_widthCustomBorder = 0; - - m_btnState = 0; - m_btnWidDefault = 0; - m_blankButtonBg = false; - m_ignoreEvtText = 0; - m_popupWinType = POPUPWIN_NONE; - m_btnWid = m_btnHei = -1; - m_btnSide = wxRIGHT; - m_btnSpacingX = 0; - - m_extLeft = 0; - m_extRight = 0; - m_absIndent = -1; - m_iFlags = 0; - m_timeCanAcceptClick = 0; - - m_resetFocus = false; -} - -bool wxComboCtrlBase::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( !wxControl::Create(parent, - id, - pos, - size, - style | wxWANTS_CHARS, - validator, - name) ) - return false; - - m_valueString = value; - - // Get colours - OnThemeChange(); - m_absIndent = GetNativeTextIndent(); - - m_iFlags |= wxCC_IFLAG_CREATED; - - // If x and y indicate valid size, wxSizeEvent won't be - // emitted automatically, so we need to add artifical one. - if ( size.x > 0 && size.y > 0 ) - { - wxSizeEvent evt(size,GetId()); - GetEventHandler()->AddPendingEvent(evt); - } - - return true; -} - -void wxComboCtrlBase::InstallInputHandlers() -{ - if ( m_text ) - { - m_textEvtHandler = new wxComboBoxExtraInputHandler(this); - m_text->PushEventHandler(m_textEvtHandler); - } -} - -void -wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator) -{ - if ( !(m_windowStyle & wxCB_READONLY) ) - { - if ( m_text ) - m_text->Destroy(); - - // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is - // not used by the wxPropertyGrid and therefore the tab is processed by - // looking at ancestors to see if they have wxTAB_TRAVERSAL. The - // navigation event is then sent to the wrong window. - style |= wxTE_PROCESS_TAB; - - if ( HasFlag(wxTE_PROCESS_ENTER) ) - style |= wxTE_PROCESS_ENTER; - - // Ignore EVT_TEXT generated by the constructor (but only - // if the event redirector already exists) - // NB: This must be " = 1" instead of "++"; - if ( m_textEvtHandler ) - m_ignoreEvtText = 1; - else - m_ignoreEvtText = 0; - - m_text = new wxTextCtrl(this, wxID_ANY, m_valueString, - wxDefaultPosition, wxSize(10,-1), - style, validator); - } -} - -void wxComboCtrlBase::OnThemeChange() -{ - // Leave the default bg on the Mac so the area used by the focus ring will - // be the correct colour and themed brush. Instead we'll use - // wxSYS_COLOUR_WINDOW in the EVT_PAINT handler as needed. -#ifndef __WXMAC__ - if ( !m_hasBgCol ) - { -#ifdef __WXGTK__ - // Set background to gtk_rc_get_style(m_widget)->bg[GTK_STATE_NORMAL], - // which can be different than the background of text entry. - wxColour bgCol = GetDefaultAttributes().colBg; -#else - wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#endif - SetOwnBackgroundColour(bgCol); - m_hasBgCol = false; - } -#endif -} - -wxComboCtrlBase::~wxComboCtrlBase() -{ - if ( HasCapture() ) - ReleaseMouse(); - -#if INSTALL_TOPLEV_HANDLER - delete ((wxComboFrameEventHandler*)m_toplevEvtHandler); - m_toplevEvtHandler = (wxEvtHandler*) NULL; -#endif - - DestroyPopup(); - - if ( m_text ) - m_text->RemoveEventHandler(m_textEvtHandler); - - delete m_textEvtHandler; -} - - -// ---------------------------------------------------------------------------- -// geometry stuff -// ---------------------------------------------------------------------------- - -// Recalculates button and textctrl areas -void wxComboCtrlBase::CalculateAreas( int btnWidth ) -{ - wxSize sz = GetClientSize(); - int customBorder = m_widthCustomBorder; - int btnBorder; // border for button only - - // check if button should really be outside the border: we'll do it it if - // its platform default or bitmap+pushbutton background is used, but not if - // there is vertical size adjustment or horizontal spacing. - if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || - (m_bmpNormal.Ok() && m_blankButtonBg) ) && - m_btnSpacingX == 0 && - m_btnHei <= 0 ) - { - m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE; - btnBorder = 0; - } - else - { - m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE); - btnBorder = customBorder; - } - - // Defaul indentation - if ( m_absIndent < 0 ) - m_absIndent = GetNativeTextIndent(); - - int butWidth = btnWidth; - - if ( butWidth <= 0 ) - butWidth = m_btnWidDefault; - else - m_btnWidDefault = butWidth; - - if ( butWidth <= 0 ) - return; - - int butHeight = sz.y - btnBorder*2; - - // Adjust button width - if ( m_btnWid > 0 ) - butWidth = m_btnWid; - else - { - // Adjust button width to match aspect ratio - // (but only if control is smaller than best size). - int bestHeight = GetBestSize().y; - int height = GetSize().y; - - if ( height < bestHeight ) - { - // Make very small buttons square, as it makes - // them accommodate arrow image better and still - // looks decent. - if ( height > 18 ) - butWidth = (height*butWidth)/bestHeight; - else - butWidth = butHeight; - } - } - - // Adjust button height - if ( m_btnHei > 0 ) - butHeight = m_btnHei; - - // Use size of normal bitmap if... - // It is larger - // OR - // button width is set to default and blank button bg is not drawn - if ( m_bmpNormal.Ok() ) - { - int bmpReqWidth = m_bmpNormal.GetWidth(); - int bmpReqHeight = m_bmpNormal.GetHeight(); - - // If drawing blank button background, we need to add some margin. - if ( m_blankButtonBg ) - { - bmpReqWidth += BMP_BUTTON_MARGIN*2; - bmpReqHeight += BMP_BUTTON_MARGIN*2; - } - - if ( butWidth < bmpReqWidth || ( m_btnWid == 0 && !m_blankButtonBg ) ) - butWidth = bmpReqWidth; - if ( butHeight < bmpReqHeight || ( m_btnHei == 0 && !m_blankButtonBg ) ) - butHeight = bmpReqHeight; - - // Need to fix height? - if ( (sz.y-(customBorder*2)) < butHeight && btnWidth == 0 ) - { - int newY = butHeight+(customBorder*2); - SetClientSize(wxDefaultCoord,newY); - sz.y = newY; - } - } - - int butAreaWid = butWidth + (m_btnSpacingX*2); - - m_btnSize.x = butWidth; - m_btnSize.y = butHeight; - - m_btnArea.x = ( m_btnSide==wxRIGHT ? sz.x - butAreaWid - btnBorder : btnBorder ); - m_btnArea.y = btnBorder + FOCUS_RING; - m_btnArea.width = butAreaWid; - m_btnArea.height = sz.y - ((btnBorder+FOCUS_RING)*2); - - m_tcArea.x = ( m_btnSide==wxRIGHT ? 0 : butAreaWid ) + customBorder + FOCUS_RING; - m_tcArea.y = customBorder + FOCUS_RING; - m_tcArea.width = sz.x - butAreaWid - (customBorder*2) - (FOCUS_RING*2); - m_tcArea.height = sz.y - ((customBorder+FOCUS_RING)*2); - -/* - if ( m_text ) - { - ::wxMessageBox(wxString::Format(wxT("ButtonArea (%i,%i,%i,%i)\n"),m_btnArea.x,m_btnArea.y,m_btnArea.width,m_btnArea.height) + - wxString::Format(wxT("TextCtrlArea (%i,%i,%i,%i)"),m_tcArea.x,m_tcArea.y,m_tcArea.width,m_tcArea.height)); - } -*/ -} - -void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ) -{ - if ( !m_text ) - return; - -#if !TEXTCTRL_TEXT_CENTERED - - wxSize sz = GetClientSize(); - - int customBorder = m_widthCustomBorder; - if ( (m_text->GetWindowStyleFlag() & wxBORDER_MASK) == wxNO_BORDER ) - { - // Centre textctrl - int tcSizeY = m_text->GetBestSize().y; - int diff = sz.y - tcSizeY; - int y = textCtrlYAdjust + (diff/2); - - if ( y < customBorder ) - y = customBorder; - - m_text->SetSize( m_tcArea.x + m_widthCustomPaint + m_absIndent + textCtrlXAdjust, - y, - m_tcArea.width - COMBO_MARGIN - - (textCtrlXAdjust + m_widthCustomPaint + m_absIndent), - -1 ); - - // Make sure textctrl doesn't exceed the bottom custom border - wxSize tsz = m_text->GetSize(); - diff = (y + tsz.y) - (sz.y - customBorder); - if ( diff >= 0 ) - { - tsz.y = tsz.y - diff - 1; - m_text->SetSize(tsz); - } - } - else -#else // TEXTCTRL_TEXT_CENTERED - wxUnusedVar(textCtrlXAdjust); - wxUnusedVar(textCtrlYAdjust); -#endif // !TEXTCTRL_TEXT_CENTERED/TEXTCTRL_TEXT_CENTERED - { - // If it has border, have textctrl will the entire text field. - m_text->SetSize( m_tcArea.x + m_widthCustomPaint, - m_tcArea.y, - m_tcArea.width - m_widthCustomPaint, - m_tcArea.height ); - } -} - -wxSize wxComboCtrlBase::DoGetBestSize() const -{ - wxSize sizeText(150,0); - - if ( m_text ) - sizeText = m_text->GetBestSize(); - - // TODO: Better method to calculate close-to-native control height. - - int fhei; - if ( m_font.Ok() ) - fhei = (m_font.GetPointSize()*2) + 5; - else if ( wxNORMAL_FONT->Ok() ) - fhei = (wxNORMAL_FONT->GetPointSize()*2) + 5; - else - fhei = sizeText.y + 4; - - // Need to force height to accomodate bitmap? - int btnSizeY = m_btnSize.y; - if ( m_bmpNormal.Ok() && fhei < btnSizeY ) - fhei = btnSizeY; - - // Control height doesn't depend on border -/* - // Add border - int border = m_windowStyle & wxBORDER_MASK; - if ( border == wxSIMPLE_BORDER ) - fhei += 2; - else if ( border == wxNO_BORDER ) - fhei += (m_widthCustomBorder*2); - else - // Sunken etc. - fhei += 4; -*/ - - // Final adjustments -#ifdef __WXGTK__ - fhei += 1; -#endif - -#ifdef __WXMAC__ - // these are the numbers from the HIG: - switch ( m_windowVariant ) - { - case wxWINDOW_VARIANT_NORMAL: - default : - fhei = 22; - break; - case wxWINDOW_VARIANT_SMALL: - fhei = 19; - break; - case wxWINDOW_VARIANT_MINI: - fhei = 15; - break; - } -#endif - - fhei += 2 * FOCUS_RING; - int width = sizeText.x + FOCUS_RING + COMBO_MARGIN + DEFAULT_DROPBUTTON_WIDTH; - - wxSize ret(width, fhei); - CacheBestSize(ret); - return ret; -} - -void wxComboCtrlBase::OnSizeEvent( wxSizeEvent& event ) -{ - if ( !IsCreated() ) - return; - - // defined by actual wxComboCtrls - OnResize(); - - event.Skip(); -} - -// ---------------------------------------------------------------------------- -// standard operations -// ---------------------------------------------------------------------------- - -bool wxComboCtrlBase::Enable(bool enable) -{ - if ( !wxControl::Enable(enable) ) - return false; - - if ( m_btn ) - m_btn->Enable(enable); - if ( m_text ) - m_text->Enable(enable); - - Refresh(); - - return true; -} - -bool wxComboCtrlBase::Show(bool show) -{ - if ( !wxControl::Show(show) ) - return false; - - if (m_btn) - m_btn->Show(show); - - if (m_text) - m_text->Show(show); - - return true; -} - -bool wxComboCtrlBase::SetFont ( const wxFont& font ) -{ - if ( !wxControl::SetFont(font) ) - return false; - - if (m_text) - m_text->SetFont(font); - - return true; -} - -#if wxUSE_TOOLTIPS -void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) -{ - wxControl::DoSetToolTip(tooltip); - - // Set tool tip for button and text box - if ( tooltip ) - { - const wxString &tip = tooltip->GetTip(); - if ( m_text ) m_text->SetToolTip(tip); - if ( m_btn ) m_btn->SetToolTip(tip); - } - else - { - if ( m_text ) m_text->SetToolTip( (wxToolTip*) NULL ); - if ( m_btn ) m_btn->SetToolTip( (wxToolTip*) NULL ); - } -} -#endif // wxUSE_TOOLTIPS - -#if wxUSE_VALIDATORS -void wxComboCtrlBase::SetValidator(const wxValidator& validator) -{ - wxTextCtrl* textCtrl = GetTextCtrl(); - - if ( textCtrl ) - textCtrl->SetValidator( validator ); - else - wxControl::SetValidator( validator ); -} - -wxValidator* wxComboCtrlBase::GetValidator() -{ - wxTextCtrl* textCtrl = GetTextCtrl(); - - return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator(); -} -#endif // wxUSE_VALIDATORS - -// ---------------------------------------------------------------------------- -// painting -// ---------------------------------------------------------------------------- - -#if (!defined(__WXMSW__)) || defined(__WXUNIVERSAL__) -// prepare combo box background on area in a way typical on platform -void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const -{ - wxSize sz = GetClientSize(); - bool isEnabled; - bool isFocused; // also selected - - // For smaller size control (and for disabled background) use less spacing - int focusSpacingX; - int focusSpacingY; - - if ( !(flags & wxCONTROL_ISSUBMENU) ) - { - // Drawing control - isEnabled = IsEnabled(); - isFocused = ShouldDrawFocus(); - - // Windows-style: for smaller size control (and for disabled background) use less spacing - focusSpacingX = isEnabled ? 2 : 1; - focusSpacingY = sz.y > (GetCharHeight()+2) && isEnabled ? 2 : 1; - } - else - { - // Drawing a list item - isEnabled = true; // they are never disabled - isFocused = flags & wxCONTROL_SELECTED ? true : false; - - focusSpacingX = 0; - focusSpacingY = 0; - } - - // Set the background sub-rectangle for selection, disabled etc - wxRect selRect(rect); - selRect.y += focusSpacingY; - selRect.height -= (focusSpacingY*2); - - int wcp = 0; - - if ( !(flags & wxCONTROL_ISSUBMENU) ) - wcp += m_widthCustomPaint; - - selRect.x += wcp + focusSpacingX; - selRect.width -= wcp + (focusSpacingX*2); - - wxColour fgCol; - wxColour bgCol; - - if ( isEnabled ) - { - if ( isFocused ) - fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - else if ( m_hasFgCol ) - // Honour the custom foreground colour - fgCol = GetForegroundColour(); - else - fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - } - else - { - fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); - } - - if ( isEnabled ) - { - if ( isFocused ) - bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - else if ( m_hasBgCol ) - // Honour the custom background colour - bgCol = GetBackgroundColour(); - else -#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange - bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#else - bgCol = GetBackgroundColour(); -#endif - } - else - { -#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange - bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#else - bgCol = GetBackgroundColour(); -#endif - } - - dc.SetTextForeground( fgCol ); - dc.SetBrush( bgCol ); - dc.SetPen( bgCol ); - dc.DrawRectangle( selRect ); - - // Don't clip exactly to the selection rectangle so we can draw - // to the non-selected area in front of it. - wxRect clipRect(rect.x,rect.y, - (selRect.x+selRect.width)-rect.x,rect.height); - dc.SetClippingRegion(clipRect); -} -#else -// Save the library size a bit for platforms that re-implement this. -void wxComboCtrlBase::PrepareBackground( wxDC&, const wxRect&, int ) const -{ -} -#endif - -void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) -{ - int drawState = m_btnState; - -#ifdef __WXGTK__ - if ( GetPopupWindowState() >= Animating ) - drawState |= wxCONTROL_PRESSED; -#endif - - wxRect drawRect(rect.x+m_btnSpacingX, - rect.y+((rect.height-m_btnSize.y)/2), - m_btnSize.x, - m_btnSize.y); - - // Make sure area is not larger than the control - if ( drawRect.y < rect.y ) - drawRect.y = rect.y; - if ( drawRect.height > rect.height ) - drawRect.height = rect.height; - - bool enabled = IsEnabled(); - - if ( !enabled ) - drawState |= wxCONTROL_DISABLED; - - if ( !m_bmpNormal.Ok() ) - { - if ( flags & Draw_BitmapOnly ) - return; - - // Need to clear button background even if m_btn is present - if ( flags & Draw_PaintBg ) - { - wxColour bgCol; - - if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) - bgCol = GetParent()->GetBackgroundColour(); - else - bgCol = GetBackgroundColour(); - - dc.SetBrush(bgCol); - dc.SetPen(bgCol); - dc.DrawRectangle(rect); - } - - // Draw standard button - wxRendererNative::Get().DrawComboBoxDropButton(this, - dc, - drawRect, - drawState); - } - else - { - // Draw bitmap - - wxBitmap* pBmp; - - if ( !enabled ) - pBmp = &m_bmpDisabled; - else if ( m_btnState & wxCONTROL_PRESSED ) - pBmp = &m_bmpPressed; - else if ( m_btnState & wxCONTROL_CURRENT ) - pBmp = &m_bmpHover; - else - pBmp = &m_bmpNormal; - - if ( m_blankButtonBg ) - { - // If using blank button background, we need to clear its background - // with button face colour instead of colour for rest of the control. - if ( flags & Draw_PaintBg ) - { - wxColour bgCol = GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); - //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - dc.SetPen(bgCol); - dc.SetBrush(bgCol); - dc.DrawRectangle(rect); - } - - wxRendererNative::Get().DrawPushButton(this, - dc, - drawRect, - drawState); - - } - else - - { - // Need to clear button background even if m_btn is present - // (assume non-button background was cleared just before this call so brushes are good) - if ( flags & Draw_PaintBg ) - dc.DrawRectangle(rect); - } - - // Draw bitmap centered in drawRect - dc.DrawBitmap(*pBmp, - drawRect.x + (drawRect.width-pBmp->GetWidth())/2, - drawRect.y + (drawRect.height-pBmp->GetHeight())/2, - true); - } -} - -void wxComboCtrlBase::RecalcAndRefresh() -{ - if ( IsCreated() ) - { - wxSizeEvent evt(GetSize(),GetId()); - GetEventHandler()->ProcessEvent(evt); - Refresh(); - } -} - -// ---------------------------------------------------------------------------- -// miscellaneous event handlers -// ---------------------------------------------------------------------------- - -void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) -{ - if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED ) - { - if ( m_ignoreEvtText > 0 ) - { - m_ignoreEvtText--; - return; - } - } - - // Change event id, object and string before relaying it forward - event.SetId(GetId()); - wxString s = event.GetString(); - event.SetEventObject(this); - event.SetString(s); - event.Skip(); -} - -// call if cursor is on button area or mouse is captured for the button -bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event, - int flags ) -{ - int type = event.GetEventType(); - - if ( type == wxEVT_MOTION ) - { - if ( flags & wxCC_MF_ON_BUTTON ) - { - if ( !(m_btnState & wxCONTROL_CURRENT) ) - { - // Mouse hover begins - m_btnState |= wxCONTROL_CURRENT; - if ( HasCapture() ) // Retain pressed state. - m_btnState |= wxCONTROL_PRESSED; - Refresh(); - } - } - else if ( (m_btnState & wxCONTROL_CURRENT) ) - { - // Mouse hover ends - m_btnState &= ~(wxCONTROL_CURRENT|wxCONTROL_PRESSED); - Refresh(); - } - } - else if ( type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_DCLICK ) - { - if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) ) - { - m_btnState |= wxCONTROL_PRESSED; - Refresh(); - - if ( !(m_iFlags & wxCC_POPUP_ON_MOUSE_UP) ) - OnButtonClick(); - else - // If showing popup now, do not capture mouse or there will be interference - CaptureMouse(); - } - } - else if ( type == wxEVT_LEFT_UP ) - { - - // Only accept event if mouse was left-press was previously accepted - if ( HasCapture() ) - ReleaseMouse(); - - if ( m_btnState & wxCONTROL_PRESSED ) - { - // If mouse was inside, fire the click event. - if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP ) - { - if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) ) - OnButtonClick(); - } - - m_btnState &= ~(wxCONTROL_PRESSED); - Refresh(); - } - } - else if ( type == wxEVT_LEAVE_WINDOW ) - { - if ( m_btnState & (wxCONTROL_CURRENT|wxCONTROL_PRESSED) ) - { - m_btnState &= ~(wxCONTROL_CURRENT); - - // Mouse hover ends - if ( IsPopupWindowState(Hidden) ) - { - m_btnState &= ~(wxCONTROL_PRESSED); - Refresh(); - } - } - } - else - return false; - - return true; -} - -// returns true if event was consumed or filtered -bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, - int WXUNUSED(flags) ) -{ - wxLongLong t = ::wxGetLocalTimeMillis(); - int evtType = event.GetEventType(); - -#if USES_WXPOPUPWINDOW || USES_WXDIALOG - if ( m_popupWinType != POPUPWIN_WXPOPUPTRANSIENTWINDOW ) - { - if ( IsPopupWindowState(Visible) && - ( evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_RIGHT_DOWN ) ) - { - HidePopup(); - return true; - } - } -#endif - - // Filter out clicks on button immediately after popup dismiss (Windows like behaviour) - if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick ) - { - event.SetEventType(0); - return true; - } - - return false; -} - -void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent& event ) -{ - int evtType = event.GetEventType(); - - if ( (evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_LEFT_DCLICK) && - (m_windowStyle & wxCB_READONLY) ) - { - if ( GetPopupWindowState() >= Animating ) - { - #if USES_WXPOPUPWINDOW - // Click here always hides the popup. - if ( m_popupWinType == POPUPWIN_WXPOPUPWINDOW ) - HidePopup(); - #endif - } - else - { - if ( !(m_windowStyle & wxCC_SPECIAL_DCLICK) ) - { - // In read-only mode, clicking the text is the - // same as clicking the button. - OnButtonClick(); - } - else if ( /*evtType == wxEVT_LEFT_UP || */evtType == wxEVT_LEFT_DCLICK ) - { - //if ( m_popupInterface->CycleValue() ) - // Refresh(); - if ( m_popupInterface ) - m_popupInterface->OnComboDoubleClick(); - } - } - } - else - if ( IsPopupShown() ) - { - // relay (some) mouse events to the popup - if ( evtType == wxEVT_MOUSEWHEEL ) - m_popup->AddPendingEvent(event); - } - else if ( evtType ) - event.Skip(); -} - -void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) -{ - if ( IsPopupShown() ) - { - // pass it to the popped up control - GetPopupControl()->GetControl()->AddPendingEvent(event); - } - else // no popup - { - int keycode = event.GetKeyCode(); - - wxWindow* mainCtrl = GetMainWindowOfCompositeControl(); - - if ( mainCtrl->GetParent()->HasFlag(wxTAB_TRAVERSAL) && - keycode == WXK_TAB ) - { - wxNavigationKeyEvent evt; - - evt.SetFlags(wxNavigationKeyEvent::FromTab| - (!event.ShiftDown() ? wxNavigationKeyEvent::IsForward - : wxNavigationKeyEvent::IsBackward)); - evt.SetEventObject(mainCtrl); - evt.SetCurrentFocus(mainCtrl); - mainCtrl->GetParent()->GetEventHandler()->AddPendingEvent(evt); - return; - } - - if ( IsKeyPopupToggle(event) ) - { - OnButtonClick(); - return; - } - - int comboStyle = GetWindowStyle(); - wxComboPopup* popupInterface = GetPopupControl(); - - if ( !popupInterface ) - { - event.Skip(); - return; - } - - if ( (comboStyle & wxCB_READONLY) || - (keycode != WXK_RIGHT && keycode != WXK_LEFT) ) - { - popupInterface->OnComboKeyEvent(event); - } - else - event.Skip(); - } -} - -void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) -{ - if ( event.GetEventType() == wxEVT_SET_FOCUS ) - { - wxWindow* tc = GetTextCtrl(); - if ( tc && tc != DoFindFocus() ) -#ifdef __WXMAC__ - m_resetFocus = true; -#else - tc->SetFocus(); -#endif - } - - Refresh(); -} - -void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) ) -{ - if ( m_resetFocus ) - { - m_resetFocus = false; - wxWindow* tc = GetTextCtrl(); - if ( tc ) - tc->SetFocus(); - } -} - -void wxComboCtrlBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) -{ - OnThemeChange(); - // indentation may also have changed - if ( !(m_iFlags & wxCC_IFLAG_INDENT_SET) ) - m_absIndent = GetNativeTextIndent(); - RecalcAndRefresh(); -} - -// ---------------------------------------------------------------------------- -// popup handling -// ---------------------------------------------------------------------------- - -// Create popup window and the child control -void wxComboCtrlBase::CreatePopup() -{ - wxComboPopup* popupInterface = m_popupInterface; - wxWindow* popup; - - if ( !m_winPopup ) - { -#ifdef wxComboPopupWindowBase2 - if ( m_iFlags & wxCC_IFLAG_USE_ALT_POPUP ) - { - #if !USES_WXDIALOG - m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER ); - #else - m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString, - wxPoint(-21,-21), wxSize(20, 20), - wxNO_BORDER ); - #endif - m_popupWinType = SECONDARY_POPUP_TYPE; - } - else -#endif - { - m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER ); - m_popupWinType = PRIMARY_POPUP_TYPE; - } - m_popupWinEvtHandler = new wxComboPopupWindowEvtHandler(this); - m_winPopup->PushEventHandler(m_popupWinEvtHandler); - } - - popupInterface->Create(m_winPopup); - m_popup = popup = popupInterface->GetControl(); - - m_popupExtraHandler = new wxComboPopupExtraEventHandler(this); - popup->PushEventHandler( m_popupExtraHandler ); - - // This may be helpful on some platforms - // (eg. it bypasses a wxGTK popupwindow bug where - // window is not initially hidden when it should be) - m_winPopup->Hide(); - - popupInterface->m_iFlags |= wxCP_IFLAG_CREATED; -} - -// Destroy popup window and the child control -void wxComboCtrlBase::DestroyPopup() -{ - HidePopup(); - - if ( m_popup ) - m_popup->RemoveEventHandler(m_popupExtraHandler); - - delete m_popupExtraHandler; - - delete m_popupInterface; - - if ( m_winPopup ) - { - m_winPopup->RemoveEventHandler(m_popupWinEvtHandler); - delete m_popupWinEvtHandler; - m_popupWinEvtHandler = NULL; - m_winPopup->Destroy(); - } - - m_popupExtraHandler = (wxEvtHandler*) NULL; - m_popupInterface = (wxComboPopup*) NULL; - m_winPopup = (wxWindow*) NULL; - m_popup = (wxWindow*) NULL; -} - -void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) -{ - wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") ); - - DestroyPopup(); - - iface->InitBase(this); - iface->Init(); - - m_popupInterface = iface; - - if ( !iface->LazyCreate() ) - { - CreatePopup(); - } - else - { - m_popup = (wxWindow*) NULL; - } - - // This must be done after creation - if ( m_valueString.length() ) - { - iface->SetStringValue(m_valueString); - //Refresh(); - } -} - -// Ensures there is atleast the default popup -void wxComboCtrlBase::EnsurePopupControl() -{ - if ( !m_popupInterface ) - SetPopupControl(NULL); -} - -void wxComboCtrlBase::OnButtonClick() -{ - // Derived classes can override this method for totally custom - // popup action - if ( !IsPopupWindowState(Visible) ) - ShowPopup(); - else - HidePopup(); -} - -void wxComboCtrlBase::ShowPopup() -{ - EnsurePopupControl(); - wxCHECK_RET( !IsPopupWindowState(Visible), wxT("popup window already shown") ); - - if ( IsPopupWindowState(Animating) ) - return; - - SetFocus(); - - // Space above and below - int screenHeight; - wxPoint scrPos; - int spaceAbove; - int spaceBelow; - int maxHeightPopup; - wxSize ctrlSz = GetSize(); - - screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); - scrPos = GetParent()->ClientToScreen(GetPosition()); - - spaceAbove = scrPos.y; - spaceBelow = screenHeight - spaceAbove - ctrlSz.y; - - maxHeightPopup = spaceBelow; - if ( spaceAbove > spaceBelow ) - maxHeightPopup = spaceAbove; - - // Width - int widthPopup = ctrlSz.x + m_extLeft + m_extRight; - - if ( widthPopup < m_widthMinPopup ) - widthPopup = m_widthMinPopup; - - wxWindow* winPopup = m_winPopup; - wxWindow* popup; - - // Need to disable tab traversal of parent - // - // NB: This is to fix a bug in wxMSW. In theory it could also be fixed - // by, for instance, adding check to window.cpp:wxWindowMSW::MSWProcessMessage - // that if transient popup is open, then tab traversal is to be ignored. - // However, I think this code would still be needed for cases where - // transient popup doesn't work yet (wxWinCE?). - wxWindow* parent = GetParent(); - int parentFlags = parent->GetWindowStyle(); - if ( parentFlags & wxTAB_TRAVERSAL ) - { - parent->SetWindowStyle( parentFlags & ~(wxTAB_TRAVERSAL) ); - m_iFlags |= wxCC_IFLAG_PARENT_TAB_TRAVERSAL; - } - - if ( !winPopup ) - { - CreatePopup(); - winPopup = m_winPopup; - popup = m_popup; - } - else - { - popup = m_popup; - } - - winPopup->Enable(); - - wxASSERT( !m_popup || m_popup == popup ); // Consistency check. - - wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup, - m_heightPopup<=0?DEFAULT_POPUP_HEIGHT:m_heightPopup, - maxHeightPopup); - - popup->SetSize(adjustedSize); - popup->Move(0,0); - m_popupInterface->OnPopup(); - - // - // Reposition and resize popup window - // - - wxSize szp = popup->GetSize(); - - int popupX; - int popupY = scrPos.y + ctrlSz.y; - - // Default anchor is wxLEFT - int anchorSide = m_anchorSide; - if ( !anchorSide ) - anchorSide = wxLEFT; - - int rightX = scrPos.x + ctrlSz.x + m_extRight - szp.x; - int leftX = scrPos.x - m_extLeft; - - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) - leftX -= ctrlSz.x; - - int screenWidth = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ); - - // If there is not enough horizontal space, anchor on the other side. - // If there is no space even then, place the popup at x 0. - if ( anchorSide == wxRIGHT ) - { - if ( rightX < 0 ) - { - if ( (leftX+szp.x) < screenWidth ) - anchorSide = wxLEFT; - else - anchorSide = 0; - } - } - else - { - if ( (leftX+szp.x) >= screenWidth ) - { - if ( rightX >= 0 ) - anchorSide = wxRIGHT; - else - anchorSide = 0; - } - } - - // Select x coordinate according to the anchor side - if ( anchorSide == wxRIGHT ) - popupX = rightX; - else if ( anchorSide == wxLEFT ) - popupX = leftX; - else - popupX = 0; - - int showFlags = CanDeferShow; - - if ( spaceBelow < szp.y ) - { - popupY = scrPos.y - szp.y; - showFlags |= ShowAbove; - } - -#if INSTALL_TOPLEV_HANDLER - // Put top level window event handler into place - if ( m_popupWinType == POPUPWIN_WXPOPUPWINDOW ) - { - if ( !m_toplevEvtHandler ) - m_toplevEvtHandler = new wxComboFrameEventHandler(this); - - wxWindow* toplev = ::wxGetTopLevelParent( this ); - wxASSERT( toplev ); - ((wxComboFrameEventHandler*)m_toplevEvtHandler)->OnPopup(); - toplev->PushEventHandler( m_toplevEvtHandler ); - } -#endif - - // Set string selection (must be this way instead of SetStringSelection) - if ( m_text ) - { - if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) - m_text->SelectAll(); - - m_popupInterface->SetStringValue( m_text->GetValue() ); - } - else - { - // This is neede since focus/selection indication may change when popup is shown - Refresh(); - } - - // This must be after SetStringValue - m_popupWinState = Animating; - - wxRect popupWinRect( popupX, popupY, szp.x, szp.y ); - - m_popup = popup; - if ( (m_iFlags & wxCC_IFLAG_DISABLE_POPUP_ANIM) || - AnimateShow( popupWinRect, showFlags ) ) - { - DoShowPopup( popupWinRect, showFlags ); - } -} - -bool wxComboCtrlBase::AnimateShow( const wxRect& WXUNUSED(rect), int WXUNUSED(flags) ) -{ - return true; -} - -void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) ) -{ - wxWindow* winPopup = m_winPopup; - - if ( IsPopupWindowState(Animating) ) - { - // Make sure the popup window is shown in the right position. - // Should not matter even if animation already did this. - - // Some platforms (GTK) may like SetSize and Move to be separate - // (though the bug was probably fixed). - winPopup->SetSize( rect ); - - winPopup->Show(); - - m_popupWinState = Visible; - } - else if ( IsPopupWindowState(Hidden) ) - { - // Animation was aborted - - wxASSERT( !winPopup->IsShown() ); - - m_popupWinState = Hidden; - } -} - -void wxComboCtrlBase::OnPopupDismiss() -{ - // Just in case, avoid double dismiss - if ( IsPopupWindowState(Hidden) ) - return; - - // This must be set before focus - otherwise there will be recursive - // OnPopupDismisses. - m_popupWinState = Hidden; - - //SetFocus(); - m_winPopup->Disable(); - - // Inform popup control itself - m_popupInterface->OnDismiss(); - - if ( m_popupExtraHandler ) - ((wxComboPopupExtraEventHandler*)m_popupExtraHandler)->OnPopupDismiss(); - -#if INSTALL_TOPLEV_HANDLER - // Remove top level window event handler - if ( m_toplevEvtHandler ) - { - wxWindow* toplev = ::wxGetTopLevelParent( this ); - if ( toplev ) - toplev->RemoveEventHandler( m_toplevEvtHandler ); - } -#endif - - m_timeCanAcceptClick = ::wxGetLocalTimeMillis(); - - if ( m_popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW ) - m_timeCanAcceptClick += 150; - - // If cursor not on dropdown button, then clear its state - // (technically not required by all ports, but do it for all just in case) - if ( !m_btnArea.Contains(ScreenToClient(::wxGetMousePosition())) ) - m_btnState = 0; - - // Return parent's tab traversal flag. - // See ShowPopup for notes. - if ( m_iFlags & wxCC_IFLAG_PARENT_TAB_TRAVERSAL ) - { - wxWindow* parent = GetParent(); - parent->SetWindowStyle( parent->GetWindowStyle() | wxTAB_TRAVERSAL ); - m_iFlags &= ~(wxCC_IFLAG_PARENT_TAB_TRAVERSAL); - } - - // refresh control (necessary even if m_text) - Refresh(); - - SetFocus(); -} - -void wxComboCtrlBase::HidePopup() -{ - // Should be able to call this without popup interface - if ( IsPopupWindowState(Hidden) ) - return; - - // transfer value and show it in textctrl, if any - if ( !IsPopupWindowState(Animating) ) - SetValue( m_popupInterface->GetStringValue() ); - - m_winPopup->Hide(); - - OnPopupDismiss(); -} - -// ---------------------------------------------------------------------------- -// customization methods -// ---------------------------------------------------------------------------- - -void wxComboCtrlBase::SetButtonPosition( int width, int height, - int side, int spacingX ) -{ - m_btnWid = width; - m_btnHei = height; - m_btnSide = side; - m_btnSpacingX = spacingX; - - if ( width > 0 || height > 0 || spacingX ) - m_iFlags |= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON; - - RecalcAndRefresh(); -} - -wxSize wxComboCtrlBase::GetButtonSize() -{ - if ( m_btnSize.x > 0 ) - return m_btnSize; - - wxSize retSize(m_btnWid,m_btnHei); - - // Need to call CalculateAreas now if button size is - // is not explicitly specified. - if ( retSize.x <= 0 || retSize.y <= 0) - { - OnResize(); - - retSize = m_btnSize; - } - - return retSize; -} - -void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal, - bool blankButtonBg, - const wxBitmap& bmpPressed, - const wxBitmap& bmpHover, - const wxBitmap& bmpDisabled ) -{ - m_bmpNormal = bmpNormal; - m_blankButtonBg = blankButtonBg; - - if ( bmpPressed.Ok() ) - m_bmpPressed = bmpPressed; - else - m_bmpPressed = bmpNormal; - - if ( bmpHover.Ok() ) - m_bmpHover = bmpHover; - else - m_bmpHover = bmpNormal; - - if ( bmpDisabled.Ok() ) - m_bmpDisabled = bmpDisabled; - else - m_bmpDisabled = bmpNormal; - - RecalcAndRefresh(); -} - -void wxComboCtrlBase::SetCustomPaintWidth( int width ) -{ - if ( m_text ) - { - // move textctrl accordingly - wxRect r = m_text->GetRect(); - int inc = width - m_widthCustomPaint; - r.x += inc; - r.width -= inc; - m_text->SetSize( r ); - } - - m_widthCustomPaint = width; - - RecalcAndRefresh(); -} - -void wxComboCtrlBase::SetTextIndent( int indent ) -{ - if ( indent < 0 ) - { - m_absIndent = GetNativeTextIndent(); - m_iFlags &= ~(wxCC_IFLAG_INDENT_SET); - } - else - { - m_absIndent = indent; - m_iFlags |= wxCC_IFLAG_INDENT_SET; - } - - RecalcAndRefresh(); -} - -wxCoord wxComboCtrlBase::GetNativeTextIndent() const -{ - return DEFAULT_TEXT_INDENT; -} - -// ---------------------------------------------------------------------------- -// methods forwarded to wxTextCtrl -// ---------------------------------------------------------------------------- - -wxString wxComboCtrlBase::GetValue() const -{ - if ( m_text ) - return m_text->GetValue(); - return m_valueString; -} - -void wxComboCtrlBase::SetValueWithEvent(const wxString& value, bool withEvent) -{ - if ( m_text ) - { - if ( !withEvent ) - m_ignoreEvtText++; - - m_text->SetValue(value); - if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) - m_text->SelectAll(); - } - - // Since wxComboPopup may want to paint the combo as well, we need - // to set the string value here (as well as sometimes in ShowPopup). - if ( m_valueString != value ) - { - m_valueString = value; - - EnsurePopupControl(); - - if (m_popupInterface) - m_popupInterface->SetStringValue(value); - } - - Refresh(); -} - -void wxComboCtrlBase::SetValue(const wxString& value) -{ - SetValueWithEvent(value, false); -} - -// In this SetValue variant wxComboPopup::SetStringValue is not called -void wxComboCtrlBase::SetText(const wxString& value) -{ - // Unlike in SetValue(), this must be called here or - // the behaviour will no be consistent in readonlys. - EnsurePopupControl(); - - m_valueString = value; - - if ( m_text ) - { - m_ignoreEvtText++; - m_text->SetValue( value ); - } - - Refresh(); -} - -void wxComboCtrlBase::Copy() -{ - if ( m_text ) - m_text->Copy(); -} - -void wxComboCtrlBase::Cut() -{ - if ( m_text ) - m_text->Cut(); -} - -void wxComboCtrlBase::Paste() -{ - if ( m_text ) - m_text->Paste(); -} - -void wxComboCtrlBase::SetInsertionPoint(long pos) -{ - if ( m_text ) - m_text->SetInsertionPoint(pos); -} - -void wxComboCtrlBase::SetInsertionPointEnd() -{ - if ( m_text ) - m_text->SetInsertionPointEnd(); -} - -long wxComboCtrlBase::GetInsertionPoint() const -{ - if ( m_text ) - return m_text->GetInsertionPoint(); - - return 0; -} - -long wxComboCtrlBase::GetLastPosition() const -{ - if ( m_text ) - return m_text->GetLastPosition(); - - return 0; -} - -void wxComboCtrlBase::Replace(long from, long to, const wxString& value) -{ - if ( m_text ) - m_text->Replace(from, to, value); -} - -void wxComboCtrlBase::Remove(long from, long to) -{ - if ( m_text ) - m_text->Remove(from, to); -} - -void wxComboCtrlBase::SetSelection(long from, long to) -{ - if ( m_text ) - m_text->SetSelection(from, to); -} - -void wxComboCtrlBase::Undo() -{ - if ( m_text ) - m_text->Undo(); -} - -#endif // wxUSE_COMBOCTRL diff --git a/Source/3rdParty/wx/src/common/config.cpp b/Source/3rdParty/wx/src/common/config.cpp deleted file mode 100644 index ce169563f..000000000 --- a/Source/3rdParty/wx/src/common/config.cpp +++ /dev/null @@ -1,490 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/config.cpp -// Purpose: implementation of wxConfigBase class -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.04.98 -// RCS-ID: $Id: config.cpp 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net -// Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif //__BORLANDC__ - -#ifndef wxUSE_CONFIG_NATIVE - #define wxUSE_CONFIG_NATIVE 1 -#endif - -#include "wx/config.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/arrstr.h" - #include "wx/math.h" -#endif //WX_PRECOMP - -#if wxUSE_CONFIG && ((wxUSE_FILE && wxUSE_TEXTFILE) || wxUSE_CONFIG_NATIVE) - -#include "wx/file.h" - -#include -#include -#include // for INT_MAX - -// ---------------------------------------------------------------------------- -// global and class static variables -// ---------------------------------------------------------------------------- - -wxConfigBase *wxConfigBase::ms_pConfig = NULL; -bool wxConfigBase::ms_bAutoCreate = true; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxConfigBase -// ---------------------------------------------------------------------------- - -// Not all args will always be used by derived classes, but including them all -// in each class ensures compatibility. -wxConfigBase::wxConfigBase(const wxString& appName, - const wxString& vendorName, - const wxString& WXUNUSED(localFilename), - const wxString& WXUNUSED(globalFilename), - long style) - : m_appName(appName), m_vendorName(vendorName), m_style(style) -{ - m_bExpandEnvVars = true; - m_bRecordDefaults = false; -} - -wxConfigBase::~wxConfigBase() -{ - // required here for Darwin -} - -wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) -{ - wxConfigBase *pOld = ms_pConfig; - ms_pConfig = pConfig; - return pOld; -} - -wxConfigBase *wxConfigBase::Create() -{ - if ( ms_bAutoCreate && ms_pConfig == NULL ) { - ms_pConfig = - #if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE - new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName()); - #elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE - new wxPrefConfig(wxTheApp->GetAppName()); - #else // either we're under Unix or wish to use files even under Windows - new wxFileConfig(wxTheApp->GetAppName()); - #endif - } - - return ms_pConfig; -} - -// ---------------------------------------------------------------------------- -// wxConfigBase reading entries -// ---------------------------------------------------------------------------- - -// implement both Read() overloads for the given type in terms of DoRead() -#define IMPLEMENT_READ_FOR_TYPE(name, type, deftype, extra) \ - bool wxConfigBase::Read(const wxString& key, type *val) const \ - { \ - wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); \ - \ - if ( !DoRead##name(key, val) ) \ - return false; \ - \ - *val = extra(*val); \ - \ - return true; \ - } \ - \ - bool wxConfigBase::Read(const wxString& key, \ - type *val, \ - deftype defVal) const \ - { \ - wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); \ - \ - bool read = DoRead##name(key, val); \ - if ( !read ) \ - { \ - if ( IsRecordingDefaults() ) \ - { \ - ((wxConfigBase *)this)->DoWrite##name(key, defVal); \ - } \ - \ - *val = defVal; \ - } \ - \ - *val = extra(*val); \ - \ - return read; \ - } - - -IMPLEMENT_READ_FOR_TYPE(String, wxString, const wxString&, ExpandEnvVars) -IMPLEMENT_READ_FOR_TYPE(Long, long, long, long) -IMPLEMENT_READ_FOR_TYPE(Int, int, int, int) -IMPLEMENT_READ_FOR_TYPE(Double, double, double, double) -IMPLEMENT_READ_FOR_TYPE(Bool, bool, bool, bool) - -#undef IMPLEMENT_READ_FOR_TYPE - -// the DoReadXXX() for the other types have implementation in the base class -// but can be overridden in the derived ones -bool wxConfigBase::DoReadInt(const wxString& key, int *pi) const -{ - wxCHECK_MSG( pi, false, _T("wxConfig::Read(): NULL parameter") ); - - long l; - if ( !DoReadLong(key, &l) ) - return false; - - wxASSERT_MSG( l < INT_MAX, _T("overflow in wxConfig::DoReadInt") ); - - *pi = (int)l; - - return true; -} - -bool wxConfigBase::DoReadBool(const wxString& key, bool* val) const -{ - wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); - - long l; - if ( !DoReadLong(key, &l) ) - return false; - - wxASSERT_MSG( l == 0 || l == 1, _T("bad bool value in wxConfig::DoReadInt") ); - - *val = l != 0; - - return true; -} - -bool wxConfigBase::DoReadDouble(const wxString& key, double* val) const -{ - wxString str; - if ( Read(key, &str) ) - { - return str.ToDouble(val); - } - - return false; -} - -// string reading helper -wxString wxConfigBase::ExpandEnvVars(const wxString& str) const -{ - wxString tmp; // Required for BC++ - if (IsExpandingEnvVars()) - tmp = wxExpandEnvVars(str); - else - tmp = str; - return tmp; -} - -// ---------------------------------------------------------------------------- -// wxConfigBase writing -// ---------------------------------------------------------------------------- - -bool wxConfigBase::DoWriteDouble(const wxString& key, double val) -{ - return DoWriteString(key, wxString::Format(_T("%g"), val)); -} - -bool wxConfigBase::DoWriteInt(const wxString& key, int value) -{ - return DoWriteLong(key, (long)value); -} - -bool wxConfigBase::DoWriteBool(const wxString& key, bool value) -{ - return DoWriteLong(key, value ? 1l : 0l); -} - -// ---------------------------------------------------------------------------- -// wxConfigPathChanger -// ---------------------------------------------------------------------------- - -wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, - const wxString& strEntry) -{ - m_bChanged = false; - m_pContainer = (wxConfigBase *)pContainer; - - // the path is everything which precedes the last slash - wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); - - // except in the special case of "/keyname" when there is nothing before "/" - if ( strPath.empty() && - ((!strEntry.empty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) ) - { - strPath = wxCONFIG_PATH_SEPARATOR; - } - - if ( !strPath.empty() ) - { - if ( m_pContainer->GetPath() != strPath ) - { - // we do change the path so restore it later - m_bChanged = true; - - /* JACS: work around a memory bug that causes an assert - when using wxRegConfig, related to reference-counting. - Can be reproduced by removing (const wxChar*) below and - adding the following code to the config sample OnInit under - Windows: - - pConfig->SetPath(wxT("MySettings")); - pConfig->SetPath(wxT("..")); - int value; - pConfig->Read(_T("MainWindowX"), & value); - */ - m_strOldPath = (const wxChar*) m_pContainer->GetPath(); - if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR ) - m_strOldPath += wxCONFIG_PATH_SEPARATOR; - m_pContainer->SetPath(strPath); - } - - // in any case, use the just the name, not full path - m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); - } - else { - // it's a name only, without path - nothing to do - m_strName = strEntry; - } -} - -void wxConfigPathChanger::UpdateIfDeleted() -{ - // we don't have to do anything at all if we didn't change the path - if ( !m_bChanged ) - return; - - // find the deepest still existing parent path of the original path - while ( !m_pContainer->HasGroup(m_strOldPath) ) - { - m_strOldPath = m_strOldPath.BeforeLast(wxCONFIG_PATH_SEPARATOR); - if ( m_strOldPath.empty() ) - m_strOldPath = wxCONFIG_PATH_SEPARATOR; - } -} - -wxConfigPathChanger::~wxConfigPathChanger() -{ - // only restore path if it was changed - if ( m_bChanged ) { - m_pContainer->SetPath(m_strOldPath); - } -} - -// this is a wxConfig method but it's mainly used with wxConfigPathChanger -/* static */ -wxString wxConfigBase::RemoveTrailingSeparator(const wxString& key) -{ - wxString path(key); - - // don't remove the only separator from a root group path! - while ( path.length() > 1 ) - { - if ( *path.rbegin() != wxCONFIG_PATH_SEPARATOR ) - break; - - path.erase(path.end() - 1); - } - - return path; -} - -#endif // wxUSE_CONFIG - -// ---------------------------------------------------------------------------- -// static & global functions -// ---------------------------------------------------------------------------- - -// understands both Unix and Windows (but only under Windows) environment -// variables expansion: i.e. $var, $(var) and ${var} are always understood -// and in addition under Windows %var% is also. - -// don't change the values the enum elements: they must be equal -// to the matching [closing] delimiter. -enum Bracket -{ - Bracket_None, - Bracket_Normal = ')', - Bracket_Curly = '}', -#ifdef __WXMSW__ - Bracket_Windows = '%', // yeah, Windows people are a bit strange ;-) -#endif - Bracket_Max -}; - -wxString wxExpandEnvVars(const wxString& str) -{ - wxString strResult; - strResult.Alloc(str.length()); - - size_t m; - for ( size_t n = 0; n < str.length(); n++ ) { - switch ( str[n] ) { -#ifdef __WXMSW__ - case wxT('%'): -#endif //WINDOWS - case wxT('$'): - { - Bracket bracket; - #ifdef __WXMSW__ - if ( str[n] == wxT('%') ) - bracket = Bracket_Windows; - else - #endif //WINDOWS - if ( n == str.length() - 1 ) { - bracket = Bracket_None; - } - else { - switch ( str[n + 1] ) { - case wxT('('): - bracket = Bracket_Normal; - n++; // skip the bracket - break; - - case wxT('{'): - bracket = Bracket_Curly; - n++; // skip the bracket - break; - - default: - bracket = Bracket_None; - } - } - - m = n + 1; - - while ( m < str.length() && (wxIsalnum(str[m]) || str[m] == wxT('_')) ) - m++; - - wxString strVarName(str.c_str() + n + 1, m - n - 1); - -#ifdef __WXWINCE__ - const wxChar *pszValue = NULL; -#else - // NB: use wxGetEnv instead of wxGetenv as otherwise variables - // set through wxSetEnv may not be read correctly! - const wxChar *pszValue = NULL; - wxString tmp; - if (wxGetEnv(strVarName, &tmp)) - pszValue = tmp; -#endif - if ( pszValue != NULL ) { - strResult += pszValue; - } - else { - // variable doesn't exist => don't change anything - #ifdef __WXMSW__ - if ( bracket != Bracket_Windows ) - #endif - if ( bracket != Bracket_None ) - strResult << str[n - 1]; - strResult << str[n] << strVarName; - } - - // check the closing bracket - if ( bracket != Bracket_None ) { - if ( m == str.length() || str[m] != (wxChar)bracket ) { - // under MSW it's common to have '%' characters in the registry - // and it's annoying to have warnings about them each time, so - // ignroe them silently if they are not used for env vars - // - // under Unix, OTOH, this warning could be useful for the user to - // understand why isn't the variable expanded as intended - #ifndef __WXMSW__ - wxLogWarning(_("Environment variables expansion failed: missing '%c' at position %u in '%s'."), - (char)bracket, (unsigned int) (m + 1), str.c_str()); - #endif // __WXMSW__ - } - else { - // skip closing bracket unless the variables wasn't expanded - if ( pszValue == NULL ) - strResult << (wxChar)bracket; - m++; - } - } - - n = m - 1; // skip variable name - } - break; - - case '\\': - // backslash can be used to suppress special meaning of % and $ - if ( n != str.length() - 1 && - (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) { - strResult += str[++n]; - - break; - } - //else: fall through - - default: - strResult += str[n]; - } - } - - return strResult; -} - -// this function is used to properly interpret '..' in path -void wxSplitPath(wxArrayString& aParts, const wxChar *sz) -{ - aParts.clear(); - - wxString strCurrent; - const wxChar *pc = sz; - for ( ;; ) { - if ( *pc == wxT('\0') || *pc == wxCONFIG_PATH_SEPARATOR ) { - if ( strCurrent == wxT(".") ) { - // ignore - } - else if ( strCurrent == wxT("..") ) { - // go up one level - if ( aParts.size() == 0 ) - wxLogWarning(_("'%s' has extra '..', ignored."), sz); - else - aParts.erase(aParts.end() - 1); - - strCurrent.Empty(); - } - else if ( !strCurrent.empty() ) { - aParts.push_back(strCurrent); - strCurrent.Empty(); - } - //else: - // could log an error here, but we prefer to ignore extra '/' - - if ( *pc == wxT('\0') ) - break; - } - else - strCurrent += *pc; - - pc++; - } -} diff --git a/Source/3rdParty/wx/src/common/containr.cpp b/Source/3rdParty/wx/src/common/containr.cpp deleted file mode 100644 index ffa9ce975..000000000 --- a/Source/3rdParty/wx/src/common/containr.cpp +++ /dev/null @@ -1,678 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/containr.cpp -// Purpose: implementation of wxControlContainer -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.01 -// RCS-ID: $Id: containr.cpp 44273 2007-01-21 01:21:45Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/event.h" - #include "wx/window.h" - #include "wx/scrolbar.h" - #include "wx/radiobut.h" - #include "wx/containr.h" -#endif //WX_PRECOMP - -// trace mask for focus messages -#define TRACE_FOCUS _T("focus") - -// ============================================================================ -// implementation -// ============================================================================ - -wxControlContainer::wxControlContainer(wxWindow *winParent) -{ - m_winParent = winParent; - m_winLastFocused = NULL; - m_inSetFocus = false; -} - -bool wxControlContainer::AcceptsFocus() const -{ - // if we're not shown or disabled, we can't accept focus - if ( m_winParent->IsShown() && m_winParent->IsEnabled() ) - { - // otherwise we can accept focus either if we have no children at all - // (in this case we're probably not used as a container) or only when - // at least one child will accept focus - wxWindowList::compatibility_iterator node = m_winParent->GetChildren().GetFirst(); - if ( !node ) - return true; - -#ifdef __WXMAC__ - // wxMac has eventually the two scrollbars as children, they don't count - // as real children in the algorithm mentioned above - bool hasRealChildren = false ; -#endif - - while ( node ) - { - wxWindow *child = node->GetData(); - node = node->GetNext(); - -#ifdef __WXMAC__ - if ( m_winParent->MacIsWindowScrollbar( child ) ) - continue; - hasRealChildren = true ; -#endif - if ( child->AcceptsFocus() ) - { - return true; - } - } - -#ifdef __WXMAC__ - if ( !hasRealChildren ) - return true ; -#endif - } - - return false; -} - -void wxControlContainer::SetLastFocus(wxWindow *win) -{ - // the panel itself should never get the focus at all but if it does happen - // temporarily (as it seems to do under wxGTK), at the very least don't - // forget our previous m_winLastFocused - if ( win != m_winParent ) - { - // if we're setting the focus - if ( win ) - { - // find the last _immediate_ child which got focus - wxWindow *winParent = win; - while ( winParent != m_winParent ) - { - win = winParent; - winParent = win->GetParent(); - - // Yes, this can happen, though in a totally pathological case. - // like when detaching a menubar from a frame with a child - // which has pushed itself as an event handler for the menubar. - // (under wxGTK) - - wxASSERT_MSG( winParent, - _T("Setting last focus for a window that is not our child?") ); - } - } - - m_winLastFocused = win; - - if ( win ) - { - wxLogTrace(TRACE_FOCUS, _T("Set last focus to %s(%s)"), - win->GetClassInfo()->GetClassName(), - win->GetLabel().c_str()); - } - else - { - wxLogTrace(TRACE_FOCUS, _T("No more last focus")); - } - } - - // propagate the last focus upwards so that our parent can set focus back - // to us if it loses it now and regains later - wxWindow *parent = m_winParent->GetParent(); - if ( parent ) - { - wxChildFocusEvent eventFocus(m_winParent); - parent->GetEventHandler()->ProcessEvent(eventFocus); - } -} - -// -------------------------------------------------------------------- -// The following four functions are used to find other radio buttons -// within the same group. Used by wxSetFocusToChild on wxMSW -// -------------------------------------------------------------------- - -#ifdef __WXMSW__ - -wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn) -{ - if ( btn->HasFlag(wxRB_GROUP) || btn->HasFlag(wxRB_SINGLE) ) - return NULL; - - const wxWindowList& siblings = btn->GetParent()->GetChildren(); - wxWindowList::compatibility_iterator nodeThis = siblings.Find(btn); - wxCHECK_MSG( nodeThis, NULL, _T("radio button not a child of its parent?") ); - - // Iterate over all previous siblings until we find the next radio button - wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious(); - wxRadioButton *prevBtn = 0; - while (nodeBefore) - { - prevBtn = wxDynamicCast(nodeBefore->GetData(), wxRadioButton); - if (prevBtn) - break; - - nodeBefore = nodeBefore->GetPrevious(); - } - - if (!prevBtn || prevBtn->HasFlag(wxRB_SINGLE)) - { - // no more buttons in group - return NULL; - } - - return prevBtn; -} - -wxRadioButton* wxGetNextButtonInGroup(wxRadioButton *btn) -{ - if (btn->HasFlag(wxRB_SINGLE)) - return NULL; - - const wxWindowList& siblings = btn->GetParent()->GetChildren(); - wxWindowList::compatibility_iterator nodeThis = siblings.Find(btn); - wxCHECK_MSG( nodeThis, NULL, _T("radio button not a child of its parent?") ); - - // Iterate over all previous siblings until we find the next radio button - wxWindowList::compatibility_iterator nodeNext = nodeThis->GetNext(); - wxRadioButton *nextBtn = 0; - while (nodeNext) - { - nextBtn = wxDynamicCast(nodeNext->GetData(), wxRadioButton); - if (nextBtn) - break; - - nodeNext = nodeNext->GetNext(); - } - - if ( !nextBtn || nextBtn->HasFlag(wxRB_GROUP) || nextBtn->HasFlag(wxRB_SINGLE) ) - { - // no more buttons or the first button of the next group - return NULL; - } - - return nextBtn; -} - -wxRadioButton* wxGetFirstButtonInGroup(wxRadioButton *btn) -{ - while (true) - { - wxRadioButton* prevBtn = wxGetPreviousButtonInGroup(btn); - if (!prevBtn) - return btn; - - btn = prevBtn; - } -} - -wxRadioButton* wxGetLastButtonInGroup(wxRadioButton *btn) -{ - while (true) - { - wxRadioButton* nextBtn = wxGetNextButtonInGroup(btn); - if (!nextBtn) - return btn; - - btn = nextBtn; - } -} - -wxRadioButton* wxGetSelectedButtonInGroup(wxRadioButton *btn) -{ - // Find currently selected button - if (btn->GetValue()) - return btn; - - if (btn->HasFlag(wxRB_SINGLE)) - return NULL; - - wxRadioButton *selBtn; - - // First check all previous buttons - for (selBtn = wxGetPreviousButtonInGroup(btn); selBtn; selBtn = wxGetPreviousButtonInGroup(selBtn)) - if (selBtn->GetValue()) - return selBtn; - - // Now all following buttons - for (selBtn = wxGetNextButtonInGroup(btn); selBtn; selBtn = wxGetNextButtonInGroup(selBtn)) - if (selBtn->GetValue()) - return selBtn; - - return NULL; -} - -#endif // __WXMSW__ - -// ---------------------------------------------------------------------------- -// Keyboard handling - this is the place where the TAB traversal logic is -// implemented. As this code is common to all ports, this ensures consistent -// behaviour even if we don't specify how exactly the wxNavigationKeyEvent are -// generated and this is done in platform specific code which also ensures that -// we can follow the given platform standards. -// ---------------------------------------------------------------------------- - -void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) -{ - wxWindow *parent = m_winParent->GetParent(); - - // the event is propagated downwards if the event emitter was our parent - bool goingDown = event.GetEventObject() == parent; - - const wxWindowList& children = m_winParent->GetChildren(); - - // if we have exactly one notebook-like child window (actually it could be - // any window that returns true from its HasMultiplePages()), then - // [Shift-]Ctrl-Tab and Ctrl-PageUp/Down keys should iterate over its pages - // even if the focus is outside of the control because this is how the - // standard MSW properties dialogs behave and we do it under other platforms - // as well because it seems like a good idea -- but we can always put this - // block inside "#ifdef __WXMSW__" if it's not suitable there - if ( event.IsWindowChange() && !goingDown ) - { - // check if we have a unique notebook-like child - wxWindow *bookctrl = NULL; - for ( wxWindowList::const_iterator i = children.begin(), - end = children.end(); - i != end; - ++i ) - { - wxWindow * const window = *i; - if ( window->HasMultiplePages() ) - { - if ( bookctrl ) - { - // this is the second book-like control already so don't do - // anything as we don't know which one should have its page - // changed - bookctrl = NULL; - break; - } - - bookctrl = window; - } - } - - if ( bookctrl ) - { - // make sure that we don't bubble up the event again from the book - // control resulting in infinite recursion - wxNavigationKeyEvent eventCopy(event); - eventCopy.SetEventObject(m_winParent); - if ( bookctrl->GetEventHandler()->ProcessEvent(eventCopy) ) - return; - } - } - - // there is not much to do if we don't have children and we're not - // interested in "notebook page change" events here - if ( !children.GetCount() || event.IsWindowChange() ) - { - // let the parent process it unless it already comes from our parent - // of we don't have any - if ( goingDown || - !parent || !parent->GetEventHandler()->ProcessEvent(event) ) - { - event.Skip(); - } - - return; - } - - // where are we going? - const bool forward = event.GetDirection(); - - // the node of the children list from which we should start looking for the - // next acceptable child - wxWindowList::compatibility_iterator node, start_node; - - // we should start from the first/last control and not from the one which - // had focus the last time if we're propagating the event downwards because - // for our parent we look like a single control - if ( goingDown ) - { - // just to be sure it's not used (normally this is not necessary, but - // doesn't hurt neither) - m_winLastFocused = (wxWindow *)NULL; - - // start from first or last depending on where we're going - node = forward ? children.GetFirst() : children.GetLast(); - } - else // going up - { - // try to find the child which has the focus currently - - // the event emitter might have done this for us - wxWindow *winFocus = event.GetCurrentFocus(); - - // but if not, we might know where the focus was ourselves - if (!winFocus) - winFocus = m_winLastFocused; - - // if still no luck, do it the hard way - if (!winFocus) - winFocus = wxWindow::FindFocus(); - - if ( winFocus ) - { -#ifdef __WXMSW__ - // If we are in a radio button group, start from the first item in the - // group - if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) ) - winFocus = wxGetFirstButtonInGroup((wxRadioButton*)winFocus); -#endif - // ok, we found the focus - now is it our child? - start_node = children.Find( winFocus ); - } - - if ( !start_node && m_winLastFocused ) - { - // window which has focus isn't our child, fall back to the one - // which had the focus the last time - start_node = children.Find( m_winLastFocused ); - } - - // if we still didn't find anything, we should start with the first one - if ( !start_node ) - { - start_node = children.GetFirst(); - } - - // and the first child which we can try setting focus to is the next or - // the previous one - node = forward ? start_node->GetNext() : start_node->GetPrevious(); - } - - // we want to cycle over all elements passing by NULL - for ( ;; ) - { - // don't go into infinite loop - if ( start_node && node && node == start_node ) - break; - - // Have we come to the last or first item on the panel? - if ( !node ) - { - if ( !start_node ) - { - // exit now as otherwise we'd loop forever - break; - } - - if ( !goingDown ) - { - // Check if our (maybe grand) parent is another panel: if this - // is the case, they will know what to do with this navigation - // key and so give them the chance to process it instead of - // looping inside this panel (normally, the focus will go to - // the next/previous item after this panel in the parent - // panel). - wxWindow *focussed_child_of_parent = m_winParent; - while ( parent ) - { - // we don't want to tab into a different dialog or frame - if ( focussed_child_of_parent->IsTopLevel() ) - break; - - event.SetCurrentFocus( focussed_child_of_parent ); - if ( parent->GetEventHandler()->ProcessEvent( event ) ) - return; - - focussed_child_of_parent = parent; - - parent = parent->GetParent(); - } - } - //else: as the focus came from our parent, we definitely don't want - // to send it back to it! - - // no, we are not inside another panel so process this ourself - node = forward ? children.GetFirst() : children.GetLast(); - - continue; - } - - wxWindow *child = node->GetData(); - -#ifdef __WXMSW__ - if ( event.IsFromTab() ) - { - if ( wxIsKindOf(child, wxRadioButton) ) - { - // only radio buttons with either wxRB_GROUP or wxRB_SINGLE - // can be tabbed to - if ( child->HasFlag(wxRB_GROUP) ) - { - // need to tab into the active button within a group - wxRadioButton *rb = wxGetSelectedButtonInGroup((wxRadioButton*)child); - if ( rb ) - child = rb; - } - else if ( !child->HasFlag(wxRB_SINGLE) ) - { - node = forward ? node->GetNext() : node->GetPrevious(); - continue; - } - } - } - else if ( m_winLastFocused && - wxIsKindOf(m_winLastFocused, wxRadioButton) && - !m_winLastFocused->HasFlag(wxRB_SINGLE) ) - { - // cursor keys don't navigate out of a radio button group so - // find the correct radio button to focus - if ( forward ) - { - child = wxGetNextButtonInGroup((wxRadioButton*)m_winLastFocused); - if ( !child ) - { - // no next button in group, set it to the first button - child = wxGetFirstButtonInGroup((wxRadioButton*)m_winLastFocused); - } - } - else - { - child = wxGetPreviousButtonInGroup((wxRadioButton*)m_winLastFocused); - if ( !child ) - { - // no previous button in group, set it to the last button - child = wxGetLastButtonInGroup((wxRadioButton*)m_winLastFocused); - } - } - - if ( child == m_winLastFocused ) - { - // must be a group consisting of only one button therefore - // no need to send a navigation event - event.Skip(false); - return; - } - } -#endif // __WXMSW__ - - if ( child->AcceptsFocusFromKeyboard() ) - { - // if we're setting the focus to a child panel we should prevent it - // from giving it to the child which had the focus the last time - // and instead give it to the first/last child depending from which - // direction we're coming - event.SetEventObject(m_winParent); - - // disable propagation for this call as otherwise the event might - // bounce back to us. - wxPropagationDisabler disableProp(event); - if ( !child->GetEventHandler()->ProcessEvent(event) ) - { - // set it first in case SetFocusFromKbd() results in focus - // change too - m_winLastFocused = child; - - // everything is simple: just give focus to it - child->SetFocusFromKbd(); - } - //else: the child manages its focus itself - - event.Skip( false ); - - return; - } - - node = forward ? node->GetNext() : node->GetPrevious(); - } - - // we cycled through all of our children and none of them wanted to accept - // focus - event.Skip(); -} - -void wxControlContainer::HandleOnWindowDestroy(wxWindowBase *child) -{ - if ( child == m_winLastFocused ) - m_winLastFocused = NULL; -} - -// ---------------------------------------------------------------------------- -// focus handling -// ---------------------------------------------------------------------------- - -bool wxControlContainer::DoSetFocus() -{ - wxLogTrace(TRACE_FOCUS, _T("SetFocus on wxPanel 0x%p."), - m_winParent->GetHandle()); - - if (m_inSetFocus) - return true; - - // when the panel gets the focus we move the focus to either the last - // window that had the focus or the first one that can get it unless the - // focus had been already set to some other child - - wxWindow *win = wxWindow::FindFocus(); - while ( win ) - { - if ( win == m_winParent ) - { - // our child already has focus, don't take it away from it - return true; - } - - if ( win->IsTopLevel() ) - { - // don't look beyond the first top level parent - useless and - // unnecessary - break; - } - - win = win->GetParent(); - } - - // protect against infinite recursion: - m_inSetFocus = true; - - bool ret = SetFocusToChild(); - - m_inSetFocus = false; - - return ret; -} - -void wxControlContainer::HandleOnFocus(wxFocusEvent& event) -{ - wxLogTrace(TRACE_FOCUS, _T("OnFocus on wxPanel 0x%p, name: %s"), - m_winParent->GetHandle(), - m_winParent->GetName().c_str() ); - - DoSetFocus(); - - event.Skip(); -} - -bool wxControlContainer::SetFocusToChild() -{ - return wxSetFocusToChild(m_winParent, &m_winLastFocused); -} - -// ---------------------------------------------------------------------------- -// SetFocusToChild(): this function is used by wxPanel but also by wxFrame in -// wxMSW, this is why it is outside of wxControlContainer class -// ---------------------------------------------------------------------------- - -bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) -{ - wxCHECK_MSG( win, false, _T("wxSetFocusToChild(): invalid window") ); - wxCHECK_MSG( childLastFocused, false, - _T("wxSetFocusToChild(): NULL child poonter") ); - - if ( *childLastFocused ) - { - // It might happen that the window got reparented - if ( (*childLastFocused)->GetParent() == win ) - { - wxLogTrace(TRACE_FOCUS, - _T("SetFocusToChild() => last child (0x%p)."), - (*childLastFocused)->GetHandle()); - - // not SetFocusFromKbd(): we're restoring focus back to the old - // window and not setting it as the result of a kbd action - (*childLastFocused)->SetFocus(); - return true; - } - else - { - // it doesn't count as such any more - *childLastFocused = (wxWindow *)NULL; - } - } - - // set the focus to the first child who wants it - wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - while ( node ) - { - wxWindow *child = node->GetData(); - node = node->GetNext(); - -#ifdef __WXMAC__ - if ( child->GetParent()->MacIsWindowScrollbar( child ) ) - continue; -#endif - - if ( child->AcceptsFocusFromKeyboard() && !child->IsTopLevel() ) - { -#ifdef __WXMSW__ - // If a radiobutton is the first focusable child, search for the - // selected radiobutton in the same group - wxRadioButton* btn = wxDynamicCast(child, wxRadioButton); - if (btn) - { - wxRadioButton* selected = wxGetSelectedButtonInGroup(btn); - if (selected) - child = selected; - } -#endif - - wxLogTrace(TRACE_FOCUS, - _T("SetFocusToChild() => first child (0x%p)."), - child->GetHandle()); - - *childLastFocused = child; - child->SetFocusFromKbd(); - return true; - } - } - - return false; -} diff --git a/Source/3rdParty/wx/src/common/convauto.cpp b/Source/3rdParty/wx/src/common/convauto.cpp deleted file mode 100644 index 3205b7bea..000000000 --- a/Source/3rdParty/wx/src/common/convauto.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/convauto.cpp -// Purpose: implementation of wxConvAuto -// Author: Vadim Zeitlin -// Created: 2006-04-04 -// RCS-ID: $Id: convauto.cpp 38570 2006-04-05 14:37:47Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_WCHAR_T - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/convauto.h" - -// ============================================================================ -// implementation -// ============================================================================ - -/* static */ -wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) -{ - if ( srcLen < 2 ) - { - // minimal BOM is 2 bytes so bail out immediately and simplify the code - // below which wouldn't need to check for length for UTF-16 cases - return BOM_None; - } - - // examine the buffer for BOM presence - // - // see http://www.unicode.org/faq/utf_bom.html#BOM - switch ( *src++ ) - { - case '\0': - // could only be big endian UTF-32 (00 00 FE FF) - if ( srcLen >= 4 && - src[0] == '\0' && - src[1] == '\xfe' && - src[2] == '\xff' ) - { - return BOM_UTF32BE; - } - break; - - case '\xfe': - // could only be big endian UTF-16 (FE FF) - if ( *src++ == '\xff' ) - { - return BOM_UTF16BE; - } - break; - - case '\xff': - // could be either little endian UTF-16 or UTF-32, both start - // with FF FE - if ( *src++ == '\xfe' ) - { - return srcLen >= 4 && src[0] == '\0' && src[1] == '\0' - ? BOM_UTF32LE - : BOM_UTF16LE; - } - break; - - case '\xef': - // is this UTF-8 BOM (EF BB BF)? - if ( srcLen >= 3 && src[0] == '\xbb' && src[1] == '\xbf' ) - { - return BOM_UTF8; - } - break; - } - - return BOM_None; -} - -void wxConvAuto::InitFromBOM(BOMType bomType) -{ - m_consumedBOM = false; - - switch ( bomType ) - { - case BOM_UTF32BE: - m_conv = new wxMBConvUTF32BE; - m_ownsConv = true; - break; - - case BOM_UTF32LE: - m_conv = new wxMBConvUTF32LE; - m_ownsConv = true; - break; - - case BOM_UTF16BE: - m_conv = new wxMBConvUTF16BE; - m_ownsConv = true; - break; - - case BOM_UTF16LE: - m_conv = new wxMBConvUTF16LE; - m_ownsConv = true; - break; - - case BOM_UTF8: - m_conv = &wxConvUTF8; - m_ownsConv = false; - break; - - default: - wxFAIL_MSG( _T("unexpected BOM type") ); - // fall through: still need to create something - - case BOM_None: - InitWithDefault(); - m_consumedBOM = true; // as there is nothing to consume - } -} - -void wxConvAuto::SkipBOM(const char **src, size_t *len) const -{ - int ofs; - switch ( m_bomType ) - { - case BOM_UTF32BE: - case BOM_UTF32LE: - ofs = 4; - break; - - case BOM_UTF16BE: - case BOM_UTF16LE: - ofs = 2; - break; - - case BOM_UTF8: - ofs = 3; - break; - - default: - wxFAIL_MSG( _T("unexpected BOM type") ); - // fall through: still need to create something - - case BOM_None: - ofs = 0; - } - - *src += ofs; - if ( *len != (size_t)-1 ) - *len -= ofs; -} - -void wxConvAuto::InitFromInput(const char **src, size_t *len) -{ - m_bomType = DetectBOM(*src, *len); - InitFromBOM(m_bomType); - SkipBOM(src, len); -} - -size_t -wxConvAuto::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - // we check BOM and create the appropriate conversion the first time we're - // called but we also need to ensure that the BOM is skipped not only - // during this initial call but also during the first call with non-NULL - // dst as typically we're first called with NULL dst to calculate the - // needed buffer size - wxConvAuto *self = wx_const_cast(wxConvAuto *, this); - if ( !m_conv ) - { - self->InitFromInput(&src, &srcLen); - if ( dst ) - self->m_consumedBOM = true; - } - - if ( !m_consumedBOM && dst ) - { - self->m_consumedBOM = true; - SkipBOM(&src, &srcLen); - } - - return m_conv->ToWChar(dst, dstLen, src, srcLen); -} - -size_t -wxConvAuto::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( !m_conv ) - { - // default to UTF-8 for the multibyte output - wx_const_cast(wxConvAuto *, this)->InitWithDefault(); - } - - return m_conv->FromWChar(dst, dstLen, src, srcLen); -} - -#endif // wxUSE_WCHAR_T - diff --git a/Source/3rdParty/wx/src/common/cshelp.cpp b/Source/3rdParty/wx/src/common/cshelp.cpp deleted file mode 100644 index 6bd3d5cc0..000000000 --- a/Source/3rdParty/wx/src/common/cshelp.cpp +++ /dev/null @@ -1,512 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/cshelp.cpp -// Purpose: Context sensitive help class implementation -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 08/09/2000 -// RCS-ID: $Id: cshelp.cpp 52329 2008-03-05 13:20:26Z VZ $ -// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_HELP - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/module.h" -#endif - -#include "wx/tipwin.h" -#include "wx/cshelp.h" - -#if wxUSE_MS_HTML_HELP - #include "wx/msw/helpchm.h" // for ShowContextHelpPopup - #include "wx/utils.h" // for wxGetMousePosition() -#endif - -// ---------------------------------------------------------------------------- -// wxContextHelpEvtHandler private class -// ---------------------------------------------------------------------------- - -// This class exists in order to eat events until the left mouse button is -// pressed -class wxContextHelpEvtHandler: public wxEvtHandler -{ -public: - wxContextHelpEvtHandler(wxContextHelp* contextHelp) - { - m_contextHelp = contextHelp; - } - - virtual bool ProcessEvent(wxEvent& event); - -//// Data - wxContextHelp* m_contextHelp; - - DECLARE_NO_COPY_CLASS(wxContextHelpEvtHandler) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxContextHelp -// ---------------------------------------------------------------------------- - -/* - * Invokes context-sensitive help - */ - - -IMPLEMENT_DYNAMIC_CLASS(wxContextHelp, wxObject) - -wxContextHelp::wxContextHelp(wxWindow* win, bool beginHelp) -{ - m_inHelp = false; - - if (beginHelp) - BeginContextHelp(win); -} - -wxContextHelp::~wxContextHelp() -{ - if (m_inHelp) - EndContextHelp(); -} - -// Not currently needed, but on some systems capture may not work as -// expected so we'll leave it here for now. -#ifdef __WXMOTIF__ -static void wxPushOrPopEventHandlers(wxContextHelp* help, wxWindow* win, bool push) -{ - if (push) - win->PushEventHandler(new wxContextHelpEvtHandler(help)); - else - win->PopEventHandler(true); - - wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - while (node) - { - wxWindow* child = node->GetData(); - wxPushOrPopEventHandlers(help, child, push); - - node = node->GetNext(); - } -} -#endif - -// Begin 'context help mode' -bool wxContextHelp::BeginContextHelp(wxWindow* win) -{ - if (!win) - win = wxTheApp->GetTopWindow(); - if (!win) - return false; - - wxCursor cursor(wxCURSOR_QUESTION_ARROW); - wxCursor oldCursor = win->GetCursor(); - win->SetCursor(cursor); - -#ifdef __WXMAC__ - wxSetCursor(cursor); -#endif - - m_status = false; - -#ifdef __WXMOTIF__ - wxPushOrPopEventHandlers(this, win, true); -#else - win->PushEventHandler(new wxContextHelpEvtHandler(this)); -#endif - - win->CaptureMouse(); - - EventLoop(); - - win->ReleaseMouse(); - -#ifdef __WXMOTIF__ - wxPushOrPopEventHandlers(this, win, false); -#else - win->PopEventHandler(true); -#endif - - win->SetCursor(oldCursor); - -#ifdef __WXMAC__ - wxSetCursor(wxNullCursor); -#endif - - if (m_status) - { - wxPoint pt; - wxWindow* winAtPtr = wxFindWindowAtPointer(pt); - -#if 0 - if (winAtPtr) - { - printf("Picked %s (%d)\n", winAtPtr->GetName().c_str(), - winAtPtr->GetId()); - } -#endif - - if (winAtPtr) - DispatchEvent(winAtPtr, pt); - } - - return true; -} - -bool wxContextHelp::EndContextHelp() -{ - m_inHelp = false; - - return true; -} - -bool wxContextHelp::EventLoop() -{ - m_inHelp = true; - - while ( m_inHelp ) - { - if (wxTheApp->Pending()) - { - wxTheApp->Dispatch(); - } - else - { - wxTheApp->ProcessIdle(); - } - } - - return true; -} - -bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event) -{ - if (event.GetEventType() == wxEVT_LEFT_DOWN) - { - m_contextHelp->SetStatus(true); - m_contextHelp->EndContextHelp(); - return true; - } - - if ((event.GetEventType() == wxEVT_CHAR) || - (event.GetEventType() == wxEVT_KEY_DOWN) || - (event.GetEventType() == wxEVT_ACTIVATE) || - (event.GetEventType() == wxEVT_MOUSE_CAPTURE_CHANGED)) - { - // May have already been set to true by a left-click - //m_contextHelp->SetStatus(false); - m_contextHelp->EndContextHelp(); - return true; - } - - if ((event.GetEventType() == wxEVT_PAINT) || - (event.GetEventType() == wxEVT_ERASE_BACKGROUND)) - { - event.Skip(); - return false; - } - - return true; -} - -// Dispatch the help event to the relevant window -bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) -{ - wxCHECK_MSG( win, false, _T("win parameter can't be NULL") ); - - wxHelpEvent helpEvent(wxEVT_HELP, win->GetId(), pt, - wxHelpEvent::Origin_HelpButton); - helpEvent.SetEventObject(win); - - return win->GetEventHandler()->ProcessEvent(helpEvent); -} - -// ---------------------------------------------------------------------------- -// wxContextHelpButton -// ---------------------------------------------------------------------------- - -/* - * wxContextHelpButton - * You can add this to your dialogs (especially on non-Windows platforms) - * to put the application into context help mode. - */ - -#ifndef __WXPM__ - -static const char * csquery_xpm[] = { -"12 11 2 1", -" c None", -". c #000000", -" ", -" .... ", -" .. .. ", -" .. .. ", -" .. ", -" .. ", -" .. ", -" ", -" .. ", -" .. ", -" "}; - -#endif - -IMPLEMENT_CLASS(wxContextHelpButton, wxBitmapButton) - -BEGIN_EVENT_TABLE(wxContextHelpButton, wxBitmapButton) - EVT_BUTTON(wxID_CONTEXT_HELP, wxContextHelpButton::OnContextHelp) -END_EVENT_TABLE() - -wxContextHelpButton::wxContextHelpButton(wxWindow* parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style) -#if defined(__WXPM__) - : wxBitmapButton(parent, id, wxBitmap(wxCSQUERY_BITMAP - ,wxBITMAP_TYPE_RESOURCE - ), - pos, size, style) -#else - : wxBitmapButton(parent, id, wxBitmap(csquery_xpm), - pos, size, style) -#endif -{ -} - -void wxContextHelpButton::OnContextHelp(wxCommandEvent& WXUNUSED(event)) -{ - wxContextHelp contextHelp(GetParent()); -} - -// ---------------------------------------------------------------------------- -// wxHelpProvider -// ---------------------------------------------------------------------------- - -wxHelpProvider *wxHelpProvider::ms_helpProvider = (wxHelpProvider *)NULL; - -// trivial implementation of some methods which we don't want to make pure -// virtual for convenience - -void wxHelpProvider::AddHelp(wxWindowBase * WXUNUSED(window), - const wxString& WXUNUSED(text)) -{ -} - -void wxHelpProvider::AddHelp(wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(text)) -{ -} - -// removes the association -void wxHelpProvider::RemoveHelp(wxWindowBase* WXUNUSED(window)) -{ -} - -wxHelpProvider::~wxHelpProvider() -{ -} - -wxString wxHelpProvider::GetHelpTextMaybeAtPoint(wxWindowBase *window) -{ - if ( m_helptextAtPoint != wxDefaultPosition || - m_helptextOrigin != wxHelpEvent::Origin_Unknown ) - { - wxCHECK_MSG( window, wxEmptyString, _T("window must not be NULL") ); - - wxPoint pt = m_helptextAtPoint; - wxHelpEvent::Origin origin = m_helptextOrigin; - - m_helptextAtPoint = wxDefaultPosition; - m_helptextOrigin = wxHelpEvent::Origin_Unknown; - - return window->GetHelpTextAtPoint(pt, origin); - } - - return GetHelp(window); -} - -// ---------------------------------------------------------------------------- -// wxSimpleHelpProvider -// ---------------------------------------------------------------------------- - -#define WINHASH_KEY(w) wxPtrToUInt(w) - -wxString wxSimpleHelpProvider::GetHelp(const wxWindowBase *window) -{ - wxSimpleHelpProviderHashMap::iterator it = m_hashWindows.find(WINHASH_KEY(window)); - - if ( it == m_hashWindows.end() ) - { - it = m_hashIds.find(window->GetId()); - if ( it == m_hashIds.end() ) - return wxEmptyString; - } - - return it->second; -} - -void wxSimpleHelpProvider::AddHelp(wxWindowBase *window, const wxString& text) -{ - m_hashWindows.erase(WINHASH_KEY(window)); - m_hashWindows[WINHASH_KEY(window)] = text; -} - -void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text) -{ - wxSimpleHelpProviderHashMap::key_type key = (wxSimpleHelpProviderHashMap::key_type)id; - m_hashIds.erase(key); - m_hashIds[key] = text; -} - -// removes the association -void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window) -{ - m_hashWindows.erase(WINHASH_KEY(window)); -} - -bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window) -{ -#if wxUSE_MS_HTML_HELP || wxUSE_TIPWINDOW -#if wxUSE_MS_HTML_HELP - // m_helptextAtPoint will be reset by GetHelpTextMaybeAtPoint(), stash it - const wxPoint posTooltip = m_helptextAtPoint; -#endif // wxUSE_MS_HTML_HELP - - const wxString text = GetHelpTextMaybeAtPoint(window); - - if ( !text.empty() ) - { - // use the native help popup style if it's available -#if wxUSE_MS_HTML_HELP - if ( !wxCHMHelpController::ShowContextHelpPopup - ( - text, - posTooltip, - (wxWindow *)window - ) ) -#endif // wxUSE_MS_HTML_HELP - { -#if wxUSE_TIPWINDOW - static wxTipWindow* s_tipWindow = NULL; - - if ( s_tipWindow ) - { - // Prevent s_tipWindow being nulled in OnIdle, thereby removing - // the chance for the window to be closed by ShowHelp - s_tipWindow->SetTipWindowPtr(NULL); - s_tipWindow->Close(); - } - - s_tipWindow = new wxTipWindow((wxWindow *)window, text, - 100, &s_tipWindow); -#else // !wxUSE_TIPWINDOW - // we tried wxCHMHelpController but it failed and we don't have - // wxTipWindow to fall back on, so - return false; -#endif // wxUSE_TIPWINDOW - } - - return true; - } -#else // !wxUSE_MS_HTML_HELP && !wxUSE_TIPWINDOW - wxUnusedVar(window); -#endif // wxUSE_MS_HTML_HELP || wxUSE_TIPWINDOW - - return false; -} - -// ---------------------------------------------------------------------------- -// wxHelpControllerHelpProvider -// ---------------------------------------------------------------------------- - -wxHelpControllerHelpProvider::wxHelpControllerHelpProvider(wxHelpControllerBase* hc) -{ - m_helpController = hc; -} - -bool wxHelpControllerHelpProvider::ShowHelp(wxWindowBase *window) -{ - const wxString text = GetHelpTextMaybeAtPoint(window); - - if ( text.empty() ) - return false; - - if ( m_helpController ) - { - // if it's a numeric topic, show it - long topic; - if ( text.ToLong(&topic) ) - return m_helpController->DisplayContextPopup(topic); - - // otherwise show the text directly - if ( m_helpController->DisplayTextPopup(text, wxGetMousePosition()) ) - return true; - } - - // if there is no help controller or it's not capable of showing the help, - // fallback to the default method - return wxSimpleHelpProvider::ShowHelp(window); -} - -// Convenience function for turning context id into wxString -wxString wxContextId(int id) -{ - return wxString::Format(_T("%d"), id); -} - -// ---------------------------------------------------------------------------- -// wxHelpProviderModule: module responsible for cleaning up help provider. -// ---------------------------------------------------------------------------- - -class wxHelpProviderModule : public wxModule -{ -public: - bool OnInit(); - void OnExit(); - -private: - DECLARE_DYNAMIC_CLASS(wxHelpProviderModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxHelpProviderModule, wxModule) - -bool wxHelpProviderModule::OnInit() -{ - // Probably we don't want to do anything by default, - // since it could pull in extra code - // wxHelpProvider::Set(new wxSimpleHelpProvider); - - return true; -} - -void wxHelpProviderModule::OnExit() -{ - if (wxHelpProvider::Get()) - { - delete wxHelpProvider::Get(); - wxHelpProvider::Set(NULL); - } -} - -#endif // wxUSE_HELP diff --git a/Source/3rdParty/wx/src/common/ctrlcmn.cpp b/Source/3rdParty/wx/src/common/ctrlcmn.cpp deleted file mode 100644 index 9326835e9..000000000 --- a/Source/3rdParty/wx/src/common/ctrlcmn.cpp +++ /dev/null @@ -1,188 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/ctrlcmn.cpp -// Purpose: wxControl common interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: ctrlcmn.cpp 40329 2006-07-25 18:40:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CONTROLS - -#include "wx/control.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/radiobut.h" - #include "wx/statbmp.h" - #include "wx/bitmap.h" - #include "wx/utils.h" // for wxStripMenuCodes() -#endif - -const wxChar wxControlNameStr[] = wxT("control"); - -// ============================================================================ -// implementation -// ============================================================================ - -wxControlBase::~wxControlBase() -{ - // this destructor is required for Darwin -} - -bool wxControlBase::Create(wxWindow *parent, - wxWindowID id, - const wxPoint &pos, - const wxSize &size, - long style, - const wxValidator& wxVALIDATOR_PARAM(validator), - const wxString &name) -{ - bool ret = wxWindow::Create(parent, id, pos, size, style, name); - -#if wxUSE_VALIDATORS - if ( ret ) - SetValidator(validator); -#endif // wxUSE_VALIDATORS - - return ret; -} - -bool wxControlBase::CreateControl(wxWindowBase *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - // even if it's possible to create controls without parents in some port, - // it should surely be discouraged because it doesn't work at all under - // Windows - wxCHECK_MSG( parent, false, wxT("all controls must have parents") ); - - if ( !CreateBase(parent, id, pos, size, style, validator, name) ) - return false; - - parent->AddChild(this); - - return true; -} - -/* static */ -wxString wxControlBase::GetLabelText(const wxString& label) -{ - // we don't want strip the TABs here, just the mnemonics - return wxStripMenuCodes(label, wxStrip_Mnemonics); -} - -void wxControlBase::Command(wxCommandEvent& event) -{ - (void)GetEventHandler()->ProcessEvent(event); -} - -void wxControlBase::InitCommandEvent(wxCommandEvent& event) const -{ - event.SetEventObject((wxControlBase *)this); // const_cast - - // event.SetId(GetId()); -- this is usuall done in the event ctor - - switch ( m_clientDataType ) - { - case wxClientData_Void: - event.SetClientData(GetClientData()); - break; - - case wxClientData_Object: - event.SetClientObject(GetClientObject()); - break; - - case wxClientData_None: - // nothing to do - ; - } -} - - -void wxControlBase::SetLabel( const wxString &label ) -{ - InvalidateBestSize(); - wxWindow::SetLabel(label); -} - -bool wxControlBase::SetFont(const wxFont& font) -{ - InvalidateBestSize(); - return wxWindow::SetFont(font); -} - -// wxControl-specific processing after processing the update event -void wxControlBase::DoUpdateWindowUI(wxUpdateUIEvent& event) -{ - // call inherited - wxWindowBase::DoUpdateWindowUI(event); - - // update label - if ( event.GetSetText() ) - { - if ( event.GetText() != GetLabel() ) - SetLabel(event.GetText()); - } - - // Unfortunately we don't yet have common base class for - // wxRadioButton, so we handle updates of radiobuttons here. - // TODO: If once wxRadioButtonBase will exist, move this code there. -#if wxUSE_RADIOBTN - if ( event.GetSetChecked() ) - { - wxRadioButton *radiobtn = wxDynamicCastThis(wxRadioButton); - if ( radiobtn ) - radiobtn->SetValue(event.GetChecked()); - } -#endif // wxUSE_RADIOBTN -} - -// ---------------------------------------------------------------------------- -// wxStaticBitmap -// ---------------------------------------------------------------------------- - -#if wxUSE_STATBMP - -wxStaticBitmapBase::~wxStaticBitmapBase() -{ - // this destructor is required for Darwin -} - -wxSize wxStaticBitmapBase::DoGetBestSize() const -{ - wxSize best; - wxBitmap bmp = GetBitmap(); - if ( bmp.Ok() ) - best = wxSize(bmp.GetWidth(), bmp.GetHeight()); - else - // this is completely arbitrary - best = wxSize(16, 16); - CacheBestSize(best); - return best; -} - -#endif // wxUSE_STATBMP - -#endif // wxUSE_CONTROLS diff --git a/Source/3rdParty/wx/src/common/ctrlsub.cpp b/Source/3rdParty/wx/src/common/ctrlsub.cpp deleted file mode 100644 index 387b174cc..000000000 --- a/Source/3rdParty/wx/src/common/ctrlsub.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/ctrlsub.cpp -// Purpose: wxItemContainer implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: ctrlsub.cpp 39077 2006-05-06 19:05:50Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CONTROLS - -#ifndef WX_PRECOMP - #include "wx/ctrlsub.h" - #include "wx/arrstr.h" -#endif - -IMPLEMENT_ABSTRACT_CLASS(wxControlWithItems, wxControl) - -// ============================================================================ -// wxItemContainerImmutable implementation -// ============================================================================ - -wxItemContainerImmutable::~wxItemContainerImmutable() -{ - // this destructor is required for Darwin -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -wxString wxItemContainerImmutable::GetStringSelection() const -{ - wxString s; - - int sel = GetSelection(); - if ( sel != wxNOT_FOUND ) - s = GetString((unsigned int)sel); - - return s; -} - -bool wxItemContainerImmutable::SetStringSelection(const wxString& s) -{ - const int sel = FindString(s); - if ( sel == wxNOT_FOUND ) - return false; - - SetSelection(sel); - - return true; -} - -wxArrayString wxItemContainerImmutable::GetStrings() const -{ - wxArrayString result; - - const unsigned int count = GetCount(); - result.Alloc(count); - for ( unsigned int n = 0; n < count; n++ ) - result.Add(GetString(n)); - - return result; -} - -// ============================================================================ -// wxItemContainer implementation -// ============================================================================ - -wxItemContainer::~wxItemContainer() -{ - // this destructor is required for Darwin -} - -// ---------------------------------------------------------------------------- -// appending items -// ---------------------------------------------------------------------------- - -void wxItemContainer::Append(const wxArrayString& strings) -{ - const size_t count = strings.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - Append(strings[n]); - } -} - -int wxItemContainer::Insert(const wxString& item, unsigned int pos, void *clientData) -{ - int n = DoInsert(item, pos); - if ( n != wxNOT_FOUND ) - SetClientData(n, clientData); - - return n; -} - -int wxItemContainer::Insert(const wxString& item, unsigned int pos, wxClientData *clientData) -{ - int n = DoInsert(item, pos); - if ( n != wxNOT_FOUND ) - SetClientObject(n, clientData); - - return n; -} - -// ---------------------------------------------------------------------------- -// client data -// ---------------------------------------------------------------------------- - -void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) -{ - wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void, - wxT("can't have both object and void client data") ); - - // when we call SetClientObject() for the first time, m_clientDataItemsType - // is still wxClientData_None and so calling DoGetItemClientObject() would - // fail (in addition to being useless) - don't do it - if ( m_clientDataItemsType == wxClientData_Object ) - { - wxClientData *clientDataOld = DoGetItemClientObject(n); - if ( clientDataOld ) - delete clientDataOld; - } - else // m_clientDataItemsType == wxClientData_None - { - // now we have object client data - m_clientDataItemsType = wxClientData_Object; - } - - DoSetItemClientObject(n, data); -} - -wxClientData *wxItemContainer::GetClientObject(unsigned int n) const -{ - wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object, - wxT("this window doesn't have object client data") ); - - return DoGetItemClientObject(n); -} - -void wxItemContainer::SetClientData(unsigned int n, void *data) -{ - wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object, - wxT("can't have both object and void client data") ); - - DoSetItemClientData(n, data); - m_clientDataItemsType = wxClientData_Void; -} - -void *wxItemContainer::GetClientData(unsigned int n) const -{ - wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void, - wxT("this window doesn't have void client data") ); - - return DoGetItemClientData(n); -} - -// ============================================================================ -// wxControlWithItems implementation -// ============================================================================ - -void wxControlWithItems::InitCommandEventWithItems(wxCommandEvent& event, int n) -{ - InitCommandEvent(event); - - if ( n != wxNOT_FOUND ) - { - if ( HasClientObjectData() ) - event.SetClientObject(GetClientObject(n)); - else if ( HasClientUntypedData() ) - event.SetClientData(GetClientData(n)); - } -} - -wxControlWithItems::~wxControlWithItems() -{ - // this destructor is required for Darwin -} - -#endif // wxUSE_CONTROLS diff --git a/Source/3rdParty/wx/src/common/datacmn.cpp b/Source/3rdParty/wx/src/common/datacmn.cpp deleted file mode 100644 index e82b5ead5..000000000 --- a/Source/3rdParty/wx/src/common/datacmn.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/datacmn.cpp -// Purpose: contains definitions of various global wxWidgets variables -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.04.03 (from src/*/data.cpp files) -// RCS-ID: $Id: datacmn.cpp 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1997-2002 wxWidgets development team -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#endif // WX_PRECOMP - -#include "wx/accel.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// 'Null' objects -#if wxUSE_ACCEL -wxAcceleratorTable wxNullAcceleratorTable; -#endif // wxUSE_ACCEL - -// Default window names -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[] = wxT("button"); -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[] = wxT("check"); -extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[] = wxT("comboBox"); -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[] = wxT("dialog"); -extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[] = wxT("frame"); -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBoxNameStr[] = wxT("groupBox"); -extern WXDLLEXPORT_DATA(const wxChar) wxListBoxNameStr[] = wxT("listBox"); -extern WXDLLEXPORT_DATA(const wxChar) wxStaticLineNameStr[] = wxT("staticLine"); -extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[] = wxT("staticText"); -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[] = wxT("staticBitmap"); -extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[] = wxT("notebook"); -extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[] = wxT("panel"); -extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[] = wxT("radioBox"); -extern WXDLLEXPORT_DATA(const wxChar) wxRadioButtonNameStr[] = wxT("radioButton"); -extern WXDLLEXPORT_DATA(const wxChar) wxBitmapRadioButtonNameStr[] = wxT("radioButton"); -extern WXDLLEXPORT_DATA(const wxChar) wxScrollBarNameStr[] = wxT("scrollBar"); -extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[] = wxT("slider"); -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[] = wxT("status_line"); -extern WXDLLEXPORT_DATA(const wxChar) wxTextCtrlNameStr[] = wxT("text"); -extern WXDLLEXPORT_DATA(const wxChar) wxTreeCtrlNameStr[] = wxT("treeCtrl"); -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[] = wxT("toolbar"); - -// Default messages -extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[] = wxT("Message"); -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[] = wxT("Select a file"); -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[] = wxT("Select a directory"); - -// Other default strings -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[] = -#if defined(__WXMSW__) || defined(__OS2__) - wxT("*.*") -#else // Unix/Mac - wxT("*") -#endif - ; -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[] = wxT("wxDirCtrl"); -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[] = wxT("/"); - -extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[] = wxT("filedlg"); -#if defined(__WXMSW__) || defined(__OS2__) -WXDLLEXPORT_DATA(const wxChar *) wxUserResourceStr = wxT("TEXT"); -#endif diff --git a/Source/3rdParty/wx/src/common/datetime.cpp b/Source/3rdParty/wx/src/common/datetime.cpp deleted file mode 100644 index 30db343e8..000000000 --- a/Source/3rdParty/wx/src/common/datetime.cpp +++ /dev/null @@ -1,4615 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/datetime.cpp -// Purpose: implementation of time/date related classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.05.99 -// RCS-ID: $Id: datetime.cpp 65730 2010-10-02 16:50:34Z TIK $ -// Copyright: (c) 1999 Vadim Zeitlin -// parts of code taken from sndcal library by Scott E. Lee: -// -// Copyright 1993-1995, Scott E. Lee, all rights reserved. -// Permission granted to use, copy, modify, distribute and sell -// so long as the above copyright and this permission statement -// are retained in all copies. -// -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - * Implementation notes: - * - * 1. the time is stored as a 64bit integer containing the signed number of - * milliseconds since Jan 1. 1970 (the Unix Epoch) - so it is always - * expressed in GMT. - * - * 2. the range is thus something about 580 million years, but due to current - * algorithms limitations, only dates from Nov 24, 4714BC are handled - * - * 3. standard ANSI C functions are used to do time calculations whenever - * possible, i.e. when the date is in the range Jan 1, 1970 to 2038 - * - * 4. otherwise, the calculations are done by converting the date to/from JDN - * first (the range limitation mentioned above comes from here: the - * algorithm used by Scott E. Lee's code only works for positive JDNs, more - * or less) - * - * 5. the object constructed for the given DD-MM-YYYY HH:MM:SS corresponds to - * this moment in local time and may be converted to the object - * corresponding to the same date/time in another time zone by using - * ToTimezone() - * - * 6. the conversions to the current (or any other) timezone are done when the - * internal time representation is converted to the broken-down one in - * wxDateTime::Tm. - */ - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if !defined(wxUSE_DATETIME) || wxUSE_DATETIME - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/string.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/stopwatch.h" // for wxGetLocalTimeMillis() - #include "wx/module.h" -#endif // WX_PRECOMP - -#include "wx/thread.h" -#include "wx/tokenzr.h" - -#include - -#ifdef __WINDOWS__ - #include - #ifndef __WXWINCE__ - #include - #endif -#endif - -#include "wx/datetime.h" - -const long wxDateTime::TIME_T_FACTOR = 1000l; - -#if wxUSE_EXTENDED_RTTI - -template<> void wxStringReadValue(const wxString &s , wxDateTime &data ) -{ - data.ParseFormat(s,wxT("%Y-%m-%d %H:%M:%S")) ; -} - -template<> void wxStringWriteValue(wxString &s , const wxDateTime &data ) -{ - s = data.Format(wxT("%Y-%m-%d %H:%M:%S")) ; -} - -wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter , wxFromStringConverter) - -#endif - -// -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -#if defined(HAVE_STRPTIME) && defined(__GLIBC__) && \ - ((__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) - // glibc 2.0.7 strptime() is broken - the following snippet causes it to - // crash (instead of just failing): - // - // strncpy(buf, "Tue Dec 21 20:25:40 1999", 128); - // strptime(buf, "%x", &tm); - // - // so don't use it - #undef HAVE_STRPTIME -#endif // broken strptime() - -#if defined(HAVE_STRPTIME) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - // configure detects strptime as linkable because it's in the OS X - // System library but MSL headers don't declare it. - -// char *strptime(const char *, const char *, struct tm *); - // However, we DON'T want to just provide it here because we would - // crash and/or overwrite data when strptime from OS X tries - // to fill in MW's struct tm which is two fields shorter (no TZ stuff) - // So for now let's just say we don't have strptime - #undef HAVE_STRPTIME -#endif - -#if defined(__MWERKS__) && wxUSE_UNICODE - #include -#endif - -// define a special symbol for VC8 instead of writing tests for 1400 repeatedly -#ifdef __VISUALC__ - #if __VISUALC__ >= 1400 - #define __VISUALC8__ - #endif -#endif - -#if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM) - #if defined(__WXPALMOS__) - #define WX_GMTOFF_IN_TM - #elif defined(__WXMSW__) - static long wxGetTimeZone() - { - TIME_ZONE_INFORMATION info; - GetTimeZoneInformation(&info); - long timeZone = info.Bias * 60; // convert minutes to seconds - return timeZone; - } - #define WX_TIMEZONE wxGetTimeZone() - #elif defined(__VISAGECPP__) - #define WX_TIMEZONE _timezone - #elif defined(__MWERKS__) - long wxmw_timezone = 28800; - #define WX_TIMEZONE wxmw_timezone - #elif defined(__DARWIN__) - #define WX_GMTOFF_IN_TM - #else // unknown platform - try timezone - #define WX_TIMEZONE timezone - #endif -#endif // !WX_TIMEZONE && !WX_GMTOFF_IN_TM - -// everyone has strftime except Win CE unless VC8 is used -#if !defined(__WXWINCE__) || defined(__VISUALC8__) - #define HAVE_STRFTIME -#endif - -// NB: VC8 safe time functions could/should be used for wxMSW as well probably -#if defined(__WXWINCE__) && defined(__VISUALC8__) - -struct tm *wxLocaltime_r(const time_t *t, struct tm* tm) -{ - __time64_t t64 = *t; - return _localtime64_s(tm, &t64) == 0 ? tm : NULL; -} - -struct tm *wxGmtime_r(const time_t* t, struct tm* tm) -{ - __time64_t t64 = *t; - return _gmtime64_s(tm, &t64) == 0 ? tm : NULL; -} - -#else // !wxWinCE with VC8 - -#if (!defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)) && wxUSE_THREADS && !defined(__WINDOWS__) -static wxMutex timeLock; -#endif - -#ifndef HAVE_LOCALTIME_R -struct tm *wxLocaltime_r(const time_t* ticks, struct tm* temp) -{ -#if wxUSE_THREADS && !defined(__WINDOWS__) - // No need to waste time with a mutex on windows since it's using - // thread local storage for localtime anyway. - wxMutexLocker locker(timeLock); -#endif - - // Borland CRT crashes when passed 0 ticks for some reason, see SF bug 1704438 -#ifdef __BORLANDC__ - if ( !*ticks ) - return NULL; -#endif - - const tm * const t = localtime(ticks); - if ( !t ) - return NULL; - - memcpy(temp, t, sizeof(struct tm)); - return temp; -} -#endif // !HAVE_LOCALTIME_R - -#ifndef HAVE_GMTIME_R -struct tm *wxGmtime_r(const time_t* ticks, struct tm* temp) -{ -#if wxUSE_THREADS && !defined(__WINDOWS__) - // No need to waste time with a mutex on windows since it's - // using thread local storage for gmtime anyway. - wxMutexLocker locker(timeLock); -#endif - -#ifdef __BORLANDC__ - if ( !*ticks ) - return NULL; -#endif - - const tm * const t = gmtime(ticks); - if ( !t ) - return NULL; - - memcpy(temp, gmtime(ticks), sizeof(struct tm)); - return temp; -} -#endif // !HAVE_GMTIME_R - -#endif // wxWinCE with VC8/other platforms - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// debugging helper: just a convenient replacement of wxCHECK() -#define wxDATETIME_CHECK(expr, msg) \ - wxCHECK2_MSG(expr, *this = wxInvalidDateTime; return *this, msg) - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -class wxDateTimeHolidaysModule : public wxModule -{ -public: - virtual bool OnInit() - { - wxDateTimeHolidayAuthority::AddAuthority(new wxDateTimeWorkDays); - - return true; - } - - virtual void OnExit() - { - wxDateTimeHolidayAuthority::ClearAllAuthorities(); - wxDateTimeHolidayAuthority::ms_authorities.clear(); - } - -private: - DECLARE_DYNAMIC_CLASS(wxDateTimeHolidaysModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDateTimeHolidaysModule, wxModule) - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// some trivial ones -static const int MONTHS_IN_YEAR = 12; - -static const int SEC_PER_MIN = 60; - -static const int MIN_PER_HOUR = 60; - -static const int HOURS_PER_DAY = 24; - -static const long SECONDS_PER_DAY = 86400l; - -static const int DAYS_PER_WEEK = 7; - -static const long MILLISECONDS_PER_DAY = 86400000l; - -// this is the integral part of JDN of the midnight of Jan 1, 1970 -// (i.e. JDN(Jan 1, 1970) = 2440587.5) -static const long EPOCH_JDN = 2440587l; - -// used only in asserts -#ifdef __WXDEBUG__ -// the date of JDN -0.5 (as we don't work with fractional parts, this is the -// reference date for us) is Nov 24, 4714BC -static const int JDN_0_YEAR = -4713; -static const int JDN_0_MONTH = wxDateTime::Nov; -static const int JDN_0_DAY = 24; -#endif // __WXDEBUG__ - -// the constants used for JDN calculations -static const long JDN_OFFSET = 32046l; -static const long DAYS_PER_5_MONTHS = 153l; -static const long DAYS_PER_4_YEARS = 1461l; -static const long DAYS_PER_400_YEARS = 146097l; - -// this array contains the cumulated number of days in all previous months for -// normal and leap years -static const wxDateTime::wxDateTime_t gs_cumulatedDays[2][MONTHS_IN_YEAR] = -{ - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }, - { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 } -}; - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -const wxChar * wxDefaultDateTimeFormat = wxT("%c"); -const wxChar * wxDefaultTimeSpanFormat = wxT("%H:%M:%S"); - -// in the fine tradition of ANSI C we use our equivalent of (time_t)-1 to -// indicate an invalid wxDateTime object -const wxDateTime wxDefaultDateTime; - -wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown; - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// debugger helper: shows what the date really is -#ifdef __WXDEBUG__ -extern const wxChar *wxDumpDate(const wxDateTime* dt) -{ - static wxChar buf[128]; - - wxStrcpy(buf, dt->Format(_T("%Y-%m-%d (%a) %H:%M:%S"))); - - return buf; -} -#endif // Debug - -// get the number of days in the given month of the given year -static inline -wxDateTime::wxDateTime_t GetNumOfDaysInMonth(int year, wxDateTime::Month month) -{ - // the number of days in month in Julian/Gregorian calendar: the first line - // is for normal years, the second one is for the leap ones - static wxDateTime::wxDateTime_t daysInMonth[2][MONTHS_IN_YEAR] = - { - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } - }; - - return daysInMonth[wxDateTime::IsLeapYear(year)][month]; -} - -// returns the time zone in the C sense, i.e. the difference UTC - local -// (in seconds) -static int GetTimeZone() -{ -#ifdef WX_GMTOFF_IN_TM - // set to true when the timezone is set - static bool s_timezoneSet = false; - static long gmtoffset = LONG_MAX; // invalid timezone - - // ensure that the timezone variable is set by calling wxLocaltime_r - if ( !s_timezoneSet ) - { - // just call wxLocaltime_r() instead of figuring out whether this - // system supports tzset(), _tzset() or something else - time_t t = 0; - struct tm tm; - - wxLocaltime_r(&t, &tm); - s_timezoneSet = true; - - // note that GMT offset is the opposite of time zone and so to return - // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM - // cases we have to negate it - gmtoffset = -tm.tm_gmtoff; - } - return (int)gmtoffset; -#else // !WX_GMTOFF_IN_TM - return WX_TIMEZONE; -#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM -} - -// return the integral part of the JDN for the midnight of the given date (to -// get the real JDN you need to add 0.5, this is, in fact, JDN of the -// noon of the previous day) -static long GetTruncatedJDN(wxDateTime::wxDateTime_t day, - wxDateTime::Month mon, - int year) -{ - // CREDIT: code below is by Scott E. Lee (but bugs are mine) - - // check the date validity - wxASSERT_MSG( - (year > JDN_0_YEAR) || - ((year == JDN_0_YEAR) && (mon > JDN_0_MONTH)) || - ((year == JDN_0_YEAR) && (mon == JDN_0_MONTH) && (day >= JDN_0_DAY)), - _T("date out of range - can't convert to JDN") - ); - - // make the year positive to avoid problems with negative numbers division - year += 4800; - - // months are counted from March here - int month; - if ( mon >= wxDateTime::Mar ) - { - month = mon - 2; - } - else - { - month = mon + 10; - year--; - } - - // now we can simply add all the contributions together - return ((year / 100) * DAYS_PER_400_YEARS) / 4 - + ((year % 100) * DAYS_PER_4_YEARS) / 4 - + (month * DAYS_PER_5_MONTHS + 2) / 5 - + day - - JDN_OFFSET; -} - -#ifdef HAVE_STRFTIME - -// this function is a wrapper around strftime(3) adding error checking -static wxString CallStrftime(const wxChar *format, const tm* tm) -{ - wxChar buf[4096]; - // Create temp wxString here to work around mingw/cygwin bug 1046059 - // http://sourceforge.net/tracker/?func=detail&atid=102435&aid=1046059&group_id=2435 - wxString s; - - if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) ) - { - // buffer is too small? - wxFAIL_MSG(_T("strftime() failed")); - } - - s = buf; - return s; -} - -#endif // HAVE_STRFTIME - -#ifdef HAVE_STRPTIME - -#if wxUSE_UNIX && !defined(HAVE_STRPTIME_DECL) - // configure detected that we had strptime() but not its declaration, - // provide it ourselves - extern "C" char *strptime(const char *, const char *, struct tm *); -#endif - -// Unicode-friendly strptime() wrapper -static const wxChar * -CallStrptime(const wxChar *input, const char *fmt, tm *tm) -{ - // the problem here is that strptime() returns pointer into the string we - // passed to it while we're really interested in the pointer into the - // original, Unicode, string so we try to transform the pointer back -#if wxUSE_UNICODE - wxCharBuffer inputMB(wxConvertWX2MB(input)); -#else // ASCII - const char * const inputMB = input; -#endif // Unicode/Ascii - - const char *result = strptime(inputMB, fmt, tm); - if ( !result ) - return NULL; - -#if wxUSE_UNICODE - // FIXME: this is wrong in presence of surrogates &c - return input + (result - inputMB.data()); -#else // ASCII - return result; -#endif // Unicode/Ascii -} - -#endif // HAVE_STRPTIME - -// if year and/or month have invalid values, replace them with the current ones -static void ReplaceDefaultYearMonthWithCurrent(int *year, - wxDateTime::Month *month) -{ - struct tm *tmNow = NULL; - struct tm tmstruct; - - if ( *year == wxDateTime::Inv_Year ) - { - tmNow = wxDateTime::GetTmNow(&tmstruct); - - *year = 1900 + tmNow->tm_year; - } - - if ( *month == wxDateTime::Inv_Month ) - { - if ( !tmNow ) - tmNow = wxDateTime::GetTmNow(&tmstruct); - - *month = (wxDateTime::Month)tmNow->tm_mon; - } -} - -// fll the struct tm with default values -static void InitTm(struct tm& tm) -{ - // struct tm may have etxra fields (undocumented and with unportable - // names) which, nevertheless, must be set to 0 - memset(&tm, 0, sizeof(struct tm)); - - tm.tm_mday = 1; // mday 0 is invalid - tm.tm_year = 76; // any valid year - tm.tm_isdst = -1; // auto determine -} - -// parsing helpers -// --------------- - -// return the month if the string is a month name or Inv_Month otherwise -static wxDateTime::Month GetMonthFromName(const wxString& name, int flags) -{ - wxDateTime::Month mon; - for ( mon = wxDateTime::Jan; mon < wxDateTime::Inv_Month; wxNextMonth(mon) ) - { - // case-insensitive comparison either one of or with both abbreviated - // and not versions - if ( flags & wxDateTime::Name_Full ) - { - if ( name.CmpNoCase(wxDateTime:: - GetMonthName(mon, wxDateTime::Name_Full)) == 0 ) - { - break; - } - } - - if ( flags & wxDateTime::Name_Abbr ) - { - if ( name.CmpNoCase(wxDateTime:: - GetMonthName(mon, wxDateTime::Name_Abbr)) == 0 ) - { - break; - } - } - } - - return mon; -} - -// return the weekday if the string is a weekday name or Inv_WeekDay otherwise -static wxDateTime::WeekDay GetWeekDayFromName(const wxString& name, int flags) -{ - wxDateTime::WeekDay wd; - for ( wd = wxDateTime::Sun; wd < wxDateTime::Inv_WeekDay; wxNextWDay(wd) ) - { - // case-insensitive comparison either one of or with both abbreviated - // and not versions - if ( flags & wxDateTime::Name_Full ) - { - if ( name.CmpNoCase(wxDateTime:: - GetWeekDayName(wd, wxDateTime::Name_Full)) == 0 ) - { - break; - } - } - - if ( flags & wxDateTime::Name_Abbr ) - { - if ( name.CmpNoCase(wxDateTime:: - GetWeekDayName(wd, wxDateTime::Name_Abbr)) == 0 ) - { - break; - } - } - } - - return wd; -} - -/* static */ -struct tm *wxDateTime::GetTmNow(struct tm *tmstruct) -{ - time_t t = GetTimeNow(); - return wxLocaltime_r(&t, tmstruct); -} - -// scans all digits (but no more than len) and returns the resulting number -static bool GetNumericToken(size_t len, const wxChar*& p, unsigned long *number) -{ - size_t n = 1; - wxString s; - while ( wxIsdigit(*p) ) - { - s += *p++; - - if ( len && ++n > len ) - break; - } - - return !s.empty() && s.ToULong(number); -} - -// scans all alphabetic characters and returns the resulting string -static wxString GetAlphaToken(const wxChar*& p) -{ - wxString s; - while ( wxIsalpha(*p) ) - { - s += *p++; - } - - return s; -} - -// ============================================================================ -// implementation of wxDateTime -// ============================================================================ - -// ---------------------------------------------------------------------------- -// struct Tm -// ---------------------------------------------------------------------------- - -wxDateTime::Tm::Tm() -{ - year = (wxDateTime_t)wxDateTime::Inv_Year; - mon = wxDateTime::Inv_Month; - mday = 0; - hour = min = sec = msec = 0; - wday = wxDateTime::Inv_WeekDay; -} - -wxDateTime::Tm::Tm(const struct tm& tm, const TimeZone& tz) - : m_tz(tz) -{ - msec = 0; - sec = (wxDateTime::wxDateTime_t)tm.tm_sec; - min = (wxDateTime::wxDateTime_t)tm.tm_min; - hour = (wxDateTime::wxDateTime_t)tm.tm_hour; - mday = (wxDateTime::wxDateTime_t)tm.tm_mday; - mon = (wxDateTime::Month)tm.tm_mon; - year = 1900 + tm.tm_year; - wday = (wxDateTime::wxDateTime_t)tm.tm_wday; - yday = (wxDateTime::wxDateTime_t)tm.tm_yday; -} - -bool wxDateTime::Tm::IsValid() const -{ - // we allow for the leap seconds, although we don't use them (yet) - return (year != wxDateTime::Inv_Year) && (mon != wxDateTime::Inv_Month) && - (mday <= GetNumOfDaysInMonth(year, mon)) && - (hour < 24) && (min < 60) && (sec < 62) && (msec < 1000); -} - -void wxDateTime::Tm::ComputeWeekDay() -{ - // compute the week day from day/month/year: we use the dumbest algorithm - // possible: just compute our JDN and then use the (simple to derive) - // formula: weekday = (JDN + 1.5) % 7 - wday = (wxDateTime::wxDateTime_t)((GetTruncatedJDN(mday, mon, year) + 2) % 7); -} - -void wxDateTime::Tm::AddMonths(int monDiff) -{ - // normalize the months field - while ( monDiff < -mon ) - { - year--; - - monDiff += MONTHS_IN_YEAR; - } - - while ( monDiff + mon >= MONTHS_IN_YEAR ) - { - year++; - - monDiff -= MONTHS_IN_YEAR; - } - - mon = (wxDateTime::Month)(mon + monDiff); - - wxASSERT_MSG( mon >= 0 && mon < MONTHS_IN_YEAR, _T("logic error") ); - - // NB: we don't check here that the resulting date is valid, this function - // is private and the caller must check it if needed -} - -void wxDateTime::Tm::AddDays(int dayDiff) -{ - // normalize the days field - while ( dayDiff + mday < 1 ) - { - AddMonths(-1); - - dayDiff += GetNumOfDaysInMonth(year, mon); - } - - mday = (wxDateTime::wxDateTime_t)( mday + dayDiff ); - while ( mday > GetNumOfDaysInMonth(year, mon) ) - { - mday -= GetNumOfDaysInMonth(year, mon); - - AddMonths(1); - } - - wxASSERT_MSG( mday > 0 && mday <= GetNumOfDaysInMonth(year, mon), - _T("logic error") ); -} - -// ---------------------------------------------------------------------------- -// class TimeZone -// ---------------------------------------------------------------------------- - -wxDateTime::TimeZone::TimeZone(wxDateTime::TZ tz) -{ - switch ( tz ) - { - case wxDateTime::Local: - // get the offset from C RTL: it returns the difference GMT-local - // while we want to have the offset _from_ GMT, hence the '-' - m_offset = -GetTimeZone(); - break; - - case wxDateTime::GMT_12: - case wxDateTime::GMT_11: - case wxDateTime::GMT_10: - case wxDateTime::GMT_9: - case wxDateTime::GMT_8: - case wxDateTime::GMT_7: - case wxDateTime::GMT_6: - case wxDateTime::GMT_5: - case wxDateTime::GMT_4: - case wxDateTime::GMT_3: - case wxDateTime::GMT_2: - case wxDateTime::GMT_1: - m_offset = -3600*(wxDateTime::GMT0 - tz); - break; - - case wxDateTime::GMT0: - case wxDateTime::GMT1: - case wxDateTime::GMT2: - case wxDateTime::GMT3: - case wxDateTime::GMT4: - case wxDateTime::GMT5: - case wxDateTime::GMT6: - case wxDateTime::GMT7: - case wxDateTime::GMT8: - case wxDateTime::GMT9: - case wxDateTime::GMT10: - case wxDateTime::GMT11: - case wxDateTime::GMT12: - case wxDateTime::GMT13: - m_offset = 3600*(tz - wxDateTime::GMT0); - break; - - case wxDateTime::A_CST: - // Central Standard Time in use in Australia = UTC + 9.5 - m_offset = 60l*(9*MIN_PER_HOUR + MIN_PER_HOUR/2); - break; - - default: - wxFAIL_MSG( _T("unknown time zone") ); - } -} - -// ---------------------------------------------------------------------------- -// static functions -// ---------------------------------------------------------------------------- - -/* static */ -bool wxDateTime::IsLeapYear(int year, wxDateTime::Calendar cal) -{ - if ( year == Inv_Year ) - year = GetCurrentYear(); - - if ( cal == Gregorian ) - { - // in Gregorian calendar leap years are those divisible by 4 except - // those divisible by 100 unless they're also divisible by 400 - // (in some countries, like Russia and Greece, additional corrections - // exist, but they won't manifest themselves until 2700) - return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)); - } - else if ( cal == Julian ) - { - // in Julian calendar the rule is simpler - return year % 4 == 0; - } - else - { - wxFAIL_MSG(_T("unknown calendar")); - - return false; - } -} - -/* static */ -int wxDateTime::GetCentury(int year) -{ - return year > 0 ? year / 100 : year / 100 - 1; -} - -/* static */ -int wxDateTime::ConvertYearToBC(int year) -{ - // year 0 is BC 1 - return year > 0 ? year : year - 1; -} - -/* static */ -int wxDateTime::GetCurrentYear(wxDateTime::Calendar cal) -{ - switch ( cal ) - { - case Gregorian: - return Now().GetYear(); - - case Julian: - wxFAIL_MSG(_T("TODO")); - break; - - default: - wxFAIL_MSG(_T("unsupported calendar")); - break; - } - - return Inv_Year; -} - -/* static */ -wxDateTime::Month wxDateTime::GetCurrentMonth(wxDateTime::Calendar cal) -{ - switch ( cal ) - { - case Gregorian: - return Now().GetMonth(); - - case Julian: - wxFAIL_MSG(_T("TODO")); - break; - - default: - wxFAIL_MSG(_T("unsupported calendar")); - break; - } - - return Inv_Month; -} - -/* static */ -wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(int year, Calendar cal) -{ - if ( year == Inv_Year ) - { - // take the current year if none given - year = GetCurrentYear(); - } - - switch ( cal ) - { - case Gregorian: - case Julian: - return IsLeapYear(year) ? 366 : 365; - - default: - wxFAIL_MSG(_T("unsupported calendar")); - break; - } - - return 0; -} - -/* static */ -wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(wxDateTime::Month month, - int year, - wxDateTime::Calendar cal) -{ - wxCHECK_MSG( month < MONTHS_IN_YEAR, 0, _T("invalid month") ); - - if ( cal == Gregorian || cal == Julian ) - { - if ( year == Inv_Year ) - { - // take the current year if none given - year = GetCurrentYear(); - } - - return GetNumOfDaysInMonth(year, month); - } - else - { - wxFAIL_MSG(_T("unsupported calendar")); - - return 0; - } -} - -/* static */ -wxString wxDateTime::GetMonthName(wxDateTime::Month month, - wxDateTime::NameFlags flags) -{ - wxCHECK_MSG( month != Inv_Month, wxEmptyString, _T("invalid month") ); -#ifdef HAVE_STRFTIME - // notice that we must set all the fields to avoid confusing libc (GNU one - // gets confused to a crash if we don't do this) - tm tm; - InitTm(tm); - tm.tm_mon = month; - - return CallStrftime(flags == Name_Abbr ? _T("%b") : _T("%B"), &tm); -#else // !HAVE_STRFTIME - wxString ret; - switch(month) - { - case Jan: - ret = (flags == Name_Abbr ? wxT("Jan"): wxT("January")); - break; - case Feb: - ret = (flags == Name_Abbr ? wxT("Feb"): wxT("Febuary")); - break; - case Mar: - ret = (flags == Name_Abbr ? wxT("Mar"): wxT("March")); - break; - case Apr: - ret = (flags == Name_Abbr ? wxT("Apr"): wxT("April")); - break; - case May: - ret = (flags == Name_Abbr ? wxT("May"): wxT("May")); - break; - case Jun: - ret = (flags == Name_Abbr ? wxT("Jun"): wxT("June")); - break; - case Jul: - ret = (flags == Name_Abbr ? wxT("Jul"): wxT("July")); - break; - case Aug: - ret = (flags == Name_Abbr ? wxT("Aug"): wxT("August")); - break; - case Sep: - ret = (flags == Name_Abbr ? wxT("Sep"): wxT("September")); - break; - case Oct: - ret = (flags == Name_Abbr ? wxT("Oct"): wxT("October")); - break; - case Nov: - ret = (flags == Name_Abbr ? wxT("Nov"): wxT("November")); - break; - case Dec: - ret = (flags == Name_Abbr ? wxT("Dec"): wxT("December")); - break; - } - return ret; -#endif // HAVE_STRFTIME/!HAVE_STRFTIME -} - -/* static */ -wxString wxDateTime::GetWeekDayName(wxDateTime::WeekDay wday, - wxDateTime::NameFlags flags) -{ - wxCHECK_MSG( wday != Inv_WeekDay, wxEmptyString, _T("invalid weekday") ); -#ifdef HAVE_STRFTIME - // take some arbitrary Sunday (but notice that the day should be such that - // after adding wday to it below we still have a valid date, e.g. don't - // take 28 here!) - tm tm; - InitTm(tm); - tm.tm_mday = 21; - tm.tm_mon = Nov; - tm.tm_year = 99; - - // and offset it by the number of days needed to get the correct wday - tm.tm_mday += wday; - - // call mktime() to normalize it... - (void)mktime(&tm); - - // ... and call strftime() - return CallStrftime(flags == Name_Abbr ? _T("%a") : _T("%A"), &tm); -#else // !HAVE_STRFTIME - wxString ret; - switch(wday) - { - case Sun: - ret = (flags == Name_Abbr ? wxT("Sun") : wxT("Sunday")); - break; - case Mon: - ret = (flags == Name_Abbr ? wxT("Mon") : wxT("Monday")); - break; - case Tue: - ret = (flags == Name_Abbr ? wxT("Tue") : wxT("Tuesday")); - break; - case Wed: - ret = (flags == Name_Abbr ? wxT("Wed") : wxT("Wednesday")); - break; - case Thu: - ret = (flags == Name_Abbr ? wxT("Thu") : wxT("Thursday")); - break; - case Fri: - ret = (flags == Name_Abbr ? wxT("Fri") : wxT("Friday")); - break; - case Sat: - ret = (flags == Name_Abbr ? wxT("Sat") : wxT("Saturday")); - break; - } - return ret; -#endif // HAVE_STRFTIME/!HAVE_STRFTIME -} - -/* static */ -void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm) -{ - tm tm; - InitTm(tm); - wxChar buffer[64]; - // @Note: Do not call 'CallStrftime' here! CallStrftime checks the return code - // and causes an assertion failed if the buffer is to small (which is good) - OR - - // if strftime does not return anything because the format string is invalid - OR - - // if there are no 'am' / 'pm' tokens defined for the current locale (which is not good). - // wxDateTime::ParseTime will try several different formats to parse the time. - // As a result, GetAmPmStrings might get called, even if the current locale - // does not define any 'am' / 'pm' tokens. In this case, wxStrftime would - // assert, even though it is a perfectly legal use. - if ( am ) - { - if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0) - *am = wxString(buffer); - else - *am = wxString(); - } - if ( pm ) - { - tm.tm_hour = 13; - if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0) - *pm = wxString(buffer); - else - *pm = wxString(); - } -} - -// ---------------------------------------------------------------------------- -// Country stuff: date calculations depend on the country (DST, work days, -// ...), so we need to know which rules to follow. -// ---------------------------------------------------------------------------- - -/* static */ -wxDateTime::Country wxDateTime::GetCountry() -{ - // TODO use LOCALE_ICOUNTRY setting under Win32 -#ifndef __WXWINCE__ - if ( ms_country == Country_Unknown ) - { - // try to guess from the time zone name - time_t t = time(NULL); - struct tm tmstruct; - struct tm *tm = wxLocaltime_r(&t, &tmstruct); - - wxString tz = CallStrftime(_T("%Z"), tm); - if ( tz == _T("WET") || tz == _T("WEST") ) - { - ms_country = UK; - } - else if ( tz == _T("CET") || tz == _T("CEST") ) - { - ms_country = Country_EEC; - } - else if ( tz == _T("MSK") || tz == _T("MSD") ) - { - ms_country = Russia; - } - else if ( tz == _T("AST") || tz == _T("ADT") || - tz == _T("EST") || tz == _T("EDT") || - tz == _T("CST") || tz == _T("CDT") || - tz == _T("MST") || tz == _T("MDT") || - tz == _T("PST") || tz == _T("PDT") ) - { - ms_country = USA; - } - else - { - // well, choose a default one - ms_country = USA; - } - } -#else // __WXWINCE__ - ms_country = USA; -#endif // !__WXWINCE__/__WXWINCE__ - - return ms_country; -} - -/* static */ -void wxDateTime::SetCountry(wxDateTime::Country country) -{ - ms_country = country; -} - -/* static */ -bool wxDateTime::IsWestEuropeanCountry(Country country) -{ - if ( country == Country_Default ) - { - country = GetCountry(); - } - - return (Country_WesternEurope_Start <= country) && - (country <= Country_WesternEurope_End); -} - -// ---------------------------------------------------------------------------- -// DST calculations: we use 3 different rules for the West European countries, -// USA and for the rest of the world. This is undoubtedly false for many -// countries, but I lack the necessary info (and the time to gather it), -// please add the other rules here! -// ---------------------------------------------------------------------------- - -/* static */ -bool wxDateTime::IsDSTApplicable(int year, Country country) -{ - if ( year == Inv_Year ) - { - // take the current year if none given - year = GetCurrentYear(); - } - - if ( country == Country_Default ) - { - country = GetCountry(); - } - - switch ( country ) - { - case USA: - case UK: - // DST was first observed in the US and UK during WWI, reused - // during WWII and used again since 1966 - return year >= 1966 || - (year >= 1942 && year <= 1945) || - (year == 1918 || year == 1919); - - default: - // assume that it started after WWII - return year > 1950; - } -} - -/* static */ -wxDateTime wxDateTime::GetBeginDST(int year, Country country) -{ - if ( year == Inv_Year ) - { - // take the current year if none given - year = GetCurrentYear(); - } - - if ( country == Country_Default ) - { - country = GetCountry(); - } - - if ( !IsDSTApplicable(year, country) ) - { - return wxInvalidDateTime; - } - - wxDateTime dt; - - if ( IsWestEuropeanCountry(country) || (country == Russia) ) - { - // DST begins at 1 a.m. GMT on the last Sunday of March - if ( !dt.SetToLastWeekDay(Sun, Mar, year) ) - { - // weird... - wxFAIL_MSG( _T("no last Sunday in March?") ); - } - - dt += wxTimeSpan::Hours(1); - - // disable DST tests because it could result in an infinite recursion! - dt.MakeGMT(true); - } - else switch ( country ) - { - case USA: - switch ( year ) - { - case 1918: - case 1919: - // don't know for sure - assume it was in effect all year - - case 1943: - case 1944: - case 1945: - dt.Set(1, Jan, year); - break; - - case 1942: - // DST was installed Feb 2, 1942 by the Congress - dt.Set(2, Feb, year); - break; - - // Oil embargo changed the DST period in the US - case 1974: - dt.Set(6, Jan, 1974); - break; - - case 1975: - dt.Set(23, Feb, 1975); - break; - - default: - // before 1986, DST begun on the last Sunday of April, but - // in 1986 Reagan changed it to begin at 2 a.m. of the - // first Sunday in April - if ( year < 1986 ) - { - if ( !dt.SetToLastWeekDay(Sun, Apr, year) ) - { - // weird... - wxFAIL_MSG( _T("no first Sunday in April?") ); - } - } - else if ( year > 2006 ) - // Energy Policy Act of 2005, Pub. L. no. 109-58, 119 Stat 594 (2005). - // Starting in 2007, daylight time begins in the United States on the - // second Sunday in March and ends on the first Sunday in November - { - if ( !dt.SetToWeekDay(Sun, 2, Mar, year) ) - { - // weird... - wxFAIL_MSG( _T("no second Sunday in March?") ); - } - } - else - { - if ( !dt.SetToWeekDay(Sun, 1, Apr, year) ) - { - // weird... - wxFAIL_MSG( _T("no first Sunday in April?") ); - } - } - - dt += wxTimeSpan::Hours(2); - - // TODO what about timezone?? - } - - break; - - default: - // assume Mar 30 as the start of the DST for the rest of the world - // - totally bogus, of course - dt.Set(30, Mar, year); - } - - return dt; -} - -/* static */ -wxDateTime wxDateTime::GetEndDST(int year, Country country) -{ - if ( year == Inv_Year ) - { - // take the current year if none given - year = GetCurrentYear(); - } - - if ( country == Country_Default ) - { - country = GetCountry(); - } - - if ( !IsDSTApplicable(year, country) ) - { - return wxInvalidDateTime; - } - - wxDateTime dt; - - if ( IsWestEuropeanCountry(country) || (country == Russia) ) - { - // DST ends at 1 a.m. GMT on the last Sunday of October - if ( !dt.SetToLastWeekDay(Sun, Oct, year) ) - { - // weirder and weirder... - wxFAIL_MSG( _T("no last Sunday in October?") ); - } - - dt += wxTimeSpan::Hours(1); - - // disable DST tests because it could result in an infinite recursion! - dt.MakeGMT(true); - } - else switch ( country ) - { - case USA: - switch ( year ) - { - case 1918: - case 1919: - // don't know for sure - assume it was in effect all year - - case 1943: - case 1944: - dt.Set(31, Dec, year); - break; - - case 1945: - // the time was reset after the end of the WWII - dt.Set(30, Sep, year); - break; - - default: // default for switch (year) - if ( year > 2006 ) - // Energy Policy Act of 2005, Pub. L. no. 109-58, 119 Stat 594 (2005). - // Starting in 2007, daylight time begins in the United States on the - // second Sunday in March and ends on the first Sunday in November - { - if ( !dt.SetToWeekDay(Sun, 1, Nov, year) ) - { - // weird... - wxFAIL_MSG( _T("no first Sunday in November?") ); - } - } - else - // pre-2007 - // DST ends at 2 a.m. on the last Sunday of October - { - if ( !dt.SetToLastWeekDay(Sun, Oct, year) ) - { - // weirder and weirder... - wxFAIL_MSG( _T("no last Sunday in October?") ); - } - } - - dt += wxTimeSpan::Hours(2); - - // TODO: what about timezone?? - } - break; - - default: // default for switch (country) - // assume October 26th as the end of the DST - totally bogus too - dt.Set(26, Oct, year); - } - - return dt; -} - -// ---------------------------------------------------------------------------- -// constructors and assignment operators -// ---------------------------------------------------------------------------- - -// return the current time with ms precision -/* static */ wxDateTime wxDateTime::UNow() -{ - return wxDateTime(wxGetLocalTimeMillis()); -} - -// the values in the tm structure contain the local time -wxDateTime& wxDateTime::Set(const struct tm& tm) -{ - struct tm tm2(tm); - time_t timet = mktime(&tm2); - - if ( timet == (time_t)-1 ) - { - // mktime() rather unintuitively fails for Jan 1, 1970 if the hour is - // less than timezone - try to make it work for this case - if ( tm2.tm_year == 70 && tm2.tm_mon == 0 && tm2.tm_mday == 1 ) - { - return Set((time_t)( - GetTimeZone() + - tm2.tm_hour * MIN_PER_HOUR * SEC_PER_MIN + - tm2.tm_min * SEC_PER_MIN + - tm2.tm_sec)); - } - - wxFAIL_MSG( _T("mktime() failed") ); - - *this = wxInvalidDateTime; - - return *this; - } - else - { - return Set(timet); - } -} - -wxDateTime& wxDateTime::Set(wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - // we allow seconds to be 61 to account for the leap seconds, even if we - // don't use them really - wxDATETIME_CHECK( hour < 24 && - second < 62 && - minute < 60 && - millisec < 1000, - _T("Invalid time in wxDateTime::Set()") ); - - // get the current date from system - struct tm tmstruct; - struct tm *tm = GetTmNow(&tmstruct); - - wxDATETIME_CHECK( tm, _T("wxLocaltime_r() failed") ); - - // make a copy so it isn't clobbered by the call to mktime() below - struct tm tm1(*tm); - - // adjust the time - tm1.tm_hour = hour; - tm1.tm_min = minute; - tm1.tm_sec = second; - - // and the DST in case it changes on this date - struct tm tm2(tm1); - mktime(&tm2); - if ( tm2.tm_isdst != tm1.tm_isdst ) - tm1.tm_isdst = tm2.tm_isdst; - - (void)Set(tm1); - - // and finally adjust milliseconds - return SetMillisecond(millisec); -} - -wxDateTime& wxDateTime::Set(wxDateTime_t day, - Month month, - int year, - wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - wxDATETIME_CHECK( hour < 24 && - second < 62 && - minute < 60 && - millisec < 1000, - _T("Invalid time in wxDateTime::Set()") ); - - ReplaceDefaultYearMonthWithCurrent(&year, &month); - - wxDATETIME_CHECK( (0 < day) && (day <= GetNumberOfDays(month, year)), - _T("Invalid date in wxDateTime::Set()") ); - - // the range of time_t type (inclusive) - static const int yearMinInRange = 1970; - static const int yearMaxInRange = 2037; - - // test only the year instead of testing for the exact end of the Unix - // time_t range - it doesn't bring anything to do more precise checks - if ( year >= yearMinInRange && year <= yearMaxInRange ) - { - // use the standard library version if the date is in range - this is - // probably more efficient than our code - struct tm tm; - tm.tm_year = year - 1900; - tm.tm_mon = month; - tm.tm_mday = day; - tm.tm_hour = hour; - tm.tm_min = minute; - tm.tm_sec = second; - tm.tm_isdst = -1; // mktime() will guess it - - (void)Set(tm); - - // and finally adjust milliseconds - if (IsValid()) - SetMillisecond(millisec); - - return *this; - } - else - { - // do time calculations ourselves: we want to calculate the number of - // milliseconds between the given date and the epoch - - // get the JDN for the midnight of this day - m_time = GetTruncatedJDN(day, month, year); - m_time -= EPOCH_JDN; - m_time *= SECONDS_PER_DAY * TIME_T_FACTOR; - - // JDN corresponds to GMT, we take localtime - Add(wxTimeSpan(hour, minute, second + GetTimeZone(), millisec)); - } - - return *this; -} - -wxDateTime& wxDateTime::Set(double jdn) -{ - // so that m_time will be 0 for the midnight of Jan 1, 1970 which is jdn - // EPOCH_JDN + 0.5 - jdn -= EPOCH_JDN + 0.5; - - m_time.Assign(jdn*MILLISECONDS_PER_DAY); - - // JDNs always are in UTC, so we don't need any adjustments for time zone - - return *this; -} - -wxDateTime& wxDateTime::ResetTime() -{ - Tm tm = GetTm(); - - if ( tm.hour || tm.min || tm.sec || tm.msec ) - { - tm.msec = - tm.sec = - tm.min = - tm.hour = 0; - - Set(tm); - } - - return *this; -} - -wxDateTime wxDateTime::GetDateOnly() const -{ - Tm tm = GetTm(); - tm.msec = - tm.sec = - tm.min = - tm.hour = 0; - return wxDateTime(tm); -} - -// ---------------------------------------------------------------------------- -// DOS Date and Time Format functions -// ---------------------------------------------------------------------------- -// the dos date and time value is an unsigned 32 bit value in the format: -// YYYYYYYMMMMDDDDDhhhhhmmmmmmsssss -// -// Y = year offset from 1980 (0-127) -// M = month (1-12) -// D = day of month (1-31) -// h = hour (0-23) -// m = minute (0-59) -// s = bisecond (0-29) each bisecond indicates two seconds -// ---------------------------------------------------------------------------- - -wxDateTime& wxDateTime::SetFromDOS(unsigned long ddt) -{ - struct tm tm; - InitTm(tm); - - long year = ddt & 0xFE000000; - year >>= 25; - year += 80; - tm.tm_year = year; - - long month = ddt & 0x1E00000; - month >>= 21; - month -= 1; - tm.tm_mon = month; - - long day = ddt & 0x1F0000; - day >>= 16; - tm.tm_mday = day; - - long hour = ddt & 0xF800; - hour >>= 11; - tm.tm_hour = hour; - - long minute = ddt & 0x7E0; - minute >>= 5; - tm.tm_min = minute; - - long second = ddt & 0x1F; - tm.tm_sec = second * 2; - - return Set(mktime(&tm)); -} - -unsigned long wxDateTime::GetAsDOS() const -{ - unsigned long ddt; - time_t ticks = GetTicks(); - struct tm tmstruct; - struct tm *tm = wxLocaltime_r(&ticks, &tmstruct); - wxCHECK_MSG( tm, ULONG_MAX, _T("time can't be represented in DOS format") ); - - long year = tm->tm_year; - year -= 80; - year <<= 25; - - long month = tm->tm_mon; - month += 1; - month <<= 21; - - long day = tm->tm_mday; - day <<= 16; - - long hour = tm->tm_hour; - hour <<= 11; - - long minute = tm->tm_min; - minute <<= 5; - - long second = tm->tm_sec; - second /= 2; - - ddt = year | month | day | hour | minute | second; - return ddt; -} - -// ---------------------------------------------------------------------------- -// time_t <-> broken down time conversions -// ---------------------------------------------------------------------------- - -wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - time_t time = GetTicks(); - if ( time != (time_t)-1 ) - { - // use C RTL functions - struct tm tmstruct; - tm *tm; - if ( tz.GetOffset() == -GetTimeZone() ) - { - // we are working with local time - tm = wxLocaltime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, Tm(), _T("wxLocaltime_r() failed") ); - } - else - { - time += (time_t)tz.GetOffset(); -#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning - int time2 = (int) time; - if ( time2 >= 0 ) -#else - if ( time >= 0 ) -#endif - { - tm = wxGmtime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, Tm(), _T("wxGmtime_r() failed") ); - } - else - { - tm = (struct tm *)NULL; - } - } - - if ( tm ) - { - // adjust the milliseconds - Tm tm2(*tm, tz); - long timeOnly = (m_time % MILLISECONDS_PER_DAY).ToLong(); - tm2.msec = (wxDateTime_t)(timeOnly % 1000); - return tm2; - } - //else: use generic code below - } - - // remember the time and do the calculations with the date only - this - // eliminates rounding errors of the floating point arithmetics - - wxLongLong timeMidnight = m_time + tz.GetOffset() * 1000; - - long timeOnly = (timeMidnight % MILLISECONDS_PER_DAY).ToLong(); - - // we want to always have positive time and timeMidnight to be really - // the midnight before it - if ( timeOnly < 0 ) - { - timeOnly = MILLISECONDS_PER_DAY + timeOnly; - } - - timeMidnight -= timeOnly; - - // calculate the Gregorian date from JDN for the midnight of our date: - // this will yield day, month (in 1..12 range) and year - - // actually, this is the JDN for the noon of the previous day - long jdn = (timeMidnight / MILLISECONDS_PER_DAY).ToLong() + EPOCH_JDN; - - // CREDIT: code below is by Scott E. Lee (but bugs are mine) - - wxASSERT_MSG( jdn > -2, _T("JDN out of range") ); - - // calculate the century - long temp = (jdn + JDN_OFFSET) * 4 - 1; - long century = temp / DAYS_PER_400_YEARS; - - // then the year and day of year (1 <= dayOfYear <= 366) - temp = ((temp % DAYS_PER_400_YEARS) / 4) * 4 + 3; - long year = (century * 100) + (temp / DAYS_PER_4_YEARS); - long dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1; - - // and finally the month and day of the month - temp = dayOfYear * 5 - 3; - long month = temp / DAYS_PER_5_MONTHS; - long day = (temp % DAYS_PER_5_MONTHS) / 5 + 1; - - // month is counted from March - convert to normal - if ( month < 10 ) - { - month += 3; - } - else - { - year += 1; - month -= 9; - } - - // year is offset by 4800 - year -= 4800; - - // check that the algorithm gave us something reasonable - wxASSERT_MSG( (0 < month) && (month <= 12), _T("invalid month") ); - wxASSERT_MSG( (1 <= day) && (day < 32), _T("invalid day") ); - - // construct Tm from these values - Tm tm; - tm.year = (int)year; - tm.mon = (Month)(month - 1); // algorithm yields 1 for January, not 0 - tm.mday = (wxDateTime_t)day; - tm.msec = (wxDateTime_t)(timeOnly % 1000); - timeOnly -= tm.msec; - timeOnly /= 1000; // now we have time in seconds - - tm.sec = (wxDateTime_t)(timeOnly % SEC_PER_MIN); - timeOnly -= tm.sec; - timeOnly /= SEC_PER_MIN; // now we have time in minutes - - tm.min = (wxDateTime_t)(timeOnly % MIN_PER_HOUR); - timeOnly -= tm.min; - - tm.hour = (wxDateTime_t)(timeOnly / MIN_PER_HOUR); - - return tm; -} - -wxDateTime& wxDateTime::SetYear(int year) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.year = year; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetMonth(Month month) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.mon = month; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetDay(wxDateTime_t mday) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.mday = mday; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetHour(wxDateTime_t hour) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.hour = hour; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetMinute(wxDateTime_t min) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.min = min; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetSecond(wxDateTime_t sec) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - Tm tm(GetTm()); - tm.sec = sec; - Set(tm); - - return *this; -} - -wxDateTime& wxDateTime::SetMillisecond(wxDateTime_t millisecond) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); - - // we don't need to use GetTm() for this one - m_time -= m_time % 1000l; - m_time += millisecond; - - return *this; -} - -// ---------------------------------------------------------------------------- -// wxDateTime arithmetics -// ---------------------------------------------------------------------------- - -wxDateTime& wxDateTime::Add(const wxDateSpan& diff) -{ - Tm tm(GetTm()); - - tm.year += diff.GetYears(); - tm.AddMonths(diff.GetMonths()); - - // check that the resulting date is valid - if ( tm.mday > GetNumOfDaysInMonth(tm.year, tm.mon) ) - { - // We suppose that when adding one month to Jan 31 we want to get Feb - // 28 (or 29), i.e. adding a month to the last day of the month should - // give the last day of the next month which is quite logical. - // - // Unfortunately, there is no logic way to understand what should - // Jan 30 + 1 month be - Feb 28 too or Feb 27 (assuming non leap year)? - // We make it Feb 28 (last day too), but it is highly questionable. - tm.mday = GetNumOfDaysInMonth(tm.year, tm.mon); - } - - tm.AddDays(diff.GetTotalDays()); - - Set(tm); - - wxASSERT_MSG( IsSameTime(tm), - _T("Add(wxDateSpan) shouldn't modify time") ); - - return *this; -} - -// ---------------------------------------------------------------------------- -// Weekday and monthday stuff -// ---------------------------------------------------------------------------- - -// convert Sun, Mon, ..., Sat into 6, 0, ..., 5 -static inline int ConvertWeekDayToMondayBase(int wd) -{ - return wd == wxDateTime::Sun ? 6 : wd - 1; -} - -/* static */ -wxDateTime -wxDateTime::SetToWeekOfYear(int year, wxDateTime_t numWeek, WeekDay wd) -{ - wxASSERT_MSG( numWeek > 0, - _T("invalid week number: weeks are counted from 1") ); - - // Jan 4 always lies in the 1st week of the year - wxDateTime dt(4, Jan, year); - dt.SetToWeekDayInSameWeek(wd); - dt += wxDateSpan::Weeks(numWeek - 1); - - return dt; -} - -#if WXWIN_COMPATIBILITY_2_6 -// use a separate function to avoid warnings about using deprecated -// SetToTheWeek in GetWeek below -static wxDateTime -SetToTheWeek(int year, - wxDateTime::wxDateTime_t numWeek, - wxDateTime::WeekDay weekday, - wxDateTime::WeekFlags flags) -{ - // Jan 4 always lies in the 1st week of the year - wxDateTime dt(4, wxDateTime::Jan, year); - dt.SetToWeekDayInSameWeek(weekday, flags); - dt += wxDateSpan::Weeks(numWeek - 1); - - return dt; -} - -bool wxDateTime::SetToTheWeek(wxDateTime_t numWeek, - WeekDay weekday, - WeekFlags flags) -{ - int year = GetYear(); - *this = ::SetToTheWeek(year, numWeek, weekday, flags); - if ( GetYear() != year ) - { - // oops... numWeek was too big - return false; - } - - return true; -} - -wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, - WeekDay weekday, - WeekFlags flags) const -{ - return ::SetToTheWeek(GetYear(), numWeek, weekday, flags); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -wxDateTime& wxDateTime::SetToLastMonthDay(Month month, - int year) -{ - // take the current month/year if none specified - if ( year == Inv_Year ) - year = GetYear(); - if ( month == Inv_Month ) - month = GetMonth(); - - return Set(GetNumOfDaysInMonth(year, month), month, year); -} - -wxDateTime& wxDateTime::SetToWeekDayInSameWeek(WeekDay weekday, WeekFlags flags) -{ - wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); - - int wdayDst = weekday, - wdayThis = GetWeekDay(); - if ( wdayDst == wdayThis ) - { - // nothing to do - return *this; - } - - if ( flags == Default_First ) - { - flags = GetCountry() == USA ? Sunday_First : Monday_First; - } - - // the logic below based on comparing weekday and wdayThis works if Sun (0) - // is the first day in the week, but breaks down for Monday_First case so - // we adjust the week days in this case - if ( flags == Monday_First ) - { - if ( wdayThis == Sun ) - wdayThis += 7; - if ( wdayDst == Sun ) - wdayDst += 7; - } - //else: Sunday_First, nothing to do - - // go forward or back in time to the day we want - if ( wdayDst < wdayThis ) - { - return Subtract(wxDateSpan::Days(wdayThis - wdayDst)); - } - else // weekday > wdayThis - { - return Add(wxDateSpan::Days(wdayDst - wdayThis)); - } -} - -wxDateTime& wxDateTime::SetToNextWeekDay(WeekDay weekday) -{ - wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); - - int diff; - WeekDay wdayThis = GetWeekDay(); - if ( weekday == wdayThis ) - { - // nothing to do - return *this; - } - else if ( weekday < wdayThis ) - { - // need to advance a week - diff = 7 - (wdayThis - weekday); - } - else // weekday > wdayThis - { - diff = weekday - wdayThis; - } - - return Add(wxDateSpan::Days(diff)); -} - -wxDateTime& wxDateTime::SetToPrevWeekDay(WeekDay weekday) -{ - wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); - - int diff; - WeekDay wdayThis = GetWeekDay(); - if ( weekday == wdayThis ) - { - // nothing to do - return *this; - } - else if ( weekday > wdayThis ) - { - // need to go to previous week - diff = 7 - (weekday - wdayThis); - } - else // weekday < wdayThis - { - diff = wdayThis - weekday; - } - - return Subtract(wxDateSpan::Days(diff)); -} - -bool wxDateTime::SetToWeekDay(WeekDay weekday, - int n, - Month month, - int year) -{ - wxCHECK_MSG( weekday != Inv_WeekDay, false, _T("invalid weekday") ); - - // we don't check explicitly that -5 <= n <= 5 because we will return false - // anyhow in such case - but may be should still give an assert for it? - - // take the current month/year if none specified - ReplaceDefaultYearMonthWithCurrent(&year, &month); - - wxDateTime dt; - - // TODO this probably could be optimised somehow... - - if ( n > 0 ) - { - // get the first day of the month - dt.Set(1, month, year); - - // get its wday - WeekDay wdayFirst = dt.GetWeekDay(); - - // go to the first weekday of the month - int diff = weekday - wdayFirst; - if ( diff < 0 ) - diff += 7; - - // add advance n-1 weeks more - diff += 7*(n - 1); - - dt += wxDateSpan::Days(diff); - } - else // count from the end of the month - { - // get the last day of the month - dt.SetToLastMonthDay(month, year); - - // get its wday - WeekDay wdayLast = dt.GetWeekDay(); - - // go to the last weekday of the month - int diff = wdayLast - weekday; - if ( diff < 0 ) - diff += 7; - - // and rewind n-1 weeks from there - diff += 7*(-n - 1); - - dt -= wxDateSpan::Days(diff); - } - - // check that it is still in the same month - if ( dt.GetMonth() == month ) - { - *this = dt; - - return true; - } - else - { - // no such day in this month - return false; - } -} - -static inline -wxDateTime::wxDateTime_t GetDayOfYearFromTm(const wxDateTime::Tm& tm) -{ - return (wxDateTime::wxDateTime_t)(gs_cumulatedDays[wxDateTime::IsLeapYear(tm.year)][tm.mon] + tm.mday); -} - -wxDateTime::wxDateTime_t wxDateTime::GetDayOfYear(const TimeZone& tz) const -{ - return GetDayOfYearFromTm(GetTm(tz)); -} - -wxDateTime::wxDateTime_t -wxDateTime::GetWeekOfYear(wxDateTime::WeekFlags flags, const TimeZone& tz) const -{ - if ( flags == Default_First ) - { - flags = GetCountry() == USA ? Sunday_First : Monday_First; - } - - Tm tm(GetTm(tz)); - wxDateTime_t nDayInYear = GetDayOfYearFromTm(tm); - - int wdTarget = GetWeekDay(tz); - int wdYearStart = wxDateTime(1, Jan, GetYear()).GetWeekDay(); - int week; - if ( flags == Sunday_First ) - { - // FIXME: First week is not calculated correctly. - week = (nDayInYear - wdTarget + 7) / 7; - if ( wdYearStart == Wed || wdYearStart == Thu ) - week++; - } - else // week starts with monday - { - // adjust the weekdays to non-US style. - wdYearStart = ConvertWeekDayToMondayBase(wdYearStart); - wdTarget = ConvertWeekDayToMondayBase(wdTarget); - - // quoting from http://www.cl.cam.ac.uk/~mgk25/iso-time.html: - // - // Week 01 of a year is per definition the first week that has the - // Thursday in this year, which is equivalent to the week that - // contains the fourth day of January. In other words, the first - // week of a new year is the week that has the majority of its - // days in the new year. Week 01 might also contain days from the - // previous year and the week before week 01 of a year is the last - // week (52 or 53) of the previous year even if it contains days - // from the new year. A week starts with Monday (day 1) and ends - // with Sunday (day 7). - // - - // if Jan 1 is Thursday or less, it is in the first week of this year - if ( wdYearStart < 4 ) - { - // count the number of entire weeks between Jan 1 and this date - week = (nDayInYear + wdYearStart + 6 - wdTarget)/7; - - // be careful to check for overflow in the next year - if ( week == 53 && tm.mday - wdTarget > 28 ) - week = 1; - } - else // Jan 1 is in the last week of the previous year - { - // check if we happen to be at the last week of previous year: - if ( tm.mon == Jan && tm.mday < 8 - wdYearStart ) - week = wxDateTime(31, Dec, GetYear()-1).GetWeekOfYear(); - else - week = (nDayInYear + wdYearStart - 1 - wdTarget)/7; - } - } - - return (wxDateTime::wxDateTime_t)week; -} - -wxDateTime::wxDateTime_t wxDateTime::GetWeekOfMonth(wxDateTime::WeekFlags flags, - const TimeZone& tz) const -{ - Tm tm = GetTm(tz); - const wxDateTime dateFirst = wxDateTime(1, tm.mon, tm.year); - const wxDateTime::WeekDay wdFirst = dateFirst.GetWeekDay(); - - if ( flags == Default_First ) - { - flags = GetCountry() == USA ? Sunday_First : Monday_First; - } - - // compute offset of dateFirst from the beginning of the week - int firstOffset; - if ( flags == Sunday_First ) - firstOffset = wdFirst - Sun; - else - firstOffset = wdFirst == Sun ? DAYS_PER_WEEK - 1 : wdFirst - Mon; - - return (wxDateTime::wxDateTime_t)((tm.mday - 1 + firstOffset)/7 + 1); -} - -wxDateTime& wxDateTime::SetToYearDay(wxDateTime::wxDateTime_t yday) -{ - int year = GetYear(); - wxDATETIME_CHECK( (0 < yday) && (yday <= GetNumberOfDays(year)), - _T("invalid year day") ); - - bool isLeap = IsLeapYear(year); - for ( Month mon = Jan; mon < Inv_Month; wxNextMonth(mon) ) - { - // for Dec, we can't compare with gs_cumulatedDays[mon + 1], but we - // don't need it neither - because of the CHECK above we know that - // yday lies in December then - if ( (mon == Dec) || (yday <= gs_cumulatedDays[isLeap][mon + 1]) ) - { - Set((wxDateTime::wxDateTime_t)(yday - gs_cumulatedDays[isLeap][mon]), mon, year); - - break; - } - } - - return *this; -} - -// ---------------------------------------------------------------------------- -// Julian day number conversion and related stuff -// ---------------------------------------------------------------------------- - -double wxDateTime::GetJulianDayNumber() const -{ - return m_time.ToDouble() / MILLISECONDS_PER_DAY + EPOCH_JDN + 0.5; -} - -double wxDateTime::GetRataDie() const -{ - // March 1 of the year 0 is Rata Die day -306 and JDN 1721119.5 - return GetJulianDayNumber() - 1721119.5 - 306; -} - -// ---------------------------------------------------------------------------- -// timezone and DST stuff -// ---------------------------------------------------------------------------- - -int wxDateTime::IsDST(wxDateTime::Country country) const -{ - wxCHECK_MSG( country == Country_Default, -1, - _T("country support not implemented") ); - - // use the C RTL for the dates in the standard range - time_t timet = GetTicks(); - if ( timet != (time_t)-1 ) - { - struct tm tmstruct; - tm *tm = wxLocaltime_r(&timet, &tmstruct); - - wxCHECK_MSG( tm, -1, _T("wxLocaltime_r() failed") ); - - return tm->tm_isdst; - } - else - { - int year = GetYear(); - - if ( !IsDSTApplicable(year, country) ) - { - // no DST time in this year in this country - return -1; - } - - return IsBetween(GetBeginDST(year, country), GetEndDST(year, country)); - } -} - -wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) -{ - long secDiff = GetTimeZone() + tz.GetOffset(); - - // we need to know whether DST is or not in effect for this date unless - // the test disabled by the caller - if ( !noDST && (IsDST() == 1) ) - { - // FIXME we assume that the DST is always shifted by 1 hour - secDiff -= 3600; - } - - return Add(wxTimeSpan::Seconds(secDiff)); -} - -wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) -{ - long secDiff = GetTimeZone() + tz.GetOffset(); - - // we need to know whether DST is or not in effect for this date unless - // the test disabled by the caller - if ( !noDST && (IsDST() == 1) ) - { - // FIXME we assume that the DST is always shifted by 1 hour - secDiff -= 3600; - } - - return Subtract(wxTimeSpan::Seconds(secDiff)); -} - -// ---------------------------------------------------------------------------- -// wxDateTime to/from text representations -// ---------------------------------------------------------------------------- - -wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const -{ - wxCHECK_MSG( format, wxEmptyString, _T("NULL format in wxDateTime::Format") ); - - time_t time = GetTicks(); - - // we have to use our own implementation if the date is out of range of - // strftime() or if we use non standard specificators -#ifdef HAVE_STRFTIME - if ( (time != (time_t)-1) && !wxStrstr(format, _T("%l")) ) - { - // use strftime() - struct tm tmstruct; - struct tm *tm; - if ( tz.GetOffset() == -GetTimeZone() ) - { - // we are working with local time - tm = wxLocaltime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, wxEmptyString, _T("wxLocaltime_r() failed") ); - } - else - { - time += (int)tz.GetOffset(); - -#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning - int time2 = (int) time; - if ( time2 >= 0 ) -#else - if ( time >= 0 ) -#endif - { - tm = wxGmtime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, wxEmptyString, _T("wxGmtime_r() failed") ); - } - else - { - tm = (struct tm *)NULL; - } - } - - if ( tm ) - { - return CallStrftime(format, tm); - } - } - //else: use generic code below -#endif // HAVE_STRFTIME - - // we only parse ANSI C format specifications here, no POSIX 2 - // complications, no GNU extensions but we do add support for a "%l" format - // specifier allowing to get the number of milliseconds - Tm tm = GetTm(tz); - - // used for calls to strftime() when we only deal with time - struct tm tmTimeOnly; - memset(&tmTimeOnly, 0, sizeof(tmTimeOnly)); - tmTimeOnly.tm_hour = tm.hour; - tmTimeOnly.tm_min = tm.min; - tmTimeOnly.tm_sec = tm.sec; - tmTimeOnly.tm_wday = 0; - tmTimeOnly.tm_yday = 0; - tmTimeOnly.tm_mday = 1; // any date will do, use 1976-01-01 - tmTimeOnly.tm_mon = 0; - tmTimeOnly.tm_year = 76; - tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves - - wxString tmp, res, fmt; - for ( const wxChar *p = format; *p; p++ ) - { - if ( *p != _T('%') ) - { - // copy as is - res += *p; - - continue; - } - - // set the default format - switch ( *++p ) - { - case _T('Y'): // year has 4 digits - fmt = _T("%04d"); - break; - - case _T('j'): // day of year has 3 digits - case _T('l'): // milliseconds have 3 digits - fmt = _T("%03d"); - break; - - case _T('w'): // week day as number has only one - fmt = _T("%d"); - break; - - default: - // it's either another valid format specifier in which case - // the format is "%02d" (for all the rest) or we have the - // field width preceding the format in which case it will - // override the default format anyhow - fmt = _T("%02d"); - } - - bool restart = true; - while ( restart ) - { - restart = false; - - // start of the format specification - switch ( *p ) - { - case _T('a'): // a weekday name - case _T('A'): - // second parameter should be true for abbreviated names - res += GetWeekDayName(tm.GetWeekDay(), - *p == _T('a') ? Name_Abbr : Name_Full); - break; - - case _T('b'): // a month name - case _T('B'): - res += GetMonthName(tm.mon, - *p == _T('b') ? Name_Abbr : Name_Full); - break; - - case _T('c'): // locale default date and time representation - case _T('x'): // locale default date representation -#ifdef HAVE_STRFTIME - // - // the problem: there is no way to know what do these format - // specifications correspond to for the current locale. - // - // the solution: use a hack and still use strftime(): first - // find the YEAR which is a year in the strftime() range (1970 - // - 2038) whose Jan 1 falls on the same week day as the Jan 1 - // of the real year. Then make a copy of the format and - // replace all occurrences of YEAR in it with some unique - // string not appearing anywhere else in it, then use - // strftime() to format the date in year YEAR and then replace - // YEAR back by the real year and the unique replacement - // string back with YEAR. Notice that "all occurrences of YEAR" - // means all occurrences of 4 digit as well as 2 digit form! - // - // the bugs: we assume that neither of %c nor %x contains any - // fields which may change between the YEAR and real year. For - // example, the week number (%U, %W) and the day number (%j) - // will change if one of these years is leap and the other one - // is not! - { - // find the YEAR: normally, for any year X, Jan 1 or the - // year X + 28 is the same weekday as Jan 1 of X (because - // the weekday advances by 1 for each normal X and by 2 - // for each leap X, hence by 5 every 4 years or by 35 - // which is 0 mod 7 every 28 years) but this rule breaks - // down if there are years between X and Y which are - // divisible by 4 but not leap (i.e. divisible by 100 but - // not 400), hence the correction. - - int yearReal = GetYear(tz); - int mod28 = yearReal % 28; - - // be careful to not go too far - we risk to leave the - // supported range - int year; - if ( mod28 < 10 ) - { - year = 1988 + mod28; // 1988 == 0 (mod 28) - } - else - { - year = 1970 + mod28 - 10; // 1970 == 10 (mod 28) - } - - int nCentury = year / 100, - nCenturyReal = yearReal / 100; - - // need to adjust for the years divisble by 400 which are - // not leap but are counted like leap ones if we just take - // the number of centuries in between for nLostWeekDays - int nLostWeekDays = (nCentury - nCenturyReal) - - (nCentury / 4 - nCenturyReal / 4); - - // we have to gain back the "lost" weekdays: note that the - // effect of this loop is to not do anything to - // nLostWeekDays (which we won't use any more), but to - // (indirectly) set the year correctly - while ( (nLostWeekDays % 7) != 0 ) - { - nLostWeekDays += year++ % 4 ? 1 : 2; - } - - // Keep year below 2000 so the 2digit year number - // can never match the month or day of the month - if (year>=2000) year-=28; - // at any rate, we couldn't go further than 1988 + 9 + 28! - wxASSERT_MSG( year < 2030, - _T("logic error in wxDateTime::Format") ); - - wxString strYear, strYear2; - strYear.Printf(_T("%d"), year); - strYear2.Printf(_T("%d"), year % 100); - - // find four strings not occurring in format (this is surely - // not the optimal way of doing it... improvements welcome!) - wxString fmt2 = format; - wxString replacement,replacement2,replacement3,replacement4; - for (int rnr=1; rnr<5 ; rnr++) - { - wxString r = (wxChar)-rnr; - while ( fmt2.Find(r) != wxNOT_FOUND ) - { - r << (wxChar)-rnr; - } - - switch (rnr) - { - case 1: replacement=r; break; - case 2: replacement2=r; break; - case 3: replacement3=r; break; - case 4: replacement4=r; break; - } - } - // replace all occurrences of year with it - bool wasReplaced = fmt2.Replace(strYear, replacement) > 0; - // evaluation order ensures we always attempt the replacement. - wasReplaced = (fmt2.Replace(strYear2, replacement2) > 0) || wasReplaced; - - // use strftime() to format the same date but in supported - // year - // - // NB: we assume that strftime() doesn't check for the - // date validity and will happily format the date - // corresponding to Feb 29 of a non leap year (which - // may happen if yearReal was leap and year is not) - struct tm tmAdjusted; - InitTm(tmAdjusted); - tmAdjusted.tm_hour = tm.hour; - tmAdjusted.tm_min = tm.min; - tmAdjusted.tm_sec = tm.sec; - tmAdjusted.tm_wday = tm.GetWeekDay(); - tmAdjusted.tm_yday = GetDayOfYear(); - tmAdjusted.tm_mday = tm.mday; - tmAdjusted.tm_mon = tm.mon; - tmAdjusted.tm_year = year - 1900; - tmAdjusted.tm_isdst = 0; // no DST, already adjusted - wxString str = CallStrftime(*p == _T('c') ? _T("%c") - : _T("%x"), - &tmAdjusted); - - // now replace the occurrence of 1999 with the real year - // we do this in two stages to stop the 2 digit year - // matching any substring of the 4 digit year. - // Any day,month hours and minutes components should be safe due - // to ensuring the range of the years. - wxString strYearReal, strYearReal2; - strYearReal.Printf(_T("%04d"), yearReal); - strYearReal2.Printf(_T("%02d"), yearReal % 100); - str.Replace(strYear, replacement3); - str.Replace(strYear2,replacement4); - str.Replace(replacement3, strYearReal); - str.Replace(replacement4, strYearReal2); - - // and replace back all occurrences of replacement string - if ( wasReplaced ) - { - str.Replace(replacement2, strYear2); - str.Replace(replacement, strYear); - } - - res += str; - } -#else // !HAVE_STRFTIME - // Use "%m/%d/%y %H:%M:%S" format instead - res += wxString::Format(wxT("%02d/%02d/%04d %02d:%02d:%02d"), - tm.mon+1,tm.mday, tm.year, tm.hour, tm.min, tm.sec); -#endif // HAVE_STRFTIME/!HAVE_STRFTIME - break; - - case _T('d'): // day of a month (01-31) - res += wxString::Format(fmt, tm.mday); - break; - - case _T('H'): // hour in 24h format (00-23) - res += wxString::Format(fmt, tm.hour); - break; - - case _T('I'): // hour in 12h format (01-12) - { - // 24h -> 12h, 0h -> 12h too - int hour12 = tm.hour > 12 ? tm.hour - 12 - : tm.hour ? tm.hour : 12; - res += wxString::Format(fmt, hour12); - } - break; - - case _T('j'): // day of the year - res += wxString::Format(fmt, GetDayOfYear(tz)); - break; - - case _T('l'): // milliseconds (NOT STANDARD) - res += wxString::Format(fmt, GetMillisecond(tz)); - break; - - case _T('m'): // month as a number (01-12) - res += wxString::Format(fmt, tm.mon + 1); - break; - - case _T('M'): // minute as a decimal number (00-59) - res += wxString::Format(fmt, tm.min); - break; - - case _T('p'): // AM or PM string -#ifdef HAVE_STRFTIME - res += CallStrftime(_T("%p"), &tmTimeOnly); -#else // !HAVE_STRFTIME - res += (tmTimeOnly.tm_hour > 12) ? wxT("pm") : wxT("am"); -#endif // HAVE_STRFTIME/!HAVE_STRFTIME - break; - - case _T('S'): // second as a decimal number (00-61) - res += wxString::Format(fmt, tm.sec); - break; - - case _T('U'): // week number in the year (Sunday 1st week day) - res += wxString::Format(fmt, GetWeekOfYear(Sunday_First, tz)); - break; - - case _T('W'): // week number in the year (Monday 1st week day) - res += wxString::Format(fmt, GetWeekOfYear(Monday_First, tz)); - break; - - case _T('w'): // weekday as a number (0-6), Sunday = 0 - res += wxString::Format(fmt, tm.GetWeekDay()); - break; - - // case _T('x'): -- handled with "%c" - - case _T('X'): // locale default time representation - // just use strftime() to format the time for us -#ifdef HAVE_STRFTIME - res += CallStrftime(_T("%X"), &tmTimeOnly); -#else // !HAVE_STRFTIME - res += wxString::Format(wxT("%02d:%02d:%02d"),tm.hour, tm.min, tm.sec); -#endif // HAVE_STRFTIME/!HAVE_STRFTIME - break; - - case _T('y'): // year without century (00-99) - res += wxString::Format(fmt, tm.year % 100); - break; - - case _T('Y'): // year with century - res += wxString::Format(fmt, tm.year); - break; - - case _T('Z'): // timezone name -#ifdef HAVE_STRFTIME - res += CallStrftime(_T("%Z"), &tmTimeOnly); -#endif - break; - - default: - // is it the format width? - for( fmt.clear(); - *p == _T('-') || *p == _T('+') || - *p == _T(' ') || wxIsdigit(*p); - ++p ) - { - fmt += *p; - } - - if ( !fmt.empty() ) - { - // we've only got the flags and width so far in fmt - fmt.Prepend(_T('%')); - fmt.Append(_T('d')); - - restart = true; - - break; - } - - // no, it wasn't the width - wxFAIL_MSG(_T("unknown format specificator")); - - // fall through and just copy it nevertheless - - case _T('%'): // a percent sign - res += *p; - break; - - case 0: // the end of string - wxFAIL_MSG(_T("missing format at the end of string")); - - // just put the '%' which was the last char in format - res += _T('%'); - break; - } - } - } - - return res; -} - -// this function parses a string in (strict) RFC 822 format: see the section 5 -// of the RFC for the detailed description, but briefly it's something of the -// form "Sat, 18 Dec 1999 00:48:30 +0100" -// -// this function is "strict" by design - it must reject anything except true -// RFC822 time specs. -// -// TODO a great candidate for using reg exps -const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) -{ - wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); - - const wxChar *p = date; - const wxChar *comma = wxStrchr(p, _T(',')); - if ( comma ) - { - // the part before comma is the weekday - - // skip it for now - we don't use but might check that it really - // corresponds to the specfied date - p = comma + 1; - - if ( *p != _T(' ') ) - { - wxLogDebug(_T("no space after weekday in RFC822 time spec")); - - return (wxChar *)NULL; - } - - p++; // skip space - } - - // the following 1 or 2 digits are the day number - if ( !wxIsdigit(*p) ) - { - wxLogDebug(_T("day number expected in RFC822 time spec, none found")); - - return (wxChar *)NULL; - } - - wxDateTime_t day = (wxDateTime_t)(*p++ - _T('0')); - if ( wxIsdigit(*p) ) - { - day *= 10; - day = (wxDateTime_t)(day + (*p++ - _T('0'))); - } - - if ( *p++ != _T(' ') ) - { - return (wxChar *)NULL; - } - - // the following 3 letters specify the month - wxString monName(p, 3); - Month mon; - if ( monName == _T("Jan") ) - mon = Jan; - else if ( monName == _T("Feb") ) - mon = Feb; - else if ( monName == _T("Mar") ) - mon = Mar; - else if ( monName == _T("Apr") ) - mon = Apr; - else if ( monName == _T("May") ) - mon = May; - else if ( monName == _T("Jun") ) - mon = Jun; - else if ( monName == _T("Jul") ) - mon = Jul; - else if ( monName == _T("Aug") ) - mon = Aug; - else if ( monName == _T("Sep") ) - mon = Sep; - else if ( monName == _T("Oct") ) - mon = Oct; - else if ( monName == _T("Nov") ) - mon = Nov; - else if ( monName == _T("Dec") ) - mon = Dec; - else - { - wxLogDebug(_T("Invalid RFC 822 month name '%s'"), monName.c_str()); - - return (wxChar *)NULL; - } - - p += 3; - - if ( *p++ != _T(' ') ) - { - return (wxChar *)NULL; - } - - // next is the year - if ( !wxIsdigit(*p) ) - { - // no year? - return (wxChar *)NULL; - } - - int year = *p++ - _T('0'); - - if ( !wxIsdigit(*p) ) - { - // should have at least 2 digits in the year - return (wxChar *)NULL; - } - - year *= 10; - year += *p++ - _T('0'); - - // is it a 2 digit year (as per original RFC 822) or a 4 digit one? - if ( wxIsdigit(*p) ) - { - year *= 10; - year += *p++ - _T('0'); - - if ( !wxIsdigit(*p) ) - { - // no 3 digit years please - return (wxChar *)NULL; - } - - year *= 10; - year += *p++ - _T('0'); - } - - if ( *p++ != _T(' ') ) - { - return (wxChar *)NULL; - } - - // time is in the format hh:mm:ss and seconds are optional - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - wxDateTime_t hour = (wxDateTime_t)(*p++ - _T('0')); - - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - hour *= 10; - hour = (wxDateTime_t)(hour + (*p++ - _T('0'))); - - if ( *p++ != _T(':') ) - { - return (wxChar *)NULL; - } - - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - wxDateTime_t min = (wxDateTime_t)(*p++ - _T('0')); - - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - min *= 10; - min = (wxDateTime_t)(min + *p++ - _T('0')); - - wxDateTime_t sec = 0; - if ( *p == _T(':') ) - { - p++; - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - sec = (wxDateTime_t)(*p++ - _T('0')); - - if ( !wxIsdigit(*p) ) - { - return (wxChar *)NULL; - } - - sec *= 10; - sec = (wxDateTime_t)(sec + *p++ - _T('0')); - } - - if ( *p++ != _T(' ') ) - { - return (wxChar *)NULL; - } - - // and now the interesting part: the timezone - int offset wxDUMMY_INITIALIZE(0); - if ( *p == _T('-') || *p == _T('+') ) - { - // the explicit offset given: it has the form of hhmm - bool plus = *p++ == _T('+'); - - if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) - { - return (wxChar *)NULL; - } - - // hours - offset = MIN_PER_HOUR*(10*(*p - _T('0')) + (*(p + 1) - _T('0'))); - - p += 2; - - if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) - { - return (wxChar *)NULL; - } - - // minutes - offset += 10*(*p - _T('0')) + (*(p + 1) - _T('0')); - - if ( !plus ) - { - offset = -offset; - } - - p += 2; - } - else - { - // the symbolic timezone given: may be either military timezone or one - // of standard abbreviations - if ( !*(p + 1) ) - { - // military: Z = UTC, J unused, A = -1, ..., Y = +12 - static const int offsets[26] = - { - //A B C D E F G H I J K L M - -1, -2, -3, -4, -5, -6, -7, -8, -9, 0, -10, -11, -12, - //N O P R Q S T U V W Z Y Z - +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, 0 - }; - - if ( *p < _T('A') || *p > _T('Z') || *p == _T('J') ) - { - wxLogDebug(_T("Invalid militaty timezone '%c'"), *p); - - return (wxChar *)NULL; - } - - offset = offsets[*p++ - _T('A')]; - } - else - { - // abbreviation - wxString tz = p; - if ( tz == _T("UT") || tz == _T("UTC") || tz == _T("GMT") ) - offset = 0; - else if ( tz == _T("AST") ) - offset = AST - GMT0; - else if ( tz == _T("ADT") ) - offset = ADT - GMT0; - else if ( tz == _T("EST") ) - offset = EST - GMT0; - else if ( tz == _T("EDT") ) - offset = EDT - GMT0; - else if ( tz == _T("CST") ) - offset = CST - GMT0; - else if ( tz == _T("CDT") ) - offset = CDT - GMT0; - else if ( tz == _T("MST") ) - offset = MST - GMT0; - else if ( tz == _T("MDT") ) - offset = MDT - GMT0; - else if ( tz == _T("PST") ) - offset = PST - GMT0; - else if ( tz == _T("PDT") ) - offset = PDT - GMT0; - else - { - wxLogDebug(_T("Unknown RFC 822 timezone '%s'"), p); - - return (wxChar *)NULL; - } - - p += tz.length(); - } - - // make it minutes - offset *= MIN_PER_HOUR; - } - - // the spec was correct, construct the date from the values we found - Set(day, mon, year, hour, min, sec); - MakeFromTimezone(TimeZone::Make(offset*SEC_PER_MIN)); - - return p; -} - -#ifdef __WINDOWS__ - -// returns the string containing strftime() format used for short dates in the -// current locale or an empty string -static wxString GetLocaleDateFormat() -{ - wxString fmtWX; - - // there is no setlocale() under Windows CE, so just always query the - // system there -#ifndef __WXWINCE__ - if ( strcmp(setlocale(LC_ALL, NULL), "C") != 0 ) -#endif - { - // The locale was programatically set to non-C. We assume that this was - // done using wxLocale, in which case thread's current locale is also - // set to correct LCID value and we can use GetLocaleInfo to determine - // the correct formatting string: -#ifdef __WXWINCE__ - LCID lcid = LOCALE_USER_DEFAULT; -#else - LCID lcid = GetThreadLocale(); -#endif - // according to MSDN 80 chars is max allowed for short date format - wxChar fmt[81]; - if ( ::GetLocaleInfo(lcid, LOCALE_SSHORTDATE, fmt, WXSIZEOF(fmt)) ) - { - wxChar chLast = _T('\0'); - size_t lastCount = 0; - for ( const wxChar *p = fmt; /* NUL handled inside */; p++ ) - { - if ( *p == chLast ) - { - lastCount++; - continue; - } - - switch ( *p ) - { - // these characters come in groups, start counting them - case _T('d'): - case _T('M'): - case _T('y'): - case _T('g'): - chLast = *p; - lastCount = 1; - break; - - default: - // first deal with any special characters we have had - if ( lastCount ) - { - switch ( chLast ) - { - case _T('d'): - switch ( lastCount ) - { - case 1: // d - case 2: // dd - // these two are the same as we - // don't distinguish between 1 and - // 2 digits for days - fmtWX += _T("%d"); - break; - - case 3: // ddd - fmtWX += _T("%a"); - break; - - case 4: // dddd - fmtWX += _T("%A"); - break; - - default: - wxFAIL_MSG( _T("too many 'd's") ); - } - break; - - case _T('M'): - switch ( lastCount ) - { - case 1: // M - case 2: // MM - // as for 'd' and 'dd' above - fmtWX += _T("%m"); - break; - - case 3: - fmtWX += _T("%b"); - break; - - case 4: - fmtWX += _T("%B"); - break; - - default: - wxFAIL_MSG( _T("too many 'M's") ); - } - break; - - case _T('y'): - switch ( lastCount ) - { - case 1: // y - case 2: // yy - fmtWX += _T("%y"); - break; - - case 4: // yyyy - fmtWX += _T("%Y"); - break; - - default: - wxFAIL_MSG( _T("wrong number of 'y's") ); - } - break; - - case _T('g'): - // strftime() doesn't have era string, - // ignore this format - wxASSERT_MSG( lastCount <= 2, - _T("too many 'g's") ); - break; - - default: - wxFAIL_MSG( _T("unreachable") ); - } - - chLast = _T('\0'); - lastCount = 0; - } - - // not a special character so must be just a separator, - // treat as is - if ( *p != _T('\0') ) - { - if ( *p == _T('%') ) - { - // this one needs to be escaped - fmtWX += _T('%'); - } - - fmtWX += *p; - } - } - - if ( *p == _T('\0') ) - break; - } - } - //else: GetLocaleInfo() failed, leave fmtDate value unchanged and - // try our luck with the default formats - } - //else: default C locale, default formats should work - - return fmtWX; -} - -#endif // __WINDOWS__ - -const wxChar *wxDateTime::ParseFormat(const wxChar *date, - const wxChar *format, - const wxDateTime& dateDef) -{ - wxCHECK_MSG( date && format, (wxChar *)NULL, - _T("NULL pointer in wxDateTime::ParseFormat()") ); - - wxString str; - unsigned long num; - - // what fields have we found? - bool haveWDay = false, - haveYDay = false, - haveDay = false, - haveMon = false, - haveYear = false, - haveHour = false, - haveMin = false, - haveSec = false; - - bool hourIsIn12hFormat = false, // or in 24h one? - isPM = false; // AM by default - - // and the value of the items we have (init them to get rid of warnings) - wxDateTime_t sec = 0, - min = 0, - hour = 0; - WeekDay wday = Inv_WeekDay; - wxDateTime_t yday = 0, - mday = 0; - wxDateTime::Month mon = Inv_Month; - int year = 0; - - const wxChar *input = date; - for ( const wxChar *fmt = format; *fmt; fmt++ ) - { - if ( *fmt != _T('%') ) - { - if ( wxIsspace(*fmt) ) - { - // a white space in the format string matches 0 or more white - // spaces in the input - while ( wxIsspace(*input) ) - { - input++; - } - } - else // !space - { - // any other character (not whitespace, not '%') must be - // matched by itself in the input - if ( *input++ != *fmt ) - { - // no match - return (wxChar *)NULL; - } - } - - // done with this format char - continue; - } - - // start of a format specification - - // parse the optional width - size_t width = 0; - while ( wxIsdigit(*++fmt) ) - { - width *= 10; - width += *fmt - _T('0'); - } - - // the default widths for the various fields - if ( !width ) - { - switch ( *fmt ) - { - case _T('Y'): // year has 4 digits - width = 4; - break; - - case _T('j'): // day of year has 3 digits - case _T('l'): // milliseconds have 3 digits - width = 3; - break; - - case _T('w'): // week day as number has only one - width = 1; - break; - - default: - // default for all other fields - width = 2; - } - } - - // then the format itself - switch ( *fmt ) - { - case _T('a'): // a weekday name - case _T('A'): - { - int flag = *fmt == _T('a') ? Name_Abbr : Name_Full; - wday = GetWeekDayFromName(GetAlphaToken(input), flag); - if ( wday == Inv_WeekDay ) - { - // no match - return (wxChar *)NULL; - } - } - haveWDay = true; - break; - - case _T('b'): // a month name - case _T('B'): - { - int flag = *fmt == _T('b') ? Name_Abbr : Name_Full; - mon = GetMonthFromName(GetAlphaToken(input), flag); - if ( mon == Inv_Month ) - { - // no match - return (wxChar *)NULL; - } - } - haveMon = true; - break; - - case _T('c'): // locale default date and time representation - { - wxDateTime dt; - - // this is the format which corresponds to ctime() output - // and strptime("%c") should parse it, so try it first - static const wxChar *fmtCtime = _T("%a %b %d %H:%M:%S %Y"); - - const wxChar *result = dt.ParseFormat(input, fmtCtime); - if ( !result ) - { - result = dt.ParseFormat(input, _T("%x %X")); - } - - if ( !result ) - { - result = dt.ParseFormat(input, _T("%X %x")); - } - - if ( !result ) - { - // we've tried everything and still no match - return (wxChar *)NULL; - } - - Tm tm = dt.GetTm(); - - haveDay = haveMon = haveYear = - haveHour = haveMin = haveSec = true; - - hour = tm.hour; - min = tm.min; - sec = tm.sec; - - year = tm.year; - mon = tm.mon; - mday = tm.mday; - - input = result; - } - break; - - case _T('d'): // day of a month (01-31) - if ( !GetNumericToken(width, input, &num) || - (num > 31) || (num < 1) ) - { - // no match - return (wxChar *)NULL; - } - - // we can't check whether the day range is correct yet, will - // do it later - assume ok for now - haveDay = true; - mday = (wxDateTime_t)num; - break; - - case _T('H'): // hour in 24h format (00-23) - if ( !GetNumericToken(width, input, &num) || (num > 23) ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = true; - hour = (wxDateTime_t)num; - break; - - case _T('I'): // hour in 12h format (01-12) - if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = true; - hourIsIn12hFormat = true; - hour = (wxDateTime_t)(num % 12); // 12 should be 0 - break; - - case _T('j'): // day of the year - if ( !GetNumericToken(width, input, &num) || !num || (num > 366) ) - { - // no match - return (wxChar *)NULL; - } - - haveYDay = true; - yday = (wxDateTime_t)num; - break; - - case _T('m'): // month as a number (01-12) - if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) - { - // no match - return (wxChar *)NULL; - } - - haveMon = true; - mon = (Month)(num - 1); - break; - - case _T('M'): // minute as a decimal number (00-59) - if ( !GetNumericToken(width, input, &num) || (num > 59) ) - { - // no match - return (wxChar *)NULL; - } - - haveMin = true; - min = (wxDateTime_t)num; - break; - - case _T('p'): // AM or PM string - { - wxString am, pm, token = GetAlphaToken(input); - - GetAmPmStrings(&am, &pm); - if (am.empty() && pm.empty()) - return (wxChar *)NULL; // no am/pm strings defined - if ( token.CmpNoCase(pm) == 0 ) - { - isPM = true; - } - else if ( token.CmpNoCase(am) != 0 ) - { - // no match - return (wxChar *)NULL; - } - } - break; - - case _T('r'): // time as %I:%M:%S %p - { - wxDateTime dt; - input = dt.ParseFormat(input, _T("%I:%M:%S %p")); - if ( !input ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = haveMin = haveSec = true; - - Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - } - break; - - case _T('R'): // time as %H:%M - { - wxDateTime dt; - input = dt.ParseFormat(input, _T("%H:%M")); - if ( !input ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = haveMin = true; - - Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - } - break; - - case _T('S'): // second as a decimal number (00-61) - if ( !GetNumericToken(width, input, &num) || (num > 61) ) - { - // no match - return (wxChar *)NULL; - } - - haveSec = true; - sec = (wxDateTime_t)num; - break; - - case _T('T'): // time as %H:%M:%S - { - wxDateTime dt; - input = dt.ParseFormat(input, _T("%H:%M:%S")); - if ( !input ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = haveMin = haveSec = true; - - Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - } - break; - - case _T('w'): // weekday as a number (0-6), Sunday = 0 - if ( !GetNumericToken(width, input, &num) || (wday > 6) ) - { - // no match - return (wxChar *)NULL; - } - - haveWDay = true; - wday = (WeekDay)num; - break; - - case _T('x'): // locale default date representation -#ifdef HAVE_STRPTIME - // try using strptime() -- it may fail even if the input is - // correct but the date is out of range, so we will fall back - // to our generic code anyhow - { - struct tm tm; - - const wxChar *result = CallStrptime(input, "%x", &tm); - if ( result ) - { - input = result; - - haveDay = haveMon = haveYear = true; - - year = 1900 + tm.tm_year; - mon = (Month)tm.tm_mon; - mday = tm.tm_mday; - - break; - } - } -#endif // HAVE_STRPTIME - - { - wxDateTime dt; - wxString fmtDate, - fmtDateAlt; - -#ifdef __WINDOWS__ - // The above doesn't work for all locales, try to query - // Windows for the right way of formatting the date: - fmtDate = GetLocaleDateFormat(); - if ( fmtDate.empty() ) -#endif - { - if ( IsWestEuropeanCountry(GetCountry()) || - GetCountry() == Russia ) - { - fmtDate = _T("%d/%m/%y"); - fmtDateAlt = _T("%m/%d/%y"); - } - else // assume USA - { - fmtDate = _T("%m/%d/%y"); - fmtDateAlt = _T("%d/%m/%y"); - } - } - - const wxChar *result = dt.ParseFormat(input, fmtDate); - - if ( !result && !fmtDateAlt.empty() ) - { - // ok, be nice and try another one - result = dt.ParseFormat(input, fmtDateAlt); - } - - if ( !result ) - { - // bad luck - return (wxChar *)NULL; - } - - Tm tm = dt.GetTm(); - - haveDay = haveMon = haveYear = true; - - year = tm.year; - mon = tm.mon; - mday = tm.mday; - - input = result; - } - - break; - - case _T('X'): // locale default time representation -#ifdef HAVE_STRPTIME - { - // use strptime() to do it for us (FIXME !Unicode friendly) - struct tm tm; - input = CallStrptime(input, "%X", &tm); - if ( !input ) - { - return (wxChar *)NULL; - } - - haveHour = haveMin = haveSec = true; - - hour = tm.tm_hour; - min = tm.tm_min; - sec = tm.tm_sec; - } -#else // !HAVE_STRPTIME - // TODO under Win32 we can query the LOCALE_ITIME system - // setting which says whether the default time format is - // 24 or 12 hour - { - // try to parse what follows as "%H:%M:%S" and, if this - // fails, as "%I:%M:%S %p" - this should catch the most - // common cases - wxDateTime dt; - - const wxChar *result = dt.ParseFormat(input, _T("%T")); - if ( !result ) - { - result = dt.ParseFormat(input, _T("%r")); - } - - if ( !result ) - { - // no match - return (wxChar *)NULL; - } - - haveHour = haveMin = haveSec = true; - - Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - - input = result; - } -#endif // HAVE_STRPTIME/!HAVE_STRPTIME - break; - - case _T('y'): // year without century (00-99) - if ( !GetNumericToken(width, input, &num) || (num > 99) ) - { - // no match - return (wxChar *)NULL; - } - - haveYear = true; - - // TODO should have an option for roll over date instead of - // hard coding it here - year = (num > 30 ? 1900 : 2000) + (wxDateTime_t)num; - break; - - case _T('Y'): // year with century - if ( !GetNumericToken(width, input, &num) ) - { - // no match - return (wxChar *)NULL; - } - - haveYear = true; - year = (wxDateTime_t)num; - break; - - case _T('Z'): // timezone name - wxFAIL_MSG(_T("TODO")); - break; - - case _T('%'): // a percent sign - if ( *input++ != _T('%') ) - { - // no match - return (wxChar *)NULL; - } - break; - - case 0: // the end of string - wxFAIL_MSG(_T("unexpected format end")); - - // fall through - - default: // not a known format spec - return (wxChar *)NULL; - } - } - - // format matched, try to construct a date from what we have now - Tm tmDef; - if ( dateDef.IsValid() ) - { - // take this date as default - tmDef = dateDef.GetTm(); - } - else if ( IsValid() ) - { - // if this date is valid, don't change it - tmDef = GetTm(); - } - else - { - // no default and this date is invalid - fall back to Today() - tmDef = Today().GetTm(); - } - - Tm tm = tmDef; - - // set the date - if ( haveYear ) - { - tm.year = year; - } - - // TODO we don't check here that the values are consistent, if both year - // day and month/day were found, we just ignore the year day and we - // also always ignore the week day - if ( haveMon && haveDay ) - { - if ( mday > GetNumOfDaysInMonth(tm.year, mon) ) - { - wxLogDebug(_T("bad month day in wxDateTime::ParseFormat")); - - return (wxChar *)NULL; - } - - tm.mon = mon; - tm.mday = mday; - } - else if ( haveYDay ) - { - if ( yday > GetNumberOfDays(tm.year) ) - { - wxLogDebug(_T("bad year day in wxDateTime::ParseFormat")); - - return (wxChar *)NULL; - } - - Tm tm2 = wxDateTime(1, Jan, tm.year).SetToYearDay(yday).GetTm(); - - tm.mon = tm2.mon; - tm.mday = tm2.mday; - } - - // deal with AM/PM - if ( haveHour && hourIsIn12hFormat && isPM ) - { - // translate to 24hour format - hour += 12; - } - //else: either already in 24h format or no translation needed - - // set the time - if ( haveHour ) - { - tm.hour = hour; - } - - if ( haveMin ) - { - tm.min = min; - } - - if ( haveSec ) - { - tm.sec = sec; - } - - Set(tm); - - // finally check that the week day is consistent -- if we had it - if ( haveWDay && GetWeekDay() != wday ) - { - wxLogDebug(_T("inconsistsnet week day in wxDateTime::ParseFormat()")); - - return NULL; - } - - return input; -} - -const wxChar *wxDateTime::ParseDateTime(const wxChar *date) -{ - wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); - - // Set to current day and hour, so strings like '14:00' becomes today at - // 14, not some other random date - wxDateTime dtDate = wxDateTime::Today(); - wxDateTime dtTime = wxDateTime::Today(); - - const wxChar* pchTime; - - // Try to parse the beginning of the string as a date - const wxChar* pchDate = dtDate.ParseDate(date); - - // We got a date in the beginning, see if there is a time specified after the date - if ( pchDate ) - { - // Skip spaces, as the ParseTime() function fails on spaces - while ( wxIsspace(*pchDate) ) - pchDate++; - - pchTime = dtTime.ParseTime(pchDate); - } - else // no date in the beginning - { - // check and see if we have a time followed by a date - pchTime = dtTime.ParseTime(date); - if ( pchTime ) - { - while ( wxIsspace(*pchTime) ) - pchTime++; - - pchDate = dtDate.ParseDate(pchTime); - } - } - - // If we have a date specified, set our own data to the same date - if ( !pchDate || !pchTime ) - return NULL; - - Set(dtDate.GetDay(), dtDate.GetMonth(), dtDate.GetYear(), - dtTime.GetHour(), dtTime.GetMinute(), dtTime.GetSecond(), - dtTime.GetMillisecond()); - - // Return endpoint of scan - return pchDate > pchTime ? pchDate : pchTime; -} - -const wxChar *wxDateTime::ParseDate(const wxChar *date) -{ - // this is a simplified version of ParseDateTime() which understands only - // "today" (for wxDate compatibility) and digits only otherwise (and not - // all esoteric constructions ParseDateTime() knows about) - - wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); - - const wxChar *p = date; - while ( wxIsspace(*p) ) - p++; - - // some special cases - static struct - { - const wxChar *str; - int dayDiffFromToday; - } literalDates[] = - { - { wxTRANSLATE("today"), 0 }, - { wxTRANSLATE("yesterday"), -1 }, - { wxTRANSLATE("tomorrow"), 1 }, - }; - - for ( size_t n = 0; n < WXSIZEOF(literalDates); n++ ) - { - const wxString dateStr = wxGetTranslation(literalDates[n].str); - size_t len = dateStr.length(); - if ( wxStrlen(p) >= len ) - { - wxString str(p, len); - if ( str.CmpNoCase(dateStr) == 0 ) - { - // nothing can follow this, so stop here - p += len; - - int dayDiffFromToday = literalDates[n].dayDiffFromToday; - *this = Today(); - if ( dayDiffFromToday ) - { - *this += wxDateSpan::Days(dayDiffFromToday); - } - - return p; - } - } - } - - // We try to guess what we have here: for each new (numeric) token, we - // determine if it can be a month, day or a year. Of course, there is an - // ambiguity as some numbers may be days as well as months, so we also - // have the ability to back track. - - // what do we have? - bool haveDay = false, // the months day? - haveWDay = false, // the day of week? - haveMon = false, // the month? - haveYear = false; // the year? - - // and the value of the items we have (init them to get rid of warnings) - WeekDay wday = Inv_WeekDay; - wxDateTime_t day = 0; - wxDateTime::Month mon = Inv_Month; - int year = 0; - - // tokenize the string - size_t nPosCur = 0; - static const wxChar *dateDelimiters = _T(".,/-\t\r\n "); - wxStringTokenizer tok(p, dateDelimiters); - while ( tok.HasMoreTokens() ) - { - wxString token = tok.GetNextToken(); - if ( !token ) - continue; - - // is it a number? - unsigned long val; - if ( token.ToULong(&val) ) - { - // guess what this number is - - bool isDay = false, - isMonth = false, - isYear = false; - - if ( !haveMon && val > 0 && val <= 12 ) - { - // assume it is month - isMonth = true; - } - else // not the month - { - if ( haveDay ) - { - // this can only be the year - isYear = true; - } - else // may be either day or year - { - // use a leap year if we don't have the year yet to allow - // dates like 2/29/1976 which would be rejected otherwise - wxDateTime_t max_days = (wxDateTime_t)( - haveMon - ? GetNumOfDaysInMonth(haveYear ? year : 1976, mon) - : 31 - ); - - // can it be day? - if ( (val == 0) || (val > (unsigned long)max_days) ) - { - // no - isYear = true; - } - else // yes, suppose it's the day - { - isDay = true; - } - } - } - - if ( isYear ) - { - if ( haveYear ) - break; - - haveYear = true; - - year = (wxDateTime_t)val; - } - else if ( isDay ) - { - if ( haveDay ) - break; - - haveDay = true; - - day = (wxDateTime_t)val; - } - else if ( isMonth ) - { - haveMon = true; - - mon = (Month)(val - 1); - } - } - else // not a number - { - // be careful not to overwrite the current mon value - Month mon2 = GetMonthFromName(token, Name_Full | Name_Abbr); - if ( mon2 != Inv_Month ) - { - // it's a month - if ( haveMon ) - { - // but we already have a month - maybe we guessed wrong? - if ( !haveDay ) - { - // no need to check in month range as always < 12, but - // the days are counted from 1 unlike the months - day = (wxDateTime_t)(mon + 1); - haveDay = true; - } - else - { - // could possible be the year (doesn't the year come - // before the month in the japanese format?) (FIXME) - break; - } - } - - mon = mon2; - - haveMon = true; - } - else // not a valid month name - { - WeekDay wday2 = GetWeekDayFromName(token, Name_Full | Name_Abbr); - if ( wday2 != Inv_WeekDay ) - { - // a week day - if ( haveWDay ) - { - break; - } - - wday = wday2; - - haveWDay = true; - } - else // not a valid weekday name - { - // try the ordinals - static const wxChar *ordinals[] = - { - wxTRANSLATE("first"), - wxTRANSLATE("second"), - wxTRANSLATE("third"), - wxTRANSLATE("fourth"), - wxTRANSLATE("fifth"), - wxTRANSLATE("sixth"), - wxTRANSLATE("seventh"), - wxTRANSLATE("eighth"), - wxTRANSLATE("ninth"), - wxTRANSLATE("tenth"), - wxTRANSLATE("eleventh"), - wxTRANSLATE("twelfth"), - wxTRANSLATE("thirteenth"), - wxTRANSLATE("fourteenth"), - wxTRANSLATE("fifteenth"), - wxTRANSLATE("sixteenth"), - wxTRANSLATE("seventeenth"), - wxTRANSLATE("eighteenth"), - wxTRANSLATE("nineteenth"), - wxTRANSLATE("twentieth"), - // that's enough - otherwise we'd have problems with - // composite (or not) ordinals - }; - - size_t n; - for ( n = 0; n < WXSIZEOF(ordinals); n++ ) - { - if ( token.CmpNoCase(ordinals[n]) == 0 ) - { - break; - } - } - - if ( n == WXSIZEOF(ordinals) ) - { - // stop here - something unknown - break; - } - - // it's a day - if ( haveDay ) - { - // don't try anything here (as in case of numeric day - // above) - the symbolic day spec should always - // precede the month/year - break; - } - - haveDay = true; - - day = (wxDateTime_t)(n + 1); - } - } - } - - nPosCur = tok.GetPosition(); - } - - // either no more tokens or the scan was stopped by something we couldn't - // parse - in any case, see if we can construct a date from what we have - if ( !haveDay && !haveWDay ) - { - wxLogDebug(_T("ParseDate: no day, no weekday hence no date.")); - - return NULL; - } - - if ( haveWDay && (haveMon || haveYear || haveDay) && - !(haveDay && haveMon && haveYear) ) - { - // without adjectives (which we don't support here) the week day only - // makes sense completely separately or with the full date - // specification (what would "Wed 1999" mean?) - return NULL; - } - - if ( !haveWDay && haveYear && !(haveDay && haveMon) ) - { - // may be we have month and day instead of day and year? - if ( haveDay && !haveMon ) - { - if ( day <= 12 ) - { - // exchange day and month - mon = (wxDateTime::Month)(day - 1); - - // we're in the current year then - if ( (year > 0) && (year <= (int)GetNumOfDaysInMonth(Inv_Year, mon)) ) - { - day = (wxDateTime_t)year; - - haveMon = true; - haveYear = false; - } - //else: no, can't exchange, leave haveMon == false - } - } - - if ( !haveMon ) - { - // if we give the year, month and day must be given too - wxLogDebug(_T("ParseDate: day and month should be specified if year is.")); - - return NULL; - } - } - - if ( !haveMon ) - { - mon = GetCurrentMonth(); - } - - if ( !haveYear ) - { - year = GetCurrentYear(); - } - - if ( haveDay ) - { - // normally we check the day above but the check is optimistic in case - // we find the day before its month/year so we have to redo it now - if ( day > GetNumOfDaysInMonth(year, mon) ) - return NULL; - - Set(day, mon, year); - - if ( haveWDay ) - { - // check that it is really the same - if ( GetWeekDay() != wday ) - { - // inconsistency detected - wxLogDebug(_T("ParseDate: inconsistent day/weekday.")); - - return (wxChar *)NULL; - } - } - } - else // haveWDay - { - *this = Today(); - - SetToWeekDayInSameWeek(wday); - } - - // return the pointer to the first unparsed char - p += nPosCur; - if ( nPosCur && wxStrchr(dateDelimiters, *(p - 1)) ) - { - // if we couldn't parse the token after the delimiter, put back the - // delimiter as well - p--; - } - - return p; -} - -const wxChar *wxDateTime::ParseTime(const wxChar *time) -{ - wxCHECK_MSG( time, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); - - // first try some extra things - static const struct - { - const wxChar *name; - wxDateTime_t hour; - } stdTimes[] = - { - { wxTRANSLATE("noon"), 12 }, - { wxTRANSLATE("midnight"), 00 }, - // anything else? - }; - - for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ ) - { - wxString timeString = wxGetTranslation(stdTimes[n].name); - size_t len = timeString.length(); - if ( timeString.CmpNoCase(wxString(time, len)) == 0 ) - { - // casts required by DigitalMars - Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0)); - - return time + len; - } - } - - // try all time formats we may think about in the order from longest to - // shortest - - // 12hour with AM/PM? - const wxChar *result = ParseFormat(time, _T("%I:%M:%S %p")); - - if ( !result ) - { - // normally, it's the same, but why not try it? - result = ParseFormat(time, _T("%H:%M:%S")); - } - - if ( !result ) - { - // 12hour with AM/PM but without seconds? - result = ParseFormat(time, _T("%I:%M %p")); - } - - if ( !result ) - { - // without seconds? - result = ParseFormat(time, _T("%H:%M")); - } - - if ( !result ) - { - // just the hour and AM/PM? - result = ParseFormat(time, _T("%I %p")); - } - - if ( !result ) - { - // just the hour? - result = ParseFormat(time, _T("%H")); - } - - if ( !result ) - { - // parse the standard format: normally it is one of the formats above - // but it may be set to something completely different by the user - result = ParseFormat(time, _T("%X")); - } - - // TODO: parse timezones - - return result; -} - -// ---------------------------------------------------------------------------- -// Workdays and holidays support -// ---------------------------------------------------------------------------- - -bool wxDateTime::IsWorkDay(Country WXUNUSED(country)) const -{ - return !wxDateTimeHolidayAuthority::IsHoliday(*this); -} - -// ============================================================================ -// wxDateSpan -// ============================================================================ - -wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds) -{ - wxDateSpan ds1(ds); - return ds1.Multiply(n); -} - -// ============================================================================ -// wxTimeSpan -// ============================================================================ - -wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts) -{ - return wxTimeSpan(ts).Multiply(n); -} - -// this enum is only used in wxTimeSpan::Format() below but we can't declare -// it locally to the method as it provokes an internal compiler error in egcs -// 2.91.60 when building with -O2 -enum TimeSpanPart -{ - Part_Week, - Part_Day, - Part_Hour, - Part_Min, - Part_Sec, - Part_MSec -}; - -// not all strftime(3) format specifiers make sense here because, for example, -// a time span doesn't have a year nor a timezone -// -// Here are the ones which are supported (all of them are supported by strftime -// as well): -// %H hour in 24 hour format -// %M minute (00 - 59) -// %S second (00 - 59) -// %% percent sign -// -// Also, for MFC CTimeSpan compatibility, we support -// %D number of days -// -// And, to be better than MFC :-), we also have -// %E number of wEeks -// %l milliseconds (000 - 999) -wxString wxTimeSpan::Format(const wxChar *format) const -{ - // we deal with only positive time spans here and just add the sign in - // front for the negative ones - if ( IsNegative() ) - { - wxString str(Negate().Format(format)); - return _T("-") + str; - } - - wxCHECK_MSG( format, wxEmptyString, - _T("NULL format in wxTimeSpan::Format") ); - - wxString str; - str.Alloc(wxStrlen(format)); - - // Suppose we have wxTimeSpan ts(1 /* hour */, 2 /* min */, 3 /* sec */) - // - // Then, of course, ts.Format("%H:%M:%S") must return "01:02:03", but the - // question is what should ts.Format("%S") do? The code here returns "3273" - // in this case (i.e. the total number of seconds, not just seconds % 60) - // because, for me, this call means "give me entire time interval in - // seconds" and not "give me the seconds part of the time interval" - // - // If we agree that it should behave like this, it is clear that the - // interpretation of each format specifier depends on the presence of the - // other format specs in the string: if there was "%H" before "%M", we - // should use GetMinutes() % 60, otherwise just GetMinutes() &c - - // we remember the most important unit found so far - TimeSpanPart partBiggest = Part_MSec; - - for ( const wxChar *pch = format; *pch; pch++ ) - { - wxChar ch = *pch; - - if ( ch == _T('%') ) - { - // the start of the format specification of the printf() below - wxString fmtPrefix(_T('%')); - - // the number - long n; - - // the number of digits for the format string, 0 if unused - unsigned digits = 0; - - ch = *++pch; // get the format spec char - switch ( ch ) - { - default: - wxFAIL_MSG( _T("invalid format character") ); - // fall through - - case _T('%'): - str += ch; - - // skip the part below switch - continue; - - case _T('D'): - n = GetDays(); - if ( partBiggest < Part_Day ) - { - n %= DAYS_PER_WEEK; - } - else - { - partBiggest = Part_Day; - } - break; - - case _T('E'): - partBiggest = Part_Week; - n = GetWeeks(); - break; - - case _T('H'): - n = GetHours(); - if ( partBiggest < Part_Hour ) - { - n %= HOURS_PER_DAY; - } - else - { - partBiggest = Part_Hour; - } - - digits = 2; - break; - - case _T('l'): - n = GetMilliseconds().ToLong(); - if ( partBiggest < Part_MSec ) - { - n %= 1000; - } - //else: no need to reset partBiggest to Part_MSec, it is - // the least significant one anyhow - - digits = 3; - break; - - case _T('M'): - n = GetMinutes(); - if ( partBiggest < Part_Min ) - { - n %= MIN_PER_HOUR; - } - else - { - partBiggest = Part_Min; - } - - digits = 2; - break; - - case _T('S'): - n = GetSeconds().ToLong(); - if ( partBiggest < Part_Sec ) - { - n %= SEC_PER_MIN; - } - else - { - partBiggest = Part_Sec; - } - - digits = 2; - break; - } - - if ( digits ) - { - fmtPrefix << _T("0") << digits; - } - - str += wxString::Format(fmtPrefix + _T("ld"), n); - } - else - { - // normal character, just copy - str += ch; - } - } - - return str; -} - -// ============================================================================ -// wxDateTimeHolidayAuthority and related classes -// ============================================================================ - -#include "wx/arrimpl.cpp" - -WX_DEFINE_OBJARRAY(wxDateTimeArray) - -static int wxCMPFUNC_CONV -wxDateTimeCompareFunc(wxDateTime **first, wxDateTime **second) -{ - wxDateTime dt1 = **first, - dt2 = **second; - - return dt1 == dt2 ? 0 : dt1 < dt2 ? -1 : +1; -} - -// ---------------------------------------------------------------------------- -// wxDateTimeHolidayAuthority -// ---------------------------------------------------------------------------- - -wxHolidayAuthoritiesArray wxDateTimeHolidayAuthority::ms_authorities; - -/* static */ -bool wxDateTimeHolidayAuthority::IsHoliday(const wxDateTime& dt) -{ - size_t count = ms_authorities.size(); - for ( size_t n = 0; n < count; n++ ) - { - if ( ms_authorities[n]->DoIsHoliday(dt) ) - { - return true; - } - } - - return false; -} - -/* static */ -size_t -wxDateTimeHolidayAuthority::GetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) -{ - wxDateTimeArray hol; - - holidays.Clear(); - - const size_t countAuth = ms_authorities.size(); - for ( size_t nAuth = 0; nAuth < countAuth; nAuth++ ) - { - ms_authorities[nAuth]->DoGetHolidaysInRange(dtStart, dtEnd, hol); - - WX_APPEND_ARRAY(holidays, hol); - } - - holidays.Sort(wxDateTimeCompareFunc); - - return holidays.size(); -} - -/* static */ -void wxDateTimeHolidayAuthority::ClearAllAuthorities() -{ - WX_CLEAR_ARRAY(ms_authorities); -} - -/* static */ -void wxDateTimeHolidayAuthority::AddAuthority(wxDateTimeHolidayAuthority *auth) -{ - ms_authorities.push_back(auth); -} - -wxDateTimeHolidayAuthority::~wxDateTimeHolidayAuthority() -{ - // required here for Darwin -} - -// ---------------------------------------------------------------------------- -// wxDateTimeWorkDays -// ---------------------------------------------------------------------------- - -bool wxDateTimeWorkDays::DoIsHoliday(const wxDateTime& dt) const -{ - wxDateTime::WeekDay wd = dt.GetWeekDay(); - - return (wd == wxDateTime::Sun) || (wd == wxDateTime::Sat); -} - -size_t wxDateTimeWorkDays::DoGetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const -{ - if ( dtStart > dtEnd ) - { - wxFAIL_MSG( _T("invalid date range in GetHolidaysInRange") ); - - return 0u; - } - - holidays.Empty(); - - // instead of checking all days, start with the first Sat after dtStart and - // end with the last Sun before dtEnd - wxDateTime dtSatFirst = dtStart.GetNextWeekDay(wxDateTime::Sat), - dtSatLast = dtEnd.GetPrevWeekDay(wxDateTime::Sat), - dtSunFirst = dtStart.GetNextWeekDay(wxDateTime::Sun), - dtSunLast = dtEnd.GetPrevWeekDay(wxDateTime::Sun), - dt; - - for ( dt = dtSatFirst; dt <= dtSatLast; dt += wxDateSpan::Week() ) - { - holidays.Add(dt); - } - - for ( dt = dtSunFirst; dt <= dtSunLast; dt += wxDateSpan::Week() ) - { - holidays.Add(dt); - } - - return holidays.GetCount(); -} - -// ============================================================================ -// other helper functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// iteration helpers: can be used to write a for loop over enum variable like -// this: -// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) -// ---------------------------------------------------------------------------- - -WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m) -{ - wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); - - // no wrapping or the for loop above would never end! - m = (wxDateTime::Month)(m + 1); -} - -WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m) -{ - wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); - - m = m == wxDateTime::Jan ? wxDateTime::Inv_Month - : (wxDateTime::Month)(m - 1); -} - -WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd) -{ - wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") ); - - // no wrapping or the for loop above would never end! - wd = (wxDateTime::WeekDay)(wd + 1); -} - -WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd) -{ - wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") ); - - wd = wd == wxDateTime::Sun ? wxDateTime::Inv_WeekDay - : (wxDateTime::WeekDay)(wd - 1); -} - -#endif // wxUSE_DATETIME diff --git a/Source/3rdParty/wx/src/common/datstrm.cpp b/Source/3rdParty/wx/src/common/datstrm.cpp deleted file mode 100644 index fd16e9223..000000000 --- a/Source/3rdParty/wx/src/common/datstrm.cpp +++ /dev/null @@ -1,745 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/datstrm.cpp -// Purpose: Data stream classes -// Author: Guilhem Lavaux -// Modified by: Mickael Gilabert -// Created: 28/06/98 -// RCS-ID: $Id: datstrm.cpp 53028 2008-04-05 17:28:32Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/datstrm.h" - -#ifndef WX_PRECOMP - #include "wx/math.h" -#endif //WX_PRECOMP - -// --------------------------------------------------------------------------- -// wxDataInputStream -// --------------------------------------------------------------------------- - -#if wxUSE_UNICODE -wxDataInputStream::wxDataInputStream(wxInputStream& s, const wxMBConv& conv) - : m_input(&s), m_be_order(false), m_conv(conv.Clone()) -#else -wxDataInputStream::wxDataInputStream(wxInputStream& s) - : m_input(&s), m_be_order(false) -#endif -{ -} - -wxDataInputStream::~wxDataInputStream() -{ -#if wxUSE_UNICODE - delete m_conv; -#endif // wxUSE_UNICODE -} - -#if wxHAS_INT64 -wxUint64 wxDataInputStream::Read64() -{ - wxUint64 tmp; - Read64(&tmp, 1); - return tmp; -} -#endif // wxHAS_INT64 - -wxUint32 wxDataInputStream::Read32() -{ - wxUint32 i32; - - m_input->Read(&i32, 4); - - if (m_be_order) - return wxUINT32_SWAP_ON_LE(i32); - else - return wxUINT32_SWAP_ON_BE(i32); -} - -wxUint16 wxDataInputStream::Read16() -{ - wxUint16 i16; - - m_input->Read(&i16, 2); - - if (m_be_order) - return wxUINT16_SWAP_ON_LE(i16); - else - return wxUINT16_SWAP_ON_BE(i16); -} - -wxUint8 wxDataInputStream::Read8() -{ - wxUint8 buf; - - m_input->Read(&buf, 1); - return (wxUint8)buf; -} - -double wxDataInputStream::ReadDouble() -{ -#if wxUSE_APPLE_IEEE - char buf[10]; - - m_input->Read(buf, 10); - return ConvertFromIeeeExtended((const wxInt8 *)buf); -#else - return 0.0; -#endif -} - -wxString wxDataInputStream::ReadString() -{ - wxString ret; - - const size_t len = Read32(); - if ( len > 0 ) - { -#if wxUSE_UNICODE - wxCharBuffer tmp(len + 1); - if ( tmp ) - { - m_input->Read(tmp.data(), len); - tmp.data()[len] = '\0'; - ret = m_conv->cMB2WX(tmp.data()); - } -#else - wxStringBuffer buf(ret, len); - if ( buf ) - m_input->Read(buf, len); -#endif - } - - return ret; -} - -#if wxUSE_LONGLONG - -template -static -void DoReadLL(T *buffer, size_t size, wxInputStream *input, bool be_order) -{ - typedef T DataType; - unsigned char *pchBuffer = new unsigned char[size * 8]; - // TODO: Check for overflow when size is of type uint and is > than 512m - input->Read(pchBuffer, size * 8); - size_t idx_base = 0; - if ( be_order ) - { - for ( size_t uiIndex = 0; uiIndex != size; ++uiIndex ) - { - buffer[uiIndex] = 0l; - for ( unsigned ui = 0; ui != 8; ++ui ) - { - buffer[uiIndex] = buffer[uiIndex] * 256l + - DataType((unsigned long) pchBuffer[idx_base + ui]); - } - - idx_base += 8; - } - } - else // little endian - { - for ( size_t uiIndex=0; uiIndex!=size; ++uiIndex ) - { - buffer[uiIndex] = 0l; - for ( unsigned ui=0; ui!=8; ++ui ) - buffer[uiIndex] = buffer[uiIndex] * 256l + - DataType((unsigned long) pchBuffer[idx_base + 7 - ui]); - idx_base += 8; - } - } - delete[] pchBuffer; -} - -template -static void DoWriteLL(const T *buffer, size_t size, wxOutputStream *output, bool be_order) -{ - typedef T DataType; - unsigned char *pchBuffer = new unsigned char[size * 8]; - size_t idx_base = 0; - if ( be_order ) - { - for ( size_t uiIndex = 0; uiIndex != size; ++uiIndex ) - { - DataType i64 = buffer[uiIndex]; - for ( unsigned ui = 0; ui != 8; ++ui ) - { - pchBuffer[idx_base + 7 - ui] = - (unsigned char) (i64.GetLo() & 255l); - i64 >>= 8l; - } - - idx_base += 8; - } - } - else // little endian - { - for ( size_t uiIndex=0; uiIndex != size; ++uiIndex ) - { - DataType i64 = buffer[uiIndex]; - for (unsigned ui=0; ui!=8; ++ui) - { - pchBuffer[idx_base + ui] = - (unsigned char) (i64.GetLo() & 255l); - i64 >>= 8l; - } - - idx_base += 8; - } - } - - // TODO: Check for overflow when size is of type uint and is > than 512m - output->Write(pchBuffer, size * 8); - delete[] pchBuffer; -} - -#endif // wxUSE_LONGLONG - -#ifdef wxLongLong_t - -template -static -void DoReadI64(T *buffer, size_t size, wxInputStream *input, bool be_order) -{ - typedef T DataType; - unsigned char *pchBuffer = (unsigned char*) buffer; - // TODO: Check for overflow when size is of type uint and is > than 512m - input->Read(pchBuffer, size * 8); - if ( be_order ) - { - for ( wxUint32 i = 0; i < size; i++ ) - { - DataType v = wxUINT64_SWAP_ON_LE(*buffer); - *(buffer++) = v; - } - } - else // little endian - { - for ( wxUint32 i=0; i -static -void DoWriteI64(const T *buffer, size_t size, wxOutputStream *output, bool be_order) -{ - typedef T DataType; - if ( be_order ) - { - for ( size_t i = 0; i < size; i++ ) - { - DataType i64 = wxUINT64_SWAP_ON_LE(*buffer); - buffer++; - output->Write(&i64, 8); - } - } - else // little endian - { - for ( size_t i=0; i < size; i++ ) - { - DataType i64 = wxUINT64_SWAP_ON_BE(*buffer); - buffer++; - output->Write(&i64, 8); - } - } -} - -#endif // wxLongLong_t - - -#if wxHAS_INT64 -void wxDataInputStream::Read64(wxUint64 *buffer, size_t size) -{ -#ifndef wxLongLong_t - DoReadLL(buffer, size, m_input, m_be_order); -#else - DoReadI64(buffer, size, m_input, m_be_order); -#endif -} - -void wxDataInputStream::Read64(wxInt64 *buffer, size_t size) -{ -#ifndef wxLongLong_t - DoReadLL(buffer, size, m_input, m_be_order); -#else - DoReadI64(buffer, size, m_input, m_be_order); -#endif -} -#endif // wxHAS_INT64 - -#if defined(wxLongLong_t) && wxUSE_LONGLONG -void wxDataInputStream::Read64(wxULongLong *buffer, size_t size) -{ - DoReadLL(buffer, size, m_input, m_be_order); -} - -void wxDataInputStream::Read64(wxLongLong *buffer, size_t size) -{ - DoReadLL(buffer, size, m_input, m_be_order); -} -#endif // wxLongLong_t - -#if wxUSE_LONGLONG -void wxDataInputStream::ReadLL(wxULongLong *buffer, size_t size) -{ - DoReadLL(buffer, size, m_input, m_be_order); -} - -void wxDataInputStream::ReadLL(wxLongLong *buffer, size_t size) -{ - DoReadLL(buffer, size, m_input, m_be_order); -} - -wxLongLong wxDataInputStream::ReadLL(void) -{ - wxLongLong ll; - DoReadLL(&ll, (size_t)1, m_input, m_be_order); - return ll; -} -#endif // wxUSE_LONGLONG - -void wxDataInputStream::Read32(wxUint32 *buffer, size_t size) -{ - m_input->Read(buffer, size * 4); - - if (m_be_order) - { - for (wxUint32 i=0; iRead(buffer, size * 2); - - if (m_be_order) - { - for (wxUint32 i=0; iRead(buffer, size); -} - -void wxDataInputStream::ReadDouble(double *buffer, size_t size) -{ - for (wxUint32 i=0; i>(wxString& s) -{ - s = ReadString(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxInt8& c) -{ - c = (wxInt8)Read8(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxInt16& i) -{ - i = (wxInt16)Read16(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxInt32& i) -{ - i = (wxInt32)Read32(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxUint8& c) -{ - c = Read8(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxUint16& i) -{ - i = Read16(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxUint32& i) -{ - i = Read32(); - return *this; -} - -#if wxHAS_INT64 -wxDataInputStream& wxDataInputStream::operator>>(wxUint64& i) -{ - i = Read64(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxInt64& i) -{ - i = Read64(); - return *this; -} -#endif // wxHAS_INT64 - -#if defined(wxLongLong_t) && wxUSE_LONGLONG -wxDataInputStream& wxDataInputStream::operator>>(wxULongLong& i) -{ - i = ReadLL(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(wxLongLong& i) -{ - i = ReadLL(); - return *this; -} -#endif // wxLongLong_t - -wxDataInputStream& wxDataInputStream::operator>>(double& i) -{ - i = ReadDouble(); - return *this; -} - -wxDataInputStream& wxDataInputStream::operator>>(float& f) -{ - f = (float)ReadDouble(); - return *this; -} - -// --------------------------------------------------------------------------- -// wxDataOutputStream -// --------------------------------------------------------------------------- - -#if wxUSE_UNICODE -wxDataOutputStream::wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv) - : m_output(&s), m_be_order(false), m_conv(conv.Clone()) -#else -wxDataOutputStream::wxDataOutputStream(wxOutputStream& s) - : m_output(&s), m_be_order(false) -#endif -{ -} - -wxDataOutputStream::~wxDataOutputStream() -{ -#if wxUSE_UNICODE - delete m_conv; -#endif // wxUSE_UNICODE -} - -#if wxHAS_INT64 -void wxDataOutputStream::Write64(wxUint64 i) -{ - Write64(&i, 1); -} - -void wxDataOutputStream::Write64(wxInt64 i) -{ - Write64(&i, 1); -} -#endif // wxHAS_INT64 - -void wxDataOutputStream::Write32(wxUint32 i) -{ - wxUint32 i32; - - if (m_be_order) - i32 = wxUINT32_SWAP_ON_LE(i); - else - i32 = wxUINT32_SWAP_ON_BE(i); - m_output->Write(&i32, 4); -} - -void wxDataOutputStream::Write16(wxUint16 i) -{ - wxUint16 i16; - - if (m_be_order) - i16 = wxUINT16_SWAP_ON_LE(i); - else - i16 = wxUINT16_SWAP_ON_BE(i); - - m_output->Write(&i16, 2); -} - -void wxDataOutputStream::Write8(wxUint8 i) -{ - m_output->Write(&i, 1); -} - -void wxDataOutputStream::WriteString(const wxString& string) -{ -#if wxUSE_UNICODE - const wxWX2MBbuf buf = string.mb_str(*m_conv); -#else - const wxWX2MBbuf buf = string.mb_str(); -#endif - size_t len = strlen(buf); - Write32(len); - if (len > 0) - m_output->Write(buf, len); -} - -void wxDataOutputStream::WriteDouble(double d) -{ - char buf[10]; - -#if wxUSE_APPLE_IEEE - ConvertToIeeeExtended(d, (wxInt8 *)buf); -#else -#if !defined(__VMS__) && !defined(__GNUG__) -# pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!" -#endif - buf[0] = '\0'; -#endif - m_output->Write(buf, 10); -} - -#if wxHAS_INT64 -void wxDataOutputStream::Write64(const wxUint64 *buffer, size_t size) -{ -#ifndef wxLongLong_t - DoWriteLL(buffer, size, m_output, m_be_order); -#else - DoWriteI64(buffer, size, m_output, m_be_order); -#endif -} - -void wxDataOutputStream::Write64(const wxInt64 *buffer, size_t size) -{ -#ifndef wxLongLong_t - DoWriteLL(buffer, size, m_output, m_be_order); -#else - DoWriteI64(buffer, size, m_output, m_be_order); -#endif -} -#endif // wxHAS_INT64 - -#if defined(wxLongLong_t) && wxUSE_LONGLONG -void wxDataOutputStream::Write64(const wxULongLong *buffer, size_t size) -{ - DoWriteLL(buffer, size, m_output, m_be_order); -} - -void wxDataOutputStream::Write64(const wxLongLong *buffer, size_t size) -{ - DoWriteLL(buffer, size, m_output, m_be_order); -} -#endif // wxLongLong_t - -#if wxUSE_LONGLONG -void wxDataOutputStream::WriteLL(const wxULongLong *buffer, size_t size) -{ - DoWriteLL(buffer, size, m_output, m_be_order); -} - -void wxDataOutputStream::WriteLL(const wxLongLong *buffer, size_t size) -{ - DoWriteLL(buffer, size, m_output, m_be_order); -} - -void wxDataOutputStream::WriteLL(const wxLongLong &ll) -{ - WriteLL(&ll, 1); -} - -void wxDataOutputStream::WriteLL(const wxULongLong &ll) -{ - WriteLL(&ll, 1); -} -#endif // wxUSE_LONGLONG - -void wxDataOutputStream::Write32(const wxUint32 *buffer, size_t size) -{ - if (m_be_order) - { - for (wxUint32 i=0; iWrite(&i32, 4); - } - } - else - { - for (wxUint32 i=0; iWrite(&i32, 4); - } - } -} - -void wxDataOutputStream::Write16(const wxUint16 *buffer, size_t size) -{ - if (m_be_order) - { - for (wxUint32 i=0; iWrite(&i16, 2); - } - } - else - { - for (wxUint32 i=0; iWrite(&i16, 2); - } - } -} - -void wxDataOutputStream::Write8(const wxUint8 *buffer, size_t size) -{ - m_output->Write(buffer, size); -} - -void wxDataOutputStream::WriteDouble(const double *buffer, size_t size) -{ - for (wxUint32 i=0; iWrite((const char *)string, wxStrlen(string)*sizeof(wxChar)); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(const wxString& string) -{ - WriteString(string); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxInt8 c) -{ - Write8((wxUint8)c); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxInt16 i) -{ - Write16((wxUint16)i); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxInt32 i) -{ - Write32((wxUint32)i); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxUint8 c) -{ - Write8(c); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxUint16 i) -{ - Write16(i); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxUint32 i) -{ - Write32(i); - return *this; -} - -#if wxHAS_INT64 -wxDataOutputStream& wxDataOutputStream::operator<<(wxUint64 i) -{ - Write64(i); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(wxInt64 i) -{ - Write64(i); - return *this; -} -#endif // wxHAS_INT64 - -#if defined(wxLongLong_t) && wxUSE_LONGLONG -wxDataOutputStream& wxDataOutputStream::operator<<(const wxULongLong &i) -{ - WriteLL(i); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(const wxLongLong &i) -{ - WriteLL(i); - return *this; -} -#endif // wxLongLong_t - -wxDataOutputStream& wxDataOutputStream::operator<<(double f) -{ - WriteDouble(f); - return *this; -} - -wxDataOutputStream& wxDataOutputStream::operator<<(float f) -{ - WriteDouble((double)f); - return *this; -} - -#endif - // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/dcbase.cpp b/Source/3rdParty/wx/src/common/dcbase.cpp deleted file mode 100644 index ecc821d00..000000000 --- a/Source/3rdParty/wx/src/common/dcbase.cpp +++ /dev/null @@ -1,1174 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dcbase.cpp -// Purpose: generic methods of the wxDC Class -// Author: Vadim Zeitlin -// Modified by: -// Created: 05/25/99 -// RCS-ID: $Id: dcbase.cpp 56135 2008-10-06 21:04:02Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/dc.h" -#include "wx/dcbuffer.h" // for IMPLEMENT_DYNAMIC_CLASS - -#ifndef WX_PRECOMP - #include "wx/math.h" -#endif - -// bool wxDCBase::sm_cacheing = false; - -IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject) - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC, wxMemoryDC) -IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC, wxBufferedDC) - -#if WXWIN_COMPATIBILITY_2_6 -void wxDCBase::BeginDrawing() -{ -} - -void wxDCBase::EndDrawing() -{ -} -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// special symbols -// ---------------------------------------------------------------------------- - -void wxDCBase::DoDrawCheckMark(wxCoord x1, wxCoord y1, - wxCoord width, wxCoord height) -{ - wxCHECK_RET( Ok(), wxT("invalid window dc") ); - - wxCoord x2 = x1 + width, - y2 = y1 + height; - - // the pen width is calibrated to give 3 for width == height == 10 - wxDCPenChanger pen((wxDC&)*this, - wxPen(GetTextForeground(), (width + height + 1)/7)); - - // we're drawing a scaled version of wx/generic/tick.xpm here - wxCoord x3 = x1 + (4*width) / 10, // x of the tick bottom - y3 = y1 + height / 2; // y of the left tick branch - DoDrawLine(x1, y3, x3, y2); - DoDrawLine(x3, y2, x2, y1); - - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); -} - -// ---------------------------------------------------------------------------- -// line/polygons -// ---------------------------------------------------------------------------- - -void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset) -{ - int n = list->GetCount(); - wxPoint *points = new wxPoint[n]; - - int i = 0; - for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) - { - wxPoint *point = (wxPoint *)node->GetData(); - points[i].x = point->x; - points[i].y = point->y; - } - - DoDrawLines(n, points, xoffset, yoffset); - - delete [] points; -} - - -void wxDCBase::DrawPolygon(const wxList *list, - wxCoord xoffset, wxCoord yoffset, - int fillStyle) -{ - int n = list->GetCount(); - wxPoint *points = new wxPoint[n]; - - int i = 0; - for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) - { - wxPoint *point = (wxPoint *)node->GetData(); - points[i].x = point->x; - points[i].y = point->y; - } - - DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); - - delete [] points; -} - -void -wxDCBase::DoDrawPolyPolygon(int n, - int count[], - wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle) -{ - if ( n == 1 ) - { - DoDrawPolygon(count[0], points, xoffset, yoffset, fillStyle); - return; - } - - int i, j, lastOfs; - wxPoint* pts; - wxPen pen; - - for (i = j = lastOfs = 0; i < n; i++) - { - lastOfs = j; - j += count[i]; - } - pts = new wxPoint[j+n-1]; - for (i = 0; i < j; i++) - pts[i] = points[i]; - for (i = 2; i <= n; i++) - { - lastOfs -= count[n-i]; - pts[j++] = pts[lastOfs]; - } - - pen = GetPen(); - SetPen(wxPen(*wxBLACK, 0, wxTRANSPARENT)); - DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle); - SetPen(pen); - for (i = j = 0; i < n; i++) - { - DoDrawLines(count[i], pts+j, xoffset, yoffset); - j += count[i]; - } - delete[] pts; -} - -// ---------------------------------------------------------------------------- -// splines -// ---------------------------------------------------------------------------- - -#if wxUSE_SPLINES - -// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) -void wxDCBase::DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) -{ - wxList point_list; - - wxPoint *point1 = new wxPoint; - point1->x = x1; point1->y = y1; - point_list.Append((wxObject*)point1); - - wxPoint *point2 = new wxPoint; - point2->x = x2; point2->y = y2; - point_list.Append((wxObject*)point2); - - wxPoint *point3 = new wxPoint; - point3->x = x3; point3->y = y3; - point_list.Append((wxObject*)point3); - - DrawSpline(&point_list); - - for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = (wxPoint *)node->GetData(); - delete p; - } -} - -void wxDCBase::DrawSpline(int n, wxPoint points[]) -{ - wxList list; - for (int i =0; i < n; i++) - { - list.Append((wxObject*)&points[i]); - } - - DrawSpline(&list); -} - -// ----------------------------------- spline code ---------------------------------------- - -void wx_quadratic_spline(double a1, double b1, double a2, double b2, - double a3, double b3, double a4, double b4); -void wx_clear_stack(); -int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3, - double *y3, double *x4, double *y4); -void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, - double x4, double y4); -static bool wx_spline_add_point(double x, double y); -static void wx_spline_draw_point_array(wxDCBase *dc); - -wxList wx_spline_point_list; - -#define half(z1, z2) ((z1+z2)/2.0) -#define THRESHOLD 5 - -/* iterative version */ - -void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4, - double b4) -{ - register double xmid, ymid; - double x1, y1, x2, y2, x3, y3, x4, y4; - - wx_clear_stack(); - wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4); - - while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) { - xmid = (double)half(x2, x3); - ymid = (double)half(y2, y3); - if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD && - fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) { - wx_spline_add_point( x1, y1 ); - wx_spline_add_point( xmid, ymid ); - } else { - wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3), - (double)half(x3, x4), (double)half(y3, y4), x4, y4); - wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2), - (double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid); - } - } -} - -/* utilities used by spline drawing routines */ - -typedef struct wx_spline_stack_struct { - double x1, y1, x2, y2, x3, y3, x4, y4; -} Stack; - -#define SPLINE_STACK_DEPTH 20 -static Stack wx_spline_stack[SPLINE_STACK_DEPTH]; -static Stack *wx_stack_top; -static int wx_stack_count; - -void wx_clear_stack() -{ - wx_stack_top = wx_spline_stack; - wx_stack_count = 0; -} - -void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) -{ - wx_stack_top->x1 = x1; - wx_stack_top->y1 = y1; - wx_stack_top->x2 = x2; - wx_stack_top->y2 = y2; - wx_stack_top->x3 = x3; - wx_stack_top->y3 = y3; - wx_stack_top->x4 = x4; - wx_stack_top->y4 = y4; - wx_stack_top++; - wx_stack_count++; -} - -int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, - double *x3, double *y3, double *x4, double *y4) -{ - if (wx_stack_count == 0) - return (0); - wx_stack_top--; - wx_stack_count--; - *x1 = wx_stack_top->x1; - *y1 = wx_stack_top->y1; - *x2 = wx_stack_top->x2; - *y2 = wx_stack_top->y2; - *x3 = wx_stack_top->x3; - *y3 = wx_stack_top->y3; - *x4 = wx_stack_top->x4; - *y4 = wx_stack_top->y4; - return (1); -} - -static bool wx_spline_add_point(double x, double y) -{ - wxPoint *point = new wxPoint ; - point->x = (int) x; - point->y = (int) y; - wx_spline_point_list.Append((wxObject*)point); - return true; -} - -static void wx_spline_draw_point_array(wxDCBase *dc) -{ - dc->DrawLines(&wx_spline_point_list, 0, 0 ); - wxList::compatibility_iterator node = wx_spline_point_list.GetFirst(); - while (node) - { - wxPoint *point = (wxPoint *)node->GetData(); - delete point; - wx_spline_point_list.Erase(node); - node = wx_spline_point_list.GetFirst(); - } -} - -void wxDCBase::DoDrawSpline( wxList *points ) -{ - wxCHECK_RET( Ok(), wxT("invalid window dc") ); - - wxPoint *p; - double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; - double x1, y1, x2, y2; - - wxList::compatibility_iterator node = points->GetFirst(); - if (!node) - // empty list - return; - - p = (wxPoint *)node->GetData(); - - x1 = p->x; - y1 = p->y; - - node = node->GetNext(); - p = (wxPoint *)node->GetData(); - - x2 = p->x; - y2 = p->y; - cx1 = (double)((x1 + x2) / 2); - cy1 = (double)((y1 + y2) / 2); - cx2 = (double)((cx1 + x2) / 2); - cy2 = (double)((cy1 + y2) / 2); - - wx_spline_add_point(x1, y1); - - while ((node = node->GetNext()) -#if !wxUSE_STL - != NULL -#endif // !wxUSE_STL - ) - { - p = (wxPoint *)node->GetData(); - x1 = x2; - y1 = y2; - x2 = p->x; - y2 = p->y; - cx4 = (double)(x1 + x2) / 2; - cy4 = (double)(y1 + y2) / 2; - cx3 = (double)(x1 + cx4) / 2; - cy3 = (double)(y1 + cy4) / 2; - - wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4); - - cx1 = cx4; - cy1 = cy4; - cx2 = (double)(cx1 + x2) / 2; - cy2 = (double)(cy1 + y2) / 2; - } - - wx_spline_add_point( cx1, cy1 ); - wx_spline_add_point( x2, y2 ); - - wx_spline_draw_point_array( this ); -} - -#endif // wxUSE_SPLINES - -// ---------------------------------------------------------------------------- -// Partial Text Extents -// ---------------------------------------------------------------------------- - - -// Each element of the widths array will be the width of the string up to and -// including the corresponding character in text. This is the generic -// implementation, the port-specific classes should do this with native APIs -// if available and if faster. Note: pango_layout_index_to_pos is much slower -// than calling GetTextExtent!! - -#define FWC_SIZE 256 - -class FontWidthCache -{ -public: - FontWidthCache() : m_scaleX(1), m_widths(NULL) { } - ~FontWidthCache() { delete []m_widths; } - - void Reset() - { - if (!m_widths) - m_widths = new int[FWC_SIZE]; - - memset(m_widths, 0, sizeof(int)*FWC_SIZE); - } - - wxFont m_font; - double m_scaleX; - int *m_widths; -}; - -static FontWidthCache s_fontWidthCache; - -bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const -{ - int totalWidth = 0; - - const size_t len = text.length(); - widths.Empty(); - widths.Add(0, len); - - // reset the cache if font or horizontal scale have changed - if ( !s_fontWidthCache.m_widths || - !wxIsSameDouble(s_fontWidthCache.m_scaleX, m_scaleX) || - (s_fontWidthCache.m_font != GetFont()) ) - { - s_fontWidthCache.Reset(); - s_fontWidthCache.m_font = GetFont(); - s_fontWidthCache.m_scaleX = m_scaleX; - } - - // Calculate the position of each character based on the widths of - // the previous characters - int w, h; - for ( size_t i = 0; i < len; i++ ) - { - const wxChar c = text[i]; - unsigned int c_int = (unsigned int)c; - - if ((c_int < FWC_SIZE) && (s_fontWidthCache.m_widths[c_int] != 0)) - { - w = s_fontWidthCache.m_widths[c_int]; - } - else - { - GetTextExtent(c, &w, &h); - if (c_int < FWC_SIZE) - s_fontWidthCache.m_widths[c_int] = w; - } - - totalWidth += w; - widths[i] = totalWidth; - } - - return true; -} - - -// ---------------------------------------------------------------------------- -// enhanced text drawing -// ---------------------------------------------------------------------------- - -void wxDCBase::GetMultiLineTextExtent(const wxString& text, - wxCoord *x, - wxCoord *y, - wxCoord *h, - wxFont *font) const -{ - wxCoord widthTextMax = 0, widthLine, - heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; - - wxString curLine; - for ( const wxChar *pc = text; ; pc++ ) - { - if ( *pc == _T('\n') || *pc == _T('\0') ) - { - if ( curLine.empty() ) - { - // we can't use GetTextExtent - it will return 0 for both width - // and height and an empty line should count in height - // calculation - - // assume that this line has the same height as the previous - // one - if ( !heightLineDefault ) - heightLineDefault = heightLine; - - if ( !heightLineDefault ) - { - // but we don't know it yet - choose something reasonable - GetTextExtent(_T("W"), NULL, &heightLineDefault, - NULL, NULL, font); - } - - heightTextTotal += heightLineDefault; - } - else - { - GetTextExtent(curLine, &widthLine, &heightLine, - NULL, NULL, font); - if ( widthLine > widthTextMax ) - widthTextMax = widthLine; - heightTextTotal += heightLine; - } - - if ( *pc == _T('\n') ) - { - curLine.clear(); - } - else - { - // the end of string - break; - } - } - else - { - curLine += *pc; - } - } - - if ( x ) - *x = widthTextMax; - if ( y ) - *y = heightTextTotal; - if ( h ) - *h = heightLine; -} - -void wxDCBase::DrawLabel(const wxString& text, - const wxBitmap& bitmap, - const wxRect& rect, - int alignment, - int indexAccel, - wxRect *rectBounding) -{ - // find the text position - wxCoord widthText, heightText, heightLine; - GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine); - - wxCoord width, height; - if ( bitmap.Ok() ) - { - width = widthText + bitmap.GetWidth(); - height = bitmap.GetHeight(); - } - else // no bitmap - { - width = widthText; - height = heightText; - } - - wxCoord x, y; - if ( alignment & wxALIGN_RIGHT ) - { - x = rect.GetRight() - width; - } - else if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) - { - x = (rect.GetLeft() + rect.GetRight() + 1 - width) / 2; - } - else // alignment & wxALIGN_LEFT - { - x = rect.GetLeft(); - } - - if ( alignment & wxALIGN_BOTTOM ) - { - y = rect.GetBottom() - height; - } - else if ( alignment & wxALIGN_CENTRE_VERTICAL ) - { - y = (rect.GetTop() + rect.GetBottom() + 1 - height) / 2; - } - else // alignment & wxALIGN_TOP - { - y = rect.GetTop(); - } - - // draw the bitmap first - wxCoord x0 = x, - y0 = y, - width0 = width; - if ( bitmap.Ok() ) - { - DrawBitmap(bitmap, x, y, true /* use mask */); - - wxCoord offset = bitmap.GetWidth() + 4; - x += offset; - width -= offset; - - y += (height - heightText) / 2; - } - - // we will draw the underscore under the accel char later - wxCoord startUnderscore = 0, - endUnderscore = 0, - yUnderscore = 0; - - // split the string into lines and draw each of them separately - wxString curLine; - for ( const wxChar *pc = text; ; pc++ ) - { - if ( *pc == _T('\n') || *pc == _T('\0') ) - { - int xRealStart = x; // init it here to avoid compielr warnings - - if ( !curLine.empty() ) - { - // NB: can't test for !(alignment & wxALIGN_LEFT) because - // wxALIGN_LEFT is 0 - if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) ) - { - wxCoord widthLine; - GetTextExtent(curLine, &widthLine, NULL); - - if ( alignment & wxALIGN_RIGHT ) - { - xRealStart += width - widthLine; - } - else // if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) - { - xRealStart += (width - widthLine) / 2; - } - } - //else: left aligned, nothing to do - - DrawText(curLine, xRealStart, y); - } - - y += heightLine; - - // do we have underscore in this line? we can check yUnderscore - // because it is set below to just y + heightLine if we do - if ( y == yUnderscore ) - { - // adjust the horz positions to account for the shift - startUnderscore += xRealStart; - endUnderscore += xRealStart; - } - - if ( *pc == _T('\0') ) - break; - - curLine.clear(); - } - else // not end of line - { - if ( pc - text.c_str() == indexAccel ) - { - // remeber to draw underscore here - GetTextExtent(curLine, &startUnderscore, NULL); - curLine += *pc; - GetTextExtent(curLine, &endUnderscore, NULL); - - yUnderscore = y + heightLine; - } - else - { - curLine += *pc; - } - } - } - - // draw the underscore if found - if ( startUnderscore != endUnderscore ) - { - // it should be of the same colour as text - SetPen(wxPen(GetTextForeground(), 0, wxSOLID)); - - yUnderscore--; - - DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore); - } - - // return bounding rect if requested - if ( rectBounding ) - { - *rectBounding = wxRect(x, y - heightText, widthText, heightText); - } - - CalcBoundingBox(x0, y0); - CalcBoundingBox(x0 + width0, y0 + height); -} - - -void wxDCBase::DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection) -{ - // save old pen - wxPen oldPen = m_pen; - wxBrush oldBrush = m_brush; - - wxUint8 nR1 = initialColour.Red(); - wxUint8 nG1 = initialColour.Green(); - wxUint8 nB1 = initialColour.Blue(); - wxUint8 nR2 = destColour.Red(); - wxUint8 nG2 = destColour.Green(); - wxUint8 nB2 = destColour.Blue(); - wxUint8 nR, nG, nB; - - if ( nDirection == wxEAST || nDirection == wxWEST ) - { - wxInt32 x = rect.GetWidth(); - wxInt32 w = x; // width of area to shade - wxInt32 xDelta = w/256; // height of one shade bend - if (xDelta < 1) - xDelta = 1; - - while (x >= xDelta) - { - x -= xDelta; - if (nR1 > nR2) - nR = nR1 - (nR1-nR2)*(w-x)/w; - else - nR = nR1 + (nR2-nR1)*(w-x)/w; - - if (nG1 > nG2) - nG = nG1 - (nG1-nG2)*(w-x)/w; - else - nG = nG1 + (nG2-nG1)*(w-x)/w; - - if (nB1 > nB2) - nB = nB1 - (nB1-nB2)*(w-x)/w; - else - nB = nB1 + (nB2-nB1)*(w-x)/w; - - wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxSOLID)); - SetBrush(wxBrush(colour)); - if(nDirection == wxEAST) - DrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), - xDelta, rect.GetHeight()); - else //nDirection == wxWEST - DrawRectangle(rect.GetLeft()+x, rect.GetTop(), - xDelta, rect.GetHeight()); - } - } - else // nDirection == wxNORTH || nDirection == wxSOUTH - { - wxInt32 y = rect.GetHeight(); - wxInt32 w = y; // height of area to shade - wxInt32 yDelta = w/255; // height of one shade bend - if (yDelta < 1) - yDelta = 1; - - while (y > 0) - { - y -= yDelta; - if (nR1 > nR2) - nR = nR1 - (nR1-nR2)*(w-y)/w; - else - nR = nR1 + (nR2-nR1)*(w-y)/w; - - if (nG1 > nG2) - nG = nG1 - (nG1-nG2)*(w-y)/w; - else - nG = nG1 + (nG2-nG1)*(w-y)/w; - - if (nB1 > nB2) - nB = nB1 - (nB1-nB2)*(w-y)/w; - else - nB = nB1 + (nB2-nB1)*(w-y)/w; - - wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxSOLID)); - SetBrush(wxBrush(colour)); - if(nDirection == wxNORTH) - DrawRectangle(rect.GetLeft(), rect.GetTop()+y, - rect.GetWidth(), yDelta); - else //nDirection == wxSOUTH - DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1, - rect.GetWidth(), yDelta); - } - } - - SetPen(oldPen); - SetBrush(oldBrush); -} - -void wxDCBase::DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter) -{ - //save the old pen color - wxColour oldPenColour = m_pen.GetColour(); - - wxUint8 nR1 = destColour.Red(); - wxUint8 nG1 = destColour.Green(); - wxUint8 nB1 = destColour.Blue(); - wxUint8 nR2 = initialColour.Red(); - wxUint8 nG2 = initialColour.Green(); - wxUint8 nB2 = initialColour.Blue(); - wxUint8 nR, nG, nB; - - - //Radius - wxInt32 cx = rect.GetWidth() / 2; - wxInt32 cy = rect.GetHeight() / 2; - wxInt32 nRadius; - if (cx < cy) - nRadius = cx; - else - nRadius = cy; - - //Offset of circle - wxInt32 nCircleOffX = circleCenter.x - (rect.GetWidth() / 2); - wxInt32 nCircleOffY = circleCenter.y - (rect.GetHeight() / 2); - - for ( wxInt32 x = 0; x < rect.GetWidth(); x++ ) - { - for ( wxInt32 y = 0; y < rect.GetHeight(); y++ ) - { - //get color difference - wxInt32 nGradient = ((nRadius - - (wxInt32)sqrt( - pow((double)(x - cx - nCircleOffX), 2) + - pow((double)(y - cy - nCircleOffY), 2) - )) * 100) / nRadius; - - //normalize Gradient - if (nGradient < 0 ) - nGradient = 0; - - //get dest colors - nR = (wxUint8)(nR1 + ((nR2 - nR1) * nGradient / 100)); - nG = (wxUint8)(nG1 + ((nG2 - nG1) * nGradient / 100)); - nB = (wxUint8)(nB1 + ((nB2 - nB1) * nGradient / 100)); - - //set the pixel - m_pen.SetColour(wxColour(nR,nG,nB)); - DrawPoint(wxPoint(x + rect.GetLeft(), y + rect.GetTop())); - } - } - //return old pen color - m_pen.SetColour(oldPenColour); -} - -/* -Notes for wxWidgets DrawEllipticArcRot(...) - -wxDCBase::DrawEllipticArcRot(...) draws a rotated elliptic arc or an ellipse. -It uses wxDCBase::CalculateEllipticPoints(...) and wxDCBase::Rotate(...), -which are also new. - -All methods are generic, so they can be implemented in wxDCBase. -DoDrawEllipticArcRot(...) is virtual, so it can be called from deeper -methods like (WinCE) wxDC::DoDrawArc(...). - -CalculateEllipticPoints(...) fills a given list of wxPoints with some points -of an elliptic arc. The algorithm is pixel-based: In every row (in flat -parts) or every column (in steep parts) only one pixel is calculated. -Trigonometric calculation (sin, cos, tan, atan) is only done if the -starting angle is not equal to the ending angle. The calculation of the -pixels is done using simple arithmetic only and should perform not too -bad even on devices without floating point processor. I didn't test this yet. - -Rotate(...) rotates a list of point pixel-based, you will see rounding errors. -For instance: an ellipse rotated 180 degrees is drawn -slightly different from the original. - -The points are then moved to an array and used to draw a polyline and/or polygon -(with center added, the pie). -The result looks quite similar to the native ellipse, only e few pixels differ. - -The performance on a desktop system (Athlon 1800, WinXP) is about 7 times -slower as DrawEllipse(...), which calls the native API. -An rotated ellipse outside the clipping region takes nearly the same time, -while an native ellipse outside takes nearly no time to draw. - -If you draw an arc with this new method, you will see the starting and ending angles -are calculated properly. -If you use DrawEllipticArc(...), you will see they are only correct for circles -and not properly calculated for ellipses. - -Peter Lenhard -p.lenhard@t-online.de -*/ - -#ifdef __WXWINCE__ -void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa, double ea, double angle ) -{ - wxList list; - - CalculateEllipticPoints( &list, x, y, w, h, sa, ea ); - Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) ); - - // Add center (for polygon/pie) - list.Append( (wxObject*) new wxPoint( x+w/2, y+h/2 ) ); - - // copy list into array and delete list elements - int n = list.GetCount(); - wxPoint *points = new wxPoint[n]; - int i = 0; - wxNode* node = 0; - for ( node = list.GetFirst(); node; node = node->GetNext(), i++ ) - { - wxPoint *point = (wxPoint *)node->GetData(); - points[i].x = point->x; - points[i].y = point->y; - delete point; - } - - // first draw the pie without pen, if necessary - if( GetBrush() != *wxTRANSPARENT_BRUSH ) - { - wxPen tempPen( GetPen() ); - SetPen( *wxTRANSPARENT_PEN ); - DoDrawPolygon( n, points, 0, 0 ); - SetPen( tempPen ); - } - - // then draw the arc without brush, if necessary - if( GetPen() != *wxTRANSPARENT_PEN ) - { - // without center - DoDrawLines( n-1, points, 0, 0 ); - } - - delete [] points; - -} // DrawEllipticArcRot - -void wxDCBase::Rotate( wxList* points, double angle, wxPoint center ) -{ - if( angle != 0.0 ) - { - double pi(M_PI); - double dSinA = -sin(angle*2.0*pi/360.0); - double dCosA = cos(angle*2.0*pi/360.0); - for ( wxNode* node = points->GetFirst(); node; node = node->GetNext() ) - { - wxPoint* point = (wxPoint*)node->GetData(); - - // transform coordinates, if necessary - if( center.x ) point->x -= center.x; - if( center.y ) point->y -= center.y; - - // calculate rotation, rounding simply by implicit cast to integer - int xTemp = point->x * dCosA - point->y * dSinA; - point->y = point->x * dSinA + point->y * dCosA; - point->x = xTemp; - - // back transform coordinates, if necessary - if( center.x ) point->x += center.x; - if( center.y ) point->y += center.y; - } - } -} - -void wxDCBase::CalculateEllipticPoints( wxList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ) -{ - double pi = M_PI; - double sar = 0; - double ear = 0; - int xsa = 0; - int ysa = 0; - int xea = 0; - int yea = 0; - int sq = 0; - int eq = 0; - bool bUseAngles = false; - if( w<0 ) w = -w; - if( h<0 ) h = -h; - // half-axes - wxCoord a = w/2; - wxCoord b = h/2; - // decrement 1 pixel if ellipse is smaller than 2*a, 2*b - int decrX = 0; - if( 2*a == w ) decrX = 1; - int decrY = 0; - if( 2*b == h ) decrY = 1; - // center - wxCoord xCenter = xStart + a; - wxCoord yCenter = yStart + b; - // calculate data for start and end, if necessary - if( sa != ea ) - { - bUseAngles = true; - // normalisation of angles - while( sa<0 ) sa += 360; - while( ea<0 ) ea += 360; - while( sa>=360 ) sa -= 360; - while( ea>=360 ) ea -= 360; - // calculate quadrant numbers - if( sa > 270 ) sq = 3; - else if( sa > 180 ) sq = 2; - else if( sa > 90 ) sq = 1; - if( ea > 270 ) eq = 3; - else if( ea > 180 ) eq = 2; - else if( ea > 90 ) eq = 1; - sar = sa * pi / 180.0; - ear = ea * pi / 180.0; - // correct angle circle -> ellipse - sar = atan( -a/(double)b * tan( sar ) ); - if ( sq == 1 || sq == 2 ) sar += pi; - ear = atan( -a/(double)b * tan( ear ) ); - if ( eq == 1 || eq == 2 ) ear += pi; - // coordinates of points - xsa = xCenter + a * cos( sar ); - if( sq == 0 || sq == 3 ) xsa -= decrX; - ysa = yCenter + b * sin( sar ); - if( sq == 2 || sq == 3 ) ysa -= decrY; - xea = xCenter + a * cos( ear ); - if( eq == 0 || eq == 3 ) xea -= decrX; - yea = yCenter + b * sin( ear ); - if( eq == 2 || eq == 3 ) yea -= decrY; - } // if iUseAngles - // calculate c1 = b^2, c2 = b^2/a^2 with a = w/2, b = h/2 - double c1 = b * b; - double c2 = 2.0 / w; - c2 *= c2; - c2 *= c1; - wxCoord x = 0; - wxCoord y = b; - long x2 = 1; - long y2 = y*y; - long y2_old = 0; - long y_old = 0; - // Lists for quadrant 1 to 4 - wxList pointsarray[4]; - // Calculate points for first quadrant and set in all quadrants - for( x = 0; x <= a; ++x ) - { - x2 = x2+x+x-1; - y2_old = y2; - y_old = y; - bool bNewPoint = false; - while( y2 > c1 - c2 * x2 && y > 0 ) - { - bNewPoint = true; - y2 = y2-y-y+1; - --y; - } - // old y now to big: set point with old y, old x - if( bNewPoint && x>1) - { - int x1 = x - 1; - // remove points on the same line - pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); - pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - x1, yCenter - y_old ) ); - pointsarray[2].Insert( (wxObject*) new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); - pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); - } // set point - } // calculate point - - // Starting and/or ending points for the quadrants, first quadrant gets both. - pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); - pointsarray[0].Append( (wxObject*) new wxPoint( xCenter, yCenter - b ) ); - pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - a, yCenter ) ); - pointsarray[2].Append( (wxObject*) new wxPoint( xCenter, yCenter + b - decrY ) ); - pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); - - // copy quadrants in original list - if( bUseAngles ) - { - // Copy the right part of the points in the lists - // and delete the wxPoints, because they do not leave this method. - points->Append( (wxObject*) new wxPoint( xsa, ysa ) ); - int q = sq; - bool bStarted = false; - bool bReady = false; - bool bForceTurn = ( sq == eq && sa > ea ); - while( !bReady ) - { - for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) - { - // once: go to starting point in start quadrant - if( !bStarted && - ( - ( (wxPoint*) node->GetData() )->x < xsa+1 && q <= 1 - || - ( (wxPoint*) node->GetData() )->x > xsa-1 && q >= 2 - ) - ) - { - bStarted = true; - } - - // copy point, if not at ending point - if( bStarted ) - { - if( q != eq || bForceTurn - || - ( (wxPoint*) node->GetData() )->x > xea+1 && q <= 1 - || - ( (wxPoint*) node->GetData() )->x < xea-1 && q >= 2 - ) - { - // copy point - wxPoint* pPoint = new wxPoint( *((wxPoint*) node->GetData() ) ); - points->Append( (wxObject*) pPoint ); - } - else if( q == eq && !bForceTurn || ( (wxPoint*) node->GetData() )->x == xea) - { - bReady = true; - } - } - } // for node - ++q; - if( q > 3 ) q = 0; - bForceTurn = false; - bStarted = true; - } // while not bReady - points->Append( (wxObject*) new wxPoint( xea, yea ) ); - - // delete points - for( q = 0; q < 4; ++q ) - { - for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = (wxPoint *)node->GetData(); - delete p; - } - } - } - else - { - wxNode* node; - // copy whole ellipse, wxPoints will be deleted outside - for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() ) - { - wxObject *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() ) - { - wxObject *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() ) - { - wxObject *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() ) - { - wxObject *p = node->GetData(); - points->Append( p ); - } - } // not iUseAngles -} // CalculateEllipticPoints - -#endif - - -float wxDCBase::GetFontPointSizeAdjustment(float dpi) -{ - // wxMSW has long-standing bug where wxFont point size is interpreted as - // "pixel size corresponding to given point size *on screen*". In other - // words, on a typical 600dpi printer and a typical 96dpi screen, fonts - // are ~6 times smaller when printing. Unfortunately, this bug is so severe - // that *all* printing code has to account for it and consequently, other - // ports need to emulate this bug too: - const wxSize screenPixels = wxGetDisplaySize(); - const wxSize screenMM = wxGetDisplaySizeMM(); - const float screenPPI_y = (screenPixels.y * 25.4) / screenMM.y; - return screenPPI_y / dpi; -} diff --git a/Source/3rdParty/wx/src/common/dcbufcmn.cpp b/Source/3rdParty/wx/src/common/dcbufcmn.cpp deleted file mode 100644 index 3ac28eae9..000000000 --- a/Source/3rdParty/wx/src/common/dcbufcmn.cpp +++ /dev/null @@ -1,95 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dcbufcmn.cpp -// Purpose: Buffered DC implementation -// Author: Ron Lee, Jaakko Salli -// Modified by: -// Created: Sep-20-2006 -// RCS-ID: $Id: dcbufcmn.cpp 52152 2008-02-27 18:03:12Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/dcbuffer.h" - -#ifndef WX_PRECOMP - #include "wx/module.h" -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxSharedDCBufferManager: helper class maintaining backing store bitmap -// ---------------------------------------------------------------------------- - -class wxSharedDCBufferManager : public wxModule -{ -public: - wxSharedDCBufferManager() { } - - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDELETE(ms_buffer); } - - static wxBitmap* GetBuffer(int w, int h) - { - if ( !ms_buffer || - w > ms_buffer->GetWidth() || - h > ms_buffer->GetHeight() ) - { - delete ms_buffer; - - // we must always return a valid bitmap but creating a bitmap of - // size 0 would fail, so create a 1*1 bitmap in this case - if ( !w ) - w = 1; - if ( !h ) - h = 1; - - ms_buffer = new wxBitmap(w, h); - } - return ms_buffer; - } - -private: - static wxBitmap *ms_buffer; - - DECLARE_DYNAMIC_CLASS(wxSharedDCBufferManager) -}; - -wxBitmap* wxSharedDCBufferManager::ms_buffer = NULL; - -IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) - -// ============================================================================ -// wxBufferedDC -// ============================================================================ - -void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) -{ - if ( !m_buffer || !m_buffer->IsOk() ) - { - if ( w == -1 || h == -1 ) - m_dc->GetSize(&w, &h); - - m_buffer = wxSharedDCBufferManager::GetBuffer(w, h); - } - - SelectObject(*m_buffer); -} - diff --git a/Source/3rdParty/wx/src/common/dcgraph.cpp b/Source/3rdParty/wx/src/common/dcgraph.cpp deleted file mode 100644 index c9d5e11fe..000000000 --- a/Source/3rdParty/wx/src/common/dcgraph.cpp +++ /dev/null @@ -1,1034 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/graphcmn.cpp -// Purpose: graphics context methods common to all platforms -// Author: Stefan Csomor -// Modified by: -// Created: -// RCS-ID: $Id: dcgraph.cpp 60190 2009-04-16 00:57:35Z KO $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/graphics.h" - -#ifndef WX_PRECOMP - #include "wx/icon.h" - #include "wx/bitmap.h" - #include "wx/dcmemory.h" - #include "wx/region.h" -#endif - -#ifdef __WXMAC__ -#include "wx/mac/private.h" -#endif -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -static const double RAD2DEG = 180.0 / M_PI; - -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double DegToRad(double deg) -{ - return (deg * M_PI) / 180.0; -} - -//----------------------------------------------------------------------------- -// wxDC bridge class -//----------------------------------------------------------------------------- - -#ifdef __WXMAC__ -IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDCBase) -#else -IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC) -#endif - -wxGCDC::wxGCDC() -{ - Init(); -} - -void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) -{ - delete m_graphicContext; - m_graphicContext = ctx; - if ( m_graphicContext ) - { - m_matrixOriginal = m_graphicContext->GetTransform(); - m_ok = true; - // apply the stored transformations to the passed in context - ComputeScaleAndOrigin(); - m_graphicContext->SetFont( m_font , m_textForegroundColour ); - m_graphicContext->SetPen( m_pen ); - m_graphicContext->SetBrush( m_brush); - } -} - -wxGCDC::wxGCDC(const wxWindowDC& dc) -{ - Init(); - wxGraphicsContext* context; -#if wxUSE_CAIRO - wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetCairoRenderer(); - context = renderer->CreateContext(dc); -#else - context = wxGraphicsContext::Create(dc); -#endif - - SetGraphicsContext( context ); -} - -#ifdef __WXMSW__ -wxGCDC::wxGCDC(const wxMemoryDC& dc) -{ - Init(); - SetGraphicsContext( wxGraphicsContext::Create(dc) ); -} -#endif - -void wxGCDC::Init() -{ - m_ok = false; - m_colour = true; - m_mm_to_pix_x = mm2pt; - m_mm_to_pix_y = mm2pt; - - m_pen = *wxBLACK_PEN; - m_font = *wxNORMAL_FONT; - m_brush = *wxWHITE_BRUSH; - - m_graphicContext = NULL; - m_logicalFunctionSupported = true; -} - - -wxGCDC::~wxGCDC() -{ - delete m_graphicContext; -} - -void wxGCDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNUSED(useMask) ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") ); - wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") ); - - if ( bmp.GetDepth() == 1 ) - { - m_graphicContext->SetPen(*wxTRANSPARENT_PEN); - m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) ); - m_graphicContext->DrawRectangle( x , y , bmp.GetWidth() , bmp.GetHeight() ); - m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) ); - m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() ); - m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush)); - m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen)); - } - else - m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() ); -} - -void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") ); - wxCHECK_RET( icon.Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") ); - - wxCoord w = icon.GetWidth(); - wxCoord h = icon.GetHeight(); - - m_graphicContext->DrawIcon( icon , x, y, w, h ); -} - -bool wxGCDC::StartDoc( const wxString& WXUNUSED(message) ) -{ - return true; -} - -void wxGCDC::EndDoc() -{ -} - -void wxGCDC::StartPage() -{ -} - -void wxGCDC::EndPage() -{ -} - -void wxGCDC::Flush() -{ -#ifdef __WXMAC__ - CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() ); -#endif -} - -void wxGCDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") ); - - m_graphicContext->Clip( x, y, w, h ); - if ( m_clipping ) - { - m_clipX1 = wxMax( m_clipX1, x ); - m_clipY1 = wxMax( m_clipY1, y ); - m_clipX2 = wxMin( m_clipX2, (x + w) ); - m_clipY2 = wxMin( m_clipY2, (y + h) ); - } - else - { - m_clipping = true; - - m_clipX1 = x; - m_clipY1 = y; - m_clipX2 = x + w; - m_clipY2 = y + h; - } -} - -void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) -{ - // region is in device coordinates - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegionAsRegion - invalid DC") ); - - if (region.Empty()) - { - //DestroyClippingRegion(); - return; - } - - wxRegion logRegion( region ); - wxCoord x, y, w, h; - - logRegion.Offset( DeviceToLogicalX(0), DeviceToLogicalY(0) ); - logRegion.GetBox( x, y, w, h ); - - m_graphicContext->Clip( logRegion ); - if ( m_clipping ) - { - m_clipX1 = wxMax( m_clipX1, x ); - m_clipY1 = wxMax( m_clipY1, y ); - m_clipX2 = wxMin( m_clipX2, (x + w) ); - m_clipY2 = wxMin( m_clipY2, (y + h) ); - } - else - { - m_clipping = true; - - m_clipX1 = x; - m_clipY1 = y; - m_clipX2 = x + w; - m_clipY2 = y + h; - } -} - -void wxGCDC::DestroyClippingRegion() -{ - m_graphicContext->ResetClip(); - // currently the clip eg of a window extends to the area between the scrollbars - // so we must explicitely make sure it only covers the area we want it to draw - int width, height ; - GetSize( &width , &height ) ; - m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) ); - - m_graphicContext->SetPen( m_pen ); - m_graphicContext->SetBrush( m_brush ); - - m_clipping = false; -} - -void wxGCDC::DoGetSizeMM( int* width, int* height ) const -{ - int w = 0, h = 0; - - GetSize( &w, &h ); - if (width) - *width = long( double(w) / (m_scaleX * m_mm_to_pix_x) ); - if (height) - *height = long( double(h) / (m_scaleY * m_mm_to_pix_y) ); -} - -void wxGCDC::SetTextForeground( const wxColour &col ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") ); - - if ( col != m_textForegroundColour ) - { - m_textForegroundColour = col; - m_graphicContext->SetFont( m_font, m_textForegroundColour ); - } -} - -void wxGCDC::SetTextBackground( const wxColour &col ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") ); - - m_textBackgroundColour = col; -} - -void wxGCDC::SetMapMode( int mode ) -{ - switch (mode) - { - case wxMM_TWIPS: - SetLogicalScale( twips2mm * m_mm_to_pix_x, twips2mm * m_mm_to_pix_y ); - break; - - case wxMM_POINTS: - SetLogicalScale( pt2mm * m_mm_to_pix_x, pt2mm * m_mm_to_pix_y ); - break; - - case wxMM_METRIC: - SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); - break; - - case wxMM_LOMETRIC: - SetLogicalScale( m_mm_to_pix_x / 10.0, m_mm_to_pix_y / 10.0 ); - break; - - case wxMM_TEXT: - default: - SetLogicalScale( 1.0, 1.0 ); - break; - } - - ComputeScaleAndOrigin(); -} - -void wxGCDC::SetUserScale( double x, double y ) -{ - // allow negative ? -> no - - m_userScaleX = x; - m_userScaleY = y; - ComputeScaleAndOrigin(); -} - -void wxGCDC::SetLogicalScale( double x, double y ) -{ - // allow negative ? - m_logicalScaleX = x; - m_logicalScaleY = y; - ComputeScaleAndOrigin(); -} - -void wxGCDC::SetLogicalOrigin( wxCoord x, wxCoord y ) -{ - m_logicalOriginX = x * m_signX; // is this still correct ? - m_logicalOriginY = y * m_signY; - ComputeScaleAndOrigin(); -} - -void wxGCDC::SetDeviceOrigin( wxCoord x, wxCoord y ) -{ - m_deviceOriginX = x; - m_deviceOriginY = y; - ComputeScaleAndOrigin(); -} - -void wxGCDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) -{ - m_signX = (xLeftRight ? 1 : -1); - m_signY = (yBottomUp ? -1 : 1); - ComputeScaleAndOrigin(); -} - -wxSize wxGCDC::GetPPI() const -{ - return wxSize(72, 72); -} - -int wxGCDC::GetDepth() const -{ - return 32; -} - -void wxGCDC::ComputeScaleAndOrigin() -{ - m_scaleX = m_logicalScaleX * m_userScaleX; - m_scaleY = m_logicalScaleY * m_userScaleY; - - if ( m_graphicContext ) - { - m_matrixCurrent = m_graphicContext->CreateMatrix(); - m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY ); - m_matrixCurrent.Scale( m_scaleX, m_scaleY ); - // the logical origin sets the origin to have new coordinates - m_matrixCurrent.Translate( -m_logicalOriginX, -m_logicalOriginY ); - - m_graphicContext->SetTransform( m_matrixOriginal ); - m_graphicContext->ConcatTransform( m_matrixCurrent ); - } -} - -void wxGCDC::SetPalette( const wxPalette& WXUNUSED(palette) ) -{ - -} - -void wxGCDC::SetBackgroundMode( int mode ) -{ - m_backgroundMode = mode; -} - -void wxGCDC::SetFont( const wxFont &font ) -{ - m_font = font; - if ( m_graphicContext ) - { - wxFont f = font; - if ( f.Ok() ) - f.SetPointSize( /*LogicalToDeviceYRel*/(font.GetPointSize())); - m_graphicContext->SetFont( f, m_textForegroundColour ); - } -} - -void wxGCDC::SetPen( const wxPen &pen ) -{ - if ( m_pen == pen ) - return; - - m_pen = pen; - if ( m_graphicContext ) - { - m_graphicContext->SetPen( m_pen ); - } -} - -void wxGCDC::SetBrush( const wxBrush &brush ) -{ - if (m_brush == brush) - return; - - m_brush = brush; - if ( m_graphicContext ) - { - m_graphicContext->SetBrush( m_brush ); - } -} - -void wxGCDC::SetBackground( const wxBrush &brush ) -{ - if (m_backgroundBrush == brush) - return; - - m_backgroundBrush = brush; - if (!m_backgroundBrush.Ok()) - return; -} - -void wxGCDC::SetLogicalFunction( int function ) -{ - if (m_logicalFunction == function) - return; - - m_logicalFunction = function; - if ( m_graphicContext->SetLogicalFunction( function ) ) - m_logicalFunctionSupported=true; - else - m_logicalFunctionSupported=false; -} - -bool wxGCDC::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - const wxColour& WXUNUSED(col), int WXUNUSED(style)) -{ - return false; -} - -bool wxGCDC::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const -{ - // wxCHECK_MSG( 0 , false, wxT("wxGCDC(cg)::DoGetPixel - not implemented") ); - return false; -} - -void wxGCDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - m_graphicContext->StrokeLine(x1,y1,x2,y2); - - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); -} - -void wxGCDC::DoCrossHair( wxCoord x, wxCoord y ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - int w = 0, h = 0; - - GetSize( &w, &h ); - - m_graphicContext->StrokeLine(0,y,w,y); - m_graphicContext->StrokeLine(x,0,x,h); - - CalcBoundingBox(0, 0); - CalcBoundingBox(0+w, 0+h); -} - -void wxGCDC::DoDrawArc( wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - double dx = x1 - xc; - double dy = y1 - yc; - double radius = sqrt((double)(dx * dx + dy * dy)); - wxCoord rad = (wxCoord)radius; - double sa, ea; - if (x1 == x2 && y1 == y2) - { - sa = 0.0; - ea = 360.0; - } - else if (radius == 0.0) - { - sa = ea = 0.0; - } - else - { - sa = (x1 - xc == 0) ? - (y1 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y1 - yc), double(x1 - xc)) * RAD2DEG; - ea = (x2 - xc == 0) ? - (y2 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y2 - yc), double(x2 - xc)) * RAD2DEG; - } - - bool fill = m_brush.GetStyle() != wxTRANSPARENT; - - wxGraphicsPath path = m_graphicContext->CreatePath(); - if ( fill && ((x1!=x2)||(y1!=y2)) ) - path.MoveToPoint( xc, yc ); - // since these angles (ea,sa) are measured counter-clockwise, we invert them to - // get clockwise angles - path.AddArc( xc, yc , rad , DegToRad(-sa) , DegToRad(-ea), false ); - if ( fill && ((x1!=x2)||(y1!=y2)) ) - path.AddLineToPoint( xc, yc ); - m_graphicContext->DrawPath(path); -} - -void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - m_graphicContext->PushState(); - m_graphicContext->Translate(x+w/2.0,y+h/2.0); - wxDouble factor = ((wxDouble) w) / h; - m_graphicContext->Scale( factor , 1.0); - - // since these angles (ea,sa) are measured counter-clockwise, we invert them to - // get clockwise angles - if ( m_brush.GetStyle() != wxTRANSPARENT ) - { - wxGraphicsPath path = m_graphicContext->CreatePath(); - path.MoveToPoint( 0, 0 ); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); - path.AddLineToPoint( 0, 0 ); - m_graphicContext->FillPath( path ); - - path = m_graphicContext->CreatePath(); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); - m_graphicContext->StrokePath( path ); - } - else - { - wxGraphicsPath path = m_graphicContext->CreatePath(); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); - m_graphicContext->DrawPath( path ); - } - - m_graphicContext->PopState(); -} - -void wxGCDC::DoDrawPoint( wxCoord x, wxCoord y ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") ); - - DoDrawLine( x , y , x + 1 , y + 1 ); -} - -void wxGCDC::DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - wxPoint2DDouble* pointsD = new wxPoint2DDouble[n]; - for( int i = 0; i < n; ++i) - { - pointsD[i].m_x = points[i].x + xoffset; - pointsD[i].m_y = points[i].y + yoffset; - } - - m_graphicContext->StrokeLines( n , pointsD); - delete[] pointsD; -} - -#if wxUSE_SPLINES -void wxGCDC::DoDrawSpline(wxList *points) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - wxGraphicsPath path = m_graphicContext->CreatePath(); - - wxList::compatibility_iterator node = points->GetFirst(); - if (node == wxList::compatibility_iterator()) - // empty list - return; - - wxPoint *p = (wxPoint *)node->GetData(); - - wxCoord x1 = p->x; - wxCoord y1 = p->y; - - node = node->GetNext(); - p = (wxPoint *)node->GetData(); - - wxCoord x2 = p->x; - wxCoord y2 = p->y; - wxCoord cx1 = ( x1 + x2 ) / 2; - wxCoord cy1 = ( y1 + y2 ) / 2; - - path.MoveToPoint( x1 , y1 ); - path.AddLineToPoint( cx1 , cy1 ); -#if !wxUSE_STL - - while ((node = node->GetNext()) != NULL) -#else - - while ((node = node->GetNext())) -#endif // !wxUSE_STL - - { - p = (wxPoint *)node->GetData(); - x1 = x2; - y1 = y2; - x2 = p->x; - y2 = p->y; - wxCoord cx4 = (x1 + x2) / 2; - wxCoord cy4 = (y1 + y2) / 2; - - path.AddQuadCurveToPoint(x1 , y1 ,cx4 , cy4 ); - - cx1 = cx4; - cy1 = cy4; - } - - path.AddLineToPoint( x2 , y2 ); - - m_graphicContext->StrokePath( path ); -} -#endif // wxUSE_SPLINES - -void wxGCDC::DoDrawPolygon( int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle ) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") ); - - if ( n <= 0 || (m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT ) ) - return; - if ( !m_logicalFunctionSupported ) - return; - - bool closeIt = false; - if (points[n-1] != points[0]) - closeIt = true; - - wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)]; - for( int i = 0; i < n; ++i) - { - pointsD[i].m_x = points[i].x + xoffset; - pointsD[i].m_y = points[i].y + yoffset; - } - if ( closeIt ) - pointsD[n] = pointsD[0]; - - m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle); - delete[] pointsD; -} - -void wxGCDC::DoDrawPolyPolygon(int n, - int count[], - wxPoint points[], - wxCoord xoffset, - wxCoord yoffset, - int fillStyle) -{ - wxASSERT(n > 1); - wxGraphicsPath path = m_graphicContext->CreatePath(); - - int i = 0; - for ( int j = 0; j < n; ++j) - { - wxPoint start = points[i]; - path.MoveToPoint( start.x+ xoffset, start.y+ yoffset); - ++i; - int l = count[j]; - for ( int k = 1; k < l; ++k) - { - path.AddLineToPoint( points[i].x+ xoffset, points[i].y+ yoffset); - ++i; - } - // close the polygon - if ( start != points[i-1]) - path.AddLineToPoint( start.x+ xoffset, start.y+ yoffset); - } - m_graphicContext->DrawPath( path , fillStyle); -} - -void wxGCDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - // CMB: draw nothing if transformed w or h is 0 - if (w == 0 || h == 0) - return; - - if ( m_graphicContext->ShouldOffset() ) - { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 - w -= 1; - h -= 1; - } - m_graphicContext->DrawRectangle(x,y,w,h); -} - -void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double radius) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - if (radius < 0.0) - radius = - radius * ((w < h) ? w : h); - - // CMB: draw nothing if transformed w or h is 0 - if (w == 0 || h == 0) - return; - - if ( m_graphicContext->ShouldOffset() ) - { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 - w -= 1; - h -= 1; - } - m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius); -} - -void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") ); - - if ( !m_logicalFunctionSupported ) - return; - - if ( m_graphicContext->ShouldOffset() ) - { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 - w -= 1; - h -= 1; - } - m_graphicContext->DrawEllipse(x,y,w,h); -} - -bool wxGCDC::CanDrawBitmap() const -{ - return true; -} - -bool wxGCDC::DoBlit( - wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool WXUNUSED(useMask), - wxCoord xsrcMask, wxCoord ysrcMask ) -{ - wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid DC") ); - wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid source DC") ); - - if ( logical_func == wxNO_OP ) - return true; - else if ( !m_graphicContext->SetLogicalFunction( logical_func ) ) - - { - wxFAIL_MSG( wxT("Logical function is not supported by the graphics context.") ); - return false; - } - - if (xsrcMask == -1 && ysrcMask == -1) - { - xsrcMask = xsrc; - ysrcMask = ysrc; - } - - wxRect subrect(source->LogicalToDeviceX(xsrc), - source->LogicalToDeviceY(ysrc), - source->LogicalToDeviceXRel(width), - source->LogicalToDeviceYRel(height)); - - // if needed clip the subrect down to the size of the source DC - wxCoord sw, sh; - source->GetSize(&sw, &sh); - sw = source->LogicalToDeviceXRel(sw); - sh = source->LogicalToDeviceYRel(sh); - if (subrect.x + subrect.width > sw) - subrect.width = sw - subrect.x; - if (subrect.y + subrect.height > sh) - subrect.height = sh - subrect.y; - - wxBitmap blit = source->GetAsBitmap( &subrect ); - - if ( blit.Ok() ) - { - m_graphicContext->DrawBitmap( blit, xdest, ydest, - wxMin(width, blit.GetWidth()), - wxMin(height, blit.GetHeight())); - } - else - { - wxFAIL_MSG( wxT("Cannot Blit. Unable to get contents of DC as bitmap.") ); - return false; - } - - // reset logical function - m_graphicContext->SetLogicalFunction( m_logicalFunction ); - - return true; -} - -void wxGCDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, - double angle) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - - if ( str.length() == 0 ) - return; - if ( !m_logicalFunctionSupported ) - return; - - if ( m_backgroundMode == wxTRANSPARENT ) - m_graphicContext->DrawText( str, x ,y , DegToRad(angle )); - else - m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); -} - -void wxGCDC::DoDrawText(const wxString& str, wxCoord x, wxCoord y) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - - if ( str.length() == 0 ) - return; - - if ( !m_logicalFunctionSupported ) - return; - - if ( m_backgroundMode == wxTRANSPARENT ) - m_graphicContext->DrawText( str, x ,y); - else - m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); -} - -bool wxGCDC::CanGetTextExtent() const -{ - wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") ); - - return true; -} - -void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height, - wxCoord *descent, wxCoord *externalLeading , - wxFont *theFont ) const -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") ); - - if ( theFont ) - { - m_graphicContext->SetFont( *theFont, m_textForegroundColour ); - } - - wxDouble h , d , e , w; - - m_graphicContext->GetTextExtent( str, &w, &h, &d, &e ); - - if ( height ) - *height = (wxCoord)(h+0.5); - if ( descent ) - *descent = (wxCoord)(d+0.5); - if ( externalLeading ) - *externalLeading = (wxCoord)(e+0.5); - if ( width ) - *width = (wxCoord)(w+0.5); - - if ( theFont ) - { - m_graphicContext->SetFont( m_font, m_textForegroundColour ); - } -} - -bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const -{ - wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") ); - widths.Clear(); - widths.Add(0,text.Length()); - if ( text.IsEmpty() ) - return true; - - wxArrayDouble widthsD; - - m_graphicContext->GetPartialTextExtents( text, widthsD ); - for ( size_t i = 0; i < widths.GetCount(); ++i ) - widths[i] = (wxCoord)(widthsD[i] + 0.5); - - return true; -} - -wxCoord wxGCDC::GetCharWidth(void) const -{ - wxCoord width; - DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL ); - - return width; -} - -wxCoord wxGCDC::GetCharHeight(void) const -{ - wxCoord height; - DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL ); - - return height; -} - -void wxGCDC::Clear(void) -{ - wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::Clear - invalid DC") ); - // TODO better implementation / incorporate size info into wxGCDC or context - m_graphicContext->SetBrush( m_backgroundBrush ); - wxPen p = *wxTRANSPARENT_PEN; - m_graphicContext->SetPen( p ); - DoDrawRectangle( 0, 0, 32000 , 32000 ); - m_graphicContext->SetPen( m_pen ); - m_graphicContext->SetBrush( m_brush ); -} - -void wxGCDC::DoGetSize(int *width, int *height) const -{ - *width = 10000; - *height = 10000; -} - -void wxGCDC::DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection ) -{ - wxPoint start; - wxPoint end; - switch( nDirection) - { - case wxWEST : - start = rect.GetRightBottom(); - start.x++; - end = rect.GetLeftBottom(); - break; - case wxEAST : - start = rect.GetLeftBottom(); - end = rect.GetRightBottom(); - end.x++; - break; - case wxNORTH : - start = rect.GetLeftBottom(); - start.y++; - end = rect.GetLeftTop(); - break; - case wxSOUTH : - start = rect.GetLeftTop(); - end = rect.GetLeftBottom(); - end.y++; - break; - default : - break; - } - - if (rect.width == 0 || rect.height == 0) - return; - - m_graphicContext->SetBrush( m_graphicContext->CreateLinearGradientBrush( - start.x,start.y,end.x,end.y, initialColour, destColour)); - m_graphicContext->SetPen(*wxTRANSPARENT_PEN); - m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); - m_graphicContext->SetPen(m_pen); -} - -void wxGCDC::DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter) -{ - //Radius - wxInt32 cx = rect.GetWidth() / 2; - wxInt32 cy = rect.GetHeight() / 2; - wxInt32 nRadius; - if (cx < cy) - nRadius = cx; - else - nRadius = cy; - - // make sure the background is filled (todo move into specific platform implementation ?) - m_graphicContext->SetPen(*wxTRANSPARENT_PEN); - m_graphicContext->SetBrush( wxBrush( destColour) ); - m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); - - m_graphicContext->SetBrush( m_graphicContext->CreateRadialGradientBrush( - rect.x+circleCenter.x,rect.y+circleCenter.y, - rect.x+circleCenter.x,rect.y+circleCenter.y, - nRadius,initialColour,destColour)); - - m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); - m_graphicContext->SetPen(m_pen); -} - -void wxGCDC::DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) -{ - wxDCBase::DoDrawCheckMark(x,y,width,height); -} - -#endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Source/3rdParty/wx/src/common/dircmn.cpp b/Source/3rdParty/wx/src/common/dircmn.cpp deleted file mode 100644 index 3e79a7a4e..000000000 --- a/Source/3rdParty/wx/src/common/dircmn.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dircmn.cpp -// Purpose: wxDir methods common to all implementations -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.05.01 -// RCS-ID: $Id: dircmn.cpp 40665 2006-08-19 08:45:31Z JS $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/filefn.h" - #include "wx/arrstr.h" -#endif //WX_PRECOMP - -#include "wx/dir.h" -#include "wx/filename.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxDirTraverser -// ---------------------------------------------------------------------------- - -wxDirTraverseResult -wxDirTraverser::OnOpenError(const wxString& WXUNUSED(dirname)) -{ - return wxDIR_IGNORE; -} - -// ---------------------------------------------------------------------------- -// wxDir::HasFiles() and HasSubDirs() -// ---------------------------------------------------------------------------- - -// dumb generic implementation - -bool wxDir::HasFiles(const wxString& spec) -{ - wxString s; - return GetFirst(&s, spec, wxDIR_FILES | wxDIR_HIDDEN); -} - -// we have a (much) faster version for Unix -#if (defined(__CYGWIN__) && defined(__WINDOWS__)) || !defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__EMX__) || defined(__WINE__) - -bool wxDir::HasSubDirs(const wxString& spec) -{ - wxString s; - return GetFirst(&s, spec, wxDIR_DIRS | wxDIR_HIDDEN); -} - -#endif // !Unix - -// ---------------------------------------------------------------------------- -// wxDir::Traverse() -// ---------------------------------------------------------------------------- - -size_t wxDir::Traverse(wxDirTraverser& sink, - const wxString& filespec, - int flags) const -{ - wxCHECK_MSG( IsOpened(), (size_t)-1, - _T("dir must be opened before traversing it") ); - - // the total number of files found - size_t nFiles = 0; - - // the name of this dir with path delimiter at the end - wxString prefix = GetName(); - prefix += wxFILE_SEP_PATH; - - // first, recurse into subdirs - if ( flags & wxDIR_DIRS ) - { - wxString dirname; - for ( bool cont = GetFirst(&dirname, wxEmptyString, wxDIR_DIRS | (flags & wxDIR_HIDDEN) ); - cont; - cont = cont && GetNext(&dirname) ) - { - const wxString fulldirname = prefix + dirname; - - switch ( sink.OnDir(fulldirname) ) - { - default: - wxFAIL_MSG(_T("unexpected OnDir() return value") ); - // fall through - - case wxDIR_STOP: - cont = false; - break; - - case wxDIR_CONTINUE: - { - wxDir subdir; - - // don't give the error messages for the directories - // which we can't open: there can be all sorts of good - // reason for this (e.g. insufficient privileges) and - // this shouldn't be treated as an error -- instead - // let the user code decide what to do - bool ok; - do - { - wxLogNull noLog; - ok = subdir.Open(fulldirname); - if ( !ok ) - { - // ask the user code what to do - bool tryagain; - switch ( sink.OnOpenError(fulldirname) ) - { - default: - wxFAIL_MSG(_T("unexpected OnOpenError() return value") ); - // fall through - - case wxDIR_STOP: - cont = false; - // fall through - - case wxDIR_IGNORE: - tryagain = false; - break; - - case wxDIR_CONTINUE: - tryagain = true; - } - - if ( !tryagain ) - break; - } - } - while ( !ok ); - - if ( ok ) - { - nFiles += subdir.Traverse(sink, filespec, flags); - } - } - break; - - case wxDIR_IGNORE: - // nothing to do - ; - } - } - } - - // now enum our own files - if ( flags & wxDIR_FILES ) - { - flags &= ~wxDIR_DIRS; - - wxString filename; - bool cont = GetFirst(&filename, filespec, flags); - while ( cont ) - { - wxDirTraverseResult res = sink.OnFile(prefix + filename); - if ( res == wxDIR_STOP ) - break; - - wxASSERT_MSG( res == wxDIR_CONTINUE, - _T("unexpected OnFile() return value") ); - - nFiles++; - - cont = GetNext(&filename); - } - } - - return nFiles; -} - -// ---------------------------------------------------------------------------- -// wxDir::GetAllFiles() -// ---------------------------------------------------------------------------- - -class wxDirTraverserSimple : public wxDirTraverser -{ -public: - wxDirTraverserSimple(wxArrayString& files) : m_files(files) { } - - virtual wxDirTraverseResult OnFile(const wxString& filename) - { - m_files.push_back(filename); - return wxDIR_CONTINUE; - } - - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) - { - return wxDIR_CONTINUE; - } - -private: - wxArrayString& m_files; - - DECLARE_NO_COPY_CLASS(wxDirTraverserSimple) -}; - -/* static */ -size_t wxDir::GetAllFiles(const wxString& dirname, - wxArrayString *files, - const wxString& filespec, - int flags) -{ - wxCHECK_MSG( files, (size_t)-1, _T("NULL pointer in wxDir::GetAllFiles") ); - - size_t nFiles = 0; - - wxDir dir(dirname); - if ( dir.IsOpened() ) - { - wxDirTraverserSimple traverser(*files); - - nFiles += dir.Traverse(traverser, filespec, flags); - } - - return nFiles; -} - -// ---------------------------------------------------------------------------- -// wxDir::FindFirst() -// ---------------------------------------------------------------------------- - -class wxDirTraverserFindFirst : public wxDirTraverser -{ -public: - wxDirTraverserFindFirst() { } - - virtual wxDirTraverseResult OnFile(const wxString& filename) - { - m_file = filename; - return wxDIR_STOP; - } - - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) - { - return wxDIR_CONTINUE; - } - - const wxString& GetFile() const - { - return m_file; - } - -private: - wxString m_file; - - DECLARE_NO_COPY_CLASS(wxDirTraverserFindFirst) -}; - -/* static */ -wxString wxDir::FindFirst(const wxString& dirname, - const wxString& filespec, - int flags) -{ - wxDir dir(dirname); - if ( dir.IsOpened() ) - { - wxDirTraverserFindFirst traverser; - - dir.Traverse(traverser, filespec, flags | wxDIR_FILES); - return traverser.GetFile(); - } - - return wxEmptyString; -} - - -// ---------------------------------------------------------------------------- -// wxDir::GetTotalSize() -// ---------------------------------------------------------------------------- - -class wxDirTraverserSumSize : public wxDirTraverser -{ -public: - wxDirTraverserSumSize() { } - - virtual wxDirTraverseResult OnFile(const wxString& filename) - { - wxULongLong sz = wxFileName::GetSize(filename); - - // wxFileName::GetSize won't use this class again as - // we're passing it a file and not a directory; - // thus we are sure to avoid an endless loop - if (sz == wxInvalidSize) - { - // if the GetSize() failed (this can happen because e.g. a - // file is locked by another process), we can proceed but - // we need to at least warn the user that the resulting - // final size could be not reliable (if e.g. the locked - // file is very big). - m_skippedFiles.Add(filename); - return wxDIR_CONTINUE; - } - - m_sz += sz; - return wxDIR_CONTINUE; - } - - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) - { - return wxDIR_CONTINUE; - } - - wxULongLong GetTotalSize() const - { return m_sz; } - wxArrayString &FilesSkipped() - { return m_skippedFiles; } - -protected: - wxULongLong m_sz; - wxArrayString m_skippedFiles; -}; - -wxULongLong wxDir::GetTotalSize(const wxString &dirname, wxArrayString *filesSkipped) -{ - if (!wxDirExists(dirname)) - return wxInvalidSize; - - // to get the size of this directory and its contents we need - // to recursively walk it... - wxDir dir(dirname); - if ( !dir.IsOpened() ) - return wxInvalidSize; - - wxDirTraverserSumSize traverser; - if (dir.Traverse(traverser) == (size_t)-1 || - traverser.GetTotalSize() == 0) - return wxInvalidSize; - - if (filesSkipped) - *filesSkipped = traverser.FilesSkipped(); - - return traverser.GetTotalSize(); -} - diff --git a/Source/3rdParty/wx/src/common/dlgcmn.cpp b/Source/3rdParty/wx/src/common/dlgcmn.cpp deleted file mode 100644 index 597b14e2c..000000000 --- a/Source/3rdParty/wx/src/common/dlgcmn.cpp +++ /dev/null @@ -1,565 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dlgcmn.cpp -// Purpose: common (to all ports) wxDialog functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.06.99 -// RCS-ID: $Id: dlgcmn.cpp 49747 2007-11-09 15:06:52Z JS $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/dialog.h" - -#ifndef WX_PRECOMP - #include "wx/button.h" - #include "wx/dcclient.h" - #include "wx/intl.h" - #include "wx/settings.h" - #include "wx/stattext.h" - #include "wx/sizer.h" - #include "wx/containr.h" -#endif - -#include "wx/statline.h" -#include "wx/sysopt.h" - -#if wxUSE_STATTEXT - -// ---------------------------------------------------------------------------- -// wxTextWrapper -// ---------------------------------------------------------------------------- - -// this class is used to wrap the text on word boundary: wrapping is done by -// calling OnStartLine() and OnOutputLine() functions -class wxTextWrapper -{ -public: - wxTextWrapper() { m_eol = false; } - - // win is used for getting the font, text is the text to wrap, width is the - // max line width or -1 to disable wrapping - void Wrap(wxWindow *win, const wxString& text, int widthMax); - - // we don't need it, but just to avoid compiler warnings - virtual ~wxTextWrapper() { } - -protected: - // line may be empty - virtual void OnOutputLine(const wxString& line) = 0; - - // called at the start of every new line (except the very first one) - virtual void OnNewLine() { } - -private: - // call OnOutputLine() and set m_eol to true - void DoOutputLine(const wxString& line) - { - OnOutputLine(line); - - m_eol = true; - } - - // this function is a destructive inspector: when it returns true it also - // resets the flag to false so calling it again woulnd't return true any - // more - bool IsStartOfNewLine() - { - if ( !m_eol ) - return false; - - m_eol = false; - - return true; - } - - - bool m_eol; -}; - -#endif // wxUSE_STATTEXT - -// ---------------------------------------------------------------------------- -// wxDialogBase -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow) - EVT_BUTTON(wxID_ANY, wxDialogBase::OnButton) - - EVT_CLOSE(wxDialogBase::OnCloseWindow) - - EVT_CHAR_HOOK(wxDialogBase::OnCharHook) - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxDialogBase) -END_EVENT_TABLE() - -WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase, wxTopLevelWindow) - -void wxDialogBase::Init() -{ - m_returnCode = 0; - m_affirmativeId = wxID_OK; - m_escapeId = wxID_ANY; - - // the dialogs have this flag on by default to prevent the events from the - // dialog controls from reaching the parent frame which is usually - // undesirable and can lead to unexpected and hard to find bugs - SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); - - m_container.SetContainerWindow(this); -} - -#if wxUSE_STATTEXT - -void wxTextWrapper::Wrap(wxWindow *win, const wxString& text, int widthMax) -{ - const wxChar *lastSpace = NULL; - wxString line; - - const wxChar *lineStart = text.c_str(); - for ( const wxChar *p = lineStart; ; p++ ) - { - if ( IsStartOfNewLine() ) - { - OnNewLine(); - - lastSpace = NULL; - line.clear(); - lineStart = p; - } - - if ( *p == _T('\n') || *p == _T('\0') ) - { - DoOutputLine(line); - - if ( *p == _T('\0') ) - break; - } - else // not EOL - { - if ( *p == _T(' ') ) - lastSpace = p; - - line += *p; - - if ( widthMax >= 0 && lastSpace ) - { - int width; - win->GetTextExtent(line, &width, NULL); - - if ( width > widthMax ) - { - // remove the last word from this line - line.erase(lastSpace - lineStart, p + 1 - lineStart); - DoOutputLine(line); - - // go back to the last word of this line which we didn't - // output yet - p = lastSpace; - } - } - //else: no wrapping at all or impossible to wrap - } - } -} - -class wxTextSizerWrapper : public wxTextWrapper -{ -public: - wxTextSizerWrapper(wxWindow *win) - { - m_win = win; - m_hLine = 0; - } - - wxSizer *CreateSizer(const wxString& text, int widthMax) - { - m_sizer = new wxBoxSizer(wxVERTICAL); - Wrap(m_win, text, widthMax); - return m_sizer; - } - -protected: - virtual void OnOutputLine(const wxString& line) - { - if ( !line.empty() ) - { - m_sizer->Add(new wxStaticText(m_win, wxID_ANY, line)); - } - else // empty line, no need to create a control for it - { - if ( !m_hLine ) - m_hLine = m_win->GetCharHeight(); - - m_sizer->Add(5, m_hLine); - } - } - -private: - wxWindow *m_win; - wxSizer *m_sizer; - int m_hLine; -}; - -wxSizer *wxDialogBase::CreateTextSizer(const wxString& message) -{ - // I admit that this is complete bogus, but it makes - // message boxes work for pda screens temporarily.. - int widthMax = -1; - const bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA; - if (is_pda) - { - widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25; - } - - // '&' is used as accel mnemonic prefix in the wxWidgets controls but in - // the static messages created by CreateTextSizer() (used by wxMessageBox, - // for example), we don't want this special meaning, so we need to quote it - wxString text(message); - text.Replace(_T("&"), _T("&&")); - - wxTextSizerWrapper wrapper(this); - - return wrapper.CreateSizer(text, widthMax); -} - -class wxLabelWrapper : public wxTextWrapper -{ -public: - void WrapLabel(wxWindow *text, int widthMax) - { - m_text.clear(); - Wrap(text, text->GetLabel(), widthMax); - text->SetLabel(m_text); - } - -protected: - virtual void OnOutputLine(const wxString& line) - { - m_text += line; - } - - virtual void OnNewLine() - { - m_text += _T('\n'); - } - -private: - wxString m_text; -}; - -// NB: don't "factor out" the scope operator, SGI MIPSpro 7.3 (but not 7.4) -// gets confused if it doesn't immediately follow the class name -void -#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__) -wxStaticText:: -#else -wxStaticTextBase:: -#endif -Wrap(int width) -{ - wxLabelWrapper wrapper; - wrapper.WrapLabel(this, width); -} - -#endif // wxUSE_STATTEXT - -wxSizer *wxDialogBase::CreateButtonSizer(long flags) -{ - wxSizer *sizer = NULL; - -#ifdef __SMARTPHONE__ - wxDialog* dialog = (wxDialog*) this; - if ( flags & wxOK ) - dialog->SetLeftMenu(wxID_OK); - - if ( flags & wxCANCEL ) - dialog->SetRightMenu(wxID_CANCEL); - - if ( flags & wxYES ) - dialog->SetLeftMenu(wxID_YES); - - if ( flags & wxNO ) - dialog->SetRightMenu(wxID_NO); -#else // !__SMARTPHONE__ - -#if wxUSE_BUTTON - -#ifdef __POCKETPC__ - // PocketPC guidelines recommend for Ok/Cancel dialogs to use OK button - // located inside caption bar and implement Cancel functionality through - // Undo outside dialog. As native behaviour this will be default here but - // can be replaced with real wxButtons by setting the option below to 1 - if ( (flags & ~(wxCANCEL|wxNO_DEFAULT)) != wxOK || - wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) ) -#endif // __POCKETPC__ - { - sizer = CreateStdDialogButtonSizer(flags); - } -#endif // wxUSE_BUTTON - -#endif // __SMARTPHONE__/!__SMARTPHONE__ - - return sizer; -} - -wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags) -{ - wxSizer *sizer = CreateButtonSizer(flags); - if ( !sizer ) - return NULL; - - // Mac Human Interface Guidelines recommend not to use static lines as - // grouping elements -#if wxUSE_STATLINE && !defined(__WXMAC__) - wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); - topsizer->Add(new wxStaticLine(this), - wxSizerFlags().Expand().DoubleBorder(wxBOTTOM)); - topsizer->Add(sizer, wxSizerFlags().Expand()); - sizer = topsizer; -#endif // wxUSE_STATLINE - - return sizer; -} - -#if wxUSE_BUTTON - -wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) -{ - wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer(); - - wxButton *ok = NULL; - wxButton *yes = NULL; - wxButton *no = NULL; - - if (flags & wxOK) - { - ok = new wxButton(this, wxID_OK); - sizer->AddButton(ok); - } - - if (flags & wxCANCEL) - { - wxButton *cancel = new wxButton(this, wxID_CANCEL); - sizer->AddButton(cancel); - } - - if (flags & wxYES) - { - yes = new wxButton(this, wxID_YES); - sizer->AddButton(yes); - } - - if (flags & wxNO) - { - no = new wxButton(this, wxID_NO); - sizer->AddButton(no); - } - - if (flags & wxHELP) - { - wxButton *help = new wxButton(this, wxID_HELP); - sizer->AddButton(help); - } - - if (flags & wxNO_DEFAULT) - { - if (no) - { - no->SetDefault(); - no->SetFocus(); - } - } - else - { - if (ok) - { - ok->SetDefault(); - ok->SetFocus(); - } - else if (yes) - { - yes->SetDefault(); - yes->SetFocus(); - } - } - - if (flags & wxOK) - SetAffirmativeId(wxID_OK); - else if (flags & wxYES) - SetAffirmativeId(wxID_YES); - - sizer->Realize(); - - return sizer; -} - -#endif // wxUSE_BUTTON - -// ---------------------------------------------------------------------------- -// standard buttons handling -// ---------------------------------------------------------------------------- - -void wxDialogBase::EndDialog(int rc) -{ - if ( IsModal() ) - EndModal(rc); - else - Hide(); -} - -void wxDialogBase::AcceptAndClose() -{ - if ( Validate() && TransferDataFromWindow() ) - { - EndDialog(m_affirmativeId); - } -} - -void wxDialogBase::SetAffirmativeId(int affirmativeId) -{ - m_affirmativeId = affirmativeId; -} - -void wxDialogBase::SetEscapeId(int escapeId) -{ - m_escapeId = escapeId; -} - -bool wxDialogBase::EmulateButtonClickIfPresent(int id) -{ -#if wxUSE_BUTTON - wxButton *btn = wxDynamicCast(FindWindow(id), wxButton); - - if ( !btn || !btn->IsEnabled() || !btn->IsShown() ) - return false; - - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, id); - event.SetEventObject(btn); - btn->GetEventHandler()->ProcessEvent(event); - - return true; -#else // !wxUSE_BUTTON - wxUnusedVar(id); - return false; -#endif // wxUSE_BUTTON/!wxUSE_BUTTON -} - -bool wxDialogBase::IsEscapeKey(const wxKeyEvent& event) -{ - // for most platforms, Esc key is used to close the dialogs - return event.GetKeyCode() == WXK_ESCAPE && - event.GetModifiers() == wxMOD_NONE; -} - -void wxDialogBase::OnCharHook(wxKeyEvent& event) -{ - if ( event.GetKeyCode() == WXK_ESCAPE ) - { - int idCancel = GetEscapeId(); - switch ( idCancel ) - { - case wxID_NONE: - // don't handle Esc specially at all - break; - - case wxID_ANY: - // this value is special: it means translate Esc to wxID_CANCEL - // but if there is no such button, then fall back to wxID_OK - if ( EmulateButtonClickIfPresent(wxID_CANCEL) ) - return; - idCancel = GetAffirmativeId(); - // fall through - - default: - // translate Esc to button press for the button with given id - if ( EmulateButtonClickIfPresent(idCancel) ) - return; - } - } - - event.Skip(); -} - -void wxDialogBase::OnButton(wxCommandEvent& event) -{ - const int id = event.GetId(); - if ( id == GetAffirmativeId() ) - { - AcceptAndClose(); - } - else if ( id == wxID_APPLY ) - { - if ( Validate() ) - TransferDataFromWindow(); - - // TODO: disable the Apply button until things change again - } - else if ( id == GetEscapeId() || - (id == wxID_CANCEL && GetEscapeId() == wxID_ANY) ) - { - EndDialog(wxID_CANCEL); - } - else // not a standard button - { - event.Skip(); - } -} - -// ---------------------------------------------------------------------------- -// other event handlers -// ---------------------------------------------------------------------------- - -void wxDialogBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) -{ - // We'll send a Cancel message by default, which may close the dialog. - // Check for looping if the Cancel event handler calls Close(). - - // Note that if a cancel button and handler aren't present in the dialog, - // nothing will happen when you close the dialog via the window manager, or - // via Close(). We wouldn't want to destroy the dialog by default, since - // the dialog may have been created on the stack. However, this does mean - // that calling dialog->Close() won't delete the dialog unless the handler - // for wxID_CANCEL does so. So use Destroy() if you want to be sure to - // destroy the dialog. The default OnCancel (above) simply ends a modal - // dialog, and hides a modeless dialog. - - // VZ: this is horrible and MT-unsafe. Can't we reuse some of these global - // lists here? don't dare to change it now, but should be done later! - static wxList closing; - - if ( closing.Member(this) ) - return; - - closing.Append(this); - - wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); - cancelEvent.SetEventObject( this ); - GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog - - closing.DeleteObject(this); -} - -void wxDialogBase::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -#ifndef __WXGTK__ - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - Refresh(); -#endif - event.Skip(); -} diff --git a/Source/3rdParty/wx/src/common/dndcmn.cpp b/Source/3rdParty/wx/src/common/dndcmn.cpp deleted file mode 100644 index 5daf3da7d..000000000 --- a/Source/3rdParty/wx/src/common/dndcmn.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/dndcmn.cpp -// Author: Robert Roebling -// Modified by: -// Created: 19.10.99 -// RCS-ID: $Id: dndcmn.cpp 43664 2006-11-26 21:50:51Z JS $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/dnd.h" - -#if wxUSE_DRAG_AND_DROP - -bool wxIsDragResultOk(wxDragResult res) -{ - return res == wxDragCopy || res == wxDragMove || res == wxDragLink; -} - -#endif - diff --git a/Source/3rdParty/wx/src/common/dobjcmn.cpp b/Source/3rdParty/wx/src/common/dobjcmn.cpp deleted file mode 100644 index 68b194d3e..000000000 --- a/Source/3rdParty/wx/src/common/dobjcmn.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dobjcmn.cpp -// Purpose: implementation of data object methods common to all platforms -// Author: Vadim Zeitlin, Robert Roebling -// Modified by: -// Created: 19.10.99 -// RCS-ID: $Id: dobjcmn.cpp 49036 2007-10-04 10:10:06Z SC $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DATAOBJ - -#include "wx/dataobj.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" -#endif - -// ---------------------------------------------------------------------------- -// lists -// ---------------------------------------------------------------------------- - -#include "wx/listimpl.cpp" - -WX_DEFINE_LIST(wxSimpleDataObjectList) - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -static wxDataFormat dataFormatInvalid; -WXDLLEXPORT const wxDataFormat& wxFormatInvalid = dataFormatInvalid; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxDataObjectBase -// ---------------------------------------------------------------------------- - -wxDataObjectBase::~wxDataObjectBase() -{ -} - -bool wxDataObjectBase::IsSupported(const wxDataFormat& format, - Direction dir) const -{ - size_t nFormatCount = GetFormatCount( dir ); - if ( nFormatCount == 1 ) - { - return format == GetPreferredFormat( dir ); - } - else - { - wxDataFormat *formats = new wxDataFormat[nFormatCount]; - GetAllFormats( formats, dir ); - - size_t n; - for ( n = 0; n < nFormatCount; n++ ) - { - if ( formats[n] == format ) - break; - } - - delete [] formats; - - // found? - return n < nFormatCount; - } -} - -// ---------------------------------------------------------------------------- -// wxDataObjectComposite -// ---------------------------------------------------------------------------- - -wxDataObjectComposite::wxDataObjectComposite() -{ - m_preferred = 0; - m_receivedFormat = wxFormatInvalid; -} - -wxDataObjectComposite::~wxDataObjectComposite() -{ - WX_CLEAR_LIST( wxSimpleDataObjectList, m_dataObjects ); -} - -wxDataObjectSimple * -wxDataObjectComposite::GetObject(const wxDataFormat& format) const -{ - wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst(); - while ( node ) - { - wxDataObjectSimple *dataObj = node->GetData(); - - if ( dataObj->GetFormat() == format ) - { - return dataObj; - } - - node = node->GetNext(); - } - - return (wxDataObjectSimple *)NULL; -} - -void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred) -{ - if ( preferred ) - m_preferred = m_dataObjects.GetCount(); - - m_dataObjects.Append( dataObject ); -} - -wxDataFormat wxDataObjectComposite::GetReceivedFormat() const -{ - return m_receivedFormat; -} - -wxDataFormat -wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const -{ - wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.Item( m_preferred ); - - wxCHECK_MSG( node, wxFormatInvalid, wxT("no preferred format") ); - - wxDataObjectSimple* dataObj = node->GetData(); - - return dataObj->GetFormat(); -} - -#if defined(__WXMSW__) - -size_t wxDataObjectComposite::GetBufferOffset( const wxDataFormat& format ) -{ - wxDataObjectSimple *dataObj = GetObject(format); - - wxCHECK_MSG( dataObj, 0, - wxT("unsupported format in wxDataObjectComposite")); - - return dataObj->GetBufferOffset( format ); -} - - -const void* wxDataObjectComposite::GetSizeFromBuffer( const void* buffer, - size_t* size, - const wxDataFormat& format ) -{ - wxDataObjectSimple *dataObj = GetObject(format); - - wxCHECK_MSG( dataObj, NULL, - wxT("unsupported format in wxDataObjectComposite")); - - return dataObj->GetSizeFromBuffer( buffer, size, format ); -} - - -void* wxDataObjectComposite::SetSizeInBuffer( void* buffer, size_t size, - const wxDataFormat& format ) -{ - wxDataObjectSimple *dataObj = GetObject( format ); - - wxCHECK_MSG( dataObj, NULL, - wxT("unsupported format in wxDataObjectComposite")); - - return dataObj->SetSizeInBuffer( buffer, size, format ); -} - -#endif - -size_t wxDataObjectComposite::GetFormatCount(Direction WXUNUSED(dir)) const -{ - // TODO what about the Get/Set only formats? - return m_dataObjects.GetCount(); -} - -void wxDataObjectComposite::GetAllFormats(wxDataFormat *formats, - Direction WXUNUSED(dir)) const -{ - size_t n = 0; - wxSimpleDataObjectList::compatibility_iterator node; - for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() ) - { - // TODO if ( !outputOnlyToo ) && this one counts ... - formats[n++] = node->GetData()->GetFormat(); - } -} - -size_t wxDataObjectComposite::GetDataSize(const wxDataFormat& format) const -{ - wxDataObjectSimple *dataObj = GetObject(format); - - wxCHECK_MSG( dataObj, 0, - wxT("unsupported format in wxDataObjectComposite")); - - return dataObj->GetDataSize(); -} - -bool wxDataObjectComposite::GetDataHere(const wxDataFormat& format, - void *buf) const -{ - wxDataObjectSimple *dataObj = GetObject( format ); - - wxCHECK_MSG( dataObj, false, - wxT("unsupported format in wxDataObjectComposite")); - - return dataObj->GetDataHere( buf ); -} - -bool wxDataObjectComposite::SetData(const wxDataFormat& format, - size_t len, - const void *buf) -{ - wxDataObjectSimple *dataObj = GetObject( format ); - - wxCHECK_MSG( dataObj, false, - wxT("unsupported format in wxDataObjectComposite")); - - m_receivedFormat = format; - return dataObj->SetData( len, buf ); -} - -// ---------------------------------------------------------------------------- -// wxTextDataObject -// ---------------------------------------------------------------------------- - -#if defined(__WXGTK20__) && wxUSE_UNICODE - -static inline wxMBConv& GetConv(const wxDataFormat& format) -{ - // use UTF8 for wxDF_UNICODETEXT and UCS4 for wxDF_TEXT - return format == wxDF_UNICODETEXT ? wxConvUTF8 : wxConvLibc; -} - -size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const -{ - wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); - - return buffer ? strlen( buffer ) : 0; -} - -bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const -{ - if ( !buf ) - return false; - - wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); - if ( !buffer ) - return false; - - memcpy( (char*) buf, buffer, GetDataSize(format) ); - // strcpy( (char*) buf, buffer ); - - return true; -} - -bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), const void *buf) -{ - if ( buf == NULL ) - return false; - - wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf ); - - SetText( buffer ); - - return true; -} - -#elif wxUSE_UNICODE && defined(__WXMAC__) - -static wxMBConvUTF16 sUTF16Converter; - -static inline wxMBConv& GetConv(const wxDataFormat& format) -{ - return - format == wxDF_UNICODETEXT - ? (wxMBConv&) sUTF16Converter - : (wxMBConv&) wxConvLocal; -} - -size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const -{ - wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); - if ( !buffer ) - return 0; - - size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 ); - return len; -} - -bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const -{ - if ( buf == NULL ) - return false; - - wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); - if ( !buffer ) - return false; - - size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 ); - memcpy( (char*)buf, (const char*)buffer, len ); - - return true; -} - -bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), const void *buf) -{ - if ( buf == NULL ) - return false; - - wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf ); - - SetText( buffer ); - - return true; -} - -#else - -size_t wxTextDataObject::GetDataSize() const -{ - return GetTextLength() * sizeof(wxChar); -} - -bool wxTextDataObject::GetDataHere(void *buf) const -{ - wxStrcpy( (wxChar*)buf, GetText().c_str() ); - - return true; -} - -bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf) -{ - SetText( wxString((const wxChar*)buf) ); - - return true; -} - -#endif - -// ---------------------------------------------------------------------------- -// wxFileDataObjectBase -// ---------------------------------------------------------------------------- - -// VZ: I don't need this in MSW finally, so if it is needed in wxGTK, it should -// be moved to gtk/dataobj.cpp -#if 0 - -wxString wxFileDataObjectBase::GetFilenames() const -{ - wxString str; - size_t count = m_filenames.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - str << m_filenames[n] << wxT('\0'); - } - - return str; -} - -void wxFileDataObjectBase::SetFilenames(const wxChar* filenames) -{ - m_filenames.Empty(); - - wxString current; - for ( const wxChar *pc = filenames; ; pc++ ) - { - if ( *pc ) - { - current += *pc; - } - else - { - if ( !current ) - { - // 2 consecutive NULs - this is the end of the string - break; - } - - m_filenames.Add(current); - current.Empty(); - } - } -} - -#endif - -// ---------------------------------------------------------------------------- -// wxCustomDataObject -// ---------------------------------------------------------------------------- - -wxCustomDataObject::wxCustomDataObject(const wxDataFormat& format) - : wxDataObjectSimple(format) -{ - m_data = NULL; - m_size = 0; -} - -wxCustomDataObject::~wxCustomDataObject() -{ - Free(); -} - -void wxCustomDataObject::TakeData(size_t size, void *data) -{ - Free(); - - m_size = size; - m_data = data; -} - -void *wxCustomDataObject::Alloc(size_t size) -{ - return (void *)new char[size]; -} - -void wxCustomDataObject::Free() -{ - delete [] (char*)m_data; - m_size = 0; - m_data = (void*)NULL; -} - -size_t wxCustomDataObject::GetDataSize() const -{ - return GetSize(); -} - -bool wxCustomDataObject::GetDataHere(void *buf) const -{ - if ( buf == NULL ) - return false; - - void *data = GetData(); - if ( data == NULL ) - return false; - - memcpy( buf, data, GetSize() ); - - return true; -} - -bool wxCustomDataObject::SetData(size_t size, const void *buf) -{ - Free(); - - m_data = Alloc(size); - if ( m_data == NULL ) - return false; - - m_size = size; - memcpy( m_data, buf, m_size ); - - return true; -} - -// ============================================================================ -// some common dnd related code -// ============================================================================ - -#if wxUSE_DRAG_AND_DROP - -#include "wx/dnd.h" - -// ---------------------------------------------------------------------------- -// wxTextDropTarget -// ---------------------------------------------------------------------------- - -// NB: we can't use "new" in ctor initializer lists because this provokes an -// internal compiler error with VC++ 5.0 (hey, even gcc compiles this!), -// so use SetDataObject() instead - -wxTextDropTarget::wxTextDropTarget() -{ - SetDataObject(new wxTextDataObject); -} - -wxDragResult wxTextDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def) -{ - if ( !GetData() ) - return wxDragNone; - - wxTextDataObject *dobj = (wxTextDataObject *)m_dataObject; - return OnDropText( x, y, dobj->GetText() ) ? def : wxDragNone; -} - -// ---------------------------------------------------------------------------- -// wxFileDropTarget -// ---------------------------------------------------------------------------- - -wxFileDropTarget::wxFileDropTarget() -{ - SetDataObject(new wxFileDataObject); -} - -wxDragResult wxFileDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def) -{ - if ( !GetData() ) - return wxDragNone; - - wxFileDataObject *dobj = (wxFileDataObject *)m_dataObject; - return OnDropFiles( x, y, dobj->GetFilenames() ) ? def : wxDragNone; -} - -#endif // wxUSE_DRAG_AND_DROP - -#endif // wxUSE_DATAOBJ diff --git a/Source/3rdParty/wx/src/common/docmdi.cpp b/Source/3rdParty/wx/src/common/docmdi.cpp deleted file mode 100644 index d63628f69..000000000 --- a/Source/3rdParty/wx/src/common/docmdi.cpp +++ /dev/null @@ -1,206 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: docmdi.cpp -// Purpose: Frame classes for MDI document/view applications -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docmdi.cpp 66911 2011-02-16 21:31:33Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_MDI_ARCHITECTURE - -#include "wx/docmdi.h" - -/* - * Docview MDI parent frame - */ - -IMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame) - -BEGIN_EVENT_TABLE(wxDocMDIParentFrame, wxMDIParentFrame) - EVT_MENU(wxID_EXIT, wxDocMDIParentFrame::OnExit) - EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocMDIParentFrame::OnMRUFile) - EVT_CLOSE(wxDocMDIParentFrame::OnCloseWindow) -END_EVENT_TABLE() - -wxDocMDIParentFrame::wxDocMDIParentFrame() -{ - Init(); -} - -wxDocMDIParentFrame::wxDocMDIParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name) -{ - Init(); - Create(manager, frame, id, title, pos, size, style, name); -} - -bool wxDocMDIParentFrame::Create(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name) -{ - m_docManager = manager; - return wxMDIParentFrame::Create(frame, id, title, pos, size, style, name); -} - -void wxDocMDIParentFrame::OnExit(wxCommandEvent& WXUNUSED(event)) -{ - Close(); -} - -void wxDocMDIParentFrame::Init() -{ - m_docManager = NULL; -} - -void wxDocMDIParentFrame::OnMRUFile(wxCommandEvent& event) -{ - wxString f(m_docManager->GetHistoryFile(event.GetId() - wxID_FILE1)); - if (!f.empty()) - (void)m_docManager->CreateDocument(f, wxDOC_SILENT); -} - -// Extend event processing to search the view's event table -bool wxDocMDIParentFrame::ProcessEvent(wxEvent& event) -{ - // Try the document manager, then do default processing - if (!m_docManager || !m_docManager->ProcessEvent(event)) - return wxEvtHandler::ProcessEvent(event); - else - return true; -} - -void wxDocMDIParentFrame::OnCloseWindow(wxCloseEvent& event) -{ - if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) - { - // The user decided not to close finally, abort. - event.Veto(); - } - else - { - this->Destroy(); - } -} - -/* - * Default document child frame for MDI children - */ - -IMPLEMENT_CLASS(wxDocMDIChildFrame, wxMDIChildFrame) - -BEGIN_EVENT_TABLE(wxDocMDIChildFrame, wxMDIChildFrame) - EVT_ACTIVATE(wxDocMDIChildFrame::OnActivate) - EVT_CLOSE(wxDocMDIChildFrame::OnCloseWindow) -END_EVENT_TABLE() - -void wxDocMDIChildFrame::Init() -{ - m_childDocument = (wxDocument*) NULL; - m_childView = (wxView*) NULL; -} - -wxDocMDIChildFrame::wxDocMDIChildFrame() -{ - Init(); -} - -wxDocMDIChildFrame::wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, - const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) -{ - Init(); - Create(doc, view, frame, id, title, pos, size, style, name); -} - -bool wxDocMDIChildFrame::Create(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, - const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) -{ - m_childDocument = doc; - m_childView = view; - if (wxMDIChildFrame::Create(frame, id, title, pos, size, style, name)) - { - if (view) - view->SetFrame(this); - return true; - } - - return false; -} - -wxDocMDIChildFrame::~wxDocMDIChildFrame(void) -{ - m_childView = (wxView *) NULL; -} - -// Extend event processing to search the view's event table -bool wxDocMDIChildFrame::ProcessEvent(wxEvent& event) -{ - static wxEvent *ActiveEvent = NULL; - - // Break recursion loops - if (ActiveEvent == &event) - return false; - - ActiveEvent = &event; - - bool ret; - if ( !m_childView || ! m_childView->ProcessEvent(event) ) - { - // Only hand up to the parent if it's a menu command - if (!event.IsKindOf(CLASSINFO(wxCommandEvent)) || !GetParent() || !GetParent()->ProcessEvent(event)) - ret = wxEvtHandler::ProcessEvent(event); - else - ret = true; - } - else - ret = true; - - ActiveEvent = NULL; - return ret; -} - -void wxDocMDIChildFrame::OnActivate(wxActivateEvent& event) -{ - wxMDIChildFrame::OnActivate(event); - - if (event.GetActive() && m_childView) - m_childView->Activate(event.GetActive()); -} - -void wxDocMDIChildFrame::OnCloseWindow(wxCloseEvent& event) -{ - // Close view but don't delete the frame while doing so! - // ...since it will be deleted by wxWidgets if we return true. - if (m_childView) - { - bool ans = event.CanVeto() - ? m_childView->Close(false) // false means don't delete associated window - : true; // Must delete. - - if (ans) - { - m_childView->Activate(false); - delete m_childView; - m_childView = (wxView *) NULL; - m_childDocument = (wxDocument *) NULL; - - this->Destroy(); - } - else - event.Veto(); - } - else - event.Veto(); -} - -#endif - // wxUSE_DOC_VIEW_ARCHITECTURE - diff --git a/Source/3rdParty/wx/src/common/docview.cpp b/Source/3rdParty/wx/src/common/docview.cpp deleted file mode 100644 index be1393f86..000000000 --- a/Source/3rdParty/wx/src/common/docview.cpp +++ /dev/null @@ -1,2491 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/docview.cpp -// Purpose: Document/view classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docview.cpp 66911 2011-02-16 21:31:33Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DOC_VIEW_ARCHITECTURE - -#include "wx/docview.h" - -#ifndef WX_PRECOMP - #include "wx/list.h" - #include "wx/string.h" - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/dc.h" - #include "wx/dialog.h" - #include "wx/menu.h" - #include "wx/filedlg.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/msgdlg.h" - #include "wx/mdi.h" - #include "wx/choicdlg.h" -#endif - -#include "wx/ffile.h" - -#ifdef __WXMAC__ - #include "wx/filename.h" -#endif - -#if wxUSE_PRINTING_ARCHITECTURE - #include "wx/prntbase.h" - #include "wx/printdlg.h" -#endif - -#include "wx/confbase.h" -#include "wx/file.h" -#include "wx/cmdproc.h" -#include "wx/tokenzr.h" - -#include -#include - -#if wxUSE_STD_IOSTREAM - #include "wx/ioswrap.h" - #if wxUSE_IOSTREAMH - #include - #else - #include - #endif -#else - #include "wx/wfstream.h" -#endif - -// ---------------------------------------------------------------------------- -// wxWidgets macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler) -IMPLEMENT_CLASS(wxDocChildFrame, wxFrame) -IMPLEMENT_CLASS(wxDocParentFrame, wxFrame) - -#if wxUSE_PRINTING_ARCHITECTURE - IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout) -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject) - -// ---------------------------------------------------------------------------- -// function prototypes -// ---------------------------------------------------------------------------- - -static wxWindow* wxFindSuitableParent(void); - -// ---------------------------------------------------------------------------- -// local constants -// ---------------------------------------------------------------------------- - -static const wxChar *s_MRUEntryFormat = wxT("&%d %s"); - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - -static wxString FindExtension(const wxChar *path) -{ - wxString ext; - wxSplitPath(path, NULL, NULL, &ext); - - // VZ: extensions are considered not case sensitive - is this really a good - // idea? - return ext.MakeLower(); -} - -// ---------------------------------------------------------------------------- -// Definition of wxDocument -// ---------------------------------------------------------------------------- - -wxDocument::wxDocument(wxDocument *parent) -{ - m_documentModified = false; - m_documentParent = parent; - m_documentTemplate = (wxDocTemplate *) NULL; - m_commandProcessor = (wxCommandProcessor*) NULL; - m_savedYet = false; -} - -bool wxDocument::DeleteContents() -{ - return true; -} - -wxDocument::~wxDocument() -{ - DeleteContents(); - - if (m_commandProcessor) - delete m_commandProcessor; - - if (GetDocumentManager()) - GetDocumentManager()->RemoveDocument(this); - - // Not safe to do here, since it'll invoke virtual view functions - // expecting to see valid derived objects: and by the time we get here, - // we've called destructors higher up. - //DeleteAllViews(); -} - -bool wxDocument::Close() -{ - if (OnSaveModified()) - return OnCloseDocument(); - else - return false; -} - -bool wxDocument::OnCloseDocument() -{ - // Tell all views that we're about to close - NotifyClosing(); - DeleteContents(); - Modify(false); - return true; -} - -// Note that this implicitly deletes the document when the last view is -// deleted. -bool wxDocument::DeleteAllViews() -{ - wxDocManager* manager = GetDocumentManager(); - - // first check if all views agree to be closed - const wxList::iterator end = m_documentViews.end(); - for ( wxList::iterator i = m_documentViews.begin(); i != end; ++i ) - { - wxView *view = (wxView *)*i; - if ( !view->Close() ) - return false; - } - - // all views agreed to close, now do close them - if ( m_documentViews.empty() ) - { - // normally the document would be implicitly deleted when the last view - // is, but if don't have any views, do it here instead - if ( manager && manager->GetDocuments().Member(this) ) - delete this; - } - else // have views - { - // as we delete elements we iterate over, don't use the usual "from - // begin to end" loop - for ( ;; ) - { - wxView *view = (wxView *)*m_documentViews.begin(); - - bool isLastOne = m_documentViews.size() == 1; - - // this always deletes the node implicitly and if this is the last - // view also deletes this object itself (also implicitly, great), - // so we can't test for m_documentViews.empty() after calling this! - delete view; - - if ( isLastOne ) - break; - } - } - - return true; -} - -wxView *wxDocument::GetFirstView() const -{ - if (m_documentViews.GetCount() == 0) - return (wxView *) NULL; - return (wxView *)m_documentViews.GetFirst()->GetData(); -} - -wxDocManager *wxDocument::GetDocumentManager() const -{ - return (m_documentTemplate ? m_documentTemplate->GetDocumentManager() : (wxDocManager*) NULL); -} - -bool wxDocument::OnNewDocument() -{ - if (!OnSaveModified()) - return false; - - if (OnCloseDocument()==false) return false; - DeleteContents(); - Modify(false); - SetDocumentSaved(false); - - wxString name; - GetDocumentManager()->MakeDefaultName(name); - SetTitle(name); - SetFilename(name, true); - - return true; -} - -bool wxDocument::Save() -{ - if (!IsModified() && m_savedYet) - return true; - - if ( m_documentFile.empty() || !m_savedYet ) - return SaveAs(); - - return OnSaveDocument(m_documentFile); -} - -bool wxDocument::SaveAs() -{ - wxDocTemplate *docTemplate = GetDocumentTemplate(); - if (!docTemplate) - return false; - -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__) - wxString filter = docTemplate->GetDescription() + wxT(" (") + docTemplate->GetFileFilter() + wxT(")|") + docTemplate->GetFileFilter(); - - // Now see if there are some other template with identical view and document - // classes, whose filters may also be used. - - if (docTemplate->GetViewClassInfo() && docTemplate->GetDocClassInfo()) - { - wxList::compatibility_iterator node = docTemplate->GetDocumentManager()->GetTemplates().GetFirst(); - while (node) - { - wxDocTemplate *t = (wxDocTemplate*) node->GetData(); - - if (t->IsVisible() && t != docTemplate && - t->GetViewClassInfo() == docTemplate->GetViewClassInfo() && - t->GetDocClassInfo() == docTemplate->GetDocClassInfo()) - { - // add a '|' to separate this filter from the previous one - if ( !filter.empty() ) - filter << wxT('|'); - - filter << t->GetDescription() << wxT(" (") << t->GetFileFilter() << wxT(") |") - << t->GetFileFilter(); - } - - node = node->GetNext(); - } - } -#else - wxString filter = docTemplate->GetFileFilter() ; -#endif - wxString defaultDir = docTemplate->GetDirectory(); - if (defaultDir.IsEmpty()) - defaultDir = wxPathOnly(GetFilename()); - - wxString tmp = wxFileSelector(_("Save as"), - defaultDir, - wxFileNameFromPath(GetFilename()), - docTemplate->GetDefaultExtension(), - filter, - wxFD_SAVE | wxFD_OVERWRITE_PROMPT, - GetDocumentWindow()); - - if (tmp.empty()) - return false; - - wxString fileName(tmp); - wxString path, name, ext; - wxSplitPath(fileName, & path, & name, & ext); - - if (ext.empty()) - { - fileName += wxT("."); - fileName += docTemplate->GetDefaultExtension(); - } - - SetFilename(fileName); - SetTitle(wxFileNameFromPath(fileName)); - - // Notify the views that the filename has changed - wxList::compatibility_iterator node = m_documentViews.GetFirst(); - while (node) - { - wxView *view = (wxView *)node->GetData(); - view->OnChangeFilename(); - node = node->GetNext(); - } - - // Files that were not saved correctly are not added to the FileHistory. - if (!OnSaveDocument(m_documentFile)) - return false; - - // A file that doesn't use the default extension of its document template cannot be opened - // via the FileHistory, so we do not add it. - if (docTemplate->FileMatchesTemplate(fileName)) - { - GetDocumentManager()->AddFileToHistory(fileName); - } - else - { - // The user will probably not be able to open the file again, so - // we could warn about the wrong file-extension here. - } - return true; -} - -bool wxDocument::OnSaveDocument(const wxString& file) -{ - if ( !file ) - return false; - - if ( !DoSaveDocument(file) ) - return false; - - Modify(false); - SetFilename(file); - SetDocumentSaved(true); -#ifdef __WXMAC__ - wxFileName fn(file) ; - fn.MacSetDefaultTypeAndCreator() ; -#endif - return true; -} - -bool wxDocument::OnOpenDocument(const wxString& file) -{ - if (!OnSaveModified()) - return false; - - if ( !DoOpenDocument(file) ) - return false; - - SetFilename(file, true); - Modify(false); - m_savedYet = true; - - UpdateAllViews(); - - return true; -} - -#if wxUSE_STD_IOSTREAM -wxSTD istream& wxDocument::LoadObject(wxSTD istream& stream) -#else -wxInputStream& wxDocument::LoadObject(wxInputStream& stream) -#endif -{ - return stream; -} - -#if wxUSE_STD_IOSTREAM -wxSTD ostream& wxDocument::SaveObject(wxSTD ostream& stream) -#else -wxOutputStream& wxDocument::SaveObject(wxOutputStream& stream) -#endif -{ - return stream; -} - -bool wxDocument::Revert() -{ - return false; -} - - -// Get title, or filename if no title, else unnamed -bool wxDocument::GetPrintableName(wxString& buf) const -{ - if (!m_documentTitle.empty()) - { - buf = m_documentTitle; - return true; - } - else if (!m_documentFile.empty()) - { - buf = wxFileNameFromPath(m_documentFile); - return true; - } - else - { - buf = _("unnamed"); - return true; - } -} - -wxWindow *wxDocument::GetDocumentWindow() const -{ - wxView *view = GetFirstView(); - if (view) - return view->GetFrame(); - else - return wxTheApp->GetTopWindow(); -} - -wxCommandProcessor *wxDocument::OnCreateCommandProcessor() -{ - return new wxCommandProcessor; -} - -// true if safe to close -bool wxDocument::OnSaveModified() -{ - if (IsModified()) - { - wxString title; - GetPrintableName(title); - - wxString msgTitle; - if (!wxTheApp->GetAppName().empty()) - msgTitle = wxTheApp->GetAppName(); - else - msgTitle = wxString(_("Warning")); - - wxString prompt; - prompt.Printf(_("Do you want to save changes to document %s?"), - (const wxChar *)title); - int res = wxMessageBox(prompt, msgTitle, - wxYES_NO|wxCANCEL|wxICON_QUESTION, - GetDocumentWindow()); - if (res == wxNO) - { - Modify(false); - return true; - } - else if (res == wxYES) - return Save(); - else if (res == wxCANCEL) - return false; - } - return true; -} - -bool wxDocument::Draw(wxDC& WXUNUSED(context)) -{ - return true; -} - -bool wxDocument::AddView(wxView *view) -{ - if (!m_documentViews.Member(view)) - { - m_documentViews.Append(view); - OnChangedViewList(); - } - return true; -} - -bool wxDocument::RemoveView(wxView *view) -{ - (void)m_documentViews.DeleteObject(view); - OnChangedViewList(); - return true; -} - -bool wxDocument::OnCreate(const wxString& WXUNUSED(path), long flags) -{ - if (GetDocumentTemplate()->CreateView(this, flags)) - return true; - else - return false; -} - -// Called after a view is added or removed. -// The default implementation deletes the document if -// there are no more views. -void wxDocument::OnChangedViewList() -{ - if (m_documentViews.GetCount() == 0) - { - if (OnSaveModified()) - { - delete this; - } - } -} - -void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint) -{ - wxList::compatibility_iterator node = m_documentViews.GetFirst(); - while (node) - { - wxView *view = (wxView *)node->GetData(); - if (view != sender) - view->OnUpdate(sender, hint); - node = node->GetNext(); - } -} - -void wxDocument::NotifyClosing() -{ - wxList::compatibility_iterator node = m_documentViews.GetFirst(); - while (node) - { - wxView *view = (wxView *)node->GetData(); - view->OnClosingDocument(); - node = node->GetNext(); - } -} - -void wxDocument::SetFilename(const wxString& filename, bool notifyViews) -{ - m_documentFile = filename; - if ( notifyViews ) - { - // Notify the views that the filename has changed - wxList::compatibility_iterator node = m_documentViews.GetFirst(); - while (node) - { - wxView *view = (wxView *)node->GetData(); - view->OnChangeFilename(); - node = node->GetNext(); - } - } -} - -bool wxDocument::DoSaveDocument(const wxString& file) -{ - wxString msgTitle; - if (!wxTheApp->GetAppName().empty()) - msgTitle = wxTheApp->GetAppName(); - else - msgTitle = wxString(_("File error")); - -#if wxUSE_STD_IOSTREAM - wxSTD ofstream store(file.mb_str(), wxSTD ios::binary); - if (store.fail() || store.bad()) -#else - wxFileOutputStream store(file); - if (store.GetLastError() != wxSTREAM_NO_ERROR) -#endif - { - (void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION, - GetDocumentWindow()); - // Saving error - return false; - } - if (!SaveObject(store)) - { - (void)wxMessageBox(_("Sorry, could not save this file."), msgTitle, wxOK | wxICON_EXCLAMATION, - GetDocumentWindow()); - // Saving error - return false; - } - - return true; -} - -bool wxDocument::DoOpenDocument(const wxString& file) -{ -#if wxUSE_STD_IOSTREAM - wxSTD ifstream store(file.mb_str(), wxSTD ios::binary); - if (!store.fail() && !store.bad()) -#else - wxFileInputStream store(file); - if (store.GetLastError() == wxSTREAM_NO_ERROR) -#endif - { -#if wxUSE_STD_IOSTREAM - LoadObject(store); - if ( !!store || store.eof() ) -#else - int res = LoadObject(store).GetLastError(); - if ( res == wxSTREAM_NO_ERROR || res == wxSTREAM_EOF ) -#endif - return true; - } - - wxLogError(_("Sorry, could not open this file.")); - return false; -} - - -// ---------------------------------------------------------------------------- -// Document view -// ---------------------------------------------------------------------------- - -wxView::wxView() -{ - m_viewDocument = (wxDocument*) NULL; - - m_viewFrame = (wxFrame *) NULL; -} - -wxView::~wxView() -{ - if (m_viewDocument && GetDocumentManager()) - GetDocumentManager()->ActivateView(this, false); - if (m_viewDocument) - m_viewDocument->RemoveView(this); -} - -// Extend event processing to search the document's event table -bool wxView::ProcessEvent(wxEvent& event) -{ - if ( !GetDocument() || !GetDocument()->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - - return true; -} - -void wxView::OnActivateView(bool WXUNUSED(activate), wxView *WXUNUSED(activeView), wxView *WXUNUSED(deactiveView)) -{ -} - -void wxView::OnPrint(wxDC *dc, wxObject *WXUNUSED(info)) -{ - OnDraw(dc); -} - -void wxView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) -{ -} - -void wxView::OnChangeFilename() -{ - // GetFrame can return wxWindow rather than wxTopLevelWindow due to - // generic MDI implementation so use SetLabel rather than SetTitle. - // It should cause SetTitle() for top level windows. - wxWindow *win = GetFrame(); - if (!win) return; - - wxDocument *doc = GetDocument(); - if (!doc) return; - - wxString name; - doc->GetPrintableName(name); - win->SetLabel(name); -} - -void wxView::SetDocument(wxDocument *doc) -{ - m_viewDocument = doc; - if (doc) - doc->AddView(this); -} - -bool wxView::Close(bool deleteWindow) -{ - if (OnClose(deleteWindow)) - return true; - else - return false; -} - -void wxView::Activate(bool activate) -{ - if (GetDocument() && GetDocumentManager()) - { - OnActivateView(activate, this, GetDocumentManager()->GetCurrentView()); - GetDocumentManager()->ActivateView(this, activate); - } -} - -bool wxView::OnClose(bool WXUNUSED(deleteWindow)) -{ - return GetDocument() ? GetDocument()->Close() : true; -} - -#if wxUSE_PRINTING_ARCHITECTURE -wxPrintout *wxView::OnCreatePrintout() -{ - return new wxDocPrintout(this); -} -#endif // wxUSE_PRINTING_ARCHITECTURE - -// ---------------------------------------------------------------------------- -// wxDocTemplate -// ---------------------------------------------------------------------------- - -wxDocTemplate::wxDocTemplate(wxDocManager *manager, - const wxString& descr, - const wxString& filter, - const wxString& dir, - const wxString& ext, - const wxString& docTypeName, - const wxString& viewTypeName, - wxClassInfo *docClassInfo, - wxClassInfo *viewClassInfo, - long flags) -{ - m_documentManager = manager; - m_description = descr; - m_directory = dir; - m_defaultExt = ext; - m_fileFilter = filter; - m_flags = flags; - m_docTypeName = docTypeName; - m_viewTypeName = viewTypeName; - m_documentManager->AssociateTemplate(this); - - m_docClassInfo = docClassInfo; - m_viewClassInfo = viewClassInfo; -} - -wxDocTemplate::~wxDocTemplate() -{ - m_documentManager->DisassociateTemplate(this); -} - -// Tries to dynamically construct an object of the right class. -wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags) -{ - wxDocument *doc = DoCreateDocument(); - if ( doc == NULL ) - return (wxDocument *) NULL; - - if (InitDocument(doc, path, flags)) - { - return doc; - } - else - { - return (wxDocument *) NULL; - } -} - -bool wxDocTemplate::InitDocument(wxDocument* doc, const wxString& path, long flags) -{ - doc->SetFilename(path); - doc->SetDocumentTemplate(this); - GetDocumentManager()->AddDocument(doc); - doc->SetCommandProcessor(doc->OnCreateCommandProcessor()); - - if (doc->OnCreate(path, flags)) - return true; - else - { - if (GetDocumentManager()->GetDocuments().Member(doc)) - doc->DeleteAllViews(); - return false; - } -} - -wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags) -{ - wxView *view = DoCreateView(); - if ( view == NULL ) - return (wxView *) NULL; - - view->SetDocument(doc); - if (view->OnCreate(doc, flags)) - { - return view; - } - else - { - delete view; - return (wxView *) NULL; - } -} - -// The default (very primitive) format detection: check is the extension is -// that of the template -bool wxDocTemplate::FileMatchesTemplate(const wxString& path) -{ - wxStringTokenizer parser (GetFileFilter(), wxT(";")); - wxString anything = wxT ("*"); - while (parser.HasMoreTokens()) - { - wxString filter = parser.GetNextToken(); - wxString filterExt = FindExtension (filter); - if ( filter.IsSameAs (anything) || - filterExt.IsSameAs (anything) || - filterExt.IsSameAs (FindExtension (path)) ) - return true; - } - return GetDefaultExtension().IsSameAs(FindExtension(path)); -} - -wxDocument *wxDocTemplate::DoCreateDocument() -{ - if (!m_docClassInfo) - return (wxDocument *) NULL; - - return (wxDocument *)m_docClassInfo->CreateObject(); -} - -wxView *wxDocTemplate::DoCreateView() -{ - if (!m_viewClassInfo) - return (wxView *) NULL; - - return (wxView *)m_viewClassInfo->CreateObject(); -} - -// ---------------------------------------------------------------------------- -// wxDocManager -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) - EVT_MENU(wxID_OPEN, wxDocManager::OnFileOpen) - EVT_MENU(wxID_CLOSE, wxDocManager::OnFileClose) - EVT_MENU(wxID_CLOSE_ALL, wxDocManager::OnFileCloseAll) - EVT_MENU(wxID_REVERT, wxDocManager::OnFileRevert) - EVT_MENU(wxID_NEW, wxDocManager::OnFileNew) - EVT_MENU(wxID_SAVE, wxDocManager::OnFileSave) - EVT_MENU(wxID_SAVEAS, wxDocManager::OnFileSaveAs) - EVT_MENU(wxID_UNDO, wxDocManager::OnUndo) - EVT_MENU(wxID_REDO, wxDocManager::OnRedo) - - EVT_UPDATE_UI(wxID_OPEN, wxDocManager::OnUpdateFileOpen) - EVT_UPDATE_UI(wxID_CLOSE, wxDocManager::OnUpdateFileClose) - EVT_UPDATE_UI(wxID_CLOSE_ALL, wxDocManager::OnUpdateFileClose) - EVT_UPDATE_UI(wxID_REVERT, wxDocManager::OnUpdateFileRevert) - EVT_UPDATE_UI(wxID_NEW, wxDocManager::OnUpdateFileNew) - EVT_UPDATE_UI(wxID_SAVE, wxDocManager::OnUpdateFileSave) - EVT_UPDATE_UI(wxID_SAVEAS, wxDocManager::OnUpdateFileSaveAs) - EVT_UPDATE_UI(wxID_UNDO, wxDocManager::OnUpdateUndo) - EVT_UPDATE_UI(wxID_REDO, wxDocManager::OnUpdateRedo) - -#if wxUSE_PRINTING_ARCHITECTURE - EVT_MENU(wxID_PRINT, wxDocManager::OnPrint) - EVT_MENU(wxID_PREVIEW, wxDocManager::OnPreview) - - EVT_UPDATE_UI(wxID_PRINT, wxDocManager::OnUpdatePrint) - EVT_UPDATE_UI(wxID_PREVIEW, wxDocManager::OnUpdatePreview) -#endif -END_EVENT_TABLE() - -wxDocManager* wxDocManager::sm_docManager = (wxDocManager*) NULL; - -wxDocManager::wxDocManager(long flags, bool initialize) -{ - m_defaultDocumentNameCounter = 1; - m_flags = flags; - m_currentView = (wxView *) NULL; - m_maxDocsOpen = 10000; - m_fileHistory = (wxFileHistory *) NULL; - if (initialize) - Initialize(); - sm_docManager = this; -} - -wxDocManager::~wxDocManager() -{ - Clear(); - if (m_fileHistory) - delete m_fileHistory; - sm_docManager = (wxDocManager*) NULL; -} - -// closes the specified document -bool wxDocManager::CloseDocument(wxDocument* doc, bool force) -{ - if (doc->Close() || force) - { - // Implicitly deletes the document when - // the last view is deleted - doc->DeleteAllViews(); - - // Check we're really deleted - if (m_docs.Member(doc)) - delete doc; - - return true; - } - return false; -} - -bool wxDocManager::CloseDocuments(bool force) -{ - wxList::compatibility_iterator node = m_docs.GetFirst(); - while (node) - { - wxDocument *doc = (wxDocument *)node->GetData(); - wxList::compatibility_iterator next = node->GetNext(); - - if (!CloseDocument(doc, force)) - return false; - - // This assumes that documents are not connected in - // any way, i.e. deleting one document does NOT - // delete another. - node = next; - } - return true; -} - -bool wxDocManager::Clear(bool force) -{ - if (!CloseDocuments(force)) - return false; - - m_currentView = NULL; - - wxList::compatibility_iterator node = m_templates.GetFirst(); - while (node) - { - wxDocTemplate *templ = (wxDocTemplate*) node->GetData(); - wxList::compatibility_iterator next = node->GetNext(); - delete templ; - node = next; - } - return true; -} - -bool wxDocManager::Initialize() -{ - m_fileHistory = OnCreateFileHistory(); - return true; -} - -wxFileHistory *wxDocManager::OnCreateFileHistory() -{ - return new wxFileHistory; -} - -void wxDocManager::OnFileClose(wxCommandEvent& WXUNUSED(event)) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - if (doc->Close()) - { - doc->DeleteAllViews(); - if (m_docs.Member(doc)) - delete doc; - } -} - -void wxDocManager::OnFileCloseAll(wxCommandEvent& WXUNUSED(event)) -{ - CloseDocuments(false); -} - -void wxDocManager::OnFileNew(wxCommandEvent& WXUNUSED(event)) -{ - CreateDocument( wxEmptyString, wxDOC_NEW ); -} - -void wxDocManager::OnFileOpen(wxCommandEvent& WXUNUSED(event)) -{ - if ( !CreateDocument( wxEmptyString, 0) ) - { - OnOpenFileFailure(); - } -} - -void wxDocManager::OnFileRevert(wxCommandEvent& WXUNUSED(event)) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - doc->Revert(); -} - -void wxDocManager::OnFileSave(wxCommandEvent& WXUNUSED(event)) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - doc->Save(); -} - -void wxDocManager::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - doc->SaveAs(); -} - -void wxDocManager::OnPrint(wxCommandEvent& WXUNUSED(event)) -{ -#if wxUSE_PRINTING_ARCHITECTURE - wxView *view = GetCurrentView(); - if (!view) - return; - - wxPrintout *printout = view->OnCreatePrintout(); - if (printout) - { - wxPrinter printer; - printer.Print(view->GetFrame(), printout, true); - - delete printout; - } -#endif // wxUSE_PRINTING_ARCHITECTURE -} - -void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event)) -{ -#if wxUSE_PRINTING_ARCHITECTURE - wxBusyCursor busy; - wxView *view = GetCurrentView(); - if (!view) - return; - - wxPrintout *printout = view->OnCreatePrintout(); - if (printout) - { - // Pass two printout objects: for preview, and possible printing. - wxPrintPreviewBase *preview = new wxPrintPreview(printout, view->OnCreatePrintout()); - if ( !preview->Ok() ) - { - delete preview; - wxMessageBox( _("Sorry, print preview needs a printer to be installed.") ); - return; - } - - wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), _("Print Preview"), - wxPoint(100, 100), wxSize(600, 650)); - frame->Centre(wxBOTH); - frame->Initialize(); - frame->Show(true); - } -#endif // wxUSE_PRINTING_ARCHITECTURE -} - -void wxDocManager::OnUndo(wxCommandEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - if (doc->GetCommandProcessor()) - doc->GetCommandProcessor()->Undo(); - else - event.Skip(); -} - -void wxDocManager::OnRedo(wxCommandEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - return; - if (doc->GetCommandProcessor()) - doc->GetCommandProcessor()->Redo(); - else - event.Skip(); -} - -// Handlers for UI update commands - -void wxDocManager::OnUpdateFileOpen(wxUpdateUIEvent& event) -{ - event.Enable( true ); -} - -void wxDocManager::OnUpdateFileClose(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( (doc != (wxDocument*) NULL) ); -} - -void wxDocManager::OnUpdateFileRevert(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( (doc != (wxDocument*) NULL) ); -} - -void wxDocManager::OnUpdateFileNew(wxUpdateUIEvent& event) -{ - event.Enable( true ); -} - -void wxDocManager::OnUpdateFileSave(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( doc && doc->IsModified() ); -} - -void wxDocManager::OnUpdateFileSaveAs(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( (doc != (wxDocument*) NULL) ); -} - -void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - event.Enable(false); - else if (!doc->GetCommandProcessor()) - event.Skip(); - else - { - event.Enable( doc->GetCommandProcessor()->CanUndo() ); - doc->GetCommandProcessor()->SetMenuStrings(); - } -} - -void wxDocManager::OnUpdateRedo(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - if (!doc) - event.Enable(false); - else if (!doc->GetCommandProcessor()) - event.Skip(); - else - { - event.Enable( doc->GetCommandProcessor()->CanRedo() ); - doc->GetCommandProcessor()->SetMenuStrings(); - } -} - -void wxDocManager::OnUpdatePrint(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( (doc != (wxDocument*) NULL) ); -} - -void wxDocManager::OnUpdatePreview(wxUpdateUIEvent& event) -{ - wxDocument *doc = GetCurrentDocument(); - event.Enable( (doc != (wxDocument*) NULL) ); -} - -wxView *wxDocManager::GetCurrentView() const -{ - if (m_currentView) - return m_currentView; - if (m_docs.GetCount() == 1) - { - wxDocument* doc = (wxDocument*) m_docs.GetFirst()->GetData(); - return doc->GetFirstView(); - } - return (wxView *) NULL; -} - -// Extend event processing to search the view's event table -bool wxDocManager::ProcessEvent(wxEvent& event) -{ - wxView* view = GetCurrentView(); - if (view) - { - if (view->ProcessEvent(event)) - return true; - } - return wxEvtHandler::ProcessEvent(event); -} - -wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags) -{ - wxDocTemplate **templates = new wxDocTemplate *[m_templates.GetCount()]; - int n = 0; - - for (size_t i = 0; i < m_templates.GetCount(); i++) - { - wxDocTemplate *temp = (wxDocTemplate *)(m_templates.Item(i)->GetData()); - if (temp->IsVisible()) - { - templates[n] = temp; - n ++; - } - } - if (n == 0) - { - delete[] templates; - return (wxDocument *) NULL; - } - - wxDocument* docToClose = NULL; - - // If we've reached the max number of docs, close the - // first one. - if ( (int)GetDocuments().GetCount() >= m_maxDocsOpen ) - { - wxDocument *doc = (wxDocument *)GetDocuments().GetFirst()->GetData(); - docToClose = doc; - } - - // New document: user chooses a template, unless there's only one. - if (flags & wxDOC_NEW) - { - if (n == 1) - { - if (docToClose) - { - if (!CloseDocument(docToClose, false)) - { - delete[] templates; - return NULL; - } - } - - wxDocTemplate *temp = templates[0]; - delete[] templates; - wxDocument *newDoc = temp->CreateDocument(path, flags); - - if (newDoc) - { - newDoc->SetDocumentName(temp->GetDocumentName()); - newDoc->SetDocumentTemplate(temp); - if (!newDoc->OnNewDocument() ) - { - // Document is implicitly deleted by DeleteAllViews - newDoc->DeleteAllViews(); - return NULL; - } - } - return newDoc; - } - - wxDocTemplate *temp = SelectDocumentType(templates, n); - delete[] templates; - if (temp) - { - if (docToClose) - { - if (!CloseDocument(docToClose, false)) - { - return NULL; - } - } - - wxDocument *newDoc = temp->CreateDocument(path, flags); - - if (newDoc) - { - newDoc->SetDocumentName(temp->GetDocumentName()); - newDoc->SetDocumentTemplate(temp); - if (!newDoc->OnNewDocument() ) - { - // Document is implicitly deleted by DeleteAllViews - newDoc->DeleteAllViews(); - return NULL; - } - } - return newDoc; - } - else - return (wxDocument *) NULL; - } - - // Existing document - wxDocTemplate *temp; - - wxString path2 = path; - - if (flags & wxDOC_SILENT) - { - temp = FindTemplateForPath(path2); - if (!temp) - { - // Since we do not add files with non-default extensions to the FileHistory this - // can only happen if the application changes the allowed templates in runtime. - (void)wxMessageBox(_("Sorry, the format for this file is unknown."), - _("Open File"), - wxOK | wxICON_EXCLAMATION, wxFindSuitableParent()); - } - } - else - temp = SelectDocumentPath(templates, n, path2, flags); - - delete[] templates; - - if (temp) - { - if (docToClose) - { - if (!CloseDocument(docToClose, false)) - { - return NULL; - } - } - - //see if this file is already open - for (size_t i = 0; i < GetDocuments().GetCount(); ++i) - { - wxDocument* currentDoc = (wxDocument*)(GetDocuments().Item(i)->GetData()); -#ifdef __WXMSW__ - //file paths are case-insensitive on Windows - if (path2.CmpNoCase(currentDoc->GetFilename()) == 0) -#else - if (path2.Cmp(currentDoc->GetFilename()) == 0) -#endif - { - //file already open. Just activate it and return - if (currentDoc->GetFirstView()) - { - ActivateView(currentDoc->GetFirstView(), true); - if (currentDoc->GetDocumentWindow()) - currentDoc->GetDocumentWindow()->SetFocus(); - return currentDoc; - } - } - } - - wxDocument *newDoc = temp->CreateDocument(path2, flags); - if (newDoc) - { - newDoc->SetDocumentName(temp->GetDocumentName()); - newDoc->SetDocumentTemplate(temp); - if (!newDoc->OnOpenDocument(path2)) - { - newDoc->DeleteAllViews(); - // delete newDoc; // Implicitly deleted by DeleteAllViews - return (wxDocument *) NULL; - } - // A file that doesn't use the default extension of its document - // template cannot be opened via the FileHistory, so we do not - // add it. - if (temp->FileMatchesTemplate(path2)) - AddFileToHistory(path2); - } - return newDoc; - } - - return (wxDocument *) NULL; -} - -wxView *wxDocManager::CreateView(wxDocument *doc, long flags) -{ - wxDocTemplate **templates = new wxDocTemplate *[m_templates.GetCount()]; - int n =0; - - for (size_t i = 0; i < m_templates.GetCount(); i++) - { - wxDocTemplate *temp = (wxDocTemplate *)(m_templates.Item(i)->GetData()); - if (temp->IsVisible()) - { - if (temp->GetDocumentName() == doc->GetDocumentName()) - { - templates[n] = temp; - n ++; - } - } - } - if (n == 0) - { - delete[] templates; - return (wxView *) NULL; - } - if (n == 1) - { - wxDocTemplate *temp = templates[0]; - delete[] templates; - wxView *view = temp->CreateView(doc, flags); - if (view) - view->SetViewName(temp->GetViewName()); - return view; - } - - wxDocTemplate *temp = SelectViewType(templates, n); - delete[] templates; - if (temp) - { - wxView *view = temp->CreateView(doc, flags); - if (view) - view->SetViewName(temp->GetViewName()); - return view; - } - else - return (wxView *) NULL; -} - -// Not yet implemented -void wxDocManager::DeleteTemplate(wxDocTemplate *WXUNUSED(temp), long WXUNUSED(flags)) -{ -} - -// Not yet implemented -bool wxDocManager::FlushDoc(wxDocument *WXUNUSED(doc)) -{ - return false; -} - -wxDocument *wxDocManager::GetCurrentDocument() const -{ - wxView *view = GetCurrentView(); - if (view) - return view->GetDocument(); - else - return (wxDocument *) NULL; -} - -// Make a default document name -bool wxDocManager::MakeDefaultName(wxString& name) -{ - name.Printf(_("unnamed%d"), m_defaultDocumentNameCounter); - m_defaultDocumentNameCounter++; - - return true; -} - -// Make a frame title (override this to do something different) -// If docName is empty, a document is not currently active. -wxString wxDocManager::MakeFrameTitle(wxDocument* doc) -{ - wxString appName = wxTheApp->GetAppName(); - wxString title; - if (!doc) - title = appName; - else - { - wxString docName; - doc->GetPrintableName(docName); - title = docName + wxString(_(" - ")) + appName; - } - return title; -} - - -// Not yet implemented -wxDocTemplate *wxDocManager::MatchTemplate(const wxString& WXUNUSED(path)) -{ - return (wxDocTemplate *) NULL; -} - -// File history management -void wxDocManager::AddFileToHistory(const wxString& file) -{ - if (m_fileHistory) - m_fileHistory->AddFileToHistory(file); -} - -void wxDocManager::RemoveFileFromHistory(size_t i) -{ - if (m_fileHistory) - m_fileHistory->RemoveFileFromHistory(i); -} - -wxString wxDocManager::GetHistoryFile(size_t i) const -{ - wxString histFile; - - if (m_fileHistory) - histFile = m_fileHistory->GetHistoryFile(i); - - return histFile; -} - -void wxDocManager::FileHistoryUseMenu(wxMenu *menu) -{ - if (m_fileHistory) - m_fileHistory->UseMenu(menu); -} - -void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu) -{ - if (m_fileHistory) - m_fileHistory->RemoveMenu(menu); -} - -#if wxUSE_CONFIG -void wxDocManager::FileHistoryLoad(wxConfigBase& config) -{ - if (m_fileHistory) - m_fileHistory->Load(config); -} - -void wxDocManager::FileHistorySave(wxConfigBase& config) -{ - if (m_fileHistory) - m_fileHistory->Save(config); -} -#endif - -void wxDocManager::FileHistoryAddFilesToMenu(wxMenu* menu) -{ - if (m_fileHistory) - m_fileHistory->AddFilesToMenu(menu); -} - -void wxDocManager::FileHistoryAddFilesToMenu() -{ - if (m_fileHistory) - m_fileHistory->AddFilesToMenu(); -} - -size_t wxDocManager::GetHistoryFilesCount() const -{ - return m_fileHistory ? m_fileHistory->GetCount() : 0; -} - - -// Find out the document template via matching in the document file format -// against that of the template -wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path) -{ - wxDocTemplate *theTemplate = (wxDocTemplate *) NULL; - - // Find the template which this extension corresponds to - for (size_t i = 0; i < m_templates.GetCount(); i++) - { - wxDocTemplate *temp = (wxDocTemplate *)m_templates.Item(i)->GetData(); - if ( temp->FileMatchesTemplate(path) ) - { - theTemplate = temp; - break; - } - } - return theTemplate; -} - -// Try to get a more suitable parent frame than the top window, -// for selection dialogs. Otherwise you may get an unexpected -// window being activated when a dialog is shown. -static wxWindow* wxFindSuitableParent() -{ - wxWindow* parent = wxTheApp->GetTopWindow(); - - wxWindow* focusWindow = wxWindow::FindFocus(); - if (focusWindow) - { - while (focusWindow && - !focusWindow->IsKindOf(CLASSINFO(wxDialog)) && - !focusWindow->IsKindOf(CLASSINFO(wxFrame))) - - focusWindow = focusWindow->GetParent(); - - if (focusWindow) - parent = focusWindow; - } - return parent; -} - -// Prompts user to open a file, using file specs in templates. -// Must extend the file selector dialog or implement own; OR -// match the extension to the template extension. - -wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__) - int noTemplates, -#else - int WXUNUSED(noTemplates), -#endif - wxString& path, - long WXUNUSED(flags), - bool WXUNUSED(save)) -{ - // We can only have multiple filters in Windows and GTK -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__) - wxString descrBuf; - - int i; - for (i = 0; i < noTemplates; i++) - { - if (templates[i]->IsVisible()) - { - // add a '|' to separate this filter from the previous one - if ( !descrBuf.empty() ) - descrBuf << wxT('|'); - - descrBuf << templates[i]->GetDescription() - << wxT(" (") << templates[i]->GetFileFilter() << wxT(") |") - << templates[i]->GetFileFilter(); - } - } -#else - wxString descrBuf = wxT("*.*"); -#endif - - int FilterIndex = -1; - - wxWindow* parent = wxFindSuitableParent(); - - wxString pathTmp = wxFileSelectorEx(_("Select a file"), - m_lastDirectory, - wxEmptyString, - &FilterIndex, - descrBuf, - 0, - parent); - - wxDocTemplate *theTemplate = (wxDocTemplate *)NULL; - if (!pathTmp.empty()) - { - if (!wxFileExists(pathTmp)) - { - wxString msgTitle; - if (!wxTheApp->GetAppName().empty()) - msgTitle = wxTheApp->GetAppName(); - else - msgTitle = wxString(_("File error")); - - (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK | wxICON_EXCLAMATION, - parent); - - path = wxEmptyString; - return (wxDocTemplate *) NULL; - } - m_lastDirectory = wxPathOnly(pathTmp); - - path = pathTmp; - - // first choose the template using the extension, if this fails (i.e. - // wxFileSelectorEx() didn't fill it), then use the path - if ( FilterIndex != -1 ) - theTemplate = templates[FilterIndex]; - if ( !theTemplate ) - theTemplate = FindTemplateForPath(path); - if ( !theTemplate ) - { - // Since we do not add files with non-default extensions to the FileHistory this - // can only happen if the application changes the allowed templates in runtime. - (void)wxMessageBox(_("Sorry, the format for this file is unknown."), - _("Open File"), - wxOK | wxICON_EXCLAMATION, wxFindSuitableParent()); - } - } - else - { - path = wxEmptyString; - } - - return theTemplate; -} - -wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, - int noTemplates, bool sort) -{ - wxArrayString strings; - wxDocTemplate **data = new wxDocTemplate *[noTemplates]; - int i; - int n = 0; - - for (i = 0; i < noTemplates; i++) - { - if (templates[i]->IsVisible()) - { - int j; - bool want = true; - for (j = 0; j < n; j++) - { - //filter out NOT unique documents + view combinations - if ( templates[i]->m_docTypeName == data[j]->m_docTypeName && - templates[i]->m_viewTypeName == data[j]->m_viewTypeName - ) - want = false; - } - - if ( want ) - { - strings.Add(templates[i]->m_description); - - data[n] = templates[i]; - n ++; - } - } - } // for - - if (sort) - { - strings.Sort(); // ascending sort - // Yes, this will be slow, but template lists - // are typically short. - int j; - n = strings.Count(); - for (i = 0; i < n; i++) - { - for (j = 0; j < noTemplates; j++) - { - if (strings[i] == templates[j]->m_description) - data[i] = templates[j]; - } - } - } - - wxDocTemplate *theTemplate; - - switch ( n ) - { - case 0: - // no visible templates, hence nothing to choose from - theTemplate = NULL; - break; - - case 1: - // don't propose the user to choose if he heas no choice - theTemplate = data[0]; - break; - - default: - // propose the user to choose one of several - theTemplate = (wxDocTemplate *)wxGetSingleChoiceData - ( - _("Select a document template"), - _("Templates"), - strings, - (void **)data, - wxFindSuitableParent() - ); - } - - delete[] data; - - return theTemplate; -} - -wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, - int noTemplates, bool sort) -{ - wxArrayString strings; - wxDocTemplate **data = new wxDocTemplate *[noTemplates]; - int i; - int n = 0; - - for (i = 0; i < noTemplates; i++) - { - wxDocTemplate *templ = templates[i]; - if ( templ->IsVisible() && !templ->GetViewName().empty() ) - { - int j; - bool want = true; - for (j = 0; j < n; j++) - { - //filter out NOT unique views - if ( templates[i]->m_viewTypeName == data[j]->m_viewTypeName ) - want = false; - } - - if ( want ) - { - strings.Add(templ->m_viewTypeName); - data[n] = templ; - n ++; - } - } - } - - if (sort) - { - strings.Sort(); // ascending sort - // Yes, this will be slow, but template lists - // are typically short. - int j; - n = strings.Count(); - for (i = 0; i < n; i++) - { - for (j = 0; j < noTemplates; j++) - { - if (strings[i] == templates[j]->m_viewTypeName) - data[i] = templates[j]; - } - } - } - - wxDocTemplate *theTemplate; - - // the same logic as above - switch ( n ) - { - case 0: - theTemplate = (wxDocTemplate *)NULL; - break; - - case 1: - theTemplate = data[0]; - break; - - default: - theTemplate = (wxDocTemplate *)wxGetSingleChoiceData - ( - _("Select a document view"), - _("Views"), - strings, - (void **)data, - wxFindSuitableParent() - ); - - } - - delete[] data; - return theTemplate; -} - -void wxDocManager::AssociateTemplate(wxDocTemplate *temp) -{ - if (!m_templates.Member(temp)) - m_templates.Append(temp); -} - -void wxDocManager::DisassociateTemplate(wxDocTemplate *temp) -{ - m_templates.DeleteObject(temp); -} - -// Add and remove a document from the manager's list -void wxDocManager::AddDocument(wxDocument *doc) -{ - if (!m_docs.Member(doc)) - m_docs.Append(doc); -} - -void wxDocManager::RemoveDocument(wxDocument *doc) -{ - m_docs.DeleteObject(doc); -} - -// Views or windows should inform the document manager -// when a view is going in or out of focus -void wxDocManager::ActivateView(wxView *view, bool activate) -{ - if ( activate ) - { - m_currentView = view; - } - else // deactivate - { - if ( m_currentView == view ) - { - // don't keep stale pointer - m_currentView = (wxView *) NULL; - } - } -} - -// ---------------------------------------------------------------------------- -// Default document child frame -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxDocChildFrame, wxFrame) - EVT_ACTIVATE(wxDocChildFrame::OnActivate) - EVT_CLOSE(wxDocChildFrame::OnCloseWindow) -END_EVENT_TABLE() - -wxDocChildFrame::wxDocChildFrame(wxDocument *doc, - wxView *view, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) - : wxFrame(frame, id, title, pos, size, style, name) -{ - m_childDocument = doc; - m_childView = view; - if (view) - view->SetFrame(this); -} - -// Extend event processing to search the view's event table -bool wxDocChildFrame::ProcessEvent(wxEvent& event) -{ - if (m_childView) - m_childView->Activate(true); - - if ( !m_childView || ! m_childView->ProcessEvent(event) ) - { - // Only hand up to the parent if it's a menu command - if (!event.IsKindOf(CLASSINFO(wxCommandEvent)) || !GetParent() || !GetParent()->ProcessEvent(event)) - return wxEvtHandler::ProcessEvent(event); - else - return true; - } - else - return true; -} - -void wxDocChildFrame::OnActivate(wxActivateEvent& event) -{ - wxFrame::OnActivate(event); - - if (m_childView) - m_childView->Activate(event.GetActive()); -} - -void wxDocChildFrame::OnCloseWindow(wxCloseEvent& event) -{ - if (m_childView) - { - bool ans = event.CanVeto() - ? m_childView->Close(false) // false means don't delete associated window - : true; // Must delete. - - if (ans) - { - m_childView->Activate(false); - delete m_childView; - m_childView = (wxView *) NULL; - m_childDocument = (wxDocument *) NULL; - - this->Destroy(); - } - else - event.Veto(); - } - else - event.Veto(); -} - -// ---------------------------------------------------------------------------- -// Default parent frame -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame) - EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit) - EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile) - EVT_CLOSE(wxDocParentFrame::OnCloseWindow) -END_EVENT_TABLE() - -wxDocParentFrame::wxDocParentFrame() -{ - m_docManager = NULL; -} - -wxDocParentFrame::wxDocParentFrame(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) - : wxFrame(frame, id, title, pos, size, style, name) -{ - m_docManager = manager; -} - -bool wxDocParentFrame::Create(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - m_docManager = manager; - return base_type::Create(frame, id, title, pos, size, style, name); -} - -void wxDocParentFrame::OnExit(wxCommandEvent& WXUNUSED(event)) -{ - Close(); -} - -void wxDocParentFrame::OnMRUFile(wxCommandEvent& event) -{ - int n = event.GetId() - wxID_FILE1; // the index in MRU list - wxString filename(m_docManager->GetHistoryFile(n)); - if ( !filename.empty() ) - { - // verify that the file exists before doing anything else - if ( wxFile::Exists(filename) ) - { - // try to open it - if (!m_docManager->CreateDocument(filename, wxDOC_SILENT)) - { - // remove the file from the MRU list. The user should already be notified. - m_docManager->RemoveFileFromHistory(n); - - wxLogError(_("The file '%s' couldn't be opened.\nIt has been removed from the most recently used files list."), - filename.c_str()); - } - } - else - { - // remove the bogus filename from the MRU list and notify the user - // about it - m_docManager->RemoveFileFromHistory(n); - - wxLogError(_("The file '%s' doesn't exist and couldn't be opened.\nIt has been removed from the most recently used files list."), - filename.c_str()); - } - } -} - -// Extend event processing to search the view's event table -bool wxDocParentFrame::ProcessEvent(wxEvent& event) -{ - // Try the document manager, then do default processing - if (!m_docManager || !m_docManager->ProcessEvent(event)) - return wxEvtHandler::ProcessEvent(event); - else - return true; -} - -// Define the behaviour for the frame closing -// - must delete all frames except for the main one. -void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event) -{ - if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) - { - // The user decided not to close finally, abort. - event.Veto(); - } - else - { - this->Destroy(); - } -} - -#if wxUSE_PRINTING_ARCHITECTURE - -wxDocPrintout::wxDocPrintout(wxView *view, const wxString& title) - : wxPrintout(title) -{ - m_printoutView = view; -} - -bool wxDocPrintout::OnPrintPage(int WXUNUSED(page)) -{ - wxDC *dc = GetDC(); - - // Get the logical pixels per inch of screen and printer - int ppiScreenX, ppiScreenY; - GetPPIScreen(&ppiScreenX, &ppiScreenY); - wxUnusedVar(ppiScreenY); - int ppiPrinterX, ppiPrinterY; - GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); - wxUnusedVar(ppiPrinterY); - - // This scales the DC so that the printout roughly represents the - // the screen scaling. The text point size _should_ be the right size - // but in fact is too small for some reason. This is a detail that will - // need to be addressed at some point but can be fudged for the - // moment. - float scale = (float)((float)ppiPrinterX/(float)ppiScreenX); - - // Now we have to check in case our real page size is reduced - // (e.g. because we're drawing to a print preview memory DC) - int pageWidth, pageHeight; - int w, h; - dc->GetSize(&w, &h); - GetPageSizePixels(&pageWidth, &pageHeight); - wxUnusedVar(pageHeight); - - // If printer pageWidth == current DC width, then this doesn't - // change. But w might be the preview bitmap width, so scale down. - float overallScale = scale * (float)(w/(float)pageWidth); - dc->SetUserScale(overallScale, overallScale); - - if (m_printoutView) - { - m_printoutView->OnDraw(dc); - } - return true; -} - -bool wxDocPrintout::HasPage(int pageNum) -{ - return (pageNum == 1); -} - -bool wxDocPrintout::OnBeginDocument(int startPage, int endPage) -{ - if (!wxPrintout::OnBeginDocument(startPage, endPage)) - return false; - - return true; -} - -void wxDocPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) -{ - *minPage = 1; - *maxPage = 1; - *selPageFrom = 1; - *selPageTo = 1; -} - -#endif // wxUSE_PRINTING_ARCHITECTURE - -// ---------------------------------------------------------------------------- -// File history processor -// ---------------------------------------------------------------------------- - -static inline wxChar* MYcopystring(const wxString& s) -{ - wxChar* copy = new wxChar[s.length() + 1]; - return wxStrcpy(copy, s.c_str()); -} - -static inline wxChar* MYcopystring(const wxChar* s) -{ - wxChar* copy = new wxChar[wxStrlen(s) + 1]; - return wxStrcpy(copy, s); -} - -wxFileHistory::wxFileHistory(size_t maxFiles, wxWindowID idBase) -{ - m_fileMaxFiles = maxFiles; - m_idBase = idBase; - m_fileHistoryN = 0; - m_fileHistory = new wxChar *[m_fileMaxFiles]; -} - -wxFileHistory::~wxFileHistory() -{ - size_t i; - for (i = 0; i < m_fileHistoryN; i++) - delete[] m_fileHistory[i]; - delete[] m_fileHistory; -} - -// File history management -void wxFileHistory::AddFileToHistory(const wxString& file) -{ - size_t i; - - // Check we don't already have this file - for (i = 0; i < m_fileHistoryN; i++) - { -#if defined( __WXMSW__ ) // Add any other OSes with case insensitive file names - wxString testString; - if ( m_fileHistory[i] ) - testString = m_fileHistory[i]; - if ( m_fileHistory[i] && ( file.Lower() == testString.Lower() ) ) -#else - if ( m_fileHistory[i] && ( file == m_fileHistory[i] ) ) -#endif - { - // we do have it, move it to the top of the history - RemoveFileFromHistory (i); - AddFileToHistory (file); - return; - } - } - - // if we already have a full history, delete the one at the end - if ( m_fileMaxFiles == m_fileHistoryN ) - { - RemoveFileFromHistory (m_fileHistoryN - 1); - AddFileToHistory (file); - return; - } - - // Add to the project file history: - // Move existing files (if any) down so we can insert file at beginning. - if (m_fileHistoryN < m_fileMaxFiles) - { - wxList::compatibility_iterator node = m_fileMenus.GetFirst(); - while (node) - { - wxMenu* menu = (wxMenu*) node->GetData(); - if ( m_fileHistoryN == 0 && menu->GetMenuItemCount() ) - { - menu->AppendSeparator(); - } - menu->Append(m_idBase+m_fileHistoryN, _("[EMPTY]")); - node = node->GetNext(); - } - m_fileHistoryN ++; - } - // Shuffle filenames down - for (i = (m_fileHistoryN-1); i > 0; i--) - { - m_fileHistory[i] = m_fileHistory[i-1]; - } - m_fileHistory[0] = MYcopystring(file); - - // this is the directory of the last opened file - wxString pathCurrent; - wxSplitPath( m_fileHistory[0], &pathCurrent, NULL, NULL ); - for (i = 0; i < m_fileHistoryN; i++) - { - if ( m_fileHistory[i] ) - { - // if in same directory just show the filename; otherwise the full - // path - wxString pathInMenu, path, filename, ext; - wxSplitPath( m_fileHistory[i], &path, &filename, &ext ); - if ( path == pathCurrent ) - { - pathInMenu = filename; - if ( !ext.empty() ) - pathInMenu = pathInMenu + wxFILE_SEP_EXT + ext; - } - else - { - // absolute path; could also set relative path - pathInMenu = m_fileHistory[i]; - } - - // we need to quote '&' characters which are used for mnemonics - pathInMenu.Replace(_T("&"), _T("&&")); - wxString buf; - buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str()); - wxList::compatibility_iterator node = m_fileMenus.GetFirst(); - while (node) - { - wxMenu* menu = (wxMenu*) node->GetData(); - menu->SetLabel(m_idBase + i, buf); - node = node->GetNext(); - } - } - } -} - -void wxFileHistory::RemoveFileFromHistory(size_t i) -{ - wxCHECK_RET( i < m_fileHistoryN, - wxT("invalid index in wxFileHistory::RemoveFileFromHistory") ); - - // delete the element from the array (could use memmove() too...) - delete [] m_fileHistory[i]; - - size_t j; - for ( j = i; j < m_fileHistoryN - 1; j++ ) - { - m_fileHistory[j] = m_fileHistory[j + 1]; - } - - wxList::compatibility_iterator node = m_fileMenus.GetFirst(); - while ( node ) - { - wxMenu* menu = (wxMenu*) node->GetData(); - - // shuffle filenames up - wxString buf; - for ( j = i; j < m_fileHistoryN - 1; j++ ) - { - buf.Printf(s_MRUEntryFormat, j + 1, m_fileHistory[j]); - menu->SetLabel(m_idBase + j, buf); - } - - node = node->GetNext(); - - // delete the last menu item which is unused now - wxWindowID lastItemId = m_idBase + wx_truncate_cast(wxWindowID, m_fileHistoryN) - 1; - if (menu->FindItem(lastItemId)) - { - menu->Delete(lastItemId); - } - - // delete the last separator too if no more files are left - if ( m_fileHistoryN == 1 ) - { - wxMenuItemList::compatibility_iterator nodeLast = menu->GetMenuItems().GetLast(); - if ( nodeLast ) - { - wxMenuItem *menuItem = nodeLast->GetData(); - if ( menuItem->IsSeparator() ) - { - menu->Delete(menuItem); - } - //else: should we search backwards for the last separator? - } - //else: menu is empty somehow - } - } - - m_fileHistoryN--; -} - -wxString wxFileHistory::GetHistoryFile(size_t i) const -{ - wxString s; - if ( i < m_fileHistoryN ) - { - s = m_fileHistory[i]; - } - else - { - wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") ); - } - - return s; -} - -void wxFileHistory::UseMenu(wxMenu *menu) -{ - if (!m_fileMenus.Member(menu)) - m_fileMenus.Append(menu); -} - -void wxFileHistory::RemoveMenu(wxMenu *menu) -{ - m_fileMenus.DeleteObject(menu); -} - -#if wxUSE_CONFIG -void wxFileHistory::Load(wxConfigBase& config) -{ - m_fileHistoryN = 0; - wxString buf; - buf.Printf(wxT("file%d"), (int)m_fileHistoryN+1); - wxString historyFile; - while ((m_fileHistoryN < m_fileMaxFiles) && config.Read(buf, &historyFile) && (!historyFile.empty())) - { - m_fileHistory[m_fileHistoryN] = MYcopystring((const wxChar*) historyFile); - m_fileHistoryN ++; - buf.Printf(wxT("file%d"), (int)m_fileHistoryN+1); - historyFile = wxEmptyString; - } - AddFilesToMenu(); -} - -void wxFileHistory::Save(wxConfigBase& config) -{ - size_t i; - for (i = 0; i < m_fileMaxFiles; i++) - { - wxString buf; - buf.Printf(wxT("file%d"), (int)i+1); - if (i < m_fileHistoryN) - config.Write(buf, wxString(m_fileHistory[i])); - else - config.Write(buf, wxEmptyString); - } -} -#endif // wxUSE_CONFIG - -void wxFileHistory::AddFilesToMenu() -{ - if (m_fileHistoryN > 0) - { - wxList::compatibility_iterator node = m_fileMenus.GetFirst(); - while (node) - { - wxMenu* menu = (wxMenu*) node->GetData(); - if (menu->GetMenuItemCount()) - { - menu->AppendSeparator(); - } - - size_t i; - for (i = 0; i < m_fileHistoryN; i++) - { - if (m_fileHistory[i]) - { - wxString buf; - buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]); - menu->Append(m_idBase+i, buf); - } - } - node = node->GetNext(); - } - } -} - -void wxFileHistory::AddFilesToMenu(wxMenu* menu) -{ - if (m_fileHistoryN > 0) - { - if (menu->GetMenuItemCount()) - { - menu->AppendSeparator(); - } - - size_t i; - for (i = 0; i < m_fileHistoryN; i++) - { - if (m_fileHistory[i]) - { - wxString buf; - buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]); - menu->Append(m_idBase+i, buf); - } - } - } -} - -// ---------------------------------------------------------------------------- -// Permits compatibility with existing file formats and functions that -// manipulate files directly -// ---------------------------------------------------------------------------- - -#if wxUSE_STD_IOSTREAM - -bool wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream) -{ - wxFFile file(filename, _T("rb")); - if ( !file.IsOpened() ) - return false; - - char buf[4096]; - - size_t nRead; - do - { - nRead = file.Read(buf, WXSIZEOF(buf)); - if ( file.Error() ) - return false; - - stream.write(buf, nRead); - if ( !stream ) - return false; - } - while ( !file.Eof() ); - - return true; -} - -bool wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename) -{ - wxFFile file(filename, _T("wb")); - if ( !file.IsOpened() ) - return false; - - char buf[4096]; - do - { - stream.read(buf, WXSIZEOF(buf)); - if ( !stream.bad() ) // fail may be set on EOF, don't use operator!() - { - if ( !file.Write(buf, stream.gcount()) ) - return false; - } - } - while ( !stream.eof() ); - - return true; -} - -#else // !wxUSE_STD_IOSTREAM - -bool wxTransferFileToStream(const wxString& filename, wxOutputStream& stream) -{ - wxFFile file(filename, _T("rb")); - if ( !file.IsOpened() ) - return false; - - char buf[4096]; - - size_t nRead; - do - { - nRead = file.Read(buf, WXSIZEOF(buf)); - if ( file.Error() ) - return false; - - stream.Write(buf, nRead); - if ( !stream ) - return false; - } - while ( !file.Eof() ); - - return true; -} - -bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename) -{ - wxFFile file(filename, _T("wb")); - if ( !file.IsOpened() ) - return false; - - char buf[4096]; - for ( ;; ) - { - stream.Read(buf, WXSIZEOF(buf)); - - const size_t nRead = stream.LastRead(); - if ( !nRead ) - { - if ( stream.Eof() ) - break; - - return false; - } - - if ( !file.Write(buf, nRead) ) - return false; - } - - return true; -} - -#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM - -#endif // wxUSE_DOC_VIEW_ARCHITECTURE diff --git a/Source/3rdParty/wx/src/common/dpycmn.cpp b/Source/3rdParty/wx/src/common/dpycmn.cpp deleted file mode 100644 index 4cc0e4435..000000000 --- a/Source/3rdParty/wx/src/common/dpycmn.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dpycmn.cpp -// Purpose: wxDisplay and wxDisplayImplSingle implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.03.03 -// RCS-ID: $Id: dpycmn.cpp 41548 2006-10-02 05:38:05Z PC $ -// Copyright: (c) 2003-2006 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/gdicmn.h" - #include "wx/window.h" - #include "wx/module.h" -#endif //WX_PRECOMP - -#include "wx/display.h" -#include "wx/display_impl.h" - -#if wxUSE_DISPLAY - -#include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(wxArrayVideoModes) - -const wxVideoMode wxDefaultVideoMode; - -#endif // wxUSE_DISPLAY - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -// the factory object used by wxDisplay -// -// created on demand and destroyed by wxDisplayModule -static wxDisplayFactory *gs_factory = NULL; - -// ---------------------------------------------------------------------------- -// wxDisplayImplSingle: trivial implementation working for main display only -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl -{ -public: - wxDisplayImplSingle() : wxDisplayImpl(0) { } - - virtual wxRect GetGeometry() const - { - wxRect r; - wxDisplaySize(&r.width, &r.height); - return r; - } - - virtual wxRect GetClientArea() const { return wxGetClientDisplayRect(); } - - virtual wxString GetName() const { return wxString(); } - -#if wxUSE_DISPLAY - // no video modes support for us, provide just the stubs - - virtual wxArrayVideoModes GetModes(const wxVideoMode& WXUNUSED(mode)) const - { - return wxArrayVideoModes(); - } - - virtual wxVideoMode GetCurrentMode() const { return wxVideoMode(); } - - virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) { return false; } -#endif // wxUSE_DISPLAY - - - DECLARE_NO_COPY_CLASS(wxDisplayImplSingle) -}; - -// ---------------------------------------------------------------------------- -// wxDisplayModule is used to cleanup gs_factory -// ---------------------------------------------------------------------------- - -class wxDisplayModule : public wxModule -{ -public: - virtual bool OnInit() { return true; } - virtual void OnExit() - { - if ( gs_factory ) - { - delete gs_factory; - gs_factory = NULL; - } - } - - DECLARE_DYNAMIC_CLASS(wxDisplayModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule) - -// ============================================================================ -// wxDisplay implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// ctor/dtor -// ---------------------------------------------------------------------------- - -wxDisplay::wxDisplay(unsigned n) -{ - wxASSERT_MSG( n < GetCount(), - wxT("An invalid index was passed to wxDisplay") ); - - m_impl = Factory().CreateDisplay(n); -} - -wxDisplay::~wxDisplay() -{ - delete m_impl; -} - -// ---------------------------------------------------------------------------- -// static functions forwarded to wxDisplayFactory -// ---------------------------------------------------------------------------- - -/* static */ unsigned wxDisplay::GetCount() -{ - return Factory().GetCount(); -} - -/* static */ int wxDisplay::GetFromPoint(const wxPoint& pt) -{ - return Factory().GetFromPoint(pt); -} - -/* static */ int wxDisplay::GetFromWindow(wxWindow *window) -{ - wxCHECK_MSG( window, wxNOT_FOUND, _T("invalid window") ); - - return Factory().GetFromWindow(window); -} - -// ---------------------------------------------------------------------------- -// functions forwarded to wxDisplayImpl -// ---------------------------------------------------------------------------- - -wxRect wxDisplay::GetGeometry() const -{ - wxCHECK_MSG( IsOk(), wxRect(), _T("invalid wxDisplay object") ); - - return m_impl->GetGeometry(); -} - -wxRect wxDisplay::GetClientArea() const -{ - wxCHECK_MSG( IsOk(), wxRect(), _T("invalid wxDisplay object") ); - - return m_impl->GetClientArea(); -} - -wxString wxDisplay::GetName() const -{ - wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") ); - - return m_impl->GetName(); -} - -bool wxDisplay::IsPrimary() const -{ - return m_impl && m_impl->GetIndex() == 0; -} - -#if wxUSE_DISPLAY - -wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& mode) const -{ - wxCHECK_MSG( IsOk(), wxArrayVideoModes(), _T("invalid wxDisplay object") ); - - return m_impl->GetModes(mode); -} - -wxVideoMode wxDisplay::GetCurrentMode() const -{ - wxCHECK_MSG( IsOk(), wxVideoMode(), _T("invalid wxDisplay object") ); - - return m_impl->GetCurrentMode(); -} - -bool wxDisplay::ChangeMode(const wxVideoMode& mode) -{ - wxCHECK_MSG( IsOk(), false, _T("invalid wxDisplay object") ); - - return m_impl->ChangeMode(mode); -} - -#endif // wxUSE_DIRECTDRAW - -// ---------------------------------------------------------------------------- -// static functions implementation -// ---------------------------------------------------------------------------- - -// if wxUSE_DISPLAY == 1 this is implemented in port-specific code -#if !wxUSE_DISPLAY - -/* static */ wxDisplayFactory *wxDisplay::CreateFactory() -{ - return new wxDisplayFactorySingle; -} - -#endif // !wxUSE_DISPLAY - -/* static */ wxDisplayFactory& wxDisplay::Factory() -{ - if ( !gs_factory ) - { - gs_factory = CreateFactory(); - } - - return *gs_factory; -} - -// ============================================================================ -// wxDisplayFactory implementation -// ============================================================================ - -int wxDisplayFactory::GetFromWindow(wxWindow *window) -{ - // consider that the window belongs to the display containing its centre - const wxRect r(window->GetRect()); - return GetFromPoint(wxPoint(r.x + r.width/2, r.y + r.height/2)); -} - -// ============================================================================ -// wxDisplayFactorySingle implementation -// ============================================================================ - -/* static */ -wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) -{ - // we recognize the main display only - return n != 0 ? NULL : new wxDisplayImplSingle; -} - -int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt) -{ - if ( pt.x >= 0 && pt.y >= 0 ) - { - int w, h; - wxDisplaySize(&w, &h); - - if ( pt.x < w && pt.y < h ) - return 0; - } - - // the point is outside of the screen - return wxNOT_FOUND; -} diff --git a/Source/3rdParty/wx/src/common/dseldlg.cpp b/Source/3rdParty/wx/src/common/dseldlg.cpp deleted file mode 100644 index 04944fc65..000000000 --- a/Source/3rdParty/wx/src/common/dseldlg.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dseldlg.cpp -// Purpose: implementation of ::wxDirSelector() -// Author: Paul Thiessen -// Modified by: -// Created: 20.02.01 -// RCS-ID: $Id: dseldlg.cpp 39613 2006-06-07 11:44:19Z ABX $ -// Copyright: (c) 2001 wxWidgets team -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DIRDLG - -#include "wx/dirdlg.h" - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -// ============================================================================ -// implementation -// ============================================================================ - -wxString wxDirSelector(const wxString& message, - const wxString& defaultPath, - long style, - const wxPoint& pos, - wxWindow *parent) -{ - wxString path; - - wxDirDialog dirDialog(parent, message, defaultPath, style, pos); - if ( dirDialog.ShowModal() == wxID_OK ) - { - path = dirDialog.GetPath(); - } - - return path; -} - -#endif // wxUSE_DIRDLG diff --git a/Source/3rdParty/wx/src/common/dummy.cpp b/Source/3rdParty/wx/src/common/dummy.cpp deleted file mode 100644 index db74ef7c6..000000000 --- a/Source/3rdParty/wx/src/common/dummy.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * File: src/common/dummy.cpp - * Purpose: See below - * Author: Julian Smart - * Created: 1993 - * Updated: - * Copyright: (c) 1993, AIAI, University of Edinburgh - */ - -/* A dummy file to include wx.h. If precompiling wx.h, - * always start by compiling this and producing the PCH file. - * Then subsequent source files use the PCH file. - * - * If precompiling wx.h for wxWidgets and derived apps, - * link dummy.obj with your program. - * - * This will produce a big PCH file. - */ - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifdef __WXMSW__ - #include "wx/msw/msvcrt.h" -#endif - -#ifdef __VISAGECPP__ - char wxDummyChar = 0; -#endif diff --git a/Source/3rdParty/wx/src/common/dynarray.cpp b/Source/3rdParty/wx/src/common/dynarray.cpp deleted file mode 100644 index b5f2b4bc7..000000000 --- a/Source/3rdParty/wx/src/common/dynarray.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dynarray.cpp -// Purpose: implementation of wxBaseArray class -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.97 -// RCS-ID: $Id: dynarray.cpp 43030 2006-11-04 12:51:01Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// headers -// ============================================================================ - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/intl.h" -#endif //WX_PRECOMP - -#include -#include // for memmove - -// we cast the value to long from which we cast it to void * in IndexForInsert: -// this can't work if the pointers are not big enough -wxCOMPILE_TIME_ASSERT( sizeof(wxUIntPtr) <= sizeof(void *), - wxArraySizeOfPtrLessSizeOfLong ); // < 32 symbols - -// ============================================================================ -// constants -// ============================================================================ - -// size increment = max(50% of current size, ARRAY_MAXSIZE_INCREMENT) -#define ARRAY_MAXSIZE_INCREMENT 4096 - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxBaseArray - dynamic array of 'T's -// ---------------------------------------------------------------------------- - -#define _WX_DEFINE_BASEARRAY_COMMON(T, name) \ -/* searches the array for an item (forward or backwards) */ \ -int name::Index(T lItem, bool bFromEnd) const \ -{ \ - if ( bFromEnd ) { \ - if ( size() > 0 ) { \ - size_t n = size(); \ - do { \ - if ( (*this)[--n] == lItem ) \ - return n; \ - } \ - while ( n != 0 ); \ - } \ - } \ - else { \ - for( size_t n = 0; n < size(); n++ ) { \ - if( (*this)[n] == lItem ) \ - return n; \ - } \ - } \ - \ - return wxNOT_FOUND; \ -} \ - \ -/* add item assuming the array is sorted with fnCompare function */ \ -size_t name::Add(T lItem, CMPFUNC fnCompare) \ -{ \ - size_t idx = IndexForInsert(lItem, fnCompare); \ - Insert(lItem, idx); \ - return idx; \ -} - -#if wxUSE_STL - -#define _WX_DEFINE_BASEARRAY_NOCOMMON(T, name) \ -size_t name::IndexForInsert(T lItem, CMPFUNC fnCompare) const \ -{ \ - Predicate p((SCMPFUNC)fnCompare); \ - const_iterator it = std::lower_bound(begin(), end(), lItem, p); \ - return it - begin(); \ -} \ - \ -int name::Index(T lItem, CMPFUNC fnCompare) const \ -{ \ - Predicate p((SCMPFUNC)fnCompare); \ - const_iterator it = std::lower_bound(begin(), end(), lItem, p); \ - return (it != end() && !p(lItem, *it)) ? \ - (int)(it - begin()) : wxNOT_FOUND; \ -} \ - \ -void name::Shrink() \ -{ \ - name tmp(*this); \ - swap(tmp); \ -} - -#else // if !wxUSE_STL - -#define _WX_DEFINE_BASEARRAY_NOCOMMON(T, name) \ -/* ctor */ \ -name::name() \ -{ \ - m_nSize = \ - m_nCount = 0; \ - m_pItems = (T *)NULL; \ -} \ - \ -/* copy ctor */ \ -name::name(const name& src) \ -{ \ - m_nSize = /* not src.m_nSize to save memory */ \ - m_nCount = src.m_nCount; \ - \ - if ( m_nSize != 0 ) { \ - m_pItems = new T[m_nSize]; \ - /* only copy if allocation succeeded */ \ - if ( m_pItems ) { \ - memcpy(m_pItems, src.m_pItems, m_nCount*sizeof(T)); \ - } \ - else { \ - m_nSize = 0; \ - } \ - } \ - else \ - m_pItems = (T *) NULL; \ -} \ - \ -/* assignment operator */ \ -name& name::operator=(const name& src) \ -{ \ - wxDELETEA(m_pItems); \ - \ - m_nSize = /* not src.m_nSize to save memory */ \ - m_nCount = src.m_nCount; \ - \ - if ( m_nSize != 0 ){ \ - m_pItems = new T[m_nSize]; \ - /* only copy if allocation succeeded */ \ - if ( m_pItems ) { \ - memcpy(m_pItems, src.m_pItems, m_nCount*sizeof(T)); \ - } \ - else { \ - m_nSize = 0; \ - } \ - } \ - else \ - m_pItems = (T *) NULL; \ - \ - return *this; \ -} \ - \ -/* allocate new buffer of the given size and move our data to it */ \ -bool name::Realloc(size_t nSize) \ -{ \ - T *pNew = new T[nSize]; \ - /* only grow if allocation succeeded */ \ - if ( !pNew ) \ - return false; \ - \ - m_nSize = nSize; \ - /* copy data to new location */ \ - memcpy(pNew, m_pItems, m_nCount*sizeof(T)); \ - delete [] m_pItems; \ - m_pItems = pNew; \ - \ - return true; \ -} \ - \ -/* grow the array */ \ -void name::Grow(size_t nIncrement) \ -{ \ - /* only do it if no more place */ \ - if( (m_nCount == m_nSize) || ((m_nSize - m_nCount) < nIncrement) ) { \ - if( m_nSize == 0 ) { \ - /* was empty, determine initial size */ \ - size_t size = WX_ARRAY_DEFAULT_INITIAL_SIZE; \ - if (size < nIncrement) size = nIncrement; \ - /* allocate some memory */ \ - m_pItems = new T[size]; \ - /* only grow if allocation succeeded */ \ - if ( m_pItems ) { \ - m_nSize = size; \ - } \ - } \ - else \ - { \ - /* add at least 50% but not too much */ \ - size_t ndefIncrement = m_nSize < WX_ARRAY_DEFAULT_INITIAL_SIZE \ - ? WX_ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1; \ - if ( ndefIncrement > ARRAY_MAXSIZE_INCREMENT ) \ - ndefIncrement = ARRAY_MAXSIZE_INCREMENT; \ - if ( nIncrement < ndefIncrement ) \ - nIncrement = ndefIncrement; \ - Realloc(m_nSize + nIncrement); \ - } \ - } \ -} \ - \ -/* make sure that the array has at least count elements */ \ -void name::SetCount(size_t count, T defval) \ -{ \ - if ( m_nSize < count ) \ - { \ - /* need to realloc memory: don't overallocate it here as if */ \ - /* SetCount() is called, it probably means that the caller */ \ - /* knows in advance how many elements there will be in the */ \ - /* array and so it won't be necessary to realloc it later */ \ - if ( !Realloc(count) ) \ - { \ - /* out of memory -- what can we do? */ \ - return; \ - } \ - } \ - \ - /* add new elements if we extend the array */ \ - while ( m_nCount < count ) \ - { \ - m_pItems[m_nCount++] = defval; \ - } \ -} \ - \ -/* dtor */ \ -name::~name() \ -{ \ - wxDELETEA(m_pItems); \ -} \ - \ -/* clears the list */ \ -void name::Clear() \ -{ \ - m_nSize = \ - m_nCount = 0; \ - \ - wxDELETEA(m_pItems); \ -} \ - \ -/* minimizes the memory usage by freeing unused memory */ \ -void name::Shrink() \ -{ \ - /* only do it if we have some memory to free */ \ - if( m_nCount < m_nSize ) { \ - /* allocates exactly as much memory as we need */ \ - T *pNew = new T[m_nCount]; \ - /* only shrink if allocation succeeded */ \ - if ( pNew ) { \ - /* copy data to new location */ \ - memcpy(pNew, m_pItems, m_nCount*sizeof(T)); \ - delete [] m_pItems; \ - m_pItems = pNew; \ - \ - /* update the size of the new block */ \ - m_nSize = m_nCount; \ - } \ - /* else: don't do anything, better keep old memory block! */ \ - } \ -} \ - \ -/* add item at the end */ \ -void name::Add(T lItem, size_t nInsert) \ -{ \ - if (nInsert == 0) \ - return; \ - Grow(nInsert); \ - for (size_t i = 0; i < nInsert; i++) \ - m_pItems[m_nCount++] = lItem; \ -} \ - \ -/* add item at the given position */ \ -void name::Insert(T lItem, size_t nIndex, size_t nInsert) \ -{ \ - wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArray::Insert") ); \ - wxCHECK_RET( m_nCount <= m_nCount + nInsert, \ - wxT("array size overflow in wxArray::Insert") ); \ - \ - if (nInsert == 0) \ - return; \ - Grow(nInsert); \ - \ - memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], \ - (m_nCount - nIndex)*sizeof(T)); \ - for (size_t i = 0; i < nInsert; i++) \ - m_pItems[nIndex + i] = lItem; \ - m_nCount += nInsert; \ -} \ - \ -/* search for a place to insert item into sorted array (binary search) */ \ -size_t name::IndexForInsert(T lItem, CMPFUNC fnCompare) const \ -{ \ - size_t i, \ - lo = 0, \ - hi = m_nCount; \ - int res; \ - \ - while ( lo < hi ) { \ - i = (lo + hi)/2; \ - \ - res = (*fnCompare)((const void *)(wxUIntPtr)lItem, \ - (const void *)(wxUIntPtr)(m_pItems[i])); \ - if ( res < 0 ) \ - hi = i; \ - else if ( res > 0 ) \ - lo = i + 1; \ - else { \ - lo = i; \ - break; \ - } \ - } \ - \ - return lo; \ -} \ - \ -/* search for an item in a sorted array (binary search) */ \ -int name::Index(T lItem, CMPFUNC fnCompare) const \ -{ \ - size_t n = IndexForInsert(lItem, fnCompare); \ - \ - return (n >= m_nCount || \ - (*fnCompare)((const void *)(wxUIntPtr)lItem, \ - ((const void *)(wxUIntPtr)m_pItems[n]))) \ - ? wxNOT_FOUND \ - : (int)n; \ -} \ - \ -/* removes item from array (by index) */ \ -void name::RemoveAt(size_t nIndex, size_t nRemove) \ -{ \ - wxCHECK_RET( nIndex < m_nCount, wxT("bad index in wxArray::RemoveAt") ); \ - wxCHECK_RET( nIndex + nRemove <= m_nCount, \ - wxT("removing too many elements in wxArray::RemoveAt") ); \ - \ - memmove(&m_pItems[nIndex], &m_pItems[nIndex + nRemove], \ - (m_nCount - nIndex - nRemove)*sizeof(T)); \ - m_nCount -= nRemove; \ -} \ - \ -/* removes item from array (by value) */ \ -void name::Remove(T lItem) \ -{ \ - int iIndex = Index(lItem); \ - \ - wxCHECK_RET( iIndex != wxNOT_FOUND, \ - wxT("removing inexistent item in wxArray::Remove") ); \ - \ - RemoveAt((size_t)iIndex); \ -} \ - \ -/* sort array elements using passed comparaison function */ \ -void name::Sort(CMPFUNC fCmp) \ -{ \ - qsort(m_pItems, m_nCount, sizeof(T), fCmp); \ -} \ - \ -void name::assign(const_iterator first, const_iterator last) \ -{ \ - clear(); \ - reserve(last - first); \ - for(; first != last; ++first) \ - push_back(*first); \ -} \ - \ -void name::assign(size_type n, const_reference v) \ -{ \ - clear(); \ - reserve(n); \ - for( size_type i = 0; i < n; ++i ) \ - push_back(v); \ -} \ - \ -void name::insert(iterator it, const_iterator first, const_iterator last) \ -{ \ - size_t nInsert = last - first, nIndex = it - begin(); \ - if (nInsert == 0) \ - return; \ - Grow(nInsert); \ - \ - memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], \ - (m_nCount - nIndex)*sizeof(T)); \ - for (size_t i = 0; i < nInsert; ++i, ++it, ++first) \ - *it = *first; \ - m_nCount += nInsert; \ -} - -#endif - -#define _WX_DEFINE_BASEARRAY(T, name) \ - _WX_DEFINE_BASEARRAY_COMMON(T, name) \ - _WX_DEFINE_BASEARRAY_NOCOMMON(T, name) - -#ifdef __INTELC__ - #pragma warning(push) - #pragma warning(disable: 1684) - #pragma warning(disable: 1572) -#endif - -_WX_DEFINE_BASEARRAY(const void *, wxBaseArrayPtrVoid) -_WX_DEFINE_BASEARRAY(char, wxBaseArrayChar) -_WX_DEFINE_BASEARRAY(short, wxBaseArrayShort) -_WX_DEFINE_BASEARRAY(int, wxBaseArrayInt) -_WX_DEFINE_BASEARRAY(long, wxBaseArrayLong) -_WX_DEFINE_BASEARRAY(size_t, wxBaseArraySizeT) -_WX_DEFINE_BASEARRAY(double, wxBaseArrayDouble) - -#ifdef __INTELC__ - #pragma warning(pop) -#endif - -#if wxUSE_STL -#include "wx/arrstr.h" - -#include "wx/beforestd.h" -#include -#include "wx/afterstd.h" - -_WX_DEFINE_BASEARRAY(wxString, wxBaseArrayStringBase) - -// some compilers (Sun CC being the only known example) distinguish between -// extern "C" functions and the functions with C++ linkage and ptr_fun and -// wxStringCompareLess can't take wxStrcmp/wxStricmp directly as arguments in -// this case, we need the wrappers below to make this work -inline int wxStrcmpCppWrapper(const wxChar *p, const wxChar *q) -{ - return wxStrcmp(p, q); -} - -inline int wxStricmpCppWrapper(const wxChar *p, const wxChar *q) -{ - return wxStricmp(p, q); -} - -int wxArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFromEnd)) const -{ - wxArrayString::const_iterator it; - - if (bCase) - { - it = std::find_if(begin(), end(), - std::not1( - std::bind2nd( - std::ptr_fun(wxStrcmpCppWrapper), sz))); - } - else // !bCase - { - it = std::find_if(begin(), end(), - std::not1( - std::bind2nd( - std::ptr_fun(wxStricmpCppWrapper), sz))); - } - - return it == end() ? wxNOT_FOUND : it - begin(); -} - -template -class wxStringCompareLess -{ -public: - wxStringCompareLess(F f) : m_f(f) { } - bool operator()(const wxChar* s1, const wxChar* s2) - { return m_f(s1, s2) < 0; } - bool operator()(const wxString& s1, const wxString& s2) - { return m_f(s1, s2) < 0; } -private: - F m_f; -}; - -template -wxStringCompareLess wxStringCompare(F f) -{ - return wxStringCompareLess(f); -} - -void wxArrayString::Sort(CompareFunction function) -{ - std::sort(begin(), end(), wxStringCompare(function)); -} - -void wxArrayString::Sort(bool reverseOrder) -{ - if (reverseOrder) - { - std::sort(begin(), end(), std::greater()); - } - else - { - std::sort(begin(), end()); - } -} - -int wxSortedArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFromEnd)) const -{ - wxSortedArrayString::const_iterator it; - wxString s(sz); - - if (bCase) - it = std::lower_bound(begin(), end(), s, - wxStringCompare(wxStrcmpCppWrapper)); - else - it = std::lower_bound(begin(), end(), s, - wxStringCompare(wxStricmpCppWrapper)); - - if (it == end()) - return wxNOT_FOUND; - - if (bCase) - { - if (wxStrcmp(it->c_str(), sz) != 0) - return wxNOT_FOUND; - } - else - { - if (wxStricmp(it->c_str(), sz) != 0) - return wxNOT_FOUND; - } - - return it - begin(); -} - -#endif diff --git a/Source/3rdParty/wx/src/common/dynlib.cpp b/Source/3rdParty/wx/src/common/dynlib.cpp deleted file mode 100644 index a2db5e3ba..000000000 --- a/Source/3rdParty/wx/src/common/dynlib.cpp +++ /dev/null @@ -1,323 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dynlib.cpp -// Purpose: Dynamic library management -// Author: Guilhem Lavaux -// Modified by: -// Created: 20/07/98 -// RCS-ID: $Id: dynlib.cpp 41807 2006-10-09 15:58:56Z VZ $ -// Copyright: (c) 1998 Guilhem Lavaux -// 2000-2005 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -//FIXME: This class isn't really common at all, it should be moved into -// platform dependent files (already done for Windows and Unix) - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DYNLIB_CLASS - -#include "wx/dynlib.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/app.h" - #include "wx/utils.h" -#endif //WX_PRECOMP - -#include "wx/filefn.h" -#include "wx/filename.h" // for SplitPath() -#include "wx/platinfo.h" - -#include "wx/arrimpl.cpp" - -#if defined(__WXMAC__) - #include "wx/mac/private.h" -#endif - -WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray) - -// ============================================================================ -// implementation -// ============================================================================ - -// --------------------------------------------------------------------------- -// wxDynamicLibrary -// --------------------------------------------------------------------------- - -#if defined(__WXPM__) || defined(__EMX__) - const wxChar *wxDynamicLibrary::ms_dllext = _T(".dll"); -#elif defined(__WXMAC__) && !defined(__DARWIN__) - const wxChar *wxDynamicLibrary::ms_dllext = wxEmptyString; -#endif - -// for MSW/Unix it is defined in platform-specific file -#if !(defined(__WXMSW__) || defined(__UNIX__)) || defined(__EMX__) - -wxDllType wxDynamicLibrary::GetProgramHandle() -{ - wxFAIL_MSG( wxT("GetProgramHandle() is not implemented under this platform")); - return 0; -} - -#endif // __WXMSW__ || __UNIX__ - - -bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) -{ - wxASSERT_MSG(m_handle == 0, _T("Library already loaded.")); - - // add the proper extension for the DLL ourselves unless told not to - wxString libname = libnameOrig; - if ( !(flags & wxDL_VERBATIM) ) - { - // and also check that the libname doesn't already have it - wxString ext; - wxFileName::SplitPath(libname, NULL, NULL, &ext); - if ( ext.empty() ) - { - libname += GetDllExt(); - } - } - - // different ways to load a shared library - // - // FIXME: should go to the platform-specific files! -#if defined(__WXMAC__) && !defined(__DARWIN__) - FSSpec myFSSpec; - Ptr myMainAddr; - Str255 myErrName; - - wxMacFilename2FSSpec( libname , &myFSSpec ); - - if( GetDiskFragment( &myFSSpec, - 0, - kCFragGoesToEOF, - "\p", - kPrivateCFragCopy, - &m_handle, - &myMainAddr, - myErrName ) != noErr ) - { - wxLogSysError( _("Failed to load shared library '%s' Error '%s'"), - libname.c_str(), - wxMacMakeStringFromPascal( myErrName ).c_str() ); - m_handle = 0; - } - -#elif defined(__WXPM__) || defined(__EMX__) - char err[256] = ""; - DosLoadModule(err, sizeof(err), (PSZ)libname.c_str(), &m_handle); -#else // this should be the only remaining branch eventually - m_handle = RawLoad(libname, flags); -#endif - - if ( m_handle == 0 ) - { -#ifdef wxHAVE_DYNLIB_ERROR - Error(); -#else - wxLogSysError(_("Failed to load shared library '%s'"), libname.c_str()); -#endif - } - - return IsLoaded(); -} - -// for MSW and Unix this is implemented in the platform-specific file -// -// TODO: move the rest to os2/dlpm.cpp and mac/dlmac.cpp! -#if (!defined(__WXMSW__) && !defined(__UNIX__)) || defined(__EMX__) - -/* static */ -void wxDynamicLibrary::Unload(wxDllType handle) -{ -#if defined(__OS2__) || defined(__EMX__) - DosFreeModule( handle ); -#elif defined(__WXMAC__) && !defined(__DARWIN__) - CloseConnection( (CFragConnectionID*) &handle ); -#else - #error "runtime shared lib support not implemented" -#endif -} - -#endif // !(__WXMSW__ || __UNIX__) - -void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const -{ - wxCHECK_MSG( IsLoaded(), NULL, - _T("Can't load symbol from unloaded library") ); - - void *symbol = 0; - - wxUnusedVar(symbol); -#if defined(__WXMAC__) && !defined(__DARWIN__) - Ptr symAddress; - CFragSymbolClass symClass; - Str255 symName; -#if TARGET_CARBON - c2pstrcpy( (StringPtr) symName, name.fn_str() ); -#else - strcpy( (char *)symName, name.fn_str() ); - c2pstr( (char *)symName ); -#endif - if( FindSymbol( m_handle, symName, &symAddress, &symClass ) == noErr ) - symbol = (void *)symAddress; -#elif defined(__WXPM__) || defined(__EMX__) - DosQueryProcAddr( m_handle, 1L, (PSZ)name.c_str(), (PFN*)symbol ); -#else - symbol = RawGetSymbol(m_handle, name); -#endif - - if ( success ) - *success = symbol != NULL; - - return symbol; -} - -void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const -{ - void *symbol = DoGetSymbol(name, success); - if ( !symbol ) - { -#ifdef wxHAVE_DYNLIB_ERROR - Error(); -#else - wxLogSysError(_("Couldn't find symbol '%s' in a dynamic library"), - name.c_str()); -#endif - } - - return symbol; -} - -// ---------------------------------------------------------------------------- -// informational methods -// ---------------------------------------------------------------------------- - -/*static*/ -wxString -wxDynamicLibrary::CanonicalizeName(const wxString& name, - wxDynamicLibraryCategory cat) -{ - wxString nameCanonic; - - // under Unix the library names usually start with "lib" prefix, add it -#if defined(__UNIX__) && !defined(__EMX__) - switch ( cat ) - { - default: - wxFAIL_MSG( _T("unknown wxDynamicLibraryCategory value") ); - // fall through - - case wxDL_MODULE: - // don't do anything for modules, their names are arbitrary - break; - - case wxDL_LIBRARY: - // library names should start with "lib" under Unix - nameCanonic = _T("lib"); - break; - } -#else // !__UNIX__ - wxUnusedVar(cat); -#endif // __UNIX__/!__UNIX__ - - nameCanonic << name << GetDllExt(); - return nameCanonic; -} - -/*static*/ -wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name, - wxPluginCategory cat) -{ - wxString suffix; - if ( cat == wxDL_PLUGIN_GUI ) - { - suffix = wxPlatformInfo::Get().GetPortIdShortName(); - } -#if wxUSE_UNICODE - suffix << _T('u'); -#endif -#ifdef __WXDEBUG__ - suffix << _T('d'); -#endif - - if ( !suffix.empty() ) - suffix = wxString(_T("_")) + suffix; - -#define WXSTRINGIZE(x) #x -#if defined(__UNIX__) && !defined(__EMX__) - #if (wxMINOR_VERSION % 2) == 0 - #define wxDLLVER(x,y,z) "-" WXSTRINGIZE(x) "." WXSTRINGIZE(y) - #else - #define wxDLLVER(x,y,z) "-" WXSTRINGIZE(x) "." WXSTRINGIZE(y) "." WXSTRINGIZE(z) - #endif -#else - #if (wxMINOR_VERSION % 2) == 0 - #define wxDLLVER(x,y,z) WXSTRINGIZE(x) WXSTRINGIZE(y) - #else - #define wxDLLVER(x,y,z) WXSTRINGIZE(x) WXSTRINGIZE(y) WXSTRINGIZE(z) - #endif -#endif - - suffix << wxString::FromAscii(wxDLLVER(wxMAJOR_VERSION, wxMINOR_VERSION, - wxRELEASE_NUMBER)); -#undef wxDLLVER -#undef WXSTRINGIZE - -#ifdef __WINDOWS__ - // Add compiler identification: - #if defined(__GNUG__) - suffix << _T("_gcc"); - #elif defined(__VISUALC__) - suffix << _T("_vc"); - #elif defined(__WATCOMC__) - suffix << _T("_wat"); - #elif defined(__BORLANDC__) - suffix << _T("_bcc"); - #endif -#endif - - return CanonicalizeName(name + suffix, wxDL_MODULE); -} - -/*static*/ -wxString wxDynamicLibrary::GetPluginsDirectory() -{ -#ifdef __UNIX__ - wxString format = wxGetInstallPrefix(); - wxString dir; - format << wxFILE_SEP_PATH - << wxT("lib") << wxFILE_SEP_PATH - << wxT("wx") << wxFILE_SEP_PATH -#if (wxMINOR_VERSION % 2) == 0 - << wxT("%i.%i"); - dir.Printf(format.c_str(), wxMAJOR_VERSION, wxMINOR_VERSION); -#else - << wxT("%i.%i.%i"); - dir.Printf(format.c_str(), - wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER); -#endif - return dir; - -#else // ! __UNIX__ - return wxEmptyString; -#endif -} - - -#endif // wxUSE_DYNLIB_CLASS diff --git a/Source/3rdParty/wx/src/common/dynload.cpp b/Source/3rdParty/wx/src/common/dynload.cpp deleted file mode 100644 index a28b9e528..000000000 --- a/Source/3rdParty/wx/src/common/dynload.cpp +++ /dev/null @@ -1,362 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dynload.cpp -// Purpose: Dynamic loading framework -// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's -// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) -// Modified by: -// Created: 03/12/01 -// RCS-ID: $Id: dynload.cpp 40943 2006-08-31 19:31:43Z ABX $ -// Copyright: (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DYNAMIC_LOADER - -#ifdef __WINDOWS__ - #include "wx/msw/private.h" -#endif - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/hash.h" - #include "wx/utils.h" - #include "wx/module.h" -#endif - -#include "wx/strconv.h" - -#include "wx/dynload.h" - - -// --------------------------------------------------------------------------- -// wxPluginLibrary -// --------------------------------------------------------------------------- - - -wxDLImports* wxPluginLibrary::ms_classes = NULL; - -class wxPluginLibraryModule : public wxModule -{ -public: - wxPluginLibraryModule() { } - - // TODO: create ms_classes on demand, why always preallocate it? - virtual bool OnInit() - { - wxPluginLibrary::ms_classes = new wxDLImports; - wxPluginManager::CreateManifest(); - return true; - } - - virtual void OnExit() - { - delete wxPluginLibrary::ms_classes; - wxPluginLibrary::ms_classes = NULL; - wxPluginManager::ClearManifest(); - } - -private: - DECLARE_DYNAMIC_CLASS(wxPluginLibraryModule ) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxPluginLibraryModule, wxModule) - - -wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) - : m_linkcount(1) - , m_objcount(0) -{ - m_before = wxClassInfo::sm_first; - Load( libname, flags ); - m_after = wxClassInfo::sm_first; - - if( m_handle != 0 ) - { - UpdateClasses(); - RegisterModules(); - } - else - { - // Flag us for deletion - --m_linkcount; - } -} - -wxPluginLibrary::~wxPluginLibrary() -{ - if( m_handle != 0 ) - { - UnregisterModules(); - RestoreClasses(); - } -} - -wxPluginLibrary *wxPluginLibrary::RefLib() -{ - wxCHECK_MSG( m_linkcount > 0, NULL, - _T("Library had been already deleted!") ); - - ++m_linkcount; - return this; -} - -bool wxPluginLibrary::UnrefLib() -{ - wxASSERT_MSG( m_objcount == 0, - _T("Library unloaded before all objects were destroyed") ); - - if ( m_linkcount == 0 || --m_linkcount == 0 ) - { - delete this; - return true; - } - - return false; -} - -// ------------------------ -// Private methods -// ------------------------ - -void wxPluginLibrary::UpdateClasses() -{ - for (wxClassInfo *info = m_after; info != m_before; info = info->m_next) - { - if( info->GetClassName() ) - { - // Hash all the class names into a local table too so - // we can quickly find the entry they correspond to. - (*ms_classes)[info->GetClassName()] = this; - } - } -} - -void wxPluginLibrary::RestoreClasses() -{ - // Check if there is a need to restore classes. - if (!ms_classes) - return; - - for(wxClassInfo *info = m_after; info != m_before; info = info->m_next) - { - ms_classes->erase(ms_classes->find(info->GetClassName())); - } -} - -void wxPluginLibrary::RegisterModules() -{ - // Plugin libraries might have wxModules, Register and initialise them if - // they do. - // - // Note that these classes are NOT included in the reference counting since - // it's implicit that they will be unloaded if and when the last handle to - // the library is. We do have to keep a copy of the module's pointer - // though, as there is currently no way to Unregister it without it. - - wxASSERT_MSG( m_linkcount == 1, - _T("RegisterModules should only be called for the first load") ); - - for ( wxClassInfo *info = m_after; info != m_before; info = info->m_next) - { - if( info->IsKindOf(CLASSINFO(wxModule)) ) - { - wxModule *m = wxDynamicCast(info->CreateObject(), wxModule); - - wxASSERT_MSG( m, _T("wxDynamicCast of wxModule failed") ); - - m_wxmodules.push_back(m); - wxModule::RegisterModule(m); - } - } - - // FIXME: Likewise this is (well was) very similar to InitializeModules() - - for ( wxModuleList::iterator it = m_wxmodules.begin(); - it != m_wxmodules.end(); - ++it) - { - if( !(*it)->Init() ) - { - wxLogDebug(_T("wxModule::Init() failed for wxPluginLibrary")); - - // XXX: Watch this, a different hash implementation might break it, - // a good hash implementation would let us fix it though. - - // The name of the game is to remove any uninitialised modules and - // let the dtor Exit the rest on shutdown, (which we'll initiate - // shortly). - - wxModuleList::iterator oldNode = m_wxmodules.end(); - do { - ++it; - if( oldNode != m_wxmodules.end() ) - m_wxmodules.erase(oldNode); - wxModule::UnregisterModule( *it ); - oldNode = it; - } while( it != m_wxmodules.end() ); - - --m_linkcount; // Flag us for deletion - break; - } - } -} - -void wxPluginLibrary::UnregisterModules() -{ - wxModuleList::iterator it; - - for ( it = m_wxmodules.begin(); it != m_wxmodules.end(); ++it ) - (*it)->Exit(); - - for ( it = m_wxmodules.begin(); it != m_wxmodules.end(); ++it ) - wxModule::UnregisterModule( *it ); - - // NB: content of the list was deleted by UnregisterModule calls above: - m_wxmodules.clear(); -} - - -// --------------------------------------------------------------------------- -// wxPluginManager -// --------------------------------------------------------------------------- - -wxDLManifest* wxPluginManager::ms_manifest = NULL; - -// ------------------------ -// Static accessors -// ------------------------ - -wxPluginLibrary * -wxPluginManager::LoadLibrary(const wxString &libname, int flags) -{ - wxString realname(libname); - - if( !(flags & wxDL_VERBATIM) ) - realname += wxDynamicLibrary::GetDllExt(); - - wxPluginLibrary *entry; - - if ( flags & wxDL_NOSHARE ) - { - entry = NULL; - } - else - { - entry = FindByName(realname); - } - - if ( entry ) - { - wxLogTrace(_T("dll"), - _T("LoadLibrary(%s): already loaded."), realname.c_str()); - - entry->RefLib(); - } - else - { - entry = new wxPluginLibrary( libname, flags ); - - if ( entry->IsLoaded() ) - { - (*ms_manifest)[realname] = entry; - - wxLogTrace(_T("dll"), - _T("LoadLibrary(%s): loaded ok."), realname.c_str()); - - } - else - { - wxLogTrace(_T("dll"), - _T("LoadLibrary(%s): failed to load."), realname.c_str()); - - // we have created entry just above - if ( !entry->UnrefLib() ) - { - // ... so UnrefLib() is supposed to delete it - wxFAIL_MSG( _T("Currently linked library is not loaded?") ); - } - - entry = NULL; - } - } - - return entry; -} - -bool wxPluginManager::UnloadLibrary(const wxString& libname) -{ - wxString realname = libname; - - wxPluginLibrary *entry = FindByName(realname); - - if ( !entry ) - { - realname += wxDynamicLibrary::GetDllExt(); - - entry = FindByName(realname); - } - - if ( !entry ) - { - wxLogDebug(_T("Attempt to unload library '%s' which is not loaded."), - libname.c_str()); - - return false; - } - - wxLogTrace(_T("dll"), _T("UnloadLibrary(%s)"), realname.c_str()); - - if ( !entry->UnrefLib() ) - { - // not really unloaded yet - return false; - } - - ms_manifest->erase(ms_manifest->find(realname)); - - return true; -} - -// ------------------------ -// Class implementation -// ------------------------ - -bool wxPluginManager::Load(const wxString &libname, int flags) -{ - m_entry = wxPluginManager::LoadLibrary(libname, flags); - - return IsLoaded(); -} - -void wxPluginManager::Unload() -{ - wxCHECK_RET( m_entry, _T("unloading an invalid wxPluginManager?") ); - - for ( wxDLManifest::iterator i = ms_manifest->begin(); - i != ms_manifest->end(); - ++i ) - { - if ( i->second == m_entry ) - { - ms_manifest->erase(i); - break; - } - } - - m_entry->UnrefLib(); - - m_entry = NULL; -} - -#endif // wxUSE_DYNAMIC_LOADER diff --git a/Source/3rdParty/wx/src/common/effects.cpp b/Source/3rdParty/wx/src/common/effects.cpp deleted file mode 100644 index dc1ab01e5..000000000 --- a/Source/3rdParty/wx/src/common/effects.cpp +++ /dev/null @@ -1,124 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/effects.cpp -// Purpose: wxEffects implementation -// Author: Julian Smart -// Modified by: -// Created: 25/4/2000 -// RCS-ID: $Id: effects.cpp 42755 2006-10-30 19:41:46Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/effects.h" - -#ifndef WX_PRECOMP - #include "wx/dcmemory.h" - #include "wx/pen.h" - #include "wx/settings.h" - #include "wx/gdicmn.h" -#endif //WX_PRECOMP - -/* - * wxEffects: various 3D effects - */ - -IMPLEMENT_CLASS(wxEffects, wxObject) - -// Assume system colours -wxEffects::wxEffects() -{ - m_highlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT) ; - m_lightShadow = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT) ; - m_faceColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) ; - m_mediumShadow = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW) ; - m_darkShadow = wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW) ; -} - -// Going from lightest to darkest -wxEffects::wxEffects(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, const wxColour& darkShadow) -{ - m_highlightColour = highlightColour; - m_lightShadow = lightShadow; - m_faceColour = faceColour; - m_mediumShadow = mediumShadow; - m_darkShadow = darkShadow; -} - -// Draw a sunken edge -void wxEffects::DrawSunkenEdge(wxDC& dc, const wxRect& rect, int WXUNUSED(borderSize)) -{ - wxPen highlightPen(m_highlightColour, 1, wxSOLID); - wxPen lightShadowPen(m_lightShadow, 1, wxSOLID); - wxPen facePen(m_faceColour, 1, wxSOLID); - wxPen mediumShadowPen(m_mediumShadow, 1, wxSOLID); - wxPen darkShadowPen(m_darkShadow, 1, wxSOLID); - - //// LEFT AND TOP - // Draw a medium shadow pen on left and top, followed by dark shadow line to - // right and below of these lines - - dc.SetPen(mediumShadowPen); - dc.DrawLine(rect.x, rect.y, rect.x+rect.width-1, rect.y); // Top - dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height-1); // Left - - dc.SetPen(darkShadowPen); - dc.DrawLine(rect.x+1, rect.y+1, rect.x+rect.width-2, rect.y+1); // Top - dc.DrawLine(rect.x+1, rect.y+1, rect.x+1, rect.y+rect.height-1); // Left - - //// RIGHT AND BOTTOM - - dc.SetPen(highlightPen); - dc.DrawLine(rect.x+rect.width-1, rect.y, rect.x+rect.width-1, rect.y+rect.height-1); // Right - dc.DrawLine(rect.x, rect.y+rect.height-1, rect.x+rect.width, rect.y+rect.height-1); // Bottom - - dc.SetPen(lightShadowPen); - dc.DrawLine(rect.x+rect.width-2, rect.y+1, rect.x+rect.width-2, rect.y+rect.height-2); // Right - dc.DrawLine(rect.x+1, rect.y+rect.height-2, rect.x+rect.width-1, rect.y+rect.height-2); // Bottom - - dc.SetPen(wxNullPen); -} - -bool wxEffects::TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap) -{ - int w = bitmap.GetWidth(); - int h = bitmap.GetHeight(); - - wxMemoryDC dcMem; - -#if wxUSE_PALETTE - static bool hiColour = (wxDisplayDepth() >= 16) ; - if (bitmap.GetPalette() && !hiColour) - { - dc.SetPalette(* bitmap.GetPalette()); - dcMem.SetPalette(* bitmap.GetPalette()); - } -#endif // wxUSE_PALETTE - - dcMem.SelectObjectAsSource(bitmap); - - int i, j; - for (i = rect.x; i < rect.x + rect.width; i += w) - { - for (j = rect.y; j < rect.y + rect.height; j+= h) - dc.Blit(i, j, bitmap.GetWidth(), bitmap.GetHeight(), & dcMem, 0, 0); - } - dcMem.SelectObject(wxNullBitmap); - -#if wxUSE_PALETTE - if (bitmap.GetPalette() && !hiColour) - { - dc.SetPalette(wxNullPalette); - dcMem.SetPalette(wxNullPalette); - } -#endif // wxUSE_PALETTE - - return true; -} diff --git a/Source/3rdParty/wx/src/common/encconv.cpp b/Source/3rdParty/wx/src/common/encconv.cpp deleted file mode 100644 index 15509c9cb..000000000 --- a/Source/3rdParty/wx/src/common/encconv.cpp +++ /dev/null @@ -1,531 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: encconv.cpp -// Purpose: wxEncodingConverter class for converting between different -// font encodings -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/encconv.h" - -#include - -// conversion tables, generated by scripts in $(WXWIN)/misc/unictabl: -#if defined( __BORLANDC__ ) || defined(__DARWIN__) - #include "../common/unictabl.inc" -#else - #include "unictabl.inc" -#endif - -#if wxUSE_WCHAR_T - typedef wchar_t tchar; -#else - typedef char tchar; -#endif - -#ifdef __WXMAC__ -#ifdef __DARWIN__ -#include -#else -#include -#include -#include -#endif - #include "wx/fontutil.h" - #include "wx/mac/private.h" // includes mac headers - - wxUint16 gMacEncodings[wxFONTENCODING_MACMAX-wxFONTENCODING_MACMIN+1][128] ; - bool gMacEncodingsInited[wxFONTENCODING_MACMAX-wxFONTENCODING_MACMIN+1] ; -#endif - -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" // for bsearch() -#endif - -static const wxUint16* GetEncTable(wxFontEncoding enc) -{ -#ifdef __WXMAC__ - if( enc >= wxFONTENCODING_MACMIN && enc <= wxFONTENCODING_MACMAX ) - { - int i = enc-wxFONTENCODING_MACMIN ; - if ( gMacEncodingsInited[i] == false ) - { - TECObjectRef converter ; - TextEncodingBase code = wxMacGetSystemEncFromFontEnc( enc ) ; - TextEncodingBase unicode = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ; - OSStatus status = TECCreateConverter(&converter,code,unicode); - char s[2] ; - s[1] = 0 ; - ByteCount byteInLen, byteOutLen ; - for( unsigned char c = 255 ; c >= 128 ; --c ) - { - s[0] = c ; - status = TECConvertText(converter, (ConstTextPtr) &s , 1, &byteInLen, - (TextPtr) &gMacEncodings[i][c-128] , 2, &byteOutLen); - } - status = TECDisposeConverter(converter); - gMacEncodingsInited[i]=true; - } - return gMacEncodings[i] ; - } -#endif - - for (int i = 0; encodings_list[i].table != NULL; i++) - { - if (encodings_list[i].encoding == enc) - return encodings_list[i].table; - } - return NULL; -} - -typedef struct { - wxUint16 u; - wxUint8 c; -} CharsetItem; - -extern "C" int wxCMPFUNC_CONV -CompareCharsetItems(const void *i1, const void *i2) -{ - return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u ); -} - - -static CharsetItem* BuildReverseTable(const wxUint16 *tbl) -{ - CharsetItem *rev = new CharsetItem[128]; - - for (int i = 0; i < 128; i++) - rev[i].c = wxUint8(128 + i), rev[i].u = tbl[i]; - - qsort(rev, 128, sizeof(CharsetItem), CompareCharsetItems); - - return rev; -} - - - -wxEncodingConverter::wxEncodingConverter() -{ - m_Table = NULL; - m_UnicodeInput = m_UnicodeOutput = false; - m_JustCopy = false; -} - - - -bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method) -{ - unsigned i; - const wxUint16 *in_tbl; - const wxUint16 *out_tbl = NULL; - - if (m_Table) {delete[] m_Table; m_Table = NULL;} - -#if !wxUSE_WCHAR_T - if (input_enc == wxFONTENCODING_UNICODE || output_enc == wxFONTENCODING_UNICODE) return false; -#endif - - if (input_enc == output_enc) {m_JustCopy = true; return true;} - - m_UnicodeOutput = (output_enc == wxFONTENCODING_UNICODE); - m_JustCopy = false; - - if (input_enc == wxFONTENCODING_UNICODE) - { - if ((out_tbl = GetEncTable(output_enc)) == NULL) return false; - - m_Table = new tchar[65536]; - for (i = 0; i < 128; i++) m_Table[i] = (tchar)i; // 7bit ASCII - for (i = 128; i < 65536; i++) m_Table[i] = (tchar)0; - - if (method == wxCONVERT_SUBSTITUTE) - { - for (i = 0; i < encoding_unicode_fallback_count; i++) - m_Table[encoding_unicode_fallback[i].c] = (tchar) encoding_unicode_fallback[i].s; - } - - for (i = 0; i < 128; i++) - m_Table[out_tbl[i]] = (tchar)(128 + i); - - m_UnicodeInput = true; - } - else // input !Unicode - { - if ((in_tbl = GetEncTable(input_enc)) == NULL) return false; - if (output_enc != wxFONTENCODING_UNICODE) - if ((out_tbl = GetEncTable(output_enc)) == NULL) return false; - - m_UnicodeInput = false; - - m_Table = new tchar[256]; - for (i = 0; i < 128; i++) m_Table[i] = (tchar)i; // 7bit ASCII - - if (output_enc == wxFONTENCODING_UNICODE) - { - for (i = 0; i < 128; i++) m_Table[128 + i] = (tchar)in_tbl[i]; - return true; - } - else // output !Unicode - { - CharsetItem *rev = BuildReverseTable(out_tbl); - CharsetItem *item; - CharsetItem key; - - for (i = 0; i < 128; i++) - { - key.u = in_tbl[i]; - item = (CharsetItem*) bsearch(&key, rev, 128, sizeof(CharsetItem), CompareCharsetItems); - if (item == NULL && method == wxCONVERT_SUBSTITUTE) - item = (CharsetItem*) bsearch(&key, encoding_unicode_fallback, - encoding_unicode_fallback_count, sizeof(CharsetItem), CompareCharsetItems); - if (item) - m_Table[128 + i] = (tchar)item -> c; - else -#if wxUSE_WCHAR_T - m_Table[128 + i] = (wchar_t)(128 + i); -#else - m_Table[128 + i] = (char)(128 + i); -#endif - } - - delete[] rev; - } - } - - return true; -} - - -#define REPLACEMENT_CHAR ((tchar)'?') - -inline tchar GetTableValue(const tchar *table, tchar value, bool& repl) -{ - tchar r = table[value]; - if (r == 0 && value != 0) - { - r = REPLACEMENT_CHAR; - repl = true; - } - return r; -} - - -bool wxEncodingConverter::Convert(const char* input, char* output) const -{ - wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!")); - wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!")); - - const char *i; - char *o; - - if (m_JustCopy) - { - strcpy(output, input); - return true; - } - - wxCHECK_MSG(m_Table != NULL, false, - wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - bool replaced = false; - - for (i = input, o = output; *i != 0;) - *(o++) = (char)(GetTableValue(m_Table, (wxUint8)*(i++), replaced)); - *o = 0; - - return !replaced; -} - - -#if wxUSE_WCHAR_T - -bool wxEncodingConverter::Convert(const char* input, wchar_t* output) const -{ - wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!")); - wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!")); - - const char *i; - wchar_t *o; - - if (m_JustCopy) - { - for (i = input, o = output; *i != 0;) - *(o++) = (wchar_t)(*(i++)); - *o = 0; - return true; - } - - wxCHECK_MSG(m_Table != NULL, false, - wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - bool replaced = false; - - for (i = input, o = output; *i != 0;) - *(o++) = (wchar_t)(GetTableValue(m_Table, (wxUint8)*(i++), replaced)); - *o = 0; - - return !replaced; -} - - - -bool wxEncodingConverter::Convert(const wchar_t* input, char* output) const -{ - wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!")); - wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!")); - - const wchar_t *i; - char *o; - - if (m_JustCopy) - { - for (i = input, o = output; *i != 0;) - *(o++) = (char)(*(i++)); - *o = 0; - return true; - } - - wxCHECK_MSG(m_Table != NULL, false, - wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - bool replaced = false; - - for (i = input, o = output; *i != 0;) - *(o++) = (char)(GetTableValue(m_Table, (wxUint16)*(i++), replaced)); - *o = 0; - - return !replaced; -} - - - -bool wxEncodingConverter::Convert(const wchar_t* input, wchar_t* output) const -{ - wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!")); - wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!")); - - const wchar_t *i; - wchar_t *o; - - if (m_JustCopy) - { - // wcscpy() is not guaranteed to exist - for (i = input, o = output; *i != 0;) - *(o++) = (*(i++)); - *o = 0; - return true; - } - - wxCHECK_MSG(m_Table != NULL, false, - wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - bool replaced = false; - - for (i = input, o = output; *i != 0;) - *(o++) = (wchar_t)(GetTableValue(m_Table, (wxUint8)*(i++), replaced)); - *o = 0; - - return !replaced; -} - -#endif // wxUSE_WCHAR_T - - -wxString wxEncodingConverter::Convert(const wxString& input) const -{ - if (m_JustCopy) return input; - - wxString s; - const wxChar *i; - - wxCHECK_MSG(m_Table != NULL, s, - wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - if (m_UnicodeInput) - { - for (i = input.c_str(); *i != 0; i++) - s << (wxChar)(m_Table[(wxUint16)*i]); - } - else - { - for (i = input.c_str(); *i != 0; i++) - s << (wxChar)(m_Table[(wxUint8)*i]); - } - - return s; -} - - - - - - - -// Following tables describe classes of encoding equivalence. -// - -#define STOP wxFONTENCODING_SYSTEM - -#define NUM_OF_PLATFORMS 4 /*must conform to enum wxPLATFORM_XXXX !!!*/ -#define ENC_PER_PLATFORM 3 - // max no. of encodings for one language used on one platform. - // Using maximum of everything at the current moment to not make the - // library larger than necessary. Make larger only if necessary - MR - -static const wxFontEncoding - EquivalentEncodings[][NUM_OF_PLATFORMS][ENC_PER_PLATFORM+1] = { - - // *** Please put more common encodings as first! *** - - // Western European - { - /* unix */ {wxFONTENCODING_ISO8859_1, wxFONTENCODING_ISO8859_15, STOP}, - /* windows */ {wxFONTENCODING_CP1252, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACROMAN, STOP} - }, - - // Central European - { - /* unix */ {wxFONTENCODING_ISO8859_2, STOP}, - /* windows */ {wxFONTENCODING_CP1250, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACCENTRALEUR, STOP} - }, - - // Baltic - { - /* unix */ {wxFONTENCODING_ISO8859_13, wxFONTENCODING_ISO8859_4, STOP}, - /* windows */ {wxFONTENCODING_CP1257, STOP}, - /* os2 */ {STOP}, - /* mac */ {STOP} - }, - - // Hebrew - { - /* unix */ {wxFONTENCODING_ISO8859_8, STOP}, - /* windows */ {wxFONTENCODING_CP1255, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACHEBREW, STOP} - }, - - // Greek - { - /* unix */ {wxFONTENCODING_ISO8859_7, STOP}, - /* windows */ {wxFONTENCODING_CP1253, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACGREEK, STOP} - }, - - // Arabic - { - /* unix */ {wxFONTENCODING_ISO8859_6, STOP}, - /* windows */ {wxFONTENCODING_CP1256, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACARABIC, STOP} - }, - - // Turkish - { - /* unix */ {wxFONTENCODING_ISO8859_9, STOP}, - /* windows */ {wxFONTENCODING_CP1254, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACTURKISH, STOP} - }, - - // Cyrillic - { - /* unix */ {wxFONTENCODING_KOI8, wxFONTENCODING_KOI8_U, wxFONTENCODING_ISO8859_5, STOP}, - /* windows */ {wxFONTENCODING_CP1251, STOP}, - /* os2 */ {STOP}, - /* mac */ {wxFONTENCODING_MACCYRILLIC, STOP} - }, - - {{STOP},{STOP},{STOP},{STOP}} /* Terminator */ - /* no, _not_ Arnold! */ -}; - - -static bool FindEncoding(const wxFontEncodingArray& arr, wxFontEncoding f) -{ - for (wxFontEncodingArray::const_iterator it = arr.begin(), en = arr.end(); - it != en; ++it) - if (*it == f) - return true; - return false; -} - -wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding enc, int platform) -{ - if (platform == wxPLATFORM_CURRENT) - { -#if defined(__WXMSW__) - platform = wxPLATFORM_WINDOWS; -#elif defined(__WXGTK__) || defined(__WXMOTIF__) - platform = wxPLATFORM_UNIX; -#elif defined(__WXPM__) - platform = wxPLATFORM_OS2; -#elif defined(__WXMAC__) - platform = wxPLATFORM_MAC; -#endif - } - - int i, clas, e ; - const wxFontEncoding *f; - wxFontEncodingArray arr; - - clas = 0; - while (EquivalentEncodings[clas][0][0] != STOP) - { - for (i = 0; i < NUM_OF_PLATFORMS; i++) - for (e = 0; EquivalentEncodings[clas][i][e] != STOP; e++) - if (EquivalentEncodings[clas][i][e] == enc) - { - for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++) - if (*f == enc) arr.push_back(enc); - for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++) - if (!FindEncoding(arr, *f)) arr.push_back(*f); - i = NUM_OF_PLATFORMS/*hack*/; break; - } - clas++; - } - - return arr; -} - - - -wxFontEncodingArray wxEncodingConverter::GetAllEquivalents(wxFontEncoding enc) -{ - int i, clas, e, j ; - const wxFontEncoding *f; - wxFontEncodingArray arr; - - arr = GetPlatformEquivalents(enc); // we want them to be first items in array - - clas = 0; - while (EquivalentEncodings[clas][0][0] != STOP) - { - for (i = 0; i < NUM_OF_PLATFORMS; i++) - for (e = 0; EquivalentEncodings[clas][i][e] != STOP; e++) - if (EquivalentEncodings[clas][i][e] == enc) - { - for (j = 0; j < NUM_OF_PLATFORMS; j++) - for (f = EquivalentEncodings[clas][j]; *f != STOP; f++) - if (!FindEncoding(arr, *f)) arr.push_back(*f); - i = NUM_OF_PLATFORMS/*hack*/; break; - } - clas++; - } - - return arr; -} - diff --git a/Source/3rdParty/wx/src/common/event.cpp b/Source/3rdParty/wx/src/common/event.cpp deleted file mode 100644 index 934456c80..000000000 --- a/Source/3rdParty/wx/src/common/event.cpp +++ /dev/null @@ -1,1499 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/event.cpp -// Purpose: Event classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: event.cpp 61982 2009-09-20 21:48:50Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/event.h" - -#ifndef WX_PRECOMP - #include "wx/list.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/stopwatch.h" - #include "wx/module.h" - - #if wxUSE_GUI - #include "wx/window.h" - #include "wx/control.h" - #include "wx/dc.h" - #include "wx/textctrl.h" - #include "wx/validate.h" - #endif // wxUSE_GUI -#endif - -#if wxUSE_BASE - #include "wx/ptr_scpd.h" - - wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr) - wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr) -#endif // wxUSE_BASE - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -#if wxUSE_BASE - IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) - IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) -#endif // wxUSE_BASE - -#if wxUSE_GUI - IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxDisplayChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent, wxCommandEvent) -#endif // wxUSE_GUI - -#if wxUSE_BASE - -const wxEventTable *wxEvtHandler::GetEventTable() const - { return &wxEvtHandler::sm_eventTable; } - -const wxEventTable wxEvtHandler::sm_eventTable = - { (const wxEventTable *)NULL, &wxEvtHandler::sm_eventTableEntries[0] }; - -wxEventHashTable &wxEvtHandler::GetEventHashTable() const - { return wxEvtHandler::sm_eventHashTable; } - -wxEventHashTable wxEvtHandler::sm_eventHashTable(wxEvtHandler::sm_eventTable); - -const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = - { DECLARE_EVENT_TABLE_ENTRY(wxEVT_NULL, 0, 0, (wxObjectEventFunction)NULL, NULL) }; - - -#ifdef __WXDEBUG__ -// Clear up event hash table contents or we can get problems -// when C++ is cleaning up the static object -class wxEventTableEntryModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxEventTableEntryModule) -public: - wxEventTableEntryModule() {} - bool OnInit() - { - wxEventHashTable::ReconstructAll(); - return true; - } - void OnExit() - { - wxEventHashTable::ClearAll(); - } -}; -IMPLEMENT_DYNAMIC_CLASS(wxEventTableEntryModule, wxModule) -#endif - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// To put pending event handlers -wxList *wxPendingEvents = (wxList *)NULL; - -#if wxUSE_THREADS - // protects wxPendingEvents list - wxCriticalSection *wxPendingEventsLocker = (wxCriticalSection *)NULL; -#endif - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - -// common event types are defined here, other event types are defined by the -// components which use them - -const wxEventType wxEVT_FIRST = 10000; -const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000; - -DEFINE_EVENT_TYPE(wxEVT_NULL) -DEFINE_EVENT_TYPE(wxEVT_IDLE) -DEFINE_EVENT_TYPE(wxEVT_SOCKET) - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -#endif // wxUSE_BASE - -#if wxUSE_GUI - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED) - -// Sockets and timers send events, too -DEFINE_EVENT_TYPE(wxEVT_TIMER) - -// Mouse event types -DEFINE_EVENT_TYPE(wxEVT_LEFT_DOWN) -DEFINE_EVENT_TYPE(wxEVT_LEFT_UP) -DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DOWN) -DEFINE_EVENT_TYPE(wxEVT_MIDDLE_UP) -DEFINE_EVENT_TYPE(wxEVT_RIGHT_DOWN) -DEFINE_EVENT_TYPE(wxEVT_RIGHT_UP) -DEFINE_EVENT_TYPE(wxEVT_MOTION) -DEFINE_EVENT_TYPE(wxEVT_ENTER_WINDOW) -DEFINE_EVENT_TYPE(wxEVT_LEAVE_WINDOW) -DEFINE_EVENT_TYPE(wxEVT_LEFT_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS) -DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS) -DEFINE_EVENT_TYPE(wxEVT_CHILD_FOCUS) -DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL) - -// Non-client mouse events -DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN) -DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_UP) -DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN) -DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP) -DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN) -DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_UP) -DEFINE_EVENT_TYPE(wxEVT_NC_MOTION) -DEFINE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW) -DEFINE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW) -DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK) - -// Character input event type -DEFINE_EVENT_TYPE(wxEVT_CHAR) -DEFINE_EVENT_TYPE(wxEVT_CHAR_HOOK) -DEFINE_EVENT_TYPE(wxEVT_NAVIGATION_KEY) -DEFINE_EVENT_TYPE(wxEVT_KEY_DOWN) -DEFINE_EVENT_TYPE(wxEVT_KEY_UP) -#if wxUSE_HOTKEY -DEFINE_EVENT_TYPE(wxEVT_HOTKEY) -#endif - -// Set cursor event -DEFINE_EVENT_TYPE(wxEVT_SET_CURSOR) - -// wxScrollbar and wxSlider event identifiers -DEFINE_EVENT_TYPE(wxEVT_SCROLL_TOP) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEUP) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE) -DEFINE_EVENT_TYPE(wxEVT_SCROLL_CHANGED) - -// Scroll events from wxWindow -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK) -DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE) - -// System events -DEFINE_EVENT_TYPE(wxEVT_SIZE) -DEFINE_EVENT_TYPE(wxEVT_SIZING) -DEFINE_EVENT_TYPE(wxEVT_MOVE) -DEFINE_EVENT_TYPE(wxEVT_MOVING) -DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW) -DEFINE_EVENT_TYPE(wxEVT_END_SESSION) -DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION) -DEFINE_EVENT_TYPE(wxEVT_HIBERNATE) -DEFINE_EVENT_TYPE(wxEVT_ACTIVATE_APP) -DEFINE_EVENT_TYPE(wxEVT_POWER) -DEFINE_EVENT_TYPE(wxEVT_ACTIVATE) -DEFINE_EVENT_TYPE(wxEVT_CREATE) -DEFINE_EVENT_TYPE(wxEVT_DESTROY) -DEFINE_EVENT_TYPE(wxEVT_SHOW) -DEFINE_EVENT_TYPE(wxEVT_ICONIZE) -DEFINE_EVENT_TYPE(wxEVT_MAXIMIZE) -DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST) -DEFINE_EVENT_TYPE(wxEVT_PAINT) -DEFINE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND) -DEFINE_EVENT_TYPE(wxEVT_NC_PAINT) -DEFINE_EVENT_TYPE(wxEVT_PAINT_ICON) -DEFINE_EVENT_TYPE(wxEVT_MENU_OPEN) -DEFINE_EVENT_TYPE(wxEVT_MENU_CLOSE) -DEFINE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT) -DEFINE_EVENT_TYPE(wxEVT_CONTEXT_MENU) -DEFINE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_SETTING_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE) -DEFINE_EVENT_TYPE(wxEVT_PALETTE_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN) -DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP) -DEFINE_EVENT_TYPE(wxEVT_JOY_MOVE) -DEFINE_EVENT_TYPE(wxEVT_JOY_ZMOVE) -DEFINE_EVENT_TYPE(wxEVT_DROP_FILES) -DEFINE_EVENT_TYPE(wxEVT_DRAW_ITEM) -DEFINE_EVENT_TYPE(wxEVT_MEASURE_ITEM) -DEFINE_EVENT_TYPE(wxEVT_COMPARE_ITEM) -DEFINE_EVENT_TYPE(wxEVT_INIT_DIALOG) -DEFINE_EVENT_TYPE(wxEVT_UPDATE_UI) - -// Clipboard events -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE) - -// Generic command events -// Note: a click is a higher-level event than button down/up -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_ENTER) - -// Help events -DEFINE_EVENT_TYPE(wxEVT_HELP) -DEFINE_EVENT_TYPE(wxEVT_DETAILED_HELP) - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -#endif // wxUSE_GUI - -#if wxUSE_BASE - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// event initialization -// ---------------------------------------------------------------------------- - -int wxNewEventType() -{ - // MT-FIXME - static int s_lastUsedEventType = wxEVT_FIRST; - - return s_lastUsedEventType++; -} - -// ---------------------------------------------------------------------------- -// wxEvent -// ---------------------------------------------------------------------------- - -/* - * General wxWidgets events, covering - * all interesting things that might happen (button clicking, resizing, - * setting text in widgets, etc.). - * - * For each completely new event type, derive a new event class. - * - */ - -wxEvent::wxEvent(int theId, wxEventType commandType ) -{ - m_eventType = commandType; - m_eventObject = (wxObject *) NULL; - m_timeStamp = 0; - m_id = theId; - m_skipped = false; - m_callbackUserData = (wxObject *) NULL; - m_isCommandEvent = false; - m_propagationLevel = wxEVENT_PROPAGATE_NONE; -} - -wxEvent::wxEvent(const wxEvent &src) - : wxObject(src) - , m_eventObject(src.m_eventObject) - , m_eventType(src.m_eventType) - , m_timeStamp(src.m_timeStamp) - , m_id(src.m_id) - , m_callbackUserData(src.m_callbackUserData) - , m_propagationLevel(src.m_propagationLevel) - , m_skipped(src.m_skipped) - , m_isCommandEvent(src.m_isCommandEvent) -{ -} - -#endif // wxUSE_BASE - -#if wxUSE_GUI - -/* - * Command events - * - */ - -#ifdef __VISUALC__ - // 'this' : used in base member initializer list (for m_commandString) - #pragma warning(disable:4355) -#endif - -wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) - : wxEvent(theId, commandType) -#if WXWIN_COMPATIBILITY_2_4 - , m_commandString(this) -#endif -{ - m_clientData = (char *) NULL; - m_clientObject = (wxClientData *) NULL; - m_extraLong = 0; - m_commandInt = 0; - m_isCommandEvent = true; - - // the command events are propagated upwards by default - m_propagationLevel = wxEVENT_PROPAGATE_MAX; -} - -#ifdef __VISUALC__ - #pragma warning(default:4355) -#endif - -wxString wxCommandEvent::GetString() const -{ - if(m_eventType != wxEVT_COMMAND_TEXT_UPDATED || !m_eventObject) - return m_cmdString; - else - { -#if wxUSE_TEXTCTRL - wxTextCtrl *txt = wxDynamicCast(m_eventObject, wxTextCtrl); - if(txt) - return txt->GetValue(); - else -#endif // wxUSE_TEXTCTRL - return m_cmdString; - } -} - -/* - * UI update events - */ - -#if wxUSE_LONGLONG -wxLongLong wxUpdateUIEvent::sm_lastUpdate = 0; -#endif - -long wxUpdateUIEvent::sm_updateInterval = 0; - -wxUpdateUIMode wxUpdateUIEvent::sm_updateMode = wxUPDATE_UI_PROCESS_ALL; - -// Can we update? -bool wxUpdateUIEvent::CanUpdate(wxWindowBase *win) -{ - // Don't update if we've switched global updating off - // and this window doesn't support updates. - if (win && - (GetMode() == wxUPDATE_UI_PROCESS_SPECIFIED && - ((win->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES) == 0))) - return false; - - if (sm_updateInterval == -1) - return false; - - if (sm_updateInterval == 0) - return true; - -#if wxUSE_STOPWATCH && wxUSE_LONGLONG - wxLongLong now = wxGetLocalTimeMillis(); - if (now > (sm_lastUpdate + sm_updateInterval)) - { - return true; - } - - return false; -#else - // If we don't have wxStopWatch or wxLongLong, we - // should err on the safe side and update now anyway. - return true; -#endif -} - -// Reset the update time to provide a delay until the next -// time we should update -void wxUpdateUIEvent::ResetUpdateTime() -{ -#if wxUSE_STOPWATCH && wxUSE_LONGLONG - if (sm_updateInterval > 0) - { - wxLongLong now = wxGetLocalTimeMillis(); - if (now > (sm_lastUpdate + sm_updateInterval)) - { - sm_lastUpdate = now; - } - } -#endif -} - -/* - * Idle events - */ - -wxIdleMode wxIdleEvent::sm_idleMode = wxIDLE_PROCESS_ALL; - -// Can we send an idle event? -bool wxIdleEvent::CanSend(wxWindow* win) -{ - // Don't update if we've switched global updating off - // and this window doesn't support updates. - if (win && - (GetMode() == wxIDLE_PROCESS_SPECIFIED && - ((win->GetExtraStyle() & wxWS_EX_PROCESS_IDLE) == 0))) - return false; - - return true; -} - -/* - * Scroll events - */ - -wxScrollEvent::wxScrollEvent(wxEventType commandType, - int id, - int pos, - int orient) - : wxCommandEvent(commandType, id) -{ - m_extraLong = orient; - m_commandInt = pos; -} - -/* - * ScrollWin events - */ - -wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType, - int pos, - int orient) -{ - m_eventType = commandType; - m_extraLong = orient; - m_commandInt = pos; -} - -/* - * Mouse events - * - */ - -wxMouseEvent::wxMouseEvent(wxEventType commandType) -{ - m_eventType = commandType; - m_metaDown = false; - m_altDown = false; - m_controlDown = false; - m_shiftDown = false; - m_leftDown = false; - m_rightDown = false; - m_middleDown = false; - m_x = 0; - m_y = 0; - m_wheelRotation = 0; - m_wheelDelta = 0; - m_linesPerAction = 0; -} - -void wxMouseEvent::Assign(const wxMouseEvent& event) -{ - m_eventType = event.m_eventType; - - m_x = event.m_x; - m_y = event.m_y; - - m_leftDown = event.m_leftDown; - m_middleDown = event.m_middleDown; - m_rightDown = event.m_rightDown; - - m_controlDown = event.m_controlDown; - m_shiftDown = event.m_shiftDown; - m_altDown = event.m_altDown; - m_metaDown = event.m_metaDown; - - m_wheelRotation = event.m_wheelRotation; - m_wheelDelta = event.m_wheelDelta; - m_linesPerAction = event.m_linesPerAction; -} - -// return true if was a button dclick event -bool wxMouseEvent::ButtonDClick(int but) const -{ - switch (but) - { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick")); - // fall through - - case wxMOUSE_BTN_ANY: - return (LeftDClick() || MiddleDClick() || RightDClick()); - - case wxMOUSE_BTN_LEFT: - return LeftDClick(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleDClick(); - - case wxMOUSE_BTN_RIGHT: - return RightDClick(); - } -} - -// return true if was a button down event -bool wxMouseEvent::ButtonDown(int but) const -{ - switch (but) - { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown")); - // fall through - - case wxMOUSE_BTN_ANY: - return (LeftDown() || MiddleDown() || RightDown()); - - case wxMOUSE_BTN_LEFT: - return LeftDown(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleDown(); - - case wxMOUSE_BTN_RIGHT: - return RightDown(); - } -} - -// return true if was a button up event -bool wxMouseEvent::ButtonUp(int but) const -{ - switch (but) - { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp")); - // fall through - - case wxMOUSE_BTN_ANY: - return (LeftUp() || MiddleUp() || RightUp()); - - case wxMOUSE_BTN_LEFT: - return LeftUp(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleUp(); - - case wxMOUSE_BTN_RIGHT: - return RightUp(); - } -} - -// return true if the given button is currently changing state -bool wxMouseEvent::Button(int but) const -{ - switch (but) - { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button")); - // fall through - - case wxMOUSE_BTN_ANY: - return ButtonUp(wxMOUSE_BTN_ANY) || - ButtonDown(wxMOUSE_BTN_ANY) || - ButtonDClick(wxMOUSE_BTN_ANY); - - case wxMOUSE_BTN_LEFT: - return LeftDown() || LeftUp() || LeftDClick(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleDown() || MiddleUp() || MiddleDClick(); - - case wxMOUSE_BTN_RIGHT: - return RightDown() || RightUp() || RightDClick(); - } -} - -bool wxMouseEvent::ButtonIsDown(int but) const -{ - switch (but) - { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown")); - // fall through - - case wxMOUSE_BTN_ANY: - return LeftIsDown() || MiddleIsDown() || RightIsDown(); - - case wxMOUSE_BTN_LEFT: - return LeftIsDown(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleIsDown(); - - case wxMOUSE_BTN_RIGHT: - return RightIsDown(); - } -} - -int wxMouseEvent::GetButton() const -{ - for ( int i = 1; i <= 3; i++ ) - { - if ( Button(i) ) - { - return i; - } - } - - return wxMOUSE_BTN_NONE; -} - -// Find the logical position of the event given the DC -wxPoint wxMouseEvent::GetLogicalPosition(const wxDC& dc) const -{ - wxPoint pt(dc.DeviceToLogicalX(m_x), dc.DeviceToLogicalY(m_y)); - return pt; -} - - -/* - * Keyboard event - * - */ - -wxKeyEvent::wxKeyEvent(wxEventType type) -{ - m_eventType = type; - m_shiftDown = false; - m_controlDown = false; - m_metaDown = false; - m_altDown = false; - m_keyCode = 0; - m_scanCode = 0; -#if wxUSE_UNICODE - m_uniChar = 0; -#endif -} - -wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt) - : wxEvent(evt) -{ - m_x = evt.m_x; - m_y = evt.m_y; - - m_keyCode = evt.m_keyCode; - - m_controlDown = evt.m_controlDown; - m_shiftDown = evt.m_shiftDown; - m_altDown = evt.m_altDown; - m_metaDown = evt.m_metaDown; - m_scanCode = evt.m_scanCode; - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; - -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif -} - -#if WXWIN_COMPATIBILITY_2_6 -long wxKeyEvent::KeyCode() const -{ - return m_keyCode; -} -#endif // WXWIN_COMPATIBILITY_2_6 - -wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win) -{ - SetEventType(wxEVT_CREATE); - SetEventObject(win); -} - -wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win) -{ - SetEventType(wxEVT_DESTROY); - SetEventObject(win); -} - -wxChildFocusEvent::wxChildFocusEvent(wxWindow *win) - : wxCommandEvent(wxEVT_CHILD_FOCUS) -{ - SetEventObject(win); -} - -// ---------------------------------------------------------------------------- -// wxHelpEvent -// ---------------------------------------------------------------------------- - -/* static */ -wxHelpEvent::Origin wxHelpEvent::GuessOrigin(Origin origin) -{ - if ( origin == Origin_Unknown ) - { - // assume that the event comes from the help button if it's not from - // keyboard and that pressing F1 always results in the help event - origin = wxGetKeyState(WXK_F1) ? Origin_Keyboard : Origin_HelpButton; - } - - return origin; -} - -#endif // wxUSE_GUI - - -#if wxUSE_BASE - -// ---------------------------------------------------------------------------- -// wxEventHashTable -// ---------------------------------------------------------------------------- - -static const int EVENT_TYPE_TABLE_INIT_SIZE = 31; // Not too big not too small... - -wxEventHashTable* wxEventHashTable::sm_first = NULL; - -wxEventHashTable::wxEventHashTable(const wxEventTable &table) - : m_table(table), - m_rebuildHash(true) -{ - AllocEventTypeTable(EVENT_TYPE_TABLE_INIT_SIZE); - - m_next = sm_first; - if (m_next) - m_next->m_previous = this; - sm_first = this; -} - -wxEventHashTable::~wxEventHashTable() -{ - if (m_next) - m_next->m_previous = m_previous; - if (m_previous) - m_previous->m_next = m_next; - if (sm_first == this) - sm_first = m_next; - - Clear(); -} - -void wxEventHashTable::Clear() -{ - size_t i; - for(i = 0; i < m_size; i++) - { - EventTypeTablePointer eTTnode = m_eventTypeTable[i]; - if (eTTnode) - { - delete eTTnode; - } - } - - // Necessary in order to not invoke the - // overloaded delete operator when statics are cleaned up - if (m_eventTypeTable) - delete[] m_eventTypeTable; - - m_eventTypeTable = NULL; - m_size = 0; -} - -// Clear all tables -void wxEventHashTable::ClearAll() -{ - wxEventHashTable* table = sm_first; - while (table) - { - table->Clear(); - table = table->m_next; - } -} - -// Rebuild all tables if they were cleared by ClearAll -void wxEventHashTable::ReconstructAll() -{ - wxEventHashTable* table = sm_first; - while (table) - { - // This will only be true if the event table was cleared. - // What we do here is basically what the constructor does. - if(table->m_eventTypeTable == NULL) - { - table->AllocEventTypeTable(EVENT_TYPE_TABLE_INIT_SIZE); - table->m_rebuildHash = true; - } - table = table->m_next; - } -} - -bool wxEventHashTable::HandleEvent(wxEvent &event, wxEvtHandler *self) -{ - if (m_rebuildHash) - { - InitHashTable(); - m_rebuildHash = false; - } - - if (!m_eventTypeTable) - return false; - - // Find all entries for the given event type. - wxEventType eventType = event.GetEventType(); - const EventTypeTablePointer eTTnode = m_eventTypeTable[eventType % m_size]; - if (eTTnode && eTTnode->eventType == eventType) - { - // Now start the search for an event handler - // that can handle an event with the given ID. - const wxEventTableEntryPointerArray& - eventEntryTable = eTTnode->eventEntryTable; - - const size_t count = eventEntryTable.GetCount(); - for (size_t n = 0; n < count; n++) - { - if ( wxEvtHandler:: - ProcessEventIfMatches(*eventEntryTable[n], self, event) ) - { - return true; - } - } - } - - return false; -} - -void wxEventHashTable::InitHashTable() -{ - // Loop over the event tables and all its base tables. - const wxEventTable *table = &m_table; - while (table) - { - // Retrieve all valid event handler entries - const wxEventTableEntry *entry = table->entries; - while (entry->m_fn != 0) - { - // Add the event entry in the Hash. - AddEntry(*entry); - - entry++; - } - - table = table->baseTable; - } - - // Lets free some memory. - size_t i; - for(i = 0; i < m_size; i++) - { - EventTypeTablePointer eTTnode = m_eventTypeTable[i]; - if (eTTnode) - { - eTTnode->eventEntryTable.Shrink(); - } - } -} - -void wxEventHashTable::AddEntry(const wxEventTableEntry &entry) -{ - // This might happen 'accidentally' as the app is exiting - if (!m_eventTypeTable) - return; - - EventTypeTablePointer *peTTnode = &m_eventTypeTable[entry.m_eventType % m_size]; - EventTypeTablePointer eTTnode = *peTTnode; - - if (eTTnode) - { - if (eTTnode->eventType != entry.m_eventType) - { - // Resize the table! - GrowEventTypeTable(); - // Try again to add it. - AddEntry(entry); - return; - } - } - else - { - eTTnode = new EventTypeTable; - eTTnode->eventType = entry.m_eventType; - *peTTnode = eTTnode; - } - - // Fill all hash entries between entry.m_id and entry.m_lastId... - eTTnode->eventEntryTable.Add(&entry); -} - -void wxEventHashTable::AllocEventTypeTable(size_t size) -{ - m_eventTypeTable = new EventTypeTablePointer[size]; - memset((void *)m_eventTypeTable, 0, sizeof(EventTypeTablePointer)*size); - m_size = size; -} - -void wxEventHashTable::GrowEventTypeTable() -{ - size_t oldSize = m_size; - EventTypeTablePointer *oldEventTypeTable = m_eventTypeTable; - - // TODO: Search the most optimal grow sequence - AllocEventTypeTable(/* GetNextPrime(oldSize) */oldSize*2+1); - - for ( size_t i = 0; i < oldSize; /* */ ) - { - EventTypeTablePointer eTToldNode = oldEventTypeTable[i]; - if (eTToldNode) - { - EventTypeTablePointer *peTTnode = &m_eventTypeTable[eTToldNode->eventType % m_size]; - EventTypeTablePointer eTTnode = *peTTnode; - - // Check for collision, we don't want any. - if (eTTnode) - { - GrowEventTypeTable(); - continue; // Don't increment the counter, - // as we still need to add this element. - } - else - { - // Get the old value and put it in the new table. - *peTTnode = oldEventTypeTable[i]; - } - } - - i++; - } - - delete[] oldEventTypeTable; -} - - -// ---------------------------------------------------------------------------- -// wxEvtHandler -// ---------------------------------------------------------------------------- - -/* - * Event handler - */ - -wxEvtHandler::wxEvtHandler() -{ - m_nextHandler = (wxEvtHandler *) NULL; - m_previousHandler = (wxEvtHandler *) NULL; - m_enabled = true; - m_dynamicEvents = (wxList *) NULL; - m_pendingEvents = (wxList *) NULL; -#if wxUSE_THREADS -# if !defined(__VISAGECPP__) - m_eventsLocker = new wxCriticalSection; -# endif -#endif - - // no client data (yet) - m_clientData = NULL; - m_clientDataType = wxClientData_None; -} - -wxEvtHandler::~wxEvtHandler() -{ - // Takes itself out of the list of handlers - if (m_previousHandler) - m_previousHandler->m_nextHandler = m_nextHandler; - - if (m_nextHandler) - m_nextHandler->m_previousHandler = m_previousHandler; - - if (m_dynamicEvents) - { - for ( wxList::iterator it = m_dynamicEvents->begin(), - end = m_dynamicEvents->end(); - it != end; - ++it ) - { -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)*it; -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)*it; -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - if (entry->m_callbackUserData) - delete entry->m_callbackUserData; - delete entry; - } - delete m_dynamicEvents; - }; - - if (m_pendingEvents) - m_pendingEvents->DeleteContents(true); - delete m_pendingEvents; - -#if wxUSE_THREADS -# if !defined(__VISAGECPP__) - delete m_eventsLocker; -# endif - - // Remove us from wxPendingEvents if necessary. - if(wxPendingEventsLocker) - wxENTER_CRIT_SECT(*wxPendingEventsLocker); -#endif // wxUSE_THREADS - - if ( wxPendingEvents ) - { - // Delete all occurences of this from the list of pending events - while (wxPendingEvents->DeleteObject(this)) { } // Do nothing - } - -#if wxUSE_THREADS - if(wxPendingEventsLocker) - wxLEAVE_CRIT_SECT(*wxPendingEventsLocker); -#endif // wxUSE_THREADS - - // we only delete object data, not untyped - if ( m_clientDataType == wxClientData_Object ) - delete m_clientObject; -} - -#if wxUSE_THREADS - -bool wxEvtHandler::ProcessThreadEvent(wxEvent& event) -{ - // check that we are really in a child thread - wxASSERT_MSG( !wxThread::IsMain(), - wxT("use ProcessEvent() in main thread") ); - - AddPendingEvent(event); - - return true; -} - -void wxEvtHandler::ClearEventLocker() -{ -#if !defined(__VISAGECPP__) - delete m_eventsLocker; - m_eventsLocker = NULL; -#endif -} - -#endif // wxUSE_THREADS - -void wxEvtHandler::AddPendingEvent(wxEvent& event) -{ - // 1) Add event to list of pending events of this event handler - - wxEvent *eventCopy = event.Clone(); - - // we must be able to copy the events here so the event class must - // implement Clone() properly instead of just providing a NULL stab for it - wxCHECK_RET( eventCopy, - _T("events of this type aren't supposed to be posted") ); - - wxENTER_CRIT_SECT( Lock() ); - - if ( !m_pendingEvents ) - m_pendingEvents = new wxList; - - m_pendingEvents->Append(eventCopy); - - // 2) Add this event handler to list of event handlers that - // have pending events. - - wxENTER_CRIT_SECT(*wxPendingEventsLocker); - - if ( !wxPendingEvents ) - wxPendingEvents = new wxList; - wxPendingEvents->Append(this); - - wxLEAVE_CRIT_SECT(*wxPendingEventsLocker); - - wxLEAVE_CRIT_SECT( Lock() ); - - // 3) Inform the system that new pending events are somewhere, - // and that these should be processed in idle time. - wxWakeUpIdle(); -} - -void wxEvtHandler::ProcessPendingEvents() -{ - // this method is only called by wxApp if this handler does have - // pending events - wxCHECK_RET( m_pendingEvents, - wxT("Please call wxApp::ProcessPendingEvents() instead") ); - - wxENTER_CRIT_SECT( Lock() ); - - // we leave the loop once we have processed all events that were present at - // the start of ProcessPendingEvents because otherwise we could get into - // infinite loop if the pending event handler execution resulted in another - // event being posted - size_t n = m_pendingEvents->size(); - for ( wxList::compatibility_iterator node = m_pendingEvents->GetFirst(); - node; - node = m_pendingEvents->GetFirst() ) - { - { - wxEventPtr event(wx_static_cast(wxEvent *, node->GetData())); - - // It's important we remove event from list before processing it. - // Else a nested event loop, for example from a modal dialog, might - // process the same event again. - - m_pendingEvents->Erase(node); - - wxLEAVE_CRIT_SECT( Lock() ); - - ProcessEvent(*event); - } // delete the event at this block exit, before re-locking our - // critical section, to avoid deadlocks if the event dtor locks - // something else itself (see #10790) - - wxENTER_CRIT_SECT( Lock() ); - - if ( --n == 0 ) - break; - } - - wxLEAVE_CRIT_SECT( Lock() ); -} - -/* - * Event table stuff - */ -/* static */ bool -wxEvtHandler::ProcessEventIfMatches(const wxEventTableEntryBase& entry, - wxEvtHandler *handler, - wxEvent& event) -{ - int tableId1 = entry.m_id, - tableId2 = entry.m_lastId; - - // match only if the event type is the same and the id is either -1 in - // the event table (meaning "any") or the event id matches the id - // specified in the event table either exactly or by falling into - // range between first and last - if ((tableId1 == wxID_ANY) || - (tableId2 == wxID_ANY && tableId1 == event.GetId()) || - (tableId2 != wxID_ANY && - (event.GetId() >= tableId1 && event.GetId() <= tableId2))) - { - event.Skip(false); - event.m_callbackUserData = entry.m_callbackUserData; - -#if wxUSE_EXCEPTIONS - if ( wxTheApp ) - { - // call the handler via wxApp method which allows the user to catch - // any exceptions which may be thrown by any handler in the program - // in one place - wxTheApp->HandleEvent(handler, (wxEventFunction)entry.m_fn, event); - } - else -#endif // wxUSE_EXCEPTIONS - { - // no need for an extra virtual function call - (handler->*((wxEventFunction) (entry.m_fn)))(event); - } - - if (!event.GetSkipped()) - return true; - } - - return false; -} - -bool wxEvtHandler::TryParent(wxEvent& event) -{ - if ( wxTheApp && (this != wxTheApp) ) - { - // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always - // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be - // processed appropriately via SearchEventTable. - if ( event.GetEventType() != wxEVT_IDLE ) - { - if ( wxTheApp->ProcessEvent(event) ) - return true; - } - } - - return false; -} - -bool wxEvtHandler::ProcessEvent(wxEvent& event) -{ - // allow the application to hook into event processing - if ( wxTheApp ) - { - int rc = wxTheApp->FilterEvent(event); - if ( rc != -1 ) - { - wxASSERT_MSG( rc == 1 || rc == 0, - _T("unexpected wxApp::FilterEvent return value") ); - - return rc != 0; - } - //else: proceed normally - } - - // An event handler can be enabled or disabled - if ( GetEvtHandlerEnabled() ) - { - // if we have a validator, it has higher priority than our own event - // table - if ( TryValidator(event) ) - return true; - - // Handle per-instance dynamic event tables first - if ( m_dynamicEvents && SearchDynamicEventTable(event) ) - return true; - - // Then static per-class event tables - if ( GetEventHashTable().HandleEvent(event, this) ) - return true; - } - - // Try going down the event handler chain - if ( GetNextHandler() ) - { - if ( GetNextHandler()->ProcessEvent(event) ) - return true; - } - - // Finally propagate the event upwards the window chain and/or to the - // application object as necessary - return TryParent(event); -} - - -bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event) -{ - const wxEventType eventType = event.GetEventType(); - for ( int i = 0; table.entries[i].m_fn != 0; i++ ) - { - const wxEventTableEntry& entry = table.entries[i]; - if ( eventType == entry.m_eventType ) - { - if ( ProcessEventIfMatches(entry, this, event) ) - return true; - } - } - - return false; -} - -void wxEvtHandler::Connect( int id, int lastId, - int eventType, - wxObjectEventFunction func, - wxObject *userData, - wxEvtHandler* eventSink ) -{ -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = new wxEventTableEntry; - entry->m_eventType = eventType; - entry->m_id = id; - entry->m_lastId = lastId; - entry->m_fn = func; - entry->m_callbackUserData = userData; -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = - new wxDynamicEventTableEntry(eventType, id, lastId, func, userData, eventSink); -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - if (!m_dynamicEvents) - m_dynamicEvents = new wxList; - - // Insert at the front of the list so most recent additions are found first - m_dynamicEvents->Insert( (wxObject*) entry ); -} - -bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType, - wxObjectEventFunction func, - wxObject *userData, - wxEvtHandler* eventSink ) -{ - if (!m_dynamicEvents) - return false; - - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(); - while (node) - { -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)node->GetData(); -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - if ((entry->m_id == id) && - ((entry->m_lastId == lastId) || (lastId == wxID_ANY)) && - ((entry->m_eventType == eventType) || (eventType == wxEVT_NULL)) && - ((entry->m_fn == func) || (func == (wxObjectEventFunction)NULL)) && - ((entry->m_eventSink == eventSink) || (eventSink == (wxEvtHandler*)NULL)) && - ((entry->m_callbackUserData == userData) || (userData == (wxObject*)NULL))) - { - if (entry->m_callbackUserData) - delete entry->m_callbackUserData; - m_dynamicEvents->Erase( node ); - delete entry; - return true; - } - node = node->GetNext(); - } - return false; -} - -bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) -{ - wxCHECK_MSG( m_dynamicEvents, false, - wxT("caller should check that we have dynamic events") ); - - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(); - while (node) - { -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)node->GetData(); -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - // get next node before (maybe) calling the event handler as it could - // call Disconnect() invalidating the current node - node = node->GetNext(); - - if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0)) - { - wxEvtHandler *handler = -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - entry->m_eventSink ? entry->m_eventSink - : -#endif - this; - - if ( ProcessEventIfMatches(*entry, handler, event) ) - { - return true; - } - } - } - - return false; -} - -void wxEvtHandler::DoSetClientObject( wxClientData *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("can't have both object and void client data") ); - - if ( m_clientObject ) - delete m_clientObject; - - m_clientObject = data; - m_clientDataType = wxClientData_Object; -} - -wxClientData *wxEvtHandler::DoGetClientObject() const -{ - // it's not an error to call GetClientObject() on a window which doesn't - // have client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("this window doesn't have object client data") ); - - return m_clientObject; -} - -void wxEvtHandler::DoSetClientData( void *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("can't have both object and void client data") ); - - m_clientData = data; - m_clientDataType = wxClientData_Void; -} - -void *wxEvtHandler::DoGetClientData() const -{ - // it's not an error to call GetClientData() on a window which doesn't have - // client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("this window doesn't have void client data") ); - - return m_clientData; -} - -#endif // wxUSE_BASE - -#if wxUSE_GUI - -// Find a window with the focus, that is also a descendant of the given window. -// This is used to determine the window to initially send commands to. -wxWindow* wxFindFocusDescendant(wxWindow* ancestor) -{ - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxWindow::FindFocus(); - wxWindow* win = focusWin; - - // Check if this is a descendant of this frame. - // If not, win will be set to NULL. - while (win) - { - if (win == ancestor) - break; - else - win = win->GetParent(); - } - if (win == (wxWindow*) NULL) - focusWin = (wxWindow*) NULL; - - return focusWin; -} - -#endif // wxUSE_GUI diff --git a/Source/3rdParty/wx/src/common/evtloopcmn.cpp b/Source/3rdParty/wx/src/common/evtloopcmn.cpp deleted file mode 100644 index 00bc1001b..000000000 --- a/Source/3rdParty/wx/src/common/evtloopcmn.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/evtloopcmn.cpp -// Purpose: common wxEventLoop-related stuff -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-01-12 -// RCS-ID: $Id: evtloopcmn.cpp 45938 2007-05-10 02:07:41Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/evtloop.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" -#endif //WX_PRECOMP - -// see the comment near the declaration of wxRunningEventLoopCount in -// src/msw/thread.cpp for the explanation of this hack -#if defined(__WXMSW__) && wxUSE_THREADS - -extern WXDLLIMPEXP_DATA_BASE(int) wxRunningEventLoopCount; -struct wxRunningEventLoopCounter -{ - wxRunningEventLoopCounter() { wxRunningEventLoopCount++; } - ~wxRunningEventLoopCounter() { wxRunningEventLoopCount--; } -}; - -#endif // __WXMSW__ - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; - -// wxEventLoopManual is unused in the other ports -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) - -// ============================================================================ -// wxEventLoopManual implementation -// ============================================================================ - -wxEventLoopManual::wxEventLoopManual() -{ - m_exitcode = 0; - m_shouldExit = false; -} - -int wxEventLoopManual::Run() -{ - // event loops are not recursive, you need to create another loop! - wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); - - // ProcessIdle() and Dispatch() below may throw so the code here should - // be exception-safe, hence we must use local objects for all actions we - // should undo - wxEventLoopActivator activate(wx_static_cast(wxEventLoop *, this)); - -#if defined(__WXMSW__) && wxUSE_THREADS - wxRunningEventLoopCounter evtLoopCounter; -#endif // __WXMSW__ - - // we must ensure that OnExit() is called even if an exception is thrown - // from inside Dispatch() but we must call it from Exit() in normal - // situations because it is supposed to be called synchronously, - // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or - // something similar here) -#if wxUSE_EXCEPTIONS - for ( ;; ) - { - try - { -#endif // wxUSE_EXCEPTIONS - - // this is the event loop itself - for ( ;; ) - { - // give them the possibility to do whatever they want - OnNextIteration(); - - // generate and process idle events for as long as we don't - // have anything else to do - while ( !Pending() && (wxTheApp && wxTheApp->ProcessIdle()) ) - ; - - // if the "should exit" flag is set, the loop should terminate - // but not before processing any remaining messages so while - // Pending() returns true, do process them - if ( m_shouldExit ) - { - while ( Pending() ) - Dispatch(); - - break; - } - - // a message came or no more idle processing to do, sit in - // Dispatch() waiting for the next message - if ( !Dispatch() ) - { - // we got WM_QUIT - break; - } - } - -#if wxUSE_EXCEPTIONS - // exit the outer loop as well - break; - } - catch ( ... ) - { - try - { - if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() ) - { - OnExit(); - break; - } - //else: continue running the event loop - } - catch ( ... ) - { - // OnException() throwed, possibly rethrowing the same - // exception again: very good, but we still need OnExit() to - // be called - OnExit(); - throw; - } - } - } -#endif // wxUSE_EXCEPTIONS - - return m_exitcode; -} - -void wxEventLoopManual::Exit(int rc) -{ - wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") ); - - m_exitcode = rc; - m_shouldExit = true; - - OnExit(); - - // all we have to do to exit from the loop is to (maybe) wake it up so that - // it can notice that Exit() had been called - // - // in particular, do *not* use here calls such as PostQuitMessage() (under - // MSW) which terminate the current event loop here because we're not sure - // that it is going to be processed by the correct event loop: it would be - // possible that another one is started and terminated by mistake if we do - // this - WakeUp(); -} - -#endif // __WXMSW__ || __WXMAC__ || __WXDFB__ diff --git a/Source/3rdParty/wx/src/common/execcmn.cpp b/Source/3rdParty/wx/src/common/execcmn.cpp deleted file mode 100644 index 2b2025270..000000000 --- a/Source/3rdParty/wx/src/common/execcmn.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/wxexec.cpp -// Purpose: defines wxStreamTempInputBuffer which is used by Unix and MSW -// implementations of wxExecute; this file is only used by the -// library and never by the user code -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.08.02 -// RCS-ID: $Id: execcmn.cpp 35289 2005-08-23 23:12:48Z VZ $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXEXEC_CPP_ -#define _WX_WXEXEC_CPP_ - -// this file should never be compiled directly, just included by other code -#ifndef _WX_USED_BY_WXEXECUTE_ - #error "You should never directly build this file!" -#endif - -// ---------------------------------------------------------------------------- -// wxStreamTempInputBuffer -// ---------------------------------------------------------------------------- - -/* - wxStreamTempInputBuffer is a hack which we need to solve the problem of - executing a child process synchronously with IO redirecting: when we do - this, the child writes to a pipe we open to it but when the pipe buffer - (which has finite capacity, e.g. commonly just 4Kb) becomes full we have to - read data from it because the child blocks in its write() until then and if - it blocks we are never going to return from wxExecute() so we dead lock. - - So here is the fix: we now read the output as soon as it appears into a temp - buffer (wxStreamTempInputBuffer object) and later just stuff it back into - the stream when the process terminates. See supporting code in wxExecute() - itself as well. - - Note that this is horribly inefficient for large amounts of output (count - the number of times we copy the data around) and so a better API is badly - needed! However it's not easy to devise a way to do this keeping backwards - compatibility with the existing wxExecute(wxEXEC_SYNC)... -*/ - -class wxStreamTempInputBuffer -{ -public: - wxStreamTempInputBuffer(); - - // call to associate a stream with this buffer, otherwise nothing happens - // at all - void Init(wxPipeInputStream *stream); - - // check for input on our stream and cache it in our buffer if any - void Update(); - - ~wxStreamTempInputBuffer(); - -private: - // the stream we're buffering, if NULL we don't do anything at all - wxPipeInputStream *m_stream; - - // the buffer of size m_size (NULL if m_size == 0) - void *m_buffer; - - // the size of the buffer - size_t m_size; - - DECLARE_NO_COPY_CLASS(wxStreamTempInputBuffer) -}; - -inline wxStreamTempInputBuffer::wxStreamTempInputBuffer() -{ - m_stream = NULL; - m_buffer = NULL; - m_size = 0; -} - -inline void wxStreamTempInputBuffer::Init(wxPipeInputStream *stream) -{ - m_stream = stream; -} - -inline -void wxStreamTempInputBuffer::Update() -{ - if ( m_stream && m_stream->CanRead() ) - { - // realloc in blocks of 4Kb: this is the default (and minimal) buffer - // size of the Unix pipes so it should be the optimal step - // - // NB: don't use "static int" in this inline function, some compilers - // (e.g. IBM xlC) don't like it - enum { incSize = 4096 }; - - void *buf = realloc(m_buffer, m_size + incSize); - if ( !buf ) - { - // don't read any more, we don't have enough memory to do it - m_stream = NULL; - } - else // got memory for the buffer - { - m_buffer = buf; - m_stream->Read((char *)m_buffer + m_size, incSize); - m_size += m_stream->LastRead(); - } - } -} - -inline -wxStreamTempInputBuffer::~wxStreamTempInputBuffer() -{ - if ( m_buffer ) - { - m_stream->Ungetch(m_buffer, m_size); - free(m_buffer); - } -} - -#endif // _WX_WXEXEC_CPP_ - diff --git a/Source/3rdParty/wx/src/common/extended.c b/Source/3rdParty/wx/src/common/extended.c deleted file mode 100644 index 2f9df1b30..000000000 --- a/Source/3rdParty/wx/src/common/extended.c +++ /dev/null @@ -1,196 +0,0 @@ -/***************************************************************************** -** Name: extended.c -** Purpose: IEEE Extended<->Double routines to save floats to file -** Maintainer: Ryan Norton -** Modified by: -** Created: 11/24/04 -** RCS-ID: $Id: extended.c 36952 2006-01-18 10:25:04Z JS $ -*****************************************************************************/ - - -#if defined(_WIN32_WCE) - /* eVC cause warnings in its own headers: stdlib.h and winnt.h */ - #pragma warning (disable:4115) - #pragma warning (disable:4214) -#endif - -#include -#include -#include -#include -#include -#include "wx/defs.h" - -#if defined(_WIN32_WCE) - #pragma warning (default:4115) - #pragma warning (default:4214) -#endif - -#if wxUSE_APPLE_IEEE - -#include "wx/math.h" - -/* Copyright (C) 1989-1991 Ken Turkowski. - * - * All rights reserved. - * - * Warranty Information - * Even though I have reviewed this software, I make no warranty - * or representation, either express or implied, with respect to this - * software, its quality, accuracy, merchantability, or fitness for a - * particular purpose. As a result, this software is provided "as is," - * and you, its user, are assuming the entire risk as to its quality - * and accuracy. - * - * This code may be used and freely distributed as long as it includes - * this copyright notice and the above warranty information. - * - * Machine-independent I/O routines for IEEE floating-point numbers. - * - * NaN's and infinities are converted to HUGE_VAL or HUGE, which - * happens to be infinity on IEEE machines. Unfortunately, it is - * impossible to preserve NaN's in a machine-independent way. - * Infinities are, however, preserved on IEEE machines. - * - * These routines have been tested on the following machines: - * Apple Macintosh, MPW 3.1 C compiler - * Apple Macintosh, THINK C compiler - * Silicon Graphics IRIS, MIPS compiler - * Cray X/MP and Y/MP - * Digital Equipment VAX - * Sequent Balance (Multiprocesor 386) - * NeXT - * - * - * Implemented by Malcolm Slaney and Ken Turkowski. - * - * Malcolm Slaney contributions during 1988-1990 include big- and little- - * endian file I/O, conversion to and from Motorola's extended 80-bit - * floating-point format, and conversions to and from IEEE single- - * precision floating-point format. - * - * In 1991, Ken Turkowski implemented the conversions to and from - * IEEE double-precision format, added more precision to the extended - * conversions, and accommodated conversions involving +/- infinity, - * NaN's, and denormalized numbers. - */ - -#ifndef HUGE_VAL -# define HUGE_VAL HUGE -#endif /*HUGE_VAL*/ - - -/**************************************************************** - * The following two routines make up for deficiencies in many - * compilers to convert properly between unsigned integers and - * floating-point. Some compilers which have this bug are the - * THINK_C compiler for the Macintosh and the C compiler for the - * Silicon Graphics MIPS-based Iris. - ****************************************************************/ - -#ifdef applec /* The Apple C compiler works */ -# define FloatToUnsigned(f) ((wxUint32)(f)) -# define UnsignedToFloat(u) ((wxFloat64)(u)) -#else /*applec*/ -# define FloatToUnsigned(f) ((wxUint32)(((wxInt32)((f) - 2147483648.0)) + 2147483647L) + 1) -# define UnsignedToFloat(u) (((wxFloat64)((wxInt32)((u) - 2147483647L - 1))) + 2147483648.0) -#endif /*applec*/ - - - -/**************************************************************** - * Extended precision IEEE floating-point conversion routines. - * Extended is an 80-bit number as defined by Motorola, - * with a sign bit, 15 bits of exponent (offset 16383?), - * and a 64-bit mantissa, with no hidden bit. - ****************************************************************/ - -wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes) -{ - wxFloat64 f; - wxInt32 expon; - wxUint32 hiMant, loMant; - - expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF); - hiMant = ((wxUint32)(bytes[2] & 0xFF) << 24) - | ((wxUint32)(bytes[3] & 0xFF) << 16) - | ((wxUint32)(bytes[4] & 0xFF) << 8) - | ((wxUint32)(bytes[5] & 0xFF)); - loMant = ((wxUint32)(bytes[6] & 0xFF) << 24) - | ((wxUint32)(bytes[7] & 0xFF) << 16) - | ((wxUint32)(bytes[8] & 0xFF) << 8) - | ((wxUint32)(bytes[9] & 0xFF)); - - if (expon == 0 && hiMant == 0 && loMant == 0) { - f = 0; - } - else { - if (expon == 0x7FFF) { /* Infinity or NaN */ - f = HUGE_VAL; - } - else { - expon -= 16383; - f = ldexp(UnsignedToFloat(hiMant), expon-=31); - f += ldexp(UnsignedToFloat(loMant), expon-=32); - } - } - - if (bytes[0] & 0x80) - return -f; - else - return f; -} - - -/****************************************************************/ - - -void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes) -{ - wxInt32 sign; - wxInt32 expon; - wxFloat64 fMant, fsMant; - wxUint32 hiMant, loMant; - - if (num < 0) { - sign = 0x8000; - num *= -1; - } else { - sign = 0; - } - - if (num == 0) { - expon = 0; hiMant = 0; loMant = 0; - } - else { - fMant = frexp(num, &expon); - if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */ - expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */ - } - else { /* Finite */ - expon += 16382; - if (expon < 0) { /* denormalized */ - fMant = ldexp(fMant, expon); - expon = 0; - } - expon |= sign; - fMant = ldexp(fMant, 32); fsMant = floor(fMant); hiMant = FloatToUnsigned(fsMant); - fMant = ldexp(fMant - fsMant, 32); fsMant = floor(fMant); loMant = FloatToUnsigned(fsMant); - } - } - - bytes[0] = expon >> 8; - bytes[1] = expon; - bytes[2] = hiMant >> 24; - bytes[3] = hiMant >> 16; - bytes[4] = hiMant >> 8; - bytes[5] = hiMant; - bytes[6] = loMant >> 24; - bytes[7] = loMant >> 16; - bytes[8] = loMant >> 8; - bytes[9] = loMant; -} - - - -#endif /* wxUSE_APPLE_IEEE */ diff --git a/Source/3rdParty/wx/src/common/fddlgcmn.cpp b/Source/3rdParty/wx/src/common/fddlgcmn.cpp deleted file mode 100644 index 64d9f91cc..000000000 --- a/Source/3rdParty/wx/src/common/fddlgcmn.cpp +++ /dev/null @@ -1,102 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fdrepdlg.cpp -// Purpose: common parts of wxFindReplaceDialog implementations -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.08.01 -// RCS-ID: -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FINDREPLDLG - -#ifndef WX_PRECOMP -#endif - -#include "wx/fdrepdlg.h" - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent) - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE) - -// ============================================================================ -// implementations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxFindReplaceData -// ---------------------------------------------------------------------------- - -void wxFindReplaceData::Init() -{ - m_Flags = 0; -} - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialogBase -// ---------------------------------------------------------------------------- - -wxFindReplaceDialogBase::~wxFindReplaceDialogBase() -{ -} - -void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event) -{ - // we copy the data to dialog->GetData() as well - - m_FindReplaceData->m_Flags = event.GetFlags(); - m_FindReplaceData->m_FindWhat = event.GetFindString(); - if ( HasFlag(wxFR_REPLACEDIALOG) && - (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE || - event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) ) - { - m_FindReplaceData->m_ReplaceWith = event.GetReplaceString(); - } - - // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed - if ( event.GetEventType() == wxEVT_COMMAND_FIND_NEXT ) - { - if ( m_FindReplaceData->m_FindWhat != m_lastSearch ) - { - event.SetEventType(wxEVT_COMMAND_FIND); - - m_lastSearch = m_FindReplaceData->m_FindWhat; - } - } - - if ( !GetEventHandler()->ProcessEvent(event) ) - { - // the event is not propagated upwards to the parent automatically - // because the dialog is a top level window, so do it manually as - // in 9 cases of 10 the message must be processed by the dialog - // owner and not the dialog itself - (void)GetParent()->GetEventHandler()->ProcessEvent(event); - } -} - -#endif // wxUSE_FINDREPLDLG - diff --git a/Source/3rdParty/wx/src/common/ffile.cpp b/Source/3rdParty/wx/src/common/ffile.cpp deleted file mode 100644 index 92bc8ede9..000000000 --- a/Source/3rdParty/wx/src/common/ffile.cpp +++ /dev/null @@ -1,256 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ffile.cpp -// Purpose: wxFFile encapsulates "FILE *" IO stream -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.07.99 -// RCS-ID: $Id: ffile.cpp 63300 2010-01-28 21:36:09Z MW $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FFILE - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#ifdef __WINDOWS__ -#include "wx/msw/mslu.h" -#endif - -#include "wx/ffile.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// opening the file -// ---------------------------------------------------------------------------- - -wxFFile::wxFFile(const wxChar *filename, const wxChar *mode) -{ - Detach(); - - (void)Open(filename, mode); -} - -bool wxFFile::Open(const wxChar *filename, const wxChar *mode) -{ - wxASSERT_MSG( !m_fp, wxT("should close or detach the old file first") ); - - m_fp = wxFopen(filename, mode); - - if ( !m_fp ) - { - wxLogSysError(_("can't open file '%s'"), filename); - - return false; - } - - m_name = filename; - - return true; -} - -bool wxFFile::Close() -{ - if ( IsOpened() ) - { - if ( fclose(m_fp) != 0 ) - { - wxLogSysError(_("can't close file '%s'"), m_name.c_str()); - - return false; - } - - Detach(); - } - - return true; -} - -// ---------------------------------------------------------------------------- -// read/write -// ---------------------------------------------------------------------------- - -bool wxFFile::ReadAll(wxString *str, const wxMBConv& conv) -{ - wxCHECK_MSG( str, false, wxT("invalid parameter") ); - wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") ); - wxCHECK_MSG( Length() >= 0, false, wxT("invalid length") ); - size_t length = wx_truncate_cast(size_t, Length()); - wxCHECK_MSG( (wxFileOffset)length == Length(), false, wxT("huge file not supported") ); - - clearerr(m_fp); - - wxCharBuffer buf(length + 1); - - // note that real length may be less than file length for text files with DOS EOLs - // ('\r's get dropped by CRT when reading which means that we have - // realLen = fileLen - numOfLinesInTheFile) - length = fread(buf.data(), sizeof(char), length, m_fp); - - if ( Error() ) - { - wxLogSysError(_("Read error on file '%s'"), m_name.c_str()); - - return false; - } - - buf.data()[length] = 0; - *str = wxString(buf, conv); - - return true; -} - -size_t wxFFile::Read(void *pBuf, size_t nCount) -{ - wxCHECK_MSG( pBuf, 0, wxT("invalid parameter") ); - wxCHECK_MSG( IsOpened(), 0, wxT("can't read from closed file") ); - - size_t nRead = fread(pBuf, 1, nCount, m_fp); - if ( (nRead < nCount) && Error() ) - { - wxLogSysError(_("Read error on file '%s'"), m_name.c_str()); - } - - return nRead; -} - -size_t wxFFile::Write(const void *pBuf, size_t nCount) -{ - wxCHECK_MSG( pBuf, 0, wxT("invalid parameter") ); - wxCHECK_MSG( IsOpened(), 0, wxT("can't write to closed file") ); - - size_t nWritten = fwrite(pBuf, 1, nCount, m_fp); - if ( nWritten < nCount ) - { - wxLogSysError(_("Write error on file '%s'"), m_name.c_str()); - } - - return nWritten; -} - -bool wxFFile::Flush() -{ - if ( IsOpened() ) - { - // fflush returns non-zero on error - // - if ( fflush(m_fp) ) - { - wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str()); - - return false; - } - } - - return true; -} - -// ---------------------------------------------------------------------------- -// seeking -// ---------------------------------------------------------------------------- - -bool wxFFile::Seek(wxFileOffset ofs, wxSeekMode mode) -{ - wxCHECK_MSG( IsOpened(), false, wxT("can't seek on closed file") ); - - int origin; - switch ( mode ) - { - default: - wxFAIL_MSG(wxT("unknown seek mode")); - // still fall through - - case wxFromStart: - origin = SEEK_SET; - break; - - case wxFromCurrent: - origin = SEEK_CUR; - break; - - case wxFromEnd: - origin = SEEK_END; - break; - } - -#ifndef wxHAS_LARGE_FFILES - if ((long)ofs != ofs) - { - wxLogError(_("Seek error on file '%s' (large files not supported by stdio)"), m_name.c_str()); - - return false; - } - - if ( wxFseek(m_fp, (long)ofs, origin) != 0 ) -#else - if ( wxFseek(m_fp, ofs, origin) != 0 ) -#endif - { - wxLogSysError(_("Seek error on file '%s'"), m_name.c_str()); - - return false; - } - - return true; -} - -wxFileOffset wxFFile::Tell() const -{ - wxCHECK_MSG( IsOpened(), wxInvalidOffset, - _T("wxFFile::Tell(): file is closed!") ); - - wxFileOffset rc = wxFtell(m_fp); - if ( rc == wxInvalidOffset ) - { - wxLogSysError(_("Can't find current position in file '%s'"), - m_name.c_str()); - } - - return rc; -} - -wxFileOffset wxFFile::Length() const -{ - wxCHECK_MSG( IsOpened(), wxInvalidOffset, - _T("wxFFile::Length(): file is closed!") ); - - wxFFile& self = *(wxFFile *)this; // const_cast - - wxFileOffset posOld = Tell(); - if ( posOld != wxInvalidOffset ) - { - if ( self.SeekEnd() ) - { - wxFileOffset len = Tell(); - - (void)self.Seek(posOld); - - return len; - } - } - - return wxInvalidOffset; -} - -#endif // wxUSE_FFILE diff --git a/Source/3rdParty/wx/src/common/file.cpp b/Source/3rdParty/wx/src/common/file.cpp deleted file mode 100644 index 26f0ce80d..000000000 --- a/Source/3rdParty/wx/src/common/file.cpp +++ /dev/null @@ -1,559 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: file.cpp -// Purpose: wxFile - encapsulates low-level "file descriptor" -// wxTempFile -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: file.cpp 42876 2006-10-31 23:29:02Z SN $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILE - -// standard -#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - -#ifndef __SALFORDC__ - #define WIN32_LEAN_AND_MEAN - #define NOSERVICE - #define NOIME - #define NOATOM - #define NOGDI - #define NOGDICAPMASKS - #define NOMETAFILE - #define NOMINMAX - #define NOMSG - #define NOOPENFILE - #define NORASTEROPS - #define NOSCROLL - #define NOSOUND - #define NOSYSMETRICS - #define NOTEXTMETRIC - #define NOWH - #define NOCOMM - #define NOKANJI - #define NOCRYPT - #define NOMCX -#endif - -#elif defined(__WXMSW__) && defined(__WXWINCE__) - #include "wx/msw/missing.h" -#elif (defined(__OS2__)) - #include -#elif (defined(__UNIX__) || defined(__GNUWIN32__)) - #include - #include - #include - #ifdef __GNUWIN32__ - #include "wx/msw/wrapwin.h" - #endif -#elif defined(__DOS__) - #if defined(__WATCOMC__) - #include - #elif defined(__DJGPP__) - #include - #include - #include - #else - #error "Please specify the header with file functions declarations." - #endif -#elif (defined(__WXSTUBS__)) - // Have to ifdef this for different environments - #include -#elif (defined(__WXMAC__)) -#if __MSL__ < 0x6000 - int access( const char *path, int mode ) { return 0 ; } -#else - int _access( const char *path, int mode ) { return 0 ; } -#endif - char* mktemp( char * path ) { return path ;} - #include - #include -#else - #error "Please specify the header with file functions declarations." -#endif //Win/UNIX - -#include // SEEK_xxx constants - -// Windows compilers don't have these constants -#ifndef W_OK - enum - { - F_OK = 0, // test for existence - X_OK = 1, // execute permission - W_OK = 2, // write - R_OK = 4 // read - }; -#endif // W_OK - -#ifdef __SALFORDC__ - #include -#endif - -// some broken compilers don't have 3rd argument in open() and creat() -#ifdef __SALFORDC__ - #define ACCESS(access) - #define stat _stat -#else // normal compiler - #define ACCESS(access) , (access) -#endif // Salford C - -// wxWidgets -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" -#endif // !WX_PRECOMP - -#include "wx/filename.h" -#include "wx/file.h" -#include "wx/filefn.h" - -// there is no distinction between text and binary files under Unix, so define -// O_BINARY as 0 if the system headers don't do it already -#if defined(__UNIX__) && !defined(O_BINARY) - #define O_BINARY (0) -#endif //__UNIX__ - -#ifdef __WXMSW__ - #include "wx/msw/mslu.h" -#endif - -#ifdef __WXWINCE__ - #include "wx/msw/private.h" -#endif - -#ifndef MAX_PATH - #define MAX_PATH 512 -#endif - -// ============================================================================ -// implementation of wxFile -// ============================================================================ - -// ---------------------------------------------------------------------------- -// static functions -// ---------------------------------------------------------------------------- - -bool wxFile::Exists(const wxChar *name) -{ - return wxFileExists(name); -} - -bool wxFile::Access(const wxChar *name, OpenMode mode) -{ - int how; - - switch ( mode ) - { - default: - wxFAIL_MSG(wxT("bad wxFile::Access mode parameter.")); - // fall through - - case read: - how = R_OK; - break; - - case write: - how = W_OK; - break; - - case read_write: - how = R_OK | W_OK; - break; - } - - return wxAccess(name, how) == 0; -} - -// ---------------------------------------------------------------------------- -// opening/closing -// ---------------------------------------------------------------------------- - -// ctors -wxFile::wxFile(const wxChar *szFileName, OpenMode mode) -{ - m_fd = fd_invalid; - m_error = false; - - Open(szFileName, mode); -} - -// create the file, fail if it already exists and bOverwrite -bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) -{ - // if bOverwrite we create a new file or truncate the existing one, - // otherwise we only create the new file and fail if it already exists -#if defined(__WXMAC__) && !defined(__UNIX__) && !wxUSE_UNICODE - // Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace - // int fd = open( szFileName , O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access); - int fd = creat( szFileName , accessMode); -#else - int fd = wxOpen( szFileName, - O_BINARY | O_WRONLY | O_CREAT | - (bOverwrite ? O_TRUNC : O_EXCL) - ACCESS(accessMode) ); -#endif - if ( fd == -1 ) - { - wxLogSysError(_("can't create file '%s'"), szFileName); - return false; - } - - Attach(fd); - return true; -} - -// open the file -bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) -{ - int flags = O_BINARY; - - switch ( mode ) - { - case read: - flags |= O_RDONLY; - break; - - case write_append: - if ( wxFile::Exists(szFileName) ) - { - flags |= O_WRONLY | O_APPEND; - break; - } - //else: fall through as write_append is the same as write if the - // file doesn't exist - - case write: - flags |= O_WRONLY | O_CREAT | O_TRUNC; - break; - - case write_excl: - flags |= O_WRONLY | O_CREAT | O_EXCL; - break; - - case read_write: - flags |= O_RDWR; - break; - } - -#ifdef __WINDOWS__ - // only read/write bits for "all" are supported by this function under - // Windows, and VC++ 8 returns EINVAL if any other bits are used in - // accessMode, so clear them as they have at best no effect anyhow - accessMode &= wxS_IRUSR | wxS_IWUSR; -#endif // __WINDOWS__ - - int fd = wxOpen( szFileName, flags ACCESS(accessMode)); - - if ( fd == -1 ) - { - wxLogSysError(_("can't open file '%s'"), szFileName); - return false; - } - - Attach(fd); - return true; -} - -// close -bool wxFile::Close() -{ - if ( IsOpened() ) { - if (wxClose(m_fd) == -1) - { - wxLogSysError(_("can't close file descriptor %d"), m_fd); - m_fd = fd_invalid; - return false; - } - else - m_fd = fd_invalid; - } - - return true; -} - -// ---------------------------------------------------------------------------- -// read/write -// ---------------------------------------------------------------------------- - -// read -ssize_t wxFile::Read(void *pBuf, size_t nCount) -{ - wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); - - ssize_t iRc = wxRead(m_fd, pBuf, nCount); - - if ( iRc == -1 ) - { - wxLogSysError(_("can't read from file descriptor %d"), m_fd); - return wxInvalidOffset; - } - - return iRc; -} - -// write -size_t wxFile::Write(const void *pBuf, size_t nCount) -{ - wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); - - ssize_t iRc = wxWrite(m_fd, pBuf, nCount); - - if ( iRc == -1 ) - { - wxLogSysError(_("can't write to file descriptor %d"), m_fd); - m_error = true; - iRc = 0; - } - - return iRc; -} - -// flush -bool wxFile::Flush() -{ -#ifdef HAVE_FSYNC - // fsync() only works on disk files and returns errors for pipes, don't - // call it then - if ( IsOpened() && GetKind() == wxFILE_KIND_DISK ) - { - if ( wxFsync(m_fd) == -1 ) - { - wxLogSysError(_("can't flush file descriptor %d"), m_fd); - return false; - } - } -#endif // HAVE_FSYNC - - return true; -} - -// ---------------------------------------------------------------------------- -// seek -// ---------------------------------------------------------------------------- - -// seek -wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) -{ - wxASSERT_MSG( IsOpened(), _T("can't seek on closed file") ); - wxCHECK_MSG( ofs != wxInvalidOffset || mode != wxFromStart, - wxInvalidOffset, - _T("invalid absolute file offset") ); - - int origin; - switch ( mode ) { - default: - wxFAIL_MSG(_("unknown seek origin")); - - case wxFromStart: - origin = SEEK_SET; - break; - - case wxFromCurrent: - origin = SEEK_CUR; - break; - - case wxFromEnd: - origin = SEEK_END; - break; - } - - wxFileOffset iRc = wxSeek(m_fd, ofs, origin); - if ( iRc == wxInvalidOffset ) - { - wxLogSysError(_("can't seek on file descriptor %d"), m_fd); - } - - return iRc; -} - -// get current file offset -wxFileOffset wxFile::Tell() const -{ - wxASSERT( IsOpened() ); - - wxFileOffset iRc = wxTell(m_fd); - if ( iRc == wxInvalidOffset ) - { - wxLogSysError(_("can't get seek position on file descriptor %d"), m_fd); - } - - return iRc; -} - -// get current file length -wxFileOffset wxFile::Length() const -{ - wxASSERT( IsOpened() ); - - wxFileOffset iRc = Tell(); - if ( iRc != wxInvalidOffset ) { - // have to use const_cast :-( - wxFileOffset iLen = ((wxFile *)this)->SeekEnd(); - if ( iLen != wxInvalidOffset ) { - // restore old position - if ( ((wxFile *)this)->Seek(iRc) == wxInvalidOffset ) { - // error - iLen = wxInvalidOffset; - } - } - - iRc = iLen; - } - - if ( iRc == wxInvalidOffset ) - { - wxLogSysError(_("can't find length of file on file descriptor %d"), m_fd); - } - - return iRc; -} - -// is end of file reached? -bool wxFile::Eof() const -{ - wxASSERT( IsOpened() ); - - wxFileOffset iRc; - -#if defined(__DOS__) || defined(__UNIX__) || defined(__GNUWIN32__) || defined( __MWERKS__ ) || defined(__SALFORDC__) - // @@ this doesn't work, of course, on unseekable file descriptors - wxFileOffset ofsCur = Tell(), - ofsMax = Length(); - if ( ofsCur == wxInvalidOffset || ofsMax == wxInvalidOffset ) - iRc = wxInvalidOffset; - else - iRc = ofsCur == ofsMax; -#else // Windows and "native" compiler - iRc = wxEof(m_fd); -#endif // Windows/Unix - - if ( iRc == 1) - {} - else if ( iRc == 0 ) - return false; - else if ( iRc == wxInvalidOffset ) - wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd); - else - wxFAIL_MSG(_("invalid eof() return value.")); - - return true; -} - -// ============================================================================ -// implementation of wxTempFile -// ============================================================================ - -// ---------------------------------------------------------------------------- -// construction -// ---------------------------------------------------------------------------- - -wxTempFile::wxTempFile(const wxString& strName) -{ - Open(strName); -} - -bool wxTempFile::Open(const wxString& strName) -{ - // we must have an absolute filename because otherwise CreateTempFileName() - // would create the temp file in $TMP (i.e. the system standard location - // for the temp files) which might be on another volume/drive/mount and - // wxRename()ing it later to m_strName from Commit() would then fail - // - // with the absolute filename, the temp file is created in the same - // directory as this one which ensures that wxRename() may work later - wxFileName fn(strName); - if ( !fn.IsAbsolute() ) - { - fn.Normalize(wxPATH_NORM_ABSOLUTE); - } - - m_strName = fn.GetFullPath(); - - m_strTemp = wxFileName::CreateTempFileName(m_strName, &m_file); - - if ( m_strTemp.empty() ) - { - // CreateTempFileName() failed - return false; - } - -#ifdef __UNIX__ - // the temp file should have the same permissions as the original one - mode_t mode; - - wxStructStat st; - if ( stat( (const char*) m_strName.fn_str(), &st) == 0 ) - { - mode = st.st_mode; - } - else - { - // file probably didn't exist, just give it the default mode _using_ - // user's umask (new files creation should respect umask) - mode_t mask = umask(0777); - mode = 0666 & ~mask; - umask(mask); - } - - if ( chmod( (const char*) m_strTemp.fn_str(), mode) == -1 ) - { -#ifndef __OS2__ - wxLogSysError(_("Failed to set temporary file permissions")); -#endif - } -#endif // Unix - - return true; -} - -// ---------------------------------------------------------------------------- -// destruction -// ---------------------------------------------------------------------------- - -wxTempFile::~wxTempFile() -{ - if ( IsOpened() ) - Discard(); -} - -bool wxTempFile::Commit() -{ - m_file.Close(); - - if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) { - wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); - return false; - } - - if ( !wxRenameFile(m_strTemp, m_strName) ) { - wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); - return false; - } - - return true; -} - -void wxTempFile::Discard() -{ - m_file.Close(); - if ( wxRemove(m_strTemp) != 0 ) - wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str()); -} - -#endif // wxUSE_FILE - diff --git a/Source/3rdParty/wx/src/common/fileback.cpp b/Source/3rdParty/wx/src/common/fileback.cpp deleted file mode 100644 index ccce957bf..000000000 --- a/Source/3rdParty/wx/src/common/fileback.cpp +++ /dev/null @@ -1,338 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fileback.cpp -// Purpose: Back an input stream with memory or a file -// Author: Mike Wetherell -// RCS-ID: $Id: fileback.cpp 42651 2006-10-29 20:06:45Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILESYSTEM - -#include "wx/private/fileback.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/log.h" -#endif - -#include "wx/private/filename.h" - -// Prefer wxFFile unless wxFile has large file support but wxFFile does not. -// -#if wxUSE_FFILE && (defined wxHAS_LARGE_FFILES || !defined wxHAS_LARGE_FILES) -typedef wxFFile wxBFFile; -static const bool wxBadSeek = false; -#else -typedef wxFile wxBFFile; -static const wxFileOffset wxBadSeek = wxInvalidOffset; -#endif - -///////////////////////////////////////////////////////////////////////////// -// Backing file implementation - -class wxBackingFileImpl -{ -public: - wxBackingFileImpl(wxInputStream *stream, - size_t bufsize, - const wxString& prefix); - ~wxBackingFileImpl(); - - void Release() { if (--m_refcount == 0) delete this; } - wxBackingFileImpl *AddRef() { m_refcount++; return this; } - - wxStreamError ReadAt(wxFileOffset pos, void *buffer, size_t *size); - wxFileOffset GetLength() const; - -private: - int m_refcount; - - wxInputStream *m_stream; - wxStreamError m_parenterror; - - char *m_buf; - size_t m_bufsize; - size_t m_buflen; - - wxString m_prefix; - wxString m_filename; - wxBFFile m_file; - wxFileOffset m_filelen; -}; - -wxBackingFileImpl::wxBackingFileImpl(wxInputStream *stream, - size_t bufsize, - const wxString& prefix) - : m_refcount(1), - m_stream(stream), - m_parenterror(wxSTREAM_NO_ERROR), - m_buf(NULL), - m_bufsize(bufsize), - m_buflen(0), - m_prefix(prefix), - m_filelen(0) -{ - wxFileOffset len = m_stream->GetLength(); - - if (len >= 0 && len + size_t(1) < m_bufsize) - m_bufsize = size_t(len + 1); - - if (m_bufsize) - m_buf = new char[m_bufsize]; -} - -wxBackingFileImpl::~wxBackingFileImpl() -{ - delete m_stream; - delete [] m_buf; - - if (!m_filename.empty()) - wxRemoveFile(m_filename); -} - -wxStreamError wxBackingFileImpl::ReadAt(wxFileOffset pos, - void *buffer, - size_t *size) -{ - size_t reqestedSize = *size; - *size = 0; - - // size1 is the number of bytes it will read directly from the backing - // file. size2 is any remaining bytes not yet backed, these are returned - // from the buffer or read from the parent stream. - size_t size1, size2; - - if (pos + reqestedSize <= m_filelen + size_t(0)) { - size1 = reqestedSize; - size2 = 0; - } else if (pos < m_filelen) { - size1 = size_t(m_filelen - pos); - size2 = reqestedSize - size1; - } else { - size1 = 0; - size2 = reqestedSize; - } - - if (pos < 0) - return wxSTREAM_READ_ERROR; - - // read the backing file - if (size1) { - if (m_file.Seek(pos) == wxBadSeek) - return wxSTREAM_READ_ERROR; - - ssize_t n = m_file.Read(buffer, size1); - if (n > 0) { - *size = n; - pos += n; - } - - if (*size < size1) - return wxSTREAM_READ_ERROR; - } - - // read from the buffer or parent stream - if (size2) - { - while (*size < reqestedSize) - { - // if pos is further ahead than the parent has been read so far, - // then read forward in the parent stream - while (pos - m_filelen + size_t(0) >= m_buflen) - { - // if the parent is small enough, don't use a backing file - // just the buffer memory - if (!m_stream && m_filelen == 0) - return m_parenterror; - - // before refilling the buffer write out the current buffer - // to the backing file if there is anything in it - if (m_buflen) - { - if (!m_file.IsOpened()) - if (!wxCreateTempFile(m_prefix, &m_file, &m_filename)) - return wxSTREAM_READ_ERROR; - - if (m_file.Seek(m_filelen) == wxBadSeek) - return wxSTREAM_READ_ERROR; - - size_t count = m_file.Write(m_buf, m_buflen); - m_filelen += count; - - if (count < m_buflen) { - delete m_stream; - m_stream = NULL; - if (count > 0) { - delete[] m_buf; - m_buf = NULL; - m_buflen = 0; - } - m_parenterror = wxSTREAM_READ_ERROR; - return m_parenterror; - } - - m_buflen = 0; - - if (!m_stream) { - delete[] m_buf; - m_buf = NULL; - } - } - - if (!m_stream) - return m_parenterror; - - // refill buffer - m_buflen = m_stream->Read(m_buf, m_bufsize).LastRead(); - - if (m_buflen < m_bufsize) { - m_parenterror = m_stream->GetLastError(); - if (m_parenterror == wxSTREAM_NO_ERROR) - m_parenterror = wxSTREAM_EOF; - delete m_stream; - m_stream = NULL; - } - } - - // copy to the user's buffer - size_t start = size_t(pos - m_filelen); - size_t len = wxMin(m_buflen - start, reqestedSize - *size); - - memcpy((char*)buffer + *size, m_buf + start, len); - *size += len; - pos += len; - } - } - - return wxSTREAM_NO_ERROR; -} - -wxFileOffset wxBackingFileImpl::GetLength() const -{ - if (m_parenterror != wxSTREAM_EOF) { - wxLogNull nolog; - return m_stream->GetLength(); - } - return m_filelen + m_buflen; -} - - -///////////////////////////////////////////////////////////////////////////// -// Backing File, the handle part - -wxBackingFile::wxBackingFile(wxInputStream *stream, - size_t bufsize, - const wxString& prefix) - : m_impl(new wxBackingFileImpl(stream, bufsize, prefix)) -{ -} - -wxBackingFile::wxBackingFile(const wxBackingFile& backer) - : m_impl(backer.m_impl ? backer.m_impl->AddRef() : NULL) -{ -} - -wxBackingFile& wxBackingFile::operator=(const wxBackingFile& backer) -{ - if (backer.m_impl != m_impl) { - if (m_impl) - m_impl->Release(); - - m_impl = backer.m_impl; - - if (m_impl) - m_impl->AddRef(); - } - - return *this; -} - -wxBackingFile::~wxBackingFile() -{ - if (m_impl) - m_impl->Release(); -} - - -///////////////////////////////////////////////////////////////////////////// -// Input stream - -wxBackedInputStream::wxBackedInputStream(const wxBackingFile& backer) - : m_backer(backer), - m_pos(0) -{ -} - -wxFileOffset wxBackedInputStream::GetLength() const -{ - return m_backer.m_impl->GetLength(); -} - -wxFileOffset wxBackedInputStream::FindLength() const -{ - wxFileOffset len = GetLength(); - - if (len == wxInvalidOffset && IsOk()) { - // read a byte at 7ff...ffe - wxFileOffset pos = 1; - pos <<= sizeof(pos) * 8 - 1; - pos = ~pos - 1; - char ch; - size_t size = 1; - m_backer.m_impl->ReadAt(pos, &ch, &size); - len = GetLength(); - } - - return len; -} - -size_t wxBackedInputStream::OnSysRead(void *buffer, size_t size) -{ - if (!IsOk()) - return 0; - - m_lasterror = m_backer.m_impl->ReadAt(m_pos, buffer, &size); - m_pos += size; - return size; -} - -wxFileOffset wxBackedInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - switch (mode) { - case wxFromCurrent: - { - m_pos += pos; - break; - } - case wxFromEnd: - { - wxFileOffset len = GetLength(); - if (len == wxInvalidOffset) - return wxInvalidOffset; - m_pos = len + pos; - break; - } - default: - { - m_pos = pos; - break; - } - } - - return m_pos; -} - -wxFileOffset wxBackedInputStream::OnSysTell() const -{ - return m_pos; -} - -#endif // wxUSE_FILESYSTEM diff --git a/Source/3rdParty/wx/src/common/fileconf.cpp b/Source/3rdParty/wx/src/common/fileconf.cpp deleted file mode 100644 index c85ebe894..000000000 --- a/Source/3rdParty/wx/src/common/fileconf.cpp +++ /dev/null @@ -1,2131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/fileconf.cpp -// Purpose: implementation of wxFileConfig derivation of wxConfig -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.04.98 (adapted from appconf.cpp) -// RCS-ID: $Id: fileconf.cpp 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin -// Ballueder@usa.net -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif //__BORLANDC__ - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/app.h" - #include "wx/utils.h" // for wxGetHomeDir - #if wxUSE_STREAMS - #include "wx/stream.h" - #endif // wxUSE_STREAMS -#endif //WX_PRECOMP - -#include "wx/file.h" -#include "wx/textfile.h" -#include "wx/memtext.h" -#include "wx/config.h" -#include "wx/fileconf.h" -#include "wx/filefn.h" - -#if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers - #include "wx/filename.h" // for MacSetTypeAndCreator -#endif - -#if defined(__WXMSW__) - #include "wx/msw/private.h" -#endif //windows.h -#if defined(__WXPM__) - #define INCL_DOS - #include -#endif - -#include -#include - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- -#define CONST_CAST ((wxFileConfig *)this)-> - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifndef MAX_PATH - #define MAX_PATH 512 -#endif - -#define FILECONF_TRACE_MASK _T("fileconf") - -// ---------------------------------------------------------------------------- -// global functions declarations -// ---------------------------------------------------------------------------- - -// compare functions for sorting the arrays -static int LINKAGEMODE CompareEntries(wxFileConfigEntry *p1, wxFileConfigEntry *p2); -static int LINKAGEMODE CompareGroups(wxFileConfigGroup *p1, wxFileConfigGroup *p2); - -// filter strings -static wxString FilterInValue(const wxString& str); -static wxString FilterOutValue(const wxString& str); - -static wxString FilterInEntryName(const wxString& str); -static wxString FilterOutEntryName(const wxString& str); - -// get the name to use in wxFileConfig ctor -static wxString GetAppName(const wxString& appname); - -// ============================================================================ -// private classes -// ============================================================================ - -// ---------------------------------------------------------------------------- -// "template" array types -// ---------------------------------------------------------------------------- - -#ifdef WXMAKINGDLL_BASE - WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(wxFileConfigEntry *, ArrayEntries, - WXDLLIMPEXP_BASE); - WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(wxFileConfigGroup *, ArrayGroups, - WXDLLIMPEXP_BASE); -#else - WX_DEFINE_SORTED_ARRAY(wxFileConfigEntry *, ArrayEntries); - WX_DEFINE_SORTED_ARRAY(wxFileConfigGroup *, ArrayGroups); -#endif - -// ---------------------------------------------------------------------------- -// wxFileConfigLineList -// ---------------------------------------------------------------------------- - -// we store all lines of the local config file as a linked list in memory -class wxFileConfigLineList -{ -public: - void SetNext(wxFileConfigLineList *pNext) { m_pNext = pNext; } - void SetPrev(wxFileConfigLineList *pPrev) { m_pPrev = pPrev; } - - // ctor - wxFileConfigLineList(const wxString& str, - wxFileConfigLineList *pNext = NULL) : m_strLine(str) - { SetNext(pNext); SetPrev(NULL); } - - // next/prev nodes in the linked list - wxFileConfigLineList *Next() const { return m_pNext; } - wxFileConfigLineList *Prev() const { return m_pPrev; } - - // get/change lines text - void SetText(const wxString& str) { m_strLine = str; } - const wxString& Text() const { return m_strLine; } - -private: - wxString m_strLine; // line contents - wxFileConfigLineList *m_pNext, // next node - *m_pPrev; // previous one - - DECLARE_NO_COPY_CLASS(wxFileConfigLineList) -}; - -// ---------------------------------------------------------------------------- -// wxFileConfigEntry: a name/value pair -// ---------------------------------------------------------------------------- - -class wxFileConfigEntry -{ -private: - wxFileConfigGroup *m_pParent; // group that contains us - - wxString m_strName, // entry name - m_strValue; // value - bool m_bImmutable:1, // can be overriden locally? - m_bHasValue:1; // set after first call to SetValue() - - int m_nLine; // used if m_pLine == NULL only - - // pointer to our line in the linked list or NULL if it was found in global - // file (which we don't modify) - wxFileConfigLineList *m_pLine; - -public: - wxFileConfigEntry(wxFileConfigGroup *pParent, - const wxString& strName, int nLine); - - // simple accessors - const wxString& Name() const { return m_strName; } - const wxString& Value() const { return m_strValue; } - wxFileConfigGroup *Group() const { return m_pParent; } - bool IsImmutable() const { return m_bImmutable; } - bool IsLocal() const { return m_pLine != 0; } - int Line() const { return m_nLine; } - wxFileConfigLineList * - GetLine() const { return m_pLine; } - - // modify entry attributes - void SetValue(const wxString& strValue, bool bUser = true); - void SetLine(wxFileConfigLineList *pLine); - - DECLARE_NO_COPY_CLASS(wxFileConfigEntry) -}; - -// ---------------------------------------------------------------------------- -// wxFileConfigGroup: container of entries and other groups -// ---------------------------------------------------------------------------- - -class wxFileConfigGroup -{ -private: - wxFileConfig *m_pConfig; // config object we belong to - wxFileConfigGroup *m_pParent; // parent group (NULL for root group) - ArrayEntries m_aEntries; // entries in this group - ArrayGroups m_aSubgroups; // subgroups - wxString m_strName; // group's name - wxFileConfigLineList *m_pLine; // pointer to our line in the linked list - wxFileConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the - wxFileConfigGroup *m_pLastGroup; // local file (we insert new ones after it) - - // DeleteSubgroupByName helper - bool DeleteSubgroup(wxFileConfigGroup *pGroup); - - // used by Rename() - void UpdateGroupAndSubgroupsLines(); - -public: - // ctor - wxFileConfigGroup(wxFileConfigGroup *pParent, const wxString& strName, wxFileConfig *); - - // dtor deletes all entries and subgroups also - ~wxFileConfigGroup(); - - // simple accessors - const wxString& Name() const { return m_strName; } - wxFileConfigGroup *Parent() const { return m_pParent; } - wxFileConfig *Config() const { return m_pConfig; } - - const ArrayEntries& Entries() const { return m_aEntries; } - const ArrayGroups& Groups() const { return m_aSubgroups; } - bool IsEmpty() const { return Entries().IsEmpty() && Groups().IsEmpty(); } - - // find entry/subgroup (NULL if not found) - wxFileConfigGroup *FindSubgroup(const wxChar *szName) const; - wxFileConfigEntry *FindEntry (const wxChar *szName) const; - - // delete entry/subgroup, return false if doesn't exist - bool DeleteSubgroupByName(const wxChar *szName); - bool DeleteEntry(const wxChar *szName); - - // create new entry/subgroup returning pointer to newly created element - wxFileConfigGroup *AddSubgroup(const wxString& strName); - wxFileConfigEntry *AddEntry (const wxString& strName, int nLine = wxNOT_FOUND); - - void SetLine(wxFileConfigLineList *pLine); - - // rename: no checks are done to ensure that the name is unique! - void Rename(const wxString& newName); - - // - wxString GetFullName() const; - - // get the last line belonging to an entry/subgroup of this group - wxFileConfigLineList *GetGroupLine(); // line which contains [group] - // may be NULL for "/" only - wxFileConfigLineList *GetLastEntryLine(); // after which our subgroups start - wxFileConfigLineList *GetLastGroupLine(); // after which the next group starts - - // called by entries/subgroups when they're created/deleted - void SetLastEntry(wxFileConfigEntry *pEntry); - void SetLastGroup(wxFileConfigGroup *pGroup) - { m_pLastGroup = pGroup; } - - DECLARE_NO_COPY_CLASS(wxFileConfigGroup) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// static functions -// ---------------------------------------------------------------------------- -wxString wxFileConfig::GetGlobalDir() -{ - wxString strDir; - -#ifdef __VMS__ // Note if __VMS is defined __UNIX is also defined - strDir = wxT("sys$manager:"); -#elif defined(__WXMAC__) - strDir = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ; -#elif defined( __UNIX__ ) - strDir = wxT("/etc/"); -#elif defined(__OS2__) - ULONG aulSysInfo[QSV_MAX] = {0}; - UINT drive; - APIRET rc; - - rc = DosQuerySysInfo( 1L, QSV_MAX, (PVOID)aulSysInfo, sizeof(ULONG)*QSV_MAX); - if (rc == 0) - { - drive = aulSysInfo[QSV_BOOT_DRIVE - 1]; - strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1); - } -#elif defined(__WXSTUBS__) - wxFAIL_MSG( wxT("TODO") ); -#elif defined(__DOS__) - // There's no such thing as global cfg dir in MS-DOS, let's return - // current directory (FIXME_MGL?) - strDir = wxT(".\\"); -#elif defined(__WXWINCE__) - strDir = wxT("\\Windows\\"); -#else // Windows - - wxChar szWinDir[MAX_PATH]; - ::GetWindowsDirectory(szWinDir, MAX_PATH); - - strDir = szWinDir; - strDir << wxT('\\'); -#endif // Unix/Windows - - return strDir; -} - -wxString wxFileConfig::GetLocalDir() -{ - wxString strDir; - -#if defined(__WXMAC__) || defined(__DOS__) - // no local dir concept on Mac OS 9 or MS-DOS - strDir << GetGlobalDir() ; -#else - wxGetHomeDir(&strDir); - - #ifdef __UNIX__ - if ( - (strDir.Last() != wxT('/')) - #ifdef __VMS - && (strDir.Last() != wxT(']')) - #endif - ) - strDir << wxT('/'); - #else - if (strDir.Last() != wxT('\\')) - strDir << wxT('\\'); - #endif -#endif - - return strDir; -} - -wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile) -{ - wxString str = GetGlobalDir(); - str << szFile; - - if ( wxStrchr(szFile, wxT('.')) == NULL ) -#if defined( __WXMAC__ ) - str << wxT(" Preferences") ; -#elif defined( __UNIX__ ) - str << wxT(".conf"); -#else // Windows - str << wxT(".ini"); -#endif // UNIX/Win - - return str; -} - -wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) -{ -#ifdef __VMS__ - // On VMS I saw the problem that the home directory was appended - // twice for the configuration file. Does that also happen for - // other platforms? - wxString str = wxT( '.' ); -#else - wxString str = GetLocalDir(); -#endif - -#if defined( __UNIX__ ) && !defined( __VMS ) && !defined( __WXMAC__ ) - str << wxT('.'); -#endif - - str << szFile; - -#if defined(__WINDOWS__) || defined(__DOS__) - if ( wxStrchr(szFile, wxT('.')) == NULL ) - str << wxT(".ini"); -#endif - -#ifdef __WXMAC__ - str << wxT(" Preferences") ; -#endif - - return str; -} - -// ---------------------------------------------------------------------------- -// ctor -// ---------------------------------------------------------------------------- - -void wxFileConfig::Init() -{ - m_pCurrentGroup = - m_pRootGroup = new wxFileConfigGroup(NULL, wxEmptyString, this); - - m_linesHead = - m_linesTail = NULL; - - // It's not an error if (one of the) file(s) doesn't exist. - - // parse the global file - if ( !m_strGlobalFile.empty() && wxFile::Exists(m_strGlobalFile) ) - { - wxTextFile fileGlobal(m_strGlobalFile); - - if ( fileGlobal.Open(*m_conv/*ignored in ANSI build*/) ) - { - Parse(fileGlobal, false /* global */); - SetRootPath(); - } - else - { - wxLogWarning(_("can't open global configuration file '%s'."), m_strGlobalFile.c_str()); - } - } - - // parse the local file - if ( !m_strLocalFile.empty() && wxFile::Exists(m_strLocalFile) ) - { - wxTextFile fileLocal(m_strLocalFile); - if ( fileLocal.Open(*m_conv/*ignored in ANSI build*/) ) - { - Parse(fileLocal, true /* local */); - SetRootPath(); - } - else - { - wxLogWarning(_("can't open user configuration file '%s'."), m_strLocalFile.c_str() ); - } - } - - m_isDirty = false; -} - -// constructor supports creation of wxFileConfig objects of any type -wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName, - const wxString& strLocal, const wxString& strGlobal, - long style, - const wxMBConv& conv) - : wxConfigBase(::GetAppName(appName), vendorName, - strLocal, strGlobal, - style), - m_strLocalFile(strLocal), m_strGlobalFile(strGlobal), - m_conv(conv.Clone()) -{ - // Make up names for files if empty - if ( m_strLocalFile.empty() && (style & wxCONFIG_USE_LOCAL_FILE) ) - { - m_strLocalFile = GetLocalFileName(GetAppName()); -#if defined(__UNIX__) && !defined(__VMS) - if ( style & wxCONFIG_USE_SUBDIR ) - m_strLocalFile << wxFILE_SEP_PATH << GetAppName() << _T(".conf"); -#endif - } - - if ( m_strGlobalFile.empty() && (style & wxCONFIG_USE_GLOBAL_FILE) ) - m_strGlobalFile = GetGlobalFileName(GetAppName()); - - // Check if styles are not supplied, but filenames are, in which case - // add the correct styles. - if ( !m_strLocalFile.empty() ) - SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE); - - if ( !m_strGlobalFile.empty() ) - SetStyle(GetStyle() | wxCONFIG_USE_GLOBAL_FILE); - - // if the path is not absolute, prepend the standard directory to it - // UNLESS wxCONFIG_USE_RELATIVE_PATH style is set - if ( !(style & wxCONFIG_USE_RELATIVE_PATH) ) - { - if ( !m_strLocalFile.empty() && !wxIsAbsolutePath(m_strLocalFile) ) - { - const wxString strLocalOrig = m_strLocalFile; - m_strLocalFile = GetLocalDir(); - m_strLocalFile << strLocalOrig; - } - - if ( !m_strGlobalFile.empty() && !wxIsAbsolutePath(m_strGlobalFile) ) - { - const wxString strGlobalOrig = m_strGlobalFile; - m_strGlobalFile = GetGlobalDir(); - m_strGlobalFile << strGlobalOrig; - } - } - - SetUmask(-1); - - Init(); -} - -#if wxUSE_STREAMS - -wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv) - : m_conv(conv.Clone()) -{ - // always local_file when this constructor is called (?) - SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE); - - m_pCurrentGroup = - m_pRootGroup = new wxFileConfigGroup(NULL, wxEmptyString, this); - - m_linesHead = - m_linesTail = NULL; - - // read the entire stream contents in memory - wxString str; - { - static const size_t chunkLen = 1024; - - wxMemoryBuffer buf(chunkLen); - do - { - inStream.Read(buf.GetAppendBuf(chunkLen), chunkLen); - buf.UngetAppendBuf(inStream.LastRead()); - - const wxStreamError err = inStream.GetLastError(); - - if ( err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF ) - { - wxLogError(_("Error reading config options.")); - break; - } - } - while ( !inStream.Eof() ); - -#if wxUSE_UNICODE - size_t len; - str = conv.cMB2WC((char *)buf.GetData(), buf.GetDataLen(), &len); - if ( !len && buf.GetDataLen() ) - { - wxLogError(_("Failed to read config options.")); - } -#else // !wxUSE_UNICODE - // no need for conversion - str.assign((char *)buf.GetData(), buf.GetDataLen()); -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - } - - - // translate everything to the current (platform-dependent) line - // termination character - str = wxTextBuffer::Translate(str); - - wxMemoryText memText; - - // Now we can add the text to the memory text. To do this we extract line - // by line from the translated string, until we've reached the end. - // - // VZ: all this is horribly inefficient, we should do the translation on - // the fly in one pass saving both memory and time (TODO) - - const wxChar *pEOL = wxTextBuffer::GetEOL(wxTextBuffer::typeDefault); - const size_t EOLLen = wxStrlen(pEOL); - - int posLineStart = str.Find(pEOL); - while ( posLineStart != -1 ) - { - wxString line(str.Left(posLineStart)); - - memText.AddLine(line); - - str = str.Mid(posLineStart + EOLLen); - - posLineStart = str.Find(pEOL); - } - - // also add whatever we have left in the translated string. - if ( !str.empty() ) - memText.AddLine(str); - - // Finally we can parse it all. - Parse(memText, true /* local */); - - SetRootPath(); - ResetDirty(); -} - -#endif // wxUSE_STREAMS - -void wxFileConfig::CleanUp() -{ - delete m_pRootGroup; - - wxFileConfigLineList *pCur = m_linesHead; - while ( pCur != NULL ) { - wxFileConfigLineList *pNext = pCur->Next(); - delete pCur; - pCur = pNext; - } -} - -wxFileConfig::~wxFileConfig() -{ - Flush(); - - CleanUp(); - - delete m_conv; -} - -// ---------------------------------------------------------------------------- -// parse a config file -// ---------------------------------------------------------------------------- - -void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) -{ - const wxChar *pStart; - const wxChar *pEnd; - wxString strLine; - - size_t nLineCount = buffer.GetLineCount(); - - for ( size_t n = 0; n < nLineCount; n++ ) - { - strLine = buffer[n]; - - // add the line to linked list - if ( bLocal ) - LineListAppend(strLine); - - - // skip leading spaces - for ( pStart = strLine; wxIsspace(*pStart); pStart++ ) - ; - - // skip blank/comment lines - if ( *pStart == wxT('\0')|| *pStart == wxT(';') || *pStart == wxT('#') ) - continue; - - if ( *pStart == wxT('[') ) { // a new group - pEnd = pStart; - - while ( *++pEnd != wxT(']') ) { - if ( *pEnd == wxT('\\') ) { - // the next char is escaped, so skip it even if it is ']' - pEnd++; - } - - if ( *pEnd == wxT('\n') || *pEnd == wxT('\0') ) { - // we reached the end of line, break out of the loop - break; - } - } - - if ( *pEnd != wxT(']') ) { - wxLogError(_("file '%s': unexpected character %c at line %d."), - buffer.GetName(), *pEnd, n + 1); - continue; // skip this line - } - - // group name here is always considered as abs path - wxString strGroup; - pStart++; - strGroup << wxCONFIG_PATH_SEPARATOR - << FilterInEntryName(wxString(pStart, pEnd - pStart)); - - // will create it if doesn't yet exist - SetPath(strGroup); - - if ( bLocal ) - { - if ( m_pCurrentGroup->Parent() ) - m_pCurrentGroup->Parent()->SetLastGroup(m_pCurrentGroup); - m_pCurrentGroup->SetLine(m_linesTail); - } - - // check that there is nothing except comments left on this line - bool bCont = true; - while ( *++pEnd != wxT('\0') && bCont ) { - switch ( *pEnd ) { - case wxT('#'): - case wxT(';'): - bCont = false; - break; - - case wxT(' '): - case wxT('\t'): - // ignore whitespace ('\n' impossible here) - break; - - default: - wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."), - buffer.GetName(), n + 1, pEnd); - bCont = false; - } - } - } - else { // a key - pEnd = pStart; - while ( *pEnd && *pEnd != wxT('=') /* && !wxIsspace(*pEnd)*/ ) { - if ( *pEnd == wxT('\\') ) { - // next character may be space or not - still take it because it's - // quoted (unless there is nothing) - pEnd++; - if ( !*pEnd ) { - // the error message will be given below anyhow - break; - } - } - - pEnd++; - } - - wxString strKey(FilterInEntryName(wxString(pStart, pEnd).Trim())); - - // skip whitespace - while ( wxIsspace(*pEnd) ) - pEnd++; - - if ( *pEnd++ != wxT('=') ) { - wxLogError(_("file '%s', line %d: '=' expected."), - buffer.GetName(), n + 1); - } - else { - wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strKey); - - if ( pEntry == NULL ) { - // new entry - pEntry = m_pCurrentGroup->AddEntry(strKey, n); - } - else { - if ( bLocal && pEntry->IsImmutable() ) { - // immutable keys can't be changed by user - wxLogWarning(_("file '%s', line %d: value for immutable key '%s' ignored."), - buffer.GetName(), n + 1, strKey.c_str()); - continue; - } - // the condition below catches the cases (a) and (b) but not (c): - // (a) global key found second time in global file - // (b) key found second (or more) time in local file - // (c) key from global file now found in local one - // which is exactly what we want. - else if ( !bLocal || pEntry->IsLocal() ) { - wxLogWarning(_("file '%s', line %d: key '%s' was first found at line %d."), - buffer.GetName(), n + 1, strKey.c_str(), pEntry->Line()); - - } - } - - if ( bLocal ) - pEntry->SetLine(m_linesTail); - - // skip whitespace - while ( wxIsspace(*pEnd) ) - pEnd++; - - wxString value = pEnd; - if ( !(GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS) ) - value = FilterInValue(value); - - pEntry->SetValue(value, false); - } - } - } -} - -// ---------------------------------------------------------------------------- -// set/retrieve path -// ---------------------------------------------------------------------------- - -void wxFileConfig::SetRootPath() -{ - m_strPath.Empty(); - m_pCurrentGroup = m_pRootGroup; -} - -bool -wxFileConfig::DoSetPath(const wxString& strPath, bool createMissingComponents) -{ - wxArrayString aParts; - - if ( strPath.empty() ) { - SetRootPath(); - return true; - } - - if ( strPath[0] == wxCONFIG_PATH_SEPARATOR ) { - // absolute path - wxSplitPath(aParts, strPath); - } - else { - // relative path, combine with current one - wxString strFullPath = m_strPath; - strFullPath << wxCONFIG_PATH_SEPARATOR << strPath; - wxSplitPath(aParts, strFullPath); - } - - // change current group - size_t n; - m_pCurrentGroup = m_pRootGroup; - for ( n = 0; n < aParts.Count(); n++ ) { - wxFileConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]); - if ( pNextGroup == NULL ) - { - if ( !createMissingComponents ) - return false; - - pNextGroup = m_pCurrentGroup->AddSubgroup(aParts[n]); - } - - m_pCurrentGroup = pNextGroup; - } - - // recombine path parts in one variable - m_strPath.Empty(); - for ( n = 0; n < aParts.Count(); n++ ) { - m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n]; - } - - return true; -} - -void wxFileConfig::SetPath(const wxString& strPath) -{ - DoSetPath(strPath, true /* create missing path components */); -} - -// ---------------------------------------------------------------------------- -// enumeration -// ---------------------------------------------------------------------------- - -bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const -{ - lIndex = 0; - return GetNextGroup(str, lIndex); -} - -bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const -{ - if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { - str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name(); - return true; - } - else - return false; -} - -bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const -{ - lIndex = 0; - return GetNextEntry(str, lIndex); -} - -bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const -{ - if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { - str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name(); - return true; - } - else - return false; -} - -size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const -{ - size_t n = m_pCurrentGroup->Entries().Count(); - if ( bRecursive ) { - wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup; - size_t nSubgroups = m_pCurrentGroup->Groups().Count(); - for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) { - CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup]; - n += GetNumberOfEntries(true); - CONST_CAST m_pCurrentGroup = pOldCurrentGroup; - } - } - - return n; -} - -size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const -{ - size_t n = m_pCurrentGroup->Groups().Count(); - if ( bRecursive ) { - wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup; - size_t nSubgroups = m_pCurrentGroup->Groups().Count(); - for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) { - CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup]; - n += GetNumberOfGroups(true); - CONST_CAST m_pCurrentGroup = pOldCurrentGroup; - } - } - - return n; -} - -// ---------------------------------------------------------------------------- -// tests for existence -// ---------------------------------------------------------------------------- - -bool wxFileConfig::HasGroup(const wxString& strName) const -{ - // special case: DoSetPath("") does work as it's equivalent to DoSetPath("/") - // but there is no group with empty name so treat this separately - if ( strName.empty() ) - return false; - - const wxString pathOld = GetPath(); - - wxFileConfig *self = wx_const_cast(wxFileConfig *, this); - const bool - rc = self->DoSetPath(strName, false /* don't create missing components */); - - self->SetPath(pathOld); - - return rc; -} - -bool wxFileConfig::HasEntry(const wxString& entry) const -{ - // path is the part before the last "/" - wxString path = entry.BeforeLast(wxCONFIG_PATH_SEPARATOR); - - // except in the special case of "/keyname" when there is nothing before "/" - if ( path.empty() && *entry.c_str() == wxCONFIG_PATH_SEPARATOR ) - { - path = wxCONFIG_PATH_SEPARATOR; - } - - // change to the path of the entry if necessary and remember the old path - // to restore it later - wxString pathOld; - wxFileConfig * const self = wx_const_cast(wxFileConfig *, this); - if ( !path.empty() ) - { - pathOld = GetPath(); - if ( pathOld.empty() ) - pathOld = wxCONFIG_PATH_SEPARATOR; - - if ( !self->DoSetPath(path, false /* don't create if doesn't exist */) ) - { - return false; - } - } - - // check if the entry exists in this group - const bool exists = m_pCurrentGroup->FindEntry( - entry.AfterLast(wxCONFIG_PATH_SEPARATOR)) != NULL; - - // restore the old path if we changed it above - if ( !pathOld.empty() ) - { - self->SetPath(pathOld); - } - - return exists; -} - -// ---------------------------------------------------------------------------- -// read/write values -// ---------------------------------------------------------------------------- - -bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const -{ - wxConfigPathChanger path(this, key); - - wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); - if (pEntry == NULL) { - return false; - } - - *pStr = pEntry->Value(); - - return true; -} - -bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const -{ - wxString str; - if ( !Read(key, &str) ) - return false; - - // extra spaces shouldn't prevent us from reading numeric values - str.Trim(); - - return str.ToLong(pl); -} - -bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) -{ - wxConfigPathChanger path(this, key); - wxString strName = path.Name(); - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Writing String '%s' = '%s' to Group '%s'"), - strName.c_str(), - szValue.c_str(), - GetPath().c_str() ); - - if ( strName.empty() ) - { - // setting the value of a group is an error - - wxASSERT_MSG( szValue.empty(), wxT("can't set value of a group!") ); - - // ... except if it's empty in which case it's a way to force it's creation - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Creating group %s"), - m_pCurrentGroup->Name().c_str() ); - - SetDirty(); - - // this will add a line for this group if it didn't have it before (or - // do nothing for the root but it's ok as it always exists anyhow) - (void)m_pCurrentGroup->GetGroupLine(); - } - else - { - // writing an entry check that the name is reasonable - if ( strName[0u] == wxCONFIG_IMMUTABLE_PREFIX ) - { - wxLogError( _("Config entry name cannot start with '%c'."), - wxCONFIG_IMMUTABLE_PREFIX); - return false; - } - - wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName); - - if ( pEntry == 0 ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Adding Entry %s"), - strName.c_str() ); - pEntry = m_pCurrentGroup->AddEntry(strName); - } - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Setting value %s"), - szValue.c_str() ); - pEntry->SetValue(szValue); - - SetDirty(); - } - - return true; -} - -bool wxFileConfig::DoWriteLong(const wxString& key, long lValue) -{ - return Write(key, wxString::Format(_T("%ld"), lValue)); -} - -bool wxFileConfig::Flush(bool /* bCurrentOnly */) -{ - if ( !IsDirty() || !m_strLocalFile ) - return true; - - // set the umask if needed - wxCHANGE_UMASK(m_umask); - - wxTempFile file(m_strLocalFile); - - if ( !file.IsOpened() ) - { - wxLogError(_("can't open user configuration file.")); - return false; - } - - // write all strings to file - wxString filetext; - filetext.reserve(4096); - for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) - { - filetext << p->Text() << wxTextFile::GetEOL(); - } - - if ( !file.Write(filetext, *m_conv) ) - { - wxLogError(_("can't write user configuration file.")); - return false; - } - - if ( !file.Commit() ) - { - wxLogError(_("Failed to update user configuration file.")); - - return false; - } - - ResetDirty(); - -#if defined(__WXMAC__) - wxFileName(m_strLocalFile).MacSetTypeAndCreator('TEXT', 'ttxt'); -#endif // __WXMAC__ - - return true; -} - -#if wxUSE_STREAMS - -bool wxFileConfig::Save(wxOutputStream& os, const wxMBConv& conv) -{ - // save unconditionally, even if not dirty - for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) - { - wxString line = p->Text(); - line += wxTextFile::GetEOL(); - - wxCharBuffer buf(line.mb_str(conv)); - if ( !os.Write(buf, strlen(buf)) ) - { - wxLogError(_("Error saving user configuration data.")); - - return false; - } - } - - ResetDirty(); - - return true; -} - -#endif // wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// renaming groups/entries -// ---------------------------------------------------------------------------- - -bool wxFileConfig::RenameEntry(const wxString& oldName, - const wxString& newName) -{ - wxASSERT_MSG( !wxStrchr(oldName, wxCONFIG_PATH_SEPARATOR), - _T("RenameEntry(): paths are not supported") ); - - // check that the entry exists - wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName); - if ( !oldEntry ) - return false; - - // check that the new entry doesn't already exist - if ( m_pCurrentGroup->FindEntry(newName) ) - return false; - - // delete the old entry, create the new one - wxString value = oldEntry->Value(); - if ( !m_pCurrentGroup->DeleteEntry(oldName) ) - return false; - - SetDirty(); - - wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName); - newEntry->SetValue(value); - - return true; -} - -bool wxFileConfig::RenameGroup(const wxString& oldName, - const wxString& newName) -{ - // check that the group exists - wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName); - if ( !group ) - return false; - - // check that the new group doesn't already exist - if ( m_pCurrentGroup->FindSubgroup(newName) ) - return false; - - group->Rename(newName); - - SetDirty(); - - return true; -} - -// ---------------------------------------------------------------------------- -// delete groups/entries -// ---------------------------------------------------------------------------- - -bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso) -{ - wxConfigPathChanger path(this, key); - - if ( !m_pCurrentGroup->DeleteEntry(path.Name()) ) - return false; - - SetDirty(); - - if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) { - if ( m_pCurrentGroup != m_pRootGroup ) { - wxFileConfigGroup *pGroup = m_pCurrentGroup; - SetPath(wxT("..")); // changes m_pCurrentGroup! - m_pCurrentGroup->DeleteSubgroupByName(pGroup->Name()); - } - //else: never delete the root group - } - - return true; -} - -bool wxFileConfig::DeleteGroup(const wxString& key) -{ - wxConfigPathChanger path(this, RemoveTrailingSeparator(key)); - - if ( !m_pCurrentGroup->DeleteSubgroupByName(path.Name()) ) - return false; - - path.UpdateIfDeleted(); - - SetDirty(); - - return true; -} - -bool wxFileConfig::DeleteAll() -{ - CleanUp(); - - if ( !m_strLocalFile.empty() ) - { - if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 ) - { - wxLogSysError(_("can't delete user configuration file '%s'"), - m_strLocalFile.c_str()); - return false; - } - } - - Init(); - - return true; -} - -// ---------------------------------------------------------------------------- -// linked list functions -// ---------------------------------------------------------------------------- - - // append a new line to the end of the list - -wxFileConfigLineList *wxFileConfig::LineListAppend(const wxString& str) -{ - wxLogTrace( FILECONF_TRACE_MASK, - _T(" ** Adding Line '%s'"), - str.c_str() ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - wxFileConfigLineList *pLine = new wxFileConfigLineList(str); - - if ( m_linesTail == NULL ) - { - // list is empty - m_linesHead = pLine; - } - else - { - // adjust pointers - m_linesTail->SetNext(pLine); - pLine->SetPrev(m_linesTail); - } - - m_linesTail = pLine; - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - return m_linesTail; -} - -// insert a new line after the given one or in the very beginning if !pLine -wxFileConfigLineList *wxFileConfig::LineListInsert(const wxString& str, - wxFileConfigLineList *pLine) -{ - wxLogTrace( FILECONF_TRACE_MASK, - _T(" ** Inserting Line '%s' after '%s'"), - str.c_str(), - ((pLine) ? pLine->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - if ( pLine == m_linesTail ) - return LineListAppend(str); - - wxFileConfigLineList *pNewLine = new wxFileConfigLineList(str); - if ( pLine == NULL ) - { - // prepend to the list - pNewLine->SetNext(m_linesHead); - m_linesHead->SetPrev(pNewLine); - m_linesHead = pNewLine; - } - else - { - // insert before pLine - wxFileConfigLineList *pNext = pLine->Next(); - pNewLine->SetNext(pNext); - pNewLine->SetPrev(pLine); - pNext->SetPrev(pNewLine); - pLine->SetNext(pNewLine); - } - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - return pNewLine; -} - -void wxFileConfig::LineListRemove(wxFileConfigLineList *pLine) -{ - wxLogTrace( FILECONF_TRACE_MASK, - _T(" ** Removing Line '%s'"), - pLine->Text().c_str() ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - wxFileConfigLineList *pPrev = pLine->Prev(), - *pNext = pLine->Next(); - - // first entry? - - if ( pPrev == NULL ) - m_linesHead = pNext; - else - pPrev->SetNext(pNext); - - // last entry? - - if ( pNext == NULL ) - m_linesTail = pPrev; - else - pNext->SetPrev(pPrev); - - if ( m_pRootGroup->GetGroupLine() == pLine ) - m_pRootGroup->SetLine(m_linesHead); - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" head: %s"), - ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" tail: %s"), - ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - - delete pLine; -} - -bool wxFileConfig::LineListIsEmpty() -{ - return m_linesHead == NULL; -} - -// ============================================================================ -// wxFileConfig::wxFileConfigGroup -// ============================================================================ - -// ---------------------------------------------------------------------------- -// ctor/dtor -// ---------------------------------------------------------------------------- - -// ctor -wxFileConfigGroup::wxFileConfigGroup(wxFileConfigGroup *pParent, - const wxString& strName, - wxFileConfig *pConfig) - : m_aEntries(CompareEntries), - m_aSubgroups(CompareGroups), - m_strName(strName) -{ - m_pConfig = pConfig; - m_pParent = pParent; - m_pLine = NULL; - - m_pLastEntry = NULL; - m_pLastGroup = NULL; -} - -// dtor deletes all children -wxFileConfigGroup::~wxFileConfigGroup() -{ - // entries - size_t n, nCount = m_aEntries.Count(); - for ( n = 0; n < nCount; n++ ) - delete m_aEntries[n]; - - // subgroups - nCount = m_aSubgroups.Count(); - for ( n = 0; n < nCount; n++ ) - delete m_aSubgroups[n]; -} - -// ---------------------------------------------------------------------------- -// line -// ---------------------------------------------------------------------------- - -void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) -{ - // for a normal (i.e. not root) group this method shouldn't be called twice - // unless we are resetting the line - wxASSERT_MSG( !m_pParent || !m_pLine || !pLine, - _T("changing line for a non-root group?") ); - - m_pLine = pLine; -} - -/* - This is a bit complicated, so let me explain it in details. All lines that - were read from the local file (the only one we will ever modify) are stored - in a (doubly) linked list. Our problem is to know at which position in this - list should we insert the new entries/subgroups. To solve it we keep three - variables for each group: m_pLine, m_pLastEntry and m_pLastGroup. - - m_pLine points to the line containing "[group_name]" - m_pLastEntry points to the last entry of this group in the local file. - m_pLastGroup subgroup - - Initially, they're NULL all three. When the group (an entry/subgroup) is read - from the local file, the corresponding variable is set. However, if the group - was read from the global file and then modified or created by the application - these variables are still NULL and we need to create the corresponding lines. - See the following functions (and comments preceding them) for the details of - how we do it. - - Also, when our last entry/group are deleted we need to find the new last - element - the code in DeleteEntry/Subgroup does this by backtracking the list - of lines until it either founds an entry/subgroup (and this is the new last - element) or the m_pLine of the group, in which case there are no more entries - (or subgroups) left and m_pLast becomes NULL. - - NB: This last problem could be avoided for entries if we added new entries - immediately after m_pLine, but in this case the entries would appear - backwards in the config file (OTOH, it's not that important) and as we - would still need to do it for the subgroups the code wouldn't have been - significantly less complicated. -*/ - -// Return the line which contains "[our name]". If we're still not in the list, -// add our line to it immediately after the last line of our parent group if we -// have it or in the very beginning if we're the root group. -wxFileConfigLineList *wxFileConfigGroup::GetGroupLine() -{ - wxLogTrace( FILECONF_TRACE_MASK, - _T(" GetGroupLine() for Group '%s'"), - Name().c_str() ); - - if ( !m_pLine ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Getting Line item pointer") ); - - wxFileConfigGroup *pParent = Parent(); - - // this group wasn't present in local config file, add it now - if ( pParent ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" checking parent '%s'"), - pParent->Name().c_str() ); - - wxString strFullName; - - // add 1 to the name because we don't want to start with '/' - strFullName << wxT("[") - << FilterOutEntryName(GetFullName().c_str() + 1) - << wxT("]"); - m_pLine = m_pConfig->LineListInsert(strFullName, - pParent->GetLastGroupLine()); - pParent->SetLastGroup(this); // we're surely after all the others - } - //else: this is the root group and so we return NULL because we don't - // have any group line - } - - return m_pLine; -} - -// Return the last line belonging to the subgroups of this group (after which -// we can add a new subgroup), if we don't have any subgroups or entries our -// last line is the group line (m_pLine) itself. -wxFileConfigLineList *wxFileConfigGroup::GetLastGroupLine() -{ - // if we have any subgroups, our last line is the last line of the last - // subgroup - if ( m_pLastGroup ) - { - wxFileConfigLineList *pLine = m_pLastGroup->GetLastGroupLine(); - - wxASSERT_MSG( pLine, _T("last group must have !NULL associated line") ); - - return pLine; - } - - // no subgroups, so the last line is the line of thelast entry (if any) - return GetLastEntryLine(); -} - -// return the last line belonging to the entries of this group (after which -// we can add a new entry), if we don't have any entries we will add the new -// one immediately after the group line itself. -wxFileConfigLineList *wxFileConfigGroup::GetLastEntryLine() -{ - wxLogTrace( FILECONF_TRACE_MASK, - _T(" GetLastEntryLine() for Group '%s'"), - Name().c_str() ); - - if ( m_pLastEntry ) - { - wxFileConfigLineList *pLine = m_pLastEntry->GetLine(); - - wxASSERT_MSG( pLine, _T("last entry must have !NULL associated line") ); - - return pLine; - } - - // no entries: insert after the group header, if any - return GetGroupLine(); -} - -void wxFileConfigGroup::SetLastEntry(wxFileConfigEntry *pEntry) -{ - m_pLastEntry = pEntry; - - if ( !m_pLine ) - { - // the only situation in which a group without its own line can have - // an entry is when the first entry is added to the initially empty - // root pseudo-group - wxASSERT_MSG( !m_pParent, _T("unexpected for non root group") ); - - // let the group know that it does have a line in the file now - m_pLine = pEntry->GetLine(); - } -} - -// ---------------------------------------------------------------------------- -// group name -// ---------------------------------------------------------------------------- - -void wxFileConfigGroup::UpdateGroupAndSubgroupsLines() -{ - // update the line of this group - wxFileConfigLineList *line = GetGroupLine(); - wxCHECK_RET( line, _T("a non root group must have a corresponding line!") ); - - // +1: skip the leading '/' - line->SetText(wxString::Format(_T("[%s]"), GetFullName().c_str() + 1)); - - - // also update all subgroups as they have this groups name in their lines - const size_t nCount = m_aSubgroups.Count(); - for ( size_t n = 0; n < nCount; n++ ) - { - m_aSubgroups[n]->UpdateGroupAndSubgroupsLines(); - } -} - -void wxFileConfigGroup::Rename(const wxString& newName) -{ - wxCHECK_RET( m_pParent, _T("the root group can't be renamed") ); - - if ( newName == m_strName ) - return; - - // we need to remove the group from the parent and it back under the new - // name to keep the parents array of subgroups alphabetically sorted - m_pParent->m_aSubgroups.Remove(this); - - m_strName = newName; - - m_pParent->m_aSubgroups.Add(this); - - // update the group lines recursively - UpdateGroupAndSubgroupsLines(); -} - -wxString wxFileConfigGroup::GetFullName() const -{ - wxString fullname; - if ( Parent() ) - fullname = Parent()->GetFullName() + wxCONFIG_PATH_SEPARATOR + Name(); - - return fullname; -} - -// ---------------------------------------------------------------------------- -// find an item -// ---------------------------------------------------------------------------- - -// use binary search because the array is sorted -wxFileConfigEntry * -wxFileConfigGroup::FindEntry(const wxChar *szName) const -{ - size_t i, - lo = 0, - hi = m_aEntries.Count(); - int res; - wxFileConfigEntry *pEntry; - - while ( lo < hi ) { - i = (lo + hi)/2; - pEntry = m_aEntries[i]; - - #if wxCONFIG_CASE_SENSITIVE - res = wxStrcmp(pEntry->Name(), szName); - #else - res = wxStricmp(pEntry->Name(), szName); - #endif - - if ( res > 0 ) - hi = i; - else if ( res < 0 ) - lo = i + 1; - else - return pEntry; - } - - return NULL; -} - -wxFileConfigGroup * -wxFileConfigGroup::FindSubgroup(const wxChar *szName) const -{ - size_t i, - lo = 0, - hi = m_aSubgroups.Count(); - int res; - wxFileConfigGroup *pGroup; - - while ( lo < hi ) { - i = (lo + hi)/2; - pGroup = m_aSubgroups[i]; - - #if wxCONFIG_CASE_SENSITIVE - res = wxStrcmp(pGroup->Name(), szName); - #else - res = wxStricmp(pGroup->Name(), szName); - #endif - - if ( res > 0 ) - hi = i; - else if ( res < 0 ) - lo = i + 1; - else - return pGroup; - } - - return NULL; -} - -// ---------------------------------------------------------------------------- -// create a new item -// ---------------------------------------------------------------------------- - -// create a new entry and add it to the current group -wxFileConfigEntry *wxFileConfigGroup::AddEntry(const wxString& strName, int nLine) -{ - wxASSERT( FindEntry(strName) == 0 ); - - wxFileConfigEntry *pEntry = new wxFileConfigEntry(this, strName, nLine); - - m_aEntries.Add(pEntry); - return pEntry; -} - -// create a new group and add it to the current group -wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName) -{ - wxASSERT( FindSubgroup(strName) == 0 ); - - wxFileConfigGroup *pGroup = new wxFileConfigGroup(this, strName, m_pConfig); - - m_aSubgroups.Add(pGroup); - return pGroup; -} - -// ---------------------------------------------------------------------------- -// delete an item -// ---------------------------------------------------------------------------- - -/* - The delete operations are _very_ slow if we delete the last item of this - group (see comments before GetXXXLineXXX functions for more details), - so it's much better to start with the first entry/group if we want to - delete several of them. - */ - -bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName) -{ - wxFileConfigGroup * const pGroup = FindSubgroup(szName); - - return pGroup ? DeleteSubgroup(pGroup) : false; -} - -// Delete the subgroup and remove all references to it from -// other data structures. -bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) -{ - wxCHECK_MSG( pGroup, false, _T("deleting non existing group?") ); - - wxLogTrace( FILECONF_TRACE_MASK, - _T("Deleting group '%s' from '%s'"), - pGroup->Name().c_str(), - Name().c_str() ); - - wxLogTrace( FILECONF_TRACE_MASK, - _T(" (m_pLine) = prev: %p, this %p, next %p"), - m_pLine ? wx_static_cast(void*, m_pLine->Prev()) : 0, - wx_static_cast(void*, m_pLine), - m_pLine ? wx_static_cast(void*, m_pLine->Next()) : 0 ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" text: '%s'"), - m_pLine ? m_pLine->Text().c_str() : wxEmptyString ); - - // delete all entries... - size_t nCount = pGroup->m_aEntries.Count(); - - wxLogTrace(FILECONF_TRACE_MASK, - _T("Removing %lu entries"), (unsigned long)nCount ); - - for ( size_t nEntry = 0; nEntry < nCount; nEntry++ ) - { - wxFileConfigLineList *pLine = pGroup->m_aEntries[nEntry]->GetLine(); - - if ( pLine ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" '%s'"), - pLine->Text().c_str() ); - m_pConfig->LineListRemove(pLine); - } - } - - // ...and subgroups of this subgroup - nCount = pGroup->m_aSubgroups.Count(); - - wxLogTrace( FILECONF_TRACE_MASK, - _T("Removing %lu subgroups"), (unsigned long)nCount ); - - for ( size_t nGroup = 0; nGroup < nCount; nGroup++ ) - { - pGroup->DeleteSubgroup(pGroup->m_aSubgroups[0]); - } - - // and then finally the group itself - wxFileConfigLineList *pLine = pGroup->m_pLine; - if ( pLine ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Removing line for group '%s' : '%s'"), - pGroup->Name().c_str(), - pLine->Text().c_str() ); - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Removing from group '%s' : '%s'"), - Name().c_str(), - ((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) ); - - // notice that we may do this test inside the previous "if" - // because the last entry's line is surely !NULL - if ( pGroup == m_pLastGroup ) - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" Removing last group") ); - - // our last entry is being deleted, so find the last one which - // stays by going back until we find a subgroup or reach the - // group line - const size_t nSubgroups = m_aSubgroups.Count(); - - m_pLastGroup = NULL; - for ( wxFileConfigLineList *pl = pLine->Prev(); - pl && !m_pLastGroup; - pl = pl->Prev() ) - { - // does this line belong to our subgroup? - for ( size_t n = 0; n < nSubgroups; n++ ) - { - // do _not_ call GetGroupLine! we don't want to add it to - // the local file if it's not already there - if ( m_aSubgroups[n]->m_pLine == pl ) - { - m_pLastGroup = m_aSubgroups[n]; - break; - } - } - - if ( pl == m_pLine ) - break; - } - } - - m_pConfig->LineListRemove(pLine); - } - else - { - wxLogTrace( FILECONF_TRACE_MASK, - _T(" No line entry for Group '%s'?"), - pGroup->Name().c_str() ); - } - - m_aSubgroups.Remove(pGroup); - delete pGroup; - - return true; -} - -bool wxFileConfigGroup::DeleteEntry(const wxChar *szName) -{ - wxFileConfigEntry *pEntry = FindEntry(szName); - if ( !pEntry ) - { - // entry doesn't exist, nothing to do - return false; - } - - wxFileConfigLineList *pLine = pEntry->GetLine(); - if ( pLine != NULL ) { - // notice that we may do this test inside the previous "if" because the - // last entry's line is surely !NULL - if ( pEntry == m_pLastEntry ) { - // our last entry is being deleted - find the last one which stays - wxASSERT( m_pLine != NULL ); // if we have an entry with !NULL pLine... - - // find the previous entry (if any) - wxFileConfigEntry *pNewLast = NULL; - const wxFileConfigLineList * const - pNewLastLine = m_pLastEntry->GetLine()->Prev(); - const size_t nEntries = m_aEntries.GetCount(); - for ( size_t n = 0; n < nEntries; n++ ) { - if ( m_aEntries[n]->GetLine() == pNewLastLine ) { - pNewLast = m_aEntries[n]; - break; - } - } - - // pNewLast can be NULL here -- it's ok and can happen if we have no - // entries left - m_pLastEntry = pNewLast; - } - - m_pConfig->LineListRemove(pLine); - } - - m_aEntries.Remove(pEntry); - delete pEntry; - - return true; -} - -// ============================================================================ -// wxFileConfig::wxFileConfigEntry -// ============================================================================ - -// ---------------------------------------------------------------------------- -// ctor -// ---------------------------------------------------------------------------- -wxFileConfigEntry::wxFileConfigEntry(wxFileConfigGroup *pParent, - const wxString& strName, - int nLine) - : m_strName(strName) -{ - wxASSERT( !strName.empty() ); - - m_pParent = pParent; - m_nLine = nLine; - m_pLine = NULL; - - m_bHasValue = false; - - m_bImmutable = strName[0] == wxCONFIG_IMMUTABLE_PREFIX; - if ( m_bImmutable ) - m_strName.erase(0, 1); // remove first character -} - -// ---------------------------------------------------------------------------- -// set value -// ---------------------------------------------------------------------------- - -void wxFileConfigEntry::SetLine(wxFileConfigLineList *pLine) -{ - if ( m_pLine != NULL ) { - wxLogWarning(_("entry '%s' appears more than once in group '%s'"), - Name().c_str(), m_pParent->GetFullName().c_str()); - } - - m_pLine = pLine; - Group()->SetLastEntry(this); -} - -// second parameter is false if we read the value from file and prevents the -// entry from being marked as 'dirty' -void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) -{ - if ( bUser && IsImmutable() ) - { - wxLogWarning( _("attempt to change immutable key '%s' ignored."), - Name().c_str()); - return; - } - - // do nothing if it's the same value: but don't test for it if m_bHasValue - // hadn't been set yet or we'd never write empty values to the file - if ( m_bHasValue && strValue == m_strValue ) - return; - - m_bHasValue = true; - m_strValue = strValue; - - if ( bUser ) - { - wxString strValFiltered; - - if ( Group()->Config()->GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS ) - { - strValFiltered = strValue; - } - else { - strValFiltered = FilterOutValue(strValue); - } - - wxString strLine; - strLine << FilterOutEntryName(m_strName) << wxT('=') << strValFiltered; - - if ( m_pLine ) - { - // entry was read from the local config file, just modify the line - m_pLine->SetText(strLine); - } - else // this entry didn't exist in the local file - { - // add a new line to the file: note that line returned by - // GetLastEntryLine() may be NULL if we're in the root group and it - // doesn't have any entries yet, but this is ok as passing NULL - // line to LineListInsert() means to prepend new line to the list - wxFileConfigLineList *line = Group()->GetLastEntryLine(); - m_pLine = Group()->Config()->LineListInsert(strLine, line); - - Group()->SetLastEntry(this); - } - } -} - -// ============================================================================ -// global functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// compare functions for array sorting -// ---------------------------------------------------------------------------- - -int CompareEntries(wxFileConfigEntry *p1, wxFileConfigEntry *p2) -{ -#if wxCONFIG_CASE_SENSITIVE - return wxStrcmp(p1->Name(), p2->Name()); -#else - return wxStricmp(p1->Name(), p2->Name()); -#endif -} - -int CompareGroups(wxFileConfigGroup *p1, wxFileConfigGroup *p2) -{ -#if wxCONFIG_CASE_SENSITIVE - return wxStrcmp(p1->Name(), p2->Name()); -#else - return wxStricmp(p1->Name(), p2->Name()); -#endif -} - -// ---------------------------------------------------------------------------- -// filter functions -// ---------------------------------------------------------------------------- - -// undo FilterOutValue -static wxString FilterInValue(const wxString& str) -{ - wxString strResult; - strResult.Alloc(str.Len()); - - bool bQuoted = !str.empty() && str[0] == '"'; - - for ( size_t n = bQuoted ? 1 : 0; n < str.Len(); n++ ) { - if ( str[n] == wxT('\\') ) { - switch ( str[++n] ) { - case wxT('n'): - strResult += wxT('\n'); - break; - - case wxT('r'): - strResult += wxT('\r'); - break; - - case wxT('t'): - strResult += wxT('\t'); - break; - - case wxT('\\'): - strResult += wxT('\\'); - break; - - case wxT('"'): - strResult += wxT('"'); - break; - } - } - else { - if ( str[n] != wxT('"') || !bQuoted ) - strResult += str[n]; - else if ( n != str.Len() - 1 ) { - wxLogWarning(_("unexpected \" at position %d in '%s'."), - n, str.c_str()); - } - //else: it's the last quote of a quoted string, ok - } - } - - return strResult; -} - -// quote the string before writing it to file -static wxString FilterOutValue(const wxString& str) -{ - if ( !str ) - return str; - - wxString strResult; - strResult.Alloc(str.Len()); - - // quoting is necessary to preserve spaces in the beginning of the string - bool bQuote = wxIsspace(str[0]) || str[0] == wxT('"'); - - if ( bQuote ) - strResult += wxT('"'); - - wxChar c; - for ( size_t n = 0; n < str.Len(); n++ ) { - switch ( str[n] ) { - case wxT('\n'): - c = wxT('n'); - break; - - case wxT('\r'): - c = wxT('r'); - break; - - case wxT('\t'): - c = wxT('t'); - break; - - case wxT('\\'): - c = wxT('\\'); - break; - - case wxT('"'): - if ( bQuote ) { - c = wxT('"'); - break; - } - //else: fall through - - default: - strResult += str[n]; - continue; // nothing special to do - } - - // we get here only for special characters - strResult << wxT('\\') << c; - } - - if ( bQuote ) - strResult += wxT('"'); - - return strResult; -} - -// undo FilterOutEntryName -static wxString FilterInEntryName(const wxString& str) -{ - wxString strResult; - strResult.Alloc(str.Len()); - - for ( const wxChar *pc = str.c_str(); *pc != '\0'; pc++ ) { - if ( *pc == wxT('\\') ) { - // we need to test it here or we'd skip past the NUL in the loop line - if ( *++pc == _T('\0') ) - break; - } - - strResult += *pc; - } - - return strResult; -} - -// sanitize entry or group name: insert '\\' before any special characters -static wxString FilterOutEntryName(const wxString& str) -{ - wxString strResult; - strResult.Alloc(str.Len()); - - for ( const wxChar *pc = str.c_str(); *pc != wxT('\0'); pc++ ) { - const wxChar c = *pc; - - // we explicitly allow some of "safe" chars and 8bit ASCII characters - // which will probably never have special meaning and with which we can't - // use isalnum() anyhow (in ASCII built, in Unicode it's just fine) - // - // NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR - // should *not* be quoted - if ( -#if !wxUSE_UNICODE - ((unsigned char)c < 127) && -#endif // ANSI - !wxIsalnum(c) && !wxStrchr(wxT("@_/-!.*%"), c) ) - { - strResult += wxT('\\'); - } - - strResult += c; - } - - return strResult; -} - -// we can't put ?: in the ctor initializer list because it confuses some -// broken compilers (Borland C++) -static wxString GetAppName(const wxString& appName) -{ - if ( !appName && wxTheApp ) - return wxTheApp->GetAppName(); - else - return appName; -} - -#endif // wxUSE_CONFIG diff --git a/Source/3rdParty/wx/src/common/filefn.cpp b/Source/3rdParty/wx/src/common/filefn.cpp deleted file mode 100644 index b9700d4c4..000000000 --- a/Source/3rdParty/wx/src/common/filefn.cpp +++ /dev/null @@ -1,2123 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/filefn.cpp -// Purpose: File- and directory-related functions -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: filefn.cpp 66990 2011-02-22 12:10:44Z JS $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/filefn.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif - -#include "wx/file.h" -#include "wx/filename.h" -#include "wx/dir.h" - -#include "wx/tokenzr.h" - -// there are just too many of those... -#ifdef __VISUALC__ - #pragma warning(disable:4706) // assignment within conditional expression -#endif // VC++ - -#include -#include -#include -#include -#if !wxONLY_WATCOM_EARLIER_THAN(1,4) - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif -#endif - -#if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers -#endif - -#ifdef __WINDOWS__ - #include "wx/msw/private.h" - #include "wx/msw/mslu.h" - - // sys/cygwin.h is needed for cygwin_conv_to_full_win32_path() - // - // note that it must be included after - #ifdef __GNUWIN32__ - #ifdef __CYGWIN__ - #include - #endif - #endif // __GNUWIN32__ - - // io.h is needed for _get_osfhandle() - // Already included by filefn.h for many Windows compilers - #if defined __MWERKS__ || defined __CYGWIN__ - #include - #endif -#endif // __WINDOWS__ - -#if defined(__VMS__) - #include -#endif - -// TODO: Borland probably has _wgetcwd as well? -#ifdef _MSC_VER - #define HAVE_WGETCWD -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifndef _MAXPATHLEN - #define _MAXPATHLEN 1024 -#endif - -#ifdef __WXMAC__ -# include "MoreFilesX.h" -#endif - -// ---------------------------------------------------------------------------- -// private globals -// ---------------------------------------------------------------------------- - -// MT-FIXME: get rid of this horror and all code using it -static wxChar wxFileFunctionsBuffer[4*_MAXPATHLEN]; - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -// -// VisualAge C++ V4.0 cannot have any external linkage const decs -// in headers included by more than one primary source -// -const int wxInvalidOffset = -1; -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// translate the filenames before passing them to OS functions -#define OS_FILENAME(s) (s.fn_str()) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wrappers around standard POSIX functions -// ---------------------------------------------------------------------------- - -#ifdef wxNEED_WX_UNISTD_H - -WXDLLEXPORT int wxStat( const wxChar *file_name, wxStructStat *buf ) -{ - return stat( wxConvFile.cWX2MB( file_name ), buf ); -} - -WXDLLEXPORT int wxLstat( const wxChar *file_name, wxStructStat *buf ) -{ - return lstat( wxConvFile.cWX2MB( file_name ), buf ); -} - -WXDLLEXPORT int wxAccess( const wxChar *pathname, int mode ) -{ - return access( wxConvFile.cWX2MB( pathname ), mode ); -} - -WXDLLEXPORT int wxOpen( const wxChar *pathname, int flags, mode_t mode ) -{ - return open( wxConvFile.cWX2MB( pathname ), flags, mode ); -} - -#endif // wxNEED_WX_UNISTD_H - -#if wxUSE_UNICODE && defined __BORLANDC__ \ - && __BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551 - -// BCC 5.5 and 5.5.1 have a bug in _wopen where files are created read only -// regardless of the mode parameter. This hack works around the problem by -// setting the mode with _wchmod. -// -int wxOpen(const wchar_t *pathname, int flags, mode_t mode) -{ - int moreflags = 0; - - // we only want to fix the mode when the file is actually created, so - // when creating first try doing it O_EXCL so we can tell if the file - // was already there. - if ((flags & O_CREAT) && !(flags & O_EXCL) && (mode & wxS_IWUSR) != 0) - moreflags = O_EXCL; - - int fd = _wopen(pathname, flags | moreflags, mode); - - // the file was actually created and needs fixing - if (fd != -1 && (flags & O_CREAT) != 0 && (mode & wxS_IWUSR) != 0) - { - close(fd); - _wchmod(pathname, mode); - fd = _wopen(pathname, flags & ~(O_EXCL | O_CREAT)); - } - // the open failed, but it may have been because the added O_EXCL stopped - // the opening of an existing file, so try again without. - else if (fd == -1 && moreflags != 0) - { - fd = _wopen(pathname, flags & ~O_CREAT); - } - - return fd; -} - -#endif - -// ---------------------------------------------------------------------------- -// wxPathList -// ---------------------------------------------------------------------------- - -bool wxPathList::Add(const wxString& path) -{ - // add a path separator to force wxFileName to interpret it always as a directory - // (i.e. if we are called with '/home/user' we want to consider it a folder and - // not, as wxFileName would consider, a filename). - wxFileName fn(path + wxFileName::GetPathSeparator()); - - // add only normalized relative/absolute paths - // NB: we won't do wxPATH_NORM_DOTS in order to avoid problems when trying to - // normalize paths which starts with ".." (which can be normalized only if - // we use also wxPATH_NORM_ABSOLUTE - which we don't want to use). - if (!fn.Normalize(wxPATH_NORM_TILDE|wxPATH_NORM_LONG|wxPATH_NORM_ENV_VARS)) - return false; - - wxString toadd = fn.GetPath(); - if (Index(toadd) == wxNOT_FOUND) - wxArrayString::Add(toadd); // do not add duplicates - - return true; -} - -void wxPathList::Add(const wxArrayString &arr) -{ - for (size_t j=0; j < arr.GetCount(); j++) - Add(arr[j]); -} - -// Add paths e.g. from the PATH environment variable -void wxPathList::AddEnvList (const wxString& WXUNUSED_IN_WINCE(envVariable)) -{ - // No environment variables on WinCE -#ifndef __WXWINCE__ - - // The space has been removed from the tokenizers, otherwise a - // path such as "C:\Program Files" would be split into 2 paths: - // "C:\Program" and "Files"; this is true for both Windows and Unix. - - static const wxChar PATH_TOKS[] = -#if defined(__WINDOWS__) || defined(__OS2__) - wxT(";"); // Don't separate with colon in DOS (used for drive) -#else - wxT(":;"); -#endif - - wxString val; - if ( wxGetEnv(envVariable, &val) ) - { - // split into an array of string the value of the env var - wxArrayString arr = wxStringTokenize(val, PATH_TOKS); - WX_APPEND_ARRAY(*this, arr); - } -#endif // !__WXWINCE__ -} - -// Given a full filename (with path), ensure that that file can -// be accessed again USING FILENAME ONLY by adding the path -// to the list if not already there. -bool wxPathList::EnsureFileAccessible (const wxString& path) -{ - return Add(wxPathOnly(path)); -} - -#if WXWIN_COMPATIBILITY_2_6 -bool wxPathList::Member (const wxString& path) const -{ - return Index(path) != wxNOT_FOUND; -} -#endif - -wxString wxPathList::FindValidPath (const wxString& file) const -{ - // normalize the given string as it could be a path + a filename - // and not only a filename - wxFileName fn(file); - wxString strend; - - // NB: normalize without making absolute otherwise calling this function with - // e.g. "b/c.txt" would result in removing the directory 'b' and the for loop - // below would only add to the paths of this list the 'c.txt' part when doing - // the existence checks... - // NB: we don't use wxPATH_NORM_DOTS here, too (see wxPathList::Add for more info) - if (!fn.Normalize(wxPATH_NORM_TILDE|wxPATH_NORM_LONG|wxPATH_NORM_ENV_VARS)) - return wxEmptyString; - - wxASSERT_MSG(!fn.IsDir(), wxT("Cannot search for directories; only for files")); - if (fn.IsAbsolute()) - strend = fn.GetFullName(); // search for the file name and ignore the path part - else - strend = fn.GetFullPath(); - - for (size_t i=0; i 0) - { - if (buffer[i] == wxT('.')) - { - buffer[i] = 0; - break; - } - i --; - } -} - -void wxStripExtension(wxString& buffer) -{ - //RN: Be careful about the handling the case where - //buffer.length() == 0 - for(size_t i = buffer.length() - 1; i != wxString::npos; --i) - { - if (buffer.GetChar(i) == wxT('.')) - { - buffer = buffer.Left(i); - break; - } - } -} - -// Destructive removal of /./ and /../ stuff -wxChar *wxRealPath (wxChar *path) -{ -#ifdef __WXMSW__ - static const wxChar SEP = wxT('\\'); - wxUnix2DosFilename(path); -#else - static const wxChar SEP = wxT('/'); -#endif - if (path[0] && path[1]) { - /* MATTHEW: special case "/./x" */ - wxChar *p; - if (path[2] == SEP && path[1] == wxT('.')) - p = &path[0]; - else - p = &path[2]; - for (; *p; p++) - { - if (*p == SEP) - { - if (p[1] == wxT('.') && p[2] == wxT('.') && (p[3] == SEP || p[3] == wxT('\0'))) - { - wxChar *q; - for (q = p - 1; q >= path && *q != SEP; q--) - { - // Empty - } - - if (q[0] == SEP && (q[1] != wxT('.') || q[2] != wxT('.') || q[3] != SEP) - && (q - 1 <= path || q[-1] != SEP)) - { - wxStrcpy (q, p + 3); - if (path[0] == wxT('\0')) - { - path[0] = SEP; - path[1] = wxT('\0'); - } -#if defined(__WXMSW__) || defined(__OS2__) - /* Check that path[2] is NULL! */ - else if (path[1] == wxT(':') && !path[2]) - { - path[2] = SEP; - path[3] = wxT('\0'); - } -#endif - p = q - 1; - } - } - else if (p[1] == wxT('.') && (p[2] == SEP || p[2] == wxT('\0'))) - wxStrcpy (p, p + 2); - } - } - } - return path; -} - -wxString wxRealPath(const wxString& path) -{ - wxChar *buf1=MYcopystring(path); - wxChar *buf2=wxRealPath(buf1); - wxString buf(buf2); - delete [] buf1; - return buf; -} - - -// Must be destroyed -wxChar *wxCopyAbsolutePath(const wxString& filename) -{ - if (filename.empty()) - return (wxChar *) NULL; - - if (! wxIsAbsolutePath(wxExpandPath(wxFileFunctionsBuffer, filename))) - { - wxString buf = ::wxGetCwd(); - wxChar ch = buf.Last(); -#ifdef __WXMSW__ - if (ch != wxT('\\') && ch != wxT('/')) - buf << wxT("\\"); -#else - if (ch != wxT('/')) - buf << wxT("/"); -#endif - buf << wxFileFunctionsBuffer; - buf = wxRealPath( buf ); - return MYcopystring( buf ); - } - return MYcopystring( wxFileFunctionsBuffer ); -} - -/*- - Handles: - ~/ => home dir - ~user/ => user's home dir - If the environment variable a = "foo" and b = "bar" then: - Unix: - $a => foo - $a$b => foobar - $a.c => foo.c - xxx$a => xxxfoo - ${a}! => foo! - $(b)! => bar! - \$a => \$a - MSDOS: - $a ==> $a - $(a) ==> foo - $(a)$b ==> foo$b - $(a)$(b)==> foobar - test.$$ ==> test.$$ - */ - -/* input name in name, pathname output to buf. */ - -wxChar *wxExpandPath(wxChar *buf, const wxChar *name) -{ - register wxChar *d, *s, *nm; - wxChar lnm[_MAXPATHLEN]; - int q; - - // Some compilers don't like this line. -// const wxChar trimchars[] = wxT("\n \t"); - - wxChar trimchars[4]; - trimchars[0] = wxT('\n'); - trimchars[1] = wxT(' '); - trimchars[2] = wxT('\t'); - trimchars[3] = 0; - -#ifdef __WXMSW__ - const wxChar SEP = wxT('\\'); -#else - const wxChar SEP = wxT('/'); -#endif - buf[0] = wxT('\0'); - if (name == NULL || *name == wxT('\0')) - return buf; - nm = MYcopystring(name); // Make a scratch copy - wxChar *nm_tmp = nm; - - /* Skip leading whitespace and cr */ - while (wxStrchr((wxChar *)trimchars, *nm) != NULL) - nm++; - /* And strip off trailing whitespace and cr */ - s = nm + (q = wxStrlen(nm)) - 1; - while (q-- && wxStrchr((wxChar *)trimchars, *s) != NULL) - *s = wxT('\0'); - - s = nm; - d = lnm; -#ifdef __WXMSW__ - q = FALSE; -#else - q = nm[0] == wxT('\\') && nm[1] == wxT('~'); -#endif - - /* Expand inline environment variables */ -#ifdef __VISAGECPP__ - while (*d) - { - *d++ = *s; - if(*s == wxT('\\')) - { - *(d - 1) = *++s; - if (*d) - { - s++; - continue; - } - else - break; - } - else -#else - while ((*d++ = *s) != 0) { -# ifndef __WXMSW__ - if (*s == wxT('\\')) { - if ((*(d - 1) = *++s)!=0) { - s++; - continue; - } else - break; - } else -# endif -#endif - // No env variables on WinCE -#ifndef __WXWINCE__ -#ifdef __WXMSW__ - if (*s++ == wxT('$') && (*s == wxT('{') || *s == wxT(')'))) -#else - if (*s++ == wxT('$')) -#endif - { - register wxChar *start = d; - register int braces = (*s == wxT('{') || *s == wxT('(')); - register wxChar *value; - while ((*d++ = *s) != 0) - if (braces ? (*s == wxT('}') || *s == wxT(')')) : !(wxIsalnum(*s) || *s == wxT('_')) ) - break; - else - s++; - *--d = 0; - value = wxGetenv(braces ? start + 1 : start); - if (value) { - for ((d = start - 1); (*d++ = *value++) != 0;) - { - // Empty - } - - d--; - if (braces && *s) - s++; - } - } -#endif - // __WXWINCE__ - } - - /* Expand ~ and ~user */ - nm = lnm; - if (nm[0] == wxT('~') && !q) - { - /* prefix ~ */ - if (nm[1] == SEP || nm[1] == 0) - { /* ~/filename */ - // FIXME: wxGetUserHome could return temporary storage in Unicode mode - if ((s = WXSTRINGCAST wxGetUserHome(wxEmptyString)) != NULL) { - if (*++nm) - nm++; - } - } else - { /* ~user/filename */ - register wxChar *nnm; - register wxChar *home; - for (s = nm; *s && *s != SEP; s++) - { - // Empty - } - int was_sep; /* MATTHEW: Was there a separator, or NULL? */ - was_sep = (*s == SEP); - nnm = *s ? s + 1 : s; - *s = 0; - // FIXME: wxGetUserHome could return temporary storage in Unicode mode - if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) - { - if (was_sep) /* replace only if it was there: */ - *s = SEP; - s = NULL; - } - else - { - nm = nnm; - s = home; - } - } - } - - d = buf; - if (s && *s) { /* MATTHEW: s could be NULL if user '~' didn't exist */ - /* Copy home dir */ - while (wxT('\0') != (*d++ = *s++)) - /* loop */; - // Handle root home - if (d - 1 > buf && *(d - 2) != SEP) - *(d - 1) = SEP; - } - s = nm; - while ((*d++ = *s++) != 0) - { - // Empty - } - delete[] nm_tmp; // clean up alloc - /* Now clean up the buffer */ - return wxRealPath(buf); -} - -/* Contract Paths to be build upon an environment variable - component: - - example: "/usr/openwin/lib", OPENWINHOME --> ${OPENWINHOME}/lib - - The call wxExpandPath can convert these back! - */ -wxChar * -wxContractPath (const wxString& filename, - const wxString& WXUNUSED_IN_WINCE(envname), - const wxString& user) -{ - static wxChar dest[_MAXPATHLEN]; - - if (filename.empty()) - return (wxChar *) NULL; - - wxStrcpy (dest, WXSTRINGCAST filename); -#ifdef __WXMSW__ - wxUnix2DosFilename(dest); -#endif - - // Handle environment - const wxChar *val; -#ifndef __WXWINCE__ - wxChar *tcp; - if (!envname.empty() && (val = wxGetenv (WXSTRINGCAST envname)) != NULL && - (tcp = wxStrstr (dest, val)) != NULL) - { - wxStrcpy (wxFileFunctionsBuffer, tcp + wxStrlen (val)); - *tcp++ = wxT('$'); - *tcp++ = wxT('{'); - wxStrcpy (tcp, WXSTRINGCAST envname); - wxStrcat (tcp, wxT("}")); - wxStrcat (tcp, wxFileFunctionsBuffer); - } -#endif - - // Handle User's home (ignore root homes!) - val = wxGetUserHome (user); - if (!val) - return dest; - - const size_t len = wxStrlen(val); - if (len <= 2) - return dest; - - if (wxStrncmp(dest, val, len) == 0) - { - wxStrcpy(wxFileFunctionsBuffer, wxT("~")); - if (!user.empty()) - wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user); - wxStrcat(wxFileFunctionsBuffer, dest + len); - wxStrcpy (dest, wxFileFunctionsBuffer); - } - - return dest; -} - -// Return just the filename, not the path (basename) -wxChar *wxFileNameFromPath (wxChar *path) -{ - wxString p = path; - wxString n = wxFileNameFromPath(p); - - return path + p.length() - n.length(); -} - -wxString wxFileNameFromPath (const wxString& path) -{ - wxString name, ext; - wxFileName::SplitPath(path, NULL, &name, &ext); - - wxString fullname = name; - if ( !ext.empty() ) - { - fullname << wxFILE_SEP_EXT << ext; - } - - return fullname; -} - -// Return just the directory, or NULL if no directory -wxChar * -wxPathOnly (wxChar *path) -{ - if (path && *path) - { - static wxChar buf[_MAXPATHLEN]; - - // Local copy - wxStrcpy (buf, path); - - int l = wxStrlen(path); - int i = l - 1; - - // Search backward for a backward or forward slash - while (i > -1) - { -#if defined(__WXMAC__) && !defined(__DARWIN__) - // Classic or Carbon CodeWarrior like - // Carbon with Apple DevTools is Unix like - if (path[i] == wxT(':') ) - { - buf[i] = 0; - return buf; - } -#else - // Unix like or Windows - if (path[i] == wxT('/') || path[i] == wxT('\\')) - { - buf[i] = 0; - return buf; - } -#endif -#ifdef __VMS__ - if (path[i] == wxT(']')) - { - buf[i+1] = 0; - return buf; - } -#endif - i --; - } - -#if defined(__WXMSW__) || defined(__OS2__) - // Try Drive specifier - if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) - { - // A:junk --> A:. (since A:.\junk Not A:\junk) - buf[2] = wxT('.'); - buf[3] = wxT('\0'); - return buf; - } -#endif - } - return (wxChar *) NULL; -} - -// Return just the directory, or NULL if no directory -wxString wxPathOnly (const wxString& path) -{ - if (!path.empty()) - { - wxChar buf[_MAXPATHLEN]; - - // Local copy - wxStrcpy (buf, WXSTRINGCAST path); - - int l = path.length(); - int i = l - 1; - - // Search backward for a backward or forward slash - while (i > -1) - { -#if defined(__WXMAC__) && !defined(__DARWIN__) - // Classic or Carbon CodeWarrior like - // Carbon with Apple DevTools is Unix like - if (path[i] == wxT(':') ) - { - buf[i] = 0; - return wxString(buf); - } -#else - // Unix like or Windows - if (path[i] == wxT('/') || path[i] == wxT('\\')) - { - // Don't return an empty string - if (i == 0) - i ++; - buf[i] = 0; - return wxString(buf); - } -#endif -#ifdef __VMS__ - if (path[i] == wxT(']')) - { - buf[i+1] = 0; - return wxString(buf); - } -#endif - i --; - } - -#if defined(__WXMSW__) || defined(__OS2__) - // Try Drive specifier - if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) - { - // A:junk --> A:. (since A:.\junk Not A:\junk) - buf[2] = wxT('.'); - buf[3] = wxT('\0'); - return wxString(buf); - } -#endif - } - return wxEmptyString; -} - -// Utility for converting delimiters in DOS filenames to UNIX style -// and back again - or we get nasty problems with delimiters. -// Also, convert to lower case, since case is significant in UNIX. - -#if defined(__WXMAC__) - -#if TARGET_API_MAC_OSX -#define kDefaultPathStyle kCFURLPOSIXPathStyle -#else -#define kDefaultPathStyle kCFURLHFSPathStyle -#endif - -wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent ) -{ - CFURLRef fullURLRef; - fullURLRef = CFURLCreateFromFSRef(NULL, fsRef); - if ( additionalPathComponent ) - { - CFURLRef parentURLRef = fullURLRef ; - fullURLRef = CFURLCreateCopyAppendingPathComponent(NULL, parentURLRef, - additionalPathComponent,false); - CFRelease( parentURLRef ) ; - } - CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle); - CFRelease( fullURLRef ) ; - CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString); - CFRelease( cfString ); - CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); - return wxMacCFStringHolder(cfMutableString).AsString(); -} - -OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) -{ - OSStatus err = noErr ; - CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(path)); - CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); - CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kDefaultPathStyle, false); - CFRelease( cfMutableString ); - if ( NULL != url ) - { - if ( CFURLGetFSRef(url, fsRef) == false ) - err = fnfErr ; - CFRelease( url ) ; - } - else - { - err = fnfErr ; - } - return err ; -} - -wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ) -{ - CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault, - uniname->unicode, - uniname->length ); - CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfname); - CFRelease( cfname ); - CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); - return wxMacCFStringHolder(cfMutableString).AsString() ; -} - -#ifndef __LP64__ - -wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) -{ - FSRef fsRef ; - if ( FSpMakeFSRef( spec , &fsRef) == noErr ) - { - return wxMacFSRefToPath( &fsRef ) ; - } - return wxEmptyString ; -} - -void wxMacFilename2FSSpec( const wxString& path , FSSpec *spec ) -{ - OSStatus err = noErr ; - FSRef fsRef ; - wxMacPathToFSRef( path , &fsRef ) ; - err = FSRefMakeFSSpec( &fsRef , spec ) ; -} -#endif - -#endif // __WXMAC__ - -void -wxDos2UnixFilename (wxChar *s) -{ - if (s) - while (*s) - { - if (*s == _T('\\')) - *s = _T('/'); -#ifdef __WXMSW__ - else - *s = (wxChar)wxTolower (*s); // Case INDEPENDENT -#endif - s++; - } -} - -void -#if defined(__WXMSW__) || defined(__OS2__) -wxUnix2DosFilename (wxChar *s) -#else -wxUnix2DosFilename (wxChar *WXUNUSED(s) ) -#endif -{ -// Yes, I really mean this to happen under DOS only! JACS -#if defined(__WXMSW__) || defined(__OS2__) - if (s) - while (*s) - { - if (*s == wxT('/')) - *s = wxT('\\'); - s++; - } -#endif -} - -// Concatenate two files to form third -bool -wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& file3) -{ -#if wxUSE_FILE - - wxFile in1(file1), in2(file2); - wxTempFile out(file3); - - if ( !in1.IsOpened() || !in2.IsOpened() || !out.IsOpened() ) - return false; - - ssize_t ofs; - unsigned char buf[1024]; - - for( int i=0; i<2; i++) - { - wxFile *in = i==0 ? &in1 : &in2; - do{ - if ( (ofs = in->Read(buf,WXSIZEOF(buf))) == wxInvalidOffset ) return false; - if ( ofs > 0 ) - if ( !out.Write(buf,ofs) ) - return false; - } while ( ofs == (ssize_t)WXSIZEOF(buf) ); - } - - return out.Commit(); - -#else - - wxUnusedVar(file1); - wxUnusedVar(file2); - wxUnusedVar(file3); - return false; - -#endif -} - -// Copy files -bool -wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) -{ -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - // CopyFile() copies file attributes and modification time too, so use it - // instead of our code if available - // - // NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite - if ( !::CopyFile(file1, file2, !overwrite) ) - { - wxLogSysError(_("Failed to copy the file '%s' to '%s'"), - file1.c_str(), file2.c_str()); - - return false; - } -#elif defined(__OS2__) - if ( ::DosCopy((PSZ)file1.c_str(), (PSZ)file2.c_str(), overwrite ? DCPY_EXISTING : 0) != 0 ) - return false; -#elif defined(__PALMOS__) - // TODO with http://www.palmos.com/dev/support/docs/protein_books/Memory_Databases_Files/ - return false; -#elif wxUSE_FILE // !Win32 - - wxStructStat fbuf; - // get permissions of file1 - if ( wxStat( file1.c_str(), &fbuf) != 0 ) - { - // the file probably doesn't exist or we haven't the rights to read - // from it anyhow - wxLogSysError(_("Impossible to get permissions for file '%s'"), - file1.c_str()); - return false; - } - - // open file1 for reading - wxFile fileIn(file1, wxFile::read); - if ( !fileIn.IsOpened() ) - return false; - - // remove file2, if it exists. This is needed for creating - // file2 with the correct permissions in the next step - if ( wxFileExists(file2) && (!overwrite || !wxRemoveFile(file2))) - { - wxLogSysError(_("Impossible to overwrite the file '%s'"), - file2.c_str()); - return false; - } - - // reset the umask as we want to create the file with exactly the same - // permissions as the original one - wxCHANGE_UMASK(0); - - // create file2 with the same permissions than file1 and open it for - // writing - - wxFile fileOut; - if ( !fileOut.Create(file2, overwrite, fbuf.st_mode & 0777) ) - return false; - - // copy contents of file1 to file2 - char buf[4096]; - size_t count; - for ( ;; ) - { - count = fileIn.Read(buf, WXSIZEOF(buf)); - if ( fileIn.Error() ) - return false; - - // end of file? - if ( !count ) - break; - - if ( fileOut.Write(buf, count) < count ) - return false; - } - - // we can expect fileIn to be closed successfully, but we should ensure - // that fileOut was closed as some write errors (disk full) might not be - // detected before doing this - if ( !fileIn.Close() || !fileOut.Close() ) - return false; - -#if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__) - // no chmod in VA. Should be some permission API for HPFS386 partitions - // however - if ( chmod(OS_FILENAME(file2), fbuf.st_mode) != 0 ) - { - wxLogSysError(_("Impossible to set permissions for the file '%s'"), - file2.c_str()); - return false; - } -#endif // OS/2 || Mac - -#else // !Win32 && ! wxUSE_FILE - - // impossible to simulate with wxWidgets API - wxUnusedVar(file1); - wxUnusedVar(file2); - wxUnusedVar(overwrite); - return false; - -#endif // __WXMSW__ && __WIN32__ - - return true; -} - -bool -wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite) -{ - if ( !overwrite && wxFileExists(file2) ) - { - wxLogSysError - ( - _("Failed to rename the file '%s' to '%s' because the destination file already exists."), - file1.c_str(), file2.c_str() - ); - - return false; - } - -#if !defined(__WXWINCE__) && !defined(__WXPALMOS__) - // Normal system call - if ( wxRename (file1, file2) == 0 ) - return true; -#endif - - // Try to copy - if (wxCopyFile(file1, file2, overwrite)) { - wxRemoveFile(file1); - return true; - } - // Give up - return false; -} - -bool wxRemoveFile(const wxString& file) -{ -#if defined(__VISUALC__) \ - || defined(__BORLANDC__) \ - || defined(__WATCOMC__) \ - || defined(__DMC__) \ - || defined(__GNUWIN32__) \ - || (defined(__MWERKS__) && defined(__MSL__)) - int res = wxRemove(file); -#elif defined(__WXMAC__) - int res = unlink(wxFNCONV(file)); -#elif defined(__WXPALMOS__) - int res = 1; - // TODO with VFSFileDelete() -#else - int res = unlink(OS_FILENAME(file)); -#endif - - return res == 0; -} - -bool wxMkdir(const wxString& dir, int perm) -{ -#if defined(__WXPALMOS__) - return false; -#elif defined(__WXMAC__) && !defined(__UNIX__) - return (mkdir( wxFNCONV(dir) , 0 ) == 0); -#else // !Mac - const wxChar *dirname = dir.c_str(); - - // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too - // for the GNU compiler -#if (!(defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WINE__) || defined(__WXMICROWIN__) - #if defined(MSVCRT) - wxUnusedVar(perm); - if ( mkdir(wxFNCONV(dirname)) != 0 ) - #else - if ( mkdir(wxFNCONV(dirname), perm) != 0 ) - #endif -#elif defined(__OS2__) - wxUnusedVar(perm); - if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's?? -#elif defined(__DOS__) - #if defined(__WATCOMC__) - (void)perm; - if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) - #elif defined(__DJGPP__) - if ( mkdir(wxFNCONV(dirname), perm) != 0 ) - #else - #error "Unsupported DOS compiler!" - #endif -#else // !MSW, !DOS and !OS/2 VAC++ - wxUnusedVar(perm); -#ifdef __WXWINCE__ - if ( !CreateDirectory(dirname, NULL) ) -#else - if ( wxMkDir(dir.fn_str()) != 0 ) -#endif -#endif // !MSW/MSW - { - wxLogSysError(_("Directory '%s' couldn't be created"), dirname); - - return false; - } - - return true; -#endif // Mac/!Mac -} - -bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) -{ -#if defined(__VMS__) - return false; //to be changed since rmdir exists in VMS7.x -#elif defined(__OS2__) - return (::DosDeleteDir((PSZ)dir.c_str()) == 0); -#elif defined(__WXWINCE__) - return (RemoveDirectory(dir) != 0); -#elif defined(__WXPALMOS__) - // TODO with VFSFileRename() - return false; -#else - return (wxRmDir(OS_FILENAME(dir)) == 0); -#endif -} - -// does the path exists? (may have or not '/' or '\\' at the end) -bool wxDirExists(const wxChar *pszPathName) -{ - wxString strPath(pszPathName); - -#if defined(__WINDOWS__) || defined(__OS2__) - // Windows fails to find directory named "c:\dir\" even if "c:\dir" exists, - // so remove all trailing backslashes from the path - but don't do this for - // the paths "d:\" (which are different from "d:") nor for just "\" - while ( wxEndsWithPathSeparator(strPath) ) - { - size_t len = strPath.length(); - if ( len == 1 || (len == 3 && strPath[len - 2] == _T(':')) ) - break; - - strPath.Truncate(len - 1); - } -#endif // __WINDOWS__ - -#ifdef __OS2__ - // OS/2 can't handle "d:", it wants either "d:\" or "d:." - if (strPath.length() == 2 && strPath[1u] == _T(':')) - strPath << _T('.'); -#endif - -#if defined(__WXPALMOS__) - return false; -#elif defined(__WIN32__) && !defined(__WXMICROWIN__) - // stat() can't cope with network paths - DWORD ret = ::GetFileAttributes(strPath); - - return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY); -#elif defined(__OS2__) - FILESTATUS3 Info = {{0}}; - APIRET rc = ::DosQueryPathInfo((PSZ)(WXSTRINGCAST strPath), FIL_STANDARD, - (void*) &Info, sizeof(FILESTATUS3)); - - return ((rc == NO_ERROR) && (Info.attrFile & FILE_DIRECTORY)) || - (rc == ERROR_SHARING_VIOLATION); - // If we got a sharing violation, there must be something with this name. -#else // !__WIN32__ - - wxStructStat st; -#ifndef __VISAGECPP__ - return wxStat(strPath.c_str(), &st) == 0 && ((st.st_mode & S_IFMT) == S_IFDIR); -#else - // S_IFMT not supported in VA compilers.. st_mode is a 2byte value only - return wxStat(pszPathName, &st) == 0 && (st.st_mode == S_IFDIR); -#endif - -#endif // __WIN32__/!__WIN32__ -} - -// Get a temporary filename, opening and closing the file. -wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) -{ - wxString filename; - if ( !wxGetTempFileName(prefix, filename) ) - return NULL; - - if ( buf ) - wxStrcpy(buf, filename); - else - buf = MYcopystring(filename); - - return buf; -} - -bool wxGetTempFileName(const wxString& prefix, wxString& buf) -{ -#if wxUSE_FILE - buf = wxFileName::CreateTempFileName(prefix); - - return !buf.empty(); -#else // !wxUSE_FILE - wxUnusedVar(prefix); - wxUnusedVar(buf); - - return false; -#endif // wxUSE_FILE/!wxUSE_FILE -} - -// Get first file name matching given wild card. - -static wxDir *gs_dir = NULL; -static wxString gs_dirPath; - -wxString wxFindFirstFile(const wxChar *spec, int flags) -{ - wxSplitPath(spec, &gs_dirPath, NULL, NULL); - if ( gs_dirPath.empty() ) - gs_dirPath = wxT("."); - if ( !wxEndsWithPathSeparator(gs_dirPath ) ) - gs_dirPath << wxFILE_SEP_PATH; - - if (gs_dir) - delete gs_dir; - gs_dir = new wxDir(gs_dirPath); - - if ( !gs_dir->IsOpened() ) - { - wxLogSysError(_("Can not enumerate files '%s'"), spec); - return wxEmptyString; - } - - int dirFlags; - switch (flags) - { - case wxDIR: dirFlags = wxDIR_DIRS; break; - case wxFILE: dirFlags = wxDIR_FILES; break; - default: dirFlags = wxDIR_DIRS | wxDIR_FILES; break; - } - - wxString result; - gs_dir->GetFirst(&result, wxFileNameFromPath(wxString(spec)), dirFlags); - if ( result.empty() ) - { - wxDELETE(gs_dir); - return result; - } - - return gs_dirPath + result; -} - -wxString wxFindNextFile() -{ - wxASSERT_MSG( gs_dir, wxT("You must call wxFindFirstFile before!") ); - - wxString result; - gs_dir->GetNext(&result); - - if ( result.empty() ) - { - wxDELETE(gs_dir); - return result; - } - - return gs_dirPath + result; -} - - -// Get current working directory. -// If buf is NULL, allocates space using new, else copies into buf. -// wxGetWorkingDirectory() is obsolete, use wxGetCwd() -// wxDoGetCwd() is their common core to be moved -// to wxGetCwd() once wxGetWorkingDirectory() will be removed. -// Do not expose wxDoGetCwd in headers! - -wxChar *wxDoGetCwd(wxChar *buf, int sz) -{ -#if defined(__WXPALMOS__) - // TODO - if(buf && sz>0) buf[0] = _T('\0'); - return buf; -#elif defined(__WXWINCE__) - // TODO - if(buf && sz>0) buf[0] = _T('\0'); - return buf; -#else - if ( !buf ) - { - buf = new wxChar[sz + 1]; - } - - bool ok wxDUMMY_INITIALIZE(false); - - // for the compilers which have Unicode version of _getcwd(), call it - // directly, for the others call the ANSI version and do the translation -#if !wxUSE_UNICODE - #define cbuf buf -#else // wxUSE_UNICODE - bool needsANSI = true; - - #if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU - char cbuf[_MAXPATHLEN]; - #endif - - #ifdef HAVE_WGETCWD - #if wxUSE_UNICODE_MSLU - if ( wxGetOsVersion() != wxOS_WINDOWS_9X ) - #else - char *cbuf = NULL; // never really used because needsANSI will always be false - #endif - { - ok = _wgetcwd(buf, sz) != NULL; - needsANSI = false; - } - #endif - - if ( needsANSI ) -#endif // wxUSE_UNICODE - { - #if defined(_MSC_VER) || defined(__MINGW32__) - ok = _getcwd(cbuf, sz) != NULL; - #elif defined(__WXMAC__) && !defined(__DARWIN__) - char lbuf[1024] ; - if ( getcwd( lbuf , sizeof( lbuf ) ) ) - { - wxString res( lbuf , *wxConvCurrent ) ; - wxStrcpy( buf , res ) ; - ok = true; - } - else - ok = false ; - #elif defined(__OS2__) - APIRET rc; - ULONG ulDriveNum = 0; - ULONG ulDriveMap = 0; - rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); - ok = rc == 0; - if (ok) - { - sz -= 3; - rc = ::DosQueryCurrentDir( 0 // current drive - ,(PBYTE)cbuf + 3 - ,(PULONG)&sz - ); - cbuf[0] = char('A' + (ulDriveNum - 1)); - cbuf[1] = ':'; - cbuf[2] = '\\'; - ok = rc == 0; - } - #else // !Win32/VC++ !Mac !OS2 - ok = getcwd(cbuf, sz) != NULL; - #endif // platform - - #if wxUSE_UNICODE && !(defined(__WXMAC__) && !defined(__DARWIN__)) - // finally convert the result to Unicode if needed - wxConvFile.MB2WC(buf, cbuf, sz); - #endif // wxUSE_UNICODE - } - - if ( !ok ) - { - wxLogSysError(_("Failed to get the working directory")); - - // VZ: the old code used to return "." on error which didn't make any - // sense at all to me - empty string is a better error indicator - // (NULL might be even better but I'm afraid this could lead to - // problems with the old code assuming the return is never NULL) - buf[0] = _T('\0'); - } - else // ok, but we might need to massage the path into the right format - { -#ifdef __DJGPP__ - // VS: DJGPP is a strange mix of DOS and UNIX API and returns paths - // with / deliminers. We don't like that. - for (wxChar *ch = buf; *ch; ch++) - { - if (*ch == wxT('/')) - *ch = wxT('\\'); - } -#endif // __DJGPP__ - -// MBN: we hope that in the case the user is compiling a GTK+/Motif app, -// he needs Unix as opposed to Win32 pathnames -#if defined( __CYGWIN__ ) && defined( __WINDOWS__ ) - // another example of DOS/Unix mix (Cygwin) - wxString pathUnix = buf; -#if wxUSE_UNICODE - char bufA[_MAXPATHLEN]; - cygwin_conv_to_full_win32_path(pathUnix.mb_str(wxConvFile), bufA); - wxConvFile.MB2WC(buf, bufA, sz); -#else - cygwin_conv_to_full_win32_path(pathUnix, buf); -#endif // wxUSE_UNICODE -#endif // __CYGWIN__ - } - - return buf; - -#if !wxUSE_UNICODE - #undef cbuf -#endif - -#endif - // __WXWINCE__ -} - -#if WXWIN_COMPATIBILITY_2_6 -wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) -{ - return wxDoGetCwd(buf,sz); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -wxString wxGetCwd() -{ - wxString str; - wxDoGetCwd(wxStringBuffer(str, _MAXPATHLEN), _MAXPATHLEN); - return str; -} - -bool wxSetWorkingDirectory(const wxString& d) -{ -#if defined(__OS2__) - if (d[1] == ':') - { - ::DosSetDefaultDisk(1 + wxToupper(d[0]) - _T('A')); - // do not call DosSetCurrentDir when just changing drive, - // since it requires e.g. "d:." instead of "d:"! - if (d.length() == 2) - return true; - } - return (::DosSetCurrentDir((PSZ)d.c_str()) == 0); -#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__) - return (chdir(wxFNSTRINGCAST d.fn_str()) == 0); -#elif defined(__WINDOWS__) - -#ifdef __WIN32__ -#ifdef __WXWINCE__ - // No equivalent in WinCE - wxUnusedVar(d); - return false; -#else - return (bool)(SetCurrentDirectory(d) != 0); -#endif -#else - // Must change drive, too. - bool isDriveSpec = ((strlen(d) > 1) && (d[1] == ':')); - if (isDriveSpec) - { - wxChar firstChar = d[0]; - - // To upper case - if (firstChar > 90) - firstChar = firstChar - 32; - - // To a drive number - unsigned int driveNo = firstChar - 64; - if (driveNo > 0) - { - unsigned int noDrives; - _dos_setdrive(driveNo, &noDrives); - } - } - bool success = (chdir(WXSTRINGCAST d) == 0); - - return success; -#endif - -#endif -} - -// Get the OS directory if appropriate (such as the Windows directory). -// On non-Windows platform, probably just return the empty string. -wxString wxGetOSDirectory() -{ -#ifdef __WXWINCE__ - return wxString(wxT("\\Windows")); -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) - wxChar buf[256]; - GetWindowsDirectory(buf, 256); - return wxString(buf); -#elif defined(__WXMAC__) - return wxMacFindFolder(kOnSystemDisk, 'macs', false); -#else - return wxEmptyString; -#endif -} - -bool wxEndsWithPathSeparator(const wxChar *pszFileName) -{ - size_t len = wxStrlen(pszFileName); - - return len && wxIsPathSeparator(pszFileName[len - 1]); -} - -// find a file in a list of directories, returns false if not found -bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile) -{ - // we assume that it's not empty - wxCHECK_MSG( !wxIsEmpty(pszFile), false, - _T("empty file name in wxFindFileInPath")); - - // skip path separator in the beginning of the file name if present - if ( wxIsPathSeparator(*pszFile) ) - pszFile++; - - // copy the path (strtok will modify it) - wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1]; - wxStrcpy(szPath, pszPath); - - wxString strFile; - wxChar *pc, *save_ptr; - for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr); - pc != NULL; - pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) ) - { - // search for the file in this directory - strFile = pc; - if ( !wxEndsWithPathSeparator(pc) ) - strFile += wxFILE_SEP_PATH; - strFile += pszFile; - - if ( wxFileExists(strFile) ) { - *pStr = strFile; - break; - } - } - - // suppress warning about unused variable save_ptr when wxStrtok() is a - // macro which throws away its third argument - save_ptr = pc; - - delete [] szPath; - - return pc != NULL; // if true => we breaked from the loop -} - -void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt) -{ - // it can be empty, but it shouldn't be NULL - wxCHECK_RET( pszFileName, wxT("NULL file name in wxSplitPath") ); - - wxFileName::SplitPath(pszFileName, pstrPath, pstrName, pstrExt); -} - -#if wxUSE_DATETIME - -time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) -{ - wxDateTime mtime; - if ( !wxFileName(filename).GetTimes(NULL, &mtime, NULL) ) - return (time_t)-1; - - return mtime.GetTicks(); -} - -#endif // wxUSE_DATETIME - - -// Parses the filterStr, returning the number of filters. -// Returns 0 if none or if there's a problem. -// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpeg" - -int WXDLLEXPORT wxParseCommonDialogsFilter(const wxString& filterStr, - wxArrayString& descriptions, - wxArrayString& filters) -{ - descriptions.Clear(); - filters.Clear(); - - wxString str(filterStr); - - wxString description, filter; - int pos = 0; - while( pos != wxNOT_FOUND ) - { - pos = str.Find(wxT('|')); - if ( pos == wxNOT_FOUND ) - { - // if there are no '|'s at all in the string just take the entire - // string as filter and make description empty for later autocompletion - if ( filters.IsEmpty() ) - { - descriptions.Add(wxEmptyString); - filters.Add(filterStr); - } - else - { - wxFAIL_MSG( _T("missing '|' in the wildcard string!") ); - } - - break; - } - - description = str.Left(pos); - str = str.Mid(pos + 1); - pos = str.Find(wxT('|')); - if ( pos == wxNOT_FOUND ) - { - filter = str; - } - else - { - filter = str.Left(pos); - str = str.Mid(pos + 1); - } - - descriptions.Add(description); - filters.Add(filter); - } - -#if defined(__WXMOTIF__) - // split it so there is one wildcard per entry - for( size_t i = 0 ; i < descriptions.GetCount() ; i++ ) - { - pos = filters[i].Find(wxT(';')); - if (pos != wxNOT_FOUND) - { - // first split only filters - descriptions.Insert(descriptions[i],i+1); - filters.Insert(filters[i].Mid(pos+1),i+1); - filters[i]=filters[i].Left(pos); - - // autoreplace new filter in description with pattern: - // C/C++ Files(*.cpp;*.c;*.h)|*.cpp;*.c;*.h - // cause split into: - // C/C++ Files(*.cpp)|*.cpp - // C/C++ Files(*.c;*.h)|*.c;*.h - // and next iteration cause another split into: - // C/C++ Files(*.cpp)|*.cpp - // C/C++ Files(*.c)|*.c - // C/C++ Files(*.h)|*.h - for ( size_t k=i;kbefore.Find(_T(')'),true)) - { - before = before.Left(pos+1); - before << filters[k]; - pos = after.Find(_T(')')); - int pos1 = after.Find(_T('(')); - if (pos != wxNOT_FOUND && (pos -* -* The match procedure is public domain code (from ircII's reg.c) -* but modified to suit our tastes (RN: No "%" syntax I guess) -*/ - -bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) -{ - if (text.empty()) - { - /* Match if both are empty. */ - return pat.empty(); - } - - const wxChar *m = pat.c_str(), - *n = text.c_str(), - *ma = NULL, - *na = NULL; - int just = 0, - acount = 0, - count = 0; - - if (dot_special && (*n == wxT('.'))) - { - /* Never match so that hidden Unix files - * are never found. */ - return false; - } - - for (;;) - { - if (*m == wxT('*')) - { - ma = ++m; - na = n; - just = 1; - acount = count; - } - else if (*m == wxT('?')) - { - m++; - if (!*n++) - return false; - } - else - { - if (*m == wxT('\\')) - { - m++; - /* Quoting "nothing" is a bad thing */ - if (!*m) - return false; - } - if (!*m) - { - /* - * If we are out of both strings or we just - * saw a wildcard, then we can say we have a - * match - */ - if (!*n) - return true; - if (just) - return true; - just = 0; - goto not_matched; - } - /* - * We could check for *n == NULL at this point, but - * since it's more common to have a character there, - * check to see if they match first (m and n) and - * then if they don't match, THEN we can check for - * the NULL of n - */ - just = 0; - if (*m == *n) - { - m++; - count++; - n++; - } - else - { - - not_matched: - - /* - * If there are no more characters in the - * string, but we still need to find another - * character (*m != NULL), then it will be - * impossible to match it - */ - if (!*n) - return false; - - if (ma) - { - m = ma; - n = ++na; - count = acount; - } - else - return false; - } - } - } -} - -#ifdef __VISUALC__ - #pragma warning(default:4706) // assignment within conditional expression -#endif // VC++ diff --git a/Source/3rdParty/wx/src/common/filename.cpp b/Source/3rdParty/wx/src/common/filename.cpp deleted file mode 100644 index f50c40927..000000000 --- a/Source/3rdParty/wx/src/common/filename.cpp +++ /dev/null @@ -1,2558 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/filename.cpp -// Purpose: wxFileName - encapsulates a file path -// Author: Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 28.12.2000 -// RCS-ID: $Id: filename.cpp 66915 2011-02-16 21:46:49Z JS $ -// Copyright: (c) 2000 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - Here are brief descriptions of the filename formats supported by this class: - - wxPATH_UNIX: standard Unix format, used under Darwin as well, absolute file - names have the form: - /dir1/dir2/.../dirN/filename, "." and ".." stand for the - current and parent directory respectively, "~" is parsed as the - user HOME and "~username" as the HOME of that user - - wxPATH_DOS: DOS/Windows format, absolute file names have the form: - drive:\dir1\dir2\...\dirN\filename.ext where drive is a single - letter. "." and ".." as for Unix but no "~". - - There are also UNC names of the form \\share\fullpath - - wxPATH_MAC: Mac OS 8/9 and Mac OS X under CodeWarrior 7 format, absolute file - names have the form - volume:dir1:...:dirN:filename - and the relative file names are either - :dir1:...:dirN:filename - or just - filename - (although :filename works as well). - Since the volume is just part of the file path, it is not - treated like a separate entity as it is done under DOS and - VMS, it is just treated as another dir. - - wxPATH_VMS: VMS native format, absolute file names have the form - :[dir1.dir2.dir3]file.txt - or - :[000000.dir1.dir2.dir3]file.txt - - the is the physical device (i.e. disk). 000000 is the - root directory on the device which can be omitted. - - Note that VMS uses different separators unlike Unix: - : always after the device. If the path does not contain : than - the default (the device of the current directory) is assumed. - [ start of directory specification - . separator between directory and subdirectory - ] between directory and file - */ - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" // For GetShort/LongPathName - #endif - #include "wx/dynarray.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif - -#include "wx/filename.h" -#include "wx/private/filename.h" -#include "wx/tokenzr.h" -#include "wx/config.h" // for wxExpandEnvVars -#include "wx/dynlib.h" - -#if defined(__WIN32__) && defined(__MINGW32__) - #include "wx/msw/gccpriv.h" -#endif - -#ifdef __WXWINCE__ -#include "wx/msw/private.h" -#endif - -#if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers -#endif - -// utime() is POSIX so should normally be available on all Unices -#ifdef __UNIX_LIKE__ -#include -#include -#include -#include -#endif - -#ifdef __DJGPP__ -#include -#endif - -#ifdef __MWERKS__ -#ifdef __MACH__ -#include -#include -#include -#include -#else -#include -#include -#include -#endif -#endif - -#ifdef __WATCOMC__ -#include -#include -#include -#endif - -#ifdef __VISAGECPP__ -#ifndef MAX_PATH -#define MAX_PATH 256 -#endif -#endif - -#ifdef __EMX__ -#include -#define MAX_PATH _MAX_PATH -#endif - - -wxULongLong wxInvalidSize = (unsigned)-1; - - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// small helper class which opens and closes the file - we use it just to get -// a file handle for the given file name to pass it to some Win32 API function -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - -class wxFileHandle -{ -public: - enum OpenMode - { - Read, - Write - }; - - wxFileHandle(const wxString& filename, OpenMode mode, int flags = 0) - { - m_hFile = ::CreateFile - ( - filename, // name - mode == Read ? GENERIC_READ // access mask - : GENERIC_WRITE, - FILE_SHARE_READ | // sharing mode - FILE_SHARE_WRITE, // (allow everything) - NULL, // no secutity attr - OPEN_EXISTING, // creation disposition - flags, // flags - NULL // no template file - ); - - if ( m_hFile == INVALID_HANDLE_VALUE ) - { - wxLogSysError(_("Failed to open '%s' for %s"), - filename.c_str(), - mode == Read ? _("reading") : _("writing")); - } - } - - ~wxFileHandle() - { - if ( m_hFile != INVALID_HANDLE_VALUE ) - { - if ( !::CloseHandle(m_hFile) ) - { - wxLogSysError(_("Failed to close file handle")); - } - } - } - - // return true only if the file could be opened successfully - bool IsOk() const { return m_hFile != INVALID_HANDLE_VALUE; } - - // get the handle - operator HANDLE() const { return m_hFile; } - -private: - HANDLE m_hFile; -}; - -#endif // __WIN32__ - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -#if wxUSE_DATETIME && defined(__WIN32__) && !defined(__WXMICROWIN__) - -// convert between wxDateTime and FILETIME which is a 64-bit value representing -// the number of 100-nanosecond intervals since January 1, 1601. - -static void ConvertFileTimeToWx(wxDateTime *dt, const FILETIME &ft) -{ - FILETIME ftcopy = ft; - FILETIME ftLocal; - if ( !::FileTimeToLocalFileTime(&ftcopy, &ftLocal) ) - { - wxLogLastError(_T("FileTimeToLocalFileTime")); - } - - SYSTEMTIME st; - if ( !::FileTimeToSystemTime(&ftLocal, &st) ) - { - wxLogLastError(_T("FileTimeToSystemTime")); - } - - dt->Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear, - st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); -} - -static void ConvertWxToFileTime(FILETIME *ft, const wxDateTime& dt) -{ - SYSTEMTIME st; - st.wDay = dt.GetDay(); - st.wMonth = (WORD)(dt.GetMonth() + 1); - st.wYear = (WORD)dt.GetYear(); - st.wHour = dt.GetHour(); - st.wMinute = dt.GetMinute(); - st.wSecond = dt.GetSecond(); - st.wMilliseconds = dt.GetMillisecond(); - - FILETIME ftLocal; - if ( !::SystemTimeToFileTime(&st, &ftLocal) ) - { - wxLogLastError(_T("SystemTimeToFileTime")); - } - - if ( !::LocalFileTimeToFileTime(&ftLocal, ft) ) - { - wxLogLastError(_T("LocalFileTimeToFileTime")); - } -} - -#endif // wxUSE_DATETIME && __WIN32__ - -// return a string with the volume par -static wxString wxGetVolumeString(const wxString& volume, wxPathFormat format) -{ - wxString path; - - if ( !volume.empty() ) - { - format = wxFileName::GetFormat(format); - - // Special Windows UNC paths hack, part 2: undo what we did in - // SplitPath() and make an UNC path if we have a drive which is not a - // single letter (hopefully the network shares can't be one letter only - // although I didn't find any authoritative docs on this) - if ( format == wxPATH_DOS && volume.length() > 1 ) - { - path << wxFILE_SEP_PATH_DOS << wxFILE_SEP_PATH_DOS << volume; - } - else if ( format == wxPATH_DOS || format == wxPATH_VMS ) - { - path << volume << wxFileName::GetVolumeSeparator(format); - } - // else ignore - } - - return path; -} - -// return true if the character is a DOS path separator i.e. either a slash or -// a backslash -inline bool IsDOSPathSep(wxChar ch) -{ - return ch == wxFILE_SEP_PATH_DOS || ch == wxFILE_SEP_PATH_UNIX; -} - -// return true if the format used is the DOS/Windows one and the string looks -// like a UNC path -static bool IsUNCPath(const wxString& path, wxPathFormat format) -{ - return format == wxPATH_DOS && - path.length() >= 4 && // "\\a" can't be a UNC path - IsDOSPathSep(path[0u]) && - IsDOSPathSep(path[1u]) && - !IsDOSPathSep(path[2u]); -} - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxFileName construction -// ---------------------------------------------------------------------------- - -void wxFileName::Assign( const wxFileName &filepath ) -{ - if ( &filepath == this ) - return; - - m_volume = filepath.GetVolume(); - m_dirs = filepath.GetDirs(); - m_name = filepath.GetName(); - m_ext = filepath.GetExt(); - m_relative = filepath.m_relative; - m_hasExt = filepath.m_hasExt; -} - -void wxFileName::Assign(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - bool hasExt, - wxPathFormat format) -{ - // we should ignore paths which look like UNC shares because we already - // have the volume here and the UNC notation (\\server\path) is only valid - // for paths which don't start with a volume, so prevent SetPath() from - // recognizing "\\foo\bar" in "c:\\foo\bar" as an UNC path - // - // note also that this is a rather ugly way to do what we want (passing - // some kind of flag telling to ignore UNC paths to SetPath() would be - // better) but this is the safest thing to do to avoid breaking backwards - // compatibility in 2.8 - if ( IsUNCPath(path, format) ) - { - // remove one of the 2 leading backslashes to ensure that it's not - // recognized as an UNC path by SetPath() - wxString pathNonUNC(path, 1, wxString::npos); - SetPath(pathNonUNC, format); - } - else // no UNC complications - { - SetPath(path, format); - } - - m_volume = volume; - m_ext = ext; - m_name = name; - - m_hasExt = hasExt; -} - -void wxFileName::SetPath( const wxString& pathOrig, wxPathFormat format ) -{ - m_dirs.Clear(); - - if ( pathOrig.empty() ) - { - // no path at all - m_relative = true; - - return; - } - - format = GetFormat( format ); - - // 0) deal with possible volume part first - wxString volume, - path; - SplitVolume(pathOrig, &volume, &path, format); - if ( !volume.empty() ) - { - m_relative = false; - - SetVolume(volume); - } - - // 1) Determine if the path is relative or absolute. - wxChar leadingChar = path[0u]; - - switch (format) - { - case wxPATH_MAC: - m_relative = leadingChar == wxT(':'); - - // We then remove a leading ":". The reason is in our - // storage form for relative paths: - // ":dir:file.txt" actually means "./dir/file.txt" in - // DOS notation and should get stored as - // (relative) (dir) (file.txt) - // "::dir:file.txt" actually means "../dir/file.txt" - // stored as (relative) (..) (dir) (file.txt) - // This is important only for the Mac as an empty dir - // actually means , whereas under DOS, double - // slashes can be ignored: "\\\\" is the same as "\\". - if (m_relative) - path.erase( 0, 1 ); - break; - - case wxPATH_VMS: - // TODO: what is the relative path format here? - m_relative = false; - break; - - default: - wxFAIL_MSG( _T("Unknown path format") ); - // !! Fall through !! - - case wxPATH_UNIX: - // the paths of the form "~" or "~username" are absolute - m_relative = leadingChar != wxT('/') && leadingChar != _T('~'); - break; - - case wxPATH_DOS: - m_relative = !IsPathSeparator(leadingChar, format); - break; - - } - - // 2) Break up the path into its members. If the original path - // was just "/" or "\\", m_dirs will be empty. We know from - // the m_relative field, if this means "nothing" or "root dir". - - wxStringTokenizer tn( path, GetPathSeparators(format) ); - - while ( tn.HasMoreTokens() ) - { - wxString token = tn.GetNextToken(); - - // Remove empty token under DOS and Unix, interpret them - // as .. under Mac. - if (token.empty()) - { - if (format == wxPATH_MAC) - m_dirs.Add( wxT("..") ); - // else ignore - } - else - { - m_dirs.Add( token ); - } - } -} - -void wxFileName::Assign(const wxString& fullpath, - wxPathFormat format) -{ - wxString volume, path, name, ext; - bool hasExt; - SplitPath(fullpath, &volume, &path, &name, &ext, &hasExt, format); - - Assign(volume, path, name, ext, hasExt, format); -} - -void wxFileName::Assign(const wxString& fullpathOrig, - const wxString& fullname, - wxPathFormat format) -{ - // always recognize fullpath as directory, even if it doesn't end with a - // slash - wxString fullpath = fullpathOrig; - if ( !fullpath.empty() && !wxEndsWithPathSeparator(fullpath) ) - { - fullpath += GetPathSeparator(format); - } - - wxString volume, path, name, ext; - bool hasExt; - - // do some consistency checks in debug mode: the name should be really just - // the filename and the path should be really just a path -#ifdef __WXDEBUG__ - wxString volDummy, pathDummy, nameDummy, extDummy; - - SplitPath(fullname, &volDummy, &pathDummy, &name, &ext, &hasExt, format); - - wxASSERT_MSG( volDummy.empty() && pathDummy.empty(), - _T("the file name shouldn't contain the path") ); - - SplitPath(fullpath, &volume, &path, &nameDummy, &extDummy, format); - - wxASSERT_MSG( nameDummy.empty() && extDummy.empty(), - _T("the path shouldn't contain file name nor extension") ); - -#else // !__WXDEBUG__ - SplitPath(fullname, NULL /* no volume */, NULL /* no path */, - &name, &ext, &hasExt, format); - SplitPath(fullpath, &volume, &path, NULL, NULL, format); -#endif // __WXDEBUG__/!__WXDEBUG__ - - Assign(volume, path, name, ext, hasExt, format); -} - -void wxFileName::Assign(const wxString& pathOrig, - const wxString& name, - const wxString& ext, - wxPathFormat format) -{ - wxString volume, - path; - SplitVolume(pathOrig, &volume, &path, format); - - Assign(volume, path, name, ext, format); -} - -void wxFileName::AssignDir(const wxString& dir, wxPathFormat format) -{ - Assign(dir, wxEmptyString, format); -} - -void wxFileName::Clear() -{ - m_dirs.Clear(); - - m_volume = - m_name = - m_ext = wxEmptyString; - - // we don't have any absolute path for now - m_relative = true; - - // nor any extension - m_hasExt = false; -} - -/* static */ -wxFileName wxFileName::FileName(const wxString& file, wxPathFormat format) -{ - return wxFileName(file, format); -} - -/* static */ -wxFileName wxFileName::DirName(const wxString& dir, wxPathFormat format) -{ - wxFileName fn; - fn.AssignDir(dir, format); - return fn; -} - -// ---------------------------------------------------------------------------- -// existence tests -// ---------------------------------------------------------------------------- - -bool wxFileName::FileExists() const -{ - return wxFileName::FileExists( GetFullPath() ); -} - -bool wxFileName::FileExists( const wxString &file ) -{ - return ::wxFileExists( file ); -} - -bool wxFileName::DirExists() const -{ - return wxFileName::DirExists( GetPath() ); -} - -bool wxFileName::DirExists( const wxString &dir ) -{ - return ::wxDirExists( dir ); -} - -// ---------------------------------------------------------------------------- -// CWD and HOME stuff -// ---------------------------------------------------------------------------- - -void wxFileName::AssignCwd(const wxString& volume) -{ - AssignDir(wxFileName::GetCwd(volume)); -} - -/* static */ -wxString wxFileName::GetCwd(const wxString& volume) -{ - // if we have the volume, we must get the current directory on this drive - // and to do this we have to chdir to this volume - at least under Windows, - // I don't know how to get the current drive on another volume elsewhere - // (TODO) - wxString cwdOld; - if ( !volume.empty() ) - { - cwdOld = wxGetCwd(); - SetCwd(volume + GetVolumeSeparator()); - } - - wxString cwd = ::wxGetCwd(); - - if ( !volume.empty() ) - { - SetCwd(cwdOld); - } - - return cwd; -} - -bool wxFileName::SetCwd() -{ - return wxFileName::SetCwd( GetPath() ); -} - -bool wxFileName::SetCwd( const wxString &cwd ) -{ - return ::wxSetWorkingDirectory( cwd ); -} - -void wxFileName::AssignHomeDir() -{ - AssignDir(wxFileName::GetHomeDir()); -} - -wxString wxFileName::GetHomeDir() -{ - return ::wxGetHomeDir(); -} - - -// ---------------------------------------------------------------------------- -// CreateTempFileName -// ---------------------------------------------------------------------------- - -#if wxUSE_FILE || wxUSE_FFILE - - -#if !defined wx_fdopen && defined HAVE_FDOPEN - #define wx_fdopen fdopen -#endif - -// NB: GetTempFileName() under Windows creates the file, so using -// O_EXCL there would fail -#ifdef __WINDOWS__ - #define wxOPEN_EXCL 0 -#else - #define wxOPEN_EXCL O_EXCL -#endif - - -#ifdef wxOpenOSFHandle -#define WX_HAVE_DELETE_ON_CLOSE -// On Windows create a file with the FILE_FLAGS_DELETE_ON_CLOSE flags. -// -static int wxOpenWithDeleteOnClose(const wxString& filename) -{ - DWORD access = GENERIC_READ | GENERIC_WRITE; - - DWORD disposition = OPEN_ALWAYS; - - DWORD attributes = FILE_ATTRIBUTE_TEMPORARY | - FILE_FLAG_DELETE_ON_CLOSE; - - HANDLE h = ::CreateFile(filename, access, 0, NULL, - disposition, attributes, NULL); - - return wxOpenOSFHandle(h, wxO_BINARY); -} -#endif // wxOpenOSFHandle - - -// Helper to open the file -// -static int wxTempOpen(const wxString& path, bool *deleteOnClose) -{ -#ifdef WX_HAVE_DELETE_ON_CLOSE - if (*deleteOnClose) - return wxOpenWithDeleteOnClose(path); -#endif - - *deleteOnClose = false; - - return wxOpen(path, wxO_BINARY | O_RDWR | O_CREAT | wxOPEN_EXCL, 0600); -} - - -#if wxUSE_FFILE -// Helper to open the file and attach it to the wxFFile -// -static bool wxTempOpen(wxFFile *file, const wxString& path, bool *deleteOnClose) -{ -#ifndef wx_fdopen - *deleteOnClose = false; - return file->Open(path, _T("w+b")); -#else // wx_fdopen - int fd = wxTempOpen(path, deleteOnClose); - if (fd == -1) - return false; - file->Attach(wx_fdopen(fd, "w+b")); - return file->IsOpened(); -#endif // wx_fdopen -} -#endif // wxUSE_FFILE - - -#if !wxUSE_FILE - #define WXFILEARGS(x, y) y -#elif !wxUSE_FFILE - #define WXFILEARGS(x, y) x -#else - #define WXFILEARGS(x, y) x, y -#endif - - -// Implementation of wxFileName::CreateTempFileName(). -// -static wxString wxCreateTempImpl( - const wxString& prefix, - WXFILEARGS(wxFile *fileTemp, wxFFile *ffileTemp), - bool *deleteOnClose = NULL) -{ -#if wxUSE_FILE && wxUSE_FFILE - wxASSERT(fileTemp == NULL || ffileTemp == NULL); -#endif - wxString path, dir, name; - bool wantDeleteOnClose = false; - - if (deleteOnClose) - { - // set the result to false initially - wantDeleteOnClose = *deleteOnClose; - *deleteOnClose = false; - } - else - { - // easier if it alwasys points to something - deleteOnClose = &wantDeleteOnClose; - } - - // use the directory specified by the prefix - wxFileName::SplitPath(prefix, &dir, &name, NULL /* extension */); - - if (dir.empty()) - { - dir = wxFileName::GetTempDir(); - } - -#if defined(__WXWINCE__) - path = dir + wxT("\\") + name; - int i = 1; - while (wxFileName::FileExists(path)) - { - path = dir + wxT("\\") + name ; - path << i; - i ++; - } - -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) - if ( !::GetTempFileName(dir, name, 0, wxStringBuffer(path, MAX_PATH + 1)) ) - { - wxLogLastError(_T("GetTempFileName")); - - path.clear(); - } - -#else // !Windows - path = dir; - - if ( !wxEndsWithPathSeparator(dir) && - (name.empty() || !wxIsPathSeparator(name[0u])) ) - { - path += wxFILE_SEP_PATH; - } - - path += name; - -#if defined(HAVE_MKSTEMP) - // scratch space for mkstemp() - path += _T("XXXXXX"); - - // we need to copy the path to the buffer in which mkstemp() can modify it - wxCharBuffer buf( wxConvFile.cWX2MB( path ) ); - - // cast is safe because the string length doesn't change - int fdTemp = mkstemp( (char*)(const char*) buf ); - if ( fdTemp == -1 ) - { - // this might be not necessary as mkstemp() on most systems should have - // already done it but it doesn't hurt neither... - path.clear(); - } - else // mkstemp() succeeded - { - path = wxConvFile.cMB2WX( (const char*) buf ); - - #if wxUSE_FILE - // avoid leaking the fd - if ( fileTemp ) - { - fileTemp->Attach(fdTemp); - } - else - #endif - - #if wxUSE_FFILE - if ( ffileTemp ) - { - #ifdef wx_fdopen - ffileTemp->Attach(wx_fdopen(fdTemp, "r+b")); - #else - ffileTemp->Open(path, _T("r+b")); - close(fdTemp); - #endif - } - else - #endif - - { - close(fdTemp); - } - } -#else // !HAVE_MKSTEMP - -#ifdef HAVE_MKTEMP - // same as above - path += _T("XXXXXX"); - - wxCharBuffer buf = wxConvFile.cWX2MB( path ); - if ( !mktemp( (char*)(const char*) buf ) ) - { - path.clear(); - } - else - { - path = wxConvFile.cMB2WX( (const char*) buf ); - } -#else // !HAVE_MKTEMP (includes __DOS__) - // generate the unique file name ourselves - #if !defined(__DOS__) && !defined(__PALMOS__) && (!defined(__MWERKS__) || defined(__DARWIN__) ) - path << (unsigned int)getpid(); - #endif - - wxString pathTry; - - static const size_t numTries = 1000; - for ( size_t n = 0; n < numTries; n++ ) - { - // 3 hex digits is enough for numTries == 1000 < 4096 - pathTry = path + wxString::Format(_T("%.03x"), (unsigned int) n); - if ( !wxFileName::FileExists(pathTry) ) - { - break; - } - - pathTry.clear(); - } - - path = pathTry; -#endif // HAVE_MKTEMP/!HAVE_MKTEMP - -#endif // HAVE_MKSTEMP/!HAVE_MKSTEMP - -#endif // Windows/!Windows - - if ( path.empty() ) - { - wxLogSysError(_("Failed to create a temporary file name")); - } - else - { - bool ok = true; - - // open the file - of course, there is a race condition here, this is - // why we always prefer using mkstemp()... - #if wxUSE_FILE - if ( fileTemp && !fileTemp->IsOpened() ) - { - *deleteOnClose = wantDeleteOnClose; - int fd = wxTempOpen(path, deleteOnClose); - if (fd != -1) - fileTemp->Attach(fd); - else - ok = false; - } - #endif - - #if wxUSE_FFILE - if ( ffileTemp && !ffileTemp->IsOpened() ) - { - *deleteOnClose = wantDeleteOnClose; - ok = wxTempOpen(ffileTemp, path, deleteOnClose); - } - #endif - - if ( !ok ) - { - // FIXME: If !ok here should we loop and try again with another - // file name? That is the standard recourse if open(O_EXCL) - // fails, though of course it should be protected against - // possible infinite looping too. - - wxLogError(_("Failed to open temporary file.")); - - path.clear(); - } - } - - return path; -} - - -static bool wxCreateTempImpl( - const wxString& prefix, - WXFILEARGS(wxFile *fileTemp, wxFFile *ffileTemp), - wxString *name) -{ - bool deleteOnClose = true; - - *name = wxCreateTempImpl(prefix, - WXFILEARGS(fileTemp, ffileTemp), - &deleteOnClose); - - bool ok = !name->empty(); - - if (deleteOnClose) - name->clear(); -#ifdef __UNIX__ - else if (ok && wxRemoveFile(*name)) - name->clear(); -#endif - - return ok; -} - - -static void wxAssignTempImpl( - wxFileName *fn, - const wxString& prefix, - WXFILEARGS(wxFile *fileTemp, wxFFile *ffileTemp)) -{ - wxString tempname; - tempname = wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, ffileTemp)); - - if ( tempname.empty() ) - { - // error, failed to get temp file name - fn->Clear(); - } - else // ok - { - fn->Assign(tempname); - } -} - - -void wxFileName::AssignTempFileName(const wxString& prefix) -{ - wxAssignTempImpl(this, prefix, WXFILEARGS(NULL, NULL)); -} - -/* static */ -wxString wxFileName::CreateTempFileName(const wxString& prefix) -{ - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, NULL)); -} - -#endif // wxUSE_FILE || wxUSE_FFILE - - -#if wxUSE_FILE - -wxString wxCreateTempFileName(const wxString& prefix, - wxFile *fileTemp, - bool *deleteOnClose) -{ - return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, NULL), deleteOnClose); -} - -bool wxCreateTempFile(const wxString& prefix, - wxFile *fileTemp, - wxString *name) -{ - return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, NULL), name); -} - -void wxFileName::AssignTempFileName(const wxString& prefix, wxFile *fileTemp) -{ - wxAssignTempImpl(this, prefix, WXFILEARGS(fileTemp, NULL)); -} - -/* static */ -wxString -wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) -{ - return wxCreateTempFileName(prefix, fileTemp); -} - -#endif // wxUSE_FILE - - -#if wxUSE_FFILE - -wxString wxCreateTempFileName(const wxString& prefix, - wxFFile *fileTemp, - bool *deleteOnClose) -{ - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, fileTemp), deleteOnClose); -} - -bool wxCreateTempFile(const wxString& prefix, - wxFFile *fileTemp, - wxString *name) -{ - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, fileTemp), name); - -} - -void wxFileName::AssignTempFileName(const wxString& prefix, wxFFile *fileTemp) -{ - wxAssignTempImpl(this, prefix, WXFILEARGS(NULL, fileTemp)); -} - -/* static */ -wxString -wxFileName::CreateTempFileName(const wxString& prefix, wxFFile *fileTemp) -{ - return wxCreateTempFileName(prefix, fileTemp); -} - -#endif // wxUSE_FFILE - - -// ---------------------------------------------------------------------------- -// directory operations -// ---------------------------------------------------------------------------- - -wxString wxFileName::GetTempDir() -{ - wxString dir; - dir = wxGetenv(_T("TMPDIR")); - if (dir.empty()) - { - dir = wxGetenv(_T("TMP")); - if (dir.empty()) - { - dir = wxGetenv(_T("TEMP")); - } - } - -#if defined(__WXWINCE__) - if (dir.empty()) - { - // FIXME. Create \temp dir? - if (DirExists(wxT("\\temp"))) - dir = wxT("\\temp"); - } -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) - - if ( dir.empty() ) - { - if ( !::GetTempPath(MAX_PATH, wxStringBuffer(dir, MAX_PATH + 1)) ) - { - wxLogLastError(_T("GetTempPath")); - } - - if ( dir.empty() ) - { - // GetTempFileName() fails if we pass it an empty string - dir = _T('.'); - } - } -#else // !Windows - - if ( dir.empty() ) - { - // default -#if defined(__DOS__) || defined(__OS2__) - dir = _T("."); -#elif defined(__WXMAC__) - dir = wxMacFindFolder(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder); -#else - dir = _T("/tmp"); -#endif - } -#endif - - return dir; -} - -bool wxFileName::Mkdir( int perm, int flags ) -{ - return wxFileName::Mkdir(GetPath(), perm, flags); -} - -bool wxFileName::Mkdir( const wxString& dir, int perm, int flags ) -{ - if ( flags & wxPATH_MKDIR_FULL ) - { - // split the path in components - wxFileName filename; - filename.AssignDir(dir); - - wxString currPath; - if ( filename.HasVolume()) - { - currPath << wxGetVolumeString(filename.GetVolume(), wxPATH_NATIVE); - } - - wxArrayString dirs = filename.GetDirs(); - size_t count = dirs.GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - if ( i > 0 || -#if defined(__WXMAC__) && !defined(__DARWIN__) - // relative pathnames are exactely the other way round under mac... - !filename.IsAbsolute() -#else - filename.IsAbsolute() -#endif - ) - currPath += wxFILE_SEP_PATH; - currPath += dirs[i]; - - if (!DirExists(currPath)) - { - if (!wxMkdir(currPath, perm)) - { - // no need to try creating further directories - return false; - } - } - } - - return true; - - } - - return ::wxMkdir( dir, perm ); -} - -bool wxFileName::Rmdir() -{ - return wxFileName::Rmdir( GetPath() ); -} - -bool wxFileName::Rmdir( const wxString &dir ) -{ - return ::wxRmdir( dir ); -} - -// ---------------------------------------------------------------------------- -// path normalization -// ---------------------------------------------------------------------------- - -bool wxFileName::Normalize(int flags, - const wxString& cwd, - wxPathFormat format) -{ - // deal with env vars renaming first as this may seriously change the path - if ( flags & wxPATH_NORM_ENV_VARS ) - { - wxString pathOrig = GetFullPath(format); - wxString path = wxExpandEnvVars(pathOrig); - if ( path != pathOrig ) - { - Assign(path); - } - } - - - // the existing path components - wxArrayString dirs = GetDirs(); - - // the path to prepend in front to make the path absolute - wxFileName curDir; - - format = GetFormat(format); - - // set up the directory to use for making the path absolute later - if ( (flags & wxPATH_NORM_ABSOLUTE) && !IsAbsolute(format) ) - { - if ( cwd.empty() ) - { - curDir.AssignCwd(GetVolume()); - } - else // cwd provided - { - curDir.AssignDir(cwd); - } - } - - // handle ~ stuff under Unix only - if ( (format == wxPATH_UNIX) && (flags & wxPATH_NORM_TILDE) ) - { - if ( !dirs.IsEmpty() ) - { - wxString dir = dirs[0u]; - if ( !dir.empty() && dir[0u] == _T('~') ) - { - // to make the path absolute use the home directory - curDir.AssignDir(wxGetUserHome(dir.c_str() + 1)); - - // if we are expanding the tilde, then this path - // *should* be already relative (since we checked for - // the tilde only in the first char of the first dir); - // if m_relative==false, it's because it was initialized - // from a string which started with /~; in that case - // we reach this point but then need m_relative=true - // for relative->absolute expansion later - m_relative = true; - - dirs.RemoveAt(0u); - } - } - } - - // transform relative path into abs one - if ( curDir.IsOk() ) - { - // this path may be relative because it doesn't have the volume name - // and still have m_relative=true; in this case we shouldn't modify - // our directory components but just set the current volume - if ( !HasVolume() && curDir.HasVolume() ) - { - SetVolume(curDir.GetVolume()); - - if ( !m_relative ) - { - // yes, it was the case - we don't need curDir then - curDir.Clear(); - } - } - - // finally, prepend curDir to the dirs array - wxArrayString dirsNew = curDir.GetDirs(); - WX_PREPEND_ARRAY(dirs, dirsNew); - - // if we used e.g. tilde expansion previously and wxGetUserHome didn't - // return for some reason an absolute path, then curDir maybe not be absolute! - if ( curDir.IsAbsolute(format) ) - { - // we have prepended an absolute path and thus we are now an absolute - // file name too - m_relative = false; - } - // else if (flags & wxPATH_NORM_ABSOLUTE): - // should we warn the user that we didn't manage to make the path absolute? - } - - // now deal with ".", ".." and the rest - m_dirs.Empty(); - size_t count = dirs.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - wxString dir = dirs[n]; - - if ( flags & wxPATH_NORM_DOTS ) - { - if ( dir == wxT(".") ) - { - // just ignore - continue; - } - - if ( dir == wxT("..") ) - { - if ( m_dirs.IsEmpty() ) - { - wxLogError(_("The path '%s' contains too many \"..\"!"), - GetFullPath().c_str()); - return false; - } - - m_dirs.RemoveAt(m_dirs.GetCount() - 1); - continue; - } - } - - m_dirs.Add(dir); - } - -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE - if ( (flags & wxPATH_NORM_SHORTCUT) ) - { - wxString filename; - if (GetShortcutTarget(GetFullPath(format), filename)) - { - m_relative = false; - Assign(filename); - } - } -#endif - -#if defined(__WIN32__) - if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) ) - { - Assign(GetLongPath()); - } -#endif // Win32 - - // Change case (this should be kept at the end of the function, to ensure - // that the path doesn't change any more after we normalize its case) - if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) ) - { - m_volume.MakeLower(); - m_name.MakeLower(); - m_ext.MakeLower(); - - // directory entries must be made lower case as well - count = m_dirs.GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - m_dirs[i].MakeLower(); - } - } - - return true; -} - -// ---------------------------------------------------------------------------- -// get the shortcut target -// ---------------------------------------------------------------------------- - -// WinCE (3) doesn't have CLSID_ShellLink, IID_IShellLink definitions. -// The .lnk file is a plain text file so it should be easy to -// make it work. Hint from Google Groups: -// "If you open up a lnk file, you'll see a -// number, followed by a pound sign (#), followed by more text. The -// number is the number of characters that follows the pound sign. The -// characters after the pound sign are the command line (which _can_ -// include arguments) to be executed. Any path (e.g. \windows\program -// files\myapp.exe) that includes spaces needs to be enclosed in -// quotation marks." - -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE -// The following lines are necessary under WinCE -// #include "wx/msw/private.h" -// #include -#include -#if defined(__WXWINCE__) -#include -#endif - -bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, - wxString& targetFilename, - wxString* arguments) -{ - wxString path, file, ext; - wxSplitPath(shortcutPath, & path, & file, & ext); - - HRESULT hres; - IShellLink* psl; - bool success = false; - - // Assume it's not a shortcut if it doesn't end with lnk - if (ext.CmpNoCase(wxT("lnk"))!=0) - return false; - - // create a ShellLink object - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID*) &psl); - - if (SUCCEEDED(hres)) - { - IPersistFile* ppf; - hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf); - if (SUCCEEDED(hres)) - { - WCHAR wsz[MAX_PATH]; - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz, - MAX_PATH); - - hres = ppf->Load(wsz, 0); - ppf->Release(); - - if (SUCCEEDED(hres)) - { - wxChar buf[2048]; - // Wrong prototype in early versions -#if defined(__MINGW32__) && !wxCHECK_W32API_VERSION(2, 2) - psl->GetPath((CHAR*) buf, 2048, NULL, SLGP_UNCPRIORITY); -#else - psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY); -#endif - targetFilename = wxString(buf); - success = (shortcutPath != targetFilename); - - psl->GetArguments(buf, 2048); - wxString args(buf); - if (!args.empty() && arguments) - { - *arguments = args; - } - } - } - - psl->Release(); - } - return success; -} - -#endif // __WIN32__ && !__WXWINCE__ - - -// ---------------------------------------------------------------------------- -// absolute/relative paths -// ---------------------------------------------------------------------------- - -bool wxFileName::IsAbsolute(wxPathFormat format) const -{ - // if our path doesn't start with a path separator, it's not an absolute - // path - if ( m_relative ) - return false; - - if ( !GetVolumeSeparator(format).empty() ) - { - // this format has volumes and an absolute path must have one, it's not - // enough to have the full path to bean absolute file under Windows - if ( GetVolume().empty() ) - return false; - } - - return true; -} - -bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) -{ - wxFileName fnBase = wxFileName::DirName(pathBase, format); - - // get cwd only once - small time saving - wxString cwd = wxGetCwd(); - Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); - fnBase.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); - - bool withCase = IsCaseSensitive(format); - - // we can't do anything if the files live on different volumes - if ( !GetVolume().IsSameAs(fnBase.GetVolume(), withCase) ) - { - // nothing done - return false; - } - - // same drive, so we don't need our volume - m_volume.clear(); - - // remove common directories starting at the top - while ( !m_dirs.IsEmpty() && !fnBase.m_dirs.IsEmpty() && - m_dirs[0u].IsSameAs(fnBase.m_dirs[0u], withCase) ) - { - m_dirs.RemoveAt(0); - fnBase.m_dirs.RemoveAt(0); - } - - // add as many ".." as needed - size_t count = fnBase.m_dirs.GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - m_dirs.Insert(wxT(".."), 0u); - } - - if ( format == wxPATH_UNIX || format == wxPATH_DOS ) - { - // a directory made relative with respect to itself is '.' under Unix - // and DOS, by definition (but we don't have to insert "./" for the - // files) - if ( m_dirs.IsEmpty() && IsDir() ) - { - m_dirs.Add(_T('.')); - } - } - - m_relative = true; - - // we were modified - return true; -} - -// ---------------------------------------------------------------------------- -// filename kind tests -// ---------------------------------------------------------------------------- - -bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const -{ - wxFileName fn1 = *this, - fn2 = filepath; - - // get cwd only once - small time saving - wxString cwd = wxGetCwd(); - fn1.Normalize(wxPATH_NORM_ALL | wxPATH_NORM_CASE, cwd, format); - fn2.Normalize(wxPATH_NORM_ALL | wxPATH_NORM_CASE, cwd, format); - - if ( fn1.GetFullPath() == fn2.GetFullPath() ) - return true; - - // TODO: compare inodes for Unix, this works even when filenames are - // different but files are the same (symlinks) (VZ) - - return false; -} - -/* static */ -bool wxFileName::IsCaseSensitive( wxPathFormat format ) -{ - // only Unix filenames are truely case-sensitive - return GetFormat(format) == wxPATH_UNIX; -} - -/* static */ -wxString wxFileName::GetForbiddenChars(wxPathFormat format) -{ - // Inits to forbidden characters that are common to (almost) all platforms. - wxString strForbiddenChars = wxT("*?"); - - // If asserts, wxPathFormat has been changed. In case of a new path format - // addition, the following code might have to be updated. - wxCOMPILE_TIME_ASSERT(wxPATH_MAX == 5, wxPathFormatChanged); - switch ( GetFormat(format) ) - { - default : - wxFAIL_MSG( wxT("Unknown path format") ); - // !! Fall through !! - - case wxPATH_UNIX: - break; - - case wxPATH_MAC: - // On a Mac even names with * and ? are allowed (Tested with OS - // 9.2.1 and OS X 10.2.5) - strForbiddenChars = wxEmptyString; - break; - - case wxPATH_DOS: - strForbiddenChars += wxT("\\/:\"<>|"); - break; - - case wxPATH_VMS: - break; - } - - return strForbiddenChars; -} - -/* static */ -wxString wxFileName::GetVolumeSeparator(wxPathFormat WXUNUSED_IN_WINCE(format)) -{ -#ifdef __WXWINCE__ - return wxEmptyString; -#else - wxString sepVol; - - if ( (GetFormat(format) == wxPATH_DOS) || - (GetFormat(format) == wxPATH_VMS) ) - { - sepVol = wxFILE_SEP_DSK; - } - //else: leave empty - - return sepVol; -#endif -} - -/* static */ -wxString wxFileName::GetPathSeparators(wxPathFormat format) -{ - wxString seps; - switch ( GetFormat(format) ) - { - case wxPATH_DOS: - // accept both as native APIs do but put the native one first as - // this is the one we use in GetFullPath() - seps << wxFILE_SEP_PATH_DOS << wxFILE_SEP_PATH_UNIX; - break; - - default: - wxFAIL_MSG( _T("Unknown wxPATH_XXX style") ); - // fall through - - case wxPATH_UNIX: - seps = wxFILE_SEP_PATH_UNIX; - break; - - case wxPATH_MAC: - seps = wxFILE_SEP_PATH_MAC; - break; - - case wxPATH_VMS: - seps = wxFILE_SEP_PATH_VMS; - break; - } - - return seps; -} - -/* static */ -wxString wxFileName::GetPathTerminators(wxPathFormat format) -{ - format = GetFormat(format); - - // under VMS the end of the path is ']', not the path separator used to - // separate the components - return format == wxPATH_VMS ? wxString(_T(']')) : GetPathSeparators(format); -} - -/* static */ -bool wxFileName::IsPathSeparator(wxChar ch, wxPathFormat format) -{ - // wxString::Find() doesn't work as expected with NUL - it will always find - // it, so test for it separately - return ch != _T('\0') && GetPathSeparators(format).Find(ch) != wxNOT_FOUND; -} - -// ---------------------------------------------------------------------------- -// path components manipulation -// ---------------------------------------------------------------------------- - -/* static */ bool wxFileName::IsValidDirComponent(const wxString& dir) -{ - if ( dir.empty() ) - { - wxFAIL_MSG( _T("empty directory passed to wxFileName::InsertDir()") ); - - return false; - } - - const size_t len = dir.length(); - for ( size_t n = 0; n < len; n++ ) - { - if ( dir[n] == GetVolumeSeparator() || IsPathSeparator(dir[n]) ) - { - wxFAIL_MSG( _T("invalid directory component in wxFileName") ); - - return false; - } - } - - return true; -} - -void wxFileName::AppendDir( const wxString& dir ) -{ - if ( IsValidDirComponent(dir) ) - m_dirs.Add( dir ); -} - -void wxFileName::PrependDir( const wxString& dir ) -{ - InsertDir(0, dir); -} - -void wxFileName::InsertDir(size_t before, const wxString& dir) -{ - if ( IsValidDirComponent(dir) ) - m_dirs.Insert(dir, before); -} - -void wxFileName::RemoveDir(size_t pos) -{ - m_dirs.RemoveAt(pos); -} - -// ---------------------------------------------------------------------------- -// accessors -// ---------------------------------------------------------------------------- - -void wxFileName::SetFullName(const wxString& fullname) -{ - SplitPath(fullname, NULL /* no volume */, NULL /* no path */, - &m_name, &m_ext, &m_hasExt); -} - -wxString wxFileName::GetFullName() const -{ - wxString fullname = m_name; - if ( m_hasExt ) - { - fullname << wxFILE_SEP_EXT << m_ext; - } - - return fullname; -} - -wxString wxFileName::GetPath( int flags, wxPathFormat format ) const -{ - format = GetFormat( format ); - - wxString fullpath; - - // return the volume with the path as well if requested - if ( flags & wxPATH_GET_VOLUME ) - { - fullpath += wxGetVolumeString(GetVolume(), format); - } - - // the leading character - switch ( format ) - { - case wxPATH_MAC: - if ( m_relative ) - fullpath += wxFILE_SEP_PATH_MAC; - break; - - case wxPATH_DOS: - if ( !m_relative ) - fullpath += wxFILE_SEP_PATH_DOS; - break; - - default: - wxFAIL_MSG( wxT("Unknown path format") ); - // fall through - - case wxPATH_UNIX: - if ( !m_relative ) - { - // normally the absolute file names start with a slash - // with one exception: the ones like "~/foo.bar" don't - // have it - if ( m_dirs.IsEmpty() || m_dirs[0u] != _T('~') ) - { - fullpath += wxFILE_SEP_PATH_UNIX; - } - } - break; - - case wxPATH_VMS: - // no leading character here but use this place to unset - // wxPATH_GET_SEPARATOR flag: under VMS it doesn't make sense - // as, if I understand correctly, there should never be a dot - // before the closing bracket - flags &= ~wxPATH_GET_SEPARATOR; - } - - if ( m_dirs.empty() ) - { - // there is nothing more - return fullpath; - } - - // then concatenate all the path components using the path separator - if ( format == wxPATH_VMS ) - { - fullpath += wxT('['); - } - - const size_t dirCount = m_dirs.GetCount(); - for ( size_t i = 0; i < dirCount; i++ ) - { - switch (format) - { - case wxPATH_MAC: - if ( m_dirs[i] == wxT(".") ) - { - // skip appending ':', this shouldn't be done in this - // case as "::" is interpreted as ".." under Unix - continue; - } - - // convert back from ".." to nothing - if ( !m_dirs[i].IsSameAs(wxT("..")) ) - fullpath += m_dirs[i]; - break; - - default: - wxFAIL_MSG( wxT("Unexpected path format") ); - // still fall through - - case wxPATH_DOS: - case wxPATH_UNIX: - fullpath += m_dirs[i]; - break; - - case wxPATH_VMS: - // TODO: What to do with ".." under VMS - - // convert back from ".." to nothing - if ( !m_dirs[i].IsSameAs(wxT("..")) ) - fullpath += m_dirs[i]; - break; - } - - if ( (flags & wxPATH_GET_SEPARATOR) || (i != dirCount - 1) ) - fullpath += GetPathSeparator(format); - } - - if ( format == wxPATH_VMS ) - { - fullpath += wxT(']'); - } - - return fullpath; -} - -wxString wxFileName::GetFullPath( wxPathFormat format ) const -{ - // we already have a function to get the path - wxString fullpath = GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, - format); - - // now just add the file name and extension to it - fullpath += GetFullName(); - - return fullpath; -} - -// Return the short form of the path (returns identity on non-Windows platforms) -wxString wxFileName::GetShortPath() const -{ - wxString path(GetFullPath()); - -#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - DWORD sz = ::GetShortPathName(path, NULL, 0); - if ( sz != 0 ) - { - wxString pathOut; - if ( ::GetShortPathName - ( - path, - wxStringBuffer(pathOut, sz), - sz - ) != 0 ) - { - return pathOut; - } - } -#endif // Windows - - return path; -} - -// Return the long form of the path (returns identity on non-Windows platforms) -wxString wxFileName::GetLongPath() const -{ - wxString pathOut, - path = GetFullPath(); - -#if defined(__WIN32__) && !defined(__WXWINCE__) && !defined(__WXMICROWIN__) - -#if wxUSE_DYNLIB_CLASS - typedef DWORD (WINAPI *GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD); - - // this is MT-safe as in the worst case we're going to resolve the function - // twice -- but as the result is the same in both threads, it's ok - static GET_LONG_PATH_NAME s_pfnGetLongPathName = NULL; - if ( !s_pfnGetLongPathName ) - { - static bool s_triedToLoad = false; - - if ( !s_triedToLoad ) - { - s_triedToLoad = true; - - wxDynamicLibrary dllKernel(_T("kernel32")); - - const wxChar* GetLongPathName = _T("GetLongPathName") -#if wxUSE_UNICODE - _T("W"); -#else // ANSI - _T("A"); -#endif // Unicode/ANSI - - if ( dllKernel.HasSymbol(GetLongPathName) ) - { - s_pfnGetLongPathName = (GET_LONG_PATH_NAME) - dllKernel.GetSymbol(GetLongPathName); - } - - // note that kernel32.dll can be unloaded, it stays in memory - // anyhow as all Win32 programs link to it and so it's safe to call - // GetLongPathName() even after unloading it - } - } - - if ( s_pfnGetLongPathName ) - { - DWORD dwSize = (*s_pfnGetLongPathName)(path, NULL, 0); - if ( dwSize > 0 ) - { - if ( (*s_pfnGetLongPathName) - ( - path, - wxStringBuffer(pathOut, dwSize), - dwSize - ) != 0 ) - { - return pathOut; - } - } - } -#endif // wxUSE_DYNLIB_CLASS - - // The OS didn't support GetLongPathName, or some other error. - // We need to call FindFirstFile on each component in turn. - - WIN32_FIND_DATA findFileData; - HANDLE hFind; - - if ( HasVolume() ) - pathOut = GetVolume() + - GetVolumeSeparator(wxPATH_DOS) + - GetPathSeparator(wxPATH_DOS); - else - pathOut = wxEmptyString; - - wxArrayString dirs = GetDirs(); - dirs.Add(GetFullName()); - - wxString tmpPath; - - size_t count = dirs.GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - // We're using pathOut to collect the long-name path, but using a - // temporary for appending the last path component which may be - // short-name - tmpPath = pathOut + dirs[i]; - - if ( tmpPath.empty() ) - continue; - - // can't see this being necessary? MF - if ( tmpPath.Last() == GetVolumeSeparator(wxPATH_DOS) ) - { - // Can't pass a drive and root dir to FindFirstFile, - // so continue to next dir - tmpPath += wxFILE_SEP_PATH; - pathOut = tmpPath; - continue; - } - - hFind = ::FindFirstFile(tmpPath, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - // Error: most likely reason is that path doesn't exist, so - // append any unprocessed parts and return - for ( i += 1; i < count; i++ ) - tmpPath += wxFILE_SEP_PATH + dirs[i]; - - return tmpPath; - } - - pathOut += findFileData.cFileName; - if ( (i < (count-1)) ) - pathOut += wxFILE_SEP_PATH; - - ::FindClose(hFind); - } -#else // !Win32 - pathOut = path; -#endif // Win32/!Win32 - - return pathOut; -} - -wxPathFormat wxFileName::GetFormat( wxPathFormat format ) -{ - if (format == wxPATH_NATIVE) - { -#if defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__) - format = wxPATH_DOS; -#elif defined(__WXMAC__) && !defined(__DARWIN__) - format = wxPATH_MAC; -#elif defined(__VMS) - format = wxPATH_VMS; -#else - format = wxPATH_UNIX; -#endif - } - return format; -} - -// ---------------------------------------------------------------------------- -// path splitting function -// ---------------------------------------------------------------------------- - -/* static */ -void -wxFileName::SplitVolume(const wxString& fullpathWithVolume, - wxString *pstrVolume, - wxString *pstrPath, - wxPathFormat format) -{ - format = GetFormat(format); - - wxString fullpath = fullpathWithVolume; - - // special Windows UNC paths hack: transform \\share\path into share:path - if ( IsUNCPath(fullpath, format) ) - { - fullpath.erase(0, 2); - - size_t posFirstSlash = - fullpath.find_first_of(GetPathTerminators(format)); - if ( posFirstSlash != wxString::npos ) - { - fullpath[posFirstSlash] = wxFILE_SEP_DSK; - - // UNC paths are always absolute, right? (FIXME) - fullpath.insert(posFirstSlash + 1, 1, wxFILE_SEP_PATH_DOS); - } - } - - // We separate the volume here - if ( format == wxPATH_DOS || format == wxPATH_VMS ) - { - wxString sepVol = GetVolumeSeparator(format); - - size_t posFirstColon = fullpath.find_first_of(sepVol); - if ( posFirstColon != wxString::npos ) - { - if ( pstrVolume ) - { - *pstrVolume = fullpath.Left(posFirstColon); - } - - // remove the volume name and the separator from the full path - fullpath.erase(0, posFirstColon + sepVol.length()); - } - } - - if ( pstrPath ) - *pstrPath = fullpath; -} - -/* static */ -void wxFileName::SplitPath(const wxString& fullpathWithVolume, - wxString *pstrVolume, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt, - bool *hasExt, - wxPathFormat format) -{ - format = GetFormat(format); - - wxString fullpath; - SplitVolume(fullpathWithVolume, pstrVolume, &fullpath, format); - - // find the positions of the last dot and last path separator in the path - size_t posLastDot = fullpath.find_last_of(wxFILE_SEP_EXT); - size_t posLastSlash = fullpath.find_last_of(GetPathTerminators(format)); - - // check whether this dot occurs at the very beginning of a path component - if ( (posLastDot != wxString::npos) && - (posLastDot == 0 || - IsPathSeparator(fullpath[posLastDot - 1]) || - (format == wxPATH_VMS && fullpath[posLastDot - 1] == _T(']'))) ) - { - // dot may be (and commonly -- at least under Unix -- is) the first - // character of the filename, don't treat the entire filename as - // extension in this case - posLastDot = wxString::npos; - } - - // if we do have a dot and a slash, check that the dot is in the name part - if ( (posLastDot != wxString::npos) && - (posLastSlash != wxString::npos) && - (posLastDot < posLastSlash) ) - { - // the dot is part of the path, not the start of the extension - posLastDot = wxString::npos; - } - - // now fill in the variables provided by user - if ( pstrPath ) - { - if ( posLastSlash == wxString::npos ) - { - // no path at all - pstrPath->Empty(); - } - else - { - // take everything up to the path separator but take care to make - // the path equal to something like '/', not empty, for the files - // immediately under root directory - size_t len = posLastSlash; - - // this rule does not apply to mac since we do not start with colons (sep) - // except for relative paths - if ( !len && format != wxPATH_MAC) - len++; - - *pstrPath = fullpath.Left(len); - - // special VMS hack: remove the initial bracket - if ( format == wxPATH_VMS ) - { - if ( (*pstrPath)[0u] == _T('[') ) - pstrPath->erase(0, 1); - } - } - } - - if ( pstrName ) - { - // take all characters starting from the one after the last slash and - // up to, but excluding, the last dot - size_t nStart = posLastSlash == wxString::npos ? 0 : posLastSlash + 1; - size_t count; - if ( posLastDot == wxString::npos ) - { - // take all until the end - count = wxString::npos; - } - else if ( posLastSlash == wxString::npos ) - { - count = posLastDot; - } - else // have both dot and slash - { - count = posLastDot - posLastSlash - 1; - } - - *pstrName = fullpath.Mid(nStart, count); - } - - // finally deal with the extension here: we have an added complication that - // extension may be empty (but present) as in "foo." where trailing dot - // indicates the empty extension at the end -- and hence we must remember - // that we have it independently of pstrExt - if ( posLastDot == wxString::npos ) - { - // no extension - if ( pstrExt ) - pstrExt->clear(); - if ( hasExt ) - *hasExt = false; - } - else - { - // take everything after the dot - if ( pstrExt ) - *pstrExt = fullpath.Mid(posLastDot + 1); - if ( hasExt ) - *hasExt = true; - } -} - -/* static */ -void wxFileName::SplitPath(const wxString& fullpath, - wxString *path, - wxString *name, - wxString *ext, - wxPathFormat format) -{ - wxString volume; - SplitPath(fullpath, &volume, path, name, ext, format); - - if ( path ) - { - path->Prepend(wxGetVolumeString(volume, format)); - } -} - -/* static */ -wxString wxFileName::StripExtension(const wxString& fullpath) -{ - wxFileName fn(fullpath); - fn.SetExt(_T("")); - return fn.GetFullPath(); -} - -// ---------------------------------------------------------------------------- -// time functions -// ---------------------------------------------------------------------------- - -#if wxUSE_DATETIME - -bool wxFileName::SetTimes(const wxDateTime *dtAccess, - const wxDateTime *dtMod, - const wxDateTime *dtCreate) -{ -#if defined(__WIN32__) - FILETIME ftAccess, ftCreate, ftWrite; - - if ( dtCreate ) - ConvertWxToFileTime(&ftCreate, *dtCreate); - if ( dtAccess ) - ConvertWxToFileTime(&ftAccess, *dtAccess); - if ( dtMod ) - ConvertWxToFileTime(&ftWrite, *dtMod); - - wxString path; - int flags; - if ( IsDir() ) - { - if ( wxGetOsVersion() == wxOS_WINDOWS_9X ) - { - wxLogError(_("Setting directory access times is not supported under this OS version")); - return false; - } - - path = GetPath(); - flags = FILE_FLAG_BACKUP_SEMANTICS; - } - else // file - { - path = GetFullPath(); - flags = 0; - } - - wxFileHandle fh(path, wxFileHandle::Write, flags); - if ( fh.IsOk() ) - { - if ( ::SetFileTime(fh, - dtCreate ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtMod ? &ftWrite : NULL) ) - { - return true; - } - } -#elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__)) - wxUnusedVar(dtCreate); - - if ( !dtAccess && !dtMod ) - { - // can't modify the creation time anyhow, don't try - return true; - } - - // if dtAccess or dtMod is not specified, use the other one (which must be - // non NULL because of the test above) for both times - utimbuf utm; - utm.actime = dtAccess ? dtAccess->GetTicks() : dtMod->GetTicks(); - utm.modtime = dtMod ? dtMod->GetTicks() : dtAccess->GetTicks(); - if ( utime(GetFullPath().fn_str(), &utm) == 0 ) - { - return true; - } -#else // other platform - wxUnusedVar(dtAccess); - wxUnusedVar(dtMod); - wxUnusedVar(dtCreate); -#endif // platforms - - wxLogSysError(_("Failed to modify file times for '%s'"), - GetFullPath().c_str()); - - return false; -} - -bool wxFileName::Touch() -{ -#if defined(__UNIX_LIKE__) - // under Unix touching file is simple: just pass NULL to utime() - if ( utime(GetFullPath().fn_str(), NULL) == 0 ) - { - return true; - } - - wxLogSysError(_("Failed to touch the file '%s'"), GetFullPath().c_str()); - - return false; -#else // other platform - wxDateTime dtNow = wxDateTime::Now(); - - return SetTimes(&dtNow, &dtNow, NULL /* don't change create time */); -#endif // platforms -} - -#ifdef wxNEED_WX_UNISTD_H - -static int wxStat( const char *file_name, wxStructStat *buf ) -{ - return stat( file_name , buf ); -} - -#endif - -bool wxFileName::GetTimes(wxDateTime *dtAccess, - wxDateTime *dtMod, - wxDateTime *dtCreate) const -{ -#if defined(__WIN32__) - // we must use different methods for the files and directories under - // Windows as CreateFile(GENERIC_READ) doesn't work for the directories and - // CreateFile(FILE_FLAG_BACKUP_SEMANTICS) works -- but only under NT and - // not 9x - bool ok; - FILETIME ftAccess, ftCreate, ftWrite; - if ( IsDir() ) - { - // implemented in msw/dir.cpp - extern bool wxGetDirectoryTimes(const wxString& dirname, - FILETIME *, FILETIME *, FILETIME *); - - // we should pass the path without the trailing separator to - // wxGetDirectoryTimes() - ok = wxGetDirectoryTimes(GetPath(wxPATH_GET_VOLUME), - &ftAccess, &ftCreate, &ftWrite); - } - else // file - { - wxFileHandle fh(GetFullPath(), wxFileHandle::Read); - if ( fh.IsOk() ) - { - ok = ::GetFileTime(fh, - dtCreate ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtMod ? &ftWrite : NULL) != 0; - } - else - { - ok = false; - } - } - - if ( ok ) - { - if ( dtCreate ) - ConvertFileTimeToWx(dtCreate, ftCreate); - if ( dtAccess ) - ConvertFileTimeToWx(dtAccess, ftAccess); - if ( dtMod ) - ConvertFileTimeToWx(dtMod, ftWrite); - - return true; - } -#elif defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__OS2__) || (defined(__DOS__) && defined(__WATCOMC__)) - // no need to test for IsDir() here - wxStructStat stBuf; - if ( wxStat( GetFullPath().fn_str(), &stBuf) == 0 ) - { - if ( dtAccess ) - dtAccess->Set(stBuf.st_atime); - if ( dtMod ) - dtMod->Set(stBuf.st_mtime); - if ( dtCreate ) - dtCreate->Set(stBuf.st_ctime); - - return true; - } -#else // other platform - wxUnusedVar(dtAccess); - wxUnusedVar(dtMod); - wxUnusedVar(dtCreate); -#endif // platforms - - wxLogSysError(_("Failed to retrieve file times for '%s'"), - GetFullPath().c_str()); - - return false; -} - -#endif // wxUSE_DATETIME - - -// ---------------------------------------------------------------------------- -// file size functions -// ---------------------------------------------------------------------------- - -/* static */ -wxULongLong wxFileName::GetSize(const wxString &filename) -{ - if (!wxFileExists(filename)) - return wxInvalidSize; - -#if defined(__WXPALMOS__) - // TODO - return wxInvalidSize; -#elif defined(__WIN32__) - wxFileHandle f(filename, wxFileHandle::Read); - if (!f.IsOk()) - return wxInvalidSize; - - DWORD lpFileSizeHigh; - DWORD ret = GetFileSize(f, &lpFileSizeHigh); - if ( ret == INVALID_FILE_SIZE && ::GetLastError() != NO_ERROR ) - return wxInvalidSize; - - return wxULongLong(lpFileSizeHigh, ret); -#else // ! __WIN32__ - wxStructStat st; -#ifndef wxNEED_WX_UNISTD_H - if (wxStat( filename.fn_str() , &st) != 0) -#else - if (wxStat( filename, &st) != 0) -#endif - return wxInvalidSize; - return wxULongLong(st.st_size); -#endif -} - -/* static */ -wxString wxFileName::GetHumanReadableSize(const wxULongLong &bs, - const wxString &nullsize, - int precision) -{ - static const double KILOBYTESIZE = 1024.0; - static const double MEGABYTESIZE = 1024.0*KILOBYTESIZE; - static const double GIGABYTESIZE = 1024.0*MEGABYTESIZE; - static const double TERABYTESIZE = 1024.0*GIGABYTESIZE; - - if (bs == 0 || bs == wxInvalidSize) - return nullsize; - - double bytesize = bs.ToDouble(); - if (bytesize < KILOBYTESIZE) - return wxString::Format(_("%s B"), bs.ToString().c_str()); - if (bytesize < MEGABYTESIZE) - return wxString::Format(_("%.*f kB"), precision, bytesize/KILOBYTESIZE); - if (bytesize < GIGABYTESIZE) - return wxString::Format(_("%.*f MB"), precision, bytesize/MEGABYTESIZE); - if (bytesize < TERABYTESIZE) - return wxString::Format(_("%.*f GB"), precision, bytesize/GIGABYTESIZE); - - return wxString::Format(_("%.*f TB"), precision, bytesize/TERABYTESIZE); -} - -wxULongLong wxFileName::GetSize() const -{ - return GetSize(GetFullPath()); -} - -wxString wxFileName::GetHumanReadableSize(const wxString &failmsg, int precision) const -{ - return GetHumanReadableSize(GetSize(), failmsg, precision); -} - - -// ---------------------------------------------------------------------------- -// Mac-specific functions -// ---------------------------------------------------------------------------- - -#ifdef __WXMAC__ - -const short kMacExtensionMaxLength = 16 ; -class MacDefaultExtensionRecord -{ -public : - MacDefaultExtensionRecord() - { - m_ext[0] = 0 ; - m_type = m_creator = 0 ; - } - MacDefaultExtensionRecord( const MacDefaultExtensionRecord& from ) - { - wxStrcpy( m_ext , from.m_ext ) ; - m_type = from.m_type ; - m_creator = from.m_creator ; - } - MacDefaultExtensionRecord( const wxChar * extension , OSType type , OSType creator ) - { - wxStrncpy( m_ext , extension , kMacExtensionMaxLength ) ; - m_ext[kMacExtensionMaxLength] = 0 ; - m_type = type ; - m_creator = creator ; - } - wxChar m_ext[kMacExtensionMaxLength] ; - OSType m_type ; - OSType m_creator ; -} ; - -WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray) ; - -bool gMacDefaultExtensionsInited = false ; - -#include "wx/arrimpl.cpp" - -WX_DEFINE_EXPORTED_OBJARRAY(MacDefaultExtensionArray) ; - -MacDefaultExtensionArray gMacDefaultExtensions ; - -// load the default extensions -MacDefaultExtensionRecord gDefaults[] = -{ - MacDefaultExtensionRecord( wxT("txt") , 'TEXT' , 'ttxt' ) , - MacDefaultExtensionRecord( wxT("tif") , 'TIFF' , '****' ) , - MacDefaultExtensionRecord( wxT("jpg") , 'JPEG' , '****' ) , -} ; - -static void MacEnsureDefaultExtensionsLoaded() -{ - if ( !gMacDefaultExtensionsInited ) - { - // we could load the pc exchange prefs here too - for ( size_t i = 0 ; i < WXSIZEOF( gDefaults ) ; ++i ) - { - gMacDefaultExtensions.Add( gDefaults[i] ) ; - } - gMacDefaultExtensionsInited = true ; - } -} - -bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) -{ - FSRef fsRef ; - FSCatalogInfo catInfo; - FileInfo *finfo ; - - if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) - { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - finfo->fileType = type ; - finfo->fileCreator = creator ; - FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; - return true ; - } - } - return false ; -} - -bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) -{ - FSRef fsRef ; - FSCatalogInfo catInfo; - FileInfo *finfo ; - - if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) - { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - *type = finfo->fileType ; - *creator = finfo->fileCreator ; - return true ; - } - } - return false ; -} - -bool wxFileName::MacSetDefaultTypeAndCreator() -{ - wxUint32 type , creator ; - if ( wxFileName::MacFindDefaultTypeAndCreator(GetExt() , &type , - &creator ) ) - { - return MacSetTypeAndCreator( type , creator ) ; - } - return false; -} - -bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) -{ - MacEnsureDefaultExtensionsLoaded() ; - wxString extl = ext.Lower() ; - for( int i = gMacDefaultExtensions.Count() - 1 ; i >= 0 ; --i ) - { - if ( gMacDefaultExtensions.Item(i).m_ext == extl ) - { - *type = gMacDefaultExtensions.Item(i).m_type ; - *creator = gMacDefaultExtensions.Item(i).m_creator ; - return true ; - } - } - return false ; -} - -void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) -{ - MacEnsureDefaultExtensionsLoaded() ; - MacDefaultExtensionRecord rec ; - rec.m_type = type ; - rec.m_creator = creator ; - wxStrncpy( rec.m_ext , ext.Lower().c_str() , kMacExtensionMaxLength ) ; - gMacDefaultExtensions.Add( rec ) ; -} -#endif diff --git a/Source/3rdParty/wx/src/common/filepickercmn.cpp b/Source/3rdParty/wx/src/common/filepickercmn.cpp deleted file mode 100644 index 7b805dc8f..000000000 --- a/Source/3rdParty/wx/src/common/filepickercmn.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/filepickercmn.cpp -// Purpose: wxFilePickerCtrl class implementation -// Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: filepickercmn.cpp 42219 2006-10-21 19:53:05Z PC $ -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#include "wx/filepicker.h" -#include "wx/filename.h" - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -const wxChar wxFilePickerCtrlNameStr[] = wxT("filepicker"); -const wxChar wxFilePickerWidgetNameStr[] = wxT("filepickerwidget"); -const wxChar wxDirPickerCtrlNameStr[] = wxT("dirpicker"); -const wxChar wxDirPickerWidgetNameStr[] = wxT("dirpickerwidget"); -const wxChar wxFilePickerWidgetLabel[] = wxT("Browse"); -const wxChar wxDirPickerWidgetLabel[] = wxT("Browse"); - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FILEPICKER_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_DIRPICKER_CHANGED) -IMPLEMENT_DYNAMIC_CLASS(wxFileDirPickerEvent, wxCommandEvent) - -// ---------------------------------------------------------------------------- -// wxFileDirPickerCtrlBase -// ---------------------------------------------------------------------------- - -bool wxFileDirPickerCtrlBase::CreateBase(wxWindow *parent, - wxWindowID id, - const wxString &path, - const wxString &message, - const wxString &wildcard, - const wxPoint &pos, - const wxSize &size, - long style, - const wxValidator& validator, - const wxString &name ) -{ - wxASSERT_MSG(path.empty() || CheckPath(path), wxT("Invalid initial path!")); - - if (!wxPickerBase::CreateBase(parent, id, path, pos, size, - style, validator, name)) - return false; - - if (!HasFlag(wxFLP_OPEN) && !HasFlag(wxFLP_SAVE)) - m_windowStyle |= wxFLP_OPEN; // wxFD_OPEN is the default - - // check that the styles are not contradictory - wxASSERT_MSG( !(HasFlag(wxFLP_SAVE) && HasFlag(wxFLP_OPEN)), - _T("can't specify both wxFLP_SAVE and wxFLP_OPEN at once") ); - - wxASSERT_MSG( !HasFlag(wxFLP_SAVE) || !HasFlag(wxFLP_FILE_MUST_EXIST), - _T("wxFLP_FILE_MUST_EXIST can't be used with wxFLP_SAVE" ) ); - - wxASSERT_MSG( !HasFlag(wxFLP_OPEN) || !HasFlag(wxFLP_OVERWRITE_PROMPT), - _T("wxFLP_OVERWRITE_PROMPT can't be used with wxFLP_OPEN") ); - - // create a wxFilePickerWidget or a wxDirPickerWidget... - m_pickerIface = CreatePicker(this, path, message, wildcard); - if ( !m_pickerIface ) - return false; - m_picker = m_pickerIface->AsControl(); - - // complete sizer creation - wxPickerBase::PostCreation(); - - m_picker->Connect(GetEventType(), - wxFileDirPickerEventHandler(wxFileDirPickerCtrlBase::OnFileDirChange), - NULL, this); - - // default's wxPickerBase textctrl limit is too small for this control: - // make it bigger - if (m_text) m_text->SetMaxLength(512); - - return true; -} - -wxString wxFileDirPickerCtrlBase::GetPath() const -{ - return m_pickerIface->GetPath(); -} - -void wxFileDirPickerCtrlBase::SetPath(const wxString &path) -{ - m_pickerIface->SetPath(path); - UpdateTextCtrlFromPicker(); -} - -void wxFileDirPickerCtrlBase::UpdatePickerFromTextCtrl() -{ - wxASSERT(m_text); - - if (m_bIgnoreNextTextCtrlUpdate) - { - // ignore this update - m_bIgnoreNextTextCtrlUpdate = false; - return; - } - - // remove the eventually present path-separator from the end of the textctrl - // string otherwise we would generate a wxFileDirPickerEvent when changing - // from e.g. /home/user to /home/user/ and we want to avoid it ! - wxString newpath(GetTextCtrlValue()); - if (!CheckPath(newpath)) - return; // invalid user input - - if (m_pickerIface->GetPath() != newpath) - { - m_pickerIface->SetPath(newpath); - - // update current working directory, if necessary - // NOTE: the path separator is required because if newpath is "C:" - // then no change would happen - if (IsCwdToUpdate()) - wxSetWorkingDirectory(newpath); - - // fire an event - wxFileDirPickerEvent event(GetEventType(), this, GetId(), newpath); - GetEventHandler()->ProcessEvent(event); - } -} - -void wxFileDirPickerCtrlBase::UpdateTextCtrlFromPicker() -{ - if (!m_text) - return; // no textctrl to update - - // NOTE: this SetValue() will generate an unwanted wxEVT_COMMAND_TEXT_UPDATED - // which will trigger a unneeded UpdateFromTextCtrl(); thus before using - // SetValue() we set the m_bIgnoreNextTextCtrlUpdate flag... - m_bIgnoreNextTextCtrlUpdate = true; - m_text->SetValue(m_pickerIface->GetPath()); -} - - - -// ---------------------------------------------------------------------------- -// wxFileDirPickerCtrlBase - event handlers -// ---------------------------------------------------------------------------- - -void wxFileDirPickerCtrlBase::OnFileDirChange(wxFileDirPickerEvent &ev) -{ - UpdateTextCtrlFromPicker(); - - // the wxFilePickerWidget sent us a colour-change notification. - // forward this event to our parent - wxFileDirPickerEvent event(GetEventType(), this, GetId(), ev.GetPath()); - GetEventHandler()->ProcessEvent(event); -} - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxFileDirPickerCtrl -// ---------------------------------------------------------------------------- - -#if wxUSE_FILEPICKERCTRL - -IMPLEMENT_DYNAMIC_CLASS(wxFilePickerCtrl, wxPickerBase) - -bool wxFilePickerCtrl::CheckPath(const wxString& path) const -{ - // if wxFLP_SAVE was given or wxFLP_FILE_MUST_EXIST has NOT been given we - // must accept any path - return HasFlag(wxFLP_SAVE) || - !HasFlag(wxFLP_FILE_MUST_EXIST) || - wxFileName::FileExists(path); -} - -wxString wxFilePickerCtrl::GetTextCtrlValue() const -{ - // filter it through wxFileName to remove any spurious path separator - return wxFileName(m_text->GetValue()).GetFullPath(); -} - -#endif // wxUSE_FILEPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxDirPickerCtrl -// ---------------------------------------------------------------------------- - -#if wxUSE_DIRPICKERCTRL -IMPLEMENT_DYNAMIC_CLASS(wxDirPickerCtrl, wxPickerBase) - -bool wxDirPickerCtrl::CheckPath(const wxString& path) const -{ - // if wxDIRP_DIR_MUST_EXIST has NOT been given we must accept any path - return !HasFlag(wxDIRP_DIR_MUST_EXIST) || wxFileName::DirExists(path); -} - -wxString wxDirPickerCtrl::GetTextCtrlValue() const -{ - // filter it through wxFileName to remove any spurious path separator - return wxFileName::DirName(m_text->GetValue()).GetPath(); -} - -#endif // wxUSE_DIRPICKERCTRL diff --git a/Source/3rdParty/wx/src/common/filesys.cpp b/Source/3rdParty/wx/src/common/filesys.cpp deleted file mode 100644 index 0f850bcf6..000000000 --- a/Source/3rdParty/wx/src/common/filesys.cpp +++ /dev/null @@ -1,700 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/filesys.cpp -// Purpose: wxFileSystem class - interface for opening files -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// CVS-ID: $Id: filesys.cpp 55271 2008-08-26 00:03:04Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - - -#if wxUSE_FILESYSTEM - -#include "wx/filesys.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/module.h" -#endif - -#include "wx/sysopt.h" -#include "wx/wfstream.h" -#include "wx/mimetype.h" -#include "wx/filename.h" -#include "wx/tokenzr.h" -#include "wx/uri.h" -#include "wx/private/fileback.h" - - -//-------------------------------------------------------------------------------- -// wxFileSystemHandler -//-------------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject) - - -wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) -{ - wxString ext, mime; - wxString loc = GetRightLocation(location); - wxChar c; - int l = loc.length(), l2; - - l2 = l; - for (int i = l-1; i >= 0; i--) - { - c = loc[(unsigned int) i]; - if ( c == wxT('#') ) - l2 = i + 1; - if ( c == wxT('.') ) - { - ext = loc.Right(l2-i-1); - break; - } - if ( (c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':')) ) - return wxEmptyString; - } - -#if wxUSE_MIMETYPE - static bool s_MinimalMimeEnsured = false; - - // Don't use mime types manager if the application doesn't need it and it would be - // cause an unacceptable delay, especially on startup. - bool useMimeTypesManager = true; -#if wxUSE_SYSTEM_OPTIONS - useMimeTypesManager = (wxSystemOptions::GetOptionInt(wxT("filesys.no-mimetypesmanager")) == 0); -#endif - - if (useMimeTypesManager) - { - if (!s_MinimalMimeEnsured) - { - static const wxFileTypeInfo fallbacks[] = - { - wxFileTypeInfo(_T("image/jpeg"), - wxEmptyString, - wxEmptyString, - _T("JPEG image (from fallback)"), - _T("jpg"), _T("jpeg"), _T("JPG"), _T("JPEG"), NULL), - wxFileTypeInfo(_T("image/gif"), - wxEmptyString, - wxEmptyString, - _T("GIF image (from fallback)"), - _T("gif"), _T("GIF"), NULL), - wxFileTypeInfo(_T("image/png"), - wxEmptyString, - wxEmptyString, - _T("PNG image (from fallback)"), - _T("png"), _T("PNG"), NULL), - wxFileTypeInfo(_T("image/bmp"), - wxEmptyString, - wxEmptyString, - _T("windows bitmap image (from fallback)"), - _T("bmp"), _T("BMP"), NULL), - wxFileTypeInfo(_T("text/html"), - wxEmptyString, - wxEmptyString, - _T("HTML document (from fallback)"), - _T("htm"), _T("html"), _T("HTM"), _T("HTML"), NULL), - // must terminate the table with this! - wxFileTypeInfo() - }; - wxTheMimeTypesManager->AddFallbacks(fallbacks); - s_MinimalMimeEnsured = true; - } - - wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext); - if ( !ft || !ft -> GetMimeType(&mime) ) - { - mime = wxEmptyString; - } - - delete ft; - - return mime; - } - else -#endif - { - if ( ext.IsSameAs(wxT("htm"), false) || ext.IsSameAs(_T("html"), false) ) - return wxT("text/html"); - if ( ext.IsSameAs(wxT("jpg"), false) || ext.IsSameAs(_T("jpeg"), false) ) - return wxT("image/jpeg"); - if ( ext.IsSameAs(wxT("gif"), false) ) - return wxT("image/gif"); - if ( ext.IsSameAs(wxT("png"), false) ) - return wxT("image/png"); - if ( ext.IsSameAs(wxT("bmp"), false) ) - return wxT("image/bmp"); - return wxEmptyString; - } -} - - - -wxString wxFileSystemHandler::GetProtocol(const wxString& location) const -{ - wxString s = wxEmptyString; - int i, l = location.length(); - bool fnd = false; - - for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) { - if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true; - } - if (!fnd) return wxT("file"); - for (++i; (i < l) && (location[i] != wxT(':')); i++) s << location[i]; - return s; -} - - -wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const -{ - int i; - bool fnd = false; - - for (i = location.length()-1; i >= 0; i--) { - if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true; - else if (fnd && (location[i] == wxT('#'))) return location.Left(i); - } - return wxEmptyString; -} - -wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const -{ - int i, l = location.length(); - int l2 = l + 1; - - for (i = l-1; - (i >= 0) && - ((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':'))); - i--) - { - if (location[i] == wxT('#')) l2 = i + 1; - } - if (i == 0) return wxEmptyString; - else return location.Mid(i + 1, l2 - i - 2); -} - -wxString wxFileSystemHandler::GetAnchor(const wxString& location) const -{ - wxChar c; - int l = location.length(); - - for (int i = l-1; i >= 0; i--) { - c = location[i]; - if (c == wxT('#')) - return location.Right(l-i-1); - else if ((c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) - return wxEmptyString; - } - return wxEmptyString; -} - - -wxString wxFileSystemHandler::FindFirst(const wxString& WXUNUSED(spec), - int WXUNUSED(flags)) -{ - return wxEmptyString; -} - -wxString wxFileSystemHandler::FindNext() -{ - return wxEmptyString; -} - -//-------------------------------------------------------------------------------- -// wxLocalFSHandler -//-------------------------------------------------------------------------------- - - -wxString wxLocalFSHandler::ms_root; - -bool wxLocalFSHandler::CanOpen(const wxString& location) -{ - return GetProtocol(location) == wxT("file"); -} - -wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) -{ - // location has Unix path separators - wxString right = GetRightLocation(location); - wxFileName fn = wxFileSystem::URLToFileName(right); - wxString fullpath = ms_root + fn.GetFullPath(); - - if (!wxFileExists(fullpath)) - return (wxFSFile*) NULL; - - // we need to check whether we can really read from this file, otherwise - // wxFSFile is not going to work -#if wxUSE_FFILE - wxFFileInputStream *is = new wxFFileInputStream(fullpath); -#elif wxUSE_FILE - wxFileInputStream *is = new wxFileInputStream(fullpath); -#else -#error One of wxUSE_FILE or wxUSE_FFILE must be set to 1 for wxFSHandler to work -#endif - if ( !is->Ok() ) - { - delete is; - return (wxFSFile*) NULL; - } - - return new wxFSFile(is, - right, - GetMimeTypeFromExt(location), - GetAnchor(location) -#if wxUSE_DATETIME - ,wxDateTime(wxFileModificationTime(fullpath)) -#endif // wxUSE_DATETIME - ); -} - -wxString wxLocalFSHandler::FindFirst(const wxString& spec, int flags) -{ - wxFileName fn = wxFileSystem::URLToFileName(GetRightLocation(spec)); - return wxFindFirstFile(ms_root + fn.GetFullPath(), flags); -} - -wxString wxLocalFSHandler::FindNext() -{ - return wxFindNextFile(); -} - - - -//----------------------------------------------------------------------------- -// wxFileSystem -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxFileSystem, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxFSFile, wxObject) - - -wxList wxFileSystem::m_Handlers; - - -wxFileSystem::~wxFileSystem() -{ - WX_CLEAR_HASH_MAP(wxFSHandlerHash, m_LocalHandlers) -} - - -static wxString MakeCorrectPath(const wxString& path) -{ - wxString p(path); - wxString r; - int i, j, cnt; - - cnt = p.length(); - for (i = 0; i < cnt; i++) - if (p.GetChar(i) == wxT('\\')) p.GetWritableChar(i) = wxT('/'); // Want to be windows-safe - - if (p.Left(2) == wxT("./")) { p = p.Mid(2); cnt -= 2; } - - if (cnt < 3) return p; - - r << p.GetChar(0) << p.GetChar(1); - - // skip trailing ../.., if any - for (i = 2; i < cnt && (p.GetChar(i) == wxT('/') || p.GetChar(i) == wxT('.')); i++) r << p.GetChar(i); - - // remove back references: translate dir1/../dir2 to dir2 - for (; i < cnt; i++) - { - r << p.GetChar(i); - if (p.GetChar(i) == wxT('/') && p.GetChar(i-1) == wxT('.') && p.GetChar(i-2) == wxT('.')) - { - for (j = r.length() - 2; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {} - if (j >= 0 && r.GetChar(j) != wxT(':')) - { - for (j = j - 1; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {} - r.Remove(j + 1); - } - } - } - - for (; i < cnt; i++) r << p.GetChar(i); - - return r; -} - - -void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) -{ - int i, pathpos = -1; - - m_Path = MakeCorrectPath(location); - - if (is_dir) - { - if (m_Path.length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) - m_Path << wxT('/'); - } - - else - { - for (i = m_Path.length()-1; i >= 0; i--) - { - if (m_Path[(unsigned int) i] == wxT('/')) - { - if ((i > 1) && (m_Path[(unsigned int) (i-1)] == wxT('/')) && (m_Path[(unsigned int) (i-2)] == wxT(':'))) - { - i -= 2; - continue; - } - else - { - pathpos = i; - break; - } - } - else if (m_Path[(unsigned int) i] == wxT(':')) { - pathpos = i; - break; - } - } - if (pathpos == -1) - { - for (i = 0; i < (int) m_Path.length(); i++) - { - if (m_Path[(unsigned int) i] == wxT(':')) - { - m_Path.Remove(i+1); - break; - } - } - if (i == (int) m_Path.length()) - m_Path = wxEmptyString; - } - else - { - m_Path.Remove(pathpos+1); - } - } -} - - - -wxFileSystemHandler *wxFileSystem::MakeLocal(wxFileSystemHandler *h) -{ - wxClassInfo *classinfo = h->GetClassInfo(); - - if (classinfo->IsDynamic()) - { - wxFileSystemHandler*& local = m_LocalHandlers[classinfo]; - if (!local) - local = (wxFileSystemHandler*)classinfo->CreateObject(); - return local; - } - else - { - return h; - } -} - - - -wxFSFile* wxFileSystem::OpenFile(const wxString& location, int flags) -{ - if ((flags & wxFS_READ) == 0) - return NULL; - - wxString loc = MakeCorrectPath(location); - unsigned i, ln; - wxChar meta; - wxFSFile *s = NULL; - wxList::compatibility_iterator node; - - ln = loc.length(); - meta = 0; - for (i = 0; i < ln; i++) - { - switch (loc[i]) - { - case wxT('/') : case wxT(':') : case wxT('#') : - meta = loc[i]; - break; - } - if (meta != 0) break; - } - m_LastName = wxEmptyString; - - // try relative paths first : - if (meta != wxT(':')) - { - node = m_Handlers.GetFirst(); - while (node) - { - wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData(); - if (h->CanOpen(m_Path + loc)) - { - s = MakeLocal(h)->OpenFile(*this, m_Path + loc); - if (s) { m_LastName = m_Path + loc; break; } - } - node = node->GetNext(); - } - } - - // if failed, try absolute paths : - if (s == NULL) - { - node = m_Handlers.GetFirst(); - while (node) - { - wxFileSystemHandler *h = (wxFileSystemHandler*) node->GetData(); - if (h->CanOpen(loc)) - { - s = MakeLocal(h)->OpenFile(*this, loc); - if (s) { m_LastName = loc; break; } - } - node = node->GetNext(); - } - } - - if (s && (flags & wxFS_SEEKABLE) != 0 && !s->GetStream()->IsSeekable()) - { - wxBackedInputStream *stream; - stream = new wxBackedInputStream(s->DetachStream()); - stream->FindLength(); - s->SetStream(stream); - } - - return (s); -} - - - -wxString wxFileSystem::FindFirst(const wxString& spec, int flags) -{ - wxList::compatibility_iterator node; - wxString spec2(spec); - - m_FindFileHandler = NULL; - - for (int i = spec2.length()-1; i >= 0; i--) - if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe - - node = m_Handlers.GetFirst(); - while (node) - { - wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData(); - if (h -> CanOpen(m_Path + spec2)) - { - m_FindFileHandler = MakeLocal(h); - return m_FindFileHandler -> FindFirst(m_Path + spec2, flags); - } - node = node->GetNext(); - } - - node = m_Handlers.GetFirst(); - while (node) - { - wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData(); - if (h -> CanOpen(spec2)) - { - m_FindFileHandler = MakeLocal(h); - return m_FindFileHandler -> FindFirst(spec2, flags); - } - node = node->GetNext(); - } - - return wxEmptyString; -} - - - -wxString wxFileSystem::FindNext() -{ - if (m_FindFileHandler == NULL) return wxEmptyString; - else return m_FindFileHandler -> FindNext(); -} - -bool wxFileSystem::FindFileInPath(wxString *pStr, - const wxChar *path, - const wxChar *basename) -{ - // we assume that it's not empty - wxCHECK_MSG( !wxIsEmpty(basename), false, - _T("empty file name in wxFileSystem::FindFileInPath")); - - // skip path separator in the beginning of the file name if present - if ( wxIsPathSeparator(*basename) ) - basename++; - - wxStringTokenizer tokenizer(path, wxPATH_SEP); - while ( tokenizer.HasMoreTokens() ) - { - wxString strFile = tokenizer.GetNextToken(); - if ( !wxEndsWithPathSeparator(strFile) ) - strFile += wxFILE_SEP_PATH; - strFile += basename; - - wxFSFile *file = OpenFile(strFile); - if ( file ) - { - delete file; - *pStr = strFile; - return true; - } - } - - return false; -} - -void wxFileSystem::AddHandler(wxFileSystemHandler *handler) -{ - // prepend the handler to the beginning of the list because handlers added - // last should have the highest priority to allow overriding them - m_Handlers.Insert((size_t)0, handler); -} - -wxFileSystemHandler* wxFileSystem::RemoveHandler(wxFileSystemHandler *handler) -{ - // if handler has already been removed (or deleted) - // we return NULL. This is by design in case - // CleanUpHandlers() is called before RemoveHandler - // is called, as we cannot control the order - // which modules are unloaded - if (!m_Handlers.DeleteObject(handler)) - return NULL; - - return handler; -} - - -bool wxFileSystem::HasHandlerForPath(const wxString &location) -{ - for ( wxList::compatibility_iterator node = m_Handlers.GetFirst(); - node; node = node->GetNext() ) - { - wxFileSystemHandler *h = (wxFileSystemHandler*) node->GetData(); - if (h->CanOpen(location)) - return true; - } - - return false; -} - -void wxFileSystem::CleanUpHandlers() -{ - WX_CLEAR_LIST(wxList, m_Handlers); -} - -static const wxString g_unixPathString(wxT("/")); -static const wxString g_nativePathString(wxFILE_SEP_PATH); - -// Returns the native path for a file URL -wxFileName wxFileSystem::URLToFileName(const wxString& url) -{ - wxString path = url; - - if ( path.Find(wxT("file://")) == 0 ) - { - path = path.Mid(7); - } - else if ( path.Find(wxT("file:")) == 0 ) - { - path = path.Mid(5); - } - // Remove preceding double slash on Mac Classic -#if defined(__WXMAC__) && !defined(__UNIX__) - else if ( path.Find(wxT("//")) == 0 ) - path = path.Mid(2); -#endif - - path = wxURI::Unescape(path); - -#ifdef __WXMSW__ - // file urls either start with a forward slash (local harddisk), - // otherwise they have a servername/sharename notation, - // which only exists on msw and corresponds to a unc - if ( path[0u] == wxT('/') && path [1u] != wxT('/')) - { - path = path.Mid(1); - } - else if ( (url.Find(wxT("file://")) == 0) && - (path.Find(wxT('/')) != wxNOT_FOUND) && - (path.length() > 1) && (path[1u] != wxT(':')) ) - { - path = wxT("//") + path; - } -#endif - - path.Replace(g_unixPathString, g_nativePathString); - - return wxFileName(path, wxPATH_NATIVE); -} - -// Returns the file URL for a native path -wxString wxFileSystem::FileNameToURL(const wxFileName& filename) -{ - wxFileName fn = filename; - fn.Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_ABSOLUTE); - wxString url = fn.GetFullPath(wxPATH_NATIVE); - -#ifndef __UNIX__ - // unc notation, wxMSW - if ( url.Find(wxT("\\\\")) == 0 ) - { - url = wxT("//") + url.Mid(2); - } - else - { - url = wxT("/") + url; -#ifdef __WXMAC__ - url = wxT("/") + url; -#endif - - } -#endif - - url.Replace(g_nativePathString, g_unixPathString); - url.Replace(wxT("%"), wxT("%25")); // '%'s must be replaced first! - url.Replace(wxT("#"), wxT("%23")); - url.Replace(wxT(":"), wxT("%3A")); - url = wxT("file:") + url; - return url; -} - - -///// Module: - -class wxFileSystemModule : public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxFileSystemModule) - - public: - wxFileSystemModule() : - wxModule(), - m_handler(NULL) - { - } - - virtual bool OnInit() - { - m_handler = new wxLocalFSHandler; - wxFileSystem::AddHandler(m_handler); - return true; - } - virtual void OnExit() - { - delete wxFileSystem::RemoveHandler(m_handler); - - wxFileSystem::CleanUpHandlers(); - } - - private: - wxFileSystemHandler* m_handler; - -}; - -IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule) - -#endif - // wxUSE_FILESYSTEM diff --git a/Source/3rdParty/wx/src/common/filtall.cpp b/Source/3rdParty/wx/src/common/filtall.cpp deleted file mode 100644 index 952730f82..000000000 --- a/Source/3rdParty/wx/src/common/filtall.cpp +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/filtall.cpp -// Purpose: Link all filter streams -// Author: Mike Wetherell -// RCS-ID: $Id: filtall.cpp 42412 2006-10-25 20:41:12Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#if wxUSE_ZLIB -#include "wx/zstream.h" -#endif - -// Reference filter classes to ensure they are linked into a statically -// linked program that uses Find or GetFirst to look for an filter handler. -// It is in its own file so that the user can override this behaviour by -// providing their own implementation. - -void wxUseFilterClasses() -{ -#if wxUSE_ZLIB - wxZlibClassFactory(); - wxGzipClassFactory(); -#endif -} - -#endif // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/filtfind.cpp b/Source/3rdParty/wx/src/common/filtfind.cpp deleted file mode 100644 index 16cb227f3..000000000 --- a/Source/3rdParty/wx/src/common/filtfind.cpp +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/filtfind.cpp -// Purpose: Streams for filter formats -// Author: Mike Wetherell -// RCS-ID: $Id: filtfind.cpp 42412 2006-10-25 20:41:12Z MW $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/stream.h" - -// These functions are in a separate file so that statically linked apps -// that do not call them to search for filter handlers will only link in -// the filter classes they use. - -const wxFilterClassFactory * -wxFilterClassFactory::Find(const wxChar *protocol, wxStreamProtocolType type) -{ - for (const wxFilterClassFactory *f = GetFirst(); f; f = f->GetNext()) - if (f->CanHandle(protocol, type)) - return f; - - return NULL; -} - -// static -const wxFilterClassFactory *wxFilterClassFactory::GetFirst() -{ - if (!sm_first) - wxUseFilterClasses(); - return sm_first; -} - -#endif // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/fldlgcmn.cpp b/Source/3rdParty/wx/src/common/fldlgcmn.cpp deleted file mode 100644 index 6f59d40eb..000000000 --- a/Source/3rdParty/wx/src/common/fldlgcmn.cpp +++ /dev/null @@ -1,348 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fldlgcmn.cpp -// Purpose: wxFileDialog common functions -// Author: John Labenski -// Modified by: -// Created: 14.06.03 (extracted from src/*/filedlg.cpp) -// RCS-ID: $Id: fldlgcmn.cpp 66916 2011-02-16 21:48:55Z JS $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if wxUSE_FILEDLG - -#include "wx/filedlg.h" -#include "wx/dirdlg.h" - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/window.h" -#endif // WX_PRECOMP - -//---------------------------------------------------------------------------- -// wxFileDialogBase -//---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog) - -void wxFileDialogBase::Init() -{ - m_filterIndex = - m_windowStyle = 0; -} - -bool wxFileDialogBase::Create(wxWindow *parent, - const wxString& message, - const wxString& defaultDir, - const wxString& defaultFile, - const wxString& wildCard, - long style, - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(sz), - const wxString& WXUNUSED(name)) -{ - m_message = message; - m_dir = defaultDir; - m_fileName = defaultFile; - m_wildCard = wildCard; - - m_parent = parent; - m_windowStyle = style; - m_filterIndex = 0; - - if (!HasFdFlag(wxFD_OPEN) && !HasFdFlag(wxFD_SAVE)) - m_windowStyle |= wxFD_OPEN; // wxFD_OPEN is the default - - // check that the styles are not contradictory - wxASSERT_MSG( !(HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OPEN)), - _T("can't specify both wxFD_SAVE and wxFD_OPEN at once") ); - - wxASSERT_MSG( !HasFdFlag(wxFD_SAVE) || - (!HasFdFlag(wxFD_MULTIPLE) && !HasFdFlag(wxFD_FILE_MUST_EXIST)), - _T("wxFD_MULTIPLE or wxFD_FILE_MUST_EXIST can't be used with wxFD_SAVE" ) ); - - wxASSERT_MSG( !HasFdFlag(wxFD_OPEN) || !HasFdFlag(wxFD_OVERWRITE_PROMPT), - _T("wxFD_OVERWRITE_PROMPT can't be used with wxFD_OPEN") ); - - if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr ) - { - m_wildCard = wxString::Format(_("All files (%s)|%s"), - wxFileSelectorDefaultWildcardStr, - wxFileSelectorDefaultWildcardStr); - } - else // have wild card - { - // convert m_wildCard from "*.bar" to "bar files (*.bar)|*.bar" - if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND ) - { - wxString::size_type nDot = m_wildCard.find(_T("*.")); - if ( nDot != wxString::npos ) - nDot++; - else - nDot = 0; - - m_wildCard = wxString::Format - ( - _("%s files (%s)|%s"), - wildCard.c_str() + nDot, - wildCard.c_str(), - wildCard.c_str() - ); - } - } - - return true; -} - -#if WXWIN_COMPATIBILITY_2_4 -// Parses the filterStr, returning the number of filters. -// Returns 0 if none or if there's a problem. -// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg" -int wxFileDialogBase::ParseWildcard(const wxString& filterStr, - wxArrayString& descriptions, - wxArrayString& filters) -{ - return ::wxParseCommonDialogsFilter(filterStr, descriptions, filters); -} -#endif // WXWIN_COMPATIBILITY_2_4 - -#if WXWIN_COMPATIBILITY_2_6 -long wxFileDialogBase::GetStyle() const -{ - return GetWindowStyle(); -} - -void wxFileDialogBase::SetStyle(long style) -{ - SetWindowStyle(style); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - -wxString wxFileDialogBase::AppendExtension(const wxString &filePath, - const wxString &extensionList) -{ - // strip off path, to avoid problems with "path.bar/foo" - wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH); - - // if fileName is of form "foo.bar" it's ok, return it - int idx_dot = fileName.Find(wxT('.'), true); - if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.length() - 1)) - return filePath; - - // get the first extension from extensionList, or all of it - wxString ext = extensionList.BeforeFirst(wxT(';')); - - // if ext == "foo" or "foo." there's no extension - int idx_ext_dot = ext.Find(wxT('.'), true); - if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.length() - 1)) - return filePath; - else - ext = ext.AfterLast(wxT('.')); - - // if ext == "*" or "bar*" or "b?r" or " " then its not valid - if ((ext.Find(wxT('*')) != wxNOT_FOUND) || - (ext.Find(wxT('?')) != wxNOT_FOUND) || - (ext.Strip(wxString::both).empty())) - return filePath; - - // if fileName doesn't have a '.' then add one - if (filePath.Last() != wxT('.')) - ext = wxT(".") + ext; - - return filePath + ext; -} - -//---------------------------------------------------------------------------- -// wxFileDialog convenience functions -//---------------------------------------------------------------------------- - -wxString wxFileSelector(const wxChar *title, - const wxChar *defaultDir, - const wxChar *defaultFileName, - const wxChar *defaultExtension, - const wxChar *filter, - int flags, - wxWindow *parent, - int x, int y) -{ - // The defaultExtension, if non-NULL, is - // appended to the filename if the user fails to type an extension. The new - // implementation (taken from wxFileSelectorEx) appends the extension - // automatically, by looking at the filter specification. In fact this - // should be better than the native Microsoft implementation because - // Windows only allows *one* default extension, whereas here we do the - // right thing depending on the filter the user has chosen. - - // If there's a default extension specified but no filter, we create a - // suitable filter. - - wxString filter2; - if ( !wxIsEmpty(defaultExtension) && wxIsEmpty(filter) ) - filter2 = wxString(wxT("*.")) + defaultExtension; - else if ( !wxIsEmpty(filter) ) - filter2 = filter; - - wxString defaultDirString; - if (!wxIsEmpty(defaultDir)) - defaultDirString = defaultDir; - - wxString defaultFilenameString; - if (!wxIsEmpty(defaultFileName)) - defaultFilenameString = defaultFileName; - - wxFileDialog fileDialog(parent, title, defaultDirString, - defaultFilenameString, filter2, - flags, wxPoint(x, y)); - - // if filter is of form "All files (*)|*|..." set correct filter index - if((wxStrlen(defaultExtension) != 0) && (filter2.Find(wxT('|')) != wxNOT_FOUND)) - { - int filterIndex = 0; - - wxArrayString descriptions, filters; - // don't care about errors, handled already by wxFileDialog - (void)wxParseCommonDialogsFilter(filter2, descriptions, filters); - for (size_t n=0; n 0) - fileDialog.SetFilterIndex(filterIndex); - } - - wxString filename; - if ( fileDialog.ShowModal() == wxID_OK ) - { - filename = fileDialog.GetPath(); - } - - return filename; -} - -//---------------------------------------------------------------------------- -// wxFileSelectorEx -//---------------------------------------------------------------------------- - -wxString wxFileSelectorEx(const wxChar *title, - const wxChar *defaultDir, - const wxChar *defaultFileName, - int* defaultFilterIndex, - const wxChar *filter, - int flags, - wxWindow* parent, - int x, - int y) - -{ - wxFileDialog fileDialog(parent, - !wxIsEmpty(title) ? title : wxEmptyString, - !wxIsEmpty(defaultDir) ? defaultDir : wxEmptyString, - !wxIsEmpty(defaultFileName) ? defaultFileName : wxEmptyString, - !wxIsEmpty(filter) ? filter : wxEmptyString, - flags, wxPoint(x, y)); - - wxString filename; - if ( fileDialog.ShowModal() == wxID_OK ) - { - if ( defaultFilterIndex ) - *defaultFilterIndex = fileDialog.GetFilterIndex(); - - filename = fileDialog.GetPath(); - } - - return filename; -} - -//---------------------------------------------------------------------------- -// wxDefaultFileSelector - Generic load/save dialog (for internal use only) -//---------------------------------------------------------------------------- - -static wxString wxDefaultFileSelector(bool load, - const wxChar *what, - const wxChar *extension, - const wxChar *default_name, - wxWindow *parent) -{ - wxString prompt; - wxString str; - if (load) - str = _("Load %s file"); - else - str = _("Save %s file"); - prompt.Printf(str, what); - - wxString wild; - const wxChar *ext = extension; - if ( !wxIsEmpty(ext) ) - { - if ( *ext == wxT('.') ) - ext++; - - wild.Printf(wxT("*.%s"), ext); - } - else // no extension specified - { - wild = wxFileSelectorDefaultWildcardStr; - } - - return wxFileSelector(prompt, NULL, default_name, ext, wild, - load ? (wxFD_OPEN | wxFD_FILE_MUST_EXIST) : wxFD_SAVE, parent); -} - -//---------------------------------------------------------------------------- -// wxLoadFileSelector -//---------------------------------------------------------------------------- - -WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name, - wxWindow *parent) -{ - return wxDefaultFileSelector(true, what, extension, default_name, parent); -} - -//---------------------------------------------------------------------------- -// wxSaveFileSelector -//---------------------------------------------------------------------------- - -WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name, - wxWindow *parent) -{ - return wxDefaultFileSelector(false, what, extension, default_name, parent); -} - - -//---------------------------------------------------------------------------- -// wxDirDialogBase -//---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 -long wxDirDialogBase::GetStyle() const -{ - return GetWindowStyle(); -} - -void wxDirDialogBase::SetStyle(long style) -{ - SetWindowStyle(style); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - -#endif // wxUSE_FILEDLG diff --git a/Source/3rdParty/wx/src/common/fmapbase.cpp b/Source/3rdParty/wx/src/common/fmapbase.cpp deleted file mode 100644 index d273922c1..000000000 --- a/Source/3rdParty/wx/src/common/fmapbase.cpp +++ /dev/null @@ -1,737 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/fmapbase.cpp -// Purpose: wxFontMapperBase class implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 (extracted from common/fontmap.cpp) -// RCS-ID: $Id: fmapbase.cpp 43063 2006-11-04 20:48:04Z VZ $ -// Copyright: (c) 1999-2003 Vadim Zeitlin -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FONTMAP - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/module.h" -#endif //WX_PRECOMP - -#if defined(__WXMSW__) - #include "wx/msw/private.h" // includes windows.h for LOGFONT - #include "wx/msw/winundef.h" -#endif - -#include "wx/fontmap.h" -#include "wx/fmappriv.h" - -#include "wx/apptrait.h" - -// wxMemoryConfig uses wxFileConfig -#if wxUSE_CONFIG && wxUSE_FILECONFIG - #include "wx/config.h" - #include "wx/memconf.h" -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// encodings supported by GetEncodingDescription -static wxFontEncoding gs_encodings[] = -{ - wxFONTENCODING_ISO8859_1, - wxFONTENCODING_ISO8859_2, - wxFONTENCODING_ISO8859_3, - wxFONTENCODING_ISO8859_4, - wxFONTENCODING_ISO8859_5, - wxFONTENCODING_ISO8859_6, - wxFONTENCODING_ISO8859_7, - wxFONTENCODING_ISO8859_8, - wxFONTENCODING_ISO8859_9, - wxFONTENCODING_ISO8859_10, - wxFONTENCODING_ISO8859_11, - wxFONTENCODING_ISO8859_12, - wxFONTENCODING_ISO8859_13, - wxFONTENCODING_ISO8859_14, - wxFONTENCODING_ISO8859_15, - wxFONTENCODING_KOI8, - wxFONTENCODING_KOI8_U, - wxFONTENCODING_CP874, - wxFONTENCODING_CP932, - wxFONTENCODING_CP936, - wxFONTENCODING_CP949, - wxFONTENCODING_CP950, - wxFONTENCODING_CP1250, - wxFONTENCODING_CP1251, - wxFONTENCODING_CP1252, - wxFONTENCODING_CP1253, - wxFONTENCODING_CP1254, - wxFONTENCODING_CP1255, - wxFONTENCODING_CP1256, - wxFONTENCODING_CP1257, - wxFONTENCODING_CP437, - wxFONTENCODING_UTF7, - wxFONTENCODING_UTF8, - wxFONTENCODING_UTF16BE, - wxFONTENCODING_UTF16LE, - wxFONTENCODING_UTF32BE, - wxFONTENCODING_UTF32LE, - wxFONTENCODING_EUC_JP, - wxFONTENCODING_DEFAULT, - wxFONTENCODING_BIG5, - wxFONTENCODING_SHIFT_JIS, - wxFONTENCODING_GB2312, -}; - -// the descriptions for them -static const wxChar* gs_encodingDescs[] = -{ - wxTRANSLATE( "Western European (ISO-8859-1)" ), - wxTRANSLATE( "Central European (ISO-8859-2)" ), - wxTRANSLATE( "Esperanto (ISO-8859-3)" ), - wxTRANSLATE( "Baltic (old) (ISO-8859-4)" ), - wxTRANSLATE( "Cyrillic (ISO-8859-5)" ), - wxTRANSLATE( "Arabic (ISO-8859-6)" ), - wxTRANSLATE( "Greek (ISO-8859-7)" ), - wxTRANSLATE( "Hebrew (ISO-8859-8)" ), - wxTRANSLATE( "Turkish (ISO-8859-9)" ), - wxTRANSLATE( "Nordic (ISO-8859-10)" ), - wxTRANSLATE( "Thai (ISO-8859-11)" ), - wxTRANSLATE( "Indian (ISO-8859-12)" ), - wxTRANSLATE( "Baltic (ISO-8859-13)" ), - wxTRANSLATE( "Celtic (ISO-8859-14)" ), - wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ), - wxTRANSLATE( "KOI8-R" ), - wxTRANSLATE( "KOI8-U" ), - wxTRANSLATE( "Windows Thai (CP 874)" ), - wxTRANSLATE( "Windows Japanese (CP 932)" ), - wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ), - wxTRANSLATE( "Windows Korean (CP 949)" ), - wxTRANSLATE( "Windows Chinese Traditional (CP 950)" ), - wxTRANSLATE( "Windows Central European (CP 1250)" ), - wxTRANSLATE( "Windows Cyrillic (CP 1251)" ), - wxTRANSLATE( "Windows Western European (CP 1252)" ), - wxTRANSLATE( "Windows Greek (CP 1253)" ), - wxTRANSLATE( "Windows Turkish (CP 1254)" ), - wxTRANSLATE( "Windows Hebrew (CP 1255)" ), - wxTRANSLATE( "Windows Arabic (CP 1256)" ), - wxTRANSLATE( "Windows Baltic (CP 1257)" ), - wxTRANSLATE( "Windows/DOS OEM (CP 437)" ), - wxTRANSLATE( "Unicode 7 bit (UTF-7)" ), - wxTRANSLATE( "Unicode 8 bit (UTF-8)" ), -#ifdef WORDS_BIGENDIAN - wxTRANSLATE( "Unicode 16 bit (UTF-16)" ), - wxTRANSLATE( "Unicode 16 bit Little Endian (UTF-16LE)" ), - wxTRANSLATE( "Unicode 32 bit (UTF-32)" ), - wxTRANSLATE( "Unicode 32 bit Little Endian (UTF-32LE)" ), -#else // WORDS_BIGENDIAN - wxTRANSLATE( "Unicode 16 bit Big Endian (UTF-16BE)" ), - wxTRANSLATE( "Unicode 16 bit (UTF-16)" ), - wxTRANSLATE( "Unicode 32 bit Big Endian (UTF-32BE)" ), - wxTRANSLATE( "Unicode 32 bit (UTF-32)" ), -#endif // WORDS_BIGENDIAN - wxTRANSLATE( "Extended Unix Codepage for Japanese (EUC-JP)" ), - wxTRANSLATE( "US-ASCII" ), - wxTRANSLATE( "BIG5" ), - wxTRANSLATE( "SHIFT-JIS" ), - wxTRANSLATE( "GB-2312" ), -}; - -// and the internal names (these are not translated on purpose!) -static const wxChar* gs_encodingNames[WXSIZEOF(gs_encodingDescs)][9] = -{ - // names from the columns correspond to these OS: - // Linux Solaris and IRIX HP-UX AIX - { _T("ISO-8859-1"), _T("ISO8859-1"), _T("iso88591"), _T("8859-1"), wxT("iso_8859_1"), NULL }, - { _T("ISO-8859-2"), _T("ISO8859-2"), _T("iso88592"), _T("8859-2"), NULL }, - { _T("ISO-8859-3"), _T("ISO8859-3"), _T("iso88593"), _T("8859-3"), NULL }, - { _T("ISO-8859-4"), _T("ISO8859-4"), _T("iso88594"), _T("8859-4"), NULL }, - { _T("ISO-8859-5"), _T("ISO8859-5"), _T("iso88595"), _T("8859-5"), NULL }, - { _T("ISO-8859-6"), _T("ISO8859-6"), _T("iso88596"), _T("8859-6"), NULL }, - { _T("ISO-8859-7"), _T("ISO8859-7"), _T("iso88597"), _T("8859-7"), NULL }, - { _T("ISO-8859-8"), _T("ISO8859-8"), _T("iso88598"), _T("8859-8"), NULL }, - { _T("ISO-8859-9"), _T("ISO8859-9"), _T("iso88599"), _T("8859-9"), NULL }, - { _T("ISO-8859-10"), _T("ISO8859-10"), _T("iso885910"), _T("8859-10"), NULL }, - { _T("ISO-8859-11"), _T("ISO8859-11"), _T("iso885911"), _T("8859-11"), NULL }, - { _T("ISO-8859-12"), _T("ISO8859-12"), _T("iso885912"), _T("8859-12"), NULL }, - { _T("ISO-8859-13"), _T("ISO8859-13"), _T("iso885913"), _T("8859-13"), NULL }, - { _T("ISO-8859-14"), _T("ISO8859-14"), _T("iso885914"), _T("8859-14"), NULL }, - { _T("ISO-8859-15"), _T("ISO8859-15"), _T("iso885915"), _T("8859-15"), NULL }, - - // although koi8-ru is not strictly speaking the same as koi8-r, - // they are similar enough to make mapping it to koi8 better than - // not recognizing it at all - { wxT( "KOI8-R" ), wxT( "KOI8-RU" ), NULL }, - { wxT( "KOI8-U" ), NULL }, - - { wxT( "WINDOWS-874" ), wxT( "CP-874" ), NULL }, - { wxT( "WINDOWS-932" ), wxT( "CP-932" ), NULL }, - { wxT( "WINDOWS-936" ), wxT( "CP-936" ), NULL }, - { wxT( "WINDOWS-949" ), wxT( "CP-949" ), wxT( "EUC-KR" ), wxT( "eucKR" ), wxT( "euc_kr" ), NULL }, - { wxT( "WINDOWS-950" ), wxT( "CP-950" ), NULL }, - { wxT( "WINDOWS-1250" ),wxT( "CP-1250" ), NULL }, - { wxT( "WINDOWS-1251" ),wxT( "CP-1251" ), NULL }, - { wxT( "WINDOWS-1252" ),wxT( "CP-1252" ), wxT("IBM-1252"), NULL }, - { wxT( "WINDOWS-1253" ),wxT( "CP-1253" ), NULL }, - { wxT( "WINDOWS-1254" ),wxT( "CP-1254" ), NULL }, - { wxT( "WINDOWS-1255" ),wxT( "CP-1255" ), NULL }, - { wxT( "WINDOWS-1256" ),wxT( "CP-1256" ), NULL }, - { wxT( "WINDOWS-1257" ),wxT( "CP-1257" ), NULL }, - { wxT( "WINDOWS-437" ), wxT( "CP-437" ), NULL }, - - { wxT( "UTF-7" ), wxT("utf7"), NULL }, - { wxT( "UTF-8" ), wxT("utf8"), NULL }, -#ifdef WORDS_BIGENDIAN - { wxT( "UTF-16BE" ), wxT("UCS-2BE"), wxT( "UTF-16" ), wxT("UCS-2"), wxT("UCS2"), NULL }, - { wxT( "UTF-16LE" ), wxT("UCS-2LE"), NULL }, - { wxT( "UTF-32BE" ), wxT( "UCS-4BE" ), wxT( "UTF-32" ), wxT( "UCS-4" ), wxT("UCS4"), NULL }, - { wxT( "UTF-32LE" ), wxT( "UCS-4LE" ), NULL }, -#else // WORDS_BIGENDIAN - { wxT( "UTF-16BE" ), wxT("UCS-2BE"), NULL }, - { wxT( "UTF-16LE" ), wxT("UCS-2LE"), wxT( "UTF-16" ), wxT("UCS-2"), wxT("UCS2"), NULL }, - { wxT( "UTF-32BE" ), wxT( "UCS-4BE" ), NULL }, - { wxT( "UTF-32LE" ), wxT( "UCS-4LE" ), wxT( "UTF-32" ), wxT( "UCS-4" ), wxT("UCS4"), NULL }, -#endif // WORDS_BIGENDIAN - - { wxT( "EUC-JP" ), wxT( "eucJP" ), wxT( "euc_jp" ), wxT( "IBM-eucJP" ), NULL }, - - // 646 is for Solaris, roman8 -- for HP-UX - { wxT( "US-ASCII" ), wxT( "ASCII" ), wxT("C"), wxT("POSIX"), wxT("ANSI_X3.4-1968"), - wxT("646"), wxT("roman8"), wxT( "" ), NULL }, - - { wxT( "BIG5" ), wxT("big5"), NULL }, - { wxT( "SJIS" ), wxT( "SHIFT-JIS" ), wxT( "SHIFT_JIS" ), NULL }, - { wxT( "GB2312" ), NULL }, -}; - -wxCOMPILE_TIME_ASSERT( WXSIZEOF(gs_encodingDescs) == WXSIZEOF(gs_encodings), EncodingsArraysNotInSync ); -wxCOMPILE_TIME_ASSERT( WXSIZEOF(gs_encodingNames) == WXSIZEOF(gs_encodings), EncodingsArraysNotInSync ); - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// clean up the font mapper object -class wxFontMapperModule : public wxModule -{ -public: - wxFontMapperModule() : wxModule() { } - - virtual bool OnInit() - { - // a dummy wxFontMapperBase object could have been created during the - // program startup before wxApp was created, we have to delete it to - // allow creating the real font mapper next time it is needed now that - // we can create it (when the modules are initialized, wxApp object - // already exists) - wxFontMapperBase *fm = wxFontMapperBase::Get(); - if ( fm && fm->IsDummy() ) - wxFontMapperBase::Reset(); - - return true; - } - - virtual void OnExit() - { - wxFontMapperBase::Reset(); - } - - DECLARE_DYNAMIC_CLASS(wxFontMapperModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule) - - -// ============================================================================ -// wxFontMapperBase implementation -// ============================================================================ - -wxFontMapper *wxFontMapperBase::sm_instance = NULL; - -// ---------------------------------------------------------------------------- -// ctor and dtor -// ---------------------------------------------------------------------------- - -wxFontMapperBase::wxFontMapperBase() -{ -#if wxUSE_CONFIG && wxUSE_FILECONFIG - m_configDummy = NULL; -#endif // wxUSE_CONFIG -} - -wxFontMapperBase::~wxFontMapperBase() -{ -#if wxUSE_CONFIG && wxUSE_FILECONFIG - if ( m_configDummy ) - delete m_configDummy; -#endif // wxUSE_CONFIG -} - -/* static */ -wxFontMapperBase *wxFontMapperBase::Get() -{ - if ( !sm_instance ) - { - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( traits ) - { - sm_instance = traits->CreateFontMapper(); - - wxASSERT_MSG( sm_instance, - _T("wxAppTraits::CreateFontMapper() failed") ); - } - - if ( !sm_instance ) - { - // last resort: we must create something because the existing code - // relies on always having a valid font mapper object - sm_instance = (wxFontMapper *)new wxFontMapperBase; - } - } - - return (wxFontMapperBase*)sm_instance; -} - -/* static */ -wxFontMapper *wxFontMapperBase::Set(wxFontMapper *mapper) -{ - wxFontMapper *old = sm_instance; - sm_instance = mapper; - return old; -} - -/* static */ -void wxFontMapperBase::Reset() -{ - if ( sm_instance ) - { - // we need a cast as wxFontMapper is not fully declared here and so the - // compiler can't know that it derives from wxFontMapperBase (but - // run-time behaviour will be correct because the dtor is virtual) - delete (wxFontMapperBase *)sm_instance; - sm_instance = NULL; - } -} - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - -// ---------------------------------------------------------------------------- -// config usage customisation -// ---------------------------------------------------------------------------- - -/* static */ -const wxChar *wxFontMapperBase::GetDefaultConfigPath() -{ - return FONTMAPPER_ROOT_PATH; -} - -void wxFontMapperBase::SetConfigPath(const wxString& prefix) -{ - wxCHECK_RET( !prefix.empty() && prefix[0] == wxCONFIG_PATH_SEPARATOR, - wxT("an absolute path should be given to wxFontMapper::SetConfigPath()") ); - - m_configRootPath = prefix; -} - -// ---------------------------------------------------------------------------- -// get config object and path for it -// ---------------------------------------------------------------------------- - -wxConfigBase *wxFontMapperBase::GetConfig() -{ - wxConfigBase *config = wxConfig::Get(false); - - // If there is no global configuration, use an internal memory configuration - if ( !config ) - { - if ( !m_configDummy ) - m_configDummy = new wxMemoryConfig; - config = m_configDummy; - - // FIXME: ideally, we should add keys from dummy config to a real one later, - // but it is a low-priority task because typical wxWin application - // either doesn't use wxConfig at all or creates wxConfig object in - // wxApp::OnInit(), before any real interaction with the user takes - // place... - } - - return config; -} - -const wxString& wxFontMapperBase::GetConfigPath() -{ - if ( !m_configRootPath ) - { - // use the default - m_configRootPath = GetDefaultConfigPath(); - } - - return m_configRootPath; -} - -// ---------------------------------------------------------------------------- -// config helpers -// ---------------------------------------------------------------------------- - -bool wxFontMapperBase::ChangePath(const wxString& pathNew, wxString *pathOld) -{ - wxConfigBase *config = GetConfig(); - if ( !config ) - return false; - - *pathOld = config->GetPath(); - - wxString path = GetConfigPath(); - if ( path.empty() || path.Last() != wxCONFIG_PATH_SEPARATOR ) - { - path += wxCONFIG_PATH_SEPARATOR; - } - - wxASSERT_MSG( !pathNew || (pathNew[0] != wxCONFIG_PATH_SEPARATOR), - wxT("should be a relative path") ); - - path += pathNew; - - config->SetPath(path); - - return true; -} - -void wxFontMapperBase::RestorePath(const wxString& pathOld) -{ - GetConfig()->SetPath(pathOld); -} - -#endif - -// ---------------------------------------------------------------------------- -// charset/encoding correspondence -// ---------------------------------------------------------------------------- - -wxFontEncoding -wxFontMapperBase::CharsetToEncoding(const wxString& charset, - bool WXUNUSED(interactive)) -{ - int enc = NonInteractiveCharsetToEncoding(charset); - if ( enc == wxFONTENCODING_UNKNOWN ) - { - // we should return wxFONTENCODING_SYSTEM from here for unknown - // encodings - enc = wxFONTENCODING_SYSTEM; - } - - return (wxFontEncoding)enc; -} - -int -wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) -{ - wxFontEncoding encoding = wxFONTENCODING_SYSTEM; - - // we're going to modify it, make a copy - wxString cs = charset; - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // first try the user-defined settings - wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH); - if ( path.IsOk() ) - { - wxConfigBase *config = GetConfig(); - - // do we have an encoding for this charset? - long value = config->Read(charset, -1l); - if ( value != -1 ) - { - if ( value == wxFONTENCODING_UNKNOWN ) - { - // don't try to find it, in particular don't ask the user - return value; - } - - if ( value >= 0 && value <= wxFONTENCODING_MAX ) - { - encoding = (wxFontEncoding)value; - } - else - { - wxLogDebug(wxT("corrupted config data: invalid encoding %ld for charset '%s' ignored"), - value, charset.c_str()); - } - } - - if ( encoding == wxFONTENCODING_SYSTEM ) - { - // may be we have an alias? - config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH); - - wxString alias = config->Read(charset); - if ( !alias.empty() ) - { - // yes, we do - use it instead - cs = alias; - } - } - } -#endif // wxUSE_CONFIG - - // if didn't find it there, try to recognize it ourselves - if ( encoding == wxFONTENCODING_SYSTEM ) - { - // trim any spaces - cs.Trim(true); - cs.Trim(false); - - // discard the optional quotes - if ( !cs.empty() ) - { - if ( cs[0u] == _T('"') && cs.Last() == _T('"') ) - { - cs = wxString(cs.c_str(), cs.length() - 1); - } - } - - for ( size_t i = 0; i < WXSIZEOF(gs_encodingNames); ++i ) - { - for ( const wxChar** encName = gs_encodingNames[i]; *encName; ++encName ) - { - if ( cs.CmpNoCase(*encName) == 0 ) - return gs_encodings[i]; - } - } - - cs.MakeUpper(); - - if ( cs.Left(3) == wxT("ISO") ) - { - // the dash is optional (or, to be exact, it is not, but - // several brokenmails "forget" it) - const wxChar *p = cs.c_str() + 3; - if ( *p == wxT('-') ) - p++; - - // printf( "iso %s\n", (const char*) cs.ToAscii() ); - - unsigned int value; - if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) - { - // printf( "value %d\n", (int)value ); - - // make it 0 based and check that it is strictly positive in - // the process (no such thing as iso8859-0 encoding) - if ( (value-- > 0) && - (value < wxFONTENCODING_ISO8859_MAX - - wxFONTENCODING_ISO8859_1) ) - { - // it's a valid ISO8859 encoding - value += wxFONTENCODING_ISO8859_1; - encoding = (wxFontEncoding)value; - } - } - } - else if ( cs.Left(4) == wxT("8859") ) - { - const wxChar *p = cs.c_str(); - - unsigned int value; - if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) - { - // printf( "value %d\n", (int)value ); - - // make it 0 based and check that it is strictly positive in - // the process (no such thing as iso8859-0 encoding) - if ( (value-- > 0) && - (value < wxFONTENCODING_ISO8859_MAX - - wxFONTENCODING_ISO8859_1) ) - { - // it's a valid ISO8859 encoding - value += wxFONTENCODING_ISO8859_1; - encoding = (wxFontEncoding)value; - } - } - } - else // check for Windows charsets - { - size_t len; - if ( cs.Left(7) == wxT("WINDOWS") ) - { - len = 7; - } - else if ( cs.Left(2) == wxT("CP") ) - { - len = 2; - } - else // not a Windows encoding - { - len = 0; - } - - if ( len ) - { - const wxChar *p = cs.c_str() + len; - if ( *p == wxT('-') ) - p++; - - unsigned int value; - if ( wxSscanf(p, wxT("%u"), &value) == 1 ) - { - if ( value >= 1250 ) - { - value -= 1250; - if ( value < wxFONTENCODING_CP12_MAX - - wxFONTENCODING_CP1250 ) - { - // a valid Windows code page - value += wxFONTENCODING_CP1250; - encoding = (wxFontEncoding)value; - } - } - - switch ( value ) - { - case 866: - encoding = wxFONTENCODING_CP866; - break; - - case 874: - encoding = wxFONTENCODING_CP874; - break; - - case 932: - encoding = wxFONTENCODING_CP932; - break; - - case 936: - encoding = wxFONTENCODING_CP936; - break; - - case 949: - encoding = wxFONTENCODING_CP949; - break; - - case 950: - encoding = wxFONTENCODING_CP950; - break; - } - } - } - } - //else: unknown - } - - return encoding; -} - -/* static */ -size_t wxFontMapperBase::GetSupportedEncodingsCount() -{ - return WXSIZEOF(gs_encodings); -} - -/* static */ -wxFontEncoding wxFontMapperBase::GetEncoding(size_t n) -{ - wxCHECK_MSG( n < WXSIZEOF(gs_encodings), wxFONTENCODING_SYSTEM, - _T("wxFontMapper::GetEncoding(): invalid index") ); - - return gs_encodings[n]; -} - -/* static */ -wxString wxFontMapperBase::GetEncodingDescription(wxFontEncoding encoding) -{ - if ( encoding == wxFONTENCODING_DEFAULT ) - { - return _("Default encoding"); - } - - const size_t count = WXSIZEOF(gs_encodingDescs); - - for ( size_t i = 0; i < count; i++ ) - { - if ( gs_encodings[i] == encoding ) - { - return wxGetTranslation(gs_encodingDescs[i]); - } - } - - wxString str; - str.Printf(_("Unknown encoding (%d)"), encoding); - - return str; -} - -/* static */ -wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding) -{ - if ( encoding == wxFONTENCODING_DEFAULT ) - { - return _("default"); - } - - const size_t count = WXSIZEOF(gs_encodingNames); - - for ( size_t i = 0; i < count; i++ ) - { - if ( gs_encodings[i] == encoding ) - { - return gs_encodingNames[i][0]; - } - } - - wxString str; - str.Printf(_("unknown-%d"), encoding); - - return str; -} - -/* static */ -const wxChar** wxFontMapperBase::GetAllEncodingNames(wxFontEncoding encoding) -{ - static const wxChar* dummy[] = { NULL }; - - for ( size_t i = 0; i < WXSIZEOF(gs_encodingNames); i++ ) - { - if ( gs_encodings[i] == encoding ) - { - return gs_encodingNames[i]; - } - } - - return dummy; -} - -/* static */ -wxFontEncoding wxFontMapperBase::GetEncodingFromName(const wxString& name) -{ - const size_t count = WXSIZEOF(gs_encodingNames); - - for ( size_t i = 0; i < count; i++ ) - { - for ( const wxChar** encName = gs_encodingNames[i]; *encName; ++encName ) - { - if ( name.CmpNoCase(*encName) == 0 ) - return gs_encodings[i]; - } - } - - return wxFONTENCODING_MAX; -} - -#endif // wxUSE_FONTMAP diff --git a/Source/3rdParty/wx/src/common/fontcmn.cpp b/Source/3rdParty/wx/src/common/fontcmn.cpp deleted file mode 100644 index f88b54dcb..000000000 --- a/Source/3rdParty/wx/src/common/fontcmn.cpp +++ /dev/null @@ -1,784 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fontcmn.cpp -// Purpose: implementation of wxFontBase methods -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.99 -// RCS-ID: $Id: fontcmn.cpp 43661 2006-11-26 20:18:53Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/font.h" - -#ifndef WX_PRECOMP - #include "wx/dc.h" - #include "wx/intl.h" - #include "wx/dcscreen.h" - #include "wx/log.h" - #include "wx/gdicmn.h" -#endif // WX_PRECOMP - -#if defined(__WXMSW__) - #include "wx/msw/private.h" // includes windows.h for LOGFONT - #include "wx/msw/winundef.h" -#endif - -#include "wx/fontutil.h" // for wxNativeFontInfo -#include "wx/fontmap.h" -#include "wx/fontenum.h" - -#include "wx/tokenzr.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// helper functions -// ---------------------------------------------------------------------------- - -static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize) -{ - int currentSize = 0; - int largestGood = 0; - int smallestBad = 0; - - bool initialGoodFound = false; - bool initialBadFound = false; - - // NB: this assignment was separated from the variable definition - // in order to fix a gcc v3.3.3 compiler crash - currentSize = font.GetPointSize(); - while (currentSize > 0) - { - dc.SetFont(font); - - // if currentSize (in points) results in a font that is smaller - // than required by pixelSize it is considered a good size - if (dc.GetCharHeight() <= pixelSize.GetHeight() && - (!pixelSize.GetWidth() || - dc.GetCharWidth() <= pixelSize.GetWidth())) - { - largestGood = currentSize; - initialGoodFound = true; - } - else - { - smallestBad = currentSize; - initialBadFound = true; - } - if (!initialGoodFound) - { - currentSize /= 2; - } - else if (!initialBadFound) - { - currentSize *= 2; - } - else - { - int distance = smallestBad - largestGood; - if (distance == 1) - break; - - currentSize = largestGood + distance / 2; - } - - font.SetPointSize(currentSize); - } - - if (currentSize != largestGood) - font.SetPointSize(largestGood); -} - -// ---------------------------------------------------------------------------- -// wxFontBase -// ---------------------------------------------------------------------------- - -wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM; - -/* static */ -void wxFontBase::SetDefaultEncoding(wxFontEncoding encoding) -{ - // GetDefaultEncoding() should return something != wxFONTENCODING_DEFAULT - // and, besides, using this value here doesn't make any sense - wxCHECK_RET( encoding != wxFONTENCODING_DEFAULT, - _T("can't set default encoding to wxFONTENCODING_DEFAULT") ); - - ms_encodingDefault = encoding; -} - -wxFontBase::~wxFontBase() -{ - // this destructor is required for Darwin -} - -/* static */ -wxFont *wxFontBase::New(int size, - int family, - int style, - int weight, - bool underlined, - const wxString& face, - wxFontEncoding encoding) -{ - return new wxFont(size, family, style, weight, underlined, face, encoding); -} - -static inline int flags2Style(int flags) -{ - return flags & wxFONTFLAG_ITALIC - ? wxFONTSTYLE_ITALIC - : flags & wxFONTFLAG_SLANT - ? wxFONTSTYLE_SLANT - : wxFONTSTYLE_NORMAL; -} - -static inline int flags2Weight(int flags) -{ - return flags & wxFONTFLAG_LIGHT - ? wxFONTWEIGHT_LIGHT - : flags & wxFONTFLAG_BOLD - ? wxFONTWEIGHT_BOLD - : wxFONTWEIGHT_NORMAL; -} - -static inline bool flags2Underlined(int flags) -{ - return (flags & wxFONTFLAG_UNDERLINED) != 0; -} - -/* static */ -wxFont *wxFontBase::New(int pointSize, - wxFontFamily family, - int flags, - const wxString& face, - wxFontEncoding encoding) -{ - return New(pointSize, family, flags2Style(flags), flags2Weight(flags), - flags2Underlined(flags), face, encoding); -} - -/* static */ -wxFont *wxFontBase::New(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined, - const wxString& face, - wxFontEncoding encoding) -{ -#if defined(__WXMSW__) - return new wxFont(pixelSize, family, style, weight, underlined, - face, encoding); -#else - wxFont *self = New(10, family, style, weight, underlined, face, encoding); - wxScreenDC dc; - AdjustFontSize(*(wxFont *)self, dc, pixelSize); - return self; -#endif -} - -/* static */ -wxFont *wxFontBase::New(const wxSize& pixelSize, - wxFontFamily family, - int flags, - const wxString& face, - wxFontEncoding encoding) -{ - return New(pixelSize, family, flags2Style(flags), flags2Weight(flags), - flags2Underlined(flags), face, encoding); -} - -wxSize wxFontBase::GetPixelSize() const -{ - wxScreenDC dc; - dc.SetFont(*(wxFont *)this); - return wxSize(dc.GetCharWidth(), dc.GetCharHeight()); -} - -bool wxFontBase::IsUsingSizeInPixels() const -{ - return false; -} - -void wxFontBase::SetPixelSize( const wxSize& pixelSize ) -{ - wxScreenDC dc; - AdjustFontSize(*(wxFont *)this, dc, pixelSize); -} - -/* static */ -wxFont *wxFontBase::New(const wxNativeFontInfo& info) -{ - return new wxFont(info); -} - -/* static */ -wxFont *wxFontBase::New(const wxString& strNativeFontDesc) -{ - wxNativeFontInfo fontInfo; - if ( !fontInfo.FromString(strNativeFontDesc) ) - return new wxFont(*wxNORMAL_FONT); - - return New(fontInfo); -} - -bool wxFontBase::IsFixedWidth() const -{ - return GetFamily() == wxFONTFAMILY_TELETYPE; -} - -void wxFontBase::DoSetNativeFontInfo(const wxNativeFontInfo& info) -{ -#ifdef wxNO_NATIVE_FONTINFO - SetPointSize(info.pointSize); - SetFamily(info.family); - SetStyle(info.style); - SetWeight(info.weight); - SetUnderlined(info.underlined); - SetFaceName(info.faceName); - SetEncoding(info.encoding); -#else - (void)info; -#endif -} - -wxString wxFontBase::GetNativeFontInfoDesc() const -{ - wxString fontDesc; - const wxNativeFontInfo *fontInfo = GetNativeFontInfo(); - if ( fontInfo ) - { - fontDesc = fontInfo->ToString(); - wxASSERT_MSG(!fontDesc.empty(), wxT("This should be a non-empty string!")); - } - else - { - wxFAIL_MSG(wxT("Derived class should have created the wxNativeFontInfo!")); - } - - return fontDesc; -} - -wxString wxFontBase::GetNativeFontInfoUserDesc() const -{ - wxString fontDesc; - const wxNativeFontInfo *fontInfo = GetNativeFontInfo(); - if ( fontInfo ) - { - fontDesc = fontInfo->ToUserString(); - wxASSERT_MSG(!fontDesc.empty(), wxT("This should be a non-empty string!")); - } - else - { - wxFAIL_MSG(wxT("Derived class should have created the wxNativeFontInfo!")); - } - - return fontDesc; -} - -bool wxFontBase::SetNativeFontInfo(const wxString& info) -{ - wxNativeFontInfo fontInfo; - if ( !info.empty() && fontInfo.FromString(info) ) - { - SetNativeFontInfo(fontInfo); - return true; - } - - UnRef(); - return false; -} - -bool wxFontBase::SetNativeFontInfoUserDesc(const wxString& info) -{ - wxNativeFontInfo fontInfo; - if ( !info.empty() && fontInfo.FromUserString(info) ) - { - SetNativeFontInfo(fontInfo); - return true; - } - - UnRef(); - return false; -} - -bool wxFontBase::operator==(const wxFont& font) const -{ - // either it is the same font, i.e. they share the same common data or they - // have different ref datas but still describe the same font - return IsSameAs(font) || - ( - Ok() == font.Ok() && - GetPointSize() == font.GetPointSize() && - // in wxGTK1 GetPixelSize() calls GetInternalFont() which uses - // operator==() resulting in infinite recursion so we can't use it - // in that port -#if !defined(__WXGTK__) || defined(__WXGTK20__) - GetPixelSize() == font.GetPixelSize() && -#endif - GetFamily() == font.GetFamily() && - GetStyle() == font.GetStyle() && - GetWeight() == font.GetWeight() && - GetUnderlined() == font.GetUnderlined() && - GetFaceName().IsSameAs(font.GetFaceName(), false) && - GetEncoding() == font.GetEncoding() - ); -} - -bool wxFontBase::operator!=(const wxFont& font) const -{ - return !(*this == font); -} - -wxString wxFontBase::GetFamilyString() const -{ - wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") ); - - switch ( GetFamily() ) - { - case wxDECORATIVE: return wxT("wxDECORATIVE"); - case wxROMAN: return wxT("wxROMAN"); - case wxSCRIPT: return wxT("wxSCRIPT"); - case wxSWISS: return wxT("wxSWISS"); - case wxMODERN: return wxT("wxMODERN"); - case wxTELETYPE: return wxT("wxTELETYPE"); - default: return wxT("wxDEFAULT"); - } -} - -wxString wxFontBase::GetStyleString() const -{ - wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") ); - - switch ( GetStyle() ) - { - case wxNORMAL: return wxT("wxNORMAL"); - case wxSLANT: return wxT("wxSLANT"); - case wxITALIC: return wxT("wxITALIC"); - default: return wxT("wxDEFAULT"); - } -} - -wxString wxFontBase::GetWeightString() const -{ - wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") ); - - switch ( GetWeight() ) - { - case wxNORMAL: return wxT("wxNORMAL"); - case wxBOLD: return wxT("wxBOLD"); - case wxLIGHT: return wxT("wxLIGHT"); - default: return wxT("wxDEFAULT"); - } -} - -bool wxFontBase::SetFaceName(const wxString &facename) -{ - if (!wxFontEnumerator::IsValidFacename(facename)) - { - UnRef(); // make Ok() return false - return false; - } - - return true; -} - - -// ---------------------------------------------------------------------------- -// wxNativeFontInfo -// ---------------------------------------------------------------------------- - -// Up to now, there are no native implementations of this function: -void wxNativeFontInfo::SetFaceName(const wxArrayString &facenames) -{ - for (size_t i=0; i < facenames.GetCount(); i++) - { - if (wxFontEnumerator::IsValidFacename(facenames[i])) - { - SetFaceName(facenames[i]); - return; - } - } - - // set the first valid facename we can find on this system - wxString validfacename = wxFontEnumerator::GetFacenames().Item(0); - wxLogTrace(wxT("font"), wxT("Falling back to '%s'"), validfacename.c_str()); - SetFaceName(validfacename); -} - - -#ifdef wxNO_NATIVE_FONTINFO - -// These are the generic forms of FromString()/ToString. -// -// convert to/from the string representation: format is -// version;pointsize;family;style;weight;underlined;facename;encoding - -bool wxNativeFontInfo::FromString(const wxString& s) -{ - long l; - - wxStringTokenizer tokenizer(s, _T(";")); - - wxString token = tokenizer.GetNextToken(); - // - // Ignore the version for now - // - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - pointSize = (int)l; - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - family = (wxFontFamily)l; - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - style = (wxFontStyle)l; - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - weight = (wxFontWeight)l; - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - underlined = l != 0; - - faceName = tokenizer.GetNextToken(); - -#ifndef __WXMAC__ - if( !faceName ) - return false; -#endif - - token = tokenizer.GetNextToken(); - if ( !token.ToLong(&l) ) - return false; - encoding = (wxFontEncoding)l; - - return true; -} - -wxString wxNativeFontInfo::ToString() const -{ - wxString s; - - s.Printf(_T("%d;%d;%d;%d;%d;%d;%s;%d"), - 0, // version - pointSize, - family, - (int)style, - (int)weight, - underlined, - faceName.GetData(), - (int)encoding); - - return s; -} - -void wxNativeFontInfo::Init() -{ - pointSize = 0; - family = wxFONTFAMILY_DEFAULT; - style = wxFONTSTYLE_NORMAL; - weight = wxFONTWEIGHT_NORMAL; - underlined = false; - faceName.clear(); - encoding = wxFONTENCODING_DEFAULT; -} - -int wxNativeFontInfo::GetPointSize() const -{ - return pointSize; -} - -wxFontStyle wxNativeFontInfo::GetStyle() const -{ - return style; -} - -wxFontWeight wxNativeFontInfo::GetWeight() const -{ - return weight; -} - -bool wxNativeFontInfo::GetUnderlined() const -{ - return underlined; -} - -wxString wxNativeFontInfo::GetFaceName() const -{ - return faceName; -} - -wxFontFamily wxNativeFontInfo::GetFamily() const -{ - return family; -} - -wxFontEncoding wxNativeFontInfo::GetEncoding() const -{ - return encoding; -} - -void wxNativeFontInfo::SetPointSize(int pointsize) -{ - pointSize = pointsize; -} - -void wxNativeFontInfo::SetStyle(wxFontStyle style_) -{ - style = style_; -} - -void wxNativeFontInfo::SetWeight(wxFontWeight weight_) -{ - weight = weight_; -} - -void wxNativeFontInfo::SetUnderlined(bool underlined_) -{ - underlined = underlined_; -} - -bool wxNativeFontInfo::SetFaceName(const wxString& facename_) -{ - faceName = facename_; - return true; -} - -void wxNativeFontInfo::SetFamily(wxFontFamily family_) -{ - family = family_; -} - -void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding_) -{ - encoding = encoding_; -} - -#endif // generic wxNativeFontInfo implementation - -// conversion to/from user-readable string: this is used in the generic -// versions and under MSW as well because there is no standard font description -// format there anyhow (but there is a well-defined standard for X11 fonts used -// by wxGTK and wxMotif) - -#if defined(wxNO_NATIVE_FONTINFO) || defined(__WXMSW__) || defined (__WXPM__) - -wxString wxNativeFontInfo::ToUserString() const -{ - wxString desc; - - // first put the adjectives, if any - this is English-centric, of course, - // but what else can we do? - if ( GetUnderlined() ) - { - desc << _("underlined"); - } - - switch ( GetWeight() ) - { - default: - wxFAIL_MSG( _T("unknown font weight") ); - // fall through - - case wxFONTWEIGHT_NORMAL: - break; - - case wxFONTWEIGHT_LIGHT: - desc << _(" light"); - break; - - case wxFONTWEIGHT_BOLD: - desc << _(" bold"); - break; - } - - switch ( GetStyle() ) - { - default: - wxFAIL_MSG( _T("unknown font style") ); - // fall through - - case wxFONTSTYLE_NORMAL: - break; - - // we don't distinguish between the two for now anyhow... - case wxFONTSTYLE_ITALIC: - case wxFONTSTYLE_SLANT: - desc << _(" italic"); - break; - } - - wxString face = GetFaceName(); - if ( !face.empty() ) - { - desc << _T(' ') << face; - } - - int size = GetPointSize(); - if ( size != wxNORMAL_FONT->GetPointSize() ) - { - desc << _T(' ') << size; - } - -#if wxUSE_FONTMAP - wxFontEncoding enc = GetEncoding(); - if ( enc != wxFONTENCODING_DEFAULT && enc != wxFONTENCODING_SYSTEM ) - { - desc << _T(' ') << wxFontMapper::GetEncodingName(enc); - } -#endif // wxUSE_FONTMAP - - return desc.Strip(wxString::both).MakeLower(); -} - -bool wxNativeFontInfo::FromUserString(const wxString& s) -{ - // reset to the default state - Init(); - - // parse a more or less free form string - // - // TODO: we should handle at least the quoted facenames - wxStringTokenizer tokenizer(s, _T(";, "), wxTOKEN_STRTOK); - - wxString face; - unsigned long size; - bool weightfound = false, pointsizefound = false; -#if wxUSE_FONTMAP - bool encodingfound = false; -#endif - - while ( tokenizer.HasMoreTokens() ) - { - wxString token = tokenizer.GetNextToken(); - - // normalize it - token.Trim(true).Trim(false).MakeLower(); - - // look for the known tokens - if ( token == _T("underlined") || token == _("underlined") ) - { - SetUnderlined(true); - } - else if ( token == _T("light") || token == _("light") ) - { - SetWeight(wxFONTWEIGHT_LIGHT); - weightfound = true; - } - else if ( token == _T("bold") || token == _("bold") ) - { - SetWeight(wxFONTWEIGHT_BOLD); - weightfound = true; - } - else if ( token == _T("italic") || token == _("italic") ) - { - SetStyle(wxFONTSTYLE_ITALIC); - } - else if ( token.ToULong(&size) ) - { - SetPointSize(size); - pointsizefound = true; - } - else - { -#if wxUSE_FONTMAP - // try to interpret this as an encoding - wxFontEncoding encoding = wxFontMapper::Get()->CharsetToEncoding(token, false); - if ( encoding != wxFONTENCODING_DEFAULT && - encoding != wxFONTENCODING_SYSTEM ) // returned when the recognition failed - { - SetEncoding(encoding); - encodingfound = true; - } - else - { -#endif // wxUSE_FONTMAP - - // assume it is the face name - if ( !face.empty() ) - { - face += _T(' '); - } - - face += token; - - // skip the code which resets face below - continue; - -#if wxUSE_FONTMAP - } -#endif // wxUSE_FONTMAP - } - - // if we had had the facename, we shouldn't continue appending tokens - // to it (i.e. "foo bold bar" shouldn't result in the facename "foo - // bar") - if ( !face.empty() ) - { - // NB: the check on the facename is implemented in wxFontBase::SetFaceName - // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely - // call here wxFontEnumerator::IsValidFacename - if (!wxFontEnumerator::IsValidFacename(face) || - !SetFaceName(face)) - SetFaceName(wxNORMAL_FONT->GetFaceName()); - face.clear(); - } - } - - // we might not have flushed it inside the loop - if ( !face.empty() ) - { - // NB: the check on the facename is implemented in wxFontBase::SetFaceName - // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely - // call here wxFontEnumerator::IsValidFacename - if (!wxFontEnumerator::IsValidFacename(face) || - !SetFaceName(face)) - SetFaceName(wxNORMAL_FONT->GetFaceName()); - } - - // set point size to default value if size was not given - if ( !pointsizefound ) - SetPointSize(wxNORMAL_FONT->GetPointSize()); - - // set font weight to default value if weight was not given - if ( !weightfound ) - SetWeight(wxFONTWEIGHT_NORMAL); - -#if wxUSE_FONTMAP - // set font encoding to default value if encoding was not given - if ( !encodingfound ) - SetEncoding(wxFONTENCODING_SYSTEM); -#endif // wxUSE_FONTMAP - - return true; -} - -#endif // generic or wxMSW or wxOS2 diff --git a/Source/3rdParty/wx/src/common/fontenumcmn.cpp b/Source/3rdParty/wx/src/common/fontenumcmn.cpp deleted file mode 100644 index 6ea8a30cb..000000000 --- a/Source/3rdParty/wx/src/common/fontenumcmn.cpp +++ /dev/null @@ -1,131 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fontenumcmn.cpp -// Purpose: wxFontEnumerator class -// Author: Vadim Zeitlin -// Modified by: -// Created: 7/5/2006 -// RCS-ID: $Id: fontenumcmn.cpp 43727 2006-12-01 10:14:28Z VS $ -// Copyright: (c) 1999-2003 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/fontenum.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// A simple wxFontEnumerator which doesn't perform any filtering and -// just returns all facenames and encodings found in the system -class WXDLLEXPORT wxSimpleFontEnumerator : public wxFontEnumerator -{ -public: - wxSimpleFontEnumerator() { } - - // called by EnumerateFacenames - virtual bool OnFacename(const wxString& facename) - { - m_arrFacenames.Add(facename); - return true; - } - - // called by EnumerateEncodings - virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), - const wxString& encoding) - { - m_arrEncodings.Add(encoding); - return true; - } - -public: - wxArrayString m_arrFacenames, m_arrEncodings; -}; - - -/* static */ -wxArrayString wxFontEnumerator::GetFacenames(wxFontEncoding encoding, bool fixedWidthOnly) -{ - wxSimpleFontEnumerator temp; - temp.EnumerateFacenames(encoding, fixedWidthOnly); - return temp.m_arrFacenames; -} - -/* static */ -wxArrayString wxFontEnumerator::GetEncodings(const wxString& facename) -{ - wxSimpleFontEnumerator temp; - temp.EnumerateEncodings(facename); - return temp.m_arrEncodings; -} - -/* static */ -bool wxFontEnumerator::IsValidFacename(const wxString &facename) -{ - // we cache the result of wxFontEnumerator::GetFacenames supposing that - // the array of face names won't change in the session of this program - static wxArrayString s_arr = wxFontEnumerator::GetFacenames(); - -#ifdef __WXMSW__ - // Quoting the MSDN: - // "MS Shell Dlg is a mapping mechanism that enables - // U.S. English Microsoft Windows NT, and Microsoft Windows 2000 to - // support locales that have characters that are not contained in code - // page 1252. It is not a font but a face name for a nonexistent font." - // Thus we need to consider "Ms Shell Dlg" and "Ms Shell Dlg 2" as valid - // font face names even if they are enumerated by wxFontEnumerator - if (facename.IsSameAs(wxT("Ms Shell Dlg"), false) || - facename.IsSameAs(wxT("Ms Shell Dlg 2"), false)) - return true; -#endif - - // is given font face name a valid one ? - if (s_arr.Index(facename, false) == wxNOT_FOUND) - return false; - - return true; -} - -#ifdef wxHAS_UTF8_FONTS -bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename) -{ - // name of UTF-8 encoding: no need to use wxFontMapper for it as it's - // unlikely to change - const wxString utf8(_T("UTF-8")); - - // all fonts are in UTF-8 only if this code is used - if ( !facename.empty() ) - { - OnFontEncoding(facename, utf8); - return true; - } - - // so enumerating all facenames supporting this encoding is the same as - // enumerating all facenames - const wxArrayString facenames(GetFacenames(wxFONTENCODING_UTF8)); - const size_t count = facenames.size(); - if ( !count ) - return false; - - for ( size_t n = 0; n < count; n++ ) - { - OnFontEncoding(facenames[n], utf8); - } - - return true; -} -#endif // wxHAS_UTF8_FONTS diff --git a/Source/3rdParty/wx/src/common/fontmap.cpp b/Source/3rdParty/wx/src/common/fontmap.cpp deleted file mode 100644 index 3d3800766..000000000 --- a/Source/3rdParty/wx/src/common/fontmap.cpp +++ /dev/null @@ -1,519 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fontmap.cpp -// Purpose: wxFontMapper class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.11.99 -// RCS-ID: $Id: fontmap.cpp 39651 2006-06-09 17:50:46Z ABX $ -// Copyright: (c) 1999-2003 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FONTMAP - -#include "wx/fontmap.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/msgdlg.h" - #include "wx/choicdlg.h" -#endif // PCH - -#if wxUSE_CONFIG - #include "wx/config.h" -#endif // wxUSE_CONFIG - -#if defined(__WXMSW__) - #include "wx/msw/private.h" // includes windows.h for LOGFONT - #include "wx/msw/winundef.h" -#endif - -#include "wx/fmappriv.h" -#include "wx/fontutil.h" -#include "wx/fontdlg.h" -#include "wx/encinfo.h" - -#include "wx/encconv.h" - -#if wxUSE_EXTENDED_RTTI - -wxBEGIN_ENUM( wxFontEncoding ) - wxENUM_MEMBER( wxFONTENCODING_SYSTEM ) - wxENUM_MEMBER( wxFONTENCODING_DEFAULT ) - - wxENUM_MEMBER( wxFONTENCODING_ISO8859_1 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_2 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_3 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_4 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_5 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_6 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_7 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_8 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_9 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_10 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_11 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_12 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_13 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_14 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_15 ) - wxENUM_MEMBER( wxFONTENCODING_ISO8859_MAX ) - wxENUM_MEMBER( wxFONTENCODING_KOI8 ) - wxENUM_MEMBER( wxFONTENCODING_KOI8_U ) - wxENUM_MEMBER( wxFONTENCODING_ALTERNATIVE ) - wxENUM_MEMBER( wxFONTENCODING_BULGARIAN ) - wxENUM_MEMBER( wxFONTENCODING_CP437 ) - wxENUM_MEMBER( wxFONTENCODING_CP850 ) - wxENUM_MEMBER( wxFONTENCODING_CP852 ) - wxENUM_MEMBER( wxFONTENCODING_CP855 ) - wxENUM_MEMBER( wxFONTENCODING_CP866 ) - - wxENUM_MEMBER( wxFONTENCODING_CP874 ) - wxENUM_MEMBER( wxFONTENCODING_CP932 ) - wxENUM_MEMBER( wxFONTENCODING_CP936 ) - wxENUM_MEMBER( wxFONTENCODING_CP949 ) - wxENUM_MEMBER( wxFONTENCODING_CP950 ) - wxENUM_MEMBER( wxFONTENCODING_CP1250 ) - wxENUM_MEMBER( wxFONTENCODING_CP1251 ) - wxENUM_MEMBER( wxFONTENCODING_CP1252 ) - wxENUM_MEMBER( wxFONTENCODING_CP1253 ) - wxENUM_MEMBER( wxFONTENCODING_CP1254 ) - wxENUM_MEMBER( wxFONTENCODING_CP1255 ) - wxENUM_MEMBER( wxFONTENCODING_CP1256 ) - wxENUM_MEMBER( wxFONTENCODING_CP1257 ) - wxENUM_MEMBER( wxFONTENCODING_CP12_MAX ) - wxENUM_MEMBER( wxFONTENCODING_UTF7 ) - wxENUM_MEMBER( wxFONTENCODING_UTF8 ) - wxENUM_MEMBER( wxFONTENCODING_GB2312 ) - wxENUM_MEMBER( wxFONTENCODING_BIG5 ) - wxENUM_MEMBER( wxFONTENCODING_SHIFT_JIS ) - wxENUM_MEMBER( wxFONTENCODING_EUC_JP ) - wxENUM_MEMBER( wxFONTENCODING_UNICODE ) -wxEND_ENUM( wxFontEncoding ) -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the config paths we use -#if wxUSE_CONFIG - -static const wxChar* FONTMAPPER_FONT_FROM_ENCODING_PATH = wxT("Encodings"); -static const wxChar* FONTMAPPER_FONT_DONT_ASK = wxT("none"); - -#endif // wxUSE_CONFIG - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// it may happen that while we're showing a dialog asking the user about -// something, another request for an encoding mapping arrives: in this case it -// is best to not do anything because otherwise we risk to enter an infinite -// loop so we create an object of this class on stack to test for this in all -// interactive functions -class ReentrancyBlocker -{ -public: - ReentrancyBlocker(bool& flag) : m_flagOld(flag), m_flag(flag) - { m_flag = true; } - ~ReentrancyBlocker() { m_flag = m_flagOld; } - -private: - bool m_flagOld; - bool& m_flag; - - DECLARE_NO_COPY_CLASS(ReentrancyBlocker) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// ctor and dtor -// ---------------------------------------------------------------------------- - -wxFontMapper::wxFontMapper() -{ - m_windowParent = NULL; -} - -wxFontMapper::~wxFontMapper() -{ -} - -/* static */ -wxFontMapper *wxFontMapper::Get() -{ - wxFontMapperBase *fontmapper = wxFontMapperBase::Get(); - wxASSERT_MSG( !fontmapper->IsDummy(), - wxT("GUI code requested a wxFontMapper but we only have a wxFontMapperBase.") ); - - // Now return it anyway because there's a chance the GUI code might just - // only want to call wxFontMapperBase functions and it's better than - // crashing by returning NULL - return (wxFontMapper *)fontmapper; -} - -wxFontEncoding -wxFontMapper::CharsetToEncoding(const wxString& charset, bool interactive) -{ - // try the ways not needing the users intervention first - int encoding = wxFontMapperBase::NonInteractiveCharsetToEncoding(charset); - - // if we failed to find the encoding, ask the user -- unless disabled - if ( encoding == wxFONTENCODING_UNKNOWN ) - { - // this is the special value which disables asking the user (he had - // chosen to suppress this the last time) - encoding = wxFONTENCODING_SYSTEM; - } -#if wxUSE_CHOICEDLG - else if ( (encoding == wxFONTENCODING_SYSTEM) && interactive ) - { - // prepare the dialog data - - // the dialog title - wxString title(m_titleDialog); - if ( !title ) - title << wxTheApp->GetAppName() << _(": unknown charset"); - - // the message - wxString msg; - msg.Printf(_("The charset '%s' is unknown. You may select\nanother charset to replace it with or choose\n[Cancel] if it cannot be replaced"), charset.c_str()); - - // the list of choices - const size_t count = GetSupportedEncodingsCount(); - - wxString *encodingNamesTranslated = new wxString[count]; - - for ( size_t i = 0; i < count; i++ ) - { - encodingNamesTranslated[i] = GetEncodingDescription(GetEncoding(i)); - } - - // the parent window - wxWindow *parent = m_windowParent; - if ( !parent ) - parent = wxTheApp->GetTopWindow(); - - // do ask the user and get back the index in encodings table - int n = wxGetSingleChoiceIndex(msg, title, - count, - encodingNamesTranslated, - parent); - - delete [] encodingNamesTranslated; - - if ( n != -1 ) - { - encoding = GetEncoding(n); - } - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // save the result in the config now - wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH); - if ( path.IsOk() ) - { - wxConfigBase *config = GetConfig(); - - // remember the alt encoding for this charset -- or remember that - // we don't know it - long value = n == -1 ? (long)wxFONTENCODING_UNKNOWN : (long)encoding; - if ( !config->Write(charset, value) ) - { - wxLogError(_("Failed to remember the encoding for the charset '%s'."), charset.c_str()); - } - } -#endif // wxUSE_CONFIG - } -#else - wxUnusedVar(interactive); -#endif // wxUSE_CHOICEDLG - - return (wxFontEncoding)encoding; -} - -// ---------------------------------------------------------------------------- -// support for unknown encodings: we maintain a map between the -// (platform-specific) strings identifying them and our wxFontEncodings they -// correspond to which is used by GetFontForEncoding() function -// ---------------------------------------------------------------------------- - -bool wxFontMapper::TestAltEncoding(const wxString& configEntry, - wxFontEncoding encReplacement, - wxNativeEncodingInfo *info) -{ - if ( wxGetNativeFontEncoding(encReplacement, info) && - wxTestFontEncoding(*info) ) - { -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // remember the mapping in the config - wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH); - - if ( path.IsOk() ) - { - GetConfig()->Write(configEntry, info->ToString()); - } -#else - wxUnusedVar(configEntry); -#endif // wxUSE_CONFIG - return true; - } - - return false; -} - -bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info, - const wxString& facename, - bool interactive) -{ -#if wxUSE_GUI - // we need a flag to prevent infinite recursion which happens, for - // example, when GetAltForEncoding() is called from an OnPaint() handler: - // in this case, wxYield() which is called from wxMessageBox() we use here - // will lead to another call of OnPaint() and hence to another call of - // GetAltForEncoding() -- and it is impossible to catch this from the user - // code because we are called from wxFont ctor implicitly. - - // assume we're always called from the main thread, so that it is safe to - // use a static var - static bool s_inGetAltForEncoding = false; - - if ( interactive && s_inGetAltForEncoding ) - return false; - - ReentrancyBlocker blocker(s_inGetAltForEncoding); -#endif // wxUSE_GUI - - wxCHECK_MSG( info, false, wxT("bad pointer in GetAltForEncoding") ); - - info->facename = facename; - - if ( encoding == wxFONTENCODING_DEFAULT ) - { - encoding = wxFont::GetDefaultEncoding(); - } - - // if we failed to load the system default encoding, something is really - // wrong and we'd better stop now -- otherwise we will go into endless - // recursion trying to create the font in the msg box with the error - // message - if ( encoding == wxFONTENCODING_SYSTEM ) - { - wxLogFatalError(_("can't load any font, aborting")); - - // wxLogFatalError doesn't return - } - - wxString configEntry, - encName = GetEncodingName(encoding); - if ( !facename.empty() ) - { - configEntry = facename + _T("_"); - } - configEntry += encName; - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // do we have a font spec for this encoding? - wxString fontinfo; - wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH); - if ( path.IsOk() ) - { - fontinfo = GetConfig()->Read(configEntry); - } - - // this special value means that we don't know of fonts for this - // encoding but, moreover, have already asked the user as well and he - // didn't specify any font neither - if ( fontinfo == FONTMAPPER_FONT_DONT_ASK ) - { - interactive = false; - } - else // use the info entered the last time - { - if ( !fontinfo.empty() && !facename.empty() ) - { - // we tried to find a match with facename -- now try without it - fontinfo = GetConfig()->Read(encName); - } - - if ( !fontinfo.empty() ) - { - if ( info->FromString(fontinfo) ) - { - if ( wxTestFontEncoding(*info) ) - { - // ok, got something - return true; - } - //else: no such fonts, look for something else - // (should we erase the outdated value?) - } - else - { - wxLogDebug(wxT("corrupted config data: string '%s' is not a valid font encoding info"), - fontinfo.c_str()); - } - } - //else: there is no information in config about this encoding - } -#endif // wxUSE_CONFIG - - // now try to map this encoding to a compatible one which we have on this - // system - wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding); - size_t count = equiv.GetCount(); - bool foundEquivEncoding = false; - wxFontEncoding equivEncoding = wxFONTENCODING_SYSTEM; - if ( count ) - { - for ( size_t i = 0; i < count && !foundEquivEncoding; i++ ) - { - // don't test for encoding itself, we already know we don't have it - if ( equiv[i] == encoding ) - continue; - - if ( TestAltEncoding(configEntry, equiv[i], info) ) - { - equivEncoding = equiv[i]; - - foundEquivEncoding = true; - } - } - } - - // ask the user -#if wxUSE_FONTDLG - if ( interactive ) - { - wxString title(m_titleDialog); - if ( !title ) - title << wxTheApp->GetAppName() << _(": unknown encoding"); - - // built the message - wxString encDesc = GetEncodingDescription(encoding), - msg; - if ( foundEquivEncoding ) - { - // ask the user if he wants to override found alternative encoding - msg.Printf(_("No font for displaying text in encoding '%s' found,\nbut an alternative encoding '%s' is available.\nDo you want to use this encoding (otherwise you will have to choose another one)?"), - encDesc.c_str(), GetEncodingDescription(equivEncoding).c_str()); - } - else - { - msg.Printf(_("No font for displaying text in encoding '%s' found.\nWould you like to select a font to be used for this encoding\n(otherwise the text in this encoding will not be shown correctly)?"), - encDesc.c_str()); - } - - // the question is different in 2 cases so the answer has to be - // interpreted differently as well - int answer = foundEquivEncoding ? wxNO : wxYES; - - if ( wxMessageBox(msg, title, - wxICON_QUESTION | wxYES_NO, - m_windowParent) == answer ) - { - wxFontData data; - data.SetEncoding(encoding); - data.EncodingInfo() = *info; - wxFontDialog dialog(m_windowParent, data); - if ( dialog.ShowModal() == wxID_OK ) - { - wxFontData retData = dialog.GetFontData(); - - *info = retData.EncodingInfo(); - info->encoding = retData.GetEncoding(); - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // remember this in the config - wxFontMapperPathChanger path2(this, - FONTMAPPER_FONT_FROM_ENCODING_PATH); - if ( path2.IsOk() ) - { - GetConfig()->Write(configEntry, info->ToString()); - } -#endif // wxUSE_CONFIG - - return true; - } - //else: the user canceled the font selection dialog - } - else - { - // the user doesn't want to select a font for this encoding - // or selected to use equivalent encoding - // - // remember it to avoid asking the same question again later -#if wxUSE_CONFIG && wxUSE_FILECONFIG - wxFontMapperPathChanger path2(this, - FONTMAPPER_FONT_FROM_ENCODING_PATH); - if ( path2.IsOk() ) - { - GetConfig()->Write - ( - configEntry, - foundEquivEncoding ? info->ToString().c_str() - : FONTMAPPER_FONT_DONT_ASK - ); - } -#endif // wxUSE_CONFIG - } - } - //else: we're in non-interactive mode -#else - wxUnusedVar(equivEncoding); -#endif // wxUSE_FONTDLG - - return foundEquivEncoding; -} - -bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, - wxFontEncoding *encodingAlt, - const wxString& facename, - bool interactive) -{ - wxCHECK_MSG( encodingAlt, false, - _T("wxFontEncoding::GetAltForEncoding(): NULL pointer") ); - - wxNativeEncodingInfo info; - if ( !GetAltForEncoding(encoding, &info, facename, interactive) ) - return false; - - *encodingAlt = info.encoding; - - return true; -} - -bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding, - const wxString& facename) -{ - wxNativeEncodingInfo info; - - if ( !wxGetNativeFontEncoding(encoding, &info) ) - return false; - - info.facename = facename; - return wxTestFontEncoding(info); -} - -#endif // wxUSE_FONTMAP diff --git a/Source/3rdParty/wx/src/common/fontpickercmn.cpp b/Source/3rdParty/wx/src/common/fontpickercmn.cpp deleted file mode 100644 index c4af53f25..000000000 --- a/Source/3rdParty/wx/src/common/fontpickercmn.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/fontpickercmn.cpp -// Purpose: wxFontPickerCtrl class implementation -// Author: Francesco Montorsi -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: fontpickercmn.cpp 42999 2006-11-03 21:54:13Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FONTPICKERCTRL - -#include "wx/fontpicker.h" - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" -#endif - -#include "wx/fontenum.h" -#include "wx/tokenzr.h" - -// ============================================================================ -// implementation -// ============================================================================ - -const wxChar wxFontPickerCtrlNameStr[] = wxT("fontpicker"); -const wxChar wxFontPickerWidgetNameStr[] = wxT("fontpickerwidget"); - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_FONTPICKER_CHANGED) -IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrl, wxPickerBase) -IMPLEMENT_DYNAMIC_CLASS(wxFontPickerEvent, wxCommandEvent) - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl -// ---------------------------------------------------------------------------- - -#define M_PICKER ((wxFontPickerWidget*)m_picker) - -bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id, - const wxFont &initial, - const wxPoint &pos, const wxSize &size, - long style, const wxValidator& validator, - const wxString &name ) -{ - if (!wxPickerBase::CreateBase(parent, id, - Font2String(initial.IsOk() ? initial - : *wxNORMAL_FONT), - pos, size, style, validator, name)) - return false; - - // the picker of a wxFontPickerCtrl is a wxFontPickerWidget - m_picker = new wxFontPickerWidget(this, wxID_ANY, initial, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(style)); - // complete sizer creation - wxPickerBase::PostCreation(); - - m_picker->Connect(wxEVT_COMMAND_FONTPICKER_CHANGED, - wxFontPickerEventHandler(wxFontPickerCtrl::OnFontChange), - NULL, this); - - return true; -} - -wxString wxFontPickerCtrl::Font2String(const wxFont &f) -{ - wxString ret = f.GetNativeFontInfoUserDesc(); -#ifdef __WXMSW__ - // on wxMSW the encoding of the font is appended at the end of the string; - // since encoding is not very user-friendly we remove it. - wxFontEncoding enc = f.GetEncoding(); - if ( enc != wxFONTENCODING_DEFAULT && enc != wxFONTENCODING_SYSTEM ) - ret = ret.BeforeLast(wxT(' ')); -#endif - return ret; -} - -wxFont wxFontPickerCtrl::String2Font(const wxString &s) -{ - wxString str(s); - wxFont ret; - double n; - - // put a limit on the maximum point size which the user can enter - // NOTE: we suppose the last word of given string is the pointsize - wxString size = str.AfterLast(wxT(' ')); - if (size.ToDouble(&n)) - { - if (n < 1) - str = str.Left(str.length() - size.length()) + wxT("1"); - else if (n >= m_nMaxPointSize) - str = str.Left(str.length() - size.length()) + - wxString::Format(wxT("%d"), m_nMaxPointSize); - } - - if (!ret.SetNativeFontInfoUserDesc(str)) - return wxNullFont; - - return ret; -} - -void wxFontPickerCtrl::SetSelectedFont(const wxFont &f) -{ - M_PICKER->SetSelectedFont(f); - UpdateTextCtrlFromPicker(); -} - -void wxFontPickerCtrl::UpdatePickerFromTextCtrl() -{ - wxASSERT(m_text); - - if (m_bIgnoreNextTextCtrlUpdate) - { - // ignore this update - m_bIgnoreNextTextCtrlUpdate = false; - return; - } - - // NB: we don't use the wxFont::wxFont(const wxString &) constructor - // since that constructor expects the native font description - // string returned by wxFont::GetNativeFontInfoDesc() and not - // the user-friendly one returned by wxFont::GetNativeFontInfoUserDesc() - wxFont f = String2Font(m_text->GetValue()); - if (!f.Ok()) - return; // invalid user input - - if (M_PICKER->GetSelectedFont() != f) - { - M_PICKER->SetSelectedFont(f); - - // fire an event - wxFontPickerEvent event(this, GetId(), f); - GetEventHandler()->ProcessEvent(event); - } -} - -void wxFontPickerCtrl::UpdateTextCtrlFromPicker() -{ - if (!m_text) - return; // no textctrl to update - - // NOTE: this SetValue() will generate an unwanted wxEVT_COMMAND_TEXT_UPDATED - // which will trigger a unneeded UpdateFromTextCtrl(); thus before using - // SetValue() we set the m_bIgnoreNextTextCtrlUpdate flag... - m_bIgnoreNextTextCtrlUpdate = true; - m_text->SetValue(Font2String(M_PICKER->GetSelectedFont())); -} - - - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl - event handlers -// ---------------------------------------------------------------------------- - -void wxFontPickerCtrl::OnFontChange(wxFontPickerEvent &ev) -{ - UpdateTextCtrlFromPicker(); - - // the wxFontPickerWidget sent us a colour-change notification. - // forward this event to our parent - wxFontPickerEvent event(this, GetId(), ev.GetFont()); - GetEventHandler()->ProcessEvent(event); -} - -#endif // wxUSE_FONTPICKERCTRL diff --git a/Source/3rdParty/wx/src/common/framecmn.cpp b/Source/3rdParty/wx/src/common/framecmn.cpp deleted file mode 100644 index 65c3c48ac..000000000 --- a/Source/3rdParty/wx/src/common/framecmn.cpp +++ /dev/null @@ -1,590 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/framecmn.cpp -// Purpose: common (for all platforms) wxFrame functions -// Author: Julian Smart, Vadim Zeitlin -// Created: 01/02/97 -// Id: $Id: framecmn.cpp 51463 2008-01-30 21:31:03Z VZ $ -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/frame.h" - -#ifndef WX_PRECOMP - #include "wx/menu.h" - #include "wx/menuitem.h" - #include "wx/dcclient.h" - #include "wx/toolbar.h" - #include "wx/statusbr.h" -#endif // WX_PRECOMP - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -#if wxUSE_MENUS && wxUSE_STATUSBAR - -BEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow) - EVT_MENU_OPEN(wxFrameBase::OnMenuOpen) - EVT_MENU_CLOSE(wxFrameBase::OnMenuClose) - - EVT_MENU_HIGHLIGHT_ALL(wxFrameBase::OnMenuHighlight) -END_EVENT_TABLE() - -#endif // wxUSE_MENUS && wxUSE_STATUSBAR - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// construction/destruction -// ---------------------------------------------------------------------------- - -wxFrameBase::wxFrameBase() -{ -#if wxUSE_MENUS - m_frameMenuBar = NULL; -#endif // wxUSE_MENUS - -#if wxUSE_TOOLBAR - m_frameToolBar = NULL; -#endif // wxUSE_TOOLBAR - -#if wxUSE_STATUSBAR - m_frameStatusBar = NULL; -#endif // wxUSE_STATUSBAR - - m_statusBarPane = 0; -} - -wxFrameBase::~wxFrameBase() -{ - // this destructor is required for Darwin -} - -wxFrame *wxFrameBase::New(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - return new wxFrame(parent, id, title, pos, size, style, name); -} - -void wxFrameBase::DeleteAllBars() -{ -#if wxUSE_MENUS - if ( m_frameMenuBar ) - { - delete m_frameMenuBar; - m_frameMenuBar = (wxMenuBar *) NULL; - } -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - if ( m_frameStatusBar ) - { - delete m_frameStatusBar; - m_frameStatusBar = (wxStatusBar *) NULL; - } -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR - if ( m_frameToolBar ) - { - delete m_frameToolBar; - m_frameToolBar = (wxToolBar *) NULL; - } -#endif // wxUSE_TOOLBAR -} - -bool wxFrameBase::IsOneOfBars(const wxWindow *win) const -{ -#if wxUSE_MENUS - if ( win == GetMenuBar() ) - return true; -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - if ( win == GetStatusBar() ) - return true; -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR - if ( win == GetToolBar() ) - return true; -#endif // wxUSE_TOOLBAR - - return false; -} - -// ---------------------------------------------------------------------------- -// wxFrame size management: we exclude the areas taken by menu/status/toolbars -// from the client area, so the client area is what's really available for the -// frame contents -// ---------------------------------------------------------------------------- - -// get the origin of the client area in the client coordinates -wxPoint wxFrameBase::GetClientAreaOrigin() const -{ - wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); - -#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) - wxToolBar *toolbar = GetToolBar(); - if ( toolbar && toolbar->IsShown() ) - { - int w, h; - toolbar->GetSize(&w, &h); - - if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL ) - { - pt.x += w; - } - else - { - pt.y += h; - } - } -#endif // wxUSE_TOOLBAR - - return pt; -} - - -void wxFrameBase::SendSizeEvent() -{ - const wxSize size = GetSize(); - wxSizeEvent event( size, GetId() ); - event.SetEventObject( this ); - GetEventHandler()->AddPendingEvent( event ); - -#ifdef __WXGTK__ - // SendSizeEvent is typically called when a toolbar is shown - // or hidden, but sending the size event alone is not enough - // to trigger a full layout. - ((wxFrame*)this)->GtkOnSize( -#ifndef __WXGTK20__ - 0, 0, size.x, size.y -#endif // __WXGTK20__ - ); -#endif // __WXGTK__ -} - - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -bool wxFrameBase::ProcessCommand(int id) -{ -#if wxUSE_MENUS - wxMenuBar *bar = GetMenuBar(); - if ( !bar ) - return false; - - wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id); - commandEvent.SetEventObject(this); - - wxMenuItem *item = bar->FindItem(id); - if (item) - { - if (!item->IsEnabled()) - return true; - - if ((item->GetKind() == wxITEM_RADIO) && item->IsChecked() ) - return true; - - if (item->IsCheckable()) - { - item->Toggle(); - - // use the new value - commandEvent.SetInt(item->IsChecked()); - } - } - - return GetEventHandler()->ProcessEvent(commandEvent); -#else // !wxUSE_MENUS - return false; -#endif // wxUSE_MENUS/!wxUSE_MENUS -} - -// Do the UI update processing for this window. This is -// provided for the application to call if it wants to -// force a UI update, particularly for the menus and toolbar. -void wxFrameBase::UpdateWindowUI(long flags) -{ - wxWindowBase::UpdateWindowUI(flags); - -#if wxUSE_TOOLBAR - if (GetToolBar()) - GetToolBar()->UpdateWindowUI(flags); -#endif - -#if wxUSE_MENUS - if (GetMenuBar()) - { - if ((flags & wxUPDATE_UI_FROMIDLE) && !wxUSE_IDLEMENUUPDATES) - { - // If coming from an idle event, we only - // want to update the menus if we're - // in the wxUSE_IDLEMENUUPDATES configuration: - // so if we're not, do nothing - } - else - DoMenuUpdates(); - } -#endif // wxUSE_MENUS -} - -// ---------------------------------------------------------------------------- -// event handlers for status bar updates from menus -// ---------------------------------------------------------------------------- - -#if wxUSE_MENUS && wxUSE_STATUSBAR - -void wxFrameBase::OnMenuHighlight(wxMenuEvent& event) -{ -#if wxUSE_STATUSBAR - (void)ShowMenuHelp(GetStatusBar(), event.GetMenuId()); -#endif // wxUSE_STATUSBAR -} - -#if !wxUSE_IDLEMENUUPDATES -void wxFrameBase::OnMenuOpen(wxMenuEvent& event) -#else -void wxFrameBase::OnMenuOpen(wxMenuEvent& WXUNUSED(event)) -#endif -{ -#if !wxUSE_IDLEMENUUPDATES - DoMenuUpdates(event.GetMenu()); -#endif // !wxUSE_IDLEMENUUPDATES -} - -void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event)) -{ - // do we have real status text to restore? - if ( !m_oldStatusText.empty() ) - { - if ( m_statusBarPane >= 0 ) - { - wxStatusBar *statbar = GetStatusBar(); - if ( statbar ) - statbar->SetStatusText(m_oldStatusText, m_statusBarPane); - } - - m_oldStatusText.clear(); - } -} - -#endif // wxUSE_MENUS && wxUSE_STATUSBAR - -// Implement internal behaviour (menu updating on some platforms) -void wxFrameBase::OnInternalIdle() -{ - wxTopLevelWindow::OnInternalIdle(); - -#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES - if (wxUpdateUIEvent::CanUpdate(this)) - DoMenuUpdates(); -#endif -} - -// ---------------------------------------------------------------------------- -// status bar stuff -// ---------------------------------------------------------------------------- - -#if wxUSE_STATUSBAR - -wxStatusBar* wxFrameBase::CreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name) -{ - // the main status bar can only be created once (or else it should be - // deleted before calling CreateStatusBar() again) - wxCHECK_MSG( !m_frameStatusBar, (wxStatusBar *)NULL, - wxT("recreating status bar in wxFrame") ); - - SetStatusBar(OnCreateStatusBar(number, style, id, name)); - - return m_frameStatusBar; -} - -wxStatusBar *wxFrameBase::OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name) -{ - wxStatusBar *statusBar = new wxStatusBar(this, id, style, name); - - statusBar->SetFieldsCount(number); - - return statusBar; -} - -void wxFrameBase::SetStatusText(const wxString& text, int number) -{ - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); - - m_frameStatusBar->SetStatusText(text, number); -} - -void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) -{ - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set widths for") ); - - m_frameStatusBar->SetStatusWidths(n, widths_field); - - PositionStatusBar(); -} - -void wxFrameBase::PushStatusText(const wxString& text, int number) -{ - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); - - m_frameStatusBar->PushStatusText(text, number); -} - -void wxFrameBase::PopStatusText(int number) -{ - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); - - m_frameStatusBar->PopStatusText(number); -} - -bool wxFrameBase::ShowMenuHelp(wxStatusBar *WXUNUSED(statbar), int menuId) -{ -#if wxUSE_MENUS - // if no help string found, we will clear the status bar text - wxString helpString; - bool show = menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */; - - if ( show ) - { - wxMenuBar *menuBar = GetMenuBar(); - if ( menuBar ) - { - // it's ok if we don't find the item because it might belong - // to the popup menu - wxMenuItem *item = menuBar->FindItem(menuId); - if ( item ) - helpString = item->GetHelp(); - } - } - - DoGiveHelp(helpString, show); - - return !helpString.empty(); -#else // !wxUSE_MENUS - return false; -#endif // wxUSE_MENUS/!wxUSE_MENUS -} - -void wxFrameBase::SetStatusBar(wxStatusBar *statBar) -{ - bool hadBar = m_frameStatusBar != NULL; - m_frameStatusBar = statBar; - - if ( (m_frameStatusBar != NULL) != hadBar ) - { - PositionStatusBar(); - - DoLayout(); - } -} - -#endif // wxUSE_STATUSBAR - -#if wxUSE_MENUS || wxUSE_TOOLBAR -void wxFrameBase::DoGiveHelp(const wxString& text, bool show) -{ -#if wxUSE_STATUSBAR - if ( m_statusBarPane < 0 ) - { - // status bar messages disabled - return; - } - - wxStatusBar *statbar = GetStatusBar(); - if ( !statbar ) - return; - - wxString help; - if ( show ) - { - help = text; - - // remember the old status bar text if this is the first time we're - // called since the menu has been opened as we're going to overwrite it - // in our DoGiveHelp() and we want to restore it when the menu is - // closed - // - // note that it would be logical to do this in OnMenuOpen() but under - // MSW we get an EVT_MENU_HIGHLIGHT before EVT_MENU_OPEN, strangely - // enough, and so this doesn't work and instead we use the ugly trick - // with using special m_oldStatusText value as "menu opened" (but it is - // arguably better than adding yet another member variable to wxFrame - // on all platforms) - if ( m_oldStatusText.empty() ) - { - m_oldStatusText = statbar->GetStatusText(m_statusBarPane); - if ( m_oldStatusText.empty() ) - { - // use special value to prevent us from doing this the next time - m_oldStatusText += _T('\0'); - } - } - } - else // hide the status bar text - { - // i.e. restore the old one - help = m_oldStatusText; - - // make sure we get the up to date text when showing it the next time - m_oldStatusText.clear(); - } - - statbar->SetStatusText(help, m_statusBarPane); -#else - wxUnusedVar(text); - wxUnusedVar(show); -#endif // wxUSE_STATUSBAR -} -#endif // wxUSE_MENUS || wxUSE_TOOLBAR - - -// ---------------------------------------------------------------------------- -// toolbar stuff -// ---------------------------------------------------------------------------- - -#if wxUSE_TOOLBAR - -wxToolBar* wxFrameBase::CreateToolBar(long style, - wxWindowID id, - const wxString& name) -{ - // the main toolbar can't be recreated (unless it was explicitly deleted - // before) - wxCHECK_MSG( !m_frameToolBar, (wxToolBar *)NULL, - wxT("recreating toolbar in wxFrame") ); - - if ( style == -1 ) - { - // use default style - // - // NB: we don't specify the default value in the method declaration - // because - // a) this allows us to have different defaults for different - // platforms (even if we don't have them right now) - // b) we don't need to include wx/toolbar.h in the header then - style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT; - } - - SetToolBar(OnCreateToolBar(style, id, name)); - - return m_frameToolBar; -} - -wxToolBar* wxFrameBase::OnCreateToolBar(long style, - wxWindowID id, - const wxString& name) -{ -#if defined(__WXWINCE__) && defined(__POCKETPC__) - return new wxToolMenuBar(this, id, - wxDefaultPosition, wxDefaultSize, - style, name); -#else - return new wxToolBar(this, id, - wxDefaultPosition, wxDefaultSize, - style, name); -#endif -} - -void wxFrameBase::SetToolBar(wxToolBar *toolbar) -{ - bool hadBar = m_frameToolBar != NULL; - m_frameToolBar = toolbar; - - if ( (m_frameToolBar != NULL) != hadBar ) - { - PositionToolBar(); - - DoLayout(); - } -} - -#endif // wxUSE_TOOLBAR - -// ---------------------------------------------------------------------------- -// menus -// ---------------------------------------------------------------------------- - -#if wxUSE_MENUS - -// update all menus -void wxFrameBase::DoMenuUpdates(wxMenu* menu) -{ - if (menu) - { - wxEvtHandler* source = GetEventHandler(); - menu->UpdateUI(source); - } - else - { - wxMenuBar* bar = GetMenuBar(); - if (bar != NULL) - bar->UpdateMenus(); - } -} - -void wxFrameBase::DetachMenuBar() -{ - if ( m_frameMenuBar ) - { - m_frameMenuBar->Detach(); - m_frameMenuBar = NULL; - } -} - -void wxFrameBase::AttachMenuBar(wxMenuBar *menubar) -{ - if ( menubar ) - { - menubar->Attach((wxFrame *)this); - m_frameMenuBar = menubar; - } -} - -void wxFrameBase::SetMenuBar(wxMenuBar *menubar) -{ - if ( menubar == GetMenuBar() ) - { - // nothing to do - return; - } - - DetachMenuBar(); - - this->AttachMenuBar(menubar); -} - -#endif // wxUSE_MENUS diff --git a/Source/3rdParty/wx/src/common/fs_arc.cpp b/Source/3rdParty/wx/src/common/fs_arc.cpp deleted file mode 100644 index ee1220cfc..000000000 --- a/Source/3rdParty/wx/src/common/fs_arc.cpp +++ /dev/null @@ -1,533 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: fs_arc.cpp -// Purpose: wxArchive file system -// Author: Vaclav Slavik, Mike Wetherell -// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_arc.cpp 51495 2008-02-01 16:44:56Z MW $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_FS_ARCHIVE - -#include "wx/fs_arc.h" - -#ifndef WXPRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_ZIPSTREAM - #include "wx/zipstrm.h" -#else - #include "wx/archive.h" -#endif - -#include "wx/private/fileback.h" - -//--------------------------------------------------------------------------- -// wxArchiveFSCacheDataImpl -// -// Holds the catalog of an archive file, and if it is being read from a -// non-seekable stream, a copy of its backing file. -// -// This class is actually the reference counted implementation for the -// wxArchiveFSCacheData class below. It was done that way to allow sharing -// between instances of wxFileSystem, though that's a feature not used in this -// version. -//--------------------------------------------------------------------------- - -WX_DECLARE_STRING_HASH_MAP(wxArchiveEntry*, wxArchiveFSEntryHash); - -struct wxArchiveFSEntry -{ - wxArchiveEntry *entry; - wxArchiveFSEntry *next; -}; - -class wxArchiveFSCacheDataImpl -{ -public: - wxArchiveFSCacheDataImpl(const wxArchiveClassFactory& factory, - const wxBackingFile& backer); - wxArchiveFSCacheDataImpl(const wxArchiveClassFactory& factory, - wxInputStream *stream); - - ~wxArchiveFSCacheDataImpl(); - - void Release() { if (--m_refcount == 0) delete this; } - wxArchiveFSCacheDataImpl *AddRef() { m_refcount++; return this; } - - wxArchiveEntry *Get(const wxString& name); - wxInputStream *NewStream() const; - - wxArchiveFSEntry *GetNext(wxArchiveFSEntry *fse); - -private: - wxArchiveFSEntry *AddToCache(wxArchiveEntry *entry); - void CloseStreams(); - - int m_refcount; - - wxArchiveFSEntryHash m_hash; - wxArchiveFSEntry *m_begin; - wxArchiveFSEntry **m_endptr; - - wxBackingFile m_backer; - wxInputStream *m_stream; - wxArchiveInputStream *m_archive; -}; - -wxArchiveFSCacheDataImpl::wxArchiveFSCacheDataImpl( - const wxArchiveClassFactory& factory, - const wxBackingFile& backer) - : m_refcount(1), - m_begin(NULL), - m_endptr(&m_begin), - m_backer(backer), - m_stream(new wxBackedInputStream(backer)), - m_archive(factory.NewStream(*m_stream)) -{ -} - -wxArchiveFSCacheDataImpl::wxArchiveFSCacheDataImpl( - const wxArchiveClassFactory& factory, - wxInputStream *stream) - : m_refcount(1), - m_begin(NULL), - m_endptr(&m_begin), - m_stream(stream), - m_archive(factory.NewStream(*m_stream)) -{ -} - -wxArchiveFSCacheDataImpl::~wxArchiveFSCacheDataImpl() -{ - WX_CLEAR_HASH_MAP(wxArchiveFSEntryHash, m_hash); - - wxArchiveFSEntry *entry = m_begin; - - while (entry) - { - wxArchiveFSEntry *next = entry->next; - delete entry; - entry = next; - } - - CloseStreams(); -} - -wxArchiveFSEntry *wxArchiveFSCacheDataImpl::AddToCache(wxArchiveEntry *entry) -{ - m_hash[entry->GetName(wxPATH_UNIX)] = entry; - wxArchiveFSEntry *fse = new wxArchiveFSEntry; - *m_endptr = fse; - (*m_endptr)->entry = entry; - (*m_endptr)->next = NULL; - m_endptr = &(*m_endptr)->next; - return fse; -} - -void wxArchiveFSCacheDataImpl::CloseStreams() -{ - delete m_archive; - m_archive = NULL; - delete m_stream; - m_stream = NULL; -} - -wxArchiveEntry *wxArchiveFSCacheDataImpl::Get(const wxString& name) -{ - wxArchiveFSEntryHash::iterator it = m_hash.find(name); - - if (it != m_hash.end()) - return it->second; - - if (!m_archive) - return NULL; - - wxArchiveEntry *entry; - - while ((entry = m_archive->GetNextEntry()) != NULL) - { - AddToCache(entry); - - if (entry->GetName(wxPATH_UNIX) == name) - return entry; - } - - CloseStreams(); - - return NULL; -} - -wxInputStream* wxArchiveFSCacheDataImpl::NewStream() const -{ - if (m_backer) - return new wxBackedInputStream(m_backer); - else - return NULL; -} - -wxArchiveFSEntry *wxArchiveFSCacheDataImpl::GetNext(wxArchiveFSEntry *fse) -{ - wxArchiveFSEntry *next = fse ? fse->next : m_begin; - - if (!next && m_archive) - { - wxArchiveEntry *entry = m_archive->GetNextEntry(); - - if (entry) - next = AddToCache(entry); - else - CloseStreams(); - } - - return next; -} - -//--------------------------------------------------------------------------- -// wxArchiveFSCacheData -// -// This is the inteface for wxArchiveFSCacheDataImpl above. Holds the catalog -// of an archive file, and if it is being read from a non-seekable stream, a -// copy of its backing file. -//--------------------------------------------------------------------------- - -class wxArchiveFSCacheData -{ -public: - wxArchiveFSCacheData() : m_impl(NULL) { } - wxArchiveFSCacheData(const wxArchiveClassFactory& factory, - const wxBackingFile& backer); - wxArchiveFSCacheData(const wxArchiveClassFactory& factory, - wxInputStream *stream); - - wxArchiveFSCacheData(const wxArchiveFSCacheData& data); - wxArchiveFSCacheData& operator=(const wxArchiveFSCacheData& data); - - ~wxArchiveFSCacheData() { if (m_impl) m_impl->Release(); } - - wxArchiveEntry *Get(const wxString& name) { return m_impl->Get(name); } - wxInputStream *NewStream() const { return m_impl->NewStream(); } - wxArchiveFSEntry *GetNext(wxArchiveFSEntry *fse) - { return m_impl->GetNext(fse); } - -private: - wxArchiveFSCacheDataImpl *m_impl; -}; - -wxArchiveFSCacheData::wxArchiveFSCacheData( - const wxArchiveClassFactory& factory, - const wxBackingFile& backer) - : m_impl(new wxArchiveFSCacheDataImpl(factory, backer)) -{ -} - -wxArchiveFSCacheData::wxArchiveFSCacheData( - const wxArchiveClassFactory& factory, - wxInputStream *stream) - : m_impl(new wxArchiveFSCacheDataImpl(factory, stream)) -{ -} - -wxArchiveFSCacheData::wxArchiveFSCacheData(const wxArchiveFSCacheData& data) - : m_impl(data.m_impl ? data.m_impl->AddRef() : NULL) -{ -} - -wxArchiveFSCacheData& wxArchiveFSCacheData::operator=( - const wxArchiveFSCacheData& data) -{ - if (data.m_impl != m_impl) - { - if (m_impl) - m_impl->Release(); - - m_impl = data.m_impl; - - if (m_impl) - m_impl->AddRef(); - } - - return *this; -} - -//--------------------------------------------------------------------------- -// wxArchiveFSCache -// -// wxArchiveFSCacheData caches a single archive, and this class holds a -// collection of them to cache all the archives accessed by this instance -// of wxFileSystem. -//--------------------------------------------------------------------------- - -WX_DECLARE_STRING_HASH_MAP(wxArchiveFSCacheData, wxArchiveFSCacheDataHash); - -class wxArchiveFSCache -{ -public: - wxArchiveFSCache() { } - ~wxArchiveFSCache() { } - - wxArchiveFSCacheData* Add(const wxString& name, - const wxArchiveClassFactory& factory, - wxInputStream *stream); - - wxArchiveFSCacheData *Get(const wxString& name); - -private: - wxArchiveFSCacheDataHash m_hash; -}; - -wxArchiveFSCacheData* wxArchiveFSCache::Add( - const wxString& name, - const wxArchiveClassFactory& factory, - wxInputStream *stream) -{ - wxArchiveFSCacheData& data = m_hash[name]; - - if (stream->IsSeekable()) - data = wxArchiveFSCacheData(factory, stream); - else - data = wxArchiveFSCacheData(factory, wxBackingFile(stream)); - - return &data; -} - -wxArchiveFSCacheData *wxArchiveFSCache::Get(const wxString& name) -{ - wxArchiveFSCacheDataHash::iterator it; - - if ((it = m_hash.find(name)) != m_hash.end()) - return &it->second; - - return NULL; -} - -//---------------------------------------------------------------------------- -// wxArchiveFSHandler -//---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxArchiveFSHandler, wxFileSystemHandler) - -wxArchiveFSHandler::wxArchiveFSHandler() - : wxFileSystemHandler() -{ - m_Archive = NULL; - m_FindEntry = NULL; - m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString; - m_AllowDirs = m_AllowFiles = true; - m_DirsFound = NULL; - m_cache = NULL; -} - -wxArchiveFSHandler::~wxArchiveFSHandler() -{ - Cleanup(); - delete m_cache; -} - -void wxArchiveFSHandler::Cleanup() -{ - wxDELETE(m_DirsFound); -} - -bool wxArchiveFSHandler::CanOpen(const wxString& location) -{ - wxString p = GetProtocol(location); - return wxArchiveClassFactory::Find(p) != NULL; -} - -wxFSFile* wxArchiveFSHandler::OpenFile( - wxFileSystem& WXUNUSED(fs), - const wxString& location) -{ - wxString right = GetRightLocation(location); - wxString left = GetLeftLocation(location); - wxString protocol = GetProtocol(location); - wxString key = left + wxT("#") + protocol + wxT(":"); - - if (right.Contains(wxT("./"))) - { - if (right.GetChar(0) != wxT('/')) right = wxT('/') + right; - wxFileName rightPart(right, wxPATH_UNIX); - rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX); - right = rightPart.GetFullPath(wxPATH_UNIX); - } - - if (right.GetChar(0) == wxT('/')) right = right.Mid(1); - - if (!m_cache) - m_cache = new wxArchiveFSCache; - - const wxArchiveClassFactory *factory; - factory = wxArchiveClassFactory::Find(protocol); - if (!factory) - return NULL; - - wxArchiveFSCacheData *cached = m_cache->Get(key); - if (!cached) - { - wxFSFile *leftFile = m_fs.OpenFile(left); - if (!leftFile) - return NULL; - cached = m_cache->Add(key, *factory, leftFile->DetachStream()); - delete leftFile; - } - - wxArchiveEntry *entry = cached->Get(right); - if (!entry) - return NULL; - - wxInputStream *leftStream = cached->NewStream(); - if (!leftStream) - { - wxFSFile *leftFile = m_fs.OpenFile(left); - if (!leftFile) - return NULL; - leftStream = leftFile->DetachStream(); - delete leftFile; - } - - wxArchiveInputStream *s = factory->NewStream(leftStream); - s->OpenEntry(*entry); - - if (s && s->IsOk()) - { -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_ZIPSTREAM - if (factory->IsKindOf(CLASSINFO(wxZipClassFactory))) - ((wxZipInputStream*)s)->m_allowSeeking = true; -#endif // WXWIN_COMPATIBILITY_2_6 - - return new wxFSFile(s, - key + right, - GetMimeTypeFromExt(location), - GetAnchor(location) -#if wxUSE_DATETIME - , entry->GetDateTime() -#endif // wxUSE_DATETIME - ); - } - - delete s; - return NULL; -} - -wxString wxArchiveFSHandler::FindFirst(const wxString& spec, int flags) -{ - wxString right = GetRightLocation(spec); - wxString left = GetLeftLocation(spec); - wxString protocol = GetProtocol(spec); - wxString key = left + wxT("#") + protocol + wxT(":"); - - if (!right.empty() && right.Last() == wxT('/')) right.RemoveLast(); - - if (!m_cache) - m_cache = new wxArchiveFSCache; - - const wxArchiveClassFactory *factory; - factory = wxArchiveClassFactory::Find(protocol); - if (!factory) - return wxEmptyString; - - m_Archive = m_cache->Get(key); - if (!m_Archive) - { - wxFSFile *leftFile = m_fs.OpenFile(left); - if (!leftFile) - return wxEmptyString; - m_Archive = m_cache->Add(key, *factory, leftFile->DetachStream()); - delete leftFile; - } - - m_FindEntry = NULL; - - switch (flags) - { - case wxFILE: - m_AllowDirs = false, m_AllowFiles = true; break; - case wxDIR: - m_AllowDirs = true, m_AllowFiles = false; break; - default: - m_AllowDirs = m_AllowFiles = true; break; - } - - m_ZipFile = key; - - m_Pattern = right.AfterLast(wxT('/')); - m_BaseDir = right.BeforeLast(wxT('/')); - if (m_BaseDir.StartsWith(wxT("/"))) - m_BaseDir = m_BaseDir.Mid(1); - - if (m_Archive) - { - if (m_AllowDirs) - { - delete m_DirsFound; - m_DirsFound = new wxArchiveFilenameHashMap(); - if (right.empty()) // allow "/" to match the archive root - return spec; - } - return DoFind(); - } - return wxEmptyString; -} - -wxString wxArchiveFSHandler::FindNext() -{ - if (!m_Archive) return wxEmptyString; - return DoFind(); -} - -wxString wxArchiveFSHandler::DoFind() -{ - wxString namestr, dir, filename; - wxString match = wxEmptyString; - - while (match == wxEmptyString) - { - m_FindEntry = m_Archive->GetNext(m_FindEntry); - - if (!m_FindEntry) - { - m_Archive = NULL; - m_FindEntry = NULL; - break; - } - namestr = m_FindEntry->entry->GetName(wxPATH_UNIX); - - if (m_AllowDirs) - { - dir = namestr.BeforeLast(wxT('/')); - while (!dir.empty()) - { - if( m_DirsFound->find(dir) == m_DirsFound->end() ) - { - (*m_DirsFound)[dir] = 1; - filename = dir.AfterLast(wxT('/')); - dir = dir.BeforeLast(wxT('/')); - if (!filename.empty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, false)) - match = m_ZipFile + dir + wxT("/") + filename; - } - else - break; // already tranversed - } - } - - filename = namestr.AfterLast(wxT('/')); - dir = namestr.BeforeLast(wxT('/')); - if (m_AllowFiles && !filename.empty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, false)) - match = m_ZipFile + namestr; - } - - return match; -} - -#endif // wxUSE_FS_ARCHIVE diff --git a/Source/3rdParty/wx/src/common/fs_filter.cpp b/Source/3rdParty/wx/src/common/fs_filter.cpp deleted file mode 100644 index d0fae32ba..000000000 --- a/Source/3rdParty/wx/src/common/fs_filter.cpp +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fs_filter.cpp -// Purpose: wxFilter file system handler -// Author: Mike Wetherell -// Copyright: (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_filter.cpp 42514 2006-10-27 10:47:13Z MW $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILESYSTEM - -#include "wx/fs_filter.h" - -#ifndef WXPRECOMP -#endif - -#include "wx/ptr_scpd.h" - -wxDEFINE_SCOPED_PTR_TYPE(wxFSFile) -wxDEFINE_SCOPED_PTR_TYPE(wxInputStream) - -//---------------------------------------------------------------------------- -// wxFilterFSHandler -//---------------------------------------------------------------------------- - -bool wxFilterFSHandler::CanOpen(const wxString& location) -{ - return wxFilterClassFactory::Find(GetProtocol(location)) != NULL; -} - -wxFSFile* wxFilterFSHandler::OpenFile( - wxFileSystem& fs, - const wxString& location) -{ - wxString right = GetRightLocation(location); - if (!right.empty()) - return NULL; - - wxString protocol = GetProtocol(location); - const wxFilterClassFactory *factory = wxFilterClassFactory::Find(protocol); - if (!factory) - return NULL; - - wxString left = GetLeftLocation(location); - wxFSFilePtr leftFile(fs.OpenFile(left)); - if (!leftFile.get()) - return NULL; - - wxInputStreamPtr leftStream(leftFile->DetachStream()); - if (!leftStream.get() || !leftStream->IsOk()) - return NULL; - - wxInputStreamPtr stream(factory->NewStream(leftStream.release())); - - // The way compressed streams are supposed to be served is e.g.: - // Content-type: application/postscript - // Content-encoding: gzip - // So the mime type should be just the mime type of the lhs. However check - // whether the mime type is that of this compression format (e.g. - // application/gzip). If so pop any extension and try GetMimeTypeFromExt, - // e.g. if it were '.ps.gz' pop the '.gz' and try looking up '.ps' - wxString mime = leftFile->GetMimeType(); - if (factory->CanHandle(mime, wxSTREAM_MIMETYPE)) - mime = GetMimeTypeFromExt(factory->PopExtension(left)); - - return new wxFSFile(stream.release(), - left + wxT("#") + protocol + wxT(":") + right, - mime, - GetAnchor(location) -#if wxUSE_DATETIME - , leftFile->GetModificationTime() -#endif // wxUSE_DATETIME - ); -} - -wxString wxFilterFSHandler::FindFirst(const wxString& WXUNUSED(spec), int WXUNUSED(flags)) -{ - return wxEmptyString; -} - -wxString wxFilterFSHandler::FindNext() -{ - return wxEmptyString; -} - -#endif //wxUSE_FILESYSTEM diff --git a/Source/3rdParty/wx/src/common/fs_mem.cpp b/Source/3rdParty/wx/src/common/fs_mem.cpp deleted file mode 100644 index 3bf24969e..000000000 --- a/Source/3rdParty/wx/src/common/fs_mem.cpp +++ /dev/null @@ -1,288 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fs_mem.cpp -// Purpose: in-memory file system -// Author: Vaclav Slavik -// RCS-ID: $Id: fs_mem.cpp 46522 2007-06-18 18:37:40Z VS $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILESYSTEM && wxUSE_STREAMS - -#include "wx/fs_mem.h" - -#ifndef WXPRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/hash.h" - #if wxUSE_GUI - #include "wx/bitmap.h" - #include "wx/image.h" - #endif // wxUSE_GUI -#endif - -#include "wx/mstream.h" - -class MemFSHashObj : public wxObject -{ - public: - - MemFSHashObj(const void *data, size_t len, const wxString& mime) - { - m_Data = new char[len]; - memcpy(m_Data, data, len); - m_Len = len; - m_MimeType = mime; - InitTime(); - } - - MemFSHashObj(const wxMemoryOutputStream& stream, const wxString& mime) - { - m_Len = stream.GetSize(); - m_Data = new char[m_Len]; - stream.CopyTo(m_Data, m_Len); - m_MimeType = mime; - InitTime(); - } - - virtual ~MemFSHashObj() - { - delete[] m_Data; - } - - char *m_Data; - size_t m_Len; - wxString m_MimeType; -#if wxUSE_DATETIME - wxDateTime m_Time; -#endif // wxUSE_DATETIME - - DECLARE_NO_COPY_CLASS(MemFSHashObj) - - private: - void InitTime() - { -#if wxUSE_DATETIME - m_Time = wxDateTime::Now(); -#endif // wxUSE_DATETIME - } -}; - -#if wxUSE_BASE - - -//-------------------------------------------------------------------------------- -// wxMemoryFSHandler -//-------------------------------------------------------------------------------- - - -wxHashTable *wxMemoryFSHandlerBase::m_Hash = NULL; - - -wxMemoryFSHandlerBase::wxMemoryFSHandlerBase() : wxFileSystemHandler() -{ -} - - - -wxMemoryFSHandlerBase::~wxMemoryFSHandlerBase() -{ - // as only one copy of FS handler is supposed to exist, we may silently - // delete static data here. (There is no way how to remove FS handler from - // wxFileSystem other than releasing _all_ handlers.) - - if (m_Hash) - { - WX_CLEAR_HASH_TABLE(*m_Hash); - delete m_Hash; - m_Hash = NULL; - } -} - - - -bool wxMemoryFSHandlerBase::CanOpen(const wxString& location) -{ - wxString p = GetProtocol(location); - return (p == wxT("memory")); -} - - - - -wxFSFile* wxMemoryFSHandlerBase::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) -{ - if (m_Hash) - { - MemFSHashObj *obj = (MemFSHashObj*) m_Hash -> Get(GetRightLocation(location)); - if (obj == NULL) - { - return NULL; - } - else - { - wxString mime = obj->m_MimeType; - if ( mime.empty() ) - mime = GetMimeTypeFromExt(location); - return new wxFSFile - ( - new wxMemoryInputStream(obj -> m_Data, obj -> m_Len), - location, - mime, - GetAnchor(location) -#if wxUSE_DATETIME - , obj -> m_Time -#endif // wxUSE_DATETIME - ); - } - } - else return NULL; -} - - - -wxString wxMemoryFSHandlerBase::FindFirst(const wxString& WXUNUSED(spec), - int WXUNUSED(flags)) -{ - wxFAIL_MSG(wxT("wxMemoryFSHandlerBase::FindFirst not implemented")); - - return wxEmptyString; -} - - - -wxString wxMemoryFSHandlerBase::FindNext() -{ - wxFAIL_MSG(wxT("wxMemoryFSHandlerBase::FindNext not implemented")); - - return wxEmptyString; -} - - -bool wxMemoryFSHandlerBase::CheckHash(const wxString& filename) -{ - if (m_Hash == NULL) - { - m_Hash = new wxHashTable(wxKEY_STRING); - } - - if (m_Hash -> Get(filename) != NULL) - { - wxString s; - s.Printf(_("Memory VFS already contains file '%s'!"), filename.c_str()); - wxLogError(s); - return false; - } - else - return true; -} - - -/*static*/ -void wxMemoryFSHandlerBase::AddFileWithMimeType(const wxString& filename, - const wxString& textdata, - const wxString& mimetype) -{ - AddFileWithMimeType(filename, - (const void*) textdata.mb_str(), textdata.length(), - mimetype); -} - - -/*static*/ -void wxMemoryFSHandlerBase::AddFileWithMimeType(const wxString& filename, - const void *binarydata, size_t size, - const wxString& mimetype) -{ - if (!CheckHash(filename)) return; - m_Hash -> Put(filename, new MemFSHashObj(binarydata, size, mimetype)); -} - -/*static*/ -void wxMemoryFSHandlerBase::AddFile(const wxString& filename, - const wxString& textdata) -{ - AddFileWithMimeType(filename, textdata, wxEmptyString); -} - - -/*static*/ -void wxMemoryFSHandlerBase::AddFile(const wxString& filename, - const void *binarydata, size_t size) -{ - AddFileWithMimeType(filename, binarydata, size, wxEmptyString); -} - - - -/*static*/ void wxMemoryFSHandlerBase::RemoveFile(const wxString& filename) -{ - if (m_Hash == NULL || - m_Hash -> Get(filename) == NULL) - { - wxString s; - s.Printf(_("Trying to remove file '%s' from memory VFS, but it is not loaded!"), filename.c_str()); - wxLogError(s); - } - - else - delete m_Hash -> Delete(filename); -} - -#endif // wxUSE_BASE - -#if wxUSE_GUI - -#if wxUSE_IMAGE -/*static*/ void -wxMemoryFSHandler::AddFile(const wxString& filename, - const wxImage& image, - long type) -{ - if (!CheckHash(filename)) return; - - wxMemoryOutputStream mems; - if (image.Ok() && image.SaveFile(mems, (int)type)) - { - m_Hash->Put - ( - filename, - new MemFSHashObj - ( - mems, - wxImage::FindHandler(type)->GetMimeType() - ) - ); - } - else - { - wxString s; - s.Printf(_("Failed to store image '%s' to memory VFS!"), filename.c_str()); - wxPrintf(wxT("'%s'\n"), s.c_str()); - wxLogError(s); - } -} - -/*static*/ void -wxMemoryFSHandler::AddFile(const wxString& filename, - const wxBitmap& bitmap, - long type) -{ -#if !defined(__WXMSW__) || wxUSE_WXDIB - wxImage img = bitmap.ConvertToImage(); - AddFile(filename, img, type); -#endif -} - -#endif // wxUSE_IMAGE - -#endif // wxUSE_GUI - - -#endif // wxUSE_FILESYSTEM && wxUSE_FS_ZIP diff --git a/Source/3rdParty/wx/src/common/gaugecmn.cpp b/Source/3rdParty/wx/src/common/gaugecmn.cpp deleted file mode 100644 index d8ab642e6..000000000 --- a/Source/3rdParty/wx/src/common/gaugecmn.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/gaugecmn.cpp -// Purpose: wxGaugeBase: common to all ports methods of wxGauge -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.02.01 -// RCS-ID: $Id: gaugecmn.cpp 41089 2006-09-09 13:36:54Z RR $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#if wxUSE_GAUGE - -#include "wx/gauge.h" - -const wxChar wxGaugeNameStr[] = wxT("gauge"); - -// ============================================================================ -// implementation -// ============================================================================ - -wxGaugeBase::~wxGaugeBase() -{ - // this destructor is required for Darwin -} - -// ---------------------------------------------------------------------------- -// wxGauge creation -// ---------------------------------------------------------------------------- - -bool wxGaugeBase::Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) - return false; - - SetName(name); - -#if wxUSE_VALIDATORS - SetValidator(validator); -#endif // wxUSE_VALIDATORS - - SetRange(range); - SetValue(0); -#if wxGAUGE_EMULATE_INDETERMINATE_MODE - m_nDirection = wxRIGHT; -#endif - - return true; -} - -// ---------------------------------------------------------------------------- -// wxGauge determinate mode range/position -// ---------------------------------------------------------------------------- - -void wxGaugeBase::SetRange(int range) -{ - m_rangeMax = range; -} - -int wxGaugeBase::GetRange() const -{ - return m_rangeMax; -} - -void wxGaugeBase::SetValue(int pos) -{ - m_gaugePos = pos; -} - -int wxGaugeBase::GetValue() const -{ - return m_gaugePos; -} - -// ---------------------------------------------------------------------------- -// wxGauge indeterminate mode -// ---------------------------------------------------------------------------- - -void wxGaugeBase::Pulse() -{ -#if wxGAUGE_EMULATE_INDETERMINATE_MODE - // simulate indeterminate mode - int curr = GetValue(), max = GetRange(); - - if (m_nDirection == wxRIGHT) - { - if (curr < max) - SetValue(curr + 1); - else - { - SetValue(max - 1); - m_nDirection = wxLEFT; - } - } - else - { - if (curr > 0) - SetValue(curr - 1); - else - { - SetValue(1); - m_nDirection = wxRIGHT; - } - } -#endif -} - -// ---------------------------------------------------------------------------- -// wxGauge appearance params -// ---------------------------------------------------------------------------- - -void wxGaugeBase::SetShadowWidth(int WXUNUSED(w)) -{ -} - -int wxGaugeBase::GetShadowWidth() const -{ - return 0; -} - - -void wxGaugeBase::SetBezelFace(int WXUNUSED(w)) -{ -} - -int wxGaugeBase::GetBezelFace() const -{ - return 0; -} - -#endif // wxUSE_GAUGE diff --git a/Source/3rdParty/wx/src/common/gbsizer.cpp b/Source/3rdParty/wx/src/common/gbsizer.cpp deleted file mode 100644 index c81e80c2b..000000000 --- a/Source/3rdParty/wx/src/common/gbsizer.cpp +++ /dev/null @@ -1,784 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: gbsizer.cpp -// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, -// with items at specified cells, and with the option of row -// and/or column spanning -// -// Author: Robin Dunn -// Created: 03-Nov-2003 -// RCS-ID: $Id: gbsizer.cpp 54568 2008-07-10 01:32:23Z RD $ -// Copyright: (c) Robin Dunn -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/gbsizer.h" - -//--------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGBSizerItem, wxSizerItem) -IMPLEMENT_CLASS(wxGridBagSizer, wxFlexGridSizer) - -const wxGBSpan wxDefaultSpan; - -//--------------------------------------------------------------------------- -// wxGBSizerItem -//--------------------------------------------------------------------------- - -wxGBSizerItem::wxGBSizerItem( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData) - : wxSizerItem(width, height, 0, flag, border, userData), - m_pos(pos), - m_span(span), - m_gbsizer(NULL) -{ -} - - -wxGBSizerItem::wxGBSizerItem( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ) - : wxSizerItem(window, 0, flag, border, userData), - m_pos(pos), - m_span(span), - m_gbsizer(NULL) -{ -} - - -wxGBSizerItem::wxGBSizerItem( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ) - : wxSizerItem(sizer, 0, flag, border, userData), - m_pos(pos), - m_span(span), - m_gbsizer(NULL) -{ -} - -wxGBSizerItem::wxGBSizerItem() - : wxSizerItem(), - m_pos(-1,-1), - m_span(-1,-1), - m_gbsizer(NULL) -{ -} - -//--------------------------------------------------------------------------- - - -void wxGBSizerItem::GetPos(int& row, int& col) const -{ - row = m_pos.GetRow(); - col = m_pos.GetCol(); -} - -void wxGBSizerItem::GetSpan(int& rowspan, int& colspan) const -{ - rowspan = m_span.GetRowspan(); - colspan = m_span.GetColspan(); -} - - -bool wxGBSizerItem::SetPos( const wxGBPosition& pos ) -{ - if (m_gbsizer) - { - wxCHECK_MSG( !m_gbsizer->CheckForIntersection(pos, m_span, this), false, - wxT("An item is already at that position") ); - } - m_pos = pos; - return true; -} - -bool wxGBSizerItem::SetSpan( const wxGBSpan& span ) -{ - if (m_gbsizer) - { - wxCHECK_MSG( !m_gbsizer->CheckForIntersection(m_pos, span, this), false, - wxT("An item is already at that position") ); - } - m_span = span; - return true; -} - - -inline bool InRange(int val, int min, int max) -{ - return (val >= min && val <= max); -} - -bool wxGBSizerItem::Intersects(const wxGBSizerItem& other) -{ - return Intersects(other.GetPos(), other.GetSpan()); -} - -bool wxGBSizerItem::Intersects(const wxGBPosition& pos, const wxGBSpan& span) -{ - - int row, col, endrow, endcol; - int otherrow, othercol, otherendrow, otherendcol; - - GetPos(row, col); - GetEndPos(endrow, endcol); - - otherrow = pos.GetRow(); - othercol = pos.GetCol(); - otherendrow = otherrow + span.GetRowspan() - 1; - otherendcol = othercol + span.GetColspan() - 1; - - // is the other item's start or end in the range of this one? - if (( InRange(otherrow, row, endrow) && InRange(othercol, col, endcol) ) || - ( InRange(otherendrow, row, endrow) && InRange(otherendcol, col, endcol) )) - return true; - - // is this item's start or end in the range of the other one? - if (( InRange(row, otherrow, otherendrow) && InRange(col, othercol, otherendcol) ) || - ( InRange(endrow, otherrow, otherendrow) && InRange(endcol, othercol, otherendcol) )) - return true; - - return false; -} - - -void wxGBSizerItem::GetEndPos(int& row, int& col) -{ - row = m_pos.GetRow() + m_span.GetRowspan() - 1; - col = m_pos.GetCol() + m_span.GetColspan() - 1; -} - - -//--------------------------------------------------------------------------- -// wxGridBagSizer -//--------------------------------------------------------------------------- - -wxGridBagSizer::wxGridBagSizer(int vgap, int hgap ) - : wxFlexGridSizer(1, vgap, hgap), - m_emptyCellSize(10,20) - -{ -} - - -wxSizerItem* wxGridBagSizer::Add( wxWindow *window, - const wxGBPosition& pos, const wxGBSpan& span, - int flag, int border, wxObject* userData ) -{ - wxGBSizerItem* item = new wxGBSizerItem(window, pos, span, flag, border, userData); - if ( Add(item) ) - return item; - else - { - delete item; - return (wxSizerItem*)NULL; - } -} - -wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, - const wxGBPosition& pos, const wxGBSpan& span, - int flag, int border, wxObject* userData ) -{ - wxGBSizerItem* item = new wxGBSizerItem(sizer, pos, span, flag, border, userData); - if ( Add(item) ) - return item; - else - { - delete item; - return (wxSizerItem*)NULL; - } -} - -wxSizerItem* wxGridBagSizer::Add( int width, int height, - const wxGBPosition& pos, const wxGBSpan& span, - int flag, int border, wxObject* userData ) -{ - wxGBSizerItem* item = new wxGBSizerItem(width, height, pos, span, flag, border, userData); - if ( Add(item) ) - return item; - else - { - delete item; - return (wxSizerItem*)NULL; - } -} - -wxSizerItem* wxGridBagSizer::Add( wxGBSizerItem *item ) -{ - wxCHECK_MSG( !CheckForIntersection(item), NULL, - wxT("An item is already at that position") ); - m_children.Append(item); - item->SetGBSizer(this); - if ( item->GetWindow() ) - item->GetWindow()->SetContainingSizer( this ); - - return item; -} - - - -//--------------------------------------------------------------------------- - -wxSize wxGridBagSizer::GetCellSize(int row, int col) const -{ - wxCHECK_MSG( (row < m_rows) && (col < m_cols), - wxDefaultSize, - wxT("Invalid cell.")); - return wxSize( m_colWidths[col], m_rowHeights[row] ); -} - - -wxGBPosition wxGridBagSizer::GetItemPosition(wxWindow *window) -{ - wxGBPosition badpos(-1,-1); - wxGBSizerItem* item = FindItem(window); - wxCHECK_MSG(item, badpos, wxT("Failed to find item.")); - return item->GetPos(); -} - - -wxGBPosition wxGridBagSizer::GetItemPosition(wxSizer *sizer) -{ - wxGBPosition badpos(-1,-1); - wxGBSizerItem* item = FindItem(sizer); - wxCHECK_MSG(item, badpos, wxT("Failed to find item.")); - return item->GetPos(); -} - - -wxGBPosition wxGridBagSizer::GetItemPosition(size_t index) -{ - wxGBPosition badpos(-1,-1); - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - wxCHECK_MSG( node, badpos, _T("Failed to find item.") ); - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - return item->GetPos(); -} - - - -bool wxGridBagSizer::SetItemPosition(wxWindow *window, const wxGBPosition& pos) -{ - wxGBSizerItem* item = FindItem(window); - wxCHECK_MSG(item, false, wxT("Failed to find item.")); - return item->SetPos(pos); -} - - -bool wxGridBagSizer::SetItemPosition(wxSizer *sizer, const wxGBPosition& pos) -{ - wxGBSizerItem* item = FindItem(sizer); - wxCHECK_MSG(item, false, wxT("Failed to find item.")); - return item->SetPos(pos); -} - - -bool wxGridBagSizer::SetItemPosition(size_t index, const wxGBPosition& pos) -{ - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - wxCHECK_MSG( node, false, _T("Failed to find item.") ); - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - return item->SetPos(pos); -} - - - -wxGBSpan wxGridBagSizer::GetItemSpan(wxWindow *window) -{ - wxGBSpan badspan(-1,-1); - wxGBSizerItem* item = FindItem(window); - wxCHECK_MSG( item, badspan, _T("Failed to find item.") ); - return item->GetSpan(); -} - - -wxGBSpan wxGridBagSizer::GetItemSpan(wxSizer *sizer) -{ - wxGBSpan badspan(-1,-1); - wxGBSizerItem* item = FindItem(sizer); - wxCHECK_MSG( item, badspan, _T("Failed to find item.") ); - return item->GetSpan(); -} - - -wxGBSpan wxGridBagSizer::GetItemSpan(size_t index) -{ - wxGBSpan badspan(-1,-1); - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - wxCHECK_MSG( node, badspan, _T("Failed to find item.") ); - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - return item->GetSpan(); -} - - - -bool wxGridBagSizer::SetItemSpan(wxWindow *window, const wxGBSpan& span) -{ - wxGBSizerItem* item = FindItem(window); - wxCHECK_MSG(item, false, wxT("Failed to find item.")); - return item->SetSpan(span); -} - - -bool wxGridBagSizer::SetItemSpan(wxSizer *sizer, const wxGBSpan& span) -{ - wxGBSizerItem* item = FindItem(sizer); - wxCHECK_MSG(item, false, wxT("Failed to find item.")); - return item->SetSpan(span); -} - - -bool wxGridBagSizer::SetItemSpan(size_t index, const wxGBSpan& span) -{ - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - wxCHECK_MSG( node, false, _T("Failed to find item.") ); - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - return item->SetSpan(span); -} - - - - -wxGBSizerItem* wxGridBagSizer::FindItem(wxWindow* window) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - if ( item->GetWindow() == window ) - return item; - node = node->GetNext(); - } - return NULL; -} - - -wxGBSizerItem* wxGridBagSizer::FindItem(wxSizer* sizer) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - if ( item->GetSizer() == sizer ) - return item; - node = node->GetNext(); - } - return NULL; -} - - - - -wxGBSizerItem* wxGridBagSizer::FindItemAtPosition(const wxGBPosition& pos) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - if ( item->Intersects(pos, wxDefaultSpan) ) - return item; - node = node->GetNext(); - } - return NULL; -} - - - - -wxGBSizerItem* wxGridBagSizer::FindItemAtPoint(const wxPoint& pt) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - wxRect rect(item->GetPosition(), item->GetSize()); - rect.Inflate(m_hgap, m_vgap); - if ( rect.Contains(pt) ) - return item; - node = node->GetNext(); - } - return NULL; -} - - - - -wxGBSizerItem* wxGridBagSizer::FindItemWithData(const wxObject* userData) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - if ( item->GetUserData() == userData ) - return item; - node = node->GetNext(); - } - return NULL; -} - - - - -//--------------------------------------------------------------------------- - -// Figure out what all the min row heights and col widths are, and calculate -// min size from that. -wxSize wxGridBagSizer::CalcMin() -{ - int idx; - - if (m_children.GetCount() == 0) - return m_emptyCellSize; - - m_rowHeights.Empty(); - m_colWidths.Empty(); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - if ( item->ShouldAccountFor() ) - { - int row, col, endrow, endcol; - - item->GetPos(row, col); - item->GetEndPos(endrow, endcol); - - // fill heights and widths upto this item if needed - while ( m_rowHeights.GetCount() <= (size_t)endrow ) - m_rowHeights.Add(m_emptyCellSize.GetHeight()); - while ( m_colWidths.GetCount() <= (size_t)endcol ) - m_colWidths.Add(m_emptyCellSize.GetWidth()); - - // See if this item increases the size of its row(s) or col(s) - wxSize size(item->CalcMin()); - for (idx=row; idx <= endrow; idx++) - m_rowHeights[idx] = wxMax(m_rowHeights[idx], size.GetHeight() / (endrow-row+1)); - for (idx=col; idx <= endcol; idx++) - m_colWidths[idx] = wxMax(m_colWidths[idx], size.GetWidth() / (endcol-col+1)); - } - node = node->GetNext(); - } - - AdjustForOverflow(); - AdjustForFlexDirection(); - - // Now traverse the heights and widths arrays calcing the totals, including gaps - int width = 0; - m_cols = m_colWidths.GetCount(); - for (idx=0; idx < m_cols; idx++) - width += m_colWidths[idx] + ( idx == m_cols-1 ? 0 : m_hgap ); - - int height = 0; - m_rows = m_rowHeights.GetCount(); - for (idx=0; idx < m_rows; idx++) - height += m_rowHeights[idx] + ( idx == m_rows-1 ? 0 : m_vgap ); - - m_calculatedMinSize = wxSize(width, height); - return m_calculatedMinSize; -} - - - -void wxGridBagSizer::RecalcSizes() -{ - if (m_children.GetCount() == 0) - return; - - wxPoint pt( GetPosition() ); - wxSize sz( GetSize() ); - - m_rows = m_rowHeights.GetCount(); - m_cols = m_colWidths.GetCount(); - int idx, width, height; - - AdjustForGrowables(sz, m_calculatedMinSize, m_rows, m_cols); - - // Find the start positions on the window of the rows and columns - wxArrayInt rowpos; - rowpos.Add(0, m_rows); - int y = pt.y; - for (idx=0; idx < m_rows; idx++) - { - height = m_rowHeights[idx] + m_vgap; - rowpos[idx] = y; - y += height; - } - - wxArrayInt colpos; - colpos.Add(0, m_cols); - int x = pt.x; - for (idx=0; idx < m_cols; idx++) - { - width = m_colWidths[idx] + m_hgap; - colpos[idx] = x; - x += width; - } - - - // Now iterate the children, setting each child's dimensions - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - int row, col, endrow, endcol; - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - - if ( item->ShouldAccountFor() ) - { - item->GetPos(row, col); - item->GetEndPos(endrow, endcol); - - height = 0; - for(idx=row; idx <= endrow; idx++) - height += m_rowHeights[idx]; - height += (endrow - row) * m_vgap; // add a vgap for every row spanned - - width = 0; - for (idx=col; idx <= endcol; idx++) - width += m_colWidths[idx]; - width += (endcol - col) * m_hgap; // add a hgap for every col spanned - - SetItemBounds(item, colpos[col], rowpos[row], width, height); - } - - node = node->GetNext(); - } -} - - -// Sometimes CalcMin can result in some rows or cols having too much space in -// them because as it traverses the items it makes some assumptions when -// items span to other cells. But those assumptions can become invalid later -// on when other items are fitted into the same rows or columns that the -// spanning item occupies. This method tries to find those situations and -// fixes them. -void wxGridBagSizer::AdjustForOverflow() -{ - int row, col; - - for (row=0; row<(int)m_rowHeights.GetCount(); row++) - { - int rowExtra=INT_MAX; - int rowHeight = m_rowHeights[row]; - for (col=0; col<(int)m_colWidths.GetCount(); col++) - { - wxGBPosition pos(row,col); - wxGBSizerItem* item = FindItemAtPosition(pos); - if ( !item || !item->ShouldAccountFor() ) - continue; - - int endrow, endcol; - item->GetEndPos(endrow, endcol); - - // If the item starts in this position and doesn't span rows, then - // just look at the whole item height - if ( item->GetPos() == pos && endrow == row ) - { - int itemHeight = item->CalcMin().GetHeight(); - rowExtra = wxMin(rowExtra, rowHeight - itemHeight); - continue; - } - - // Otherwise, only look at spanning items if they end on this row - if ( endrow == row ) - { - // first deduct the portions of the item that are on prior rows - int itemHeight = item->CalcMin().GetHeight(); - for (int r=item->GetPos().GetRow(); rShouldAccountFor() ) - continue; - - int endrow, endcol; - item->GetEndPos(endrow, endcol); - - if ( item->GetPos() == pos && endcol == col ) - { - int itemWidth = item->CalcMin().GetWidth(); - colExtra = wxMin(colExtra, colWidth - itemWidth); - continue; - } - - if ( endcol == col ) - { - int itemWidth = item->CalcMin().GetWidth(); - for (int c=item->GetPos().GetCol(); cGetPos(), item->GetSpan(), excludeItem); -} - -bool wxGridBagSizer::CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); - node = node->GetNext(); - - if ( excludeItem && item == excludeItem ) - continue; - - if ( item->Intersects(pos, span) ) - return true; - - } - return false; -} - - -// Assumes a 10x10 grid, and returns the first empty cell found. This is -// really stupid but it is only used by the Add methods that match the base -// class virtuals, which should normally not be used anyway... -wxGBPosition wxGridBagSizer::FindEmptyCell() -{ - int row, col; - - for (row=0; row<10; row++) - for (col=0; col<10; col++) - { - wxGBPosition pos(row, col); - if ( !CheckForIntersection(pos, wxDefaultSpan) ) - return pos; - } - return wxGBPosition(-1, -1); -} - - -//--------------------------------------------------------------------------- - -// The Add base class virtuals should not be used with this class, but -// we'll try to make them automatically select a location for the item -// anyway. - -wxSizerItem* wxGridBagSizer::Add( wxWindow *window, int, int flag, int border, wxObject* userData ) -{ - return Add(window, FindEmptyCell(), wxDefaultSpan, flag, border, userData); -} - -wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, int, int flag, int border, wxObject* userData ) -{ - return Add(sizer, FindEmptyCell(), wxDefaultSpan, flag, border, userData); -} - -wxSizerItem* wxGridBagSizer::Add( int width, int height, int, int flag, int border, wxObject* userData ) -{ - return Add(width, height, FindEmptyCell(), wxDefaultSpan, flag, border, userData); -} - - - -// The Insert nad Prepend base class virtuals that are not appropriate for -// this class and should not be used. Their implementation in this class -// simply fails. - -wxSizerItem* wxGridBagSizer::Add( wxSizerItem * ) -{ - wxFAIL_MSG(wxT("Invalid Add form called.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Prepend( wxWindow *, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Prepend( wxSizer *, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Prepend( int, int, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Prepend( wxSizerItem * ) -{ - wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - - -wxSizerItem* wxGridBagSizer::Insert( size_t, wxWindow *, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizer *, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Insert( size_t, int, int, int, int, int, wxObject* ) -{ - wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - -wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizerItem * ) -{ - wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return (wxSizerItem*)NULL; -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- diff --git a/Source/3rdParty/wx/src/common/gdicmn.cpp b/Source/3rdParty/wx/src/common/gdicmn.cpp deleted file mode 100644 index 232238853..000000000 --- a/Source/3rdParty/wx/src/common/gdicmn.cpp +++ /dev/null @@ -1,871 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/gdicmn.cpp -// Purpose: Common GDI classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: gdicmn.cpp 50022 2007-11-17 14:24:18Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/pen.h" - #include "wx/brush.h" - #include "wx/palette.h" - #include "wx/icon.h" - #include "wx/cursor.h" - #include "wx/settings.h" - #include "wx/bitmap.h" - #include "wx/colour.h" - #include "wx/font.h" -#endif - - -IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) - - -WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; -WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; -WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; - -WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; - -WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; -WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; -WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; -WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; -WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; -WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; -WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; -#if wxUSE_PALETTE -WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; -#endif - -const wxSize wxDefaultSize(wxDefaultCoord, wxDefaultCoord); -const wxPoint wxDefaultPosition(wxDefaultCoord, wxDefaultCoord); - -#if wxUSE_EXTENDED_RTTI - -// wxPoint - -template<> void wxStringReadValue(const wxString &s , wxPoint &data ) -{ - wxSscanf(s, wxT("%d,%d"), &data.x , &data.y ) ; -} - -template<> void wxStringWriteValue(wxString &s , const wxPoint &data ) -{ - s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ; -} - -wxCUSTOM_TYPE_INFO(wxPoint, wxToStringConverter , wxFromStringConverter) - -template<> void wxStringReadValue(const wxString &s , wxSize &data ) -{ - wxSscanf(s, wxT("%d,%d"), &data.x , &data.y ) ; -} - -template<> void wxStringWriteValue(wxString &s , const wxSize &data ) -{ - s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ; -} - -wxCUSTOM_TYPE_INFO(wxSize, wxToStringConverter , wxFromStringConverter) - -#endif - -wxRect::wxRect(const wxPoint& point1, const wxPoint& point2) -{ - x = point1.x; - y = point1.y; - width = point2.x - point1.x; - height = point2.y - point1.y; - - if (width < 0) - { - width = -width; - x = point2.x; - } - width++; - - if (height < 0) - { - height = -height; - y = point2.y; - } - height++; -} - -bool wxRect::operator==(const wxRect& rect) const -{ - return ((x == rect.x) && - (y == rect.y) && - (width == rect.width) && - (height == rect.height)); -} - -wxRect wxRect::operator+(const wxRect& rect) const -{ - int x1 = wxMin(this->x, rect.x); - int y1 = wxMin(this->y, rect.y); - int y2 = wxMax(y+height, rect.height+rect.y); - int x2 = wxMax(x+width, rect.width+rect.x); - return wxRect(x1, y1, x2-x1, y2-y1); -} - -wxRect& wxRect::Union(const wxRect& rect) -{ - // ignore empty rectangles: union with an empty rectangle shouldn't extend - // this one to (0, 0) - if ( !width || !height ) - { - *this = rect; - } - else if ( rect.width && rect.height ) - { - int x1 = wxMin(x, rect.x); - int y1 = wxMin(y, rect.y); - int y2 = wxMax(y + height, rect.height + rect.y); - int x2 = wxMax(x + width, rect.width + rect.x); - - x = x1; - y = y1; - width = x2 - x1; - height = y2 - y1; - } - //else: we're not empty and rect is empty - - return *this; -} - -wxRect& wxRect::Inflate(wxCoord dx, wxCoord dy) -{ - if (-2*dx>width) - { - // Don't allow deflate to eat more width than we have, - // a well-defined rectangle cannot have negative width. - x+=width/2; - width=0; - } - else - { - // The inflate is valid. - x-=dx; - width+=2*dx; - } - - if (-2*dy>height) - { - // Don't allow deflate to eat more height than we have, - // a well-defined rectangle cannot have negative height. - y+=height/2; - height=0; - } - else - { - // The inflate is valid. - y-=dy; - height+=2*dy; - } - - return *this; -} - -bool wxRect::Contains(int cx, int cy) const -{ - return ( (cx >= x) && (cy >= y) - && ((cy - y) < height) - && ((cx - x) < width) - ); -} - -bool wxRect::Contains(const wxRect& rect) const -{ - return Contains(rect.GetTopLeft()) && Contains(rect.GetBottomRight()); -} - -wxRect& wxRect::Intersect(const wxRect& rect) -{ - int x2 = GetRight(), - y2 = GetBottom(); - - if ( x < rect.x ) - x = rect.x; - if ( y < rect.y ) - y = rect.y; - if ( x2 > rect.GetRight() ) - x2 = rect.GetRight(); - if ( y2 > rect.GetBottom() ) - y2 = rect.GetBottom(); - - width = x2 - x + 1; - height = y2 - y + 1; - - if ( width <= 0 || height <= 0 ) - { - width = - height = 0; - } - - return *this; -} - -bool wxRect::Intersects(const wxRect& rect) const -{ - wxRect r = Intersect(rect); - - // if there is no intersection, both width and height are 0 - return r.width != 0; -} - -// ============================================================================ -// wxColourDatabase -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxColourDatabase ctor/dtor -// ---------------------------------------------------------------------------- - -wxColourDatabase::wxColourDatabase () -{ - // will be created on demand in Initialize() - m_map = NULL; -} - -wxColourDatabase::~wxColourDatabase () -{ - if ( m_map ) - { - WX_CLEAR_HASH_MAP(wxStringToColourHashMap, *m_map); - - delete m_map; - } - -#ifdef __WXPM__ - delete [] m_palTable; -#endif -} - -// Colour database stuff -void wxColourDatabase::Initialize() -{ - if ( m_map ) - { - // already initialized - return; - } - - m_map = new wxStringToColourHashMap; - - static const struct wxColourDesc - { - const wxChar *name; - unsigned char r,g,b; - } - wxColourTable[] = - { - {wxT("AQUAMARINE"),112, 219, 147}, - {wxT("BLACK"),0, 0, 0}, - {wxT("BLUE"), 0, 0, 255}, - {wxT("BLUE VIOLET"), 159, 95, 159}, - {wxT("BROWN"), 165, 42, 42}, - {wxT("CADET BLUE"), 95, 159, 159}, - {wxT("CORAL"), 255, 127, 0}, - {wxT("CORNFLOWER BLUE"), 66, 66, 111}, - {wxT("CYAN"), 0, 255, 255}, - {wxT("DARK GREY"), 47, 47, 47}, // ? - - {wxT("DARK GREEN"), 47, 79, 47}, - {wxT("DARK OLIVE GREEN"), 79, 79, 47}, - {wxT("DARK ORCHID"), 153, 50, 204}, - {wxT("DARK SLATE BLUE"), 107, 35, 142}, - {wxT("DARK SLATE GREY"), 47, 79, 79}, - {wxT("DARK TURQUOISE"), 112, 147, 219}, - {wxT("DIM GREY"), 84, 84, 84}, - {wxT("FIREBRICK"), 142, 35, 35}, - {wxT("FOREST GREEN"), 35, 142, 35}, - {wxT("GOLD"), 204, 127, 50}, - {wxT("GOLDENROD"), 219, 219, 112}, - {wxT("GREY"), 128, 128, 128}, - {wxT("GREEN"), 0, 255, 0}, - {wxT("GREEN YELLOW"), 147, 219, 112}, - {wxT("INDIAN RED"), 79, 47, 47}, - {wxT("KHAKI"), 159, 159, 95}, - {wxT("LIGHT BLUE"), 191, 216, 216}, - {wxT("LIGHT GREY"), 192, 192, 192}, - {wxT("LIGHT STEEL BLUE"), 143, 143, 188}, - {wxT("LIME GREEN"), 50, 204, 50}, - {wxT("LIGHT MAGENTA"), 255, 0, 255}, - {wxT("MAGENTA"), 255, 0, 255}, - {wxT("MAROON"), 142, 35, 107}, - {wxT("MEDIUM AQUAMARINE"), 50, 204, 153}, - {wxT("MEDIUM GREY"), 100, 100, 100}, - {wxT("MEDIUM BLUE"), 50, 50, 204}, - {wxT("MEDIUM FOREST GREEN"), 107, 142, 35}, - {wxT("MEDIUM GOLDENROD"), 234, 234, 173}, - {wxT("MEDIUM ORCHID"), 147, 112, 219}, - {wxT("MEDIUM SEA GREEN"), 66, 111, 66}, - {wxT("MEDIUM SLATE BLUE"), 127, 0, 255}, - {wxT("MEDIUM SPRING GREEN"), 127, 255, 0}, - {wxT("MEDIUM TURQUOISE"), 112, 219, 219}, - {wxT("MEDIUM VIOLET RED"), 219, 112, 147}, - {wxT("MIDNIGHT BLUE"), 47, 47, 79}, - {wxT("NAVY"), 35, 35, 142}, - {wxT("ORANGE"), 204, 50, 50}, - {wxT("ORANGE RED"), 255, 0, 127}, - {wxT("ORCHID"), 219, 112, 219}, - {wxT("PALE GREEN"), 143, 188, 143}, - {wxT("PINK"), 255, 192, 203}, - {wxT("PLUM"), 234, 173, 234}, - {wxT("PURPLE"), 176, 0, 255}, - {wxT("RED"), 255, 0, 0}, - {wxT("SALMON"), 111, 66, 66}, - {wxT("SEA GREEN"), 35, 142, 107}, - {wxT("SIENNA"), 142, 107, 35}, - {wxT("SKY BLUE"), 50, 153, 204}, - {wxT("SLATE BLUE"), 0, 127, 255}, - {wxT("SPRING GREEN"), 0, 255, 127}, - {wxT("STEEL BLUE"), 35, 107, 142}, - {wxT("TAN"), 219, 147, 112}, - {wxT("THISTLE"), 216, 191, 216}, - {wxT("TURQUOISE"), 173, 234, 234}, - {wxT("VIOLET"), 79, 47, 79}, - {wxT("VIOLET RED"), 204, 50, 153}, - {wxT("WHEAT"), 216, 216, 191}, - {wxT("WHITE"), 255, 255, 255}, - {wxT("YELLOW"), 255, 255, 0}, - {wxT("YELLOW GREEN"), 153, 204, 50} - }; - - size_t n; - - for ( n = 0; n < WXSIZEOF(wxColourTable); n++ ) - { - const wxColourDesc& cc = wxColourTable[n]; - (*m_map)[cc.name] = new wxColour(cc.r, cc.g, cc.b); - } - -#ifdef __WXPM__ - m_palTable = new long[n]; - for ( n = 0; n < WXSIZEOF(wxColourTable); n++ ) - { - const wxColourDesc& cc = wxColourTable[n]; - m_palTable[n] = OS2RGB(cc.r,cc.g,cc.b); - } - m_nSize = n; -#endif -} - -// ---------------------------------------------------------------------------- -// wxColourDatabase operations -// ---------------------------------------------------------------------------- - -void wxColourDatabase::AddColour(const wxString& name, const wxColour& colour) -{ - Initialize(); - - // canonicalize the colour names before using them as keys: they should be - // in upper case - wxString colName = name; - colName.MakeUpper(); - - // ... and we also allow both grey/gray - wxString colNameAlt = colName; - if ( !colNameAlt.Replace(_T("GRAY"), _T("GREY")) ) - { - // but in this case it is not necessary so avoid extra search below - colNameAlt.clear(); - } - - wxStringToColourHashMap::iterator it = m_map->find(colName); - if ( it == m_map->end() && !colNameAlt.empty() ) - it = m_map->find(colNameAlt); - if ( it != m_map->end() ) - { - *(it->second) = colour; - } - else // new colour - { - (*m_map)[colName] = new wxColour(colour); - } -} - -wxColour wxColourDatabase::Find(const wxString& colour) const -{ - wxColourDatabase * const self = wxConstCast(this, wxColourDatabase); - self->Initialize(); - - // make the comparaison case insensitive and also match both grey and gray - wxString colName = colour; - colName.MakeUpper(); - wxString colNameAlt = colName; - if ( !colNameAlt.Replace(_T("GRAY"), _T("GREY")) ) - colNameAlt.clear(); - - wxStringToColourHashMap::iterator it = m_map->find(colName); - if ( it == m_map->end() && !colNameAlt.empty() ) - it = m_map->find(colNameAlt); - if ( it != m_map->end() ) - return *(it->second); - - // we did not find any result in existing colours: - // we won't use wxString -> wxColour conversion because the - // wxColour::Set(const wxString &) function which does that conversion - // internally uses this function (wxColourDatabase::Find) and we want - // to avoid infinite recursion ! - return wxNullColour; -} - -wxString wxColourDatabase::FindName(const wxColour& colour) const -{ - wxColourDatabase * const self = wxConstCast(this, wxColourDatabase); - self->Initialize(); - - typedef wxStringToColourHashMap::iterator iterator; - - for ( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it ) - { - if ( *(it->second) == colour ) - return it->first; - } - - return wxEmptyString; -} - -// ---------------------------------------------------------------------------- -// deprecated wxColourDatabase methods -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 -wxColour *wxColourDatabase::FindColour(const wxString& name) -{ - // This function is deprecated, use Find() instead. - // Formerly this function sometimes would return a deletable pointer and - // sometimes a non-deletable one (when returning a colour from the database). - // Trying to delete the latter anyway results in problems, so probably - // nobody ever freed the pointers. Currently it always returns a new - // instance, which means there will be memory leaks. - wxLogDebug(wxT("wxColourDataBase::FindColour():") - wxT(" Please use wxColourDataBase::Find() instead")); - - // using a static variable here is not the most elegant solution but unless - // we want to make wxStringToColourHashMap public (i.e. move it to the - // header) so that we could have a member function returning - // wxStringToColourHashMap::iterator, there is really no good way to do it - // otherwise - // - // and knowing that this function is going to disappear in the next release - // anyhow I don't want to waste time on this - - static wxColour s_col; - - s_col = Find(name); - if ( !s_col.Ok() ) - return NULL; - - return new wxColour(s_col); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -// ============================================================================ -// stock objects -// ============================================================================ - -static wxStockGDI gs_wxStockGDI_instance; -wxStockGDI* wxStockGDI::ms_instance = &gs_wxStockGDI_instance; -wxObject* wxStockGDI::ms_stockObject[ITEMCOUNT]; - -wxStockGDI::wxStockGDI() -{ -} - -wxStockGDI::~wxStockGDI() -{ -} - -void wxStockGDI::DeleteAll() -{ - for (unsigned i = 0; i < ITEMCOUNT; i++) - { - delete ms_stockObject[i]; - ms_stockObject[i] = NULL; - } -} - -const wxBrush* wxStockGDI::GetBrush(Item item) -{ - wxBrush* brush = wx_static_cast(wxBrush*, ms_stockObject[item]); - if (brush == NULL) - { - switch (item) - { - case BRUSH_BLACK: - brush = new wxBrush(*GetColour(COLOUR_BLACK), wxSOLID); - break; - case BRUSH_BLUE: - brush = new wxBrush(*GetColour(COLOUR_BLUE), wxSOLID); - break; - case BRUSH_CYAN: - brush = new wxBrush(*GetColour(COLOUR_CYAN), wxSOLID); - break; - case BRUSH_GREEN: - brush = new wxBrush(*GetColour(COLOUR_GREEN), wxSOLID); - break; - case BRUSH_GREY: - brush = new wxBrush(wxColour(wxT("GREY")), wxSOLID); - break; - case BRUSH_LIGHTGREY: - brush = new wxBrush(*GetColour(COLOUR_LIGHTGREY), wxSOLID); - break; - case BRUSH_MEDIUMGREY: - brush = new wxBrush(wxColour(wxT("MEDIUM GREY")), wxSOLID); - break; - case BRUSH_RED: - brush = new wxBrush(*GetColour(COLOUR_RED), wxSOLID); - break; - case BRUSH_TRANSPARENT: - brush = new wxBrush(*GetColour(COLOUR_BLACK), wxTRANSPARENT); - break; - case BRUSH_WHITE: - brush = new wxBrush(*GetColour(COLOUR_WHITE), wxSOLID); - break; - default: - wxFAIL; - } - ms_stockObject[item] = brush; - } - return brush; -} - -const wxColour* wxStockGDI::GetColour(Item item) -{ - wxColour* colour = wx_static_cast(wxColour*, ms_stockObject[item]); - if (colour == NULL) - { - switch (item) - { - case COLOUR_BLACK: - colour = new wxColour(0, 0, 0); - break; - case COLOUR_BLUE: - colour = new wxColour(0, 0, 255); - break; - case COLOUR_CYAN: - colour = new wxColour(wxT("CYAN")); - break; - case COLOUR_GREEN: - colour = new wxColour(0, 255, 0); - break; - case COLOUR_LIGHTGREY: - colour = new wxColour(wxT("LIGHT GREY")); - break; - case COLOUR_RED: - colour = new wxColour(255, 0, 0); - break; - case COLOUR_WHITE: - colour = new wxColour(255, 255, 255); - break; - default: - wxFAIL; - } - ms_stockObject[item] = colour; - } - return colour; -} - -const wxCursor* wxStockGDI::GetCursor(Item item) -{ - wxCursor* cursor = wx_static_cast(wxCursor*, ms_stockObject[item]); - if (cursor == NULL) - { - switch (item) - { - case CURSOR_CROSS: - cursor = new wxCursor(wxCURSOR_CROSS); - break; - case CURSOR_HOURGLASS: - cursor = new wxCursor(wxCURSOR_WAIT); - break; - case CURSOR_STANDARD: - cursor = new wxCursor(wxCURSOR_ARROW); - break; - default: - wxFAIL; - } - ms_stockObject[item] = cursor; - } - return cursor; -} - -const wxFont* wxStockGDI::GetFont(Item item) -{ - wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]); - if (font == NULL) - { - switch (item) - { - case FONT_ITALIC: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxROMAN, wxITALIC, wxNORMAL); - break; - case FONT_NORMAL: - font = new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - break; - case FONT_SMALL: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize() - 2, wxSWISS, wxNORMAL, wxNORMAL); - break; - case FONT_SWISS: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxSWISS, wxNORMAL, wxNORMAL); - break; - default: - wxFAIL; - } - ms_stockObject[item] = font; - } - return font; -} - -const wxPen* wxStockGDI::GetPen(Item item) -{ - wxPen* pen = wx_static_cast(wxPen*, ms_stockObject[item]); - if (pen == NULL) - { - switch (item) - { - case PEN_BLACK: - pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSOLID); - break; - case PEN_BLACKDASHED: - pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSHORT_DASH); - break; - case PEN_CYAN: - pen = new wxPen(*GetColour(COLOUR_CYAN), 1, wxSOLID); - break; - case PEN_GREEN: - pen = new wxPen(*GetColour(COLOUR_GREEN), 1, wxSOLID); - break; - case PEN_GREY: - pen = new wxPen(wxColour(wxT("GREY")), 1, wxSOLID); - break; - case PEN_LIGHTGREY: - pen = new wxPen(*GetColour(COLOUR_LIGHTGREY), 1, wxSOLID); - break; - case PEN_MEDIUMGREY: - pen = new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxSOLID); - break; - case PEN_RED: - pen = new wxPen(*GetColour(COLOUR_RED), 1, wxSOLID); - break; - case PEN_TRANSPARENT: - pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxTRANSPARENT); - break; - case PEN_WHITE: - pen = new wxPen(*GetColour(COLOUR_WHITE), 1, wxSOLID); - break; - default: - wxFAIL; - } - ms_stockObject[item] = pen; - } - return pen; -} - -void wxInitializeStockLists() -{ - wxTheColourDatabase = new wxColourDatabase; - - wxTheBrushList = new wxBrushList; - wxThePenList = new wxPenList; - wxTheFontList = new wxFontList; -} - -void wxDeleteStockLists() -{ - wxDELETE(wxTheBrushList); - wxDELETE(wxThePenList); - wxDELETE(wxTheFontList); -} - -// ============================================================================ -// wxTheXXXList stuff (semi-obsolete) -// ============================================================================ - -wxGDIObjListBase::wxGDIObjListBase() -{ -} - -wxGDIObjListBase::~wxGDIObjListBase() -{ - for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext()) - { - delete wx_static_cast(wxObject*, node->GetData()); - } -} - -wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) -{ - for ( wxList::compatibility_iterator node = list.GetFirst(); - node; - node = node->GetNext() ) - { - wxPen * const pen = (wxPen *) node->GetData(); - if ( pen->GetWidth () == width && - pen->GetStyle () == style && - pen->GetColour() == colour ) - return pen; - } - - wxPen* pen = NULL; - wxPen penTmp(colour, width, style); - if (penTmp.Ok()) - { - pen = new wxPen(penTmp); - list.Append(pen); - } - - return pen; -} - -wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style) -{ - for ( wxList::compatibility_iterator node = list.GetFirst(); - node; - node = node->GetNext() ) - { - wxBrush * const brush = (wxBrush *) node->GetData (); - if ( brush->GetStyle () == style && brush->GetColour() == colour ) - return brush; - } - - wxBrush* brush = NULL; - wxBrush brushTmp(colour, style); - if (brushTmp.Ok()) - { - brush = new wxBrush(brushTmp); - list.Append(brush); - } - - return brush; -} - -wxFont *wxFontList::FindOrCreateFont(int pointSize, - int family, - int style, - int weight, - bool underline, - const wxString& facename, - wxFontEncoding encoding) -{ - wxFont *font; - wxList::compatibility_iterator node; - for (node = list.GetFirst(); node; node = node->GetNext()) - { - font = (wxFont *)node->GetData(); - if ( - font->GetPointSize () == pointSize && - font->GetStyle () == style && - font->GetWeight () == weight && - font->GetUnderlined () == underline ) - { - int fontFamily = font->GetFamily(); - -#if defined(__WXGTK__) - // under GTK the default family is wxSWISS, so looking for a font - // with wxDEFAULT family should return a wxSWISS one instead of - // creating a new one - bool same = (fontFamily == family) || - (fontFamily == wxSWISS && family == wxDEFAULT); -#else // !GTK - // VZ: but why elsewhere do we require an exact match? mystery... - bool same = fontFamily == family; -#endif // GTK/!GTK - - // empty facename matches anything at all: this is bad because - // depending on which fonts are already created, we might get back - // a different font if we create it with empty facename, but it is - // still better than never matching anything in the cache at all - // in this case - if ( same && !facename.empty() ) - { - const wxString& fontFace = font->GetFaceName(); - - // empty facename matches everything - same = !fontFace || fontFace == facename; - } - - if ( same && (encoding != wxFONTENCODING_DEFAULT) ) - { - // have to match the encoding too - same = font->GetEncoding() == encoding; - } - - if ( same ) - { - return font; - } - } - } - - // font not found, create the new one - font = NULL; - wxFont fontTmp(pointSize, family, style, weight, underline, facename, encoding); - if (fontTmp.Ok()) - { - font = new wxFont(fontTmp); - list.Append(font); - } - - return font; -} - -#if WXWIN_COMPATIBILITY_2_6 -void wxBrushList::AddBrush(wxBrush*) { } -void wxBrushList::RemoveBrush(wxBrush*) { } -void wxFontList::AddFont(wxFont*) { } -void wxFontList::RemoveFont(wxFont*) { } -void wxPenList::AddPen(wxPen*) { } -void wxPenList::RemovePen(wxPen*) { } -#endif - -wxSize wxGetDisplaySize() -{ - int x, y; - wxDisplaySize(& x, & y); - return wxSize(x, y); -} - -wxRect wxGetClientDisplayRect() -{ - int x, y, width, height; - wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version - return wxRect(x, y, width, height); -} - -wxSize wxGetDisplaySizeMM() -{ - int x, y; - wxDisplaySizeMM(& x, & y); - return wxSize(x, y); -} - -wxResourceCache::~wxResourceCache () -{ - wxList::compatibility_iterator node = GetFirst (); - while (node) { - wxObject *item = (wxObject *)node->GetData(); - delete item; - - node = node->GetNext (); - } -} diff --git a/Source/3rdParty/wx/src/common/geometry.cpp b/Source/3rdParty/wx/src/common/geometry.cpp deleted file mode 100644 index 362b1aee5..000000000 --- a/Source/3rdParty/wx/src/common/geometry.cpp +++ /dev/null @@ -1,364 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/geometry.cpp -// Purpose: Common Geometry Classes -// Author: Stefan Csomor -// Modified by: -// Created: 08/05/99 -// RCS-ID: -// Copyright: (c) 1999 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_GEOMETRY - -#include "wx/geometry.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" -#endif - -#include - -#include "wx/datstrm.h" - -// -// wxPoint2D -// - -// -// wxRect2D -// - -// wxDouble version - -// for the following calculations always remember -// that the right and bottom edges are not part of a rect - -bool wxRect2DDouble::Intersects( const wxRect2DDouble &rect ) const -{ - wxDouble left,right,bottom,top; - left = wxMax ( m_x , rect.m_x ); - right = wxMin ( m_x+m_width, rect.m_x + rect.m_width ); - top = wxMax ( m_y , rect.m_y ); - bottom = wxMin ( m_y+m_height, rect.m_y + rect.m_height ); - - if ( left < right && top < bottom ) - { - return true; - } - return false; -} - -void wxRect2DDouble::Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ) -{ - wxDouble left,right,bottom,top; - left = wxMax ( src1.m_x , src2.m_x ); - right = wxMin ( src1.m_x+src1.m_width, src2.m_x + src2.m_width ); - top = wxMax ( src1.m_y , src2.m_y ); - bottom = wxMin ( src1.m_y+src1.m_height, src2.m_y + src2.m_height ); - - if ( left < right && top < bottom ) - { - dest->m_x = left; - dest->m_y = top; - dest->m_width = right - left; - dest->m_height = bottom - top; - } - else - { - dest->m_width = dest->m_height = 0; - } -} - -void wxRect2DDouble::Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ) -{ - wxDouble left,right,bottom,top; - - left = wxMin ( src1.m_x , src2.m_x ); - right = wxMax ( src1.m_x+src1.m_width, src2.m_x + src2.m_width ); - top = wxMin ( src1.m_y , src2.m_y ); - bottom = wxMax ( src1.m_y+src1.m_height, src2.m_y + src2.m_height ); - - dest->m_x = left; - dest->m_y = top; - dest->m_width = right - left; - dest->m_height = bottom - top; -} - -void wxRect2DDouble::Union( const wxPoint2DDouble &pt ) -{ - wxDouble x = pt.m_x; - wxDouble y = pt.m_y; - - if ( x < m_x ) - { - SetLeft( x ); - } - else if ( x < m_x + m_width ) - { - // contained - } - else - { - SetRight( x ); - } - - if ( y < m_y ) - { - SetTop( y ); - } - else if ( y < m_y + m_height ) - { - // contained - } - else - { - SetBottom( y ); - } -} - -void wxRect2DDouble::ConstrainTo( const wxRect2DDouble &rect ) -{ - if ( GetLeft() < rect.GetLeft() ) - SetLeft( rect.GetLeft() ); - - if ( GetRight() > rect.GetRight() ) - SetRight( rect.GetRight() ); - - if ( GetBottom() > rect.GetBottom() ) - SetBottom( rect.GetBottom() ); - - if ( GetTop() < rect.GetTop() ) - SetTop( rect.GetTop() ); -} - -wxRect2DDouble& wxRect2DDouble::operator=( const wxRect2DDouble &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; - return *this; -} - -// integer version - -// for the following calculations always remember -// that the right and bottom edges are not part of a rect - -// wxPoint2D - -#if wxUSE_STREAMS -void wxPoint2DInt::WriteTo( wxDataOutputStream &stream ) const -{ - stream.Write32( m_x ); - stream.Write32( m_y ); -} - -void wxPoint2DInt::ReadFrom( wxDataInputStream &stream ) -{ - m_x = stream.Read32(); - m_y = stream.Read32(); -} -#endif // wxUSE_STREAMS - -wxDouble wxPoint2DInt::GetVectorAngle() const -{ - if ( m_x == 0 ) - { - if ( m_y >= 0 ) - return 90; - else - return 270; - } - if ( m_y == 0 ) - { - if ( m_x >= 0 ) - return 0; - else - return 180; - } - - // casts needed for MIPSpro compiler under SGI - wxDouble deg = atan2( (double)m_y , (double)m_x ) * 180 / M_PI; - if ( deg < 0 ) - { - deg += 360; - } - return deg; -} - - -void wxPoint2DInt::SetVectorAngle( wxDouble degrees ) -{ - wxDouble length = GetVectorLength(); - m_x = (int)(length * cos( degrees / 180 * M_PI )); - m_y = (int)(length * sin( degrees / 180 * M_PI )); -} - -wxDouble wxPoint2DDouble::GetVectorAngle() const -{ - if ( wxIsNullDouble(m_x) ) - { - if ( m_y >= 0 ) - return 90; - else - return 270; - } - if ( wxIsNullDouble(m_y) ) - { - if ( m_x >= 0 ) - return 0; - else - return 180; - } - wxDouble deg = atan2( m_y , m_x ) * 180 / M_PI; - if ( deg < 0 ) - { - deg += 360; - } - return deg; -} - -void wxPoint2DDouble::SetVectorAngle( wxDouble degrees ) -{ - wxDouble length = GetVectorLength(); - m_x = length * cos( degrees / 180 * M_PI ); - m_y = length * sin( degrees / 180 * M_PI ); -} - -// wxRect2D - -bool wxRect2DInt::Intersects( const wxRect2DInt &rect ) const -{ - wxInt32 left,right,bottom,top; - left = wxMax ( m_x , rect.m_x ); - right = wxMin ( m_x+m_width, rect.m_x + rect.m_width ); - top = wxMax ( m_y , rect.m_y ); - bottom = wxMin ( m_y+m_height, rect.m_y + rect.m_height ); - - if ( left < right && top < bottom ) - { - return true; - } - return false; -} - -void wxRect2DInt::Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ) -{ - wxInt32 left,right,bottom,top; - left = wxMax ( src1.m_x , src2.m_x ); - right = wxMin ( src1.m_x+src1.m_width, src2.m_x + src2.m_width ); - top = wxMax ( src1.m_y , src2.m_y ); - bottom = wxMin ( src1.m_y+src1.m_height, src2.m_y + src2.m_height ); - - if ( left < right && top < bottom ) - { - dest->m_x = left; - dest->m_y = top; - dest->m_width = right - left; - dest->m_height = bottom - top; - } - else - { - dest->m_width = dest->m_height = 0; - } -} - -void wxRect2DInt::Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ) -{ - wxInt32 left,right,bottom,top; - - left = wxMin ( src1.m_x , src2.m_x ); - right = wxMax ( src1.m_x+src1.m_width, src2.m_x + src2.m_width ); - top = wxMin ( src1.m_y , src2.m_y ); - bottom = wxMax ( src1.m_y+src1.m_height, src2.m_y + src2.m_height ); - - dest->m_x = left; - dest->m_y = top; - dest->m_width = right - left; - dest->m_height = bottom - top; -} - -void wxRect2DInt::Union( const wxPoint2DInt &pt ) -{ - wxInt32 x = pt.m_x; - wxInt32 y = pt.m_y; - - if ( x < m_x ) - { - SetLeft( x ); - } - else if ( x < m_x + m_width ) - { - // contained - } - else - { - SetRight( x ); - } - - if ( y < m_y ) - { - SetTop( y ); - } - else if ( y < m_y + m_height ) - { - // contained - } - else - { - SetBottom( y ); - } -} - -void wxRect2DInt::ConstrainTo( const wxRect2DInt &rect ) -{ - if ( GetLeft() < rect.GetLeft() ) - SetLeft( rect.GetLeft() ); - - if ( GetRight() > rect.GetRight() ) - SetRight( rect.GetRight() ); - - if ( GetBottom() > rect.GetBottom() ) - SetBottom( rect.GetBottom() ); - - if ( GetTop() < rect.GetTop() ) - SetTop( rect.GetTop() ); -} - -wxRect2DInt& wxRect2DInt::operator=( const wxRect2DInt &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; - return *this; -} - -#if wxUSE_STREAMS -void wxRect2DInt::WriteTo( wxDataOutputStream &stream ) const -{ - stream.Write32( m_x ); - stream.Write32( m_y ); - stream.Write32( m_width ); - stream.Write32( m_height ); -} - -void wxRect2DInt::ReadFrom( wxDataInputStream &stream ) -{ - m_x = stream.Read32(); - m_y = stream.Read32(); - m_width = stream.Read32(); - m_height = stream.Read32(); -} -#endif // wxUSE_STREAMS - -#endif // wxUSE_GEOMETRY diff --git a/Source/3rdParty/wx/src/common/gifdecod.cpp b/Source/3rdParty/wx/src/common/gifdecod.cpp deleted file mode 100644 index 1f3c869d5..000000000 --- a/Source/3rdParty/wx/src/common/gifdecod.cpp +++ /dev/null @@ -1,933 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/gifdecod.cpp -// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation -// Author: Guillermo Rodriguez Garcia -// Version: 3.04 -// RCS-ID: $Id: gifdecod.cpp 62183 2009-09-28 09:40:20Z JS $ -// Copyright: (c) Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS && wxUSE_GIF - -#ifndef WX_PRECOMP - #include "wx/palette.h" - #include "wx/log.h" - #include "wx/intl.h" -#endif - -#include -#include -#include "wx/gifdecod.h" - - - -//--------------------------------------------------------------------------- -// GIFImage -//--------------------------------------------------------------------------- - -// internal class for storing GIF image data -class GIFImage -{ -public: - // def ctor - GIFImage(); - - unsigned int w; // width - unsigned int h; // height - unsigned int left; // x coord (in logical screen) - unsigned int top; // y coord (in logical screen) - int transparent; // transparent color index (-1 = none) - wxAnimationDisposal disposal; // disposal method - long delay; // delay in ms (-1 = unused) - unsigned char *p; // bitmap - unsigned char *pal; // palette - unsigned int ncolours; // number of colours - - DECLARE_NO_COPY_CLASS(GIFImage) -}; - - - -//--------------------------------------------------------------------------- -// GIFImage constructor -//--------------------------------------------------------------------------- -GIFImage::GIFImage() -{ - w = 0; - h = 0; - left = 0; - top = 0; - transparent = 0; - disposal = wxANIM_DONOTREMOVE; - delay = -1; - p = (unsigned char *) NULL; - pal = (unsigned char *) NULL; - ncolours = 0; -} - -//--------------------------------------------------------------------------- -// wxGIFDecoder constructor and destructor -//--------------------------------------------------------------------------- - -wxGIFDecoder::wxGIFDecoder() -{ -} - -wxGIFDecoder::~wxGIFDecoder() -{ - Destroy(); -} - -void wxGIFDecoder::Destroy() -{ - wxASSERT(m_nFrames==m_frames.GetCount()); - for (unsigned int i=0; ip); - free(f->pal); - delete f; - } - - m_frames.Clear(); - m_nFrames = 0; -} - - -//--------------------------------------------------------------------------- -// Convert this image to a wxImage object -//--------------------------------------------------------------------------- - -// This function was designed by Vaclav Slavik - -bool wxGIFDecoder::ConvertToImage(unsigned int frame, wxImage *image) const -{ - unsigned char *src, *dst, *pal; - unsigned long i; - int transparent; - - // just in case... - image->Destroy(); - - // create the image - wxSize sz = GetFrameSize(frame); - image->Create(sz.GetWidth(), sz.GetHeight()); - - if (!image->Ok()) - return false; - - pal = GetPalette(frame); - src = GetData(frame); - dst = image->GetData(); - transparent = GetTransparentColourIndex(frame); - - // set transparent colour mask - if (transparent != -1) - { - for (i = 0; i < GetNcolours(frame); i++) - { - if ((pal[3 * i + 0] == 255) && - (pal[3 * i + 1] == 0) && - (pal[3 * i + 2] == 255)) - { - pal[3 * i + 2] = 254; - } - } - - pal[3 * transparent + 0] = 255, - pal[3 * transparent + 1] = 0, - pal[3 * transparent + 2] = 255; - - image->SetMaskColour(255, 0, 255); - } - else - image->SetMask(false); - -#if wxUSE_PALETTE - unsigned char r[256]; - unsigned char g[256]; - unsigned char b[256]; - - for (i = 0; i < 256; i++) - { - r[i] = pal[3*i + 0]; - g[i] = pal[3*i + 1]; - b[i] = pal[3*i + 2]; - } - - image->SetPalette(wxPalette(GetNcolours(frame), r, g, b)); -#endif // wxUSE_PALETTE - - // copy image data - unsigned long npixel = sz.GetWidth() * sz.GetHeight(); - for (i = 0; i < npixel; i++, src++) - { - *(dst++) = pal[3 * (*src) + 0]; - *(dst++) = pal[3 * (*src) + 1]; - *(dst++) = pal[3 * (*src) + 2]; - } - - return true; -} - - -//--------------------------------------------------------------------------- -// Data accessors -//--------------------------------------------------------------------------- - -#define GetFrame(n) ((GIFImage*)m_frames[n]) - - -// Get data for current frame - -wxSize wxGIFDecoder::GetFrameSize(unsigned int frame) const -{ - return wxSize(GetFrame(frame)->w, GetFrame(frame)->h); -} - -wxPoint wxGIFDecoder::GetFramePosition(unsigned int frame) const -{ - return wxPoint(GetFrame(frame)->left, GetFrame(frame)->top); -} - -wxAnimationDisposal wxGIFDecoder::GetDisposalMethod(unsigned int frame) const -{ - return GetFrame(frame)->disposal; -} - -long wxGIFDecoder::GetDelay(unsigned int frame) const -{ - return GetFrame(frame)->delay; -} - -wxColour wxGIFDecoder::GetTransparentColour(unsigned int frame) const -{ - unsigned char *pal = GetFrame(frame)->pal; - int n = GetFrame(frame)->transparent; - if (n == -1) - return wxNullColour; - - return wxColour(pal[n*3 + 0], - pal[n*3 + 1], - pal[n*3 + 2]); -} - -unsigned char* wxGIFDecoder::GetData(unsigned int frame) const { return (GetFrame(frame)->p); } -unsigned char* wxGIFDecoder::GetPalette(unsigned int frame) const { return (GetFrame(frame)->pal); } -unsigned int wxGIFDecoder::GetNcolours(unsigned int frame) const { return (GetFrame(frame)->ncolours); } -int wxGIFDecoder::GetTransparentColourIndex(unsigned int frame) const { return (GetFrame(frame)->transparent); } - - - -//--------------------------------------------------------------------------- -// GIF reading and decoding -//--------------------------------------------------------------------------- - -// getcode: -// Reads the next code from the file stream, with size 'bits' -// -int wxGIFDecoder::getcode(wxInputStream& stream, int bits, int ab_fin) -{ - unsigned int mask; // bit mask - unsigned int code; // code (result) - - // get remaining bits from last byte read - mask = (1 << bits) - 1; - code = (m_lastbyte >> (8 - m_restbits)) & mask; - - // keep reading new bytes while needed - while (bits > m_restbits) - { - // if no bytes left in this block, read the next block - if (m_restbyte == 0) - { - m_restbyte = (unsigned char)stream.GetC(); - - /* Some encoders are a bit broken: instead of issuing - * an end-of-image symbol (ab_fin) they come up with - * a zero-length subblock!! We catch this here so - * that the decoder sees an ab_fin code. - */ - if (m_restbyte == 0) - { - code = ab_fin; - break; - } - - // prefetch data - stream.Read((void *) m_buffer, m_restbyte); - if (stream.LastRead() != m_restbyte) - { - code = ab_fin; - return code; - } - m_bufp = m_buffer; - } - - // read next byte and isolate the bits we need - m_lastbyte = (unsigned char) (*m_bufp++); - mask = (1 << (bits - m_restbits)) - 1; - code = code + ((m_lastbyte & mask) << m_restbits); - m_restbyte--; - - // adjust total number of bits extracted from the buffer - m_restbits = m_restbits + 8; - } - - // find number of bits remaining for next code - m_restbits = (m_restbits - bits); - - return code; -} - - -// dgif: -// GIF decoding function. The initial code size (aka root size) -// is 'bits'. Supports interlaced images (interl == 1). -// Returns wxGIF_OK (== 0) on success, or an error code if something -// fails (see header file for details) -wxGIFErrorCode -wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) -{ - static const int allocSize = 4096 + 1; - int *ab_prefix = new int[allocSize]; // alphabet (prefixes) - if (ab_prefix == NULL) - { - return wxGIF_MEMERR; - } - - int *ab_tail = new int[allocSize]; // alphabet (tails) - if (ab_tail == NULL) - { - delete[] ab_prefix; - return wxGIF_MEMERR; - } - - int *stack = new int[allocSize]; // decompression stack - if (stack == NULL) - { - delete[] ab_prefix; - delete[] ab_tail; - return wxGIF_MEMERR; - } - - int ab_clr; // clear code - int ab_fin; // end of info code - int ab_bits; // actual symbol width, in bits - int ab_free; // first free position in alphabet - int ab_max; // last possible character in alphabet - int pass; // pass number in interlaced images - int pos; // index into decompresion stack - unsigned int x, y; // position in image buffer - - int code, readcode, lastcode, abcabca; - - // these won't change - ab_clr = (1 << bits); - ab_fin = (1 << bits) + 1; - - // these will change through the decompression proccess - ab_bits = bits + 1; - ab_free = (1 << bits) + 2; - ab_max = (1 << ab_bits) - 1; - lastcode = -1; - abcabca = -1; - pass = 1; - pos = x = y = 0; - - // reset decoder vars - m_restbits = 0; - m_restbyte = 0; - m_lastbyte = 0; - - do - { - // get next code - readcode = code = getcode(stream, ab_bits, ab_fin); - - // end of image? - if (code == ab_fin) break; - - // reset alphabet? - if (code == ab_clr) - { - // reset main variables - ab_bits = bits + 1; - ab_free = (1 << bits) + 2; - ab_max = (1 << ab_bits) - 1; - lastcode = -1; - abcabca = -1; - - // skip to next code - continue; - } - - // unknown code: special case (like in ABCABCA) - if (code >= ab_free) - { - code = lastcode; // take last string - stack[pos++] = abcabca; // add first character - } - - // build the string for this code in the stack - while (code > ab_clr) - { - stack[pos++] = ab_tail[code]; - code = ab_prefix[code]; - - // Don't overflow. This shouldn't happen with normal - // GIF files, the allocSize of 4096+1 is enough. This - // will only happen with badly formed GIFs. - if (pos >= allocSize) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; - return wxGIF_INVFORMAT; - } - } - - if (pos >= allocSize) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; - return wxGIF_INVFORMAT; - } - - stack[pos] = code; // push last code into the stack - abcabca = code; // save for special case - - // make new entry in alphabet (only if NOT just cleared) - if (lastcode != -1) - { - // Normally, after the alphabet is full and can't grow any - // further (ab_free == 4096), encoder should (must?) emit CLEAR - // to reset it. This checks whether we really got it, otherwise - // the GIF is damaged. - if (ab_free > ab_max) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; - return wxGIF_INVFORMAT; - } - - // This assert seems unnecessary since the condition above - // eliminates the only case in which it went false. But I really - // don't like being forced to ask "Who in .text could have - // written there?!" And I wouldn't have been forced to ask if - // this line had already been here. - wxASSERT(ab_free < allocSize); - - ab_prefix[ab_free] = lastcode; - ab_tail[ab_free] = code; - ab_free++; - - if ((ab_free > ab_max) && (ab_bits < 12)) - { - ab_bits++; - ab_max = (1 << ab_bits) - 1; - } - } - - // dump stack data to the image buffer - while (pos >= 0) - { - (img->p)[x + (y * (img->w))] = (char) stack[pos]; - pos--; - - if (++x >= (img->w)) - { - x = 0; - - if (interl) - { - // support for interlaced images - switch (pass) - { - case 1: y += 8; break; - case 2: y += 8; break; - case 3: y += 4; break; - case 4: y += 2; break; - } - - /* loop until a valid y coordinate has been - found, Or if the maximum number of passes has - been reached, exit the loop, and stop image - decoding (At this point the image is successfully - decoded). - If we don't loop, but merely set y to some other - value, that new value might still be invalid depending - on the height of the image. This would cause out of - bounds writing. - */ - while (y >= (img->h)) - { - switch (++pass) - { - case 2: y = 4; break; - case 3: y = 2; break; - case 4: y = 1; break; - - default: - /* - It's possible we arrive here. For example this - happens when the image is interlaced, and the - height is 1. Looking at the above cases, the - lowest possible y is 1. While the only valid - one would be 0 for an image of height 1. So - 'eventually' the loop will arrive here. - This case makes sure this while loop is - exited, as well as the 2 other ones. - */ - - // Set y to a valid coordinate so the local - // while loop will be exited. (y = 0 always - // is >= img->h since if img->h == 0 the - // image is never decoded) - y = 0; - - // This will exit the other outer while loop - pos = -1; - - // This will halt image decoding. - code = ab_fin; - - break; - } - } - } - else - { - // non-interlaced - y++; -/* -Normally image decoding is finished when an End of Information code is -encountered (code == ab_fin) however some broken encoders write wrong -"block byte counts" (The first byte value after the "code size" byte), -being one value too high. It might very well be possible other variants -of this problem occur as well. The only sensible solution seems to -be to check for clipping. -Example of wrong encoding: -(1 * 1 B/W image, raster data stream follows in hex bytes) - -02 << B/W images have a code size of 2 -02 << Block byte count -44 << LZW packed -00 << Zero byte count (terminates data stream) - -Because the block byte count is 2, the zero byte count is used in the -decoding process, and decoding is continued after this byte. (While it -should signal an end of image) - -It should be: -02 -02 -44 -01 << When decoded this correctly includes the End of Information code -00 - -Or (Worse solution): -02 -01 -44 -00 -(The 44 doesn't include an End of Information code, but at least the -decoder correctly skips to 00 now after decoding, and signals this -as an End of Information itself) -*/ - if (y >= img->h) - { - code = ab_fin; - break; - } - } - } - } - - pos = 0; - lastcode = readcode; - } - while (code != ab_fin); - - delete [] ab_prefix ; - delete [] ab_tail ; - delete [] stack ; - - return wxGIF_OK; -} - - -// CanRead: -// Returns true if the file looks like a valid GIF, false otherwise. -// -bool wxGIFDecoder::CanRead(wxInputStream &stream) const -{ - unsigned char buf[3]; - - if ( !stream.Read(buf, WXSIZEOF(buf)) ) - return false; - - stream.SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent); - - return memcmp(buf, "GIF", WXSIZEOF(buf)) == 0; -} - - -// LoadGIF: -// Reads and decodes one or more GIF images, depending on whether -// animated GIF support is enabled. Can read GIFs with any bit -// size (color depth), but the output images are always expanded -// to 8 bits per pixel. Also, the image palettes always contain -// 256 colors, although some of them may be unused. Returns wxGIF_OK -// (== 0) on success, or an error code if something fails (see -// header file for details) -// -wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream) -{ - unsigned int global_ncolors = 0; - int bits, interl, i; - wxAnimationDisposal disposal; - long size; - long delay; - unsigned char type = 0; - unsigned char pal[768]; - unsigned char buf[16]; - bool anim = true; - - // check GIF signature - if (!CanRead(stream)) - return wxGIF_INVFORMAT; - - // check for animated GIF support (ver. >= 89a) - - static const unsigned int headerSize = (3 + 3); - stream.Read(buf, headerSize); - if (stream.LastRead() != headerSize) - { - return wxGIF_INVFORMAT; - } - - if (memcmp(buf + 3, "89a", 3) < 0) - { - anim = false; - } - - // read logical screen descriptor block (LSDB) - static const unsigned int lsdbSize = (2 + 2 + 1 + 1 + 1); - stream.Read(buf, lsdbSize); - if (stream.LastRead() != lsdbSize) - { - return wxGIF_INVFORMAT; - } - - m_szAnimation.SetWidth( buf[0] + 256 * buf[1] ); - m_szAnimation.SetHeight( buf[2] + 256 * buf[3] ); - - if (anim && ((m_szAnimation.GetWidth() == 0) || (m_szAnimation.GetHeight() == 0))) - { - return wxGIF_INVFORMAT; - } - - // load global color map if available - if ((buf[4] & 0x80) == 0x80) - { - int backgroundColIndex = buf[5]; - - global_ncolors = 2 << (buf[4] & 0x07); - unsigned int numBytes = 3 * global_ncolors; - stream.Read(pal, numBytes); - if (stream.LastRead() != numBytes) - { - return wxGIF_INVFORMAT; - } - - m_background.Set(pal[backgroundColIndex*3 + 0], - pal[backgroundColIndex*3 + 1], - pal[backgroundColIndex*3 + 2]); - } - - // transparent colour, disposal method and delay default to unused - int transparent = -1; - disposal = wxANIM_UNSPECIFIED; - delay = -1; - - bool done = false; - while (!done) - { - type = (unsigned char)stream.GetC(); - - /* - If the end of file has been reached (or an error) and a ";" - (0x3B) hasn't been encountered yet, exit the loop. (Without this - check the while loop would loop endlessly.) Later on, in the next while - loop, the file will be treated as being truncated (But still - be decoded as far as possible). returning wxGIF_TRUNCATED is not - possible here since some init code is done after this loop. - */ - if (stream.Eof())// || !stream.IsOk()) - { - /* - type is set to some bogus value, so there's no - need to continue evaluating it. - */ - break; // Alternative : "return wxGIF_INVFORMAT;" - } - - // end of data? - if (type == 0x3B) - { - done = true; - } - else - // extension block? - if (type == 0x21) - { - if (((unsigned char)stream.GetC()) == 0xF9) - // graphics control extension, parse it - { - static const unsigned int gceSize = 6; - stream.Read(buf, gceSize); - if (stream.LastRead() != gceSize) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - // read delay and convert from 1/100 of a second to ms - delay = 10 * (buf[2] + 256 * buf[3]); - - // read transparent colour index, if used - transparent = buf[1] & 0x01 ? buf[4] : -1; - - // read disposal method - disposal = (wxAnimationDisposal)(((buf[1] & 0x1C) >> 2) - 1); - } - else - // other extension, skip - { - while ((i = (unsigned char)stream.GetC()) != 0) - { - if (stream.Eof() || (stream.LastRead() == 0)) - { - done = true; - break; - } - stream.SeekI(i, wxFromCurrent); - } - } - } - else - // image descriptor block? - if (type == 0x2C) - { - // allocate memory for IMAGEN struct - GIFImage *pimg = new GIFImage(); - - if (pimg == NULL) - { - Destroy(); - return wxGIF_MEMERR; - } - - // fill in the data - static const unsigned int idbSize = (2 + 2 + 2 + 2 + 1); - stream.Read(buf, idbSize); - if (stream.LastRead() != idbSize) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - pimg->left = buf[0] + 256 * buf[1]; - pimg->top = buf[2] + 256 * buf[3]; -/* - pimg->left = buf[4] + 256 * buf[5]; - pimg->top = buf[4] + 256 * buf[5]; -*/ - pimg->w = buf[4] + 256 * buf[5]; - pimg->h = buf[6] + 256 * buf[7]; - -#if 0 - if (anim && ((pimg->w == 0) || (pimg->w > (unsigned int)m_szAnimation.GetWidth()) || - (pimg->h == 0) || (pimg->h > (unsigned int)m_szAnimation.GetHeight()))) - { - Destroy(); - return wxGIF_INVFORMAT; - } -#endif - if ( anim ) - { - // some GIF images specify incorrect animation size but we can - // still open them if we fix up the animation size, see #9465 - if ( m_nFrames == 0 ) - { - if ( pimg->w > (unsigned)m_szAnimation.x ) - m_szAnimation.x = pimg->w; - if ( pimg->h > (unsigned)m_szAnimation.y ) - m_szAnimation.y = pimg->h; - } - else // subsequent frames - { - // check that we have valid size - if ( (!pimg->w || pimg->w > (unsigned)m_szAnimation.x) || - (!pimg->h || pimg->h > (unsigned)m_szAnimation.y) ) - { - wxLogError(_("Incorrect GIF frame size (%u, %d) for the frame #%u"), - pimg->w, pimg->h, m_nFrames); - Destroy(); - return wxGIF_INVFORMAT; - } - } - } - - interl = ((buf[8] & 0x40)? 1 : 0); - size = pimg->w * pimg->h; - - pimg->transparent = transparent; - pimg->disposal = disposal; - pimg->delay = delay; - - // allocate memory for image and palette - pimg->p = (unsigned char *) malloc((unsigned int)size); - pimg->pal = (unsigned char *) malloc(768); - - if ((!pimg->p) || (!pimg->pal)) - { - Destroy(); - return wxGIF_MEMERR; - } - - // load local color map if available, else use global map - if ((buf[8] & 0x80) == 0x80) - { - unsigned int local_ncolors = 2 << (buf[8] & 0x07); - unsigned int numBytes = 3 * local_ncolors; - stream.Read(pimg->pal, numBytes); - pimg->ncolours = local_ncolors; - if (stream.LastRead() != numBytes) - { - Destroy(); - return wxGIF_INVFORMAT; - } - } - else - { - memcpy(pimg->pal, pal, 768); - pimg->ncolours = global_ncolors; - } - - // get initial code size from first byte in raster data - bits = (unsigned char)stream.GetC(); - if (bits == 0) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - // decode image - wxGIFErrorCode result = dgif(stream, pimg, interl, bits); - if (result != wxGIF_OK) - { - Destroy(); - return result; - } - - // add the image to our frame array - m_frames.Add((void*)pimg); - m_nFrames++; - - // if this is not an animated GIF, exit after first image - if (!anim) - done = true; - } - } - - if (m_nFrames <= 0) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - // try to read to the end of the stream - while (type != 0x3B) - { - if (!stream.IsOk()) - return wxGIF_TRUNCATED; - - type = (unsigned char)stream.GetC(); - - if (type == 0x21) - { - // extension type - (void) stream.GetC(); - - // skip all data - while ((i = (unsigned char)stream.GetC()) != 0) - { - if (stream.Eof() || (stream.LastRead() == 0)) - { - Destroy(); - return wxGIF_INVFORMAT; - } - stream.SeekI(i, wxFromCurrent); - } - } - else if (type == 0x2C) - { - // image descriptor block - static const unsigned int idbSize = (2 + 2 + 2 + 2 + 1); - stream.Read(buf, idbSize); - if (stream.LastRead() != idbSize) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - // local color map - if ((buf[8] & 0x80) == 0x80) - { - unsigned int local_ncolors = 2 << (buf[8] & 0x07); - wxFileOffset numBytes = 3 * local_ncolors; - stream.SeekI(numBytes, wxFromCurrent); - } - - // initial code size - (void) stream.GetC(); - if (stream.Eof() || (stream.LastRead() == 0)) - { - Destroy(); - return wxGIF_INVFORMAT; - } - - // skip all data - while ((i = (unsigned char)stream.GetC()) != 0) - { - if (stream.Eof() || (stream.LastRead() == 0)) - { - Destroy(); - return wxGIF_INVFORMAT; - } - stream.SeekI(i, wxFromCurrent); - } - } - else if ((type != 0x3B) && (type != 00)) // testing - { - // images are OK, but couldn't read to the end of the stream - return wxGIF_TRUNCATED; - } - } - - return wxGIF_OK; -} - -#endif // wxUSE_STREAMS && wxUSE_GIF diff --git a/Source/3rdParty/wx/src/common/graphcmn.cpp b/Source/3rdParty/wx/src/common/graphcmn.cpp deleted file mode 100644 index 70f1a3416..000000000 --- a/Source/3rdParty/wx/src/common/graphcmn.cpp +++ /dev/null @@ -1,776 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/graphcmn.cpp -// Purpose: graphics context methods common to all platforms -// Author: Stefan Csomor -// Modified by: -// Created: -// RCS-ID: $Id: graphcmn.cpp 56801 2008-11-16 23:25:09Z KO $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/graphics.h" - -#ifndef WX_PRECOMP - #include "wx/icon.h" - #include "wx/bitmap.h" - #include "wx/dcmemory.h" - #include "wx/region.h" - #include "wx/log.h" -#endif - -#if !defined(wxMAC_USE_CORE_GRAPHICS_BLEND_MODES) -#define wxMAC_USE_CORE_GRAPHICS_BLEND_MODES 0 -#endif - -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -static const double RAD2DEG = 180.0 / M_PI; - -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double DegToRad(double deg) -{ - return (deg * M_PI) / 180.0; -} - -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// wxGraphicsObject -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsObject, wxObject) - -wxGraphicsObjectRefData::wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ) -{ - m_renderer = renderer; -} -wxGraphicsObjectRefData::wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ) -{ - m_renderer = data->m_renderer; -} -wxGraphicsRenderer* wxGraphicsObjectRefData::GetRenderer() const -{ - return m_renderer ; -} - -wxGraphicsObjectRefData* wxGraphicsObjectRefData::Clone() const -{ - return new wxGraphicsObjectRefData(this); -} - -wxGraphicsObject::wxGraphicsObject() -{ -} - -wxGraphicsObject::wxGraphicsObject( wxGraphicsRenderer* renderer ) -{ - SetRefData( new wxGraphicsObjectRefData(renderer)); -} - -wxGraphicsObject::~wxGraphicsObject() -{ -} - -bool wxGraphicsObject::IsNull() const -{ - return m_refData == NULL; -} - -wxGraphicsRenderer* wxGraphicsObject::GetRenderer() const -{ - return ( IsNull() ? NULL : GetGraphicsData()->GetRenderer() ); -} - -wxGraphicsObjectRefData* wxGraphicsObject::GetGraphicsData() const -{ - return (wxGraphicsObjectRefData*) m_refData; -} - -wxObjectRefData* wxGraphicsObject::CreateRefData() const -{ - wxLogDebug(wxT("A Null Object cannot be changed")); - return NULL; -} - -wxObjectRefData* wxGraphicsObject::CloneRefData(const wxObjectRefData* data) const -{ - const wxGraphicsObjectRefData* ptr = (const wxGraphicsObjectRefData*) data; - return ptr->Clone(); -} - -//----------------------------------------------------------------------------- -// pens etc. -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPen, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBrush, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsFont, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBitmap, wxGraphicsObject) - -WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; -WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; -WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; -WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; - -//----------------------------------------------------------------------------- -// matrix -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsMatrix, wxGraphicsObject) -WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix; - -// concatenates the matrix -void wxGraphicsMatrix::Concat( const wxGraphicsMatrix *t ) -{ - AllocExclusive(); - GetMatrixData()->Concat(t->GetMatrixData()); -} - -// sets the matrix to the respective values -void wxGraphicsMatrix::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, - wxDouble tx, wxDouble ty) -{ - AllocExclusive(); - GetMatrixData()->Set(a,b,c,d,tx,ty); -} - -// gets the component valuess of the matrix -void wxGraphicsMatrix::Get(wxDouble* a, wxDouble* b, wxDouble* c, - wxDouble* d, wxDouble* tx, wxDouble* ty) const -{ - GetMatrixData()->Get(a, b, c, d, tx, ty); -} - -// makes this the inverse matrix -void wxGraphicsMatrix::Invert() -{ - AllocExclusive(); - GetMatrixData()->Invert(); -} - -// returns true if the elements of the transformation matrix are equal ? -bool wxGraphicsMatrix::IsEqual( const wxGraphicsMatrix* t) const -{ - return GetMatrixData()->IsEqual(t->GetMatrixData()); -} - -// return true if this is the identity matrix -bool wxGraphicsMatrix::IsIdentity() const -{ - return GetMatrixData()->IsIdentity(); -} - -// add the translation to this matrix -void wxGraphicsMatrix::Translate( wxDouble dx , wxDouble dy ) -{ - AllocExclusive(); - GetMatrixData()->Translate(dx,dy); -} - -// add the scale to this matrix -void wxGraphicsMatrix::Scale( wxDouble xScale , wxDouble yScale ) -{ - AllocExclusive(); - GetMatrixData()->Scale(xScale,yScale); -} - -// add the rotation to this matrix (radians) -void wxGraphicsMatrix::Rotate( wxDouble angle ) -{ - AllocExclusive(); - GetMatrixData()->Rotate(angle); -} - -// -// apply the transforms -// - -// applies that matrix to the point -void wxGraphicsMatrix::TransformPoint( wxDouble *x, wxDouble *y ) const -{ - GetMatrixData()->TransformPoint(x,y); -} - -// applies the matrix except for translations -void wxGraphicsMatrix::TransformDistance( wxDouble *dx, wxDouble *dy ) const -{ - GetMatrixData()->TransformDistance(dx,dy); -} - -// returns the native representation -void * wxGraphicsMatrix::GetNativeMatrix() const -{ - return GetMatrixData()->GetNativeMatrix(); -} - -//----------------------------------------------------------------------------- -// path -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPath, wxGraphicsObject) -WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; - -// convenience functions, for using wxPoint2DDouble etc - -wxPoint2DDouble wxGraphicsPath::GetCurrentPoint() const -{ - wxDouble x,y; - GetCurrentPoint(&x,&y); - return wxPoint2DDouble(x,y); -} - -void wxGraphicsPath::MoveToPoint( const wxPoint2DDouble& p) -{ - MoveToPoint( p.m_x , p.m_y); -} - -void wxGraphicsPath::AddLineToPoint( const wxPoint2DDouble& p) -{ - AddLineToPoint( p.m_x , p.m_y); -} - -void wxGraphicsPath::AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e) -{ - AddCurveToPoint(c1.m_x, c1.m_y, c2.m_x, c2.m_y, e.m_x, e.m_y); -} - -void wxGraphicsPath::AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise) -{ - AddArc(c.m_x, c.m_y, r, startAngle, endAngle, clockwise); -} - -wxRect2DDouble wxGraphicsPath::GetBox() const -{ - wxDouble x,y,w,h; - GetBox(&x,&y,&w,&h); - return wxRect2DDouble( x,y,w,h ); -} - -bool wxGraphicsPath::Contains( const wxPoint2DDouble& c, int fillStyle ) const -{ - return Contains( c.m_x, c.m_y, fillStyle); -} - -// true redirections - -// begins a new subpath at (x,y) -void wxGraphicsPath::MoveToPoint( wxDouble x, wxDouble y ) -{ - AllocExclusive(); - GetPathData()->MoveToPoint(x,y); -} - -// adds a straight line from the current point to (x,y) -void wxGraphicsPath::AddLineToPoint( wxDouble x, wxDouble y ) -{ - AllocExclusive(); - GetPathData()->AddLineToPoint(x,y); -} - -// adds a cubic Bezier curve from the current point, using two control points and an end point -void wxGraphicsPath::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) -{ - AllocExclusive(); - GetPathData()->AddCurveToPoint(cx1,cy1,cx2,cy2,x,y); -} - -// adds another path -void wxGraphicsPath::AddPath( const wxGraphicsPath& path ) -{ - AllocExclusive(); - GetPathData()->AddPath(path.GetPathData()); -} - -// closes the current sub-path -void wxGraphicsPath::CloseSubpath() -{ - AllocExclusive(); - GetPathData()->CloseSubpath(); -} - -// gets the last point of the current path, (0,0) if not yet set -void wxGraphicsPath::GetCurrentPoint( wxDouble* x, wxDouble* y) const -{ - GetPathData()->GetCurrentPoint(x,y); -} - -// adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle -void wxGraphicsPath::AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) -{ - AllocExclusive(); - GetPathData()->AddArc(x,y,r,startAngle,endAngle,clockwise); -} - -// -// These are convenience functions which - if not available natively will be assembled -// using the primitives from above -// - -// adds a quadratic Bezier curve from the current point, using a control point and an end point -void wxGraphicsPath::AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ) -{ - AllocExclusive(); - GetPathData()->AddQuadCurveToPoint(cx,cy,x,y); -} - -// appends a rectangle as a new closed subpath -void wxGraphicsPath::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - AllocExclusive(); - GetPathData()->AddRectangle(x,y,w,h); -} - -// appends an ellipsis as a new closed subpath fitting the passed rectangle -void wxGraphicsPath::AddCircle( wxDouble x, wxDouble y, wxDouble r ) -{ - AllocExclusive(); - GetPathData()->AddCircle(x,y,r); -} - -// appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) -void wxGraphicsPath::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) -{ - GetPathData()->AddArcToPoint(x1,y1,x2,y2,r); -} - -// appends an ellipse -void wxGraphicsPath::AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h) -{ - AllocExclusive(); - GetPathData()->AddEllipse(x,y,w,h); -} - -// appends a rounded rectangle -void wxGraphicsPath::AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius) -{ - AllocExclusive(); - GetPathData()->AddRoundedRectangle(x,y,w,h,radius); -} - -// returns the native path -void * wxGraphicsPath::GetNativePath() const -{ - return GetPathData()->GetNativePath(); -} - -// give the native path returned by GetNativePath() back (there might be some deallocations necessary) -void wxGraphicsPath::UnGetNativePath(void *p)const -{ - GetPathData()->UnGetNativePath(p); -} - -// transforms each point of this path by the matrix -void wxGraphicsPath::Transform( const wxGraphicsMatrix& matrix ) -{ - AllocExclusive(); - GetPathData()->Transform(matrix.GetMatrixData()); -} - -// gets the bounding box enclosing all points (possibly including control points) -void wxGraphicsPath::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const -{ - GetPathData()->GetBox(x,y,w,h); -} - -bool wxGraphicsPath::Contains( wxDouble x, wxDouble y, int fillStyle ) const -{ - return GetPathData()->Contains(x,y,fillStyle); -} - -// -// Emulations, these mus be implemented in the ...Data classes in order to allow for proper overrides -// - -void wxGraphicsPathData::AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ) -{ - // calculate using degree elevation to a cubic bezier - wxPoint2DDouble c1; - wxPoint2DDouble c2; - - wxPoint2DDouble start; - GetCurrentPoint(&start.m_x,&start.m_y); - wxPoint2DDouble end(x,y); - wxPoint2DDouble c(cx,cy); - c1 = wxDouble(1/3.0) * start + wxDouble(2/3.0) * c; - c2 = wxDouble(2/3.0) * c + wxDouble(1/3.0) * end; - AddCurveToPoint(c1.m_x,c1.m_y,c2.m_x,c2.m_y,x,y); -} - -void wxGraphicsPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - MoveToPoint(x,y); - AddLineToPoint(x,y+h); - AddLineToPoint(x+w,y+h); - AddLineToPoint(x+w,y); - CloseSubpath(); -} - -void wxGraphicsPathData::AddCircle( wxDouble x, wxDouble y, wxDouble r ) -{ - MoveToPoint(x+r,y); - AddArc( x,y,r,0,2*M_PI,false); - CloseSubpath(); -} - -void wxGraphicsPathData::AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h) -{ - wxDouble rw = w/2; - wxDouble rh = h/2; - wxDouble xc = x + rw; - wxDouble yc = y + rh; - wxGraphicsMatrix m = GetRenderer()->CreateMatrix(); - m.Translate(xc,yc); - m.Scale(rw/rh,1.0); - wxGraphicsPath p = GetRenderer()->CreatePath(); - p.AddCircle(0,0,rh); - p.Transform(m); - AddPath(p.GetPathData()); -} - -void wxGraphicsPathData::AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius) -{ - if ( radius == 0 ) - AddRectangle(x,y,w,h); - else - { - MoveToPoint( x + w, y + h / 2); - AddArcToPoint(x + w, y + h, x + w / 2, y + h, radius); - AddArcToPoint(x, y + h, x, y + h / 2, radius); - AddArcToPoint(x, y , x + w / 2, y, radius); - AddArcToPoint(x + w, y, x + w, y + h / 2, radius); - CloseSubpath(); - } -} - -// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) -void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) -{ - wxPoint2DDouble current; - GetCurrentPoint(¤t.m_x,¤t.m_y); - wxPoint2DDouble p1(x1,y1); - wxPoint2DDouble p2(x2,y2); - - wxPoint2DDouble v1 = current - p1; - v1.Normalize(); - wxPoint2DDouble v2 = p2 - p1; - v2.Normalize(); - - wxDouble alpha = v1.GetVectorAngle() - v2.GetVectorAngle(); - - if ( alpha < 0 ) - alpha = 360 + alpha; - // TODO obtuse angles - - alpha = DegToRad(alpha); - - wxDouble dist = r / sin(alpha/2) * cos(alpha/2); - // calculate tangential points - wxPoint2DDouble t1 = dist*v1 + p1; - wxPoint2DDouble t2 = dist*v2 + p1; - - wxPoint2DDouble nv1 = v1; - nv1.SetVectorAngle(v1.GetVectorAngle()-90); - wxPoint2DDouble c = t1 + r*nv1; - - wxDouble a1 = v1.GetVectorAngle()+90; - wxDouble a2 = v2.GetVectorAngle()-90; - - AddLineToPoint(t1.m_x,t1.m_y); - AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true); - AddLineToPoint(p2.m_x,p2.m_y); -} - -//----------------------------------------------------------------------------- -// wxGraphicsContext Convenience Methods -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject) - - -wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer) -{ - m_logicalFunction = wxCOPY; -} - -wxGraphicsContext::~wxGraphicsContext() -{ -} - -// sets the pen -void wxGraphicsContext::SetPen( const wxGraphicsPen& pen ) -{ - m_pen = pen; -} - -void wxGraphicsContext::SetPen( const wxPen& pen ) -{ - if ( !pen.Ok() || pen.GetStyle() == wxTRANSPARENT ) - SetPen( wxNullGraphicsPen ); - else - SetPen( CreatePen( pen ) ); -} - -// sets the brush for filling -void wxGraphicsContext::SetBrush( const wxGraphicsBrush& brush ) -{ - m_brush = brush; -} - -void wxGraphicsContext::SetBrush( const wxBrush& brush ) -{ - if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT ) - SetBrush( wxNullGraphicsBrush ); - else - SetBrush( CreateBrush( brush ) ); -} - -// sets the brush for filling -void wxGraphicsContext::SetFont( const wxGraphicsFont& font ) -{ - m_font = font; -} - -bool wxGraphicsContext::SetLogicalFunction( int function ) -{ - if ( function == wxCOPY ) - { - m_logicalFunction = function; - return true; - } - return false; -} - -void wxGraphicsContext::SetFont( const wxFont& font, const wxColour& colour ) -{ - if ( font.Ok() ) - SetFont( CreateFont( font, colour ) ); - else - SetFont( wxNullGraphicsFont ); -} - -void wxGraphicsContext::DrawPath( const wxGraphicsPath& path, int fillStyle ) -{ - FillPath( path , fillStyle ); - StrokePath( path ); -} - -void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) -{ - Translate(x,y); - Rotate( -angle ); - DrawText( str , 0, 0 ); - Rotate( angle ); - Translate(-x,-y); -} - -void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) -{ - wxGraphicsBrush formerBrush = m_brush; - wxGraphicsPen formerPen = m_pen; - wxDouble width; - wxDouble height; - wxDouble descent; - wxDouble externalLeading; - GetTextExtent( str , &width, &height, &descent, &externalLeading ); - SetBrush( backgroundBrush ); - // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape - SetPen( wxNullGraphicsPen ); - - wxGraphicsPath path = CreatePath(); - path.AddRectangle( x , y, width, height ); - FillPath( path ); - - DrawText( str, x ,y); - SetBrush( formerBrush ); - SetPen( formerPen ); -} - -void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ) -{ - wxGraphicsBrush formerBrush = m_brush; - wxGraphicsPen formerPen = m_pen; - - wxDouble width; - wxDouble height; - wxDouble descent; - wxDouble externalLeading; - GetTextExtent( str , &width, &height, &descent, &externalLeading ); - SetBrush( backgroundBrush ); - // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape - SetPen( wxNullGraphicsPen ); - - wxGraphicsPath path = CreatePath(); - path.MoveToPoint( x , y ); - path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) ); - path.AddLineToPoint( - (int) (x + sin(angle) * height + cos(angle) * width) , - (int) (y + cos(angle) * height - sin(angle) * width)); - path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) ); - FillPath( path ); - DrawText( str, x ,y, angle); - SetBrush( formerBrush ); - SetPen( formerPen ); -} - -void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2) -{ - wxGraphicsPath path = CreatePath(); - path.MoveToPoint(x1, y1); - path.AddLineToPoint( x2, y2 ); - StrokePath( path ); -} - -void wxGraphicsContext::DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h) -{ - wxGraphicsPath path = CreatePath(); - path.AddRectangle( x , y , w , h ); - DrawPath( path ); -} - -void wxGraphicsContext::DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h) -{ - wxGraphicsPath path = CreatePath(); - path.AddEllipse(x,y,w,h); - DrawPath(path); -} - -void wxGraphicsContext::DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius) -{ - wxGraphicsPath path = CreatePath(); - path.AddRoundedRectangle(x,y,w,h,radius); - DrawPath(path); -} - -void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *points) -{ - wxASSERT(n > 1); - wxGraphicsPath path = CreatePath(); - path.MoveToPoint(points[0].m_x, points[0].m_y); - for ( size_t i = 1; i < n; ++i) - path.AddLineToPoint( points[i].m_x, points[i].m_y ); - StrokePath( path ); -} - -void wxGraphicsContext::DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle) -{ - wxASSERT(n > 1); - wxGraphicsPath path = CreatePath(); - path.MoveToPoint(points[0].m_x, points[0].m_y); - for ( size_t i = 1; i < n; ++i) - path.AddLineToPoint( points[i].m_x, points[i].m_y ); - DrawPath( path , fillStyle); -} - -void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints) -{ - wxASSERT(n > 0); - wxGraphicsPath path = CreatePath(); - for ( size_t i = 0; i < n; ++i) - { - path.MoveToPoint(beginPoints[i].m_x, beginPoints[i].m_y); - path.AddLineToPoint( endPoints[i].m_x, endPoints[i].m_y ); - } - StrokePath( path ); -} - -// create a 'native' matrix corresponding to these values -wxGraphicsMatrix wxGraphicsContext::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d, - wxDouble tx, wxDouble ty) const -{ - return GetRenderer()->CreateMatrix(a,b,c,d,tx,ty); -} - -wxGraphicsPath wxGraphicsContext::CreatePath() const -{ - return GetRenderer()->CreatePath(); -} - -wxGraphicsPen wxGraphicsContext::CreatePen(const wxPen& pen) const -{ - return GetRenderer()->CreatePen(pen); -} - -wxGraphicsBrush wxGraphicsContext::CreateBrush(const wxBrush& brush ) const -{ - return GetRenderer()->CreateBrush(brush); -} - -// sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 -wxGraphicsBrush wxGraphicsContext::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) const -{ - return GetRenderer()->CreateLinearGradientBrush(x1,y1,x2,y2,c1,c2); -} - -// sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) -// with radius r and color cColor -wxGraphicsBrush wxGraphicsContext::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) const -{ - return GetRenderer()->CreateRadialGradientBrush(xo,yo,xc,yc,radius,oColor,cColor); -} - -// sets the font -wxGraphicsFont wxGraphicsContext::CreateFont( const wxFont &font , const wxColour &col ) const -{ - return GetRenderer()->CreateFont(font,col); -} - -wxGraphicsBitmap wxGraphicsContext::CreateBitmap( const wxBitmap& bmp ) const -{ - return GetRenderer()->CreateBitmap(bmp); -} - -wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC& dc) -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); -} -#ifdef __WXMSW__ -wxGraphicsContext* wxGraphicsContext::Create( const wxMemoryDC& dc) -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); -} -#endif - -wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context ) -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context); -} - -wxGraphicsContext* wxGraphicsContext::CreateFromNativeWindow( void * window ) -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeWindow(window); -} - -wxGraphicsContext* wxGraphicsContext::Create( wxWindow* window ) -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(window); -} - -wxGraphicsContext* wxGraphicsContext::Create() -{ - return wxGraphicsRenderer::GetDefaultRenderer()->CreateMeasuringContext(); -} - -//----------------------------------------------------------------------------- -// wxGraphicsRenderer -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxGraphicsRenderer, wxObject) - -#endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Source/3rdParty/wx/src/common/hash.cpp b/Source/3rdParty/wx/src/common/hash.cpp deleted file mode 100644 index 9969bb188..000000000 --- a/Source/3rdParty/wx/src/common/hash.cpp +++ /dev/null @@ -1,1077 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/hash.cpp -// Purpose: wxHashTable implementation -// Author: Julian Smart -// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() -// Created: 01/02/97 -// RCS-ID: $Id: hash.cpp 49529 2007-10-30 00:32:18Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/list.h" - #include "wx/hash.h" -#endif - -#if wxUSE_OLD_HASH_TABLE - -#include -#include - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxHashTablleBase for working with "void *" data -// ---------------------------------------------------------------------------- - -wxHashTableBase::wxHashTableBase() -{ - m_deleteContents = false; - m_hashTable = (wxListBase **)NULL; - m_hashSize = 0; - m_count = 0; - m_keyType = wxKEY_NONE; -} - -void wxHashTableBase::Create(wxKeyType keyType, size_t size) -{ - Destroy(); - - m_hashSize = size; - m_keyType = keyType; - m_hashTable = new wxListBase *[size]; - for ( size_t n = 0; n < m_hashSize; n++ ) - { - m_hashTable[n] = (wxListBase *) NULL; - } -} - -void wxHashTableBase::Destroy() -{ - if ( m_hashTable ) - { - for ( size_t n = 0; n < m_hashSize; n++ ) - { - delete m_hashTable[n]; - } - - delete [] m_hashTable; - - m_hashTable = (wxListBase **)NULL; - - m_count = 0; - } -} - -void wxHashTableBase::DeleteContents(bool flag) -{ - m_deleteContents = flag; - for ( size_t n = 0; n < m_hashSize; n++ ) - { - if ( m_hashTable[n] ) - { - m_hashTable[n]->DeleteContents(flag); - } - } -} - -wxNodeBase *wxHashTableBase::GetNode(long key, long value) const -{ - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - wxNodeBase *node; - if ( m_hashTable[slot] ) - { - node = m_hashTable[slot]->Find(wxListKey(value)); - } - else - { - node = (wxNodeBase *)NULL; - } - - return node; -} - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// wxHashTableLong -// ---------------------------------------------------------------------------- - -wxHashTableLong::~wxHashTableLong() -{ - Destroy(); -} - -void wxHashTableLong::Init(size_t size) -{ - m_hashSize = size; - m_values = new wxArrayLong *[size]; - m_keys = new wxArrayLong *[size]; - - for ( size_t n = 0; n < m_hashSize; n++ ) - { - m_values[n] = - m_keys[n] = (wxArrayLong *)NULL; - } - - m_count = 0; -} - -void wxHashTableLong::Create(size_t size) -{ - Init(size); -} - -void wxHashTableLong::Destroy() -{ - for ( size_t n = 0; n < m_hashSize; n++ ) - { - delete m_values[n]; - delete m_keys[n]; - } - - delete [] m_values; - delete [] m_keys; - m_hashSize = 0; - m_count = 0; -} - -void wxHashTableLong::Put(long key, long value) -{ - wxCHECK_RET( m_hashSize, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - if ( !m_keys[slot] ) - { - m_keys[slot] = new wxArrayLong; - m_values[slot] = new wxArrayLong; - } - - m_keys[slot]->Add(key); - m_values[slot]->Add(value); - - m_count++; -} - -long wxHashTableLong::Get(long key) const -{ - wxCHECK_MSG( m_hashSize, wxNOT_FOUND, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - wxArrayLong *keys = m_keys[slot]; - if ( keys ) - { - size_t count = keys->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( keys->Item(n) == key ) - { - return m_values[slot]->Item(n); - } - } - } - - return wxNOT_FOUND; -} - -long wxHashTableLong::Delete(long key) -{ - wxCHECK_MSG( m_hashSize, wxNOT_FOUND, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - wxArrayLong *keys = m_keys[slot]; - if ( keys ) - { - size_t count = keys->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( keys->Item(n) == key ) - { - long val = m_values[slot]->Item(n); - - keys->RemoveAt(n); - m_values[slot]->RemoveAt(n); - - m_count--; - - return val; - } - } - } - - return wxNOT_FOUND; -} - -// ---------------------------------------------------------------------------- -// wxStringHashTable: more efficient than storing strings in a list -// ---------------------------------------------------------------------------- - -wxStringHashTable::wxStringHashTable(size_t sizeTable) -{ - m_keys = new wxArrayLong *[sizeTable]; - m_values = new wxArrayString *[sizeTable]; - - m_hashSize = sizeTable; - for ( size_t n = 0; n < m_hashSize; n++ ) - { - m_values[n] = (wxArrayString *)NULL; - m_keys[n] = (wxArrayLong *)NULL; - } -} - -wxStringHashTable::~wxStringHashTable() -{ - Destroy(); -} - -void wxStringHashTable::Destroy() -{ - for ( size_t n = 0; n < m_hashSize; n++ ) - { - delete m_values[n]; - delete m_keys[n]; - } - - delete [] m_values; - delete [] m_keys; - m_hashSize = 0; -} - -void wxStringHashTable::Put(long key, const wxString& value) -{ - wxCHECK_RET( m_hashSize, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - if ( !m_keys[slot] ) - { - m_keys[slot] = new wxArrayLong; - m_values[slot] = new wxArrayString; - } - - m_keys[slot]->Add(key); - m_values[slot]->Add(value); -} - -wxString wxStringHashTable::Get(long key, bool *wasFound) const -{ - wxCHECK_MSG( m_hashSize, wxEmptyString, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - wxArrayLong *keys = m_keys[slot]; - if ( keys ) - { - size_t count = keys->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( keys->Item(n) == key ) - { - if ( wasFound ) - *wasFound = true; - - return m_values[slot]->Item(n); - } - } - } - - if ( wasFound ) - *wasFound = false; - - return wxEmptyString; -} - -bool wxStringHashTable::Delete(long key) const -{ - wxCHECK_MSG( m_hashSize, false, _T("must call Create() first") ); - - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); - - wxArrayLong *keys = m_keys[slot]; - if ( keys ) - { - size_t count = keys->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( keys->Item(n) == key ) - { - keys->RemoveAt(n); - m_values[slot]->RemoveAt(n); - return true; - } - } - } - - return false; -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// old not type safe wxHashTable -// ---------------------------------------------------------------------------- - -wxHashTable::wxHashTable (int the_key_type, int size) -{ - n = 0; - hash_table = (wxList**) NULL; - Create(the_key_type, size); - m_count = 0; - m_deleteContents = false; -/* - n = size; - current_position = -1; - current_node = (wxNode *) NULL; - - key_type = the_key_type; - hash_table = new wxList *[size]; - int i; - for (i = 0; i < size; i++) - hash_table[i] = (wxList *) NULL; -*/ -} - -wxHashTable::~wxHashTable () -{ - Destroy(); -} - -void wxHashTable::Destroy() -{ - if (!hash_table) return; - int i; - for (i = 0; i < n; i++) - if (hash_table[i]) - delete hash_table[i]; - delete[] hash_table; - hash_table = NULL; -} - -bool wxHashTable::Create(int the_key_type, int size) -{ - Destroy(); - - n = size; - current_position = -1; - current_node = (wxNode *) NULL; - - key_type = the_key_type; - hash_table = new wxList *[size]; - int i; - for (i = 0; i < size; i++) - hash_table[i] = (wxList *) NULL; - return true; -} - - -void wxHashTable::DoCopy(const wxHashTable& table) -{ - n = table.n; - m_count = table.m_count; - current_position = table.current_position; - current_node = NULL; // doesn't matter - Next() will reconstruct it - key_type = table.key_type; - - hash_table = new wxList *[n]; - for (int i = 0; i < n; i++) { - if (table.hash_table[i] == NULL) - hash_table[i] = NULL; - else { - hash_table[i] = new wxList(key_type); - *hash_table[i] = *(table.hash_table[i]); - } - } -} - -void wxHashTable::Put (long key, long value, wxObject * object) -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - { - hash_table[position] = new wxList (wxKEY_INTEGER); - if (m_deleteContents) hash_table[position]->DeleteContents(true); - } - - hash_table[position]->Append (value, object); - m_count++; -} - -void wxHashTable::Put (long key, const wxChar *value, wxObject * object) -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - { - hash_table[position] = new wxList (wxKEY_STRING); - if (m_deleteContents) hash_table[position]->DeleteContents(true); - } - - hash_table[position]->Append (value, object); - m_count++; -} - -void wxHashTable::Put (long key, wxObject * object) -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - { - hash_table[position] = new wxList (wxKEY_INTEGER); - if (m_deleteContents) hash_table[position]->DeleteContents(true); - } - - hash_table[position]->Append (k, object); - m_count++; -} - -void wxHashTable::Put (const wxChar *key, wxObject * object) -{ - int position = (int) (MakeKey (key) % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - { - hash_table[position] = new wxList (wxKEY_STRING); - if (m_deleteContents) hash_table[position]->DeleteContents(true); - } - - hash_table[position]->Append (key, object); - m_count++; -} - -wxObject *wxHashTable::Get (long key, long value) const -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (value); - if (node) - return node->GetData (); - else - return (wxObject *) NULL; - } -} - -wxObject *wxHashTable::Get (long key, const wxChar *value) const -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (value); - if (node) - return node->GetData (); - else - return (wxObject *) NULL; - } -} - -wxObject *wxHashTable::Get (long key) const -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (k); - return node ? node->GetData () : (wxObject*)NULL; - } -} - -wxObject *wxHashTable::Get (const wxChar *key) const -{ - int position = (int) (MakeKey (key) % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (key); - return node ? node->GetData () : (wxObject*)NULL; - } -} - -wxObject *wxHashTable::Delete (long key) -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (k); - if (node) - { - wxObject *data = node->GetData (); - delete node; - m_count--; - return data; - } - else - return (wxObject *) NULL; - } -} - -wxObject *wxHashTable::Delete (const wxChar *key) -{ - int position = (int) (MakeKey (key) % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (key); - if (node) - { - wxObject *data = node->GetData (); - delete node; - m_count--; - return data; - } - else - return (wxObject *) NULL; - } -} - -wxObject *wxHashTable::Delete (long key, int value) -{ - // Should NEVER be - long k = (long) key; - - int position = (int) (k % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (value); - if (node) - { - wxObject *data = node->GetData (); - delete node; - m_count--; - return data; - } - else - return (wxObject *) NULL; - } -} - -wxObject *wxHashTable::Delete (long key, const wxChar *value) -{ - int position = (int) (key % n); - if (position < 0) position = -position; - - if (!hash_table[position]) - return (wxObject *) NULL; - else - { - wxNode *node = hash_table[position]->Find (value); - if (node) - { - wxObject *data = node->GetData (); - delete node; - m_count--; - return data; - } - else - return (wxObject *) NULL; - } -} - -long wxHashTable::MakeKey (const wxChar *string) const -{ - long int_key = 0; - - while (*string) - int_key += (wxUChar) *string++; - - return int_key; -} - -void wxHashTable::BeginFind () -{ - current_position = -1; - current_node = (wxNode *) NULL; -} - -wxHashTable::Node* wxHashTable::Next () -{ - wxNode *found = (wxNode *) NULL; - bool end = false; - while (!end && !found) - { - if (!current_node) - { - current_position++; - if (current_position >= n) - { - current_position = -1; - current_node = (wxNode *) NULL; - end = true; - } - else - { - if (hash_table[current_position]) - { - current_node = hash_table[current_position]->GetFirst (); - found = current_node; - } - } - } - else - { - current_node = current_node->GetNext (); - found = current_node; - } - } - return found; -} - -void wxHashTable::DeleteContents (bool flag) -{ - int i; - m_deleteContents = flag; - for (i = 0; i < n; i++) - { - if (hash_table[i]) - hash_table[i]->DeleteContents (flag); - } -} - -void wxHashTable::Clear () -{ - int i; - if (hash_table) - { - for (i = 0; i < n; i++) - { - if (hash_table[i]) - hash_table[i]->Clear (); - } - } - m_count = 0; -} - -#else // if !wxUSE_OLD_HASH_TABLE - -wxHashTableBase_Node::wxHashTableBase_Node( long key, void* value, - wxHashTableBase* table ) - : m_value( value ), m_hashPtr( table ) -{ - m_key.integer = key; -} - -wxHashTableBase_Node::wxHashTableBase_Node( const wxChar* key, void* value, - wxHashTableBase* table ) - : m_value( value ), m_hashPtr( table ) -{ - m_key.string = wxStrcpy( new wxChar[wxStrlen( key ) + 1], key ); -} - -wxHashTableBase_Node::~wxHashTableBase_Node() -{ - if( m_hashPtr ) m_hashPtr->DoRemoveNode( this ); -} - -// - -wxHashTableBase::wxHashTableBase() - : m_size( 0 ), m_count( 0 ), m_table( NULL ), m_keyType( wxKEY_NONE ), - m_deleteContents( false ) -{ -} - -void wxHashTableBase::Create( wxKeyType keyType, size_t size ) -{ - m_keyType = keyType; - m_size = size; - m_table = new wxHashTableBase_Node*[ m_size ]; - - for( size_t i = 0; i < m_size; ++i ) - m_table[i] = NULL; -} - -void wxHashTableBase::Clear() -{ - for( size_t i = 0; i < m_size; ++i ) - { - Node* end = m_table[i]; - - if( end == NULL ) - continue; - - Node *curr, *next = end->GetNext(); - - do - { - curr = next; - next = curr->GetNext(); - - DoDestroyNode( curr ); - - delete curr; - } - while( curr != end ); - - m_table[i] = NULL; - } - - m_count = 0; -} - -void wxHashTableBase::DoRemoveNode( wxHashTableBase_Node* node ) -{ - size_t bucket = ( m_keyType == wxKEY_INTEGER ? - node->m_key.integer : - MakeKey( node->m_key.string ) ) % m_size; - - if( node->GetNext() == node ) - { - // single-node chain (common case) - m_table[bucket] = NULL; - } - else - { - Node *start = m_table[bucket], *curr; - Node* prev = start; - - for( curr = prev->GetNext(); curr != node; - prev = curr, curr = curr->GetNext() ) ; - - DoUnlinkNode( bucket, node, prev ); - } - - DoDestroyNode( node ); -} - -void wxHashTableBase::DoDestroyNode( wxHashTableBase_Node* node ) -{ - // if it is called from DoRemoveNode, node has already been - // removed, from other places it does not matter - node->m_hashPtr = NULL; - - if( m_keyType == wxKEY_STRING ) - delete[] node->m_key.string; - if( m_deleteContents ) - DoDeleteContents( node ); -} - -void wxHashTableBase::Destroy() -{ - Clear(); - - delete[] m_table; - - m_table = NULL; - m_size = 0; -} - -void wxHashTableBase::DoInsertNode( size_t bucket, wxHashTableBase_Node* node ) -{ - if( m_table[bucket] == NULL ) - { - m_table[bucket] = node->m_next = node; - } - else - { - Node *prev = m_table[bucket]; - Node *next = prev->m_next; - - prev->m_next = node; - node->m_next = next; - m_table[bucket] = node; - } - - ++m_count; -} - -void wxHashTableBase::DoPut( long key, long hash, void* data ) -{ - wxASSERT( m_keyType == wxKEY_INTEGER ); - - size_t bucket = size_t(hash) % m_size; - Node* node = new wxHashTableBase_Node( key, data, this ); - - DoInsertNode( bucket, node ); -} - -void wxHashTableBase::DoPut( const wxChar* key, long hash, void* data ) -{ - wxASSERT( m_keyType == wxKEY_STRING ); - - size_t bucket = size_t(hash) % m_size; - Node* node = new wxHashTableBase_Node( key, data, this ); - - DoInsertNode( bucket, node ); -} - -void* wxHashTableBase::DoGet( long key, long hash ) const -{ - wxASSERT( m_keyType == wxKEY_INTEGER ); - - size_t bucket = size_t(hash) % m_size; - - if( m_table[bucket] == NULL ) - return NULL; - - Node *first = m_table[bucket]->GetNext(), - *curr = first; - - do - { - if( curr->m_key.integer == key ) - return curr->m_value; - - curr = curr->GetNext(); - } - while( curr != first ); - - return NULL; -} - -void* wxHashTableBase::DoGet( const wxChar* key, long hash ) const -{ - wxASSERT( m_keyType == wxKEY_STRING ); - - size_t bucket = size_t(hash) % m_size; - - if( m_table[bucket] == NULL ) - return NULL; - - Node *first = m_table[bucket]->GetNext(), - *curr = first; - - do - { - if( wxStrcmp( curr->m_key.string, key ) == 0 ) - return curr->m_value; - - curr = curr->GetNext(); - } - while( curr != first ); - - return NULL; -} - -void wxHashTableBase::DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, - wxHashTableBase_Node* prev ) -{ - if( node == m_table[bucket] ) - m_table[bucket] = prev; - - if( prev == node && prev == node->GetNext() ) - m_table[bucket] = NULL; - else - prev->m_next = node->m_next; - - DoDestroyNode( node ); - --m_count; -} - -void* wxHashTableBase::DoDelete( long key, long hash ) -{ - wxASSERT( m_keyType == wxKEY_INTEGER ); - - size_t bucket = size_t(hash) % m_size; - - if( m_table[bucket] == NULL ) - return NULL; - - Node *first = m_table[bucket]->GetNext(), - *curr = first, - *prev = m_table[bucket]; - - do - { - if( curr->m_key.integer == key ) - { - void* retval = curr->m_value; - curr->m_value = NULL; - - DoUnlinkNode( bucket, curr, prev ); - delete curr; - - return retval; - } - - prev = curr; - curr = curr->GetNext(); - } - while( curr != first ); - - return NULL; -} - -void* wxHashTableBase::DoDelete( const wxChar* key, long hash ) -{ - wxASSERT( m_keyType == wxKEY_STRING ); - - size_t bucket = size_t(hash) % m_size; - - if( m_table[bucket] == NULL ) - return NULL; - - Node *first = m_table[bucket]->GetNext(), - *curr = first, - *prev = m_table[bucket]; - - do - { - if( wxStrcmp( curr->m_key.string, key ) == 0 ) - { - void* retval = curr->m_value; - curr->m_value = NULL; - - DoUnlinkNode( bucket, curr, prev ); - delete curr; - - return retval; - } - - prev = curr; - curr = curr->GetNext(); - } - while( curr != first ); - - return NULL; -} - -long wxHashTableBase::MakeKey( const wxChar *str ) -{ - long int_key = 0; - - while( *str ) - int_key += (wxUChar)*str++; - - return int_key; -} - -// ---------------------------------------------------------------------------- -// wxHashTable -// ---------------------------------------------------------------------------- - -wxHashTable::wxHashTable( const wxHashTable& table ) - : wxHashTableBase() -{ - DoCopy( table ); -} - -const wxHashTable& wxHashTable::operator=( const wxHashTable& table ) -{ - Destroy(); - DoCopy( table ); - - return *this; -} - -void wxHashTable::DoCopy( const wxHashTable& WXUNUSED(table) ) -{ - Create( m_keyType, m_size ); - - wxFAIL; -} - -void wxHashTable::DoDeleteContents( wxHashTableBase_Node* node ) -{ - delete ((wxHashTable_Node*)node)->GetData(); -} - -void wxHashTable::GetNextNode( size_t bucketStart ) -{ - for( size_t i = bucketStart; i < m_size; ++i ) - { - if( m_table[i] != NULL ) - { - m_curr = ((Node*)m_table[i])->GetNext(); - m_currBucket = i; - return; - } - } - - m_curr = NULL; - m_currBucket = 0; -} - -wxHashTable::Node* wxHashTable::Next() -{ - if( m_curr == NULL ) - GetNextNode( 0 ); - else - { - m_curr = m_curr->GetNext(); - - if( m_curr == ( (Node*)m_table[m_currBucket] )->GetNext() ) - GetNextNode( m_currBucket + 1 ); - } - - return m_curr; -} - -#endif // !wxUSE_OLD_HASH_TABLE diff --git a/Source/3rdParty/wx/src/common/hashmap.cpp b/Source/3rdParty/wx/src/common/hashmap.cpp deleted file mode 100644 index 215396f8e..000000000 --- a/Source/3rdParty/wx/src/common/hashmap.cpp +++ /dev/null @@ -1,152 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/hashmap.cpp -// Purpose: wxHashMap implementation -// Author: Mattia Barbon -// Modified by: -// Created: 29/01/2002 -// RCS-ID: $Id: hashmap.cpp 39802 2006-06-20 10:24:07Z ABX $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/hashmap.h" - -/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins */ -/* from requirements by Colin Plumb. */ -/* (http://burtleburtle.net/bob/hash/doobs.html) */ -/* adapted from Perl sources ( hv.h ) */ -unsigned long wxStringHash::wxCharStringHash( const wxChar* k ) -{ - unsigned long hash = 0; - - while( *k ) - { - hash += *k++; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - - return hash + (hash << 15); -} - -#if wxUSE_UNICODE -unsigned long wxStringHash::charStringHash( const char* k ) -{ - unsigned long hash = 0; - - while( *k ) - { - hash += *k++; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - - return hash + (hash << 15); -} -#endif - -#if !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -/* from SGI STL */ -const unsigned long _wxHashTableBase2::ms_primes[prime_count] = -{ - 7ul, 13ul, 29ul, - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul -}; - -unsigned long _wxHashTableBase2::GetNextPrime( unsigned long n ) -{ - const unsigned long* ptr = &ms_primes[0]; - for( size_t i = 0; i < prime_count; ++i, ++ptr ) - { - if( n < *ptr ) - return *ptr; - } - - /* someone might try to alloc a 2^32-element hash table */ - wxFAIL_MSG( _T("hash table too big?") ); - - /* quiet warning */ - return 0; -} - -unsigned long _wxHashTableBase2::GetPreviousPrime( unsigned long n ) -{ - const unsigned long* ptr = &ms_primes[prime_count - 1]; - - for( size_t i = 0; i < prime_count; ++i, --ptr ) - { - if( n > *ptr ) - return *ptr; - } - - /* quiet warning */ - return 1; -} - -void _wxHashTableBase2::DeleteNodes( size_t buckets, - _wxHashTable_NodeBase** table, - NodeDtor dtor ) -{ - size_t i; - - for( i = 0; i < buckets; ++i ) - { - _wxHashTable_NodeBase* node = table[i]; - _wxHashTable_NodeBase* tmp; - - while( node ) - { - tmp = node->m_nxt; - dtor( node ); - node = tmp; - } - } - - memset( table, 0, buckets * sizeof(void*) ); -} - -void _wxHashTableBase2::CopyHashTable( _wxHashTable_NodeBase** srcTable, - size_t srcBuckets, - _wxHashTableBase2* dst, - _wxHashTable_NodeBase** dstTable, - BucketFromNode func, ProcessNode proc ) -{ - for( size_t i = 0; i < srcBuckets; ++i ) - { - _wxHashTable_NodeBase* nextnode; - - for( _wxHashTable_NodeBase* node = srcTable[i]; node; node = nextnode ) - { - size_t bucket = func( dst, node ); - - nextnode = node->m_nxt; - _wxHashTable_NodeBase* newnode = proc( node ); - newnode->m_nxt = dstTable[bucket]; - dstTable[bucket] = newnode; - } - } -} - -_wxHashTable_NodeBase* _wxHashTableBase2::DummyProcessNode(_wxHashTable_NodeBase* node) -{ - return node; -} - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) diff --git a/Source/3rdParty/wx/src/common/helpbase.cpp b/Source/3rdParty/wx/src/common/helpbase.cpp deleted file mode 100644 index 83ede72d7..000000000 --- a/Source/3rdParty/wx/src/common/helpbase.cpp +++ /dev/null @@ -1,28 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/helpbase.cpp -// Purpose: Help system base classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: helpbase.cpp 38787 2006-04-18 07:24:35Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_HELP - -#ifndef WX_PRECOMP -#endif - -#include "wx/helpbase.h" - -IMPLEMENT_CLASS(wxHelpControllerBase, wxObject) - -#endif // wxUSE_HELP diff --git a/Source/3rdParty/wx/src/common/iconbndl.cpp b/Source/3rdParty/wx/src/common/iconbndl.cpp deleted file mode 100644 index 98805d7e8..000000000 --- a/Source/3rdParty/wx/src/common/iconbndl.cpp +++ /dev/null @@ -1,142 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/iconbndl.cpp -// Purpose: wxIconBundle -// Author: Mattia Barbon -// Created: 23.03.2002 -// RCS-ID: $Id: iconbndl.cpp 40654 2006-08-17 16:08:13Z VS $ -// Copyright: (c) Mattia barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/iconbndl.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/icon.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/bitmap.h" - #include "wx/image.h" -#endif - -#include "wx/arrimpl.cpp" - -WX_DEFINE_OBJARRAY(wxIconArray) - -const wxIconBundle& wxIconBundle::operator =( const wxIconBundle& ic ) -{ - if( this == &ic ) return *this; - - size_t i, max = ic.m_icons.GetCount(); - - DeleteIcons(); - for( i = 0; i < max; ++i ) - m_icons.Add( ic.m_icons[i] ); - - return *this; -} - -void wxIconBundle::DeleteIcons() -{ - m_icons.Empty(); -} - -#if wxUSE_IMAGE -void wxIconBundle::AddIcon( const wxString& file, long type ) -#else -void wxIconBundle::AddIcon( const wxString& WXUNUSED(file), long WXUNUSED(type) ) -#endif -{ -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - size_t count = wxImage::GetImageCount( file, type ); - size_t i; - wxImage image; - - for( i = 0; i < count; ++i ) - { - if( !image.LoadFile( file, type, i ) ) - { - wxLogError( _("Failed to load image %d from file '%s'."), - i, file.c_str() ); - continue; - } - - wxIcon* tmp = new wxIcon(); - tmp->CopyFromBitmap( wxBitmap( image ) ); - AddIcon( *tmp ); - delete tmp; - } -#endif -} - -const wxIcon& wxIconBundle::GetIcon( const wxSize& size ) const -{ - // temp. variable needed to fix Borland C++ 5.5.1 problem - // with passing a return value through two functions - wxIcon *tmp; - - size_t max = m_icons.GetCount(); - - // if we have one or no icon, we can return now without doing more work: - if ( max <= 1 ) - { - if ( max == 1 ) // fix for broken BCC - tmp = &m_icons[0]; - else // max == 0 - tmp = &wxNullIcon; - return *tmp; - } - - // there are more icons, find the best match: - wxCoord sysX = wxSystemSettings::GetMetric( wxSYS_ICON_X ), - sysY = wxSystemSettings::GetMetric( wxSYS_ICON_Y ); - - wxIcon *sysIcon = 0; - - for( size_t i = 0; i < max; i++ ) - { - if( !m_icons[i].Ok() ) - continue; - wxCoord sx = m_icons[i].GetWidth(), sy = m_icons[i].GetHeight(); - // requested size - if( sx == size.x && sy == size.y ) - { - tmp = &m_icons[i]; // fix for broken BCC - return *tmp; - } - // keep track if there is a system-size icon - if( sx == sysX && sy == sysY ) - sysIcon = &m_icons[i]; - } - - // return the system-sized icon if we've got one - if( sysIcon ) return *sysIcon; - // we certainly have at least one icon thanks to the <=1 check above - tmp = &m_icons[0]; - return *tmp; -} - -void wxIconBundle::AddIcon( const wxIcon& icon ) -{ - size_t i, max = m_icons.GetCount(); - - for( i = 0; i < max; ++i ) - { - wxIcon& tmp = m_icons[i]; - if( tmp.Ok() && tmp.GetWidth() == icon.GetWidth() && - tmp.GetHeight() == icon.GetHeight() ) - { - tmp = icon; - return; - } - } - - m_icons.Add( icon ); -} diff --git a/Source/3rdParty/wx/src/common/imagall.cpp b/Source/3rdParty/wx/src/common/imagall.cpp deleted file mode 100644 index 90e66ac95..000000000 --- a/Source/3rdParty/wx/src/common/imagall.cpp +++ /dev/null @@ -1,64 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagall.cpp -// Purpose: wxImage access all handler -// Author: Sylvain Bougnoux -// RCS-ID: $Id: imagall.cpp 42644 2006-10-29 18:58:25Z VZ $ -// Copyright: (c) Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE - -#ifndef WX_PRECOMP - #include "wx/image.h" -#endif - -//----------------------------------------------------------------------------- -// This function allows dynamic access to all image handlers compile within -// the library. This function should be in a separate file as some compilers -// link against the whole object file as long as just one of is function is called! - -void wxInitAllImageHandlers() -{ -#if wxUSE_LIBPNG - wxImage::AddHandler( new wxPNGHandler ); -#endif -#if wxUSE_LIBJPEG - wxImage::AddHandler( new wxJPEGHandler ); -#endif -#if wxUSE_LIBTIFF - wxImage::AddHandler( new wxTIFFHandler ); -#endif -#if wxUSE_GIF - wxImage::AddHandler( new wxGIFHandler ); -#endif -#if wxUSE_PNM - wxImage::AddHandler( new wxPNMHandler ); -#endif -#if wxUSE_PCX - wxImage::AddHandler( new wxPCXHandler ); -#endif -#if wxUSE_IFF - wxImage::AddHandler( new wxIFFHandler ); -#endif -#if wxUSE_ICO_CUR - wxImage::AddHandler( new wxICOHandler ); - wxImage::AddHandler( new wxCURHandler ); - wxImage::AddHandler( new wxANIHandler ); -#endif -#if wxUSE_TGA - wxImage::AddHandler( new wxTGAHandler ); -#endif -#if wxUSE_XPM - wxImage::AddHandler( new wxXPMHandler ); -#endif -} - -#endif // wxUSE_IMAGE diff --git a/Source/3rdParty/wx/src/common/imagbmp.cpp b/Source/3rdParty/wx/src/common/imagbmp.cpp deleted file mode 100644 index d0930f464..000000000 --- a/Source/3rdParty/wx/src/common/imagbmp.cpp +++ /dev/null @@ -1,1383 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagbmp.cpp -// Purpose: wxImage BMP,ICO and CUR handlers -// Author: Robert Roebling, Chris Elliott -// RCS-ID: $Id: imagbmp.cpp 54942 2008-08-03 00:23:38Z VZ $ -// Copyright: (c) Robert Roebling, Chris Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE - -#include "wx/imagbmp.h" - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/log.h" - #include "wx/app.h" - #include "wx/bitmap.h" - #include "wx/palette.h" - #include "wx/intl.h" -#endif - -#include "wx/filefn.h" -#include "wx/wfstream.h" -#include "wx/quantize.h" -#include "wx/anidecod.h" - -// For memcpy -#include - -#ifdef __SALFORDC__ -#ifdef FAR -#undef FAR -#endif -#endif - -//----------------------------------------------------------------------------- -// wxBMPHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) - -#if wxUSE_STREAMS - -#ifndef BI_RGB - #define BI_RGB 0 -#endif - -#ifndef BI_RLE8 -#define BI_RLE8 1 -#endif - -#ifndef BI_RLE4 -#define BI_RLE4 2 -#endif - -#ifndef BI_BITFIELDS -#define BI_BITFIELDS 3 -#endif - -#define poffset (line * width * 3 + column * 3) - -bool wxBMPHandler::SaveFile(wxImage *image, - wxOutputStream& stream, - bool verbose) -{ - return SaveDib(image, stream, verbose, true/*IsBmp*/, false/*IsMask*/); -} - -bool wxBMPHandler::SaveDib(wxImage *image, - wxOutputStream& stream, - bool verbose, - bool IsBmp, - bool IsMask) - -{ - wxCHECK_MSG( image, false, _T("invalid pointer in wxBMPHandler::SaveFile") ); - - if ( !image->Ok() ) - { - if ( verbose ) - wxLogError(_("BMP: Couldn't save invalid image.")); - return false; - } - - // get the format of the BMP file to save, else use 24bpp - unsigned format = wxBMP_24BPP; - if ( image->HasOption(wxIMAGE_OPTION_BMP_FORMAT) ) - format = image->GetOptionInt(wxIMAGE_OPTION_BMP_FORMAT); - - wxUint16 bpp; // # of bits per pixel - int palette_size; // # of color map entries, ie. 2^bpp colors - - // set the bpp and appropriate palette_size, and do additional checks - if ( (format == wxBMP_1BPP) || (format == wxBMP_1BPP_BW) ) - { - bpp = 1; - palette_size = 2; - } - else if ( format == wxBMP_4BPP ) - { - bpp = 4; - palette_size = 16; - } - else if ( (format == wxBMP_8BPP) || (format == wxBMP_8BPP_GREY) || - (format == wxBMP_8BPP_RED) || (format == wxBMP_8BPP_PALETTE) ) - { - // need to set a wxPalette to use this, HOW TO CHECK IF VALID, SIZE? - if ((format == wxBMP_8BPP_PALETTE) -#if wxUSE_PALETTE - && !image->HasPalette() -#endif // wxUSE_PALETTE - ) - { - if ( verbose ) - wxLogError(_("BMP: wxImage doesn't have own wxPalette.")); - return false; - } - bpp = 8; - palette_size = 256; - } - else // you get 24bpp - { - format = wxBMP_24BPP; - bpp = 24; - palette_size = 0; - } - - unsigned width = image->GetWidth(); - unsigned row_padding = (4 - int(width*bpp/8.0) % 4) % 4; // # bytes to pad to dword - unsigned row_width = int(width * bpp/8.0) + row_padding; // # of bytes per row - - struct - { - // BitmapHeader: - wxUint16 magic; // format magic, always 'BM' - wxUint32 filesize; // total file size, inc. headers - wxUint32 reserved; // for future use - wxUint32 data_offset; // image data offset in the file - - // BitmapInfoHeader: - wxUint32 bih_size; // 2nd part's size - wxUint32 width, height; // bitmap's dimensions - wxUint16 planes; // num of planes - wxUint16 bpp; // bits per pixel - wxUint32 compression; // compression method - wxUint32 size_of_bmp; // size of the bitmap - wxUint32 h_res, v_res; // image resolution in dpi - wxUint32 num_clrs; // number of colors used - wxUint32 num_signif_clrs;// number of significant colors - } hdr; - - wxUint32 hdr_size = 14/*BitmapHeader*/ + 40/*BitmapInfoHeader*/; - - hdr.magic = wxUINT16_SWAP_ON_BE(0x4D42/*'BM'*/); - hdr.filesize = wxUINT32_SWAP_ON_BE( hdr_size + palette_size*4 + - row_width * image->GetHeight() ); - hdr.reserved = 0; - hdr.data_offset = wxUINT32_SWAP_ON_BE(hdr_size + palette_size*4); - - hdr.bih_size = wxUINT32_SWAP_ON_BE(hdr_size - 14); - hdr.width = wxUINT32_SWAP_ON_BE(image->GetWidth()); - if ( IsBmp ) - { - hdr.height = wxUINT32_SWAP_ON_BE(image->GetHeight()); - } - else - { - hdr.height = wxUINT32_SWAP_ON_BE(2 * image->GetHeight()); - } - hdr.planes = wxUINT16_SWAP_ON_BE(1); // always 1 plane - hdr.bpp = wxUINT16_SWAP_ON_BE(bpp); - hdr.compression = 0; // RGB uncompressed - hdr.size_of_bmp = wxUINT32_SWAP_ON_BE(row_width * image->GetHeight()); - hdr.h_res = hdr.v_res = wxUINT32_SWAP_ON_BE(72); // 72dpi is standard - hdr.num_clrs = wxUINT32_SWAP_ON_BE(palette_size); // # colors in colormap - hdr.num_signif_clrs = 0; // all colors are significant - - if ( IsBmp ) - { - if (// VS: looks ugly but compilers tend to do ugly things with structs, - // like aligning hdr.filesize's ofset to dword :( - // VZ: we should add padding then... - !stream.Write(&hdr.magic, 2) || - !stream.Write(&hdr.filesize, 4) || - !stream.Write(&hdr.reserved, 4) || - !stream.Write(&hdr.data_offset, 4) - ) - { - if (verbose) - wxLogError(_("BMP: Couldn't write the file (Bitmap) header.")); - return false; - } - } - if ( !IsMask ) - { - if ( - !stream.Write(&hdr.bih_size, 4) || - !stream.Write(&hdr.width, 4) || - !stream.Write(&hdr.height, 4) || - !stream.Write(&hdr.planes, 2) || - !stream.Write(&hdr.bpp, 2) || - !stream.Write(&hdr.compression, 4) || - !stream.Write(&hdr.size_of_bmp, 4) || - !stream.Write(&hdr.h_res, 4) || - !stream.Write(&hdr.v_res, 4) || - !stream.Write(&hdr.num_clrs, 4) || - !stream.Write(&hdr.num_signif_clrs, 4) - ) - { - if (verbose) - wxLogError(_("BMP: Couldn't write the file (BitmapInfo) header.")); - return false; - } - } - - wxPalette *palette = NULL; // entries for quantized images - wxUint8 *rgbquad = NULL; // for the RGBQUAD bytes for the colormap - wxImage *q_image = NULL; // destination for quantized image - - // if <24bpp use quantization to reduce colors for *some* of the formats - if ( (format == wxBMP_1BPP) || (format == wxBMP_4BPP) || - (format == wxBMP_8BPP) || (format == wxBMP_8BPP_PALETTE) ) - { - // make a new palette and quantize the image - if (format != wxBMP_8BPP_PALETTE) - { - q_image = new wxImage(); - - // I get a delete error using Quantize when desired colors > 236 - int quantize = ((palette_size > 236) ? 236 : palette_size); - // fill the destination too, it gives much nicer 4bpp images - wxQuantize::Quantize( *image, *q_image, &palette, quantize, 0, - wxQUANTIZE_FILL_DESTINATION_IMAGE ); - } - else - { -#if wxUSE_PALETTE - palette = new wxPalette(image->GetPalette()); -#endif // wxUSE_PALETTE - } - - int i; - unsigned char r, g, b; - rgbquad = new wxUint8 [palette_size*4]; - - for (i = 0; i < palette_size; i++) - { -#if wxUSE_PALETTE - if ( !palette->GetRGB(i, &r, &g, &b) ) -#endif // wxUSE_PALETTE - r = g = b = 0; - - rgbquad[i*4] = b; - rgbquad[i*4+1] = g; - rgbquad[i*4+2] = r; - rgbquad[i*4+3] = 0; - } - } - // make a 256 entry greyscale colormap or 2 entry black & white - else if ( (format == wxBMP_8BPP_GREY) || (format == wxBMP_8BPP_RED) || - (format == wxBMP_1BPP_BW) ) - { - rgbquad = new wxUint8 [palette_size*4]; - - for ( int i = 0; i < palette_size; i++ ) - { - // if 1BPP_BW then the value should be either 0 or 255 - wxUint8 c = (wxUint8)((i > 0) && (format == wxBMP_1BPP_BW) ? 255 : i); - - rgbquad[i*4] = - rgbquad[i*4+1] = - rgbquad[i*4+2] = c; - rgbquad[i*4+3] = 0; - } - } - - // if the colormap was made, then it needs to be written - if (rgbquad) - { - if ( !IsMask ) - { - if ( !stream.Write(rgbquad, palette_size*4) ) - { - if (verbose) - wxLogError(_("BMP: Couldn't write RGB color map.")); - delete[] rgbquad; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; - return false; - } - } - delete []rgbquad; - } - - // pointer to the image data, use quantized if available - wxUint8 *data = (wxUint8*) image->GetData(); - if (q_image) if (q_image->Ok()) data = (wxUint8*) q_image->GetData(); - - wxUint8 *buffer = new wxUint8[row_width]; - memset(buffer, 0, row_width); - int y; unsigned x; - long int pixel; - - for (y = image->GetHeight() -1; y >= 0; y--) - { - if ( format == wxBMP_24BPP ) // 3 bytes per pixel red,green,blue - { - for ( x = 0; x < width; x++ ) - { - pixel = 3*(y*width + x); - - buffer[3*x ] = data[pixel+2]; - buffer[3*x + 1] = data[pixel+1]; - buffer[3*x + 2] = data[pixel]; - } - } - else if ((format == wxBMP_8BPP) || // 1 byte per pixel in color - (format == wxBMP_8BPP_PALETTE)) - { - for (x = 0; x < width; x++) - { - pixel = 3*(y*width + x); -#if wxUSE_PALETTE - buffer[x] = (wxUint8)palette->GetPixel( data[pixel], - data[pixel+1], - data[pixel+2] ); -#else - // FIXME: what should this be? use some std palette maybe? - buffer[x] = 0; -#endif // wxUSE_PALETTE - } - } - else if ( format == wxBMP_8BPP_GREY ) // 1 byte per pix, rgb ave to grey - { - for (x = 0; x < width; x++) - { - pixel = 3*(y*width + x); - buffer[x] = (wxUint8)(.299*data[pixel] + - .587*data[pixel+1] + - .114*data[pixel+2]); - } - } - else if ( format == wxBMP_8BPP_RED ) // 1 byte per pixel, red as greys - { - for (x = 0; x < width; x++) - { - buffer[x] = (wxUint8)data[3*(y*width + x)]; - } - } - else if ( format == wxBMP_4BPP ) // 4 bpp in color - { - for (x = 0; x < width; x+=2) - { - pixel = 3*(y*width + x); - - // fill buffer, ignore if > width -#if wxUSE_PALETTE - buffer[x/2] = (wxUint8)( - ((wxUint8)palette->GetPixel(data[pixel], - data[pixel+1], - data[pixel+2]) << 4) | - (((x+1) > width) - ? 0 - : ((wxUint8)palette->GetPixel(data[pixel+3], - data[pixel+4], - data[pixel+5]) )) ); -#else - // FIXME: what should this be? use some std palette maybe? - buffer[x/2] = 0; -#endif // wxUSE_PALETTE - } - } - else if ( format == wxBMP_1BPP ) // 1 bpp in "color" - { - for (x = 0; x < width; x+=8) - { - pixel = 3*(y*width + x); - -#if wxUSE_PALETTE - buffer[x/8] = (wxUint8)( - ((wxUint8)palette->GetPixel(data[pixel], data[pixel+1], data[pixel+2]) << 7) | - (((x+1) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+3], data[pixel+4], data[pixel+5]) << 6)) | - (((x+2) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+6], data[pixel+7], data[pixel+8]) << 5)) | - (((x+3) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+9], data[pixel+10], data[pixel+11]) << 4)) | - (((x+4) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+12], data[pixel+13], data[pixel+14]) << 3)) | - (((x+5) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+15], data[pixel+16], data[pixel+17]) << 2)) | - (((x+6) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+18], data[pixel+19], data[pixel+20]) << 1)) | - (((x+7) > width) ? 0 : ((wxUint8)palette->GetPixel(data[pixel+21], data[pixel+22], data[pixel+23]) )) ); -#else - // FIXME: what should this be? use some std palette maybe? - buffer[x/8] = 0; -#endif // wxUSE_PALETTE - } - } - else if ( format == wxBMP_1BPP_BW ) // 1 bpp B&W colormap from red color ONLY - { - for (x = 0; x < width; x+=8) - { - pixel = 3*(y*width + x); - - buffer[x/8] = (wxUint8)( - (((wxUint8)(data[pixel] /128.)) << 7) | - (((x+1) > width) ? 0 : (((wxUint8)(data[pixel+3] /128.)) << 6)) | - (((x+2) > width) ? 0 : (((wxUint8)(data[pixel+6] /128.)) << 5)) | - (((x+3) > width) ? 0 : (((wxUint8)(data[pixel+9] /128.)) << 4)) | - (((x+4) > width) ? 0 : (((wxUint8)(data[pixel+12]/128.)) << 3)) | - (((x+5) > width) ? 0 : (((wxUint8)(data[pixel+15]/128.)) << 2)) | - (((x+6) > width) ? 0 : (((wxUint8)(data[pixel+18]/128.)) << 1)) | - (((x+7) > width) ? 0 : (((wxUint8)(data[pixel+21]/128.)) )) ); - } - } - - if ( !stream.Write(buffer, row_width) ) - { - if (verbose) - wxLogError(_("BMP: Couldn't write data.")); - delete[] buffer; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; - return false; - } - } - delete[] buffer; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; - - return true; -} - - -typedef struct -{ - unsigned char r, g, b; -} _cmap; - -bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, - int bpp, int ncolors, int comp, - wxFileOffset bmpOffset, wxInputStream& stream, - bool verbose, bool IsBmp, bool hasPalette) -{ - wxInt32 aDword, rmask = 0, gmask = 0, bmask = 0, amask = 0; - int rshift = 0, gshift = 0, bshift = 0, ashift = 0; - int rbits = 0, gbits = 0, bbits = 0, abits = 0; - wxInt32 dbuf[4]; - wxInt8 bbuf[4]; - wxUint8 aByte; - wxUint16 aWord; - - // allocate space for palette if needed: - _cmap *cmap; - - if ( bpp < 16 ) - { - cmap = new _cmap[ncolors]; - if ( !cmap ) - { - if (verbose) - wxLogError(_("BMP: Couldn't allocate memory.")); - return false; - } - } - else - cmap = NULL; - - // destroy existing here instead of: - image->Destroy(); - image->Create(width, height); - - unsigned char *ptr = image->GetData(); - - if ( !ptr ) - { - if ( verbose ) - wxLogError( _("BMP: Couldn't allocate memory.") ); - delete[] cmap; - return false; - } - - unsigned char *alpha; - if ( bpp == 32 ) - { - // tell the image to allocate an alpha buffer - image->SetAlpha(); - alpha = image->GetAlpha(); - if ( !alpha ) - { - if ( verbose ) - wxLogError(_("BMP: Couldn't allocate memory.")); - delete[] cmap; - return false; - } - } - else // no alpha - { - alpha = NULL; - } - - // Reading the palette, if it exists: - if ( bpp < 16 && ncolors != 0 ) - { - unsigned char* r = new unsigned char[ncolors]; - unsigned char* g = new unsigned char[ncolors]; - unsigned char* b = new unsigned char[ncolors]; - for (int j = 0; j < ncolors; j++) - { - if (hasPalette) - { - stream.Read(bbuf, 4); - cmap[j].b = bbuf[0]; - cmap[j].g = bbuf[1]; - cmap[j].r = bbuf[2]; - - r[j] = cmap[j].r; - g[j] = cmap[j].g; - b[j] = cmap[j].b; - } - else - { - //used in reading .ico file mask - r[j] = cmap[j].r = - g[j] = cmap[j].g = - b[j] = cmap[j].b = ( j ? 255 : 0 ); - } - } - -#if wxUSE_PALETTE - // Set the palette for the wxImage - image->SetPalette(wxPalette(ncolors, r, g, b)); -#endif // wxUSE_PALETTE - - delete[] r; - delete[] g; - delete[] b; - } - else if ( bpp == 16 || bpp == 32 ) - { - if ( comp == BI_BITFIELDS ) - { - int bit = 0; - stream.Read(dbuf, 4 * 3); - rmask = wxINT32_SWAP_ON_BE(dbuf[0]); - gmask = wxINT32_SWAP_ON_BE(dbuf[1]); - bmask = wxINT32_SWAP_ON_BE(dbuf[2]); - // find shift amount (Least significant bit of mask) - for (bit = bpp-1; bit>=0; bit--) - { - if (bmask & (1 << bit)) - bshift = bit; - if (gmask & (1 << bit)) - gshift = bit; - if (rmask & (1 << bit)) - rshift = bit; - } - // Find number of bits in mask (MSB-LSB+1) - for (bit = 0; bit < bpp; bit++) - { - if (bmask & (1 << bit)) - bbits = bit-bshift+1; - if (gmask & (1 << bit)) - gbits = bit-gshift+1; - if (rmask & (1 << bit)) - rbits = bit-rshift+1; - } - } - else if ( bpp == 16 ) - { - rmask = 0x7C00; - gmask = 0x03E0; - bmask = 0x001F; - rshift = 10; - gshift = 5; - bshift = 0; - rbits = 5; - gbits = 5; - bbits = 5; - } - else if ( bpp == 32 ) - { - rmask = 0x00FF0000; - gmask = 0x0000FF00; - bmask = 0x000000FF; - amask = 0xFF000000; - - ashift = 24; - rshift = 16; - gshift = 8; - bshift = 0; - abits = 8; - rbits = 8; - gbits = 8; - bbits = 8; - } - } - - /* - * Reading the image data - */ - if ( IsBmp ) - stream.SeekI(bmpOffset); // else icon, just carry on - - unsigned char *data = ptr; - - /* set the whole image to the background color */ - if ( bpp < 16 && (comp == BI_RLE4 || comp == BI_RLE8) ) - { - for (int i = 0; i < width * height; i++) - { - *ptr++ = cmap[0].r; - *ptr++ = cmap[0].g; - *ptr++ = cmap[0].b; - } - ptr = data; - } - - int linesize = ((width * bpp + 31) / 32) * 4; - - /* BMPs are stored upside down */ - for ( int line = (height - 1); line >= 0; line-- ) - { - int linepos = 0; - for ( int column = 0; column < width ; ) - { - if ( bpp < 16 ) - { - linepos++; - aByte = stream.GetC(); - if ( bpp == 1 ) - { - for (int bit = 0; bit < 8 && column < width; bit++) - { - int index = ((aByte & (0x80 >> bit)) ? 1 : 0); - ptr[poffset] = cmap[index].r; - ptr[poffset + 1] = cmap[index].g; - ptr[poffset + 2] = cmap[index].b; - column++; - } - } - else if ( bpp == 4 ) - { - if ( comp == BI_RLE4 ) - { - wxUint8 first; - first = aByte; - aByte = stream.GetC(); - if ( first == 0 ) - { - if ( aByte == 0 ) - { - if ( column > 0 ) - column = width; - } - else if ( aByte == 1 ) - { - column = width; - line = -1; - } - else if ( aByte == 2 ) - { - aByte = stream.GetC(); - column += aByte; - linepos = column * bpp / 4; - aByte = stream.GetC(); - line -= aByte; // upside down - } - else - { - int absolute = aByte; - wxUint8 nibble[2] ; - int readBytes = 0 ; - for (int k = 0; k < absolute; k++) - { - if ( !(k % 2 ) ) - { - ++readBytes ; - aByte = stream.GetC(); - nibble[0] = (wxUint8)( (aByte & 0xF0) >> 4 ) ; - nibble[1] = (wxUint8)( aByte & 0x0F ) ; - } - ptr[poffset ] = cmap[nibble[k%2]].r; - ptr[poffset + 1] = cmap[nibble[k%2]].g; - ptr[poffset + 2] = cmap[nibble[k%2]].b; - column++; - if ( k % 2 ) - linepos++; - } - if ( readBytes & 0x01 ) - aByte = stream.GetC(); - } - } - else - { - wxUint8 nibble[2] ; - nibble[0] = (wxUint8)( (aByte & 0xF0) >> 4 ) ; - nibble[1] = (wxUint8)( aByte & 0x0F ) ; - - for ( int l = 0; l < first && column < width; l++ ) - { - ptr[poffset ] = cmap[nibble[l%2]].r; - ptr[poffset + 1] = cmap[nibble[l%2]].g; - ptr[poffset + 2] = cmap[nibble[l%2]].b; - column++; - if ( l % 2 ) - linepos++; - } - } - } - else - { - for (int nibble = 0; nibble < 2 && column < width; nibble++) - { - int index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4)); - if ( index >= 16 ) - index = 15; - ptr[poffset] = cmap[index].r; - ptr[poffset + 1] = cmap[index].g; - ptr[poffset + 2] = cmap[index].b; - column++; - } - } - } - else if ( bpp == 8 ) - { - if ( comp == BI_RLE8 ) - { - unsigned char first; - first = aByte; - aByte = stream.GetC(); - if ( first == 0 ) - { - if ( aByte == 0 ) - { - /* column = width; */ - } - else if ( aByte == 1 ) - { - column = width; - line = -1; - } - else if ( aByte == 2 ) - { - aByte = stream.GetC(); - column += aByte; - linepos = column * bpp / 8; - aByte = stream.GetC(); - line += aByte; - } - else - { - int absolute = aByte; - for (int k = 0; k < absolute; k++) - { - linepos++; - aByte = stream.GetC(); - ptr[poffset ] = cmap[aByte].r; - ptr[poffset + 1] = cmap[aByte].g; - ptr[poffset + 2] = cmap[aByte].b; - column++; - } - if ( absolute & 0x01 ) - aByte = stream.GetC(); - } - } - else - { - for ( int l = 0; l < first && column < width; l++ ) - { - ptr[poffset ] = cmap[aByte].r; - ptr[poffset + 1] = cmap[aByte].g; - ptr[poffset + 2] = cmap[aByte].b; - column++; - linepos++; - } - } - } - else - { - ptr[poffset ] = cmap[aByte].r; - ptr[poffset + 1] = cmap[aByte].g; - ptr[poffset + 2] = cmap[aByte].b; - column++; - // linepos += size; seems to be wrong, RR - } - } - } - else if ( bpp == 24 ) - { - stream.Read(bbuf, 3); - linepos += 3; - ptr[poffset ] = (unsigned char)bbuf[2]; - ptr[poffset + 1] = (unsigned char)bbuf[1]; - ptr[poffset + 2] = (unsigned char)bbuf[0]; - column++; - } - else if ( bpp == 16 ) - { - unsigned char temp; - stream.Read(&aWord, 2); - aWord = wxUINT16_SWAP_ON_BE(aWord); - linepos += 2; - /* use the masks and calculated amonut of shift - to retrieve the color data out of the word. Then - shift it left by (8 - number of bits) such that - the image has the proper dynamic range */ - temp = (unsigned char)((aWord & rmask) >> rshift << (8-rbits)); - ptr[poffset] = temp; - temp = (unsigned char)((aWord & gmask) >> gshift << (8-gbits)); - ptr[poffset + 1] = temp; - temp = (unsigned char)((aWord & bmask) >> bshift << (8-bbits)); - ptr[poffset + 2] = temp; - column++; - } - else - { - unsigned char temp; - stream.Read(&aDword, 4); - aDword = wxINT32_SWAP_ON_BE(aDword); - linepos += 4; - temp = (unsigned char)((aDword & rmask) >> rshift); - ptr[poffset] = temp; - temp = (unsigned char)((aDword & gmask) >> gshift); - ptr[poffset + 1] = temp; - temp = (unsigned char)((aDword & bmask) >> bshift); - ptr[poffset + 2] = temp; - if ( alpha ) - { - temp = (unsigned char)((aDword & amask) >> ashift); - alpha[line * width + column] = temp; - } - column++; - } - } - while ( (linepos < linesize) && (comp != 1) && (comp != 2) ) - { - stream.Read(&aByte, 1); - linepos += 1; - if ( !stream ) - break; - } - } - - delete[] cmap; - - image->SetMask(false); - - const wxStreamError err = stream.GetLastError(); - return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF; -} - -bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, - bool verbose, bool IsBmp) -{ - wxUint16 aWord; - wxInt32 dbuf[4]; - wxInt8 bbuf[4]; - - wxFileOffset offset = 0; // keep gcc quiet - if ( IsBmp ) - { - // read the header off the .BMP format file - - offset = stream.TellI(); - if (offset == wxInvalidOffset) - offset = 0; - - stream.Read(bbuf, 2); - stream.Read(dbuf, 16); - } - else - { - stream.Read(dbuf, 4); - } - #if 0 // unused - wxInt32 size = wxINT32_SWAP_ON_BE(dbuf[0]); - #endif - offset = offset + wxINT32_SWAP_ON_BE(dbuf[2]); - - stream.Read(dbuf, 4 * 2); - int width = wxINT32_SWAP_ON_BE((int)dbuf[0]); - int height = wxINT32_SWAP_ON_BE((int)dbuf[1]); - if ( !IsBmp)height = height / 2; // for icons divide by 2 - - if ( width > 32767 ) - { - if (verbose) - wxLogError( _("DIB Header: Image width > 32767 pixels for file.") ); - return false; - } - if ( height > 32767 ) - { - if (verbose) - wxLogError( _("DIB Header: Image height > 32767 pixels for file.") ); - return false; - } - - stream.Read(&aWord, 2); - /* - TODO - int planes = (int)wxUINT16_SWAP_ON_BE( aWord ); - */ - stream.Read(&aWord, 2); - int bpp = wxUINT16_SWAP_ON_BE((int)aWord); - if ( bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32 ) - { - if (verbose) - wxLogError( _("DIB Header: Unknown bitdepth in file.") ); - return false; - } - - stream.Read(dbuf, 4 * 4); - int comp = wxINT32_SWAP_ON_BE((int)dbuf[0]); - if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && - comp != BI_BITFIELDS ) - { - if (verbose) - wxLogError( _("DIB Header: Unknown encoding in file.") ); - return false; - } - - stream.Read(dbuf, 4 * 2); - int ncolors = wxINT32_SWAP_ON_BE( (int)dbuf[0] ); - if (ncolors == 0) - ncolors = 1 << bpp; - /* some more sanity checks */ - if (((comp == BI_RLE4) && (bpp != 4)) || - ((comp == BI_RLE8) && (bpp != 8)) || - ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32))) - { - if (verbose) - wxLogError( _("DIB Header: Encoding doesn't match bitdepth.") ); - return false; - } - - //read DIB; this is the BMP image or the XOR part of an icon image - if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream, - verbose, IsBmp, true) ) - { - if (verbose) - wxLogError( _("Error in reading image DIB.") ); - return false; - } - - if ( !IsBmp ) - { - //read Icon mask which is monochrome - //there is no palette, so we will create one - wxImage mask; - if ( !DoLoadDib(&mask, width, height, 1, 2, BI_RGB, offset, stream, - verbose, IsBmp, false) ) - { - if (verbose) - wxLogError( _("ICO: Error in reading mask DIB.") ); - return false; - } - image->SetMaskFromImage(mask, 255, 255, 255); - - } - - return true; -} - -bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream, - bool verbose, int WXUNUSED(index)) -{ - // Read a single DIB fom the file: - return LoadDib(image, stream, verbose, true/*isBmp*/); -} - -bool wxBMPHandler::DoCanRead(wxInputStream& stream) -{ - unsigned char hdr[2]; - - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - // do we have the BMP file signature? - return hdr[0] == 'B' && hdr[1] == 'M'; -} - -#endif // wxUSE_STREAMS - - -#if wxUSE_ICO_CUR -//----------------------------------------------------------------------------- -// wxICOHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxICOHandler, wxBMPHandler) - -#if wxUSE_STREAMS - -struct ICONDIRENTRY -{ - wxUint8 bWidth; // Width of the image - wxUint8 bHeight; // Height of the image (times 2) - wxUint8 bColorCount; // Number of colors in image (0 if >=8bpp) - wxUint8 bReserved; // Reserved - - // these two are different in icons and cursors: - // icon or cursor - wxUint16 wPlanes; // Color Planes or XHotSpot - wxUint16 wBitCount; // Bits per pixel or YHotSpot - - wxUint32 dwBytesInRes; // how many bytes in this resource? - wxUint32 dwImageOffset; // where in the file is this image -}; - -struct ICONDIR -{ - wxUint16 idReserved; // Reserved - wxUint16 idType; // resource type (1 for icons, 2 for cursors) - wxUint16 idCount; // how many images? -}; - - -bool wxICOHandler::SaveFile(wxImage *image, - wxOutputStream& stream, - bool verbose) - -{ - //sanity check; icon must be less than 127 pixels high and 255 wide - if ( image->GetHeight () > 127 ) - { - if ( verbose ) - wxLogError(_("ICO: Image too tall for an icon.")); - return false; - } - if ( image->GetWidth () > 255 ) - { - if ( verbose ) - wxLogError(_("ICO: Image too wide for an icon.")); - return false; - } - - const int images = 1; // only generate one image - - // VS: This is a hack of sort - since ICO and CUR files are almost - // identical, we have all the meat in wxICOHandler and check for - // the actual (handler) type when the code has to distinguish between - // the two formats - int type = (this->GetType() == wxBITMAP_TYPE_CUR) ? 2 : 1; - - // write a header, (ICONDIR) - // Calculate the header size - wxUint32 offset = 3 * sizeof(wxUint16); - - ICONDIR IconDir; - IconDir.idReserved = 0; - IconDir.idType = wxUINT16_SWAP_ON_BE((wxUint16)type); - IconDir.idCount = wxUINT16_SWAP_ON_BE((wxUint16)images); - stream.Write(&IconDir.idReserved, sizeof(IconDir.idReserved)); - stream.Write(&IconDir.idType, sizeof(IconDir.idType)); - stream.Write(&IconDir.idCount, sizeof(IconDir.idCount)); - if ( !stream.IsOk() ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - - // for each iamage write a description ICONDIRENTRY: - ICONDIRENTRY icondirentry; - for (int img = 0; img < images; img++) - { - wxImage mask; - - if ( image->HasMask() ) - { - // make another image with black/white: - mask = image->ConvertToMono (image->GetMaskRed(), image->GetMaskGreen(), image->GetMaskBlue() ); - - // now we need to change the masked regions to black: - unsigned char r = image->GetMaskRed(); - unsigned char g = image->GetMaskGreen(); - unsigned char b = image->GetMaskBlue(); - if ( (r != 0) || (g != 0) || (b != 0) ) - { - // Go round and apply black to the masked bits: - int i, j; - for (i = 0; i < mask.GetWidth(); i++) - { - for (j = 0; j < mask.GetHeight(); j++) - { - if ((r == mask.GetRed(i, j)) && - (g == mask.GetGreen(i, j))&& - (b == mask.GetBlue(i, j)) ) - image->SetRGB(i, j, 0, 0, 0 ); - } - } - } - } - else - { - // just make a black mask all over: - mask = image->Copy(); - int i, j; - for (i = 0; i < mask.GetWidth(); i++) - for (j = 0; j < mask.GetHeight(); j++) - mask.SetRGB(i, j, 0, 0, 0 ); - } - // Set the formats for image and mask - // (Windows never saves with more than 8 colors): - image->SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_8BPP); - - // monochome bitmap: - mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW); - bool IsBmp = false; - bool IsMask = false; - - //calculate size and offset of image and mask - wxCountingOutputStream cStream; - bool bResult = SaveDib(image, cStream, verbose, IsBmp, IsMask); - if ( !bResult ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - IsMask = true; - - bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask); - if ( !bResult ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - wxUint32 Size = cStream.GetSize(); - - // wxCountingOutputStream::IsOk() always returns true for now and this - // "if" provokes VC++ warnings in optimized build -#if 0 - if ( !cStream.Ok() ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } -#endif // 0 - - offset = offset + sizeof(ICONDIRENTRY); - - icondirentry.bWidth = (wxUint8)image->GetWidth(); - icondirentry.bHeight = (wxUint8)(2 * image->GetHeight()); - icondirentry.bColorCount = 0; - icondirentry.bReserved = 0; - icondirentry.wPlanes = wxUINT16_SWAP_ON_BE(1); - icondirentry.wBitCount = wxUINT16_SWAP_ON_BE(wxBMP_8BPP); - if ( type == 2 /*CUR*/) - { - int hx = image->HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ? - image->GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) : - image->GetWidth() / 2; - int hy = image->HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ? - image->GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) : - image->GetHeight() / 2; - - // actually write the values of the hot spot here: - icondirentry.wPlanes = wxUINT16_SWAP_ON_BE((wxUint16)hx); - icondirentry.wBitCount = wxUINT16_SWAP_ON_BE((wxUint16)hy); - } - icondirentry.dwBytesInRes = wxUINT32_SWAP_ON_BE(Size); - icondirentry.dwImageOffset = wxUINT32_SWAP_ON_BE(offset); - - // increase size to allow for the data written: - offset += Size; - - // write to stream: - stream.Write(&icondirentry.bWidth, sizeof(icondirentry.bWidth)); - stream.Write(&icondirentry.bHeight, sizeof(icondirentry.bHeight)); - stream.Write(&icondirentry.bColorCount, sizeof(icondirentry.bColorCount)); - stream.Write(&icondirentry.bReserved, sizeof(icondirentry.bReserved)); - stream.Write(&icondirentry.wPlanes, sizeof(icondirentry.wPlanes)); - stream.Write(&icondirentry.wBitCount, sizeof(icondirentry.wBitCount)); - stream.Write(&icondirentry.dwBytesInRes, sizeof(icondirentry.dwBytesInRes)); - stream.Write(&icondirentry.dwImageOffset, sizeof(icondirentry.dwImageOffset)); - if ( !stream.IsOk() ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - - // actually save it: - IsMask = false; - bResult = SaveDib(image, stream, verbose, IsBmp, IsMask); - if ( !bResult ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - IsMask = true; - - bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask); - if ( !bResult ) - { - if ( verbose ) - wxLogError(_("ICO: Error writing the image file!")); - return false; - } - - } // end of for loop - - return true; -} - -bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, - bool verbose, int index) -{ - stream.SeekI(0); - return DoLoadFile(image, stream, verbose, index); -} - -bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, - bool WXUNUSED(verbose), int index) -{ - bool bResult wxDUMMY_INITIALIZE(false); - bool IsBmp = false; - - ICONDIR IconDir; - - wxFileOffset iPos = stream.TellI(); - stream.Read(&IconDir, sizeof(IconDir)); - wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount); - // nType is 1 for Icons, 2 for Cursors: - wxUint16 nType = wxUINT16_SWAP_ON_BE(IconDir.idType); - - // loop round the icons and choose the best one: - ICONDIRENTRY *pIconDirEntry = new ICONDIRENTRY[nIcons]; - ICONDIRENTRY *pCurrentEntry = pIconDirEntry; - int wMax = 0; - int colmax = 0; - int iSel = wxNOT_FOUND; - - for (int i = 0; i < nIcons; i++ ) - { - stream.Read(pCurrentEntry, sizeof(ICONDIRENTRY)); - // bHeight and bColorCount are wxUint8 - if ( pCurrentEntry->bWidth >= wMax ) - { - // see if we have more colors, ==0 indicates > 8bpp: - if ( pCurrentEntry->bColorCount == 0 ) - pCurrentEntry->bColorCount = 255; - if ( pCurrentEntry->bColorCount >= colmax ) - { - iSel = i; - wMax = pCurrentEntry->bWidth; - colmax = pCurrentEntry->bColorCount; - } - } - pCurrentEntry++; - } - - if ( index != -1 ) - { - // VS: Note that we *have* to run the loop above even if index != -1, because - // it reads ICONDIRENTRies. - iSel = index; - } - - if ( iSel == wxNOT_FOUND || iSel < 0 || iSel >= nIcons ) - { - wxLogError(_("ICO: Invalid icon index.")); - bResult = false; - } - else - { - // seek to selected icon: - pCurrentEntry = pIconDirEntry + iSel; - stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart); - bResult = LoadDib(image, stream, true, IsBmp); - bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI); - if ( bResult && bIsCursorType && nType == 2 ) - { - // it is a cursor, so let's set the hotspot: - image->SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, wxUINT16_SWAP_ON_BE(pCurrentEntry->wPlanes)); - image->SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, wxUINT16_SWAP_ON_BE(pCurrentEntry->wBitCount)); - } - } - delete[] pIconDirEntry; - return bResult; -} - -int wxICOHandler::GetImageCount(wxInputStream& stream) -{ - ICONDIR IconDir; - wxFileOffset iPos = stream.TellI(); - stream.SeekI(0); - stream.Read(&IconDir, sizeof(IconDir)); - wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount); - stream.SeekI(iPos); - return (int)nIcons; -} - -bool wxICOHandler::DoCanRead(wxInputStream& stream) -{ - stream.SeekI(0); - unsigned char hdr[4]; - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - // hdr[2] is one for an icon and two for a cursor - return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0'; -} - -#endif // wxUSE_STREAMS - - -//----------------------------------------------------------------------------- -// wxCURHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxCURHandler, wxICOHandler) - -#if wxUSE_STREAMS - -bool wxCURHandler::DoCanRead(wxInputStream& stream) -{ - stream.SeekI(0); - unsigned char hdr[4]; - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - // hdr[2] is one for an icon and two for a cursor - return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0'; -} - -#endif // wxUSE_STREAMS - -//----------------------------------------------------------------------------- -// wxANIHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler) - -#if wxUSE_STREAMS - -bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream, - bool WXUNUSED(verbose), int index) -{ - wxANIDecoder decoder; - if (!decoder.Load(stream)) - return false; - - return decoder.ConvertToImage(index != -1 ? (size_t)index : 0, image); -} - -bool wxANIHandler::DoCanRead(wxInputStream& stream) -{ - wxANIDecoder decod; - return decod.CanRead(stream); -} - -int wxANIHandler::GetImageCount(wxInputStream& stream) -{ - wxANIDecoder decoder; - if (!decoder.Load(stream)) - return wxNOT_FOUND; - - return decoder.GetFrameCount(); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_ICO_CUR - -#endif // wxUSE_IMAGE diff --git a/Source/3rdParty/wx/src/common/image.cpp b/Source/3rdParty/wx/src/common/image.cpp deleted file mode 100644 index dfc85eadb..000000000 --- a/Source/3rdParty/wx/src/common/image.cpp +++ /dev/null @@ -1,3132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/image.cpp -// Purpose: wxImage -// Author: Robert Roebling -// RCS-ID: $Id: image.cpp 59197 2009-02-28 15:44:53Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE - -#include "wx/image.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/hash.h" - #include "wx/utils.h" - #include "wx/math.h" - #include "wx/module.h" - #include "wx/palette.h" - #include "wx/intl.h" -#endif - -#include "wx/filefn.h" -#include "wx/wfstream.h" -#include "wx/xpmdecod.h" - -// For memcpy -#include - -// make the code compile with either wxFile*Stream or wxFFile*Stream: -#define HAS_FILE_STREAMS (wxUSE_STREAMS && (wxUSE_FILE || wxUSE_FFILE)) - -#if HAS_FILE_STREAMS - #if wxUSE_FFILE - typedef wxFFileInputStream wxImageFileInputStream; - typedef wxFFileOutputStream wxImageFileOutputStream; - #elif wxUSE_FILE - typedef wxFileInputStream wxImageFileInputStream; - typedef wxFileOutputStream wxImageFileOutputStream; - #endif // wxUSE_FILE/wxUSE_FFILE -#endif // HAS_FILE_STREAMS - -#if wxUSE_VARIANT -IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxImage,WXDLLEXPORT) -#endif - -//----------------------------------------------------------------------------- -// wxImage -//----------------------------------------------------------------------------- - -class wxImageRefData: public wxObjectRefData -{ -public: - wxImageRefData(); - virtual ~wxImageRefData(); - - int m_width; - int m_height; - unsigned char *m_data; - - bool m_hasMask; - unsigned char m_maskRed,m_maskGreen,m_maskBlue; - - // alpha channel data, may be NULL for the formats without alpha support - unsigned char *m_alpha; - - bool m_ok; - - // if true, m_data is pointer to static data and shouldn't be freed - bool m_static; - - // same as m_static but for m_alpha - bool m_staticAlpha; - -#if wxUSE_PALETTE - wxPalette m_palette; -#endif // wxUSE_PALETTE - - wxArrayString m_optionNames; - wxArrayString m_optionValues; - - DECLARE_NO_COPY_CLASS(wxImageRefData) -}; - -wxImageRefData::wxImageRefData() -{ - m_width = 0; - m_height = 0; - m_data = - m_alpha = (unsigned char *) NULL; - - m_maskRed = 0; - m_maskGreen = 0; - m_maskBlue = 0; - m_hasMask = false; - - m_ok = false; - m_static = - m_staticAlpha = false; -} - -wxImageRefData::~wxImageRefData() -{ - if ( !m_static ) - free( m_data ); - if ( !m_staticAlpha ) - free( m_alpha ); -} - -wxList wxImage::sm_handlers; - -wxImage wxNullImage; - -//----------------------------------------------------------------------------- - -#define M_IMGDATA wx_static_cast(wxImageRefData*, m_refData) - -IMPLEMENT_DYNAMIC_CLASS(wxImage, wxObject) - -wxImage::wxImage( int width, int height, bool clear ) -{ - Create( width, height, clear ); -} - -wxImage::wxImage( int width, int height, unsigned char* data, bool static_data ) -{ - Create( width, height, data, static_data ); -} - -wxImage::wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data ) -{ - Create( width, height, data, alpha, static_data ); -} - -wxImage::wxImage( const wxString& name, long type, int index ) -{ - LoadFile( name, type, index ); -} - -wxImage::wxImage( const wxString& name, const wxString& mimetype, int index ) -{ - LoadFile( name, mimetype, index ); -} - -#if wxUSE_STREAMS -wxImage::wxImage( wxInputStream& stream, long type, int index ) -{ - LoadFile( stream, type, index ); -} - -wxImage::wxImage( wxInputStream& stream, const wxString& mimetype, int index ) -{ - LoadFile( stream, mimetype, index ); -} -#endif // wxUSE_STREAMS - -wxImage::wxImage(const char* const* xpmData) -{ - Create(xpmData); -} - -bool wxImage::Create(const char* const* -#ifdef wxUSE_XPM - xpmData -#else - /*xpmData*/ -#endif - ) -{ -#if wxUSE_XPM - UnRef(); - - wxXPMDecoder decoder; - (*this) = decoder.ReadData(xpmData); - return Ok(); -#else - return false; -#endif -} - -bool wxImage::Create( int width, int height, bool clear ) -{ - UnRef(); - - m_refData = new wxImageRefData(); - - M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 ); - if (!M_IMGDATA->m_data) - { - UnRef(); - return false; - } - - if (clear) - memset(M_IMGDATA->m_data, 0, width*height*3); - - M_IMGDATA->m_width = width; - M_IMGDATA->m_height = height; - M_IMGDATA->m_ok = true; - - return true; -} - -bool wxImage::Create( int width, int height, unsigned char* data, bool static_data ) -{ - UnRef(); - - wxCHECK_MSG( data, false, _T("NULL data in wxImage::Create") ); - - m_refData = new wxImageRefData(); - - M_IMGDATA->m_data = data; - M_IMGDATA->m_width = width; - M_IMGDATA->m_height = height; - M_IMGDATA->m_ok = true; - M_IMGDATA->m_static = static_data; - - return true; -} - -bool wxImage::Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data ) -{ - UnRef(); - - wxCHECK_MSG( data, false, _T("NULL data in wxImage::Create") ); - - m_refData = new wxImageRefData(); - - M_IMGDATA->m_data = data; - M_IMGDATA->m_alpha = alpha; - M_IMGDATA->m_width = width; - M_IMGDATA->m_height = height; - M_IMGDATA->m_ok = true; - M_IMGDATA->m_static = static_data; - M_IMGDATA->m_staticAlpha = static_data; - - return true; -} - -void wxImage::Destroy() -{ - UnRef(); -} - -wxObjectRefData* wxImage::CreateRefData() const -{ - return new wxImageRefData; -} - -wxObjectRefData* wxImage::CloneRefData(const wxObjectRefData* that) const -{ - const wxImageRefData* refData = wx_static_cast(const wxImageRefData*, that); - wxCHECK_MSG(refData->m_ok, NULL, wxT("invalid image") ); - - wxImageRefData* refData_new = new wxImageRefData; - refData_new->m_width = refData->m_width; - refData_new->m_height = refData->m_height; - refData_new->m_maskRed = refData->m_maskRed; - refData_new->m_maskGreen = refData->m_maskGreen; - refData_new->m_maskBlue = refData->m_maskBlue; - refData_new->m_hasMask = refData->m_hasMask; - refData_new->m_ok = true; - unsigned size = unsigned(refData->m_width) * unsigned(refData->m_height); - if (refData->m_alpha != NULL) - { - refData_new->m_alpha = (unsigned char*)malloc(size); - memcpy(refData_new->m_alpha, refData->m_alpha, size); - } - size *= 3; - refData_new->m_data = (unsigned char*)malloc(size); - memcpy(refData_new->m_data, refData->m_data, size); -#if wxUSE_PALETTE - refData_new->m_palette = refData->m_palette; -#endif - refData_new->m_optionNames = refData->m_optionNames; - refData_new->m_optionValues = refData->m_optionValues; - return refData_new; -} - -wxImage wxImage::Copy() const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - image.m_refData = CloneRefData(m_refData); - - return image; -} - -wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const -{ - if( xFactor == 1 && yFactor == 1 ) - return *this; - - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - // can't scale to/from 0 size - wxCHECK_MSG( (xFactor > 0) && (yFactor > 0), image, - wxT("invalid new image size") ); - - long old_height = M_IMGDATA->m_height, - old_width = M_IMGDATA->m_width; - - wxCHECK_MSG( (old_height > 0) && (old_width > 0), image, - wxT("invalid old image size") ); - - long width = old_width / xFactor ; - long height = old_height / yFactor ; - - image.Create( width, height, false ); - - char unsigned *data = image.GetData(); - - wxCHECK_MSG( data, image, wxT("unable to create image") ); - - bool hasMask = false ; - unsigned char maskRed = 0; - unsigned char maskGreen = 0; - unsigned char maskBlue =0 ; - - unsigned char *source_data = M_IMGDATA->m_data; - unsigned char *target_data = data; - unsigned char *source_alpha = 0 ; - unsigned char *target_alpha = 0 ; - if (M_IMGDATA->m_hasMask) - { - hasMask = true ; - maskRed = M_IMGDATA->m_maskRed; - maskGreen = M_IMGDATA->m_maskGreen; - maskBlue =M_IMGDATA->m_maskBlue ; - - image.SetMaskColour( M_IMGDATA->m_maskRed, - M_IMGDATA->m_maskGreen, - M_IMGDATA->m_maskBlue ); - } - else - { - source_alpha = M_IMGDATA->m_alpha ; - if ( source_alpha ) - { - image.SetAlpha() ; - target_alpha = image.GetAlpha() ; - } - } - - for (long y = 0; y < height; y++) - { - for (long x = 0; x < width; x++) - { - unsigned long avgRed = 0 ; - unsigned long avgGreen = 0; - unsigned long avgBlue = 0; - unsigned long avgAlpha = 0 ; - unsigned long counter = 0 ; - // determine average - for ( int y1 = 0 ; y1 < yFactor ; ++y1 ) - { - long y_offset = (y * yFactor + y1) * old_width; - for ( int x1 = 0 ; x1 < xFactor ; ++x1 ) - { - unsigned char *pixel = source_data + 3 * ( y_offset + x * xFactor + x1 ) ; - unsigned char red = pixel[0] ; - unsigned char green = pixel[1] ; - unsigned char blue = pixel[2] ; - unsigned char alpha = 255 ; - if ( source_alpha ) - alpha = *(source_alpha + y_offset + x * xFactor + x1) ; - if ( !hasMask || red != maskRed || green != maskGreen || blue != maskBlue ) - { - if ( alpha > 0 ) - { - avgRed += red ; - avgGreen += green ; - avgBlue += blue ; - } - avgAlpha += alpha ; - counter++ ; - } - } - } - if ( counter == 0 ) - { - *(target_data++) = M_IMGDATA->m_maskRed ; - *(target_data++) = M_IMGDATA->m_maskGreen ; - *(target_data++) = M_IMGDATA->m_maskBlue ; - } - else - { - if ( source_alpha ) - *(target_alpha++) = (unsigned char)(avgAlpha / counter ) ; - *(target_data++) = (unsigned char)(avgRed / counter); - *(target_data++) = (unsigned char)(avgGreen / counter); - *(target_data++) = (unsigned char)(avgBlue / counter); - } - } - } - - // In case this is a cursor, make sure the hotspot is scaled accordingly: - if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ) - image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, - (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X))/xFactor); - if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ) - image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, - (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y))/yFactor); - - return image; -} - -wxImage wxImage::Scale( int width, int height, int quality ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - // can't scale to/from 0 size - wxCHECK_MSG( (width > 0) && (height > 0), image, - wxT("invalid new image size") ); - - long old_height = M_IMGDATA->m_height, - old_width = M_IMGDATA->m_width; - wxCHECK_MSG( (old_height > 0) && (old_width > 0), image, - wxT("invalid old image size") ); - - // If the image's new width and height are the same as the original, no - // need to waste time or CPU cycles - if ( old_width == width && old_height == height ) - return *this; - - // Scale the image (...or more appropriately, resample the image) using - // either the high-quality or normal method as specified - if ( quality == wxIMAGE_QUALITY_HIGH ) - { - // We need to check whether we are downsampling or upsampling the image - if ( width < old_width && height < old_height ) - { - // Downsample the image using the box averaging method for best results - image = ResampleBox(width, height); - } - else - { - // For upsampling or other random/wierd image dimensions we'll use - // a bicubic b-spline scaling method - image = ResampleBicubic(width, height); - } - } - else // Default scaling method == simple pixel replication - { - if ( old_width % width == 0 && old_width >= width && - old_height % height == 0 && old_height >= height ) - { - return ShrinkBy( old_width / width , old_height / height ) ; - } - image.Create( width, height, false ); - - unsigned char *data = image.GetData(); - - wxCHECK_MSG( data, image, wxT("unable to create image") ); - - unsigned char *source_data = M_IMGDATA->m_data; - unsigned char *target_data = data; - unsigned char *source_alpha = 0 ; - unsigned char *target_alpha = 0 ; - - if ( !M_IMGDATA->m_hasMask ) - { - source_alpha = M_IMGDATA->m_alpha ; - if ( source_alpha ) - { - image.SetAlpha() ; - target_alpha = image.GetAlpha() ; - } - } - - long x_delta = (old_width<<16) / width; - long y_delta = (old_height<<16) / height; - - unsigned char* dest_pixel = target_data; - - long y = 0; - for ( long j = 0; j < height; j++ ) - { - unsigned char* src_line = &source_data[(y>>16)*old_width*3]; - unsigned char* src_alpha_line = source_alpha ? &source_alpha[(y>>16)*old_width] : 0 ; - - long x = 0; - for ( long i = 0; i < width; i++ ) - { - unsigned char* src_pixel = &src_line[(x>>16)*3]; - unsigned char* src_alpha_pixel = source_alpha ? &src_alpha_line[(x>>16)] : 0 ; - dest_pixel[0] = src_pixel[0]; - dest_pixel[1] = src_pixel[1]; - dest_pixel[2] = src_pixel[2]; - dest_pixel += 3; - if ( source_alpha ) - *(target_alpha++) = *src_alpha_pixel ; - x += x_delta; - } - - y += y_delta; - } - } - - // If the original image has a mask, apply the mask to the new image - if (M_IMGDATA->m_hasMask) - { - image.SetMaskColour( M_IMGDATA->m_maskRed, - M_IMGDATA->m_maskGreen, - M_IMGDATA->m_maskBlue ); - } - - // In case this is a cursor, make sure the hotspot is scaled accordingly: - if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ) - image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, - (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X)*width)/old_width); - if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ) - image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, - (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y)*height)/old_height); - - return image; -} - -wxImage wxImage::ResampleBox(int width, int height) const -{ - // This function implements a simple pre-blur/box averaging method for - // downsampling that gives reasonably smooth results To scale the image - // down we will need to gather a grid of pixels of the size of the scale - // factor in each direction and then do an averaging of the pixels. - - wxImage ret_image(width, height, false); - - const double scale_factor_x = double(M_IMGDATA->m_width) / width; - const double scale_factor_y = double(M_IMGDATA->m_height) / height; - - const int scale_factor_x_2 = (int)(scale_factor_x / 2); - const int scale_factor_y_2 = (int)(scale_factor_y / 2); - - unsigned char* src_data = M_IMGDATA->m_data; - unsigned char* src_alpha = M_IMGDATA->m_alpha; - unsigned char* dst_data = ret_image.GetData(); - unsigned char* dst_alpha = NULL; - - if ( src_alpha ) - { - ret_image.SetAlpha(); - dst_alpha = ret_image.GetAlpha(); - } - - int averaged_pixels, src_pixel_index; - double sum_r, sum_g, sum_b, sum_a; - - for ( int y = 0; y < height; y++ ) // Destination image - Y direction - { - // Source pixel in the Y direction - int src_y = (int)(y * scale_factor_y); - - for ( int x = 0; x < width; x++ ) // Destination image - X direction - { - // Source pixel in the X direction - int src_x = (int)(x * scale_factor_x); - - // Box of pixels to average - averaged_pixels = 0; - sum_r = sum_g = sum_b = sum_a = 0.0; - - for ( int j = int(src_y - scale_factor_y/2.0 + 1); - j <= int(src_y + scale_factor_y_2); - j++ ) - { - // We don't care to average pixels that don't exist (edges) - if ( j < 0 || j > M_IMGDATA->m_height - 1 ) - continue; - - for ( int i = int(src_x - scale_factor_x/2.0 + 1); - i <= src_x + scale_factor_x_2; - i++ ) - { - // Don't average edge pixels - if ( i < 0 || i > M_IMGDATA->m_width - 1 ) - continue; - - // Calculate the actual index in our source pixels - src_pixel_index = j * M_IMGDATA->m_width + i; - - sum_r += src_data[src_pixel_index * 3 + 0]; - sum_g += src_data[src_pixel_index * 3 + 1]; - sum_b += src_data[src_pixel_index * 3 + 2]; - if ( src_alpha ) - sum_a += src_alpha[src_pixel_index]; - - averaged_pixels++; - } - } - - // Calculate the average from the sum and number of averaged pixels - dst_data[0] = (unsigned char)(sum_r / averaged_pixels); - dst_data[1] = (unsigned char)(sum_g / averaged_pixels); - dst_data[2] = (unsigned char)(sum_b / averaged_pixels); - dst_data += 3; - if ( src_alpha ) - *dst_alpha++ = (unsigned char)(sum_a / averaged_pixels); - } - } - - return ret_image; -} - -// The following two local functions are for the B-spline weighting of the -// bicubic sampling algorithm -static inline double spline_cube(double value) -{ - return value <= 0.0 ? 0.0 : value * value * value; -} - -static inline double spline_weight(double value) -{ - return (spline_cube(value + 2) - - 4 * spline_cube(value + 1) + - 6 * spline_cube(value) - - 4 * spline_cube(value - 1)) / 6; -} - -// This is the bicubic resampling algorithm -wxImage wxImage::ResampleBicubic(int width, int height) const -{ - // This function implements a Bicubic B-Spline algorithm for resampling. - // This method is certainly a little slower than wxImage's default pixel - // replication method, however for most reasonably sized images not being - // upsampled too much on a fairly average CPU this difference is hardly - // noticeable and the results are far more pleasing to look at. - // - // This particular bicubic algorithm does pixel weighting according to a - // B-Spline that basically implements a Gaussian bell-like weighting - // kernel. Because of this method the results may appear a bit blurry when - // upsampling by large factors. This is basically because a slight - // gaussian blur is being performed to get the smooth look of the upsampled - // image. - - // Edge pixels: 3-4 possible solutions - // - (Wrap/tile) Wrap the image, take the color value from the opposite - // side of the image. - // - (Mirror) Duplicate edge pixels, so that pixel at coordinate (2, n), - // where n is nonpositive, will have the value of (2, 1). - // - (Ignore) Simply ignore the edge pixels and apply the kernel only to - // pixels which do have all neighbours. - // - (Clamp) Choose the nearest pixel along the border. This takes the - // border pixels and extends them out to infinity. - // - // NOTE: below the y_offset and x_offset variables are being set for edge - // pixels using the "Mirror" method mentioned above - - wxImage ret_image; - - ret_image.Create(width, height, false); - - unsigned char* src_data = M_IMGDATA->m_data; - unsigned char* src_alpha = M_IMGDATA->m_alpha; - unsigned char* dst_data = ret_image.GetData(); - unsigned char* dst_alpha = NULL; - - if ( src_alpha ) - { - ret_image.SetAlpha(); - dst_alpha = ret_image.GetAlpha(); - } - - for ( int dsty = 0; dsty < height; dsty++ ) - { - // We need to calculate the source pixel to interpolate from - Y-axis - double srcpixy = double(dsty * M_IMGDATA->m_height) / height; - double dy = srcpixy - (int)srcpixy; - - for ( int dstx = 0; dstx < width; dstx++ ) - { - // X-axis of pixel to interpolate from - double srcpixx = double(dstx * M_IMGDATA->m_width) / width; - double dx = srcpixx - (int)srcpixx; - - // Sums for each color channel - double sum_r = 0, sum_g = 0, sum_b = 0, sum_a = 0; - - // Here we actually determine the RGBA values for the destination pixel - for ( int k = -1; k <= 2; k++ ) - { - // Y offset - int y_offset = srcpixy + k < 0.0 - ? 0 - : srcpixy + k >= M_IMGDATA->m_height - ? M_IMGDATA->m_height - 1 - : (int)(srcpixy + k); - - // Loop across the X axis - for ( int i = -1; i <= 2; i++ ) - { - // X offset - int x_offset = srcpixx + i < 0.0 - ? 0 - : srcpixx + i >= M_IMGDATA->m_width - ? M_IMGDATA->m_width - 1 - : (int)(srcpixx + i); - - // Calculate the exact position where the source data - // should be pulled from based on the x_offset and y_offset - int src_pixel_index = y_offset*M_IMGDATA->m_width + x_offset; - - // Calculate the weight for the specified pixel according - // to the bicubic b-spline kernel we're using for - // interpolation - double - pixel_weight = spline_weight(i - dx)*spline_weight(k - dy); - - // Create a sum of all velues for each color channel - // adjusted for the pixel's calculated weight - sum_r += src_data[src_pixel_index * 3 + 0] * pixel_weight; - sum_g += src_data[src_pixel_index * 3 + 1] * pixel_weight; - sum_b += src_data[src_pixel_index * 3 + 2] * pixel_weight; - if ( src_alpha ) - sum_a += src_alpha[src_pixel_index] * pixel_weight; - } - } - - // Put the data into the destination image. The summed values are - // of double data type and are rounded here for accuracy - dst_data[0] = (unsigned char)(sum_r + 0.5); - dst_data[1] = (unsigned char)(sum_g + 0.5); - dst_data[2] = (unsigned char)(sum_b + 0.5); - dst_data += 3; - - if ( src_alpha ) - *dst_alpha++ = (unsigned char)sum_a; - } - } - - return ret_image; -} - -// Blur in the horizontal direction -wxImage wxImage::BlurHorizontal(int blurRadius) -{ - wxImage ret_image; - ret_image.Create(M_IMGDATA->m_width, M_IMGDATA->m_height, false); - - unsigned char* src_data = M_IMGDATA->m_data; - unsigned char* dst_data = ret_image.GetData(); - unsigned char* src_alpha = M_IMGDATA->m_alpha; - unsigned char* dst_alpha = NULL; - - // Check for a mask or alpha - if ( M_IMGDATA->m_hasMask ) - { - ret_image.SetMaskColour(M_IMGDATA->m_maskRed, - M_IMGDATA->m_maskGreen, - M_IMGDATA->m_maskBlue); - } - else - { - if ( src_alpha ) - { - ret_image.SetAlpha(); - dst_alpha = ret_image.GetAlpha(); - } - } - - // number of pixels we average over - const int blurArea = blurRadius*2 + 1; - - // Horizontal blurring algorithm - average all pixels in the specified blur - // radius in the X or horizontal direction - for ( int y = 0; y < M_IMGDATA->m_height; y++ ) - { - // Variables used in the blurring algorithm - long sum_r = 0, - sum_g = 0, - sum_b = 0, - sum_a = 0; - - long pixel_idx; - const unsigned char *src; - unsigned char *dst; - - // Calculate the average of all pixels in the blur radius for the first - // pixel of the row - for ( int kernel_x = -blurRadius; kernel_x <= blurRadius; kernel_x++ ) - { - // To deal with the pixels at the start of a row so it's not - // grabbing GOK values from memory at negative indices of the - // image's data or grabbing from the previous row - if ( kernel_x < 0 ) - pixel_idx = y * M_IMGDATA->m_width; - else - pixel_idx = kernel_x + y * M_IMGDATA->m_width; - - src = src_data + pixel_idx*3; - sum_r += src[0]; - sum_g += src[1]; - sum_b += src[2]; - if ( src_alpha ) - sum_a += src_alpha[pixel_idx]; - } - - dst = dst_data + y * M_IMGDATA->m_width*3; - dst[0] = (unsigned char)(sum_r / blurArea); - dst[1] = (unsigned char)(sum_g / blurArea); - dst[2] = (unsigned char)(sum_b / blurArea); - if ( src_alpha ) - dst_alpha[y * M_IMGDATA->m_width] = (unsigned char)(sum_a / blurArea); - - // Now average the values of the rest of the pixels by just moving the - // blur radius box along the row - for ( int x = 1; x < M_IMGDATA->m_width; x++ ) - { - // Take care of edge pixels on the left edge by essentially - // duplicating the edge pixel - if ( x - blurRadius - 1 < 0 ) - pixel_idx = y * M_IMGDATA->m_width; - else - pixel_idx = (x - blurRadius - 1) + y * M_IMGDATA->m_width; - - // Subtract the value of the pixel at the left side of the blur - // radius box - src = src_data + pixel_idx*3; - sum_r -= src[0]; - sum_g -= src[1]; - sum_b -= src[2]; - if ( src_alpha ) - sum_a -= src_alpha[pixel_idx]; - - // Take care of edge pixels on the right edge - if ( x + blurRadius > M_IMGDATA->m_width - 1 ) - pixel_idx = M_IMGDATA->m_width - 1 + y * M_IMGDATA->m_width; - else - pixel_idx = x + blurRadius + y * M_IMGDATA->m_width; - - // Add the value of the pixel being added to the end of our box - src = src_data + pixel_idx*3; - sum_r += src[0]; - sum_g += src[1]; - sum_b += src[2]; - if ( src_alpha ) - sum_a += src_alpha[pixel_idx]; - - // Save off the averaged data - dst = dst_data + x*3 + y*M_IMGDATA->m_width*3; - dst[0] = (unsigned char)(sum_r / blurArea); - dst[1] = (unsigned char)(sum_g / blurArea); - dst[2] = (unsigned char)(sum_b / blurArea); - if ( src_alpha ) - dst_alpha[x + y * M_IMGDATA->m_width] = (unsigned char)(sum_a / blurArea); - } - } - - return ret_image; -} - -// Blur in the vertical direction -wxImage wxImage::BlurVertical(int blurRadius) -{ - wxImage ret_image; - ret_image.Create(M_IMGDATA->m_width, M_IMGDATA->m_height, false); - - unsigned char* src_data = M_IMGDATA->m_data; - unsigned char* dst_data = ret_image.GetData(); - unsigned char* src_alpha = M_IMGDATA->m_alpha; - unsigned char* dst_alpha = NULL; - - // Check for a mask or alpha - if ( M_IMGDATA->m_hasMask ) - { - ret_image.SetMaskColour(M_IMGDATA->m_maskRed, - M_IMGDATA->m_maskGreen, - M_IMGDATA->m_maskBlue); - } - else - { - if ( src_alpha ) - { - ret_image.SetAlpha(); - dst_alpha = ret_image.GetAlpha(); - } - } - - // number of pixels we average over - const int blurArea = blurRadius*2 + 1; - - // Vertical blurring algorithm - same as horizontal but switched the - // opposite direction - for ( int x = 0; x < M_IMGDATA->m_width; x++ ) - { - // Variables used in the blurring algorithm - long sum_r = 0, - sum_g = 0, - sum_b = 0, - sum_a = 0; - - long pixel_idx; - const unsigned char *src; - unsigned char *dst; - - // Calculate the average of all pixels in our blur radius box for the - // first pixel of the column - for ( int kernel_y = -blurRadius; kernel_y <= blurRadius; kernel_y++ ) - { - // To deal with the pixels at the start of a column so it's not - // grabbing GOK values from memory at negative indices of the - // image's data or grabbing from the previous column - if ( kernel_y < 0 ) - pixel_idx = x; - else - pixel_idx = x + kernel_y * M_IMGDATA->m_width; - - src = src_data + pixel_idx*3; - sum_r += src[0]; - sum_g += src[1]; - sum_b += src[2]; - if ( src_alpha ) - sum_a += src_alpha[pixel_idx]; - } - - dst = dst_data + x*3; - dst[0] = (unsigned char)(sum_r / blurArea); - dst[1] = (unsigned char)(sum_g / blurArea); - dst[2] = (unsigned char)(sum_b / blurArea); - if ( src_alpha ) - dst_alpha[x] = (unsigned char)(sum_a / blurArea); - - // Now average the values of the rest of the pixels by just moving the - // box along the column from top to bottom - for ( int y = 1; y < M_IMGDATA->m_height; y++ ) - { - // Take care of pixels that would be beyond the top edge by - // duplicating the top edge pixel for the column - if ( y - blurRadius - 1 < 0 ) - pixel_idx = x; - else - pixel_idx = x + (y - blurRadius - 1) * M_IMGDATA->m_width; - - // Subtract the value of the pixel at the top of our blur radius box - src = src_data + pixel_idx*3; - sum_r -= src[0]; - sum_g -= src[1]; - sum_b -= src[2]; - if ( src_alpha ) - sum_a -= src_alpha[pixel_idx]; - - // Take care of the pixels that would be beyond the bottom edge of - // the image similar to the top edge - if ( y + blurRadius > M_IMGDATA->m_height - 1 ) - pixel_idx = x + (M_IMGDATA->m_height - 1) * M_IMGDATA->m_width; - else - pixel_idx = x + (blurRadius + y) * M_IMGDATA->m_width; - - // Add the value of the pixel being added to the end of our box - src = src_data + pixel_idx*3; - sum_r += src[0]; - sum_g += src[1]; - sum_b += src[2]; - if ( src_alpha ) - sum_a += src_alpha[pixel_idx]; - - // Save off the averaged data - dst = dst_data + (x + y * M_IMGDATA->m_width) * 3; - dst[0] = (unsigned char)(sum_r / blurArea); - dst[1] = (unsigned char)(sum_g / blurArea); - dst[2] = (unsigned char)(sum_b / blurArea); - if ( src_alpha ) - dst_alpha[x + y * M_IMGDATA->m_width] = (unsigned char)(sum_a / blurArea); - } - } - - return ret_image; -} - -// The new blur function -wxImage wxImage::Blur(int blurRadius) -{ - wxImage ret_image; - ret_image.Create(M_IMGDATA->m_width, M_IMGDATA->m_height, false); - - // Blur the image in each direction - ret_image = BlurHorizontal(blurRadius); - ret_image = ret_image.BlurVertical(blurRadius); - - return ret_image; -} - -wxImage wxImage::Rotate90( bool clockwise ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - image.Create( M_IMGDATA->m_height, M_IMGDATA->m_width, false ); - - unsigned char *data = image.GetData(); - - wxCHECK_MSG( data, image, wxT("unable to create image") ); - - unsigned char *source_data = M_IMGDATA->m_data; - unsigned char *target_data; - unsigned char *alpha_data = 0 ; - unsigned char *source_alpha = 0 ; - unsigned char *target_alpha = 0 ; - - if (M_IMGDATA->m_hasMask) - { - image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); - } - else - { - source_alpha = M_IMGDATA->m_alpha ; - if ( source_alpha ) - { - image.SetAlpha() ; - alpha_data = image.GetAlpha() ; - } - } - - long height = M_IMGDATA->m_height; - long width = M_IMGDATA->m_width; - - for (long j = 0; j < height; j++) - { - for (long i = 0; i < width; i++) - { - if (clockwise) - { - target_data = data + (((i+1)*height) - j - 1)*3; - if(source_alpha) - target_alpha = alpha_data + (((i+1)*height) - j - 1); - } - else - { - target_data = data + ((height*(width-1)) + j - (i*height))*3; - if(source_alpha) - target_alpha = alpha_data + ((height*(width-1)) + j - (i*height)); - } - memcpy( target_data, source_data, 3 ); - source_data += 3; - - if(source_alpha) - { - memcpy( target_alpha, source_alpha, 1 ); - source_alpha += 1; - } - } - } - - return image; -} - -wxImage wxImage::Mirror( bool horizontally ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - image.Create( M_IMGDATA->m_width, M_IMGDATA->m_height, false ); - - unsigned char *data = image.GetData(); - unsigned char *alpha = NULL; - - wxCHECK_MSG( data, image, wxT("unable to create image") ); - - if (M_IMGDATA->m_alpha != NULL) { - image.SetAlpha(); - alpha = image.GetAlpha(); - wxCHECK_MSG( alpha, image, wxT("unable to create alpha channel") ); - } - - if (M_IMGDATA->m_hasMask) - image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); - - long height = M_IMGDATA->m_height; - long width = M_IMGDATA->m_width; - - unsigned char *source_data = M_IMGDATA->m_data; - unsigned char *target_data; - - if (horizontally) - { - for (long j = 0; j < height; j++) - { - data += width*3; - target_data = data-3; - for (long i = 0; i < width; i++) - { - memcpy( target_data, source_data, 3 ); - source_data += 3; - target_data -= 3; - } - } - - if (alpha != NULL) - { - // src_alpha starts at the first pixel and increases by 1 after each step - // (a step here is the copy of the alpha value of one pixel) - const unsigned char *src_alpha = M_IMGDATA->m_alpha; - // dest_alpha starts just beyond the first line, decreases before each step, - // and after each line is finished, increases by 2 widths (skipping the line - // just copied and the line that will be copied next) - unsigned char *dest_alpha = alpha + width; - - for (long jj = 0; jj < height; ++jj) - { - for (long i = 0; i < width; ++i) { - *(--dest_alpha) = *(src_alpha++); // copy one pixel - } - dest_alpha += 2 * width; // advance beyond the end of the next line - } - } - } - else - { - for (long i = 0; i < height; i++) - { - target_data = data + 3*width*(height-1-i); - memcpy( target_data, source_data, (size_t)3*width ); - source_data += 3*width; - } - - if (alpha != NULL) - { - // src_alpha starts at the first pixel and increases by 1 width after each step - // (a step here is the copy of the alpha channel of an entire line) - const unsigned char *src_alpha = M_IMGDATA->m_alpha; - // dest_alpha starts just beyond the last line (beyond the whole image) - // and decreases by 1 width before each step - unsigned char *dest_alpha = alpha + width * height; - - for (long jj = 0; jj < height; ++jj) - { - dest_alpha -= width; - memcpy( dest_alpha, src_alpha, (size_t)width ); - src_alpha += width; - } - } - } - - return image; -} - -wxImage wxImage::GetSubImage( const wxRect &rect ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && - (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()), - image, wxT("invalid subimage size") ); - - const int subwidth = rect.GetWidth(); - const int subheight = rect.GetHeight(); - - image.Create( subwidth, subheight, false ); - - const unsigned char *src_data = GetData(); - const unsigned char *src_alpha = M_IMGDATA->m_alpha; - unsigned char *subdata = image.GetData(); - unsigned char *subalpha = NULL; - - wxCHECK_MSG( subdata, image, wxT("unable to create image") ); - - if (src_alpha != NULL) { - image.SetAlpha(); - subalpha = image.GetAlpha(); - wxCHECK_MSG( subalpha, image, wxT("unable to create alpha channel")); - } - - if (M_IMGDATA->m_hasMask) - image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); - - const int width = GetWidth(); - const int pixsoff = rect.GetLeft() + width * rect.GetTop(); - - src_data += 3 * pixsoff; - src_alpha += pixsoff; // won't be used if was NULL, so this is ok - - for (long j = 0; j < subheight; ++j) - { - memcpy( subdata, src_data, 3 * subwidth ); - subdata += 3 * subwidth; - src_data += 3 * width; - if (subalpha != NULL) { - memcpy( subalpha, src_alpha, subwidth ); - subalpha += subwidth; - src_alpha += width; - } - } - - return image; -} - -wxImage wxImage::Size( const wxSize& size, const wxPoint& pos, - int r_, int g_, int b_ ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - wxCHECK_MSG( (size.GetWidth() > 0) && (size.GetHeight() > 0), image, wxT("invalid size") ); - - int width = GetWidth(), height = GetHeight(); - image.Create(size.GetWidth(), size.GetHeight(), false); - - unsigned char r = (unsigned char)r_; - unsigned char g = (unsigned char)g_; - unsigned char b = (unsigned char)b_; - if ((r_ == -1) && (g_ == -1) && (b_ == -1)) - { - GetOrFindMaskColour( &r, &g, &b ); - image.SetMaskColour(r, g, b); - } - - image.SetRGB(wxRect(), r, g, b); - - wxRect subRect(pos.x, pos.y, width, height); - wxRect finalRect(0, 0, size.GetWidth(), size.GetHeight()); - if (pos.x < 0) - finalRect.width -= pos.x; - if (pos.y < 0) - finalRect.height -= pos.y; - - subRect.Intersect(finalRect); - - if (!subRect.IsEmpty()) - { - if ((subRect.GetWidth() == width) && (subRect.GetHeight() == height)) - image.Paste(*this, pos.x, pos.y); - else - image.Paste(GetSubImage(subRect), pos.x, pos.y); - } - - return image; -} - -void wxImage::Paste( const wxImage &image, int x, int y ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - wxCHECK_RET( image.Ok(), wxT("invalid image") ); - - AllocExclusive(); - - int xx = 0; - int yy = 0; - int width = image.GetWidth(); - int height = image.GetHeight(); - - if (x < 0) - { - xx = -x; - width += x; - } - if (y < 0) - { - yy = -y; - height += y; - } - - if ((x+xx)+width > M_IMGDATA->m_width) - width = M_IMGDATA->m_width - (x+xx); - if ((y+yy)+height > M_IMGDATA->m_height) - height = M_IMGDATA->m_height - (y+yy); - - if (width < 1) return; - if (height < 1) return; - - if ((!HasMask() && !image.HasMask()) || - (HasMask() && !image.HasMask()) || - ((HasMask() && image.HasMask() && - (GetMaskRed()==image.GetMaskRed()) && - (GetMaskGreen()==image.GetMaskGreen()) && - (GetMaskBlue()==image.GetMaskBlue())))) - { - unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth(); - int source_step = image.GetWidth()*3; - - unsigned char* target_data = GetData() + (x+xx)*3 + (y+yy)*3*M_IMGDATA->m_width; - int target_step = M_IMGDATA->m_width*3; - for (int j = 0; j < height; j++) - { - memcpy( target_data, source_data, width*3 ); - source_data += source_step; - target_data += target_step; - } - } - - // Copy over the alpha channel from the original image - if ( image.HasAlpha() ) - { - if ( !HasAlpha() ) - InitAlpha(); - - unsigned char* source_data = image.GetAlpha() + xx + yy*image.GetWidth(); - int source_step = image.GetWidth(); - - unsigned char* target_data = GetAlpha() + (x+xx) + (y+yy)*M_IMGDATA->m_width; - int target_step = M_IMGDATA->m_width; - - for (int j = 0; j < height; j++, - source_data += source_step, - target_data += target_step) - { - memcpy( target_data, source_data, width ); - } - } - - if (!HasMask() && image.HasMask()) - { - unsigned char r = image.GetMaskRed(); - unsigned char g = image.GetMaskGreen(); - unsigned char b = image.GetMaskBlue(); - - unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth(); - int source_step = image.GetWidth()*3; - - unsigned char* target_data = GetData() + (x+xx)*3 + (y+yy)*3*M_IMGDATA->m_width; - int target_step = M_IMGDATA->m_width*3; - - for (int j = 0; j < height; j++) - { - for (int i = 0; i < width*3; i+=3) - { - if ((source_data[i] != r) || - (source_data[i+1] != g) || - (source_data[i+2] != b)) - { - memcpy( target_data+i, source_data+i, 3 ); - } - } - source_data += source_step; - target_data += target_step; - } - } -} - -void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1, - unsigned char r2, unsigned char g2, unsigned char b2 ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - unsigned char *data = GetData(); - - const int w = GetWidth(); - const int h = GetHeight(); - - for (int j = 0; j < h; j++) - for (int i = 0; i < w; i++) - { - if ((data[0] == r1) && (data[1] == g1) && (data[2] == b1)) - { - data[0] = r2; - data[1] = g2; - data[2] = b2; - } - data += 3; - } -} - -wxImage wxImage::ConvertToGreyscale( double lr, double lg, double lb ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - image.Create(M_IMGDATA->m_width, M_IMGDATA->m_height, false); - - unsigned char *dest = image.GetData(); - - wxCHECK_MSG( dest, image, wxT("unable to create image") ); - - unsigned char *src = M_IMGDATA->m_data; - bool hasMask = M_IMGDATA->m_hasMask; - unsigned char maskRed = M_IMGDATA->m_maskRed; - unsigned char maskGreen = M_IMGDATA->m_maskGreen; - unsigned char maskBlue = M_IMGDATA->m_maskBlue; - - if ( hasMask ) - image.SetMaskColour(maskRed, maskGreen, maskBlue); - - const long size = M_IMGDATA->m_width * M_IMGDATA->m_height; - for ( long i = 0; i < size; i++, src += 3, dest += 3 ) - { - // don't modify the mask - if ( hasMask && src[0] == maskRed && src[1] == maskGreen && src[2] == maskBlue ) - { - memcpy(dest, src, 3); - } - else - { - // calculate the luma - double luma = (src[0] * lr + src[1] * lg + src[2] * lb) + 0.5; - dest[0] = dest[1] = dest[2] = wx_static_cast(unsigned char, luma); - } - } - - // copy the alpha channel, if any - if (HasAlpha()) - { - const size_t alphaSize = GetWidth() * GetHeight(); - unsigned char *alpha = (unsigned char*)malloc(alphaSize); - memcpy(alpha, GetAlpha(), alphaSize); - image.InitAlpha(); - image.SetAlpha(alpha); - } - - return image; -} - -wxImage wxImage::ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const -{ - wxImage image; - - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - - image.Create( M_IMGDATA->m_width, M_IMGDATA->m_height, false ); - - unsigned char *data = image.GetData(); - - wxCHECK_MSG( data, image, wxT("unable to create image") ); - - if (M_IMGDATA->m_hasMask) - { - if (M_IMGDATA->m_maskRed == r && M_IMGDATA->m_maskGreen == g && - M_IMGDATA->m_maskBlue == b) - image.SetMaskColour( 255, 255, 255 ); - else - image.SetMaskColour( 0, 0, 0 ); - } - - long size = M_IMGDATA->m_height * M_IMGDATA->m_width; - - unsigned char *srcd = M_IMGDATA->m_data; - unsigned char *tard = image.GetData(); - - for ( long i = 0; i < size; i++, srcd += 3, tard += 3 ) - { - if (srcd[0] == r && srcd[1] == g && srcd[2] == b) - tard[0] = tard[1] = tard[2] = 255; - else - tard[0] = tard[1] = tard[2] = 0; - } - - return image; -} - -int wxImage::GetWidth() const -{ - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); - - return M_IMGDATA->m_width; -} - -int wxImage::GetHeight() const -{ - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); - - return M_IMGDATA->m_height; -} - -long wxImage::XYToIndex(int x, int y) const -{ - if ( Ok() && - x >= 0 && y >= 0 && - x < M_IMGDATA->m_width && y < M_IMGDATA->m_height ) - { - return y*M_IMGDATA->m_width + x; - } - - return -1; -} - -void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ) -{ - long pos = XYToIndex(x, y); - wxCHECK_RET( pos != -1, wxT("invalid image coordinates") ); - - AllocExclusive(); - - pos *= 3; - - M_IMGDATA->m_data[ pos ] = r; - M_IMGDATA->m_data[ pos+1 ] = g; - M_IMGDATA->m_data[ pos+2 ] = b; -} - -void wxImage::SetRGB( const wxRect& rect_, unsigned char r, unsigned char g, unsigned char b ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - wxRect rect(rect_); - wxRect imageRect(0, 0, GetWidth(), GetHeight()); - if ( rect == wxRect() ) - { - rect = imageRect; - } - else - { - wxCHECK_RET( imageRect.Contains(rect.GetTopLeft()) && - imageRect.Contains(rect.GetBottomRight()), - wxT("invalid bounding rectangle") ); - } - - int x1 = rect.GetLeft(), - y1 = rect.GetTop(), - x2 = rect.GetRight() + 1, - y2 = rect.GetBottom() + 1; - - unsigned char *data wxDUMMY_INITIALIZE(NULL); - int x, y, width = GetWidth(); - for (y = y1; y < y2; y++) - { - data = M_IMGDATA->m_data + (y*width + x1)*3; - for (x = x1; x < x2; x++) - { - *data++ = r; - *data++ = g; - *data++ = b; - } - } -} - -unsigned char wxImage::GetRed( int x, int y ) const -{ - long pos = XYToIndex(x, y); - wxCHECK_MSG( pos != -1, 0, wxT("invalid image coordinates") ); - - pos *= 3; - - return M_IMGDATA->m_data[pos]; -} - -unsigned char wxImage::GetGreen( int x, int y ) const -{ - long pos = XYToIndex(x, y); - wxCHECK_MSG( pos != -1, 0, wxT("invalid image coordinates") ); - - pos *= 3; - - return M_IMGDATA->m_data[pos+1]; -} - -unsigned char wxImage::GetBlue( int x, int y ) const -{ - long pos = XYToIndex(x, y); - wxCHECK_MSG( pos != -1, 0, wxT("invalid image coordinates") ); - - pos *= 3; - - return M_IMGDATA->m_data[pos+2]; -} - -bool wxImage::IsOk() const -{ - // image of 0 width or height can't be considered ok - at least because it - // causes crashes in ConvertToBitmap() if we don't catch it in time - wxImageRefData *data = M_IMGDATA; - return data && data->m_ok && data->m_width && data->m_height; -} - -unsigned char *wxImage::GetData() const -{ - wxCHECK_MSG( Ok(), (unsigned char *)NULL, wxT("invalid image") ); - - return M_IMGDATA->m_data; -} - -void wxImage::SetData( unsigned char *data, bool static_data ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - wxImageRefData *newRefData = new wxImageRefData(); - - newRefData->m_width = M_IMGDATA->m_width; - newRefData->m_height = M_IMGDATA->m_height; - newRefData->m_data = data; - newRefData->m_ok = true; - newRefData->m_maskRed = M_IMGDATA->m_maskRed; - newRefData->m_maskGreen = M_IMGDATA->m_maskGreen; - newRefData->m_maskBlue = M_IMGDATA->m_maskBlue; - newRefData->m_hasMask = M_IMGDATA->m_hasMask; - newRefData->m_static = static_data; - - UnRef(); - - m_refData = newRefData; -} - -void wxImage::SetData( unsigned char *data, int new_width, int new_height, bool static_data ) -{ - wxImageRefData *newRefData = new wxImageRefData(); - - if (m_refData) - { - newRefData->m_width = new_width; - newRefData->m_height = new_height; - newRefData->m_data = data; - newRefData->m_ok = true; - newRefData->m_maskRed = M_IMGDATA->m_maskRed; - newRefData->m_maskGreen = M_IMGDATA->m_maskGreen; - newRefData->m_maskBlue = M_IMGDATA->m_maskBlue; - newRefData->m_hasMask = M_IMGDATA->m_hasMask; - } - else - { - newRefData->m_width = new_width; - newRefData->m_height = new_height; - newRefData->m_data = data; - newRefData->m_ok = true; - } - newRefData->m_static = static_data; - - UnRef(); - - m_refData = newRefData; -} - -// ---------------------------------------------------------------------------- -// alpha channel support -// ---------------------------------------------------------------------------- - -void wxImage::SetAlpha(int x, int y, unsigned char alpha) -{ - wxCHECK_RET( HasAlpha(), wxT("no alpha channel") ); - - long pos = XYToIndex(x, y); - wxCHECK_RET( pos != -1, wxT("invalid image coordinates") ); - - AllocExclusive(); - - M_IMGDATA->m_alpha[pos] = alpha; -} - -unsigned char wxImage::GetAlpha(int x, int y) const -{ - wxCHECK_MSG( HasAlpha(), 0, wxT("no alpha channel") ); - - long pos = XYToIndex(x, y); - wxCHECK_MSG( pos != -1, 0, wxT("invalid image coordinates") ); - - return M_IMGDATA->m_alpha[pos]; -} - -bool -wxImage::ConvertColourToAlpha(unsigned char r, unsigned char g, unsigned char b) -{ - SetAlpha(NULL); - - const int w = M_IMGDATA->m_width; - const int h = M_IMGDATA->m_height; - - unsigned char *alpha = GetAlpha(); - unsigned char *data = GetData(); - - for ( int y = 0; y < h; y++ ) - { - for ( int x = 0; x < w; x++ ) - { - *alpha++ = *data; - *data++ = r; - *data++ = g; - *data++ = b; - } - } - - return true; -} - -void wxImage::SetAlpha( unsigned char *alpha, bool static_data ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - if ( !alpha ) - { - alpha = (unsigned char *)malloc(M_IMGDATA->m_width*M_IMGDATA->m_height); - } - - if( !M_IMGDATA->m_staticAlpha ) - free(M_IMGDATA->m_alpha); - - M_IMGDATA->m_alpha = alpha; - M_IMGDATA->m_staticAlpha = static_data; -} - -unsigned char *wxImage::GetAlpha() const -{ - wxCHECK_MSG( Ok(), (unsigned char *)NULL, wxT("invalid image") ); - - return M_IMGDATA->m_alpha; -} - -void wxImage::InitAlpha() -{ - wxCHECK_RET( !HasAlpha(), wxT("image already has an alpha channel") ); - - // initialize memory for alpha channel - SetAlpha(); - - unsigned char *alpha = M_IMGDATA->m_alpha; - const size_t lenAlpha = M_IMGDATA->m_width * M_IMGDATA->m_height; - - if ( HasMask() ) - { - // use the mask to initialize the alpha channel. - const unsigned char * const alphaEnd = alpha + lenAlpha; - - const unsigned char mr = M_IMGDATA->m_maskRed; - const unsigned char mg = M_IMGDATA->m_maskGreen; - const unsigned char mb = M_IMGDATA->m_maskBlue; - for ( unsigned char *src = M_IMGDATA->m_data; - alpha < alphaEnd; - src += 3, alpha++ ) - { - *alpha = (src[0] == mr && src[1] == mg && src[2] == mb) - ? wxIMAGE_ALPHA_TRANSPARENT - : wxIMAGE_ALPHA_OPAQUE; - } - - M_IMGDATA->m_hasMask = false; - } - else // no mask - { - // make the image fully opaque - memset(alpha, wxIMAGE_ALPHA_OPAQUE, lenAlpha); - } -} - -// ---------------------------------------------------------------------------- -// mask support -// ---------------------------------------------------------------------------- - -void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - M_IMGDATA->m_maskRed = r; - M_IMGDATA->m_maskGreen = g; - M_IMGDATA->m_maskBlue = b; - M_IMGDATA->m_hasMask = true; -} - -bool wxImage::GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - if (M_IMGDATA->m_hasMask) - { - if (r) *r = M_IMGDATA->m_maskRed; - if (g) *g = M_IMGDATA->m_maskGreen; - if (b) *b = M_IMGDATA->m_maskBlue; - return true; - } - else - { - FindFirstUnusedColour(r, g, b); - return false; - } -} - -unsigned char wxImage::GetMaskRed() const -{ - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); - - return M_IMGDATA->m_maskRed; -} - -unsigned char wxImage::GetMaskGreen() const -{ - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); - - return M_IMGDATA->m_maskGreen; -} - -unsigned char wxImage::GetMaskBlue() const -{ - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); - - return M_IMGDATA->m_maskBlue; -} - -void wxImage::SetMask( bool mask ) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - M_IMGDATA->m_hasMask = mask; -} - -bool wxImage::HasMask() const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - return M_IMGDATA->m_hasMask; -} - -bool wxImage::IsTransparent(int x, int y, unsigned char threshold) const -{ - long pos = XYToIndex(x, y); - wxCHECK_MSG( pos != -1, false, wxT("invalid image coordinates") ); - - // check mask - if ( M_IMGDATA->m_hasMask ) - { - const unsigned char *p = M_IMGDATA->m_data + 3*pos; - if ( p[0] == M_IMGDATA->m_maskRed && - p[1] == M_IMGDATA->m_maskGreen && - p[2] == M_IMGDATA->m_maskBlue ) - { - return true; - } - } - - // then check alpha - if ( M_IMGDATA->m_alpha ) - { - if ( M_IMGDATA->m_alpha[pos] < threshold ) - { - // transparent enough - return true; - } - } - - // not transparent - return false; -} - -bool wxImage::SetMaskFromImage(const wxImage& mask, - unsigned char mr, unsigned char mg, unsigned char mb) -{ - // check that the images are the same size - if ( (M_IMGDATA->m_height != mask.GetHeight() ) || (M_IMGDATA->m_width != mask.GetWidth () ) ) - { - wxLogError( _("Image and mask have different sizes.") ); - return false; - } - - // find unused colour - unsigned char r,g,b ; - if (!FindFirstUnusedColour(&r, &g, &b)) - { - wxLogError( _("No unused colour in image being masked.") ); - return false ; - } - - AllocExclusive(); - - unsigned char *imgdata = GetData(); - unsigned char *maskdata = mask.GetData(); - - const int w = GetWidth(); - const int h = GetHeight(); - - for (int j = 0; j < h; j++) - { - for (int i = 0; i < w; i++) - { - if ((maskdata[0] == mr) && (maskdata[1] == mg) && (maskdata[2] == mb)) - { - imgdata[0] = r; - imgdata[1] = g; - imgdata[2] = b; - } - imgdata += 3; - maskdata += 3; - } - } - - SetMaskColour(r, g, b); - SetMask(true); - - return true; -} - -bool wxImage::ConvertAlphaToMask(unsigned char threshold) -{ - if (!HasAlpha()) - return true; - - unsigned char mr, mg, mb; - if (!FindFirstUnusedColour(&mr, &mg, &mb)) - { - wxLogError( _("No unused colour in image being masked.") ); - return false; - } - - AllocExclusive(); - - SetMask(true); - SetMaskColour(mr, mg, mb); - - unsigned char *imgdata = GetData(); - unsigned char *alphadata = GetAlpha(); - - int w = GetWidth(); - int h = GetHeight(); - - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++, imgdata += 3, alphadata++) - { - if (*alphadata < threshold) - { - imgdata[0] = mr; - imgdata[1] = mg; - imgdata[2] = mb; - } - } - } - - if( !M_IMGDATA->m_staticAlpha ) - free(M_IMGDATA->m_alpha); - - M_IMGDATA->m_alpha = NULL; - M_IMGDATA->m_staticAlpha = false; - - return true; -} - -// ---------------------------------------------------------------------------- -// Palette functions -// ---------------------------------------------------------------------------- - -#if wxUSE_PALETTE - -bool wxImage::HasPalette() const -{ - if (!Ok()) - return false; - - return M_IMGDATA->m_palette.Ok(); -} - -const wxPalette& wxImage::GetPalette() const -{ - wxCHECK_MSG( Ok(), wxNullPalette, wxT("invalid image") ); - - return M_IMGDATA->m_palette; -} - -void wxImage::SetPalette(const wxPalette& palette) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - M_IMGDATA->m_palette = palette; -} - -#endif // wxUSE_PALETTE - -// ---------------------------------------------------------------------------- -// Option functions (arbitrary name/value mapping) -// ---------------------------------------------------------------------------- - -void wxImage::SetOption(const wxString& name, const wxString& value) -{ - wxCHECK_RET( Ok(), wxT("invalid image") ); - - AllocExclusive(); - - int idx = M_IMGDATA->m_optionNames.Index(name, false); - if (idx == wxNOT_FOUND) - { - M_IMGDATA->m_optionNames.Add(name); - M_IMGDATA->m_optionValues.Add(value); - } - else - { - M_IMGDATA->m_optionNames[idx] = name; - M_IMGDATA->m_optionValues[idx] = value; - } -} - -void wxImage::SetOption(const wxString& name, int value) -{ - wxString valStr; - valStr.Printf(wxT("%d"), value); - SetOption(name, valStr); -} - -wxString wxImage::GetOption(const wxString& name) const -{ - wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid image") ); - - int idx = M_IMGDATA->m_optionNames.Index(name, false); - if (idx == wxNOT_FOUND) - return wxEmptyString; - else - return M_IMGDATA->m_optionValues[idx]; -} - -int wxImage::GetOptionInt(const wxString& name) const -{ - return wxAtoi(GetOption(name)); -} - -bool wxImage::HasOption(const wxString& name) const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - return (M_IMGDATA->m_optionNames.Index(name, false) != wxNOT_FOUND); -} - -// ---------------------------------------------------------------------------- -// image I/O -// ---------------------------------------------------------------------------- - -bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), - long WXUNUSED_UNLESS_STREAMS(type), - int WXUNUSED_UNLESS_STREAMS(index) ) -{ -#if HAS_FILE_STREAMS - if (wxFileExists(filename)) - { - wxImageFileInputStream stream(filename); - wxBufferedInputStream bstream( stream ); - return LoadFile(bstream, type, index); - } - else - { - wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() ); - - return false; - } -#else // !HAS_FILE_STREAMS - return false; -#endif // HAS_FILE_STREAMS -} - -bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), - const wxString& WXUNUSED_UNLESS_STREAMS(mimetype), - int WXUNUSED_UNLESS_STREAMS(index) ) -{ -#if HAS_FILE_STREAMS - if (wxFileExists(filename)) - { - wxImageFileInputStream stream(filename); - wxBufferedInputStream bstream( stream ); - return LoadFile(bstream, mimetype, index); - } - else - { - wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() ); - - return false; - } -#else // !HAS_FILE_STREAMS - return false; -#endif // HAS_FILE_STREAMS -} - - - -bool wxImage::SaveFile( const wxString& filename ) const -{ - wxString ext = filename.AfterLast('.').Lower(); - - wxImageHandler * pHandler = FindHandler(ext, -1); - if (pHandler) - { - return SaveFile(filename, pHandler->GetType()); - } - - wxLogError(_("Can't save image to file '%s': unknown extension."), filename.c_str()); - - return false; -} - -bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), - int WXUNUSED_UNLESS_STREAMS(type) ) const -{ -#if HAS_FILE_STREAMS - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); - - wxImageFileOutputStream stream(filename); - - if ( stream.IsOk() ) - { - wxBufferedOutputStream bstream( stream ); - return SaveFile(bstream, type); - } -#endif // HAS_FILE_STREAMS - - return false; -} - -bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), - const wxString& WXUNUSED_UNLESS_STREAMS(mimetype) ) const -{ -#if HAS_FILE_STREAMS - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); - - wxImageFileOutputStream stream(filename); - - if ( stream.IsOk() ) - { - wxBufferedOutputStream bstream( stream ); - return SaveFile(bstream, mimetype); - } -#endif // HAS_FILE_STREAMS - - return false; -} - -bool wxImage::CanRead( const wxString& WXUNUSED_UNLESS_STREAMS(name) ) -{ -#if HAS_FILE_STREAMS - wxImageFileInputStream stream(name); - return CanRead(stream); -#else - return false; -#endif -} - -int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name), - long WXUNUSED_UNLESS_STREAMS(type) ) -{ -#if HAS_FILE_STREAMS - wxImageFileInputStream stream(name); - if (stream.Ok()) - return GetImageCount(stream, type); -#endif - - return 0; -} - -#if wxUSE_STREAMS - -bool wxImage::CanRead( wxInputStream &stream ) -{ - const wxList& list = GetHandlers(); - - for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() ) - { - wxImageHandler *handler=(wxImageHandler*)node->GetData(); - if (handler->CanRead( stream )) - return true; - } - - return false; -} - -int wxImage::GetImageCount( wxInputStream &stream, long type ) -{ - wxImageHandler *handler; - - if ( type == wxBITMAP_TYPE_ANY ) - { - wxList &list=GetHandlers(); - - for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext()) - { - handler=(wxImageHandler*)node->GetData(); - if ( handler->CanRead(stream) ) - return handler->GetImageCount(stream); - - } - - wxLogWarning(_("No handler found for image type.")); - return 0; - } - - handler = FindHandler(type); - - if ( !handler ) - { - wxLogWarning(_("No image handler for type %ld defined."), type); - return false; - } - - if ( handler->CanRead(stream) ) - { - return handler->GetImageCount(stream); - } - else - { - wxLogError(_("Image file is not of type %ld."), type); - return 0; - } -} - -bool wxImage::LoadFile( wxInputStream& stream, long type, int index ) -{ - UnRef(); - - m_refData = new wxImageRefData; - - wxImageHandler *handler; - - if ( type == wxBITMAP_TYPE_ANY ) - { - wxList &list=GetHandlers(); - - for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() ) - { - handler=(wxImageHandler*)node->GetData(); - if ( handler->CanRead(stream) ) - return handler->LoadFile(this, stream, true/*verbose*/, index); - - } - - wxLogWarning( _("No handler found for image type.") ); - return false; - } - - handler = FindHandler(type); - - if (handler == 0) - { - wxLogWarning( _("No image handler for type %ld defined."), type ); - - return false; - } - - if (stream.IsSeekable() && !handler->CanRead(stream)) - { - wxLogError(_("Image file is not of type %ld."), type); - return false; - } - else - return handler->LoadFile(this, stream, true/*verbose*/, index); -} - -bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index ) -{ - UnRef(); - - m_refData = new wxImageRefData; - - wxImageHandler *handler = FindHandlerMime(mimetype); - - if (handler == 0) - { - wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); - - return false; - } - - if (stream.IsSeekable() && !handler->CanRead(stream)) - { - wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype); - return false; - } - else - return handler->LoadFile( this, stream, true/*verbose*/, index ); -} - -bool wxImage::SaveFile( wxOutputStream& stream, int type ) const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - wxImageHandler *handler = FindHandler(type); - if ( !handler ) - { - wxLogWarning( _("No image handler for type %d defined."), type ); - - return false; - } - - return handler->SaveFile( (wxImage*)this, stream ); -} - -bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); - - wxImageHandler *handler = FindHandlerMime(mimetype); - if ( !handler ) - { - wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); - - return false; - } - - return handler->SaveFile( (wxImage*)this, stream ); -} -#endif // wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// image I/O handlers -// ---------------------------------------------------------------------------- - -void wxImage::AddHandler( wxImageHandler *handler ) -{ - // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) - { - sm_handlers.Append( handler ); - } - else - { - // This is not documented behaviour, merely the simplest 'fix' - // for preventing duplicate additions. If someone ever has - // a good reason to add and remove duplicate handlers (and they - // may) we should probably refcount the duplicates. - // also an issue in InsertHandler below. - - wxLogDebug( _T("Adding duplicate image handler for '%s'"), - handler->GetName().c_str() ); - delete handler; - } -} - -void wxImage::InsertHandler( wxImageHandler *handler ) -{ - // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) - { - sm_handlers.Insert( handler ); - } - else - { - // see AddHandler for additional comments. - wxLogDebug( _T("Inserting duplicate image handler for '%s'"), - handler->GetName().c_str() ); - delete handler; - } -} - -bool wxImage::RemoveHandler( const wxString& name ) -{ - wxImageHandler *handler = FindHandler(name); - if (handler) - { - sm_handlers.DeleteObject(handler); - delete handler; - return true; - } - else - return false; -} - -wxImageHandler *wxImage::FindHandler( const wxString& name ) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while (node) - { - wxImageHandler *handler = (wxImageHandler*)node->GetData(); - if (handler->GetName().Cmp(name) == 0) return handler; - - node = node->GetNext(); - } - return 0; -} - -wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType ) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while (node) - { - wxImageHandler *handler = (wxImageHandler*)node->GetData(); - if ( (handler->GetExtension().Cmp(extension) == 0) && - (bitmapType == -1 || handler->GetType() == bitmapType) ) - return handler; - node = node->GetNext(); - } - return 0; -} - -wxImageHandler *wxImage::FindHandler( long bitmapType ) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while (node) - { - wxImageHandler *handler = (wxImageHandler *)node->GetData(); - if (handler->GetType() == bitmapType) return handler; - node = node->GetNext(); - } - return 0; -} - -wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while (node) - { - wxImageHandler *handler = (wxImageHandler *)node->GetData(); - if (handler->GetMimeType().IsSameAs(mimetype, false)) return handler; - node = node->GetNext(); - } - return 0; -} - -void wxImage::InitStandardHandlers() -{ -#if wxUSE_STREAMS - AddHandler(new wxBMPHandler); -#endif // wxUSE_STREAMS -} - -void wxImage::CleanUpHandlers() -{ - wxList::compatibility_iterator node = sm_handlers.GetFirst(); - while (node) - { - wxImageHandler *handler = (wxImageHandler *)node->GetData(); - wxList::compatibility_iterator next = node->GetNext(); - delete handler; - node = next; - } - - sm_handlers.Clear(); -} - -wxString wxImage::GetImageExtWildcard() -{ - wxString fmts; - - wxList& Handlers = wxImage::GetHandlers(); - wxList::compatibility_iterator Node = Handlers.GetFirst(); - while ( Node ) - { - wxImageHandler* Handler = (wxImageHandler*)Node->GetData(); - fmts += wxT("*.") + Handler->GetExtension(); - Node = Node->GetNext(); - if ( Node ) fmts += wxT(";"); - } - - return wxT("(") + fmts + wxT(")|") + fmts; -} - -wxImage::HSVValue wxImage::RGBtoHSV(const RGBValue& rgb) -{ - const double red = rgb.red / 255.0, - green = rgb.green / 255.0, - blue = rgb.blue / 255.0; - - // find the min and max intensity (and remember which one was it for the - // latter) - double minimumRGB = red; - if ( green < minimumRGB ) - minimumRGB = green; - if ( blue < minimumRGB ) - minimumRGB = blue; - - enum { RED, GREEN, BLUE } chMax = RED; - double maximumRGB = red; - if ( green > maximumRGB ) - { - chMax = GREEN; - maximumRGB = green; - } - if ( blue > maximumRGB ) - { - chMax = BLUE; - maximumRGB = blue; - } - - const double value = maximumRGB; - - double hue = 0.0, saturation; - const double deltaRGB = maximumRGB - minimumRGB; - if ( wxIsNullDouble(deltaRGB) ) - { - // Gray has no color - hue = 0.0; - saturation = 0.0; - } - else - { - switch ( chMax ) - { - case RED: - hue = (green - blue) / deltaRGB; - break; - - case GREEN: - hue = 2.0 + (blue - red) / deltaRGB; - break; - - case BLUE: - hue = 4.0 + (red - green) / deltaRGB; - break; - - default: - wxFAIL_MSG(wxT("hue not specified")); - break; - } - - hue /= 6.0; - - if ( hue < 0.0 ) - hue += 1.0; - - saturation = deltaRGB / maximumRGB; - } - - return HSVValue(hue, saturation, value); -} - -wxImage::RGBValue wxImage::HSVtoRGB(const HSVValue& hsv) -{ - double red, green, blue; - - if ( wxIsNullDouble(hsv.saturation) ) - { - // Grey - red = hsv.value; - green = hsv.value; - blue = hsv.value; - } - else // not grey - { - double hue = hsv.hue * 6.0; // sector 0 to 5 - int i = (int)floor(hue); - double f = hue - i; // fractional part of h - double p = hsv.value * (1.0 - hsv.saturation); - - switch (i) - { - case 0: - red = hsv.value; - green = hsv.value * (1.0 - hsv.saturation * (1.0 - f)); - blue = p; - break; - - case 1: - red = hsv.value * (1.0 - hsv.saturation * f); - green = hsv.value; - blue = p; - break; - - case 2: - red = p; - green = hsv.value; - blue = hsv.value * (1.0 - hsv.saturation * (1.0 - f)); - break; - - case 3: - red = p; - green = hsv.value * (1.0 - hsv.saturation * f); - blue = hsv.value; - break; - - case 4: - red = hsv.value * (1.0 - hsv.saturation * (1.0 - f)); - green = p; - blue = hsv.value; - break; - - default: // case 5: - red = hsv.value; - green = p; - blue = hsv.value * (1.0 - hsv.saturation * f); - break; - } - } - - return RGBValue((unsigned char)(red * 255.0), - (unsigned char)(green * 255.0), - (unsigned char)(blue * 255.0)); -} - -/* - * Rotates the hue of each pixel of the image. angle is a double in the range - * -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees - */ -void wxImage::RotateHue(double angle) -{ - AllocExclusive(); - - unsigned char *srcBytePtr; - unsigned char *dstBytePtr; - unsigned long count; - wxImage::HSVValue hsv; - wxImage::RGBValue rgb; - - wxASSERT (angle >= -1.0 && angle <= 1.0); - count = M_IMGDATA->m_width * M_IMGDATA->m_height; - if ( count > 0 && !wxIsNullDouble(angle) ) - { - srcBytePtr = M_IMGDATA->m_data; - dstBytePtr = srcBytePtr; - do - { - rgb.red = *srcBytePtr++; - rgb.green = *srcBytePtr++; - rgb.blue = *srcBytePtr++; - hsv = RGBtoHSV(rgb); - - hsv.hue = hsv.hue + angle; - if (hsv.hue > 1.0) - hsv.hue = hsv.hue - 1.0; - else if (hsv.hue < 0.0) - hsv.hue = hsv.hue + 1.0; - - rgb = HSVtoRGB(hsv); - *dstBytePtr++ = rgb.red; - *dstBytePtr++ = rgb.green; - *dstBytePtr++ = rgb.blue; - } while (--count != 0); - } -} - -//----------------------------------------------------------------------------- -// wxImageHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxImageHandler,wxObject) - -#if wxUSE_STREAMS -bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream), bool WXUNUSED(verbose), int WXUNUSED(index) ) -{ - return false; -} - -bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose) ) -{ - return false; -} - -int wxImageHandler::GetImageCount( wxInputStream& WXUNUSED(stream) ) -{ - return 1; -} - -bool wxImageHandler::CanRead( const wxString& name ) -{ - if (wxFileExists(name)) - { - wxImageFileInputStream stream(name); - return CanRead(stream); - } - - wxLogError( _("Can't check image format of file '%s': file does not exist."), name.c_str() ); - - return false; -} - -bool wxImageHandler::CallDoCanRead(wxInputStream& stream) -{ - wxFileOffset posOld = stream.TellI(); - if ( posOld == wxInvalidOffset ) - { - // can't test unseekable stream - return false; - } - - bool ok = DoCanRead(stream); - - // restore the old position to be able to test other formats and so on - if ( stream.SeekI(posOld) == wxInvalidOffset ) - { - wxLogDebug(_T("Failed to rewind the stream in wxImageHandler!")); - - // reading would fail anyhow as we're not at the right position - return false; - } - - return ok; -} - -#endif // wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// image histogram stuff -// ---------------------------------------------------------------------------- - -bool -wxImageHistogram::FindFirstUnusedColour(unsigned char *r, - unsigned char *g, - unsigned char *b, - unsigned char r2, - unsigned char b2, - unsigned char g2) const -{ - unsigned long key = MakeKey(r2, g2, b2); - - while ( find(key) != end() ) - { - // color already used - r2++; - if ( r2 >= 255 ) - { - r2 = 0; - g2++; - if ( g2 >= 255 ) - { - g2 = 0; - b2++; - if ( b2 >= 255 ) - { - wxLogError(_("No unused colour in image.") ); - return false; - } - } - } - - key = MakeKey(r2, g2, b2); - } - - if ( r ) - *r = r2; - if ( g ) - *g = g2; - if ( b ) - *b = b2; - - return true; -} - -bool -wxImage::FindFirstUnusedColour(unsigned char *r, - unsigned char *g, - unsigned char *b, - unsigned char r2, - unsigned char b2, - unsigned char g2) const -{ - wxImageHistogram histogram; - - ComputeHistogram(histogram); - - return histogram.FindFirstUnusedColour(r, g, b, r2, g2, b2); -} - - - -// GRG, Dic/99 -// Counts and returns the number of different colours. Optionally stops -// when it exceeds 'stopafter' different colours. This is useful, for -// example, to see if the image can be saved as 8-bit (256 colour or -// less, in this case it would be invoked as CountColours(256)). Default -// value for stopafter is -1 (don't care). -// -unsigned long wxImage::CountColours( unsigned long stopafter ) const -{ - wxHashTable h; - wxObject dummy; - unsigned char r, g, b; - unsigned char *p; - unsigned long size, nentries, key; - - p = GetData(); - size = GetWidth() * GetHeight(); - nentries = 0; - - for (unsigned long j = 0; (j < size) && (nentries <= stopafter) ; j++) - { - r = *(p++); - g = *(p++); - b = *(p++); - key = wxImageHistogram::MakeKey(r, g, b); - - if (h.Get(key) == NULL) - { - h.Put(key, &dummy); - nentries++; - } - } - - return nentries; -} - - -unsigned long wxImage::ComputeHistogram( wxImageHistogram &h ) const -{ - unsigned char *p = GetData(); - unsigned long nentries = 0; - - h.clear(); - - const unsigned long size = GetWidth() * GetHeight(); - - unsigned char r, g, b; - for ( unsigned long n = 0; n < size; n++ ) - { - r = *p++; - g = *p++; - b = *p++; - - wxImageHistogramEntry& entry = h[wxImageHistogram::MakeKey(r, g, b)]; - - if ( entry.value++ == 0 ) - entry.index = nentries++; - } - - return nentries; -} - -/* - * Rotation code by Carlos Moreno - */ - -static const double wxROTATE_EPSILON = 1e-10; - -// Auxiliary function to rotate a point (x,y) with respect to point p0 -// make it inline and use a straight return to facilitate optimization -// also, the function receives the sine and cosine of the angle to avoid -// repeating the time-consuming calls to these functions -- sin/cos can -// be computed and stored in the calling function. - -static inline wxRealPoint -wxRotatePoint(const wxRealPoint& p, double cos_angle, double sin_angle, - const wxRealPoint& p0) -{ - return wxRealPoint(p0.x + (p.x - p0.x) * cos_angle - (p.y - p0.y) * sin_angle, - p0.y + (p.y - p0.y) * cos_angle + (p.x - p0.x) * sin_angle); -} - -static inline wxRealPoint -wxRotatePoint(double x, double y, double cos_angle, double sin_angle, - const wxRealPoint & p0) -{ - return wxRotatePoint (wxRealPoint(x,y), cos_angle, sin_angle, p0); -} - -wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool interpolating, wxPoint * offset_after_rotation) const -{ - int i; - angle = -angle; // screen coordinates are a mirror image of "real" coordinates - - bool has_alpha = HasAlpha(); - - const int w = GetWidth(), - h = GetHeight(); - - // Create pointer-based array to accelerate access to wxImage's data - unsigned char ** data = new unsigned char * [h]; - data[0] = GetData(); - for (i = 1; i < h; i++) - data[i] = data[i - 1] + (3 * w); - - // Same for alpha channel - unsigned char ** alpha = NULL; - if (has_alpha) - { - alpha = new unsigned char * [h]; - alpha[0] = GetAlpha(); - for (i = 1; i < h; i++) - alpha[i] = alpha[i - 1] + w; - } - - // precompute coefficients for rotation formula - // (sine and cosine of the angle) - const double cos_angle = cos(angle); - const double sin_angle = sin(angle); - - // Create new Image to store the result - // First, find rectangle that covers the rotated image; to do that, - // rotate the four corners - - const wxRealPoint p0(centre_of_rotation.x, centre_of_rotation.y); - - wxRealPoint p1 = wxRotatePoint (0, 0, cos_angle, sin_angle, p0); - wxRealPoint p2 = wxRotatePoint (0, h, cos_angle, sin_angle, p0); - wxRealPoint p3 = wxRotatePoint (w, 0, cos_angle, sin_angle, p0); - wxRealPoint p4 = wxRotatePoint (w, h, cos_angle, sin_angle, p0); - - int x1a = (int) floor (wxMin (wxMin(p1.x, p2.x), wxMin(p3.x, p4.x))); - int y1a = (int) floor (wxMin (wxMin(p1.y, p2.y), wxMin(p3.y, p4.y))); - int x2a = (int) ceil (wxMax (wxMax(p1.x, p2.x), wxMax(p3.x, p4.x))); - int y2a = (int) ceil (wxMax (wxMax(p1.y, p2.y), wxMax(p3.y, p4.y))); - - // Create rotated image - wxImage rotated (x2a - x1a + 1, y2a - y1a + 1, false); - // With alpha channel - if (has_alpha) - rotated.SetAlpha(); - - if (offset_after_rotation != NULL) - { - *offset_after_rotation = wxPoint (x1a, y1a); - } - - // GRG: The rotated (destination) image is always accessed - // sequentially, so there is no need for a pointer-based - // array here (and in fact it would be slower). - // - unsigned char * dst = rotated.GetData(); - - unsigned char * alpha_dst = NULL; - if (has_alpha) - alpha_dst = rotated.GetAlpha(); - - // GRG: if the original image has a mask, use its RGB values - // as the blank pixel, else, fall back to default (black). - // - unsigned char blank_r = 0; - unsigned char blank_g = 0; - unsigned char blank_b = 0; - - if (HasMask()) - { - blank_r = GetMaskRed(); - blank_g = GetMaskGreen(); - blank_b = GetMaskBlue(); - rotated.SetMaskColour( blank_r, blank_g, blank_b ); - } - - // Now, for each point of the rotated image, find where it came from, by - // performing an inverse rotation (a rotation of -angle) and getting the - // pixel at those coordinates - - const int rH = rotated.GetHeight(); - const int rW = rotated.GetWidth(); - - // GRG: I've taken the (interpolating) test out of the loops, so that - // it is done only once, instead of repeating it for each pixel. - - if (interpolating) - { - for (int y = 0; y < rH; y++) - { - for (int x = 0; x < rW; x++) - { - wxRealPoint src = wxRotatePoint (x + x1a, y + y1a, cos_angle, -sin_angle, p0); - - if (-0.25 < src.x && src.x < w - 0.75 && - -0.25 < src.y && src.y < h - 0.75) - { - // interpolate using the 4 enclosing grid-points. Those - // points can be obtained using floor and ceiling of the - // exact coordinates of the point - int x1, y1, x2, y2; - - if (0 < src.x && src.x < w - 1) - { - x1 = wxRound(floor(src.x)); - x2 = wxRound(ceil(src.x)); - } - else // else means that x is near one of the borders (0 or width-1) - { - x1 = x2 = wxRound (src.x); - } - - if (0 < src.y && src.y < h - 1) - { - y1 = wxRound(floor(src.y)); - y2 = wxRound(ceil(src.y)); - } - else - { - y1 = y2 = wxRound (src.y); - } - - // get four points and the distances (square of the distance, - // for efficiency reasons) for the interpolation formula - - // GRG: Do not calculate the points until they are - // really needed -- this way we can calculate - // just one, instead of four, if d1, d2, d3 - // or d4 are < wxROTATE_EPSILON - - const double d1 = (src.x - x1) * (src.x - x1) + (src.y - y1) * (src.y - y1); - const double d2 = (src.x - x2) * (src.x - x2) + (src.y - y1) * (src.y - y1); - const double d3 = (src.x - x2) * (src.x - x2) + (src.y - y2) * (src.y - y2); - const double d4 = (src.x - x1) * (src.x - x1) + (src.y - y2) * (src.y - y2); - - // Now interpolate as a weighted average of the four surrounding - // points, where the weights are the distances to each of those points - - // If the point is exactly at one point of the grid of the source - // image, then don't interpolate -- just assign the pixel - - // d1,d2,d3,d4 are positive -- no need for abs() - if (d1 < wxROTATE_EPSILON) - { - unsigned char *p = data[y1] + (3 * x1); - *(dst++) = *(p++); - *(dst++) = *(p++); - *(dst++) = *p; - - if (has_alpha) - *(alpha_dst++) = *(alpha[y1] + x1); - } - else if (d2 < wxROTATE_EPSILON) - { - unsigned char *p = data[y1] + (3 * x2); - *(dst++) = *(p++); - *(dst++) = *(p++); - *(dst++) = *p; - - if (has_alpha) - *(alpha_dst++) = *(alpha[y1] + x2); - } - else if (d3 < wxROTATE_EPSILON) - { - unsigned char *p = data[y2] + (3 * x2); - *(dst++) = *(p++); - *(dst++) = *(p++); - *(dst++) = *p; - - if (has_alpha) - *(alpha_dst++) = *(alpha[y2] + x2); - } - else if (d4 < wxROTATE_EPSILON) - { - unsigned char *p = data[y2] + (3 * x1); - *(dst++) = *(p++); - *(dst++) = *(p++); - *(dst++) = *p; - - if (has_alpha) - *(alpha_dst++) = *(alpha[y2] + x1); - } - else - { - // weights for the weighted average are proportional to the inverse of the distance - unsigned char *v1 = data[y1] + (3 * x1); - unsigned char *v2 = data[y1] + (3 * x2); - unsigned char *v3 = data[y2] + (3 * x2); - unsigned char *v4 = data[y2] + (3 * x1); - - const double w1 = 1/d1, w2 = 1/d2, w3 = 1/d3, w4 = 1/d4; - - // GRG: Unrolled. - - *(dst++) = (unsigned char) - ( (w1 * *(v1++) + w2 * *(v2++) + - w3 * *(v3++) + w4 * *(v4++)) / - (w1 + w2 + w3 + w4) ); - *(dst++) = (unsigned char) - ( (w1 * *(v1++) + w2 * *(v2++) + - w3 * *(v3++) + w4 * *(v4++)) / - (w1 + w2 + w3 + w4) ); - *(dst++) = (unsigned char) - ( (w1 * *v1 + w2 * *v2 + - w3 * *v3 + w4 * *v4) / - (w1 + w2 + w3 + w4) ); - - if (has_alpha) - { - v1 = alpha[y1] + (x1); - v2 = alpha[y1] + (x2); - v3 = alpha[y2] + (x2); - v4 = alpha[y2] + (x1); - - *(alpha_dst++) = (unsigned char) - ( (w1 * *v1 + w2 * *v2 + - w3 * *v3 + w4 * *v4) / - (w1 + w2 + w3 + w4) ); - } - } - } - else - { - *(dst++) = blank_r; - *(dst++) = blank_g; - *(dst++) = blank_b; - - if (has_alpha) - *(alpha_dst++) = 0; - } - } - } - } - else // not interpolating - { - for (int y = 0; y < rH; y++) - { - for (int x = 0; x < rW; x++) - { - wxRealPoint src = wxRotatePoint (x + x1a, y + y1a, cos_angle, -sin_angle, p0); - - const int xs = wxRound (src.x); // wxRound rounds to the - const int ys = wxRound (src.y); // closest integer - - if (0 <= xs && xs < w && 0 <= ys && ys < h) - { - unsigned char *p = data[ys] + (3 * xs); - *(dst++) = *(p++); - *(dst++) = *(p++); - *(dst++) = *p; - - if (has_alpha) - *(alpha_dst++) = *(alpha[ys] + (xs)); - } - else - { - *(dst++) = blank_r; - *(dst++) = blank_g; - *(dst++) = blank_b; - - if (has_alpha) - *(alpha_dst++) = 255; - } - } - } - } - - delete [] data; - - if (has_alpha) - delete [] alpha; - - return rotated; -} - - - - - -// A module to allow wxImage initialization/cleanup -// without calling these functions from app.cpp or from -// the user's application. - -class wxImageModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxImageModule) -public: - wxImageModule() {} - bool OnInit() { wxImage::InitStandardHandlers(); return true; } - void OnExit() { wxImage::CleanUpHandlers(); } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxImageModule, wxModule) - - -#endif // wxUSE_IMAGE diff --git a/Source/3rdParty/wx/src/common/imagfill.cpp b/Source/3rdParty/wx/src/common/imagfill.cpp deleted file mode 100644 index a784b5058..000000000 --- a/Source/3rdParty/wx/src/common/imagfill.cpp +++ /dev/null @@ -1,325 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagfill.cpp -// Purpose: FloodFill for wxImage -// Author: Julian Smart -// RCS-ID: $Id: imagfill.cpp 63770 2010-03-28 22:34:12Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && !defined(__WXMSW__) -// we have no use for this code in wxMSW... - -#ifndef WX_PRECOMP - #include "wx/brush.h" - #include "wx/dc.h" - #include "wx/dcmemory.h" - #include "wx/image.h" -#endif - -// DoFloodFill -// Fills with the colour extracted from fillBrush, starting at x,y until either -// a color different from the start pixel is reached (wxFLOOD_SURFACE) -// or fill color is reached (wxFLOOD_BORDER) - -static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, const wxColour& c) -{ - if ((x<0)||(x>=w)||(y<0)||(y>=h)) return false; - - unsigned char r = img->GetRed(x,y); - unsigned char g = img->GetGreen(x,y); - unsigned char b = img->GetBlue(x,y); - return c.Red() == r && c.Green() == g && c.Blue() == b ; -} - -static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, int h, const wxColour & fill, const wxColour& bound) -{ - if ((x<0)||(x>=w)||(y<0)||(y>=h)) return true; - - unsigned char r = img->GetRed(x,y); - unsigned char g = img->GetGreen(x,y); - unsigned char b = img->GetBlue(x,y); - if ( fill.Red() == r && fill.Green() == g && fill.Blue() == b ) - return true; - if ( bound.Red() == r && bound.Green() == g && bound.Blue() == b ) - return true; - return false; -} - - -static void LINKAGEMODE -wxImageFloodFill(wxImage *image, - wxCoord x, wxCoord y, const wxBrush & fillBrush, - const wxColour& testColour, int style, - int WXUNUSED(LogicalFunction)) -{ - /* A diamond flood-fill using a circular queue system. - Each pixel surrounding the current pixel is added to - the queue if it meets the criteria, then is retrieved in - its turn. Code originally based on http://www.drawit.co.nz/Developers.htm, - with explicit permission to use this for wxWidgets granted by Andrew Empson - (no copyright claimed) - */ - - int width = image->GetWidth(); - int height = image->GetHeight(); - - //Draw using a pen made from the current brush colour - //Potentially allows us to use patterned flood fills in future code - wxColour fillColour = fillBrush.GetColour(); - unsigned char r = fillColour.Red(); - unsigned char g = fillColour.Green(); - unsigned char b = fillColour.Blue(); - - //initial test : - if (style == wxFLOOD_SURFACE) - { - //if wxFLOOD_SURFACE, if fill colour is same as required, we don't do anything - if ( image->GetRed(x,y) != r - || image->GetGreen(x,y) != g - || image->GetBlue (x,y) != b ) - { - //prepare memory for queue - //queue save, start, read - size_t *qs, *qst, *qr; - - //queue size (physical) - long qSz= height * width * 2; - qst = new size_t [qSz]; - - //temporary x and y locations - int xt, yt; - - for (int i=0; i < qSz; i++) - qst[i] = 0; - - // start queue - qs=qr=qst; - *qs=xt=x; - qs++; - *qs=yt=y; - qs++; - - image->SetRGB(xt,yt,r,g,b); - - //Main queue loop - while(qr!=qs) - { - //Add new members to queue - //Above current pixel - if(MatchPixel(image,xt,yt-1,width,height,testColour)) - { - *qs=xt; - qs++; - *qs=yt-1; - qs++; - image->SetRGB(xt,yt-1,r,g,b); - - //Loop back to beginning of queue - if(qs>=(qst+qSz)) qs=qst; - } - - //Below current pixel - if(MatchPixel(image,xt,yt+1,width,height,testColour)) - { - *qs=xt; - qs++; - *qs=yt+1; - qs++; - image->SetRGB(xt,yt+1,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Left of current pixel - if(MatchPixel(image,xt-1,yt,width,height,testColour)) - { - *qs=xt-1; - qs++; - *qs=yt; - qs++; - image->SetRGB(xt-1,yt,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Right of current pixel - if(MatchPixel(image,xt+1,yt,width,height,testColour)) - { - *qs=xt+1; - qs++; - *qs=yt; - qs++; - image->SetRGB(xt+1,yt,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Retrieve current queue member - qr+=2; - - //Loop back to the beginning - if(qr>=(qst+qSz)) qr=qst; - xt=*qr; - yt=*(qr+1); - - //Go Back to beginning of loop - } - - delete[] qst; - } - } - else - { - //style is wxFLOOD_BORDER - // fill up to testColor border - if already testColour don't do anything - if ( image->GetRed(x,y) != testColour.Red() - || image->GetGreen(x,y) != testColour.Green() - || image->GetBlue(x,y) != testColour.Blue() ) - { - //prepare memory for queue - //queue save, start, read - size_t *qs, *qst, *qr; - - //queue size (physical) - long qSz= height * width * 2; - qst = new size_t [qSz]; - - //temporary x and y locations - int xt, yt; - - for (int i=0; i < qSz; i++) - qst[i] = 0; - - // start queue - qs=qr=qst; - *qs=xt=x; - qs++; - *qs=yt=y; - qs++; - - image->SetRGB(xt,yt,r,g,b); - - //Main queue loop - while (qr!=qs) - { - //Add new members to queue - //Above current pixel - if(!MatchBoundaryPixel(image,xt,yt-1,width,height,fillColour,testColour)) - { - *qs=xt; - qs++; - *qs=yt-1; - qs++; - image->SetRGB(xt,yt-1,r,g,b); - - //Loop back to beginning of queue - if(qs>=(qst+qSz)) qs=qst; - } - - //Below current pixel - if(!MatchBoundaryPixel(image,xt,yt+1,width,height,fillColour,testColour)) - { - *qs=xt; - qs++; - *qs=yt+1; - qs++; - image->SetRGB(xt,yt+1,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Left of current pixel - if(!MatchBoundaryPixel(image,xt-1,yt,width,height,fillColour,testColour)) - { - *qs=xt-1; - qs++; - *qs=yt; - qs++; - image->SetRGB(xt-1,yt,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Right of current pixel - if(!MatchBoundaryPixel(image,xt+1,yt,width,height,fillColour,testColour)) - { - *qs=xt+1; - qs++; - *qs=yt; - qs++; - image->SetRGB(xt+1,yt,r,g,b); - if(qs>=(qst+qSz)) qs=qst; - } - - //Retrieve current queue member - qr+=2; - - //Loop back to the beginning - if(qr>=(qst+qSz)) qr=qst; - xt=*qr; - yt=*(qr+1); - - //Go Back to beginning of loop - } - - delete[] qst; - } - } - //all done, -} - - -bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, - const wxColour& col, int style) -{ - if (dc->GetBrush().GetStyle() == wxTRANSPARENT) - return true; - - int height = 0; - int width = 0; - dc->GetSize(&width, &height); - - //it would be nice to fail if we don't get a sensible size... - wxCHECK_MSG(width >= 1 && height >= 1, false, - wxT("In FloodFill, dc.GetSize routine failed, method not supported by this DC")); - - const int x_dev = dc->LogicalToDeviceX(x); - const int y_dev = dc->LogicalToDeviceY(y); - - // if start point is outside dc, can't do anything - if (!wxRect(0, 0, width, height).Contains(x_dev, y_dev)) - return false; - - wxBitmap bitmap(width, height); - wxMemoryDC memdc(bitmap); - // match dc scales - double sx, sy; - dc->GetUserScale(&sx, &sy); - memdc.SetUserScale(sx, sy); - dc->GetLogicalScale(&sx, &sy); - memdc.SetLogicalScale(sx, sy); - - // get logical size and origin - const int w_log = dc->DeviceToLogicalXRel(width); - const int h_log = dc->DeviceToLogicalYRel(height); - const int x0_log = dc->DeviceToLogicalX(0); - const int y0_log = dc->DeviceToLogicalY(0); - - memdc.Blit(0, 0, w_log, h_log, dc, x0_log, y0_log); - memdc.SelectObject(wxNullBitmap); - - wxImage image = bitmap.ConvertToImage(); - wxImageFloodFill(&image, x_dev, y_dev, dc->GetBrush(), col, style, - dc->GetLogicalFunction()); - bitmap = wxBitmap(image); - memdc.SelectObject(bitmap); - dc->Blit(x0_log, y0_log, w_log, h_log, &memdc, 0, 0); - - return true; -} - -#endif // wxUSE_IMAGE diff --git a/Source/3rdParty/wx/src/common/imaggif.cpp b/Source/3rdParty/wx/src/common/imaggif.cpp deleted file mode 100644 index bb49847cf..000000000 --- a/Source/3rdParty/wx/src/common/imaggif.cpp +++ /dev/null @@ -1,105 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imaggif.cpp -// Purpose: wxGIFHandler -// Author: Vaclav Slavik & Guillermo Rodriguez Garcia -// RCS-ID: $Id: imaggif.cpp 41819 2006-10-09 17:51:07Z VZ $ -// Copyright: (c) 1999 Vaclav Slavik & Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_GIF - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#include "wx/imaggif.h" -#include "wx/gifdecod.h" -#include "wx/wfstream.h" - -IMPLEMENT_DYNAMIC_CLASS(wxGIFHandler,wxImageHandler) - -//----------------------------------------------------------------------------- -// wxGIFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_STREAMS - -bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream, - bool verbose, int index) -{ - wxGIFDecoder *decod; - wxGIFErrorCode error; - bool ok = true; - -// image->Destroy(); - decod = new wxGIFDecoder(); - error = decod->LoadGIF(stream); - - if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED)) - { - if (verbose) - { - switch (error) - { - case wxGIF_INVFORMAT: - wxLogError(_("GIF: error in GIF image format.")); - break; - case wxGIF_MEMERR: - wxLogError(_("GIF: not enough memory.")); - break; - default: - wxLogError(_("GIF: unknown error!!!")); - break; - } - } - delete decod; - return false; - } - - if ((error == wxGIF_TRUNCATED) && verbose) - { - wxLogError(_("GIF: data stream seems to be truncated.")); - /* go on; image data is OK */ - } - - if (ok) - { - ok = decod->ConvertToImage(index != -1 ? (size_t)index : 0, image); - } - else - { - wxLogError(_("GIF: Invalid gif index.")); - } - - delete decod; - - return ok; -} - -bool wxGIFHandler::SaveFile( wxImage * WXUNUSED(image), - wxOutputStream& WXUNUSED(stream), bool verbose ) -{ - if (verbose) - wxLogDebug(wxT("GIF: the handler is read-only!!")); - - return false; -} - -bool wxGIFHandler::DoCanRead( wxInputStream& stream ) -{ - wxGIFDecoder decod; - return decod.CanRead(stream); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_GIF diff --git a/Source/3rdParty/wx/src/common/imagiff.cpp b/Source/3rdParty/wx/src/common/imagiff.cpp deleted file mode 100644 index 87ef21445..000000000 --- a/Source/3rdParty/wx/src/common/imagiff.cpp +++ /dev/null @@ -1,794 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagiff.h -// Purpose: wxImage handler for Amiga IFF images -// Author: Steffen Gutmann, Thomas Meyer -// RCS-ID: $Id: imagiff.cpp 38787 2006-04-18 07:24:35Z ABX $ -// Copyright: (c) Steffen Gutmann, 2002 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// Parts of this source are based on the iff loading algorithm found -// in xviff.c. Permission by the original author, Thomas Meyer, and -// by the author of xv, John Bradley for using the iff loading part -// in wxWidgets has been gratefully given. - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_IFF - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/intl.h" -#endif - -#include "wx/imagiff.h" -#include "wx/wfstream.h" - -#if wxUSE_PALETTE - #include "wx/palette.h" -#endif // wxUSE_PALETTE - -#include -#include - - -// -------------------------------------------------------------------------- -// Constants -// -------------------------------------------------------------------------- - -// Error codes: -// Note that the error code wxIFF_TRUNCATED means that the image itself -// is most probably OK, but the decoder didn't reach the end of the data -// stream; this means that if it was not reading directly from file, -// the stream will not be correctly positioned. -// - -enum -{ - wxIFF_OK = 0, /* everything was OK */ - wxIFF_INVFORMAT, /* error in iff header */ - wxIFF_MEMERR, /* error allocating memory */ - wxIFF_TRUNCATED /* file appears to be truncated */ -}; - -// -------------------------------------------------------------------------- -// wxIFFDecoder class -// -------------------------------------------------------------------------- - -// internal class for storing IFF image data -class IFFImage -{ -public: - unsigned int w; /* width */ - unsigned int h; /* height */ - int transparent; /* transparent color (-1 = none) */ - int colors; /* number of colors */ - unsigned char *p; /* bitmap */ - unsigned char *pal; /* palette */ - - IFFImage() : w(0), h(0), colors(0), p(0), pal(0) {} - ~IFFImage() { delete [] p; delete [] pal; } -}; - -class WXDLLEXPORT wxIFFDecoder -{ -private: - IFFImage *m_image; // image data - wxInputStream *m_f; // input stream - unsigned char *databuf; - unsigned char *picptr; - unsigned char *decomp_mem; - - void Destroy(); - -public: - // get data of current frame - unsigned char* GetData() const; - unsigned char* GetPalette() const; - int GetNumColors() const; - unsigned int GetWidth() const; - unsigned int GetHeight() const; - int GetTransparentColour() const; - - // constructor, destructor, etc. - wxIFFDecoder(wxInputStream *s); - ~wxIFFDecoder() { Destroy(); } - bool CanRead(); - int ReadIFF(); - bool ConvertToImage(wxImage *image) const; -}; - - -//--------------------------------------------------------------------------- -// wxIFFDecoder constructor and destructor -//--------------------------------------------------------------------------- - -wxIFFDecoder::wxIFFDecoder(wxInputStream *s) -{ - m_f = s; - m_image = 0; - databuf = 0; - decomp_mem = 0; -} - -void wxIFFDecoder::Destroy() -{ - delete m_image; - m_image = 0; - delete [] databuf; - databuf = 0; - delete [] decomp_mem; - decomp_mem = 0; -} - -//--------------------------------------------------------------------------- -// Convert this image to a wxImage object -//--------------------------------------------------------------------------- - -// This function was designed by Vaclav Slavik - -bool wxIFFDecoder::ConvertToImage(wxImage *image) const -{ - // just in case... - image->Destroy(); - - // create the image - image->Create(GetWidth(), GetHeight()); - - if (!image->Ok()) - return false; - - unsigned char *pal = GetPalette(); - unsigned char *src = GetData(); - unsigned char *dst = image->GetData(); - int colors = GetNumColors(); - int transparent = GetTransparentColour(); - long i; - - // set transparent colour mask - if (transparent != -1) - { - for (i = 0; i < colors; i++) - { - if ((pal[3 * i + 0] == 255) && - (pal[3 * i + 1] == 0) && - (pal[3 * i + 2] == 255)) - { - pal[3 * i + 2] = 254; - } - } - - pal[3 * transparent + 0] = 255, - pal[3 * transparent + 1] = 0, - pal[3 * transparent + 2] = 255; - - image->SetMaskColour(255, 0, 255); - } - else - image->SetMask(false); - -#if wxUSE_PALETTE - if (pal && colors > 0) - { - unsigned char* r = new unsigned char[colors]; - unsigned char* g = new unsigned char[colors]; - unsigned char* b = new unsigned char[colors]; - - for (i = 0; i < colors; i++) - { - r[i] = pal[3*i + 0]; - g[i] = pal[3*i + 1]; - b[i] = pal[3*i + 2]; - } - - image->SetPalette(wxPalette(colors, r, g, b)); - - delete [] r; - delete [] g; - delete [] b; - } -#endif // wxUSE_PALETTE - - // copy image data - for (i = 0; i < (long)(GetWidth() * GetHeight()); i++, src += 3, dst += 3) - { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - } - - return true; -} - - -//--------------------------------------------------------------------------- -// Data accessors -//--------------------------------------------------------------------------- - -// Get data for current frame - -unsigned char* wxIFFDecoder::GetData() const { return (m_image->p); } -unsigned char* wxIFFDecoder::GetPalette() const { return (m_image->pal); } -int wxIFFDecoder::GetNumColors() const { return m_image->colors; } -unsigned int wxIFFDecoder::GetWidth() const { return (m_image->w); } -unsigned int wxIFFDecoder::GetHeight() const { return (m_image->h); } -int wxIFFDecoder::GetTransparentColour() const { return m_image->transparent; } - -//--------------------------------------------------------------------------- -// IFF reading and decoding -//--------------------------------------------------------------------------- - -// -// CanRead: -// Returns true if the file looks like a valid IFF, false otherwise. -// -bool wxIFFDecoder::CanRead() -{ - unsigned char buf[12]; - - if ( !m_f->Read(buf, WXSIZEOF(buf)) ) - return false; - - m_f->SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent); - - return (memcmp(buf, "FORM", 4) == 0) && (memcmp(buf+8, "ILBM", 4) == 0); -} - - -// ReadIFF: -// Based on xv source code by Thomas Meyer -// Permission for use in wxWidgets has been gratefully given. - -typedef unsigned char byte; -#define IFFDEBUG 0 - -/************************************************************************* - void decomprle(source, destination, source length, buffer size) - - Decompress run-length encoded data from source to destination. Terminates - when source is decoded completely or destination buffer is full. - - The decruncher is as optimized as I could make it, without risking - safety in case of corrupt BODY chunks. -**************************************************************************/ - -static void decomprle(const byte *sptr, byte *dptr, long slen, long dlen) -{ - byte codeByte, dataByte; - - while ((slen > 0) && (dlen > 0)) { - // read control byte - codeByte = *sptr++; - - if (codeByte < 0x80) { - codeByte++; - if ((slen > (long) codeByte) && (dlen >= (long) codeByte)) { - slen -= codeByte + 1; - dlen -= codeByte; - while (codeByte > 0) { - *dptr++ = *sptr++; - codeByte--; - } - } - else slen = 0; - } - - else if (codeByte > 0x80) { - codeByte = 0x81 - (codeByte & 0x7f); - if ((slen > (long) 0) && (dlen >= (long) codeByte)) { - dataByte = *sptr++; - slen -= 2; - dlen -= codeByte; - while (codeByte > 0) { - *dptr++ = dataByte; - codeByte--; - } - } - else slen = 0; - } - } -} - -/******************************************/ -static unsigned int iff_getword(const byte *ptr) -{ - unsigned int v; - - v = *ptr++; - v = (v << 8) + *ptr; - return v; -} - -/******************************************/ -static unsigned long iff_getlong(const byte *ptr) -{ - unsigned long l; - - l = *ptr++; - l = (l << 8) + *ptr++; - l = (l << 8) + *ptr++; - l = (l << 8) + *ptr; - return l; -} - -// Define internal ILBM types -#define ILBM_NORMAL 0 -#define ILBM_EHB 1 -#define ILBM_HAM 2 -#define ILBM_HAM8 3 -#define ILBM_24BIT 4 - -int wxIFFDecoder::ReadIFF() -{ - Destroy(); - - m_image = new IFFImage(); - if (m_image == 0) { - Destroy(); - return wxIFF_MEMERR; - } - - // compute file length - wxFileOffset currentPos = m_f->TellI(); - m_f->SeekI(0, wxFromEnd); - long filesize = m_f->TellI(); - m_f->SeekI(currentPos, wxFromStart); - - // allocate memory for complete file - if ((databuf = new byte[filesize]) == 0) { - Destroy(); - return wxIFF_MEMERR; - } - - m_f->Read(databuf, filesize); - const byte *dataend = databuf + filesize; - - // initialize work pointer. used to trace the buffer for IFF chunks - const byte *dataptr = databuf; - - // check for minmal size - if (dataptr + 12 > dataend) { - Destroy(); - return wxIFF_INVFORMAT; - } - - // check if we really got an IFF file - if (strncmp((char *)dataptr, "FORM", 4) != 0) { - Destroy(); - return wxIFF_INVFORMAT; - } - - dataptr = dataptr + 8; // skip ID and length of FORM - - // check if the IFF file is an ILBM (picture) file - if (strncmp((char *) dataptr, "ILBM", 4) != 0) { - Destroy(); - return wxIFF_INVFORMAT; - } - - wxLogTrace(_T("iff"), _T("IFF ILBM file recognized")); - - dataptr = dataptr + 4; // skip ID - - // - // main decoding loop. searches IFF chunks and handles them. - // terminates when BODY chunk was found or dataptr ran over end of file - // - bool BMHDok = false, CMAPok = false, CAMGok = false; - int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1; - byte bmhd_masking = 0, bmhd_compression = 0; - long camg_viewmode = 0; - int colors = 0; - while (dataptr + 8 <= dataend) { - // get chunk length and make even - size_t chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe; -#ifdef __VMS - // Silence compiler warning - int chunkLen_; - chunkLen_ = chunkLen; - if (chunkLen_ < 0) { // format error? -#else - if (chunkLen < 0) { // format error? -#endif - break; - } - bool truncated = (dataptr + 8 + chunkLen > dataend); - - if (strncmp((char *)dataptr, "BMHD", 4) == 0) { // BMHD chunk? - if (chunkLen < 12 + 2 || truncated) { - break; - } - bmhd_width = iff_getword(dataptr + 8); // width of picture - bmhd_height= iff_getword(dataptr + 8 + 2); // height of picture - bmhd_bitplanes = *(dataptr + 8 + 8); // # of bitplanes - bmhd_masking = *(dataptr + 8 + 9); - bmhd_compression = *(dataptr + 8 + 10); // get compression - bmhd_transcol = iff_getword(dataptr + 8 + 12); - BMHDok = true; // got BMHD - dataptr += 8 + chunkLen; // to next chunk - } - else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ? - if (truncated) { - break; - } - const byte *cmapptr = dataptr + 8; - colors = chunkLen / 3; // calc no of colors - - delete m_image->pal; - m_image->pal = 0; - m_image->colors = colors; - if (colors > 0) { - m_image->pal = new byte[3*colors]; - if (!m_image->pal) { - Destroy(); - return wxIFF_MEMERR; - } - - // copy colors to color map - for (int i=0; i < colors; i++) { - m_image->pal[3*i + 0] = *cmapptr++; - m_image->pal[3*i + 1] = *cmapptr++; - m_image->pal[3*i + 2] = *cmapptr++; - } - } - - wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."), - colors); - - CMAPok = true; // got CMAP - dataptr += 8 + chunkLen; // to next chunk - } else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ? - if (chunkLen < 4 || truncated) { - break; - } - camg_viewmode = iff_getlong(dataptr + 8); // get viewmodes - CAMGok = true; // got CAMG - dataptr += 8 + chunkLen; // to next chunk - } - else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ? - if (!BMHDok) { // BMHD found? - break; - } - const byte *bodyptr = dataptr + 8; // -> BODY data - - if (truncated) { - chunkLen = dataend - dataptr; - } - - // - // if BODY is compressed, allocate buffer for decrunched BODY - // and decompress it (run length encoding) - // - if (bmhd_compression == 1) { - // calc size of decrunch buffer - (size of the actual pic. - // decompressed in interleaved Amiga bitplane format) - - size_t decomp_bufsize = (((bmhd_width + 15) >> 4) << 1) - * bmhd_height * bmhd_bitplanes; - - if ((decomp_mem = new byte[decomp_bufsize]) == 0) { - Destroy(); - return wxIFF_MEMERR; - } - - decomprle(bodyptr, decomp_mem, chunkLen, decomp_bufsize); - bodyptr = decomp_mem; // -> uncompressed BODY - chunkLen = decomp_bufsize; - delete [] databuf; - databuf = 0; - } - - // the following determines the type of the ILBM file. - // it's either NORMAL, EHB, HAM, HAM8 or 24BIT - - int fmt = ILBM_NORMAL; // assume normal ILBM - if (bmhd_bitplanes == 24) { - fmt = ILBM_24BIT; - } else if (bmhd_bitplanes == 8) { - if (CAMGok && (camg_viewmode & 0x800)) { - fmt = ILBM_HAM8; - } - } else if ((bmhd_bitplanes > 5) && CAMGok) { - if (camg_viewmode & 0x80) { - fmt = ILBM_EHB; - } else if (camg_viewmode & 0x800) { - fmt = ILBM_HAM; - } - } - - wxLogTrace(_T("iff"), - _T("LoadIFF: %s %dx%d, planes=%d (%d cols), comp=%d"), - (fmt==ILBM_NORMAL) ? "Normal ILBM" : - (fmt==ILBM_HAM) ? "HAM ILBM" : - (fmt==ILBM_HAM8) ? "HAM8 ILBM" : - (fmt==ILBM_EHB) ? "EHB ILBM" : - (fmt==ILBM_24BIT) ? "24BIT ILBM" : "unknown ILBM", - bmhd_width, bmhd_height, bmhd_bitplanes, - 1< m_image->colors) { - byte *pal = new byte[colors*3]; - if (!pal) { - Destroy(); - return wxIFF_MEMERR; - } - int i; - for (i = 0; i < m_image->colors; i++) { - pal[3*i + 0] = m_image->pal[3*i + 0]; - pal[3*i + 1] = m_image->pal[3*i + 1]; - pal[3*i + 2] = m_image->pal[3*i + 2]; - } - for (; i < colors; i++) { - pal[3*i + 0] = 0; - pal[3*i + 1] = 0; - pal[3*i + 2] = 0; - } - delete m_image->pal; - m_image->pal = pal; - m_image->colors = colors; - } - - for (int i=0; i < colors; i++) { - m_image->pal[3*i + 0] = (m_image->pal[3*i + 0] >> 4) * 17; - m_image->pal[3*i + 1] = (m_image->pal[3*i + 1] >> 4) * 17; - m_image->pal[3*i + 2] = (m_image->pal[3*i + 2] >> 4) * 17; - } - } - - m_image->p = new byte[bmhd_width * bmhd_height * 3]; - byte *picptr = m_image->p; - if (!picptr) { - Destroy(); - return wxIFF_MEMERR; - } - - byte *pal = m_image->pal; - int lineskip = ((bmhd_width + 15) >> 4) << 1; - int height = chunkLen / (lineskip * bmhd_bitplanes); - - if (bmhd_height < height) { - height = bmhd_height; - } - - if (fmt == ILBM_HAM || fmt == ILBM_HAM8 || fmt == ILBM_24BIT) { - byte *pic = picptr; - const byte *workptr = bodyptr; - - for (int i=0; i < height; i++) { - byte bitmsk = 0x80; - const byte *workptr2 = workptr; - - // at start of each line, init RGB values to background - byte rval = pal[0]; - byte gval = pal[1]; - byte bval = pal[2]; - - for (int j=0; j < bmhd_width; j++) { - long col = 0; - long colbit = 1; - const byte *workptr3 = workptr2; - for (int k=0; k < bmhd_bitplanes; k++) { - if (*workptr3 & bitmsk) { - col += colbit; - } - workptr3 += lineskip; - colbit <<= 1; - } - - if (fmt==ILBM_HAM) { - int c = (col & 0x0f); - switch (col & 0x30) { - case 0x00: if (c >= 0 && c < colors) { - rval = pal[3*c + 0]; - gval = pal[3*c + 1]; - bval = pal[3*c + 2]; - } - break; - - case 0x10: bval = c * 17; - break; - - case 0x20: rval = c * 17; - break; - - case 0x30: gval = c * 17; - break; - } - } else if (fmt == ILBM_HAM8) { - int c = (col & 0x3f); - switch(col & 0xc0) { - case 0x00: if (c >= 0 && c < colors) { - rval = pal[3*c + 0]; - gval = pal[3*c + 1]; - bval = pal[3*c + 2]; - } - break; - - case 0x40: bval = (bval & 3) | (c << 2); - break; - - case 0x80: rval = (rval & 3) | (c << 2); - break; - - case 0xc0: gval = (rval & 3) | (c << 2); - } - } else { - rval = col & 0xff; - gval = (col >> 8) & 0xff; - bval = (col >> 16) & 0xff; - } - - *pic++ = rval; - *pic++ = gval; - *pic++ = bval; - - bitmsk = bitmsk >> 1; - if (bitmsk == 0) { - bitmsk = 0x80; - workptr2++; - } - } - workptr += lineskip * bmhd_bitplanes; - } - } else if ((fmt == ILBM_NORMAL) || (fmt == ILBM_EHB)) { - if (fmt == ILBM_EHB) { - wxLogTrace(_T("iff"), _T("Doubling CMAP for EHB mode")); - - for (int i=0; i<32; i++) { - pal[3*(i + 32) + 0] = pal[3*i + 0] >> 1; - pal[3*(i + 32) + 1] = pal[3*i + 1] >> 1; - pal[3*(i + 32) + 2] = pal[3*i + 2] >> 1; - } - } - - byte *pic = picptr; // ptr to buffer - const byte *workptr = bodyptr; // ptr to pic, planar format - - if (bmhd_height < height) { - height = bmhd_height; - } - - for (int i=0; i < height; i++) { - byte bitmsk = 0x80; // left most bit (mask) - const byte *workptr2 = workptr; // work ptr to source - for (int j=0; j < bmhd_width; j++) { - long col = 0; - long colbit = 1; - const byte *workptr3 = workptr2; // 1st byte in 1st pln - - for (int k=0; k < bmhd_bitplanes; k++) { - if (*workptr3 & bitmsk) { // if bit set in this pln - col = col + colbit; // add bit to chunky byte - } - workptr3 += lineskip; // go to next line - colbit <<= 1; // shift color bit - } - - if (col >= 0 && col < colors) { - pic[0] = pal[3*col + 0]; - pic[1] = pal[3*col + 1]; - pic[2] = pal[3*col + 2]; - } else { - pic[0] = pic[1] = pic[2] = 0; - } - pic += 3; - bitmsk = bitmsk >> 1; // shift mask to next bit - if (bitmsk == 0) { // if mask is zero - bitmsk = 0x80; // reset mask - workptr2++; // mv ptr to next byte - } - } - - workptr += lineskip * bmhd_bitplanes; // to next line - } - } else { - break; // unknown format - } - - m_image->w = bmhd_width; - m_image->h = height; - m_image->transparent = bmhd_transcol; - - wxLogTrace(_T("iff"), _T("Loaded IFF picture %s"), - truncated? "truncated" : "completely"); - - return (truncated? wxIFF_TRUNCATED : wxIFF_OK); - } else { - wxLogTrace(_T("iff"), _T("Skipping unknown chunk '%c%c%c%c'"), - *dataptr, *(dataptr+1), *(dataptr+2), *(dataptr+3)); - - dataptr = dataptr + 8 + chunkLen; // skip unknown chunk - } - } - - Destroy(); - return wxIFF_INVFORMAT; -} - - - -//----------------------------------------------------------------------------- -// wxIFFHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxIFFHandler, wxImageHandler) - -#if wxUSE_STREAMS - -bool wxIFFHandler::LoadFile(wxImage *image, wxInputStream& stream, - bool verbose, int WXUNUSED(index)) -{ - wxIFFDecoder *decod; - int error; - bool ok; - - decod = new wxIFFDecoder(&stream); - error = decod->ReadIFF(); - - if ((error != wxIFF_OK) && (error != wxIFF_TRUNCATED)) - { - if (verbose) - { - switch (error) - { - case wxIFF_INVFORMAT: - wxLogError(_("IFF: error in IFF image format.")); - break; - case wxIFF_MEMERR: - wxLogError(_("IFF: not enough memory.")); - break; - default: - wxLogError(_("IFF: unknown error!!!")); - break; - } - } - delete decod; - return false; - } - - if ((error == wxIFF_TRUNCATED) && verbose) - { - wxLogError(_("IFF: data stream seems to be truncated.")); - /* go on; image data is OK */ - } - - ok = decod->ConvertToImage(image); - delete decod; - - return ok; -} - -bool wxIFFHandler::SaveFile(wxImage * WXUNUSED(image), - wxOutputStream& WXUNUSED(stream), bool verbose) -{ - if (verbose) - wxLogDebug(wxT("IFF: the handler is read-only!!")); - - return false; -} - -bool wxIFFHandler::DoCanRead(wxInputStream& stream) -{ - wxIFFDecoder decod(&stream); - - return decod.CanRead(); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_IFF diff --git a/Source/3rdParty/wx/src/common/imagjpeg.cpp b/Source/3rdParty/wx/src/common/imagjpeg.cpp deleted file mode 100644 index 9fb2d4e69..000000000 --- a/Source/3rdParty/wx/src/common/imagjpeg.cpp +++ /dev/null @@ -1,480 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagjpeg.cpp -// Purpose: wxImage JPEG handler -// Author: Vaclav Slavik -// RCS-ID: $Id: imagjpeg.cpp 43781 2006-12-03 21:59:47Z MW $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_LIBJPEG - -#include "wx/imagjpeg.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/bitmap.h" - #include "wx/module.h" -#endif - -// A hack based on one from tif_jpeg.c to overcome the problem on Windows -// of rpcndr.h defining boolean with a different type to the jpeg headers. -// -// This hack is only necessary for an external jpeg library, the builtin one -// usually used on Windows doesn't use the type boolean, so always works. -// -#ifdef wxHACK_BOOLEAN - #define HAVE_BOOLEAN - #define boolean wxHACK_BOOLEAN -#endif - -extern "C" -{ - #if defined(__WXMSW__) - #define XMD_H - #endif - #include "jpeglib.h" -} - -#ifndef HAVE_WXJPEG_BOOLEAN -typedef boolean wxjpeg_boolean; -#endif - -#include "wx/filefn.h" -#include "wx/wfstream.h" - -// For memcpy -#include -// For JPEG library error handling -#include - -#ifdef __SALFORDC__ -#undef FAR -#endif - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// the standard definition of METHODDEF(type) from jmorecfg.h is "static type" -// which means that we can't declare the method functions as extern "C" - the -// compiler (rightfully) complains about the multiple storage classes in -// declaration -// -// so we only add extern "C" when using our own, modified, jmorecfg.h - and use -// whatever we have in the system headers if this is what we use hoping that it -// should be ok (can't do anything else) -#ifdef JPEG_METHOD_LINKAGE - #define CPP_METHODDEF(type) extern "C" METHODDEF(type) -#else // not using our jmorecfg.h header - #define CPP_METHODDEF(type) METHODDEF(type) -#endif - -//----------------------------------------------------------------------------- -// wxJPEGHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxJPEGHandler,wxImageHandler) - -#if wxUSE_STREAMS - -//------------- JPEG Data Source Manager - -#define JPEG_IO_BUFFER_SIZE 2048 - -typedef struct { - struct jpeg_source_mgr pub; /* public fields */ - - JOCTET* buffer; /* start of buffer */ - wxInputStream *stream; -} wx_source_mgr; - -typedef wx_source_mgr * wx_src_ptr; - -CPP_METHODDEF(void) wx_init_source ( j_decompress_ptr WXUNUSED(cinfo) ) -{ -} - -CPP_METHODDEF(wxjpeg_boolean) wx_fill_input_buffer ( j_decompress_ptr cinfo ) -{ - wx_src_ptr src = (wx_src_ptr) cinfo->src; - - src->pub.next_input_byte = src->buffer; - src->pub.bytes_in_buffer = src->stream->Read(src->buffer, JPEG_IO_BUFFER_SIZE).LastRead(); - - if (src->pub.bytes_in_buffer == 0) // check for end-of-stream - { - // Insert a fake EOI marker - src->buffer[0] = 0xFF; - src->buffer[1] = JPEG_EOI; - src->pub.bytes_in_buffer = 2; - } - return TRUE; -} - -CPP_METHODDEF(void) wx_skip_input_data ( j_decompress_ptr cinfo, long num_bytes ) -{ - if (num_bytes > 0) - { - wx_src_ptr src = (wx_src_ptr) cinfo->src; - - while (num_bytes > (long)src->pub.bytes_in_buffer) - { - num_bytes -= (long) src->pub.bytes_in_buffer; - src->pub.fill_input_buffer(cinfo); - } - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; - } -} - -CPP_METHODDEF(void) wx_term_source ( j_decompress_ptr cinfo ) -{ - wx_src_ptr src = (wx_src_ptr) cinfo->src; - - if (src->pub.bytes_in_buffer > 0) - src->stream->SeekI(-(long)src->pub.bytes_in_buffer, wxFromCurrent); - delete[] src->buffer; -} - - -// JPEG error manager: - -struct wx_error_mgr { - struct jpeg_error_mgr pub; /* "public" fields */ - - jmp_buf setjmp_buffer; /* for return to caller */ -}; - -typedef struct wx_error_mgr * wx_error_ptr; - -/* - * Here's the routine that will replace the standard error_exit method: - */ - -CPP_METHODDEF(void) wx_error_exit (j_common_ptr cinfo) -{ - /* cinfo->err really points to a wx_error_mgr struct, so coerce pointer */ - wx_error_ptr myerr = (wx_error_ptr) cinfo->err; - - /* Always display the message. */ - /* We could postpone this until after returning, if we chose. */ - (*cinfo->err->output_message) (cinfo); - - /* Return control to the setjmp point */ - longjmp(myerr->setjmp_buffer, 1); -} - -/* - * This will replace the standard output_message method when the user - * wants us to be silent (verbose==false). We must have such method instead of - * simply using NULL for cinfo->err->output_message because it's called - * unconditionally from within libjpeg when there's "garbage input". - */ -CPP_METHODDEF(void) wx_ignore_message (j_common_ptr WXUNUSED(cinfo)) -{ -} - -void wx_jpeg_io_src( j_decompress_ptr cinfo, wxInputStream& infile ) -{ - wx_src_ptr src; - - if (cinfo->src == NULL) { /* first time for this JPEG object? */ - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(wx_source_mgr)); - } - src = (wx_src_ptr) cinfo->src; - src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ - src->buffer = new JOCTET[JPEG_IO_BUFFER_SIZE]; - src->pub.next_input_byte = NULL; /* until buffer loaded */ - src->stream = &infile; - - src->pub.init_source = wx_init_source; - src->pub.fill_input_buffer = wx_fill_input_buffer; - src->pub.skip_input_data = wx_skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ - src->pub.term_source = wx_term_source; -} - -static inline void wx_cmyk_to_rgb(unsigned char* rgb, const unsigned char* cmyk) -{ - register int k = 255 - cmyk[3]; - register int k2 = cmyk[3]; - register int c; - - c = k + k2 * (255 - cmyk[0]) / 255; - rgb[0] = (unsigned char)((c > 255) ? 0 : (255 - c)); - - c = k + k2 * (255 - cmyk[1]) / 255; - rgb[1] = (unsigned char)((c > 255) ? 0 : (255 - c)); - - c = k + k2 * (255 - cmyk[2]) / 255; - rgb[2] = (unsigned char)((c > 255) ? 0 : (255 - c)); -} - -// temporarily disable the warning C4611 (interaction between '_setjmp' and -// C++ object destruction is non-portable) - I don't see any dtors here -#ifdef __VISUALC__ - #pragma warning(disable:4611) -#endif /* VC++ */ - -bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) -{ - struct jpeg_decompress_struct cinfo; - struct wx_error_mgr jerr; - unsigned char *ptr; - - image->Destroy(); - cinfo.err = jpeg_std_error( &jerr.pub ); - jerr.pub.error_exit = wx_error_exit; - - if (!verbose) - cinfo.err->output_message = wx_ignore_message; - - /* Establish the setjmp return context for wx_error_exit to use. */ - if (setjmp(jerr.setjmp_buffer)) { - /* If we get here, the JPEG code has signaled an error. - * We need to clean up the JPEG object, close the input file, and return. - */ - if (verbose) - wxLogError(_("JPEG: Couldn't load - file is probably corrupted.")); - (cinfo.src->term_source)(&cinfo); - jpeg_destroy_decompress(&cinfo); - if (image->Ok()) image->Destroy(); - return false; - } - - jpeg_create_decompress( &cinfo ); - wx_jpeg_io_src( &cinfo, stream ); - jpeg_read_header( &cinfo, TRUE ); - - int bytesPerPixel; - if ((cinfo.out_color_space == JCS_CMYK) || (cinfo.out_color_space == JCS_YCCK)) - { - cinfo.out_color_space = JCS_CMYK; - bytesPerPixel = 4; - } - else // all the rest is treated as RGB - { - cinfo.out_color_space = JCS_RGB; - bytesPerPixel = 3; - } - - jpeg_start_decompress( &cinfo ); - - image->Create( cinfo.image_width, cinfo.image_height ); - if (!image->Ok()) { - jpeg_finish_decompress( &cinfo ); - jpeg_destroy_decompress( &cinfo ); - return false; - } - image->SetMask( false ); - ptr = image->GetData(); - - unsigned stride = cinfo.output_width * bytesPerPixel; - JSAMPARRAY tempbuf = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, stride, 1 ); - - while ( cinfo.output_scanline < cinfo.output_height ) - { - jpeg_read_scanlines( &cinfo, tempbuf, 1 ); - if (cinfo.out_color_space == JCS_RGB) - { - memcpy( ptr, tempbuf[0], stride ); - ptr += stride; - } - else // CMYK - { - const unsigned char* inptr = (const unsigned char*) tempbuf[0]; - for (size_t i = 0; i < cinfo.output_width; i++) - { - wx_cmyk_to_rgb(ptr, inptr); - ptr += 3; - inptr += 4; - } - } - } - - jpeg_finish_decompress( &cinfo ); - jpeg_destroy_decompress( &cinfo ); - return true; -} - -typedef struct { - struct jpeg_destination_mgr pub; - - wxOutputStream *stream; - JOCTET * buffer; -} wx_destination_mgr; - -typedef wx_destination_mgr * wx_dest_ptr; - -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ - -CPP_METHODDEF(void) wx_init_destination (j_compress_ptr cinfo) -{ - wx_dest_ptr dest = (wx_dest_ptr) cinfo->dest; - - /* Allocate the output buffer --- it will be released when done with image */ - dest->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * sizeof(JOCTET)); - dest->pub.next_output_byte = dest->buffer; - dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; -} - -CPP_METHODDEF(wxjpeg_boolean) wx_empty_output_buffer (j_compress_ptr cinfo) -{ - wx_dest_ptr dest = (wx_dest_ptr) cinfo->dest; - - dest->stream->Write(dest->buffer, OUTPUT_BUF_SIZE); - dest->pub.next_output_byte = dest->buffer; - dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; - return TRUE; -} - -CPP_METHODDEF(void) wx_term_destination (j_compress_ptr cinfo) -{ - wx_dest_ptr dest = (wx_dest_ptr) cinfo->dest; - size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; - /* Write any data remaining in the buffer */ - if (datacount > 0) - dest->stream->Write(dest->buffer, datacount); -} - -GLOBAL(void) wx_jpeg_io_dest (j_compress_ptr cinfo, wxOutputStream& outfile) -{ - wx_dest_ptr dest; - - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ - cinfo->dest = (struct jpeg_destination_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(wx_destination_mgr)); - } - - dest = (wx_dest_ptr) cinfo->dest; - dest->pub.init_destination = wx_init_destination; - dest->pub.empty_output_buffer = wx_empty_output_buffer; - dest->pub.term_destination = wx_term_destination; - dest->stream = &outfile; -} - -bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) -{ - struct jpeg_compress_struct cinfo; - struct wx_error_mgr jerr; - JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ - JSAMPLE *image_buffer; - int stride; /* physical row width in image buffer */ - - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = wx_error_exit; - - if (!verbose) - cinfo.err->output_message = wx_ignore_message; - - /* Establish the setjmp return context for wx_error_exit to use. */ - if (setjmp(jerr.setjmp_buffer)) - { - /* If we get here, the JPEG code has signaled an error. - * We need to clean up the JPEG object, close the input file, and return. - */ - if (verbose) - wxLogError(_("JPEG: Couldn't save image.")); - jpeg_destroy_compress(&cinfo); - return false; - } - - jpeg_create_compress(&cinfo); - wx_jpeg_io_dest(&cinfo, stream); - - cinfo.image_width = image->GetWidth(); - cinfo.image_height = image->GetHeight(); - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - jpeg_set_defaults(&cinfo); - - // TODO: 3rd parameter is force_baseline, what value should this be? - // Code says: "If force_baseline is TRUE, the computed quantization table entries - // are limited to 1..255 for JPEG baseline compatibility." - // 'Quality' is a number between 0 (terrible) and 100 (very good). - // The default (in jcparam.c, jpeg_set_defaults) is 75, - // and force_baseline is TRUE. - if (image->HasOption(wxIMAGE_OPTION_QUALITY)) - jpeg_set_quality(&cinfo, image->GetOptionInt(wxIMAGE_OPTION_QUALITY), TRUE); - - // set the resolution fields in the output file - UINT16 resX, - resY; - if ( image->HasOption(wxIMAGE_OPTION_RESOLUTIONX) && - image->HasOption(wxIMAGE_OPTION_RESOLUTIONY) ) - { - resX = (UINT16)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONX); - resY = (UINT16)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONY); - } - else if ( image->HasOption(wxIMAGE_OPTION_RESOLUTION) ) - { - resX = - resY = (UINT16)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION); - } - else - { - resX = - resY = 0; - } - - if ( resX && resY ) - { - cinfo.X_density = resX; - cinfo.Y_density = resY; - } - - // sets the resolution unit field in the output file - // wxIMAGE_RESOLUTION_INCHES for inches - // wxIMAGE_RESOLUTION_CM for centimeters - if ( image->HasOption(wxIMAGE_OPTION_RESOLUTIONUNIT) ) - { - cinfo.density_unit = (UINT8)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT); - } - - jpeg_start_compress(&cinfo, TRUE); - - stride = cinfo.image_width * 3; /* JSAMPLEs per row in image_buffer */ - image_buffer = image->GetData(); - while (cinfo.next_scanline < cinfo.image_height) { - row_pointer[0] = &image_buffer[cinfo.next_scanline * stride]; - jpeg_write_scanlines( &cinfo, row_pointer, 1 ); - } - jpeg_finish_compress(&cinfo); - jpeg_destroy_compress(&cinfo); - - return true; -} - -#ifdef __VISUALC__ - #pragma warning(default:4611) -#endif /* VC++ */ - -bool wxJPEGHandler::DoCanRead( wxInputStream& stream ) -{ - unsigned char hdr[2]; - - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - return hdr[0] == 0xFF && hdr[1] == 0xD8; -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LIBJPEG diff --git a/Source/3rdParty/wx/src/common/imagpcx.cpp b/Source/3rdParty/wx/src/common/imagpcx.cpp deleted file mode 100644 index d77be9b83..000000000 --- a/Source/3rdParty/wx/src/common/imagpcx.cpp +++ /dev/null @@ -1,500 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagpcx.cpp -// Purpose: wxImage PCX handler -// Author: Guillermo Rodriguez Garcia -// Version: 1.1 -// CVS-ID: $Id: imagpcx.cpp 54766 2008-07-22 20:16:03Z VZ $ -// Copyright: (c) 1999 Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_PCX - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/list.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/palette.h" - #include "wx/hash.h" - #include "wx/module.h" -#endif - -#include "wx/imagpcx.h" -#include "wx/wfstream.h" - -//----------------------------------------------------------------------------- -// wxPCXHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler) - -#if wxUSE_STREAMS - -//----------------------------------------------------------------------------- -// RLE encoding and decoding -//----------------------------------------------------------------------------- - -void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s) -{ - unsigned int data, last, cont; - - // Write 'size' bytes. The PCX official specs say there will be - // a decoding break at the end of each scanline, so in order to - // force this decoding break use this function to write, at most, - // _one_ complete scanline at a time. - - last = (unsigned char) *(p++); - cont = 1; - size--; - - while (size-- > 0) - { - data = (unsigned char) *(p++); - - // Up to 63 bytes with the same value can be stored using - // a single { cont, value } pair. - // - if ((data == last) && (cont < 63)) - { - cont++; - } - else - { - // need to write a 'counter' byte? - if ((cont > 1) || ((last & 0xC0) == 0xC0)) - s.PutC((char) (cont | 0xC0)); - - s.PutC((char) last); - last = data; - cont = 1; - } - } - - // write the last one and return; - if ((cont > 1) || ((last & 0xC0) == 0xC0)) - s.PutC((char) (cont | 0xC0)); - - s.PutC((char) last); -} - -void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s) -{ - // Read 'size' bytes. The PCX official specs say there will be - // a decoding break at the end of each scanline (but not at the - // end of each plane inside a scanline). Only use this function - // to read one or more _complete_ scanlines. Else, more than - // 'size' bytes might be read and the buffer might overflow. - - while (size != 0) - { - unsigned int data = (unsigned char)s.GetC(); - - // If ((data & 0xC0) != 0xC0), then the value read is a data - // byte. Else, it is a counter (cont = val & 0x3F) and the - // next byte is the data byte. - - if ((data & 0xC0) != 0xC0) - { - *(p++) = (unsigned char)data; - size--; - } - else - { - unsigned int cont = data & 0x3F; - if (cont > size) // can happen only if the file is malformed - break; - data = (unsigned char)s.GetC(); - for (unsigned int i = 1; i <= cont; i++) - *(p++) = (unsigned char)data; - size -= cont; - } - } -} - - -//----------------------------------------------------------------------------- -// PCX reading and saving -//----------------------------------------------------------------------------- - -// PCX header -#define HDR_MANUFACTURER 0 -#define HDR_VERSION 1 -#define HDR_ENCODING 2 -#define HDR_BITSPERPIXEL 3 -#define HDR_XMIN 4 -#define HDR_YMIN 6 -#define HDR_XMAX 8 -#define HDR_YMAX 10 -#define HDR_NPLANES 65 -#define HDR_BYTESPERLINE 66 -#define HDR_PALETTEINFO 68 - -// image formats -enum { - wxPCX_8BIT, // 8 bpp, 1 plane (8 bit) - wxPCX_24BIT // 8 bpp, 3 planes (24 bit) -}; - -// error codes -enum { - wxPCX_OK = 0, // everything was OK - wxPCX_INVFORMAT = 1, // error in pcx file format - wxPCX_MEMERR = 2, // error allocating memory - wxPCX_VERERR = 3 // error in pcx version number -}; - - -// ReadPCX: -// Loads a PCX file into the wxImage object pointed by image. -// Returns wxPCX_OK on success, or an error code otherwise -// (see above for error codes) -// -int ReadPCX(wxImage *image, wxInputStream& stream) -{ - unsigned char hdr[128]; // PCX header - unsigned char pal[768]; // palette for 8 bit images - unsigned char *p; // space to store one scanline - unsigned char *dst; // pointer into wxImage data - unsigned int width, height; // size of the image - unsigned int bytesperline; // bytes per line (each plane) - int bitsperpixel; // bits per pixel (each plane) - int nplanes; // number of planes - int encoding; // is the image RLE encoded? - int format; // image format (8 bit, 24 bit) - unsigned int i, j; - - // Read PCX header and check the version number (it must - // be at least 5 or higher for 8 bit and 24 bit images). - - stream.Read(hdr, 128); - - if (hdr[HDR_VERSION] < 5) return wxPCX_VERERR; - - // Extract all image info from the PCX header. - - encoding = hdr[HDR_ENCODING]; - nplanes = hdr[HDR_NPLANES]; - bitsperpixel = hdr[HDR_BITSPERPIXEL]; - bytesperline = hdr[HDR_BYTESPERLINE] + 256 * hdr[HDR_BYTESPERLINE + 1]; - width = (hdr[HDR_XMAX] + 256 * hdr[HDR_XMAX + 1]) - - (hdr[HDR_XMIN] + 256 * hdr[HDR_XMIN + 1]) + 1; - height = (hdr[HDR_YMAX] + 256 * hdr[HDR_YMAX + 1]) - - (hdr[HDR_YMIN] + 256 * hdr[HDR_YMIN + 1]) + 1; - - // Check image format. Currently supported formats are - // 8 bits (8 bpp, 1 plane) and 24 bits (8 bpp, 3 planes). - - if ((nplanes == 3) && (bitsperpixel == 8)) - format = wxPCX_24BIT; - else if ((nplanes == 1) && (bitsperpixel == 8)) - format = wxPCX_8BIT; - else - return wxPCX_INVFORMAT; - - // If the image is of type wxPCX_8BIT, then there is - // a palette at the end of the image data. If we were - // working with a file, we could seek at the end to the - // end (SeekI(-769, wxFromEnd) and read the palette - // before proceeding. Unfortunately, this would prevent - // loading several PCXs in a single stream, so we can't - // do it. Thus, 8-bit images will have to be decoded in - // two passes: one to read and decode the image data, - // and another to replace 'colour indexes' with RGB - // values. - - // Resize the image and allocate memory for a scanline. - - image->Create(width, height); - - if (!image->Ok()) - return wxPCX_MEMERR; - - if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == NULL) - return wxPCX_MEMERR; - - // Now start reading the file, line by line, and store - // the data in the format required by wxImage. - - dst = image->GetData(); - - for (j = height; j; j--) - { - if (encoding) - RLEdecode(p, bytesperline * nplanes, stream); - else - stream.Read(p, bytesperline * nplanes); - - switch (format) - { - case wxPCX_8BIT: - { - for (i = 0; i < width; i++) - { - // first pass, just store the colour index - *dst = p[i]; - dst += 3; - } - break; - } - case wxPCX_24BIT: - { - for (i = 0; i < width; i++) - { - *(dst++) = p[i]; - *(dst++) = p[i + bytesperline]; - *(dst++) = p[i + 2 * bytesperline]; - } - break; - } - } - } - - free(p); - - // For 8 bit images, we read the palette, and then do a second - // pass replacing indexes with their RGB values; - - if (format == wxPCX_8BIT) - { - unsigned char index; - - if (stream.GetC() != 12) - return wxPCX_INVFORMAT; - - stream.Read(pal, 768); - - p = image->GetData(); - for (unsigned long k = height * width; k; k--) - { - index = *p; - *(p++) = pal[3 * index]; - *(p++) = pal[3 * index + 1]; - *(p++) = pal[3 * index + 2]; - } - -#if wxUSE_PALETTE - unsigned char r[256]; - unsigned char g[256]; - unsigned char b[256]; - for (i = 0; i < 256; i++) - { - r[i] = pal[3*i + 0]; - g[i] = pal[3*i + 1]; - b[i] = pal[3*i + 2]; - } - image->SetPalette(wxPalette(256, r, g, b)); -#endif // wxUSE_PALETTE - } - - return wxPCX_OK; -} - -// SavePCX: -// Saves a PCX file into the wxImage object pointed by image. -// Returns wxPCX_OK on success, or an error code otherwise -// (see above for error codes). Will try to save as 8-bit -// PCX if possible, and then fall back to 24-bit if there -// are more than 256 different colours. -// -int SavePCX(wxImage *image, wxOutputStream& stream) -{ - unsigned char hdr[128]; // PCX header - unsigned char pal[768]; // palette for 8 bit images - unsigned char *p; // space to store one scanline - unsigned char *src; // pointer into wxImage data - unsigned int width, height; // size of the image - unsigned int bytesperline; // bytes per line (each plane) - unsigned char nplanes = 3; // number of planes - int format = wxPCX_24BIT; // image format (8 bit, 24 bit) - wxImageHistogram histogram; // image histogram - unsigned long key; // key in the hashtable - unsigned int i; - - // See if we can save as 8 bit. - - if (image->CountColours(256) <= 256) - { - image->ComputeHistogram(histogram); - format = wxPCX_8BIT; - nplanes = 1; - } - - // Get image dimensions, calculate bytesperline (must be even, - // according to PCX specs) and allocate space for one complete - // scanline. - - if (!image->Ok()) - return wxPCX_INVFORMAT; - - width = image->GetWidth(); - height = image->GetHeight(); - bytesperline = width; - if (bytesperline % 2) - bytesperline++; - - if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == NULL) - return wxPCX_MEMERR; - - // Build header data and write it to the stream. Initially, - // set all bytes to zero (most values default to zero). - - memset(hdr, 0, sizeof(hdr)); - - hdr[HDR_MANUFACTURER] = 10; - hdr[HDR_VERSION] = 5; - hdr[HDR_ENCODING] = 1; - hdr[HDR_NPLANES] = nplanes; - hdr[HDR_BITSPERPIXEL] = 8; - hdr[HDR_BYTESPERLINE] = (unsigned char)(bytesperline % 256); - hdr[HDR_BYTESPERLINE + 1] = (unsigned char)(bytesperline / 256); - hdr[HDR_XMAX] = (unsigned char)((width - 1) % 256); - hdr[HDR_XMAX + 1] = (unsigned char)((width - 1) / 256); - hdr[HDR_YMAX] = (unsigned char)((height - 1) % 256); - hdr[HDR_YMAX + 1] = (unsigned char)((height - 1) / 256); - hdr[HDR_PALETTEINFO] = 1; - - stream.Write(hdr, 128); - - // Encode image data line by line and write it to the stream - - src = image->GetData(); - - for (; height; height--) - { - switch (format) - { - case wxPCX_8BIT: - { - unsigned char r, g, b; - - for (i = 0; i < width; i++) - { - r = *(src++); - g = *(src++); - b = *(src++); - key = (r << 16) | (g << 8) | b; - - p[i] = (unsigned char)histogram[key].index; - } - break; - } - case wxPCX_24BIT: - { - for (i = 0; i < width; i++) - { - p[i] = *(src++); - p[i + bytesperline] = *(src++); - p[i + 2 * bytesperline] = *(src++); - } - break; - } - } - - RLEencode(p, bytesperline * nplanes, stream); - } - - free(p); - - // For 8 bit images, build the palette and write it to the stream: - if (format == wxPCX_8BIT) - { - // zero unused colours - memset(pal, 0, sizeof(pal)); - - unsigned long index; - - for (wxImageHistogram::iterator entry = histogram.begin(); - entry != histogram.end(); ++entry ) - { - key = entry->first; - index = entry->second.index; - pal[3 * index] = (unsigned char)(key >> 16); - pal[3 * index + 1] = (unsigned char)(key >> 8); - pal[3 * index + 2] = (unsigned char)(key); - } - - stream.PutC(12); - stream.Write(pal, 768); - } - - return wxPCX_OK; -} - -//----------------------------------------------------------------------------- -// wxPCXHandler -//----------------------------------------------------------------------------- - -bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) -{ - int error; - - if (!CanRead(stream)) - { - if (verbose) - wxLogError(_("PCX: this is not a PCX file.")); - - return false; - } - - image->Destroy(); - - if ((error = ReadPCX(image, stream)) != wxPCX_OK) - { - if (verbose) - { - switch (error) - { - case wxPCX_INVFORMAT: wxLogError(_("PCX: image format unsupported")); break; - case wxPCX_MEMERR: wxLogError(_("PCX: couldn't allocate memory")); break; - case wxPCX_VERERR: wxLogError(_("PCX: version number too low")); break; - default: wxLogError(_("PCX: unknown error !!!")); - } - } - image->Destroy(); - return false; - } - - return true; -} - -bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) -{ - int error; - - if ((error = SavePCX(image, stream)) != wxPCX_OK) - { - if (verbose) - { - switch (error) - { - case wxPCX_INVFORMAT: wxLogError(_("PCX: invalid image")); break; - case wxPCX_MEMERR: wxLogError(_("PCX: couldn't allocate memory")); break; - default: wxLogError(_("PCX: unknown error !!!")); - } - } - } - - return (error == wxPCX_OK); -} - -bool wxPCXHandler::DoCanRead( wxInputStream& stream ) -{ - unsigned char c = stream.GetC(); - if ( !stream ) - return false; - - // not very safe, but this is all we can get from PCX header :-( - return c == 10; -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_IMAGE && wxUSE_PCX diff --git a/Source/3rdParty/wx/src/common/imagpng.cpp b/Source/3rdParty/wx/src/common/imagpng.cpp deleted file mode 100644 index d1bac6597..000000000 --- a/Source/3rdParty/wx/src/common/imagpng.cpp +++ /dev/null @@ -1,869 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagepng.cpp -// Purpose: wxImage PNG handler -// Author: Robert Roebling -// RCS-ID: $Id: imagpng.cpp 67009 2011-02-24 08:42:57Z JS $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_LIBPNG - -#include "wx/imagpng.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/bitmap.h" - #include "wx/module.h" -#endif - -#include "png.h" -#include "wx/filefn.h" -#include "wx/wfstream.h" -#include "wx/intl.h" -#include "wx/palette.h" - -// For memcpy -#include - -#ifdef __SALFORDC__ -#ifdef FAR -#undef FAR -#endif -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// image can not have any transparent pixels at all, have only 100% opaque -// and/or 100% transparent pixels in which case a simple mask is enough to -// store this information in wxImage or have a real alpha channel in which case -// we need to have it in wxImage as well -enum Transparency -{ - Transparency_None, - Transparency_Mask, - Transparency_Alpha -}; - -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - -// return the kind of transparency needed for this image assuming that it does -// have transparent pixels, i.e. either Transparency_Alpha or Transparency_Mask -static Transparency -CheckTransparency(unsigned char **lines, - png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h, - size_t numColBytes); - -// init the alpha channel for the image and fill it with 1s up to (x, y) -static unsigned char *InitAlpha(wxImage *image, png_uint_32 x, png_uint_32 y); - -// find a free colour for the mask in the PNG data array -static void -FindMaskColour(unsigned char **lines, png_uint_32 width, png_uint_32 height, - unsigned char& rMask, unsigned char& gMask, unsigned char& bMask); - -// is the pixel with this value of alpha a fully opaque one? -static inline -bool IsOpaque(unsigned char a) -{ - return a == 0xff; -} - -// is the pixel with this value of alpha a fully transparent one? -static inline -bool IsTransparent(unsigned char a) -{ - return !a; -} - -// ============================================================================ -// wxPNGHandler implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) - -#if wxUSE_STREAMS - -#ifndef PNGLINKAGEMODE - #ifdef PNGAPI - #define PNGLINKAGEMODE PNGAPI - #elif defined(__WATCOMC__) - // we need an explicit cdecl for Watcom, at least according to - // - // http://sf.net/tracker/index.php?func=detail&aid=651492&group_id=9863&atid=109863 - // - // more testing is needed for this however, please remove this comment - // if you can confirm that my fix works with Watcom 11 - #define PNGLINKAGEMODE cdecl - #else - #define PNGLINKAGEMODE LINKAGEMODE - #endif -#endif - - -// VS: wxPNGInfoStruct declared below is a hack that needs some explanation. -// First, let me describe what's the problem: libpng uses jmp_buf in -// its png_struct structure. Unfortunately, this structure is -// compiler-specific and may vary in size, so if you use libpng compiled -// as DLL with another compiler than the main executable, it may not work -// (this is for example the case with wxMGL port and SciTech MGL library -// that provides custom runtime-loadable libpng implementation with jmpbuf -// disabled altogether). Luckily, it is still possible to use setjmp() & -// longjmp() as long as the structure is not part of png_struct. -// -// Sadly, there's no clean way to attach user-defined data to png_struct. -// There is only one customizable place, png_struct.io_ptr, which is meant -// only for I/O routines and is set with png_set_read_fn or -// png_set_write_fn. The hacky part is that we use io_ptr to store -// a pointer to wxPNGInfoStruct that holds I/O structures _and_ jmp_buf. - -struct wxPNGInfoStruct -{ - jmp_buf jmpbuf; - bool verbose; - - union - { - wxInputStream *in; - wxOutputStream *out; - } stream; -}; - -#define WX_PNG_INFO(png_ptr) ((wxPNGInfoStruct*)png_get_io_ptr(png_ptr)) - -// ---------------------------------------------------------------------------- -// helper functions -// ---------------------------------------------------------------------------- - -extern "C" -{ - -void PNGLINKAGEMODE wx_PNG_stream_reader( png_structp png_ptr, png_bytep data, - png_size_t length ) -{ - WX_PNG_INFO(png_ptr)->stream.in->Read(data, length); -} - -void PNGLINKAGEMODE wx_PNG_stream_writer( png_structp png_ptr, png_bytep data, - png_size_t length ) -{ - WX_PNG_INFO(png_ptr)->stream.out->Write(data, length); -} - -void -PNGLINKAGEMODE wx_png_warning(png_structp png_ptr, png_const_charp message) -{ - wxPNGInfoStruct *info = png_ptr ? WX_PNG_INFO(png_ptr) : NULL; - if ( !info || info->verbose ) - wxLogWarning( wxString::FromAscii(message) ); -} - -// from pngerror.c -// so that the libpng doesn't send anything on stderr -void -PNGLINKAGEMODE wx_png_error(png_structp png_ptr, png_const_charp message) -{ - wx_png_warning(NULL, message); - - // we're not using libpng built-in jump buffer (see comment before - // wxPNGInfoStruct above) so we have to return ourselves, otherwise libpng - // would just abort - longjmp(WX_PNG_INFO(png_ptr)->jmpbuf, 1); -} - -} // extern "C" - -// ---------------------------------------------------------------------------- -// LoadFile() helpers -// ---------------------------------------------------------------------------- - -// determine the kind of transparency we need for this image: if the only alpha -// values it has are 0 (transparent) and 0xff (opaque) then we can simply -// create a mask for it, we should be ok with a simple mask but otherwise we -// need a full blown alpha channel in wxImage -// -// parameters: -// lines raw PNG data -// x, y starting position -// w, h size of the image -// numColBytes number of colour bytes (1 for grey scale, 3 for RGB) -// (NB: alpha always follows the colour bytes) -Transparency -CheckTransparency(unsigned char **lines, - png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h, - size_t numColBytes) -{ - // suppose that a mask will suffice and check all the remaining alpha - // values to see if it does - for ( ; y < h; y++ ) - { - // each pixel is numColBytes+1 bytes, offset into the current line by - // the current x position - unsigned const char *ptr = lines[y] + (x * (numColBytes + 1)); - - for ( png_uint_32 x2 = x; x2 < w; x2++ ) - { - // skip the grey or colour byte(s) - ptr += numColBytes; - - unsigned char a2 = *ptr++; - - if ( !IsTransparent(a2) && !IsOpaque(a2) ) - { - // not fully opaque nor fully transparent, hence need alpha - return Transparency_Alpha; - } - } - - // during the next loop iteration check all the pixels in the row - x = 0; - } - - // mask will be enough - return Transparency_Mask; -} - -unsigned char *InitAlpha(wxImage *image, png_uint_32 x, png_uint_32 y) -{ - // create alpha channel - image->SetAlpha(); - - unsigned char *alpha = image->GetAlpha(); - - // set alpha for the pixels we had so far - png_uint_32 end = y * image->GetWidth() + x; - for ( png_uint_32 i = 0; i < end; i++ ) - { - // all the previous pixels were opaque - *alpha++ = 0xff; - } - - return alpha; -} - -void -FindMaskColour(unsigned char **lines, png_uint_32 width, png_uint_32 height, - unsigned char& rMask, unsigned char& gMask, unsigned char& bMask) -{ - // choosing the colour for the mask is more - // difficult: we need to iterate over the entire - // image for this in order to choose an unused - // colour (this is not very efficient but what else - // can we do?) - wxImageHistogram h; - unsigned nentries = 0; - unsigned char r2, g2, b2; - for ( png_uint_32 y2 = 0; y2 < height; y2++ ) - { - const unsigned char *p = lines[y2]; - for ( png_uint_32 x2 = 0; x2 < width; x2++ ) - { - r2 = *p++; - g2 = *p++; - b2 = *p++; - ++p; // jump over alpha - - wxImageHistogramEntry& - entry = h[wxImageHistogram:: MakeKey(r2, g2, b2)]; - - if ( entry.value++ == 0 ) - entry.index = nentries++; - } - } - - if ( !h.FindFirstUnusedColour(&rMask, &gMask, &bMask) ) - { - wxLogWarning(_("Too many colours in PNG, the image may be slightly blurred.")); - - // use a fixed mask colour and we'll fudge - // the real pixels with this colour (see - // below) - rMask = 0xfe; - gMask = 0; - bMask = 0xff; - } -} - -// ---------------------------------------------------------------------------- -// reading PNGs -// ---------------------------------------------------------------------------- - -bool wxPNGHandler::DoCanRead( wxInputStream& stream ) -{ - unsigned char hdr[4]; - - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0; -} - -// convert data from RGB to wxImage format -static -void CopyDataFromPNG(wxImage *image, - unsigned char **lines, - png_uint_32 width, - png_uint_32 height, - int color_type) -{ - Transparency transparency = Transparency_None; - - // only non NULL if transparency == Transparency_Alpha - unsigned char *alpha = NULL; - - // RGB of the mask colour if transparency == Transparency_Mask - // (but init them anyhow to avoid compiler warnings) - unsigned char rMask = 0, - gMask = 0, - bMask = 0; - - unsigned char *ptrDst = image->GetData(); - if ( !(color_type & PNG_COLOR_MASK_COLOR) ) - { - // grey image: GAGAGA... where G == grey component and A == alpha - for ( png_uint_32 y = 0; y < height; y++ ) - { - const unsigned char *ptrSrc = lines[y]; - for ( png_uint_32 x = 0; x < width; x++ ) - { - unsigned char g = *ptrSrc++; - unsigned char a = *ptrSrc++; - - // the first time we encounter a transparent pixel we must - // decide about what to do about them - if ( !IsOpaque(a) && transparency == Transparency_None ) - { - // we'll need at least the mask for this image and - // maybe even full alpha channel info: the former is - // only enough if we have alpha values of 0 and 0xff - // only, otherwisewe need the latter - transparency = CheckTransparency - ( - lines, - x, y, - width, height, - 1 - ); - - if ( transparency == Transparency_Mask ) - { - // let's choose this colour for the mask: this is - // not a problem here as all the other pixels are - // grey, i.e. R == G == B which is not the case for - // this one so no confusion is possible - rMask = 0xff; - gMask = 0; - bMask = 0xff; - } - else // transparency == Transparency_Alpha - { - alpha = InitAlpha(image, x, y); - } - } - - switch ( transparency ) - { - case Transparency_Mask: - if ( IsTransparent(a) ) - { - *ptrDst++ = rMask; - *ptrDst++ = gMask; - *ptrDst++ = bMask; - break; - } - // else: !transparent - - // must be opaque then as otherwise we shouldn't be - // using the mask at all - wxASSERT_MSG( IsOpaque(a), _T("logic error") ); - - // fall through - - case Transparency_Alpha: - if ( alpha ) - *alpha++ = a; - // fall through - - case Transparency_None: - *ptrDst++ = g; - *ptrDst++ = g; - *ptrDst++ = g; - break; - } - } - } - } - else // colour image: RGBRGB... - { - for ( png_uint_32 y = 0; y < height; y++ ) - { - const unsigned char *ptrSrc = lines[y]; - for ( png_uint_32 x = 0; x < width; x++ ) - { - unsigned char r = *ptrSrc++; - unsigned char g = *ptrSrc++; - unsigned char b = *ptrSrc++; - unsigned char a = *ptrSrc++; - - // the logic here is the same as for the grey case except - // where noted - if ( !IsOpaque(a) && transparency == Transparency_None ) - { - transparency = CheckTransparency - ( - lines, - x, y, - width, height, - 3 - ); - - if ( transparency == Transparency_Mask ) - { - FindMaskColour(lines, width, height, - rMask, gMask, bMask); - } - else // transparency == Transparency_Alpha - { - alpha = InitAlpha(image, x, y); - } - - } - - switch ( transparency ) - { - case Transparency_Mask: - if ( IsTransparent(a) ) - { - *ptrDst++ = rMask; - *ptrDst++ = gMask; - *ptrDst++ = bMask; - break; - } - else // !transparent - { - // must be opaque then as otherwise we shouldn't be - // using the mask at all - wxASSERT_MSG( IsOpaque(a), _T("logic error") ); - - // if we couldn't find a unique colour for the - // mask, we can have real pixels with the same - // value as the mask and it's better to slightly - // change their colour than to make them - // transparent - if ( r == rMask && g == gMask && b == bMask ) - { - r++; - } - } - - // fall through - - case Transparency_Alpha: - if ( alpha ) - *alpha++ = a; - // fall through - - case Transparency_None: - *ptrDst++ = r; - *ptrDst++ = g; - *ptrDst++ = b; - break; - } - } - } - } - - if ( transparency == Transparency_Mask ) - { - image->SetMaskColour(rMask, gMask, bMask); - } -} - -// temporarily disable the warning C4611 (interaction between '_setjmp' and -// C++ object destruction is non-portable) - I don't see any dtors here -#ifdef __VISUALC__ - #pragma warning(disable:4611) -#endif /* VC++ */ - -bool -wxPNGHandler::LoadFile(wxImage *image, - wxInputStream& stream, - bool verbose, - int WXUNUSED(index)) -{ - // VZ: as this function uses setjmp() the only fool-proof error handling - // method is to use goto (setjmp is not really C++ dtors friendly...) - - unsigned char **lines = NULL; - png_infop info_ptr = (png_infop) NULL; - wxPNGInfoStruct wxinfo; - - png_uint_32 i, width, height = 0; - int bit_depth, color_type, interlace_type; - - wxinfo.verbose = verbose; - wxinfo.stream.in = &stream; - - image->Destroy(); - - png_structp png_ptr = png_create_read_struct - ( - PNG_LIBPNG_VER_STRING, - NULL, - wx_png_error, - wx_png_warning - ); - if (!png_ptr) - goto error; - - // NB: please see the comment near wxPNGInfoStruct declaration for - // explanation why this line is mandatory - png_set_read_fn( png_ptr, &wxinfo, wx_PNG_stream_reader); - - info_ptr = png_create_info_struct( png_ptr ); - if (!info_ptr) - goto error; - - if (setjmp(wxinfo.jmpbuf)) - goto error; - - png_read_info( png_ptr, info_ptr ); - png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, (int*) NULL, (int*) NULL ); - - if (color_type == PNG_COLOR_TYPE_PALETTE) - png_set_expand( png_ptr ); - - // Fix for Bug [ 439207 ] Monochrome PNG images come up black - if (bit_depth < 8) - png_set_expand( png_ptr ); - - png_set_strip_16( png_ptr ); - png_set_packing( png_ptr ); - if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS)) - png_set_expand( png_ptr ); - png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER ); - - image->Create((int)width, (int)height, (bool) false /* no need to init pixels */); - - if (!image->Ok()) - goto error; - - // initialize all line pointers to NULL to ensure that they can be safely - // free()d if an error occurs before all of them could be allocated - lines = (unsigned char **)calloc(height, sizeof(unsigned char *)); - if ( !lines ) - goto error; - - for (i = 0; i < height; i++) - { - if ((lines[i] = (unsigned char *)malloc( (size_t)(width * (sizeof(unsigned char) * 4)))) == NULL) - goto error; - } - - png_read_image( png_ptr, lines ); - png_read_end( png_ptr, info_ptr ); - -#if wxUSE_PALETTE - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - int ncolors = 0; - png_colorp palette; - png_get_PLTE( png_ptr, info_ptr, &palette, &ncolors); - unsigned char* r = new unsigned char[ncolors]; - unsigned char* g = new unsigned char[ncolors]; - unsigned char* b = new unsigned char[ncolors]; - int j; - - for (j = 0; j < ncolors; j++) - { - r[j] = palette[j].red; - g[j] = palette[j].green; - b[j] = palette[j].blue; - } - - image->SetPalette(wxPalette(ncolors, r, g, b)); - delete[] r; - delete[] g; - delete[] b; - } -#endif // wxUSE_PALETTE - - png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL ); - - // loaded successfully, now init wxImage with this data - CopyDataFromPNG(image, lines, width, height, color_type); - - for ( i = 0; i < height; i++ ) - free( lines[i] ); - free( lines ); - - return true; - -error: - if (verbose) - wxLogError(_("Couldn't load a PNG image - file is corrupted or not enough memory.")); - - if ( image->Ok() ) - { - image->Destroy(); - } - - if ( lines ) - { - for ( unsigned int n = 0; n < height; n++ ) - free( lines[n] ); - - free( lines ); - } - - if ( png_ptr ) - { - if ( info_ptr ) - { - png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL ); - free(info_ptr); - } - else - png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL ); - } - return false; -} - -// ---------------------------------------------------------------------------- -// writing PNGs -// ---------------------------------------------------------------------------- - -bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) -{ - wxPNGInfoStruct wxinfo; - - wxinfo.verbose = verbose; - wxinfo.stream.out = &stream; - - png_structp png_ptr = png_create_write_struct - ( - PNG_LIBPNG_VER_STRING, - NULL, - wx_png_error, - wx_png_warning - ); - if (!png_ptr) - { - if (verbose) - wxLogError(_("Couldn't save PNG image.")); - return false; - } - - png_infop info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) - { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); - if (verbose) - wxLogError(_("Couldn't save PNG image.")); - return false; - } - - if (setjmp(wxinfo.jmpbuf)) - { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); - if (verbose) - wxLogError(_("Couldn't save PNG image.")); - return false; - } - - // NB: please see the comment near wxPNGInfoStruct declaration for - // explanation why this line is mandatory - png_set_write_fn( png_ptr, &wxinfo, wx_PNG_stream_writer, NULL); - - const int iColorType = image->HasOption(wxIMAGE_OPTION_PNG_FORMAT) - ? image->GetOptionInt(wxIMAGE_OPTION_PNG_FORMAT) - : wxPNG_TYPE_COLOUR; - const int iBitDepth = image->HasOption(wxIMAGE_OPTION_PNG_BITDEPTH) - ? image->GetOptionInt(wxIMAGE_OPTION_PNG_BITDEPTH) - : 8; - - wxASSERT_MSG( iBitDepth == 8 || iBitDepth == 16, - _T("PNG bit depth must be 8 or 16") ); - - bool bHasAlpha = image->HasAlpha(); - bool bHasMask = image->HasMask(); - bool bUseAlpha = bHasAlpha || bHasMask; - - int iPngColorType; - if ( iColorType==wxPNG_TYPE_COLOUR ) - { - iPngColorType = bUseAlpha ? PNG_COLOR_TYPE_RGB_ALPHA - : PNG_COLOR_TYPE_RGB; - } - else - { - iPngColorType = bUseAlpha ? PNG_COLOR_TYPE_GRAY_ALPHA - : PNG_COLOR_TYPE_GRAY; - } - - png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), - iBitDepth, iPngColorType, - PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, - PNG_FILTER_TYPE_BASE); - - int iElements; - png_color_8 sig_bit; - - if ( iPngColorType & PNG_COLOR_MASK_COLOR ) - { - sig_bit.red = - sig_bit.green = - sig_bit.blue = (png_byte)iBitDepth; - iElements = 3; - } - else // grey - { - sig_bit.gray = (png_byte)iBitDepth; - iElements = 1; - } - - if ( iPngColorType & PNG_COLOR_MASK_ALPHA ) - { - sig_bit.alpha = (png_byte)iBitDepth; - iElements++; - } - - if ( iBitDepth == 16 ) - iElements *= 2; - - png_set_sBIT( png_ptr, info_ptr, &sig_bit ); - png_write_info( png_ptr, info_ptr ); - png_set_shift( png_ptr, &sig_bit ); - png_set_packing( png_ptr ); - - unsigned char * - data = (unsigned char *)malloc( image->GetWidth() * iElements ); - if ( !data ) - { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); - return false; - } - - unsigned char * - pAlpha = (unsigned char *)(bHasAlpha ? image->GetAlpha() : NULL); - int iHeight = image->GetHeight(); - int iWidth = image->GetWidth(); - - unsigned char uchMaskRed = 0, uchMaskGreen = 0, uchMaskBlue = 0; - - if ( bHasMask ) - { - uchMaskRed = image->GetMaskRed(); - uchMaskGreen = image->GetMaskGreen(); - uchMaskBlue = image->GetMaskBlue(); - } - - unsigned char *pColors = image->GetData(); - - for (int y = 0; y != iHeight; ++y) - { - unsigned char *pData = data; - for (int x = 0; x != iWidth; x++) - { - unsigned char uchRed = *pColors++; - unsigned char uchGreen = *pColors++; - unsigned char uchBlue = *pColors++; - - switch ( iColorType ) - { - default: - wxFAIL_MSG( _T("unknown wxPNG_TYPE_XXX") ); - // fall through - - case wxPNG_TYPE_COLOUR: - *pData++ = uchRed; - if ( iBitDepth == 16 ) - *pData++ = 0; - *pData++ = uchGreen; - if ( iBitDepth == 16 ) - *pData++ = 0; - *pData++ = uchBlue; - if ( iBitDepth == 16 ) - *pData++ = 0; - break; - - case wxPNG_TYPE_GREY: - { - // where do these coefficients come from? maybe we - // should have image options for them as well? - unsigned uiColor = - (unsigned) (76.544*(unsigned)uchRed + - 150.272*(unsigned)uchGreen + - 36.864*(unsigned)uchBlue); - - *pData++ = (unsigned char)((uiColor >> 8) & 0xFF); - if ( iBitDepth == 16 ) - *pData++ = (unsigned char)(uiColor & 0xFF); - } - break; - - case wxPNG_TYPE_GREY_RED: - *pData++ = uchRed; - if ( iBitDepth == 16 ) - *pData++ = 0; - break; - } - - if ( bUseAlpha ) - { - unsigned char uchAlpha = 255; - if ( bHasAlpha ) - uchAlpha = *pAlpha++; - - if ( bHasMask ) - { - if ( (uchRed == uchMaskRed) - && (uchGreen == uchMaskGreen) - && (uchBlue == uchMaskBlue) ) - uchAlpha = 0; - } - - *pData++ = uchAlpha; - if ( iBitDepth == 16 ) - *pData++ = 0; - } - } - - png_bytep row_ptr = data; - png_write_rows( png_ptr, &row_ptr, 1 ); - } - - free(data); - png_write_end( png_ptr, info_ptr ); - png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr ); - - return true; -} - -#ifdef __VISUALC__ - #pragma warning(default:4611) -#endif /* VC++ */ - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LIBPNG diff --git a/Source/3rdParty/wx/src/common/imagpnm.cpp b/Source/3rdParty/wx/src/common/imagpnm.cpp deleted file mode 100644 index 3fcc95916..000000000 --- a/Source/3rdParty/wx/src/common/imagpnm.cpp +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagpnm.cpp -// Purpose: wxImage PNM handler -// Author: Sylvain Bougnoux -// RCS-ID: $Id: imagpnm.cpp 46311 2007-06-03 22:14:32Z VZ $ -// Copyright: (c) Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_PNM - -#include "wx/imagpnm.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#include "wx/txtstrm.h" - -//----------------------------------------------------------------------------- -// wxBMPHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler) - -#if wxUSE_STREAMS - -void Skip_Comment(wxInputStream &stream) -{ - wxTextInputStream text_stream(stream); - - if (stream.Peek()==wxT('#')) - { - text_stream.ReadLine(); - Skip_Comment(stream); - } -} - -bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) -{ - wxUint32 width, height; - wxUint16 maxval; - char c(0); - - image->Destroy(); - - /* - * Read the PNM header - */ - - wxBufferedInputStream buf_stream(stream); - wxTextInputStream text_stream(buf_stream); - - Skip_Comment(buf_stream); - if (buf_stream.GetC()==wxT('P')) c=buf_stream.GetC(); - - switch (c) - { - case wxT('2'): // ASCII Grey - case wxT('3'): // ASCII RGB - case wxT('5'): // RAW Grey - case wxT('6'): break; - default: - if (verbose) wxLogError(_("PNM: File format is not recognized.")); - return false; - } - - text_stream.ReadLine(); // for the \n - Skip_Comment(buf_stream); - text_stream >> width >> height ; - Skip_Comment(buf_stream); - text_stream >> maxval; - - //cout << line << " " << width << " " << height << " " << maxval << endl; - image->Create( width, height ); - unsigned char *ptr = image->GetData(); - if (!ptr) - { - if (verbose) - wxLogError( _("PNM: Couldn't allocate memory.") ); - return false; - } - - - if (c=='2') // Ascii GREY - { - wxUint32 value, size=width*height; - for (wxUint32 i=0; iSetMask( false ); - - const wxStreamError err = buf_stream.GetLastError(); - return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF; -} - -bool wxPNMHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool WXUNUSED(verbose) ) -{ - wxTextOutputStream text_stream(stream); - - //text_stream << "P6" << endl - //<< image->GetWidth() << " " << image->GetHeight() << endl - //<< "255" << endl; - text_stream << wxT("P6\n") << image->GetWidth() << wxT(" ") << image->GetHeight() << wxT("\n255\n"); - stream.Write(image->GetData(),3*image->GetWidth()*image->GetHeight()); - - return stream.IsOk(); -} - -bool wxPNMHandler::DoCanRead( wxInputStream& stream ) -{ - Skip_Comment(stream); - - if ( stream.GetC() == 'P' ) - { - switch ( stream.GetC() ) - { - case '2': // ASCII Grey - case '3': // ASCII RGB - case '5': // RAW Grey - case '6': // RAW RGB - return true; - } - } - - return false; -} - - -#endif // wxUSE_STREAMS - -#endif // wxUSE_IMAGE && wxUSE_PNM diff --git a/Source/3rdParty/wx/src/common/imagtga.cpp b/Source/3rdParty/wx/src/common/imagtga.cpp deleted file mode 100644 index c9b39dce7..000000000 --- a/Source/3rdParty/wx/src/common/imagtga.cpp +++ /dev/null @@ -1,750 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagtga.cpp -// Purpose: wxImage TGA handler -// Author: Seth Jackson -// CVS-ID: $Id: imagtga.cpp 43681 2006-11-27 15:01:58Z VZ $ -// Copyright: (c) 2005 Seth Jackson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_TGA - -#ifndef WX_PRECOMP - #include "wx/palette.h" -#endif - -#include "wx/imagtga.h" -#include "wx/log.h" -#include "wx/scopeguard.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// TGA error codes. -enum -{ - wxTGA_OK = 0, - wxTGA_INVFORMAT = 1, - wxTGA_MEMERR = 2 -}; - -// TGA header bytes. -enum -{ - HDR_OFFSET = 0, - HDR_COLORTYPE = 1, - HDR_IMAGETYPE = 2, - HDR_PALETTESTART = 3, - HDR_PALETTELENGTH = 5, - HDR_PALETTEBITS = 7, - HDR_XORIGIN = 8, - HDR_YORIGIN = 10, - HDR_WIDTH = 12, - HDR_HEIGHT = 14, - HDR_BPP = 16, - HDR_ORIENTATION = 17, - HDR_SIZE -}; - -// TGA color types. -enum -{ - wxTGA_UNMAPPED = 0, - wxTGA_MAPPED = 1 -}; - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxTGAHandler, wxImageHandler) - -#if wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// worker functions -// ---------------------------------------------------------------------------- - -static -void FlipTGA(unsigned char* imageData, int width, int height, short pixelSize) -{ - int lineLength = width * pixelSize; - unsigned char *line1 = imageData; - unsigned char *line2 = &imageData[lineLength * (height - 1)]; - - unsigned char temp; - for ( ; line1 < line2; line2 -= (lineLength * 2)) - { - for (int index = 0; index < lineLength; line1++, line2++, index++) - { - temp = *line1; - *line1 = *line2; - *line2 = temp; - } - } -} - -static -void DecodeRLE(unsigned char* imageData, unsigned long imageSize, - short pixelSize, wxInputStream& stream) -{ - unsigned long index = 0; - unsigned char current; - unsigned int length; - unsigned char buf[4]; - - while (index < imageSize) - { - current = stream.GetC(); - - // RLE packet. - if ( current & 0x80 ) - { - // Get the run length of the packet. - current &= 0x7f; - - current++; - - length = current; - - index += current * pixelSize; - - // Repeat the pixel length times. - stream.Read(buf, pixelSize); - - for (unsigned int i = 0; i < length; i++) - { - memcpy(imageData, buf, pixelSize); - - imageData += pixelSize; - } - } - else // Raw packet. - { - // Get the run length of the packet. - current++; - - length = current * pixelSize; - - index += length; - - // Write the next length pixels directly to the image data. - stream.Read(imageData, length); - - imageData += length; - } - } -} - -static -int ReadTGA(wxImage* image, wxInputStream& stream) -{ - // Read in the TGA header - unsigned char hdr[HDR_SIZE]; - stream.Read(hdr, HDR_SIZE); - - short offset = hdr[HDR_OFFSET] + HDR_SIZE; - short colorType = hdr[HDR_COLORTYPE]; - short imageType = hdr[HDR_IMAGETYPE]; - int paletteLength = hdr[HDR_PALETTELENGTH] + 256 * hdr[HDR_PALETTELENGTH + 1]; - int width = (hdr[HDR_WIDTH] + 256 * hdr[HDR_WIDTH + 1]) - - (hdr[HDR_XORIGIN] + 256 * hdr[HDR_XORIGIN + 1]); - int height = (hdr[HDR_HEIGHT] + 256 * hdr[HDR_HEIGHT + 1]) - - (hdr[HDR_YORIGIN] + 256 * hdr[HDR_YORIGIN + 1]); - short bpp = hdr[HDR_BPP]; - short orientation = hdr[HDR_ORIENTATION] & 0x20; - - image->Create(width, height); - - if (!image->Ok()) - { - return wxTGA_MEMERR; - } - - const short pixelSize = bpp / 8; - - const unsigned long imageSize = width * height * pixelSize; - - unsigned char *imageData = (unsigned char* )malloc(imageSize); - - if (!imageData) - { - return wxTGA_MEMERR; - } - - wxON_BLOCK_EXIT1(free, imageData); - - unsigned char *dst = image->GetData(); - - unsigned char* alpha = NULL; - if (bpp == 16 || bpp == 32) - { - image->SetAlpha(); - - alpha = image->GetAlpha(); - } - - // Seek from the offset we got from the TGA header. - stream.SeekI(offset, wxFromStart); - - // Load a palette if we have one. - if (colorType == wxTGA_MAPPED) - { - unsigned char buf[3]; - - unsigned char* r = new unsigned char[paletteLength]; - unsigned char* g = new unsigned char[paletteLength]; - unsigned char* b = new unsigned char[paletteLength]; - - for (int i = 0; i < paletteLength; i++) - { - stream.Read(buf, 3); - - r[i] = buf[2]; - g[i] = buf[1]; - b[i] = buf[0]; - } - -#if wxUSE_PALETTE - // Set the palette of the image. - image->SetPalette(wxPalette(paletteLength, r, g, b)); -#endif // wxUSE_PALETTE - - delete[] r; - delete[] g; - delete[] b; - } - - // Handle the various TGA formats we support. - - switch (imageType) - { -#if wxUSE_PALETTE - // Raw indexed. - - case 1: - { - const wxPalette& palette = image->GetPalette(); - unsigned char r; - unsigned char g; - unsigned char b; - - // No compression read the data directly to imageData. - - stream.Read(imageData, imageSize); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - // 8 bpp. - - case 8: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - palette.GetRGB(imageData[index], &r, &g, &b); - - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; - } - } - break; - - // 16 bpp. - - case 16: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - palette.GetRGB(imageData[index], &r, &g, &b); - - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; - *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; -#endif // wxUSE_PALETTE - - // Raw RGB. - - case 2: - { - // No compression read the data directly to imageData. - - stream.Read(imageData, imageSize); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - //16 bpp. - - case 16: - { - unsigned char temp; - - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - temp = (imageData[index + 1] & 0x7c) << 1; - temp |= temp >> 5; - *(dst++) = temp; - - temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2); - temp |= temp >> 5; - *(dst++) = temp; - - temp = (imageData[index] & 0x1f) << 3; - temp |= temp >> 5; - *(dst++) = temp; - - *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255; - } - } - break; - - // 24 bpp. - - case 24: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index + 2]; - *(dst++) = imageData[index + 1]; - *(dst++) = imageData[index]; - } - } - break; - - // 32 bpp. - - case 32: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index + 2]; - *(dst++) = imageData[index + 1]; - *(dst++) = imageData[index]; - *(alpha++) = imageData[index + 3]; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; - - // Raw grayscale. - - case 3: - { - // No compression read the data directly to imageData. - - stream.Read(imageData, imageSize); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - // 8 bpp. - - case 8: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - } - } - break; - - // 16 bpp. - - case 16: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(alpha++) = imageData[index + 1]; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; - -#if wxUSE_PALETTE - // RLE indexed. - - case 9: - { - const wxPalette& palette = image->GetPalette(); - unsigned char r; - unsigned char g; - unsigned char b; - - // Decode the RLE data. - - DecodeRLE(imageData, imageSize, pixelSize, stream); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - // 8 bpp. - - case 8: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - palette.GetRGB(imageData[index], &r, &g, &b); - - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; - } - } - break; - - // 16 bpp. - - case 16: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - palette.GetRGB(imageData[index], &r, &g, &b); - - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; - *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; -#endif // wxUSE_PALETTE - - // RLE RGB. - - case 10: - { - // Decode the RLE data. - - DecodeRLE(imageData, imageSize, pixelSize, stream); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - //16 bpp. - - case 16: - { - unsigned char temp; - - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - temp = (imageData[index + 1] & 0x7c) << 1; - temp |= temp >> 5; - *(dst++) = temp; - - temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2); - temp |= temp >> 5; - *(dst++) = temp; - - temp = (imageData[index] & 0x1f) << 3; - temp |= temp >> 5; - *(dst++) = temp; - - *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255; - } - } - break; - - // 24 bpp. - - case 24: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index + 2]; - *(dst++) = imageData[index + 1]; - *(dst++) = imageData[index]; - } - } - break; - - // 32 bpp. - - case 32: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index + 2]; - *(dst++) = imageData[index + 1]; - *(dst++) = imageData[index]; - *(alpha++) = imageData[index + 3]; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; - - // RLE grayscale. - - case 11: - { - // Decode the RLE data. - - DecodeRLE(imageData, imageSize, pixelSize, stream); - - // If orientation == 0, then the image is stored upside down. - // We need to store it right side up. - - if (orientation == 0) - { - FlipTGA(imageData, width, height, pixelSize); - } - - // Handle the different pixel depths. - - switch (bpp) - { - // 8 bpp. - - case 8: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - } - } - break; - - // 16 bpp. - - case 16: - { - for (unsigned long index = 0; index < imageSize; index += pixelSize) - { - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(dst++) = imageData[index]; - *(alpha++) = imageData[index + 1]; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - } - break; - - default: - return wxTGA_INVFORMAT; - } - - return wxTGA_OK; -} - -static -int SaveTGA(wxImage* WXUNUSED(image), wxOutputStream& WXUNUSED(stream)) -{ - wxLogError(wxT("Saving in TGA format is not implemented.")); - - return wxTGA_OK; -} - -// ---------------------------------------------------------------------------- -// wxTGAHandler -// ---------------------------------------------------------------------------- - -bool wxTGAHandler::LoadFile(wxImage* image, - wxInputStream& stream, - bool verbose, - int WXUNUSED(index)) -{ - if ( !CanRead(stream) ) - { - if ( verbose ) - wxLogError(wxT("TGA: this is not a TGA file.")); - - return false; - } - - image->Destroy(); - - int error = ReadTGA(image, stream); - if ( error != wxTGA_OK ) - { - if ( verbose ) - { - switch ( error ) - { - case wxTGA_INVFORMAT: - wxLogError(wxT("TGA: image format unsupported.")); - break; - - case wxTGA_MEMERR: - wxLogError(wxT("TGA: couldn't allocate memory.")); - break; - - default: - wxLogError(wxT("TGA: unknown error!")); - } - } - - image->Destroy(); - - return false; - } - - return true; -} - -bool wxTGAHandler::SaveFile(wxImage* image, wxOutputStream& stream, bool verbose) -{ - int error = SaveTGA(image, stream); - - if ( error != wxTGA_OK ) - { - if ( verbose ) - { - switch ( error ) - { - case wxTGA_INVFORMAT: - wxLogError(wxT("TGA: invalid image.")); - break; - - case wxTGA_MEMERR: - wxLogError(wxT("TGA: couldn't allocate memory.")); - break; - - default: - wxLogError(wxT("TGA: unknown error!")); - } - } - - return false; - } - - return true; -} - -bool wxTGAHandler::DoCanRead(wxInputStream& stream) -{ - // read the fixed-size TGA headers - unsigned char hdr[HDR_SIZE]; - stream.Read(hdr, HDR_SIZE); - - // Check wether we can read the file or not. - - short colorType = hdr[HDR_COLORTYPE]; - if ( colorType != wxTGA_UNMAPPED && colorType != wxTGA_MAPPED ) - { - return false; - } - - short imageType = hdr[HDR_IMAGETYPE]; - if ( imageType == 0 || imageType == 32 || imageType == 33 ) - { - return false; - } - - short bpp = hdr[HDR_BPP]; - if ( bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32 ) - { - return false; - } - - return true; -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_IMAGE && wxUSE_TGA diff --git a/Source/3rdParty/wx/src/common/imagtiff.cpp b/Source/3rdParty/wx/src/common/imagtiff.cpp deleted file mode 100644 index 7a48cf51c..000000000 --- a/Source/3rdParty/wx/src/common/imagtiff.cpp +++ /dev/null @@ -1,525 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagtiff.cpp -// Purpose: wxImage TIFF handler -// Author: Robert Roebling -// RCS-ID: $Id: imagtiff.cpp 60897 2009-06-04 22:28:48Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_LIBTIFF - -#include "wx/imagtiff.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/bitmap.h" - #include "wx/module.h" -#endif - -extern "C" -{ - #include "tiff.h" - #include "tiffio.h" -} -#include "wx/filefn.h" -#include "wx/wfstream.h" - -#ifndef TIFFLINKAGEMODE - #if defined(__WATCOMC__) && defined(__WXMGL__) - #define TIFFLINKAGEMODE cdecl - #else - #define TIFFLINKAGEMODE LINKAGEMODE - #endif -#endif - -//----------------------------------------------------------------------------- -// wxTIFFHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler) - -#if wxUSE_STREAMS - -// helper to translate our, possibly 64 bit, wxFileOffset to TIFF, always 32 -// bit, toff_t -static toff_t wxFileOffsetToTIFF(wxFileOffset ofs) -{ - if ( ofs == wxInvalidOffset ) - return (toff_t)-1; - - toff_t tofs = wx_truncate_cast(toff_t, ofs); - wxCHECK_MSG( (wxFileOffset)tofs == ofs, (toff_t)-1, - _T("TIFF library doesn't support large files") ); - - return tofs; -} - -// another helper to convert standard seek mode to our -static wxSeekMode wxSeekModeFromTIFF(int whence) -{ - switch ( whence ) - { - case SEEK_SET: - return wxFromStart; - - case SEEK_CUR: - return wxFromCurrent; - - case SEEK_END: - return wxFromEnd; - - default: - return wxFromCurrent; - } -} - -extern "C" -{ - -tsize_t TIFFLINKAGEMODE -wxTIFFNullProc(thandle_t WXUNUSED(handle), - tdata_t WXUNUSED(buf), - tsize_t WXUNUSED(size)) -{ - return (tsize_t) -1; -} - -tsize_t TIFFLINKAGEMODE -wxTIFFReadProc(thandle_t handle, tdata_t buf, tsize_t size) -{ - wxInputStream *stream = (wxInputStream*) handle; - stream->Read( (void*) buf, (size_t) size ); - return wx_truncate_cast(tsize_t, stream->LastRead()); -} - -tsize_t TIFFLINKAGEMODE -wxTIFFWriteProc(thandle_t handle, tdata_t buf, tsize_t size) -{ - wxOutputStream *stream = (wxOutputStream*) handle; - stream->Write( (void*) buf, (size_t) size ); - return wx_truncate_cast(tsize_t, stream->LastWrite()); -} - -toff_t TIFFLINKAGEMODE -wxTIFFSeekIProc(thandle_t handle, toff_t off, int whence) -{ - wxInputStream *stream = (wxInputStream*) handle; - - return wxFileOffsetToTIFF(stream->SeekI((wxFileOffset)off, - wxSeekModeFromTIFF(whence))); -} - -toff_t TIFFLINKAGEMODE -wxTIFFSeekOProc(thandle_t handle, toff_t off, int whence) -{ - wxOutputStream *stream = (wxOutputStream*) handle; - - return wxFileOffsetToTIFF(stream->SeekO((wxFileOffset)off, - wxSeekModeFromTIFF(whence))); -} - -int TIFFLINKAGEMODE -wxTIFFCloseIProc(thandle_t WXUNUSED(handle)) -{ - // there is no need to close the input stream - return 0; -} - -int TIFFLINKAGEMODE -wxTIFFCloseOProc(thandle_t handle) -{ - wxOutputStream *stream = (wxOutputStream*) handle; - - return stream->Close() ? 0 : -1; -} - -toff_t TIFFLINKAGEMODE -wxTIFFSizeProc(thandle_t handle) -{ - wxStreamBase *stream = (wxStreamBase*) handle; - return (toff_t) stream->GetSize(); -} - -int TIFFLINKAGEMODE -wxTIFFMapProc(thandle_t WXUNUSED(handle), - tdata_t* WXUNUSED(pbase), - toff_t* WXUNUSED(psize)) -{ - return 0; -} - -void TIFFLINKAGEMODE -wxTIFFUnmapProc(thandle_t WXUNUSED(handle), - tdata_t WXUNUSED(base), - toff_t WXUNUSED(size)) -{ -} - -static void -TIFFwxWarningHandler(const char* module, - const char* WXUNUSED_IN_UNICODE(fmt), - va_list WXUNUSED_IN_UNICODE(ap)) -{ - if (module != NULL) - wxLogWarning(_("tiff module: %s"), wxString::FromAscii(module).c_str()); - - // FIXME: this is not terrible informative but better than crashing! -#if wxUSE_UNICODE - wxLogWarning(_("TIFF library warning.")); -#else - wxVLogWarning(fmt, ap); -#endif -} - -static void -TIFFwxErrorHandler(const char* module, - const char* WXUNUSED_IN_UNICODE(fmt), - va_list WXUNUSED_IN_UNICODE(ap)) -{ - if (module != NULL) - wxLogError(_("tiff module: %s"), wxString::FromAscii(module).c_str()); - - // FIXME: as above -#if wxUSE_UNICODE - wxLogError(_("TIFF library error.")); -#else - wxVLogError(fmt, ap); -#endif -} - -} // extern "C" - -TIFF* -TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode) -{ - TIFF* tif = TIFFClientOpen(name, mode, - (thandle_t) &stream, - wxTIFFReadProc, wxTIFFNullProc, - wxTIFFSeekIProc, wxTIFFCloseIProc, wxTIFFSizeProc, - wxTIFFMapProc, wxTIFFUnmapProc); - - return tif; -} - -TIFF* -TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode) -{ - TIFF* tif = TIFFClientOpen(name, mode, - (thandle_t) &stream, - wxTIFFNullProc, wxTIFFWriteProc, - wxTIFFSeekOProc, wxTIFFCloseOProc, wxTIFFSizeProc, - wxTIFFMapProc, wxTIFFUnmapProc); - - return tif; -} - -wxTIFFHandler::wxTIFFHandler() -{ - m_name = wxT("TIFF file"); - m_extension = wxT("tif"); - m_type = wxBITMAP_TYPE_TIF; - m_mime = wxT("image/tiff"); - TIFFSetWarningHandler((TIFFErrorHandler) TIFFwxWarningHandler); - TIFFSetErrorHandler((TIFFErrorHandler) TIFFwxErrorHandler); -} - -bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ) -{ - if (index == -1) - index = 0; - - image->Destroy(); - - TIFF *tif = TIFFwxOpen( stream, "image", "r" ); - - if (!tif) - { - if (verbose) - wxLogError( _("TIFF: Error loading image.") ); - - return false; - } - - if (!TIFFSetDirectory( tif, (tdir_t)index )) - { - if (verbose) - wxLogError( _("Invalid TIFF image index.") ); - - TIFFClose( tif ); - - return false; - } - - uint32 w, h; - uint32 *raster; - - TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &w ); - TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &h ); - - uint16 extraSamples; - uint16* samplesInfo; - TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, - &extraSamples, &samplesInfo); - const bool hasAlpha = (extraSamples == 1 && - (samplesInfo[0] == EXTRASAMPLE_ASSOCALPHA || - samplesInfo[0] == EXTRASAMPLE_UNASSALPHA)); - - // guard against integer overflow during multiplication which could result - // in allocating a too small buffer and then overflowing it - const double bytesNeeded = (double)w * (double)h * sizeof(uint32); - if ( bytesNeeded >= 4294967295U /* UINT32_MAX */ ) - { - if ( verbose ) - wxLogError( _("TIFF: Image size is abnormally big.") ); - - TIFFClose(tif); - - return false; - } - - raster = (uint32*) _TIFFmalloc( bytesNeeded ); - - if (!raster) - { - if (verbose) - wxLogError( _("TIFF: Couldn't allocate memory.") ); - - TIFFClose( tif ); - - return false; - } - - image->Create( (int)w, (int)h ); - if (!image->Ok()) - { - if (verbose) - wxLogError( _("TIFF: Couldn't allocate memory.") ); - - _TIFFfree( raster ); - TIFFClose( tif ); - - return false; - } - - if ( hasAlpha ) - image->SetAlpha(); - - if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) - { - if (verbose) - wxLogError( _("TIFF: Error reading image.") ); - - _TIFFfree( raster ); - image->Destroy(); - TIFFClose( tif ); - - return false; - } - - unsigned char *ptr = image->GetData(); - ptr += w*3*(h-1); - - unsigned char *alpha = hasAlpha ? image->GetAlpha() : NULL; - if ( hasAlpha ) - alpha += w*(h-1); - - uint32 pos = 0; - - for (uint32 i = 0; i < h; i++) - { - for (uint32 j = 0; j < w; j++) - { - *(ptr++) = (unsigned char)TIFFGetR(raster[pos]); - *(ptr++) = (unsigned char)TIFFGetG(raster[pos]); - *(ptr++) = (unsigned char)TIFFGetB(raster[pos]); - if ( hasAlpha ) - *(alpha++) = (unsigned char)TIFFGetA(raster[pos]); - - pos++; - } - - // subtract line we just added plus one line: - ptr -= 2*w*3; - if ( hasAlpha ) - alpha -= 2*w; - } - - _TIFFfree( raster ); - - TIFFClose( tif ); - - return true; -} - -int wxTIFFHandler::GetImageCount( wxInputStream& stream ) -{ - TIFF *tif = TIFFwxOpen( stream, "image", "r" ); - - if (!tif) - return 0; - - int dircount = 0; // according to the libtiff docs, dircount should be set to 1 here??? - do { - dircount++; - } while (TIFFReadDirectory(tif)); - - TIFFClose( tif ); - - return dircount; -} - -bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) -{ - TIFF *tif = TIFFwxOpen( stream, "image", "w" ); - - if (!tif) - { - if (verbose) - wxLogError( _("TIFF: Error saving image.") ); - - return false; - } - - TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth()); - TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32)image->GetHeight()); - TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - - if ( image->HasOption(wxIMAGE_OPTION_RESOLUTIONX) && - image->HasOption(wxIMAGE_OPTION_RESOLUTIONY) ) - { - TIFFSetField(tif, TIFFTAG_XRESOLUTION, - (float)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONX)); - TIFFSetField(tif, TIFFTAG_YRESOLUTION, - (float)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONY)); - } - - int spp = image->GetOptionInt(wxIMAGE_OPTION_SAMPLESPERPIXEL); - if ( !spp ) - spp = 3; - - int bpp = image->GetOptionInt(wxIMAGE_OPTION_BITSPERSAMPLE); - if ( !bpp ) - bpp=8; - - int compression = image->GetOptionInt(wxIMAGE_OPTION_COMPRESSION); - if ( !compression ) - { - // we can't use COMPRESSION_LZW because current version of libtiff - // doesn't implement it ("no longer implemented due to Unisys patent - // enforcement") and other compression methods are lossy so we - // shouldn't use them by default -- and the only remaining one is none - compression = COMPRESSION_NONE; - } - - TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp); - TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bpp); - TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, spp*bpp == 1 ? PHOTOMETRIC_MINISBLACK - : PHOTOMETRIC_RGB); - TIFFSetField(tif, TIFFTAG_COMPRESSION, compression); - - // scanlinesize if determined by spp and bpp - tsize_t linebytes = (tsize_t)image->GetWidth() * spp * bpp / 8; - - if ( (image->GetWidth() % 8 > 0) && (spp * bpp < 8) ) - linebytes+=1; - - unsigned char *buf; - - if (TIFFScanlineSize(tif) > linebytes || (spp * bpp < 24)) - { - buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif)); - if (!buf) - { - if (verbose) - wxLogError( _("TIFF: Couldn't allocate memory.") ); - - TIFFClose( tif ); - - return false; - } - } - else - { - buf = NULL; - } - - TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,TIFFDefaultStripSize(tif, (uint32) -1)); - - unsigned char *ptr = image->GetData(); - for ( int row = 0; row < image->GetHeight(); row++ ) - { - if ( buf ) - { - if ( spp * bpp > 1 ) - { - // color image - memcpy(buf, ptr, image->GetWidth()); - } - else // black and white image - { - for ( int column = 0; column < linebytes; column++ ) - { - uint8 reverse = 0; - for ( int bp = 0; bp < 8; bp++ ) - { - if ( ptr[column*24 + bp*3] > 0 ) - { - // check only red as this is sufficient - reverse = (uint8)(reverse | 128 >> bp); - } - } - - buf[column] = reverse; - } - } - } - - if ( TIFFWriteScanline(tif, buf ? buf : ptr, (uint32)row, 0) < 0 ) - { - if (verbose) - wxLogError( _("TIFF: Error writing image.") ); - - TIFFClose( tif ); - if (buf) - _TIFFfree(buf); - - return false; - } - - ptr += image->GetWidth()*3; - } - - (void) TIFFClose(tif); - - if (buf) - _TIFFfree(buf); - - return true; -} - -bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) -{ - unsigned char hdr[2]; - - if ( !stream.Read(&hdr[0], WXSIZEOF(hdr)) ) - return false; - - return (hdr[0] == 'I' && hdr[1] == 'I') || - (hdr[0] == 'M' && hdr[1] == 'M'); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LIBTIFF diff --git a/Source/3rdParty/wx/src/common/imagxpm.cpp b/Source/3rdParty/wx/src/common/imagxpm.cpp deleted file mode 100644 index 8ef328cf2..000000000 --- a/Source/3rdParty/wx/src/common/imagxpm.cpp +++ /dev/null @@ -1,224 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/imagxpm.cpp -// Purpose: wxXPMHandler -// Author: Vaclav Slavik, Robert Roebling -// RCS-ID: $Id: imagxpm.cpp 53477 2008-05-07 07:28:57Z JS $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - -This file is partially based on source code of ImageMagick by John Cristy. Its -license is as follows: - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -% X X PPPP M M % -% X X P P MM MM % -% X PPPP M M M % -% X X P M M % -% X X P M M % -% % -% % -% Read/Write ImageMagick Image Format. % -% % -% % -% Software Design % -% John Cristy % -% July 1992 % -% % -% % -% Copyright (C) 2001 ImageMagick Studio, a non-profit organization dedicated % -% to making software imaging solutions freely available. % -% % -% Permission is hereby granted, free of charge, to any person obtaining a % -% copy of this software and associated documentation files ("ImageMagick"), % -% to deal in ImageMagick without restriction, including without limitation % -% the rights to use, copy, modify, merge, publish, distribute, sublicense, % -% and/or sell copies of ImageMagick, and to permit persons to whom the % -% ImageMagick is furnished to do so, subject to the following conditions: % -% % -% The above copyright notice and this permission notice shall be included in % -% all copies or substantial portions of ImageMagick. % -% % -% The software is provided "as is", without warranty of any kind, express or % -% implied, including but not limited to the warranties of merchantability, % -% fitness for a particular purpose and noninfringement. In no event shall % -% ImageMagick Studio be liable for any claim, damages or other liability, % -% whether in an action of contract, tort or otherwise, arising from, out of % -% or in connection with ImageMagick or the use or other dealings in % -% ImageMagick. % -% % -% Except as contained in this notice, the name of the ImageMagick Studio % -% shall not be used in advertising or otherwise to promote the sale, use or % -% other dealings in ImageMagick without prior written authorization from the % -% ImageMagick Studio. % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% -*/ - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_XPM - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/utils.h" -#endif - -#include "wx/imagxpm.h" -#include "wx/wfstream.h" -#include "wx/xpmdecod.h" - -IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler) - -//----------------------------------------------------------------------------- -// wxXPMHandler -//----------------------------------------------------------------------------- - -#if wxUSE_STREAMS - -bool wxXPMHandler::LoadFile(wxImage *image, - wxInputStream& stream, - bool WXUNUSED(verbose), int WXUNUSED(index)) -{ - wxXPMDecoder decoder; - - wxImage img = decoder.ReadFile(stream); - if ( !img.Ok() ) - return false; - *image = img; - return true; -} - -bool wxXPMHandler::SaveFile(wxImage * image, - wxOutputStream& stream, bool WXUNUSED(verbose)) -{ - // 1. count colours: - #define MaxCixels 92 - static const char Cixel[MaxCixels+1] = - " .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjk" - "lzxcvbnmMNBVCZASDFGHJKLPIUYTREWQ!~^/()_`'][{}|"; - int i, j, k; - - wxImageHistogram histogram; - int cols = int(image->ComputeHistogram(histogram)); - - int chars_per_pixel = 1; - for ( k = MaxCixels; cols > k; k *= MaxCixels) - chars_per_pixel++; - - // 2. write the header: - wxString sName; - if ( image->HasOption(wxIMAGE_OPTION_FILENAME) ) - { - wxSplitPath(image->GetOption(wxIMAGE_OPTION_FILENAME), - NULL, &sName, NULL); - sName << wxT("_xpm"); - } - - if ( !sName.empty() ) - sName = wxString(wxT("/* XPM */\nstatic const char *")) + sName; - else - sName = wxT("/* XPM */\nstatic const char *xpm_data"); - stream.Write( (const char*) sName.ToAscii(), sName.Len() ); - - char tmpbuf[200]; - // VS: 200b is safe upper bound for anything produced by sprintf below - // (<101 bytes the string, neither %i can expand into more than 10 chars) - sprintf(tmpbuf, - "[] = {\n" - "/* columns rows colors chars-per-pixel */\n" - "\"%i %i %i %i\",\n", - image->GetWidth(), image->GetHeight(), cols, chars_per_pixel); - stream.Write(tmpbuf, strlen(tmpbuf)); - - // 3. create color symbols table: - char *symbols_data = new char[cols * (chars_per_pixel+1)]; - char **symbols = new char*[cols]; - - // 2a. find mask colour: - unsigned long mask_key = 0x1000000 /*invalid RGB value*/; - if (image->HasMask()) - mask_key = (image->GetMaskRed() << 16) | - (image->GetMaskGreen() << 8) | image->GetMaskBlue(); - - // 2b. generate colour table: - for (wxImageHistogram::iterator entry = histogram.begin(); - entry != histogram.end(); ++entry ) - { - unsigned long index = entry->second.index; - symbols[index] = symbols_data + index * (chars_per_pixel+1); - char *sym = symbols[index]; - - for (j = 0; j < chars_per_pixel; j++) - { - sym[j] = Cixel[index % MaxCixels]; - index /= MaxCixels; - } - sym[j] = '\0'; - - unsigned long key = entry->first; - - if (key == 0) - sprintf( tmpbuf, "\"%s c Black\",\n", sym); - else if (key == mask_key) - sprintf( tmpbuf, "\"%s c None\",\n", sym); - else - { - wxByte r = wxByte(key >> 16); - wxByte g = wxByte(key >> 8); - wxByte b = wxByte(key); - sprintf(tmpbuf, "\"%s c #%02X%02X%02X\",\n", sym, r, g, b); - } - stream.Write( tmpbuf, strlen(tmpbuf) ); - } - - stream.Write("/* pixels */\n", 13); - - unsigned char *data = image->GetData(); - for (j = 0; j < image->GetHeight(); j++) - { - char tmp_c; - tmp_c = '\"'; stream.Write(&tmp_c, 1); - for (i = 0; i < image->GetWidth(); i++, data += 3) - { - unsigned long key = (data[0] << 16) | (data[1] << 8) | (data[2]); - stream.Write(symbols[histogram[key].index], chars_per_pixel); - } - tmp_c = '\"'; stream.Write(&tmp_c, 1); - if ( j + 1 < image->GetHeight() ) - { - tmp_c = ','; stream.Write(&tmp_c, 1); - } - tmp_c = '\n'; stream.Write(&tmp_c, 1); - } - stream.Write("};\n", 3 ); - - // Clean up: - delete[] symbols; - delete[] symbols_data; - - return true; -} - -bool wxXPMHandler::DoCanRead(wxInputStream& stream) -{ - wxXPMDecoder decoder; - return decoder.CanRead(stream); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_XPM diff --git a/Source/3rdParty/wx/src/common/init.cpp b/Source/3rdParty/wx/src/common/init.cpp deleted file mode 100644 index 9d68e6abb..000000000 --- a/Source/3rdParty/wx/src/common/init.cpp +++ /dev/null @@ -1,505 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/init.cpp -// Purpose: initialisation for the library -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.10.99 -// RCS-ID: $Id: init.cpp 61555 2009-07-30 07:42:54Z VS $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif //__BORLANDC__ - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/filefn.h" - #include "wx/log.h" - #include "wx/thread.h" - #include "wx/intl.h" - #include "wx/module.h" -#endif - -#include "wx/init.h" - -#include "wx/ptr_scpd.h" -#include "wx/except.h" - -#if defined(__WXMSW__) && defined(__WXDEBUG__) - #include "wx/msw/msvcrt.h" - - static struct EnableMemLeakChecking - { - EnableMemLeakChecking() - { - // do check for memory leaks on program exit (another useful flag - // is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free deallocated - // memory which may be used to simulate low-memory condition) - wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); - } - } gs_enableLeakChecks; -#endif // __WXMSW__ && __WXDEBUG__ - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// we need a dummy app object if the user doesn't want to create a real one -class wxDummyConsoleApp : public wxAppConsole -{ -public: - wxDummyConsoleApp() { } - - virtual int OnRun() { wxFAIL_MSG( _T("unreachable code") ); return 0; } - - DECLARE_NO_COPY_CLASS(wxDummyConsoleApp) -}; - -// we need a special kind of auto pointer to wxApp which not only deletes the -// pointer it holds in its dtor but also resets the global application pointer -wxDECLARE_SCOPED_PTR(wxAppConsole, wxAppPtrBase) -wxDEFINE_SCOPED_PTR(wxAppConsole, wxAppPtrBase) - -class wxAppPtr : public wxAppPtrBase -{ -public: - wxEXPLICIT wxAppPtr(wxAppConsole *ptr = NULL) : wxAppPtrBase(ptr) { } - ~wxAppPtr() - { - if ( get() ) - { - // the pointer is going to be deleted in the base class dtor, don't - // leave the dangling pointer! - wxApp::SetInstance(NULL); - } - } - - void Set(wxAppConsole *ptr) - { - reset(ptr); - - wxApp::SetInstance(ptr); - } - - DECLARE_NO_COPY_CLASS(wxAppPtr) -}; - -// class to ensure that wxAppBase::CleanUp() is called if our Initialize() -// fails -class wxCallAppCleanup -{ -public: - wxCallAppCleanup(wxAppConsole *app) : m_app(app) { } - ~wxCallAppCleanup() { if ( m_app ) m_app->CleanUp(); } - - void Dismiss() { m_app = NULL; } - -private: - wxAppConsole *m_app; -}; - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// suppress warnings about unused variables -static inline void Use(void *) { } - -#define WX_SUPPRESS_UNUSED_WARN(x) Use(&x) - -// ---------------------------------------------------------------------------- -// initialization data -// ---------------------------------------------------------------------------- - -static struct InitData -{ - InitData() - { - nInitCount = 0; - -#if wxUSE_UNICODE - argc = 0; - // argv = NULL; -- not even really needed -#endif // wxUSE_UNICODE - } - - // critical section protecting this struct - wxCRIT_SECT_DECLARE_MEMBER(csInit); - - // number of times wxInitialize() was called minus the number of times - // wxUninitialize() was - size_t nInitCount; - -#if wxUSE_UNICODE - int argc; - - // if we receive the command line arguments as ASCII and have to convert - // them to Unicode ourselves (this is the case under Unix but not Windows, - // for example), we remember the converted argv here because we'll have to - // free it when doing cleanup to avoid memory leaks - wchar_t **argv; -#endif // wxUSE_UNICODE - - DECLARE_NO_COPY_CLASS(InitData) -} gs_initData; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// command line arguments ANSI -> Unicode conversion -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE - -static void ConvertArgsToUnicode(int argc, char **argv) -{ - gs_initData.argv = new wchar_t *[argc + 1]; - int wargc = 0; - for ( int i = 0; i < argc; i++ ) - { -#ifdef __DARWIN__ - wxWCharBuffer buf(wxConvFileName->cMB2WX(argv[i])); -#else - wxWCharBuffer buf(wxConvLocal.cMB2WX(argv[i])); -#endif - if ( !buf ) - { - wxLogWarning(_("Command line argument %d couldn't be converted to Unicode and will be ignored."), - i); - } - else // converted ok - { - gs_initData.argv[wargc++] = wxStrdup(buf); - } - } - - gs_initData.argc = wargc; - gs_initData.argv[wargc] = NULL; -} - -static void FreeConvertedArgs() -{ - if ( gs_initData.argv ) - { - for ( int i = 0; i < gs_initData.argc; i++ ) - { - free(gs_initData.argv[i]); - } - - delete [] gs_initData.argv; - gs_initData.argv = NULL; - gs_initData.argc = 0; - } -} - -#endif // wxUSE_UNICODE - -// ---------------------------------------------------------------------------- -// start up -// ---------------------------------------------------------------------------- - -// initialization which is always done (not customizable) before wxApp creation -static bool DoCommonPreInit() -{ -#if wxUSE_LOG - // Reset logging in case we were cleaned up and are being reinitialized. - wxLog::DoCreateOnDemand(); - - // install temporary log sink: we can't use wxLogGui before wxApp is - // constructed and if we use wxLogStderr, all messages during - // initialization simply disappear under Windows - // - // note that we will delete this log target below - delete wxLog::SetActiveTarget(new wxLogBuffer); -#endif // wxUSE_LOG - - return true; -} - -// non customizable initialization done after wxApp creation and initialization -static bool DoCommonPostInit() -{ - wxModule::RegisterModules(); - - if ( !wxModule::InitializeModules() ) - { - wxLogError(_("Initialization failed in post init, aborting.")); - return false; - } - - return true; -} - -bool wxEntryStart(int& argc, wxChar **argv) -{ - // do minimal, always necessary, initialization - // -------------------------------------------- - - // initialize wxRTTI - if ( !DoCommonPreInit() ) - { - return false; - } - - - // first of all, we need an application object - // ------------------------------------------- - - // the user might have already created it himself somehow - wxAppPtr app(wxTheApp); - if ( !app.get() ) - { - // if not, he might have used IMPLEMENT_APP() to give us a function to - // create it - wxAppInitializerFunction fnCreate = wxApp::GetInitializerFunction(); - - if ( fnCreate ) - { - // he did, try to create the custom wxApp object - app.Set((*fnCreate)()); - } - } - - if ( !app.get() ) - { - // either IMPLEMENT_APP() was not used at all or it failed -- in any - // case we still need something - app.Set(new wxDummyConsoleApp); - } - - - // wxApp initialization: this can be customized - // -------------------------------------------- - - if ( !app->Initialize(argc, argv) ) - { - return false; - } - - wxCallAppCleanup callAppCleanup(app.get()); - - // for compatibility call the old initialization function too - if ( !app->OnInitGui() ) - return false; - - - // common initialization after wxTheApp creation - // --------------------------------------------- - - if ( !DoCommonPostInit() ) - return false; - - - // prevent the smart pointer from destroying its contents - app.release(); - - // and the cleanup object from doing cleanup - callAppCleanup.Dismiss(); - -#if wxUSE_LOG - // now that we have a valid wxApp (wxLogGui would have crashed if we used - // it before now), we can delete the temporary sink we had created for the - // initialization messages -- the next time logging function is called, the - // sink will be recreated but this time wxAppTraits will be used - delete wxLog::SetActiveTarget(NULL); -#endif // wxUSE_LOG - - return true; -} - -#if wxUSE_UNICODE - -// we provide a wxEntryStart() wrapper taking "char *" pointer too -bool wxEntryStart(int& argc, char **argv) -{ - ConvertArgsToUnicode(argc, argv); - - if ( !wxEntryStart(gs_initData.argc, gs_initData.argv) ) - { - FreeConvertedArgs(); - - return false; - } - - return true; -} - -#endif // wxUSE_UNICODE - -// ---------------------------------------------------------------------------- -// clean up -// ---------------------------------------------------------------------------- - -// cleanup done before destroying wxTheApp -static void DoCommonPreCleanup() -{ -#if wxUSE_LOG - // flush the logged messages if any and install a 'safer' log target: the - // default one (wxLogGui) can't be used after the resources are freed just - // below and the user supplied one might be even more unsafe (using any - // wxWidgets GUI function is unsafe starting from now) - wxLog::DontCreateOnDemand(); - - // this will flush the old messages if any - delete wxLog::SetActiveTarget(new wxLogStderr); -#endif // wxUSE_LOG -} - -// cleanup done after destroying wxTheApp -static void DoCommonPostCleanup() -{ - wxModule::CleanUpModules(); - - // we can't do this in wxApp itself because it doesn't know if argv had - // been allocated -#if wxUSE_UNICODE - FreeConvertedArgs(); -#endif // wxUSE_UNICODE - - // use Set(NULL) and not Get() to avoid creating a message output object on - // demand when we just want to delete it - delete wxMessageOutput::Set(NULL); - -#if wxUSE_LOG - // and now delete the last logger as well - delete wxLog::SetActiveTarget(NULL); -#endif // wxUSE_LOG -} - -void wxEntryCleanup() -{ - DoCommonPreCleanup(); - - - // delete the application object - if ( wxTheApp ) - { - wxTheApp->CleanUp(); - - // reset the global pointer to it to NULL before destroying it as in - // some circumstances this can result in executing the code using - // wxTheApp and using half-destroyed object is no good - wxAppConsole * const app = wxApp::GetInstance(); - wxApp::SetInstance(NULL); - delete app; - } - - - DoCommonPostCleanup(); -} - -// ---------------------------------------------------------------------------- -// wxEntry -// ---------------------------------------------------------------------------- - -// for MSW the real wxEntry is defined in msw/main.cpp -#ifndef __WXMSW__ - #define wxEntryReal wxEntry -#endif // !__WXMSW__ - -int wxEntryReal(int& argc, wxChar **argv) -{ - // library initialization - wxInitializer initializer(argc, argv); - - if ( !initializer.IsOk() ) - { -#if wxUSE_LOG - // flush any log messages explaining why we failed - delete wxLog::SetActiveTarget(NULL); -#endif - return -1; - } - - wxTRY - { - - // app initialization - if ( !wxTheApp->CallOnInit() ) - { - // don't call OnExit() if OnInit() failed - return -1; - } - - // ensure that OnExit() is called if OnInit() had succeeded - class CallOnExit - { - public: - ~CallOnExit() { wxTheApp->OnExit(); } - } callOnExit; - - WX_SUPPRESS_UNUSED_WARN(callOnExit); - - // app execution - return wxTheApp->OnRun(); - } - wxCATCH_ALL( wxTheApp->OnUnhandledException(); return -1; ) -} - -#if wxUSE_UNICODE - -// as with wxEntryStart, we provide an ANSI wrapper -int wxEntry(int& argc, char **argv) -{ - ConvertArgsToUnicode(argc, argv); - - return wxEntry(gs_initData.argc, gs_initData.argv); -} - -#endif // wxUSE_UNICODE - -// ---------------------------------------------------------------------------- -// wxInitialize/wxUninitialize -// ---------------------------------------------------------------------------- - -bool wxInitialize(int argc, wxChar **argv) -{ - wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); - - if ( gs_initData.nInitCount++ ) - { - // already initialized - return true; - } - - return wxEntryStart(argc, argv); -} - -#if wxUSE_UNICODE -bool wxInitialize(int argc, char **argv) -{ - wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); - - if ( gs_initData.nInitCount++ ) - { - // already initialized - return true; - } - - return wxEntryStart(argc, argv); -} -#endif // wxUSE_UNICODE - -void wxUninitialize() -{ - wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); - - if ( --gs_initData.nInitCount == 0 ) - { - wxEntryCleanup(); - } -} diff --git a/Source/3rdParty/wx/src/common/intl.cpp b/Source/3rdParty/wx/src/common/intl.cpp deleted file mode 100644 index 60083b7f5..000000000 --- a/Source/3rdParty/wx/src/common/intl.cpp +++ /dev/null @@ -1,3784 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/intl.cpp -// Purpose: Internationalization and localisation for wxWidgets -// Author: Vadim Zeitlin -// Modified by: Michael N. Filippov -// (2003/09/30 - PluralForms support) -// Created: 29/01/98 -// RCS-ID: $Id: intl.cpp 61340 2009-07-06 21:19:58Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declaration -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifdef __EMX__ -// The following define is needed by Innotek's libc to -// make the definition of struct localeconv available. -#define __INTERNAL_DEFS -#endif - -#if wxUSE_INTL - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/hashmap.h" - #include "wx/module.h" -#endif // WX_PRECOMP - -#ifndef __WXWINCE__ - #include -#endif - -// standard headers -#include -#include -#ifdef HAVE_LANGINFO_H - #include -#endif - -#ifdef __WIN32__ - #include "wx/msw/private.h" -#elif defined(__UNIX_LIKE__) - #include "wx/fontmap.h" // for CharsetToEncoding() -#endif - -#include "wx/file.h" -#include "wx/filename.h" -#include "wx/tokenzr.h" -#include "wx/fontmap.h" -#include "wx/encconv.h" -#include "wx/ptr_scpd.h" -#include "wx/apptrait.h" -#include "wx/stdpaths.h" - -#if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers -#endif - -#if defined(__DARWIN__) - #include "wx/mac/corefoundation/cfref.h" - #include - #include "wx/mac/corefoundation/cfstring.h" -#endif - -// ---------------------------------------------------------------------------- -// simple types -// ---------------------------------------------------------------------------- - -// this should *not* be wxChar, this type must have exactly 8 bits! -typedef wxUint8 size_t8; -typedef wxUint32 size_t32; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// magic number identifying the .mo format file -const size_t32 MSGCATALOG_MAGIC = 0x950412de; -const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495; - -// the constants describing the format of lang_LANG locale string -static const size_t LEN_LANG = 2; -static const size_t LEN_SUBLANG = 2; -static const size_t LEN_FULL = LEN_LANG + 1 + LEN_SUBLANG; // 1 for '_' - -#define TRACE_I18N _T("i18n") - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - -// small class to suppress the translation erros until exit from current scope -class NoTransErr -{ -public: - NoTransErr() { ms_suppressCount++; } - ~NoTransErr() { ms_suppressCount--; } - - static bool Suppress() { return ms_suppressCount > 0; } - -private: - static size_t ms_suppressCount; -}; - -size_t NoTransErr::ms_suppressCount = 0; - -#else // !Debug - -class NoTransErr -{ -public: - NoTransErr() { } - ~NoTransErr() { } -}; - -#endif // Debug/!Debug - -static wxLocale *wxSetLocale(wxLocale *pLocale); - -// helper functions of GetSystemLanguage() -#ifdef __UNIX__ - -// get just the language part -static inline wxString ExtractLang(const wxString& langFull) -{ - return langFull.Left(LEN_LANG); -} - -// get everything else (including the leading '_') -static inline wxString ExtractNotLang(const wxString& langFull) -{ - return langFull.Mid(LEN_LANG); -} - -#endif // __UNIX__ - - -// ---------------------------------------------------------------------------- -// Plural forms parser -// ---------------------------------------------------------------------------- - -/* - Simplified Grammar - -Expression: - LogicalOrExpression '?' Expression ':' Expression - LogicalOrExpression - -LogicalOrExpression: - LogicalAndExpression "||" LogicalOrExpression // to (a || b) || c - LogicalAndExpression - -LogicalAndExpression: - EqualityExpression "&&" LogicalAndExpression // to (a && b) && c - EqualityExpression - -EqualityExpression: - RelationalExpression "==" RelationalExperession - RelationalExpression "!=" RelationalExperession - RelationalExpression - -RelationalExpression: - MultiplicativeExpression '>' MultiplicativeExpression - MultiplicativeExpression '<' MultiplicativeExpression - MultiplicativeExpression ">=" MultiplicativeExpression - MultiplicativeExpression "<=" MultiplicativeExpression - MultiplicativeExpression - -MultiplicativeExpression: - PmExpression '%' PmExpression - PmExpression - -PmExpression: - N - Number - '(' Expression ')' -*/ - -class wxPluralFormsToken -{ -public: - enum Type - { - T_ERROR, T_EOF, T_NUMBER, T_N, T_PLURAL, T_NPLURALS, T_EQUAL, T_ASSIGN, - T_GREATER, T_GREATER_OR_EQUAL, T_LESS, T_LESS_OR_EQUAL, - T_REMINDER, T_NOT_EQUAL, - T_LOGICAL_AND, T_LOGICAL_OR, T_QUESTION, T_COLON, T_SEMICOLON, - T_LEFT_BRACKET, T_RIGHT_BRACKET - }; - Type type() const { return m_type; } - void setType(Type type) { m_type = type; } - // for T_NUMBER only - typedef int Number; - Number number() const { return m_number; } - void setNumber(Number num) { m_number = num; } -private: - Type m_type; - Number m_number; -}; - - -class wxPluralFormsScanner -{ -public: - wxPluralFormsScanner(const char* s); - const wxPluralFormsToken& token() const { return m_token; } - bool nextToken(); // returns false if error -private: - const char* m_s; - wxPluralFormsToken m_token; -}; - -wxPluralFormsScanner::wxPluralFormsScanner(const char* s) : m_s(s) -{ - nextToken(); -} - -bool wxPluralFormsScanner::nextToken() -{ - wxPluralFormsToken::Type type = wxPluralFormsToken::T_ERROR; - while (isspace((unsigned char) *m_s)) - { - ++m_s; - } - if (*m_s == 0) - { - type = wxPluralFormsToken::T_EOF; - } - else if (isdigit((unsigned char) *m_s)) - { - wxPluralFormsToken::Number number = *m_s++ - '0'; - while (isdigit((unsigned char) *m_s)) - { - number = number * 10 + (*m_s++ - '0'); - } - m_token.setNumber(number); - type = wxPluralFormsToken::T_NUMBER; - } - else if (isalpha((unsigned char) *m_s)) - { - const char* begin = m_s++; - while (isalnum((unsigned char) *m_s)) - { - ++m_s; - } - size_t size = m_s - begin; - if (size == 1 && memcmp(begin, "n", size) == 0) - { - type = wxPluralFormsToken::T_N; - } - else if (size == 6 && memcmp(begin, "plural", size) == 0) - { - type = wxPluralFormsToken::T_PLURAL; - } - else if (size == 8 && memcmp(begin, "nplurals", size) == 0) - { - type = wxPluralFormsToken::T_NPLURALS; - } - } - else if (*m_s == '=') - { - ++m_s; - if (*m_s == '=') - { - ++m_s; - type = wxPluralFormsToken::T_EQUAL; - } - else - { - type = wxPluralFormsToken::T_ASSIGN; - } - } - else if (*m_s == '>') - { - ++m_s; - if (*m_s == '=') - { - ++m_s; - type = wxPluralFormsToken::T_GREATER_OR_EQUAL; - } - else - { - type = wxPluralFormsToken::T_GREATER; - } - } - else if (*m_s == '<') - { - ++m_s; - if (*m_s == '=') - { - ++m_s; - type = wxPluralFormsToken::T_LESS_OR_EQUAL; - } - else - { - type = wxPluralFormsToken::T_LESS; - } - } - else if (*m_s == '%') - { - ++m_s; - type = wxPluralFormsToken::T_REMINDER; - } - else if (*m_s == '!' && m_s[1] == '=') - { - m_s += 2; - type = wxPluralFormsToken::T_NOT_EQUAL; - } - else if (*m_s == '&' && m_s[1] == '&') - { - m_s += 2; - type = wxPluralFormsToken::T_LOGICAL_AND; - } - else if (*m_s == '|' && m_s[1] == '|') - { - m_s += 2; - type = wxPluralFormsToken::T_LOGICAL_OR; - } - else if (*m_s == '?') - { - ++m_s; - type = wxPluralFormsToken::T_QUESTION; - } - else if (*m_s == ':') - { - ++m_s; - type = wxPluralFormsToken::T_COLON; - } else if (*m_s == ';') { - ++m_s; - type = wxPluralFormsToken::T_SEMICOLON; - } - else if (*m_s == '(') - { - ++m_s; - type = wxPluralFormsToken::T_LEFT_BRACKET; - } - else if (*m_s == ')') - { - ++m_s; - type = wxPluralFormsToken::T_RIGHT_BRACKET; - } - m_token.setType(type); - return type != wxPluralFormsToken::T_ERROR; -} - -class wxPluralFormsNode; - -// NB: Can't use wxDEFINE_SCOPED_PTR_TYPE because wxPluralFormsNode is not -// fully defined yet: -class wxPluralFormsNodePtr -{ -public: - wxPluralFormsNodePtr(wxPluralFormsNode *p = NULL) : m_p(p) {} - ~wxPluralFormsNodePtr(); - wxPluralFormsNode& operator*() const { return *m_p; } - wxPluralFormsNode* operator->() const { return m_p; } - wxPluralFormsNode* get() const { return m_p; } - wxPluralFormsNode* release(); - void reset(wxPluralFormsNode *p); - -private: - wxPluralFormsNode *m_p; -}; - -class wxPluralFormsNode -{ -public: - wxPluralFormsNode(const wxPluralFormsToken& token) : m_token(token) {} - const wxPluralFormsToken& token() const { return m_token; } - const wxPluralFormsNode* node(size_t i) const - { return m_nodes[i].get(); } - void setNode(size_t i, wxPluralFormsNode* n); - wxPluralFormsNode* releaseNode(size_t i); - wxPluralFormsToken::Number evaluate(wxPluralFormsToken::Number n) const; - -private: - wxPluralFormsToken m_token; - wxPluralFormsNodePtr m_nodes[3]; -}; - -wxPluralFormsNodePtr::~wxPluralFormsNodePtr() -{ - delete m_p; -} -wxPluralFormsNode* wxPluralFormsNodePtr::release() -{ - wxPluralFormsNode *p = m_p; - m_p = NULL; - return p; -} -void wxPluralFormsNodePtr::reset(wxPluralFormsNode *p) -{ - if (p != m_p) - { - delete m_p; - m_p = p; - } -} - - -void wxPluralFormsNode::setNode(size_t i, wxPluralFormsNode* n) -{ - m_nodes[i].reset(n); -} - -wxPluralFormsNode* wxPluralFormsNode::releaseNode(size_t i) -{ - return m_nodes[i].release(); -} - -wxPluralFormsToken::Number -wxPluralFormsNode::evaluate(wxPluralFormsToken::Number n) const -{ - switch (token().type()) - { - // leaf - case wxPluralFormsToken::T_NUMBER: - return token().number(); - case wxPluralFormsToken::T_N: - return n; - // 2 args - case wxPluralFormsToken::T_EQUAL: - return node(0)->evaluate(n) == node(1)->evaluate(n); - case wxPluralFormsToken::T_NOT_EQUAL: - return node(0)->evaluate(n) != node(1)->evaluate(n); - case wxPluralFormsToken::T_GREATER: - return node(0)->evaluate(n) > node(1)->evaluate(n); - case wxPluralFormsToken::T_GREATER_OR_EQUAL: - return node(0)->evaluate(n) >= node(1)->evaluate(n); - case wxPluralFormsToken::T_LESS: - return node(0)->evaluate(n) < node(1)->evaluate(n); - case wxPluralFormsToken::T_LESS_OR_EQUAL: - return node(0)->evaluate(n) <= node(1)->evaluate(n); - case wxPluralFormsToken::T_REMINDER: - { - wxPluralFormsToken::Number number = node(1)->evaluate(n); - if (number != 0) - { - return node(0)->evaluate(n) % number; - } - else - { - return 0; - } - } - case wxPluralFormsToken::T_LOGICAL_AND: - return node(0)->evaluate(n) && node(1)->evaluate(n); - case wxPluralFormsToken::T_LOGICAL_OR: - return node(0)->evaluate(n) || node(1)->evaluate(n); - // 3 args - case wxPluralFormsToken::T_QUESTION: - return node(0)->evaluate(n) - ? node(1)->evaluate(n) - : node(2)->evaluate(n); - default: - return 0; - } -} - - -class wxPluralFormsCalculator -{ -public: - wxPluralFormsCalculator() : m_nplurals(0), m_plural(0) {} - - // input: number, returns msgstr index - int evaluate(int n) const; - - // input: text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"), - // if s == 0, creates default handler - // returns 0 if error - static wxPluralFormsCalculator* make(const char* s = 0); - - ~wxPluralFormsCalculator() {} - - void init(wxPluralFormsToken::Number nplurals, wxPluralFormsNode* plural); - -private: - wxPluralFormsToken::Number m_nplurals; - wxPluralFormsNodePtr m_plural; -}; - -wxDEFINE_SCOPED_PTR_TYPE(wxPluralFormsCalculator) - -void wxPluralFormsCalculator::init(wxPluralFormsToken::Number nplurals, - wxPluralFormsNode* plural) -{ - m_nplurals = nplurals; - m_plural.reset(plural); -} - -int wxPluralFormsCalculator::evaluate(int n) const -{ - if (m_plural.get() == 0) - { - return 0; - } - wxPluralFormsToken::Number number = m_plural->evaluate(n); - if (number < 0 || number > m_nplurals) - { - return 0; - } - return number; -} - - -class wxPluralFormsParser -{ -public: - wxPluralFormsParser(wxPluralFormsScanner& scanner) : m_scanner(scanner) {} - bool parse(wxPluralFormsCalculator& rCalculator); - -private: - wxPluralFormsNode* parsePlural(); - // stops at T_SEMICOLON, returns 0 if error - wxPluralFormsScanner& m_scanner; - const wxPluralFormsToken& token() const; - bool nextToken(); - - wxPluralFormsNode* expression(); - wxPluralFormsNode* logicalOrExpression(); - wxPluralFormsNode* logicalAndExpression(); - wxPluralFormsNode* equalityExpression(); - wxPluralFormsNode* multiplicativeExpression(); - wxPluralFormsNode* relationalExpression(); - wxPluralFormsNode* pmExpression(); -}; - -bool wxPluralFormsParser::parse(wxPluralFormsCalculator& rCalculator) -{ - if (token().type() != wxPluralFormsToken::T_NPLURALS) - return false; - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_ASSIGN) - return false; - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_NUMBER) - return false; - wxPluralFormsToken::Number nplurals = token().number(); - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_SEMICOLON) - return false; - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_PLURAL) - return false; - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_ASSIGN) - return false; - if (!nextToken()) - return false; - wxPluralFormsNode* plural = parsePlural(); - if (plural == 0) - return false; - if (token().type() != wxPluralFormsToken::T_SEMICOLON) - return false; - if (!nextToken()) - return false; - if (token().type() != wxPluralFormsToken::T_EOF) - return false; - rCalculator.init(nplurals, plural); - return true; -} - -wxPluralFormsNode* wxPluralFormsParser::parsePlural() -{ - wxPluralFormsNode* p = expression(); - if (p == NULL) - { - return NULL; - } - wxPluralFormsNodePtr n(p); - if (token().type() != wxPluralFormsToken::T_SEMICOLON) - { - return NULL; - } - return n.release(); -} - -const wxPluralFormsToken& wxPluralFormsParser::token() const -{ - return m_scanner.token(); -} - -bool wxPluralFormsParser::nextToken() -{ - if (!m_scanner.nextToken()) - return false; - return true; -} - -wxPluralFormsNode* wxPluralFormsParser::expression() -{ - wxPluralFormsNode* p = logicalOrExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr n(p); - if (token().type() == wxPluralFormsToken::T_QUESTION) - { - wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return 0; - } - p = expression(); - if (p == 0) - { - return 0; - } - qn->setNode(1, p); - if (token().type() != wxPluralFormsToken::T_COLON) - { - return 0; - } - if (!nextToken()) - { - return 0; - } - p = expression(); - if (p == 0) - { - return 0; - } - qn->setNode(2, p); - qn->setNode(0, n.release()); - return qn.release(); - } - return n.release(); -} - -wxPluralFormsNode*wxPluralFormsParser::logicalOrExpression() -{ - wxPluralFormsNode* p = logicalAndExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr ln(p); - if (token().type() == wxPluralFormsToken::T_LOGICAL_OR) - { - wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return 0; - } - p = logicalOrExpression(); - if (p == 0) - { - return 0; - } - wxPluralFormsNodePtr rn(p); // right - if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_OR) - { - // see logicalAndExpression comment - un->setNode(0, ln.release()); - un->setNode(1, rn->releaseNode(0)); - rn->setNode(0, un.release()); - return rn.release(); - } - - - un->setNode(0, ln.release()); - un->setNode(1, rn.release()); - return un.release(); - } - return ln.release(); -} - -wxPluralFormsNode* wxPluralFormsParser::logicalAndExpression() -{ - wxPluralFormsNode* p = equalityExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr ln(p); // left - if (token().type() == wxPluralFormsToken::T_LOGICAL_AND) - { - wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); // up - if (!nextToken()) - { - return NULL; - } - p = logicalAndExpression(); - if (p == 0) - { - return NULL; - } - wxPluralFormsNodePtr rn(p); // right - if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_AND) - { -// transform 1 && (2 && 3) -> (1 && 2) && 3 -// u r -// l r -> u 3 -// 2 3 l 2 - un->setNode(0, ln.release()); - un->setNode(1, rn->releaseNode(0)); - rn->setNode(0, un.release()); - return rn.release(); - } - - un->setNode(0, ln.release()); - un->setNode(1, rn.release()); - return un.release(); - } - return ln.release(); -} - -wxPluralFormsNode* wxPluralFormsParser::equalityExpression() -{ - wxPluralFormsNode* p = relationalExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr n(p); - if (token().type() == wxPluralFormsToken::T_EQUAL - || token().type() == wxPluralFormsToken::T_NOT_EQUAL) - { - wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return NULL; - } - p = relationalExpression(); - if (p == NULL) - { - return NULL; - } - qn->setNode(1, p); - qn->setNode(0, n.release()); - return qn.release(); - } - return n.release(); -} - -wxPluralFormsNode* wxPluralFormsParser::relationalExpression() -{ - wxPluralFormsNode* p = multiplicativeExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr n(p); - if (token().type() == wxPluralFormsToken::T_GREATER - || token().type() == wxPluralFormsToken::T_LESS - || token().type() == wxPluralFormsToken::T_GREATER_OR_EQUAL - || token().type() == wxPluralFormsToken::T_LESS_OR_EQUAL) - { - wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return NULL; - } - p = multiplicativeExpression(); - if (p == NULL) - { - return NULL; - } - qn->setNode(1, p); - qn->setNode(0, n.release()); - return qn.release(); - } - return n.release(); -} - -wxPluralFormsNode* wxPluralFormsParser::multiplicativeExpression() -{ - wxPluralFormsNode* p = pmExpression(); - if (p == NULL) - return NULL; - wxPluralFormsNodePtr n(p); - if (token().type() == wxPluralFormsToken::T_REMINDER) - { - wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return NULL; - } - p = pmExpression(); - if (p == NULL) - { - return NULL; - } - qn->setNode(1, p); - qn->setNode(0, n.release()); - return qn.release(); - } - return n.release(); -} - -wxPluralFormsNode* wxPluralFormsParser::pmExpression() -{ - wxPluralFormsNodePtr n; - if (token().type() == wxPluralFormsToken::T_N - || token().type() == wxPluralFormsToken::T_NUMBER) - { - n.reset(new wxPluralFormsNode(token())); - if (!nextToken()) - { - return NULL; - } - } - else if (token().type() == wxPluralFormsToken::T_LEFT_BRACKET) { - if (!nextToken()) - { - return NULL; - } - wxPluralFormsNode* p = expression(); - if (p == NULL) - { - return NULL; - } - n.reset(p); - if (token().type() != wxPluralFormsToken::T_RIGHT_BRACKET) - { - return NULL; - } - if (!nextToken()) - { - return NULL; - } - } - else - { - return NULL; - } - return n.release(); -} - -wxPluralFormsCalculator* wxPluralFormsCalculator::make(const char* s) -{ - wxPluralFormsCalculatorPtr calculator(new wxPluralFormsCalculator); - if (s != NULL) - { - wxPluralFormsScanner scanner(s); - wxPluralFormsParser p(scanner); - if (!p.parse(*calculator)) - { - return NULL; - } - } - return calculator.release(); -} - - - - -// ---------------------------------------------------------------------------- -// wxMsgCatalogFile corresponds to one disk-file message catalog. -// -// This is a "low-level" class and is used only by wxMsgCatalog -// ---------------------------------------------------------------------------- - -WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxString, wxMessagesHash); - -class wxMsgCatalogFile -{ -public: - // ctor & dtor - wxMsgCatalogFile(); - ~wxMsgCatalogFile(); - - // load the catalog from disk (szDirPrefix corresponds to language) - bool Load(const wxChar *szDirPrefix, const wxChar *szName, - wxPluralFormsCalculatorPtr& rPluralFormsCalculator); - - // fills the hash with string-translation pairs - void FillHash(wxMessagesHash& hash, - const wxString& msgIdCharset, - bool convertEncoding) const; - - // return the charset of the strings in this catalog or empty string if - // none/unknown - wxString GetCharset() const { return m_charset; } - -private: - // this implementation is binary compatible with GNU gettext() version 0.10 - - // an entry in the string table - struct wxMsgTableEntry - { - size_t32 nLen; // length of the string - size_t32 ofsString; // pointer to the string - }; - - // header of a .mo file - struct wxMsgCatalogHeader - { - size_t32 magic, // offset +00: magic id - revision, // +04: revision - numStrings; // +08: number of strings in the file - size_t32 ofsOrigTable, // +0C: start of original string table - ofsTransTable; // +10: start of translated string table - size_t32 nHashSize, // +14: hash table size - ofsHashTable; // +18: offset of hash table start - }; - - // all data is stored here, NULL if no data loaded - size_t8 *m_pData; - - // amount of memory pointed to by m_pData. - size_t32 m_nSize; - - // data description - size_t32 m_numStrings; // number of strings in this domain - wxMsgTableEntry *m_pOrigTable, // pointer to original strings - *m_pTransTable; // translated - - wxString m_charset; // from the message catalog header - - - // swap the 2 halves of 32 bit integer if needed - size_t32 Swap(size_t32 ui) const - { - return m_bSwapped ? (ui << 24) | ((ui & 0xff00) << 8) | - ((ui >> 8) & 0xff00) | (ui >> 24) - : ui; - } - - const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 n) const - { - const wxMsgTableEntry * const ent = pTable + n; - - // this check could fail for a corrupt message catalog - size_t32 ofsString = Swap(ent->ofsString); - if ( ofsString + Swap(ent->nLen) > m_nSize) - { - return NULL; - } - - return (const char *)(m_pData + ofsString); - } - - bool m_bSwapped; // wrong endianness? - - DECLARE_NO_COPY_CLASS(wxMsgCatalogFile) -}; - - -// ---------------------------------------------------------------------------- -// wxMsgCatalog corresponds to one loaded message catalog. -// -// This is a "low-level" class and is used only by wxLocale (that's why -// it's designed to be stored in a linked list) -// ---------------------------------------------------------------------------- - -class wxMsgCatalog -{ -public: -#if !wxUSE_UNICODE - wxMsgCatalog() { m_conv = NULL; } - ~wxMsgCatalog(); -#endif - - // load the catalog from disk (szDirPrefix corresponds to language) - bool Load(const wxChar *szDirPrefix, const wxChar *szName, - const wxChar *msgIdCharset = NULL, bool bConvertEncoding = false); - - // get name of the catalog - wxString GetName() const { return m_name; } - - // get the translated string: returns NULL if not found - const wxChar *GetString(const wxChar *sz, size_t n = size_t(-1)) const; - - // public variable pointing to the next element in a linked list (or NULL) - wxMsgCatalog *m_pNext; - -private: - wxMessagesHash m_messages; // all messages in the catalog - wxString m_name; // name of the domain - -#if !wxUSE_UNICODE - // the conversion corresponding to this catalog charset if we installed it - // as the global one - wxCSConv *m_conv; -#endif - - wxPluralFormsCalculatorPtr m_pluralFormsCalculator; -}; - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the list of the directories to search for message catalog files -static wxArrayString gs_searchPrefixes; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxMsgCatalogFile class -// ---------------------------------------------------------------------------- - -wxMsgCatalogFile::wxMsgCatalogFile() -{ - m_pData = NULL; - m_nSize = 0; -} - -wxMsgCatalogFile::~wxMsgCatalogFile() -{ - delete [] m_pData; -} - -// return the directories to search for message catalogs under the given -// prefix, separated by wxPATH_SEP -static -wxString GetMsgCatalogSubdirs(const wxChar *prefix, const wxChar *lang) -{ - // Search first in Unix-standard prefix/lang/LC_MESSAGES, then in - // prefix/lang and finally in just prefix. - // - // Note that we use LC_MESSAGES on all platforms and not just Unix, because - // it doesn't cost much to look into one more directory and doing it this - // way has two important benefits: - // a) we don't break compatibility with wx-2.6 and older by stopping to - // look in a directory where the catalogs used to be and thus silently - // breaking apps after they are recompiled against the latest wx - // b) it makes it possible to package app's support files in the same - // way on all target platforms - wxString pathPrefix; - pathPrefix << prefix << wxFILE_SEP_PATH << lang; - - wxString searchPath; - searchPath.reserve(4*pathPrefix.length()); - searchPath << pathPrefix << wxFILE_SEP_PATH << wxT("LC_MESSAGES") << wxPATH_SEP - << prefix << wxFILE_SEP_PATH << wxPATH_SEP - << pathPrefix; - - return searchPath; -} - -// construct the search path for the given language -static wxString GetFullSearchPath(const wxChar *lang) -{ - // first take the entries explicitly added by the program - wxArrayString paths; - paths.reserve(gs_searchPrefixes.size() + 1); - size_t n, - count = gs_searchPrefixes.size(); - for ( n = 0; n < count; n++ ) - { - paths.Add(GetMsgCatalogSubdirs(gs_searchPrefixes[n], lang)); - } - - -#if wxUSE_STDPATHS - // then look in the standard location - const wxString stdp = wxStandardPaths::Get(). - GetLocalizedResourcesDir(lang, wxStandardPaths::ResourceCat_Messages); - - if ( paths.Index(stdp) == wxNOT_FOUND ) - paths.Add(stdp); -#endif // wxUSE_STDPATHS - - // last look in default locations -#ifdef __UNIX__ - // LC_PATH is a standard env var containing the search path for the .mo - // files - const wxChar *pszLcPath = wxGetenv(wxT("LC_PATH")); - if ( pszLcPath ) - { - const wxString lcp = GetMsgCatalogSubdirs(pszLcPath, lang); - if ( paths.Index(lcp) == wxNOT_FOUND ) - paths.Add(lcp); - } - - // also add the one from where wxWin was installed: - wxString wxp = wxGetInstallPrefix(); - if ( !wxp.empty() ) - { - wxp = GetMsgCatalogSubdirs(wxp + _T("/share/locale"), lang); - if ( paths.Index(wxp) == wxNOT_FOUND ) - paths.Add(wxp); - } -#endif // __UNIX__ - - - // finally construct the full search path - wxString searchPath; - searchPath.reserve(500); - count = paths.size(); - for ( n = 0; n < count; n++ ) - { - searchPath += paths[n]; - if ( n != count - 1 ) - searchPath += wxPATH_SEP; - } - - return searchPath; -} - -// open disk file and read in it's contents -bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName, - wxPluralFormsCalculatorPtr& rPluralFormsCalculator) -{ - wxString searchPath; - -#if wxUSE_FONTMAP - // first look for the catalog for this language and the current locale: - // notice that we don't use the system name for the locale as this would - // force us to install catalogs in different locations depending on the - // system but always use the canonical name - wxFontEncoding encSys = wxLocale::GetSystemEncoding(); - if ( encSys != wxFONTENCODING_SYSTEM ) - { - wxString fullname(szDirPrefix); - fullname << _T('.') << wxFontMapperBase::GetEncodingName(encSys); - searchPath << GetFullSearchPath(fullname) << wxPATH_SEP; - } -#endif // wxUSE_FONTMAP - - - searchPath += GetFullSearchPath(szDirPrefix); - const wxChar *sublocale = wxStrchr(szDirPrefix, wxT('_')); - if ( sublocale ) - { - // also add just base locale name: for things like "fr_BE" (belgium - // french) we should use "fr" if no belgium specific message catalogs - // exist - searchPath << wxPATH_SEP - << GetFullSearchPath(wxString(szDirPrefix). - Left((size_t)(sublocale - szDirPrefix))); - } - - // don't give translation errors here because the wxstd catalog might - // not yet be loaded (and it's normal) - // - // (we're using an object because we have several return paths) - - NoTransErr noTransErr; - wxLogVerbose(_("looking for catalog '%s' in path '%s'."), - szName, searchPath.c_str()); - wxLogTrace(TRACE_I18N, _T("Looking for \"%s.mo\" in \"%s\""), - szName, searchPath.c_str()); - - wxFileName fn(szName); - fn.SetExt(_T("mo")); - wxString strFullName; - if ( !wxFindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) { - wxLogVerbose(_("catalog file for domain '%s' not found."), szName); - wxLogTrace(TRACE_I18N, _T("Catalog \"%s.mo\" not found"), szName); - return false; - } - - // open file - wxLogVerbose(_("using catalog '%s' from '%s'."), szName, strFullName.c_str()); - wxLogTrace(TRACE_I18N, _T("Using catalog \"%s\"."), strFullName.c_str()); - - wxFile fileMsg(strFullName); - if ( !fileMsg.IsOpened() ) - return false; - - // get the file size (assume it is less than 4Gb...) - wxFileOffset lenFile = fileMsg.Length(); - if ( lenFile == wxInvalidOffset ) - return false; - - size_t nSize = wx_truncate_cast(size_t, lenFile); - wxASSERT_MSG( nSize == lenFile + size_t(0), _T("message catalog bigger than 4GB?") ); - - // read the whole file in memory - m_pData = new size_t8[nSize]; - if ( fileMsg.Read(m_pData, nSize) != lenFile ) { - wxDELETEA(m_pData); - return false; - } - - // examine header - bool bValid = nSize + (size_t)0 > sizeof(wxMsgCatalogHeader); - - wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData; - if ( bValid ) { - // we'll have to swap all the integers if it's true - m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW; - - // check the magic number - bValid = m_bSwapped || pHeader->magic == MSGCATALOG_MAGIC; - } - - if ( !bValid ) { - // it's either too short or has incorrect magic number - wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str()); - - wxDELETEA(m_pData); - return false; - } - - // initialize - m_numStrings = Swap(pHeader->numStrings); - m_pOrigTable = (wxMsgTableEntry *)(m_pData + - Swap(pHeader->ofsOrigTable)); - m_pTransTable = (wxMsgTableEntry *)(m_pData + - Swap(pHeader->ofsTransTable)); - m_nSize = (size_t32)nSize; - - // now parse catalog's header and try to extract catalog charset and - // plural forms formula from it: - - const char* headerData = StringAtOfs(m_pOrigTable, 0); - if (headerData && headerData[0] == 0) - { - // Extract the charset: - wxString header = wxString::FromAscii(StringAtOfs(m_pTransTable, 0)); - int begin = header.Find(wxT("Content-Type: text/plain; charset=")); - if (begin != wxNOT_FOUND) - { - begin += 34; //strlen("Content-Type: text/plain; charset=") - size_t end = header.find('\n', begin); - if (end != size_t(-1)) - { - m_charset.assign(header, begin, end - begin); - if (m_charset == wxT("CHARSET")) - { - // "CHARSET" is not valid charset, but lazy translator - m_charset.Clear(); - } - } - } - // else: incorrectly filled Content-Type header - - // Extract plural forms: - begin = header.Find(wxT("Plural-Forms:")); - if (begin != wxNOT_FOUND) - { - begin += 13; - size_t end = header.find('\n', begin); - if (end != size_t(-1)) - { - wxString pfs(header, begin, end - begin); - wxPluralFormsCalculator* pCalculator = wxPluralFormsCalculator - ::make(pfs.ToAscii()); - if (pCalculator != 0) - { - rPluralFormsCalculator.reset(pCalculator); - } - else - { - wxLogVerbose(_("Cannot parse Plural-Forms:'%s'"), pfs.c_str()); - } - } - } - if (rPluralFormsCalculator.get() == NULL) - { - rPluralFormsCalculator.reset(wxPluralFormsCalculator::make()); - } - } - - // everything is fine - return true; -} - -void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, - const wxString& msgIdCharset, - bool convertEncoding) const -{ -#if wxUSE_UNICODE - // this parameter doesn't make sense, we always must convert encoding in - // Unicode build - convertEncoding = true; -#elif wxUSE_FONTMAP - if ( convertEncoding ) - { - // determine if we need any conversion at all - wxFontEncoding encCat = wxFontMapperBase::GetEncodingFromName(m_charset); - if ( encCat == wxLocale::GetSystemEncoding() ) - { - // no need to convert - convertEncoding = false; - } - } -#endif // wxUSE_UNICODE/wxUSE_FONTMAP - -#if wxUSE_WCHAR_T - // conversion to use to convert catalog strings to the GUI encoding - wxMBConv *inputConv, - *inputConvPtr = NULL; // same as inputConv but safely deleteable - if ( convertEncoding && !m_charset.empty() ) - { - inputConvPtr = - inputConv = new wxCSConv(m_charset); - } - else // no need or not possible to convert the encoding - { -#if wxUSE_UNICODE - // we must somehow convert the narrow strings in the message catalog to - // wide strings, so use the default conversion if we have no charset - inputConv = wxConvCurrent; -#else // !wxUSE_UNICODE - inputConv = NULL; -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - } - - // conversion to apply to msgid strings before looking them up: we only - // need it if the msgids are neither in 7 bit ASCII nor in the same - // encoding as the catalog - wxCSConv *sourceConv = msgIdCharset.empty() || (msgIdCharset == m_charset) - ? NULL - : new wxCSConv(msgIdCharset); - -#elif wxUSE_FONTMAP - wxASSERT_MSG( msgIdCharset.empty(), - _T("non-ASCII msgid languages only supported if wxUSE_WCHAR_T=1") ); - - wxEncodingConverter converter; - if ( convertEncoding ) - { - wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM; - wxFontEncoding enc = wxFontMapperBase::Get()->CharsetToEncoding(m_charset, false); - if ( enc == wxFONTENCODING_SYSTEM ) - { - convertEncoding = false; // unknown encoding - } - else - { - targetEnc = wxLocale::GetSystemEncoding(); - if (targetEnc == wxFONTENCODING_SYSTEM) - { - wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc); - if (a[0] == enc) - // no conversion needed, locale uses native encoding - convertEncoding = false; - if (a.GetCount() == 0) - // we don't know common equiv. under this platform - convertEncoding = false; - targetEnc = a[0]; - } - } - - if ( convertEncoding ) - { - converter.Init(enc, targetEnc); - } - } -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - (void)convertEncoding; // get rid of warnings about unused parameter - - for (size_t32 i = 0; i < m_numStrings; i++) - { - const char *data = StringAtOfs(m_pOrigTable, i); - - wxString msgid; -#if wxUSE_UNICODE - msgid = wxString(data, *inputConv); -#else // ASCII - #if wxUSE_WCHAR_T - if ( inputConv && sourceConv ) - msgid = wxString(inputConv->cMB2WC(data), *sourceConv); - else - #endif - msgid = data; -#endif // wxUSE_UNICODE - - data = StringAtOfs(m_pTransTable, i); - size_t length = Swap(m_pTransTable[i].nLen); - size_t offset = 0; - size_t index = 0; - while (offset < length) - { - const char * const str = data + offset; - - wxString msgstr; -#if wxUSE_UNICODE - msgstr = wxString(str, *inputConv); -#elif wxUSE_WCHAR_T - if ( inputConv ) - msgstr = wxString(inputConv->cMB2WC(str), *wxConvUI); - else - msgstr = str; -#else // !wxUSE_WCHAR_T - #if wxUSE_FONTMAP - if ( convertEncoding ) - msgstr = wxString(converter.Convert(str)); - else - #endif - msgstr = str; -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - - if ( !msgstr.empty() ) - { - hash[index == 0 ? msgid : msgid + wxChar(index)] = msgstr; - } - - // skip this string - offset += strlen(str) + 1; - ++index; - } - } - -#if wxUSE_WCHAR_T - delete sourceConv; - delete inputConvPtr; -#endif // wxUSE_WCHAR_T -} - - -// ---------------------------------------------------------------------------- -// wxMsgCatalog class -// ---------------------------------------------------------------------------- - -#if !wxUSE_UNICODE -wxMsgCatalog::~wxMsgCatalog() -{ - if ( m_conv ) - { - if ( wxConvUI == m_conv ) - { - // we only change wxConvUI if it points to wxConvLocal so we reset - // it back to it too - wxConvUI = &wxConvLocal; - } - - delete m_conv; - } -} -#endif // !wxUSE_UNICODE - -bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName, - const wxChar *msgIdCharset, bool bConvertEncoding) -{ - wxMsgCatalogFile file; - - m_name = szName; - - if ( !file.Load(szDirPrefix, szName, m_pluralFormsCalculator) ) - return false; - - file.FillHash(m_messages, msgIdCharset, bConvertEncoding); - -#if !wxUSE_UNICODE && wxUSE_WCHAR_T - // we should use a conversion compatible with the message catalog encoding - // in the GUI if we don't convert the strings to the current conversion but - // as the encoding is global, only change it once, otherwise we could get - // into trouble if we use several message catalogs with different encodings - // - // this is, of course, a hack but it at least allows the program to use - // message catalogs in any encodings without asking the user to change his - // locale - if ( !bConvertEncoding && - !file.GetCharset().empty() && - wxConvUI == &wxConvLocal ) - { - wxConvUI = - m_conv = new wxCSConv(file.GetCharset()); - } -#endif // !wxUSE_UNICODE && wxUSE_WCHAR_T - - return true; -} - -const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const -{ - int index = 0; - if (n != size_t(-1)) - { - index = m_pluralFormsCalculator->evaluate(n); - } - wxMessagesHash::const_iterator i; - if (index != 0) - { - i = m_messages.find(wxString(sz) + wxChar(index)); // plural - } - else - { - i = m_messages.find(sz); - } - - if ( i != m_messages.end() ) - { - return i->second.c_str(); - } - else - return NULL; -} - -// ---------------------------------------------------------------------------- -// wxLocale -// ---------------------------------------------------------------------------- - -#include "wx/arrimpl.cpp" -WX_DECLARE_EXPORTED_OBJARRAY(wxLanguageInfo, wxLanguageInfoArray); -WX_DEFINE_OBJARRAY(wxLanguageInfoArray) - -wxLanguageInfoArray *wxLocale::ms_languagesDB = NULL; - -/*static*/ void wxLocale::CreateLanguagesDB() -{ - if (ms_languagesDB == NULL) - { - ms_languagesDB = new wxLanguageInfoArray; - InitLanguagesDB(); - } -} - -/*static*/ void wxLocale::DestroyLanguagesDB() -{ - delete ms_languagesDB; - ms_languagesDB = NULL; -} - - -void wxLocale::DoCommonInit() -{ - m_pszOldLocale = NULL; - - m_pOldLocale = wxSetLocale(this); - - m_pMsgCat = NULL; - m_language = wxLANGUAGE_UNKNOWN; - m_initialized = false; -} - -// NB: this function has (desired) side effect of changing current locale -bool wxLocale::Init(const wxChar *szName, - const wxChar *szShort, - const wxChar *szLocale, - bool bLoadDefault, - bool bConvertEncoding) -{ - wxASSERT_MSG( !m_initialized, - _T("you can't call wxLocale::Init more than once") ); - - m_initialized = true; - m_strLocale = szName; - m_strShort = szShort; - m_bConvertEncoding = bConvertEncoding; - m_language = wxLANGUAGE_UNKNOWN; - - // change current locale (default: same as long name) - if ( szLocale == NULL ) - { - // the argument to setlocale() - szLocale = szShort; - - wxCHECK_MSG( szLocale, false, _T("no locale to set in wxLocale::Init()") ); - } - -#ifdef __WXWINCE__ - // FIXME: I'm guessing here - wxChar localeName[256]; - int ret = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLANGUAGE, localeName, - 256); - if (ret != 0) - { - m_pszOldLocale = wxStrdup(localeName); - } - else - m_pszOldLocale = NULL; - - // TODO: how to find languageId - // SetLocaleInfo(languageId, SORT_DEFAULT, localeName); -#else - wxMB2WXbuf oldLocale = wxSetlocale(LC_ALL, szLocale); - if ( oldLocale ) - m_pszOldLocale = wxStrdup(oldLocale); - else - m_pszOldLocale = NULL; -#endif - - if ( m_pszOldLocale == NULL ) - wxLogError(_("locale '%s' can not be set."), szLocale); - - // the short name will be used to look for catalog files as well, - // so we need something here - if ( m_strShort.empty() ) { - // FIXME I don't know how these 2 letter abbreviations are formed, - // this wild guess is surely wrong - if ( szLocale && szLocale[0] ) - { - m_strShort += (wxChar)wxTolower(szLocale[0]); - if ( szLocale[1] ) - m_strShort += (wxChar)wxTolower(szLocale[1]); - } - } - - // load the default catalog with wxWidgets standard messages - m_pMsgCat = NULL; - bool bOk = true; - if ( bLoadDefault ) - { - bOk = AddCatalog(wxT("wxstd")); - - // there may be a catalog with toolkit specific overrides, it is not - // an error if this does not exist - if ( bOk ) - { - wxString port(wxPlatformInfo::Get().GetPortIdName()); - if ( !port.empty() ) - { - AddCatalog(port.BeforeFirst(wxT('/')).MakeLower()); - } - } - } - - return bOk; -} - - -#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WXMAC__) -static wxWCharBuffer wxSetlocaleTryUTF(int c, const wxChar *lc) -{ - wxMB2WXbuf l = wxSetlocale(c, lc); - if ( !l && lc && lc[0] != 0 ) - { - wxString buf(lc); - wxString buf2; - buf2 = buf + wxT(".UTF-8"); - l = wxSetlocale(c, buf2.c_str()); - if ( !l ) - { - buf2 = buf + wxT(".utf-8"); - l = wxSetlocale(c, buf2.c_str()); - } - if ( !l ) - { - buf2 = buf + wxT(".UTF8"); - l = wxSetlocale(c, buf2.c_str()); - } - if ( !l ) - { - buf2 = buf + wxT(".utf8"); - l = wxSetlocale(c, buf2.c_str()); - } - } - return l; -} -#else -#define wxSetlocaleTryUTF(c, lc) wxSetlocale(c, lc) -#endif - -bool wxLocale::Init(int language, int flags) -{ - int lang = language; - if (lang == wxLANGUAGE_DEFAULT) - { - // auto detect the language - lang = GetSystemLanguage(); - } - - // We failed to detect system language, so we will use English: - if (lang == wxLANGUAGE_UNKNOWN) - { - return false; - } - - const wxLanguageInfo *info = GetLanguageInfo(lang); - - // Unknown language: - if (info == NULL) - { - wxLogError(wxT("Unknown language %i."), lang); - return false; - } - - wxString name = info->Description; - wxString canonical = info->CanonicalName; - wxString locale; - - // Set the locale: -#if defined(__OS2__) - wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); -#elif defined(__UNIX__) && !defined(__WXMAC__) - if (language != wxLANGUAGE_DEFAULT) - locale = info->CanonicalName; - - wxMB2WXbuf retloc = wxSetlocaleTryUTF(LC_ALL, locale); - - const wxString langOnly = locale.Left(2); - if ( !retloc ) - { - // Some C libraries don't like xx_YY form and require xx only - retloc = wxSetlocaleTryUTF(LC_ALL, langOnly); - } - -#if wxUSE_FONTMAP - // some systems (e.g. FreeBSD and HP-UX) don't have xx_YY aliases but - // require the full xx_YY.encoding form, so try using UTF-8 because this is - // the only thing we can do generically - // - // TODO: add encodings applicable to each language to the lang DB and try - // them all in turn here - if ( !retloc ) - { - const wxChar **names = - wxFontMapperBase::GetAllEncodingNames(wxFONTENCODING_UTF8); - while ( *names ) - { - retloc = wxSetlocale(LC_ALL, locale + _T('.') + *names++); - if ( retloc ) - break; - } - } -#endif // wxUSE_FONTMAP - - if ( !retloc ) - { - // Some C libraries (namely glibc) still use old ISO 639, - // so will translate the abbrev for them - wxString localeAlt; - if ( langOnly == wxT("he") ) - localeAlt = wxT("iw") + locale.Mid(3); - else if ( langOnly == wxT("id") ) - localeAlt = wxT("in") + locale.Mid(3); - else if ( langOnly == wxT("yi") ) - localeAlt = wxT("ji") + locale.Mid(3); - else if ( langOnly == wxT("nb") ) - localeAlt = wxT("no_NO"); - else if ( langOnly == wxT("nn") ) - localeAlt = wxT("no_NY"); - - if ( !localeAlt.empty() ) - { - retloc = wxSetlocaleTryUTF(LC_ALL, localeAlt); - if ( !retloc ) - retloc = wxSetlocaleTryUTF(LC_ALL, localeAlt.Left(2)); - } - } - - if ( !retloc ) - { - wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); - return false; - } - -#ifdef __AIX__ - // at least in AIX 5.2 libc is buggy and the string returned from setlocale(LC_ALL) - // can't be passed back to it because it returns 6 strings (one for each locale - // category), i.e. for C locale we get back "C C C C C C" - // - // this contradicts IBM own docs but this is not of much help, so just work around - // it in the crudest possible manner - wxChar *p = wxStrchr((wxChar *)retloc, _T(' ')); - if ( p ) - *p = _T('\0'); -#endif // __AIX__ - -#elif defined(__WIN32__) - - #if wxUSE_UNICODE && (defined(__VISUALC__) || defined(__MINGW32__)) - // NB: setlocale() from msvcrt.dll (used by VC++ and Mingw) - // can't set locale to language that can only be written using - // Unicode. Therefore wxSetlocale call failed, but we don't want - // to report it as an error -- so that at least message catalogs - // can be used. Watch for code marked with - // #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS bellow. - #define SETLOCALE_FAILS_ON_UNICODE_LANGS - #endif - -#if !wxUSE_UNICODE - const -#endif - wxMB2WXbuf retloc = wxT("C"); - if (language != wxLANGUAGE_DEFAULT) - { - if (info->WinLang == 0) - { - wxLogWarning(wxT("Locale '%s' not supported by OS."), name.c_str()); - // retloc already set to "C" - } - else - { - int codepage - #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS - = -1 - #endif - ; - wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), - SORT_DEFAULT); - // FIXME -#ifndef __WXWINCE__ - SetThreadLocale(lcid); -#endif - // NB: we must translate LCID to CRT's setlocale string ourselves, - // because SetThreadLocale does not modify change the - // interpretation of setlocale(LC_ALL, "") call: - wxChar buffer[256]; - buffer[0] = wxT('\0'); - GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, 256); - locale << buffer; - if (GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, buffer, 256) > 0) - locale << wxT("_") << buffer; - if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buffer, 256) > 0) - { - codepage = wxAtoi(buffer); - if (codepage != 0) - locale << wxT(".") << buffer; - } - if (locale.empty()) - { - wxLogLastError(wxT("SetThreadLocale")); - wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); - return false; - } - else - { - // FIXME -#ifndef __WXWINCE__ - retloc = wxSetlocale(LC_ALL, locale); -#endif -#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS - if (codepage == 0 && (const wxChar*)retloc == NULL) - { - retloc = wxT("C"); - } -#endif - } - } - } - else - { - // FIXME -#ifndef __WXWINCE__ - retloc = wxSetlocale(LC_ALL, wxEmptyString); -#else - retloc = NULL; -#endif -#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS - if ((const wxChar*)retloc == NULL) - { - wxChar buffer[16]; - if (GetLocaleInfo(LOCALE_USER_DEFAULT, - LOCALE_IDEFAULTANSICODEPAGE, buffer, 16) > 0 && - wxStrcmp(buffer, wxT("0")) == 0) - { - retloc = wxT("C"); - } - } -#endif - } - - if ( !retloc ) - { - wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); - return false; - } -#elif defined(__WXMAC__) - if (lang == wxLANGUAGE_DEFAULT) - locale = wxEmptyString; - else - locale = info->CanonicalName; - - wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale); - - if ( !retloc ) - { - // Some C libraries don't like xx_YY form and require xx only - retloc = wxSetlocale(LC_ALL, locale.Mid(0,2)); - } - if ( !retloc ) - { - wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); - return false; - } -#else - wxUnusedVar(flags); - return false; - #define WX_NO_LOCALE_SUPPORT -#endif - -#ifndef WX_NO_LOCALE_SUPPORT - wxChar *szLocale = retloc ? wxStrdup(retloc) : NULL; - bool ret = Init(name, canonical, szLocale, - (flags & wxLOCALE_LOAD_DEFAULT) != 0, - (flags & wxLOCALE_CONV_ENCODING) != 0); - free(szLocale); - - if (IsOk()) // setlocale() succeeded - m_language = lang; - - return ret; -#endif // !WX_NO_LOCALE_SUPPORT -} - - - -void wxLocale::AddCatalogLookupPathPrefix(const wxString& prefix) -{ - if ( gs_searchPrefixes.Index(prefix) == wxNOT_FOUND ) - { - gs_searchPrefixes.Add(prefix); - } - //else: already have it -} - -/*static*/ int wxLocale::GetSystemLanguage() -{ - CreateLanguagesDB(); - - // init i to avoid compiler warning - size_t i = 0, - count = ms_languagesDB->GetCount(); - -#if defined(__UNIX__) && !defined(__WXMAC__) - // first get the string identifying the language from the environment - wxString langFull; - if (!wxGetEnv(wxT("LC_ALL"), &langFull) && - !wxGetEnv(wxT("LC_MESSAGES"), &langFull) && - !wxGetEnv(wxT("LANG"), &langFull)) - { - // no language specified, treat it as English - return wxLANGUAGE_ENGLISH_US; - } - - if ( langFull == _T("C") || langFull == _T("POSIX") ) - { - // default C locale is English too - return wxLANGUAGE_ENGLISH_US; - } - - // the language string has the following form - // - // lang[_LANG][.encoding][@modifier] - // - // (see environ(5) in the Open Unix specification) - // - // where lang is the primary language, LANG is a sublang/territory, - // encoding is the charset to use and modifier "allows the user to select - // a specific instance of localization data within a single category" - // - // for example, the following strings are valid: - // fr - // fr_FR - // de_DE.iso88591 - // de_DE@euro - // de_DE.iso88591@euro - - // for now we don't use the encoding, although we probably should (doing - // translations of the msg catalogs on the fly as required) (TODO) - // - // we need the modified for languages like Valencian: ca_ES@valencia - // though, remember it - wxString modifier; - size_t posModifier = langFull.find_first_of(_T("@")); - if ( posModifier != wxString::npos ) - modifier = langFull.Mid(posModifier); - - size_t posEndLang = langFull.find_first_of(_T("@.")); - if ( posEndLang != wxString::npos ) - { - langFull.Truncate(posEndLang); - } - - // in addition to the format above, we also can have full language names - // in LANG env var - for example, SuSE is known to use LANG="german" - so - // check for this - - // do we have just the language (or sublang too)? - bool justLang = langFull.length() == LEN_LANG; - if ( justLang || - (langFull.length() == LEN_FULL && langFull[LEN_LANG] == wxT('_')) ) - { - // 0. Make sure the lang is according to latest ISO 639 - // (this is necessary because glibc uses iw and in instead - // of he and id respectively). - - // the language itself (second part is the dialect/sublang) - wxString langOrig = ExtractLang(langFull); - - wxString lang; - if ( langOrig == wxT("iw")) - lang = _T("he"); - else if (langOrig == wxT("in")) - lang = wxT("id"); - else if (langOrig == wxT("ji")) - lang = wxT("yi"); - else if (langOrig == wxT("no_NO")) - lang = wxT("nb_NO"); - else if (langOrig == wxT("no_NY")) - lang = wxT("nn_NO"); - else if (langOrig == wxT("no")) - lang = wxT("nb_NO"); - else - lang = langOrig; - - // did we change it? - if ( lang != langOrig ) - { - langFull = lang + ExtractNotLang(langFull); - } - - // 1. Try to find the language either as is: - // a) With modifier if set - if ( !modifier.empty() ) - { - wxString langFullWithModifier = langFull + modifier; - for ( i = 0; i < count; i++ ) - { - if ( ms_languagesDB->Item(i).CanonicalName == langFullWithModifier ) - break; - } - } - - // b) Without modifier - if ( modifier.empty() || i == count ) - { - for ( i = 0; i < count; i++ ) - { - if ( ms_languagesDB->Item(i).CanonicalName == langFull ) - break; - } - } - - // 2. If langFull is of the form xx_YY, try to find xx: - if ( i == count && !justLang ) - { - for ( i = 0; i < count; i++ ) - { - if ( ms_languagesDB->Item(i).CanonicalName == lang ) - { - break; - } - } - } - - // 3. If langFull is of the form xx, try to find any xx_YY record: - if ( i == count && justLang ) - { - for ( i = 0; i < count; i++ ) - { - if ( ExtractLang(ms_languagesDB->Item(i).CanonicalName) - == langFull ) - { - break; - } - } - } - } - else // not standard format - { - // try to find the name in verbose description - for ( i = 0; i < count; i++ ) - { - if (ms_languagesDB->Item(i).Description.CmpNoCase(langFull) == 0) - { - break; - } - } - } -#elif defined(__WXMAC__) - const wxChar * lc = NULL ; - long lang = GetScriptVariable( smSystemScript, smScriptLang) ; - switch( GetScriptManagerVariable( smRegionCode ) ) { - case verUS : - lc = wxT("en_US") ; - break ; - case verFrance : - lc = wxT("fr_FR") ; - break ; - case verBritain : - lc = wxT("en_GB") ; - break ; - case verGermany : - lc = wxT("de_DE") ; - break ; - case verItaly : - lc = wxT("it_IT") ; - break ; - case verNetherlands : - lc = wxT("nl_NL") ; - break ; - case verFlemish : - lc = wxT("nl_BE") ; - break ; - case verSweden : - lc = wxT("sv_SE" ); - break ; - case verSpain : - lc = wxT("es_ES" ); - break ; - case verDenmark : - lc = wxT("da_DK") ; - break ; - case verPortugal : - lc = wxT("pt_PT") ; - break ; - case verFrCanada: - lc = wxT("fr_CA") ; - break ; - case verNorway: - lc = wxT("nb_NO") ; - break ; - case verIsrael: - lc = wxT("iw_IL") ; - break ; - case verJapan: - lc = wxT("ja_JP") ; - break ; - case verAustralia: - lc = wxT("en_AU") ; - break ; - case verArabic: - lc = wxT("ar") ; - break ; - case verFinland: - lc = wxT("fi_FI") ; - break ; - case verFrSwiss: - lc = wxT("fr_CH") ; - break ; - case verGrSwiss: - lc = wxT("de_CH") ; - break ; - case verGreece: - lc = wxT("el_GR") ; - break ; - case verIceland: - lc = wxT("is_IS") ; - break ; - case verMalta: - lc = wxT("mt_MT") ; - break ; - case verCyprus: - // _CY is not part of wx, so we have to translate according to the system language - if ( lang == langGreek ) { - lc = wxT("el_GR") ; - } - else if ( lang == langTurkish ) { - lc = wxT("tr_TR") ; - } - break ; - case verTurkey: - lc = wxT("tr_TR") ; - break ; - case verYugoCroatian: - lc = wxT("hr_HR") ; - break ; - case verIndiaHindi: - lc = wxT("hi_IN") ; - break ; - case verPakistanUrdu: - lc = wxT("ur_PK") ; - break ; - case verTurkishModified: - lc = wxT("tr_TR") ; - break ; - case verItalianSwiss: - lc = wxT("it_CH") ; - break ; - case verInternational: - lc = wxT("en") ; - break ; - case verRomania: - lc = wxT("ro_RO") ; - break ; - case verGreecePoly: - lc = wxT("el_GR") ; - break ; - case verLithuania: - lc = wxT("lt_LT") ; - break ; - case verPoland: - lc = wxT("pl_PL") ; - break ; - case verMagyar : - case verHungary: - lc = wxT("hu_HU") ; - break ; - case verEstonia: - lc = wxT("et_EE") ; - break ; - case verLatvia: - lc = wxT("lv_LV") ; - break ; - case verSami: - lc = wxT("se_NO") ; - break ; - case verFaroeIsl: - lc = wxT("fo_FO") ; - break ; - case verIran: - lc = wxT("fa_IR") ; - break ; - case verRussia: - lc = wxT("ru_RU") ; - break ; - case verIreland: - lc = wxT("ga_IE") ; - break ; - case verKorea: - lc = wxT("ko_KR") ; - break ; - case verChina: - lc = wxT("zh_CN") ; - break ; - case verTaiwan: - lc = wxT("zh_TW") ; - break ; - case verThailand: - lc = wxT("th_TH") ; - break ; - case verCzech: - lc = wxT("cs_CZ") ; - break ; - case verSlovak: - lc = wxT("sk_SK") ; - break ; - case verBengali: - lc = wxT("bn") ; - break ; - case verByeloRussian: - lc = wxT("be_BY") ; - break ; - case verUkraine: - lc = wxT("uk_UA") ; - break ; - case verGreeceAlt: - lc = wxT("el_GR") ; - break ; - case verSerbian: - lc = wxT("sr_YU") ; - break ; - case verSlovenian: - lc = wxT("sl_SI") ; - break ; - case verMacedonian: - lc = wxT("mk_MK") ; - break ; - case verCroatia: - lc = wxT("hr_HR") ; - break ; - case verBrazil: - lc = wxT("pt_BR ") ; - break ; - case verBulgaria: - lc = wxT("bg_BG") ; - break ; - case verCatalonia: - lc = wxT("ca_ES") ; - break ; - case verScottishGaelic: - lc = wxT("gd") ; - break ; - case verManxGaelic: - lc = wxT("gv") ; - break ; - case verBreton: - lc = wxT("br") ; - break ; - case verNunavut: - lc = wxT("iu_CA") ; - break ; - case verWelsh: - lc = wxT("cy") ; - break ; - case verIrishGaelicScript: - lc = wxT("ga_IE") ; - break ; - case verEngCanada: - lc = wxT("en_CA") ; - break ; - case verBhutan: - lc = wxT("dz_BT") ; - break ; - case verArmenian: - lc = wxT("hy_AM") ; - break ; - case verGeorgian: - lc = wxT("ka_GE") ; - break ; - case verSpLatinAmerica: - lc = wxT("es_AR") ; - break ; - case verTonga: - lc = wxT("to_TO" ); - break ; - case verFrenchUniversal: - lc = wxT("fr_FR") ; - break ; - case verAustria: - lc = wxT("de_AT") ; - break ; - case verGujarati: - lc = wxT("gu_IN") ; - break ; - case verPunjabi: - lc = wxT("pa") ; - break ; - case verIndiaUrdu: - lc = wxT("ur_IN") ; - break ; - case verVietnam: - lc = wxT("vi_VN") ; - break ; - case verFrBelgium: - lc = wxT("fr_BE") ; - break ; - case verUzbek: - lc = wxT("uz_UZ") ; - break ; - case verSingapore: - lc = wxT("zh_SG") ; - break ; - case verNynorsk: - lc = wxT("nn_NO") ; - break ; - case verAfrikaans: - lc = wxT("af_ZA") ; - break ; - case verEsperanto: - lc = wxT("eo") ; - break ; - case verMarathi: - lc = wxT("mr_IN") ; - break ; - case verTibetan: - lc = wxT("bo") ; - break ; - case verNepal: - lc = wxT("ne_NP") ; - break ; - case verGreenland: - lc = wxT("kl_GL") ; - break ; - default : - break ; - } - if ( !lc ) - return wxLANGUAGE_UNKNOWN; - for ( i = 0; i < count; i++ ) - { - if ( ms_languagesDB->Item(i).CanonicalName == lc ) - { - break; - } - } - -#elif defined(__WIN32__) - LCID lcid = GetUserDefaultLCID(); - if ( lcid != 0 ) - { - wxUint32 lang = PRIMARYLANGID(LANGIDFROMLCID(lcid)); - wxUint32 sublang = SUBLANGID(LANGIDFROMLCID(lcid)); - - for ( i = 0; i < count; i++ ) - { - if (ms_languagesDB->Item(i).WinLang == lang && - ms_languagesDB->Item(i).WinSublang == sublang) - { - break; - } - } - } - //else: leave wxlang == wxLANGUAGE_UNKNOWN -#endif // Unix/Win32 - - if ( i < count ) - { - // we did find a matching entry, use it - return ms_languagesDB->Item(i).Language; - } - - // no info about this language in the database - return wxLANGUAGE_UNKNOWN; -} - -// ---------------------------------------------------------------------------- -// encoding stuff -// ---------------------------------------------------------------------------- - -// this is a bit strange as under Windows we get the encoding name using its -// numeric value and under Unix we do it the other way round, but this just -// reflects the way different systems provide the encoding info - -/* static */ -wxString wxLocale::GetSystemEncodingName() -{ - wxString encname; - -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - // FIXME: what is the error return value for GetACP()? - UINT codepage = ::GetACP(); - encname.Printf(_T("windows-%u"), codepage); -#elif defined(__WXMAC__) - // default is just empty string, this resolves to the default system - // encoding later -#elif defined(__UNIX_LIKE__) - -#if defined(HAVE_LANGINFO_H) && defined(CODESET) - // GNU libc provides current character set this way (this conforms - // to Unix98) - char *oldLocale = strdup(setlocale(LC_CTYPE, NULL)); - setlocale(LC_CTYPE, ""); - const char *alang = nl_langinfo(CODESET); - setlocale(LC_CTYPE, oldLocale); - free(oldLocale); - - if ( alang ) - { - encname = wxString::FromAscii( alang ); - } - else // nl_langinfo() failed -#endif // HAVE_LANGINFO_H - { - // if we can't get at the character set directly, try to see if it's in - // the environment variables (in most cases this won't work, but I was - // out of ideas) - char *lang = getenv( "LC_ALL"); - char *dot = lang ? strchr(lang, '.') : (char *)NULL; - if (!dot) - { - lang = getenv( "LC_CTYPE" ); - if ( lang ) - dot = strchr(lang, '.' ); - } - if (!dot) - { - lang = getenv( "LANG"); - if ( lang ) - dot = strchr(lang, '.'); - } - - if ( dot ) - { - encname = wxString::FromAscii( dot+1 ); - } - } -#endif // Win32/Unix - - return encname; -} - -/* static */ -wxFontEncoding wxLocale::GetSystemEncoding() -{ -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - UINT codepage = ::GetACP(); - - // wxWidgets only knows about CP1250-1257, 874, 932, 936, 949, 950 - if ( codepage >= 1250 && codepage <= 1257 ) - { - return (wxFontEncoding)(wxFONTENCODING_CP1250 + codepage - 1250); - } - - if ( codepage == 874 ) - { - return wxFONTENCODING_CP874; - } - - if ( codepage == 932 ) - { - return wxFONTENCODING_CP932; - } - - if ( codepage == 936 ) - { - return wxFONTENCODING_CP936; - } - - if ( codepage == 949 ) - { - return wxFONTENCODING_CP949; - } - - if ( codepage == 950 ) - { - return wxFONTENCODING_CP950; - } -#elif defined(__WXMAC__) - TextEncoding encoding = 0 ; -#if TARGET_CARBON - encoding = CFStringGetSystemEncoding() ; -#else - UpgradeScriptInfoToTextEncoding ( smSystemScript , kTextLanguageDontCare , kTextRegionDontCare , NULL , &encoding ) ; -#endif - return wxMacGetFontEncFromSystemEnc( encoding ) ; -#elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP - const wxString encname = GetSystemEncodingName(); - if ( !encname.empty() ) - { - wxFontEncoding enc = wxFontMapperBase::GetEncodingFromName(encname); - - // on some modern Linux systems (RedHat 8) the default system locale - // is UTF8 -- but it isn't supported by wxGTK1 in ANSI build at all so - // don't even try to use it in this case -#if !wxUSE_UNICODE && \ - ((defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__WXMOTIF__)) - if ( enc == wxFONTENCODING_UTF8 ) - { - // the most similar supported encoding... - enc = wxFONTENCODING_ISO8859_1; - } -#endif // !wxUSE_UNICODE - - // GetEncodingFromName() returns wxFONTENCODING_DEFAULT for C locale - // (a.k.a. US-ASCII) which is arguably a bug but keep it like this for - // backwards compatibility and just take care to not return - // wxFONTENCODING_DEFAULT from here as this surely doesn't make sense - if ( enc == wxFONTENCODING_DEFAULT ) - { - // we don't have wxFONTENCODING_ASCII, so use the closest one - return wxFONTENCODING_ISO8859_1; - } - - if ( enc != wxFONTENCODING_MAX ) - { - return enc; - } - //else: return wxFONTENCODING_SYSTEM below - } -#endif // Win32/Unix - - return wxFONTENCODING_SYSTEM; -} - -/* static */ -void wxLocale::AddLanguage(const wxLanguageInfo& info) -{ - CreateLanguagesDB(); - ms_languagesDB->Add(info); -} - -/* static */ -const wxLanguageInfo *wxLocale::GetLanguageInfo(int lang) -{ - CreateLanguagesDB(); - - // calling GetLanguageInfo(wxLANGUAGE_DEFAULT) is a natural thing to do, so - // make it work - if ( lang == wxLANGUAGE_DEFAULT ) - lang = GetSystemLanguage(); - - const size_t count = ms_languagesDB->GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - if ( ms_languagesDB->Item(i).Language == lang ) - { - // We need to create a temporary here in order to make this work with BCC in final build mode - wxLanguageInfo *ptr = &ms_languagesDB->Item(i); - return ptr; - } - } - - return NULL; -} - -/* static */ -wxString wxLocale::GetLanguageName(int lang) -{ - const wxLanguageInfo *info = GetLanguageInfo(lang); - if ( !info ) - return wxEmptyString; - else - return info->Description; -} - -/* static */ -const wxLanguageInfo *wxLocale::FindLanguageInfo(const wxString& locale) -{ - CreateLanguagesDB(); - - const wxLanguageInfo *infoRet = NULL; - - const size_t count = ms_languagesDB->GetCount(); - for ( size_t i = 0; i < count; i++ ) - { - const wxLanguageInfo *info = &ms_languagesDB->Item(i); - - if ( wxStricmp(locale, info->CanonicalName) == 0 || - wxStricmp(locale, info->Description) == 0 ) - { - // exact match, stop searching - infoRet = info; - break; - } - - if ( wxStricmp(locale, info->CanonicalName.BeforeFirst(_T('_'))) == 0 ) - { - // a match -- but maybe we'll find an exact one later, so continue - // looking - // - // OTOH, maybe we had already found a language match and in this - // case don't overwrite it becauce the entry for the default - // country always appears first in ms_languagesDB - if ( !infoRet ) - infoRet = info; - } - } - - return infoRet; -} - -wxString wxLocale::GetSysName() const -{ - // FIXME -#ifndef __WXWINCE__ - return wxSetlocale(LC_ALL, NULL); -#else - return wxEmptyString; -#endif -} - -// clean up -wxLocale::~wxLocale() -{ - // free memory - wxMsgCatalog *pTmpCat; - while ( m_pMsgCat != NULL ) { - pTmpCat = m_pMsgCat; - m_pMsgCat = m_pMsgCat->m_pNext; - delete pTmpCat; - } - - // restore old locale pointer - wxSetLocale(m_pOldLocale); - - // FIXME -#ifndef __WXWINCE__ - wxSetlocale(LC_ALL, m_pszOldLocale); -#endif - free((wxChar *)m_pszOldLocale); // const_cast -} - -// get the translation of given string in current locale -const wxChar *wxLocale::GetString(const wxChar *szOrigString, - const wxChar *szDomain) const -{ - return GetString(szOrigString, szOrigString, size_t(-1), szDomain); -} - -const wxChar *wxLocale::GetString(const wxChar *szOrigString, - const wxChar *szOrigString2, - size_t n, - const wxChar *szDomain) const -{ - if ( wxIsEmpty(szOrigString) ) - return wxEmptyString; - - const wxChar *pszTrans = NULL; - wxMsgCatalog *pMsgCat; - - if ( szDomain != NULL && szDomain[0] ) - { - pMsgCat = FindCatalog(szDomain); - - // does the catalog exist? - if ( pMsgCat != NULL ) - pszTrans = pMsgCat->GetString(szOrigString, n); - } - else - { - // search in all domains - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) - { - pszTrans = pMsgCat->GetString(szOrigString, n); - if ( pszTrans != NULL ) // take the first found - break; - } - } - - if ( pszTrans == NULL ) - { -#ifdef __WXDEBUG__ - if ( !NoTransErr::Suppress() ) - { - NoTransErr noTransErr; - - wxLogTrace(TRACE_I18N, - _T("string \"%s\"[%ld] not found in %slocale '%s'."), - szOrigString, (long)n, - szDomain ? wxString::Format(_T("domain '%s' "), szDomain).c_str() - : _T(""), - m_strLocale.c_str()); - } -#endif // __WXDEBUG__ - - if (n == size_t(-1)) - return szOrigString; - else - return n == 1 ? szOrigString : szOrigString2; - } - - return pszTrans; -} - -wxString wxLocale::GetHeaderValue( const wxChar* szHeader, - const wxChar* szDomain ) const -{ - if ( wxIsEmpty(szHeader) ) - return wxEmptyString; - - wxChar const * pszTrans = NULL; - wxMsgCatalog *pMsgCat; - - if ( szDomain != NULL ) - { - pMsgCat = FindCatalog(szDomain); - - // does the catalog exist? - if ( pMsgCat == NULL ) - return wxEmptyString; - - pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); - } - else - { - // search in all domains - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) - { - pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); - if ( pszTrans != NULL ) // take the first found - break; - } - } - - if ( wxIsEmpty(pszTrans) ) - return wxEmptyString; - - wxChar const * pszFound = wxStrstr(pszTrans, szHeader); - if ( pszFound == NULL ) - return wxEmptyString; - - pszFound += wxStrlen(szHeader) + 2 /* ': ' */; - - // Every header is separated by \n - - wxChar const * pszEndLine = wxStrchr(pszFound, wxT('\n')); - if ( pszEndLine == NULL ) pszEndLine = pszFound + wxStrlen(pszFound); - - - // wxString( wxChar*, length); - wxString retVal( pszFound, pszEndLine - pszFound ); - - return retVal; -} - - -// find catalog by name in a linked list, return NULL if !found -wxMsgCatalog *wxLocale::FindCatalog(const wxChar *szDomain) const -{ - // linear search in the linked list - wxMsgCatalog *pMsgCat; - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) - { - if ( wxStricmp(pMsgCat->GetName(), szDomain) == 0 ) - return pMsgCat; - } - - return NULL; -} - -// check if the given locale is provided by OS and C run time -/* static */ -bool wxLocale::IsAvailable(int lang) -{ - const wxLanguageInfo *info = wxLocale::GetLanguageInfo(lang); - wxCHECK_MSG( info, false, _T("invalid language") ); - -#if defined(__WIN32__) - if ( !info->WinLang ) - return false; - - if ( !::IsValidLocale - ( - MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), - SORT_DEFAULT), - LCID_INSTALLED - ) ) - return false; - -#elif defined(__UNIX__) - - // Test if setting the locale works, then set it back. - wxMB2WXbuf oldLocale = wxSetlocale(LC_ALL, wxEmptyString); - wxMB2WXbuf tmp = wxSetlocaleTryUTF(LC_ALL, info->CanonicalName); - if ( !tmp ) - { - // Some C libraries don't like xx_YY form and require xx only - tmp = wxSetlocaleTryUTF(LC_ALL, info->CanonicalName.Left(2)); - if ( !tmp ) - return false; - } - // restore the original locale - wxSetlocale(LC_ALL, oldLocale); -#endif - - return true; -} - -// check if the given catalog is loaded -bool wxLocale::IsLoaded(const wxChar *szDomain) const -{ - return FindCatalog(szDomain) != NULL; -} - -// add a catalog to our linked list -bool wxLocale::AddCatalog(const wxChar *szDomain) -{ - return AddCatalog(szDomain, wxLANGUAGE_ENGLISH_US, NULL); -} - -// add a catalog to our linked list -bool wxLocale::AddCatalog(const wxChar *szDomain, - wxLanguage msgIdLanguage, - const wxChar *msgIdCharset) - -{ - wxMsgCatalog *pMsgCat = new wxMsgCatalog; - - if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) ) { - // add it to the head of the list so that in GetString it will - // be searched before the catalogs added earlier - pMsgCat->m_pNext = m_pMsgCat; - m_pMsgCat = pMsgCat; - - return true; - } - else { - // don't add it because it couldn't be loaded anyway - delete pMsgCat; - - // It is OK to not load catalog if the msgid language and m_language match, - // in which case we can directly display the texts embedded in program's - // source code: - if (m_language == msgIdLanguage) - return true; - - // If there's no exact match, we may still get partial match where the - // (basic) language is same, but the country differs. For example, it's - // permitted to use en_US strings from sources even if m_language is en_GB: - const wxLanguageInfo *msgIdLangInfo = GetLanguageInfo(msgIdLanguage); - if ( msgIdLangInfo && - msgIdLangInfo->CanonicalName.Mid(0, 2) == m_strShort.Mid(0, 2) ) - { - return true; - } - - return false; - } -} - -// ---------------------------------------------------------------------------- -// accessors for locale-dependent data -// ---------------------------------------------------------------------------- - -#ifdef __WXMSW__ - -/* static */ -wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) -{ - wxUint32 lcid = LOCALE_USER_DEFAULT; - - if (wxGetLocale()) - { - const wxLanguageInfo *info = GetLanguageInfo(wxGetLocale()->GetLanguage()); - if (info) - { ; - lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), - SORT_DEFAULT); - } - } - - wxString str; - wxChar buffer[256]; - size_t count; - buffer[0] = wxT('\0'); - switch (index) - { - case wxLOCALE_DECIMAL_POINT: - count = ::GetLocaleInfo(lcid, LOCALE_SDECIMAL, buffer, 256); - if (!count) - str << wxT("."); - else - str << buffer; - break; -#if 0 - case wxSYS_LIST_SEPARATOR: - count = ::GetLocaleInfo(lcid, LOCALE_SLIST, buffer, 256); - if (!count) - str << wxT(","); - else - str << buffer; - break; - case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero - count = ::GetLocaleInfo(lcid, LOCALE_ILZERO, buffer, 256); - if (!count) - str << wxT("0"); - else - str << buffer; - break; -#endif - default: - wxFAIL_MSG(wxT("Unknown System String !")); - } - return str; -} - -#elif defined(__DARWIN__) - -/* static */ -wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) -{ - CFLocaleRef userLocaleRefRaw; - if ( wxGetLocale() ) - { - userLocaleRefRaw = CFLocaleCreate - ( - kCFAllocatorDefault, - wxMacCFStringHolder(wxGetLocale()->GetCanonicalName()) - ); - } - else // no current locale, use the default one - { - userLocaleRefRaw = CFLocaleCopyCurrent(); - } - - wxCFRef userLocaleRef(userLocaleRefRaw); - - CFTypeRef cfstr; - switch ( index ) - { - case wxLOCALE_THOUSANDS_SEP: - cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator); - break; - - case wxLOCALE_DECIMAL_POINT: - cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator); - break; - - default: - wxFAIL_MSG( _T("Unknown locale info") ); - } - - wxMacCFStringHolder - str(CFStringCreateCopy(NULL, static_cast(cfstr))); - return str.AsString(); -} - -#else // !__WXMSW__ && !__DARWIN__ - -/* static */ -wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) -{ - struct lconv *locale_info = localeconv(); - switch (cat) - { - case wxLOCALE_CAT_NUMBER: - switch (index) - { - case wxLOCALE_THOUSANDS_SEP: - return wxString(locale_info->thousands_sep, - *wxConvCurrent); - case wxLOCALE_DECIMAL_POINT: - return wxString(locale_info->decimal_point, - *wxConvCurrent); - default: - return wxEmptyString; - } - case wxLOCALE_CAT_MONEY: - switch (index) - { - case wxLOCALE_THOUSANDS_SEP: - return wxString(locale_info->mon_thousands_sep, - *wxConvCurrent); - case wxLOCALE_DECIMAL_POINT: - return wxString(locale_info->mon_decimal_point, - *wxConvCurrent); - default: - return wxEmptyString; - } - default: - return wxEmptyString; - } -} - -#endif // __WXMSW__/!__WXMSW__ - -// ---------------------------------------------------------------------------- -// global functions and variables -// ---------------------------------------------------------------------------- - -// retrieve/change current locale -// ------------------------------ - -// the current locale object -static wxLocale *g_pLocale = NULL; - -wxLocale *wxGetLocale() -{ - return g_pLocale; -} - -wxLocale *wxSetLocale(wxLocale *pLocale) -{ - wxLocale *pOld = g_pLocale; - g_pLocale = pLocale; - return pOld; -} - - - -// ---------------------------------------------------------------------------- -// wxLocale module (for lazy destruction of languagesDB) -// ---------------------------------------------------------------------------- - -class wxLocaleModule: public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxLocaleModule) - public: - wxLocaleModule() {} - bool OnInit() { return true; } - void OnExit() { wxLocale::DestroyLanguagesDB(); } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule) - - - -// ---------------------------------------------------------------------------- -// default languages table & initialization -// ---------------------------------------------------------------------------- - - - -// --- --- --- generated code begins here --- --- --- - -// This table is generated by misc/languages/genlang.py -// When making changes, please put them into misc/languages/langtabl.txt - -#if !defined(__WIN32__) || defined(__WXMICROWIN__) - -#define SETWINLANG(info,lang,sublang) - -#else - -#define SETWINLANG(info,lang,sublang) \ - info.WinLang = lang, info.WinSublang = sublang; - -#ifndef LANG_AFRIKAANS -#define LANG_AFRIKAANS (0) -#endif -#ifndef LANG_ALBANIAN -#define LANG_ALBANIAN (0) -#endif -#ifndef LANG_ARABIC -#define LANG_ARABIC (0) -#endif -#ifndef LANG_ARMENIAN -#define LANG_ARMENIAN (0) -#endif -#ifndef LANG_ASSAMESE -#define LANG_ASSAMESE (0) -#endif -#ifndef LANG_AZERI -#define LANG_AZERI (0) -#endif -#ifndef LANG_BASQUE -#define LANG_BASQUE (0) -#endif -#ifndef LANG_BELARUSIAN -#define LANG_BELARUSIAN (0) -#endif -#ifndef LANG_BENGALI -#define LANG_BENGALI (0) -#endif -#ifndef LANG_BULGARIAN -#define LANG_BULGARIAN (0) -#endif -#ifndef LANG_CATALAN -#define LANG_CATALAN (0) -#endif -#ifndef LANG_CHINESE -#define LANG_CHINESE (0) -#endif -#ifndef LANG_CROATIAN -#define LANG_CROATIAN (0) -#endif -#ifndef LANG_CZECH -#define LANG_CZECH (0) -#endif -#ifndef LANG_DANISH -#define LANG_DANISH (0) -#endif -#ifndef LANG_DUTCH -#define LANG_DUTCH (0) -#endif -#ifndef LANG_ENGLISH -#define LANG_ENGLISH (0) -#endif -#ifndef LANG_ESTONIAN -#define LANG_ESTONIAN (0) -#endif -#ifndef LANG_FAEROESE -#define LANG_FAEROESE (0) -#endif -#ifndef LANG_FARSI -#define LANG_FARSI (0) -#endif -#ifndef LANG_FINNISH -#define LANG_FINNISH (0) -#endif -#ifndef LANG_FRENCH -#define LANG_FRENCH (0) -#endif -#ifndef LANG_GEORGIAN -#define LANG_GEORGIAN (0) -#endif -#ifndef LANG_GERMAN -#define LANG_GERMAN (0) -#endif -#ifndef LANG_GREEK -#define LANG_GREEK (0) -#endif -#ifndef LANG_GUJARATI -#define LANG_GUJARATI (0) -#endif -#ifndef LANG_HEBREW -#define LANG_HEBREW (0) -#endif -#ifndef LANG_HINDI -#define LANG_HINDI (0) -#endif -#ifndef LANG_HUNGARIAN -#define LANG_HUNGARIAN (0) -#endif -#ifndef LANG_ICELANDIC -#define LANG_ICELANDIC (0) -#endif -#ifndef LANG_INDONESIAN -#define LANG_INDONESIAN (0) -#endif -#ifndef LANG_ITALIAN -#define LANG_ITALIAN (0) -#endif -#ifndef LANG_JAPANESE -#define LANG_JAPANESE (0) -#endif -#ifndef LANG_KANNADA -#define LANG_KANNADA (0) -#endif -#ifndef LANG_KASHMIRI -#define LANG_KASHMIRI (0) -#endif -#ifndef LANG_KAZAK -#define LANG_KAZAK (0) -#endif -#ifndef LANG_KONKANI -#define LANG_KONKANI (0) -#endif -#ifndef LANG_KOREAN -#define LANG_KOREAN (0) -#endif -#ifndef LANG_LATVIAN -#define LANG_LATVIAN (0) -#endif -#ifndef LANG_LITHUANIAN -#define LANG_LITHUANIAN (0) -#endif -#ifndef LANG_MACEDONIAN -#define LANG_MACEDONIAN (0) -#endif -#ifndef LANG_MALAY -#define LANG_MALAY (0) -#endif -#ifndef LANG_MALAYALAM -#define LANG_MALAYALAM (0) -#endif -#ifndef LANG_MANIPURI -#define LANG_MANIPURI (0) -#endif -#ifndef LANG_MARATHI -#define LANG_MARATHI (0) -#endif -#ifndef LANG_NEPALI -#define LANG_NEPALI (0) -#endif -#ifndef LANG_NORWEGIAN -#define LANG_NORWEGIAN (0) -#endif -#ifndef LANG_ORIYA -#define LANG_ORIYA (0) -#endif -#ifndef LANG_POLISH -#define LANG_POLISH (0) -#endif -#ifndef LANG_PORTUGUESE -#define LANG_PORTUGUESE (0) -#endif -#ifndef LANG_PUNJABI -#define LANG_PUNJABI (0) -#endif -#ifndef LANG_ROMANIAN -#define LANG_ROMANIAN (0) -#endif -#ifndef LANG_RUSSIAN -#define LANG_RUSSIAN (0) -#endif -#ifndef LANG_SAMI -#define LANG_SAMI (0) -#endif -#ifndef LANG_SANSKRIT -#define LANG_SANSKRIT (0) -#endif -#ifndef LANG_SERBIAN -#define LANG_SERBIAN (0) -#endif -#ifndef LANG_SINDHI -#define LANG_SINDHI (0) -#endif -#ifndef LANG_SLOVAK -#define LANG_SLOVAK (0) -#endif -#ifndef LANG_SLOVENIAN -#define LANG_SLOVENIAN (0) -#endif -#ifndef LANG_SPANISH -#define LANG_SPANISH (0) -#endif -#ifndef LANG_SWAHILI -#define LANG_SWAHILI (0) -#endif -#ifndef LANG_SWEDISH -#define LANG_SWEDISH (0) -#endif -#ifndef LANG_TAMIL -#define LANG_TAMIL (0) -#endif -#ifndef LANG_TATAR -#define LANG_TATAR (0) -#endif -#ifndef LANG_TELUGU -#define LANG_TELUGU (0) -#endif -#ifndef LANG_THAI -#define LANG_THAI (0) -#endif -#ifndef LANG_TURKISH -#define LANG_TURKISH (0) -#endif -#ifndef LANG_UKRAINIAN -#define LANG_UKRAINIAN (0) -#endif -#ifndef LANG_URDU -#define LANG_URDU (0) -#endif -#ifndef LANG_UZBEK -#define LANG_UZBEK (0) -#endif -#ifndef LANG_VALENCIAN -#define LANG_VALENCIAN (0) -#endif -#ifndef LANG_VIETNAMESE -#define LANG_VIETNAMESE (0) -#endif -#ifndef SUBLANG_ARABIC_ALGERIA -#define SUBLANG_ARABIC_ALGERIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_BAHRAIN -#define SUBLANG_ARABIC_BAHRAIN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_EGYPT -#define SUBLANG_ARABIC_EGYPT SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_IRAQ -#define SUBLANG_ARABIC_IRAQ SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_JORDAN -#define SUBLANG_ARABIC_JORDAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_KUWAIT -#define SUBLANG_ARABIC_KUWAIT SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_LEBANON -#define SUBLANG_ARABIC_LEBANON SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_LIBYA -#define SUBLANG_ARABIC_LIBYA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_MOROCCO -#define SUBLANG_ARABIC_MOROCCO SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_OMAN -#define SUBLANG_ARABIC_OMAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_QATAR -#define SUBLANG_ARABIC_QATAR SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_SAUDI_ARABIA -#define SUBLANG_ARABIC_SAUDI_ARABIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_SYRIA -#define SUBLANG_ARABIC_SYRIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_TUNISIA -#define SUBLANG_ARABIC_TUNISIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_UAE -#define SUBLANG_ARABIC_UAE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ARABIC_YEMEN -#define SUBLANG_ARABIC_YEMEN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_AZERI_CYRILLIC -#define SUBLANG_AZERI_CYRILLIC SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_AZERI_LATIN -#define SUBLANG_AZERI_LATIN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_CHINESE_SIMPLIFIED -#define SUBLANG_CHINESE_SIMPLIFIED SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_CHINESE_TRADITIONAL -#define SUBLANG_CHINESE_TRADITIONAL SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_CHINESE_HONGKONG -#define SUBLANG_CHINESE_HONGKONG SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_CHINESE_MACAU -#define SUBLANG_CHINESE_MACAU SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_CHINESE_SINGAPORE -#define SUBLANG_CHINESE_SINGAPORE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_DUTCH -#define SUBLANG_DUTCH SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_DUTCH_BELGIAN -#define SUBLANG_DUTCH_BELGIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_UK -#define SUBLANG_ENGLISH_UK SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_US -#define SUBLANG_ENGLISH_US SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_AUS -#define SUBLANG_ENGLISH_AUS SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_BELIZE -#define SUBLANG_ENGLISH_BELIZE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_CAN -#define SUBLANG_ENGLISH_CAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_CARIBBEAN -#define SUBLANG_ENGLISH_CARIBBEAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_EIRE -#define SUBLANG_ENGLISH_EIRE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_JAMAICA -#define SUBLANG_ENGLISH_JAMAICA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_NZ -#define SUBLANG_ENGLISH_NZ SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_PHILIPPINES -#define SUBLANG_ENGLISH_PHILIPPINES SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_SOUTH_AFRICA -#define SUBLANG_ENGLISH_SOUTH_AFRICA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_TRINIDAD -#define SUBLANG_ENGLISH_TRINIDAD SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ENGLISH_ZIMBABWE -#define SUBLANG_ENGLISH_ZIMBABWE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH -#define SUBLANG_FRENCH SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH_BELGIAN -#define SUBLANG_FRENCH_BELGIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH_CANADIAN -#define SUBLANG_FRENCH_CANADIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH_LUXEMBOURG -#define SUBLANG_FRENCH_LUXEMBOURG SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH_MONACO -#define SUBLANG_FRENCH_MONACO SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_FRENCH_SWISS -#define SUBLANG_FRENCH_SWISS SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_GERMAN -#define SUBLANG_GERMAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_GERMAN_AUSTRIAN -#define SUBLANG_GERMAN_AUSTRIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_GERMAN_LIECHTENSTEIN -#define SUBLANG_GERMAN_LIECHTENSTEIN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_GERMAN_LUXEMBOURG -#define SUBLANG_GERMAN_LUXEMBOURG SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_GERMAN_SWISS -#define SUBLANG_GERMAN_SWISS SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ITALIAN -#define SUBLANG_ITALIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_ITALIAN_SWISS -#define SUBLANG_ITALIAN_SWISS SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_KASHMIRI_INDIA -#define SUBLANG_KASHMIRI_INDIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_KOREAN -#define SUBLANG_KOREAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_LITHUANIAN -#define SUBLANG_LITHUANIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM -#define SUBLANG_MALAY_BRUNEI_DARUSSALAM SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_MALAY_MALAYSIA -#define SUBLANG_MALAY_MALAYSIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_NEPALI_INDIA -#define SUBLANG_NEPALI_INDIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_NORWEGIAN_BOKMAL -#define SUBLANG_NORWEGIAN_BOKMAL SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_NORWEGIAN_NYNORSK -#define SUBLANG_NORWEGIAN_NYNORSK SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_PORTUGUESE -#define SUBLANG_PORTUGUESE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_PORTUGUESE_BRAZILIAN -#define SUBLANG_PORTUGUESE_BRAZILIAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SERBIAN_CYRILLIC -#define SUBLANG_SERBIAN_CYRILLIC SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SERBIAN_LATIN -#define SUBLANG_SERBIAN_LATIN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH -#define SUBLANG_SPANISH SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_ARGENTINA -#define SUBLANG_SPANISH_ARGENTINA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_BOLIVIA -#define SUBLANG_SPANISH_BOLIVIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_CHILE -#define SUBLANG_SPANISH_CHILE SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_COLOMBIA -#define SUBLANG_SPANISH_COLOMBIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_COSTA_RICA -#define SUBLANG_SPANISH_COSTA_RICA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC -#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_ECUADOR -#define SUBLANG_SPANISH_ECUADOR SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_EL_SALVADOR -#define SUBLANG_SPANISH_EL_SALVADOR SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_GUATEMALA -#define SUBLANG_SPANISH_GUATEMALA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_HONDURAS -#define SUBLANG_SPANISH_HONDURAS SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_MEXICAN -#define SUBLANG_SPANISH_MEXICAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_MODERN -#define SUBLANG_SPANISH_MODERN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_NICARAGUA -#define SUBLANG_SPANISH_NICARAGUA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_PANAMA -#define SUBLANG_SPANISH_PANAMA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_PARAGUAY -#define SUBLANG_SPANISH_PARAGUAY SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_PERU -#define SUBLANG_SPANISH_PERU SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_PUERTO_RICO -#define SUBLANG_SPANISH_PUERTO_RICO SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_URUGUAY -#define SUBLANG_SPANISH_URUGUAY SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SPANISH_VENEZUELA -#define SUBLANG_SPANISH_VENEZUELA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SWEDISH -#define SUBLANG_SWEDISH SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_SWEDISH_FINLAND -#define SUBLANG_SWEDISH_FINLAND SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_URDU_INDIA -#define SUBLANG_URDU_INDIA SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_URDU_PAKISTAN -#define SUBLANG_URDU_PAKISTAN SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_UZBEK_CYRILLIC -#define SUBLANG_UZBEK_CYRILLIC SUBLANG_DEFAULT -#endif -#ifndef SUBLANG_UZBEK_LATIN -#define SUBLANG_UZBEK_LATIN SUBLANG_DEFAULT -#endif - - -#endif // __WIN32__ - -#define LNG(wxlang, canonical, winlang, winsublang, layout, desc) \ - info.Language = wxlang; \ - info.CanonicalName = wxT(canonical); \ - info.LayoutDirection = layout; \ - info.Description = wxT(desc); \ - SETWINLANG(info, winlang, winsublang) \ - AddLanguage(info); - -void wxLocale::InitLanguagesDB() -{ - wxLanguageInfo info; - wxStringTokenizer tkn; - - LNG(wxLANGUAGE_ABKHAZIAN, "ab" , 0 , 0 , wxLayout_LeftToRight, "Abkhazian") - LNG(wxLANGUAGE_AFAR, "aa" , 0 , 0 , wxLayout_LeftToRight, "Afar") - LNG(wxLANGUAGE_AFRIKAANS, "af_ZA", LANG_AFRIKAANS , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Afrikaans") - LNG(wxLANGUAGE_ALBANIAN, "sq_AL", LANG_ALBANIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Albanian") - LNG(wxLANGUAGE_AMHARIC, "am" , 0 , 0 , wxLayout_LeftToRight, "Amharic") - LNG(wxLANGUAGE_ARABIC, "ar" , LANG_ARABIC , SUBLANG_DEFAULT , wxLayout_RightToLeft, "Arabic") - LNG(wxLANGUAGE_ARABIC_ALGERIA, "ar_DZ", LANG_ARABIC , SUBLANG_ARABIC_ALGERIA , wxLayout_RightToLeft, "Arabic (Algeria)") - LNG(wxLANGUAGE_ARABIC_BAHRAIN, "ar_BH", LANG_ARABIC , SUBLANG_ARABIC_BAHRAIN , wxLayout_RightToLeft, "Arabic (Bahrain)") - LNG(wxLANGUAGE_ARABIC_EGYPT, "ar_EG", LANG_ARABIC , SUBLANG_ARABIC_EGYPT , wxLayout_RightToLeft, "Arabic (Egypt)") - LNG(wxLANGUAGE_ARABIC_IRAQ, "ar_IQ", LANG_ARABIC , SUBLANG_ARABIC_IRAQ , wxLayout_RightToLeft, "Arabic (Iraq)") - LNG(wxLANGUAGE_ARABIC_JORDAN, "ar_JO", LANG_ARABIC , SUBLANG_ARABIC_JORDAN , wxLayout_RightToLeft, "Arabic (Jordan)") - LNG(wxLANGUAGE_ARABIC_KUWAIT, "ar_KW", LANG_ARABIC , SUBLANG_ARABIC_KUWAIT , wxLayout_RightToLeft, "Arabic (Kuwait)") - LNG(wxLANGUAGE_ARABIC_LEBANON, "ar_LB", LANG_ARABIC , SUBLANG_ARABIC_LEBANON , wxLayout_RightToLeft, "Arabic (Lebanon)") - LNG(wxLANGUAGE_ARABIC_LIBYA, "ar_LY", LANG_ARABIC , SUBLANG_ARABIC_LIBYA , wxLayout_RightToLeft, "Arabic (Libya)") - LNG(wxLANGUAGE_ARABIC_MOROCCO, "ar_MA", LANG_ARABIC , SUBLANG_ARABIC_MOROCCO , wxLayout_RightToLeft, "Arabic (Morocco)") - LNG(wxLANGUAGE_ARABIC_OMAN, "ar_OM", LANG_ARABIC , SUBLANG_ARABIC_OMAN , wxLayout_RightToLeft, "Arabic (Oman)") - LNG(wxLANGUAGE_ARABIC_QATAR, "ar_QA", LANG_ARABIC , SUBLANG_ARABIC_QATAR , wxLayout_RightToLeft, "Arabic (Qatar)") - LNG(wxLANGUAGE_ARABIC_SAUDI_ARABIA, "ar_SA", LANG_ARABIC , SUBLANG_ARABIC_SAUDI_ARABIA , wxLayout_RightToLeft, "Arabic (Saudi Arabia)") - LNG(wxLANGUAGE_ARABIC_SUDAN, "ar_SD", 0 , 0 , wxLayout_RightToLeft, "Arabic (Sudan)") - LNG(wxLANGUAGE_ARABIC_SYRIA, "ar_SY", LANG_ARABIC , SUBLANG_ARABIC_SYRIA , wxLayout_RightToLeft, "Arabic (Syria)") - LNG(wxLANGUAGE_ARABIC_TUNISIA, "ar_TN", LANG_ARABIC , SUBLANG_ARABIC_TUNISIA , wxLayout_RightToLeft, "Arabic (Tunisia)") - LNG(wxLANGUAGE_ARABIC_UAE, "ar_AE", LANG_ARABIC , SUBLANG_ARABIC_UAE , wxLayout_RightToLeft, "Arabic (Uae)") - LNG(wxLANGUAGE_ARABIC_YEMEN, "ar_YE", LANG_ARABIC , SUBLANG_ARABIC_YEMEN , wxLayout_RightToLeft, "Arabic (Yemen)") - LNG(wxLANGUAGE_ARMENIAN, "hy" , LANG_ARMENIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Armenian") - LNG(wxLANGUAGE_ASSAMESE, "as" , LANG_ASSAMESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Assamese") - LNG(wxLANGUAGE_AYMARA, "ay" , 0 , 0 , wxLayout_LeftToRight, "Aymara") - LNG(wxLANGUAGE_AZERI, "az" , LANG_AZERI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Azeri") - LNG(wxLANGUAGE_AZERI_CYRILLIC, "az" , LANG_AZERI , SUBLANG_AZERI_CYRILLIC , wxLayout_LeftToRight, "Azeri (Cyrillic)") - LNG(wxLANGUAGE_AZERI_LATIN, "az" , LANG_AZERI , SUBLANG_AZERI_LATIN , wxLayout_LeftToRight, "Azeri (Latin)") - LNG(wxLANGUAGE_BASHKIR, "ba" , 0 , 0 , wxLayout_LeftToRight, "Bashkir") - LNG(wxLANGUAGE_BASQUE, "eu_ES", LANG_BASQUE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Basque") - LNG(wxLANGUAGE_BELARUSIAN, "be_BY", LANG_BELARUSIAN, SUBLANG_DEFAULT , wxLayout_LeftToRight, "Belarusian") - LNG(wxLANGUAGE_BENGALI, "bn" , LANG_BENGALI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Bengali") - LNG(wxLANGUAGE_BHUTANI, "dz" , 0 , 0 , wxLayout_LeftToRight, "Bhutani") - LNG(wxLANGUAGE_BIHARI, "bh" , 0 , 0 , wxLayout_LeftToRight, "Bihari") - LNG(wxLANGUAGE_BISLAMA, "bi" , 0 , 0 , wxLayout_LeftToRight, "Bislama") - LNG(wxLANGUAGE_BRETON, "br" , 0 , 0 , wxLayout_LeftToRight, "Breton") - LNG(wxLANGUAGE_BULGARIAN, "bg_BG", LANG_BULGARIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Bulgarian") - LNG(wxLANGUAGE_BURMESE, "my" , 0 , 0 , wxLayout_LeftToRight, "Burmese") - LNG(wxLANGUAGE_CAMBODIAN, "km" , 0 , 0 , wxLayout_LeftToRight, "Cambodian") - LNG(wxLANGUAGE_CATALAN, "ca_ES", LANG_CATALAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Catalan") - LNG(wxLANGUAGE_CHINESE, "zh_TW", LANG_CHINESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Chinese") - LNG(wxLANGUAGE_CHINESE_SIMPLIFIED, "zh_CN", LANG_CHINESE , SUBLANG_CHINESE_SIMPLIFIED , wxLayout_LeftToRight, "Chinese (Simplified)") - LNG(wxLANGUAGE_CHINESE_TRADITIONAL, "zh_TW", LANG_CHINESE , SUBLANG_CHINESE_TRADITIONAL , wxLayout_LeftToRight, "Chinese (Traditional)") - LNG(wxLANGUAGE_CHINESE_HONGKONG, "zh_HK", LANG_CHINESE , SUBLANG_CHINESE_HONGKONG , wxLayout_LeftToRight, "Chinese (Hongkong)") - LNG(wxLANGUAGE_CHINESE_MACAU, "zh_MO", LANG_CHINESE , SUBLANG_CHINESE_MACAU , wxLayout_LeftToRight, "Chinese (Macau)") - LNG(wxLANGUAGE_CHINESE_SINGAPORE, "zh_SG", LANG_CHINESE , SUBLANG_CHINESE_SINGAPORE , wxLayout_LeftToRight, "Chinese (Singapore)") - LNG(wxLANGUAGE_CHINESE_TAIWAN, "zh_TW", LANG_CHINESE , SUBLANG_CHINESE_TRADITIONAL , wxLayout_LeftToRight, "Chinese (Taiwan)") - LNG(wxLANGUAGE_CORSICAN, "co" , 0 , 0 , wxLayout_LeftToRight, "Corsican") - LNG(wxLANGUAGE_CROATIAN, "hr_HR", LANG_CROATIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Croatian") - LNG(wxLANGUAGE_CZECH, "cs_CZ", LANG_CZECH , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Czech") - LNG(wxLANGUAGE_DANISH, "da_DK", LANG_DANISH , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Danish") - LNG(wxLANGUAGE_DUTCH, "nl_NL", LANG_DUTCH , SUBLANG_DUTCH , wxLayout_LeftToRight, "Dutch") - LNG(wxLANGUAGE_DUTCH_BELGIAN, "nl_BE", LANG_DUTCH , SUBLANG_DUTCH_BELGIAN , wxLayout_LeftToRight, "Dutch (Belgian)") - LNG(wxLANGUAGE_ENGLISH, "en_GB", LANG_ENGLISH , SUBLANG_ENGLISH_UK , wxLayout_LeftToRight, "English") - LNG(wxLANGUAGE_ENGLISH_UK, "en_GB", LANG_ENGLISH , SUBLANG_ENGLISH_UK , wxLayout_LeftToRight, "English (U.K.)") - LNG(wxLANGUAGE_ENGLISH_US, "en_US", LANG_ENGLISH , SUBLANG_ENGLISH_US , wxLayout_LeftToRight, "English (U.S.)") - LNG(wxLANGUAGE_ENGLISH_AUSTRALIA, "en_AU", LANG_ENGLISH , SUBLANG_ENGLISH_AUS , wxLayout_LeftToRight, "English (Australia)") - LNG(wxLANGUAGE_ENGLISH_BELIZE, "en_BZ", LANG_ENGLISH , SUBLANG_ENGLISH_BELIZE , wxLayout_LeftToRight, "English (Belize)") - LNG(wxLANGUAGE_ENGLISH_BOTSWANA, "en_BW", 0 , 0 , wxLayout_LeftToRight, "English (Botswana)") - LNG(wxLANGUAGE_ENGLISH_CANADA, "en_CA", LANG_ENGLISH , SUBLANG_ENGLISH_CAN , wxLayout_LeftToRight, "English (Canada)") - LNG(wxLANGUAGE_ENGLISH_CARIBBEAN, "en_CB", LANG_ENGLISH , SUBLANG_ENGLISH_CARIBBEAN , wxLayout_LeftToRight, "English (Caribbean)") - LNG(wxLANGUAGE_ENGLISH_DENMARK, "en_DK", 0 , 0 , wxLayout_LeftToRight, "English (Denmark)") - LNG(wxLANGUAGE_ENGLISH_EIRE, "en_IE", LANG_ENGLISH , SUBLANG_ENGLISH_EIRE , wxLayout_LeftToRight, "English (Eire)") - LNG(wxLANGUAGE_ENGLISH_JAMAICA, "en_JM", LANG_ENGLISH , SUBLANG_ENGLISH_JAMAICA , wxLayout_LeftToRight, "English (Jamaica)") - LNG(wxLANGUAGE_ENGLISH_NEW_ZEALAND, "en_NZ", LANG_ENGLISH , SUBLANG_ENGLISH_NZ , wxLayout_LeftToRight, "English (New Zealand)") - LNG(wxLANGUAGE_ENGLISH_PHILIPPINES, "en_PH", LANG_ENGLISH , SUBLANG_ENGLISH_PHILIPPINES , wxLayout_LeftToRight, "English (Philippines)") - LNG(wxLANGUAGE_ENGLISH_SOUTH_AFRICA, "en_ZA", LANG_ENGLISH , SUBLANG_ENGLISH_SOUTH_AFRICA , wxLayout_LeftToRight, "English (South Africa)") - LNG(wxLANGUAGE_ENGLISH_TRINIDAD, "en_TT", LANG_ENGLISH , SUBLANG_ENGLISH_TRINIDAD , wxLayout_LeftToRight, "English (Trinidad)") - LNG(wxLANGUAGE_ENGLISH_ZIMBABWE, "en_ZW", LANG_ENGLISH , SUBLANG_ENGLISH_ZIMBABWE , wxLayout_LeftToRight, "English (Zimbabwe)") - LNG(wxLANGUAGE_ESPERANTO, "eo" , 0 , 0 , wxLayout_LeftToRight, "Esperanto") - LNG(wxLANGUAGE_ESTONIAN, "et_EE", LANG_ESTONIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Estonian") - LNG(wxLANGUAGE_FAEROESE, "fo_FO", LANG_FAEROESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Faeroese") - LNG(wxLANGUAGE_FARSI, "fa_IR", LANG_FARSI , SUBLANG_DEFAULT , wxLayout_RightToLeft, "Farsi") - LNG(wxLANGUAGE_FIJI, "fj" , 0 , 0 , wxLayout_LeftToRight, "Fiji") - LNG(wxLANGUAGE_FINNISH, "fi_FI", LANG_FINNISH , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Finnish") - LNG(wxLANGUAGE_FRENCH, "fr_FR", LANG_FRENCH , SUBLANG_FRENCH , wxLayout_LeftToRight, "French") - LNG(wxLANGUAGE_FRENCH_BELGIAN, "fr_BE", LANG_FRENCH , SUBLANG_FRENCH_BELGIAN , wxLayout_LeftToRight, "French (Belgian)") - LNG(wxLANGUAGE_FRENCH_CANADIAN, "fr_CA", LANG_FRENCH , SUBLANG_FRENCH_CANADIAN , wxLayout_LeftToRight, "French (Canadian)") - LNG(wxLANGUAGE_FRENCH_LUXEMBOURG, "fr_LU", LANG_FRENCH , SUBLANG_FRENCH_LUXEMBOURG , wxLayout_LeftToRight, "French (Luxembourg)") - LNG(wxLANGUAGE_FRENCH_MONACO, "fr_MC", LANG_FRENCH , SUBLANG_FRENCH_MONACO , wxLayout_LeftToRight, "French (Monaco)") - LNG(wxLANGUAGE_FRENCH_SWISS, "fr_CH", LANG_FRENCH , SUBLANG_FRENCH_SWISS , wxLayout_LeftToRight, "French (Swiss)") - LNG(wxLANGUAGE_FRISIAN, "fy" , 0 , 0 , wxLayout_LeftToRight, "Frisian") - LNG(wxLANGUAGE_GALICIAN, "gl_ES", 0 , 0 , wxLayout_LeftToRight, "Galician") - LNG(wxLANGUAGE_GEORGIAN, "ka_GE", LANG_GEORGIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Georgian") - LNG(wxLANGUAGE_GERMAN, "de_DE", LANG_GERMAN , SUBLANG_GERMAN , wxLayout_LeftToRight, "German") - LNG(wxLANGUAGE_GERMAN_AUSTRIAN, "de_AT", LANG_GERMAN , SUBLANG_GERMAN_AUSTRIAN , wxLayout_LeftToRight, "German (Austrian)") - LNG(wxLANGUAGE_GERMAN_BELGIUM, "de_BE", 0 , 0 , wxLayout_LeftToRight, "German (Belgium)") - LNG(wxLANGUAGE_GERMAN_LIECHTENSTEIN, "de_LI", LANG_GERMAN , SUBLANG_GERMAN_LIECHTENSTEIN , wxLayout_LeftToRight, "German (Liechtenstein)") - LNG(wxLANGUAGE_GERMAN_LUXEMBOURG, "de_LU", LANG_GERMAN , SUBLANG_GERMAN_LUXEMBOURG , wxLayout_LeftToRight, "German (Luxembourg)") - LNG(wxLANGUAGE_GERMAN_SWISS, "de_CH", LANG_GERMAN , SUBLANG_GERMAN_SWISS , wxLayout_LeftToRight, "German (Swiss)") - LNG(wxLANGUAGE_GREEK, "el_GR", LANG_GREEK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Greek") - LNG(wxLANGUAGE_GREENLANDIC, "kl_GL", 0 , 0 , wxLayout_LeftToRight, "Greenlandic") - LNG(wxLANGUAGE_GUARANI, "gn" , 0 , 0 , wxLayout_LeftToRight, "Guarani") - LNG(wxLANGUAGE_GUJARATI, "gu" , LANG_GUJARATI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Gujarati") - LNG(wxLANGUAGE_HAUSA, "ha" , 0 , 0 , wxLayout_LeftToRight, "Hausa") - LNG(wxLANGUAGE_HEBREW, "he_IL", LANG_HEBREW , SUBLANG_DEFAULT , wxLayout_RightToLeft, "Hebrew") - LNG(wxLANGUAGE_HINDI, "hi_IN", LANG_HINDI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Hindi") - LNG(wxLANGUAGE_HUNGARIAN, "hu_HU", LANG_HUNGARIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Hungarian") - LNG(wxLANGUAGE_ICELANDIC, "is_IS", LANG_ICELANDIC , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Icelandic") - LNG(wxLANGUAGE_INDONESIAN, "id_ID", LANG_INDONESIAN, SUBLANG_DEFAULT , wxLayout_LeftToRight, "Indonesian") - LNG(wxLANGUAGE_INTERLINGUA, "ia" , 0 , 0 , wxLayout_LeftToRight, "Interlingua") - LNG(wxLANGUAGE_INTERLINGUE, "ie" , 0 , 0 , wxLayout_LeftToRight, "Interlingue") - LNG(wxLANGUAGE_INUKTITUT, "iu" , 0 , 0 , wxLayout_LeftToRight, "Inuktitut") - LNG(wxLANGUAGE_INUPIAK, "ik" , 0 , 0 , wxLayout_LeftToRight, "Inupiak") - LNG(wxLANGUAGE_IRISH, "ga_IE", 0 , 0 , wxLayout_LeftToRight, "Irish") - LNG(wxLANGUAGE_ITALIAN, "it_IT", LANG_ITALIAN , SUBLANG_ITALIAN , wxLayout_LeftToRight, "Italian") - LNG(wxLANGUAGE_ITALIAN_SWISS, "it_CH", LANG_ITALIAN , SUBLANG_ITALIAN_SWISS , wxLayout_LeftToRight, "Italian (Swiss)") - LNG(wxLANGUAGE_JAPANESE, "ja_JP", LANG_JAPANESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Japanese") - LNG(wxLANGUAGE_JAVANESE, "jw" , 0 , 0 , wxLayout_LeftToRight, "Javanese") - LNG(wxLANGUAGE_KANNADA, "kn" , LANG_KANNADA , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kannada") - LNG(wxLANGUAGE_KASHMIRI, "ks" , LANG_KASHMIRI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kashmiri") - LNG(wxLANGUAGE_KASHMIRI_INDIA, "ks_IN", LANG_KASHMIRI , SUBLANG_KASHMIRI_INDIA , wxLayout_LeftToRight, "Kashmiri (India)") - LNG(wxLANGUAGE_KAZAKH, "kk" , LANG_KAZAK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kazakh") - LNG(wxLANGUAGE_KERNEWEK, "kw_GB", 0 , 0 , wxLayout_LeftToRight, "Kernewek") - LNG(wxLANGUAGE_KINYARWANDA, "rw" , 0 , 0 , wxLayout_LeftToRight, "Kinyarwanda") - LNG(wxLANGUAGE_KIRGHIZ, "ky" , 0 , 0 , wxLayout_LeftToRight, "Kirghiz") - LNG(wxLANGUAGE_KIRUNDI, "rn" , 0 , 0 , wxLayout_LeftToRight, "Kirundi") - LNG(wxLANGUAGE_KONKANI, "" , LANG_KONKANI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Konkani") - LNG(wxLANGUAGE_KOREAN, "ko_KR", LANG_KOREAN , SUBLANG_KOREAN , wxLayout_LeftToRight, "Korean") - LNG(wxLANGUAGE_KURDISH, "ku_TR", 0 , 0 , wxLayout_LeftToRight, "Kurdish") - LNG(wxLANGUAGE_LAOTHIAN, "lo" , 0 , 0 , wxLayout_LeftToRight, "Laothian") - LNG(wxLANGUAGE_LATIN, "la" , 0 , 0 , wxLayout_LeftToRight, "Latin") - LNG(wxLANGUAGE_LATVIAN, "lv_LV", LANG_LATVIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Latvian") - LNG(wxLANGUAGE_LINGALA, "ln" , 0 , 0 , wxLayout_LeftToRight, "Lingala") - LNG(wxLANGUAGE_LITHUANIAN, "lt_LT", LANG_LITHUANIAN, SUBLANG_LITHUANIAN , wxLayout_LeftToRight, "Lithuanian") - LNG(wxLANGUAGE_MACEDONIAN, "mk_MK", LANG_MACEDONIAN, SUBLANG_DEFAULT , wxLayout_LeftToRight, "Macedonian") - LNG(wxLANGUAGE_MALAGASY, "mg" , 0 , 0 , wxLayout_LeftToRight, "Malagasy") - LNG(wxLANGUAGE_MALAY, "ms_MY", LANG_MALAY , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Malay") - LNG(wxLANGUAGE_MALAYALAM, "ml" , LANG_MALAYALAM , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Malayalam") - LNG(wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, "ms_BN", LANG_MALAY , SUBLANG_MALAY_BRUNEI_DARUSSALAM , wxLayout_LeftToRight, "Malay (Brunei Darussalam)") - LNG(wxLANGUAGE_MALAY_MALAYSIA, "ms_MY", LANG_MALAY , SUBLANG_MALAY_MALAYSIA , wxLayout_LeftToRight, "Malay (Malaysia)") - LNG(wxLANGUAGE_MALTESE, "mt_MT", 0 , 0 , wxLayout_LeftToRight, "Maltese") - LNG(wxLANGUAGE_MANIPURI, "" , LANG_MANIPURI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Manipuri") - LNG(wxLANGUAGE_MAORI, "mi" , 0 , 0 , wxLayout_LeftToRight, "Maori") - LNG(wxLANGUAGE_MARATHI, "mr_IN", LANG_MARATHI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Marathi") - LNG(wxLANGUAGE_MOLDAVIAN, "mo" , 0 , 0 , wxLayout_LeftToRight, "Moldavian") - LNG(wxLANGUAGE_MONGOLIAN, "mn" , 0 , 0 , wxLayout_LeftToRight, "Mongolian") - LNG(wxLANGUAGE_NAURU, "na" , 0 , 0 , wxLayout_LeftToRight, "Nauru") - LNG(wxLANGUAGE_NEPALI, "ne_NP", LANG_NEPALI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Nepali") - LNG(wxLANGUAGE_NEPALI_INDIA, "ne_IN", LANG_NEPALI , SUBLANG_NEPALI_INDIA , wxLayout_LeftToRight, "Nepali (India)") - LNG(wxLANGUAGE_NORWEGIAN_BOKMAL, "nb_NO", LANG_NORWEGIAN , SUBLANG_NORWEGIAN_BOKMAL , wxLayout_LeftToRight, "Norwegian (Bokmal)") - LNG(wxLANGUAGE_NORWEGIAN_NYNORSK, "nn_NO", LANG_NORWEGIAN , SUBLANG_NORWEGIAN_NYNORSK , wxLayout_LeftToRight, "Norwegian (Nynorsk)") - LNG(wxLANGUAGE_OCCITAN, "oc" , 0 , 0 , wxLayout_LeftToRight, "Occitan") - LNG(wxLANGUAGE_ORIYA, "or" , LANG_ORIYA , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Oriya") - LNG(wxLANGUAGE_OROMO, "om" , 0 , 0 , wxLayout_LeftToRight, "(Afan) Oromo") - LNG(wxLANGUAGE_PASHTO, "ps" , 0 , 0 , wxLayout_LeftToRight, "Pashto, Pushto") - LNG(wxLANGUAGE_POLISH, "pl_PL", LANG_POLISH , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Polish") - LNG(wxLANGUAGE_PORTUGUESE, "pt_PT", LANG_PORTUGUESE, SUBLANG_PORTUGUESE , wxLayout_LeftToRight, "Portuguese") - LNG(wxLANGUAGE_PORTUGUESE_BRAZILIAN, "pt_BR", LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN , wxLayout_LeftToRight, "Portuguese (Brazilian)") - LNG(wxLANGUAGE_PUNJABI, "pa" , LANG_PUNJABI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Punjabi") - LNG(wxLANGUAGE_QUECHUA, "qu" , 0 , 0 , wxLayout_LeftToRight, "Quechua") - LNG(wxLANGUAGE_RHAETO_ROMANCE, "rm" , 0 , 0 , wxLayout_LeftToRight, "Rhaeto-Romance") - LNG(wxLANGUAGE_ROMANIAN, "ro_RO", LANG_ROMANIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Romanian") - LNG(wxLANGUAGE_RUSSIAN, "ru_RU", LANG_RUSSIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Russian") - LNG(wxLANGUAGE_RUSSIAN_UKRAINE, "ru_UA", 0 , 0 , wxLayout_LeftToRight, "Russian (Ukraine)") - LNG(wxLANGUAGE_SAMI, "se_NO", LANG_SAMI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Northern Sami") - LNG(wxLANGUAGE_SAMOAN, "sm" , 0 , 0 , wxLayout_LeftToRight, "Samoan") - LNG(wxLANGUAGE_SANGHO, "sg" , 0 , 0 , wxLayout_LeftToRight, "Sangho") - LNG(wxLANGUAGE_SANSKRIT, "sa" , LANG_SANSKRIT , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Sanskrit") - LNG(wxLANGUAGE_SCOTS_GAELIC, "gd" , 0 , 0 , wxLayout_LeftToRight, "Scots Gaelic") - LNG(wxLANGUAGE_SERBIAN, "sr_RS", LANG_SERBIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Serbian") - LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_RS", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , wxLayout_LeftToRight, "Serbian (Cyrillic)") - LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_RS@latin", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , wxLayout_LeftToRight, "Serbian (Latin)") - LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_YU", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , wxLayout_LeftToRight, "Serbian (Cyrillic)") - LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_YU@latin", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , wxLayout_LeftToRight, "Serbian (Latin)") - LNG(wxLANGUAGE_SERBO_CROATIAN, "sh" , 0 , 0 , wxLayout_LeftToRight, "Serbo-Croatian") - LNG(wxLANGUAGE_SESOTHO, "st" , 0 , 0 , wxLayout_LeftToRight, "Sesotho") - LNG(wxLANGUAGE_SETSWANA, "tn" , 0 , 0 , wxLayout_LeftToRight, "Setswana") - LNG(wxLANGUAGE_SHONA, "sn" , 0 , 0 , wxLayout_LeftToRight, "Shona") - LNG(wxLANGUAGE_SINDHI, "sd" , LANG_SINDHI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Sindhi") - LNG(wxLANGUAGE_SINHALESE, "si" , 0 , 0 , wxLayout_LeftToRight, "Sinhalese") - LNG(wxLANGUAGE_SISWATI, "ss" , 0 , 0 , wxLayout_LeftToRight, "Siswati") - LNG(wxLANGUAGE_SLOVAK, "sk_SK", LANG_SLOVAK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Slovak") - LNG(wxLANGUAGE_SLOVENIAN, "sl_SI", LANG_SLOVENIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Slovenian") - LNG(wxLANGUAGE_SOMALI, "so" , 0 , 0 , wxLayout_LeftToRight, "Somali") - LNG(wxLANGUAGE_SPANISH, "es_ES", LANG_SPANISH , SUBLANG_SPANISH , wxLayout_LeftToRight, "Spanish") - LNG(wxLANGUAGE_SPANISH_ARGENTINA, "es_AR", LANG_SPANISH , SUBLANG_SPANISH_ARGENTINA , wxLayout_LeftToRight, "Spanish (Argentina)") - LNG(wxLANGUAGE_SPANISH_BOLIVIA, "es_BO", LANG_SPANISH , SUBLANG_SPANISH_BOLIVIA , wxLayout_LeftToRight, "Spanish (Bolivia)") - LNG(wxLANGUAGE_SPANISH_CHILE, "es_CL", LANG_SPANISH , SUBLANG_SPANISH_CHILE , wxLayout_LeftToRight, "Spanish (Chile)") - LNG(wxLANGUAGE_SPANISH_COLOMBIA, "es_CO", LANG_SPANISH , SUBLANG_SPANISH_COLOMBIA , wxLayout_LeftToRight, "Spanish (Colombia)") - LNG(wxLANGUAGE_SPANISH_COSTA_RICA, "es_CR", LANG_SPANISH , SUBLANG_SPANISH_COSTA_RICA , wxLayout_LeftToRight, "Spanish (Costa Rica)") - LNG(wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, "es_DO", LANG_SPANISH , SUBLANG_SPANISH_DOMINICAN_REPUBLIC, wxLayout_LeftToRight, "Spanish (Dominican republic)") - LNG(wxLANGUAGE_SPANISH_ECUADOR, "es_EC", LANG_SPANISH , SUBLANG_SPANISH_ECUADOR , wxLayout_LeftToRight, "Spanish (Ecuador)") - LNG(wxLANGUAGE_SPANISH_EL_SALVADOR, "es_SV", LANG_SPANISH , SUBLANG_SPANISH_EL_SALVADOR , wxLayout_LeftToRight, "Spanish (El Salvador)") - LNG(wxLANGUAGE_SPANISH_GUATEMALA, "es_GT", LANG_SPANISH , SUBLANG_SPANISH_GUATEMALA , wxLayout_LeftToRight, "Spanish (Guatemala)") - LNG(wxLANGUAGE_SPANISH_HONDURAS, "es_HN", LANG_SPANISH , SUBLANG_SPANISH_HONDURAS , wxLayout_LeftToRight, "Spanish (Honduras)") - LNG(wxLANGUAGE_SPANISH_MEXICAN, "es_MX", LANG_SPANISH , SUBLANG_SPANISH_MEXICAN , wxLayout_LeftToRight, "Spanish (Mexican)") - LNG(wxLANGUAGE_SPANISH_MODERN, "es_ES", LANG_SPANISH , SUBLANG_SPANISH_MODERN , wxLayout_LeftToRight, "Spanish (Modern)") - LNG(wxLANGUAGE_SPANISH_NICARAGUA, "es_NI", LANG_SPANISH , SUBLANG_SPANISH_NICARAGUA , wxLayout_LeftToRight, "Spanish (Nicaragua)") - LNG(wxLANGUAGE_SPANISH_PANAMA, "es_PA", LANG_SPANISH , SUBLANG_SPANISH_PANAMA , wxLayout_LeftToRight, "Spanish (Panama)") - LNG(wxLANGUAGE_SPANISH_PARAGUAY, "es_PY", LANG_SPANISH , SUBLANG_SPANISH_PARAGUAY , wxLayout_LeftToRight, "Spanish (Paraguay)") - LNG(wxLANGUAGE_SPANISH_PERU, "es_PE", LANG_SPANISH , SUBLANG_SPANISH_PERU , wxLayout_LeftToRight, "Spanish (Peru)") - LNG(wxLANGUAGE_SPANISH_PUERTO_RICO, "es_PR", LANG_SPANISH , SUBLANG_SPANISH_PUERTO_RICO , wxLayout_LeftToRight, "Spanish (Puerto Rico)") - LNG(wxLANGUAGE_SPANISH_URUGUAY, "es_UY", LANG_SPANISH , SUBLANG_SPANISH_URUGUAY , wxLayout_LeftToRight, "Spanish (Uruguay)") - LNG(wxLANGUAGE_SPANISH_US, "es_US", 0 , 0 , wxLayout_LeftToRight, "Spanish (U.S.)") - LNG(wxLANGUAGE_SPANISH_VENEZUELA, "es_VE", LANG_SPANISH , SUBLANG_SPANISH_VENEZUELA , wxLayout_LeftToRight, "Spanish (Venezuela)") - LNG(wxLANGUAGE_SUNDANESE, "su" , 0 , 0 , wxLayout_LeftToRight, "Sundanese") - LNG(wxLANGUAGE_SWAHILI, "sw_KE", LANG_SWAHILI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Swahili") - LNG(wxLANGUAGE_SWEDISH, "sv_SE", LANG_SWEDISH , SUBLANG_SWEDISH , wxLayout_LeftToRight, "Swedish") - LNG(wxLANGUAGE_SWEDISH_FINLAND, "sv_FI", LANG_SWEDISH , SUBLANG_SWEDISH_FINLAND , wxLayout_LeftToRight, "Swedish (Finland)") - LNG(wxLANGUAGE_TAGALOG, "tl_PH", 0 , 0 , wxLayout_LeftToRight, "Tagalog") - LNG(wxLANGUAGE_TAJIK, "tg" , 0 , 0 , wxLayout_LeftToRight, "Tajik") - LNG(wxLANGUAGE_TAMIL, "ta" , LANG_TAMIL , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Tamil") - LNG(wxLANGUAGE_TATAR, "tt" , LANG_TATAR , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Tatar") - LNG(wxLANGUAGE_TELUGU, "te" , LANG_TELUGU , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Telugu") - LNG(wxLANGUAGE_THAI, "th_TH", LANG_THAI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Thai") - LNG(wxLANGUAGE_TIBETAN, "bo" , 0 , 0 , wxLayout_LeftToRight, "Tibetan") - LNG(wxLANGUAGE_TIGRINYA, "ti" , 0 , 0 , wxLayout_LeftToRight, "Tigrinya") - LNG(wxLANGUAGE_TONGA, "to" , 0 , 0 , wxLayout_LeftToRight, "Tonga") - LNG(wxLANGUAGE_TSONGA, "ts" , 0 , 0 , wxLayout_LeftToRight, "Tsonga") - LNG(wxLANGUAGE_TURKISH, "tr_TR", LANG_TURKISH , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Turkish") - LNG(wxLANGUAGE_TURKMEN, "tk" , 0 , 0 , wxLayout_LeftToRight, "Turkmen") - LNG(wxLANGUAGE_TWI, "tw" , 0 , 0 , wxLayout_LeftToRight, "Twi") - LNG(wxLANGUAGE_UIGHUR, "ug" , 0 , 0 , wxLayout_LeftToRight, "Uighur") - LNG(wxLANGUAGE_UKRAINIAN, "uk_UA", LANG_UKRAINIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Ukrainian") - LNG(wxLANGUAGE_URDU, "ur" , LANG_URDU , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Urdu") - LNG(wxLANGUAGE_URDU_INDIA, "ur_IN", LANG_URDU , SUBLANG_URDU_INDIA , wxLayout_LeftToRight, "Urdu (India)") - LNG(wxLANGUAGE_URDU_PAKISTAN, "ur_PK", LANG_URDU , SUBLANG_URDU_PAKISTAN , wxLayout_LeftToRight, "Urdu (Pakistan)") - LNG(wxLANGUAGE_UZBEK, "uz" , LANG_UZBEK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Uzbek") - LNG(wxLANGUAGE_UZBEK_CYRILLIC, "uz" , LANG_UZBEK , SUBLANG_UZBEK_CYRILLIC , wxLayout_LeftToRight, "Uzbek (Cyrillic)") - LNG(wxLANGUAGE_UZBEK_LATIN, "uz" , LANG_UZBEK , SUBLANG_UZBEK_LATIN , wxLayout_LeftToRight, "Uzbek (Latin)") - LNG(wxLANGUAGE_VALENCIAN, "ca_ES@valencia", LANG_VALENCIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Valencian") - LNG(wxLANGUAGE_VIETNAMESE, "vi_VN", LANG_VIETNAMESE, SUBLANG_DEFAULT , wxLayout_LeftToRight, "Vietnamese") - LNG(wxLANGUAGE_VOLAPUK, "vo" , 0 , 0 , wxLayout_LeftToRight, "Volapuk") - LNG(wxLANGUAGE_WELSH, "cy" , 0 , 0 , wxLayout_LeftToRight, "Welsh") - LNG(wxLANGUAGE_WOLOF, "wo" , 0 , 0 , wxLayout_LeftToRight, "Wolof") - LNG(wxLANGUAGE_XHOSA, "xh" , 0 , 0 , wxLayout_LeftToRight, "Xhosa") - LNG(wxLANGUAGE_YIDDISH, "yi" , 0 , 0 , wxLayout_LeftToRight, "Yiddish") - LNG(wxLANGUAGE_YORUBA, "yo" , 0 , 0 , wxLayout_LeftToRight, "Yoruba") - LNG(wxLANGUAGE_ZHUANG, "za" , 0 , 0 , wxLayout_LeftToRight, "Zhuang") - LNG(wxLANGUAGE_ZULU, "zu" , 0 , 0 , wxLayout_LeftToRight, "Zulu") -} -#undef LNG - -// --- --- --- generated code ends here --- --- --- - -#endif // wxUSE_INTL diff --git a/Source/3rdParty/wx/src/common/ipcbase.cpp b/Source/3rdParty/wx/src/common/ipcbase.cpp deleted file mode 100644 index 80fa9412d..000000000 --- a/Source/3rdParty/wx/src/common/ipcbase.cpp +++ /dev/null @@ -1,87 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/ipcbase.cpp -// Purpose: IPC base classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: ipcbase.cpp 54615 2008-07-14 02:34:29Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#endif - -#include "wx/ipcbase.h" - -IMPLEMENT_CLASS(wxServerBase, wxObject) -IMPLEMENT_CLASS(wxClientBase, wxObject) -IMPLEMENT_CLASS(wxConnectionBase, wxObject) - -wxConnectionBase::wxConnectionBase(wxChar *buffer, int bytes) - : m_connected(true), - m_buffer(buffer), - m_buffersize(bytes), - m_deletebufferwhendone(false) -{ - if ( buffer == (wxChar *)NULL ) - { // behave like next constructor - m_buffersize = 0; - m_deletebufferwhendone = true; - } -} - -wxConnectionBase::wxConnectionBase() - : m_connected(true), - m_buffer(NULL), - m_buffersize(0), - m_deletebufferwhendone(true) -{ -} - -wxConnectionBase::wxConnectionBase(const wxConnectionBase& copy) - : wxObject(), - m_connected(copy.m_connected), - m_buffer(copy.m_buffer), - m_buffersize(copy.m_buffersize), - m_deletebufferwhendone(false) - -{ - // copy constructor would require ref-counted pointer to buffer - wxFAIL_MSG( _T("Copy constructor of wxConnectionBase not implemented") ); -} - - -wxConnectionBase::~wxConnectionBase(void) -{ - if ( m_deletebufferwhendone ) - delete [] m_buffer; -} - -wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes ) -{ - if ( m_buffersize >= bytes ) - return m_buffer; - else - { // need to resize buffer - if ( m_deletebufferwhendone ) - { // we're in charge of buffer, increase it - delete [] m_buffer; - // the argument specifies **byte size**, but m_buffer is of type - // wxChar. Under unicode: sizeof(wxChar) > 1, so the buffer size is - // bytes / sizeof(wxChar) rounded upwards. - m_buffer = new wxChar[(bytes + sizeof(wxChar) - 1) / sizeof(wxChar)]; - m_buffersize = bytes; - return m_buffer; - } // user-supplied buffer, fail - else - return NULL; - } -} diff --git a/Source/3rdParty/wx/src/common/layout.cpp b/Source/3rdParty/wx/src/common/layout.cpp deleted file mode 100644 index d796eee1f..000000000 --- a/Source/3rdParty/wx/src/common/layout.cpp +++ /dev/null @@ -1,1026 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/layout.cpp -// Purpose: Constraint layout system classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: layout.cpp 39627 2006-06-08 06:57:39Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================= -// declarations -// ============================================================================= - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CONSTRAINTS - -#include "wx/layout.h" - -#ifndef WX_PRECOMP - #include "wx/window.h" - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/msgdlg.h" - #include "wx/intl.h" -#endif - - -IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) - - -inline void wxGetAsIs(wxWindowBase* win, int* w, int* h) -{ -#if 1 - // The old way. Works for me. - win->GetSize(w, h); -#endif - -#if 0 - // Vadim's change. Breaks wxPython's LayoutAnchors - win->GetBestSize(w, h); -#endif - -#if 0 - // Proposed compromise. Doesn't work. - int sw, sh, bw, bh; - win->GetSize(&sw, &sh); - win->GetBestSize(&bw, &bh); - if (w) - *w = wxMax(sw, bw); - if (h) - *h = wxMax(sh, bh); -#endif -} - - -wxIndividualLayoutConstraint::wxIndividualLayoutConstraint() -{ - myEdge = wxTop; - relationship = wxUnconstrained; - margin = 0; - value = 0; - percent = 0; - otherEdge = wxTop; - done = false; - otherWin = (wxWindowBase *) NULL; -} - -void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg) -{ - if (rel == wxSameAs) - { - // If Set is called by the user with wxSameAs then call SameAs to do - // it since it will actually use wxPercent instead. - SameAs(otherW, otherE, marg); - return; - } - - relationship = rel; - otherWin = otherW; - otherEdge = otherE; - - if ( rel == wxPercentOf ) - { - percent = val; - } - else - { - value = val; - } - - margin = marg; -} - -void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg) -{ - Set(wxLeftOf, sibling, wxLeft, 0, marg); -} - -void wxIndividualLayoutConstraint::RightOf(wxWindowBase *sibling, int marg) -{ - Set(wxRightOf, sibling, wxRight, 0, marg); -} - -void wxIndividualLayoutConstraint::Above(wxWindowBase *sibling, int marg) -{ - Set(wxAbove, sibling, wxTop, 0, marg); -} - -void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg) -{ - Set(wxBelow, sibling, wxBottom, 0, marg); -} - -// -// 'Same edge' alignment -// -void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg) -{ - Set(wxPercentOf, otherW, edge, 100, marg); -} - -// The edge is a percentage of the other window's edge -void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, int per) -{ - Set(wxPercentOf, otherW, wh, per); -} - -// -// Edge has absolute value -// -void wxIndividualLayoutConstraint::Absolute(int val) -{ - value = val; - relationship = wxAbsolute; -} - -// Reset constraint if it mentions otherWin -bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW) -{ - if (otherW == otherWin) - { - myEdge = wxTop; - relationship = wxAsIs; - margin = 0; - value = 0; - percent = 0; - otherEdge = wxTop; - otherWin = (wxWindowBase *) NULL; - return true; - } - - return false; -} - -// Try to satisfy constraint -bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win) -{ - if (relationship == wxAbsolute) - { - done = true; - return true; - } - - switch (myEdge) - { - case wxLeft: - { - switch (relationship) - { - case wxLeftOf: - { - // We can know this edge if: otherWin is win's - // parent, or otherWin has a satisfied constraint, - // or otherWin has no constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxRightOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) + margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the left-hand edge position if we know - // the right-hand edge and we know the width; OR if - // we know the centre and the width. - if (constraints->right.GetDone() && constraints->width.GetDone()) - { - value = (constraints->right.GetValue() - constraints->width.GetValue() + margin); - done = true; - return true; - } - else if (constraints->centreX.GetDone() && constraints->width.GetDone()) - { - value = (int)(constraints->centreX.GetValue() - (constraints->width.GetValue()/2) + margin); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - int y; - win->GetPosition(&value, &y); - done = true; - return true; - } - default: - break; - } - break; - } - case wxRight: - { - switch (relationship) - { - case wxLeftOf: - { - // We can know this edge if: otherWin is win's - // parent, or otherWin has a satisfied constraint, - // or otherWin has no constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxRightOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) - margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the right-hand edge position if we know the - // left-hand edge and we know the width, OR if we know the - // centre edge and the width. - if (constraints->left.GetDone() && constraints->width.GetDone()) - { - value = (constraints->left.GetValue() + constraints->width.GetValue() - margin); - done = true; - return true; - } - else if (constraints->centreX.GetDone() && constraints->width.GetDone()) - { - value = (int)(constraints->centreX.GetValue() + (constraints->width.GetValue()/2) - margin); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - int x, y; - int w, h; - wxGetAsIs(win, &w, &h); - win->GetPosition(&x, &y); - value = x + w; - done = true; - return true; - } - default: - break; - } - break; - } - case wxTop: - { - switch (relationship) - { - case wxAbove: - { - // We can know this edge if: otherWin is win's - // parent, or otherWin has a satisfied constraint, - // or otherWin has no constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxBelow: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) + margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the top edge position if we know the bottom edge - // and we know the height; OR if we know the centre edge and - // the height. - if (constraints->bottom.GetDone() && constraints->height.GetDone()) - { - value = (constraints->bottom.GetValue() - constraints->height.GetValue() + margin); - done = true; - return true; - } - else if (constraints->centreY.GetDone() && constraints->height.GetDone()) - { - value = (constraints->centreY.GetValue() - (constraints->height.GetValue()/2) + margin); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - int x; - win->GetPosition(&x, &value); - done = true; - return true; - } - default: - break; - } - break; - } - case wxBottom: - { - switch (relationship) - { - case wxAbove: - { - // We can know this edge if: otherWin is win's parent, - // or otherWin has a satisfied constraint, or - // otherWin has no constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxBelow: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) - margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the bottom edge position if we know the top edge - // and we know the height; OR if we know the centre edge and - // the height. - if (constraints->top.GetDone() && constraints->height.GetDone()) - { - value = (constraints->top.GetValue() + constraints->height.GetValue() - margin); - done = true; - return true; - } - else if (constraints->centreY.GetDone() && constraints->height.GetDone()) - { - value = (constraints->centreY.GetValue() + (constraints->height.GetValue()/2) - margin); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - int x, y; - int w, h; - wxGetAsIs(win, &w, &h); - win->GetPosition(&x, &y); - value = h + y; - done = true; - return true; - } - default: - break; - } - break; - } - case wxCentreX: - { - switch (relationship) - { - case wxLeftOf: - { - // We can know this edge if: otherWin is win's parent, or - // otherWin has a satisfied constraint, or otherWin has no - // constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxRightOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) + margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the centre position if we know - // the left-hand edge and we know the width, OR - // the right-hand edge and the width - if (constraints->left.GetDone() && constraints->width.GetDone()) - { - value = (int)(constraints->left.GetValue() + (constraints->width.GetValue()/2) + margin); - done = true; - return true; - } - else if (constraints->right.GetDone() && constraints->width.GetDone()) - { - value = (int)(constraints->left.GetValue() - (constraints->width.GetValue()/2) + margin); - done = true; - return true; - } - else - return false; - } - default: - break; - } - break; - } - case wxCentreY: - { - switch (relationship) - { - case wxAbove: - { - // We can know this edge if: otherWin is win's parent, - // or otherWin has a satisfied constraint, or otherWin - // has no constraint. - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos - margin; - done = true; - return true; - } - else - return false; - } - case wxBelow: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = edgePos + margin; - done = true; - return true; - } - else - return false; - } - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01) + margin); - done = true; - return true; - } - else - return false; - } - case wxUnconstrained: - { - // We know the centre position if we know - // the top edge and we know the height, OR - // the bottom edge and the height. - if (constraints->bottom.GetDone() && constraints->height.GetDone()) - { - value = (int)(constraints->bottom.GetValue() - (constraints->height.GetValue()/2) + margin); - done = true; - return true; - } - else if (constraints->top.GetDone() && constraints->height.GetDone()) - { - value = (int)(constraints->top.GetValue() + (constraints->height.GetValue()/2) + margin); - done = true; - return true; - } - else - return false; - } - default: - break; - } - break; - } - case wxWidth: - { - switch (relationship) - { - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01)); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - if (win) - { - int h; - wxGetAsIs(win, &value, &h); - done = true; - return true; - } - else return false; - } - case wxUnconstrained: - { - // We know the width if we know the left edge and the right edge, OR - // if we know the left edge and the centre, OR - // if we know the right edge and the centre - if (constraints->left.GetDone() && constraints->right.GetDone()) - { - value = constraints->right.GetValue() - constraints->left.GetValue(); - done = true; - return true; - } - else if (constraints->centreX.GetDone() && constraints->left.GetDone()) - { - value = (int)(2*(constraints->centreX.GetValue() - constraints->left.GetValue())); - done = true; - return true; - } - else if (constraints->centreX.GetDone() && constraints->right.GetDone()) - { - value = (int)(2*(constraints->right.GetValue() - constraints->centreX.GetValue())); - done = true; - return true; - } - else - return false; - } - default: - break; - } - break; - } - case wxHeight: - { - switch (relationship) - { - case wxPercentOf: - { - int edgePos = GetEdge(otherEdge, win, otherWin); - if (edgePos != -1) - { - value = (int)(edgePos*(((float)percent)*0.01)); - done = true; - return true; - } - else - return false; - } - case wxAsIs: - { - if (win) - { - int w; - wxGetAsIs(win, &w, &value); - done = true; - return true; - } - else return false; - } - case wxUnconstrained: - { - // We know the height if we know the top edge and the bottom edge, OR - // if we know the top edge and the centre, OR - // if we know the bottom edge and the centre - if (constraints->top.GetDone() && constraints->bottom.GetDone()) - { - value = constraints->bottom.GetValue() - constraints->top.GetValue(); - done = true; - return true; - } - else if (constraints->top.GetDone() && constraints->centreY.GetDone()) - { - value = (int)(2*(constraints->centreY.GetValue() - constraints->top.GetValue())); - done = true; - return true; - } - else if (constraints->bottom.GetDone() && constraints->centreY.GetDone()) - { - value = (int)(2*(constraints->bottom.GetValue() - constraints->centreY.GetValue())); - done = true; - return true; - } - else - return false; - } - default: - break; - } - break; - } - default: - break; - } - return false; -} - -// Get the value of this edge or dimension, or if this is not determinable, -1. -int wxIndividualLayoutConstraint::GetEdge(wxEdge which, - wxWindowBase *thisWin, - wxWindowBase *other) const -{ - // If the edge or dimension belongs to the parent, then we know the - // dimension is obtainable immediately. E.g. a wxExpandSizer may contain a - // button (but the button's true parent is a panel, not the sizer) - if (other->GetChildren().Find((wxWindow*)thisWin)) - { - switch (which) - { - case wxLeft: - { - return 0; - } - case wxTop: - { - return 0; - } - case wxRight: - { - int w, h; - other->GetClientSizeConstraint(&w, &h); - return w; - } - case wxBottom: - { - int w, h; - other->GetClientSizeConstraint(&w, &h); - return h; - } - case wxWidth: - { - int w, h; - other->GetClientSizeConstraint(&w, &h); - return w; - } - case wxHeight: - { - int w, h; - other->GetClientSizeConstraint(&w, &h); - return h; - } - case wxCentreX: - case wxCentreY: - { - int w, h; - other->GetClientSizeConstraint(&w, &h); - if (which == wxCentreX) - return (int)(w/2); - else - return (int)(h/2); - } - default: - return -1; - } - } - switch (which) - { - case wxLeft: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->left.GetDone()) - return constr->left.GetValue(); - else - return -1; - } - else - { - int x, y; - other->GetPosition(&x, &y); - return x; - } - } - case wxTop: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->top.GetDone()) - return constr->top.GetValue(); - else - return -1; - } - else - { - int x, y; - other->GetPosition(&x, &y); - return y; - } - } - case wxRight: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->right.GetDone()) - return constr->right.GetValue(); - else - return -1; - } - else - { - int x, y, w, h; - other->GetPosition(&x, &y); - other->GetSize(&w, &h); - return (int)(x + w); - } - } - case wxBottom: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->bottom.GetDone()) - return constr->bottom.GetValue(); - else - return -1; - } - else - { - int x, y, w, h; - other->GetPosition(&x, &y); - other->GetSize(&w, &h); - return (int)(y + h); - } - } - case wxWidth: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->width.GetDone()) - return constr->width.GetValue(); - else - return -1; - } - else - { - int w, h; - other->GetSize(&w, &h); - return w; - } - } - case wxHeight: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->height.GetDone()) - return constr->height.GetValue(); - else - return -1; - } - else - { - int w, h; - other->GetSize(&w, &h); - return h; - } - } - case wxCentreX: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->centreX.GetDone()) - return constr->centreX.GetValue(); - else - return -1; - } - else - { - int x, y, w, h; - other->GetPosition(&x, &y); - other->GetSize(&w, &h); - return (int)(x + (w/2)); - } - } - case wxCentreY: - { - wxLayoutConstraints *constr = other->GetConstraints(); - // If no constraints, it means the window is not dependent - // on anything, and therefore we know its value immediately - if (constr) - { - if (constr->centreY.GetDone()) - return constr->centreY.GetValue(); - else - return -1; - } - else - { - int x, y, w, h; - other->GetPosition(&x, &y); - other->GetSize(&w, &h); - return (int)(y + (h/2)); - } - } - default: - break; - } - return -1; -} - -wxLayoutConstraints::wxLayoutConstraints() -{ - left.SetEdge(wxLeft); - top.SetEdge(wxTop); - right.SetEdge(wxRight); - bottom.SetEdge(wxBottom); - centreX.SetEdge(wxCentreX); - centreY.SetEdge(wxCentreY); - width.SetEdge(wxWidth); - height.SetEdge(wxHeight); -} - -bool wxLayoutConstraints::SatisfyConstraints(wxWindowBase *win, int *nChanges) -{ - int noChanges = 0; - - bool done = width.GetDone(); - bool newDone = (done ? true : width.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = height.GetDone(); - newDone = (done ? true : height.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = left.GetDone(); - newDone = (done ? true : left.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = top.GetDone(); - newDone = (done ? true : top.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = right.GetDone(); - newDone = (done ? true : right.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = bottom.GetDone(); - newDone = (done ? true : bottom.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = centreX.GetDone(); - newDone = (done ? true : centreX.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - done = centreY.GetDone(); - newDone = (done ? true : centreY.SatisfyConstraint(this, win)); - if (newDone != done) - noChanges ++; - - *nChanges = noChanges; - - return AreSatisfied(); -} - -#endif // wxUSE_CONSTRAINTS diff --git a/Source/3rdParty/wx/src/common/lboxcmn.cpp b/Source/3rdParty/wx/src/common/lboxcmn.cpp deleted file mode 100644 index 883e4858c..000000000 --- a/Source/3rdParty/wx/src/common/lboxcmn.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/lboxcmn.cpp -// Purpose: wxListBox class methods common to all platforms -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: lboxcmn.cpp 39964 2006-07-04 00:31:52Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_LISTBOX - -#include "wx/listbox.h" - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/arrstr.h" -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -wxListBoxBase::~wxListBoxBase() -{ - // this destructor is required for Darwin -} - -// ---------------------------------------------------------------------------- -// adding items -// ---------------------------------------------------------------------------- - -void wxListBoxBase::InsertItems(unsigned int nItems, const wxString *items, unsigned int pos) -{ - wxArrayString aItems; - for ( unsigned int n = 0; n < nItems; n++ ) - { - aItems.Add(items[n]); - } - - DoInsertItems(aItems, pos); -} - - -void wxListBoxBase::Set(int nItems, const wxString* items, void **clientData) -{ - wxArrayString aItems; - for ( int n = 0; n < nItems; n++ ) - { - aItems.Add(items[n]); - } - - DoSetItems(aItems, clientData); -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -bool wxListBoxBase::SetStringSelection(const wxString& s, bool select) -{ - const int sel = FindString(s); - if ( sel == wxNOT_FOUND ) - return false; - - SetSelection(sel, select); - - return true; -} - -void wxListBoxBase::DeselectAll(int itemToLeaveSelected) -{ - if ( HasMultipleSelection() ) - { - wxArrayInt selections; - GetSelections(selections); - - size_t count = selections.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - int item = selections[n]; - if ( item != itemToLeaveSelected ) - Deselect(item); - } - } - else // single selection - { - int sel = GetSelection(); - if ( sel != wxNOT_FOUND && sel != itemToLeaveSelected ) - { - Deselect(sel); - } - } -} - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -void wxListBoxBase::Command(wxCommandEvent& event) -{ - SetSelection(event.GetInt(), event.GetExtraLong() != 0); - (void)ProcessEvent(event); -} - -// ---------------------------------------------------------------------------- -// SetFirstItem() and such -// ---------------------------------------------------------------------------- - -void wxListBoxBase::SetFirstItem(const wxString& s) -{ - int n = FindString(s); - - wxCHECK_RET( n != wxNOT_FOUND, wxT("invalid string in wxListBox::SetFirstItem") ); - - DoSetFirstItem(n); -} - -void wxListBoxBase::AppendAndEnsureVisible(const wxString& s) -{ - Append(s); - EnsureVisible(GetCount() - 1); -} - -void wxListBoxBase::EnsureVisible(int WXUNUSED(n)) -{ - // the base class version does nothing (the only alternative would be to - // call SetFirstItem() but this is probably even more stupid) -} - -#endif // wxUSE_LISTBOX diff --git a/Source/3rdParty/wx/src/common/list.cpp b/Source/3rdParty/wx/src/common/list.cpp deleted file mode 100644 index 6074a8fdd..000000000 --- a/Source/3rdParty/wx/src/common/list.cpp +++ /dev/null @@ -1,768 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Name: src/common/list.cpp -// Purpose: wxList implementation -// Author: Julian Smart -// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added -// Created: 04/01/98 -// RCS-ID: $Id: list.cpp 43048 2006-11-04 18:14:50Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -//////////////////////////////////////////////////////////////////////////////// - -// ============================================================================= -// declarations -// ============================================================================= - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include -#include -#include - -#ifndef WX_PRECOMP - #include "wx/list.h" -#endif - -#if !wxUSE_STL - -// ============================================================================= -// implementation -// ============================================================================= - -// ----------------------------------------------------------------------------- -// wxListKey -// ----------------------------------------------------------------------------- -wxListKey wxDefaultListKey; - -bool wxListKey::operator==(wxListKeyValue value) const -{ - switch ( m_keyType ) - { - default: - wxFAIL_MSG(wxT("bad key type.")); - // let compiler optimize the line above away in release build - // by not putting return here... - - case wxKEY_STRING: - return wxStrcmp(m_key.string, value.string) == 0; - - case wxKEY_INTEGER: - return m_key.integer == value.integer; - } -} - -// ----------------------------------------------------------------------------- -// wxNodeBase -// ----------------------------------------------------------------------------- - -wxNodeBase::wxNodeBase(wxListBase *list, - wxNodeBase *previous, wxNodeBase *next, - void *data, const wxListKey& key) -{ - m_list = list; - m_data = data; - m_previous = previous; - m_next = next; - - switch ( key.GetKeyType() ) - { - case wxKEY_NONE: - break; - - case wxKEY_INTEGER: - m_key.integer = key.GetNumber(); - break; - - case wxKEY_STRING: - // to be free()d later - m_key.string = wxStrdup(key.GetString()); - break; - - default: - wxFAIL_MSG(wxT("invalid key type")); - } - - if ( previous ) - previous->m_next = this; - - if ( next ) - next->m_previous = this; -} - -wxNodeBase::~wxNodeBase() -{ - // handle the case when we're being deleted from the list by the user (i.e. - // not by the list itself from DeleteNode) - we must do it for - // compatibility with old code - if ( m_list != NULL ) - { - if ( m_list->m_keyType == wxKEY_STRING ) - { - free(m_key.string); - } - - m_list->DetachNode(this); - } -} - -int wxNodeBase::IndexOf() const -{ - wxCHECK_MSG( m_list, wxNOT_FOUND, wxT("node doesn't belong to a list in IndexOf")); - - // It would be more efficient to implement IndexOf() completely inside - // wxListBase (only traverse the list once), but this is probably a more - // reusable way of doing it. Can always be optimized at a later date (since - // IndexOf() resides in wxListBase as well) if efficiency is a problem. - int i; - wxNodeBase *prev = m_previous; - - for( i = 0; prev; i++ ) - { - prev = prev->m_previous; - } - - return i; -} - -// ----------------------------------------------------------------------------- -// wxListBase -// ----------------------------------------------------------------------------- - -void wxListBase::Init(wxKeyType keyType) -{ - m_nodeFirst = - m_nodeLast = (wxNodeBase *) NULL; - m_count = 0; - m_destroy = false; - m_keyType = keyType; -} - -wxListBase::wxListBase(size_t count, void *elements[]) -{ - Init(); - - for ( size_t n = 0; n < count; n++ ) - { - Append(elements[n]); - } -} - -void wxListBase::DoCopy(const wxListBase& list) -{ - wxASSERT_MSG( !list.m_destroy, - wxT("copying list which owns it's elements is a bad idea") ); - - m_destroy = list.m_destroy; - m_keyType = list.m_keyType; - m_nodeFirst = - m_nodeLast = (wxNodeBase *) NULL; - - switch (m_keyType) - { - case wxKEY_INTEGER: - { - long key; - for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) - { - key = node->GetKeyInteger(); - Append(key, node->GetData()); - } - break; - } - - case wxKEY_STRING: - { - const wxChar *key; - for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) - { - key = node->GetKeyString(); - Append(key, node->GetData()); - } - break; - } - - default: - { - for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) - { - Append(node->GetData()); - } - break; - } - } - - wxASSERT_MSG( m_count == list.m_count, _T("logic error in wxList::DoCopy") ); -} - -wxListBase::~wxListBase() -{ - wxNodeBase *each = m_nodeFirst; - while ( each != NULL ) - { - wxNodeBase *next = each->GetNext(); - DoDeleteNode(each); - each = next; - } -} - -wxNodeBase *wxListBase::AppendCommon(wxNodeBase *node) -{ - if ( !m_nodeFirst ) - { - m_nodeFirst = node; - m_nodeLast = m_nodeFirst; - } - else - { - m_nodeLast->m_next = node; - m_nodeLast = node; - } - - m_count++; - - return node; -} - -wxNodeBase *wxListBase::Append(void *object) -{ - // all objects in a keyed list should have a key - wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL, - wxT("need a key for the object to append") ); - - // we use wxDefaultListKey even though it is the default parameter value - // because gcc under Mac OS X seems to miscompile this call otherwise - wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, - wxDefaultListKey); - - return AppendCommon(node); -} - -wxNodeBase *wxListBase::Append(long key, void *object) -{ - wxCHECK_MSG( (m_keyType == wxKEY_INTEGER) || - (m_keyType == wxKEY_NONE && m_count == 0), - (wxNodeBase *)NULL, - wxT("can't append object with numeric key to this list") ); - - wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key); - return AppendCommon(node); -} - -wxNodeBase *wxListBase::Append (const wxChar *key, void *object) -{ - wxCHECK_MSG( (m_keyType == wxKEY_STRING) || - (m_keyType == wxKEY_NONE && m_count == 0), - (wxNodeBase *)NULL, - wxT("can't append object with string key to this list") ); - - wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key); - return AppendCommon(node); -} - -wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object) -{ - // all objects in a keyed list should have a key - wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL, - wxT("need a key for the object to insert") ); - - wxCHECK_MSG( !position || position->m_list == this, (wxNodeBase *)NULL, - wxT("can't insert before a node from another list") ); - - // previous and next node for the node being inserted - wxNodeBase *prev, *next; - if ( position ) - { - prev = position->GetPrevious(); - next = position; - } - else - { - // inserting in the beginning of the list - prev = (wxNodeBase *)NULL; - next = m_nodeFirst; - } - - // wxDefaultListKey: see comment in Append() above - wxNodeBase *node = CreateNode(prev, next, object, wxDefaultListKey); - if ( !m_nodeFirst ) - { - m_nodeLast = node; - } - - if ( prev == NULL ) - { - m_nodeFirst = node; - } - - m_count++; - - return node; -} - -wxNodeBase *wxListBase::Item(size_t n) const -{ - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - if ( n-- == 0 ) - { - return current; - } - } - - wxFAIL_MSG( wxT("invalid index in wxListBase::Item") ); - - return (wxNodeBase *)NULL; -} - -wxNodeBase *wxListBase::Find(const wxListKey& key) const -{ - wxASSERT_MSG( m_keyType == key.GetKeyType(), - wxT("this list is not keyed on the type of this key") ); - - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - if ( key == current->m_key ) - { - return current; - } - } - - // not found - return (wxNodeBase *)NULL; -} - -wxNodeBase *wxListBase::Find(const void *object) const -{ - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - if ( current->GetData() == object ) - return current; - } - - // not found - return (wxNodeBase *)NULL; -} - -int wxListBase::IndexOf(void *object) const -{ - wxNodeBase *node = Find( object ); - - return node ? node->IndexOf() : wxNOT_FOUND; -} - -void wxListBase::DoDeleteNode(wxNodeBase *node) -{ - // free node's data - if ( m_keyType == wxKEY_STRING ) - { - free(node->m_key.string); - } - - if ( m_destroy ) - { - node->DeleteData(); - } - - // so that the node knows that it's being deleted by the list - node->m_list = NULL; - delete node; -} - -wxNodeBase *wxListBase::DetachNode(wxNodeBase *node) -{ - wxCHECK_MSG( node, NULL, wxT("detaching NULL wxNodeBase") ); - wxCHECK_MSG( node->m_list == this, NULL, - wxT("detaching node which is not from this list") ); - - // update the list - wxNodeBase **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next - : &m_nodeFirst; - wxNodeBase **nextPrev = node->GetNext() ? &node->GetNext()->m_previous - : &m_nodeLast; - - *prevNext = node->GetNext(); - *nextPrev = node->GetPrevious(); - - m_count--; - - // mark the node as not belonging to this list any more - node->m_list = NULL; - - return node; -} - -bool wxListBase::DeleteNode(wxNodeBase *node) -{ - if ( !DetachNode(node) ) - return false; - - DoDeleteNode(node); - - return true; -} - -bool wxListBase::DeleteObject(void *object) -{ - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - if ( current->GetData() == object ) - { - DeleteNode(current); - return true; - } - } - - // not found - return false; -} - -void wxListBase::Clear() -{ - wxNodeBase *current = m_nodeFirst; - while ( current ) - { - wxNodeBase *next = current->GetNext(); - DoDeleteNode(current); - current = next; - } - - m_nodeFirst = - m_nodeLast = (wxNodeBase *)NULL; - - m_count = 0; -} - -void wxListBase::ForEach(wxListIterateFunction F) -{ - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - (*F)(current->GetData()); - } -} - -void *wxListBase::FirstThat(wxListIterateFunction F) -{ - for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) - { - if ( (*F)(current->GetData()) ) - return current->GetData(); - } - - return (wxNodeBase *)NULL; -} - -void *wxListBase::LastThat(wxListIterateFunction F) -{ - for ( wxNodeBase *current = GetLast(); current; current = current->GetPrevious() ) - { - if ( (*F)(current->GetData()) ) - return current->GetData(); - } - - return (wxNodeBase *)NULL; -} - -// (stefan.hammes@urz.uni-heidelberg.de) -// -// function for sorting lists. the concept is borrowed from 'qsort'. -// by giving a sort function, arbitrary lists can be sorted. -// method: -// - put wxObject pointers into an array -// - sort the array with qsort -// - put back the sorted wxObject pointers into the list -// -// CAVE: the sort function receives pointers to wxObject pointers (wxObject **), -// so dereference right! -// EXAMPLE: -// int listcompare(const void *arg1, const void *arg2) -// { -// return(compare(**(wxString **)arg1, -// **(wxString **)arg2)); -// } -// -// void main() -// { -// wxListBase list; -// -// list.Append(new wxString("DEF")); -// list.Append(new wxString("GHI")); -// list.Append(new wxString("ABC")); -// list.Sort(listcompare); -// } - -void wxListBase::Sort(const wxSortCompareFunction compfunc) -{ - // allocate an array for the wxObject pointers of the list - const size_t num = GetCount(); - void **objArray = new void *[num]; - void **objPtr = objArray; - - // go through the list and put the pointers into the array - wxNodeBase *node; - for ( node = GetFirst(); node; node = node->GetNext() ) - { - *objPtr++ = node->GetData(); - } - - // sort the array - qsort((void *)objArray,num,sizeof(wxObject *), -#ifdef __WXWINCE__ - (int (__cdecl *)(const void *,const void *)) -#endif - compfunc); - - // put the sorted pointers back into the list - objPtr = objArray; - for ( node = GetFirst(); node; node = node->GetNext() ) - { - node->SetData(*objPtr++); - } - - // free the array - delete[] objArray; -} - -void wxListBase::Reverse() -{ - wxNodeBase* node = m_nodeFirst; - wxNodeBase* tmp; - - while (node) - { - // swap prev and next pointers - tmp = node->m_next; - node->m_next = node->m_previous; - node->m_previous = tmp; - - // this is the node that was next before swapping - node = tmp; - } - - // swap first and last node - tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp; -} - -void wxListBase::DeleteNodes(wxNodeBase* first, wxNodeBase* last) -{ - wxNodeBase* node = first; - - while (node != last) - { - wxNodeBase* next = node->GetNext(); - DeleteNode(node); - node = next; - } -} - -// ============================================================================ -// compatibility section from now on -// ============================================================================ - -#ifdef wxLIST_COMPATIBILITY - -// ----------------------------------------------------------------------------- -// wxList (a.k.a. wxObjectList) -// ----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject) - -wxList::wxList( int key_type ) - : wxObjectList( (wxKeyType)key_type ) -{ -} - -void wxObjectListNode::DeleteData() -{ - delete (wxObject *)GetData(); -} - -// ---------------------------------------------------------------------------- -// wxStringList -// ---------------------------------------------------------------------------- - -static inline wxChar* MYcopystring(const wxChar* s) -{ - wxChar* copy = new wxChar[wxStrlen(s) + 1]; - return wxStrcpy(copy, s); -} - -IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxObject) - -// instead of WX_DEFINE_LIST(wxStringListBase) we define this function -// ourselves -void wxStringListNode::DeleteData() -{ - delete [] (char *)GetData(); -} - -bool wxStringList::Delete(const wxChar *s) -{ - wxStringListNode *current; - - for ( current = GetFirst(); current; current = current->GetNext() ) - { - if ( wxStrcmp(current->GetData(), s) == 0 ) - { - DeleteNode(current); - return true; - } - } - - // not found - return false; -} - -void wxStringList::DoCopy(const wxStringList& other) -{ - wxASSERT( GetCount() == 0 ); // this list must be empty before copying! - - size_t count = other.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - Add(other.Item(n)->GetData()); - } -} - -wxStringList::wxStringList() -{ - DeleteContents(true); -} - -// Variable argument list, terminated by a zero -// Makes new storage for the strings -wxStringList::wxStringList (const wxChar *first, ...) -{ - DeleteContents(true); - if ( !first ) - return; - - va_list ap; - va_start(ap, first); - - const wxChar *s = first; - for (;;) - { - Add(s); - - // icc gives this warning in its own va_arg() macro, argh -#ifdef __INTELC__ - #pragma warning(push) - #pragma warning(disable: 1684) -#endif - - s = va_arg(ap, const wxChar *); - -#ifdef __INTELC__ - #pragma warning(pop) -#endif - - if ( !s ) - break; - } - - va_end(ap); -} - -// Only makes new strings if arg is true -wxChar **wxStringList::ListToArray(bool new_copies) const -{ - wxChar **string_array = new wxChar *[GetCount()]; - wxStringListNode *node = GetFirst(); - for (size_t i = 0; i < GetCount(); i++) - { - wxChar *s = node->GetData(); - if ( new_copies ) - string_array[i] = MYcopystring(s); - else - string_array[i] = s; - node = node->GetNext(); - } - - return string_array; -} - -// Checks whether s is a member of the list -bool wxStringList::Member(const wxChar *s) const -{ - for ( wxStringListNode *node = GetFirst(); node; node = node->GetNext() ) - { - const wxChar *s1 = node->GetData(); - if (s == s1 || wxStrcmp (s, s1) == 0) - return true; - } - - return false; -} - -#ifdef __WXWINCE__ -extern "C" int __cdecl -#else -extern "C" int LINKAGEMODE -#endif - -wx_comparestrings(const void *arg1, const void *arg2) -{ - wxChar **s1 = (wxChar **) arg1; - wxChar **s2 = (wxChar **) arg2; - - return wxStrcmp (*s1, *s2); -} - -// Sort a list of strings - deallocates old nodes, allocates new -void wxStringList::Sort() -{ - size_t N = GetCount(); - wxChar **array = new wxChar *[N]; - wxStringListNode *node; - - size_t i = 0; - for ( node = GetFirst(); node; node = node->GetNext() ) - { - array[i++] = node->GetData(); - } - - qsort (array, N, sizeof (wxChar *), wx_comparestrings); - - i = 0; - for ( node = GetFirst(); node; node = node->GetNext() ) - node->SetData( array[i++] ); - - delete [] array; -} - -wxNode *wxStringList::Add(const wxChar *s) -{ - return (wxNode *)(wxStringListBase::Node *) - wxStringListBase::Append(MYcopystring(s)); -} - -wxNode *wxStringList::Prepend(const wxChar *s) -{ - return (wxNode *)(wxStringListBase::Node *) - wxStringListBase::Insert(MYcopystring(s)); -} - -#endif // wxLIST_COMPATIBILITY - -#else // wxUSE_STL = 1 - - #include "wx/listimpl.cpp" - WX_DEFINE_LIST(wxObjectList) - -// with wxUSE_STL wxStringList contains wxString objects, not pointers -void _WX_LIST_HELPER_wxStringListBase::DeleteFunction( wxString WXUNUSED(X) ) -{ -} - -wxStringListBase::BaseListType wxStringListBase::EmptyList; - -#endif // !wxUSE_STL diff --git a/Source/3rdParty/wx/src/common/listctrlcmn.cpp b/Source/3rdParty/wx/src/common/listctrlcmn.cpp deleted file mode 100644 index c5366a1aa..000000000 --- a/Source/3rdParty/wx/src/common/listctrlcmn.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Name: src/common/listctrlcmn.cpp -// Purpose: Common defines for wxListCtrl and wxListCtrl-based classes. -// Author: Kevin Ollivier -// Created: 09/15/06 -// RCS-ID: $Id: listctrlcmn.cpp 41568 2006-10-02 17:38:30Z PC $ -// Copyright: (c) Kevin Ollivier -// Licence: wxWindows licence -//////////////////////////////////////////////////////////////////////////////// - -// ============================================================================= -// declarations -// ============================================================================= - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if wxUSE_LISTCTRL - -#include "wx/listctrl.h" - -const wxChar wxListCtrlNameStr[] = wxT("listCtrl"); - -// ListCtrl events -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS) -#if WXWIN_COMPATIBILITY_2_4 -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO) -#endif -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT) - -#endif // wxUSE_LISTCTRL diff --git a/Source/3rdParty/wx/src/common/log.cpp b/Source/3rdParty/wx/src/common/log.cpp deleted file mode 100644 index dc23a83e3..000000000 --- a/Source/3rdParty/wx/src/common/log.cpp +++ /dev/null @@ -1,838 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/log.cpp -// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: log.cpp 67119 2011-03-03 15:09:44Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_LOG - -// wxWidgets -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/arrstr.h" - #include "wx/intl.h" - #include "wx/string.h" - #include "wx/utils.h" -#endif //WX_PRECOMP - -#include "wx/apptrait.h" -#include "wx/datetime.h" -#include "wx/file.h" -#include "wx/msgout.h" -#include "wx/textfile.h" -#include "wx/thread.h" -#include "wx/wxchar.h" - -// other standard headers -#ifndef __WXWINCE__ -#include -#endif - -#include - -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/wince/time.h" -#endif - -#if defined(__WINDOWS__) - #include "wx/msw/private.h" // includes windows.h -#endif - -// ---------------------------------------------------------------------------- -// non member functions -// ---------------------------------------------------------------------------- - -// define this to enable wrapping of log messages -//#define LOG_PRETTY_WRAP - -#ifdef LOG_PRETTY_WRAP - static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz); -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// implementation of Log functions -// -// NB: unfortunately we need all these distinct functions, we can't make them -// macros and not all compilers inline vararg functions. -// ---------------------------------------------------------------------------- - -// generic log function -void wxVLogGeneric(wxLogLevel level, const wxChar *szFormat, va_list argptr) -{ - if ( wxLog::IsEnabled() ) { - wxLog::OnLog(level, wxString::FormatV(szFormat, argptr), time(NULL)); - } -} - -void wxLogGeneric(wxLogLevel level, const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogGeneric(level, szFormat, argptr); - va_end(argptr); -} - -#define IMPLEMENT_LOG_FUNCTION(level) \ - void wxVLog##level(const wxChar *szFormat, va_list argptr) \ - { \ - if ( wxLog::IsEnabled() ) { \ - wxLog::OnLog(wxLOG_##level, \ - wxString::FormatV(szFormat, argptr), time(NULL));\ - } \ - } \ - \ - void wxLog##level(const wxChar *szFormat, ...) \ - { \ - va_list argptr; \ - va_start(argptr, szFormat); \ - wxVLog##level(szFormat, argptr); \ - va_end(argptr); \ - } - -IMPLEMENT_LOG_FUNCTION(Error) -IMPLEMENT_LOG_FUNCTION(Warning) -IMPLEMENT_LOG_FUNCTION(Message) -IMPLEMENT_LOG_FUNCTION(Info) -IMPLEMENT_LOG_FUNCTION(Status) - -void wxSafeShowMessage(const wxString& title, const wxString& text) -{ -#ifdef __WINDOWS__ - ::MessageBox(NULL, text, title, MB_OK | MB_ICONSTOP); -#else - wxFprintf(stderr, _T("%s: %s\n"), title.c_str(), text.c_str()); - fflush(stderr); -#endif -} - -// fatal errors can't be suppressed nor handled by the custom log target and -// always terminate the program -void wxVLogFatalError(const wxChar *szFormat, va_list argptr) -{ - wxSafeShowMessage(_T("Fatal Error"), wxString::FormatV(szFormat, argptr)); - -#ifdef __WXWINCE__ - ExitThread(3); -#else - abort(); -#endif -} - -void wxLogFatalError(const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogFatalError(szFormat, argptr); - - // some compilers warn about unreachable code and it shouldn't matter - // for the others anyhow... - //va_end(argptr); -} - -// same as info, but only if 'verbose' mode is on -void wxVLogVerbose(const wxChar *szFormat, va_list argptr) -{ - if ( wxLog::IsEnabled() ) { - if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() ) { - wxLog::OnLog(wxLOG_Info, - wxString::FormatV(szFormat, argptr), time(NULL)); - } - } -} - -void wxLogVerbose(const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogVerbose(szFormat, argptr); - va_end(argptr); -} - -// debug functions -#ifdef __WXDEBUG__ -#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \ - void wxVLog##level(const wxChar *szFormat, va_list argptr) \ - { \ - if ( wxLog::IsEnabled() ) { \ - wxLog::OnLog(wxLOG_##level, \ - wxString::FormatV(szFormat, argptr), time(NULL));\ - } \ - } \ - \ - void wxLog##level(const wxChar *szFormat, ...) \ - { \ - va_list argptr; \ - va_start(argptr, szFormat); \ - wxVLog##level(szFormat, argptr); \ - va_end(argptr); \ - } - - void wxVLogTrace(const wxChar *mask, const wxChar *szFormat, va_list argptr) - { - if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) { - wxString msg; - msg << _T("(") << mask << _T(") ") << wxString::FormatV(szFormat, argptr); - - wxLog::OnLog(wxLOG_Trace, msg, time(NULL)); - } - } - - void wxLogTrace(const wxChar *mask, const wxChar *szFormat, ...) - { - va_list argptr; - va_start(argptr, szFormat); - wxVLogTrace(mask, szFormat, argptr); - va_end(argptr); - } - - void wxVLogTrace(wxTraceMask mask, const wxChar *szFormat, va_list argptr) - { - // we check that all of mask bits are set in the current mask, so - // that wxLogTrace(wxTraceRefCount | wxTraceOle) will only do something - // if both bits are set. - if ( wxLog::IsEnabled() && ((wxLog::GetTraceMask() & mask) == mask) ) { - wxLog::OnLog(wxLOG_Trace, wxString::FormatV(szFormat, argptr), time(NULL)); - } - } - - void wxLogTrace(wxTraceMask mask, const wxChar *szFormat, ...) - { - va_list argptr; - va_start(argptr, szFormat); - wxVLogTrace(mask, szFormat, argptr); - va_end(argptr); - } - -#else // release - #define IMPLEMENT_LOG_DEBUG_FUNCTION(level) -#endif - -IMPLEMENT_LOG_DEBUG_FUNCTION(Debug) -IMPLEMENT_LOG_DEBUG_FUNCTION(Trace) - -// wxLogSysError: one uses the last error code, for other you must give it -// explicitly - -// return the system error message description -static inline wxString wxLogSysErrorHelper(long err) -{ - return wxString::Format(_(" (error %ld: %s)"), err, wxSysErrorMsg(err)); -} - -void WXDLLEXPORT wxVLogSysError(const wxChar *szFormat, va_list argptr) -{ - wxVLogSysError(wxSysErrorCode(), szFormat, argptr); -} - -void WXDLLEXPORT wxLogSysError(const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogSysError(szFormat, argptr); - va_end(argptr); -} - -void WXDLLEXPORT wxVLogSysError(long err, const wxChar *fmt, va_list argptr) -{ - if ( wxLog::IsEnabled() ) { - wxLog::OnLog(wxLOG_Error, - wxString::FormatV(fmt, argptr) + wxLogSysErrorHelper(err), - time(NULL)); - } -} - -void WXDLLEXPORT wxLogSysError(long lErrCode, const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogSysError(lErrCode, szFormat, argptr); - va_end(argptr); -} - -// ---------------------------------------------------------------------------- -// wxLog class implementation -// ---------------------------------------------------------------------------- - -// define a critical section gs_prevCS protecting access to wxLog::ms_prevXXX -wxCRIT_SECT_DECLARE(gs_prevCS); - -/* static */ -unsigned wxLog::DoLogNumberOfRepeats() -{ - wxLog * const pLogger = GetActiveTarget(); - return pLogger ? pLogger->LogLastRepeatIfNeeded() : 0u; -} - -unsigned wxLog::LogLastRepeatIfNeeded() -{ - wxCRIT_SECT_LOCKER(lock, gs_prevCS); - - return LogLastRepeatIfNeededUnlocked(); -} - -unsigned wxLog::LogLastRepeatIfNeededUnlocked() -{ - long retval = ms_prevCounter; - if ( ms_prevCounter > 0 ) - { - wxString msg; -#if wxUSE_INTL - msg.Printf(wxPLURAL("The previous message repeated once.", - "The previous message repeated %lu times.", - ms_prevCounter), - ms_prevCounter); -#else - msg.Printf(wxT("The previous message was repeated.")); -#endif - ms_prevCounter = 0; - ms_prevString.clear(); - DoLog(ms_prevLevel, msg.c_str(), ms_prevTimeStamp); - } - return retval; -} - -wxLog::~wxLog() -{ -} - -/* static */ -void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - if ( IsEnabled() && ms_logLevel >= level ) - { - wxLog *pLogger = GetActiveTarget(); - if ( pLogger ) - { - if ( GetRepetitionCounting() ) - { - wxCRIT_SECT_LOCKER(lock, gs_prevCS); - - if ( szString == ms_prevString ) - { - ms_prevCounter++; - - // nothing else to do, in particular, don't log the - // repeated message - return; - } - - pLogger->LogLastRepeatIfNeededUnlocked(); - - // reset repetition counter for a new message - ms_prevString = szString; - ms_prevLevel = level; - ms_prevTimeStamp = t; - } - - pLogger->DoLog(level, szString, t); - } - } -} - -// deprecated function -#if WXWIN_COMPATIBILITY_2_6 - -wxChar *wxLog::SetLogBuffer(wxChar * WXUNUSED(buf), size_t WXUNUSED(size)) -{ - return NULL; -} - -#endif // WXWIN_COMPATIBILITY_2_6 - -wxLog *wxLog::GetActiveTarget() -{ - if ( ms_bAutoCreate && ms_pLogger == NULL ) { - // prevent infinite recursion if someone calls wxLogXXX() from - // wxApp::CreateLogTarget() - static bool s_bInGetActiveTarget = false; - if ( !s_bInGetActiveTarget ) { - s_bInGetActiveTarget = true; - - // ask the application to create a log target for us - if ( wxTheApp != NULL ) - ms_pLogger = wxTheApp->GetTraits()->CreateLogTarget(); - else - ms_pLogger = new wxLogStderr; - - s_bInGetActiveTarget = false; - - // do nothing if it fails - what can we do? - } - } - - return ms_pLogger; -} - -wxLog *wxLog::SetActiveTarget(wxLog *pLogger) -{ - if ( ms_pLogger != NULL ) { - // flush the old messages before changing because otherwise they might - // get lost later if this target is not restored - ms_pLogger->Flush(); - } - - wxLog *pOldLogger = ms_pLogger; - ms_pLogger = pLogger; - - return pOldLogger; -} - -void wxLog::DontCreateOnDemand() -{ - ms_bAutoCreate = false; - - // this is usually called at the end of the program and we assume that it - // is *always* called at the end - so we free memory here to avoid false - // memory leak reports from wxWin memory tracking code - ClearTraceMasks(); -} - -void wxLog::DoCreateOnDemand() -{ - ms_bAutoCreate = true; -} - -void wxLog::RemoveTraceMask(const wxString& str) -{ - int index = ms_aTraceMasks.Index(str); - if ( index != wxNOT_FOUND ) - ms_aTraceMasks.RemoveAt((size_t)index); -} - -void wxLog::ClearTraceMasks() -{ - ms_aTraceMasks.Clear(); -} - -void wxLog::TimeStamp(wxString *str) -{ -#if wxUSE_DATETIME - if ( ms_timestamp ) - { - wxChar buf[256]; - time_t timeNow; - (void)time(&timeNow); - - struct tm tm; - wxStrftime(buf, WXSIZEOF(buf), - ms_timestamp, wxLocaltime_r(&timeNow, &tm)); - - str->Empty(); - *str << buf << wxT(": "); - } -#endif // wxUSE_DATETIME -} - -void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - switch ( level ) { - case wxLOG_FatalError: - DoLogString(wxString(_("Fatal error: ")) + szString, t); - DoLogString(_("Program aborted."), t); - Flush(); -#ifdef __WXWINCE__ - ExitThread(3); -#else - abort(); -#endif - break; - - case wxLOG_Error: - DoLogString(wxString(_("Error: ")) + szString, t); - break; - - case wxLOG_Warning: - DoLogString(wxString(_("Warning: ")) + szString, t); - break; - - case wxLOG_Info: - if ( GetVerbose() ) - case wxLOG_Message: - case wxLOG_Status: - default: // log unknown log levels too - DoLogString(szString, t); - break; - - case wxLOG_Trace: - case wxLOG_Debug: -#ifdef __WXDEBUG__ - { - wxString msg = level == wxLOG_Trace ? wxT("Trace: ") - : wxT("Debug: "); - msg << szString; - DoLogString(msg, t); - } -#endif // Debug - break; - } -} - -void wxLog::DoLogString(const wxChar *WXUNUSED(szString), time_t WXUNUSED(t)) -{ - wxFAIL_MSG(wxT("DoLogString must be overriden if it's called.")); -} - -void wxLog::Flush() -{ - LogLastRepeatIfNeeded(); -} - -/*static*/ bool wxLog::IsAllowedTraceMask(const wxChar *mask) -{ - for ( wxArrayString::iterator it = ms_aTraceMasks.begin(), - en = ms_aTraceMasks.end(); - it != en; ++it ) - if ( *it == mask) - return true; - return false; -} - -// ---------------------------------------------------------------------------- -// wxLogBuffer implementation -// ---------------------------------------------------------------------------- - -void wxLogBuffer::Flush() -{ - if ( !m_str.empty() ) - { - wxMessageOutputBest out; - out.Printf(_T("%s"), m_str.c_str()); - m_str.clear(); - } -} - -void wxLogBuffer::DoLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - switch ( level ) - { - case wxLOG_Trace: - case wxLOG_Debug: -#ifdef __WXDEBUG__ - // don't put debug messages in the buffer, we don't want to show - // them to the user in a msg box, log them immediately - { - wxString str; - TimeStamp(&str); - str += szString; - - wxMessageOutputDebug dbgout; - dbgout.Printf(_T("%s\n"), str.c_str()); - } -#endif // __WXDEBUG__ - break; - - default: - wxLog::DoLog(level, szString, t); - } -} - -void wxLogBuffer::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) -{ - m_str << szString << _T("\n"); -} - -// ---------------------------------------------------------------------------- -// wxLogStderr class implementation -// ---------------------------------------------------------------------------- - -wxLogStderr::wxLogStderr(FILE *fp) -{ - if ( fp == NULL ) - m_fp = stderr; - else - m_fp = fp; -} - -void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) -{ - wxString str; - TimeStamp(&str); - str << szString; - - wxFputs(str, m_fp); - wxFputc(_T('\n'), m_fp); - fflush(m_fp); - - // under GUI systems such as Windows or Mac, programs usually don't have - // stderr at all, so show the messages also somewhere else, typically in - // the debugger window so that they go at least somewhere instead of being - // simply lost - if ( m_fp == stderr ) - { - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( traits && !traits->HasStderr() ) - { - wxMessageOutputDebug dbgout; - dbgout.Printf(_T("%s\n"), str.c_str()); - } - } -} - -// ---------------------------------------------------------------------------- -// wxLogStream implementation -// ---------------------------------------------------------------------------- - -#if wxUSE_STD_IOSTREAM -#include "wx/ioswrap.h" -wxLogStream::wxLogStream(wxSTD ostream *ostr) -{ - if ( ostr == NULL ) - m_ostr = &wxSTD cerr; - else - m_ostr = ostr; -} - -void wxLogStream::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) -{ - wxString str; - TimeStamp(&str); - (*m_ostr) << wxSafeConvertWX2MB(str) << wxSafeConvertWX2MB(szString) << wxSTD endl; -} -#endif // wxUSE_STD_IOSTREAM - -// ---------------------------------------------------------------------------- -// wxLogChain -// ---------------------------------------------------------------------------- - -wxLogChain::wxLogChain(wxLog *logger) -{ - m_bPassMessages = true; - - m_logNew = logger; - m_logOld = wxLog::SetActiveTarget(this); -} - -wxLogChain::~wxLogChain() -{ - wxLog::SetActiveTarget(m_logOld); - - if ( m_logNew != this ) - delete m_logNew; -} - -void wxLogChain::SetLog(wxLog *logger) -{ - if ( m_logNew != this ) - delete m_logNew; - - m_logNew = logger; -} - -void wxLogChain::Flush() -{ - if ( m_logOld ) - m_logOld->Flush(); - - // be careful to avoid infinite recursion - if ( m_logNew && m_logNew != this ) - m_logNew->Flush(); -} - -void wxLogChain::DoLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - // let the previous logger show it - if ( m_logOld && IsPassingMessages() ) - { - // bogus cast just to access protected DoLog - ((wxLogChain *)m_logOld)->DoLog(level, szString, t); - } - - if ( m_logNew && m_logNew != this ) - { - // as above... - ((wxLogChain *)m_logNew)->DoLog(level, szString, t); - } -} - -// ---------------------------------------------------------------------------- -// wxLogPassThrough -// ---------------------------------------------------------------------------- - -#ifdef __VISUALC__ - // "'this' : used in base member initializer list" - so what? - #pragma warning(disable:4355) -#endif // VC++ - -wxLogPassThrough::wxLogPassThrough() - : wxLogChain(this) -{ -} - -#ifdef __VISUALC__ - #pragma warning(default:4355) -#endif // VC++ - -// ============================================================================ -// Global functions/variables -// ============================================================================ - -// ---------------------------------------------------------------------------- -// static variables -// ---------------------------------------------------------------------------- - -bool wxLog::ms_bRepetCounting = false; -wxString wxLog::ms_prevString; -unsigned int wxLog::ms_prevCounter = 0; -time_t wxLog::ms_prevTimeStamp= 0; -wxLogLevel wxLog::ms_prevLevel; - -wxLog *wxLog::ms_pLogger = (wxLog *)NULL; -bool wxLog::ms_doLog = true; -bool wxLog::ms_bAutoCreate = true; -bool wxLog::ms_bVerbose = false; - -wxLogLevel wxLog::ms_logLevel = wxLOG_Max; // log everything by default - -size_t wxLog::ms_suspendCount = 0; - -const wxChar *wxLog::ms_timestamp = wxT("%X"); // time only, no date - -wxTraceMask wxLog::ms_ulTraceMask = (wxTraceMask)0; -wxArrayString wxLog::ms_aTraceMasks; - -// ---------------------------------------------------------------------------- -// stdout error logging helper -// ---------------------------------------------------------------------------- - -// helper function: wraps the message and justifies it under given position -// (looks more pretty on the terminal). Also adds newline at the end. -// -// TODO this is now disabled until I find a portable way of determining the -// terminal window size (ok, I found it but does anybody really cares?) -#ifdef LOG_PRETTY_WRAP -static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz) -{ - size_t nMax = 80; // FIXME - size_t nStart = strlen(pszPrefix); - fputs(pszPrefix, f); - - size_t n; - while ( *psz != '\0' ) { - for ( n = nStart; (n < nMax) && (*psz != '\0'); n++ ) - putc(*psz++, f); - - // wrapped? - if ( *psz != '\0' ) { - /*putc('\n', f);*/ - for ( n = 0; n < nStart; n++ ) - putc(' ', f); - - // as we wrapped, squeeze all white space - while ( isspace(*psz) ) - psz++; - } - } - - putc('\n', f); -} -#endif //LOG_PRETTY_WRAP - -// ---------------------------------------------------------------------------- -// error code/error message retrieval functions -// ---------------------------------------------------------------------------- - -// get error code from syste -unsigned long wxSysErrorCode() -{ -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - return ::GetLastError(); -#else //Unix - return errno; -#endif //Win/Unix -} - -// get error message from system -const wxChar *wxSysErrorMsg(unsigned long nErrCode) -{ - if ( nErrCode == 0 ) - nErrCode = wxSysErrorCode(); - -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - static wxChar s_szBuf[1024]; - - // get error message from system - LPVOID lpMsgBuf; - if ( ::FormatMessage - ( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - nErrCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf, - 0, - NULL - ) == 0 ) - { - // if this happens, something is seriously wrong, so don't use _() here - // for safety - wxSprintf(s_szBuf, _T("unknown error %lx"), nErrCode); - return s_szBuf; - } - - - // copy it to our buffer and free memory - // Crashes on SmartPhone (FIXME) -#if !defined(__SMARTPHONE__) /* of WinCE */ - if( lpMsgBuf != 0 ) - { - wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1); - s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0'); - - LocalFree(lpMsgBuf); - - // returned string is capitalized and ended with '\r\n' - bad - s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]); - size_t len = wxStrlen(s_szBuf); - if ( len > 0 ) { - // truncate string - if ( s_szBuf[len - 2] == wxT('\r') ) - s_szBuf[len - 2] = wxT('\0'); - } - } - else -#endif // !__SMARTPHONE__ - { - s_szBuf[0] = wxT('\0'); - } - - return s_szBuf; -#else // !__WXMSW__ - #if wxUSE_UNICODE - static wchar_t s_wzBuf[1024]; - wxConvCurrent->MB2WC(s_wzBuf, strerror((int)nErrCode), - WXSIZEOF(s_wzBuf) - 1); - return s_wzBuf; - #else - return strerror((int)nErrCode); - #endif -#endif // __WXMSW__/!__WXMSW__ -} - -#endif // wxUSE_LOG diff --git a/Source/3rdParty/wx/src/common/longlong.cpp b/Source/3rdParty/wx/src/common/longlong.cpp deleted file mode 100644 index 78a47ce25..000000000 --- a/Source/3rdParty/wx/src/common/longlong.cpp +++ /dev/null @@ -1,1363 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/longlong.cpp -// Purpose: implementation of wxLongLongNative -// Author: Jeffrey C. Ollie , Vadim Zeitlin -// Remarks: this class is not public in wxWidgets 2.0! It is intentionally -// not documented and is for private use only. -// Modified by: -// Created: 10.02.99 -// RCS-ID: $Id: longlong.cpp 40750 2006-08-22 19:04:45Z MW $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// headers -// ============================================================================ - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_LONGLONG - -#include "wx/longlong.h" - -#ifndef WX_PRECOMP - #include "wx/math.h" // for fabs() -#endif - -#if wxUSE_STREAMS - #include "wx/txtstrm.h" -#endif - -#include // for memset() - -#include "wx/ioswrap.h" - -// ============================================================================ -// implementation -// ============================================================================ - -#if wxUSE_LONGLONG_NATIVE - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -void *wxLongLongNative::asArray() const -{ - static unsigned char temp[8]; - - temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF)); - temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF)); - temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF)); - temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF)); - temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF)); - temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF)); - temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8) & 0xFF)); - temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0) & 0xFF)); - - return temp; -} - -void *wxULongLongNative::asArray() const -{ - static unsigned char temp[8]; - - temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF)); - temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF)); - temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF)); - temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF)); - temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF)); - temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF)); - temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8) & 0xFF)); - temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0) & 0xFF)); - - return temp; -} - -#if wxUSE_LONGLONG_WX -wxLongLongNative::wxLongLongNative(wxLongLongWx ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ll.GetLo(); -} - -wxLongLongNative& wxLongLongNative::operator=(wxLongLongWx ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ll.GetLo(); - return *this; -} - -wxLongLongNative& wxLongLongNative::operator=(const class wxULongLongWx &ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ll.GetLo(); - return *this; -} - -wxULongLongNative::wxULongLongNative(const class wxULongLongWx &ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ((unsigned long) ll.GetLo()); -} - -wxULongLongNative& wxULongLongNative::operator=(wxLongLongWx ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ((unsigned long) ll.GetLo()); - return *this; -} - -wxULongLongNative& wxULongLongNative::operator=(const class wxULongLongWx &ll) -{ - // assign first to avoid precision loss! - m_ll = ll.GetHi(); - m_ll <<= 32; - m_ll |= ((unsigned long) ll.GetLo()); - return *this; -} -#endif - -#endif // wxUSE_LONGLONG_NATIVE - -// ============================================================================ -// wxLongLongWx: emulation of 'long long' using 2 longs -// ============================================================================ - -#if wxUSE_LONGLONG_WX - -// Set value from unsigned wxULongLongWx -wxLongLongWx &wxLongLongWx::operator=(const class wxULongLongWx &ll) -{ - m_hi = (unsigned long) ll.GetHi(); - m_lo = ll.GetLo(); - return *this; -} - -// assignment -wxLongLongWx& wxLongLongWx::Assign(double d) -{ - bool positive = d >= 0; - d = fabs(d); - if ( d <= ULONG_MAX ) - { - m_hi = 0; - m_lo = (long)d; - } - else - { - m_hi = (unsigned long)(d / (1.0 + (double)ULONG_MAX)); - m_lo = (unsigned long)(d - ((double)m_hi * (1.0 + (double)ULONG_MAX))); - } - -#ifdef wxLONGLONG_TEST_MODE - m_ll = (wxLongLong_t)d; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - if ( !positive ) - Negate(); - - return *this; -} - -double wxLongLongWx::ToDouble() const -{ - double d = m_hi; - d *= 1.0 + (double)ULONG_MAX; - d += m_lo; - -#ifdef wxLONGLONG_TEST_MODE - wxASSERT( d == m_ll ); -#endif // wxLONGLONG_TEST_MODE - - return d; -} - -double wxULongLongWx::ToDouble() const -{ - unsigned double d = m_hi; - d *= 1.0 + (double)ULONG_MAX; - d += m_lo; - -#ifdef wxLONGLONG_TEST_MODE - wxASSERT( d == m_ll ); -#endif // wxLONGLONG_TEST_MODE - - return d; -} - -wxLongLongWx wxLongLongWx::operator<<(int shift) const -{ - wxLongLongWx ll(*this); - ll <<= shift; - - return ll; -} - -wxULongLongWx wxULongLongWx::operator<<(int shift) const -{ - wxULongLongWx ll(*this); - ll <<= shift; - - return ll; -} - -wxLongLongWx& wxLongLongWx::operator<<=(int shift) -{ - if (shift != 0) - { - if (shift < 32) - { - m_hi <<= shift; - m_hi |= m_lo >> (32 - shift); - m_lo <<= shift; - } - else - { - m_hi = m_lo << (shift - 32); - m_lo = 0; - } - } - -#ifdef wxLONGLONG_TEST_MODE - m_ll <<= shift; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator<<=(int shift) -{ - if (shift != 0) - { - if (shift < 32) - { - m_hi <<= shift; - m_hi |= m_lo >> (32 - shift); - m_lo <<= shift; - } - else - { - m_hi = m_lo << (shift - 32); - m_lo = 0; - } - } - -#ifdef wxLONGLONG_TEST_MODE - m_ll <<= shift; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx wxLongLongWx::operator>>(int shift) const -{ - wxLongLongWx ll(*this); - ll >>= shift; - - return ll; -} - -wxULongLongWx wxULongLongWx::operator>>(int shift) const -{ - wxULongLongWx ll(*this); - ll >>= shift; - - return ll; -} - -wxLongLongWx& wxLongLongWx::operator>>=(int shift) -{ - if (shift != 0) - { - if (shift < 32) - { - m_lo >>= shift; - m_lo |= m_hi << (32 - shift); - m_hi >>= shift; - } - else - { - m_lo = m_hi >> (shift - 32); - m_hi = (m_hi < 0 ? -1L : 0); - } - } - -#ifdef wxLONGLONG_TEST_MODE - m_ll >>= shift; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator>>=(int shift) -{ - if (shift != 0) - { - if (shift < 32) - { - m_lo >>= shift; - m_lo |= m_hi << (32 - shift); - m_hi >>= shift; - } - else - { - m_lo = m_hi >> (shift - 32); - m_hi = 0; - } - } - -#ifdef wxLONGLONG_TEST_MODE - m_ll >>= shift; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx wxLongLongWx::operator+(const wxLongLongWx& ll) const -{ - wxLongLongWx res(*this); - res += ll; - - return res; -} - -wxULongLongWx wxULongLongWx::operator+(const wxULongLongWx& ll) const -{ - wxULongLongWx res(*this); - res += ll; - - return res; -} - -wxLongLongWx wxLongLongWx::operator+(long l) const -{ - wxLongLongWx res(*this); - res += l; - - return res; -} - -wxULongLongWx wxULongLongWx::operator+(unsigned long l) const -{ - wxULongLongWx res(*this); - res += l; - - return res; -} - -wxLongLongWx& wxLongLongWx::operator+=(const wxLongLongWx& ll) -{ - unsigned long previous = m_lo; - - m_lo += ll.m_lo; - m_hi += ll.m_hi; - - if ((m_lo < previous) || (m_lo < ll.m_lo)) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll += ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator+=(const wxULongLongWx& ll) -{ - unsigned long previous = m_lo; - - m_lo += ll.m_lo; - m_hi += ll.m_hi; - - if ((m_lo < previous) || (m_lo < ll.m_lo)) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll += ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx& wxLongLongWx::operator+=(long l) -{ - unsigned long previous = m_lo; - - m_lo += l; - if (l < 0) - m_hi += -1l; - - if ((m_lo < previous) || (m_lo < (unsigned long)l)) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll += l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator+=(unsigned long l) -{ - unsigned long previous = m_lo; - - m_lo += l; - - if ((m_lo < previous) || (m_lo < l)) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll += l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// pre increment -wxLongLongWx& wxLongLongWx::operator++() -{ - m_lo++; - if (m_lo == 0) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll++; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator++() -{ - m_lo++; - if (m_lo == 0) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll++; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// negation -wxLongLongWx wxLongLongWx::operator-() const -{ - wxLongLongWx res(*this); - res.Negate(); - - return res; -} - -wxLongLongWx& wxLongLongWx::Negate() -{ - m_hi = ~m_hi; - m_lo = ~m_lo; - - m_lo++; - if ( m_lo == 0 ) - m_hi++; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = -m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// subtraction - -wxLongLongWx wxLongLongWx::operator-(const wxLongLongWx& ll) const -{ - wxLongLongWx res(*this); - res -= ll; - - return res; -} - -wxLongLongWx wxULongLongWx::operator-(const wxULongLongWx& ll) const -{ - wxASSERT(m_hi <= LONG_MAX ); - wxASSERT(ll.m_hi <= LONG_MAX ); - - wxLongLongWx res( (long)m_hi , m_lo ); - wxLongLongWx op( (long)ll.m_hi , ll.m_lo ); - res -= op; - - return res; -} - -wxLongLongWx& wxLongLongWx::operator-=(const wxLongLongWx& ll) -{ - unsigned long previous = m_lo; - - m_lo -= ll.m_lo; - m_hi -= ll.m_hi; - - if (previous < ll.m_lo) - m_hi--; - -#ifdef wxLONGLONG_TEST_MODE - m_ll -= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator-=(const wxULongLongWx& ll) -{ - unsigned long previous = m_lo; - - m_lo -= ll.m_lo; - m_hi -= ll.m_hi; - - if (previous < ll.m_lo) - m_hi--; - -#ifdef wxLONGLONG_TEST_MODE - m_ll -= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// pre decrement -wxLongLongWx& wxLongLongWx::operator--() -{ - m_lo--; - if (m_lo == 0xFFFFFFFF) - m_hi--; - -#ifdef wxLONGLONG_TEST_MODE - m_ll--; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator--() -{ - m_lo--; - if (m_lo == 0xFFFFFFFF) - m_hi--; - -#ifdef wxLONGLONG_TEST_MODE - m_ll--; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// comparison operators - -bool wxLongLongWx::operator<(const wxLongLongWx& ll) const -{ - if ( m_hi < ll.m_hi ) - return true; - else if ( m_hi == ll.m_hi ) - return m_lo < ll.m_lo; - else - return false; -} - -bool wxULongLongWx::operator<(const wxULongLongWx& ll) const -{ - if ( m_hi < ll.m_hi ) - return true; - else if ( m_hi == ll.m_hi ) - return m_lo < ll.m_lo; - else - return false; -} - -bool wxLongLongWx::operator>(const wxLongLongWx& ll) const -{ - if ( m_hi > ll.m_hi ) - return true; - else if ( m_hi == ll.m_hi ) - return m_lo > ll.m_lo; - else - return false; -} - -bool wxULongLongWx::operator>(const wxULongLongWx& ll) const -{ - if ( m_hi > ll.m_hi ) - return true; - else if ( m_hi == ll.m_hi ) - return m_lo > ll.m_lo; - else - return false; -} - -// bitwise operators - -wxLongLongWx wxLongLongWx::operator&(const wxLongLongWx& ll) const -{ - return wxLongLongWx(m_hi & ll.m_hi, m_lo & ll.m_lo); -} - -wxULongLongWx wxULongLongWx::operator&(const wxULongLongWx& ll) const -{ - return wxULongLongWx(m_hi & ll.m_hi, m_lo & ll.m_lo); -} - -wxLongLongWx wxLongLongWx::operator|(const wxLongLongWx& ll) const -{ - return wxLongLongWx(m_hi | ll.m_hi, m_lo | ll.m_lo); -} - -wxULongLongWx wxULongLongWx::operator|(const wxULongLongWx& ll) const -{ - return wxULongLongWx(m_hi | ll.m_hi, m_lo | ll.m_lo); -} - -wxLongLongWx wxLongLongWx::operator^(const wxLongLongWx& ll) const -{ - return wxLongLongWx(m_hi ^ ll.m_hi, m_lo ^ ll.m_lo); -} - -wxULongLongWx wxULongLongWx::operator^(const wxULongLongWx& ll) const -{ - return wxULongLongWx(m_hi ^ ll.m_hi, m_lo ^ ll.m_lo); -} - -wxLongLongWx& wxLongLongWx::operator&=(const wxLongLongWx& ll) -{ - m_lo &= ll.m_lo; - m_hi &= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll &= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator&=(const wxULongLongWx& ll) -{ - m_lo &= ll.m_lo; - m_hi &= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll &= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx& wxLongLongWx::operator|=(const wxLongLongWx& ll) -{ - m_lo |= ll.m_lo; - m_hi |= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll |= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator|=(const wxULongLongWx& ll) -{ - m_lo |= ll.m_lo; - m_hi |= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll |= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx& wxLongLongWx::operator^=(const wxLongLongWx& ll) -{ - m_lo ^= ll.m_lo; - m_hi ^= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll ^= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator^=(const wxULongLongWx& ll) -{ - m_lo ^= ll.m_lo; - m_hi ^= ll.m_hi; - -#ifdef wxLONGLONG_TEST_MODE - m_ll ^= ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxLongLongWx wxLongLongWx::operator~() const -{ - return wxLongLongWx(~m_hi, ~m_lo); -} - -wxULongLongWx wxULongLongWx::operator~() const -{ - return wxULongLongWx(~m_hi, ~m_lo); -} - -// multiplication - -wxLongLongWx wxLongLongWx::operator*(const wxLongLongWx& ll) const -{ - wxLongLongWx res(*this); - res *= ll; - - return res; -} - -wxULongLongWx wxULongLongWx::operator*(const wxULongLongWx& ll) const -{ - wxULongLongWx res(*this); - res *= ll; - - return res; -} - -wxLongLongWx& wxLongLongWx::operator*=(const wxLongLongWx& ll) -{ - wxLongLongWx t(m_hi, m_lo); - wxLongLongWx q(ll.m_hi, ll.m_lo); - - m_hi = m_lo = 0; - -#ifdef wxLONGLONG_TEST_MODE - wxLongLong_t llOld = m_ll; - m_ll = 0; -#endif // wxLONGLONG_TEST_MODE - - int counter = 0; - do - { - if ((q.m_lo & 1) != 0) - *this += t; - q >>= 1; - t <<= 1; - counter++; - } - while ((counter < 64) && ((q.m_hi != 0) || (q.m_lo != 0))); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = llOld * ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator*=(const wxULongLongWx& ll) -{ - wxULongLongWx t(m_hi, m_lo); - wxULongLongWx q(ll.m_hi, ll.m_lo); - - m_hi = m_lo = 0; - -#ifdef wxLONGLONG_TEST_MODE - wxULongLong_t llOld = m_ll; - m_ll = 0; -#endif // wxLONGLONG_TEST_MODE - - int counter = 0; - do - { - if ((q.m_lo & 1) != 0) - *this += t; - q >>= 1; - t <<= 1; - counter++; - } - while ((counter < 64) && ((q.m_hi != 0) || (q.m_lo != 0))); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = llOld * ll.m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; -} - -// division - -#define IS_MSB_SET(ll) ((ll.GetHi()) & (1 << (8*sizeof(long) - 1))) - -void wxLongLongWx::Divide(const wxLongLongWx& divisorIn, - wxLongLongWx& quotient, - wxLongLongWx& remainderIO) const -{ - if ((divisorIn.m_lo == 0) && (divisorIn.m_hi == 0)) - { - // provoke division by zero error and silence the compilers warnings - // about an expression without effect and unused variable - long dummy = divisorIn.m_lo/divisorIn.m_hi; - dummy += 0; - } - - // VZ: I'm writing this in a hurry and it's surely not the fastest way to - // do this - any improvements are more than welcome - // - // code inspired by the snippet at - // http://www.bearcave.com/software/divide.htm - // - // Copyright notice: - // - // Use of this program, for any purpose, is granted the author, Ian - // Kaplan, as long as this copyright notice is included in the source - // code or any source code derived from this program. The user assumes - // all responsibility for using this code. - - // init everything - wxULongLongWx dividend, divisor, remainder; - - quotient = 0l; - remainder = 0l; - - // always do unsigned division and adjust the signs later: in C integer - // division, the sign of the remainder is the same as the sign of the - // dividend, while the sign of the quotient is the product of the signs of - // the dividend and divisor. Of course, we also always have - // - // dividend = quotient*divisor + remainder - // - // with 0 <= abs(remainder) < abs(divisor) - bool negRemainder = GetHi() < 0; - bool negQuotient = false; // assume positive - if ( GetHi() < 0 ) - { - negQuotient = !negQuotient; - dividend = -*this; - } else { - dividend = *this; - } - if ( divisorIn.GetHi() < 0 ) - { - negQuotient = !negQuotient; - divisor = -divisorIn; - } else { - divisor = divisorIn; - } - - // check for some particular cases - if ( divisor > dividend ) - { - remainder = dividend; - } - else if ( divisor == dividend ) - { - quotient = 1l; - } - else - { - // here: dividend > divisor and both are positive: do unsigned division - size_t nBits = 64u; - wxLongLongWx d; - - while ( remainder < divisor ) - { - remainder <<= 1; - if ( IS_MSB_SET(dividend) ) - { - remainder |= 1; - } - - d = dividend; - dividend <<= 1; - - nBits--; - } - - // undo the last loop iteration - dividend = d; - remainder >>= 1; - nBits++; - - for ( size_t i = 0; i < nBits; i++ ) - { - remainder <<= 1; - if ( IS_MSB_SET(dividend) ) - { - remainder |= 1; - } - - wxLongLongWx t = remainder - divisor; - dividend <<= 1; - quotient <<= 1; - if ( !IS_MSB_SET(t) ) - { - quotient |= 1; - - remainder = t; - } - } - } - - remainderIO = remainder; - - // adjust signs - if ( negRemainder ) - { - remainderIO = -remainderIO; - } - - if ( negQuotient ) - { - quotient = -quotient; - } -} - -void wxULongLongWx::Divide(const wxULongLongWx& divisorIn, - wxULongLongWx& quotient, - wxULongLongWx& remainder) const -{ - if ((divisorIn.m_lo == 0) && (divisorIn.m_hi == 0)) - { - // provoke division by zero error and silence the compilers warnings - // about an expression without effect and unused variable - unsigned long dummy = divisorIn.m_lo/divisorIn.m_hi; - dummy += 0; - } - - // VZ: I'm writing this in a hurry and it's surely not the fastest way to - // do this - any improvements are more than welcome - // - // code inspired by the snippet at - // http://www.bearcave.com/software/divide.htm - // - // Copyright notice: - // - // Use of this program, for any purpose, is granted the author, Ian - // Kaplan, as long as this copyright notice is included in the source - // code or any source code derived from this program. The user assumes - // all responsibility for using this code. - - // init everything - wxULongLongWx dividend = *this, - divisor = divisorIn; - - quotient = 0l; - remainder = 0l; - - // check for some particular cases - if ( divisor > dividend ) - { - remainder = dividend; - } - else if ( divisor == dividend ) - { - quotient = 1l; - } - else - { - // here: dividend > divisor - size_t nBits = 64u; - wxULongLongWx d; - - while ( remainder < divisor ) - { - remainder <<= 1; - if ( IS_MSB_SET(dividend) ) - { - remainder |= 1; - } - - d = dividend; - dividend <<= 1; - - nBits--; - } - - // undo the last loop iteration - dividend = d; - remainder >>= 1; - nBits++; - - for ( size_t i = 0; i < nBits; i++ ) - { - remainder <<= 1; - if ( IS_MSB_SET(dividend) ) - { - remainder |= 1; - } - - wxULongLongWx t = remainder - divisor; - dividend <<= 1; - quotient <<= 1; - if ( !IS_MSB_SET(t) ) - { - quotient |= 1; - - remainder = t; - } - } - } -} - -wxLongLongWx wxLongLongWx::operator/(const wxLongLongWx& ll) const -{ - wxLongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - return quotient; -} - -wxULongLongWx wxULongLongWx::operator/(const wxULongLongWx& ll) const -{ - wxULongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - return quotient; -} - -wxLongLongWx& wxLongLongWx::operator/=(const wxLongLongWx& ll) -{ - wxLongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - *this = quotient; - - return *this; -} - -wxULongLongWx& wxULongLongWx::operator/=(const wxULongLongWx& ll) -{ - wxULongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - *this = quotient; - - return *this; -} - -wxLongLongWx wxLongLongWx::operator%(const wxLongLongWx& ll) const -{ - wxLongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - return remainder; -} - -wxULongLongWx wxULongLongWx::operator%(const wxULongLongWx& ll) const -{ - wxULongLongWx quotient, remainder; - - Divide(ll, quotient, remainder); - - return remainder; -} - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -// temporary - just for testing -void *wxLongLongWx::asArray(void) const -{ - static unsigned char temp[8]; - - temp[0] = (char)((m_hi >> 24) & 0xFF); - temp[1] = (char)((m_hi >> 16) & 0xFF); - temp[2] = (char)((m_hi >> 8) & 0xFF); - temp[3] = (char)((m_hi >> 0) & 0xFF); - temp[4] = (char)((m_lo >> 24) & 0xFF); - temp[5] = (char)((m_lo >> 16) & 0xFF); - temp[6] = (char)((m_lo >> 8) & 0xFF); - temp[7] = (char)((m_lo >> 0) & 0xFF); - - return temp; -} - -void *wxULongLongWx::asArray(void) const -{ - static unsigned char temp[8]; - - temp[0] = (char)((m_hi >> 24) & 0xFF); - temp[1] = (char)((m_hi >> 16) & 0xFF); - temp[2] = (char)((m_hi >> 8) & 0xFF); - temp[3] = (char)((m_hi >> 0) & 0xFF); - temp[4] = (char)((m_lo >> 24) & 0xFF); - temp[5] = (char)((m_lo >> 16) & 0xFF); - temp[6] = (char)((m_lo >> 8) & 0xFF); - temp[7] = (char)((m_lo >> 0) & 0xFF); - - return temp; -} - -#endif // wxUSE_LONGLONG_WX - -#define LL_TO_STRING(name) \ - wxString name::ToString() const \ - { \ - /* TODO: this is awfully inefficient, anything better? */ \ - wxString result; \ - \ - name ll = *this; \ - \ - bool neg = ll < 0; \ - if ( neg ) \ - { \ - while ( ll != 0 ) \ - { \ - long digit = (ll % 10).ToLong(); \ - result.Prepend((wxChar)(_T('0') - digit)); \ - ll /= 10; \ - } \ - } \ - else \ - { \ - while ( ll != 0 ) \ - { \ - long digit = (ll % 10).ToLong(); \ - result.Prepend((wxChar)(_T('0') + digit)); \ - ll /= 10; \ - } \ - } \ - \ - if ( result.empty() ) \ - result = _T('0'); \ - else if ( neg ) \ - result.Prepend(_T('-')); \ - \ - return result; \ - } - -#define ULL_TO_STRING(name) \ - wxString name::ToString() const \ - { \ - /* TODO: this is awfully inefficient, anything better? */ \ - wxString result; \ - \ - name ll = *this; \ - \ - while ( ll != 0 ) \ - { \ - result.Prepend((wxChar)(_T('0') + (ll % 10).ToULong())); \ - ll /= 10; \ - } \ - \ - if ( result.empty() ) \ - result = _T('0'); \ - \ - return result; \ - } - -#if wxUSE_LONGLONG_NATIVE - LL_TO_STRING(wxLongLongNative) - ULL_TO_STRING(wxULongLongNative) -#endif - -#if wxUSE_LONGLONG_WX - LL_TO_STRING(wxLongLongWx) - ULL_TO_STRING(wxULongLongWx) -#endif - -#if wxUSE_STD_IOSTREAM - -// input/output -WXDLLIMPEXP_BASE -wxSTD ostream& operator<< (wxSTD ostream& o, const wxLongLong& ll) -{ - return o << ll.ToString(); -} - -WXDLLIMPEXP_BASE -wxSTD ostream& operator<< (wxSTD ostream& o, const wxULongLong& ll) -{ - return o << ll.ToString(); -} - -#endif // wxUSE_STD_IOSTREAM - -WXDLLIMPEXP_BASE wxString& operator<< (wxString& s, const wxLongLong& ll) -{ - return s << ll.ToString(); -} - -WXDLLIMPEXP_BASE wxString& operator<< (wxString& s, const wxULongLong& ll) -{ - return s << ll.ToString(); -} - -#if wxUSE_STREAMS - -WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wxULongLong& ll) -{ - return o << ll.ToString(); -} - -WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wxLongLong& ll) -{ - return o << ll.ToString(); -} - -#define READ_STRING_CHAR(s, idx, len) ((wxChar) ((idx!=len) ? s[idx++] : 0)) - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong &ll) -{ - wxString s = o.ReadWord(); - - ll = wxULongLong(0l, 0l); - size_t length = s.length(); - size_t idx = 0; - - wxChar ch = READ_STRING_CHAR(s, idx, length); - - // Skip WS - while (ch==wxT(' ') || ch==wxT('\t')) - ch = READ_STRING_CHAR(s, idx, length); - - // Read number - wxULongLong multiplier(0l, 10l); - while (ch>=wxT('0') && ch<=wxT('9')) { - long lValue = (unsigned) (ch - wxT('0')); - ll = ll * multiplier + wxULongLong(0l, lValue); - ch = READ_STRING_CHAR(s, idx, length); - } - - return o; -} - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxLongLong &ll) -{ - wxString s = o.ReadWord(); - - ll = wxLongLong(0l, 0l); - size_t length = s.length(); - size_t idx = 0; - - wxChar ch = READ_STRING_CHAR(s, idx, length); - - // Skip WS - while (ch==wxT(' ') || ch==wxT('\t')) - ch = READ_STRING_CHAR(s, idx, length); - - // Ask for sign - int iSign = 1; - if (ch==wxT('-') || ch==wxT('+')) { - iSign = ((ch==wxT('-')) ? -1 : 1); - ch = READ_STRING_CHAR(s, idx, length); - } - - // Read number - wxLongLong multiplier(0l, 10l); - while (ch>=wxT('0') && ch<=wxT('9')) { - long lValue = (unsigned) (ch - wxT('0')); - ll = ll * multiplier + wxLongLong(0l, lValue); - ch = READ_STRING_CHAR(s, idx, length); - } - -#if wxUSE_LONGLONG_NATIVE - ll = ll * wxLongLong((wxLongLong_t) iSign); -#else - ll = ll * wxLongLong((long) iSign); -#endif - - return o; -} - -#if wxUSE_LONGLONG_NATIVE - -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &o, wxULongLong_t value) -{ - return o << wxULongLong(value).ToString(); -} - -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &o, wxLongLong_t value) -{ - return o << wxLongLong(value).ToString(); -} - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong_t &value) -{ - wxULongLong ll; - o >> ll; - value = ll.GetValue(); - return o; -} - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxLongLong_t &value) -{ - wxLongLong ll; - o >> ll; - value = ll.GetValue(); - return o; -} - -#endif // wxUSE_LONGLONG_NATIVE - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LONGLONG diff --git a/Source/3rdParty/wx/src/common/matrix.cpp b/Source/3rdParty/wx/src/common/matrix.cpp deleted file mode 100644 index 4903aca39..000000000 --- a/Source/3rdParty/wx/src/common/matrix.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/matrix.cpp -// Purpose: wxTransformMatrix class -// Author: Chris Breeze, Julian Smart -// Modified by: Klaas Holwerda -// Created: 01/02/97 -// RCS-ID: $Id: matrix.cpp 39745 2006-06-15 17:58:49Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// Note: this is intended to be used in wxDC at some point to replace -// the current system of scaling/translation. It is not yet used. - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/matrix.h" - -#ifndef WX_PRECOMP - #include "wx/math.h" -#endif - -static const double pi = M_PI; - -wxTransformMatrix::wxTransformMatrix(void) -{ - m_isIdentity = false; - - Identity(); -} - -wxTransformMatrix::wxTransformMatrix(const wxTransformMatrix& mat) - : wxObject() -{ - (*this) = mat; -} - -double wxTransformMatrix::GetValue(int col, int row) const -{ - if (row < 0 || row > 2 || col < 0 || col > 2) - return 0.0; - - return m_matrix[col][row]; -} - -void wxTransformMatrix::SetValue(int col, int row, double value) -{ - if (row < 0 || row > 2 || col < 0 || col > 2) - return; - - m_matrix[col][row] = value; - m_isIdentity = IsIdentity1(); -} - -void wxTransformMatrix::operator = (const wxTransformMatrix& mat) -{ - int i, j; - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - m_matrix[i][j] = mat.m_matrix[i][j]; - } - } - m_isIdentity = mat.m_isIdentity; -} - -bool wxTransformMatrix::operator == (const wxTransformMatrix& mat) const -{ - if (m_isIdentity && mat.m_isIdentity) - return true; - - int i, j; - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - if ( !wxIsSameDouble(m_matrix[i][j], mat.m_matrix[i][j]) ) - return false; - } - } - return true; -} - -bool wxTransformMatrix::operator != (const wxTransformMatrix& mat) const -{ - return (! ((*this) == mat)); -} - -double& wxTransformMatrix::operator()(int col, int row) -{ - if (row < 0 || row > 2 || col < 0 || col > 2) - return m_matrix[0][0]; - - return m_matrix[col][row]; -} - -double wxTransformMatrix::operator()(int col, int row) const -{ - if (row < 0 || row > 2 || col < 0 || col > 2) - return 0.0; - - return m_matrix[col][row]; -} - -// Invert matrix -bool wxTransformMatrix::Invert(void) -{ - double inverseMatrix[3][3]; - - // calculate the adjoint - inverseMatrix[0][0] = wxCalculateDet(m_matrix[1][1],m_matrix[2][1],m_matrix[1][2],m_matrix[2][2]); - inverseMatrix[0][1] = -wxCalculateDet(m_matrix[0][1],m_matrix[2][1],m_matrix[0][2],m_matrix[2][2]); - inverseMatrix[0][2] = wxCalculateDet(m_matrix[0][1],m_matrix[1][1],m_matrix[0][2],m_matrix[1][2]); - - inverseMatrix[1][0] = -wxCalculateDet(m_matrix[1][0],m_matrix[2][0],m_matrix[1][2],m_matrix[2][2]); - inverseMatrix[1][1] = wxCalculateDet(m_matrix[0][0],m_matrix[2][0],m_matrix[0][2],m_matrix[2][2]); - inverseMatrix[1][2] = -wxCalculateDet(m_matrix[0][0],m_matrix[1][0],m_matrix[0][2],m_matrix[1][2]); - - inverseMatrix[2][0] = wxCalculateDet(m_matrix[1][0],m_matrix[2][0],m_matrix[1][1],m_matrix[2][1]); - inverseMatrix[2][1] = -wxCalculateDet(m_matrix[0][0],m_matrix[2][0],m_matrix[0][1],m_matrix[2][1]); - inverseMatrix[2][2] = wxCalculateDet(m_matrix[0][0],m_matrix[1][0],m_matrix[0][1],m_matrix[1][1]); - - // now divide by the determinant - double det = m_matrix[0][0] * inverseMatrix[0][0] + m_matrix[0][1] * inverseMatrix[1][0] + m_matrix[0][2] * inverseMatrix[2][0]; - if ( wxIsNullDouble(det) ) - return false; - - inverseMatrix[0][0] /= det; inverseMatrix[1][0] /= det; inverseMatrix[2][0] /= det; - inverseMatrix[0][1] /= det; inverseMatrix[1][1] /= det; inverseMatrix[2][1] /= det; - inverseMatrix[0][2] /= det; inverseMatrix[1][2] /= det; inverseMatrix[2][2] /= det; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - m_matrix[i][j] = inverseMatrix[i][j]; - } - } - m_isIdentity = IsIdentity1(); - return true; -} - -// Make into identity matrix -bool wxTransformMatrix::Identity(void) -{ - m_matrix[0][0] = m_matrix[1][1] = m_matrix[2][2] = 1.0; - m_matrix[1][0] = m_matrix[2][0] = m_matrix[0][1] = m_matrix[2][1] = m_matrix[0][2] = m_matrix[1][2] = 0.0; - m_isIdentity = true; - - return true; -} - -// Scale by scale (isotropic scaling i.e. the same in x and y): -// | scale 0 0 | -// matrix' = | 0 scale 0 | x matrix -// | 0 0 scale | -// -bool wxTransformMatrix::Scale(double scale) -{ - int i, j; - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - m_matrix[i][j] *= scale; - } - } - m_isIdentity = IsIdentity1(); - - return true; -} - - -// scale a matrix in 2D -// -// xs 0 xc(1-xs) -// 0 ys yc(1-ys) -// 0 0 1 -// -wxTransformMatrix& wxTransformMatrix::Scale(const double &xs, const double &ys,const double &xc, const double &yc) -{ - double r00,r10,r20,r01,r11,r21; - - if (m_isIdentity) - { - double tx = xc*(1-xs); - double ty = yc*(1-ys); - r00 = xs; - r10 = 0; - r20 = tx; - r01 = 0; - r11 = ys; - r21 = ty; - } - else if ( !wxIsNullDouble(xc) || !wxIsNullDouble(yc) ) - { - double tx = xc*(1-xs); - double ty = yc*(1-ys); - r00 = xs * m_matrix[0][0]; - r10 = xs * m_matrix[1][0]; - r20 = xs * m_matrix[2][0] + tx; - r01 = ys * m_matrix[0][1]; - r11 = ys * m_matrix[1][1]; - r21 = ys * m_matrix[2][1] + ty; - } - else - { - r00 = xs * m_matrix[0][0]; - r10 = xs * m_matrix[1][0]; - r20 = xs * m_matrix[2][0]; - r01 = ys * m_matrix[0][1]; - r11 = ys * m_matrix[1][1]; - r21 = ys * m_matrix[2][1]; - } - - m_matrix[0][0] = r00; - m_matrix[1][0] = r10; - m_matrix[2][0] = r20; - m_matrix[0][1] = r01; - m_matrix[1][1] = r11; - m_matrix[2][1] = r21; - -/* or like this - // first translate to origin O - (*this).Translate(-x_cen, -y_cen); - - // now do the scaling - wxTransformMatrix scale; - scale.m_matrix[0][0] = x_fac; - scale.m_matrix[1][1] = y_fac; - scale.m_isIdentity = IsIdentity1(); - - *this = scale * (*this); - - // translate back from origin to x_cen, y_cen - (*this).Translate(x_cen, y_cen); -*/ - - m_isIdentity = IsIdentity1(); - - return *this; -} - - -// mirror a matrix in x, y -// -// -1 0 0 Y-mirror -// 0 -1 0 X-mirror -// 0 0 -1 Z-mirror -wxTransformMatrix& wxTransformMatrix::Mirror(bool x, bool y) -{ - wxTransformMatrix temp; - if (x) - { - temp.m_matrix[1][1] = -1; - temp.m_isIdentity=false; - } - if (y) - { - temp.m_matrix[0][0] = -1; - temp.m_isIdentity=false; - } - - *this = temp * (*this); - m_isIdentity = IsIdentity1(); - return *this; -} - -// Translate by dx, dy: -// | 1 0 dx | -// matrix' = | 0 1 dy | x matrix -// | 0 0 1 | -// -bool wxTransformMatrix::Translate(double dx, double dy) -{ - int i; - for (i = 0; i < 3; i++) - m_matrix[i][0] += dx * m_matrix[i][2]; - for (i = 0; i < 3; i++) - m_matrix[i][1] += dy * m_matrix[i][2]; - - m_isIdentity = IsIdentity1(); - - return true; -} - -// Rotate clockwise by the given number of degrees: -// | cos sin 0 | -// matrix' = | -sin cos 0 | x matrix -// | 0 0 1 | -bool wxTransformMatrix::Rotate(double degrees) -{ - Rotate(-degrees,0,0); - return true; -} - -// counter clockwise rotate around a point -// -// cos(r) -sin(r) x(1-cos(r))+y(sin(r) -// sin(r) cos(r) y(1-cos(r))-x(sin(r) -// 0 0 1 -wxTransformMatrix& wxTransformMatrix::Rotate(const double °rees, const double &x, const double &y) -{ - double angle = degrees * pi / 180.0; - double c = cos(angle); - double s = sin(angle); - double r00,r10,r20,r01,r11,r21; - - if (m_isIdentity) - { - double tx = x*(1-c)+y*s; - double ty = y*(1-c)-x*s; - r00 = c ; - r10 = -s; - r20 = tx; - r01 = s; - r11 = c; - r21 = ty; - } - else if ( !wxIsNullDouble(x) || !wxIsNullDouble(y) ) - { - double tx = x*(1-c)+y*s; - double ty = y*(1-c)-x*s; - r00 = c * m_matrix[0][0] - s * m_matrix[0][1] + tx * m_matrix[0][2]; - r10 = c * m_matrix[1][0] - s * m_matrix[1][1] + tx * m_matrix[1][2]; - r20 = c * m_matrix[2][0] - s * m_matrix[2][1] + tx;// * m_matrix[2][2]; - r01 = c * m_matrix[0][1] + s * m_matrix[0][0] + ty * m_matrix[0][2]; - r11 = c * m_matrix[1][1] + s * m_matrix[1][0] + ty * m_matrix[1][2]; - r21 = c * m_matrix[2][1] + s * m_matrix[2][0] + ty;// * m_matrix[2][2]; - } - else - { - r00 = c * m_matrix[0][0] - s * m_matrix[0][1]; - r10 = c * m_matrix[1][0] - s * m_matrix[1][1]; - r20 = c * m_matrix[2][0] - s * m_matrix[2][1]; - r01 = c * m_matrix[0][1] + s * m_matrix[0][0]; - r11 = c * m_matrix[1][1] + s * m_matrix[1][0]; - r21 = c * m_matrix[2][1] + s * m_matrix[2][0]; - } - - m_matrix[0][0] = r00; - m_matrix[1][0] = r10; - m_matrix[2][0] = r20; - m_matrix[0][1] = r01; - m_matrix[1][1] = r11; - m_matrix[2][1] = r21; - -/* or like this - wxTransformMatrix rotate; - rotate.m_matrix[2][0] = tx; - rotate.m_matrix[2][1] = ty; - - rotate.m_matrix[0][0] = c; - rotate.m_matrix[0][1] = s; - - rotate.m_matrix[1][0] = -s; - rotate.m_matrix[1][1] = c; - - rotate.m_isIdentity=false; - *this = rotate * (*this); -*/ - m_isIdentity = IsIdentity1(); - - return *this; -} - -// Transform a point from logical to device coordinates -bool wxTransformMatrix::TransformPoint(double x, double y, double& tx, double& ty) const -{ - if (IsIdentity()) - { - tx = x; ty = y; return true; - } - - tx = x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0]; - ty = x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1]; - - return true; -} - -// Transform a point from device to logical coordinates. - -// Example of use: -// wxTransformMatrix mat = dc.GetTransformation(); -// mat.Invert(); -// mat.InverseTransformPoint(x, y, x1, y1); -// OR (shorthand:) -// dc.LogicalToDevice(x, y, x1, y1); -// The latter is slightly less efficient if we're doing several -// conversions, since the matrix is inverted several times. -bool wxTransformMatrix::InverseTransformPoint(double x, double y, double& tx, double& ty) const -{ - if (IsIdentity()) - { - tx = x; - ty = y; - return true; - } - - const double z = (1.0 - m_matrix[0][2] * x - m_matrix[1][2] * y) / m_matrix[2][2]; - if ( wxIsNullDouble(z) ) - return false; - - tx = x * m_matrix[0][0] + y * m_matrix[1][0] + z * m_matrix[2][0]; - ty = x * m_matrix[0][1] + y * m_matrix[1][1] + z * m_matrix[2][1]; - return true; -} - -wxTransformMatrix& wxTransformMatrix::operator*=(const double& t) -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - m_matrix[i][j]*= t; - m_isIdentity = IsIdentity1(); - return *this; -} - -wxTransformMatrix& wxTransformMatrix::operator/=(const double& t) -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - m_matrix[i][j]/= t; - m_isIdentity = IsIdentity1(); - return *this; -} - -wxTransformMatrix& wxTransformMatrix::operator+=(const wxTransformMatrix& mat) -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - m_matrix[i][j] += mat.m_matrix[i][j]; - m_isIdentity = IsIdentity1(); - return *this; -} - -wxTransformMatrix& wxTransformMatrix::operator-=(const wxTransformMatrix& mat) -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - m_matrix[i][j] -= mat.m_matrix[i][j]; - m_isIdentity = IsIdentity1(); - return *this; -} - -wxTransformMatrix& wxTransformMatrix::operator*=(const wxTransformMatrix& mat) -{ - - if (mat.m_isIdentity) - return *this; - if (m_isIdentity) - { - *this = mat; - return *this; - } - else - { - wxTransformMatrix result; - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - double sum = 0; - for (int k = 0; k < 3; k++) - sum += m_matrix[k][i] * mat.m_matrix[j][k]; - result.m_matrix[j][i] = sum; - } - } - *this = result; - } - - m_isIdentity = IsIdentity1(); - return *this; -} - - -// constant operators -wxTransformMatrix wxTransformMatrix::operator*(const double& t) const -{ - wxTransformMatrix result = *this; - result *= t; - result.m_isIdentity = result.IsIdentity1(); - return result; -} - -wxTransformMatrix wxTransformMatrix::operator/(const double& t) const -{ - wxTransformMatrix result = *this; -// wxASSERT(t!=0); - result /= t; - result.m_isIdentity = result.IsIdentity1(); - return result; -} - -wxTransformMatrix wxTransformMatrix::operator+(const wxTransformMatrix& m) const -{ - wxTransformMatrix result = *this; - result += m; - result.m_isIdentity = result.IsIdentity1(); - return result; -} - -wxTransformMatrix wxTransformMatrix::operator-(const wxTransformMatrix& m) const -{ - wxTransformMatrix result = *this; - result -= m; - result.m_isIdentity = result.IsIdentity1(); - return result; -} - - -wxTransformMatrix wxTransformMatrix::operator*(const wxTransformMatrix& m) const -{ - wxTransformMatrix result = *this; - result *= m; - result.m_isIdentity = result.IsIdentity1(); - return result; -} - - -wxTransformMatrix wxTransformMatrix::operator-() const -{ - wxTransformMatrix result = *this; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - result.m_matrix[i][j] = -(this->m_matrix[i][j]); - result.m_isIdentity = result.IsIdentity1(); - return result; -} - -static double CheckInt(double getal) -{ - // check if the number is very close to an integer - if ( (ceil(getal) - getal) < 0.0001) - return ceil(getal); - - else if ( (getal - floor(getal)) < 0.0001) - return floor(getal); - - return getal; - -} - -double wxTransformMatrix::Get_scaleX() -{ - double scale_factor; - double rot_angle = CheckInt(atan2(m_matrix[1][0],m_matrix[0][0])*180/pi); - if ( !wxIsSameDouble(rot_angle, 90) && !wxIsSameDouble(rot_angle, -90) ) - scale_factor = m_matrix[0][0]/cos((rot_angle/180)*pi); - else - scale_factor = m_matrix[0][0]/sin((rot_angle/180)*pi); // er kan nl. niet door 0 gedeeld worden ! - - scale_factor = CheckInt(scale_factor); - if (scale_factor < 0) - scale_factor = -scale_factor; - - return scale_factor; -} - -double wxTransformMatrix::Get_scaleY() -{ - double scale_factor; - double rot_angle = CheckInt(atan2(m_matrix[1][0],m_matrix[0][0])*180/pi); - if ( !wxIsSameDouble(rot_angle, 90) && !wxIsSameDouble(rot_angle, -90) ) - scale_factor = m_matrix[1][1]/cos((rot_angle/180)*pi); - else - scale_factor = m_matrix[1][1]/sin((rot_angle/180)*pi); // er kan nl. niet door 0 gedeeld worden ! - - scale_factor = CheckInt(scale_factor); - if (scale_factor < 0) - - scale_factor = -scale_factor; - - return scale_factor; - -} - -double wxTransformMatrix::GetRotation() -{ - double temp1 = GetValue(0,0); // for angle calculation - double temp2 = GetValue(0,1); // - - // Rotation - double rot_angle = atan2(temp2,temp1)*180/pi; - - rot_angle = CheckInt(rot_angle); - return rot_angle; -} - -void wxTransformMatrix::SetRotation(double rotation) -{ - double x=GetValue(2,0); - double y=GetValue(2,1); - Rotate(-GetRotation(), x, y); - Rotate(rotation, x, y); -} diff --git a/Source/3rdParty/wx/src/common/memory.cpp b/Source/3rdParty/wx/src/common/memory.cpp deleted file mode 100644 index e3a1d7866..000000000 --- a/Source/3rdParty/wx/src/common/memory.cpp +++ /dev/null @@ -1,1148 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/memory.cpp -// Purpose: Memory checking implementation -// Author: Arthur Seaton, Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: memory.cpp 41054 2006-09-07 19:01:45Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#include "wx/memory.h" - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/hash.h" - #include "wx/log.h" -#endif - -#if wxUSE_THREADS - #include "wx/thread.h" -#endif - -#include - -#include "wx/ioswrap.h" - -#if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) )\ - && !defined( __MWERKS__ ) && !defined(__SALFORDC__) -#include -#endif - -#include -#include - -#if wxUSE_THREADS && defined(__WXDEBUG__) -#define USE_THREADSAFE_MEMORY_ALLOCATION 1 -#else -#define USE_THREADSAFE_MEMORY_ALLOCATION 0 -#endif - - -#ifdef new -#undef new -#endif - -// wxDebugContext wxTheDebugContext; -/* - Redefine new and delete so that we can pick up situations where: - - we overwrite or underwrite areas of malloc'd memory. - - we use uninitialise variables - Only do this in debug mode. - - We change new to get enough memory to allocate a struct, followed - by the caller's requested memory, followed by a tag. The struct - is used to create a doubly linked list of these areas and also - contains another tag. The tags are used to determine when the area - has been over/under written. -*/ - - -/* - Values which are used to set the markers which will be tested for - under/over write. There are 3 of these, one in the struct, one - immediately after the struct but before the caller requested memory and - one immediately after the requested memory. -*/ -#define MemStartCheck 0x23A8 -#define MemMidCheck 0xA328 -#define MemEndCheck 0x8A32 -#define MemFillChar 0xAF -#define MemStructId 0x666D - -/* - External interface for the wxMemStruct class. Others are - defined inline within the class def. Here we only need to be able - to add and delete nodes from the list and handle errors in some way. -*/ - -/* - Used for internal "this shouldn't happen" type of errors. -*/ -void wxMemStruct::ErrorMsg (const char * mesg) -{ - wxLogMessage(wxT("wxWidgets memory checking error: %s"), mesg); - PrintNode (); -} - -/* - Used when we find an overwrite or an underwrite error. -*/ -void wxMemStruct::ErrorMsg () -{ - wxLogMessage(wxT("wxWidgets over/underwrite memory error:")); - PrintNode (); -} - - -/* - We want to find out if pointers have been overwritten as soon as is - possible, so test everything before we dereference it. Of course it's still - quite possible that, if things have been overwritten, this function will - fall over, but the only way of dealing with that would cost too much in terms - of time. -*/ -int wxMemStruct::AssertList () -{ - if (wxDebugContext::GetHead () != 0 && ! (wxDebugContext::GetHead ())->AssertIt () || - wxDebugContext::GetTail () != 0 && ! wxDebugContext::GetTail ()->AssertIt ()) { - ErrorMsg ("Head or tail pointers trashed"); - return 0; - } - return 1; -} - - -/* - Check that the thing we're pointing to has the correct id for a wxMemStruct - object and also that it's previous and next pointers are pointing at objects - which have valid ids. - This is definitely not perfect since we could fall over just trying to access - any of the slots which we use here, but I think it's about the best that I - can do without doing something like taking all new wxMemStruct pointers and - comparing them against all known pointer within the list and then only - doing this sort of check _after_ you've found the pointer in the list. That - would be safer, but also much more time consuming. -*/ -int wxMemStruct::AssertIt () -{ - return (m_id == MemStructId && - (m_prev == 0 || m_prev->m_id == MemStructId) && - (m_next == 0 || m_next->m_id == MemStructId)); -} - - -/* - Additions are always at the tail of the list. - Returns 0 on error, non-zero on success. -*/ -int wxMemStruct::Append () -{ - if (! AssertList ()) - return 0; - - if (wxDebugContext::GetHead () == 0) { - if (wxDebugContext::GetTail () != 0) { - ErrorMsg ("Null list should have a null tail pointer"); - return 0; - } - (void) wxDebugContext::SetHead (this); - (void) wxDebugContext::SetTail (this); - } else { - wxDebugContext::GetTail ()->m_next = this; - this->m_prev = wxDebugContext::GetTail (); - (void) wxDebugContext::SetTail (this); - } - return 1; -} - - -/* - Don't actually free up anything here as the space which is used - by the node will be free'd up when the whole block is free'd. - Returns 0 on error, non-zero on success. -*/ -int wxMemStruct::Unlink () -{ - if (! AssertList ()) - return 0; - - if (wxDebugContext::GetHead () == 0 || wxDebugContext::GetTail () == 0) { - ErrorMsg ("Trying to remove node from empty list"); - return 0; - } - - // Handle the part of the list before this node. - if (m_prev == 0) { - if (this != wxDebugContext::GetHead ()) { - ErrorMsg ("No previous node for non-head node"); - return 0; - } - (void) wxDebugContext::SetHead (m_next); - } else { - if (! m_prev->AssertIt ()) { - ErrorMsg ("Trashed previous pointer"); - return 0; - } - - if (m_prev->m_next != this) { - ErrorMsg ("List is inconsistent"); - return 0; - } - m_prev->m_next = m_next; - } - - // Handle the part of the list after this node. - if (m_next == 0) { - if (this != wxDebugContext::GetTail ()) { - ErrorMsg ("No next node for non-tail node"); - return 0; - } - (void) wxDebugContext::SetTail (m_prev); - } else { - if (! m_next->AssertIt ()) { - ErrorMsg ("Trashed next pointer"); - return 0; - } - - if (m_next->m_prev != this) { - ErrorMsg ("List is inconsistent"); - return 0; - } - m_next->m_prev = m_prev; - } - - return 1; -} - - - -/* - Checks a node and block of memory to see that the markers are still - intact. -*/ -int wxMemStruct::CheckBlock () -{ - int nFailures = 0; - - if (m_firstMarker != MemStartCheck) { - nFailures++; - ErrorMsg (); - } - - char * pointer = wxDebugContext::MidMarkerPos ((char *) this); - if (* (wxMarkerType *) pointer != MemMidCheck) { - nFailures++; - ErrorMsg (); - } - - pointer = wxDebugContext::EndMarkerPos ((char *) this, RequestSize ()); - if (* (wxMarkerType *) pointer != MemEndCheck) { - nFailures++; - ErrorMsg (); - } - - return nFailures; -} - - -/* - Check the list of nodes to see if they are all ok. -*/ -int wxMemStruct::CheckAllPrevious () -{ - int nFailures = 0; - - for (wxMemStruct * st = this->m_prev; st != 0; st = st->m_prev) { - if (st->AssertIt ()) - nFailures += st->CheckBlock (); - else - return -1; - } - - return nFailures; -} - - -/* - When we delete a node we set the id slot to a specific value and then test - against this to see if a nodes have been deleted previously. I don't - just set the entire memory to the fillChar because then I'd be overwriting - useful stuff like the vtbl which may be needed to output the error message - including the file name and line numbers. Without this info the whole point - of this class is lost! -*/ -void wxMemStruct::SetDeleted () -{ - m_id = MemFillChar; -} - -int wxMemStruct::IsDeleted () -{ - return (m_id == MemFillChar); -} - - -/* - Print out a single node. There are many far better ways of doing this - but this will suffice for now. -*/ -void wxMemStruct::PrintNode () -{ - if (m_isObject) - { - wxObject *obj = (wxObject *)m_actualData; - wxClassInfo *info = obj->GetClassInfo(); - - // Let's put this in standard form so IDEs can load the file at the appropriate - // line - wxString msg; - - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - if (info && info->GetClassName()) - msg += info->GetClassName(); - else - msg += wxT("object"); - - wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize()); - msg += msg2; - - wxLogMessage(msg); - } - else - { - wxString msg; - - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - msg += wxT("non-object data"); - wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d\n"), (long)GetActualData(), (int)RequestSize()); - msg += msg2; - - wxLogMessage(msg); - } -} - -void wxMemStruct::Dump () -{ - if (!ValidateNode()) return; - - if (m_isObject) - { - wxObject *obj = (wxObject *)m_actualData; - - wxString msg; - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - - /* TODO: We no longer have a stream (using wxLogDebug) so we can't dump it. - * Instead, do what wxObject::Dump does. - * What should we do long-term, eliminate Dumping? Or specify - * that MyClass::Dump should use wxLogDebug? Ugh. - obj->Dump(wxDebugContext::GetStream()); - */ - - if (obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) - msg += obj->GetClassInfo()->GetClassName(); - else - msg += wxT("unknown object class"); - - wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize()); - msg += msg2; - - wxDebugContext::OutputDumpLine(msg); - } - else - { - wxString msg; - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - wxString msg2; - msg2.Printf(wxT("non-object data at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize() ); - msg += msg2; - wxDebugContext::OutputDumpLine(msg); - } -} - - -/* - Validate a node. Check to see that the node is "clean" in the sense - that nothing has over/underwritten it etc. -*/ -int wxMemStruct::ValidateNode () -{ - char * startPointer = (char *) this; - if (!AssertIt ()) { - if (IsDeleted ()) - ErrorMsg ("Object already deleted"); - else { - // Can't use the error routines as we have no recognisable object. -#ifndef __WXGTK__ - wxLogMessage(wxT("Can't verify memory struct - all bets are off!")); -#endif - } - return 0; - } - -/* - int i; - for (i = 0; i < wxDebugContext::TotSize (requestSize ()); i++) - cout << startPointer [i]; - cout << endl; -*/ - if (Marker () != MemStartCheck) - ErrorMsg (); - if (* (wxMarkerType *) wxDebugContext::MidMarkerPos (startPointer) != MemMidCheck) - ErrorMsg (); - if (* (wxMarkerType *) wxDebugContext::EndMarkerPos (startPointer, - RequestSize ()) != - MemEndCheck) - ErrorMsg (); - - // Back to before the extra buffer and check that - // we can still read what we originally wrote. - if (Marker () != MemStartCheck || - * (wxMarkerType *) wxDebugContext::MidMarkerPos (startPointer) - != MemMidCheck || - * (wxMarkerType *) wxDebugContext::EndMarkerPos (startPointer, - RequestSize ()) != MemEndCheck) - { - ErrorMsg (); - return 0; - } - - return 1; -} - -/* - The wxDebugContext class. -*/ - -wxMemStruct *wxDebugContext::m_head = NULL; -wxMemStruct *wxDebugContext::m_tail = NULL; - -bool wxDebugContext::m_checkPrevious = false; -int wxDebugContext::debugLevel = 1; -bool wxDebugContext::debugOn = true; -wxMemStruct *wxDebugContext::checkPoint = NULL; - -// For faster alignment calculation -static wxMarkerType markerCalc[2]; -int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]); -int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1; - -wxDebugContext::wxDebugContext(void) -{ -} - -wxDebugContext::~wxDebugContext(void) -{ -} - -/* - Work out the positions of the markers by creating an array of 2 markers - and comparing the addresses of the 2 elements. Use this number as the - alignment for markers. -*/ -size_t wxDebugContext::CalcAlignment () -{ - wxMarkerType ar[2]; - return (char *) &ar[1] - (char *) &ar[0]; -} - - -char * wxDebugContext::StructPos (const char * buf) -{ - return (char *) buf; -} - -char * wxDebugContext::MidMarkerPos (const char * buf) -{ - return StructPos (buf) + PaddedSize (sizeof (wxMemStruct)); -} - -char * wxDebugContext::CallerMemPos (const char * buf) -{ - return MidMarkerPos (buf) + PaddedSize (sizeof(wxMarkerType)); -} - - -char * wxDebugContext::EndMarkerPos (const char * buf, const size_t size) -{ - return CallerMemPos (buf) + PaddedSize (size); -} - - -/* - Slightly different as this takes a pointer to the start of the caller - requested region and returns a pointer to the start of the buffer. - */ -char * wxDebugContext::StartPos (const char * caller) -{ - return ((char *) (caller - wxDebugContext::PaddedSize (sizeof(wxMarkerType)) - - wxDebugContext::PaddedSize (sizeof (wxMemStruct)))); -} - -/* - We may need padding between various parts of the allocated memory. - Given a size of memory, this returns the amount of memory which should - be allocated in order to allow for alignment of the following object. - - I don't know how portable this stuff is, but it seems to work for me at - the moment. It would be real nice if I knew more about this! - - // Note: this function is now obsolete (along with CalcAlignment) - // because the calculations are done statically, for greater speed. -*/ -size_t wxDebugContext::GetPadding (const size_t size) -{ - size_t pad = size % CalcAlignment (); - return (pad) ? sizeof(wxMarkerType) - pad : 0; -} - -size_t wxDebugContext::PaddedSize (const size_t size) -{ - // Added by Terry Farnham to replace - // slow GetPadding call. - int padb; - - padb = size & m_balignmask; - if(padb) - return(size + m_balign - padb); - else - return(size); -} - -/* - Returns the total amount of memory which we need to get from the system - in order to satisfy a caller request. This includes space for the struct - plus markers and the caller's memory as well. -*/ -size_t wxDebugContext::TotSize (const size_t reqSize) -{ - return (PaddedSize (sizeof (wxMemStruct)) + PaddedSize (reqSize) + - 2 * sizeof(wxMarkerType)); -} - - -/* - Traverse the list of nodes executing the given function on each node. -*/ -void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) -{ - if (!from) - from = wxDebugContext::GetHead (); - - wxMemStruct * st = NULL; - for (st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); -// if ((data != (void*)m_debugStream) && (data != (void*) m_streamBuf)) - if (data != (void*) wxLog::GetActiveTarget()) - { - (st->*func) (); - } - } -} - - -/* - Print out the list. - */ -bool wxDebugContext::PrintList (void) -{ -#ifdef __WXDEBUG__ - TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL)); - - return true; -#else - return false; -#endif -} - -bool wxDebugContext::Dump(void) -{ -#ifdef __WXDEBUG__ - { - wxChar* appName = (wxChar*) wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = WXSTRINGCAST appNameStr; - OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, WXSTRINGCAST wxNow() ); - } - else - { - OutputDumpLine( wxT("----- Memory dump -----") ); - } - } - - TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL)); - - OutputDumpLine(wxEmptyString); - OutputDumpLine(wxEmptyString); - - return true; -#else - return false; -#endif -} - -#ifdef __WXDEBUG__ -struct wxDebugStatsStruct -{ - long instanceCount; - long totalSize; - wxChar *instanceClass; - wxDebugStatsStruct *next; -}; - -static wxDebugStatsStruct *FindStatsStruct(wxDebugStatsStruct *st, wxChar *name) -{ - while (st) - { - if (wxStrcmp(st->instanceClass, name) == 0) - return st; - st = st->next; - } - return NULL; -} - -static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugStatsStruct *st) -{ - st->next = head; - return st; -} -#endif - -bool wxDebugContext::PrintStatistics(bool detailed) -{ -#ifdef __WXDEBUG__ - { - wxChar* appName = (wxChar*) wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = WXSTRINGCAST appNameStr; - OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, WXSTRINGCAST wxNow() ); - } - else - { - OutputDumpLine( wxT("----- Memory statistics -----") ); - } - } - - bool currentMode = GetDebugMode(); - SetDebugMode(false); - - long noNonObjectNodes = 0; - long noObjectNodes = 0; - long totalSize = 0; - - wxDebugStatsStruct *list = NULL; - - wxMemStruct *from = (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL ); - if (!from) - from = wxDebugContext::GetHead (); - - wxMemStruct *st; - for (st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); - if (detailed && (data != (void*) wxLog::GetActiveTarget())) - { - wxChar *className = (wxChar*) wxT("nonobject"); - if (st->m_isObject && st->GetActualData()) - { - wxObject *obj = (wxObject *)st->GetActualData(); - if (obj->GetClassInfo()->GetClassName()) - className = (wxChar*)obj->GetClassInfo()->GetClassName(); - } - wxDebugStatsStruct *stats = FindStatsStruct(list, className); - if (!stats) - { - stats = (wxDebugStatsStruct *)malloc(sizeof(wxDebugStatsStruct)); - stats->instanceClass = className; - stats->instanceCount = 0; - stats->totalSize = 0; - list = InsertStatsStruct(list, stats); - } - stats->instanceCount ++; - stats->totalSize += st->RequestSize(); - } - - if (data != (void*) wxLog::GetActiveTarget()) - { - totalSize += st->RequestSize(); - if (st->m_isObject) - noObjectNodes ++; - else - noNonObjectNodes ++; - } - } - - if (detailed) - { - while (list) - { - OutputDumpLine(wxT("%ld objects of class %s, total size %ld"), - list->instanceCount, list->instanceClass, list->totalSize); - wxDebugStatsStruct *old = list; - list = old->next; - free((char *)old); - } - OutputDumpLine(wxEmptyString); - } - - SetDebugMode(currentMode); - - OutputDumpLine(wxT("Number of object items: %ld"), noObjectNodes); - OutputDumpLine(wxT("Number of non-object items: %ld"), noNonObjectNodes); - OutputDumpLine(wxT("Total allocated size: %ld"), totalSize); - OutputDumpLine(wxEmptyString); - OutputDumpLine(wxEmptyString); - - return true; -#else - (void)detailed; - return false; -#endif -} - -bool wxDebugContext::PrintClasses(void) -{ - { - wxChar* appName = (wxChar*) wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = WXSTRINGCAST appNameStr; - wxLogMessage(wxT("----- Classes in %s -----"), appName); - } - } - - int n = 0; - wxHashTable::compatibility_iterator node; - wxClassInfo *info; - - wxClassInfo::sm_classTable->BeginFind(); - node = wxClassInfo::sm_classTable->Next(); - while (node) - { - info = (wxClassInfo *)node->GetData(); - if (info->GetClassName()) - { - wxString msg(info->GetClassName()); - msg += wxT(" "); - - if (info->GetBaseClassName1() && !info->GetBaseClassName2()) - { - msg += wxT("is a "); - msg += info->GetBaseClassName1(); - } - else if (info->GetBaseClassName1() && info->GetBaseClassName2()) - { - msg += wxT("is a "); - msg += info->GetBaseClassName1() ; - msg += wxT(", "); - msg += info->GetBaseClassName2() ; - } - if (info->GetConstructor()) - msg += wxT(": dynamic"); - - wxLogMessage(msg); - } - node = wxClassInfo::sm_classTable->Next(); - n ++; - } - wxLogMessage(wxEmptyString); - wxLogMessage(wxT("There are %d classes derived from wxObject."), n); - wxLogMessage(wxEmptyString); - wxLogMessage(wxEmptyString); - return true; -} - -void wxDebugContext::SetCheckpoint(bool all) -{ - if (all) - checkPoint = NULL; - else - checkPoint = m_tail; -} - -// Checks all nodes since checkpoint, or since start. -int wxDebugContext::Check(bool checkAll) -{ - int nFailures = 0; - - wxMemStruct *from = (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL ); - if (!from || checkAll) - from = wxDebugContext::GetHead (); - - for (wxMemStruct * st = from; st != 0; st = st->m_next) - { - if (st->AssertIt ()) - nFailures += st->CheckBlock (); - else - return -1; - } - - return nFailures; -} - -// Count the number of non-wxDebugContext-related objects -// that are outstanding -int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) -{ - int n = 0; - - wxMemStruct *from = NULL; - if (sinceCheckpoint && checkPoint) - from = checkPoint->m_next; - else - from = wxDebugContext::GetHead () ; - - for (wxMemStruct * st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); - if (data != (void*) wxLog::GetActiveTarget()) - n ++; - } - - return n ; -} - -// This function is used to output the dump -void wxDebugContext::OutputDumpLine(const wxChar *szFormat, ...) -{ - // a buffer of 2048 bytes should be long enough for a file name - // and a class name - wxChar buf[2048]; - int count; - va_list argptr; - va_start(argptr, szFormat); - buf[sizeof(buf)/sizeof(wxChar)-1] = _T('\0'); - - // keep 3 bytes for a \r\n\0 - count = wxVsnprintf(buf, sizeof(buf)/sizeof(wxChar)-3, szFormat, argptr); - - if ( count < 0 ) - count = sizeof(buf)/sizeof(wxChar)-3; - buf[count]=_T('\r'); - buf[count+1]=_T('\n'); - buf[count+2]=_T('\0'); - - wxMessageOutputDebug dbgout; - dbgout.Printf(buf); -} - - -#if USE_THREADSAFE_MEMORY_ALLOCATION -static bool memSectionOk = false; - -class MemoryCriticalSection : public wxCriticalSection -{ -public: - MemoryCriticalSection() { - memSectionOk = true; - } - ~MemoryCriticalSection() { - memSectionOk = false; - } -}; - -class MemoryCriticalSectionLocker -{ -public: - inline MemoryCriticalSectionLocker(wxCriticalSection& critsect) - : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); } - inline ~MemoryCriticalSectionLocker() { if(m_locked) m_critsect.Leave(); } - -private: - // no assignment operator nor copy ctor - MemoryCriticalSectionLocker(const MemoryCriticalSectionLocker&); - MemoryCriticalSectionLocker& operator=(const MemoryCriticalSectionLocker&); - - wxCriticalSection& m_critsect; - bool m_locked; -}; - -static MemoryCriticalSection memLocker; - -#endif // USE_THREADSAFE_MEMORY_ALLOCATION - - -#ifdef __WXDEBUG__ -#if !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) -#if wxUSE_GLOBAL_MEMORY_OPERATORS -void * operator new (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, false); -} - -void * operator new (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false); -} - -void operator delete (void * buf) -{ - wxDebugFree(buf, false); -} - -#if wxUSE_ARRAY_MEMORY_OPERATORS -void * operator new[] (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false, true); -} - -void * operator new[] (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, true); -} - -void operator delete[] (void * buf) -{ - wxDebugFree(buf, true); -} -#endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // wxUSE_GLOBAL_MEMORY_OPERATORS -#endif // !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) - -// TODO: store whether this is a vector or not. -void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) -{ -#if USE_THREADSAFE_MEMORY_ALLOCATION - MemoryCriticalSectionLocker lock(memLocker); -#endif - - // If not in debugging allocation mode, do the normal thing - // so we don't leave any trace of ourselves in the node list. - -#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) -// VA 3.0 still has trouble in here - return (void *)malloc(size); -#endif - if (!wxDebugContext::GetDebugMode()) - { - return (void *)malloc(size); - } - - int totSize = wxDebugContext::TotSize (size); - char * buf = (char *) malloc(totSize); - if (!buf) { - wxLogMessage(wxT("Call to malloc (%ld) failed."), (long)size); - return 0; - } - wxMemStruct * st = (wxMemStruct *)buf; - st->m_firstMarker = MemStartCheck; - st->m_reqSize = size; - st->m_fileName = fileName; - st->m_lineNum = lineNum; - st->m_id = MemStructId; - st->m_prev = 0; - st->m_next = 0; - st->m_isObject = isObject; - - // Errors from Append() shouldn't really happen - but just in case! - if (st->Append () == 0) { - st->ErrorMsg ("Trying to append new node"); - } - - if (wxDebugContext::GetCheckPrevious ()) { - if (st->CheckAllPrevious () < 0) { - st->ErrorMsg ("Checking previous nodes"); - } - } - - // Set up the extra markers at the middle and end. - char * ptr = wxDebugContext::MidMarkerPos (buf); - * (wxMarkerType *) ptr = MemMidCheck; - ptr = wxDebugContext::EndMarkerPos (buf, size); - * (wxMarkerType *) ptr = MemEndCheck; - - // pointer returned points to the start of the caller's - // usable area. - void *m_actualData = (void *) wxDebugContext::CallerMemPos (buf); - st->m_actualData = m_actualData; - - return m_actualData; -} - -// TODO: check whether was allocated as a vector -void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) -{ -#if USE_THREADSAFE_MEMORY_ALLOCATION - MemoryCriticalSectionLocker lock(memLocker); -#endif - - if (!buf) - return; - -#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) -// VA 3.0 still has trouble in here - free((char *)buf); -#endif - // If not in debugging allocation mode, do the normal thing - // so we don't leave any trace of ourselves in the node list. - if (!wxDebugContext::GetDebugMode()) - { - free((char *)buf); - return; - } - - // Points to the start of the entire allocated area. - char * startPointer = wxDebugContext::StartPos ((char *) buf); - // Find the struct and make sure that it's identifiable. - wxMemStruct * st = (wxMemStruct *) wxDebugContext::StructPos (startPointer); - - if (! st->ValidateNode ()) - return; - - // If this is the current checkpoint, we need to - // move the checkpoint back so it points to a valid - // node. - if (st == wxDebugContext::checkPoint) - wxDebugContext::checkPoint = wxDebugContext::checkPoint->m_prev; - - if (! st->Unlink ()) - { - st->ErrorMsg ("Unlinking deleted node"); - } - - // Now put in the fill char into the id slot and the caller requested - // memory locations. - st->SetDeleted (); - (void) memset (wxDebugContext::CallerMemPos (startPointer), MemFillChar, - st->RequestSize ()); - - free((char *)st); -} - -#endif // __WXDEBUG__ - -// Trace: send output to the current debugging stream -void wxTrace(const wxChar * ...) -{ -#if 1 - wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); -#else - va_list ap; - static wxChar buffer[512]; - - va_start(ap, fmt); - -#ifdef __WXMSW__ - wvsprintf(buffer,fmt,ap) ; -#else - vsprintf(buffer,fmt,ap) ; -#endif - - va_end(ap); - - if (wxDebugContext::HasStream()) - { - wxDebugContext::GetStream() << buffer; - wxDebugContext::GetStream().flush(); - } - else -#ifdef __WXMSW__ -#ifdef __WIN32__ - OutputDebugString((LPCTSTR)buffer) ; -#else - OutputDebugString((const char*) buffer) ; -#endif -#else - fprintf(stderr, buffer); -#endif -#endif -} - -// Trace with level -void wxTraceLevel(int, const wxChar * ...) -{ -#if 1 - wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); -#else - if (wxDebugContext::GetLevel() < level) - return; - - va_list ap; - static wxChar buffer[512]; - - va_start(ap, fmt); - -#ifdef __WXMSW__ - wxWvsprintf(buffer,fmt,ap) ; -#else - vsprintf(buffer,fmt,ap) ; -#endif - - va_end(ap); - - if (wxDebugContext::HasStream()) - { - wxDebugContext::GetStream() << buffer; - wxDebugContext::GetStream().flush(); - } - else -#ifdef __WXMSW__ -#ifdef __WIN32__ - OutputDebugString((LPCTSTR)buffer) ; -#else - OutputDebugString((const char*) buffer) ; -#endif -#else - fprintf(stderr, buffer); -#endif -#endif -} - -//---------------------------------------------------------------------------- -// Final cleanup after all global objects in all files have been destroyed -//---------------------------------------------------------------------------- - -// Don't set it to 0 by dynamic initialization -// Some compilers will really do the assignment later -// All global variables are initialized to 0 at the very beginning, and this is just fine. -int wxDebugContextDumpDelayCounter::sm_count; - -void wxDebugContextDumpDelayCounter::DoDump() -{ - if (wxDebugContext::CountObjectsLeft(true) > 0) - { - wxDebugContext::OutputDumpLine(wxT("There were memory leaks.\n")); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); - } -} - -// Even if there is nothing else, make sure that there is at -// least one cleanup counter object -static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_One; - -#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT diff --git a/Source/3rdParty/wx/src/common/menucmn.cpp b/Source/3rdParty/wx/src/common/menucmn.cpp deleted file mode 100644 index 145fe9b01..000000000 --- a/Source/3rdParty/wx/src/common/menucmn.cpp +++ /dev/null @@ -1,1173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/menucmn.cpp -// Purpose: wxMenu and wxMenuBar methods common to all ports -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.10.99 -// RCS-ID: $Id: menucmn.cpp 57852 2009-01-06 09:40:34Z SC $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_MENUS - -#include - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/menu.h" -#endif - -#include "wx/stockitem.h" - -// ---------------------------------------------------------------------------- -// template lists -// ---------------------------------------------------------------------------- - -#include "wx/listimpl.cpp" - -WX_DEFINE_LIST(wxMenuList) -WX_DEFINE_LIST(wxMenuItemList) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxAcceleratorEntry -// ---------------------------------------------------------------------------- - - -#if wxUSE_ACCEL - -static const struct wxKeyName -{ - wxKeyCode code; - const wxChar *name; -} wxKeyNames[] = -{ - { WXK_DELETE, wxTRANSLATE("DEL") }, - { WXK_DELETE, wxTRANSLATE("DELETE") }, - { WXK_BACK, wxTRANSLATE("BACK") }, - { WXK_INSERT, wxTRANSLATE("INS") }, - { WXK_INSERT, wxTRANSLATE("INSERT") }, - { WXK_RETURN, wxTRANSLATE("ENTER") }, - { WXK_RETURN, wxTRANSLATE("RETURN") }, - { WXK_PAGEUP, wxTRANSLATE("PGUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PGDN") }, - { WXK_LEFT, wxTRANSLATE("LEFT") }, - { WXK_RIGHT, wxTRANSLATE("RIGHT") }, - { WXK_UP, wxTRANSLATE("UP") }, - { WXK_DOWN, wxTRANSLATE("DOWN") }, - { WXK_HOME, wxTRANSLATE("HOME") }, - { WXK_END, wxTRANSLATE("END") }, - { WXK_SPACE, wxTRANSLATE("SPACE") }, - { WXK_TAB, wxTRANSLATE("TAB") }, - { WXK_ESCAPE, wxTRANSLATE("ESC") }, - { WXK_ESCAPE, wxTRANSLATE("ESCAPE") }, - { WXK_CANCEL, wxTRANSLATE("CANCEL") }, - { WXK_CLEAR, wxTRANSLATE("CLEAR") }, - { WXK_MENU, wxTRANSLATE("MENU") }, - { WXK_PAUSE, wxTRANSLATE("PAUSE") }, - { WXK_CAPITAL, wxTRANSLATE("CAPITAL") }, - { WXK_SELECT, wxTRANSLATE("SELECT") }, - { WXK_PRINT, wxTRANSLATE("PRINT") }, - { WXK_EXECUTE, wxTRANSLATE("EXECUTE") }, - { WXK_SNAPSHOT, wxTRANSLATE("SNAPSHOT") }, - { WXK_HELP, wxTRANSLATE("HELP") }, - { WXK_ADD, wxTRANSLATE("ADD") }, - { WXK_SEPARATOR, wxTRANSLATE("SEPARATOR") }, - { WXK_SUBTRACT, wxTRANSLATE("SUBTRACT") }, - { WXK_DECIMAL, wxTRANSLATE("DECIMAL") }, - { WXK_DIVIDE, wxTRANSLATE("DIVIDE") }, - { WXK_NUMLOCK, wxTRANSLATE("NUM_LOCK") }, - { WXK_SCROLL, wxTRANSLATE("SCROLL_LOCK") }, - { WXK_PAGEUP, wxTRANSLATE("PAGEUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PAGEDOWN") }, - { WXK_NUMPAD_SPACE, wxTRANSLATE("KP_SPACE") }, - { WXK_NUMPAD_TAB, wxTRANSLATE("KP_TAB") }, - { WXK_NUMPAD_ENTER, wxTRANSLATE("KP_ENTER") }, - { WXK_NUMPAD_HOME, wxTRANSLATE("KP_HOME") }, - { WXK_NUMPAD_LEFT, wxTRANSLATE("KP_LEFT") }, - { WXK_NUMPAD_UP, wxTRANSLATE("KP_UP") }, - { WXK_NUMPAD_RIGHT, wxTRANSLATE("KP_RIGHT") }, - { WXK_NUMPAD_DOWN, wxTRANSLATE("KP_DOWN") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PRIOR") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PAGEUP") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_NEXT") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_PAGEDOWN") }, - { WXK_NUMPAD_END, wxTRANSLATE("KP_END") }, - { WXK_NUMPAD_BEGIN, wxTRANSLATE("KP_BEGIN") }, - { WXK_NUMPAD_INSERT, wxTRANSLATE("KP_INSERT") }, - { WXK_NUMPAD_DELETE, wxTRANSLATE("KP_DELETE") }, - { WXK_NUMPAD_EQUAL, wxTRANSLATE("KP_EQUAL") }, - { WXK_NUMPAD_MULTIPLY, wxTRANSLATE("KP_MULTIPLY") }, - { WXK_NUMPAD_ADD, wxTRANSLATE("KP_ADD") }, - { WXK_NUMPAD_SEPARATOR, wxTRANSLATE("KP_SEPARATOR") }, - { WXK_NUMPAD_SUBTRACT, wxTRANSLATE("KP_SUBTRACT") }, - { WXK_NUMPAD_DECIMAL, wxTRANSLATE("KP_DECIMAL") }, - { WXK_NUMPAD_DIVIDE, wxTRANSLATE("KP_DIVIDE") }, - { WXK_WINDOWS_LEFT, wxTRANSLATE("WINDOWS_LEFT") }, - { WXK_WINDOWS_RIGHT, wxTRANSLATE("WINDOWS_RIGHT") }, - { WXK_WINDOWS_MENU, wxTRANSLATE("WINDOWS_MENU") }, - { WXK_COMMAND, wxTRANSLATE("COMMAND") }, -}; - -// return true if the 2 strings refer to the same accel -// -// as accels can be either translated or not, check for both possibilities and -// also compare case-insensitively as the key names case doesn't count -static inline bool CompareAccelString(const wxString& str, const wxChar *accel) -{ - return str.CmpNoCase(accel) == 0 -#if wxUSE_INTL - || str.CmpNoCase(wxGetTranslation(accel)) == 0 -#endif - ; -} - -// return prefixCode+number if the string is of the form "" and -// 0 if it isn't -// -// first and last parameter specify the valid domain for "number" part -static int - IsNumberedAccelKey(const wxString& str, - const wxChar *prefix, - wxKeyCode prefixCode, - unsigned first, - unsigned last) -{ - const size_t lenPrefix = wxStrlen(prefix); - if ( !CompareAccelString(str.Left(lenPrefix), prefix) ) - return 0; - - unsigned long num; - if ( !str.Mid(lenPrefix).ToULong(&num) ) - return 0; - - if ( num < first || num > last ) - { - // this must be a mistake, chances that this is a valid name of another - // key are vanishingly small - wxLogDebug(_T("Invalid key string \"%s\""), str.c_str()); - return 0; - } - - return prefixCode + num - first; -} - -/* static */ -bool -wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut) -{ - // the parser won't like trailing spaces - wxString label = text; - label.Trim(true); // the initial \t must be preserved so don't strip leading whitespaces - - // check for accelerators: they are given after '\t' - int posTab = label.Find(wxT('\t')); - if ( posTab == wxNOT_FOUND ) - { - return false; - } - - // parse the accelerator string - int accelFlags = wxACCEL_NORMAL; - wxString current; - for ( size_t n = (size_t)posTab + 1; n < label.length(); n++ ) - { - if ( (label[n] == '+') || (label[n] == '-') ) - { - // differentiate between a ctrl that will be translated to cmd on mac - // and an explicit xctrl that will not be translated and remains a ctrl - if ( CompareAccelString(current, wxTRANSLATE("ctrl")) ) - accelFlags |= wxACCEL_CMD; - else if ( CompareAccelString(current, wxTRANSLATE("xctrl")) ) - accelFlags |= wxACCEL_CTRL; - else if ( CompareAccelString(current, wxTRANSLATE("alt")) ) - accelFlags |= wxACCEL_ALT; - else if ( CompareAccelString(current, wxTRANSLATE("shift")) ) - accelFlags |= wxACCEL_SHIFT; - else // not a recognized modifier name - { - // we may have "Ctrl-+", for example, but we still want to - // catch typos like "Crtl-A" so only give the warning if we - // have something before the current '+' or '-', else take - // it as a literal symbol - if ( current.empty() ) - { - current += label[n]; - - // skip clearing it below - continue; - } - else - { - wxLogDebug(wxT("Unknown accel modifier: '%s'"), - current.c_str()); - } - } - - current.clear(); - } - else // not special character - { - current += (wxChar) wxTolower(label[n]); - } - } - - int keyCode; - const size_t len = current.length(); - switch ( len ) - { - case 0: - wxLogDebug(wxT("No accel key found, accel string ignored.")); - return false; - - case 1: - // it's just a letter - keyCode = current[0U]; - - // if the key is used with any modifiers, make it an uppercase one - // because Ctrl-A and Ctrl-a are the same; but keep it as is if it's - // used alone as 'a' and 'A' are different - if ( accelFlags != wxACCEL_NORMAL ) - keyCode = wxToupper(keyCode); - break; - - default: - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("F"), - WXK_F1, 1, 12); - if ( !keyCode ) - { - for ( size_t n = 0; n < WXSIZEOF(wxKeyNames); n++ ) - { - const wxKeyName& kn = wxKeyNames[n]; - if ( CompareAccelString(current, kn.name) ) - { - keyCode = kn.code; - break; - } - } - } - - if ( !keyCode ) - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("KP_"), - WXK_NUMPAD0, 0, 9); - if ( !keyCode ) - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("SPECIAL"), - WXK_SPECIAL1, 1, 20); - - if ( !keyCode ) - { - wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."), - current.c_str()); - return false; - } - } - - - wxASSERT_MSG( keyCode, _T("logic error: should have key code here") ); - - if ( flagsOut ) - *flagsOut = accelFlags; - if ( keyOut ) - *keyOut = keyCode; - - return true; -} - -/* static */ -wxAcceleratorEntry *wxAcceleratorEntry::Create(const wxString& str) -{ - int flags, - keyCode; - if ( !ParseAccel(str, &flags, &keyCode) ) - return NULL; - - return new wxAcceleratorEntry(flags, keyCode); -} - -bool wxAcceleratorEntry::FromString(const wxString& str) -{ - return ParseAccel(str, &m_flags, &m_keyCode); -} - -wxString wxAcceleratorEntry::ToString() const -{ - wxString text; - - int flags = GetFlags(); - if ( flags & wxACCEL_ALT ) - text += _("Alt-"); - if ( flags & wxACCEL_CMD ) - text += _("Ctrl-"); -#ifdef __WXMAC__ - if ( flags & wxACCEL_CTRL ) - text += _("XCtrl-"); -#endif - if ( flags & wxACCEL_SHIFT ) - text += _("Shift-"); - - const int code = GetKeyCode(); - - if ( code >= WXK_F1 && code <= WXK_F12 ) - text << _("F") << code - WXK_F1 + 1; - else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 ) - text << _("KP_") << code - WXK_NUMPAD0; - else if ( code >= WXK_SPECIAL1 && code <= WXK_SPECIAL20 ) - text << _("SPECIAL") << code - WXK_SPECIAL1 + 1; - else // check the named keys - { - size_t n; - for ( n = 0; n < WXSIZEOF(wxKeyNames); n++ ) - { - const wxKeyName& kn = wxKeyNames[n]; - if ( code == kn.code ) - { - text << wxGetTranslation(kn.name); - break; - } - } - - if ( n == WXSIZEOF(wxKeyNames) ) - { - // must be a simple key - if ( -#if !wxUSE_UNICODE - isascii(code) && -#endif // ANSI - wxIsalnum(code) ) - { - text << (wxChar)code; - } - else - { - wxFAIL_MSG( wxT("unknown keyboard accelerator code") ); - } - } - } - - return text; -} - -wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) -{ - return wxAcceleratorEntry::Create(label); -} - -#endif // wxUSE_ACCEL - - -// ---------------------------------------------------------------------------- -// wxMenuItem -// ---------------------------------------------------------------------------- - -wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, - int id, - const wxString& text, - const wxString& help, - wxItemKind kind, - wxMenu *subMenu) -{ - wxASSERT_MSG( parentMenu != NULL, wxT("menuitem should have a menu") ); - - m_parentMenu = parentMenu; - m_subMenu = subMenu; - m_isEnabled = true; - m_isChecked = false; - m_id = id; - m_kind = kind; - if (m_id == wxID_ANY) - m_id = wxNewId(); - if (m_id == wxID_SEPARATOR) - m_kind = wxITEM_SEPARATOR; - - SetText(text); - SetHelp(help); -} - -wxMenuItemBase::~wxMenuItemBase() -{ - delete m_subMenu; -} - -#if wxUSE_ACCEL - -wxAcceleratorEntry *wxMenuItemBase::GetAccel() const -{ - return wxAcceleratorEntry::Create(GetText()); -} - -void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel) -{ - wxString text = m_text.BeforeFirst(wxT('\t')); - if ( accel ) - { - text += wxT('\t'); - text += accel->ToString(); - } - - SetText(text); -} - -#endif // wxUSE_ACCEL - -void wxMenuItemBase::SetText(const wxString& str) -{ - m_text = str; - - if ( m_text.empty() && !IsSeparator() ) - { - wxASSERT_MSG( wxIsStockID(GetId()), - wxT("A non-stock menu item with an empty label?") ); - m_text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR | - wxSTOCK_WITH_MNEMONIC); - } -} - -void wxMenuItemBase::SetHelp(const wxString& str) -{ - m_help = str; - - if ( m_help.empty() && !IsSeparator() && wxIsStockID(GetId()) ) - { - // get a stock help string - m_help = wxGetStockHelpString(GetId()); - } -} - -wxString wxMenuItemBase::GetLabelText(const wxString& label) -{ - return GetLabelFromText(label); -} - -bool wxMenuBase::ms_locked = true; - -// ---------------------------------------------------------------------------- -// wxMenu ctor and dtor -// ---------------------------------------------------------------------------- - -void wxMenuBase::Init(long style) -{ - m_menuBar = (wxMenuBar *)NULL; - m_menuParent = (wxMenu *)NULL; - - m_invokingWindow = (wxWindow *)NULL; - m_style = style; - m_clientData = (void *)NULL; - m_eventHandler = this; -} - -wxMenuBase::~wxMenuBase() -{ - WX_CLEAR_LIST(wxMenuItemList, m_items); -} - -// ---------------------------------------------------------------------------- -// wxMenu item adding/removing -// ---------------------------------------------------------------------------- - -void wxMenuBase::AddSubMenu(wxMenu *submenu) -{ - wxCHECK_RET( submenu, _T("can't add a NULL submenu") ); - - submenu->SetParent((wxMenu *)this); -} - -wxMenuItem* wxMenuBase::DoAppend(wxMenuItem *item) -{ - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Append()") ); - - m_items.Append(item); - item->SetMenu((wxMenu*)this); - if ( item->IsSubMenu() ) - { - AddSubMenu(item->GetSubMenu()); - } - - return item; -} - -wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item) -{ - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") ); - - if ( pos == GetMenuItemCount() ) - { - return DoAppend(item); - } - else - { - wxCHECK_MSG( pos < GetMenuItemCount(), NULL, - wxT("invalid index in wxMenu::Insert") ); - - return DoInsert(pos, item); - } -} - -wxMenuItem* wxMenuBase::DoInsert(size_t pos, wxMenuItem *item) -{ - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert()") ); - - wxMenuItemList::compatibility_iterator node = m_items.Item(pos); - wxCHECK_MSG( node, NULL, wxT("invalid index in wxMenu::Insert()") ); - - m_items.Insert(node, item); - item->SetMenu((wxMenu*)this); - if ( item->IsSubMenu() ) - { - AddSubMenu(item->GetSubMenu()); - } - - return item; -} - -wxMenuItem *wxMenuBase::Remove(wxMenuItem *item) -{ - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Remove") ); - - return DoRemove(item); -} - -wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item) -{ - wxMenuItemList::compatibility_iterator node = m_items.Find(item); - - // if we get here, the item is valid or one of Remove() functions is broken - wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") ); - - // we detach the item, but we do delete the list node (i.e. don't call - // DetachNode() here!) - m_items.Erase(node); - - // item isn't attached to anything any more - item->SetMenu((wxMenu *)NULL); - wxMenu *submenu = item->GetSubMenu(); - if ( submenu ) - { - submenu->SetParent((wxMenu *)NULL); - if ( submenu->IsAttached() ) - submenu->Detach(); - } - - return item; -} - -bool wxMenuBase::Delete(wxMenuItem *item) -{ - wxCHECK_MSG( item, false, wxT("invalid item in wxMenu::Delete") ); - - return DoDelete(item); -} - -bool wxMenuBase::DoDelete(wxMenuItem *item) -{ - wxMenuItem *item2 = DoRemove(item); - wxCHECK_MSG( item2, false, wxT("failed to delete menu item") ); - - // don't delete the submenu - item2->SetSubMenu((wxMenu *)NULL); - - delete item2; - - return true; -} - -bool wxMenuBase::Destroy(wxMenuItem *item) -{ - wxCHECK_MSG( item, false, wxT("invalid item in wxMenu::Destroy") ); - - return DoDestroy(item); -} - -bool wxMenuBase::DoDestroy(wxMenuItem *item) -{ - wxMenuItem *item2 = DoRemove(item); - wxCHECK_MSG( item2, false, wxT("failed to delete menu item") ); - - delete item2; - - return true; -} - -// ---------------------------------------------------------------------------- -// wxMenu searching for items -// ---------------------------------------------------------------------------- - -// Finds the item id matching the given string, wxNOT_FOUND if not found. -int wxMenuBase::FindItem(const wxString& text) const -{ - wxString label = wxMenuItem::GetLabelFromText(text); - for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst(); - node; - node = node->GetNext() ) - { - wxMenuItem *item = node->GetData(); - if ( item->IsSubMenu() ) - { - int rc = item->GetSubMenu()->FindItem(label); - if ( rc != wxNOT_FOUND ) - return rc; - } - - // we execute this code for submenus as well to alllow finding them by - // name just like the ordinary items - if ( !item->IsSeparator() ) - { - if ( item->GetLabel() == label ) - return item->GetId(); - } - } - - return wxNOT_FOUND; -} - -// recursive search for item by id -wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const -{ - if ( itemMenu ) - *itemMenu = NULL; - - wxMenuItem *item = NULL; - for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst(); - node && !item; - node = node->GetNext() ) - { - item = node->GetData(); - - if ( item->GetId() == itemId ) - { - if ( itemMenu ) - *itemMenu = (wxMenu *)this; - } - else if ( item->IsSubMenu() ) - { - item = item->GetSubMenu()->FindItem(itemId, itemMenu); - } - else - { - // don't exit the loop - item = NULL; - } - } - - return item; -} - -// non recursive search -wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const -{ - wxMenuItem *item = (wxMenuItem *)NULL; - wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); - - size_t pos; - for ( pos = 0; node; pos++ ) - { - if ( node->GetData()->GetId() == id ) - { - item = node->GetData(); - - break; - } - - node = node->GetNext(); - } - - if ( ppos ) - { - *ppos = item ? pos : (size_t)wxNOT_FOUND; - } - - return item; -} - -// find by position -wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const -{ - wxCHECK_MSG( position < m_items.GetCount(), NULL, - _T("wxMenu::FindItemByPosition(): invalid menu index") ); - - return m_items.Item( position )->GetData(); -} - -// ---------------------------------------------------------------------------- -// wxMenu helpers used by derived classes -// ---------------------------------------------------------------------------- - -// Update a menu and all submenus recursively. source is the object that has -// the update event handlers defined for it. If NULL, the menu or associated -// window will be used. -void wxMenuBase::UpdateUI(wxEvtHandler* source) -{ - if (GetInvokingWindow()) - { - // Don't update menus if the parent - // frame is about to get deleted - wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() ); - if (tlw && wxPendingDelete.Member(tlw)) - return; - } - - if ( !source && GetInvokingWindow() ) - source = GetInvokingWindow()->GetEventHandler(); - if ( !source ) - source = GetEventHandler(); - if ( !source ) - source = this; - - wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); - while ( node ) - { - wxMenuItem* item = node->GetData(); - if ( !item->IsSeparator() ) - { - wxWindowID id = item->GetId(); - wxUpdateUIEvent event(id); - event.SetEventObject( source ); - - if ( source->ProcessEvent(event) ) - { - // if anything changed, update the changed attribute - if (event.GetSetText()) - SetLabel(id, event.GetText()); - if (event.GetSetChecked()) - Check(id, event.GetChecked()); - if (event.GetSetEnabled()) - Enable(id, event.GetEnabled()); - } - - // recurse to the submenus - if ( item->GetSubMenu() ) - item->GetSubMenu()->UpdateUI(source); - } - //else: item is a separator (which doesn't process update UI events) - - node = node->GetNext(); - } -} - -bool wxMenuBase::SendEvent(int id, int checked) -{ - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id); - event.SetEventObject(this); - event.SetInt(checked); - - bool processed = false; - - // Try the menu's event handler - // if ( !processed ) - { - wxEvtHandler *handler = GetEventHandler(); - if ( handler ) - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from (and up through the - // hierarchy) - if ( !processed ) - { - const wxMenuBase *menu = this; - while ( menu ) - { - wxWindow *win = menu->GetInvokingWindow(); - if ( win ) - { - processed = win->GetEventHandler()->ProcessEvent(event); - break; - } - - menu = menu->GetParent(); - } - } - - return processed; -} - -// ---------------------------------------------------------------------------- -// wxMenu attaching/detaching to/from menu bar -// ---------------------------------------------------------------------------- - -wxMenuBar* wxMenuBase::GetMenuBar() const -{ - if(GetParent()) - return GetParent()->GetMenuBar(); - return m_menuBar; -} - -void wxMenuBase::Attach(wxMenuBarBase *menubar) -{ - // use Detach() instead! - wxASSERT_MSG( menubar, _T("menu can't be attached to NULL menubar") ); - - // use IsAttached() to prevent this from happening - wxASSERT_MSG( !m_menuBar, _T("attaching menu twice?") ); - - m_menuBar = (wxMenuBar *)menubar; -} - -void wxMenuBase::Detach() -{ - // use IsAttached() to prevent this from happening - wxASSERT_MSG( m_menuBar, _T("detaching unattached menu?") ); - - m_menuBar = NULL; -} - -// ---------------------------------------------------------------------------- -// wxMenu functions forwarded to wxMenuItem -// ---------------------------------------------------------------------------- - -void wxMenuBase::Enable( int id, bool enable ) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenu::Enable: no such item") ); - - item->Enable(enable); -} - -bool wxMenuBase::IsEnabled( int id ) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, false, wxT("wxMenu::IsEnabled: no such item") ); - - return item->IsEnabled(); -} - -void wxMenuBase::Check( int id, bool enable ) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenu::Check: no such item") ); - - item->Check(enable); -} - -bool wxMenuBase::IsChecked( int id ) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, false, wxT("wxMenu::IsChecked: no such item") ); - - return item->IsChecked(); -} - -void wxMenuBase::SetLabel( int id, const wxString &label ) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenu::SetLabel: no such item") ); - - item->SetText(label); -} - -wxString wxMenuBase::GetLabel( int id ) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, wxEmptyString, wxT("wxMenu::GetLabel: no such item") ); - - return item->GetText(); -} - -void wxMenuBase::SetHelpString( int id, const wxString& helpString ) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenu::SetHelpString: no such item") ); - - item->SetHelp( helpString ); -} - -wxString wxMenuBase::GetHelpString( int id ) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, wxEmptyString, wxT("wxMenu::GetHelpString: no such item") ); - - return item->GetHelp(); -} - -// ---------------------------------------------------------------------------- -// wxMenuBarBase ctor and dtor -// ---------------------------------------------------------------------------- - -wxMenuBarBase::wxMenuBarBase() -{ - // not attached yet - m_menuBarFrame = NULL; -} - -wxMenuBarBase::~wxMenuBarBase() -{ - WX_CLEAR_LIST(wxMenuList, m_menus); -} - -// ---------------------------------------------------------------------------- -// wxMenuBar item access: the base class versions manage m_menus list, the -// derived class should reflect the changes in the real menubar -// ---------------------------------------------------------------------------- - -wxMenu *wxMenuBarBase::GetMenu(size_t pos) const -{ - wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::GetMenu()") ); - - return node->GetData(); -} - -bool wxMenuBarBase::Append(wxMenu *menu, const wxString& WXUNUSED(title)) -{ - wxCHECK_MSG( menu, false, wxT("can't append NULL menu") ); - - m_menus.Append(menu); - menu->Attach(this); - - return true; -} - -bool wxMenuBarBase::Insert(size_t pos, wxMenu *menu, - const wxString& title) -{ - if ( pos == m_menus.GetCount() ) - { - return wxMenuBarBase::Append(menu, title); - } - else // not at the end - { - wxCHECK_MSG( menu, false, wxT("can't insert NULL menu") ); - - wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, false, wxT("bad index in wxMenuBar::Insert()") ); - - m_menus.Insert(node, menu); - menu->Attach(this); - - return true; - } -} - -wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu, - const wxString& WXUNUSED(title)) -{ - wxCHECK_MSG( menu, NULL, wxT("can't insert NULL menu") ); - - wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Replace()") ); - - wxMenu *menuOld = node->GetData(); - node->SetData(menu); - - menu->Attach(this); - menuOld->Detach(); - - return menuOld; -} - -wxMenu *wxMenuBarBase::Remove(size_t pos) -{ - wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") ); - - wxMenu *menu = node->GetData(); - m_menus.Erase(node); - menu->Detach(); - - return menu; -} - -int wxMenuBarBase::FindMenu(const wxString& title) const -{ - wxString label = wxMenuItem::GetLabelFromText(title); - - size_t count = GetMenuCount(); - for ( size_t i = 0; i < count; i++ ) - { - wxString title2 = GetLabelTop(i); - if ( (title2 == title) || - (wxMenuItem::GetLabelFromText(title2) == label) ) - { - // found - return (int)i; - } - } - - return wxNOT_FOUND; - -} - -// ---------------------------------------------------------------------------- -// wxMenuBar attaching/detaching to/from the frame -// ---------------------------------------------------------------------------- - -void wxMenuBarBase::Attach(wxFrame *frame) -{ - wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") ); - - m_menuBarFrame = frame; -} - -void wxMenuBarBase::Detach() -{ - wxASSERT_MSG( IsAttached(), wxT("detaching unattached menubar") ); - - m_menuBarFrame = NULL; -} - -// ---------------------------------------------------------------------------- -// wxMenuBar searching for items -// ---------------------------------------------------------------------------- - -wxMenuItem *wxMenuBarBase::FindItem(int id, wxMenu **menu) const -{ - if ( menu ) - *menu = NULL; - - wxMenuItem *item = NULL; - size_t count = GetMenuCount(), i; - wxMenuList::const_iterator it; - for ( i = 0, it = m_menus.begin(); !item && (i < count); i++, it++ ) - { - item = (*it)->FindItem(id, menu); - } - - return item; -} - -int wxMenuBarBase::FindMenuItem(const wxString& menu, const wxString& item) const -{ - wxString label = wxMenuItem::GetLabelFromText(menu); - - int i = 0; - wxMenuList::compatibility_iterator node; - for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ ) - { - if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) ) - return node->GetData()->FindItem(item); - } - - return wxNOT_FOUND; -} - -// --------------------------------------------------------------------------- -// wxMenuBar functions forwarded to wxMenuItem -// --------------------------------------------------------------------------- - -void wxMenuBarBase::Enable(int id, bool enable) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("attempt to enable an item which doesn't exist") ); - - item->Enable(enable); -} - -void wxMenuBarBase::Check(int id, bool check) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("attempt to check an item which doesn't exist") ); - wxCHECK_RET( item->IsCheckable(), wxT("attempt to check an uncheckable item") ); - - item->Check(check); -} - -bool wxMenuBarBase::IsChecked(int id) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, false, wxT("wxMenuBar::IsChecked(): no such item") ); - - return item->IsChecked(); -} - -bool wxMenuBarBase::IsEnabled(int id) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, false, wxT("wxMenuBar::IsEnabled(): no such item") ); - - return item->IsEnabled(); -} - -void wxMenuBarBase::SetLabel(int id, const wxString& label) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenuBar::SetLabel(): no such item") ); - - item->SetText(label); -} - -wxString wxMenuBarBase::GetLabel(int id) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, wxEmptyString, - wxT("wxMenuBar::GetLabel(): no such item") ); - - return item->GetText(); -} - -void wxMenuBarBase::SetHelpString(int id, const wxString& helpString) -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_RET( item, wxT("wxMenuBar::SetHelpString(): no such item") ); - - item->SetHelp(helpString); -} - -wxString wxMenuBarBase::GetHelpString(int id) const -{ - wxMenuItem *item = FindItem(id); - - wxCHECK_MSG( item, wxEmptyString, - wxT("wxMenuBar::GetHelpString(): no such item") ); - - return item->GetHelp(); -} - -void wxMenuBarBase::UpdateMenus( void ) -{ - wxEvtHandler* source; - wxMenu* menu; - int nCount = GetMenuCount(); - for (int n = 0; n < nCount; n++) - { - menu = GetMenu( n ); - if (menu != NULL) - { - source = menu->GetEventHandler(); - if (source != NULL) - menu->UpdateUI( source ); - } - } -} - -// Get the text only, from the label -wxString wxMenuBarBase::GetMenuLabelText(size_t pos) const -{ - return wxMenuItem::GetLabelText(((wxMenuBar*)this)->GetMenuLabel(pos)); -} - - -#endif // wxUSE_MENUS diff --git a/Source/3rdParty/wx/src/common/mimecmn.cpp b/Source/3rdParty/wx/src/common/mimecmn.cpp deleted file mode 100644 index 8f914e347..000000000 --- a/Source/3rdParty/wx/src/common/mimecmn.cpp +++ /dev/null @@ -1,752 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/mimecmn.cpp -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 -// Created: 23.09.98 -// RCS-ID: $Id: mimecmn.cpp 47027 2007-06-29 18:23:39Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_MIMETYPE - -#include "wx/mimetype.h" - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/module.h" -#endif //WX_PRECOMP - -#include "wx/file.h" -#include "wx/iconloc.h" -#include "wx/confbase.h" - -// other standard headers -#include - -// implementation classes: -#if defined(__WXMSW__) - #include "wx/msw/mimetype.h" -#elif defined(__WXMAC__) - #include "wx/mac/mimetype.h" -#elif defined(__WXPM__) || defined (__EMX__) - #include "wx/os2/mimetype.h" - #undef __UNIX__ -#elif defined(__DOS__) - #include "wx/msdos/mimetype.h" -#else // Unix - #include "wx/unix/mimetype.h" -#endif - -// ============================================================================ -// common classes -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxMimeTypeCommands -// ---------------------------------------------------------------------------- - -void -wxMimeTypeCommands::AddOrReplaceVerb(const wxString& verb, const wxString& cmd) -{ - int n = m_verbs.Index(verb, false /* ignore case */); - if ( n == wxNOT_FOUND ) - { - m_verbs.Add(verb); - m_commands.Add(cmd); - } - else - { - m_commands[n] = cmd; - } -} - -wxString -wxMimeTypeCommands::GetCommandForVerb(const wxString& verb, size_t *idx) const -{ - wxString s; - - int n = m_verbs.Index(verb); - if ( n != wxNOT_FOUND ) - { - s = m_commands[(size_t)n]; - if ( idx ) - *idx = n; - } - else if ( idx ) - { - // different from any valid index - *idx = (size_t)-1; - } - - return s; -} - -wxString wxMimeTypeCommands::GetVerbCmd(size_t n) const -{ - return m_verbs[n] + wxT('=') + m_commands[n]; -} - -// ---------------------------------------------------------------------------- -// wxFileTypeInfo -// ---------------------------------------------------------------------------- - -wxFileTypeInfo::wxFileTypeInfo(const wxChar *mimeType, - const wxChar *openCmd, - const wxChar *printCmd, - const wxChar *desc, - ...) - : m_mimeType(mimeType), - m_openCmd(openCmd), - m_printCmd(printCmd), - m_desc(desc) -{ - va_list argptr; - va_start(argptr, desc); - - for ( ;; ) - { - // icc gives this warning in its own va_arg() macro, argh -#ifdef __INTELC__ - #pragma warning(push) - #pragma warning(disable: 1684) -#endif - - const wxChar *ext = va_arg(argptr, const wxChar *); - -#ifdef __INTELC__ - #pragma warning(pop) -#endif - if ( !ext ) - { - // NULL terminates the list - break; - } - - m_exts.Add(ext); - } - - va_end(argptr); -} - - -wxFileTypeInfo::wxFileTypeInfo(const wxArrayString& sArray) -{ - m_mimeType = sArray [0u]; - m_openCmd = sArray [1u]; - m_printCmd = sArray [2u]; - m_desc = sArray [3u]; - - size_t count = sArray.GetCount(); - for ( size_t i = 4; i < count; i++ ) - { - m_exts.Add(sArray[i]); - } -} - -#include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo) - -// ============================================================================ -// implementation of the wrapper classes -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxFileType -// ---------------------------------------------------------------------------- - -/* static */ -wxString wxFileType::ExpandCommand(const wxString& command, - const wxFileType::MessageParameters& params) -{ - bool hasFilename = false; - - wxString str; - for ( const wxChar *pc = command.c_str(); *pc != wxT('\0'); pc++ ) { - if ( *pc == wxT('%') ) { - switch ( *++pc ) { - case wxT('s'): - // '%s' expands into file name (quoted because it might - // contain spaces) - except if there are already quotes - // there because otherwise some programs may get confused - // by double double quotes -#if 0 - if ( *(pc - 2) == wxT('"') ) - str << params.GetFileName(); - else - str << wxT('"') << params.GetFileName() << wxT('"'); -#endif - str << params.GetFileName(); - hasFilename = true; - break; - - case wxT('t'): - // '%t' expands into MIME type (quote it too just to be - // consistent) - str << wxT('\'') << params.GetMimeType() << wxT('\''); - break; - - case wxT('{'): - { - const wxChar *pEnd = wxStrchr(pc, wxT('}')); - if ( pEnd == NULL ) { - wxString mimetype; - wxLogWarning(_("Unmatched '{' in an entry for mime type %s."), - params.GetMimeType().c_str()); - str << wxT("%{"); - } - else { - wxString param(pc + 1, pEnd - pc - 1); - str << wxT('\'') << params.GetParamValue(param) << wxT('\''); - pc = pEnd; - } - } - break; - - case wxT('n'): - case wxT('F'): - // TODO %n is the number of parts, %F is an array containing - // the names of temp files these parts were written to - // and their mime types. - break; - - default: - wxLogDebug(wxT("Unknown field %%%c in command '%s'."), - *pc, command.c_str()); - str << *pc; - } - } - else { - str << *pc; - } - } - - // metamail(1) man page states that if the mailcap entry doesn't have '%s' - // the program will accept the data on stdin so normally we should append - // "< %s" to the end of the command in such case, but not all commands - // behave like this, in particular a common test is 'test -n "$DISPLAY"' - // and appending "< %s" to this command makes the test fail... I don't - // know of the correct solution, try to guess what we have to do. - - // test now carried out on reading file so test should never get here - if ( !hasFilename && !str.empty() -#ifdef __UNIX__ - && !str.StartsWith(_T("test ")) -#endif // Unix - ) { - str << wxT(" < '") << params.GetFileName() << wxT('\''); - } - - return str; -} - -wxFileType::wxFileType(const wxFileTypeInfo& info) -{ - m_info = &info; - m_impl = NULL; -} - -wxFileType::wxFileType() -{ - m_info = NULL; - m_impl = new wxFileTypeImpl; -} - -wxFileType::~wxFileType() -{ - if ( m_impl ) - delete m_impl; -} - -bool wxFileType::GetExtensions(wxArrayString& extensions) -{ - if ( m_info ) - { - extensions = m_info->GetExtensions(); - return true; - } - - return m_impl->GetExtensions(extensions); -} - -bool wxFileType::GetMimeType(wxString *mimeType) const -{ - wxCHECK_MSG( mimeType, false, _T("invalid parameter in GetMimeType") ); - - if ( m_info ) - { - *mimeType = m_info->GetMimeType(); - - return true; - } - - return m_impl->GetMimeType(mimeType); -} - -bool wxFileType::GetMimeTypes(wxArrayString& mimeTypes) const -{ - if ( m_info ) - { - mimeTypes.Clear(); - mimeTypes.Add(m_info->GetMimeType()); - - return true; - } - - return m_impl->GetMimeTypes(mimeTypes); -} - -bool wxFileType::GetIcon(wxIconLocation *iconLoc) const -{ - if ( m_info ) - { - if ( iconLoc ) - { - iconLoc->SetFileName(m_info->GetIconFile()); -#ifdef __WXMSW__ - iconLoc->SetIndex(m_info->GetIconIndex()); -#endif // __WXMSW__ - } - - return true; - } - - return m_impl->GetIcon(iconLoc); -} - -bool -wxFileType::GetIcon(wxIconLocation *iconloc, - const MessageParameters& params) const -{ - if ( !GetIcon(iconloc) ) - { - return false; - } - - // we may have "%s" in the icon location string, at least under Windows, so - // expand this - if ( iconloc ) - { - iconloc->SetFileName(ExpandCommand(iconloc->GetFileName(), params)); - } - - return true; -} - -bool wxFileType::GetDescription(wxString *desc) const -{ - wxCHECK_MSG( desc, false, _T("invalid parameter in GetDescription") ); - - if ( m_info ) - { - *desc = m_info->GetDescription(); - - return true; - } - - return m_impl->GetDescription(desc); -} - -bool -wxFileType::GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const -{ - wxCHECK_MSG( openCmd, false, _T("invalid parameter in GetOpenCommand") ); - - if ( m_info ) - { - *openCmd = ExpandCommand(m_info->GetOpenCommand(), params); - - return true; - } - - return m_impl->GetOpenCommand(openCmd, params); -} - -wxString wxFileType::GetOpenCommand(const wxString& filename) const -{ - wxString cmd; - if ( !GetOpenCommand(&cmd, filename) ) - { - // return empty string to indicate an error - cmd.clear(); - } - - return cmd; -} - -bool -wxFileType::GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) const -{ - wxCHECK_MSG( printCmd, false, _T("invalid parameter in GetPrintCommand") ); - - if ( m_info ) - { - *printCmd = ExpandCommand(m_info->GetPrintCommand(), params); - - return true; - } - - return m_impl->GetPrintCommand(printCmd, params); -} - - -size_t wxFileType::GetAllCommands(wxArrayString *verbs, - wxArrayString *commands, - const wxFileType::MessageParameters& params) const -{ - if ( verbs ) - verbs->Clear(); - if ( commands ) - commands->Clear(); - -#if defined (__WXMSW__) || defined(__UNIX__) - return m_impl->GetAllCommands(verbs, commands, params); -#else // !__WXMSW__ || Unix - // we don't know how to retrieve all commands, so just try the 2 we know - // about - size_t count = 0; - wxString cmd; - if ( GetOpenCommand(&cmd, params) ) - { - if ( verbs ) - verbs->Add(_T("Open")); - if ( commands ) - commands->Add(cmd); - count++; - } - - if ( GetPrintCommand(&cmd, params) ) - { - if ( verbs ) - verbs->Add(_T("Print")); - if ( commands ) - commands->Add(cmd); - - count++; - } - - return count; -#endif // __WXMSW__/| __UNIX__ -} - -bool wxFileType::Unassociate() -{ -#if defined(__WXMSW__) - return m_impl->Unassociate(); -#elif defined(__UNIX__) - return m_impl->Unassociate(this); -#else - wxFAIL_MSG( _T("not implemented") ); // TODO - return false; -#endif -} - -bool wxFileType::SetCommand(const wxString& cmd, - const wxString& verb, - bool overwriteprompt) -{ -#if defined (__WXMSW__) || defined(__UNIX__) - return m_impl->SetCommand(cmd, verb, overwriteprompt); -#else - wxUnusedVar(cmd); - wxUnusedVar(verb); - wxUnusedVar(overwriteprompt); - wxFAIL_MSG(_T("not implemented")); - return false; -#endif -} - -bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) -{ - wxString sTmp = cmd; -#ifdef __WXMSW__ - // VZ: should we do this? - // chris elliott : only makes sense in MS windows - if ( sTmp.empty() ) - GetOpenCommand(&sTmp, wxFileType::MessageParameters(wxEmptyString, wxEmptyString)); -#endif - wxCHECK_MSG( !sTmp.empty(), false, _T("need the icon file") ); - -#if defined (__WXMSW__) || defined(__UNIX__) - return m_impl->SetDefaultIcon (cmd, index); -#else - wxUnusedVar(index); - wxFAIL_MSG(_T("not implemented")); - return false; -#endif -} - -// ---------------------------------------------------------------------------- -// wxMimeTypesManagerFactory -// ---------------------------------------------------------------------------- - -wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = NULL; - -/* static */ -void wxMimeTypesManagerFactory::Set(wxMimeTypesManagerFactory *factory) -{ - delete m_factory; - - m_factory = factory; -} - -/* static */ -wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::Get() -{ - if ( !m_factory ) - m_factory = new wxMimeTypesManagerFactory; - - return m_factory; -} - -wxMimeTypesManagerImpl *wxMimeTypesManagerFactory::CreateMimeTypesManagerImpl() -{ - return new wxMimeTypesManagerImpl; -} - -// ---------------------------------------------------------------------------- -// wxMimeTypesManager -// ---------------------------------------------------------------------------- - -void wxMimeTypesManager::EnsureImpl() -{ - if ( !m_impl ) - m_impl = wxMimeTypesManagerFactory::Get()->CreateMimeTypesManagerImpl(); -} - -bool wxMimeTypesManager::IsOfType(const wxString& mimeType, - const wxString& wildcard) -{ - wxASSERT_MSG( mimeType.Find(wxT('*')) == wxNOT_FOUND, - wxT("first MIME type can't contain wildcards") ); - - // all comparaisons are case insensitive (2nd arg of IsSameAs() is false) - if ( wildcard.BeforeFirst(wxT('/')). - IsSameAs(mimeType.BeforeFirst(wxT('/')), false) ) - { - wxString strSubtype = wildcard.AfterFirst(wxT('/')); - - if ( strSubtype == wxT("*") || - strSubtype.IsSameAs(mimeType.AfterFirst(wxT('/')), false) ) - { - // matches (either exactly or it's a wildcard) - return true; - } - } - - return false; -} - -wxMimeTypesManager::wxMimeTypesManager() -{ - m_impl = NULL; -} - -wxMimeTypesManager::~wxMimeTypesManager() -{ - if ( m_impl ) - delete m_impl; -} - -bool wxMimeTypesManager::Unassociate(wxFileType *ft) -{ - EnsureImpl(); - -#if defined(__UNIX__) && !defined(__CYGWIN__) && !defined(__WINE__) - return m_impl->Unassociate(ft); -#else - return ft->Unassociate(); -#endif -} - - -wxFileType * -wxMimeTypesManager::Associate(const wxFileTypeInfo& ftInfo) -{ - EnsureImpl(); - -#if defined(__WXMSW__) || defined(__UNIX__) - return m_impl->Associate(ftInfo); -#else // other platforms - wxUnusedVar(ftInfo); - wxFAIL_MSG( _T("not implemented") ); // TODO - return NULL; -#endif // platforms -} - -wxFileType * -wxMimeTypesManager::GetFileTypeFromExtension(const wxString& ext) -{ - EnsureImpl(); - - wxString::const_iterator i = ext.begin(); - const wxString::const_iterator end = ext.end(); - wxString extWithoutDot; - if ( i != end && *i == '.' ) - extWithoutDot.assign(++i, ext.end()); - else - extWithoutDot = ext; - - wxCHECK_MSG( !ext.empty(), NULL, _T("extension can't be empty") ); - - wxFileType *ft = m_impl->GetFileTypeFromExtension(extWithoutDot); - - if ( !ft ) { - // check the fallbacks - // - // TODO linear search is potentially slow, perhaps we should use a - // sorted array? - size_t count = m_fallbacks.GetCount(); - for ( size_t n = 0; n < count; n++ ) { - if ( m_fallbacks[n].GetExtensions().Index(ext) != wxNOT_FOUND ) { - ft = new wxFileType(m_fallbacks[n]); - - break; - } - } - } - - return ft; -} - -wxFileType * -wxMimeTypesManager::GetFileTypeFromMimeType(const wxString& mimeType) -{ - EnsureImpl(); - wxFileType *ft = m_impl->GetFileTypeFromMimeType(mimeType); - - if ( !ft ) { - // check the fallbacks - // - // TODO linear search is potentially slow, perhaps we should use a - // sorted array? - size_t count = m_fallbacks.GetCount(); - for ( size_t n = 0; n < count; n++ ) { - if ( wxMimeTypesManager::IsOfType(mimeType, - m_fallbacks[n].GetMimeType()) ) { - ft = new wxFileType(m_fallbacks[n]); - - break; - } - } - } - - return ft; -} - -bool wxMimeTypesManager::ReadMailcap(const wxString& filename, bool fallback) -{ - EnsureImpl(); - return m_impl->ReadMailcap(filename, fallback); -} - -bool wxMimeTypesManager::ReadMimeTypes(const wxString& filename) -{ - EnsureImpl(); - return m_impl->ReadMimeTypes(filename); -} - -void wxMimeTypesManager::AddFallbacks(const wxFileTypeInfo *filetypes) -{ - EnsureImpl(); - for ( const wxFileTypeInfo *ft = filetypes; ft && ft->IsValid(); ft++ ) { - AddFallback(*ft); - } -} - -size_t wxMimeTypesManager::EnumAllFileTypes(wxArrayString& mimetypes) -{ - EnsureImpl(); - size_t countAll = m_impl->EnumAllFileTypes(mimetypes); - - // add the fallback filetypes - size_t count = m_fallbacks.GetCount(); - for ( size_t n = 0; n < count; n++ ) { - if ( mimetypes.Index(m_fallbacks[n].GetMimeType()) == wxNOT_FOUND ) { - mimetypes.Add(m_fallbacks[n].GetMimeType()); - countAll++; - } - } - - return countAll; -} - -void wxMimeTypesManager::Initialize(int mcapStyle, - const wxString& sExtraDir) -{ -#if defined(__UNIX__) && !defined(__CYGWIN__) && !defined(__WINE__) - EnsureImpl(); - - m_impl->Initialize(mcapStyle, sExtraDir); -#else - (void)mcapStyle; - (void)sExtraDir; -#endif // Unix -} - -// and this function clears all the data from the manager -void wxMimeTypesManager::ClearData() -{ -#if defined(__UNIX__) && !defined(__CYGWIN__) && !defined(__WINE__) - EnsureImpl(); - - m_impl->ClearData(); -#endif // Unix -} - -// ---------------------------------------------------------------------------- -// global data and wxMimeTypeCmnModule -// ---------------------------------------------------------------------------- - -// private object -static wxMimeTypesManager gs_mimeTypesManager; - -// and public pointer -wxMimeTypesManager *wxTheMimeTypesManager = &gs_mimeTypesManager; - -class wxMimeTypeCmnModule: public wxModule -{ -public: - wxMimeTypeCmnModule() : wxModule() { } - - virtual bool OnInit() { return true; } - virtual void OnExit() - { - wxMimeTypesManagerFactory::Set(NULL); - - if ( gs_mimeTypesManager.m_impl != NULL ) - { - delete gs_mimeTypesManager.m_impl; - gs_mimeTypesManager.m_impl = NULL; - gs_mimeTypesManager.m_fallbacks.Clear(); - } - } - - DECLARE_DYNAMIC_CLASS(wxMimeTypeCmnModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxMimeTypeCmnModule, wxModule) - -#endif // wxUSE_MIMETYPE diff --git a/Source/3rdParty/wx/src/common/module.cpp b/Source/3rdParty/wx/src/common/module.cpp deleted file mode 100644 index d4d963b63..000000000 --- a/Source/3rdParty/wx/src/common/module.cpp +++ /dev/null @@ -1,202 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/module.cpp -// Purpose: Modules initialization/destruction -// Author: Wolfram Gloger/adapted by Guilhem Lavaux -// Modified by: -// Created: 04/11/98 -// RCS-ID: $Id: module.cpp 39677 2006-06-11 22:19:12Z VZ $ -// Copyright: (c) Wolfram Gloger and Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/module.h" - -#ifndef WX_PRECOMP - #include "wx/hash.h" - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#include "wx/listimpl.cpp" - -#define TRACE_MODULE _T("module") - -WX_DEFINE_LIST(wxModuleList) - -IMPLEMENT_CLASS(wxModule, wxObject) - -wxModuleList wxModule::m_modules; - -void wxModule::RegisterModule(wxModule* module) -{ - module->m_state = State_Registered; - m_modules.Append(module); -} - -void wxModule::UnregisterModule(wxModule* module) -{ - m_modules.DeleteObject(module); - delete module; -} - -// Collect up all module-derived classes, create an instance of each, -// and register them. -void wxModule::RegisterModules() -{ - wxHashTable::compatibility_iterator node; - wxClassInfo* classInfo; - - wxClassInfo::sm_classTable->BeginFind(); - node = wxClassInfo::sm_classTable->Next(); - while (node) - { - classInfo = (wxClassInfo *)node->GetData(); - if ( classInfo->IsKindOf(CLASSINFO(wxModule)) && - (classInfo != (& (wxModule::ms_classInfo))) ) - { - wxLogTrace(TRACE_MODULE, wxT("Registering module %s"), - classInfo->GetClassName()); - wxModule* module = (wxModule *)classInfo->CreateObject(); - RegisterModule(module); - } - node = wxClassInfo::sm_classTable->Next(); - } -} - -bool wxModule::DoInitializeModule(wxModule *module, - wxModuleList &initializedModules) -{ - if ( module->m_state == State_Initializing ) - { - wxLogError(_("Circular dependency involving module \"%s\" detected."), - module->GetClassInfo()->GetClassName()); - return false; - } - - module->m_state = State_Initializing; - - const wxArrayClassInfo& dependencies = module->m_dependencies; - - // satisfy module dependencies by loading them before the current module - for ( unsigned int i = 0; i < dependencies.size(); ++i ) - { - wxClassInfo * cinfo = dependencies[i]; - - // Check if the module is already initialized - wxModuleList::compatibility_iterator node; - for ( node = initializedModules.GetFirst(); node; node = node->GetNext() ) - { - if ( node->GetData()->GetClassInfo() == cinfo ) - break; - } - - if ( node ) - { - // this dependency is already initialized, nothing to do - continue; - } - - // find the module in the registered modules list - for ( node = m_modules.GetFirst(); node; node = node->GetNext() ) - { - wxModule *moduleDep = node->GetData(); - if ( moduleDep->GetClassInfo() == cinfo ) - { - if ( !DoInitializeModule(moduleDep, initializedModules ) ) - { - // failed to initialize a dependency, so fail this one too - return false; - } - - break; - } - } - - if ( !node ) - { - wxLogError(_("Dependency \"%s\" of module \"%s\" doesn't exist."), - cinfo->GetClassName(), - module->GetClassInfo()->GetClassName()); - return false; - } - } - - if ( !module->Init() ) - { - wxLogError(_("Module \"%s\" initialization failed"), - module->GetClassInfo()->GetClassName()); - return false; - } - - wxLogTrace(TRACE_MODULE, wxT("Module \"%s\" initialized"), - module->GetClassInfo()->GetClassName()); - - module->m_state = State_Initialized; - initializedModules.Append(module); - - return true; -} - -// Initialize user-defined modules -bool wxModule::InitializeModules() -{ - wxModuleList initializedModules; - - for ( wxModuleList::compatibility_iterator node = m_modules.GetFirst(); - node; - node = node->GetNext() ) - { - wxModule *module = node->GetData(); - - // the module could have been already initialized as dependency of - // another one - if ( module->m_state == State_Registered ) - { - if ( !DoInitializeModule( module, initializedModules ) ) - { - // failed to initialize all modules, so clean up the already - // initialized ones - DoCleanUpModules(initializedModules); - - return false; - } - } - } - - // remember the real initialisation order - m_modules = initializedModules; - - return true; -} - -// Clean up all currently initialized modules -void wxModule::DoCleanUpModules(const wxModuleList& modules) -{ - // cleanup user-defined modules in the reverse order compared to their - // initialization -- this ensures that dependencies are respected - for ( wxModuleList::compatibility_iterator node = modules.GetLast(); - node; - node = node->GetPrevious() ) - { - wxLogTrace(TRACE_MODULE, wxT("Cleanup module %s"), - node->GetData()->GetClassInfo()->GetClassName()); - - wxModule * module = node->GetData(); - - wxASSERT_MSG( module->m_state == State_Initialized, - _T("not initialized module being cleaned up") ); - - module->Exit(); - module->m_state = State_Registered; - } - - // clear all modules, even the non-initialized ones - WX_CLEAR_LIST(wxModuleList, m_modules); -} diff --git a/Source/3rdParty/wx/src/common/msgout.cpp b/Source/3rdParty/wx/src/common/msgout.cpp deleted file mode 100644 index ebeed13be..000000000 --- a/Source/3rdParty/wx/src/common/msgout.cpp +++ /dev/null @@ -1,222 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/msgout.cpp -// Purpose: wxMessageOutput implementation -// Author: Mattia Barbon -// Modified by: -// Created: 17.07.02 -// RCS-ID: $Id: msgout.cpp 38920 2006-04-26 08:21:31Z ABX $ -// Copyright: (c) the wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/ffile.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/log.h" - #if wxUSE_GUI - #include "wx/msgdlg.h" - #endif // wxUSE_GUI -#endif - -#include "wx/msgout.h" -#include "wx/apptrait.h" -#include -#include - -#if defined(__WINDOWS__) - #include "wx/msw/private.h" -#endif -#ifdef __WXMAC__ - #include "wx/mac/private.h" -#endif - -// =========================================================================== -// implementation -// =========================================================================== - -#if wxUSE_BASE - -// ---------------------------------------------------------------------------- -// wxMessageOutput -// ---------------------------------------------------------------------------- - -wxMessageOutput* wxMessageOutput::ms_msgOut = 0; - -wxMessageOutput* wxMessageOutput::Get() -{ - if ( !ms_msgOut && wxTheApp ) - { - ms_msgOut = wxTheApp->GetTraits()->CreateMessageOutput(); - } - - return ms_msgOut; -} - -wxMessageOutput* wxMessageOutput::Set(wxMessageOutput* msgout) -{ - wxMessageOutput* old = ms_msgOut; - ms_msgOut = msgout; - return old; -} - -// ---------------------------------------------------------------------------- -// wxMessageOutputBest -// ---------------------------------------------------------------------------- - -#ifdef __WINDOWS__ - -// check if we're running in a console under Windows -static inline bool IsInConsole() -{ -#ifdef __WXWINCE__ - return false; -#else // !__WXWINCE__ - HANDLE hStdErr = ::GetStdHandle(STD_ERROR_HANDLE); - return hStdErr && hStdErr != INVALID_HANDLE_VALUE; -#endif // __WXWINCE__/!__WXWINCE__ -} - -#endif // __WINDOWS__ - -void wxMessageOutputBest::Printf(const wxChar* format, ...) -{ - va_list args; - va_start(args, format); - wxString out; - - out.PrintfV(format, args); - va_end(args); - -#ifdef __WINDOWS__ - if ( !IsInConsole() ) - { - ::MessageBox(NULL, out, _T("wxWidgets"), MB_ICONINFORMATION | MB_OK); - } - else -#endif // __WINDOWS__/!__WINDOWS__ - { - fprintf(stderr, "%s", (const char*) out.mb_str()); - } -} - -// ---------------------------------------------------------------------------- -// wxMessageOutputStderr -// ---------------------------------------------------------------------------- - -void wxMessageOutputStderr::Printf(const wxChar* format, ...) -{ - va_list args; - va_start(args, format); - wxString out; - - out.PrintfV(format, args); - va_end(args); - - fprintf(stderr, "%s", (const char*) out.mb_str()); -} - -// ---------------------------------------------------------------------------- -// wxMessageOutputDebug -// ---------------------------------------------------------------------------- - -void wxMessageOutputDebug::Printf(const wxChar* format, ...) -{ - wxString out; - - va_list args; - va_start(args, format); - - out.PrintfV(format, args); - va_end(args); - -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) - out.Replace(wxT("\t"), wxT(" ")); - out.Replace(wxT("\n"), wxT("\r\n")); - ::OutputDebugString(out); -#elif defined(__WXMAC__) && !defined(__DARWIN__) - if ( wxIsDebuggerRunning() ) - { - Str255 pstr; - wxString output = out + wxT(";g") ; - wxMacStringToPascal(output.c_str(), pstr); - - #ifdef __powerc - DebugStr(pstr); - #else - SysBreakStr(pstr); - #endif - } -#else - wxFputs( out , stderr ) ; - if ( out.Right(1) != wxT("\n") ) - wxFputs( wxT("\n") , stderr ) ; - fflush( stderr ) ; -#endif // platform -} - -// ---------------------------------------------------------------------------- -// wxMessageOutputLog -// ---------------------------------------------------------------------------- - -void wxMessageOutputLog::Printf(const wxChar* format, ...) -{ - wxString out; - - va_list args; - va_start(args, format); - - out.PrintfV(format, args); - va_end(args); - - out.Replace(wxT("\t"), wxT(" ")); - - ::wxLogMessage(wxT("%s"), out.c_str()); -} - -#endif // wxUSE_BASE - -// ---------------------------------------------------------------------------- -// wxMessageOutputMessageBox -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -void wxMessageOutputMessageBox::Printf(const wxChar* format, ...) -{ - va_list args; - va_start(args, format); - wxString out; - - out.PrintfV(format, args); - va_end(args); - - // the native MSW msg box understands the TABs, others don't -#ifndef __WXMSW__ - out.Replace(wxT("\t"), wxT(" ")); -#endif - - wxString title; - if ( wxTheApp ) - title.Printf(_("%s message"), wxTheApp->GetAppName().c_str()); - - ::wxMessageBox(out, title); -} - -#endif // wxUSE_GUI diff --git a/Source/3rdParty/wx/src/common/mstream.cpp b/Source/3rdParty/wx/src/common/mstream.cpp deleted file mode 100644 index cbefd2a7c..000000000 --- a/Source/3rdParty/wx/src/common/mstream.cpp +++ /dev/null @@ -1,174 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/mstream.cpp -// Purpose: "Memory stream" classes -// Author: Guilhem Lavaux -// Modified by: VZ (23.11.00): general code review -// Created: 04/01/98 -// RCS-ID: $Id: mstream.cpp 39001 2006-05-03 21:50:35Z ABX $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/mstream.h" - -#ifndef WX_PRECOMP - #include "wx/stream.h" -#endif //WX_PRECOMP - -#include - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxMemoryInputStream -// ---------------------------------------------------------------------------- - -wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len) -{ - m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read); - m_i_streambuf->SetBufferIO((void *)data, len); // const_cast - m_i_streambuf->SetIntPosition(0); // seek to start pos - m_i_streambuf->Fixed(true); - - m_length = len; -} - -wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream) -{ - const wxFileOffset lenFile = stream.GetLength(); - if ( lenFile == wxInvalidOffset ) - { - m_i_streambuf = NULL; - m_lasterror = wxSTREAM_EOF; - return; - } - - const size_t len = wx_truncate_cast(size_t, lenFile); - wxASSERT_MSG( len == lenFile + size_t(0), _T("huge files not supported") ); - - m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read); - m_i_streambuf->SetBufferIO(len); // create buffer - stream.CopyTo(m_i_streambuf->GetBufferStart(), len); - m_i_streambuf->SetIntPosition(0); // seek to start pos - m_i_streambuf->Fixed(true); - m_length = len; -} - -wxMemoryInputStream::~wxMemoryInputStream() -{ - delete m_i_streambuf; -} - -char wxMemoryInputStream::Peek() -{ - char *buf = (char *)m_i_streambuf->GetBufferStart(); - size_t pos = m_i_streambuf->GetIntPosition(); - if ( pos == m_length ) - { - m_lasterror = wxSTREAM_READ_ERROR; - - return 0; - } - - return buf[pos]; -} - -size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes) -{ - size_t pos = m_i_streambuf->GetIntPosition(); - if ( pos == m_length ) - { - m_lasterror = wxSTREAM_EOF; - - return 0; - } - - m_i_streambuf->Read(buffer, nbytes); - m_lasterror = wxSTREAM_NO_ERROR; - - return m_i_streambuf->GetIntPosition() - pos; -} - -wxFileOffset wxMemoryInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_i_streambuf->Seek(pos, mode); -} - -wxFileOffset wxMemoryInputStream::OnSysTell() const -{ - return m_i_streambuf->Tell(); -} - -// ---------------------------------------------------------------------------- -// wxMemoryOutputStream -// ---------------------------------------------------------------------------- - -wxMemoryOutputStream::wxMemoryOutputStream(void *data, size_t len) -{ - m_o_streambuf = new wxStreamBuffer(wxStreamBuffer::write); - if ( data ) - m_o_streambuf->SetBufferIO(data, len); - m_o_streambuf->Fixed(false); - m_o_streambuf->Flushable(false); -} - -wxMemoryOutputStream::~wxMemoryOutputStream() -{ - delete m_o_streambuf; -} - -size_t wxMemoryOutputStream::OnSysWrite(const void *buffer, size_t nbytes) -{ - size_t oldpos = m_o_streambuf->GetIntPosition(); - m_o_streambuf->Write(buffer, nbytes); - size_t newpos = m_o_streambuf->GetIntPosition(); - - // FIXME can someone please explain what this does? (VZ) - if ( !newpos ) - newpos = m_o_streambuf->GetBufferSize(); - - return newpos - oldpos; -} - -wxFileOffset wxMemoryOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_o_streambuf->Seek(pos, mode); -} - -wxFileOffset wxMemoryOutputStream::OnSysTell() const -{ - return m_o_streambuf->Tell(); -} - -size_t wxMemoryOutputStream::CopyTo(void *buffer, size_t len) const -{ - wxCHECK_MSG( buffer, 0, _T("must have buffer to CopyTo") ); - - if ( len > GetSize() ) - len = GetSize(); - - memcpy(buffer, m_o_streambuf->GetBufferStart(), len); - - return len; -} - -#endif // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/nbkbase.cpp b/Source/3rdParty/wx/src/common/nbkbase.cpp deleted file mode 100644 index 011f53e16..000000000 --- a/Source/3rdParty/wx/src/common/nbkbase.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/nbkbase.cpp -// Purpose: common wxNotebook methods -// Author: Vadim Zeitlin -// Modified by: -// Created: 02.07.01 -// RCS-ID: $Id: nbkbase.cpp 41764 2006-10-08 23:41:52Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_NOTEBOOK - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/notebook.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const -{ - // this is, of course, totally bogus -- but we must do something by - // default because not all ports implement this - wxSize sizeTotal = sizePage; - - if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) ) - { - sizeTotal.x += 90; - sizeTotal.y += 10; - } - else // tabs on top/bottom side - { - sizeTotal.x += 10; - sizeTotal.y += 40; - } - - return sizeTotal; -} - -// ---------------------------------------------------------------------------- -// events -// ---------------------------------------------------------------------------- - -bool wxNotebookBase::SendPageChangingEvent(int nPage) -{ - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId()); - event.SetSelection(nPage); - event.SetOldSelection(GetSelection()); - event.SetEventObject(this); - return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed(); -} - -void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew) -{ - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId()); - event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew); - event.SetOldSelection(nPageOld); - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); -} - -#endif // wxUSE_NOTEBOOK diff --git a/Source/3rdParty/wx/src/common/object.cpp b/Source/3rdParty/wx/src/common/object.cpp deleted file mode 100644 index 24eddcde7..000000000 --- a/Source/3rdParty/wx/src/common/object.cpp +++ /dev/null @@ -1,390 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/object.cpp -// Purpose: wxObject implementation -// Author: Julian Smart -// Modified by: Ron Lee -// Created: 04/01/98 -// RCS-ID: $Id: object.cpp 56500 2008-10-23 14:48:31Z MW $ -// Copyright: (c) 1998 Julian Smart -// (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/hash.h" - #include "wx/memory.h" -#endif - -#include - -#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT - #if defined(__VISAGECPP__) - #define DEBUG_PRINTF(NAME) { static int raz=0; \ - printf( #NAME " %i\n",raz); fflush(stdout); raz++; } - #else - #define DEBUG_PRINTF(NAME) - #endif -#endif // __WXDEBUG__ || wxUSE_DEBUG_CONTEXT - -// we must disable optimizations for VC.NET because otherwise its too eager -// linker discards wxClassInfo objects in release build thus breaking many, -// many things -#if defined __VISUALC__ && __VISUALC__ >= 1300 - #pragma optimize("", off) -#endif - -#if wxUSE_EXTENDED_RTTI -const wxClassInfo* wxObject::ms_classParents[] = { NULL } ; - wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data ) -{ return data.wxTEMPLATED_MEMBER_CALL(Get , wxObject*) ; } - wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data ) -{ return &data.wxTEMPLATED_MEMBER_CALL(Get , wxObject) ; } - wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data ) - { return wxxVariant( dynamic_cast (data) ) ; } - wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"), - (int) sizeof(wxObject), \ - (wxObjectConstructorFn) 0 , - (wxPropertyInfo*) NULL,(wxHandlerInfo*) NULL,0 , 0 , - 0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject); - template<> void wxStringReadValue(const wxString & , wxObject * & ){assert(0) ;} - template<> void wxStringWriteValue(wxString & , wxObject* const & ){assert(0) ;} - template<> void wxStringReadValue(const wxString & , wxObject & ){assert(0) ;} - template<> void wxStringWriteValue(wxString & , wxObject const & ){assert(0) ;} - wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ; - wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ; -#else -wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), 0, 0, - (int) sizeof(wxObject), - (wxObjectConstructorFn) 0 ); -#endif - -// restore optimizations -#if defined __VISUALC__ && __VISUALC__ >= 1300 - #pragma optimize("", on) -#endif - -wxClassInfo* wxClassInfo::sm_first = NULL; -wxHashTable* wxClassInfo::sm_classTable = NULL; - -// when using XTI, this method is already implemented inline inside -// DECLARE_DYNAMIC_CLASS but otherwise we intentionally make this function -// non-inline because this allows us to have a non-inline virtual function in -// all wx classes and this solves linking problems for HP-UX native toolchain -// and possibly others (we could make dtor non-inline as well but it's more -// useful to keep it inline than this function) -#if !wxUSE_EXTENDED_RTTI - -wxClassInfo *wxObject::GetClassInfo() const -{ - return &wxObject::ms_classInfo; -} - -#endif // wxUSE_EXTENDED_RTTI - -// this variable exists only so that we can avoid 'always true/false' warnings -const bool wxFalse = false; - -// Is this object a kind of (a subclass of) 'info'? -// E.g. is wxWindow a kind of wxObject? -// Go from this class to superclass, taking into account -// two possible base classes. -bool wxObject::IsKindOf(wxClassInfo *info) const -{ - wxClassInfo *thisInfo = GetClassInfo(); - return (thisInfo) ? thisInfo->IsKindOf(info) : false ; -} - -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING && defined( new ) - #undef new -#endif - - -#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new ( size_t size, const wxChar *fileName, int lineNum ) -{ - return wxDebugAlloc(size, (wxChar*) fileName, lineNum, true); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID -void wxObject::operator delete ( void *buf ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET -void wxObject::operator delete ( void *buf, const char *_fname, size_t _line ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete ( void *buf, const wxChar *WXUNUSED(fileName), int WXUNUSED(lineNum) ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new[] ( size_t size, const wxChar* fileName, int lineNum ) -{ - return wxDebugAlloc(size, (wxChar*) fileName, lineNum, true, true); -} -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID -void wxObject::operator delete[] ( void *buf ) -{ - wxDebugFree(buf, true); -} -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete[] (void * buf, const wxChar* WXUNUSED(fileName), int WXUNUSED(lineNum) ) -{ - wxDebugFree(buf, true); -} -#endif - - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -wxClassInfo::~wxClassInfo() -{ - // remove this object from the linked list of all class infos: if we don't - // do it, loading/unloading a DLL containing static wxClassInfo objects is - // not going to work - if ( this == sm_first ) - { - sm_first = m_next; - } - else - { - wxClassInfo *info = sm_first; - while (info) - { - if ( info->m_next == this ) - { - info->m_next = m_next; - break; - } - - info = info->m_next; - } - } - Unregister(); -} - -wxClassInfo *wxClassInfo::FindClass(const wxChar *className) -{ - if ( sm_classTable ) - { - return (wxClassInfo *)wxClassInfo::sm_classTable->Get(className); - } - else - { - for ( wxClassInfo *info = sm_first; info ; info = info->m_next ) - { - if ( wxStrcmp(info->GetClassName(), className) == 0 ) - return info; - } - - return NULL; - } -} - -// Reentrance can occur on some platforms (Solaris for one), as the use of hash -// and string objects can cause other modules to load and register classes -// before the original call returns. This is handled by keeping the hash table -// local when it is first created and only assigning it to the global variable -// when the function is ready to return. -// -// That does make the assumption that after the function has completed the -// first time the problem will no longer happen; all the modules it depends on -// will have been loaded. The assumption is checked using the 'entry' variable -// as a reentrance guard, it checks that once the hash table is global it is -// not accessed multiple times simulateously. - -void wxClassInfo::Register() -{ -#ifdef __WXDEBUG__ - // reentrance guard - see note above - static int entry = 0; -#endif - - wxHashTable *classTable; - - if ( !sm_classTable ) - { - // keep the hash local initially, reentrance is possible - classTable = new wxHashTable(wxKEY_STRING); - } - else - { - // guard againt reentrance once the global has been created - wxASSERT_MSG(++entry == 1, _T("wxClassInfo::Register() reentrance")); - classTable = sm_classTable; - } - - // Using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you - // link any object module twice mistakenly, or link twice against wx shared - // library) will break this function because it will enter an infinite loop - // and eventually die with "out of memory" - as this is quite hard to - // detect if you're unaware of this, try to do some checks here. - wxASSERT_MSG( classTable->Get(m_className) == NULL, - wxString::Format - ( - _T("Class \"%s\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"), - m_className - ) - ); - - classTable->Put(m_className, (wxObject *)this); - - // if we're using a local hash we need to try to make it global - if ( sm_classTable != classTable ) - { - if ( !sm_classTable ) - { - // make the hash global - sm_classTable = classTable; - } - else - { - // the gobal hash has already been created by a reentrant call, - // so delete the local hash and try again - delete classTable; - Register(); - } - } - -#ifdef __WXDEBUG__ - entry = 0; -#endif -} - -void wxClassInfo::Unregister() -{ - if ( sm_classTable ) - { - sm_classTable->Delete(m_className); - if ( sm_classTable->GetCount() == 0 ) - { - delete sm_classTable; - sm_classTable = NULL; - } - } -} - -wxObject *wxCreateDynamicObject(const wxChar *name) -{ -#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT - DEBUG_PRINTF(wxObject *wxCreateDynamicObject) -#endif - - if ( wxClassInfo::sm_classTable ) - { - wxClassInfo *info = (wxClassInfo *)wxClassInfo::sm_classTable->Get(name); - return info ? info->CreateObject() : NULL; - } - else // no sm_classTable yet - { - for ( wxClassInfo *info = wxClassInfo::sm_first; - info; - info = info->m_next ) - { - if (info->m_className && wxStrcmp(info->m_className, name) == 0) - return info->CreateObject(); - } - - return NULL; - } -} - - -// ---------------------------------------------------------------------------- -// wxObject -// ---------------------------------------------------------------------------- - -void wxObject::Ref(const wxObject& clone) -{ -#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT - DEBUG_PRINTF(wxObject::Ref) -#endif - - // nothing to be done - if (m_refData == clone.m_refData) - return; - - // delete reference to old data - UnRef(); - - // reference new data - if ( clone.m_refData ) - { - m_refData = clone.m_refData; - ++(m_refData->m_count); - } -} - -void wxObject::UnRef() -{ - if ( m_refData ) - { - wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") ); - - if ( --m_refData->m_count == 0 ) - delete m_refData; - m_refData = NULL; - } -} - -void wxObject::AllocExclusive() -{ - if ( !m_refData ) - { - m_refData = CreateRefData(); - } - else if ( m_refData->GetRefCount() > 1 ) - { - // note that ref is not going to be destroyed in this case - const wxObjectRefData* ref = m_refData; - UnRef(); - - // ... so we can still access it - m_refData = CloneRefData(ref); - } - //else: ref count is 1, we are exclusive owners of m_refData anyhow - - wxASSERT_MSG( m_refData && m_refData->GetRefCount() == 1, - _T("wxObject::AllocExclusive() failed.") ); -} - -wxObjectRefData *wxObject::CreateRefData() const -{ - // if you use AllocExclusive() you must override this method - wxFAIL_MSG( _T("CreateRefData() must be overridden if called!") ); - - return NULL; -} - -wxObjectRefData * -wxObject::CloneRefData(const wxObjectRefData * WXUNUSED(data)) const -{ - // if you use AllocExclusive() you must override this method - wxFAIL_MSG( _T("CloneRefData() must be overridden if called!") ); - - return NULL; -} diff --git a/Source/3rdParty/wx/src/common/overlaycmn.cpp b/Source/3rdParty/wx/src/common/overlaycmn.cpp deleted file mode 100644 index 7867edb0e..000000000 --- a/Source/3rdParty/wx/src/common/overlaycmn.cpp +++ /dev/null @@ -1,197 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/overlaycmn.cpp -// Purpose: common wxOverlay code -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// RCS-ID: $Id: overlaycmn.cpp 42397 2006-10-25 12:12:56Z VS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/overlay.h" -#include "wx/private/overlay.h" -#include "wx/dcclient.h" -#include "wx/dcmemory.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxOverlay -// ---------------------------------------------------------------------------- - -wxOverlay::wxOverlay() -{ - m_impl = new wxOverlayImpl(); - m_inDrawing = false; -} - -wxOverlay::~wxOverlay() -{ - delete m_impl; -} - -bool wxOverlay::IsOk() -{ - return m_impl->IsOk(); -} - -void wxOverlay::Init( wxWindowDC* dc, int x , int y , int width , int height ) -{ - m_impl->Init(dc, x, y, width, height); -} - -void wxOverlay::BeginDrawing( wxWindowDC* dc) -{ - m_impl->BeginDrawing(dc); - m_inDrawing = true ; -} - -void wxOverlay::EndDrawing( wxWindowDC* dc) -{ - m_impl->EndDrawing(dc); - m_inDrawing = false ; -} - -void wxOverlay::Clear( wxWindowDC* dc) -{ - m_impl->Clear(dc); -} - -void wxOverlay::Reset() -{ - wxASSERT_MSG(m_inDrawing==false,wxT("cannot reset overlay during drawing")); - m_impl->Reset(); -} - - -// ---------------------------------------------------------------------------- -// wxDCOverlay -// ---------------------------------------------------------------------------- - -wxDCOverlay::wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc, int x , int y , int width , int height) : - m_overlay(overlay) -{ - Init(dc, x, y, width, height); -} - -wxDCOverlay::wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc) : - m_overlay(overlay) -{ - int width; - int height; - dc->GetSize(&width,&height); - Init(dc, 0, 0, width, height); -} - -wxDCOverlay::~wxDCOverlay() -{ - m_overlay.EndDrawing(m_dc); -} - -void wxDCOverlay::Init(wxWindowDC *dc, int x , int y , int width , int height ) -{ - m_dc = dc ; - if ( !m_overlay.IsOk() ) - { - m_overlay.Init(dc,x,y,width,height); - } - m_overlay.BeginDrawing(dc); -} - -void wxDCOverlay::Clear() -{ - m_overlay.Clear(m_dc); -} - -// ---------------------------------------------------------------------------- -// generic implementation of wxOverlayImpl -// ---------------------------------------------------------------------------- - -#ifndef wxHAS_NATIVE_OVERLAY - -wxOverlayImpl::wxOverlayImpl() -{ -#if defined(__WXGTK__) || defined(__WXMSW__) - m_window = NULL ; -#endif - m_x = m_y = m_width = m_height = 0 ; -} - -wxOverlayImpl::~wxOverlayImpl() -{ -} - -bool wxOverlayImpl::IsOk() -{ - return m_bmpSaved.Ok() ; -} - -void wxOverlayImpl::Init( wxWindowDC* dc, int x , int y , int width , int height ) -{ -#if defined(__WXGTK__) - m_window = dc->m_owner; -#else - #if defined (__WXMSW__) - m_window = dc->GetWindow(); - #endif // __WXMSW__ - -#endif - wxMemoryDC dcMem ; - m_bmpSaved.Create( width, height ); - dcMem.SelectObject( m_bmpSaved ); - m_x = x ; - m_y = y ; - m_width = width ; - m_height = height ; -#if defined(__WXGTK__) && !defined(__WX_DC_BLIT_FIXED__) - wxPoint pt = dc->GetDeviceOrigin(); - x += pt.x; - y += pt.y; -#endif // broken wxGTK wxDC::Blit - dcMem.Blit(0, 0, m_width, m_height, - dc, x, y); - dcMem.SelectObject( wxNullBitmap ); -} - -void wxOverlayImpl::Clear(wxWindowDC* dc) -{ - wxMemoryDC dcMem ; - dcMem.SelectObject( m_bmpSaved ); - dc->Blit( m_x, m_y, m_width, m_height , &dcMem , 0 , 0 ); - dcMem.SelectObject( wxNullBitmap ); -} - -void wxOverlayImpl::Reset() -{ - m_bmpSaved = wxBitmap(); -} - -void wxOverlayImpl::BeginDrawing(wxWindowDC* WXUNUSED(dc)) -{ -} - -void wxOverlayImpl::EndDrawing(wxWindowDC* WXUNUSED(dc)) -{ -} - -#endif // !wxHAS_NATIVE_OVERLAY - - diff --git a/Source/3rdParty/wx/src/common/paper.cpp b/Source/3rdParty/wx/src/common/paper.cpp deleted file mode 100644 index 714eee286..000000000 --- a/Source/3rdParty/wx/src/common/paper.cpp +++ /dev/null @@ -1,376 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/paper.cpp -// Purpose: Paper size classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: paper.cpp 60706 2009-05-21 10:17:44Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_PRINTING_ARCHITECTURE - -#ifndef WX_PRECOMP - #if defined(__WXMSW__) - #include "wx/msw/wrapcdlg.h" - #endif // MSW - #include "wx/utils.h" - #include "wx/settings.h" - #include "wx/intl.h" - #include "wx/module.h" -#endif - -#include "wx/paper.h" - -#include -#include - -#ifdef __WXMSW__ - #ifndef __WIN32__ - #include - #endif -#endif - // End __WXMSW__ - -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) -// IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) - -/* - * Paper size database for all platforms - */ - -wxPrintPaperType::wxPrintPaperType() -{ - m_paperId = wxPAPER_NONE; - m_platformId = 0; - m_paperName = wxEmptyString; - m_width = 0; - m_height = 0; -} - -wxPrintPaperType::wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h) -{ - m_paperId = paperId; - m_platformId = platformId; - m_paperName = name; - m_width = w; - m_height = h; -} - -// Get width and height in points (1/72th of an inch) -wxSize wxPrintPaperType::GetSizeDeviceUnits() const -{ - return wxSize( (int) ((m_width / 10.0) / (25.4 / 72.0)), (int) ((m_height / 10.0) / (25.4 / 72.0)) ); -} - -/* - * Print paper database for PostScript - */ - -WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList); -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxPrintPaperTypeList) - -wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL; - -wxPrintPaperDatabase::wxPrintPaperDatabase() -{ - m_map = new wxStringToPrintPaperTypeHashMap; - m_list = new wxPrintPaperTypeList; -} - -wxPrintPaperDatabase::~wxPrintPaperDatabase() -{ - ClearDatabase(); -} - -void wxPrintPaperDatabase::CreateDatabase() -{ - WXADDPAPER(wxPAPER_LETTER, DMPAPER_LETTER, wxTRANSLATE("Letter, 8 1/2 x 11 in"), 2159, 2794); - WXADDPAPER(wxPAPER_LEGAL, DMPAPER_LEGAL, wxTRANSLATE("Legal, 8 1/2 x 14 in"), 2159, 3556); - WXADDPAPER(wxPAPER_A4, DMPAPER_A4, wxTRANSLATE("A4 sheet, 210 x 297 mm"), 2100, 2970); - WXADDPAPER(wxPAPER_CSHEET, DMPAPER_CSHEET, wxTRANSLATE("C sheet, 17 x 22 in"), 4318, 5588); - WXADDPAPER(wxPAPER_DSHEET, DMPAPER_DSHEET, wxTRANSLATE("D sheet, 22 x 34 in"), 5588, 8636); - WXADDPAPER(wxPAPER_ESHEET, DMPAPER_ESHEET, wxTRANSLATE("E sheet, 34 x 44 in"), 8636, 11176); - WXADDPAPER(wxPAPER_LETTERSMALL, DMPAPER_LETTERSMALL, wxTRANSLATE("Letter Small, 8 1/2 x 11 in"), 2159, 2794); - WXADDPAPER(wxPAPER_TABLOID, DMPAPER_TABLOID, wxTRANSLATE("Tabloid, 11 x 17 in"), 2794, 4318); - WXADDPAPER(wxPAPER_LEDGER, DMPAPER_LEDGER, wxTRANSLATE("Ledger, 17 x 11 in"), 4318, 2794); - WXADDPAPER(wxPAPER_STATEMENT, DMPAPER_STATEMENT, wxTRANSLATE("Statement, 5 1/2 x 8 1/2 in"), 1397, 2159); - WXADDPAPER(wxPAPER_EXECUTIVE, DMPAPER_EXECUTIVE, wxTRANSLATE("Executive, 7 1/4 x 10 1/2 in"), 1842, 2667); - WXADDPAPER(wxPAPER_A3, DMPAPER_A3, wxTRANSLATE("A3 sheet, 297 x 420 mm"), 2970, 4200); - WXADDPAPER(wxPAPER_A4SMALL, DMPAPER_A4SMALL, wxTRANSLATE("A4 small sheet, 210 x 297 mm"), 2100, 2970); - WXADDPAPER(wxPAPER_A5, DMPAPER_A5, wxTRANSLATE("A5 sheet, 148 x 210 mm"), 1480, 2100); - WXADDPAPER(wxPAPER_B4, DMPAPER_B4, wxTRANSLATE("B4 sheet, 250 x 354 mm"), 2500, 3540); - WXADDPAPER(wxPAPER_B5, DMPAPER_B5, wxTRANSLATE("B5 sheet, 182 x 257 millimeter"), 1820, 2570); - WXADDPAPER(wxPAPER_FOLIO, DMPAPER_FOLIO, wxTRANSLATE("Folio, 8 1/2 x 13 in"), 2159, 3302); - WXADDPAPER(wxPAPER_QUARTO, DMPAPER_QUARTO, wxTRANSLATE("Quarto, 215 x 275 mm"), 2150, 2750); - WXADDPAPER(wxPAPER_10X14, DMPAPER_10X14, wxTRANSLATE("10 x 14 in"), 2540, 3556); - WXADDPAPER(wxPAPER_11X17, DMPAPER_11X17, wxTRANSLATE("11 x 17 in"), 2794, 4318); - WXADDPAPER(wxPAPER_NOTE, DMPAPER_NOTE, wxTRANSLATE("Note, 8 1/2 x 11 in"), 2159, 2794); - WXADDPAPER(wxPAPER_ENV_9, DMPAPER_ENV_9, wxTRANSLATE("#9 Envelope, 3 7/8 x 8 7/8 in"), 984, 2254); - WXADDPAPER(wxPAPER_ENV_10, DMPAPER_ENV_10, wxTRANSLATE("#10 Envelope, 4 1/8 x 9 1/2 in"), 1048, 2413); - WXADDPAPER(wxPAPER_ENV_11, DMPAPER_ENV_11, wxTRANSLATE("#11 Envelope, 4 1/2 x 10 3/8 in"), 1143, 2635); - WXADDPAPER(wxPAPER_ENV_12, DMPAPER_ENV_12, wxTRANSLATE("#12 Envelope, 4 3/4 x 11 in"), 1206, 2794); - WXADDPAPER(wxPAPER_ENV_14, DMPAPER_ENV_14, wxTRANSLATE("#14 Envelope, 5 x 11 1/2 in"), 1270, 2921); - WXADDPAPER(wxPAPER_ENV_DL, DMPAPER_ENV_DL, wxTRANSLATE("DL Envelope, 110 x 220 mm"), 1100, 2200); - WXADDPAPER(wxPAPER_ENV_C5, DMPAPER_ENV_C5, wxTRANSLATE("C5 Envelope, 162 x 229 mm"), 1620, 2290); - WXADDPAPER(wxPAPER_ENV_C3, DMPAPER_ENV_C3, wxTRANSLATE("C3 Envelope, 324 x 458 mm"), 3240, 4580); - WXADDPAPER(wxPAPER_ENV_C4, DMPAPER_ENV_C4, wxTRANSLATE("C4 Envelope, 229 x 324 mm"), 2290, 3240); - WXADDPAPER(wxPAPER_ENV_C6, DMPAPER_ENV_C6, wxTRANSLATE("C6 Envelope, 114 x 162 mm"), 1140, 1620); - WXADDPAPER(wxPAPER_ENV_C65, DMPAPER_ENV_C65, wxTRANSLATE("C65 Envelope, 114 x 229 mm"), 1140, 2290); - WXADDPAPER(wxPAPER_ENV_B4, DMPAPER_ENV_B4, wxTRANSLATE("B4 Envelope, 250 x 353 mm"), 2500, 3530); - WXADDPAPER(wxPAPER_ENV_B5, DMPAPER_ENV_B5, wxTRANSLATE("B5 Envelope, 176 x 250 mm"), 1760, 2500); - WXADDPAPER(wxPAPER_ENV_B6, DMPAPER_ENV_B6, wxTRANSLATE("B6 Envelope, 176 x 125 mm"), 1760, 1250); - WXADDPAPER(wxPAPER_ENV_ITALY, DMPAPER_ENV_ITALY, wxTRANSLATE("Italy Envelope, 110 x 230 mm"), 1100, 2300); - WXADDPAPER(wxPAPER_ENV_MONARCH, DMPAPER_ENV_MONARCH, wxTRANSLATE("Monarch Envelope, 3 7/8 x 7 1/2 in"), 984, 1905); - WXADDPAPER(wxPAPER_ENV_PERSONAL, DMPAPER_ENV_PERSONAL, wxTRANSLATE("6 3/4 Envelope, 3 5/8 x 6 1/2 in"), 921, 1651); - WXADDPAPER(wxPAPER_FANFOLD_US, DMPAPER_FANFOLD_US, wxTRANSLATE("US Std Fanfold, 14 7/8 x 11 in"), 3778, 2794); - WXADDPAPER(wxPAPER_FANFOLD_STD_GERMAN, DMPAPER_FANFOLD_STD_GERMAN, wxTRANSLATE("German Std Fanfold, 8 1/2 x 12 in"), 2159, 3048); - WXADDPAPER(wxPAPER_FANFOLD_LGL_GERMAN, DMPAPER_FANFOLD_LGL_GERMAN, wxTRANSLATE("German Legal Fanfold, 8 1/2 x 13 in"), 2159, 3302); - - WXADDPAPER(wxPAPER_ISO_B4, DMPAPER_ISO_B4, wxTRANSLATE("B4 (ISO) 250 x 353 mm"), 2500, 2530); - WXADDPAPER(wxPAPER_JAPANESE_POSTCARD, DMPAPER_JAPANESE_POSTCARD, wxTRANSLATE("Japanese Postcard 100 x 148 mm"), 1000, 1480); - WXADDPAPER(wxPAPER_9X11, DMPAPER_9X11, wxTRANSLATE("9 x 11 in"), 2286, 2794); - WXADDPAPER(wxPAPER_10X11, DMPAPER_10X11, wxTRANSLATE("10 x 11 in"), 2540, 2794); - WXADDPAPER(wxPAPER_15X11, DMPAPER_15X11, wxTRANSLATE("15 x 11 in"), 3810, 2794); - WXADDPAPER(wxPAPER_ENV_INVITE, DMPAPER_ENV_INVITE, wxTRANSLATE("Envelope Invite 220 x 220 mm"), 2200, 2200); - WXADDPAPER(wxPAPER_LETTER_EXTRA, DMPAPER_LETTER_EXTRA, wxTRANSLATE("Letter Extra 9 1/2 x 12 in"), 2413, 3048); - WXADDPAPER(wxPAPER_LEGAL_EXTRA, DMPAPER_LEGAL_EXTRA, wxTRANSLATE("Legal Extra 9 1/2 x 15 in"), 2413, 3810); - WXADDPAPER(wxPAPER_TABLOID_EXTRA, DMPAPER_TABLOID_EXTRA, wxTRANSLATE("Tabloid Extra 11.69 x 18 in"), 2969, 4572); - WXADDPAPER(wxPAPER_A4_EXTRA, DMPAPER_A4_EXTRA, wxTRANSLATE("A4 Extra 9.27 x 12.69 in"), 2355, 3223); - WXADDPAPER(wxPAPER_LETTER_TRANSVERSE, DMPAPER_LETTER_TRANSVERSE, wxTRANSLATE("Letter Transverse 8 1/2 x 11 in"), 2159, 2794); - WXADDPAPER(wxPAPER_A4_TRANSVERSE, DMPAPER_A4_TRANSVERSE, wxTRANSLATE("A4 Transverse 210 x 297 mm"), 2100, 2970); - WXADDPAPER(wxPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA_TRANSVERSE, wxTRANSLATE("Letter Extra Transverse 9.275 x 12 in"), 2355, 3048); - WXADDPAPER(wxPAPER_A_PLUS, DMPAPER_A_PLUS, wxTRANSLATE("SuperA/SuperA/A4 227 x 356 mm"), 2270, 3560); - WXADDPAPER(wxPAPER_B_PLUS, DMPAPER_B_PLUS, wxTRANSLATE("SuperB/SuperB/A3 305 x 487 mm"), 3050, 4870); - WXADDPAPER(wxPAPER_LETTER_PLUS, DMPAPER_LETTER_PLUS, wxTRANSLATE("Letter Plus 8 1/2 x 12.69 in"), 2159, 3223); - WXADDPAPER(wxPAPER_A4_PLUS, DMPAPER_A4_PLUS, wxTRANSLATE("A4 Plus 210 x 330 mm"), 2100, 3300); - WXADDPAPER(wxPAPER_A5_TRANSVERSE, DMPAPER_A5_TRANSVERSE, wxTRANSLATE("A5 Transverse 148 x 210 mm"), 1480, 2100); - WXADDPAPER(wxPAPER_B5_TRANSVERSE, DMPAPER_B5_TRANSVERSE, wxTRANSLATE("B5 (JIS) Transverse 182 x 257 mm"), 1820, 2570); - WXADDPAPER(wxPAPER_A3_EXTRA, DMPAPER_A3_EXTRA, wxTRANSLATE("A3 Extra 322 x 445 mm"), 3220, 4450); - WXADDPAPER(wxPAPER_A5_EXTRA, DMPAPER_A5_EXTRA, wxTRANSLATE("A5 Extra 174 x 235 mm"), 1740, 2350); - WXADDPAPER(wxPAPER_B5_EXTRA, DMPAPER_B5_EXTRA, wxTRANSLATE("B5 (ISO) Extra 201 x 276 mm"), 2010, 2760); - WXADDPAPER(wxPAPER_A2, DMPAPER_A2, wxTRANSLATE("A2 420 x 594 mm"), 4200, 5940); - WXADDPAPER(wxPAPER_A3_TRANSVERSE, DMPAPER_A3_TRANSVERSE, wxTRANSLATE("A3 Transverse 297 x 420 mm"), 2970, 4200); - WXADDPAPER(wxPAPER_A3_EXTRA_TRANSVERSE,DMPAPER_A3_EXTRA_TRANSVERSE,wxTRANSLATE("A3 Extra Transverse 322 x 445 mm"), 3220, 4450); - - WXADDPAPER(wxPAPER_DBL_JAPANESE_POSTCARD, 69, wxTRANSLATE("Japanese Double Postcard 200 x 148 mm"), 2000, 1480); - WXADDPAPER(wxPAPER_A6, 70, wxTRANSLATE("A6 105 x 148 mm"), 1050, 1480); - WXADDPAPER(wxPAPER_JENV_KAKU2, 71, wxTRANSLATE("Japanese Envelope Kaku #2"), 2400, 3320); - WXADDPAPER(wxPAPER_JENV_KAKU3, 72, wxTRANSLATE("Japanese Envelope Kaku #3"), 2160, 2770); - WXADDPAPER(wxPAPER_JENV_CHOU3, 73, wxTRANSLATE("Japanese Envelope Chou #3"), 1200, 2350); - WXADDPAPER(wxPAPER_JENV_CHOU4, 74, wxTRANSLATE("Japanese Envelope Chou #4"), 900, 2050); - WXADDPAPER(wxPAPER_LETTER_ROTATED, 75, wxTRANSLATE("Letter Rotated 11 x 8 1/2 in"), 2794, 2159); - WXADDPAPER(wxPAPER_A3_ROTATED, 76, wxTRANSLATE("A3 Rotated 420 x 297 mm"), 4200, 2970); - WXADDPAPER(wxPAPER_A4_ROTATED, 77, wxTRANSLATE("A4 Rotated 297 x 210 mm"), 2970, 2100); - WXADDPAPER(wxPAPER_A5_ROTATED, 78, wxTRANSLATE("A5 Rotated 210 x 148 mm"), 2100, 1480); - WXADDPAPER(wxPAPER_B4_JIS_ROTATED, 79, wxTRANSLATE("B4 (JIS) Rotated 364 x 257 mm"), 3640, 2570); - WXADDPAPER(wxPAPER_B5_JIS_ROTATED, 80, wxTRANSLATE("B5 (JIS) Rotated 257 x 182 mm"), 2570, 1820); - WXADDPAPER(wxPAPER_JAPANESE_POSTCARD_ROTATED, 81, wxTRANSLATE("Japanese Postcard Rotated 148 x 100 mm"), 1480, 1000); - WXADDPAPER(wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED, 82, wxTRANSLATE("Double Japanese Postcard Rotated 148 x 200 mm"), 1480, 2000); - WXADDPAPER(wxPAPER_A6_ROTATED, 83, wxTRANSLATE("A6 Rotated 148 x 105 mm"), 1480, 1050); - WXADDPAPER(wxPAPER_JENV_KAKU2_ROTATED, 84, wxTRANSLATE("Japanese Envelope Kaku #2 Rotated"), 3320, 2400); - WXADDPAPER(wxPAPER_JENV_KAKU3_ROTATED, 85, wxTRANSLATE("Japanese Envelope Kaku #3 Rotated"), 2770, 2160); - WXADDPAPER(wxPAPER_JENV_CHOU3_ROTATED, 86, wxTRANSLATE("Japanese Envelope Chou #3 Rotated"), 2350, 1200); - WXADDPAPER(wxPAPER_JENV_CHOU4_ROTATED, 87, wxTRANSLATE("Japanese Envelope Chou #4 Rotated"), 2050, 900); - WXADDPAPER(wxPAPER_B6_JIS, 88, wxTRANSLATE("B6 (JIS) 128 x 182 mm"), 1280, 1820); - WXADDPAPER(wxPAPER_B6_JIS_ROTATED, 89, wxTRANSLATE("B6 (JIS) Rotated 182 x 128 mm"), 1920, 1280); - WXADDPAPER(wxPAPER_12X11, 90, wxTRANSLATE("12 x 11 in"), 3048, 2794); - WXADDPAPER(wxPAPER_JENV_YOU4, 91, wxTRANSLATE("Japanese Envelope You #4"), 2350, 1050); - WXADDPAPER(wxPAPER_JENV_YOU4_ROTATED, 92, wxTRANSLATE("Japanese Envelope You #4 Rotated"), 1050, 2350); - WXADDPAPER(wxPAPER_P16K, 93, wxTRANSLATE("PRC 16K 146 x 215 mm"), 1460, 2150); - WXADDPAPER(wxPAPER_P32K, 94, wxTRANSLATE("PRC 32K 97 x 151 mm"), 970, 1510); - WXADDPAPER(wxPAPER_P32KBIG, 95, wxTRANSLATE("PRC 32K(Big) 97 x 151 mm"), 970, 1510); - WXADDPAPER(wxPAPER_PENV_1, 96, wxTRANSLATE("PRC Envelope #1 102 x 165 mm"), 1020, 1650); - WXADDPAPER(wxPAPER_PENV_2, 97, wxTRANSLATE("PRC Envelope #2 102 x 176 mm"), 1020, 1760); - WXADDPAPER(wxPAPER_PENV_3, 98, wxTRANSLATE("PRC Envelope #3 125 x 176 mm"), 1250, 1760); - WXADDPAPER(wxPAPER_PENV_4, 99, wxTRANSLATE("PRC Envelope #4 110 x 208 mm"), 1100, 2080); - WXADDPAPER(wxPAPER_PENV_5, 100, wxTRANSLATE("PRC Envelope #5 110 x 220 mm"), 1100, 2200); - WXADDPAPER(wxPAPER_PENV_6, 101, wxTRANSLATE("PRC Envelope #6 120 x 230 mm"), 1200, 2300); - WXADDPAPER(wxPAPER_PENV_7, 102, wxTRANSLATE("PRC Envelope #7 160 x 230 mm"), 1600, 2300); - WXADDPAPER(wxPAPER_PENV_8, 103, wxTRANSLATE("PRC Envelope #8 120 x 309 mm"), 1200, 3090); - WXADDPAPER(wxPAPER_PENV_9, 104, wxTRANSLATE("PRC Envelope #9 229 x 324 mm"), 2290, 3240); - WXADDPAPER(wxPAPER_PENV_10, 105, wxTRANSLATE("PRC Envelope #10 324 x 458 mm"), 3240, 4580); - WXADDPAPER(wxPAPER_P16K_ROTATED, 106, wxTRANSLATE("PRC 16K Rotated"), 2150, 1460); - WXADDPAPER(wxPAPER_P32K_ROTATED, 107, wxTRANSLATE("PRC 32K Rotated"), 1510, 970); - WXADDPAPER(wxPAPER_P32KBIG_ROTATED, 108, wxTRANSLATE("PRC 32K(Big) Rotated"), 1510, 970); - WXADDPAPER(wxPAPER_PENV_1_ROTATED, 109, wxTRANSLATE("PRC Envelope #1 Rotated 165 x 102 mm"), 1650, 1020); - WXADDPAPER(wxPAPER_PENV_2_ROTATED, 110, wxTRANSLATE("PRC Envelope #2 Rotated 176 x 102 mm"), 1760, 1020); - WXADDPAPER(wxPAPER_PENV_3_ROTATED, 111, wxTRANSLATE("PRC Envelope #3 Rotated 176 x 125 mm"), 1760, 1250); - WXADDPAPER(wxPAPER_PENV_4_ROTATED, 112, wxTRANSLATE("PRC Envelope #4 Rotated 208 x 110 mm"), 2080, 1100); - WXADDPAPER(wxPAPER_PENV_5_ROTATED, 113, wxTRANSLATE("PRC Envelope #5 Rotated 220 x 110 mm"), 2200, 1100); - WXADDPAPER(wxPAPER_PENV_6_ROTATED, 114, wxTRANSLATE("PRC Envelope #6 Rotated 230 x 120 mm"), 2300, 1200); - WXADDPAPER(wxPAPER_PENV_7_ROTATED, 115, wxTRANSLATE("PRC Envelope #7 Rotated 230 x 160 mm"), 2300, 1600); - WXADDPAPER(wxPAPER_PENV_8_ROTATED, 116, wxTRANSLATE("PRC Envelope #8 Rotated 309 x 120 mm"), 3090, 1200); - WXADDPAPER(wxPAPER_PENV_9_ROTATED, 117, wxTRANSLATE("PRC Envelope #9 Rotated 324 x 229 mm"), 3240, 2290); - WXADDPAPER(wxPAPER_PENV_10_ROTATED, 118, wxTRANSLATE("PRC Envelope #10 Rotated 458 x 324 mm"), 4580, 3240); -} - -void wxPrintPaperDatabase::ClearDatabase() -{ - delete m_list; - WX_CLEAR_HASH_MAP(wxStringToPrintPaperTypeHashMap, *m_map); - delete m_map; -} - -void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h) -{ - wxPrintPaperType* tmp = new wxPrintPaperType(paperId, 0, name, w, h); - (*m_map)[name] = tmp; - m_list->push_back(tmp); -} - -void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h) -{ - wxPrintPaperType* tmp = new wxPrintPaperType(paperId, platformId, name, w, h); - (*m_map)[name] = tmp; - m_list->push_back(tmp); -} - -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) -{ - wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name); - if (it != m_map->end()) - return it->second; - else - return NULL; -} - -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) -{ - typedef wxStringToPrintPaperTypeHashMap::iterator iterator; - - for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it) - { - wxPrintPaperType* paperType = it->second; - if (paperType->GetId() == id) - return paperType; - } - - return NULL; -} - -wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) -{ - typedef wxStringToPrintPaperTypeHashMap::iterator iterator; - - for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it) - { - wxPrintPaperType* paperType = it->second; - if (paperType->GetPlatformId() == id) - return paperType; - } - - return NULL; -} - -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) -{ - // Take the item ordering into account so that the more common types - // are likely to be taken into account first. This fixes problems with, - // for example, Letter reverting to A4 in the page setup dialog because - // it was wrongly translated to Note. - size_t i; - for (i = 0; i < GetCount(); i++) - { - wxPrintPaperType* paperType = Item(i); - wxSize paperSize = paperType->GetSize() ; - if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 ) - return paperType; - } - - return NULL; -} - -// Convert name to size id -wxPaperSize wxPrintPaperDatabase::ConvertNameToId(const wxString& name) -{ - wxPrintPaperType* type = FindPaperType(name); - if (type) - return type->GetId(); - else - return wxPAPER_NONE; -} - -// Convert size id to name -wxString wxPrintPaperDatabase::ConvertIdToName(wxPaperSize paperId) -{ - wxPrintPaperType* type = FindPaperType(paperId); - if (type) - return type->GetName(); - else - return wxEmptyString; -} - -// Get the paper size -wxSize wxPrintPaperDatabase::GetSize(wxPaperSize paperId) -{ - wxPrintPaperType* type = FindPaperType(paperId); - if (type) - return type->GetSize(); - else - return wxSize(0,0); -} - -// Get the paper size -wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size) -{ - wxPrintPaperType* type = FindPaperType(size); - if (type) - return type->GetId(); - else - return wxPAPER_NONE; -} - -// QUICK and DIRTY -size_t wxPrintPaperDatabase::GetCount() const -{ - return m_list->GetCount(); -} - -wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const -{ - return m_list->Item(index)->GetData(); -} - -// A module to allow initialization/cleanup of print paper -// things without calling these functions from app.cpp. - -class WXDLLEXPORT wxPrintPaperModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxPrintPaperModule) -public: - wxPrintPaperModule() {} - bool OnInit(); - void OnExit(); -}; - -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperModule, wxModule) - -/* - * Initialization/cleanup module - */ - -bool wxPrintPaperModule::OnInit() -{ - wxThePrintPaperDatabase = new wxPrintPaperDatabase; - wxThePrintPaperDatabase->CreateDatabase(); - - return true; -} - -void wxPrintPaperModule::OnExit() -{ - delete wxThePrintPaperDatabase; - wxThePrintPaperDatabase = NULL; -} - -#endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Source/3rdParty/wx/src/common/pickerbase.cpp b/Source/3rdParty/wx/src/common/pickerbase.cpp deleted file mode 100644 index 87c99066c..000000000 --- a/Source/3rdParty/wx/src/common/pickerbase.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/pickerbase.cpp -// Purpose: wxPickerBase class implementation -// Author: Francesco Montorsi -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: pickerbase.cpp 58463 2009-01-27 17:39:50Z BP $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COLOURPICKERCTRL || \ - wxUSE_DIRPICKERCTRL || \ - wxUSE_FILEPICKERCTRL || \ - wxUSE_FONTPICKERCTRL - -#include "wx/pickerbase.h" -#include "wx/tooltip.h" - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" -#endif - - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxPickerBase, wxControl) - -BEGIN_EVENT_TABLE(wxPickerBase, wxControl) - EVT_SIZE(wxPickerBase::OnSize) - WX_EVENT_TABLE_CONTROL_CONTAINER(wxPickerBase) -END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxPickerBase, wxControl) - - -// ---------------------------------------------------------------------------- -// wxPickerBase -// ---------------------------------------------------------------------------- - -bool wxPickerBase::CreateBase(wxWindow *parent, - wxWindowID id, - const wxString &text, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - // remove any border style from our style as wxPickerBase's window must be - // invisible (user styles must be set on the textctrl or the platform-dependent picker) - style &= ~wxBORDER_MASK; - if (!wxControl::Create(parent, id, pos, size, style | wxNO_BORDER | wxTAB_TRAVERSAL, - validator, name)) - return false; - - m_sizer = new wxBoxSizer(wxHORIZONTAL); - - if (HasFlag(wxPB_USE_TEXTCTRL)) - { - // NOTE: the style of this class (wxPickerBase) and the style of the - // attached text control are different: GetTextCtrlStyle() extracts - // the styles related to the textctrl from the styles passed here - m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, - wxDefaultPosition, wxDefaultSize, - GetTextCtrlStyle(style)); - if (!m_text) - { - wxFAIL_MSG( wxT("wxPickerBase's textctrl creation failed") ); - return false; - } - - // set the maximum lenght allowed for this textctrl. - // This is very important since any change to it will trigger an update in - // the m_picker; for very long strings, this real-time synchronization could - // become a CPU-blocker and thus should be avoided. - // 32 characters will be more than enough for all common uses. - m_text->SetMaxLength(32); - - // set the initial contents of the textctrl - m_text->SetValue(text); - - m_text->Connect(m_text->GetId(), wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler(wxPickerBase::OnTextCtrlUpdate), - NULL, this); - m_text->Connect(m_text->GetId(), wxEVT_KILL_FOCUS, - wxFocusEventHandler(wxPickerBase::OnTextCtrlKillFocus), - NULL, this); - - m_text->Connect(m_text->GetId(), wxEVT_DESTROY, - wxWindowDestroyEventHandler(wxPickerBase::OnTextCtrlDelete), - NULL, this); - - // the text control's proportion values defaults to 2 - m_sizer->Add(m_text, 2, GetDefaultTextCtrlFlag(), 5); - } - - return true; -} - -void wxPickerBase::PostCreation() -{ - // the picker's proportion value defaults to 1 when there's no text control - // associated with it - in that case it defaults to 0 - m_sizer->Add(m_picker, HasTextCtrl() ? 0 : 1, GetDefaultPickerCtrlFlag(), 5); - - SetSizer(m_sizer); - SetMinSize( m_sizer->GetMinSize() ); -} - -#if wxUSE_TOOLTIPS - -void wxPickerBase::DoSetToolTip(wxToolTip *tip) -{ - // don't set the tooltip on us but rather on our two child windows - // as otherwise it would appear only when the cursor is placed on the - // small area around the child windows which belong to wxPickerBase - m_picker->SetToolTip(tip); - - // do a copy as wxWindow will own the pointer we pass - if ( m_text ) - m_text->SetToolTip(tip ? new wxToolTip(tip->GetTip()) : NULL); -} - -#endif // wxUSE_TOOLTIPS - -// ---------------------------------------------------------------------------- -// wxPickerBase - event handlers -// ---------------------------------------------------------------------------- - -void wxPickerBase::OnTextCtrlKillFocus(wxFocusEvent& event) -{ - event.Skip(); - - // don't leave the textctrl empty - if (m_text && m_text->GetValue().empty()) - UpdateTextCtrlFromPicker(); -} - -void wxPickerBase::OnTextCtrlDelete(wxWindowDestroyEvent &) -{ - // the textctrl has been deleted; our pointer is invalid! - m_text = NULL; -} - -void wxPickerBase::OnTextCtrlUpdate(wxCommandEvent &) -{ - // for each text-change, update the picker - UpdatePickerFromTextCtrl(); -} - -void wxPickerBase::OnSize(wxSizeEvent &event) -{ - if (GetAutoLayout()) - Layout(); - event.Skip(); -} - -#endif // Any picker in use diff --git a/Source/3rdParty/wx/src/common/platinfo.cpp b/Source/3rdParty/wx/src/common/platinfo.cpp deleted file mode 100644 index bf33db2e6..000000000 --- a/Source/3rdParty/wx/src/common/platinfo.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/platinfo.cpp -// Purpose: implements wxPlatformInfo class -// Author: Francesco Montorsi -// Modified by: -// Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id: platinfo.cpp 44078 2006-12-30 21:46:22Z SN $ -// Copyright: (c) 2006 Francesco Montorsi -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/platinfo.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/utils.h" -#endif //WX_PRECOMP - -#include "wx/apptrait.h" - -// global object -// VERY IMPORTANT: do not use the default constructor since it would -// try to init the wxPlatformInfo instance using -// gs_platInfo itself! -static wxPlatformInfo gs_platInfo(wxPORT_UNKNOWN); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -static const wxChar* const wxOperatingSystemIdNames[] = -{ - _T("Apple Mac OS"), - _T("Apple Mac OS X"), - - _T("Microsoft Windows 9X"), - _T("Microsoft Windows NT"), - _T("Microsoft Windows Micro"), - _T("Microsoft Windows CE"), - - _T("Linux"), - _T("FreeBSD"), - _T("OpenBSD"), - _T("NetBSD"), - - _T("SunOS"), - _T("AIX"), - _T("HPUX"), - - _T("Other Unix"), - _T("Other Unix"), - - _T("DOS"), - _T("OS/2") -}; - -static const wxChar* const wxPortIdNames[] = -{ - _T("wxBase"), - _T("wxMSW"), - _T("wxMotif"), - _T("wxGTK"), - _T("wxMGL"), - _T("wxX11"), - _T("wxOS2"), - _T("wxMac"), - _T("wxCocoa"), - _T("wxWinCE"), - _T("wxPalmOS"), - _T("wxDFB") -}; - -static const wxChar* const wxArchitectureNames[] = -{ - _T("32 bit"), - _T("64 bit") -}; - -static const wxChar* const wxEndiannessNames[] = -{ - _T("Big endian"), - _T("Little endian"), - _T("PDP endian") -}; - -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - -// returns log in base 2 of the value, this maps the enum values to the -// corresponding indices -static unsigned wxGetIndexFromEnumValue(int value) -{ - wxCHECK_MSG( value, (unsigned)-1, _T("invalid enum value") ); - - int n = 0; - while ( !(value & 1) ) - { - value >>= 1; - n++; - } - - wxASSERT_MSG( value == 1, _T("more than one bit set in enum value") ); - - return n; -} - -// ---------------------------------------------------------------------------- -// wxPlatformInfo -// ---------------------------------------------------------------------------- - -wxPlatformInfo::wxPlatformInfo() -{ - // just copy platform info for currently running platform - *this = Get(); -} - -wxPlatformInfo::wxPlatformInfo(wxPortId pid, int tkMajor, int tkMinor, - wxOperatingSystemId id, int osMajor, int osMinor, - wxArchitecture arch, - wxEndianness endian, - bool usingUniversal) -{ - m_tkVersionMajor = tkMajor; - m_tkVersionMinor = tkMinor; - m_port = pid; - m_usingUniversal = usingUniversal; - - m_os = id; - m_osVersionMajor = osMajor; - m_osVersionMinor = osMinor; - - m_endian = endian; - m_arch = arch; -} - -bool wxPlatformInfo::operator==(const wxPlatformInfo &t) const -{ - return m_tkVersionMajor == t.m_tkVersionMajor && - m_tkVersionMinor == t.m_tkVersionMinor && - m_osVersionMajor == t.m_osVersionMajor && - m_osVersionMinor == t.m_osVersionMinor && - m_os == t.m_os && - m_port == t.m_port && - m_usingUniversal == t.m_usingUniversal && - m_arch == t.m_arch && - m_endian == t.m_endian; -} - -void wxPlatformInfo::InitForCurrentPlatform() -{ - // autodetect all informations - const wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( !traits ) - { - wxFAIL_MSG( _T("failed to initialize wxPlatformInfo") ); - - m_port = wxPORT_UNKNOWN; - m_usingUniversal = false; - m_tkVersionMajor = - m_tkVersionMinor = 0; - } - else - { - m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor); - m_usingUniversal = traits->IsUsingUniversalWidgets(); - } - - m_os = wxGetOsVersion(&m_osVersionMajor, &m_osVersionMinor); - m_endian = wxIsPlatformLittleEndian() ? wxENDIAN_LITTLE : wxENDIAN_BIG; - m_arch = wxIsPlatform64Bit() ? wxARCH_64 : wxARCH_32; -} - -/* static */ -const wxPlatformInfo& wxPlatformInfo::Get() -{ - static bool initialized = false; - if ( !initialized ) - { - gs_platInfo.InitForCurrentPlatform(); - initialized = true; - } - - return gs_platInfo; -} - - - -// ---------------------------------------------------------------------------- -// wxPlatformInfo - enum -> string conversions -// ---------------------------------------------------------------------------- - -wxString wxPlatformInfo::GetOperatingSystemFamilyName(wxOperatingSystemId os) -{ - const wxChar* string = _T("Unknown"); - if ( os & wxOS_MAC ) - string = _T("Macintosh"); - else if ( os & wxOS_WINDOWS ) - string = _T("Windows"); - else if ( os & wxOS_UNIX ) - string = _T("Unix"); - else if ( os == wxOS_DOS ) - string = _T("DOS"); - else if ( os == wxOS_OS2 ) - string = _T("OS/2"); - - return string; -} - -wxString wxPlatformInfo::GetOperatingSystemIdName(wxOperatingSystemId os) -{ - const unsigned idx = wxGetIndexFromEnumValue(os); - - wxCHECK_MSG( idx < WXSIZEOF(wxOperatingSystemIdNames), wxEmptyString, - _T("invalid OS id") ); - - return wxOperatingSystemIdNames[idx]; -} - -wxString wxPlatformInfo::GetPortIdName(wxPortId port, bool usingUniversal) -{ - const unsigned idx = wxGetIndexFromEnumValue(port); - - wxCHECK_MSG( idx < WXSIZEOF(wxPortIdNames), wxEmptyString, - _T("invalid port id") ); - - wxString ret = wxPortIdNames[idx]; - - if ( usingUniversal ) - ret += wxT("/wxUniversal"); - - return ret; -} - -wxString wxPlatformInfo::GetPortIdShortName(wxPortId port, bool usingUniversal) -{ - const unsigned idx = wxGetIndexFromEnumValue(port); - - wxCHECK_MSG( idx < WXSIZEOF(wxPortIdNames), wxEmptyString, - _T("invalid port id") ); - - wxString ret = wxPortIdNames[idx]; - ret = ret.Mid(2).Lower(); // remove 'wx' prefix - - if ( usingUniversal ) - ret += wxT("univ"); - - return ret; -} - -wxString wxPlatformInfo::GetArchName(wxArchitecture arch) -{ - wxCOMPILE_TIME_ASSERT( WXSIZEOF(wxArchitectureNames) == wxARCH_MAX, - wxArchitectureNamesMismatch ); - - return wxArchitectureNames[arch]; -} - -wxString wxPlatformInfo::GetEndiannessName(wxEndianness end) -{ - wxCOMPILE_TIME_ASSERT( WXSIZEOF(wxEndiannessNames) == wxENDIAN_MAX, - wxEndiannessNamesMismatch ); - - return wxEndiannessNames[end]; -} - - -// ---------------------------------------------------------------------------- -// wxPlatformInfo - string -> enum conversions -// ---------------------------------------------------------------------------- - -wxOperatingSystemId wxPlatformInfo::GetOperatingSystemId(const wxString &str) -{ - for ( size_t i = 0; i < WXSIZEOF(wxOperatingSystemIdNames); i++ ) - { - if ( wxString(wxOperatingSystemIdNames[i]).CmpNoCase(str) == 0 ) - return (wxOperatingSystemId)(1 << i); - } - - return wxOS_UNKNOWN; -} - -wxPortId wxPlatformInfo::GetPortId(const wxString &str) -{ - // recognize both short and long port names - for ( size_t i = 0; i < WXSIZEOF(wxPortIdNames); i++ ) - { - wxPortId current = (wxPortId)(1 << i); - - if ( wxString(wxPortIdNames[i]).CmpNoCase(str) == 0 || - GetPortIdShortName(current, true).CmpNoCase(str) == 0 || - GetPortIdShortName(current, false).CmpNoCase(str) == 0 ) - return current; - } - - return wxPORT_UNKNOWN; -} - -wxArchitecture wxPlatformInfo::GetArch(const wxString &arch) -{ - if ( arch.Contains(wxT("32")) ) - return wxARCH_32; - - if ( arch.Contains(wxT("64")) ) - return wxARCH_64; - - return wxARCH_INVALID; -} - -wxEndianness wxPlatformInfo::GetEndianness(const wxString& end) -{ - wxString endl(end.Lower()); - if ( end.StartsWith(wxT("little")) ) - return wxENDIAN_LITTLE; - - if ( end.StartsWith(wxT("big")) ) - return wxENDIAN_BIG; - - return wxENDIAN_INVALID; -} - diff --git a/Source/3rdParty/wx/src/common/popupcmn.cpp b/Source/3rdParty/wx/src/common/popupcmn.cpp deleted file mode 100644 index 7582c313e..000000000 --- a/Source/3rdParty/wx/src/common/popupcmn.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/popupcmn.cpp -// Purpose: implementation of wxPopupTransientWindow -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.01.01 -// RCS-ID: $Id: popupcmn.cpp 61466 2009-07-19 16:45:08Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_POPUPWIN - -#include "wx/popupwin.h" - -#ifndef WX_PRECOMP - #include "wx/combobox.h" // wxComboCtrl - #include "wx/app.h" // wxPostEvent - #include "wx/log.h" -#endif //WX_PRECOMP - -#include "wx/display.h" -#include "wx/recguard.h" - -#ifdef __WXUNIVERSAL__ - #include "wx/univ/renderer.h" - #include "wx/scrolbar.h" -#endif // __WXUNIVERSAL__ - -#ifdef __WXGTK__ - #include -#elif defined(__WXMSW__) - #include "wx/msw/private.h" -#elif defined(__WXX11__) - #include "wx/x11/private.h" -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) -IMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow) - -#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - IMPLEMENT_DYNAMIC_CLASS(wxPopupComboWindow, wxPopupTransientWindow) -#endif - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// event handlers which we use to intercept events which cause the popup to -// disappear -class wxPopupWindowHandler : public wxEvtHandler -{ -public: - wxPopupWindowHandler(wxPopupTransientWindow *popup) : m_popup(popup) {} - -protected: - // event handlers - void OnLeftDown(wxMouseEvent& event); - -private: - wxPopupTransientWindow *m_popup; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPopupWindowHandler) -}; - -class wxPopupFocusHandler : public wxEvtHandler -{ -public: - wxPopupFocusHandler(wxPopupTransientWindow *popup) : m_popup(popup) {} - -protected: - void OnKillFocus(wxFocusEvent& event); - void OnKeyDown(wxKeyEvent& event); - -private: - wxPopupTransientWindow *m_popup; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPopupFocusHandler) -}; - -// ---------------------------------------------------------------------------- -// event tables -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxPopupWindowHandler, wxEvtHandler) - EVT_LEFT_DOWN(wxPopupWindowHandler::OnLeftDown) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) - EVT_KILL_FOCUS(wxPopupFocusHandler::OnKillFocus) - EVT_KEY_DOWN(wxPopupFocusHandler::OnKeyDown) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPopupTransientWindow, wxPopupWindow) -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - EVT_IDLE(wxPopupTransientWindow::OnIdle) -#endif -END_EVENT_TABLE() - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxPopupWindowBase -// ---------------------------------------------------------------------------- - -wxPopupWindowBase::~wxPopupWindowBase() -{ - // this destructor is required for Darwin -} - -bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags)) -{ - return true; -} - -void wxPopupWindowBase::Position(const wxPoint& ptOrigin, - const wxSize& size) -{ - // determine the position and size of the screen we clamp the popup to - wxPoint posScreen; - wxSize sizeScreen; - - const int displayNum = wxDisplay::GetFromPoint(ptOrigin); - if ( displayNum != wxNOT_FOUND ) - { - const wxRect rectScreen = wxDisplay(displayNum).GetGeometry(); - posScreen = rectScreen.GetPosition(); - sizeScreen = rectScreen.GetSize(); - } - else // outside of any display? - { - // just use the primary one then - posScreen = wxPoint(0, 0); - sizeScreen = wxGetDisplaySize(); - } - - - const wxSize sizeSelf = GetSize(); - - // is there enough space to put the popup below the window (where we put it - // by default)? - wxCoord y = ptOrigin.y + size.y; - if ( y + sizeSelf.y > posScreen.y + sizeScreen.y ) - { - // check if there is enough space above - if ( ptOrigin.y > sizeSelf.y ) - { - // do position the control above the window - y -= size.y + sizeSelf.y; - } - //else: not enough space below nor above, leave below - } - - // now check left/right too - wxCoord x = ptOrigin.x; - - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) - { - // shift the window to the left instead of the right. - x -= size.x; - x -= sizeSelf.x; // also shift it by window width. - } - else - x += size.x; - - - if ( x + sizeSelf.x > posScreen.x + sizeScreen.x ) - { - // check if there is enough space to the left - if ( ptOrigin.x > sizeSelf.x ) - { - // do position the control to the left - x -= size.x + sizeSelf.x; - } - //else: not enough space there neither, leave in default position - } - - Move(x, y, wxSIZE_NO_ADJUSTMENTS); -} - -// ---------------------------------------------------------------------------- -// wxPopupTransientWindow -// ---------------------------------------------------------------------------- - -void wxPopupTransientWindow::Init() -{ - m_child = - m_focus = (wxWindow *)NULL; - - m_handlerFocus = NULL; - m_handlerPopup = NULL; -} - -wxPopupTransientWindow::wxPopupTransientWindow(wxWindow *parent, int style) -{ - Init(); - - (void)Create(parent, style); -} - -wxPopupTransientWindow::~wxPopupTransientWindow() -{ - if (m_handlerPopup && m_handlerPopup->GetNextHandler()) - PopHandlers(); - - wxASSERT(!m_handlerFocus || !m_handlerFocus->GetNextHandler()); - wxASSERT(!m_handlerPopup || !m_handlerPopup->GetNextHandler()); - - delete m_handlerFocus; - delete m_handlerPopup; -} - -void wxPopupTransientWindow::PopHandlers() -{ - if ( m_child ) - { - if ( !m_child->RemoveEventHandler(m_handlerPopup) ) - { - // something is very wrong and someone else probably deleted our - // handler - so don't risk deleting it second time - m_handlerPopup = NULL; - } - if (m_child->HasCapture()) - { - m_child->ReleaseMouse(); - } - m_child = NULL; - } - - if ( m_focus ) - { - if ( !m_focus->RemoveEventHandler(m_handlerFocus) ) - { - // see above - m_handlerFocus = NULL; - } - } - m_focus = NULL; -} - -void wxPopupTransientWindow::Popup(wxWindow *winFocus) -{ - const wxWindowList& children = GetChildren(); - if ( children.GetCount() ) - { - m_child = children.GetFirst()->GetData(); - } - else - { - m_child = this; - } - - Show(); - - // There is is a problem if these are still in use - wxASSERT(!m_handlerFocus || !m_handlerFocus->GetNextHandler()); - wxASSERT(!m_handlerPopup || !m_handlerPopup->GetNextHandler()); - - if (!m_handlerPopup) - m_handlerPopup = new wxPopupWindowHandler(this); - - m_child->PushEventHandler(m_handlerPopup); - -#if defined(__WXMSW__) - // Focusing on child of popup window does not work on MSW unless WS_POPUP - // style is set. We do not even want to try to set the focus, as it may - // provoke errors on some Windows versions (Vista and later). - if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & WS_POPUP ) -#endif - { - m_focus = winFocus ? winFocus : this; - m_focus->SetFocus(); - } - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - // MSW doesn't allow to set focus to the popup window, but we need to - // subclass the window which has the focus, and not winFocus passed in or - // otherwise everything else breaks down - m_focus = FindFocus(); -#elif defined(__WXGTK__) - // GTK+ catches the activate events from the popup - // window, not the focus events from the child window - m_focus = this; -#endif - - if ( m_focus ) - { - if (!m_handlerFocus) - m_handlerFocus = new wxPopupFocusHandler(this); - - m_focus->PushEventHandler(m_handlerFocus); - } -} - -bool wxPopupTransientWindow::Show( bool show ) -{ -#ifdef __WXGTK__ - if (!show) - { - gdk_pointer_ungrab( (guint32)GDK_CURRENT_TIME ); - - gtk_grab_remove( m_widget ); - } -#endif - -#ifdef __WXX11__ - if (!show) - { - XUngrabPointer( wxGlobalDisplay(), CurrentTime ); - } -#endif - -#if defined( __WXMSW__ ) || defined( __WMAC__ ) - if (!show && m_child && m_child->HasCapture()) - { - m_child->ReleaseMouse(); - } -#endif - - bool ret = wxPopupWindow::Show( show ); - -#ifdef __WXGTK__ - if (show) - { - gtk_grab_add( m_widget ); - - gdk_pointer_grab( m_widget->window, TRUE, - (GdkEventMask) - (GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_POINTER_MOTION_MASK), - (GdkWindow *) NULL, - (GdkCursor *) NULL, - (guint32)GDK_CURRENT_TIME ); - } -#endif - -#ifdef __WXX11__ - if (show) - { - Window xwindow = (Window) m_clientWindow; - - /* int res =*/ XGrabPointer(wxGlobalDisplay(), xwindow, - True, - ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, - GrabModeAsync, - None, - None, - CurrentTime ); - } -#endif - -#if defined( __WXMSW__ ) || defined( __WMAC__ ) - if (show && m_child) - { - // Assume that the mouse is outside the popup to begin with - m_child->CaptureMouse(); - } -#endif - - return ret; -} - -void wxPopupTransientWindow::Dismiss() -{ - Hide(); - PopHandlers(); -} - -void wxPopupTransientWindow::DismissAndNotify() -{ - Dismiss(); - OnDismiss(); -} - -void wxPopupTransientWindow::OnDismiss() -{ - // nothing to do here - but it may be interesting for derived class -} - -bool wxPopupTransientWindow::ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) -{ - // no special processing here - return false; -} - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) -void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) -{ - event.Skip(); - - if (IsShown() && m_child) - { - wxPoint pos = ScreenToClient(wxGetMousePosition()); - wxRect rect(GetSize()); - - if ( rect.Contains(pos) ) - { - if ( m_child->HasCapture() ) - { - m_child->ReleaseMouse(); - } - } - else - { - if ( !m_child->HasCapture() ) - { - m_child->CaptureMouse(); - } - } - } -} -#endif // __WXMSW__ - - -#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -// ---------------------------------------------------------------------------- -// wxPopupComboWindow -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxPopupComboWindow, wxPopupTransientWindow) - EVT_KEY_DOWN(wxPopupComboWindow::OnKeyDown) -END_EVENT_TABLE() - -wxPopupComboWindow::wxPopupComboWindow(wxComboCtrl *parent) - : wxPopupTransientWindow(parent) -{ - m_combo = parent; -} - -bool wxPopupComboWindow::Create(wxComboCtrl *parent) -{ - m_combo = parent; - - return wxPopupWindow::Create(parent); -} - -void wxPopupComboWindow::PositionNearCombo() -{ - // the origin point must be in screen coords - wxPoint ptOrigin = m_combo->ClientToScreen(wxPoint(0,0)); - -#if 0 //def __WXUNIVERSAL__ - // account for the fact that (0, 0) is not the top left corner of the - // window: there is also the border - wxRect rectBorders = m_combo->GetRenderer()-> - GetBorderDimensions(m_combo->GetBorder()); - ptOrigin.x -= rectBorders.x; - ptOrigin.y -= rectBorders.y; -#endif // __WXUNIVERSAL__ - - // position below or above the combobox: the width is 0 to put it exactly - // below us, not to the left or to the right - Position(ptOrigin, wxSize(0, m_combo->GetSize().y)); -} - -void wxPopupComboWindow::OnDismiss() -{ - m_combo->OnPopupDismiss(); -} - -void wxPopupComboWindow::OnKeyDown(wxKeyEvent& event) -{ - m_combo->ProcessEvent(event); -} - -#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -// ---------------------------------------------------------------------------- -// wxPopupWindowHandler -// ---------------------------------------------------------------------------- - -void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) -{ - // let the window have it first (we're the first event handler in the chain - // of handlers for this window) - if ( m_popup->ProcessLeftDown(event) ) - { - return; - } - - wxPoint pos = event.GetPosition(); - - // in non-Univ ports the system manages scrollbars for us -#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR - // scrollbar on which the click occurred - wxWindow *sbar = NULL; -#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR - - wxWindow *win = (wxWindow *)event.GetEventObject(); - - switch ( win->HitTest(pos.x, pos.y) ) - { - case wxHT_WINDOW_OUTSIDE: - { - // do the coords translation now as after DismissAndNotify() - // m_popup may be destroyed - wxMouseEvent event2(event); - - m_popup->ClientToScreen(&event2.m_x, &event2.m_y); - - // clicking outside a popup dismisses it - m_popup->DismissAndNotify(); - - // dismissing a tooltip shouldn't waste a click, i.e. you - // should be able to dismiss it and press the button with the - // same click, so repost this event to the window beneath us - wxWindow *winUnder = wxFindWindowAtPoint(event2.GetPosition()); - if ( winUnder ) - { - // translate the event coords to the ones of the window - // which is going to get the event - winUnder->ScreenToClient(&event2.m_x, &event2.m_y); - - event2.SetEventObject(winUnder); - wxPostEvent(winUnder, event2); - } - } - break; - -#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR - case wxHT_WINDOW_HORZ_SCROLLBAR: - sbar = win->GetScrollbar(wxHORIZONTAL); - break; - - case wxHT_WINDOW_VERT_SCROLLBAR: - sbar = win->GetScrollbar(wxVERTICAL); - break; -#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR - - default: - // forgot to update the switch after adding a new hit test code? - wxFAIL_MSG( _T("unexpected HitTest() return value") ); - // fall through - - case wxHT_WINDOW_CORNER: - // don't actually know if this one is good for anything, but let it - // pass just in case - - case wxHT_WINDOW_INSIDE: - // let the normal processing take place - event.Skip(); - break; - } - -#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR - if ( sbar ) - { - // translate the event coordinates to the scrollbar ones - pos = sbar->ScreenToClient(win->ClientToScreen(pos)); - - // and give the event to it - wxMouseEvent event2 = event; - event2.m_x = pos.x; - event2.m_y = pos.y; - - (void)sbar->GetEventHandler()->ProcessEvent(event2); - } -#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR -} - -// ---------------------------------------------------------------------------- -// wxPopupFocusHandler -// ---------------------------------------------------------------------------- - -void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) -{ - // when we lose focus we always disappear - unless it goes to the popup (in - // which case we don't really lose it) - wxWindow *win = event.GetWindow(); - while ( win ) - { - if ( win == m_popup ) - return; - win = win->GetParent(); - } - - m_popup->DismissAndNotify(); -} - -void wxPopupFocusHandler::OnKeyDown(wxKeyEvent& event) -{ - // we can be associated with the popup itself in which case we should avoid - // infinite recursion - static int s_inside; - wxRecursionGuard guard(s_inside); - if ( guard.IsInside() ) - { - event.Skip(); - return; - } - - // let the window have it first, it might process the keys - if ( !m_popup->GetEventHandler()->ProcessEvent(event) ) - { - // by default, dismiss the popup - m_popup->DismissAndNotify(); - } -} - -#endif // wxUSE_POPUPWIN diff --git a/Source/3rdParty/wx/src/common/powercmn.cpp b/Source/3rdParty/wx/src/common/powercmn.cpp deleted file mode 100644 index cf2086ff8..000000000 --- a/Source/3rdParty/wx/src/common/powercmn.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/powercmn.cpp -// Purpose: power event types and stubs for power functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-05-27 -// RCS-ID: $Id: powercmn.cpp 48811 2007-09-19 23:11:28Z RD $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/power.h" - -// ============================================================================ -// implementation -// ============================================================================ - -#ifdef wxHAS_POWER_EVENTS - DEFINE_EVENT_TYPE(wxEVT_POWER_SUSPENDING) - DEFINE_EVENT_TYPE(wxEVT_POWER_SUSPENDED) - DEFINE_EVENT_TYPE(wxEVT_POWER_SUSPEND_CANCEL) - DEFINE_EVENT_TYPE(wxEVT_POWER_RESUME) - - IMPLEMENT_ABSTRACT_CLASS(wxPowerEvent, wxEvent) -#endif - -// provide stubs for the systems not implementing these functions -#if !defined(__WXPALMOS__) && !defined(__WXMSW__) - -wxPowerType wxGetPowerType() -{ - return wxPOWER_UNKNOWN; -} - -wxBatteryState wxGetBatteryState() -{ - return wxBATTERY_UNKNOWN_STATE; -} - -#endif // systems without power management functions - diff --git a/Source/3rdParty/wx/src/common/prntbase.cpp b/Source/3rdParty/wx/src/common/prntbase.cpp deleted file mode 100644 index b45b319b8..000000000 --- a/Source/3rdParty/wx/src/common/prntbase.cpp +++ /dev/null @@ -1,1869 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/prntbase.cpp -// Purpose: Printing framework base class implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: prntbase.cpp 60850 2009-06-01 10:16:13Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_PRINTING_ARCHITECTURE - -// change this to 1 to use experimental high-quality printing on Windows -// (NB: this can't be in msw/printwin.cpp because of binary compatibility) -#define wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW 0 - -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - #if !defined(__WXMSW__) || !wxUSE_IMAGE || !wxUSE_WXDIB - #undef wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - #define wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW 0 - #endif -#endif - -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW -#include "wx/msw/enhmeta.h" -#endif - -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW && !wxUSE_ENH_METAFILE_FROM_DC -#error Please set wxUSE_ENH_METAFILE_FROM_DC to 1 in include/wx/msw/enhmeta.h. -#endif - -#include "wx/dcprint.h" - -#ifndef WX_PRECOMP - #if defined(__WXMSW__) - #include "wx/msw/wrapcdlg.h" - #endif // MSW - #include "wx/utils.h" - #include "wx/dc.h" - #include "wx/app.h" - #include "wx/math.h" - #include "wx/msgdlg.h" - #include "wx/layout.h" - #include "wx/choice.h" - #include "wx/button.h" - #include "wx/settings.h" - #include "wx/dcmemory.h" - #include "wx/stattext.h" - #include "wx/intl.h" - #include "wx/textdlg.h" - #include "wx/sizer.h" - #include "wx/module.h" -#endif // !WX_PRECOMP - -#include "wx/prntbase.h" -#include "wx/printdlg.h" -#include "wx/print.h" -#include "wx/dcprint.h" - -#include -#include - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) -#include "wx/msw/printdlg.h" -#elif defined(__WXMAC__) -#include "wx/mac/printdlg.h" -#include "wx/mac/private/print.h" -#else -#include "wx/generic/prntdlgg.h" -#include "wx/dcps.h" -#endif - -#ifdef __WXMSW__ - #ifndef __WIN32__ - #include - #endif -#endif // __WXMSW__ - -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - -#include "wx/msw/dib.h" -#include "wx/image.h" - -typedef bool (wxPrintPreviewBase::*RenderPageIntoDCFunc)(wxDC&, int); -static bool RenderPageIntoBitmapHQ(wxPrintPreviewBase *preview, - RenderPageIntoDCFunc RenderPageIntoDC, - wxBitmap& bmp, int pageNum); -#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - -//---------------------------------------------------------------------------- -// wxPrintFactory -//---------------------------------------------------------------------------- - -wxPrintFactory *wxPrintFactory::m_factory = NULL; - -void wxPrintFactory::SetPrintFactory( wxPrintFactory *factory ) -{ - if (wxPrintFactory::m_factory) - delete wxPrintFactory::m_factory; - - wxPrintFactory::m_factory = factory; -} - -wxPrintFactory *wxPrintFactory::GetFactory() -{ - if (!wxPrintFactory::m_factory) - wxPrintFactory::m_factory = new wxNativePrintFactory; - - return wxPrintFactory::m_factory; -} - -//---------------------------------------------------------------------------- -// wxNativePrintFactory -//---------------------------------------------------------------------------- - -wxPrinterBase *wxNativePrintFactory::CreatePrinter( wxPrintDialogData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrinter( data ); -#elif defined(__WXMAC__) - return new wxMacPrinter( data ); -#elif defined(__WXPM__) - return new wxOS2Printer( data ); -#else - return new wxPostScriptPrinter( data ); -#endif -} - -wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, wxPrintDialogData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrintPreview( preview, printout, data ); -#elif defined(__WXMAC__) - return new wxMacPrintPreview( preview, printout, data ); -#elif defined(__WXPM__) - return new wxOS2PrintPreview( preview, printout, data ); -#else - return new wxPostScriptPrintPreview( preview, printout, data ); -#endif -} - -wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, wxPrintData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrintPreview( preview, printout, data ); -#elif defined(__WXMAC__) - return new wxMacPrintPreview( preview, printout, data ); -#elif defined(__WXPM__) - return new wxOS2PrintPreview( preview, printout, data ); -#else - return new wxPostScriptPrintPreview( preview, printout, data ); -#endif -} - -wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrintDialog( parent, data ); -#elif defined(__WXMAC__) - return new wxMacPrintDialog( parent, data ); -#else - return new wxGenericPrintDialog( parent, data ); -#endif -} - -wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent, - wxPrintData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrintDialog( parent, data ); -#elif defined(__WXMAC__) - return new wxMacPrintDialog( parent, data ); -#else - return new wxGenericPrintDialog( parent, data ); -#endif -} - -wxPageSetupDialogBase *wxNativePrintFactory::CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPageSetupDialog( parent, data ); -#elif defined(__WXMAC__) - return new wxMacPageSetupDialog( parent, data ); -#else - return new wxGenericPageSetupDialog( parent, data ); -#endif -} - -bool wxNativePrintFactory::HasPrintSetupDialog() -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return false; -#elif defined(__WXMAC__) - return false; -#else - // Only here do we need to provide the print setup - // dialog ourselves, the other platforms either have - // none, don't make it accessible or let you configure - // the printer from the wxPrintDialog anyway. - return true; -#endif - -} - -wxDialog *wxNativePrintFactory::CreatePrintSetupDialog( wxWindow *parent, - wxPrintData *data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - wxUnusedVar(parent); - wxUnusedVar(data); - return NULL; -#elif defined(__WXMAC__) - wxUnusedVar(parent); - wxUnusedVar(data); - return NULL; -#else - // Only here do we need to provide the print setup - // dialog ourselves, the other platforms either have - // none, don't make it accessible or let you configure - // the printer from the wxPrintDialog anyway. - return new wxGenericPrintSetupDialog( parent, data ); -#endif -} - -wxDC* wxNativePrintFactory::CreatePrinterDC( const wxPrintData& data ) -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxPrinterDC(data); -#elif defined(__WXMAC__) - return new wxPrinterDC(data); -#else - return new wxPostScriptDC(data); -#endif -} - -bool wxNativePrintFactory::HasOwnPrintToFile() -{ - // Only relevant for PostScript and here the - // setup dialog provides no "print to file" - // option. In the GNOME setup dialog, the - // setup dialog has its own print to file. - return false; -} - -bool wxNativePrintFactory::HasPrinterLine() -{ - // Only relevant for PostScript for now - return true; -} - -wxString wxNativePrintFactory::CreatePrinterLine() -{ - // Only relevant for PostScript for now - - // We should query "lpstat -d" here - return _("Generic PostScript"); -} - -bool wxNativePrintFactory::HasStatusLine() -{ - // Only relevant for PostScript for now - return true; -} - -wxString wxNativePrintFactory::CreateStatusLine() -{ - // Only relevant for PostScript for now - - // We should query "lpstat -r" or "lpstat -p" here - return _("Ready"); -} - -wxPrintNativeDataBase *wxNativePrintFactory::CreatePrintNativeData() -{ -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - return new wxWindowsPrintNativeData; -#elif defined(__WXMAC__) - return new wxMacCarbonPrintData; -#else - return new wxPostScriptPrintNativeData; -#endif -} - -//---------------------------------------------------------------------------- -// wxPrintNativeDataBase -//---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxPrintNativeDataBase, wxObject) - -wxPrintNativeDataBase::wxPrintNativeDataBase() -{ - m_ref = 1; -} - -//---------------------------------------------------------------------------- -// wxPrintFactoryModule -//---------------------------------------------------------------------------- - -class wxPrintFactoryModule: public wxModule -{ -public: - wxPrintFactoryModule() {} - bool OnInit() { return true; } - void OnExit() { wxPrintFactory::SetPrintFactory( NULL ); } - -private: - DECLARE_DYNAMIC_CLASS(wxPrintFactoryModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxPrintFactoryModule, wxModule) - -//---------------------------------------------------------------------------- -// wxPrinterBase -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPrinterBase, wxObject) - -wxPrinterBase::wxPrinterBase(wxPrintDialogData *data) -{ - m_currentPrintout = (wxPrintout *) NULL; - sm_abortWindow = (wxWindow *) NULL; - sm_abortIt = false; - if (data) - m_printDialogData = (*data); - sm_lastError = wxPRINTER_NO_ERROR; -} - -wxWindow *wxPrinterBase::sm_abortWindow = (wxWindow *) NULL; -bool wxPrinterBase::sm_abortIt = false; -wxPrinterError wxPrinterBase::sm_lastError = wxPRINTER_NO_ERROR; - -wxPrinterBase::~wxPrinterBase() -{ -} - -wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout) -{ - wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE); - - wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL ); - button_sizer->Add( new wxStaticText(dialog, wxID_ANY, _("Please wait while printing\n") + printout->GetTitle() ), 0, wxALL, 10 ); - button_sizer->Add( new wxButton( dialog, wxID_CANCEL, wxT("Cancel") ), 0, wxALL | wxALIGN_CENTER, 10 ); - - dialog->SetAutoLayout( true ); - dialog->SetSizer( button_sizer ); - - button_sizer->Fit(dialog); - button_sizer->SetSizeHints (dialog) ; - - return dialog; -} - -void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), const wxString& message) -{ - wxMessageBox(message, _("Printing Error"), wxOK, parent); -} - -wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const -{ - return (wxPrintDialogData&) m_printDialogData; -} - -//---------------------------------------------------------------------------- -// wxPrinter -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPrinter, wxPrinterBase) - -wxPrinter::wxPrinter(wxPrintDialogData *data) -{ - m_pimpl = wxPrintFactory::GetFactory()->CreatePrinter( data ); -} - -wxPrinter::~wxPrinter() -{ - delete m_pimpl; -} - -wxWindow *wxPrinter::CreateAbortWindow(wxWindow *parent, wxPrintout *printout) -{ - return m_pimpl->CreateAbortWindow( parent, printout ); -} - -void wxPrinter::ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message) -{ - m_pimpl->ReportError( parent, printout, message ); -} - -bool wxPrinter::Setup(wxWindow *parent) -{ - return m_pimpl->Setup( parent ); -} - -bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) -{ - return m_pimpl->Print( parent, printout, prompt ); -} - -wxDC* wxPrinter::PrintDialog(wxWindow *parent) -{ - return m_pimpl->PrintDialog( parent ); -} - -wxPrintDialogData& wxPrinter::GetPrintDialogData() const -{ - return m_pimpl->GetPrintDialogData(); -} - -// --------------------------------------------------------------------------- -// wxPrintDialogBase: the dialog for printing. -// --------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase, wxDialog) - -wxPrintDialogBase::wxPrintDialogBase(wxWindow *parent, - wxWindowID id, - const wxString &title, - const wxPoint &pos, - const wxSize &size, - long style) - : wxDialog( parent, id, title.empty() ? wxString(_("Print")) : title, - pos, size, style ) -{ -} - -// --------------------------------------------------------------------------- -// wxPrintDialog: the dialog for printing -// --------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPrintDialog, wxObject) - -wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintDialogData* data) -{ - m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data ); -} - -wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintData* data) -{ - m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data ); -} - -wxPrintDialog::~wxPrintDialog() -{ - delete m_pimpl; -} - -int wxPrintDialog::ShowModal() -{ - return m_pimpl->ShowModal(); -} - -wxPrintDialogData& wxPrintDialog::GetPrintDialogData() -{ - return m_pimpl->GetPrintDialogData(); -} - -wxPrintData& wxPrintDialog::GetPrintData() -{ - return m_pimpl->GetPrintData(); -} - -wxDC *wxPrintDialog::GetPrintDC() -{ - return m_pimpl->GetPrintDC(); -} - -// --------------------------------------------------------------------------- -// wxPageSetupDialogBase: the page setup dialog -// --------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxPageSetupDialogBase, wxDialog) - -wxPageSetupDialogBase::wxPageSetupDialogBase(wxWindow *parent, - wxWindowID id, - const wxString &title, - const wxPoint &pos, - const wxSize &size, - long style) - : wxDialog( parent, id, title.empty() ? wxString(_("Page setup")) : title, - pos, size, style ) -{ -} - -// --------------------------------------------------------------------------- -// wxPageSetupDialog: the page setup dialog -// --------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPageSetupDialog, wxObject) - -wxPageSetupDialog::wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data ) -{ - m_pimpl = wxPrintFactory::GetFactory()->CreatePageSetupDialog( parent, data ); -} - -wxPageSetupDialog::~wxPageSetupDialog() -{ - delete m_pimpl; -} - -int wxPageSetupDialog::ShowModal() -{ - return m_pimpl->ShowModal(); -} - -wxPageSetupDialogData& wxPageSetupDialog::GetPageSetupDialogData() -{ - return m_pimpl->GetPageSetupDialogData(); -} - -// old name -wxPageSetupDialogData& wxPageSetupDialog::GetPageSetupData() -{ - return m_pimpl->GetPageSetupDialogData(); -} - -//---------------------------------------------------------------------------- -// wxPrintAbortDialog -//---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) -END_EVENT_TABLE() - -void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) -{ - wxPrinterBase::sm_abortIt = true; - wxPrinterBase::sm_abortWindow->Show(false); - wxPrinterBase::sm_abortWindow->Close(true); - wxPrinterBase::sm_abortWindow->Destroy(); - wxPrinterBase::sm_abortWindow = (wxWindow *) NULL; -} - -//---------------------------------------------------------------------------- -// wxPrintout -//---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) - -wxPrintout::wxPrintout(const wxString& title) -{ - m_printoutTitle = title ; - m_printoutDC = (wxDC *) NULL; - m_pageWidthMM = 0; - m_pageHeightMM = 0; - m_pageWidthPixels = 0; - m_pageHeightPixels = 0; - m_PPIScreenX = 0; - m_PPIScreenY = 0; - m_PPIPrinterX = 0; - m_PPIPrinterY = 0; - m_isPreview = false; -} - -wxPrintout::~wxPrintout() -{ -} - -bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage)) -{ - return GetDC()->StartDoc(_("Printing ") + m_printoutTitle); -} - -void wxPrintout::OnEndDocument() -{ - GetDC()->EndDoc(); -} - -void wxPrintout::OnBeginPrinting() -{ -} - -void wxPrintout::OnEndPrinting() -{ -} - -bool wxPrintout::HasPage(int page) -{ - return (page == 1); -} - -void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage) -{ - *minPage = 1; - *maxPage = 32000; - *fromPage = 1; - *toPage = 1; -} - -void wxPrintout::FitThisSizeToPaper(const wxSize& imageSize) -{ - // Set the DC scale and origin so that the given image size fits within the - // entire page and the origin is at the top left corner of the page. Note - // that with most printers, portions of the page will be non-printable. Use - // this if you're managing your own page margins. - if (!m_printoutDC) return; - wxRect paperRect = GetPaperRectPixels(); - wxCoord pw, ph; - GetPageSizePixels(&pw, &ph); - wxCoord w, h; - m_printoutDC->GetSize(&w, &h); - float scaleX = ((float(paperRect.width) * w) / (float(pw) * imageSize.x)); - float scaleY = ((float(paperRect.height) * h) / (float(ph) * imageSize.y)); - float actualScale = wxMin(scaleX, scaleY); - m_printoutDC->SetUserScale(actualScale, actualScale); - m_printoutDC->SetDeviceOrigin(0, 0); - wxRect logicalPaperRect = GetLogicalPaperRect(); - SetLogicalOrigin(logicalPaperRect.x, logicalPaperRect.y); -} - -void wxPrintout::FitThisSizeToPage(const wxSize& imageSize) -{ - // Set the DC scale and origin so that the given image size fits within the - // printable area of the page and the origin is at the top left corner of - // the printable area. - if (!m_printoutDC) return; - int w, h; - m_printoutDC->GetSize(&w, &h); - float scaleX = float(w) / imageSize.x; - float scaleY = float(h) / imageSize.y; - float actualScale = wxMin(scaleX, scaleY); - m_printoutDC->SetUserScale(actualScale, actualScale); - m_printoutDC->SetDeviceOrigin(0, 0); -} - -void wxPrintout::FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData) -{ - // Set the DC scale and origin so that the given image size fits within the - // page margins defined in the given wxPageSetupDialogData object and the - // origin is at the top left corner of the page margins. - if (!m_printoutDC) return; - wxRect paperRect = GetPaperRectPixels(); - wxCoord pw, ph; - GetPageSizePixels(&pw, &ph); - wxPoint topLeft = pageSetupData.GetMarginTopLeft(); - wxPoint bottomRight = pageSetupData.GetMarginBottomRight(); - wxCoord mw, mh; - GetPageSizeMM(&mw, &mh); - float mmToDeviceX = float(pw) / mw; - float mmToDeviceY = float(ph) / mh; - wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x), - paperRect.y + wxRound(mmToDeviceY * topLeft.y), - paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)), - paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y))); - wxCoord w, h; - m_printoutDC->GetSize(&w, &h); - float scaleX = (float(pageMarginsRect.width) * w) / (float(pw) * imageSize.x); - float scaleY = (float(pageMarginsRect.height) * h) / (float(ph) * imageSize.y); - float actualScale = wxMin(scaleX, scaleY); - m_printoutDC->SetUserScale(actualScale, actualScale); - m_printoutDC->SetDeviceOrigin(0, 0); - wxRect logicalPageMarginsRect = GetLogicalPageMarginsRect(pageSetupData); - SetLogicalOrigin(logicalPageMarginsRect.x, logicalPageMarginsRect.y); -} - -void wxPrintout::MapScreenSizeToPaper() -{ - // Set the DC scale so that an image on the screen is the same size on the - // paper and the origin is at the top left of the paper. Note that with most - // printers, portions of the page will be cut off. Use this if you're - // managing your own page margins. - if (!m_printoutDC) return; - MapScreenSizeToPage(); - wxRect logicalPaperRect = GetLogicalPaperRect(); - SetLogicalOrigin(logicalPaperRect.x, logicalPaperRect.y); -} - -void wxPrintout::MapScreenSizeToPage() -{ - // Set the DC scale and origin so that an image on the screen is the same - // size on the paper and the origin is at the top left of the printable area. - if (!m_printoutDC) return; - int ppiScreenX, ppiScreenY; - GetPPIScreen(&ppiScreenX, &ppiScreenY); - int ppiPrinterX, ppiPrinterY; - GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); - int w, h; - m_printoutDC->GetSize(&w, &h); - int pageSizePixelsX, pageSizePixelsY; - GetPageSizePixels(&pageSizePixelsX, &pageSizePixelsY); - float userScaleX = (float(ppiPrinterX) * w) / (float(ppiScreenX) * pageSizePixelsX); - float userScaleY = (float(ppiPrinterY) * h) / (float(ppiScreenY) * pageSizePixelsY); - m_printoutDC->SetUserScale(userScaleX, userScaleY); - m_printoutDC->SetDeviceOrigin(0, 0); -} - -void wxPrintout::MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData) -{ - // Set the DC scale so that an image on the screen is the same size on the - // paper and the origin is at the top left of the page margins defined by - // the given wxPageSetupDialogData object. - if (!m_printoutDC) return; - MapScreenSizeToPage(); - wxRect logicalPageMarginsRect = GetLogicalPageMarginsRect(pageSetupData); - SetLogicalOrigin(logicalPageMarginsRect.x, logicalPageMarginsRect.y); -} - -void wxPrintout::MapScreenSizeToDevice() -{ - // Set the DC scale so that a screen pixel is the same size as a device - // pixel and the origin is at the top left of the printable area. - if (!m_printoutDC) return; - int w, h; - m_printoutDC->GetSize(&w, &h); - int pageSizePixelsX, pageSizePixelsY; - GetPageSizePixels(&pageSizePixelsX, &pageSizePixelsY); - float userScaleX = float(w) / pageSizePixelsX; - float userScaleY = float(h) / pageSizePixelsY; - m_printoutDC->SetUserScale(userScaleX, userScaleY); - m_printoutDC->SetDeviceOrigin(0, 0); -} - -wxRect wxPrintout::GetLogicalPaperRect() const -{ - // Return the rectangle in logical units that corresponds to the paper - // rectangle. - wxRect paperRect = GetPaperRectPixels(); - wxCoord pw, ph; - GetPageSizePixels(&pw, &ph); - wxCoord w, h; - m_printoutDC->GetSize(&w, &h); - if (w == pw && h == ph) { - // this DC matches the printed page, so no scaling - return wxRect(m_printoutDC->DeviceToLogicalX(paperRect.x), - m_printoutDC->DeviceToLogicalY(paperRect.y), - m_printoutDC->DeviceToLogicalXRel(paperRect.width), - m_printoutDC->DeviceToLogicalYRel(paperRect.height)); - } - // This DC doesn't match the printed page, so we have to scale. - float scaleX = float(w) / pw; - float scaleY = float(h) / ph; - return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(paperRect.x * scaleX)), - m_printoutDC->DeviceToLogicalY(wxRound(paperRect.y * scaleY)), - m_printoutDC->DeviceToLogicalXRel(wxRound(paperRect.width * scaleX)), - m_printoutDC->DeviceToLogicalYRel(wxRound(paperRect.height * scaleY))); -} - -wxRect wxPrintout::GetLogicalPageRect() const -{ - // Return the rectangle in logical units that corresponds to the printable - // area. - int w, h; - m_printoutDC->GetSize(&w, &h); - return wxRect(m_printoutDC->DeviceToLogicalX(0), - m_printoutDC->DeviceToLogicalY(0), - m_printoutDC->DeviceToLogicalXRel(w), - m_printoutDC->DeviceToLogicalYRel(h)); -} - -wxRect wxPrintout::GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const -{ - // Return the rectangle in logical units that corresponds to the region - // within the page margins as specified by the given wxPageSetupDialogData - // object. - wxRect paperRect = GetPaperRectPixels(); - wxCoord pw, ph; - GetPageSizePixels(&pw, &ph); - wxPoint topLeft = pageSetupData.GetMarginTopLeft(); - wxPoint bottomRight = pageSetupData.GetMarginBottomRight(); - wxCoord mw, mh; - GetPageSizeMM(&mw, &mh); - float mmToDeviceX = float(pw) / mw; - float mmToDeviceY = float(ph) / mh; - wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x), - paperRect.y + wxRound(mmToDeviceY * topLeft.y), - paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)), - paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y))); - wxCoord w, h; - m_printoutDC->GetSize(&w, &h); - if (w == pw && h == ph) { - // this DC matches the printed page, so no scaling - return wxRect(m_printoutDC->DeviceToLogicalX(pageMarginsRect.x), - m_printoutDC->DeviceToLogicalY(pageMarginsRect.y), - m_printoutDC->DeviceToLogicalXRel(pageMarginsRect.width), - m_printoutDC->DeviceToLogicalYRel(pageMarginsRect.height)); - } - // This DC doesn't match the printed page, so we have to scale. - float scaleX = float(w) / pw; - float scaleY = float(h) / ph; - return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(pageMarginsRect.x * scaleX)), - m_printoutDC->DeviceToLogicalY(wxRound(pageMarginsRect.y * scaleY)), - m_printoutDC->DeviceToLogicalXRel(wxRound(pageMarginsRect.width * scaleX)), - m_printoutDC->DeviceToLogicalYRel(wxRound(pageMarginsRect.height * scaleY))); -} - -void wxPrintout::SetLogicalOrigin(wxCoord x, wxCoord y) -{ - // Set the device origin by specifying a point in logical coordinates. - m_printoutDC->SetDeviceOrigin(m_printoutDC->LogicalToDeviceX(x), - m_printoutDC->LogicalToDeviceY(y)); -} - -void wxPrintout::OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff) -{ - // Offset the device origin by a specified distance in device coordinates. - wxCoord x = m_printoutDC->LogicalToDeviceX(0); - wxCoord y = m_printoutDC->LogicalToDeviceY(0); - m_printoutDC->SetDeviceOrigin(x + m_printoutDC->LogicalToDeviceXRel(xoff), - y + m_printoutDC->LogicalToDeviceYRel(yoff)); -} - - -//---------------------------------------------------------------------------- -// wxPreviewCanvas -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) - -BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) - EVT_PAINT(wxPreviewCanvas::OnPaint) - EVT_CHAR(wxPreviewCanvas::OnChar) - EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged) -#if wxUSE_MOUSEWHEEL - EVT_MOUSEWHEEL(wxPreviewCanvas::OnMouseWheel) -#endif -END_EVENT_TABLE() - -// VZ: the current code doesn't refresh properly without -// wxFULL_REPAINT_ON_RESIZE, this must be fixed as otherwise we have -// really horrible flicker when resizing the preview frame, but without -// this style it simply doesn't work correctly at all... -wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): -wxScrolledWindow(parent, wxID_ANY, pos, size, style | wxFULL_REPAINT_ON_RESIZE, name) -{ - m_printPreview = preview; -#ifdef __WXMAC__ - // The app workspace colour is always white, but we should have - // a contrast with the page. - wxSystemColour colourIndex = wxSYS_COLOUR_3DDKSHADOW; -#elif defined(__WXGTK__) - wxSystemColour colourIndex = wxSYS_COLOUR_BTNFACE; -#else - wxSystemColour colourIndex = wxSYS_COLOUR_APPWORKSPACE; -#endif - SetBackgroundColour(wxSystemSettings::GetColour(colourIndex)); - - SetScrollbars(10, 10, 100, 100); -} - -wxPreviewCanvas::~wxPreviewCanvas() -{ -} - -void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - PrepareDC( dc ); - -/* -#ifdef __WXGTK__ - if (!GetUpdateRegion().IsEmpty()) - dc.SetClippingRegion( GetUpdateRegion() ); -#endif -*/ - - if (m_printPreview) - { - m_printPreview->PaintPage(this, dc); - } -} - -// Responds to colour changes, and passes event on to children. -void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -#ifdef __WXMAC__ - // The app workspace colour is always white, but we should have - // a contrast with the page. - wxSystemColour colourIndex = wxSYS_COLOUR_3DDKSHADOW; -#elif defined(__WXGTK__) - wxSystemColour colourIndex = wxSYS_COLOUR_BTNFACE; -#else - wxSystemColour colourIndex = wxSYS_COLOUR_APPWORKSPACE; -#endif - SetBackgroundColour(wxSystemSettings::GetColour(colourIndex)); - Refresh(); - - // Propagate the event to the non-top-level children - wxWindow::OnSysColourChanged(event); -} - -void wxPreviewCanvas::OnChar(wxKeyEvent &event) -{ - wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar(); - if (event.GetKeyCode() == WXK_ESCAPE) - { - ((wxPreviewFrame*) GetParent())->Close(true); - return; - } - else if (event.GetKeyCode() == WXK_TAB) - { - controlBar->OnGoto(); - return; - } - else if (event.GetKeyCode() == WXK_RETURN) - { - controlBar->OnPrint(); - return; - } - - if (!event.ControlDown()) - { - event.Skip(); - return; - } - - switch(event.GetKeyCode()) - { - case WXK_PAGEDOWN: - controlBar->OnNext(); break; - case WXK_PAGEUP: - controlBar->OnPrevious(); break; - case WXK_HOME: - controlBar->OnFirst(); break; - case WXK_END: - controlBar->OnLast(); break; - default: - event.Skip(); - } -} - -#if wxUSE_MOUSEWHEEL - -void wxPreviewCanvas::OnMouseWheel(wxMouseEvent& event) -{ - wxPreviewControlBar * - controlBar = wxStaticCast(GetParent(), wxPreviewFrame)->GetControlBar(); - - if ( controlBar ) - { - if ( event.ControlDown() && event.GetWheelRotation() != 0 ) - { - int currentZoom = controlBar->GetZoomControl(); - - int delta; - if ( currentZoom < 100 ) - delta = 5; - else if ( currentZoom <= 120 ) - delta = 10; - else - delta = 50; - - if ( event.GetWheelRotation() > 0 ) - delta = -delta; - - int newZoom = currentZoom + delta; - if ( newZoom < 10 ) - newZoom = 10; - if ( newZoom > 200 ) - newZoom = 200; - if ( newZoom != currentZoom ) - { - controlBar->SetZoomControl(newZoom); - m_printPreview->SetZoom(newZoom); - Refresh(); - } - return; - } - } - - event.Skip(); -} - -#endif // wxUSE_MOUSEWHEEL - -//---------------------------------------------------------------------------- -// wxPreviewControlBar -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow) - -BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel) - EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose) - EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrintButton) - EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPreviousButton) - EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNextButton) - EVT_BUTTON(wxID_PREVIEW_FIRST, wxPreviewControlBar::OnFirstButton) - EVT_BUTTON(wxID_PREVIEW_LAST, wxPreviewControlBar::OnLastButton) - EVT_BUTTON(wxID_PREVIEW_GOTO, wxPreviewControlBar::OnGotoButton) - EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) - EVT_PAINT(wxPreviewControlBar::OnPaint) -END_EVENT_TABLE() - -wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons, - wxWindow *parent, const wxPoint& pos, const wxSize& size, - long style, const wxString& name): -wxPanel(parent, wxID_ANY, pos, size, style, name) -{ - m_printPreview = preview; - m_closeButton = (wxButton *) NULL; - m_nextPageButton = (wxButton *) NULL; - m_previousPageButton = (wxButton *) NULL; - m_printButton = (wxButton *) NULL; - m_zoomControl = (wxChoice *) NULL; - m_buttonFlags = buttons; -} - -wxPreviewControlBar::~wxPreviewControlBar() -{ -} - -void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - - int w, h; - GetSize(&w, &h); - dc.SetPen(*wxBLACK_PEN); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawLine( 0, h-1, w, h-1 ); -} - -void wxPreviewControlBar::OnWindowClose(wxCommandEvent& WXUNUSED(event)) -{ - wxPreviewFrame *frame = (wxPreviewFrame *)GetParent(); - frame->Close(true); -} - -void wxPreviewControlBar::OnPrint(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - preview->Print(true); -} - -void wxPreviewControlBar::OnNext(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - if (preview) - { - int currentPage = preview->GetCurrentPage(); - if ((preview->GetMaxPage() > 0) && - (currentPage < preview->GetMaxPage()) && - preview->GetPrintout()->HasPage(currentPage + 1)) - { - preview->SetCurrentPage(currentPage + 1); - } - } -} - -void wxPreviewControlBar::OnPrevious(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - if (preview) - { - int currentPage = preview->GetCurrentPage(); - if ((preview->GetMinPage() > 0) && - (currentPage > preview->GetMinPage()) && - preview->GetPrintout()->HasPage(currentPage - 1)) - { - preview->SetCurrentPage(currentPage - 1); - } - } -} - -void wxPreviewControlBar::OnFirst(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - if (preview) - { - int currentPage = preview->GetMinPage(); - if (preview->GetPrintout()->HasPage(currentPage)) - { - preview->SetCurrentPage(currentPage); - } - } -} - -void wxPreviewControlBar::OnLast(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - if (preview) - { - int currentPage = preview->GetMaxPage(); - if (preview->GetPrintout()->HasPage(currentPage)) - { - preview->SetCurrentPage(currentPage); - } - } -} - -void wxPreviewControlBar::OnGoto(void) -{ - wxPrintPreviewBase *preview = GetPrintPreview(); - if (preview) - { - long currentPage; - - if (preview->GetMinPage() > 0) - { - wxString strPrompt; - wxString strPage; - - strPrompt.Printf( _("Enter a page number between %d and %d:"), - preview->GetMinPage(), preview->GetMaxPage()); - strPage.Printf( wxT("%d"), preview->GetCurrentPage() ); - - strPage = - wxGetTextFromUser( strPrompt, _("Goto Page"), strPage, GetParent()); - - if ( strPage.ToLong( ¤tPage ) ) - if (preview->GetPrintout()->HasPage(currentPage)) - { - preview->SetCurrentPage(currentPage); - } - } - } -} - -void wxPreviewControlBar::OnZoom(wxCommandEvent& WXUNUSED(event)) -{ - int zoom = GetZoomControl(); - if (GetPrintPreview()) - GetPrintPreview()->SetZoom(zoom); -} - -void wxPreviewControlBar::CreateButtons() -{ - SetSize(0, 0, 400, 40); - - wxBoxSizer *item0 = new wxBoxSizer( wxHORIZONTAL ); - - m_closeButton = new wxButton( this, wxID_PREVIEW_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - item0->Add( m_closeButton, 0, wxALIGN_CENTRE|wxALL, 5 ); - - if (m_buttonFlags & wxPREVIEW_PRINT) - { - m_printButton = new wxButton( this, wxID_PREVIEW_PRINT, _("&Print..."), wxDefaultPosition, wxDefaultSize, 0 ); - item0->Add( m_printButton, 0, wxALIGN_CENTRE|wxALL, 5 ); - } - - // Exact-fit buttons are too tiny on wxUniversal - int navButtonStyle; - wxSize navButtonSize; -#ifdef __WXUNIVERSAL__ - navButtonStyle = 0; - navButtonSize = wxSize(40, m_closeButton->GetSize().y); -#else - navButtonStyle = wxBU_EXACTFIT; - navButtonSize = wxDefaultSize; -#endif - - if (m_buttonFlags & wxPREVIEW_FIRST) - { - m_firstPageButton = new wxButton( this, wxID_PREVIEW_FIRST, _("|<<"), wxDefaultPosition, navButtonSize, navButtonStyle ); - item0->Add( m_firstPageButton, 0, wxALIGN_CENTRE|wxALL, 5 ); - } - - if (m_buttonFlags & wxPREVIEW_PREVIOUS) - { - m_previousPageButton = new wxButton( this, wxID_PREVIEW_PREVIOUS, _("<<"), wxDefaultPosition, navButtonSize, navButtonStyle ); - item0->Add( m_previousPageButton, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); - } - - if (m_buttonFlags & wxPREVIEW_NEXT) - { - m_nextPageButton = new wxButton( this, wxID_PREVIEW_NEXT, _(">>"), wxDefaultPosition, navButtonSize, navButtonStyle ); - item0->Add( m_nextPageButton, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); - } - - if (m_buttonFlags & wxPREVIEW_LAST) - { - m_lastPageButton = new wxButton( this, wxID_PREVIEW_LAST, _(">>|"), wxDefaultPosition, navButtonSize, navButtonStyle ); - item0->Add( m_lastPageButton, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); - } - - if (m_buttonFlags & wxPREVIEW_GOTO) - { - m_gotoPageButton = new wxButton( this, wxID_PREVIEW_GOTO, _("&Goto..."), wxDefaultPosition, wxDefaultSize, 0 ); - item0->Add( m_gotoPageButton, 0, wxALIGN_CENTRE|wxALL, 5 ); - } - - if (m_buttonFlags & wxPREVIEW_ZOOM) - { - wxString choices[] = - { - wxT("10%"), wxT("15%"), wxT("20%"), wxT("25%"), wxT("30%"), wxT("35%"), wxT("40%"), wxT("45%"), wxT("50%"), wxT("55%"), - wxT("60%"), wxT("65%"), wxT("70%"), wxT("75%"), wxT("80%"), wxT("85%"), wxT("90%"), wxT("95%"), wxT("100%"), wxT("110%"), - wxT("120%"), wxT("150%"), wxT("200%") - }; - int n = WXSIZEOF(choices); - - m_zoomControl = new wxChoice( this, wxID_PREVIEW_ZOOM, wxDefaultPosition, wxSize(70,wxDefaultCoord), n, choices, 0 ); - item0->Add( m_zoomControl, 0, wxALIGN_CENTRE|wxALL, 5 ); - SetZoomControl(m_printPreview->GetZoom()); - } - - SetSizer(item0); - item0->Fit(this); -} - -void wxPreviewControlBar::SetZoomControl(int zoom) -{ - if (m_zoomControl) - { - int n, count = m_zoomControl->GetCount(); - long val; - for (n=0; nGetString(n).BeforeFirst(wxT('%')).ToLong(&val) && - (val >= long(zoom))) - { - m_zoomControl->SetSelection(n); - return; - } - } - - m_zoomControl->SetSelection(count-1); - } -} - -int wxPreviewControlBar::GetZoomControl() -{ - if (m_zoomControl && (m_zoomControl->GetStringSelection() != wxEmptyString)) - { - long val; - if (m_zoomControl->GetStringSelection().BeforeFirst(wxT('%')).ToLong(&val)) - return int(val); - } - - return 0; -} - - -/* -* Preview frame -*/ - -IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) - -BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame) - EVT_CLOSE(wxPreviewFrame::OnCloseWindow) -END_EVENT_TABLE() - -wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxWindow *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): -wxFrame(parent, wxID_ANY, title, pos, size, style, name) -{ - m_printPreview = preview; - m_controlBar = NULL; - m_previewCanvas = NULL; - m_windowDisabler = NULL; - - // Give the application icon -#ifdef __WXMSW__ - wxFrame* topFrame = wxDynamicCast(wxTheApp->GetTopWindow(), wxFrame); - if (topFrame) - SetIcon(topFrame->GetIcon()); -#endif -} - -wxPreviewFrame::~wxPreviewFrame() -{ -} - -void wxPreviewFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) -{ - if (m_windowDisabler) - delete m_windowDisabler; - - // Need to delete the printout and the print preview - wxPrintout *printout = m_printPreview->GetPrintout(); - if (printout) - { - delete printout; - m_printPreview->SetPrintout(NULL); - m_printPreview->SetCanvas(NULL); - m_printPreview->SetFrame(NULL); - } - delete m_printPreview; - - Destroy(); -} - -void wxPreviewFrame::Initialize() -{ -#if wxUSE_STATUSBAR - CreateStatusBar(); -#endif - CreateCanvas(); - CreateControlBar(); - - m_printPreview->SetCanvas(m_previewCanvas); - m_printPreview->SetFrame(this); - - wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); - - item0->Add( m_controlBar, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); - item0->Add( m_previewCanvas, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); - - SetAutoLayout( true ); - SetSizer( item0 ); - - m_windowDisabler = new wxWindowDisabler(this); - - Layout(); - - m_printPreview->AdjustScrollbars(m_previewCanvas); - m_previewCanvas->SetFocus(); - m_controlBar->SetFocus(); -} - -void wxPreviewFrame::CreateCanvas() -{ - m_previewCanvas = new wxPreviewCanvas(m_printPreview, this); -} - -void wxPreviewFrame::CreateControlBar() -{ - long buttons = wxPREVIEW_DEFAULT; - if (m_printPreview->GetPrintoutForPrinting()) - buttons |= wxPREVIEW_PRINT; - - m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0,0), wxSize(400, 40)); - m_controlBar->CreateButtons(); -} - -/* -* Print preview -*/ - -IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) - -wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data) -{ - if (data) - m_printDialogData = (*data); - - Init(printout, printoutForPrinting); -} - -wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintDialogData *data) -{ - if (data) - m_printDialogData = (*data); - - Init(printout, printoutForPrinting); -} - -void wxPrintPreviewBase::Init(wxPrintout *printout, - wxPrintout *printoutForPrinting) -{ - m_isOk = true; - m_previewPrintout = printout; - if (m_previewPrintout) - m_previewPrintout->SetIsPreview(true); - - m_printPrintout = printoutForPrinting; - - m_previewCanvas = NULL; - m_previewFrame = NULL; - m_previewBitmap = NULL; - m_currentPage = 1; - m_currentZoom = 70; - m_topMargin = 40; - m_leftMargin = 40; - m_pageWidth = 0; - m_pageHeight = 0; - m_printingPrepared = false; - m_minPage = 1; - m_maxPage = 1; -} - -wxPrintPreviewBase::~wxPrintPreviewBase() -{ - if (m_previewPrintout) - delete m_previewPrintout; - if (m_previewBitmap) - delete m_previewBitmap; - if (m_printPrintout) - delete m_printPrintout; -} - -bool wxPrintPreviewBase::SetCurrentPage(int pageNum) -{ - if (m_currentPage == pageNum) - return true; - - m_currentPage = pageNum; - if (m_previewBitmap) - { - delete m_previewBitmap; - m_previewBitmap = NULL; - } - - if (m_previewCanvas) - { - AdjustScrollbars(m_previewCanvas); - - if (!RenderPage(pageNum)) - return false; - m_previewCanvas->Refresh(); - m_previewCanvas->SetFocus(); - } - return true; -} - -int wxPrintPreviewBase::GetCurrentPage() const - { return m_currentPage; } -void wxPrintPreviewBase::SetPrintout(wxPrintout *printout) - { m_previewPrintout = printout; } -wxPrintout *wxPrintPreviewBase::GetPrintout() const - { return m_previewPrintout; } -wxPrintout *wxPrintPreviewBase::GetPrintoutForPrinting() const - { return m_printPrintout; } -void wxPrintPreviewBase::SetFrame(wxFrame *frame) - { m_previewFrame = frame; } -void wxPrintPreviewBase::SetCanvas(wxPreviewCanvas *canvas) - { m_previewCanvas = canvas; } -wxFrame *wxPrintPreviewBase::GetFrame() const - { return m_previewFrame; } -wxPreviewCanvas *wxPrintPreviewBase::GetCanvas() const - { return m_previewCanvas; } - -void wxPrintPreviewBase::CalcRects(wxPreviewCanvas *canvas, wxRect& pageRect, wxRect& paperRect) -{ - // Calculate the rectangles for the printable area of the page and the - // entire paper as they appear on the canvas on-screen. - int canvasWidth, canvasHeight; - canvas->GetSize(&canvasWidth, &canvasHeight); - - float zoomScale = float(m_currentZoom) / 100; - float screenPrintableWidth = zoomScale * m_pageWidth * m_previewScaleX; - float screenPrintableHeight = zoomScale * m_pageHeight * m_previewScaleY; - - wxRect devicePaperRect = m_previewPrintout->GetPaperRectPixels(); - wxCoord devicePrintableWidth, devicePrintableHeight; - m_previewPrintout->GetPageSizePixels(&devicePrintableWidth, &devicePrintableHeight); - float scaleX = screenPrintableWidth / devicePrintableWidth; - float scaleY = screenPrintableHeight / devicePrintableHeight; - paperRect.width = wxCoord(scaleX * devicePaperRect.width); - paperRect.height = wxCoord(scaleY * devicePaperRect.height); - - paperRect.x = wxCoord((canvasWidth - paperRect.width)/ 2.0); - if (paperRect.x < m_leftMargin) - paperRect.x = m_leftMargin; - paperRect.y = wxCoord((canvasHeight - paperRect.height)/ 2.0); - if (paperRect.y < m_topMargin) - paperRect.y = m_topMargin; - - pageRect.x = paperRect.x - wxCoord(scaleX * devicePaperRect.x); - pageRect.y = paperRect.y - wxCoord(scaleY * devicePaperRect.y); - pageRect.width = wxCoord(screenPrintableWidth); - pageRect.height = wxCoord(screenPrintableHeight); -} - - -bool wxPrintPreviewBase::PaintPage(wxPreviewCanvas *canvas, wxDC& dc) -{ - DrawBlankPage(canvas, dc); - - if (!m_previewBitmap) - if (!RenderPage(m_currentPage)) - return false; - if (!m_previewBitmap) - return false; - if (!canvas) - return false; - - wxRect pageRect, paperRect; - CalcRects(canvas, pageRect, paperRect); - wxMemoryDC temp_dc; - temp_dc.SelectObject(*m_previewBitmap); - - dc.Blit(pageRect.x, pageRect.y, - m_previewBitmap->GetWidth(), m_previewBitmap->GetHeight(), &temp_dc, 0, 0); - - temp_dc.SelectObject(wxNullBitmap); - return true; -} - -// Adjusts the scrollbars for the current scale -void wxPrintPreviewBase::AdjustScrollbars(wxPreviewCanvas *canvas) -{ - if (!canvas) - return ; - - wxRect pageRect, paperRect; - CalcRects(canvas, pageRect, paperRect); - int totalWidth = paperRect.width + 2 * m_leftMargin; - int totalHeight = paperRect.height + 2 * m_topMargin; - int scrollUnitsX = totalWidth / 10; - int scrollUnitsY = totalHeight / 10; - wxSize virtualSize = canvas->GetVirtualSize(); - if (virtualSize.GetWidth() != totalWidth || virtualSize.GetHeight() != totalHeight) - canvas->SetScrollbars(10, 10, scrollUnitsX, scrollUnitsY, 0, 0, true); -} - -bool wxPrintPreviewBase::RenderPageIntoDC(wxDC& dc, int pageNum) -{ - m_previewPrintout->SetDC(&dc); - m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight); - - // Need to delay OnPreparePrinting() until here, so we have enough - // information. - if (!m_printingPrepared) - { - m_previewPrintout->OnPreparePrinting(); - int selFrom, selTo; - m_previewPrintout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo); - m_printingPrepared = true; - } - - m_previewPrintout->OnBeginPrinting(); - - if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) - { - wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK); - return false; - } - - m_previewPrintout->OnPrintPage(pageNum); - m_previewPrintout->OnEndDocument(); - m_previewPrintout->OnEndPrinting(); - - m_previewPrintout->SetDC(NULL); - - return true; -} - -bool wxPrintPreviewBase::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum) -{ -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - { - if ( RenderPageIntoBitmapHQ(this, - &wxPrintPreviewBase::RenderPageIntoDC, - bmp, pageNum) ) - { - return true; - } - } -#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - - wxMemoryDC memoryDC; - memoryDC.SelectObject(bmp); - memoryDC.Clear(); - - return RenderPageIntoDC(memoryDC, pageNum); -} - -bool wxPrintPreviewBase::RenderPage(int pageNum) -{ - wxBusyCursor busy; - - if (!m_previewCanvas) - { - wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!")); - return false; - } - - wxRect pageRect, paperRect; - CalcRects(m_previewCanvas, pageRect, paperRect); - - if (!m_previewBitmap) - { - m_previewBitmap = new wxBitmap(pageRect.width, pageRect.height); - - if (!m_previewBitmap || !m_previewBitmap->Ok()) - { - if (m_previewBitmap) { - delete m_previewBitmap; - m_previewBitmap = NULL; - } - wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK); - return false; - } - } - - if ( !RenderPageIntoBitmap(*m_previewBitmap, pageNum) ) - { - wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK); - - delete m_previewBitmap; - m_previewBitmap = NULL; - return false; - } - -#if wxUSE_STATUSBAR - wxString status; - if (m_maxPage != 0) - status = wxString::Format(_("Page %d of %d"), pageNum, m_maxPage); - else - status = wxString::Format(_("Page %d"), pageNum); - - if (m_previewFrame) - m_previewFrame->SetStatusText(status); -#endif - - return true; -} - -bool wxPrintPreviewBase::DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc) -{ - wxRect pageRect, paperRect; - - CalcRects(canvas, pageRect, paperRect); - - // Draw shadow, allowing for 1-pixel border AROUND the actual paper - wxCoord shadowOffset = 4; - - dc.SetPen(*wxBLACK_PEN); - dc.SetBrush(*wxBLACK_BRUSH); - dc.DrawRectangle(paperRect.x + shadowOffset, paperRect.y + paperRect.height + 1, - paperRect.width, shadowOffset); - - dc.DrawRectangle(paperRect.x + paperRect.width, paperRect.y + shadowOffset, - shadowOffset, paperRect.height); - - // Draw blank page allowing for 1-pixel border AROUND the actual paper - dc.SetPen(*wxBLACK_PEN); - dc.SetBrush(*wxWHITE_BRUSH); - dc.DrawRectangle(paperRect.x - 2, paperRect.y - 1, - paperRect.width + 3, paperRect.height + 2); - - return true; -} - -void wxPrintPreviewBase::SetZoom(int percent) -{ - if (m_currentZoom == percent) - return; - - m_currentZoom = percent; - if (m_previewBitmap) - { - delete m_previewBitmap; - m_previewBitmap = NULL; - } - - if (m_previewCanvas) - { - AdjustScrollbars(m_previewCanvas); - RenderPage(m_currentPage); - ((wxScrolledWindow *) m_previewCanvas)->Scroll(0, 0); - m_previewCanvas->ClearBackground(); - m_previewCanvas->Refresh(); - m_previewCanvas->SetFocus(); - } -} - -wxPrintDialogData& wxPrintPreviewBase::GetPrintDialogData() -{ - return m_printDialogData; -} - -int wxPrintPreviewBase::GetZoom() const -{ return m_currentZoom; } -int wxPrintPreviewBase::GetMaxPage() const -{ return m_maxPage; } -int wxPrintPreviewBase::GetMinPage() const -{ return m_minPage; } -bool wxPrintPreviewBase::IsOk() const -{ return m_isOk; } -void wxPrintPreviewBase::SetOk(bool ok) -{ m_isOk = ok; } - -//---------------------------------------------------------------------------- -// wxPrintPreview -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPrintPreview, wxPrintPreviewBase) - -wxPrintPreview::wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintDialogData *data) : - wxPrintPreviewBase( printout, printoutForPrinting, data ) -{ - m_pimpl = wxPrintFactory::GetFactory()-> - CreatePrintPreview( printout, printoutForPrinting, data ); -} - -wxPrintPreview::wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data ) : - wxPrintPreviewBase( printout, printoutForPrinting, data ) -{ - m_pimpl = wxPrintFactory::GetFactory()-> - CreatePrintPreview( printout, printoutForPrinting, data ); -} - -wxPrintPreview::~wxPrintPreview() -{ - delete m_pimpl; - - // don't delete twice - m_printPrintout = NULL; - m_previewPrintout = NULL; - m_previewBitmap = NULL; -} - -bool wxPrintPreview::SetCurrentPage(int pageNum) -{ - return m_pimpl->SetCurrentPage( pageNum ); -} - -int wxPrintPreview::GetCurrentPage() const -{ - return m_pimpl->GetCurrentPage(); -} - -void wxPrintPreview::SetPrintout(wxPrintout *printout) -{ - m_pimpl->SetPrintout( printout ); -} - -wxPrintout *wxPrintPreview::GetPrintout() const -{ - return m_pimpl->GetPrintout(); -} - -wxPrintout *wxPrintPreview::GetPrintoutForPrinting() const -{ - return m_pimpl->GetPrintoutForPrinting(); -} - -void wxPrintPreview::SetFrame(wxFrame *frame) -{ - m_pimpl->SetFrame( frame ); -} - -void wxPrintPreview::SetCanvas(wxPreviewCanvas *canvas) -{ - m_pimpl->SetCanvas( canvas ); -} - -wxFrame *wxPrintPreview::GetFrame() const -{ - return m_pimpl->GetFrame(); -} - -wxPreviewCanvas *wxPrintPreview::GetCanvas() const -{ - return m_pimpl->GetCanvas(); -} - -bool wxPrintPreview::PaintPage(wxPreviewCanvas *canvas, wxDC& dc) -{ - return m_pimpl->PaintPage( canvas, dc ); -} - -bool wxPrintPreview::DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc) -{ - return m_pimpl->DrawBlankPage( canvas, dc ); -} - -void wxPrintPreview::AdjustScrollbars(wxPreviewCanvas *canvas) -{ - m_pimpl->AdjustScrollbars( canvas ); -} - -bool wxPrintPreview::RenderPage(int pageNum) -{ - return m_pimpl->RenderPage( pageNum ); -} - -void wxPrintPreview::SetZoom(int percent) -{ - m_pimpl->SetZoom( percent ); -} - -int wxPrintPreview::GetZoom() const -{ - return m_pimpl->GetZoom(); -} - -wxPrintDialogData& wxPrintPreview::GetPrintDialogData() -{ - return m_pimpl->GetPrintDialogData(); -} - -int wxPrintPreview::GetMaxPage() const -{ - return m_pimpl->GetMaxPage(); -} - -int wxPrintPreview::GetMinPage() const -{ - return m_pimpl->GetMinPage(); -} - -bool wxPrintPreview::IsOk() const -{ - return m_pimpl->Ok(); -} - -void wxPrintPreview::SetOk(bool ok) -{ - m_pimpl->SetOk( ok ); -} - -bool wxPrintPreview::Print(bool interactive) -{ - return m_pimpl->Print( interactive ); -} - -void wxPrintPreview::DetermineScaling() -{ - m_pimpl->DetermineScaling(); -} - -//---------------------------------------------------------------------------- -// experimental backport of high-quality preview on Windows -//---------------------------------------------------------------------------- - -#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW -static bool RenderPageIntoBitmapHQ(wxPrintPreviewBase *preview, - RenderPageIntoDCFunc RenderPageIntoDC, - wxBitmap& bmp, int pageNum) -{ - // The preview, as implemented in wxPrintPreviewBase (and as used prior to - // wx3) is inexact: it uses screen DC, which has much lower resolution and - // has other properties different from printer DC, so the preview is not - // quite right. - // - // To make matters worse, if the application depends heavily on - // GetTextExtent() or does text layout itself, the output in preview and on - // paper can be very different. In particular, wxHtmlEasyPrinting is - // affected and the preview can be easily off by several pages. - // - // To fix this, we render the preview into high-resolution enhanced - // metafile with properties identical to the printer DC. This guarantees - // metrics correctness while still being fast. - - - // print the preview into a metafile: - wxPrinterDC printerDC(preview->GetPrintDialogData().GetPrintData()); - wxEnhMetaFileDC metaDC(printerDC, - wxEmptyString, - printerDC.GetSize().x, printerDC.GetSize().y); - - if ( !(preview->*RenderPageIntoDC)(metaDC, pageNum) ) - return false; - - wxEnhMetaFile *metafile = metaDC.Close(); - if ( !metafile ) - return false; - - // now render the metafile: - wxMemoryDC bmpDC; - bmpDC.SelectObject(bmp); - bmpDC.Clear(); - - wxRect outRect(0, 0, bmp.GetWidth(), bmp.GetHeight()); - metafile->Play(&bmpDC, &outRect); - - - delete metafile; - - // TODO: we should keep the metafile and reuse it when changing zoom level - - return true; -} -#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW - -#endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Source/3rdParty/wx/src/common/process.cpp b/Source/3rdParty/wx/src/common/process.cpp deleted file mode 100644 index 9e8681ad2..000000000 --- a/Source/3rdParty/wx/src/common/process.cpp +++ /dev/null @@ -1,172 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: process.cpp -// Purpose: Process termination classes -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin to check error codes, added Detach() method -// Created: 24/06/98 -// RCS-ID: $Id: process.cpp 42702 2006-10-30 09:03:18Z JS $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/process.h" - -// ---------------------------------------------------------------------------- -// event tables and such -// ---------------------------------------------------------------------------- - -DEFINE_EVENT_TYPE(wxEVT_END_PROCESS) - -IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler) -IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent) - -// ============================================================================ -// wxProcess implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxProcess creation -// ---------------------------------------------------------------------------- - -void wxProcess::Init(wxEvtHandler *parent, int id, int flags) -{ - if ( parent ) - SetNextHandler(parent); - - m_id = id; - m_pid = 0; - m_redirect = (flags & wxPROCESS_REDIRECT) != 0; - -#if wxUSE_STREAMS - m_inputStream = NULL; - m_errorStream = NULL; - m_outputStream = NULL; -#endif // wxUSE_STREAMS -} - -/* static */ -wxProcess *wxProcess::Open(const wxString& cmd, int flags) -{ - wxASSERT_MSG( !(flags & wxEXEC_SYNC), wxT("wxEXEC_SYNC should not be used." )); - wxProcess *process = new wxProcess(wxPROCESS_REDIRECT); - long pid = wxExecute(cmd, flags, process); - if( !pid ) - { - // couldn't launch the process - delete process; - return NULL; - } - - process->SetPid(pid); - - return process; -} - -// ---------------------------------------------------------------------------- -// wxProcess termination -// ---------------------------------------------------------------------------- - -wxProcess::~wxProcess() -{ -#if wxUSE_STREAMS - delete m_inputStream; - delete m_errorStream; - delete m_outputStream; -#endif // wxUSE_STREAMS -} - -void wxProcess::OnTerminate(int pid, int status) -{ - wxProcessEvent event(m_id, pid, status); - - if ( !ProcessEvent(event) ) - delete this; - //else: the object which processed the event is responsible for deleting - // us! -} - -void wxProcess::Detach() -{ - SetNextHandler(NULL); -} - -// ---------------------------------------------------------------------------- -// process IO redirection -// ---------------------------------------------------------------------------- - -#if wxUSE_STREAMS - -void wxProcess::SetPipeStreams(wxInputStream *inputSstream, - wxOutputStream *outputStream, - wxInputStream *errorStream) -{ - m_inputStream = inputSstream; - m_errorStream = errorStream; - m_outputStream = outputStream; -} - -bool wxProcess::IsInputOpened() const -{ - return m_inputStream && m_inputStream->GetLastError() != wxSTREAM_EOF; -} - -bool wxProcess::IsInputAvailable() const -{ - return m_inputStream && m_inputStream->CanRead(); -} - -bool wxProcess::IsErrorAvailable() const -{ - return m_errorStream && m_errorStream->CanRead(); -} - -#endif // wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// process killing -// ---------------------------------------------------------------------------- - -/* static */ -wxKillError wxProcess::Kill(int pid, wxSignal sig, int flags) -{ - wxKillError rc; - (void)wxKill(pid, sig, &rc, flags); - - return rc; -} - -/* static */ -bool wxProcess::Exists(int pid) -{ - switch ( Kill(pid, wxSIGNONE) ) - { - case wxKILL_OK: - case wxKILL_ACCESS_DENIED: - return true; - - default: - case wxKILL_ERROR: - case wxKILL_BAD_SIGNAL: - wxFAIL_MSG( _T("unexpected wxProcess::Kill() return code") ); - // fall through - - case wxKILL_NO_PROCESS: - return false; - } -} - diff --git a/Source/3rdParty/wx/src/common/quantize.cpp b/Source/3rdParty/wx/src/common/quantize.cpp deleted file mode 100644 index 7ffa7b19a..000000000 --- a/Source/3rdParty/wx/src/common/quantize.cpp +++ /dev/null @@ -1,1654 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/quantize.cpp -// Purpose: wxQuantize implementation -// Author: Julian Smart -// Modified by: -// Created: 22/6/2000 -// RCS-ID: $Id: quantize.cpp 39957 2006-07-03 19:02:54Z ABX $ -// Copyright: (c) Thomas G. Lane, Vaclav Slavik, Julian Smart -// Licence: wxWindows licence + JPEG library licence -///////////////////////////////////////////////////////////////////////////// - -/* - * jquant2.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains 2-pass color quantization (color mapping) routines. - * These routines provide selection of a custom color map for an image, - * followed by mapping of the image to that color map, with optional - * Floyd-Steinberg dithering. - * It is also possible to use just the second pass to map to an arbitrary - * externally-given color map. - * - * Note: ordered dithering is not supported, since there isn't any fast - * way to compute intercolor distances; it's unclear that ordered dither's - * fundamental assumptions even hold with an irregularly spaced color map. - */ - -/* modified by Vaclav Slavik for use as jpeglib-independent module */ - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_IMAGE - -#include "wx/quantize.h" - -#ifndef WX_PRECOMP - #include "wx/palette.h" - #include "wx/image.h" -#endif - -#ifdef __WXMSW__ - #include "wx/msw/private.h" -#endif - -#include -#include - -#if defined(__OS2__) -#define RGB_RED_OS2 0 -#define RGB_GREEN_OS2 1 -#define RGB_BLUE_OS2 2 -#else -#define RGB_RED 0 -#define RGB_GREEN 1 -#define RGB_BLUE 2 -#endif -#define RGB_PIXELSIZE 3 - -#define MAXJSAMPLE 255 -#define CENTERJSAMPLE 128 -#define BITS_IN_JSAMPLE 8 -#define GETJSAMPLE(value) ((int) (value)) - -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) - -typedef unsigned short UINT16; -typedef signed short INT16; -#if !(defined(__WATCOMC__) && (defined(__WXMSW__) || defined(__WXMOTIF__))) -typedef signed int INT32; -#endif - -typedef unsigned char JSAMPLE; -typedef JSAMPLE *JSAMPROW; -typedef JSAMPROW *JSAMPARRAY; -typedef unsigned int JDIMENSION; - -typedef struct { - void *cquantize; - JDIMENSION output_width; - JSAMPARRAY colormap; - int actual_number_of_colors; - int desired_number_of_colors; - JSAMPLE *sample_range_limit, *srl_orig; -} j_decompress; - -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) - #define JMETHOD(type,methodname,arglist) type (__cdecl methodname) arglist -#else - #define JMETHOD(type,methodname,arglist) type (methodname) arglist -#endif - -typedef j_decompress *j_decompress_ptr; -struct jpeg_color_quantizer { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, bool is_pre_scan)); - JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, - int num_rows)); - JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); -}; - - - - -/* - * This module implements the well-known Heckbert paradigm for color - * quantization. Most of the ideas used here can be traced back to - * Heckbert's seminal paper - * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", - * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. - * - * In the first pass over the image, we accumulate a histogram showing the - * usage count of each possible color. To keep the histogram to a reasonable - * size, we reduce the precision of the input; typical practice is to retain - * 5 or 6 bits per color, so that 8 or 4 different input values are counted - * in the same histogram cell. - * - * Next, the color-selection step begins with a box representing the whole - * color space, and repeatedly splits the "largest" remaining box until we - * have as many boxes as desired colors. Then the mean color in each - * remaining box becomes one of the possible output colors. - * - * The second pass over the image maps each input pixel to the closest output - * color (optionally after applying a Floyd-Steinberg dithering correction). - * This mapping is logically trivial, but making it go fast enough requires - * considerable care. - * - * Heckbert-style quantizers vary a good deal in their policies for choosing - * the "largest" box and deciding where to cut it. The particular policies - * used here have proved out well in experimental comparisons, but better ones - * may yet be found. - * - * In earlier versions of the IJG code, this module quantized in YCbCr color - * space, processing the raw upsampled data without a color conversion step. - * This allowed the color conversion math to be done only once per colormap - * entry, not once per pixel. However, that optimization precluded other - * useful optimizations (such as merging color conversion with upsampling) - * and it also interfered with desired capabilities such as quantizing to an - * externally-supplied colormap. We have therefore abandoned that approach. - * The present code works in the post-conversion color space, typically RGB. - * - * To improve the visual quality of the results, we actually work in scaled - * RGB space, giving G distances more weight than R, and R in turn more than - * B. To do everything in integer math, we must use integer scale factors. - * The 2/3/1 scale factors used here correspond loosely to the relative - * weights of the colors in the NTSC grayscale equation. - * If you want to use this code to quantize a non-RGB color space, you'll - * probably need to change these scale factors. - */ - -#define R_SCALE 2 /* scale R distances by this much */ -#define G_SCALE 3 /* scale G distances by this much */ -#define B_SCALE 1 /* and B by this much */ - -/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined - * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B - * and B,G,R orders. If you define some other weird order in jmorecfg.h, - * you'll get compile errors until you extend this logic. In that case - * you'll probably want to tweak the histogram sizes too. - */ - -#if defined(__OS2__) - -#if RGB_RED_OS2 == 0 -#define C0_SCALE R_SCALE -#endif -#if RGB_BLUE_OS2 == 0 -#define C0_SCALE B_SCALE -#endif -#if RGB_GREEN_OS2 == 1 -#define C1_SCALE G_SCALE -#endif -#if RGB_RED_OS2 == 2 -#define C2_SCALE R_SCALE -#endif -#if RGB_BLUE_OS2 == 2 -#define C2_SCALE B_SCALE -#endif - -#else - -#if RGB_RED == 0 -#define C0_SCALE R_SCALE -#endif -#if RGB_BLUE == 0 -#define C0_SCALE B_SCALE -#endif -#if RGB_GREEN == 1 -#define C1_SCALE G_SCALE -#endif -#if RGB_RED == 2 -#define C2_SCALE R_SCALE -#endif -#if RGB_BLUE == 2 -#define C2_SCALE B_SCALE -#endif - -#endif - -/* - * First we have the histogram data structure and routines for creating it. - * - * The number of bits of precision can be adjusted by changing these symbols. - * We recommend keeping 6 bits for G and 5 each for R and B. - * If you have plenty of memory and cycles, 6 bits all around gives marginally - * better results; if you are short of memory, 5 bits all around will save - * some space but degrade the results. - * To maintain a fully accurate histogram, we'd need to allocate a "long" - * (preferably unsigned long) for each cell. In practice this is overkill; - * we can get by with 16 bits per cell. Few of the cell counts will overflow, - * and clamping those that do overflow to the maximum value will give close- - * enough results. This reduces the recommended histogram size from 256Kb - * to 128Kb, which is a useful savings on PC-class machines. - * (In the second pass the histogram space is re-used for pixel mapping data; - * in that capacity, each cell must be able to store zero to the number of - * desired colors. 16 bits/cell is plenty for that too.) - * Since the JPEG code is intended to run in small memory model on 80x86 - * machines, we can't just allocate the histogram in one chunk. Instead - * of a true 3-D array, we use a row of pointers to 2-D arrays. Each - * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and - * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that - * on 80x86 machines, the pointer row is in near memory but the actual - * arrays are in far memory (same arrangement as we use for image arrays). - */ - -#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ - -/* These will do the right thing for either R,G,B or B,G,R color order, - * but you may not like the results for other color orders. - */ -#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ -#define HIST_C1_BITS 6 /* bits of precision in G histogram */ -#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ - -/* Number of elements along histogram axes. */ -#define HIST_C0_ELEMS (1<cquantize; - register JSAMPROW ptr; - register histptr histp; - register hist3d histogram = cquantize->histogram; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - ptr = input_buf[row]; - for (col = width; col > 0; col--) { - - { - - /* get pixel value and index into the histogram */ - histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] - [GETJSAMPLE(ptr[1]) >> C1_SHIFT] - [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; - /* increment, check for overflow and undo increment if so. */ - if (++(*histp) <= 0) - (*histp)--; - } - ptr += 3; - } - } -} - - -/* - * Next we have the really interesting routines: selection of a colormap - * given the completed histogram. - * These routines work with a list of "boxes", each representing a rectangular - * subset of the input color space (to histogram precision). - */ - -typedef struct { - /* The bounds of the box (inclusive); expressed as histogram indexes */ - int c0min, c0max; - int c1min, c1max; - int c2min, c2max; - /* The volume (actually 2-norm) of the box */ - INT32 volume; - /* The number of nonzero histogram cells within this box */ - long colorcount; -} box; - -typedef box * boxptr; - - -boxptr -find_biggest_color_pop (boxptr boxlist, int numboxes) -/* Find the splittable box with the largest color population */ -/* Returns NULL if no splittable boxes remain */ -{ - register boxptr boxp; - register int i; - register long maxc = 0; - boxptr which = NULL; - - for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { - if (boxp->colorcount > maxc && boxp->volume > 0) { - which = boxp; - maxc = boxp->colorcount; - } - } - return which; -} - - -boxptr -find_biggest_volume (boxptr boxlist, int numboxes) -/* Find the splittable box with the largest (scaled) volume */ -/* Returns NULL if no splittable boxes remain */ -{ - register boxptr boxp; - register int i; - register INT32 maxv = 0; - boxptr which = NULL; - - for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { - if (boxp->volume > maxv) { - which = boxp; - maxv = boxp->volume; - } - } - return which; -} - - -void -update_box (j_decompress_ptr cinfo, boxptr boxp) -/* Shrink the min/max bounds of a box to enclose only nonzero elements, */ -/* and recompute its volume and population */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - histptr histp; - int c0,c1,c2; - int c0min,c0max,c1min,c1max,c2min,c2max; - INT32 dist0,dist1,dist2; - long ccount; - - c0min = boxp->c0min; c0max = boxp->c0max; - c1min = boxp->c1min; c1max = boxp->c1max; - c2min = boxp->c2min; c2max = boxp->c2max; - - if (c0max > c0min) - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0min = c0min = c0; - goto have_c0min; - } - } - have_c0min: - if (c0max > c0min) - for (c0 = c0max; c0 >= c0min; c0--) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0max = c0max = c0; - goto have_c0max; - } - } - have_c0max: - if (c1max > c1min) - for (c1 = c1min; c1 <= c1max; c1++) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1min = c1min = c1; - goto have_c1min; - } - } - have_c1min: - if (c1max > c1min) - for (c1 = c1max; c1 >= c1min; c1--) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1max = c1max = c1; - goto have_c1max; - } - } - have_c1max: - if (c2max > c2min) - for (c2 = c2min; c2 <= c2max; c2++) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2min = c2min = c2; - goto have_c2min; - } - } - have_c2min: - if (c2max > c2min) - for (c2 = c2max; c2 >= c2min; c2--) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2max = c2max = c2; - goto have_c2max; - } - } - have_c2max: - - /* Update box volume. - * We use 2-norm rather than real volume here; this biases the method - * against making long narrow boxes, and it has the side benefit that - * a box is splittable iff norm > 0. - * Since the differences are expressed in histogram-cell units, - * we have to shift back to JSAMPLE units to get consistent distances; - * after which, we scale according to the selected distance scale factors. - */ - dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE; - dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; - dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; - boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; - - /* Now scan remaining volume of box and compute population */ - ccount = 0; - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++, histp++) - if (*histp != 0) { - ccount++; - } - } - boxp->colorcount = ccount; -} - - -int -median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, - int desired_colors) -/* Repeatedly select and split the largest box until we have enough boxes */ -{ - int n,lb; - int c0,c1,c2,cmax; - register boxptr b1,b2; - - while (numboxes < desired_colors) { - /* Select box to split. - * Current algorithm: by population for first half, then by volume. - */ - if ((numboxes*2) <= desired_colors) { - b1 = find_biggest_color_pop(boxlist, numboxes); - } else { - b1 = find_biggest_volume(boxlist, numboxes); - } - if (b1 == NULL) /* no splittable boxes left! */ - break; - b2 = &boxlist[numboxes]; /* where new box will go */ - /* Copy the color bounds to the new box. */ - b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; - b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; - /* Choose which axis to split the box on. - * Current algorithm: longest scaled axis. - * See notes in update_box about scaling distances. - */ - c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE; - c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE; - c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE; - /* We want to break any ties in favor of green, then red, blue last. - * This code does the right thing for R,G,B or B,G,R color orders only. - */ -#if defined(__VISAGECPP__) - -#if RGB_RED_OS2 == 0 - cmax = c1; n = 1; - if (c0 > cmax) { cmax = c0; n = 0; } - if (c2 > cmax) { n = 2; } -#else - cmax = c1; n = 1; - if (c2 > cmax) { cmax = c2; n = 2; } - if (c0 > cmax) { n = 0; } -#endif - -#else - -#if RGB_RED == 0 - cmax = c1; n = 1; - if (c0 > cmax) { cmax = c0; n = 0; } - if (c2 > cmax) { n = 2; } -#else - cmax = c1; n = 1; - if (c2 > cmax) { cmax = c2; n = 2; } - if (c0 > cmax) { n = 0; } -#endif - -#endif - /* Choose split point along selected axis, and update box bounds. - * Current algorithm: split at halfway point. - * (Since the box has been shrunk to minimum volume, - * any split will produce two nonempty subboxes.) - * Note that lb value is max for lower box, so must be < old max. - */ - switch (n) { - case 0: - lb = (b1->c0max + b1->c0min) / 2; - b1->c0max = lb; - b2->c0min = lb+1; - break; - case 1: - lb = (b1->c1max + b1->c1min) / 2; - b1->c1max = lb; - b2->c1min = lb+1; - break; - case 2: - lb = (b1->c2max + b1->c2min) / 2; - b1->c2max = lb; - b2->c2min = lb+1; - break; - } - /* Update stats for boxes */ - update_box(cinfo, b1); - update_box(cinfo, b2); - numboxes++; - } - return numboxes; -} - - -void -compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) -/* Compute representative color for a box, put it in colormap[icolor] */ -{ - /* Current algorithm: mean weighted by pixels (not colors) */ - /* Note it is important to get the rounding correct! */ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - histptr histp; - int c0,c1,c2; - int c0min,c0max,c1min,c1max,c2min,c2max; - long count; - long total = 0; - long c0total = 0; - long c1total = 0; - long c2total = 0; - - c0min = boxp->c0min; c0max = boxp->c0max; - c1min = boxp->c1min; c1max = boxp->c1max; - c2min = boxp->c2min; c2max = boxp->c2max; - - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) { - if ((count = *histp++) != 0) { - total += count; - c0total += ((c0 << C0_SHIFT) + ((1<>1)) * count; - c1total += ((c1 << C1_SHIFT) + ((1<>1)) * count; - c2total += ((c2 << C2_SHIFT) + ((1<>1)) * count; - } - } - } - - cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); - cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); - cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); -} - - -static void -select_colors (j_decompress_ptr cinfo, int desired_colors) -/* Master routine for color selection */ -{ - boxptr boxlist; - int numboxes; - int i; - - /* Allocate workspace for box list */ - boxlist = (boxptr) malloc(desired_colors * sizeof(box)); - /* Initialize one box containing whole space */ - numboxes = 1; - boxlist[0].c0min = 0; - boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT; - boxlist[0].c1min = 0; - boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT; - boxlist[0].c2min = 0; - boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT; - /* Shrink it to actually-used volume and set its statistics */ - update_box(cinfo, & boxlist[0]); - /* Perform median-cut to produce final box list */ - numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors); - /* Compute the representative color for each box, fill colormap */ - for (i = 0; i < numboxes; i++) - compute_color(cinfo, & boxlist[i], i); - cinfo->actual_number_of_colors = numboxes; - - free(boxlist); //FIXME?? I don't know if this is correct - VS -} - - -/* - * These routines are concerned with the time-critical task of mapping input - * colors to the nearest color in the selected colormap. - * - * We re-use the histogram space as an "inverse color map", essentially a - * cache for the results of nearest-color searches. All colors within a - * histogram cell will be mapped to the same colormap entry, namely the one - * closest to the cell's center. This may not be quite the closest entry to - * the actual input color, but it's almost as good. A zero in the cache - * indicates we haven't found the nearest color for that cell yet; the array - * is cleared to zeroes before starting the mapping pass. When we find the - * nearest color for a cell, its colormap index plus one is recorded in the - * cache for future use. The pass2 scanning routines call fill_inverse_cmap - * when they need to use an unfilled entry in the cache. - * - * Our method of efficiently finding nearest colors is based on the "locally - * sorted search" idea described by Heckbert and on the incremental distance - * calculation described by Spencer W. Thomas in chapter III.1 of Graphics - * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that - * the distances from a given colormap entry to each cell of the histogram can - * be computed quickly using an incremental method: the differences between - * distances to adjacent cells themselves differ by a constant. This allows a - * fairly fast implementation of the "brute force" approach of computing the - * distance from every colormap entry to every histogram cell. Unfortunately, - * it needs a work array to hold the best-distance-so-far for each histogram - * cell (because the inner loop has to be over cells, not colormap entries). - * The work array elements have to be INT32s, so the work array would need - * 256Kb at our recommended precision. This is not feasible in DOS machines. - * - * To get around these problems, we apply Thomas' method to compute the - * nearest colors for only the cells within a small subbox of the histogram. - * The work array need be only as big as the subbox, so the memory usage - * problem is solved. Furthermore, we need not fill subboxes that are never - * referenced in pass2; many images use only part of the color gamut, so a - * fair amount of work is saved. An additional advantage of this - * approach is that we can apply Heckbert's locality criterion to quickly - * eliminate colormap entries that are far away from the subbox; typically - * three-fourths of the colormap entries are rejected by Heckbert's criterion, - * and we need not compute their distances to individual cells in the subbox. - * The speed of this approach is heavily influenced by the subbox size: too - * small means too much overhead, too big loses because Heckbert's criterion - * can't eliminate as many colormap entries. Empirically the best subbox - * size seems to be about 1/512th of the histogram (1/8th in each direction). - * - * Thomas' article also describes a refined method which is asymptotically - * faster than the brute-force method, but it is also far more complex and - * cannot efficiently be applied to small subboxes. It is therefore not - * useful for programs intended to be portable to DOS machines. On machines - * with plenty of memory, filling the whole histogram in one shot with Thomas' - * refined method might be faster than the present code --- but then again, - * it might not be any faster, and it's certainly more complicated. - */ - - -/* log2(histogram cells in update box) for each axis; this can be adjusted */ -#define BOX_C0_LOG (HIST_C0_BITS-3) -#define BOX_C1_LOG (HIST_C1_BITS-3) -#define BOX_C2_LOG (HIST_C2_BITS-3) - -#define BOX_C0_ELEMS (1<actual_number_of_colors; - int maxc0, maxc1, maxc2; - int centerc0, centerc1, centerc2; - int i, x, ncolors; - INT32 minmaxdist, min_dist, max_dist, tdist; - INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ - - /* Compute true coordinates of update box's upper corner and center. - * Actually we compute the coordinates of the center of the upper-corner - * histogram cell, which are the upper bounds of the volume we care about. - * Note that since ">>" rounds down, the "center" values may be closer to - * min than to max; hence comparisons to them must be "<=", not "<". - */ - maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT)); - centerc0 = (minc0 + maxc0) >> 1; - maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT)); - centerc1 = (minc1 + maxc1) >> 1; - maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT)); - centerc2 = (minc2 + maxc2) >> 1; - - /* For each color in colormap, find: - * 1. its minimum squared-distance to any point in the update box - * (zero if color is within update box); - * 2. its maximum squared-distance to any point in the update box. - * Both of these can be found by considering only the corners of the box. - * We save the minimum distance for each color in mindist[]; - * only the smallest maximum distance is of interest. - */ - minmaxdist = 0x7FFFFFFFL; - - for (i = 0; i < numcolors; i++) { - /* We compute the squared-c0-distance term, then add in the other two. */ - x = GETJSAMPLE(cinfo->colormap[0][i]); - if (x < minc0) { - tdist = (x - minc0) * C0_SCALE; - min_dist = tdist*tdist; - tdist = (x - maxc0) * C0_SCALE; - max_dist = tdist*tdist; - } else if (x > maxc0) { - tdist = (x - maxc0) * C0_SCALE; - min_dist = tdist*tdist; - tdist = (x - minc0) * C0_SCALE; - max_dist = tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - min_dist = 0; - if (x <= centerc0) { - tdist = (x - maxc0) * C0_SCALE; - max_dist = tdist*tdist; - } else { - tdist = (x - minc0) * C0_SCALE; - max_dist = tdist*tdist; - } - } - - x = GETJSAMPLE(cinfo->colormap[1][i]); - if (x < minc1) { - tdist = (x - minc1) * C1_SCALE; - min_dist += tdist*tdist; - tdist = (x - maxc1) * C1_SCALE; - max_dist += tdist*tdist; - } else if (x > maxc1) { - tdist = (x - maxc1) * C1_SCALE; - min_dist += tdist*tdist; - tdist = (x - minc1) * C1_SCALE; - max_dist += tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - if (x <= centerc1) { - tdist = (x - maxc1) * C1_SCALE; - max_dist += tdist*tdist; - } else { - tdist = (x - minc1) * C1_SCALE; - max_dist += tdist*tdist; - } - } - - x = GETJSAMPLE(cinfo->colormap[2][i]); - if (x < minc2) { - tdist = (x - minc2) * C2_SCALE; - min_dist += tdist*tdist; - tdist = (x - maxc2) * C2_SCALE; - max_dist += tdist*tdist; - } else if (x > maxc2) { - tdist = (x - maxc2) * C2_SCALE; - min_dist += tdist*tdist; - tdist = (x - minc2) * C2_SCALE; - max_dist += tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - if (x <= centerc2) { - tdist = (x - maxc2) * C2_SCALE; - max_dist += tdist*tdist; - } else { - tdist = (x - minc2) * C2_SCALE; - max_dist += tdist*tdist; - } - } - - mindist[i] = min_dist; /* save away the results */ - if (max_dist < minmaxdist) - minmaxdist = max_dist; - } - - /* Now we know that no cell in the update box is more than minmaxdist - * away from some colormap entry. Therefore, only colors that are - * within minmaxdist of some part of the box need be considered. - */ - ncolors = 0; - for (i = 0; i < numcolors; i++) { - if (mindist[i] <= minmaxdist) - colorlist[ncolors++] = (JSAMPLE) i; - } - return ncolors; -} - - -static void -find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, - int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) -/* Find the closest colormap entry for each cell in the update box, - * given the list of candidate colors prepared by find_nearby_colors. - * Return the indexes of the closest entries in the bestcolor[] array. - * This routine uses Thomas' incremental distance calculation method to - * find the distance from a colormap entry to successive cells in the box. - */ -{ - int ic0, ic1, ic2; - int i, icolor; - register INT32 * bptr; /* pointer into bestdist[] array */ - JSAMPLE * cptr; /* pointer into bestcolor[] array */ - INT32 dist0, dist1; /* initial distance values */ - register INT32 dist2; /* current distance in inner loop */ - INT32 xx0, xx1; /* distance increments */ - register INT32 xx2; - INT32 inc0, inc1, inc2; /* initial values for increments */ - /* This array holds the distance to the nearest-so-far color for each cell */ - INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; - - /* Initialize best-distance for each cell of the update box */ - bptr = bestdist; - for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) - *bptr++ = 0x7FFFFFFFL; - - /* For each color selected by find_nearby_colors, - * compute its distance to the center of each cell in the box. - * If that's less than best-so-far, update best distance and color number. - */ - - /* Nominal steps between cell centers ("x" in Thomas article) */ -#define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) -#define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) -#define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) - - for (i = 0; i < numcolors; i++) { - icolor = GETJSAMPLE(colorlist[i]); - /* Compute (square of) distance from minc0/c1/c2 to this color */ - inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE; - dist0 = inc0*inc0; - inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE; - dist0 += inc1*inc1; - inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE; - dist0 += inc2*inc2; - /* Form the initial difference increments */ - inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0; - inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1; - inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2; - /* Now loop over all cells in box, updating distance per Thomas method */ - bptr = bestdist; - cptr = bestcolor; - xx0 = inc0; - for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) { - dist1 = dist0; - xx1 = inc1; - for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { - dist2 = dist1; - xx2 = inc2; - for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { - if (dist2 < *bptr) { - *bptr = dist2; - *cptr = (JSAMPLE) icolor; - } - dist2 += xx2; - xx2 += 2 * STEP_C2 * STEP_C2; - bptr++; - cptr++; - } - dist1 += xx1; - xx1 += 2 * STEP_C1 * STEP_C1; - } - dist0 += xx0; - xx0 += 2 * STEP_C0 * STEP_C0; - } - } -} - - -static void -fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) -/* Fill the inverse-colormap entries in the update box that contains */ -/* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ -/* we can fill as many others as we wish.) */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - int minc0, minc1, minc2; /* lower left corner of update box */ - int ic0, ic1, ic2; - register JSAMPLE * cptr; /* pointer into bestcolor[] array */ - register histptr cachep; /* pointer into main cache array */ - /* This array lists the candidate colormap indexes. */ - JSAMPLE colorlist[MAXNUMCOLORS]; - int numcolors; /* number of candidate colors */ - /* This array holds the actually closest colormap index for each cell. */ - JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; - - /* Convert cell coordinates to update box ID */ - c0 >>= BOX_C0_LOG; - c1 >>= BOX_C1_LOG; - c2 >>= BOX_C2_LOG; - - /* Compute true coordinates of update box's origin corner. - * Actually we compute the coordinates of the center of the corner - * histogram cell, which are the lower bounds of the volume we care about. - */ - minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); - minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); - minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); - - /* Determine which colormap entries are close enough to be candidates - * for the nearest entry to some cell in the update box. - */ - numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist); - - /* Determine the actually nearest colors. */ - find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, - bestcolor); - - /* Save the best color numbers (plus 1) in the main cache array */ - c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ - c1 <<= BOX_C1_LOG; - c2 <<= BOX_C2_LOG; - cptr = bestcolor; - for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) { - for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { - cachep = & histogram[c0+ic0][c1+ic1][c2]; - for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { - *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); - } - } - } -} - - -/* - * Map some rows of pixels to the output colormapped representation. - */ - -void -pass2_no_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) -/* This version performs no dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - register JSAMPROW inptr, outptr; - register histptr cachep; - register int c0, c1, c2; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - inptr = input_buf[row]; - outptr = output_buf[row]; - for (col = width; col > 0; col--) { - /* get pixel value and index into the cache */ - c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT; - c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT; - c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT; - cachep = & histogram[c0][c1][c2]; - /* If we have not seen this color before, find nearest colormap entry */ - /* and update the cache */ - if (*cachep == 0) - fill_inverse_cmap(cinfo, c0,c1,c2); - /* Now emit the colormap index for this cell */ - *outptr++ = (JSAMPLE) (*cachep - 1); - } - } -} - - -void -pass2_fs_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) -/* This version performs Floyd-Steinberg dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ - LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ - LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ - register FSERRPTR errorptr; /* => fserrors[] at column before current */ - JSAMPROW inptr; /* => current input pixel */ - JSAMPROW outptr; /* => current output pixel */ - histptr cachep; - int dir; /* +1 or -1 depending on direction */ - int dir3; /* 3*dir, for advancing inptr & errorptr */ - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - JSAMPLE *range_limit = cinfo->sample_range_limit; - int *error_limit = cquantize->error_limiter; - JSAMPROW colormap0 = cinfo->colormap[0]; - JSAMPROW colormap1 = cinfo->colormap[1]; - JSAMPROW colormap2 = cinfo->colormap[2]; - - - for (row = 0; row < num_rows; row++) { - inptr = input_buf[row]; - outptr = output_buf[row]; - if (cquantize->on_odd_row) { - /* work right to left in this row */ - inptr += (width-1) * 3; /* so point to rightmost pixel */ - outptr += width-1; - dir = -1; - dir3 = -3; - errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */ - cquantize->on_odd_row = false; /* flip for next time */ - } else { - /* work left to right in this row */ - dir = 1; - dir3 = 3; - errorptr = cquantize->fserrors; /* => entry before first real column */ - cquantize->on_odd_row = true; /* flip for next time */ - } - /* Preset error values: no error propagated to first pixel from left */ - cur0 = cur1 = cur2 = 0; - /* and no error propagated to row below yet */ - belowerr0 = belowerr1 = belowerr2 = 0; - bpreverr0 = bpreverr1 = bpreverr2 = 0; - - for (col = width; col > 0; col--) { - /* curN holds the error propagated from the previous pixel on the - * current line. Add the error propagated from the previous line - * to form the complete error correction term for this pixel, and - * round the error term (which is expressed * 16) to an integer. - * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct - * for either sign of the error value. - * Note: errorptr points to *previous* column's array entry. - */ - cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4); - cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4); - cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4); - /* Limit the error using transfer function set by init_error_limit. - * See comments with init_error_limit for rationale. - */ - cur0 = error_limit[cur0]; - cur1 = error_limit[cur1]; - cur2 = error_limit[cur2]; - /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. - * The maximum error is +- MAXJSAMPLE (or less with error limiting); - * this sets the required size of the range_limit array. - */ - cur0 += GETJSAMPLE(inptr[0]); - cur1 += GETJSAMPLE(inptr[1]); - cur2 += GETJSAMPLE(inptr[2]); - cur0 = GETJSAMPLE(range_limit[cur0]); - cur1 = GETJSAMPLE(range_limit[cur1]); - cur2 = GETJSAMPLE(range_limit[cur2]); - /* Index into the cache with adjusted pixel value */ - cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; - /* If we have not seen this color before, find nearest colormap */ - /* entry and update the cache */ - if (*cachep == 0) - fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); - /* Now emit the colormap index for this cell */ - { register int pixcode = *cachep - 1; - *outptr = (JSAMPLE) pixcode; - /* Compute representation error for this pixel */ - cur0 -= GETJSAMPLE(colormap0[pixcode]); - cur1 -= GETJSAMPLE(colormap1[pixcode]); - cur2 -= GETJSAMPLE(colormap2[pixcode]); - } - /* Compute error fractions to be propagated to adjacent pixels. - * Add these into the running sums, and simultaneously shift the - * next-line error sums left by 1 column. - */ - { register LOCFSERROR bnexterr, delta; - - bnexterr = cur0; /* Process component 0 */ - delta = cur0 * 2; - cur0 += delta; /* form error * 3 */ - errorptr[0] = (FSERROR) (bpreverr0 + cur0); - cur0 += delta; /* form error * 5 */ - bpreverr0 = belowerr0 + cur0; - belowerr0 = bnexterr; - cur0 += delta; /* form error * 7 */ - bnexterr = cur1; /* Process component 1 */ - delta = cur1 * 2; - cur1 += delta; /* form error * 3 */ - errorptr[1] = (FSERROR) (bpreverr1 + cur1); - cur1 += delta; /* form error * 5 */ - bpreverr1 = belowerr1 + cur1; - belowerr1 = bnexterr; - cur1 += delta; /* form error * 7 */ - bnexterr = cur2; /* Process component 2 */ - delta = cur2 * 2; - cur2 += delta; /* form error * 3 */ - errorptr[2] = (FSERROR) (bpreverr2 + cur2); - cur2 += delta; /* form error * 5 */ - bpreverr2 = belowerr2 + cur2; - belowerr2 = bnexterr; - cur2 += delta; /* form error * 7 */ - } - /* At this point curN contains the 7/16 error value to be propagated - * to the next pixel on the current line, and all the errors for the - * next line have been shifted over. We are therefore ready to move on. - */ - inptr += dir3; /* Advance pixel pointers to next column */ - outptr += dir; - errorptr += dir3; /* advance errorptr to current column */ - } - /* Post-loop cleanup: we must unload the final error values into the - * final fserrors[] entry. Note we need not unload belowerrN because - * it is for the dummy column before or after the actual array. - */ - errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */ - errorptr[1] = (FSERROR) bpreverr1; - errorptr[2] = (FSERROR) bpreverr2; - } -} - - -/* - * Initialize the error-limiting transfer function (lookup table). - * The raw F-S error computation can potentially compute error values of up to - * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be - * much less, otherwise obviously wrong pixels will be created. (Typical - * effects include weird fringes at color-area boundaries, isolated bright - * pixels in a dark area, etc.) The standard advice for avoiding this problem - * is to ensure that the "corners" of the color cube are allocated as output - * colors; then repeated errors in the same direction cannot cause cascading - * error buildup. However, that only prevents the error from getting - * completely out of hand; Aaron Giles reports that error limiting improves - * the results even with corner colors allocated. - * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty - * well, but the smoother transfer function used below is even better. Thanks - * to Aaron Giles for this idea. - */ - -static void -init_error_limit (j_decompress_ptr cinfo) -/* Allocate and fill in the error_limiter table */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - int * table; - int in, out; - - table = (int *) malloc((MAXJSAMPLE*2+1) * sizeof(int)); - table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ - cquantize->error_limiter = table; - -#define STEPSIZE ((MAXJSAMPLE+1)/16) - /* Map errors 1:1 up to +- MAXJSAMPLE/16 */ - out = 0; - for (in = 0; in < STEPSIZE; in++, out++) { - table[in] = out; table[-in] = -out; - } - /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */ - for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) { - table[in] = out; table[-in] = -out; - } - /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */ - for (; in <= MAXJSAMPLE; in++) { - table[in] = out; table[-in] = -out; - } -#undef STEPSIZE -} - - -/* - * Finish up at the end of each pass. - */ - -void -finish_pass1 (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - - /* Select the representative colors and fill in cinfo->colormap */ - cinfo->colormap = cquantize->sv_colormap; - select_colors(cinfo, cquantize->desired); - /* Force next pass to zero the color index table */ - cquantize->needs_zeroed = true; -} - - -void -finish_pass2 (j_decompress_ptr WXUNUSED(cinfo)) -{ - /* no work */ -} - - -/* - * Initialize for each processing pass. - */ - -void -start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - - if (is_pre_scan) { - /* Set up method pointers */ - cquantize->pub.color_quantize = prescan_quantize; - cquantize->pub.finish_pass = finish_pass1; - cquantize->needs_zeroed = true; /* Always zero histogram */ - } else { - /* Set up method pointers */ - cquantize->pub.color_quantize = pass2_fs_dither; - cquantize->pub.finish_pass = finish_pass2; - - { - size_t arraysize = (size_t) ((cinfo->output_width + 2) * - (3 * sizeof(FSERROR))); - /* Allocate Floyd-Steinberg workspace if we didn't already. */ - if (cquantize->fserrors == NULL) - cquantize->fserrors = (INT16*) malloc(arraysize); - /* Initialize the propagated errors to zero. */ - memset((void *) cquantize->fserrors, 0, arraysize); - /* Make the error-limit table if we didn't already. */ - if (cquantize->error_limiter == NULL) - init_error_limit(cinfo); - cquantize->on_odd_row = false; - } - - } - /* Zero the histogram or inverse color map, if necessary */ - if (cquantize->needs_zeroed) { - for (int i = 0; i < HIST_C0_ELEMS; i++) { - memset((void *) histogram[i], 0, - HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); - } - cquantize->needs_zeroed = false; - } -} - - -/* - * Switch to a new external colormap between output passes. - */ - -void -new_color_map_2_quant (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - - /* Reset the inverse color map */ - cquantize->needs_zeroed = true; -} - - -/* - * Module initialization routine for 2-pass color quantization. - */ - -void -jinit_2pass_quantizer (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize; - int i; - - cquantize = (my_cquantize_ptr) malloc(sizeof(my_cquantizer)); - cinfo->cquantize = (jpeg_color_quantizer *) cquantize; - cquantize->pub.start_pass = start_pass_2_quant; - cquantize->pub.new_color_map = new_color_map_2_quant; - cquantize->fserrors = NULL; /* flag optional arrays not allocated */ - cquantize->error_limiter = NULL; - - - /* Allocate the histogram/inverse colormap storage */ - cquantize->histogram = (hist3d) malloc(HIST_C0_ELEMS * sizeof(hist2d)); - for (i = 0; i < HIST_C0_ELEMS; i++) { - cquantize->histogram[i] = (hist2d) malloc(HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); - } - cquantize->needs_zeroed = true; /* histogram is garbage now */ - - /* Allocate storage for the completed colormap, if required. - * We do this now since it is storage and may affect - * the memory manager's space calculations. - */ - { - /* Make sure color count is acceptable */ - int desired = cinfo->desired_number_of_colors; - - cquantize->sv_colormap = (JSAMPARRAY) malloc(sizeof(JSAMPROW) * 3); - cquantize->sv_colormap[0] = (JSAMPROW) malloc(sizeof(JSAMPLE) * desired); - cquantize->sv_colormap[1] = (JSAMPROW) malloc(sizeof(JSAMPLE) * desired); - cquantize->sv_colormap[2] = (JSAMPROW) malloc(sizeof(JSAMPLE) * desired); - - cquantize->desired = desired; - } - - /* Allocate Floyd-Steinberg workspace if necessary. - * This isn't really needed until pass 2, but again it is storage. - * Although we will cope with a later change in dither_mode, - * we do not promise to honor max_memory_to_use if dither_mode changes. - */ - { - cquantize->fserrors = (FSERRPTR) malloc( - (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR)))); - /* Might as well create the error-limiting table too. */ - init_error_limit(cinfo); - } -} - - - - - - - - - - -void -prepare_range_limit_table (j_decompress_ptr cinfo) -/* Allocate and fill in the sample_range_limit table */ -{ - JSAMPLE * table; - int i; - - table = (JSAMPLE *) malloc((5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * sizeof(JSAMPLE)); - cinfo->srl_orig = table; - table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ - cinfo->sample_range_limit = table; - /* First segment of "simple" table: limit[x] = 0 for x < 0 */ - memset(table - (MAXJSAMPLE+1), 0, (MAXJSAMPLE+1) * sizeof(JSAMPLE)); - /* Main part of "simple" table: limit[x] = x */ - for (i = 0; i <= MAXJSAMPLE; i++) - table[i] = (JSAMPLE) i; - table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ - /* End of simple table, rest of first half of post-IDCT table */ - for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) - table[i] = MAXJSAMPLE; - /* Second half of post-IDCT table */ - memset(table + (2 * (MAXJSAMPLE+1)), 0, - (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE)); - memcpy(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), - cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE)); -} - - - - -/* - * wxQuantize - */ - -IMPLEMENT_DYNAMIC_CLASS(wxQuantize, wxObject) - -void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, - unsigned char *palette, int desiredNoColours) -{ - j_decompress dec; - my_cquantize_ptr cquantize; - - dec.output_width = w; - dec.desired_number_of_colors = desiredNoColours; - prepare_range_limit_table(&dec); - jinit_2pass_quantizer(&dec); - cquantize = (my_cquantize_ptr) dec.cquantize; - - - cquantize->pub.start_pass(&dec, true); - cquantize->pub.color_quantize(&dec, in_rows, out_rows, h); - cquantize->pub.finish_pass(&dec); - - cquantize->pub.start_pass(&dec, false); - cquantize->pub.color_quantize(&dec, in_rows, out_rows, h); - cquantize->pub.finish_pass(&dec); - - - for (int i = 0; i < dec.desired_number_of_colors; i++) { - palette[3 * i + 0] = dec.colormap[0][i]; - palette[3 * i + 1] = dec.colormap[1][i]; - palette[3 * i + 2] = dec.colormap[2][i]; - } - - for (int ii = 0; ii < HIST_C0_ELEMS; ii++) free(cquantize->histogram[ii]); - free(cquantize->histogram); - free(dec.colormap[0]); - free(dec.colormap[1]); - free(dec.colormap[2]); - free(dec.colormap); - free(dec.srl_orig); - - //free(cquantize->error_limiter); - free((void*)(cquantize->error_limiter - MAXJSAMPLE)); // To reverse what was done to it - - free(cquantize->fserrors); - free(cquantize); -} - -// TODO: somehow make use of the Windows system colours, rather than ignoring them for the -// purposes of quantization. - -bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, - wxPalette** pPalette, - int desiredNoColours, - unsigned char** eightBitData, - int flags) - -{ - int i; - - int windowsSystemColourCount = 20; - - int paletteShift = 0; - - // Shift the palette up by the number of Windows system colours, - // if necessary - if (flags & wxQUANTIZE_INCLUDE_WINDOWS_COLOURS) - paletteShift = windowsSystemColourCount; - - // Make room for the Windows system colours -#ifdef __WXMSW__ - if ((flags & wxQUANTIZE_INCLUDE_WINDOWS_COLOURS) && (desiredNoColours > (256 - windowsSystemColourCount))) - desiredNoColours = 256 - windowsSystemColourCount; -#endif - - // create rows info: - int h = src.GetHeight(); - int w = src.GetWidth(); - unsigned char **rows = new unsigned char *[h]; - unsigned char *imgdt = src.GetData(); - for (i = 0; i < h; i++) - rows[i] = imgdt + 3/*RGB*/ * w * i; - - unsigned char palette[3*256]; - - // This is the image as represented by palette indexes. - unsigned char *data8bit = new unsigned char[w * h]; - unsigned char **outrows = new unsigned char *[h]; - for (i = 0; i < h; i++) - outrows[i] = data8bit + w * i; - - //RGB->palette - DoQuantize(w, h, rows, outrows, palette, desiredNoColours); - - delete[] rows; - delete[] outrows; - - // palette->RGB(max.256) - - if (flags & wxQUANTIZE_FILL_DESTINATION_IMAGE) - { - if (!dest.Ok()) - dest.Create(w, h); - - imgdt = dest.GetData(); - for (i = 0; i < w * h; i++) - { - unsigned char c = data8bit[i]; - imgdt[3 * i + 0/*R*/] = palette[3 * c + 0]; - imgdt[3 * i + 1/*G*/] = palette[3 * c + 1]; - imgdt[3 * i + 2/*B*/] = palette[3 * c + 2]; - } - } - - if (eightBitData && (flags & wxQUANTIZE_RETURN_8BIT_DATA)) - { -#ifdef __WXMSW__ - if (flags & wxQUANTIZE_INCLUDE_WINDOWS_COLOURS) - { - // We need to shift the palette entries up - // to make room for the Windows system colours. - for (i = 0; i < w * h; i++) - data8bit[i] = (unsigned char)(data8bit[i] + paletteShift); - } -#endif - *eightBitData = data8bit; - } - else - delete[] data8bit; - -#if wxUSE_PALETTE - // Make a wxWidgets palette - if (pPalette) - { - unsigned char* r = new unsigned char[256]; - unsigned char* g = new unsigned char[256]; - unsigned char* b = new unsigned char[256]; - -#ifdef __WXMSW__ - // Fill the first 20 entries with Windows system colours - if (flags & wxQUANTIZE_INCLUDE_WINDOWS_COLOURS) - { - HDC hDC = ::GetDC(NULL); - PALETTEENTRY* entries = new PALETTEENTRY[windowsSystemColourCount]; - ::GetSystemPaletteEntries(hDC, 0, windowsSystemColourCount, entries); - ::ReleaseDC(NULL, hDC); - - for (i = 0; i < windowsSystemColourCount; i++) - { - r[i] = entries[i].peRed; - g[i] = entries[i].peGreen; - b[i] = entries[i].peBlue; - } - delete[] entries; - } -#endif - - for (i = 0; i < desiredNoColours; i++) - { - r[i+paletteShift] = palette[i*3 + 0]; - g[i+paletteShift] = palette[i*3 + 1]; - b[i+paletteShift] = palette[i*3 + 2]; - } - - // Blank out any remaining palette entries - for (i = desiredNoColours+paletteShift; i < 256; i++) - { - r[i] = 0; - g[i] = 0; - b[i] = 0; - } - *pPalette = new wxPalette(256, r, g, b); - delete[] r; - delete[] g; - delete[] b; - } -#endif // wxUSE_PALETTE - - return true; -} - -// This version sets a palette in the destination image so you don't -// have to manage it yourself. - -bool wxQuantize::Quantize(const wxImage& src, - wxImage& dest, - int desiredNoColours, - unsigned char** eightBitData, - int flags) -{ - wxPalette* palette = NULL; - if ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) ) - return false; - -#if wxUSE_PALETTE - if (palette) - { - dest.SetPalette(* palette); - delete palette; - } -#endif // wxUSE_PALETTE - - return true; -} - -#endif - // wxUSE_IMAGE diff --git a/Source/3rdParty/wx/src/common/radiocmn.cpp b/Source/3rdParty/wx/src/common/radiocmn.cpp deleted file mode 100644 index 418d4f04f..000000000 --- a/Source/3rdParty/wx/src/common/radiocmn.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/radiocmn.cpp -// Purpose: wxRadioBox methods common to all ports -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.06.01 -// RCS-ID: $Id: radiocmn.cpp 54930 2008-08-02 19:45:23Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_RADIOBOX - -#ifndef WX_PRECOMP - #include "wx/radiobox.h" -#endif //WX_PRECOMP - -#if wxUSE_TOOLTIPS - #include "wx/tooltip.h" -#endif // wxUSE_TOOLTIPS - -#if wxUSE_HELP - #include "wx/cshelp.h" -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -void wxRadioBoxBase::SetMajorDim(unsigned int majorDim, long style) -{ - wxCHECK_RET( majorDim != 0, _T("major radiobox dimension can't be 0") ); - - m_majorDim = majorDim; - - int minorDim = (GetCount() + m_majorDim - 1) / m_majorDim; - - if ( style & wxRA_SPECIFY_COLS ) - { - m_numCols = majorDim; - m_numRows = minorDim; - } - else // wxRA_SPECIFY_ROWS - { - m_numCols = minorDim; - m_numRows = majorDim; - } -} - -int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const -{ - const int itemStart = item; - - int count = GetCount(), - numCols = GetColumnCount(), - numRows = GetRowCount(); - - bool horz = (style & wxRA_SPECIFY_COLS) != 0; - - do - { - switch ( dir ) - { - case wxUP: - if ( horz ) - { - item -= numCols; - } - else // vertical layout - { - if ( !item-- ) - item = count - 1; - } - break; - - case wxLEFT: - if ( horz ) - { - if ( !item-- ) - item = count - 1; - } - else // vertical layout - { - item -= numRows; - } - break; - - case wxDOWN: - if ( horz ) - { - item += numCols; - } - else // vertical layout - { - if ( ++item == count ) - item = 0; - } - break; - - case wxRIGHT: - if ( horz ) - { - if ( ++item == count ) - item = 0; - } - else // vertical layout - { - item += numRows; - } - break; - - default: - wxFAIL_MSG( _T("unexpected wxDirection value") ); - return wxNOT_FOUND; - } - - // ensure that the item is in range [0..count) - if ( item < 0 ) - { - // first map the item to the one in the same column but in the last - // row - item += count; - - // now there are 2 cases: either it is the first item of the last - // row in which case we need to wrap again and get to the last item - // or we can just go to the previous item - if ( item % (horz ? numCols : numRows) ) - item--; - else - item = count - 1; - } - else if ( item >= count ) - { - // same logic as above - item -= count; - - // ... except that we need to check if this is not the last item, - // not the first one - if ( (item + 1) % (horz ? numCols : numRows) ) - item++; - else - item = 0; - } - - wxASSERT_MSG( item < count && item >= 0, - _T("logic error in wxRadioBox::GetNextItem()") ); - } - // we shouldn't select the non-active items, continue looking for a - // visible and shown one unless we came back to the item we started from in - // which case bail out to avoid infinite loop - while ( !(IsItemShown(item) && IsItemEnabled(item)) && item != itemStart ); - - return item; -} - -#if wxUSE_TOOLTIPS - -void wxRadioBoxBase::SetItemToolTip(unsigned int item, const wxString& text) -{ - wxASSERT_MSG( item < GetCount(), _T("Invalid item index") ); - - // extend the array to have entries for all our items on first use - if ( !m_itemsTooltips ) - { - m_itemsTooltips = new wxToolTipArray; - m_itemsTooltips->resize(GetCount()); - } - - wxToolTip *tooltip = (*m_itemsTooltips)[item]; - - bool changed = true; - if ( text.empty() ) - { - if ( tooltip ) - { - // delete the tooltip - delete tooltip; - tooltip = NULL; - } - else // nothing to do - { - changed = false; - } - } - else // non empty tooltip text - { - if ( tooltip ) - { - // just change the existing tooltip text, don't change the tooltip - tooltip->SetTip(text); - changed = false; - } - else // no tooltip yet - { - // create the new one - tooltip = new wxToolTip(text); - } - } - - if ( changed ) - { - (*m_itemsTooltips)[item] = tooltip; - DoSetItemToolTip(item, tooltip); - } -} - -void -wxRadioBoxBase::DoSetItemToolTip(unsigned int WXUNUSED(item), - wxToolTip * WXUNUSED(tooltip)) -{ - // per-item tooltips not implemented by default -} - -#endif // wxUSE_TOOLTIPS - -wxRadioBoxBase::~wxRadioBoxBase() -{ -#if wxUSE_TOOLTIPS - if ( m_itemsTooltips ) - { - const size_t n = m_itemsTooltips->size(); - for ( size_t i = 0; i < n; i++ ) - delete (*m_itemsTooltips)[i]; - - delete m_itemsTooltips; - } -#endif // wxUSE_TOOLTIPS -} - -#if wxUSE_HELP - -// set helptext for a particular item -void wxRadioBoxBase::SetItemHelpText(unsigned int n, const wxString& helpText) -{ - wxCHECK_RET( n < GetCount(), _T("Invalid item index") ); - - if ( m_itemsHelpTexts.empty() ) - { - // once-only initialization of the array: reserve space for all items - m_itemsHelpTexts.Add(wxEmptyString, GetCount()); - } - - m_itemsHelpTexts[n] = helpText; -} - -// retrieve helptext for a particular item -wxString wxRadioBoxBase::GetItemHelpText( unsigned int n ) const -{ - wxCHECK_MSG( n < GetCount(), wxEmptyString, _T("Invalid item index") ); - - return m_itemsHelpTexts.empty() ? wxString() : m_itemsHelpTexts[n]; -} - -// return help text for the item for which wxEVT_HELP was generated. -wxString wxRadioBoxBase::DoGetHelpTextAtPoint(const wxWindow *derived, - const wxPoint& pt, - wxHelpEvent::Origin origin) const -{ - const int item = origin == wxHelpEvent::Origin_HelpButton - ? GetItemFromPoint(pt) - : GetSelection(); - - if ( item != wxNOT_FOUND ) - { - wxString text = GetItemHelpText(wx_static_cast(unsigned int, item)); - if( !text.empty() ) - return text; - } - - return derived->wxWindowBase::GetHelpTextAtPoint(pt, origin); -} - -#endif // wxUSE_HELP - -#if WXWIN_COMPATIBILITY_2_4 - -// these functions are deprecated and don't do anything -int wxRadioBoxBase::GetNumberOfRowsOrCols() const -{ - return 1; -} - -void wxRadioBoxBase::SetNumberOfRowsOrCols(int WXUNUSED(n)) -{ -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // wxUSE_RADIOBOX diff --git a/Source/3rdParty/wx/src/common/regex.cpp b/Source/3rdParty/wx/src/common/regex.cpp deleted file mode 100644 index bd77aafe2..000000000 --- a/Source/3rdParty/wx/src/common/regex.cpp +++ /dev/null @@ -1,689 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/regex.cpp -// Purpose: regular expression matching -// Author: Karsten Ballueder and Vadim Zeitlin -// Modified by: -// Created: 13.07.01 -// RCS-ID: $Id: regex.cpp 57779 2009-01-02 17:35:16Z PC $ -// Copyright: (c) 2000 Karsten Ballueder -// 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_REGEX - -#include "wx/regex.h" - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/log.h" - #include "wx/intl.h" -#endif //WX_PRECOMP - -// FreeBSD, Watcom and DMars require this, CW doesn't have nor need it. -// Others also don't seem to need it. If you have an error related to -// (not) including please report details to -// wx-dev@lists.wxwindows.org -#if defined(__UNIX__) || defined(__WATCOMC__) || defined(__DIGITALMARS__) -# include -#endif - -#include - -// WXREGEX_USING_BUILTIN defined when using the built-in regex lib -// WXREGEX_USING_RE_SEARCH defined when using re_search in the GNU regex lib -// WXREGEX_IF_NEED_LEN() wrap the len parameter only used with the built-in -// or GNU regex -// WXREGEX_CONVERT_TO_MB defined when the regex lib is using chars and -// wxChar is wide, so conversion must be done -// WXREGEX_CHAR(x) Convert wxChar to wxRegChar -// -#ifdef __REG_NOFRONT -# define WXREGEX_USING_BUILTIN -# define WXREGEX_IF_NEED_LEN(x) ,x -# define WXREGEX_CHAR(x) x -#else -# ifdef HAVE_RE_SEARCH -# define WXREGEX_IF_NEED_LEN(x) ,x -# define WXREGEX_USING_RE_SEARCH -# else -# define WXREGEX_IF_NEED_LEN(x) -# endif -# if wxUSE_UNICODE -# define WXREGEX_CONVERT_TO_MB -# endif -# define WXREGEX_CHAR(x) wxConvertWX2MB(x) -# define wx_regfree regfree -# define wx_regerror regerror -#endif - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -#ifndef WXREGEX_USING_RE_SEARCH - -// the array of offsets for the matches, the usual POSIX regmatch_t array. -class wxRegExMatches -{ -public: - typedef regmatch_t *match_type; - - wxRegExMatches(size_t n) { m_matches = new regmatch_t[n]; } - ~wxRegExMatches() { delete [] m_matches; } - - // we just use casts here because the fields of regmatch_t struct may be 64 - // bit but we're limited to size_t in our public API and are not going to - // change it because operating on strings longer than 4GB using it is - // absolutely impractical anyhow - size_t Start(size_t n) const - { - return wx_truncate_cast(size_t, m_matches[n].rm_so); - } - - size_t End(size_t n) const - { - return wx_truncate_cast(size_t, m_matches[n].rm_eo); - } - - regmatch_t *get() const { return m_matches; } - -private: - regmatch_t *m_matches; -}; - -#else // WXREGEX_USING_RE_SEARCH - -// the array of offsets for the matches, the struct used by the GNU lib -class wxRegExMatches -{ -public: - typedef re_registers *match_type; - - wxRegExMatches(size_t n) - { - m_matches.num_regs = n; - m_matches.start = new regoff_t[n]; - m_matches.end = new regoff_t[n]; - } - - ~wxRegExMatches() - { - delete [] m_matches.start; - delete [] m_matches.end; - } - - size_t Start(size_t n) const { return m_matches.start[n]; } - size_t End(size_t n) const { return m_matches.end[n]; } - - re_registers *get() { return &m_matches; } - -private: - re_registers m_matches; -}; - -#endif // WXREGEX_USING_RE_SEARCH - -// the character type used by the regular expression engine -#ifndef WXREGEX_CONVERT_TO_MB -typedef wxChar wxRegChar; -#else -typedef char wxRegChar; -#endif - -// the real implementation of wxRegEx -class wxRegExImpl -{ -public: - // ctor and dtor - wxRegExImpl(); - ~wxRegExImpl(); - - // return true if Compile() had been called successfully - bool IsValid() const { return m_isCompiled; } - - // RE operations - bool Compile(const wxString& expr, int flags = 0); - bool Matches(const wxRegChar *str, int flags - WXREGEX_IF_NEED_LEN(size_t len)) const; - bool GetMatch(size_t *start, size_t *len, size_t index = 0) const; - size_t GetMatchCount() const; - int Replace(wxString *pattern, const wxString& replacement, - size_t maxMatches = 0) const; - -private: - // return the string containing the error message for the given err code - wxString GetErrorMsg(int errorcode, bool badconv) const; - - // init the members - void Init() - { - m_isCompiled = false; - m_Matches = NULL; - m_nMatches = 0; - } - - // free the RE if compiled - void Free() - { - if ( IsValid() ) - { - wx_regfree(&m_RegEx); - } - - delete m_Matches; - } - - // free the RE if any and reinit the members - void Reinit() - { - Free(); - Init(); - } - - // compiled RE - regex_t m_RegEx; - - // the subexpressions data - wxRegExMatches *m_Matches; - size_t m_nMatches; - - // true if m_RegEx is valid - bool m_isCompiled; -}; - - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxRegExImpl -// ---------------------------------------------------------------------------- - -wxRegExImpl::wxRegExImpl() -{ - Init(); -} - -wxRegExImpl::~wxRegExImpl() -{ - Free(); -} - -wxString wxRegExImpl::GetErrorMsg(int errorcode, bool badconv) const -{ -#ifdef WXREGEX_CONVERT_TO_MB - // currently only needed when using system library in Unicode mode - if ( badconv ) - { - return _("conversion to 8-bit encoding failed"); - } -#else - // 'use' badconv to avoid a compiler warning - (void)badconv; -#endif - - wxString szError; - - // first get the string length needed - int len = wx_regerror(errorcode, &m_RegEx, NULL, 0); - if ( len > 0 ) - { - char* szcmbError = new char[++len]; - - (void)wx_regerror(errorcode, &m_RegEx, szcmbError, len); - - szError = wxConvertMB2WX(szcmbError); - delete [] szcmbError; - } - else // regerror() returned 0 - { - szError = _("unknown error"); - } - - return szError; -} - -bool wxRegExImpl::Compile(const wxString& expr, int flags) -{ - Reinit(); - -#ifdef WX_NO_REGEX_ADVANCED -# define FLAVORS wxRE_BASIC -#else -# define FLAVORS (wxRE_ADVANCED | wxRE_BASIC) - wxASSERT_MSG( (flags & FLAVORS) != FLAVORS, - _T("incompatible flags in wxRegEx::Compile") ); -#endif - wxASSERT_MSG( !(flags & ~(FLAVORS | wxRE_ICASE | wxRE_NOSUB | wxRE_NEWLINE)), - _T("unrecognized flags in wxRegEx::Compile") ); - - // translate our flags to regcomp() ones - int flagsRE = 0; - if ( !(flags & wxRE_BASIC) ) - { -#ifndef WX_NO_REGEX_ADVANCED - if (flags & wxRE_ADVANCED) - flagsRE |= REG_ADVANCED; - else -#endif - flagsRE |= REG_EXTENDED; - } - - if ( flags & wxRE_ICASE ) - flagsRE |= REG_ICASE; - if ( flags & wxRE_NOSUB ) - flagsRE |= REG_NOSUB; - if ( flags & wxRE_NEWLINE ) - flagsRE |= REG_NEWLINE; - - // compile it -#ifdef WXREGEX_USING_BUILTIN - bool conv = true; - int errorcode = wx_re_comp(&m_RegEx, expr, expr.length(), flagsRE); -#else - const wxWX2MBbuf conv = expr.mbc_str(); - int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT; -#endif - - if ( errorcode ) - { - wxLogError(_("Invalid regular expression '%s': %s"), - expr.c_str(), GetErrorMsg(errorcode, !conv).c_str()); - - m_isCompiled = false; - } - else // ok - { - // don't allocate the matches array now, but do it later if necessary - if ( flags & wxRE_NOSUB ) - { - // we don't need it at all - m_nMatches = 0; - } - else - { - // we will alloc the array later (only if really needed) but count - // the number of sub-expressions in the regex right now - - // there is always one for the whole expression - m_nMatches = 1; - - // and some more for bracketed subexperessions - for ( const wxChar *cptr = expr.c_str(); *cptr; cptr++ ) - { - if ( *cptr == _T('\\') ) - { - // in basic RE syntax groups are inside \(...\) - if ( *++cptr == _T('(') && (flags & wxRE_BASIC) ) - { - m_nMatches++; - } - } - else if ( *cptr == _T('(') && !(flags & wxRE_BASIC) ) - { - // we know that the previous character is not an unquoted - // backslash because it would have been eaten above, so we - // have a bare '(' and this indicates a group start for the - // extended syntax. '(?' is used for extensions by perl- - // like REs (e.g. advanced), and is not valid for POSIX - // extended, so ignore them always. - if ( cptr[1] != _T('?') ) - m_nMatches++; - } - } - } - - m_isCompiled = true; - } - - return IsValid(); -} - -#ifdef WXREGEX_USING_RE_SEARCH - -// On GNU, regexec is implemented as a wrapper around re_search. re_search -// requires a length parameter which the POSIX regexec does not have, -// therefore regexec must do a strlen on the search text each time it is -// called. This can drastically affect performance when matching is done in -// a loop along a string, such as during a search and replace. Therefore if -// re_search is detected by configure, it is used directly. -// -static int ReSearch(const regex_t *preg, - const char *text, - size_t len, - re_registers *matches, - int eflags) -{ - regex_t *pattern = wx_const_cast(regex_t*, preg); - - pattern->not_bol = (eflags & REG_NOTBOL) != 0; - pattern->not_eol = (eflags & REG_NOTEOL) != 0; - pattern->regs_allocated = REGS_FIXED; - - int ret = re_search(pattern, text, len, 0, len, matches); - return ret >= 0 ? 0 : REG_NOMATCH; -} - -#endif // WXREGEX_USING_RE_SEARCH - -bool wxRegExImpl::Matches(const wxRegChar *str, - int flags - WXREGEX_IF_NEED_LEN(size_t len)) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - - // translate our flags to regexec() ones - wxASSERT_MSG( !(flags & ~(wxRE_NOTBOL | wxRE_NOTEOL)), - _T("unrecognized flags in wxRegEx::Matches") ); - - int flagsRE = 0; - if ( flags & wxRE_NOTBOL ) - flagsRE |= REG_NOTBOL; - if ( flags & wxRE_NOTEOL ) - flagsRE |= REG_NOTEOL; - - // allocate matches array if needed - wxRegExImpl *self = wxConstCast(this, wxRegExImpl); - if ( !m_Matches && m_nMatches ) - { - self->m_Matches = new wxRegExMatches(m_nMatches); - } - - wxRegExMatches::match_type matches = m_Matches ? m_Matches->get() : NULL; - - // do match it -#if defined WXREGEX_USING_BUILTIN - int rc = wx_re_exec(&self->m_RegEx, str, len, NULL, m_nMatches, matches, flagsRE); -#elif defined WXREGEX_USING_RE_SEARCH - int rc = str ? ReSearch(&self->m_RegEx, str, len, matches, flagsRE) : REG_BADPAT; -#else - int rc = str ? regexec(&self->m_RegEx, str, m_nMatches, matches, flagsRE) : REG_BADPAT; -#endif - - switch ( rc ) - { - case 0: - // matched successfully - return true; - - default: - // an error occurred - wxLogError(_("Failed to find match for regular expression: %s"), - GetErrorMsg(rc, !str).c_str()); - // fall through - - case REG_NOMATCH: - // no match - return false; - } -} - -bool wxRegExImpl::GetMatch(size_t *start, size_t *len, size_t index) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - wxCHECK_MSG( m_nMatches, false, _T("can't use with wxRE_NOSUB") ); - wxCHECK_MSG( m_Matches, false, _T("must call Matches() first") ); - wxCHECK_MSG( index < m_nMatches, false, _T("invalid match index") ); - - if ( start ) - *start = m_Matches->Start(index); - if ( len ) - *len = m_Matches->End(index) - m_Matches->Start(index); - - return true; -} - -size_t wxRegExImpl::GetMatchCount() const -{ - wxCHECK_MSG( IsValid(), 0, _T("must successfully Compile() first") ); - wxCHECK_MSG( m_nMatches, 0, _T("can't use with wxRE_NOSUB") ); - - return m_nMatches; -} - -int wxRegExImpl::Replace(wxString *text, - const wxString& replacement, - size_t maxMatches) const -{ - wxCHECK_MSG( text, wxNOT_FOUND, _T("NULL text in wxRegEx::Replace") ); - wxCHECK_MSG( IsValid(), wxNOT_FOUND, _T("must successfully Compile() first") ); - - // the input string -#ifndef WXREGEX_CONVERT_TO_MB - const wxChar *textstr = text->c_str(); - size_t textlen = text->length(); -#else - const wxWX2MBbuf textstr = WXREGEX_CHAR(*text); - if (!textstr) - { - wxLogError(_("Failed to find match for regular expression: %s"), - GetErrorMsg(0, true).c_str()); - return 0; - } - size_t textlen = strlen(textstr); - text->clear(); -#endif - - // the replacement text - wxString textNew; - - // the result, allow 25% extra - wxString result; - result.reserve(5 * textlen / 4); - - // attempt at optimization: don't iterate over the string if it doesn't - // contain back references at all - bool mayHaveBackrefs = - replacement.find_first_of(_T("\\&")) != wxString::npos; - - if ( !mayHaveBackrefs ) - { - textNew = replacement; - } - - // the position where we start looking for the match - size_t matchStart = 0; - - // number of replacement made: we won't make more than maxMatches of them - // (unless maxMatches is 0 which doesn't limit the number of replacements) - size_t countRepl = 0; - - // note that "^" shouldn't match after the first call to Matches() so we - // use wxRE_NOTBOL to prevent it from happening - while ( (!maxMatches || countRepl < maxMatches) && - Matches(textstr + matchStart, - countRepl ? wxRE_NOTBOL : 0 - WXREGEX_IF_NEED_LEN(textlen - matchStart)) ) - { - // the string possibly contains back references: we need to calculate - // the replacement text anew after each match - if ( mayHaveBackrefs ) - { - mayHaveBackrefs = false; - textNew.clear(); - textNew.reserve(replacement.length()); - - for ( const wxChar *p = replacement.c_str(); *p; p++ ) - { - size_t index = (size_t)-1; - - if ( *p == _T('\\') ) - { - if ( wxIsdigit(*++p) ) - { - // back reference - wxChar *end; - index = (size_t)wxStrtoul(p, &end, 10); - p = end - 1; // -1 to compensate for p++ in the loop - } - //else: backslash used as escape character - } - else if ( *p == _T('&') ) - { - // treat this as "\0" for compatbility with ed and such - index = 0; - } - - // do we have a back reference? - if ( index != (size_t)-1 ) - { - // yes, get its text - size_t start, len; - if ( !GetMatch(&start, &len, index) ) - { - wxFAIL_MSG( _T("invalid back reference") ); - - // just eat it... - } - else - { - textNew += wxString(textstr + matchStart + start, - *wxConvCurrent, len); - - mayHaveBackrefs = true; - } - } - else // ordinary character - { - textNew += *p; - } - } - } - - size_t start, len; - if ( !GetMatch(&start, &len) ) - { - // we did have match as Matches() returned true above! - wxFAIL_MSG( _T("internal logic error in wxRegEx::Replace") ); - - return wxNOT_FOUND; - } - - // an insurance against implementations that don't grow exponentially - // to ensure building the result takes linear time - if (result.capacity() < result.length() + start + textNew.length()) - result.reserve(2 * result.length()); - -#ifndef WXREGEX_CONVERT_TO_MB - result.append(*text, matchStart, start); -#else - result.append(wxString(textstr + matchStart, *wxConvCurrent, start)); -#endif - matchStart += start; - result.append(textNew); - - countRepl++; - - matchStart += len; - } - -#ifndef WXREGEX_CONVERT_TO_MB - result.append(*text, matchStart, wxString::npos); -#else - result.append(wxString(textstr + matchStart, *wxConvCurrent)); -#endif - *text = result; - - return countRepl; -} - -// ---------------------------------------------------------------------------- -// wxRegEx: all methods are mostly forwarded to wxRegExImpl -// ---------------------------------------------------------------------------- - -void wxRegEx::Init() -{ - m_impl = NULL; -} - -wxRegEx::~wxRegEx() -{ - delete m_impl; -} - -bool wxRegEx::Compile(const wxString& expr, int flags) -{ - if ( !m_impl ) - { - m_impl = new wxRegExImpl; - } - - if ( !m_impl->Compile(expr, flags) ) - { - // error message already given in wxRegExImpl::Compile - delete m_impl; - m_impl = NULL; - - return false; - } - - return true; -} - -bool wxRegEx::Matches(const wxChar *str, int flags, size_t len) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - (void)len; - - return m_impl->Matches(WXREGEX_CHAR(str), flags WXREGEX_IF_NEED_LEN(len)); -} - -bool wxRegEx::Matches(const wxChar *str, int flags) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - - return m_impl->Matches(WXREGEX_CHAR(str), - flags - WXREGEX_IF_NEED_LEN(wxStrlen(str))); -} - -bool wxRegEx::GetMatch(size_t *start, size_t *len, size_t index) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - - return m_impl->GetMatch(start, len, index); -} - -wxString wxRegEx::GetMatch(const wxString& text, size_t index) const -{ - size_t start, len; - if ( !GetMatch(&start, &len, index) ) - return wxEmptyString; - - return text.Mid(start, len); -} - -size_t wxRegEx::GetMatchCount() const -{ - wxCHECK_MSG( IsValid(), 0, _T("must successfully Compile() first") ); - - return m_impl->GetMatchCount(); -} - -int wxRegEx::Replace(wxString *pattern, - const wxString& replacement, - size_t maxMatches) const -{ - wxCHECK_MSG( IsValid(), wxNOT_FOUND, _T("must successfully Compile() first") ); - - return m_impl->Replace(pattern, replacement, maxMatches); -} - -#endif // wxUSE_REGEX diff --git a/Source/3rdParty/wx/src/common/rendcmn.cpp b/Source/3rdParty/wx/src/common/rendcmn.cpp deleted file mode 100644 index 702ffb4fa..000000000 --- a/Source/3rdParty/wx/src/common/rendcmn.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/rendcmn.cpp -// Purpose: wxRendererNative common functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.07.03 -// RCS-ID: $Id: rendcmn.cpp 41216 2006-09-14 16:04:18Z ABX $ -// Copyright: (c) 2003 Vadim Zeitlin -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/log.h" - #include "wx/intl.h" -#endif //WX_PRECOMP - -#include "wx/apptrait.h" -#include "wx/renderer.h" - -#include "wx/ptr_scpd.h" - -#if wxUSE_DYNLIB_CLASS - #include "wx/dynlib.h" -#endif // wxUSE_DYNLIB_CLASS - -// ---------------------------------------------------------------------------- -// wxRendererPtr: auto pointer holding the global renderer -// ---------------------------------------------------------------------------- - -wxDECLARE_SCOPED_PTR(wxRendererNative, wxRendererPtrBase) -wxDEFINE_SCOPED_PTR(wxRendererNative, wxRendererPtrBase) - -class wxRendererPtr : public wxRendererPtrBase -{ -public: - // return true if we have a renderer, false otherwise - bool IsOk() - { - if ( !m_initialized ) - { - // only try to create the renderer once - m_initialized = true; - - DoInit(); - } - - return get() != NULL; - } - - // return the global and unique wxRendererPtr - static wxRendererPtr& Get(); - -private: - wxRendererPtr() : wxRendererPtrBase(NULL) { m_initialized = false; } - - void DoInit() - { - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( traits ) - { - // ask the traits object to create a renderer for us - reset(traits->CreateRenderer()); - } - } - - bool m_initialized; - - // just to suppress a gcc warning - friend class wxRendererPtrDummyFriend; - - DECLARE_NO_COPY_CLASS(wxRendererPtr) -}; - -// return the global and unique wxRendererPtr -/*static*/ wxRendererPtr& wxRendererPtr::Get() -{ - static wxRendererPtr s_renderer; - - return s_renderer; -} - -#if wxUSE_DYNLIB_CLASS - -// ---------------------------------------------------------------------------- -// wxRendererFromDynLib: represents a renderer dynamically loaded from a DLL -// ---------------------------------------------------------------------------- - -class wxRendererFromDynLib : public wxDelegateRendererNative -{ -public: - // create the object wrapping the given renderer created from this DLL - // - // we take ownership of the pointer and will delete it (and also unload the - // DLL) when we're deleted - wxRendererFromDynLib(wxDynamicLibrary& dll, wxRendererNative *renderer) - : wxDelegateRendererNative(*renderer), - m_renderer(renderer), - m_dllHandle(dll.Detach()) - { - } - - virtual ~wxRendererFromDynLib() - { - delete m_renderer; - wxDynamicLibrary::Unload(m_dllHandle); - } - -private: - wxRendererNative *m_renderer; - wxDllType m_dllHandle; -}; - -#endif // wxUSE_DYNLIB_CLASS - -// ============================================================================ -// wxRendererNative implementation -// ============================================================================ - -wxRendererNative::~wxRendererNative() -{ - // empty but necessary -} - -// ---------------------------------------------------------------------------- -// Managing the global renderer -// ---------------------------------------------------------------------------- - -/* static */ -wxRendererNative& wxRendererNative::Get() -{ - wxRendererPtr& renderer = wxRendererPtr::Get(); - - return renderer.IsOk() ? *renderer.get() : GetDefault(); -} - -/* static */ -wxRendererNative *wxRendererNative::Set(wxRendererNative *rendererNew) -{ - wxRendererPtr& renderer = wxRendererPtr::Get(); - - wxRendererNative *rendererOld = renderer.release(); - - renderer.reset(rendererNew); - - return rendererOld; -} - - -// ---------------------------------------------------------------------------- -// Dynamic renderers loading -// ---------------------------------------------------------------------------- - -#if wxUSE_DYNLIB_CLASS - -/* static */ -wxRendererNative *wxRendererNative::Load(const wxString& name) -{ - wxString fullname = wxDynamicLibrary::CanonicalizePluginName(name); - - wxDynamicLibrary dll(fullname); - if ( !dll.IsLoaded() ) - return NULL; - - // each theme DLL must export a wxCreateRenderer() function with this - // signature - typedef wxRendererNative *(*wxCreateRenderer_t)(); - - wxDYNLIB_FUNCTION(wxCreateRenderer_t, wxCreateRenderer, dll); - if ( !pfnwxCreateRenderer ) - return NULL; - - // create a renderer object - wxRendererNative *renderer = (*pfnwxCreateRenderer)(); - if ( !renderer ) - return NULL; - - // check that its version is compatible with ours - wxRendererVersion ver = renderer->GetVersion(); - if ( !wxRendererVersion::IsCompatible(ver) ) - { - wxLogError(_("Renderer \"%s\" has incompatible version %d.%d and couldn't be loaded."), - name.c_str(), ver.version, ver.age); - delete renderer; - - return NULL; - } - - // finally wrap the renderer in an object which will delete it and unload - // the library when it is deleted and return it to the caller - return new wxRendererFromDynLib(dll, renderer); -} - -#endif // wxUSE_DYNLIB_CLASS diff --git a/Source/3rdParty/wx/src/common/rgncmn.cpp b/Source/3rdParty/wx/src/common/rgncmn.cpp deleted file mode 100644 index 0f9c8b216..000000000 --- a/Source/3rdParty/wx/src/common/rgncmn.cpp +++ /dev/null @@ -1,192 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/rgncmn.cpp -// Purpose: Methods of wxRegion that have a generic implementation -// Author: Robin Dunn -// Modified by: -// Created: 27-Mar-2003 -// RCS-ID: $Id: rgncmn.cpp 41901 2006-10-10 17:33:49Z PC $ -// Copyright: (c) Robin Dunn -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/region.h" - -#ifndef WX_PRECOMP - #include "wx/dcmemory.h" - #include "wx/bitmap.h" - #include "wx/image.h" -#endif //WX_PRECOMP - -// ============================================================================ -// wxRegionBase implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// region comparision -// ---------------------------------------------------------------------------- - -bool wxRegionBase::IsEqual(const wxRegion& region) const -{ - if ( m_refData == region.GetRefData() ) - { - // regions are identical, hence equal - return true; - } - - if ( !m_refData || !region.GetRefData() ) - { - // one, but not both, of the regions is invalid - return false; - } - - return DoIsEqual(region); -} - -// ---------------------------------------------------------------------------- -// region to/from bitmap conversions -// ---------------------------------------------------------------------------- - -wxBitmap wxRegionBase::ConvertToBitmap() const -{ - wxRect box = GetBox(); - wxBitmap bmp(box.GetRight(), box.GetBottom()); - wxMemoryDC dc; - dc.SelectObject(bmp); - dc.SetBackground(*wxBLACK_BRUSH); - dc.Clear(); - dc.SetClippingRegion(*wx_static_cast(const wxRegion *, this)); - dc.SetBackground(*wxWHITE_BRUSH); - dc.Clear(); - dc.SelectObject(wxNullBitmap); - return bmp; -} - -#if wxUSE_IMAGE - -static bool DoRegionUnion(wxRegionBase& region, - const wxImage& image, - unsigned char loR, - unsigned char loG, - unsigned char loB, - int tolerance) -{ - unsigned char hiR, hiG, hiB; - - hiR = (unsigned char)wxMin(0xFF, loR + tolerance); - hiG = (unsigned char)wxMin(0xFF, loG + tolerance); - hiB = (unsigned char)wxMin(0xFF, loB + tolerance); - - // Loop through the image row by row, pixel by pixel, building up - // rectangles to add to the region. - int width = image.GetWidth(); - int height = image.GetHeight(); - for (int y=0; y < height; y++) - { - wxRect rect; - rect.y = y; - rect.height = 1; - - for (int x=0; x < width; x++) - { - // search for a continuous range of non-transparent pixels - int x0 = x; - while ( x < width) - { - unsigned char R = image.GetRed(x,y); - unsigned char G = image.GetGreen(x,y); - unsigned char B = image.GetBlue(x,y); - if (( R >= loR && R <= hiR) && - ( G >= loG && G <= hiG) && - ( B >= loB && B <= hiB)) // It's transparent - break; - x++; - } - - // Add the run of non-transparent pixels (if any) to the region - if (x > x0) { - rect.x = x0; - rect.width = x - x0; - region.Union(rect); - } - } - } - - return true; -} - - -bool wxRegionBase::Union(const wxBitmap& bmp) -{ - if (bmp.GetMask()) - { - wxImage image = bmp.ConvertToImage(); - wxASSERT_MSG( image.HasMask(), _T("wxBitmap::ConvertToImage doesn't preserve mask?") ); - return DoRegionUnion(*this, image, - image.GetMaskRed(), - image.GetMaskGreen(), - image.GetMaskBlue(), - 0); - } - else - { - return Union(0, 0, bmp.GetWidth(), bmp.GetHeight()); - } -} - -bool wxRegionBase::Union(const wxBitmap& bmp, - const wxColour& transColour, - int tolerance) -{ - wxImage image = bmp.ConvertToImage(); - return DoRegionUnion(*this, image, - transColour.Red(), - transColour.Green(), - transColour.Blue(), - tolerance); -} - -#endif // wxUSE_IMAGE - -#ifdef wxHAS_REGION_COMBINE -// ============================================================================ -// wxRegionWithCombine -// ============================================================================ - -// implement some wxRegionBase pure virtuals in terms of Combine() -bool wxRegionWithCombine::DoUnionWithRect(const wxRect& rect) -{ - return Combine(rect, wxRGN_OR); -} - -bool wxRegionWithCombine::DoUnionWithRegion(const wxRegion& region) -{ - return DoCombine(region, wxRGN_OR); -} - -bool wxRegionWithCombine::DoIntersect(const wxRegion& region) -{ - return DoCombine(region, wxRGN_AND); -} - -bool wxRegionWithCombine::DoSubtract(const wxRegion& region) -{ - return DoCombine(region, wxRGN_DIFF); -} - -bool wxRegionWithCombine::DoXor(const wxRegion& region) -{ - return DoCombine(region, wxRGN_XOR); -} - -#endif // wxHAS_REGION_COMBINE diff --git a/Source/3rdParty/wx/src/common/settcmn.cpp b/Source/3rdParty/wx/src/common/settcmn.cpp deleted file mode 100644 index 334a8f8b8..000000000 --- a/Source/3rdParty/wx/src/common/settcmn.cpp +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/settcmn.cpp -// Purpose: common (to all ports) wxWindow functions -// Author: Robert Roebling -// RCS-ID: $Id: settcmn.cpp 39310 2006-05-24 07:16:32Z ABX $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/settings.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" -#endif //WX_PRECOMP - -// ---------------------------------------------------------------------------- -// static data -// ---------------------------------------------------------------------------- - -wxSystemScreenType wxSystemSettings::ms_screen = wxSYS_SCREEN_NONE; - -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- - -wxSystemScreenType wxSystemSettings::GetScreenType() -{ - if (ms_screen == wxSYS_SCREEN_NONE) - { - // wxUniv will be used on small devices, too. - int x = GetMetric( wxSYS_SCREEN_X ); - - ms_screen = wxSYS_SCREEN_DESKTOP; - - if (x < 800) - ms_screen = wxSYS_SCREEN_SMALL; - - if (x < 640) - ms_screen = wxSYS_SCREEN_PDA; - - if (x < 200) - ms_screen = wxSYS_SCREEN_TINY; - - // This is probably a bug, but VNC seems to report 0 - if (x < 10) - ms_screen = wxSYS_SCREEN_DESKTOP; - } - - return ms_screen; -} - -void wxSystemSettings::SetScreenType( wxSystemScreenType screen ) -{ - ms_screen = screen; -} - -#if WXWIN_COMPATIBILITY_2_4 - -wxColour wxSystemSettings::GetSystemColour(int index) -{ - return GetColour((wxSystemColour)index); -} - -wxFont wxSystemSettings::GetSystemFont(int index) -{ - return GetFont((wxSystemFont)index); -} - -int wxSystemSettings::GetSystemMetric(int index) -{ - return GetMetric((wxSystemMetric)index); -} - -#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/Source/3rdParty/wx/src/common/sizer.cpp b/Source/3rdParty/wx/src/common/sizer.cpp deleted file mode 100644 index 34a649aaa..000000000 --- a/Source/3rdParty/wx/src/common/sizer.cpp +++ /dev/null @@ -1,2265 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/sizer.cpp -// Purpose: provide new wxSizer class for layout -// Author: Robert Roebling and Robin Dunn, contributions by -// Dirk Holtwick, Ron Lee -// Modified by: Ron Lee -// Created: -// RCS-ID: $Id: sizer.cpp 66936 2011-02-17 09:52:57Z JS $ -// Copyright: (c) Robin Dunn, Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/display.h" -#include "wx/sizer.h" - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/math.h" - #include "wx/utils.h" - #include "wx/settings.h" - #include "wx/button.h" - #include "wx/statbox.h" - #include "wx/toplevel.h" -#endif // WX_PRECOMP - -#include "wx/listimpl.cpp" - -#if WXWIN_COMPATIBILITY_2_4 - #include "wx/notebook.h" -#endif - -//--------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxSizerItem, wxObject) -IMPLEMENT_CLASS(wxSizer, wxObject) -IMPLEMENT_CLASS(wxGridSizer, wxSizer) -IMPLEMENT_CLASS(wxFlexGridSizer, wxGridSizer) -IMPLEMENT_CLASS(wxBoxSizer, wxSizer) -#if wxUSE_STATBOX -IMPLEMENT_CLASS(wxStaticBoxSizer, wxBoxSizer) -#endif -#if wxUSE_BUTTON -IMPLEMENT_CLASS(wxStdDialogButtonSizer, wxBoxSizer) -#endif - -WX_DEFINE_EXPORTED_LIST( wxSizerItemList ) - -/* - TODO PROPERTIES - sizeritem - object - object_ref - minsize - option - flag - border - spacer - option - flag - borfder - boxsizer - orient - staticboxsizer - orient - label - gridsizer - rows - cols - vgap - hgap - flexgridsizer - rows - cols - vgap - hgap - growablerows - growablecols - minsize -*/ - - -// ---------------------------------------------------------------------------- -// wxSizerFlags -// ---------------------------------------------------------------------------- - -wxSizerFlags& wxSizerFlags::ReserveSpaceEvenIfHidden() -{ - m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN; - return *this; -} - -// ---------------------------------------------------------------------------- -// wxSizerItem -// ---------------------------------------------------------------------------- - -void wxSizerItem::Init(const wxSizerFlags& flags) -{ - Init(); - - m_proportion = flags.GetProportion(); - m_flag = flags.GetFlags(); - m_border = flags.GetBorderInPixels(); -} - -wxSizerItem::wxSizerItem() -{ - Init(); - - m_proportion = 0; - m_border = 0; - m_flag = 0; - - m_kind = Item_None; -} - -// window item -void wxSizerItem::SetWindow(wxWindow *window) -{ - wxCHECK_RET( window, _T("NULL window in wxSizerItem::SetWindow()") ); - - m_kind = Item_Window; - m_window = window; - - // window doesn't become smaller than its initial size, whatever happens - m_minSize = window->GetSize(); - - if ( m_flag & wxFIXED_MINSIZE ) - window->SetMinSize(m_minSize); - - // aspect ratio calculated from initial size - SetRatio(m_minSize); -} - -wxSizerItem::wxSizerItem(wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData) - : m_proportion(proportion), - m_border(border), - m_flag(flag), - m_userData(userData) -{ - SetWindow(window); -} - -// sizer item -void wxSizerItem::SetSizer(wxSizer *sizer) -{ - m_kind = Item_Sizer; - m_sizer = sizer; -} - -wxSizerItem::wxSizerItem(wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData) - : m_proportion(proportion), - m_border(border), - m_flag(flag), - m_ratio(0.0), - m_userData(userData) -{ - SetSizer(sizer); - - // m_minSize is set later -} - -// spacer item -void wxSizerItem::SetSpacer(const wxSize& size) -{ - m_kind = Item_Spacer; - m_spacer = new wxSizerSpacer(size); - m_minSize = size; - SetRatio(size); -} - -wxSizerItem::wxSizerItem(int width, - int height, - int proportion, - int flag, - int border, - wxObject* userData) - : m_minSize(width, height), // minimal size is the initial size - m_proportion(proportion), - m_border(border), - m_flag(flag), - m_userData(userData) -{ - SetSpacer(width, height); -} - -wxSizerItem::~wxSizerItem() -{ - delete m_userData; - - switch ( m_kind ) - { - case Item_None: - break; - - case Item_Window: - m_window->SetContainingSizer(NULL); - break; - - case Item_Sizer: - delete m_sizer; - break; - - case Item_Spacer: - delete m_spacer; - break; - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } -} - -wxSize wxSizerItem::GetSpacer() const -{ - wxSize size; - if ( m_kind == Item_Spacer ) - size = m_spacer->GetSize(); - - return size; -} - - -wxSize wxSizerItem::GetSize() const -{ - wxSize ret; - switch ( m_kind ) - { - case Item_None: - break; - - case Item_Window: - ret = m_window->GetSize(); - break; - - case Item_Sizer: - ret = m_sizer->GetSize(); - break; - - case Item_Spacer: - ret = m_spacer->GetSize(); - break; - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } - - if (m_flag & wxWEST) - ret.x += m_border; - if (m_flag & wxEAST) - ret.x += m_border; - if (m_flag & wxNORTH) - ret.y += m_border; - if (m_flag & wxSOUTH) - ret.y += m_border; - - return ret; -} - -wxSize wxSizerItem::CalcMin() -{ - if (IsSizer()) - { - m_minSize = m_sizer->GetMinSize(); - - // if we have to preserve aspect ratio _AND_ this is - // the first-time calculation, consider ret to be initial size - if ( (m_flag & wxSHAPED) && wxIsNullDouble(m_ratio) ) - SetRatio(m_minSize); - } - else if ( IsWindow() ) - { - // Since the size of the window may change during runtime, we - // should use the current minimal/best size. - m_minSize = m_window->GetEffectiveMinSize(); - } - - return GetMinSizeWithBorder(); -} - -wxSize wxSizerItem::GetMinSizeWithBorder() const -{ - wxSize ret = m_minSize; - - if (m_flag & wxWEST) - ret.x += m_border; - if (m_flag & wxEAST) - ret.x += m_border; - if (m_flag & wxNORTH) - ret.y += m_border; - if (m_flag & wxSOUTH) - ret.y += m_border; - - return ret; -} - - -void wxSizerItem::SetDimension( const wxPoint& pos_, const wxSize& size_ ) -{ - wxPoint pos = pos_; - wxSize size = size_; - if (m_flag & wxSHAPED) - { - // adjust aspect ratio - int rwidth = (int) (size.y * m_ratio); - if (rwidth > size.x) - { - // fit horizontally - int rheight = (int) (size.x / m_ratio); - // add vertical space - if (m_flag & wxALIGN_CENTER_VERTICAL) - pos.y += (size.y - rheight) / 2; - else if (m_flag & wxALIGN_BOTTOM) - pos.y += (size.y - rheight); - // use reduced dimensions - size.y =rheight; - } - else if (rwidth < size.x) - { - // add horizontal space - if (m_flag & wxALIGN_CENTER_HORIZONTAL) - pos.x += (size.x - rwidth) / 2; - else if (m_flag & wxALIGN_RIGHT) - pos.x += (size.x - rwidth); - size.x = rwidth; - } - } - - // This is what GetPosition() returns. Since we calculate - // borders afterwards, GetPosition() will be the left/top - // corner of the surrounding border. - m_pos = pos; - - if (m_flag & wxWEST) - { - pos.x += m_border; - size.x -= m_border; - } - if (m_flag & wxEAST) - { - size.x -= m_border; - } - if (m_flag & wxNORTH) - { - pos.y += m_border; - size.y -= m_border; - } - if (m_flag & wxSOUTH) - { - size.y -= m_border; - } - - if (size.x < 0) - size.x = 0; - if (size.y < 0) - size.y = 0; - - m_rect = wxRect(pos, size); - - switch ( m_kind ) - { - case Item_None: - wxFAIL_MSG( _T("can't set size of uninitialized sizer item") ); - break; - - case Item_Window: - m_window->SetSize(pos.x, pos.y, size.x, size.y, - wxSIZE_ALLOW_MINUS_ONE); - break; - - case Item_Sizer: - m_sizer->SetDimension(pos.x, pos.y, size.x, size.y); - break; - - case Item_Spacer: - m_spacer->SetSize(size); - break; - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } -} - -void wxSizerItem::DeleteWindows() -{ - switch ( m_kind ) - { - case Item_None: - case Item_Spacer: - break; - - case Item_Window: - //We are deleting the window from this sizer - normally - //the window destroys the sizer associated with it, - //which might destroy this, which we don't want - m_window->SetContainingSizer(NULL); - m_window->Destroy(); - //Putting this after the switch will result in a spacer - //not being deleted properly on destruction - m_kind = Item_None; - break; - - case Item_Sizer: - m_sizer->DeleteWindows(); - break; - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } - -} - -void wxSizerItem::Show( bool show ) -{ - switch ( m_kind ) - { - case Item_None: - wxFAIL_MSG( _T("can't show uninitialized sizer item") ); - break; - - case Item_Window: - m_window->Show(show); - break; - - case Item_Sizer: - m_sizer->Show(show); - break; - - case Item_Spacer: - m_spacer->Show(show); - break; - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } -} - -bool wxSizerItem::IsShown() const -{ - switch ( m_kind ) - { - case Item_None: - // we may be called from CalcMin(), just return false so that we're - // not used - break; - - case Item_Window: - return m_window->IsShown(); - - case Item_Sizer: - // arbitrarily decide that if at least one of our elements is - // shown, so are we (this arbitrariness is the reason for - // deprecating this function) - { - // Some apps (such as dialog editors) depend on an empty sizer still - // being laid out correctly and reporting the correct size and position. - if (m_sizer->GetChildren().GetCount() == 0) - return true; - - for ( wxSizerItemList::compatibility_iterator - node = m_sizer->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - if ( node->GetData()->IsShown() ) - return true; - } - } - return false; - - case Item_Spacer: - return m_spacer->IsShown(); - - case Item_Max: - default: - wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); - } - - return false; -} - -// This is a helper to support wxRESERVE_SPACE_EVEN_IF_HIDDEN. In wx 2.9+, -// this flag is respected by IsShown(), but not in wx 2.8. -bool wxSizerItem::ShouldAccountFor() const -{ - if ( m_flag & wxRESERVE_SPACE_EVEN_IF_HIDDEN ) - return true; - - if ( IsSizer() ) - { - // this mirrors wxSizerItem::IsShown() code above - const wxSizerItemList& children = m_sizer->GetChildren(); - if ( children.GetCount() == 0 ) - return true; - - for ( wxSizerItemList::compatibility_iterator - node = children.GetFirst(); - node; - node = node->GetNext() ) - { - if ( node->GetData()->ShouldAccountFor() ) - return true; - } - return false; - } - else - { - return IsShown(); - } -} - - -#if WXWIN_COMPATIBILITY_2_6 -void wxSizerItem::SetOption( int option ) -{ - SetProportion( option ); -} - -int wxSizerItem::GetOption() const -{ - return GetProportion(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - -//--------------------------------------------------------------------------- -// wxSizer -//--------------------------------------------------------------------------- - -wxSizer::~wxSizer() -{ - WX_CLEAR_LIST(wxSizerItemList, m_children); -} - -wxSizerItem* wxSizer::Insert( size_t index, wxSizerItem *item ) -{ - m_children.Insert( index, item ); - - if ( item->GetWindow() ) - item->GetWindow()->SetContainingSizer( this ); - - if ( item->GetSizer() ) - item->GetSizer()->SetContainingWindow( m_containingWindow ); - - return item; -} - -void wxSizer::SetContainingWindow(wxWindow *win) -{ - if ( win == m_containingWindow ) - return; - - m_containingWindow = win; - - // set the same window for all nested sizers as well, they also are in the - // same window - for ( wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - node; - node = node->GetNext() ) - { - wxSizerItem *const item = node->GetData(); - wxSizer *const sizer = item->GetSizer(); - - if ( sizer ) - { - sizer->SetContainingWindow(win); - } - } -} - -#if WXWIN_COMPATIBILITY_2_6 -bool wxSizer::Remove( wxWindow *window ) -{ - return Detach( window ); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -bool wxSizer::Remove( wxSizer *sizer ) -{ - wxASSERT_MSG( sizer, _T("Removing NULL sizer") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == sizer) - { - delete item; - m_children.Erase( node ); - return true; - } - - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::Remove( int index ) -{ - wxCHECK_MSG( index >= 0 && (size_t)index < m_children.GetCount(), - false, - _T("Remove index is out of range") ); - - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - - wxCHECK_MSG( node, false, _T("Failed to find child node") ); - - wxSizerItem *item = node->GetData(); - - if ( item->IsWindow() ) - item->GetWindow()->SetContainingSizer( NULL ); - - delete item; - m_children.Erase( node ); - return true; -} - -bool wxSizer::Detach( wxSizer *sizer ) -{ - wxASSERT_MSG( sizer, _T("Detaching NULL sizer") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == sizer) - { - item->DetachSizer(); - delete item; - m_children.Erase( node ); - return true; - } - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::Detach( wxWindow *window ) -{ - wxASSERT_MSG( window, _T("Detaching NULL window") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetWindow() == window) - { - item->GetWindow()->SetContainingSizer( NULL ); - delete item; - m_children.Erase( node ); - return true; - } - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::Detach( int index ) -{ - wxCHECK_MSG( index >= 0 && (size_t)index < m_children.GetCount(), - false, - _T("Detach index is out of range") ); - - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - - wxCHECK_MSG( node, false, _T("Failed to find child node") ); - - wxSizerItem *item = node->GetData(); - - if ( item->IsSizer() ) - item->DetachSizer(); - else if ( item->IsWindow() ) - item->GetWindow()->SetContainingSizer( NULL ); - - delete item; - m_children.Erase( node ); - return true; -} - -bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive ) -{ - wxASSERT_MSG( oldwin, _T("Replacing NULL window") ); - wxASSERT_MSG( newwin, _T("Replacing with NULL window") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetWindow() == oldwin) - { - item->GetWindow()->SetContainingSizer( NULL ); - item->SetWindow(newwin); - newwin->SetContainingSizer( this ); - return true; - } - else if (recursive && item->IsSizer()) - { - if (item->GetSizer()->Replace( oldwin, newwin, true )) - return true; - } - - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive ) -{ - wxASSERT_MSG( oldsz, _T("Replacing NULL sizer") ); - wxASSERT_MSG( newsz, _T("Replacing with NULL sizer") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == oldsz) - { - wxSizer *old = item->GetSizer(); - item->SetSizer(newsz); - delete old; - return true; - } - else if (recursive && item->IsSizer()) - { - if (item->GetSizer()->Replace( oldsz, newsz, true )) - return true; - } - - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::Replace( size_t old, wxSizerItem *newitem ) -{ - wxCHECK_MSG( old < m_children.GetCount(), false, _T("Replace index is out of range") ); - wxASSERT_MSG( newitem, _T("Replacing with NULL item") ); - - wxSizerItemList::compatibility_iterator node = m_children.Item( old ); - - wxCHECK_MSG( node, false, _T("Failed to find child node") ); - - wxSizerItem *item = node->GetData(); - node->SetData(newitem); - - if (item->IsWindow() && item->GetWindow()) - item->GetWindow()->SetContainingSizer(NULL); - - delete item; - - return true; -} - -void wxSizer::Clear( bool delete_windows ) -{ - // First clear the ContainingSizer pointers - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->IsWindow()) - item->GetWindow()->SetContainingSizer( NULL ); - node = node->GetNext(); - } - - // Destroy the windows if needed - if (delete_windows) - DeleteWindows(); - - // Now empty the list - WX_CLEAR_LIST(wxSizerItemList, m_children); -} - -void wxSizer::DeleteWindows() -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - item->DeleteWindows(); - node = node->GetNext(); - } -} - -wxSize wxSizer::ComputeFittingWindowSize(wxWindow *window) -{ - // take the min size by default and limit it by max size - wxSize size = GetMinWindowSize(window); - wxSize sizeMax = GetMaxWindowSize(window); - - wxTopLevelWindow *tlw = wxDynamicCast(window, wxTopLevelWindow); - if ( tlw ) - { - // hack for small screen devices where TLWs are always full screen - if ( tlw->IsAlwaysMaximized() ) - { - size = tlw->GetSize(); - } - else // normal situation - { - // limit the window to the size of the display it is on - int disp = wxDisplay::GetFromWindow(window); - if ( disp == wxNOT_FOUND ) - { - // or, if we don't know which one it is, of the main one - disp = 0; - } - - sizeMax = wxDisplay(disp).GetClientArea().GetSize(); - } - } - - if ( sizeMax.x != wxDefaultCoord && size.x > sizeMax.x ) - size.x = sizeMax.x; - if ( sizeMax.y != wxDefaultCoord && size.y > sizeMax.y ) - size.y = sizeMax.y; - - return size; -} - -wxSize wxSizer::ComputeFittingClientSize(wxWindow *window) -{ - wxCHECK_MSG( window, wxDefaultSize, _T("window can't be NULL") ); - - return window->WindowToClientSize(ComputeFittingWindowSize(window)); -} - -wxSize wxSizer::Fit( wxWindow *window ) -{ - wxSize size = ComputeFittingWindowSize(window); - window->SetSize(size); - return size; -} - -void wxSizer::FitInside( wxWindow *window ) -{ - wxSize size; - if (window->IsTopLevel()) - size = VirtualFitSize( window ); - else - size = GetMinClientSize( window ); - - window->SetVirtualSize( size ); -} - -void wxSizer::Layout() -{ - // (re)calculates minimums needed for each item and other preparations - // for layout - CalcMin(); - - // Applies the layout and repositions/resizes the items - RecalcSizes(); -} - -void wxSizer::SetSizeHints( wxWindow *window ) -{ - // Preserve the window's max size hints, but set the - // lower bound according to the sizer calculations. - - // This is equivalent to calling Fit(), except that we need to set - // the size hints _in between_ the two steps performed by Fit - // (1. ComputeFittingWindowSize, 2. SetSize). That's because - // otherwise SetSize() could have no effect if there already are - // size hints in effect that forbid requested size. - const wxSize size = ComputeFittingWindowSize(window); - - window->SetSizeHints( size.x, - size.y, - window->GetMaxWidth(), - window->GetMaxHeight() ); - - window->SetSize(size); -} - -void wxSizer::SetVirtualSizeHints( wxWindow *window ) -{ - // Preserve the window's max size hints, but set the - // lower bound according to the sizer calculations. - - FitInside( window ); - wxSize size( window->GetVirtualSize() ); - window->SetVirtualSizeHints( size.x, - size.y, - window->GetMaxWidth(), - window->GetMaxHeight() ); -} - -wxSize wxSizer::GetMaxWindowSize( wxWindow *window ) const -{ - return window->GetMaxSize(); -} - -wxSize wxSizer::GetMinWindowSize( wxWindow *window ) -{ - wxSize minSize( GetMinSize() ); - wxSize size( window->GetSize() ); - wxSize client_size( window->GetClientSize() ); - - return wxSize( minSize.x+size.x-client_size.x, - minSize.y+size.y-client_size.y ); -} - -// TODO on mac we need a function that determines how much free space this -// min size contains, in order to make sure that we have 20 pixels of free -// space around the controls -wxSize wxSizer::GetMaxClientSize( wxWindow *window ) const -{ - wxSize maxSize( window->GetMaxSize() ); - - if ( maxSize != wxDefaultSize ) - { - wxSize size( window->GetSize() ); - wxSize client_size( window->GetClientSize() ); - - return wxSize( maxSize.x + client_size.x - size.x, - maxSize.y + client_size.y - size.y ); - } - else - return wxDefaultSize; -} - -wxSize wxSizer::GetMinClientSize( wxWindow *WXUNUSED(window) ) -{ - return GetMinSize(); // Already returns client size. -} - -wxSize wxSizer::VirtualFitSize( wxWindow *window ) -{ - wxSize size = GetMinClientSize( window ); - wxSize sizeMax = GetMaxClientSize( window ); - - // Limit the size if sizeMax != wxDefaultSize - - if ( size.x > sizeMax.x && sizeMax.x != wxDefaultCoord ) - size.x = sizeMax.x; - if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord ) - size.y = sizeMax.y; - - return size; -} - -void wxSizer::SetDimension( int x, int y, int width, int height ) -{ - m_position.x = x; - m_position.y = y; - m_size.x = width; - m_size.y = height; - Layout(); -} - -wxSize wxSizer::GetMinSize() -{ - wxSize ret( CalcMin() ); - if (ret.x < m_minSize.x) ret.x = m_minSize.x; - if (ret.y < m_minSize.y) ret.y = m_minSize.y; - return ret; -} - -void wxSizer::DoSetMinSize( int width, int height ) -{ - m_minSize.x = width; - m_minSize.y = height; -} - -bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height ) -{ - wxASSERT_MSG( window, _T("SetMinSize for NULL window") ); - - // Is it our immediate child? - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetWindow() == window) - { - item->SetMinSize( width, height ); - return true; - } - node = node->GetNext(); - } - - // No? Search any subsizers we own then - - node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if ( item->GetSizer() && - item->GetSizer()->DoSetItemMinSize( window, width, height ) ) - { - // A child sizer found the requested windw, exit. - return true; - } - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height ) -{ - wxASSERT_MSG( sizer, _T("SetMinSize for NULL sizer") ); - - // Is it our immediate child? - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == sizer) - { - item->GetSizer()->DoSetMinSize( width, height ); - return true; - } - node = node->GetNext(); - } - - // No? Search any subsizers we own then - - node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if ( item->GetSizer() && - item->GetSizer()->DoSetItemMinSize( sizer, width, height ) ) - { - // A child found the requested sizer, exit. - return true; - } - node = node->GetNext(); - } - - return false; -} - -bool wxSizer::DoSetItemMinSize( size_t index, int width, int height ) -{ - wxSizerItemList::compatibility_iterator node = m_children.Item( index ); - - wxCHECK_MSG( node, false, _T("Failed to find child node") ); - - wxSizerItem *item = node->GetData(); - - if (item->GetSizer()) - { - // Sizers contains the minimal size in them, if not calculated ... - item->GetSizer()->DoSetMinSize( width, height ); - } - else - { - // ... but the minimal size of spacers and windows is stored via the item - item->SetMinSize( width, height ); - } - - return true; -} - -wxSizerItem* wxSizer::GetItem( wxWindow *window, bool recursive ) -{ - wxASSERT_MSG( window, _T("GetItem for NULL window") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetWindow() == window) - { - return item; - } - else if (recursive && item->IsSizer()) - { - wxSizerItem *subitem = item->GetSizer()->GetItem( window, true ); - if (subitem) - return subitem; - } - - node = node->GetNext(); - } - - return NULL; -} - -wxSizerItem* wxSizer::GetItem( wxSizer *sizer, bool recursive ) -{ - wxASSERT_MSG( sizer, _T("GetItem for NULL sizer") ); - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == sizer) - { - return item; - } - else if (recursive && item->IsSizer()) - { - wxSizerItem *subitem = item->GetSizer()->GetItem( sizer, true ); - if (subitem) - return subitem; - } - - node = node->GetNext(); - } - - return NULL; -} - -wxSizerItem* wxSizer::GetItem( size_t index ) -{ - wxCHECK_MSG( index < m_children.GetCount(), - NULL, - _T("GetItem index is out of range") ); - - return m_children.Item( index )->GetData(); -} - -bool wxSizer::Show( wxWindow *window, bool show, bool recursive ) -{ - wxSizerItem *item = GetItem( window, recursive ); - - if ( item ) - { - item->Show( show ); - return true; - } - - return false; -} - -bool wxSizer::Show( wxSizer *sizer, bool show, bool recursive ) -{ - wxSizerItem *item = GetItem( sizer, recursive ); - - if ( item ) - { - item->Show( show ); - return true; - } - - return false; -} - -bool wxSizer::Show( size_t index, bool show) -{ - wxSizerItem *item = GetItem( index ); - - if ( item ) - { - item->Show( show ); - return true; - } - - return false; -} - -void wxSizer::ShowItems( bool show ) -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - node->GetData()->Show( show ); - node = node->GetNext(); - } -} - -bool wxSizer::IsShown( wxWindow *window ) const -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetWindow() == window) - { - return item->IsShown(); - } - node = node->GetNext(); - } - - wxFAIL_MSG( _T("IsShown failed to find sizer item") ); - - return false; -} - -bool wxSizer::IsShown( wxSizer *sizer ) const -{ - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->GetSizer() == sizer) - { - return item->IsShown(); - } - node = node->GetNext(); - } - - wxFAIL_MSG( _T("IsShown failed to find sizer item") ); - - return false; -} - -bool wxSizer::IsShown( size_t index ) const -{ - wxCHECK_MSG( index < m_children.GetCount(), - false, - _T("IsShown index is out of range") ); - - return m_children.Item( index )->GetData()->IsShown(); -} - - -//--------------------------------------------------------------------------- -// wxGridSizer -//--------------------------------------------------------------------------- - -wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap ) - : m_rows( ( cols == 0 && rows == 0 ) ? 1 : rows ) - , m_cols( cols ) - , m_vgap( vgap ) - , m_hgap( hgap ) -{ -} - -wxGridSizer::wxGridSizer( int cols, int vgap, int hgap ) - : m_rows( cols == 0 ? 1 : 0 ) - , m_cols( cols ) - , m_vgap( vgap ) - , m_hgap( hgap ) -{ -} - -int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const -{ - int nitems = m_children.GetCount(); - if ( nitems) - { - if ( m_cols ) - { - ncols = m_cols; - nrows = (nitems + m_cols - 1) / m_cols; - } - else if ( m_rows ) - { - ncols = (nitems + m_rows - 1) / m_rows; - nrows = m_rows; - } - else // 0 columns, 0 rows? - { - wxFAIL_MSG( _T("grid sizer must have either rows or columns fixed") ); - - nrows = ncols = 0; - } - } - - return nitems; -} - -void wxGridSizer::RecalcSizes() -{ - int nitems, nrows, ncols; - if ( (nitems = CalcRowsCols(nrows, ncols)) == 0 ) - return; - - wxSize sz( GetSize() ); - wxPoint pt( GetPosition() ); - - int w = (sz.x - (ncols - 1) * m_hgap) / ncols; - int h = (sz.y - (nrows - 1) * m_vgap) / nrows; - - int x = pt.x; - for (int c = 0; c < ncols; c++) - { - int y = pt.y; - for (int r = 0; r < nrows; r++) - { - int i = r * ncols + c; - if (i < nitems) - { - wxSizerItemList::compatibility_iterator node = m_children.Item( i ); - - wxASSERT_MSG( node, _T("Failed to find SizerItemList node") ); - - SetItemBounds( node->GetData(), x, y, w, h); - } - y = y + h + m_vgap; - } - x = x + w + m_hgap; - } -} - -wxSize wxGridSizer::CalcMin() -{ - int nrows, ncols; - if ( CalcRowsCols(nrows, ncols) == 0 ) - return wxSize(); - - // Find the max width and height for any component - int w = 0; - int h = 0; - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - wxSize sz( item->CalcMin() ); - - w = wxMax( w, sz.x ); - h = wxMax( h, sz.y ); - - node = node->GetNext(); - } - - return wxSize( ncols * w + (ncols-1) * m_hgap, - nrows * h + (nrows-1) * m_vgap ); -} - -void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) -{ - wxPoint pt( x,y ); - wxSize sz( item->GetMinSizeWithBorder() ); - int flag = item->GetFlag(); - - if ((flag & wxEXPAND) || (flag & wxSHAPED)) - { - sz = wxSize(w, h); - } - else - { - if (flag & wxALIGN_CENTER_HORIZONTAL) - { - pt.x = x + (w - sz.x) / 2; - } - else if (flag & wxALIGN_RIGHT) - { - pt.x = x + (w - sz.x); - } - - if (flag & wxALIGN_CENTER_VERTICAL) - { - pt.y = y + (h - sz.y) / 2; - } - else if (flag & wxALIGN_BOTTOM) - { - pt.y = y + (h - sz.y); - } - } - - item->SetDimension(pt, sz); -} - -//--------------------------------------------------------------------------- -// wxFlexGridSizer -//--------------------------------------------------------------------------- - -wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap ) - : wxGridSizer( rows, cols, vgap, hgap ), - m_flexDirection(wxBOTH), - m_growMode(wxFLEX_GROWMODE_SPECIFIED) -{ -} - -wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap ) - : wxGridSizer( cols, vgap, hgap ), - m_flexDirection(wxBOTH), - m_growMode(wxFLEX_GROWMODE_SPECIFIED) -{ -} - -wxFlexGridSizer::~wxFlexGridSizer() -{ -} - -void wxFlexGridSizer::RecalcSizes() -{ - int nitems, nrows, ncols; - if ( (nitems = CalcRowsCols(nrows, ncols)) == 0 ) - return; - - wxPoint pt( GetPosition() ); - wxSize sz( GetSize() ); - - AdjustForGrowables(sz, m_calculatedMinSize, nrows, ncols); - - sz = wxSize( pt.x + sz.x, pt.y + sz.y ); - - int x = pt.x; - for (int c = 0; c < ncols; c++) - { - int y = pt.y; - for (int r = 0; r < nrows; r++) - { - int i = r * ncols + c; - if (i < nitems) - { - wxSizerItemList::compatibility_iterator node = m_children.Item( i ); - - wxASSERT_MSG( node, _T("Failed to find node") ); - - int w = wxMax( 0, wxMin( m_colWidths[c], sz.x - x ) ); - int h = wxMax( 0, wxMin( m_rowHeights[r], sz.y - y ) ); - - SetItemBounds( node->GetData(), x, y, w, h); - } - if (m_rowHeights[r] != -1) - y = y + m_rowHeights[r] + m_vgap; - } - if (m_colWidths[c] != -1) - x = x + m_colWidths[c] + m_hgap; - } -} - -wxSize wxFlexGridSizer::CalcMin() -{ - int nrows, - ncols; - size_t i, s; - - // Number of rows/columns can change as items are added or removed. - if ( !CalcRowsCols(nrows, ncols) ) - return wxSize(); - - m_rowHeights.SetCount(nrows); - m_colWidths.SetCount(ncols); - - // We have to recalcuate the sizes in case the item minimum size has - // changed since the previous layout, or the item has been hidden using - // wxSizer::Show(). If all the items in a row/column are hidden, the final - // dimension of the row/column will be -1, indicating that the column - // itself is hidden. - for( s = m_rowHeights.GetCount(), i = 0; i < s; ++i ) - m_rowHeights[ i ] = -1; - for( s = m_colWidths.GetCount(), i = 0; i < s; ++i ) - m_colWidths[ i ] = -1; - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - - i = 0; - while (node) - { - wxSizerItem *item = node->GetData(); - if ( item->ShouldAccountFor() ) - { - wxSize sz( item->CalcMin() ); - int row = i / ncols; - int col = i % ncols; - - m_rowHeights[ row ] = wxMax( wxMax( 0, sz.y ), m_rowHeights[ row ] ); - m_colWidths[ col ] = wxMax( wxMax( 0, sz.x ), m_colWidths[ col ] ); - } - - node = node->GetNext(); - i++; - } - - AdjustForFlexDirection(); - - // Sum total minimum size, including gaps between rows/columns. - // -1 is used as a magic number meaning empty column. - int width = 0; - for (int col = 0; col < ncols; col++) - if ( m_colWidths[ col ] != -1 ) - width += m_colWidths[ col ] + m_hgap; - if (width > 0) - width -= m_hgap; - - int height = 0; - for (int row = 0; row < nrows; row++) - if ( m_rowHeights[ row ] != -1 ) - height += m_rowHeights[ row ] + m_vgap; - if (height > 0) - height -= m_vgap; - - m_calculatedMinSize = wxSize( width, height ); - return m_calculatedMinSize; -} - -void wxFlexGridSizer::AdjustForFlexDirection() -{ - // the logic in CalcMin works when we resize flexibly in both directions - // but maybe this is not the case - if ( m_flexDirection != wxBOTH ) - { - // select the array corresponding to the direction in which we do *not* - // resize flexibly - wxArrayInt& array = m_flexDirection == wxVERTICAL ? m_colWidths - : m_rowHeights; - - const size_t count = array.GetCount(); - - // find the largest value in this array - size_t n; - int largest = 0; - - for ( n = 0; n < count; ++n ) - { - if ( array[n] > largest ) - largest = array[n]; - } - - // and now fill it with the largest value - for ( n = 0; n < count; ++n ) - { - // don't touch hidden rows - if ( array[n] != -1 ) - array[n] = largest; - } - } -} - - -void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz, const wxSize& minsz, - int nrows, int ncols) -{ - // what to do with the rows? by default, resize them proportionally - if ( sz.y > minsz.y && ( (m_flexDirection & wxVERTICAL) || (m_growMode == wxFLEX_GROWMODE_SPECIFIED) ) ) - { - int sum_proportions = 0; - int growable_space = 0; - int num = 0; - size_t idx; - for (idx = 0; idx < m_growableRows.GetCount(); idx++) - { - // Since the number of rows/columns can change as items are - // inserted/deleted, we need to verify at runtime that the - // requested growable rows/columns are still valid. - if (m_growableRows[idx] >= nrows) - continue; - - // If all items in a row/column are hidden, that row/column will - // have a dimension of -1. This causes the row/column to be - // hidden completely. - if (m_rowHeights[ m_growableRows[idx] ] == -1) - continue; - sum_proportions += m_growableRowsProportions[idx]; - growable_space += m_rowHeights[ m_growableRows[idx] ]; - num++; - } - - if (num > 0) - { - for (idx = 0; idx < m_growableRows.GetCount(); idx++) - { - if (m_growableRows[idx] >= nrows ) - continue; - if (m_rowHeights[ m_growableRows[idx] ] != -1) - { - int delta = (sz.y - minsz.y); - if (sum_proportions == 0) - delta = (delta/num) + m_rowHeights[ m_growableRows[idx] ]; - else - delta = ((delta+growable_space)*m_growableRowsProportions[idx]) / sum_proportions; - m_rowHeights[ m_growableRows[idx] ] = delta; - } - } - } - } - else if ( (m_growMode == wxFLEX_GROWMODE_ALL) && (sz.y > minsz.y) ) - { - // rounding problem? - for ( int row = 0; row < nrows; ++row ) - m_rowHeights[ row ] = sz.y / nrows; - } - - // the same logic as above but for the columns - if ( sz.x > minsz.x && ( (m_flexDirection & wxHORIZONTAL) || (m_growMode == wxFLEX_GROWMODE_SPECIFIED) ) ) - { - int sum_proportions = 0; - int growable_space = 0; - int num = 0; - size_t idx; - for (idx = 0; idx < m_growableCols.GetCount(); idx++) - { - // Since the number of rows/columns can change as items are - // inserted/deleted, we need to verify at runtime that the - // requested growable rows/columns are still valid. - if (m_growableCols[idx] >= ncols) - continue; - - // If all items in a row/column are hidden, that row/column will - // have a dimension of -1. This causes the column to be hidden - // completely. - if (m_colWidths[ m_growableCols[idx] ] == -1) - continue; - sum_proportions += m_growableColsProportions[idx]; - growable_space += m_colWidths[ m_growableCols[idx] ]; - num++; - } - - if (num > 0) - { - for (idx = 0; idx < m_growableCols.GetCount(); idx++) - { - if (m_growableCols[idx] >= ncols ) - continue; - if (m_colWidths[ m_growableCols[idx] ] != -1) - { - int delta = (sz.x - minsz.x); - if (sum_proportions == 0) - delta = (delta/num) + m_colWidths[ m_growableCols[idx] ]; - else - delta = ((delta+growable_space)*m_growableColsProportions[idx])/sum_proportions; - m_colWidths[ m_growableCols[idx] ] = delta; - } - } - } - } - else if ( (m_growMode == wxFLEX_GROWMODE_ALL) && (sz.x > minsz.x) ) - { - for ( int col=0; col < ncols; ++col ) - m_colWidths[ col ] = sz.x / ncols; - } -} - - -void wxFlexGridSizer::AddGrowableRow( size_t idx, int proportion ) -{ - m_growableRows.Add( idx ); - m_growableRowsProportions.Add( proportion ); -} - -void wxFlexGridSizer::AddGrowableCol( size_t idx, int proportion ) -{ - m_growableCols.Add( idx ); - m_growableColsProportions.Add( proportion ); -} - -// helper function for RemoveGrowableCol/Row() -static void -DoRemoveFromArrays(size_t idx, wxArrayInt& items, wxArrayInt& proportions) -{ - const size_t count = items.size(); - for ( size_t n = 0; n < count; n++ ) - { - if ( (size_t)items[n] == idx ) - { - items.RemoveAt(n); - proportions.RemoveAt(n); - return; - } - } - - wxFAIL_MSG( _T("column/row is already not growable") ); -} - -void wxFlexGridSizer::RemoveGrowableCol( size_t idx ) -{ - DoRemoveFromArrays(idx, m_growableCols, m_growableColsProportions); -} - -void wxFlexGridSizer::RemoveGrowableRow( size_t idx ) -{ - DoRemoveFromArrays(idx, m_growableRows, m_growableRowsProportions); -} - -//--------------------------------------------------------------------------- -// wxBoxSizer -//--------------------------------------------------------------------------- - -wxBoxSizer::wxBoxSizer( int orient ) - : m_orient( orient ) -{ -} - -void wxBoxSizer::RecalcSizes() -{ - if (m_children.GetCount() == 0) - return; - - int delta = 0; - if (m_stretchable) - { - if (m_orient == wxHORIZONTAL) - delta = m_size.x - m_fixedWidth; - else - delta = m_size.y - m_fixedHeight; - } - - wxPoint pt( m_position ); - - int stretchable = m_stretchable; - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->ShouldAccountFor()) - { - wxSize size( item->GetMinSizeWithBorder() ); - - if (m_orient == wxVERTICAL) - { - wxCoord height = size.y; - if (item->GetProportion()) - { - // Because of at least one visible item has non-zero - // proportion then m_stretchable is not zero - height = (delta * item->GetProportion()) / stretchable; - delta -= height; - stretchable -= item->GetProportion(); - } - - wxPoint child_pos( pt ); - wxSize child_size( size.x, height ); - - if (item->GetFlag() & (wxEXPAND | wxSHAPED)) - child_size.x = m_size.x; - else if (item->GetFlag() & wxALIGN_RIGHT) - child_pos.x += m_size.x - size.x; - else if (item->GetFlag() & (wxCENTER | wxALIGN_CENTER_HORIZONTAL)) - // XXX wxCENTER is added for backward compatibility; - // wxALIGN_CENTER should be used in new code - child_pos.x += (m_size.x - size.x) / 2; - - item->SetDimension( child_pos, child_size ); - - pt.y += height; - } - else - { - wxCoord width = size.x; - if (item->GetProportion()) - { - // Because of at least one visible item has non-zero - // proportion then m_stretchable is not zero - width = (delta * item->GetProportion()) / stretchable; - delta -= width; - stretchable -= item->GetProportion(); - } - - wxPoint child_pos( pt ); - wxSize child_size( width, size.y ); - - if (item->GetFlag() & (wxEXPAND | wxSHAPED)) - child_size.y = m_size.y; - else if (item->GetFlag() & wxALIGN_BOTTOM) - child_pos.y += m_size.y - size.y; - else if (item->GetFlag() & (wxCENTER | wxALIGN_CENTER_VERTICAL)) - // XXX wxCENTER is added for backward compatibility; - // wxALIGN_CENTER should be used in new code - child_pos.y += (m_size.y - size.y) / 2; - - if ( m_containingWindow ) - { - child_pos.x = m_containingWindow->AdjustForLayoutDirection - ( - child_pos.x, - width, - m_size.x - ); - } - - item->SetDimension( child_pos, child_size ); - - pt.x += width; - } - } - - node = node->GetNext(); - } -} - -wxSize wxBoxSizer::CalcMin() -{ - if (m_children.GetCount() == 0) - return wxSize(); - - m_stretchable = 0; - m_minWidth = 0; - m_minHeight = 0; - m_fixedWidth = 0; - m_fixedHeight = 0; - - // precalc item minsizes and count proportions - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if ( item->ShouldAccountFor() ) - { - item->CalcMin(); // result is stored in the item - - m_stretchable += item->GetProportion(); - } - - node = node->GetNext(); - } - - // Total minimum size (width or height) of sizer - int maxMinSize = 0; - - node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->ShouldAccountFor() && item->GetProportion() != 0) - { - int stretch = item->GetProportion(); - wxSize size( item->GetMinSizeWithBorder() ); - int minSize; - - // Integer division rounded up is (a + b - 1) / b - // Round up needed in order to guarantee that all - // all items will have size not less then their min size - if (m_orient == wxHORIZONTAL) - minSize = ( size.x*m_stretchable + stretch - 1)/stretch; - else - minSize = ( size.y*m_stretchable + stretch - 1)/stretch; - - if (minSize > maxMinSize) - maxMinSize = minSize; - } - node = node->GetNext(); - } - - // Calculate overall minimum size - node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - - if (item->ShouldAccountFor()) - { - wxSize size( item->GetMinSizeWithBorder() ); - if (item->GetProportion() != 0) - { - if (m_orient == wxHORIZONTAL) - size.x = (maxMinSize*item->GetProportion())/m_stretchable; - else - size.y = (maxMinSize*item->GetProportion())/m_stretchable; - } - else - { - if (m_orient == wxVERTICAL) - { - m_fixedHeight += size.y; - m_fixedWidth = wxMax( m_fixedWidth, size.x ); - } - else - { - m_fixedWidth += size.x; - m_fixedHeight = wxMax( m_fixedHeight, size.y ); - } - } - - if (m_orient == wxHORIZONTAL) - { - m_minWidth += size.x; - m_minHeight = wxMax( m_minHeight, size.y ); - } - else - { - m_minHeight += size.y; - m_minWidth = wxMax( m_minWidth, size.x ); - } - } - node = node->GetNext(); - } - - return wxSize( m_minWidth, m_minHeight ); -} - -//--------------------------------------------------------------------------- -// wxStaticBoxSizer -//--------------------------------------------------------------------------- - -#if wxUSE_STATBOX - -wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient ) - : wxBoxSizer( orient ), - m_staticBox( box ) -{ - wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") ); - - // do this so that our Detach() is called if the static box is destroyed - // before we are - m_staticBox->SetContainingSizer(this); -} - -wxStaticBoxSizer::wxStaticBoxSizer(int orient, wxWindow *win, const wxString& s) - : wxBoxSizer(orient), - m_staticBox(new wxStaticBox(win, wxID_ANY, s)) -{ - // same as above - m_staticBox->SetContainingSizer(this); -} - -wxStaticBoxSizer::~wxStaticBoxSizer() -{ - delete m_staticBox; -} - -static void GetStaticBoxBorders( wxStaticBox *box, - int *borderTop, - int *borderOther) -{ - // this has to be done platform by platform as there is no way to - // guess the thickness of a wxStaticBox border - box->GetBordersForSizer(borderTop, borderOther); -} - -void wxStaticBoxSizer::RecalcSizes() -{ - int top_border, other_border; - GetStaticBoxBorders(m_staticBox, &top_border, &other_border); - - m_staticBox->SetSize( m_position.x, m_position.y, m_size.x, m_size.y ); - - wxPoint old_pos( m_position ); - m_position.x += other_border; - m_position.y += top_border; - wxSize old_size( m_size ); - m_size.x -= 2*other_border; - m_size.y -= top_border + other_border; - - wxBoxSizer::RecalcSizes(); - - m_position = old_pos; - m_size = old_size; -} - -wxSize wxStaticBoxSizer::CalcMin() -{ - int top_border, other_border; - GetStaticBoxBorders(m_staticBox, &top_border, &other_border); - - wxSize ret( wxBoxSizer::CalcMin() ); - ret.x += 2*other_border; - ret.y += other_border + top_border; - - return ret; -} - -void wxStaticBoxSizer::ShowItems( bool show ) -{ - m_staticBox->Show( show ); - wxBoxSizer::ShowItems( show ); -} - -bool wxStaticBoxSizer::Detach( wxWindow *window ) -{ - // avoid deleting m_staticBox in our dtor if it's being detached from the - // sizer (which can happen because it's being already destroyed for - // example) - if ( window == m_staticBox ) - { - m_staticBox = NULL; - return true; - } - - return wxSizer::Detach( window ); -} - -#endif // wxUSE_STATBOX - -#if wxUSE_BUTTON - -wxStdDialogButtonSizer::wxStdDialogButtonSizer() - : wxBoxSizer(wxHORIZONTAL) -{ - // Vertical buttons with lots of space on either side - // looks rubbish on WinCE, so let's not do this for now. - // If we are going to use vertical buttons, we should - // put the sizer to the right of other controls in the dialog, - // and that's beyond the scope of this sizer. -#ifndef __WXWINCE__ - bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - // If we have a PDA screen, put yes/no button over - // all other buttons, otherwise on the left side. - if (is_pda) - m_orient = wxVERTICAL; -#endif - - m_buttonAffirmative = NULL; - m_buttonApply = NULL; - m_buttonNegative = NULL; - m_buttonCancel = NULL; - m_buttonHelp = NULL; -} - -void wxStdDialogButtonSizer::AddButton(wxButton *mybutton) -{ - switch (mybutton->GetId()) - { - case wxID_OK: - case wxID_YES: - case wxID_SAVE: - m_buttonAffirmative = mybutton; - break; - case wxID_APPLY: - m_buttonApply = mybutton; - break; - case wxID_NO: - m_buttonNegative = mybutton; - break; - case wxID_CANCEL: - m_buttonCancel = mybutton; - break; - case wxID_HELP: - case wxID_CONTEXT_HELP: - m_buttonHelp = mybutton; - break; - default: - break; - } -} - -void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton *button ) -{ - m_buttonAffirmative = button; -} - -void wxStdDialogButtonSizer::SetNegativeButton( wxButton *button ) -{ - m_buttonNegative = button; -} - -void wxStdDialogButtonSizer::SetCancelButton( wxButton *button ) -{ - m_buttonCancel = button; -} - -void wxStdDialogButtonSizer::Realize() -{ -#ifdef __WXMAC__ - Add(0, 0, 0, wxLEFT, 6); - if (m_buttonHelp) - Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 6); - - if (m_buttonNegative){ - // HIG POLICE BULLETIN - destructive buttons need extra padding - // 24 pixels on either side - Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 12); - } - - // extra whitespace between help/negative and cancel/ok buttons - Add(0, 0, 1, wxEXPAND, 0); - - if (m_buttonCancel){ - Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 6); - // Cancel or help should be default - // m_buttonCancel->SetDefaultButton(); - } - - // Ugh, Mac doesn't really have apply dialogs, so I'll just - // figure the best place is between Cancel and OK - if (m_buttonApply) - Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 6); - - if (m_buttonAffirmative){ - Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6); - - if (m_buttonAffirmative->GetId() == wxID_SAVE){ - // these buttons have set labels under Mac so we should use them - m_buttonAffirmative->SetLabel(_("Save")); - if (m_buttonNegative) - m_buttonNegative->SetLabel(_("Don't Save")); - } - } - - // Extra space around and at the right - Add(12, 24); -#elif defined(__WXGTK20__) - Add(0, 0, 0, wxLEFT, 9); - if (m_buttonHelp) - Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3); - - // extra whitespace between help and cancel/ok buttons - Add(0, 0, 1, wxEXPAND, 0); - - if (m_buttonNegative){ - Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3); - } - - if (m_buttonCancel){ - Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3); - // Cancel or help should be default - // m_buttonCancel->SetDefaultButton(); - } - - if (m_buttonApply) - Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3); - - if (m_buttonAffirmative) - Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6); -#elif defined(__WXMSW__) - // Windows - - // right-justify buttons - Add(0, 0, 1, wxEXPAND, 0); - - if (m_buttonAffirmative){ - Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonAffirmative->ConvertDialogToPixels(wxSize(2, 0)).x); - } - - if (m_buttonNegative){ - Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonNegative->ConvertDialogToPixels(wxSize(2, 0)).x); - } - - if (m_buttonCancel){ - Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonCancel->ConvertDialogToPixels(wxSize(2, 0)).x); - } - if (m_buttonApply) - Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonApply->ConvertDialogToPixels(wxSize(2, 0)).x); - - if (m_buttonHelp) - Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonHelp->ConvertDialogToPixels(wxSize(2, 0)).x); -#else - // GTK+1 and any other platform - - // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog - if (m_buttonHelp) - Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonHelp->ConvertDialogToPixels(wxSize(4, 0)).x); - - // extra whitespace between help and cancel/ok buttons - Add(0, 0, 1, wxEXPAND, 0); - - if (m_buttonApply) - Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonApply->ConvertDialogToPixels(wxSize(4, 0)).x); - - if (m_buttonAffirmative){ - Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonAffirmative->ConvertDialogToPixels(wxSize(4, 0)).x); - } - - if (m_buttonNegative){ - Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonNegative->ConvertDialogToPixels(wxSize(4, 0)).x); - } - - if (m_buttonCancel){ - Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonCancel->ConvertDialogToPixels(wxSize(4, 0)).x); - // Cancel or help should be default - // m_buttonCancel->SetDefaultButton(); - } - -#endif -} - -#endif // wxUSE_BUTTON - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// wxNotebookSizer -// ---------------------------------------------------------------------------- - -#if wxUSE_BOOKCTRL -IMPLEMENT_CLASS(wxBookCtrlSizer, wxSizer) -#if wxUSE_NOTEBOOK -IMPLEMENT_CLASS(wxNotebookSizer, wxBookCtrlSizer) -#endif // wxUSE_NOTEBOOK -#endif // wxUSE_BOOKCTRL - -#if wxUSE_BOOKCTRL - -#if WXWIN_COMPATIBILITY_2_6 - -wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase *bookctrl) - : m_bookctrl(bookctrl) -{ - wxASSERT_MSG( bookctrl, wxT("wxBookCtrlSizer needs a control") ); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - -void wxBookCtrlSizer::RecalcSizes() -{ - m_bookctrl->SetSize( m_position.x, m_position.y, m_size.x, m_size.y ); -} - -wxSize wxBookCtrlSizer::CalcMin() -{ - wxSize sizeBorder = m_bookctrl->CalcSizeFromPage(wxSize(0,0)); - - sizeBorder.x += 5; - sizeBorder.y += 5; - - if ( m_bookctrl->GetPageCount() == 0 ) - { - return wxSize(sizeBorder.x + 10, sizeBorder.y + 10); - } - - int maxX = 0; - int maxY = 0; - - wxWindowList::compatibility_iterator - node = m_bookctrl->GetChildren().GetFirst(); - while (node) - { - wxWindow *item = node->GetData(); - wxSizer *itemsizer = item->GetSizer(); - - if (itemsizer) - { - wxSize subsize( itemsizer->CalcMin() ); - - if (subsize.x > maxX) - maxX = subsize.x; - if (subsize.y > maxY) - maxY = subsize.y; - } - - node = node->GetNext(); - } - - return wxSize( maxX, maxY ) + sizeBorder; -} - -#if wxUSE_NOTEBOOK - -#if WXWIN_COMPATIBILITY_2_6 - -wxNotebookSizer::wxNotebookSizer(wxNotebook *nb) -{ - wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a control") ); - m_bookctrl = nb; -} - -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // wxUSE_NOTEBOOOK -#endif // wxUSE_BOOKCTRL - -#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/Source/3rdParty/wx/src/common/srchcmn.cpp b/Source/3rdParty/wx/src/common/srchcmn.cpp deleted file mode 100644 index 093577f5c..000000000 --- a/Source/3rdParty/wx/src/common/srchcmn.cpp +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/srchcmn.cpp -// Purpose: common (to all ports) bits of wxSearchCtrl -// Author: Robin Dunn -// Modified by: -// Created: 19-Dec-2006 -// RCS-ID: $Id: srchcmn.cpp 43939 2006-12-11 20:32:16Z KO $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_SEARCHCTRL - -#include "wx/srchctrl.h" - -#ifndef WX_PRECOMP -#endif - -// ---------------------------------------------------------------------------- - -const wxChar wxSearchCtrlNameStr[] = wxT("searchCtrl"); - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN) - - -#endif // wxUSE_SEARCHCTRL diff --git a/Source/3rdParty/wx/src/common/sstream.cpp b/Source/3rdParty/wx/src/common/sstream.cpp deleted file mode 100644 index 3d792b174..000000000 --- a/Source/3rdParty/wx/src/common/sstream.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/sstream.cpp -// Purpose: string-based streams implementation -// Author: Vadim Zeitlin -// Modified by: Ryan Norton (UTF8 UNICODE) -// Created: 2004-09-19 -// RCS-ID: $Id: sstream.cpp 45772 2007-05-03 02:19:16Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/sstream.h" - -#if wxUSE_UNICODE - #include "wx/hashmap.h" -#endif - -// ============================================================================ -// wxStringInputStream implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// construction/destruction -// ---------------------------------------------------------------------------- - -// TODO: Do we want to include the null char in the stream? If so then -// just add +1 to m_len in the ctor -wxStringInputStream::wxStringInputStream(const wxString& s) -#if wxUSE_UNICODE - : m_str(s), m_buf(wxMBConvUTF8().cWX2MB(s).release()), m_len(strlen(m_buf)) -#else - : m_str(s), m_buf((char*)s.c_str()), m_len(s.length()) -#endif -{ -#if wxUSE_UNICODE - wxASSERT_MSG(m_buf != NULL, _T("Could not convert string to UTF8!")); -#endif - m_pos = 0; -} - -wxStringInputStream::~wxStringInputStream() -{ -#if wxUSE_UNICODE - // Note: wx[W]CharBuffer uses malloc()/free() - free(m_buf); -#endif -} - -// ---------------------------------------------------------------------------- -// getlength -// ---------------------------------------------------------------------------- - -wxFileOffset wxStringInputStream::GetLength() const -{ - return m_len; -} - -// ---------------------------------------------------------------------------- -// seek/tell -// ---------------------------------------------------------------------------- - -wxFileOffset wxStringInputStream::OnSysSeek(wxFileOffset ofs, wxSeekMode mode) -{ - switch ( mode ) - { - case wxFromStart: - // nothing to do, ofs already ok - break; - - case wxFromEnd: - ofs += m_len; - break; - - case wxFromCurrent: - ofs += m_pos; - break; - - default: - wxFAIL_MSG( _T("invalid seek mode") ); - return wxInvalidOffset; - } - - if ( ofs < 0 || ofs > wx_static_cast(wxFileOffset, m_len) ) - return wxInvalidOffset; - - // FIXME: this can't be right - m_pos = wx_truncate_cast(size_t, ofs); - - return ofs; -} - -wxFileOffset wxStringInputStream::OnSysTell() const -{ - return wx_static_cast(wxFileOffset, m_pos); -} - -// ---------------------------------------------------------------------------- -// actual IO -// ---------------------------------------------------------------------------- - -size_t wxStringInputStream::OnSysRead(void *buffer, size_t size) -{ - const size_t sizeMax = m_len - m_pos; - - if ( size >= sizeMax ) - { - if ( sizeMax == 0 ) - { - m_lasterror = wxSTREAM_EOF; - return 0; - } - - size = sizeMax; - } - - memcpy(buffer, m_buf + m_pos, size); - m_pos += size; - - return size; -} - -// ============================================================================ -// wxStringOutputStream implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// seek/tell -// ---------------------------------------------------------------------------- - -wxFileOffset wxStringOutputStream::OnSysTell() const -{ - return wx_static_cast(wxFileOffset, m_pos); -} - -// ---------------------------------------------------------------------------- -// actual IO -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE - -// we can't add a member to wxStringOutputStream in 2.8 branch without breaking -// backwards binary compatibility, so we emulate it by using a hash indexed by -// wxStringOutputStream pointers - -// can't use wxCharBuffer as it has incorrect copying semantics and doesn't -// store the length which we need here -WX_DECLARE_VOIDPTR_HASH_MAP(wxMemoryBuffer, wxStringStreamUnconvBuffers); - -static wxStringStreamUnconvBuffers gs_unconverted; - -wxStringOutputStream::~wxStringOutputStream() -{ - // TODO: check that nothing remains (i.e. the unconverted buffer is empty)? - gs_unconverted.erase(this); -} - -#endif // wxUSE_UNICODE - -size_t wxStringOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - const char *p = wx_static_cast(const char *, buffer); - -#if wxUSE_UNICODE - // the part of the string we have here may be incomplete, i.e. it can stop - // in the middle of an UTF-8 character and so converting it would fail; if - // this is the case, accumulate the part which we failed to convert until - // we get the rest (and also take into account the part which we might have - // left unconverted before) - const char *src; - size_t srcLen; - wxMemoryBuffer& unconv = gs_unconverted[this]; - if ( unconv.GetDataLen() ) - { - // append the new data to the data remaining since the last time - unconv.AppendData(p, size); - src = unconv; - srcLen = unconv.GetDataLen(); - } - else // no unconverted data left, avoid extra copy - { - src = p; - srcLen = size; - } - - wxWCharBuffer wbuf(m_conv.cMB2WC(src, srcLen, NULL /* out len */)); - if ( wbuf ) - { - // conversion succeeded, clear the unconverted buffer - unconv = wxMemoryBuffer(0); - - *m_str += wbuf; - } - else // conversion failed - { - // remember unconverted data if there had been none before (otherwise - // we've already got it in the buffer) - if ( src == p ) - unconv.AppendData(src, srcLen); - - // pretend that we wrote the data anyhow, otherwise the caller would - // believe there was an error and this might not be the case, but do - // not update m_pos as m_str hasn't changed - return size; - } -#else // !wxUSE_UNICODE - // append directly, no conversion necessary - m_str->Append(wxString(p, size)); -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - - // update position - m_pos += size; - - // return number of bytes actually written - return size; -} - -#endif // wxUSE_STREAMS - diff --git a/Source/3rdParty/wx/src/common/statbar.cpp b/Source/3rdParty/wx/src/common/statbar.cpp deleted file mode 100644 index 82de44f33..000000000 --- a/Source/3rdParty/wx/src/common/statbar.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/statbar.cpp -// Purpose: wxStatusBarBase implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.10.01 -// RCS-ID: $Id: statbar.cpp 42171 2006-10-20 14:54:14Z VS $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STATUSBAR - -#include "wx/statusbr.h" - -#ifndef WX_PRECOMP - #include "wx/frame.h" -#endif //WX_PRECOMP - -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxListString) - -const wxChar wxStatusBarNameStr[] = wxT("statusBar"); - -// ============================================================================ -// wxStatusBarBase implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) - -// ---------------------------------------------------------------------------- -// ctor/dtor -// ---------------------------------------------------------------------------- - -wxStatusBarBase::wxStatusBarBase() -{ - m_nFields = 0; - - InitWidths(); - InitStacks(); - InitStyles(); -} - -wxStatusBarBase::~wxStatusBarBase() -{ - FreeWidths(); - FreeStacks(); - FreeStyles(); - - // notify the frame that it doesn't have a status bar any longer to avoid - // dangling pointers - wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if ( frame && frame->GetStatusBar() == this ) - { - frame->SetStatusBar(NULL); - } -} - -// ---------------------------------------------------------------------------- -// widths array handling -// ---------------------------------------------------------------------------- - -void wxStatusBarBase::InitWidths() -{ - m_statusWidths = NULL; -} - -void wxStatusBarBase::FreeWidths() -{ - delete [] m_statusWidths; -} - -// ---------------------------------------------------------------------------- -// styles array handling -// ---------------------------------------------------------------------------- - -void wxStatusBarBase::InitStyles() -{ - m_statusStyles = NULL; -} - -void wxStatusBarBase::FreeStyles() -{ - delete [] m_statusStyles; -} - -// ---------------------------------------------------------------------------- -// field widths -// ---------------------------------------------------------------------------- - -void wxStatusBarBase::SetFieldsCount(int number, const int *widths) -{ - wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") ); - - bool refresh = false; - - if ( number != m_nFields ) - { - // copy stacks if present - if(m_statusTextStacks) - { - wxListString **newStacks = new wxListString*[number]; - size_t i, j, max = wxMin(number, m_nFields); - - // copy old stacks - for(i = 0; i < max; ++i) - newStacks[i] = m_statusTextStacks[i]; - // free old stacks in excess - for(j = i; j < (size_t)m_nFields; ++j) - { - if(m_statusTextStacks[j]) - { - m_statusTextStacks[j]->Clear(); - delete m_statusTextStacks[j]; - } - } - // initialize new stacks to NULL - for(j = i; j < (size_t)number; ++j) - newStacks[j] = 0; - - m_statusTextStacks = newStacks; - } - - // Resize styles array - if (m_statusStyles) - { - int *oldStyles = m_statusStyles; - m_statusStyles = new int[number]; - int i, max = wxMin(number, m_nFields); - - // copy old styles - for (i = 0; i < max; ++i) - m_statusStyles[i] = oldStyles[i]; - - // initialize new styles to wxSB_NORMAL - for (i = max; i < number; ++i) - m_statusStyles[i] = wxSB_NORMAL; - - // free old styles - delete [] oldStyles; - } - - - m_nFields = number; - - ReinitWidths(); - - refresh = true; - } - //else: keep the old m_statusWidths if we had them - - if ( widths ) - { - SetStatusWidths(number, widths); - - // already done from SetStatusWidths() - refresh = false; - } - - if ( refresh ) - Refresh(); -} - -void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n), - const int widths[]) -{ - wxCHECK_RET( widths, _T("NULL pointer in SetStatusWidths") ); - - wxASSERT_MSG( n == m_nFields, _T("field number mismatch") ); - - if ( !m_statusWidths ) - m_statusWidths = new int[m_nFields]; - - for ( int i = 0; i < m_nFields; i++ ) - { - m_statusWidths[i] = widths[i]; - } - - // update the display after the widths changed - Refresh(); -} - -void wxStatusBarBase::SetStatusStyles(int WXUNUSED_UNLESS_DEBUG(n), - const int styles[]) -{ - wxCHECK_RET( styles, _T("NULL pointer in SetStatusStyles") ); - - wxASSERT_MSG( n == m_nFields, _T("field number mismatch") ); - - if ( !m_statusStyles ) - m_statusStyles = new int[m_nFields]; - - for ( int i = 0; i < m_nFields; i++ ) - { - m_statusStyles[i] = styles[i]; - } - - // update the display after the widths changed - Refresh(); -} - -wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const -{ - wxArrayInt widths; - - if ( m_statusWidths == NULL ) - { - if ( m_nFields ) - { - // Default: all fields have the same width. This is not always - // possible to do exactly (if widthTotal is not divisible by - // m_nFields) - if that happens, we distribute the extra pixels - // among all fields: - int widthToUse = widthTotal; - - for ( int i = m_nFields; i > 0; i-- ) - { - // divide the unassigned width evently between the - // not yet processed fields: - int w = widthToUse / i; - widths.Add(w); - widthToUse -= w; - } - - } - //else: we're empty anyhow - } - else // have explicit status widths - { - // calculate the total width of all the fixed width fields and the - // total number of var field widths counting with multiplicity - int nTotalWidth = 0, - nVarCount = 0, - i; - for ( i = 0; i < m_nFields; i++ ) - { - if ( m_statusWidths[i] >= 0 ) - { - nTotalWidth += m_statusWidths[i]; - } - else - { - nVarCount += -m_statusWidths[i]; - } - } - - // the amount of extra width we have per each var width field - int widthExtra = widthTotal - nTotalWidth; - - // do fill the array - for ( i = 0; i < m_nFields; i++ ) - { - if ( m_statusWidths[i] >= 0 ) - { - widths.Add(m_statusWidths[i]); - } - else - { - int nVarWidth = widthExtra > 0 ? (widthExtra * -m_statusWidths[i]) / nVarCount : 0; - nVarCount += m_statusWidths[i]; - widthExtra -= nVarWidth; - widths.Add(nVarWidth); - } - } - } - - return widths; -} - -// ---------------------------------------------------------------------------- -// text stacks handling -// ---------------------------------------------------------------------------- - -void wxStatusBarBase::InitStacks() -{ - m_statusTextStacks = NULL; -} - -void wxStatusBarBase::FreeStacks() -{ - if ( !m_statusTextStacks ) - return; - - for ( size_t i = 0; i < (size_t)m_nFields; ++i ) - { - if ( m_statusTextStacks[i] ) - { - wxListString& t = *m_statusTextStacks[i]; - WX_CLEAR_LIST(wxListString, t); - delete m_statusTextStacks[i]; - } - } - - delete[] m_statusTextStacks; -} - -// ---------------------------------------------------------------------------- -// text stacks -// ---------------------------------------------------------------------------- - -void wxStatusBarBase::PushStatusText(const wxString& text, int number) -{ - wxListString* st = GetOrCreateStatusStack(number); - // This long-winded way around avoids an internal compiler error - // in VC++ 6 with RTTI enabled - wxString tmp1(GetStatusText(number)); - wxString* tmp = new wxString(tmp1); - st->Insert(tmp); - SetStatusText(text, number); -} - -void wxStatusBarBase::PopStatusText(int number) -{ - wxListString *st = GetStatusStack(number); - wxCHECK_RET( st, _T("Unbalanced PushStatusText/PopStatusText") ); - wxListString::compatibility_iterator top = st->GetFirst(); - - SetStatusText(*top->GetData(), number); - delete top->GetData(); - st->Erase(top); - if(st->GetCount() == 0) - { - delete st; - m_statusTextStacks[number] = 0; - } -} - -wxListString *wxStatusBarBase::GetStatusStack(int i) const -{ - if(!m_statusTextStacks) - return 0; - return m_statusTextStacks[i]; -} - -wxListString *wxStatusBarBase::GetOrCreateStatusStack(int i) -{ - if(!m_statusTextStacks) - { - m_statusTextStacks = new wxListString*[m_nFields]; - - size_t j; - for(j = 0; j < (size_t)m_nFields; ++j) m_statusTextStacks[j] = 0; - } - - if(!m_statusTextStacks[i]) - { - m_statusTextStacks[i] = new wxListString(); - } - - return m_statusTextStacks[i]; -} - -#endif // wxUSE_STATUSBAR diff --git a/Source/3rdParty/wx/src/common/stdpbase.cpp b/Source/3rdParty/wx/src/common/stdpbase.cpp deleted file mode 100644 index f2d4ff6b0..000000000 --- a/Source/3rdParty/wx/src/common/stdpbase.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: common/stdpbase.cpp -// Purpose: wxStandardPathsBase methods common to all ports -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: stdpbase.cpp 53093 2008-04-08 13:51:17Z JS $ -// Copyright: (c) 2004 Vadim Zeitlin -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STDPATHS - -#ifndef WX_PRECOMP - #include "wx/app.h" -#endif //WX_PRECOMP -#include "wx/apptrait.h" - -#include "wx/filename.h" -#include "wx/stdpaths.h" - -#if defined(__UNIX__) && !defined(__WXMAC__) -#include "wx/log.h" -#include "wx/textfile.h" -#endif - -// ---------------------------------------------------------------------------- -// module globals -// ---------------------------------------------------------------------------- - -static wxStandardPaths gs_stdPaths; - -// ============================================================================ -// implementation -// ============================================================================ - -/* static */ -wxStandardPathsBase& wxStandardPathsBase::Get() -{ - wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - wxCHECK_MSG( traits, gs_stdPaths, _T("create wxApp before calling this") ); - - return traits->GetStandardPaths(); -} - -wxString wxStandardPathsBase::GetExecutablePath() const -{ - if ( !wxTheApp || !wxTheApp->argv ) - return wxEmptyString; - - wxString argv0 = wxTheApp->argv[0]; - if (wxIsAbsolutePath(argv0)) - return argv0; - - // Search PATH.environment variable... - wxPathList pathlist; - pathlist.AddEnvList(wxT("PATH")); - wxString path = pathlist.FindAbsoluteValidPath(argv0); - if ( path.empty() ) - return argv0; // better than nothing - - wxFileName filename(path); - filename.Normalize(); - return filename.GetFullPath(); -} - -wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths() -{ - return gs_stdPaths; -} - -wxStandardPathsBase::~wxStandardPathsBase() -{ - // nothing to do here -} - -wxString wxStandardPathsBase::GetLocalDataDir() const -{ - return GetDataDir(); -} - -wxString wxStandardPathsBase::GetUserLocalDataDir() const -{ - return GetUserDataDir(); -} - -wxString wxStandardPathsBase::GetDocumentsDir() const -{ -#if defined(__UNIX__) && !defined(__WXMAC__) - { - wxLogNull logNull; - wxString homeDir = wxFileName::GetHomeDir(); - wxString configPath; - if (wxGetenv(wxT("XDG_CONFIG_HOME"))) - configPath = wxGetenv(wxT("XDG_CONFIG_HOME")); - else - configPath = homeDir + wxT("/.config"); - wxString dirsFile = configPath + wxT("/user-dirs.dirs"); - if (wxFileExists(dirsFile)) - { - wxTextFile textFile; - if (textFile.Open(dirsFile)) - { - size_t i; - for (i = 0; i < textFile.GetLineCount(); i++) - { - wxString line(textFile[i]); - int pos = line.Find(wxT("XDG_DOCUMENTS_DIR")); - if (pos != wxNOT_FOUND) - { - wxString value = line.AfterFirst(wxT('=')); - value.Replace(wxT("$HOME"), homeDir); - value.Trim(true); - value.Trim(false); - if (!value.IsEmpty() && wxDirExists(value)) - return value; - else - break; - } - } - } - } - } -#endif - - return wxFileName::GetHomeDir(); -} - -// return the temporary directory for the current user -wxString wxStandardPathsBase::GetTempDir() const -{ - return wxFileName::GetTempDir(); -} - -/* static */ -wxString wxStandardPathsBase::AppendAppName(const wxString& dir) -{ - wxString subdir(dir); - - // empty string indicates that an error has occurred, don't touch it then - if ( !subdir.empty() ) - { - const wxString appname = wxTheApp->GetAppName(); - if ( !appname.empty() ) - { - const wxChar ch = *(subdir.end() - 1); - if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') ) - subdir += wxFileName::GetPathSeparator(); - - subdir += appname; - } - } - - return subdir; -} - -#endif // wxUSE_STDPATHS diff --git a/Source/3rdParty/wx/src/common/stockitem.cpp b/Source/3rdParty/wx/src/common/stockitem.cpp deleted file mode 100644 index 8c1cd480b..000000000 --- a/Source/3rdParty/wx/src/common/stockitem.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/stockitem.cpp -// Purpose: Stock buttons, menu and toolbar items labels -// Author: Vaclav Slavik -// Modified by: -// Created: 2004-08-15 -// RCS-ID: $Id: stockitem.cpp 58617 2009-02-02 05:12:43Z SC $ -// Copyright: (c) Vaclav Slavik, 2004 -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/stockitem.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/utils.h" // for wxStripMenuCodes() -#endif - -bool wxIsStockID(wxWindowID id) -{ - switch (id) - { - case wxID_ABOUT: - case wxID_ADD: - case wxID_APPLY: - case wxID_BOLD: - case wxID_CANCEL: - case wxID_CLEAR: - case wxID_CLOSE: - case wxID_COPY: - case wxID_CUT: - case wxID_DELETE: - case wxID_EDIT: - case wxID_FIND: - case wxID_FILE: - case wxID_REPLACE: - case wxID_BACKWARD: - case wxID_DOWN: - case wxID_FORWARD: - case wxID_UP: - case wxID_HELP: - case wxID_HOME: - case wxID_INDENT: - case wxID_INDEX: - case wxID_ITALIC: - case wxID_JUSTIFY_CENTER: - case wxID_JUSTIFY_FILL: - case wxID_JUSTIFY_LEFT: - case wxID_JUSTIFY_RIGHT: - case wxID_NEW: - case wxID_NO: - case wxID_OK: - case wxID_OPEN: - case wxID_PASTE: - case wxID_PREFERENCES: - case wxID_PRINT: - case wxID_PREVIEW: - case wxID_PROPERTIES: - case wxID_EXIT: - case wxID_REDO: - case wxID_REFRESH: - case wxID_REMOVE: - case wxID_REVERT_TO_SAVED: - case wxID_SAVE: - case wxID_SAVEAS: - case wxID_SELECTALL: - case wxID_STOP: - case wxID_UNDELETE: - case wxID_UNDERLINE: - case wxID_UNDO: - case wxID_UNINDENT: - case wxID_YES: - case wxID_ZOOM_100: - case wxID_ZOOM_FIT: - case wxID_ZOOM_IN: - case wxID_ZOOM_OUT: - return true; - - default: - return false; - } -} - -wxString wxGetStockLabel(wxWindowID id, long flags) -{ - wxString stockLabel; - - #define STOCKITEM(stockid, label) \ - case stockid: \ - stockLabel = label; \ - break; - - switch (id) - { - STOCKITEM(wxID_ABOUT, _("&About")) - STOCKITEM(wxID_ADD, _("Add")) - STOCKITEM(wxID_APPLY, _("&Apply")) - STOCKITEM(wxID_BOLD, _("&Bold")) - STOCKITEM(wxID_CANCEL, _("&Cancel")) - STOCKITEM(wxID_CLEAR, _("&Clear")) - STOCKITEM(wxID_CLOSE, _("&Close")) - STOCKITEM(wxID_COPY, _("&Copy")) - STOCKITEM(wxID_CUT, _("Cu&t")) - STOCKITEM(wxID_DELETE, _("&Delete")) - STOCKITEM(wxID_EDIT, _("&Edit")) - STOCKITEM(wxID_FIND, _("&Find")) - STOCKITEM(wxID_FILE, _("&File")) - STOCKITEM(wxID_REPLACE, _("Rep&lace")) - STOCKITEM(wxID_BACKWARD, _("&Back")) - STOCKITEM(wxID_DOWN, _("&Down")) - STOCKITEM(wxID_FORWARD, _("&Forward")) - STOCKITEM(wxID_UP, _("&Up")) - STOCKITEM(wxID_HELP, _("&Help")) - STOCKITEM(wxID_HOME, _("&Home")) - STOCKITEM(wxID_INDENT, _("Indent")) - STOCKITEM(wxID_INDEX, _("&Index")) - STOCKITEM(wxID_ITALIC, _("&Italic")) - STOCKITEM(wxID_JUSTIFY_CENTER, _("Centered")) - STOCKITEM(wxID_JUSTIFY_FILL, _("Justified")) - STOCKITEM(wxID_JUSTIFY_LEFT, _("Align Left")) - STOCKITEM(wxID_JUSTIFY_RIGHT, _("Align Right")) - STOCKITEM(wxID_NEW, _("&New")) - STOCKITEM(wxID_NO, _("&No")) - STOCKITEM(wxID_OK, _("&OK")) - STOCKITEM(wxID_OPEN, _("&Open")) - STOCKITEM(wxID_PASTE, _("&Paste")) - STOCKITEM(wxID_PREFERENCES, _("&Preferences")) - STOCKITEM(wxID_PRINT, _("&Print")) - STOCKITEM(wxID_PREVIEW, _("Print previe&w")) - STOCKITEM(wxID_PROPERTIES, _("&Properties")) - STOCKITEM(wxID_EXIT, _("&Quit")) - STOCKITEM(wxID_REDO, _("&Redo")) - STOCKITEM(wxID_REFRESH, _("Refresh")) - STOCKITEM(wxID_REMOVE, _("Remove")) - STOCKITEM(wxID_REVERT_TO_SAVED, _("Revert to Saved")) - STOCKITEM(wxID_SAVE, _("&Save")) - STOCKITEM(wxID_SAVEAS, _("Save &As...")) - STOCKITEM(wxID_SELECTALL, _("Select all")) - STOCKITEM(wxID_STOP, _("&Stop")) - STOCKITEM(wxID_UNDELETE, _("Undelete")) - STOCKITEM(wxID_UNDERLINE, _("&Underline")) - STOCKITEM(wxID_UNDO, _("&Undo")) - STOCKITEM(wxID_UNINDENT, _("&Unindent")) - STOCKITEM(wxID_YES, _("&Yes")) - STOCKITEM(wxID_ZOOM_100, _("&Actual Size")) - STOCKITEM(wxID_ZOOM_FIT, _("Zoom to &Fit")) - STOCKITEM(wxID_ZOOM_IN, _("Zoom &In")) - STOCKITEM(wxID_ZOOM_OUT, _("Zoom &Out")) - - default: - wxFAIL_MSG( _T("invalid stock item ID") ); - break; - }; - - #undef STOCKITEM - - if ( !(flags & wxSTOCK_WITH_MNEMONIC) ) - { - stockLabel = wxStripMenuCodes(stockLabel); - } - -#if wxUSE_ACCEL - if ( !stockLabel.empty() && (flags & wxSTOCK_WITH_ACCELERATOR) ) - { - wxAcceleratorEntry accel = wxGetStockAccelerator(id); - if (accel.IsOk()) - stockLabel << _T('\t') << accel.ToString(); - } -#endif // wxUSE_ACCEL - - return stockLabel; -} - -wxString wxGetStockHelpString(wxWindowID id, wxStockHelpStringClient client) -{ - wxString stockHelp; - - #define STOCKITEM(stockid, ctx, helpstr) \ - case stockid: \ - if (client==ctx) stockHelp = helpstr; \ - break; - - switch (id) - { - // NB: these help string should be not too specific as they could be used - // in completely different programs! - STOCKITEM(wxID_ABOUT, wxSTOCK_MENU, _("Show about dialog")) - STOCKITEM(wxID_COPY, wxSTOCK_MENU, _("Copy selection")) - STOCKITEM(wxID_CUT, wxSTOCK_MENU, _("Cut selection")) - STOCKITEM(wxID_DELETE, wxSTOCK_MENU, _("Delete selection")) - STOCKITEM(wxID_REPLACE, wxSTOCK_MENU, _("Replace selection")) - STOCKITEM(wxID_PASTE, wxSTOCK_MENU, _("Paste selection")) - STOCKITEM(wxID_EXIT, wxSTOCK_MENU, _("Quit this program")) - STOCKITEM(wxID_REDO, wxSTOCK_MENU, _("Redo last action")) - STOCKITEM(wxID_UNDO, wxSTOCK_MENU, _("Undo last action")) - STOCKITEM(wxID_CLOSE, wxSTOCK_MENU, _("Close current document")) - STOCKITEM(wxID_SAVE, wxSTOCK_MENU, _("Save current document")) - STOCKITEM(wxID_SAVEAS, wxSTOCK_MENU, _("Save current document with a different filename")) - - default: - // there's no stock help string for this ID / client - return wxEmptyString; - } - - #undef STOCKITEM - - return stockHelp; -} - -#if wxUSE_ACCEL - -wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id) -{ - wxAcceleratorEntry ret; - - #define STOCKITEM(stockid, flags, keycode) \ - case stockid: \ - ret.Set(flags, keycode, stockid); \ - break; - - switch (id) - { - STOCKITEM(wxID_COPY, wxACCEL_CMD,'C') - STOCKITEM(wxID_CUT, wxACCEL_CMD,'X') - STOCKITEM(wxID_FIND, wxACCEL_CMD,'F') - STOCKITEM(wxID_REPLACE, wxACCEL_CMD,'R') - STOCKITEM(wxID_HELP, wxACCEL_CMD,'H') - STOCKITEM(wxID_NEW, wxACCEL_CMD,'N') - STOCKITEM(wxID_OPEN, wxACCEL_CMD,'O') - STOCKITEM(wxID_PASTE, wxACCEL_CMD,'V') - STOCKITEM(wxID_SAVE, wxACCEL_CMD,'S') - - default: - // set the wxAcceleratorEntry to return into an invalid state: - // there's no stock accelerator for that. - ret.Set(0, 0, id); - break; - }; - - #undef STOCKITEM - - // always use wxAcceleratorEntry::IsOk on returned value ! - return ret; -} - -#endif // wxUSE_ACCEL - -bool wxIsStockLabel(wxWindowID id, const wxString& label) -{ - if (label.empty()) - return true; - - wxString stock = wxGetStockLabel(id); - - if (label == stock) - return true; - - stock.Replace(_T("&"), wxEmptyString); - if (label == stock) - return true; - - return false; -} diff --git a/Source/3rdParty/wx/src/common/stopwatch.cpp b/Source/3rdParty/wx/src/common/stopwatch.cpp deleted file mode 100644 index eefbae7e9..000000000 --- a/Source/3rdParty/wx/src/common/stopwatch.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/stopwatch.cpp -// Purpose: wxStopWatch and other non-GUI stuff from wx/timer.h -// Author: -// Original version by Julian Smart -// Vadim Zeitlin got rid of all ifdefs (11.12.99) -// Sylvain Bougnoux added wxStopWatch class -// Guillermo Rodriguez rewrote from scratch (Dic/99) -// Modified by: -// Created: 20.06.2003 (extracted from common/timercmn.cpp) -// RCS-ID: $Id: stopwatch.cpp 41054 2006-09-07 19:01:45Z ABX $ -// Copyright: (c) 1998-2003 wxWidgets Team -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/stopwatch.h" - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/intl.h" - #include "wx/log.h" -#endif //WX_PRECOMP - -// ---------------------------------------------------------------------------- -// System headers -// ---------------------------------------------------------------------------- - -#if defined(__WIN32__) && !defined(HAVE_FTIME) && !defined(__MWERKS__) && !defined(__WXWINCE__) - #define HAVE_FTIME -#endif - -#if defined(__VISAGECPP__) && !defined(HAVE_FTIME) - #define HAVE_FTIME -# if __IBMCPP__ >= 400 - # define ftime(x) _ftime(x) -# endif -#endif - -#if defined(__MWERKS__) && defined(__WXMSW__) -# undef HAVE_FTIME -# undef HAVE_GETTIMEOFDAY -#endif - -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/private.h" -#include "wx/msw/wince/time.h" -#endif - -#if !defined(__WXMAC__) && !defined(__WXWINCE__) - #include // for time_t -#endif - -#if defined(HAVE_GETTIMEOFDAY) - #include - #include -#elif defined(HAVE_FTIME) - #include -#endif - -#ifdef __WXMAC__ -#ifndef __DARWIN__ - #include - #include -#else - #include -#endif -#endif - -#ifdef __WXPALMOS__ - #include - #include - #include -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// on some really old systems gettimeofday() doesn't have the second argument, -// define wxGetTimeOfDay() to hide this difference -#ifdef HAVE_GETTIMEOFDAY - #ifdef WX_GETTIMEOFDAY_NO_TZ - struct timezone; - #define wxGetTimeOfDay(tv, tz) gettimeofday(tv) - #else - #define wxGetTimeOfDay(tv, tz) gettimeofday((tv), (tz)) - #endif -#endif // HAVE_GETTIMEOFDAY - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStopWatch -// ---------------------------------------------------------------------------- - -#if wxUSE_STOPWATCH - -void wxStopWatch::Start(long t) -{ -#if 0 -// __WXMSW__ - LARGE_INTEGER frequency_li; - ::QueryPerformanceFrequency( &frequency_li ); - m_frequency = frequency_li.QuadPart; - if (m_frequency == 0) - { - m_t0 = wxGetLocalTimeMillis() - t; - } - else - { - LARGE_INTEGER counter_li; - ::QueryPerformanceCounter( &counter_li ); - wxLongLong counter = counter_li.QuadPart; - m_t0 = (counter * 10000 / m_frequency) - t*10; - } -#else - m_t0 = wxGetLocalTimeMillis() - t; -#endif - m_pause = 0; - m_pauseCount = 0; -} - -long wxStopWatch::GetElapsedTime() const -{ -#if 0 -//__WXMSW__ - if (m_frequency == 0) - { - return (wxGetLocalTimeMillis() - m_t0).GetLo(); - } - else - { - LARGE_INTEGER counter_li; - ::QueryPerformanceCounter( &counter_li ); - wxLongLong counter = counter_li.QuadPart; - wxLongLong res = (counter * 10000 / m_frequency) - m_t0; - return res.GetLo() / 10; - } -#else - return (wxGetLocalTimeMillis() - m_t0).GetLo(); -#endif -} - -long wxStopWatch::Time() const -{ - return m_pauseCount ? m_pause : GetElapsedTime(); -} - -#endif // wxUSE_STOPWATCH - -// ---------------------------------------------------------------------------- -// old timer functions superceded by wxStopWatch -// ---------------------------------------------------------------------------- - -#if wxUSE_LONGLONG - -static wxLongLong wxStartTime = 0l; - -// starts the global timer -void wxStartTimer() -{ - wxStartTime = wxGetLocalTimeMillis(); -} - -// Returns elapsed time in milliseconds -long wxGetElapsedTime(bool resetTimer) -{ - wxLongLong oldTime = wxStartTime; - wxLongLong newTime = wxGetLocalTimeMillis(); - - if ( resetTimer ) - wxStartTime = newTime; - - return (newTime - oldTime).GetLo(); -} - -#endif // wxUSE_LONGLONG - -// ---------------------------------------------------------------------------- -// the functions to get the current time and timezone info -// ---------------------------------------------------------------------------- - -// Get local time as seconds since 00:00:00, Jan 1st 1970 -long wxGetLocalTime() -{ - struct tm tm; - time_t t0, t1; - - // This cannot be made static because mktime can overwrite it. - // - memset(&tm, 0, sizeof(tm)); - tm.tm_year = 70; - tm.tm_mon = 0; - tm.tm_mday = 5; // not Jan 1st 1970 due to mktime 'feature' - tm.tm_hour = 0; - tm.tm_min = 0; - tm.tm_sec = 0; - tm.tm_isdst = -1; // let mktime guess - - // Note that mktime assumes that the struct tm contains local time. - // - t1 = time(&t1); // now - t0 = mktime(&tm); // origin - - // Return the difference in seconds. - // - if (( t0 != (time_t)-1 ) && ( t1 != (time_t)-1 )) - return (long)difftime(t1, t0) + (60 * 60 * 24 * 4); - - wxLogSysError(_("Failed to get the local system time")); - return -1; -} - -// Get UTC time as seconds since 00:00:00, Jan 1st 1970 -long wxGetUTCTime() -{ - return (long)time(NULL); -} - -#if wxUSE_LONGLONG - -// Get local time as milliseconds since 00:00:00, Jan 1st 1970 -wxLongLong wxGetLocalTimeMillis() -{ - wxLongLong val = 1000l; - - // If possible, use a function which avoids conversions from - // broken-up time structures to milliseconds - -#if defined(__WXPALMOS__) - DateTimeType thenst; - thenst.second = 0; - thenst.minute = 0; - thenst.hour = 0; - thenst.day = 1; - thenst.month = 1; - thenst.year = 1970; - thenst.weekDay = 5; - uint32_t now = TimGetSeconds(); - uint32_t then = TimDateTimeToSeconds (&thenst); - return SysTimeToMilliSecs(SysTimeInSecs(now - then)); -#elif defined(__WXMSW__) && (defined(__WINE__) || defined(__MWERKS__)) - // This should probably be the way all WXMSW compilers should do it - // Go direct to the OS for time - - SYSTEMTIME thenst = { 1970, 1, 4, 1, 0, 0, 0, 0 }; // 00:00:00 Jan 1st 1970 - FILETIME thenft; - SystemTimeToFileTime( &thenst, &thenft ); - wxLongLong then( thenft.dwHighDateTime, thenft.dwLowDateTime ); // time in 100 nanoseconds - - SYSTEMTIME nowst; - GetLocalTime( &nowst ); - FILETIME nowft; - SystemTimeToFileTime( &nowst, &nowft ); - wxLongLong now( nowft.dwHighDateTime, nowft.dwLowDateTime ); // time in 100 nanoseconds - - return ( now - then ) / 10000.0; // time from 00:00:00 Jan 1st 1970 to now in milliseconds - -#elif defined(HAVE_GETTIMEOFDAY) - struct timeval tp; - if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 ) - { - val *= tp.tv_sec; - return (val + (tp.tv_usec / 1000)); - } - else - { - wxLogError(_("wxGetTimeOfDay failed.")); - return 0; - } -#elif defined(HAVE_FTIME) - struct timeb tp; - - // ftime() is void and not int in some mingw32 headers, so don't - // test the return code (well, it shouldn't fail anyhow...) - (void)::ftime(&tp); - val *= tp.time; - return (val + tp.millitm); -#elif defined(__WXMAC__) - - static UInt64 gMilliAtStart = 0; - - Nanoseconds upTime = AbsoluteToNanoseconds( UpTime() ); - - if ( gMilliAtStart == 0 ) - { - time_t start = time(NULL); - gMilliAtStart = ((UInt64) start) * 1000000L; - gMilliAtStart -= upTime.lo / 1000 ; - gMilliAtStart -= ( ( (UInt64) upTime.hi ) << 32 ) / (1000 * 1000); - } - - UInt64 millival = gMilliAtStart; - millival += upTime.lo / (1000 * 1000); - millival += ( ( (UInt64) upTime.hi ) << 32 ) / (1000 * 1000); - val = millival; - - return val; -#else // no gettimeofday() nor ftime() - // We use wxGetLocalTime() to get the seconds since - // 00:00:00 Jan 1st 1970 and then whatever is available - // to get millisecond resolution. - // - // NOTE that this might lead to a problem if the clocks - // use different sources, so this approach should be - // avoided where possible. - - val *= wxGetLocalTime(); - -// GRG: This will go soon as all WIN32 seem to have ftime -// JACS: unfortunately not. WinCE doesn't have it. -#if defined (__WIN32__) - // If your platform/compiler needs to use two different functions - // to get ms resolution, please do NOT just shut off these warnings, - // drop me a line instead at - - // FIXME -#ifndef __WXWINCE__ - #warning "Possible clock skew bug in wxGetLocalTimeMillis()!" -#endif - - SYSTEMTIME st; - ::GetLocalTime(&st); - val += st.wMilliseconds; -#else // !Win32 - // If your platform/compiler does not support ms resolution please - // do NOT just shut off these warnings, drop me a line instead at - // - - #if defined(__VISUALC__) || defined (__WATCOMC__) - #pragma message("wxStopWatch will be up to second resolution!") - #elif defined(__BORLANDC__) - #pragma message "wxStopWatch will be up to second resolution!" - #else - #warning "wxStopWatch will be up to second resolution!" - #endif // compiler -#endif - - return val; - -#endif // time functions -} - -#else // !wxUSE_LONGLONG - -double wxGetLocalTimeMillis(void) -{ - return (double(clock()) / double(CLOCKS_PER_SEC)) * 1000.0; -} - -#endif // wxUSE_LONGLONG/!wxUSE_LONGLONG diff --git a/Source/3rdParty/wx/src/common/strconv.cpp b/Source/3rdParty/wx/src/common/strconv.cpp deleted file mode 100644 index 102462916..000000000 --- a/Source/3rdParty/wx/src/common/strconv.cpp +++ /dev/null @@ -1,3742 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/strconv.cpp -// Purpose: Unicode conversion classes -// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin, Vaclav Slavik, -// Ryan Norton, Fredrik Roubert (UTF7) -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: strconv.cpp 64156 2010-04-27 08:52:30Z VZ $ -// Copyright: (c) 1999 Ove Kaaven, Robert Roebling, Vaclav Slavik -// (c) 2000-2003 Vadim Zeitlin -// (c) 2004 Ryan Norton, Fredrik Roubert -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #ifdef __WXMSW__ - #include "wx/msw/missing.h" - #endif - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/hashmap.h" -#endif - -#include "wx/strconv.h" - -#if wxUSE_WCHAR_T - -#ifdef __WINDOWS__ - #include "wx/msw/private.h" -#endif - -#ifndef __WXWINCE__ -#include -#endif - -#include -#include -#include - -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - #define wxHAVE_WIN32_MB2WC -#endif - -#ifdef __SALFORDC__ - #include -#endif - -#ifdef HAVE_ICONV - #include - #include "wx/thread.h" -#endif - -#include "wx/encconv.h" -#include "wx/fontmap.h" - -#ifdef __WXMAC__ -#ifndef __DARWIN__ -#include -#include -#include -#endif - -// includes Mac headers -#include "wx/mac/private.h" -#include "wx/thread.h" - -#endif - - -#define TRACE_STRCONV _T("strconv") - -// WC_UTF16 is defined only if sizeof(wchar_t) == 2, otherwise it's supposed to -// be 4 bytes -#if SIZEOF_WCHAR_T == 2 - #define WC_UTF16 -#endif - - -// ============================================================================ -// implementation -// ============================================================================ - -// helper function of cMB2WC(): check if n bytes at this location are all NUL -static bool NotAllNULs(const char *p, size_t n) -{ - while ( n && *p++ == '\0' ) - n--; - - return n != 0; -} - -// ---------------------------------------------------------------------------- -// UTF-16 en/decoding to/from UCS-4 with surrogates handling -// ---------------------------------------------------------------------------- - -static size_t encode_utf16(wxUint32 input, wxUint16 *output) -{ - if (input <= 0xffff) - { - if (output) - *output = (wxUint16) input; - - return 1; - } - else if (input >= 0x110000) - { - return wxCONV_FAILED; - } - else - { - if (output) - { - *output++ = (wxUint16) ((input >> 10) + 0xd7c0); - *output = (wxUint16) ((input & 0x3ff) + 0xdc00); - } - - return 2; - } -} - -static size_t decode_utf16(const wxUint16* input, wxUint32& output) -{ - if ((*input < 0xd800) || (*input > 0xdfff)) - { - output = *input; - return 1; - } - else if ((input[1] < 0xdc00) || (input[1] > 0xdfff)) - { - output = *input; - return wxCONV_FAILED; - } - else - { - output = ((input[0] - 0xd7c0) << 10) + (input[1] - 0xdc00); - return 2; - } -} - -#ifdef WC_UTF16 - typedef wchar_t wxDecodeSurrogate_t; -#else // !WC_UTF16 - typedef wxUint16 wxDecodeSurrogate_t; -#endif // WC_UTF16/!WC_UTF16 - -// returns the next UTF-32 character from the wchar_t buffer and advances the -// pointer to the character after this one -// -// if an invalid character is found, *pSrc is set to NULL, the caller must -// check for this -static wxUint32 wxDecodeSurrogate(const wxDecodeSurrogate_t **pSrc) -{ - wxUint32 out; - const size_t - n = decode_utf16(wx_reinterpret_cast(const wxUint16 *, *pSrc), out); - if ( n == wxCONV_FAILED ) - *pSrc = NULL; - else - *pSrc += n; - - return out; -} - -// ---------------------------------------------------------------------------- -// wxMBConv -// ---------------------------------------------------------------------------- - -size_t -wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - // although new conversion classes are supposed to implement this function - // directly, the existins ones only implement the old MB2WC() and so, to - // avoid to have to rewrite all conversion classes at once, we provide a - // default (but not efficient) implementation of this one in terms of the - // old function by copying the input to ensure that it's NUL-terminated and - // then using MB2WC() to convert it - - // the number of chars [which would be] written to dst [if it were not NULL] - size_t dstWritten = 0; - - // the number of NULs terminating this string - size_t nulLen = 0; // not really needed, but just to avoid warnings - - // if we were not given the input size we just have to assume that the - // string is properly terminated as we have no way of knowing how long it - // is anyhow, but if we do have the size check whether there are enough - // NULs at the end - wxCharBuffer bufTmp; - const char *srcEnd; - if ( srcLen != wxNO_LEN ) - { - // we need to know how to find the end of this string - nulLen = GetMBNulLen(); - if ( nulLen == wxCONV_FAILED ) - return wxCONV_FAILED; - - // if there are enough NULs we can avoid the copy - if ( srcLen < nulLen || NotAllNULs(src + srcLen - nulLen, nulLen) ) - { - // make a copy in order to properly NUL-terminate the string - bufTmp = wxCharBuffer(srcLen + nulLen - 1 /* 1 will be added */); - char * const p = bufTmp.data(); - memcpy(p, src, srcLen); - for ( char *s = p + srcLen; s < p + srcLen + nulLen; s++ ) - *s = '\0'; - - src = bufTmp; - } - - srcEnd = src + srcLen; - } - else // quit after the first loop iteration - { - srcEnd = NULL; - } - - for ( ;; ) - { - // try to convert the current chunk - size_t lenChunk = MB2WC(NULL, src, 0); - if ( lenChunk == wxCONV_FAILED ) - return wxCONV_FAILED; - - lenChunk++; // for the L'\0' at the end of this chunk - - dstWritten += lenChunk; - - if ( lenChunk == 1 ) - { - // nothing left in the input string, conversion succeeded - break; - } - - if ( dst ) - { - if ( dstWritten > dstLen ) - return wxCONV_FAILED; - - if ( MB2WC(dst, src, lenChunk) == wxCONV_FAILED ) - return wxCONV_FAILED; - - dst += lenChunk; - } - - if ( !srcEnd ) - { - // we convert just one chunk in this case as this is the entire - // string anyhow - break; - } - - // advance the input pointer past the end of this chunk - while ( NotAllNULs(src, nulLen) ) - { - // notice that we must skip over multiple bytes here as we suppose - // that if NUL takes 2 or 4 bytes, then all the other characters do - // too and so if advanced by a single byte we might erroneously - // detect sequences of NUL bytes in the middle of the input - src += nulLen; - } - - src += nulLen; // skipping over its terminator as well - - // note that ">=" (and not just "==") is needed here as the terminator - // we skipped just above could be inside or just after the buffer - // delimited by inEnd - if ( src >= srcEnd ) - break; - } - - return dstWritten; -} - -size_t -wxMBConv::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - // the number of chars [which would be] written to dst [if it were not NULL] - size_t dstWritten = 0; - - // make a copy of the input string unless it is already properly - // NUL-terminated - // - // if we don't know its length we have no choice but to assume that it is, - // indeed, properly terminated - wxWCharBuffer bufTmp; - if ( srcLen == wxNO_LEN ) - { - srcLen = wxWcslen(src) + 1; - } - else if ( srcLen != 0 && src[srcLen - 1] != L'\0' ) - { - // make a copy in order to properly NUL-terminate the string - bufTmp = wxWCharBuffer(srcLen); - memcpy(bufTmp.data(), src, srcLen * sizeof(wchar_t)); - src = bufTmp; - } - - const size_t lenNul = GetMBNulLen(); - for ( const wchar_t * const srcEnd = src + srcLen; - src < srcEnd; - src += wxWcslen(src) + 1 /* skip L'\0' too */ ) - { - // try to convert the current chunk - size_t lenChunk = WC2MB(NULL, src, 0); - - if ( lenChunk == wxCONV_FAILED ) - return wxCONV_FAILED; - - lenChunk += lenNul; - dstWritten += lenChunk; - - if ( dst ) - { - if ( dstWritten > dstLen ) - return wxCONV_FAILED; - - if ( WC2MB(dst, src, lenChunk) == wxCONV_FAILED ) - return wxCONV_FAILED; - - dst += lenChunk; - } - } - - return dstWritten; -} - -size_t wxMBConv::MB2WC(wchar_t *outBuff, const char *inBuff, size_t outLen) const -{ - size_t rc = ToWChar(outBuff, outLen, inBuff); - if ( rc != wxCONV_FAILED ) - { - // ToWChar() returns the buffer length, i.e. including the trailing - // NUL, while this method doesn't take it into account - rc--; - } - - return rc; -} - -size_t wxMBConv::WC2MB(char *outBuff, const wchar_t *inBuff, size_t outLen) const -{ - size_t rc = FromWChar(outBuff, outLen, inBuff); - if ( rc != wxCONV_FAILED ) - { - rc -= GetMBNulLen(); - } - - return rc; -} - -wxMBConv::~wxMBConv() -{ - // nothing to do here (necessary for Darwin linking probably) -} - -const wxWCharBuffer wxMBConv::cMB2WC(const char *psz) const -{ - if ( psz ) - { - // calculate the length of the buffer needed first - const size_t nLen = MB2WC(NULL, psz, 0); - if ( nLen != wxCONV_FAILED ) - { - // now do the actual conversion - wxWCharBuffer buf(nLen /* +1 added implicitly */); - - // +1 for the trailing NULL - if ( MB2WC(buf.data(), psz, nLen + 1) != wxCONV_FAILED ) - return buf; - } - } - - return wxWCharBuffer(); -} - -const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *pwz) const -{ - if ( pwz ) - { - const size_t nLen = WC2MB(NULL, pwz, 0); - if ( nLen != wxCONV_FAILED ) - { - // extra space for trailing NUL(s) - static const size_t extraLen = GetMaxMBNulLen(); - - wxCharBuffer buf(nLen + extraLen - 1); - if ( WC2MB(buf.data(), pwz, nLen + extraLen) != wxCONV_FAILED ) - return buf; - } - } - - return wxCharBuffer(); -} - -const wxWCharBuffer -wxMBConv::cMB2WC(const char *inBuff, size_t inLen, size_t *outLen) const -{ - const size_t dstLen = ToWChar(NULL, 0, inBuff, inLen); - if ( dstLen != wxCONV_FAILED ) - { - wxWCharBuffer wbuf(dstLen - 1); - if ( ToWChar(wbuf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED ) - { - if ( outLen ) - { - *outLen = dstLen; - if ( wbuf[dstLen - 1] == L'\0' ) - (*outLen)--; - } - - return wbuf; - } - } - - if ( outLen ) - *outLen = 0; - - return wxWCharBuffer(); -} - -const wxCharBuffer -wxMBConv::cWC2MB(const wchar_t *inBuff, size_t inLen, size_t *outLen) const -{ - size_t dstLen = FromWChar(NULL, 0, inBuff, inLen); - if ( dstLen != wxCONV_FAILED ) - { - // special case of empty input: can't allocate 0 size buffer below as - // wxCharBuffer insists on NUL-terminating it - wxCharBuffer buf(dstLen ? dstLen - 1 : 1); - if ( FromWChar(buf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED ) - { - if ( outLen ) - { - *outLen = dstLen; - - const size_t nulLen = GetMBNulLen(); - if ( dstLen >= nulLen && - !NotAllNULs(buf.data() + dstLen - nulLen, nulLen) ) - { - // in this case the output is NUL-terminated and we're not - // supposed to count NUL - *outLen -= nulLen; - } - } - - return buf; - } - } - - if ( outLen ) - *outLen = 0; - - return wxCharBuffer(); -} - -// ---------------------------------------------------------------------------- -// wxMBConvLibc -// ---------------------------------------------------------------------------- - -size_t wxMBConvLibc::MB2WC(wchar_t *buf, const char *psz, size_t n) const -{ - return wxMB2WC(buf, psz, n); -} - -size_t wxMBConvLibc::WC2MB(char *buf, const wchar_t *psz, size_t n) const -{ - return wxWC2MB(buf, psz, n); -} - -// ---------------------------------------------------------------------------- -// wxConvBrokenFileNames -// ---------------------------------------------------------------------------- - -#ifdef __UNIX__ - -wxConvBrokenFileNames::wxConvBrokenFileNames(const wxChar *charset) -{ - if ( !charset || wxStricmp(charset, _T("UTF-8")) == 0 - || wxStricmp(charset, _T("UTF8")) == 0 ) - m_conv = new wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA); - else - m_conv = new wxCSConv(charset); -} - -#endif // __UNIX__ - -// ---------------------------------------------------------------------------- -// UTF-7 -// ---------------------------------------------------------------------------- - -// Implementation (C) 2004 Fredrik Roubert - -// -// BASE64 decoding table -// -static const unsigned char utf7unb64[] = -{ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -size_t wxMBConvUTF7::MB2WC(wchar_t *buf, const char *psz, size_t n) const -{ - size_t len = 0; - - while ( *psz && (!buf || (len < n)) ) - { - unsigned char cc = *psz++; - if (cc != '+') - { - // plain ASCII char - if (buf) - *buf++ = cc; - len++; - } - else if (*psz == '-') - { - // encoded plus sign - if (buf) - *buf++ = cc; - len++; - psz++; - } - else // start of BASE64 encoded string - { - bool lsb, ok; - unsigned int d, l; - for ( ok = lsb = false, d = 0, l = 0; - (cc = utf7unb64[(unsigned char)*psz]) != 0xff; - psz++ ) - { - d <<= 6; - d += cc; - for (l += 6; l >= 8; lsb = !lsb) - { - unsigned char c = (unsigned char)((d >> (l -= 8)) % 256); - if (lsb) - { - if (buf) - *buf++ |= c; - len ++; - } - else - { - if (buf) - *buf = (wchar_t)(c << 8); - } - - ok = true; - } - } - - if ( !ok ) - { - // in valid UTF7 we should have valid characters after '+' - return wxCONV_FAILED; - } - - if (*psz == '-') - psz++; - } - } - - if ( buf && (len < n) ) - *buf = '\0'; - - return len; -} - -// -// BASE64 encoding table -// -static const unsigned char utf7enb64[] = -{ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', - 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', - 'w', 'x', 'y', 'z', '0', '1', '2', '3', - '4', '5', '6', '7', '8', '9', '+', '/' -}; - -// -// UTF-7 encoding table -// -// 0 - Set D (directly encoded characters) -// 1 - Set O (optional direct characters) -// 2 - whitespace characters (optional) -// 3 - special characters -// -static const unsigned char utf7encode[128] = -{ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 3, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 3 -}; - -size_t wxMBConvUTF7::WC2MB(char *buf, const wchar_t *psz, size_t n) const -{ - size_t len = 0; - - while (*psz && ((!buf) || (len < n))) - { - wchar_t cc = *psz++; - if (cc < 0x80 && utf7encode[cc] < 1) - { - // plain ASCII char - if (buf) - *buf++ = (char)cc; - - len++; - } -#ifndef WC_UTF16 - else if (((wxUint32)cc) > 0xffff) - { - // no surrogate pair generation (yet?) - return wxCONV_FAILED; - } -#endif - else - { - if (buf) - *buf++ = '+'; - - len++; - if (cc != '+') - { - // BASE64 encode string - unsigned int lsb, d, l; - for (d = 0, l = 0; /*nothing*/; psz++) - { - for (lsb = 0; lsb < 2; lsb ++) - { - d <<= 8; - d += lsb ? cc & 0xff : (cc & 0xff00) >> 8; - - for (l += 8; l >= 6; ) - { - l -= 6; - if (buf) - *buf++ = utf7enb64[(d >> l) % 64]; - len++; - } - } - - cc = *psz; - if (!(cc) || (cc < 0x80 && utf7encode[cc] < 1)) - break; - } - - if (l != 0) - { - if (buf) - *buf++ = utf7enb64[((d % 16) << (6 - l)) % 64]; - - len++; - } - } - - if (buf) - *buf++ = '-'; - len++; - } - } - - if (buf && (len < n)) - *buf = 0; - - return len; -} - -// ---------------------------------------------------------------------------- -// UTF-8 -// ---------------------------------------------------------------------------- - -static wxUint32 utf8_max[]= - { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff, 0xffffffff }; - -// boundaries of the private use area we use to (temporarily) remap invalid -// characters invalid in a UTF-8 encoded string -const wxUint32 wxUnicodePUA = 0x100000; -const wxUint32 wxUnicodePUAEnd = wxUnicodePUA + 256; - -size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const -{ - size_t len = 0; - - while (*psz && ((!buf) || (len < n))) - { - const char *opsz = psz; - bool invalid = false; - unsigned char cc = *psz++, fc = cc; - unsigned cnt; - for (cnt = 0; fc & 0x80; cnt++) - fc <<= 1; - - if (!cnt) - { - // plain ASCII char - if (buf) - *buf++ = cc; - len++; - - // escape the escape character for octal escapes - if ((m_options & MAP_INVALID_UTF8_TO_OCTAL) - && cc == '\\' && (!buf || len < n)) - { - if (buf) - *buf++ = cc; - len++; - } - } - else - { - cnt--; - if (!cnt) - { - // invalid UTF-8 sequence - invalid = true; - } - else - { - unsigned ocnt = cnt - 1; - wxUint32 res = cc & (0x3f >> cnt); - while (cnt--) - { - cc = *psz; - if ((cc & 0xC0) != 0x80) - { - // invalid UTF-8 sequence - invalid = true; - break; - } - - psz++; - res = (res << 6) | (cc & 0x3f); - } - - if (invalid || res <= utf8_max[ocnt]) - { - // illegal UTF-8 encoding - invalid = true; - } - else if ((m_options & MAP_INVALID_UTF8_TO_PUA) && - res >= wxUnicodePUA && res < wxUnicodePUAEnd) - { - // if one of our PUA characters turns up externally - // it must also be treated as an illegal sequence - // (a bit like you have to escape an escape character) - invalid = true; - } - else - { -#ifdef WC_UTF16 - // cast is ok because wchar_t == wxUuint16 if WC_UTF16 - size_t pa = encode_utf16(res, (wxUint16 *)buf); - if (pa == wxCONV_FAILED) - { - invalid = true; - } - else - { - if (buf) - buf += pa; - len += pa; - } -#else // !WC_UTF16 - if (buf) - *buf++ = (wchar_t)res; - len++; -#endif // WC_UTF16/!WC_UTF16 - } - } - - if (invalid) - { - if (m_options & MAP_INVALID_UTF8_TO_PUA) - { - while (opsz < psz && (!buf || len < n)) - { -#ifdef WC_UTF16 - // cast is ok because wchar_t == wxUuint16 if WC_UTF16 - size_t pa = encode_utf16((unsigned char)*opsz + wxUnicodePUA, (wxUint16 *)buf); - wxASSERT(pa != wxCONV_FAILED); - if (buf) - buf += pa; - opsz++; - len += pa; -#else - if (buf) - *buf++ = (wchar_t)(wxUnicodePUA + (unsigned char)*opsz); - opsz++; - len++; -#endif - } - } - else if (m_options & MAP_INVALID_UTF8_TO_OCTAL) - { - while (opsz < psz && (!buf || len < n)) - { - if ( buf && len + 3 < n ) - { - unsigned char on = *opsz; - *buf++ = L'\\'; - *buf++ = (wchar_t)( L'0' + on / 0100 ); - *buf++ = (wchar_t)( L'0' + (on % 0100) / 010 ); - *buf++ = (wchar_t)( L'0' + on % 010 ); - } - - opsz++; - len += 4; - } - } - else // MAP_INVALID_UTF8_NOT - { - return wxCONV_FAILED; - } - } - } - } - - if (buf && (len < n)) - *buf = 0; - - return len; -} - -static inline bool isoctal(wchar_t wch) -{ - return L'0' <= wch && wch <= L'7'; -} - -size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const -{ - size_t len = 0; - - while (*psz && ((!buf) || (len < n))) - { - wxUint32 cc; - -#ifdef WC_UTF16 - // cast is ok for WC_UTF16 - size_t pa = decode_utf16((const wxUint16 *)psz, cc); - psz += (pa == wxCONV_FAILED) ? 1 : pa; -#else - cc = (*psz++) & 0x7fffffff; -#endif - - if ( (m_options & MAP_INVALID_UTF8_TO_PUA) - && cc >= wxUnicodePUA && cc < wxUnicodePUAEnd ) - { - if (buf) - *buf++ = (char)(cc - wxUnicodePUA); - len++; - } - else if ( (m_options & MAP_INVALID_UTF8_TO_OCTAL) - && cc == L'\\' && psz[0] == L'\\' ) - { - if (buf) - *buf++ = (char)cc; - psz++; - len++; - } - else if ( (m_options & MAP_INVALID_UTF8_TO_OCTAL) && - cc == L'\\' && - isoctal(psz[0]) && isoctal(psz[1]) && isoctal(psz[2]) ) - { - if (buf) - { - *buf++ = (char) ((psz[0] - L'0') * 0100 + - (psz[1] - L'0') * 010 + - (psz[2] - L'0')); - } - - psz += 3; - len++; - } - else - { - unsigned cnt; - for (cnt = 0; cc > utf8_max[cnt]; cnt++) - { - } - - if (!cnt) - { - // plain ASCII char - if (buf) - *buf++ = (char) cc; - len++; - } - else - { - len += cnt + 1; - if (buf) - { - *buf++ = (char) ((-128 >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt))); - while (cnt--) - *buf++ = (char) (0x80 | ((cc >> (cnt * 6)) & 0x3f)); - } - } - } - } - - if (buf && (len < n)) - *buf = 0; - - return len; -} - -// ============================================================================ -// UTF-16 -// ============================================================================ - -#ifdef WORDS_BIGENDIAN - #define wxMBConvUTF16straight wxMBConvUTF16BE - #define wxMBConvUTF16swap wxMBConvUTF16LE -#else - #define wxMBConvUTF16swap wxMBConvUTF16BE - #define wxMBConvUTF16straight wxMBConvUTF16LE -#endif - -/* static */ -size_t wxMBConvUTF16Base::GetLength(const char *src, size_t srcLen) -{ - if ( srcLen == wxNO_LEN ) - { - // count the number of bytes in input, including the trailing NULs - const wxUint16 *inBuff = wx_reinterpret_cast(const wxUint16 *, src); - for ( srcLen = 1; *inBuff++; srcLen++ ) - ; - - srcLen *= BYTES_PER_CHAR; - } - else // we already have the length - { - // we can only convert an entire number of UTF-16 characters - if ( srcLen % BYTES_PER_CHAR ) - return wxCONV_FAILED; - } - - return srcLen; -} - -// case when in-memory representation is UTF-16 too -#ifdef WC_UTF16 - -// ---------------------------------------------------------------------------- -// conversions without endianness change -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF16straight::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - // set up the scene for using memcpy() (which is presumably more efficient - // than copying the bytes one by one) - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const size_t inLen = srcLen / BYTES_PER_CHAR; - if ( dst ) - { - if ( dstLen < inLen ) - return wxCONV_FAILED; - - memcpy(dst, src, srcLen); - } - - return inLen; -} - -size_t -wxMBConvUTF16straight::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - srcLen *= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - memcpy(dst, src, srcLen); - } - - return srcLen; -} - -// ---------------------------------------------------------------------------- -// endian-reversing conversions -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - srcLen /= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - const wxUint16 *inBuff = wx_reinterpret_cast(const wxUint16 *, src); - for ( size_t n = 0; n < srcLen; n++, inBuff++ ) - { - *dst++ = wxUINT16_SWAP_ALWAYS(*inBuff); - } - } - - return srcLen; -} - -size_t -wxMBConvUTF16swap::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - srcLen *= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - wxUint16 *outBuff = wx_reinterpret_cast(wxUint16 *, dst); - for ( size_t n = 0; n < srcLen; n += BYTES_PER_CHAR, src++ ) - { - *outBuff++ = wxUINT16_SWAP_ALWAYS(*src); - } - } - - return srcLen; -} - -#else // !WC_UTF16: wchar_t is UTF-32 - -// ---------------------------------------------------------------------------- -// conversions without endianness change -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF16straight::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const size_t inLen = srcLen / BYTES_PER_CHAR; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string even if the real size could be smaller if the buffer contains - // any surrogates - return inLen; - } - - size_t outLen = 0; - const wxUint16 *inBuff = wx_reinterpret_cast(const wxUint16 *, src); - for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; ) - { - const wxUint32 ch = wxDecodeSurrogate(&inBuff); - if ( !inBuff ) - return wxCONV_FAILED; - - if ( ++outLen > dstLen ) - return wxCONV_FAILED; - - *dst++ = ch; - } - - - return outLen; -} - -size_t -wxMBConvUTF16straight::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - size_t outLen = 0; - wxUint16 *outBuff = wx_reinterpret_cast(wxUint16 *, dst); - for ( size_t n = 0; n < srcLen; n++ ) - { - wxUint16 cc[2]; - const size_t numChars = encode_utf16(*src++, cc); - if ( numChars == wxCONV_FAILED ) - return wxCONV_FAILED; - - outLen += numChars * BYTES_PER_CHAR; - if ( outBuff ) - { - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *outBuff++ = cc[0]; - if ( numChars == 2 ) - { - // second character of a surrogate - *outBuff++ = cc[1]; - } - } - } - - return outLen; -} - -// ---------------------------------------------------------------------------- -// endian-reversing conversions -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const size_t inLen = srcLen / BYTES_PER_CHAR; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string even if the real size could be smaller if the buffer contains - // any surrogates - return inLen; - } - - size_t outLen = 0; - const wxUint16 *inBuff = wx_reinterpret_cast(const wxUint16 *, src); - for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; ) - { - wxUint32 ch; - wxUint16 tmp[2]; - - tmp[0] = wxUINT16_SWAP_ALWAYS(*inBuff); - inBuff++; - tmp[1] = wxUINT16_SWAP_ALWAYS(*inBuff); - - const size_t numChars = decode_utf16(tmp, ch); - if ( numChars == wxCONV_FAILED ) - return wxCONV_FAILED; - - if ( numChars == 2 ) - inBuff++; - - if ( ++outLen > dstLen ) - return wxCONV_FAILED; - - *dst++ = ch; - } - - - return outLen; -} - -size_t -wxMBConvUTF16swap::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - size_t outLen = 0; - wxUint16 *outBuff = wx_reinterpret_cast(wxUint16 *, dst); - for ( const wchar_t *srcEnd = src + srcLen; src < srcEnd; src++ ) - { - wxUint16 cc[2]; - const size_t numChars = encode_utf16(*src, cc); - if ( numChars == wxCONV_FAILED ) - return wxCONV_FAILED; - - outLen += numChars * BYTES_PER_CHAR; - if ( outBuff ) - { - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *outBuff++ = wxUINT16_SWAP_ALWAYS(cc[0]); - if ( numChars == 2 ) - { - // second character of a surrogate - *outBuff++ = wxUINT16_SWAP_ALWAYS(cc[1]); - } - } - } - - return outLen; -} - -#endif // WC_UTF16/!WC_UTF16 - - -// ============================================================================ -// UTF-32 -// ============================================================================ - -#ifdef WORDS_BIGENDIAN - #define wxMBConvUTF32straight wxMBConvUTF32BE - #define wxMBConvUTF32swap wxMBConvUTF32LE -#else - #define wxMBConvUTF32swap wxMBConvUTF32BE - #define wxMBConvUTF32straight wxMBConvUTF32LE -#endif - - -WXDLLIMPEXP_DATA_BASE(wxMBConvUTF32LE) wxConvUTF32LE; -WXDLLIMPEXP_DATA_BASE(wxMBConvUTF32BE) wxConvUTF32BE; - -/* static */ -size_t wxMBConvUTF32Base::GetLength(const char *src, size_t srcLen) -{ - if ( srcLen == wxNO_LEN ) - { - // count the number of bytes in input, including the trailing NULs - const wxUint32 *inBuff = wx_reinterpret_cast(const wxUint32 *, src); - for ( srcLen = 1; *inBuff++; srcLen++ ) - ; - - srcLen *= BYTES_PER_CHAR; - } - else // we already have the length - { - // we can only convert an entire number of UTF-32 characters - if ( srcLen % BYTES_PER_CHAR ) - return wxCONV_FAILED; - } - - return srcLen; -} - -// case when in-memory representation is UTF-16 -#ifdef WC_UTF16 - -// ---------------------------------------------------------------------------- -// conversions without endianness change -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF32straight::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const wxUint32 *inBuff = wx_reinterpret_cast(const wxUint32 *, src); - const size_t inLen = srcLen / BYTES_PER_CHAR; - size_t outLen = 0; - for ( size_t n = 0; n < inLen; n++ ) - { - wxUint16 cc[2]; - const size_t numChars = encode_utf16(*inBuff++, cc); - if ( numChars == wxCONV_FAILED ) - return wxCONV_FAILED; - - outLen += numChars; - if ( dst ) - { - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *dst++ = cc[0]; - if ( numChars == 2 ) - { - // second character of a surrogate - *dst++ = cc[1]; - } - } - } - - return outLen; -} - -size_t -wxMBConvUTF32straight::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string instead of the exact amount which could be less if there are - // any surrogates in the input - // - // we consider that surrogates are rare enough to make it worthwhile to - // avoid running the loop below at the cost of slightly extra memory - // consumption - return srcLen * BYTES_PER_CHAR; - } - - wxUint32 *outBuff = wx_reinterpret_cast(wxUint32 *, dst); - size_t outLen = 0; - for ( const wchar_t * const srcEnd = src + srcLen; src < srcEnd; ) - { - const wxUint32 ch = wxDecodeSurrogate(&src); - if ( !src ) - return wxCONV_FAILED; - - outLen += BYTES_PER_CHAR; - - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *outBuff++ = ch; - } - - return outLen; -} - -// ---------------------------------------------------------------------------- -// endian-reversing conversions -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF32swap::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const wxUint32 *inBuff = wx_reinterpret_cast(const wxUint32 *, src); - const size_t inLen = srcLen / BYTES_PER_CHAR; - size_t outLen = 0; - for ( size_t n = 0; n < inLen; n++, inBuff++ ) - { - wxUint16 cc[2]; - const size_t numChars = encode_utf16(wxUINT32_SWAP_ALWAYS(*inBuff), cc); - if ( numChars == wxCONV_FAILED ) - return wxCONV_FAILED; - - outLen += numChars; - if ( dst ) - { - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *dst++ = cc[0]; - if ( numChars == 2 ) - { - // second character of a surrogate - *dst++ = cc[1]; - } - } - } - - return outLen; -} - -size_t -wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string instead of the exact amount which could be less if there are - // any surrogates in the input - // - // we consider that surrogates are rare enough to make it worthwhile to - // avoid running the loop below at the cost of slightly extra memory - // consumption - return srcLen*BYTES_PER_CHAR; - } - - wxUint32 *outBuff = wx_reinterpret_cast(wxUint32 *, dst); - size_t outLen = 0; - for ( const wchar_t * const srcEnd = src + srcLen; src < srcEnd; ) - { - const wxUint32 ch = wxDecodeSurrogate(&src); - if ( !src ) - return wxCONV_FAILED; - - outLen += BYTES_PER_CHAR; - - if ( outLen > dstLen ) - return wxCONV_FAILED; - - *outBuff++ = wxUINT32_SWAP_ALWAYS(ch); - } - - return outLen; -} - -#else // !WC_UTF16: wchar_t is UTF-32 - -// ---------------------------------------------------------------------------- -// conversions without endianness change -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF32straight::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - // use memcpy() as it should be much faster than hand-written loop - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - const size_t inLen = srcLen/BYTES_PER_CHAR; - if ( dst ) - { - if ( dstLen < inLen ) - return wxCONV_FAILED; - - memcpy(dst, src, srcLen); - } - - return inLen; -} - -size_t -wxMBConvUTF32straight::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - srcLen *= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - memcpy(dst, src, srcLen); - } - - return srcLen; -} - -// ---------------------------------------------------------------------------- -// endian-reversing conversions -// ---------------------------------------------------------------------------- - -size_t -wxMBConvUTF32swap::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - srcLen = GetLength(src, srcLen); - if ( srcLen == wxNO_LEN ) - return wxCONV_FAILED; - - srcLen /= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - const wxUint32 *inBuff = wx_reinterpret_cast(const wxUint32 *, src); - for ( size_t n = 0; n < srcLen; n++, inBuff++ ) - { - *dst++ = wxUINT32_SWAP_ALWAYS(*inBuff); - } - } - - return srcLen; -} - -size_t -wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - srcLen *= BYTES_PER_CHAR; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - wxUint32 *outBuff = wx_reinterpret_cast(wxUint32 *, dst); - for ( size_t n = 0; n < srcLen; n += BYTES_PER_CHAR, src++ ) - { - *outBuff++ = wxUINT32_SWAP_ALWAYS(*src); - } - } - - return srcLen; -} - -#endif // WC_UTF16/!WC_UTF16 - - -// ============================================================================ -// The classes doing conversion using the iconv_xxx() functions -// ============================================================================ - -#ifdef HAVE_ICONV - -// VS: glibc 2.1.3 is broken in that iconv() conversion to/from UCS4 fails with -// E2BIG if output buffer is _exactly_ as big as needed. Such case is -// (unless there's yet another bug in glibc) the only case when iconv() -// returns with (size_t)-1 (which means error) and says there are 0 bytes -// left in the input buffer -- when _real_ error occurs, -// bytes-left-in-input buffer is non-zero. Hence, this alternative test for -// iconv() failure. -// [This bug does not appear in glibc 2.2.] -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1 -#define ICONV_FAILED(cres, bufLeft) ((cres == (size_t)-1) && \ - (errno != E2BIG || bufLeft != 0)) -#else -#define ICONV_FAILED(cres, bufLeft) (cres == (size_t)-1) -#endif - -#define ICONV_CHAR_CAST(x) ((ICONV_CONST char **)(x)) - -#define ICONV_T_INVALID ((iconv_t)-1) - -#if SIZEOF_WCHAR_T == 4 - #define WC_BSWAP wxUINT32_SWAP_ALWAYS - #define WC_ENC wxFONTENCODING_UTF32 -#elif SIZEOF_WCHAR_T == 2 - #define WC_BSWAP wxUINT16_SWAP_ALWAYS - #define WC_ENC wxFONTENCODING_UTF16 -#else // sizeof(wchar_t) != 2 nor 4 - // does this ever happen? - #error "Unknown sizeof(wchar_t): please report this to wx-dev@lists.wxwindows.org" -#endif - -// ---------------------------------------------------------------------------- -// wxMBConv_iconv: encapsulates an iconv character set -// ---------------------------------------------------------------------------- - -class wxMBConv_iconv : public wxMBConv -{ -public: - wxMBConv_iconv(const wxChar *name); - virtual ~wxMBConv_iconv(); - - virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const; - virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const; - - // classify this encoding as explained in wxMBConv::GetMBNulLen() comment - virtual size_t GetMBNulLen() const; - - virtual wxMBConv *Clone() const - { - wxMBConv_iconv *p = new wxMBConv_iconv(m_name); - p->m_minMBCharWidth = m_minMBCharWidth; - return p; - } - - bool IsOk() const - { return (m2w != ICONV_T_INVALID) && (w2m != ICONV_T_INVALID); } - -protected: - // the iconv handlers used to translate from multibyte - // to wide char and in the other direction - iconv_t m2w, - w2m; - -#if wxUSE_THREADS - // guards access to m2w and w2m objects - wxMutex m_iconvMutex; -#endif - -private: - // the name (for iconv_open()) of a wide char charset -- if none is - // available on this machine, it will remain NULL - static wxString ms_wcCharsetName; - - // true if the wide char encoding we use (i.e. ms_wcCharsetName) has - // different endian-ness than the native one - static bool ms_wcNeedsSwap; - - - // name of the encoding handled by this conversion - wxString m_name; - - // cached result of GetMBNulLen(); set to 0 meaning "unknown" - // initially - size_t m_minMBCharWidth; -}; - -// make the constructor available for unit testing -WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name ) -{ - wxMBConv_iconv* result = new wxMBConv_iconv( name ); - if ( !result->IsOk() ) - { - delete result; - return 0; - } - - return result; -} - -wxString wxMBConv_iconv::ms_wcCharsetName; -bool wxMBConv_iconv::ms_wcNeedsSwap = false; - -wxMBConv_iconv::wxMBConv_iconv(const wxChar *name) - : m_name(name) -{ - m_minMBCharWidth = 0; - - // iconv operates with chars, not wxChars, but luckily it uses only ASCII - // names for the charsets - const wxCharBuffer cname(wxString(name).ToAscii()); - - // check for charset that represents wchar_t: - if ( ms_wcCharsetName.empty() ) - { - wxLogTrace(TRACE_STRCONV, _T("Looking for wide char codeset:")); - -#if wxUSE_FONTMAP - const wxChar **names = wxFontMapperBase::GetAllEncodingNames(WC_ENC); -#else // !wxUSE_FONTMAP - static const wxChar *names_static[] = - { -#if SIZEOF_WCHAR_T == 4 - _T("UCS-4"), -#elif SIZEOF_WCHAR_T == 2 - _T("UCS-2"), -#endif - NULL - }; - const wxChar **names = names_static; -#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP - - for ( ; *names && ms_wcCharsetName.empty(); ++names ) - { - const wxString nameCS(*names); - - // first try charset with explicit bytesex info (e.g. "UCS-4LE"): - wxString nameXE(nameCS); - -#ifdef WORDS_BIGENDIAN - nameXE += _T("BE"); -#else // little endian - nameXE += _T("LE"); -#endif - - wxLogTrace(TRACE_STRCONV, _T(" trying charset \"%s\""), - nameXE.c_str()); - - m2w = iconv_open(nameXE.ToAscii(), cname); - if ( m2w == ICONV_T_INVALID ) - { - // try charset w/o bytesex info (e.g. "UCS4") - wxLogTrace(TRACE_STRCONV, _T(" trying charset \"%s\""), - nameCS.c_str()); - m2w = iconv_open(nameCS.ToAscii(), cname); - - // and check for bytesex ourselves: - if ( m2w != ICONV_T_INVALID ) - { - char buf[2], *bufPtr; - wchar_t wbuf[2], *wbufPtr; - size_t insz, outsz; - size_t res; - - buf[0] = 'A'; - buf[1] = 0; - wbuf[0] = 0; - insz = 2; - outsz = SIZEOF_WCHAR_T * 2; - wbufPtr = wbuf; - bufPtr = buf; - - res = iconv( - m2w, ICONV_CHAR_CAST(&bufPtr), &insz, - (char**)&wbufPtr, &outsz); - - if (ICONV_FAILED(res, insz)) - { - wxLogLastError(wxT("iconv")); - wxLogError(_("Conversion to charset '%s' doesn't work."), - nameCS.c_str()); - } - else // ok, can convert to this encoding, remember it - { - ms_wcCharsetName = nameCS; - ms_wcNeedsSwap = wbuf[0] != (wchar_t)buf[0]; - } - } - } - else // use charset not requiring byte swapping - { - ms_wcCharsetName = nameXE; - } - } - - wxLogTrace(TRACE_STRCONV, - wxT("iconv wchar_t charset is \"%s\"%s"), - ms_wcCharsetName.empty() ? _T("") - : ms_wcCharsetName.c_str(), - ms_wcNeedsSwap ? _T(" (needs swap)") - : _T("")); - } - else // we already have ms_wcCharsetName - { - m2w = iconv_open(ms_wcCharsetName.ToAscii(), cname); - } - - if ( ms_wcCharsetName.empty() ) - { - w2m = ICONV_T_INVALID; - } - else - { - w2m = iconv_open(cname, ms_wcCharsetName.ToAscii()); - if ( w2m == ICONV_T_INVALID ) - { - wxLogTrace(TRACE_STRCONV, - wxT("\"%s\" -> \"%s\" works but not the converse!?"), - ms_wcCharsetName.c_str(), cname.data()); - } - } -} - -wxMBConv_iconv::~wxMBConv_iconv() -{ - if ( m2w != ICONV_T_INVALID ) - iconv_close(m2w); - if ( w2m != ICONV_T_INVALID ) - iconv_close(w2m); -} - -size_t wxMBConv_iconv::MB2WC(wchar_t *buf, const char *psz, size_t n) const -{ - // find the string length: notice that must be done differently for - // NUL-terminated strings and UTF-16/32 which are terminated with 2/4 NULs - size_t inbuf; - const size_t nulLen = GetMBNulLen(); - switch ( nulLen ) - { - default: - return wxCONV_FAILED; - - case 1: - inbuf = strlen(psz); // arguably more optimized than our version - break; - - case 2: - case 4: - // for UTF-16/32 not only we need to have 2/4 consecutive NULs but - // they also have to start at character boundary and not span two - // adjacent characters - const char *p; - for ( p = psz; NotAllNULs(p, nulLen); p += nulLen ) - ; - inbuf = p - psz; - break; - } - -#if wxUSE_THREADS - // NB: iconv() is MT-safe, but each thread must use its own iconv_t handle. - // Unfortunately there are a couple of global wxCSConv objects such as - // wxConvLocal that are used all over wx code, so we have to make sure - // the handle is used by at most one thread at the time. Otherwise - // only a few wx classes would be safe to use from non-main threads - // as MB<->WC conversion would fail "randomly". - wxMutexLocker lock(wxConstCast(this, wxMBConv_iconv)->m_iconvMutex); -#endif // wxUSE_THREADS - - size_t outbuf = n * SIZEOF_WCHAR_T; - size_t res, cres; - // VS: Use these instead of psz, buf because iconv() modifies its arguments: - wchar_t *bufPtr = buf; - const char *pszPtr = psz; - - if (buf) - { - // have destination buffer, convert there - cres = iconv(m2w, - ICONV_CHAR_CAST(&pszPtr), &inbuf, - (char**)&bufPtr, &outbuf); - res = n - (outbuf / SIZEOF_WCHAR_T); - - if (ms_wcNeedsSwap) - { - // convert to native endianness - for ( unsigned i = 0; i < res; i++ ) - buf[n] = WC_BSWAP(buf[i]); - } - - // NUL-terminate the string if there is any space left - if (res < n) - buf[res] = 0; - } - else - { - // no destination buffer... convert using temp buffer - // to calculate destination buffer requirement - wchar_t tbuf[8]; - res = 0; - - do - { - bufPtr = tbuf; - outbuf = 8 * SIZEOF_WCHAR_T; - - cres = iconv(m2w, - ICONV_CHAR_CAST(&pszPtr), &inbuf, - (char**)&bufPtr, &outbuf ); - - res += 8 - (outbuf / SIZEOF_WCHAR_T); - } - while ((cres == (size_t)-1) && (errno == E2BIG)); - } - - if (ICONV_FAILED(cres, inbuf)) - { - //VS: it is ok if iconv fails, hence trace only - wxLogTrace(TRACE_STRCONV, wxT("iconv failed: %s"), wxSysErrorMsg(wxSysErrorCode())); - return wxCONV_FAILED; - } - - return res; -} - -size_t wxMBConv_iconv::WC2MB(char *buf, const wchar_t *psz, size_t n) const -{ -#if wxUSE_THREADS - // NB: explained in MB2WC - wxMutexLocker lock(wxConstCast(this, wxMBConv_iconv)->m_iconvMutex); -#endif - - size_t inlen = wxWcslen(psz); - size_t inbuf = inlen * SIZEOF_WCHAR_T; - size_t outbuf = n; - size_t res, cres; - - wchar_t *tmpbuf = 0; - - if (ms_wcNeedsSwap) - { - // need to copy to temp buffer to switch endianness - // (doing WC_BSWAP twice on the original buffer won't help, as it - // could be in read-only memory, or be accessed in some other thread) - tmpbuf = (wchar_t *)malloc(inbuf + SIZEOF_WCHAR_T); - for ( size_t i = 0; i < inlen; i++ ) - tmpbuf[n] = WC_BSWAP(psz[i]); - - tmpbuf[inlen] = L'\0'; - psz = tmpbuf; - } - - if (buf) - { - // have destination buffer, convert there - cres = iconv( w2m, ICONV_CHAR_CAST(&psz), &inbuf, &buf, &outbuf ); - - res = n - outbuf; - - // NB: iconv was given only wcslen(psz) characters on input, and so - // it couldn't convert the trailing zero. Let's do it ourselves - // if there's some room left for it in the output buffer. - if (res < n) - buf[0] = 0; - } - else - { - // no destination buffer: convert using temp buffer - // to calculate destination buffer requirement - char tbuf[16]; - res = 0; - do - { - buf = tbuf; - outbuf = 16; - - cres = iconv( w2m, ICONV_CHAR_CAST(&psz), &inbuf, &buf, &outbuf ); - - res += 16 - outbuf; - } - while ((cres == (size_t)-1) && (errno == E2BIG)); - } - - if (ms_wcNeedsSwap) - { - free(tmpbuf); - } - - if (ICONV_FAILED(cres, inbuf)) - { - wxLogTrace(TRACE_STRCONV, wxT("iconv failed: %s"), wxSysErrorMsg(wxSysErrorCode())); - return wxCONV_FAILED; - } - - return res; -} - -size_t wxMBConv_iconv::GetMBNulLen() const -{ - if ( m_minMBCharWidth == 0 ) - { - wxMBConv_iconv * const self = wxConstCast(this, wxMBConv_iconv); - -#if wxUSE_THREADS - // NB: explained in MB2WC - wxMutexLocker lock(self->m_iconvMutex); -#endif - - const wchar_t *wnul = L""; - char buf[8]; // should be enough for NUL in any encoding - size_t inLen = sizeof(wchar_t), - outLen = WXSIZEOF(buf); - char *inBuff = (char *)wnul; - char *outBuff = buf; - if ( iconv(w2m, ICONV_CHAR_CAST(&inBuff), &inLen, &outBuff, &outLen) == (size_t)-1 ) - { - self->m_minMBCharWidth = (size_t)-1; - } - else // ok - { - self->m_minMBCharWidth = outBuff - buf; - } - } - - return m_minMBCharWidth; -} - -#endif // HAVE_ICONV - - -// ============================================================================ -// Win32 conversion classes -// ============================================================================ - -#ifdef wxHAVE_WIN32_MB2WC - -// from utils.cpp -#if wxUSE_FONTMAP -extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const wxChar *charset); -extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding); -#endif - -class wxMBConv_win32 : public wxMBConv -{ -public: - wxMBConv_win32() - { - m_CodePage = CP_ACP; - m_minMBCharWidth = 0; - } - - wxMBConv_win32(const wxMBConv_win32& conv) - : wxMBConv() - { - m_CodePage = conv.m_CodePage; - m_minMBCharWidth = conv.m_minMBCharWidth; - } - -#if wxUSE_FONTMAP - wxMBConv_win32(const wxChar* name) - { - m_CodePage = wxCharsetToCodepage(name); - m_minMBCharWidth = 0; - } - - wxMBConv_win32(wxFontEncoding encoding) - { - m_CodePage = wxEncodingToCodepage(encoding); - m_minMBCharWidth = 0; - } -#endif // wxUSE_FONTMAP - - virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const - { - // note that we have to use MB_ERR_INVALID_CHARS flag as it without it - // the behaviour is not compatible with the Unix version (using iconv) - // and break the library itself, e.g. wxTextInputStream::NextChar() - // wouldn't work if reading an incomplete MB char didn't result in an - // error - // - // Moreover, MB_ERR_INVALID_CHARS is only supported on Win 2K SP4 or - // Win XP or newer and it is not supported for UTF-[78] so we always - // use our own conversions in this case. See - // http://blogs.msdn.com/michkap/archive/2005/04/19/409566.aspx - // http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp - if ( m_CodePage == CP_UTF8 ) - { - return wxConvUTF8.MB2WC(buf, psz, n); - } - - if ( m_CodePage == CP_UTF7 ) - { - return wxConvUTF7.MB2WC(buf, psz, n); - } - - int flags = 0; - if ( (m_CodePage < 50000 && m_CodePage != CP_SYMBOL) && - IsAtLeastWin2kSP4() ) - { - flags = MB_ERR_INVALID_CHARS; - } - - const size_t len = ::MultiByteToWideChar - ( - m_CodePage, // code page - flags, // flags: fall on error - psz, // input string - -1, // its length (NUL-terminated) - buf, // output string - buf ? n : 0 // size of output buffer - ); - if ( !len ) - { - // function totally failed - return wxCONV_FAILED; - } - - // if we were really converting and didn't use MB_ERR_INVALID_CHARS, - // check if we succeeded, by doing a double trip: - if ( !flags && buf ) - { - const size_t mbLen = strlen(psz); - wxCharBuffer mbBuf(mbLen); - if ( ::WideCharToMultiByte - ( - m_CodePage, - 0, - buf, - -1, - mbBuf.data(), - mbLen + 1, // size in bytes, not length - NULL, - NULL - ) == 0 || - strcmp(mbBuf, psz) != 0 ) - { - // we didn't obtain the same thing we started from, hence - // the conversion was lossy and we consider that it failed - return wxCONV_FAILED; - } - } - - // note that it returns count of written chars for buf != NULL and size - // of the needed buffer for buf == NULL so in either case the length of - // the string (which never includes the terminating NUL) is one less - return len - 1; - } - - virtual size_t WC2MB(char *buf, const wchar_t *pwz, size_t n) const - { - /* - we have a problem here: by default, WideCharToMultiByte() may - replace characters unrepresentable in the target code page with bad - quality approximations such as turning "1/2" symbol (U+00BD) into - "1" for the code pages which don't have it and we, obviously, want - to avoid this at any price - - the trouble is that this function does it _silently_, i.e. it won't - even tell us whether it did or not... Win98/2000 and higher provide - WC_NO_BEST_FIT_CHARS but it doesn't work for the older systems and - we have to resort to a round trip, i.e. check that converting back - results in the same string -- this is, of course, expensive but - otherwise we simply can't be sure to not garble the data. - */ - - // determine if we can rely on WC_NO_BEST_FIT_CHARS: according to MSDN - // it doesn't work with CJK encodings (which we test for rather roughly - // here...) nor with UTF-7/8 nor, of course, with Windows versions not - // supporting it - BOOL usedDef wxDUMMY_INITIALIZE(false); - BOOL *pUsedDef; - int flags; - if ( CanUseNoBestFit() && m_CodePage < 50000 ) - { - // it's our lucky day - flags = WC_NO_BEST_FIT_CHARS; - pUsedDef = &usedDef; - } - else // old system or unsupported encoding - { - flags = 0; - pUsedDef = NULL; - } - - const size_t len = ::WideCharToMultiByte - ( - m_CodePage, // code page - flags, // either none or no best fit - pwz, // input string - -1, // it is (wide) NUL-terminated - buf, // output buffer - buf ? n : 0, // and its size - NULL, // default "replacement" char - pUsedDef // [out] was it used? - ); - - if ( !len ) - { - // function totally failed - return wxCONV_FAILED; - } - - // if we were really converting, check if we succeeded - if ( buf ) - { - if ( flags ) - { - // check if the conversion failed, i.e. if any replacements - // were done - if ( usedDef ) - return wxCONV_FAILED; - } - else // we must resort to double tripping... - { - wxWCharBuffer wcBuf(n); - if ( MB2WC(wcBuf.data(), buf, n) == wxCONV_FAILED || - wcscmp(wcBuf, pwz) != 0 ) - { - // we didn't obtain the same thing we started from, hence - // the conversion was lossy and we consider that it failed - return wxCONV_FAILED; - } - } - } - - // see the comment above for the reason of "len - 1" - return len - 1; - } - - virtual size_t GetMBNulLen() const - { - if ( m_minMBCharWidth == 0 ) - { - int len = ::WideCharToMultiByte - ( - m_CodePage, // code page - 0, // no flags - L"", // input string - 1, // translate just the NUL - NULL, // output buffer - 0, // and its size - NULL, // no replacement char - NULL // [out] don't care if it was used - ); - - wxMBConv_win32 * const self = wxConstCast(this, wxMBConv_win32); - switch ( len ) - { - default: - wxLogDebug(_T("Unexpected NUL length %d"), len); - self->m_minMBCharWidth = (size_t)-1; - break; - - case 0: - self->m_minMBCharWidth = (size_t)-1; - break; - - case 1: - case 2: - case 4: - self->m_minMBCharWidth = len; - break; - } - } - - return m_minMBCharWidth; - } - - virtual wxMBConv *Clone() const { return new wxMBConv_win32(*this); } - - bool IsOk() const { return m_CodePage != -1; } - -private: - static bool CanUseNoBestFit() - { - static int s_isWin98Or2k = -1; - - if ( s_isWin98Or2k == -1 ) - { - int verMaj, verMin; - switch ( wxGetOsVersion(&verMaj, &verMin) ) - { - case wxOS_WINDOWS_9X: - s_isWin98Or2k = verMaj >= 4 && verMin >= 10; - break; - - case wxOS_WINDOWS_NT: - s_isWin98Or2k = verMaj >= 5; - break; - - default: - // unknown: be conservative by default - s_isWin98Or2k = 0; - break; - } - - wxASSERT_MSG( s_isWin98Or2k != -1, _T("should be set above") ); - } - - return s_isWin98Or2k == 1; - } - - static bool IsAtLeastWin2kSP4() - { -#ifdef __WXWINCE__ - return false; -#else - static int s_isAtLeastWin2kSP4 = -1; - - if ( s_isAtLeastWin2kSP4 == -1 ) - { - OSVERSIONINFOEX ver; - - memset(&ver, 0, sizeof(ver)); - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx((OSVERSIONINFO*)&ver); - - s_isAtLeastWin2kSP4 = - ((ver.dwMajorVersion > 5) || // Vista+ - (ver.dwMajorVersion == 5 && ver.dwMinorVersion > 0) || // XP/2003 - (ver.dwMajorVersion == 5 && ver.dwMinorVersion == 0 && - ver.wServicePackMajor >= 4)) // 2000 SP4+ - ? 1 : 0; - } - - return s_isAtLeastWin2kSP4 == 1; -#endif - } - - - // the code page we're working with - long m_CodePage; - - // cached result of GetMBNulLen(), set to 0 initially meaning - // "unknown" - size_t m_minMBCharWidth; -}; - -#endif // wxHAVE_WIN32_MB2WC - -// ============================================================================ -// Cocoa conversion classes -// ============================================================================ - -#if defined(__WXCOCOA__) - -// RN: There is no UTF-32 support in either Core Foundation or Cocoa. -// Strangely enough, internally Core Foundation uses -// UTF-32 internally quite a bit - its just not public (yet). - -#include -#include - -CFStringEncoding wxCFStringEncFromFontEnc(wxFontEncoding encoding) -{ - CFStringEncoding enc = kCFStringEncodingInvalidId ; - - switch (encoding) - { - case wxFONTENCODING_DEFAULT : - enc = CFStringGetSystemEncoding(); - break ; - - case wxFONTENCODING_ISO8859_1 : - enc = kCFStringEncodingISOLatin1 ; - break ; - case wxFONTENCODING_ISO8859_2 : - enc = kCFStringEncodingISOLatin2; - break ; - case wxFONTENCODING_ISO8859_3 : - enc = kCFStringEncodingISOLatin3 ; - break ; - case wxFONTENCODING_ISO8859_4 : - enc = kCFStringEncodingISOLatin4; - break ; - case wxFONTENCODING_ISO8859_5 : - enc = kCFStringEncodingISOLatinCyrillic; - break ; - case wxFONTENCODING_ISO8859_6 : - enc = kCFStringEncodingISOLatinArabic; - break ; - case wxFONTENCODING_ISO8859_7 : - enc = kCFStringEncodingISOLatinGreek; - break ; - case wxFONTENCODING_ISO8859_8 : - enc = kCFStringEncodingISOLatinHebrew; - break ; - case wxFONTENCODING_ISO8859_9 : - enc = kCFStringEncodingISOLatin5; - break ; - case wxFONTENCODING_ISO8859_10 : - enc = kCFStringEncodingISOLatin6; - break ; - case wxFONTENCODING_ISO8859_11 : - enc = kCFStringEncodingISOLatinThai; - break ; - case wxFONTENCODING_ISO8859_13 : - enc = kCFStringEncodingISOLatin7; - break ; - case wxFONTENCODING_ISO8859_14 : - enc = kCFStringEncodingISOLatin8; - break ; - case wxFONTENCODING_ISO8859_15 : - enc = kCFStringEncodingISOLatin9; - break ; - - case wxFONTENCODING_KOI8 : - enc = kCFStringEncodingKOI8_R; - break ; - case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866 - enc = kCFStringEncodingDOSRussian; - break ; - -// case wxFONTENCODING_BULGARIAN : -// enc = ; -// break ; - - case wxFONTENCODING_CP437 : - enc = kCFStringEncodingDOSLatinUS ; - break ; - case wxFONTENCODING_CP850 : - enc = kCFStringEncodingDOSLatin1; - break ; - case wxFONTENCODING_CP852 : - enc = kCFStringEncodingDOSLatin2; - break ; - case wxFONTENCODING_CP855 : - enc = kCFStringEncodingDOSCyrillic; - break ; - case wxFONTENCODING_CP866 : - enc = kCFStringEncodingDOSRussian ; - break ; - case wxFONTENCODING_CP874 : - enc = kCFStringEncodingDOSThai; - break ; - case wxFONTENCODING_CP932 : - enc = kCFStringEncodingDOSJapanese; - break ; - case wxFONTENCODING_CP936 : - enc = kCFStringEncodingDOSChineseSimplif ; - break ; - case wxFONTENCODING_CP949 : - enc = kCFStringEncodingDOSKorean; - break ; - case wxFONTENCODING_CP950 : - enc = kCFStringEncodingDOSChineseTrad; - break ; - case wxFONTENCODING_CP1250 : - enc = kCFStringEncodingWindowsLatin2; - break ; - case wxFONTENCODING_CP1251 : - enc = kCFStringEncodingWindowsCyrillic ; - break ; - case wxFONTENCODING_CP1252 : - enc = kCFStringEncodingWindowsLatin1 ; - break ; - case wxFONTENCODING_CP1253 : - enc = kCFStringEncodingWindowsGreek; - break ; - case wxFONTENCODING_CP1254 : - enc = kCFStringEncodingWindowsLatin5; - break ; - case wxFONTENCODING_CP1255 : - enc = kCFStringEncodingWindowsHebrew ; - break ; - case wxFONTENCODING_CP1256 : - enc = kCFStringEncodingWindowsArabic ; - break ; - case wxFONTENCODING_CP1257 : - enc = kCFStringEncodingWindowsBalticRim; - break ; -// This only really encodes to UTF7 (if that) evidently -// case wxFONTENCODING_UTF7 : -// enc = kCFStringEncodingNonLossyASCII ; -// break ; - case wxFONTENCODING_UTF8 : - enc = kCFStringEncodingUTF8 ; - break ; - case wxFONTENCODING_EUC_JP : - enc = kCFStringEncodingEUC_JP; - break ; - case wxFONTENCODING_UTF16 : - enc = kCFStringEncodingUnicode ; - break ; - case wxFONTENCODING_MACROMAN : - enc = kCFStringEncodingMacRoman ; - break ; - case wxFONTENCODING_MACJAPANESE : - enc = kCFStringEncodingMacJapanese ; - break ; - case wxFONTENCODING_MACCHINESETRAD : - enc = kCFStringEncodingMacChineseTrad ; - break ; - case wxFONTENCODING_MACKOREAN : - enc = kCFStringEncodingMacKorean ; - break ; - case wxFONTENCODING_MACARABIC : - enc = kCFStringEncodingMacArabic ; - break ; - case wxFONTENCODING_MACHEBREW : - enc = kCFStringEncodingMacHebrew ; - break ; - case wxFONTENCODING_MACGREEK : - enc = kCFStringEncodingMacGreek ; - break ; - case wxFONTENCODING_MACCYRILLIC : - enc = kCFStringEncodingMacCyrillic ; - break ; - case wxFONTENCODING_MACDEVANAGARI : - enc = kCFStringEncodingMacDevanagari ; - break ; - case wxFONTENCODING_MACGURMUKHI : - enc = kCFStringEncodingMacGurmukhi ; - break ; - case wxFONTENCODING_MACGUJARATI : - enc = kCFStringEncodingMacGujarati ; - break ; - case wxFONTENCODING_MACORIYA : - enc = kCFStringEncodingMacOriya ; - break ; - case wxFONTENCODING_MACBENGALI : - enc = kCFStringEncodingMacBengali ; - break ; - case wxFONTENCODING_MACTAMIL : - enc = kCFStringEncodingMacTamil ; - break ; - case wxFONTENCODING_MACTELUGU : - enc = kCFStringEncodingMacTelugu ; - break ; - case wxFONTENCODING_MACKANNADA : - enc = kCFStringEncodingMacKannada ; - break ; - case wxFONTENCODING_MACMALAJALAM : - enc = kCFStringEncodingMacMalayalam ; - break ; - case wxFONTENCODING_MACSINHALESE : - enc = kCFStringEncodingMacSinhalese ; - break ; - case wxFONTENCODING_MACBURMESE : - enc = kCFStringEncodingMacBurmese ; - break ; - case wxFONTENCODING_MACKHMER : - enc = kCFStringEncodingMacKhmer ; - break ; - case wxFONTENCODING_MACTHAI : - enc = kCFStringEncodingMacThai ; - break ; - case wxFONTENCODING_MACLAOTIAN : - enc = kCFStringEncodingMacLaotian ; - break ; - case wxFONTENCODING_MACGEORGIAN : - enc = kCFStringEncodingMacGeorgian ; - break ; - case wxFONTENCODING_MACARMENIAN : - enc = kCFStringEncodingMacArmenian ; - break ; - case wxFONTENCODING_MACCHINESESIMP : - enc = kCFStringEncodingMacChineseSimp ; - break ; - case wxFONTENCODING_MACTIBETAN : - enc = kCFStringEncodingMacTibetan ; - break ; - case wxFONTENCODING_MACMONGOLIAN : - enc = kCFStringEncodingMacMongolian ; - break ; - case wxFONTENCODING_MACETHIOPIC : - enc = kCFStringEncodingMacEthiopic ; - break ; - case wxFONTENCODING_MACCENTRALEUR : - enc = kCFStringEncodingMacCentralEurRoman ; - break ; - case wxFONTENCODING_MACVIATNAMESE : - enc = kCFStringEncodingMacVietnamese ; - break ; - case wxFONTENCODING_MACARABICEXT : - enc = kCFStringEncodingMacExtArabic ; - break ; - case wxFONTENCODING_MACSYMBOL : - enc = kCFStringEncodingMacSymbol ; - break ; - case wxFONTENCODING_MACDINGBATS : - enc = kCFStringEncodingMacDingbats ; - break ; - case wxFONTENCODING_MACTURKISH : - enc = kCFStringEncodingMacTurkish ; - break ; - case wxFONTENCODING_MACCROATIAN : - enc = kCFStringEncodingMacCroatian ; - break ; - case wxFONTENCODING_MACICELANDIC : - enc = kCFStringEncodingMacIcelandic ; - break ; - case wxFONTENCODING_MACROMANIAN : - enc = kCFStringEncodingMacRomanian ; - break ; - case wxFONTENCODING_MACCELTIC : - enc = kCFStringEncodingMacCeltic ; - break ; - case wxFONTENCODING_MACGAELIC : - enc = kCFStringEncodingMacGaelic ; - break ; -// case wxFONTENCODING_MACKEYBOARD : -// enc = kCFStringEncodingMacKeyboardGlyphs ; -// break ; - - default : - // because gcc is picky - break ; - } - - return enc ; -} - -class wxMBConv_cocoa : public wxMBConv -{ -public: - wxMBConv_cocoa() - { - Init(CFStringGetSystemEncoding()) ; - } - - wxMBConv_cocoa(const wxMBConv_cocoa& conv) - { - m_encoding = conv.m_encoding; - } - -#if wxUSE_FONTMAP - wxMBConv_cocoa(const wxChar* name) - { - Init( wxCFStringEncFromFontEnc(wxFontMapperBase::Get()->CharsetToEncoding(name, false) ) ) ; - } -#endif - - wxMBConv_cocoa(wxFontEncoding encoding) - { - Init( wxCFStringEncFromFontEnc(encoding) ); - } - - virtual ~wxMBConv_cocoa() - { - } - - void Init( CFStringEncoding encoding) - { - m_encoding = encoding ; - } - - size_t MB2WC(wchar_t * szOut, const char * szUnConv, size_t nOutSize) const - { - wxASSERT(szUnConv); - - CFStringRef theString = CFStringCreateWithBytes ( - NULL, //the allocator - (const UInt8*)szUnConv, - strlen(szUnConv), - m_encoding, - false //no BOM/external representation - ); - - wxASSERT(theString); - - size_t nOutLength = CFStringGetLength(theString); - - if (szOut == NULL) - { - CFRelease(theString); - return nOutLength; - } - - CFRange theRange = { 0, nOutSize }; - -#if SIZEOF_WCHAR_T == 4 - UniChar* szUniCharBuffer = new UniChar[nOutSize]; -#endif - - CFStringGetCharacters(theString, theRange, szUniCharBuffer); - - CFRelease(theString); - - szUniCharBuffer[nOutLength] = '\0'; - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter; - converter.MB2WC( szOut, (const char*)szUniCharBuffer, nOutSize ); - delete [] szUniCharBuffer; -#endif - - return nOutLength; - } - - size_t WC2MB(char *szOut, const wchar_t *szUnConv, size_t nOutSize) const - { - wxASSERT(szUnConv); - - size_t nRealOutSize; - size_t nBufSize = wxWcslen(szUnConv); - UniChar* szUniBuffer = (UniChar*) szUnConv; - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter ; - nBufSize = converter.WC2MB( NULL, szUnConv, 0 ); - szUniBuffer = new UniChar[ (nBufSize / sizeof(UniChar)) + 1]; - converter.WC2MB( (char*) szUniBuffer, szUnConv, nBufSize + sizeof(UniChar)); - nBufSize /= sizeof(UniChar); -#endif - - CFStringRef theString = CFStringCreateWithCharactersNoCopy( - NULL, //allocator - szUniBuffer, - nBufSize, - kCFAllocatorNull //deallocator - we want to deallocate it ourselves - ); - - wxASSERT(theString); - - //Note that CER puts a BOM when converting to unicode - //so we check and use getchars instead in that case - if (m_encoding == kCFStringEncodingUnicode) - { - if (szOut != NULL) - CFStringGetCharacters(theString, CFRangeMake(0, nOutSize - 1), (UniChar*) szOut); - - nRealOutSize = CFStringGetLength(theString) + 1; - } - else - { - CFStringGetBytes( - theString, - CFRangeMake(0, CFStringGetLength(theString)), - m_encoding, - 0, //what to put in characters that can't be converted - - //0 tells CFString to return NULL if it meets such a character - false, //not an external representation - (UInt8*) szOut, - nOutSize, - (CFIndex*) &nRealOutSize - ); - } - - CFRelease(theString); - -#if SIZEOF_WCHAR_T == 4 - delete[] szUniBuffer; -#endif - - return nRealOutSize - 1; - } - - virtual wxMBConv *Clone() const { return new wxMBConv_cocoa(*this); } - - bool IsOk() const - { - return m_encoding != kCFStringEncodingInvalidId && - CFStringIsEncodingAvailable(m_encoding); - } - -private: - CFStringEncoding m_encoding ; -}; - -#endif // defined(__WXCOCOA__) - -// ============================================================================ -// Mac conversion classes -// ============================================================================ - -#if defined(__WXMAC__) && defined(TARGET_CARBON) - -class wxMBConv_mac : public wxMBConv -{ -public: - wxMBConv_mac() - { - Init(CFStringGetSystemEncoding()) ; - } - - wxMBConv_mac(const wxMBConv_mac& conv) - { - Init(conv.m_char_encoding); - } - -#if wxUSE_FONTMAP - wxMBConv_mac(const wxChar* name) - { - wxFontEncoding enc = wxFontMapperBase::Get()->CharsetToEncoding(name, false); - Init( (enc != wxFONTENCODING_SYSTEM) ? wxMacGetSystemEncFromFontEnc( enc ) : kTextEncodingUnknown); - } -#endif - - wxMBConv_mac(wxFontEncoding encoding) - { - Init( wxMacGetSystemEncFromFontEnc(encoding) ); - } - - virtual ~wxMBConv_mac() - { - OSStatus status = noErr ; - if (m_MB2WC_converter) - status = TECDisposeConverter(m_MB2WC_converter); - if (m_WC2MB_converter) - status = TECDisposeConverter(m_WC2MB_converter); - } - - void Init( TextEncodingBase encoding,TextEncodingVariant encodingVariant = kTextEncodingDefaultVariant , - TextEncodingFormat encodingFormat = kTextEncodingDefaultFormat) - { - m_MB2WC_converter = NULL ; - m_WC2MB_converter = NULL ; - if ( encoding != kTextEncodingUnknown ) - { - m_char_encoding = CreateTextEncoding(encoding, encodingVariant, encodingFormat) ; - m_unicode_encoding = CreateTextEncoding(kTextEncodingUnicodeDefault, 0, kUnicode16BitFormat) ; - } - else - { - m_char_encoding = kTextEncodingUnknown; - m_unicode_encoding = kTextEncodingUnknown; - } - } - - virtual void CreateIfNeeded() const - { - if ( m_MB2WC_converter == NULL && m_WC2MB_converter == NULL && - m_char_encoding != kTextEncodingUnknown && m_unicode_encoding != kTextEncodingUnknown ) - { - OSStatus status = noErr ; - status = TECCreateConverter(&m_MB2WC_converter, - m_char_encoding, - m_unicode_encoding); - wxASSERT_MSG( status == noErr , _("Unable to create TextEncodingConverter")) ; - status = TECCreateConverter(&m_WC2MB_converter, - m_unicode_encoding, - m_char_encoding); - wxASSERT_MSG( status == noErr , _("Unable to create TextEncodingConverter")) ; - } - } - - size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const - { - CreateIfNeeded() ; - OSStatus status = noErr ; - ByteCount byteOutLen ; - ByteCount byteInLen = strlen(psz) + 1; - wchar_t *tbuf = NULL ; - UniChar* ubuf = NULL ; - size_t res = 0 ; - - if (buf == NULL) - { - // Apple specs say at least 32 - n = wxMax( 32, byteInLen ) ; - tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T ) ; - } - - ByteCount byteBufferLen = n * sizeof( UniChar ) ; - -#if SIZEOF_WCHAR_T == 4 - ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ; -#else - ubuf = (UniChar*) (buf ? buf : tbuf) ; -#endif - { -#if wxUSE_THREADS - wxMutexLocker lock( m_MB2WC_guard ); -#endif - status = TECConvertText( - m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen, - (TextPtr) ubuf, byteBufferLen, &byteOutLen); - } - -#if SIZEOF_WCHAR_T == 4 - // we have to terminate here, because n might be larger for the trailing zero, and if UniChar - // is not properly terminated we get random characters at the end - ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ; - wxMBConvUTF16 converter ; - res = converter.MB2WC( (buf ? buf : tbuf), (const char*)ubuf, n ) ; - free( ubuf ) ; -#else - res = byteOutLen / sizeof( UniChar ) ; -#endif - - if ( buf == NULL ) - free(tbuf) ; - - if ( buf && res < n) - buf[res] = 0; - - return res ; - } - - size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const - { - CreateIfNeeded() ; - OSStatus status = noErr ; - ByteCount byteOutLen ; - ByteCount byteInLen = wxWcslen(psz) * SIZEOF_WCHAR_T ; - - char *tbuf = NULL ; - - if (buf == NULL) - { - // Apple specs say at least 32 - n = wxMax( 32, ((byteInLen / SIZEOF_WCHAR_T) * 8) + SIZEOF_WCHAR_T ); - tbuf = (char*) malloc( n ) ; - } - - ByteCount byteBufferLen = n ; - UniChar* ubuf = NULL ; - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter ; - size_t unicharlen = converter.WC2MB( NULL, psz, 0 ) ; - byteInLen = unicharlen ; - ubuf = (UniChar*) malloc( byteInLen + 2 ) ; - converter.WC2MB( (char*) ubuf, psz, unicharlen + 2 ) ; -#else - ubuf = (UniChar*) psz ; -#endif - - { -#if wxUSE_THREADS - wxMutexLocker lock( m_WC2MB_guard ); -#endif - status = TECConvertText( - m_WC2MB_converter, (ConstTextPtr) ubuf, byteInLen, &byteInLen, - (TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen); - } - -#if SIZEOF_WCHAR_T == 4 - free( ubuf ) ; -#endif - - if ( buf == NULL ) - free(tbuf) ; - - size_t res = byteOutLen ; - if ( buf && res < n) - { - buf[res] = 0; - - //we need to double-trip to verify it didn't insert any ? in place - //of bogus characters - wxWCharBuffer wcBuf(n); - size_t pszlen = wxWcslen(psz); - if ( MB2WC(wcBuf.data(), buf, n) == wxCONV_FAILED || - wxWcslen(wcBuf) != pszlen || - memcmp(wcBuf, psz, pszlen * sizeof(wchar_t)) != 0 ) - { - // we didn't obtain the same thing we started from, hence - // the conversion was lossy and we consider that it failed - return wxCONV_FAILED; - } - } - - return res ; - } - - virtual wxMBConv *Clone() const { return new wxMBConv_mac(*this); } - - bool IsOk() const - { - CreateIfNeeded() ; - return m_MB2WC_converter != NULL && m_WC2MB_converter != NULL; - } - -protected : - mutable TECObjectRef m_MB2WC_converter; - mutable TECObjectRef m_WC2MB_converter; -#if wxUSE_THREADS - mutable wxMutex m_MB2WC_guard; - mutable wxMutex m_WC2MB_guard; -#endif - - TextEncodingBase m_char_encoding; - TextEncodingBase m_unicode_encoding; -}; - -// MB is decomposed (D) normalized UTF8 - -class wxMBConv_macUTF8D : public wxMBConv_mac -{ -public : - wxMBConv_macUTF8D() - { - Init( kTextEncodingUnicodeDefault , kUnicodeNoSubset , kUnicodeUTF8Format ) ; - m_uni = NULL; - m_uniBack = NULL ; - } - - virtual ~wxMBConv_macUTF8D() - { - if (m_uni!=NULL) - DisposeUnicodeToTextInfo(&m_uni); - if (m_uniBack!=NULL) - DisposeUnicodeToTextInfo(&m_uniBack); - } - - size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const - { - CreateIfNeeded() ; - OSStatus status = noErr ; - ByteCount byteOutLen ; - ByteCount byteInLen = wxWcslen(psz) * SIZEOF_WCHAR_T ; - - char *tbuf = NULL ; - - if (buf == NULL) - { - // Apple specs say at least 32 - n = wxMax( 32, ((byteInLen / SIZEOF_WCHAR_T) * 8) + SIZEOF_WCHAR_T ); - tbuf = (char*) malloc( n ) ; - } - - ByteCount byteBufferLen = n ; - UniChar* ubuf = NULL ; - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter ; - size_t unicharlen = converter.WC2MB( NULL, psz, 0 ) ; - byteInLen = unicharlen ; - ubuf = (UniChar*) malloc( byteInLen + 2 ) ; - converter.WC2MB( (char*) ubuf, psz, unicharlen + 2 ) ; -#else - ubuf = (UniChar*) psz ; -#endif - - // ubuf is a non-decomposed UniChar buffer - - ByteCount dcubuflen = byteInLen * 2 + 2 ; - ByteCount dcubufread , dcubufwritten ; - UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ; - - { -#if wxUSE_THREADS - wxMutexLocker lock( m_WC2MB_guard ); -#endif - ConvertFromUnicodeToText( m_uni , byteInLen , ubuf , - kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , dcubuf ) ; - - // we now convert that decomposed buffer into UTF8 - - status = TECConvertText( - m_WC2MB_converter, (ConstTextPtr) dcubuf, dcubufwritten, &dcubufread, - (TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen); - } - - free( dcubuf ); - -#if SIZEOF_WCHAR_T == 4 - free( ubuf ) ; -#endif - - if ( buf == NULL ) - free(tbuf) ; - - size_t res = byteOutLen ; - if ( buf && res < n) - { - buf[res] = 0; - // don't test for round-trip fidelity yet, we cannot guarantee it yet - } - - return res ; - } - - size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const - { - CreateIfNeeded() ; - OSStatus status = noErr ; - ByteCount byteOutLen ; - ByteCount byteInLen = strlen(psz) + 1; - wchar_t *tbuf = NULL ; - UniChar* ubuf = NULL ; - size_t res = 0 ; - - if (buf == NULL) - { - // Apple specs say at least 32 - n = wxMax( 32, byteInLen ) ; - tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T ) ; - } - - ByteCount byteBufferLen = n * sizeof( UniChar ) ; - -#if SIZEOF_WCHAR_T == 4 - ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ; -#else - ubuf = (UniChar*) (buf ? buf : tbuf) ; -#endif - - ByteCount dcubuflen = byteBufferLen * 2 + 2 ; - ByteCount dcubufread , dcubufwritten ; - UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ; - - { -#if wxUSE_THREADS - wxMutexLocker lock( m_MB2WC_guard ); -#endif - status = TECConvertText( - m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen, - (TextPtr) dcubuf, dcubuflen, &byteOutLen); - // we have to terminate here, because n might be larger for the trailing zero, and if UniChar - // is not properly terminated we get random characters at the end - dcubuf[byteOutLen / sizeof( UniChar ) ] = 0 ; - - // now from the decomposed UniChar to properly composed uniChar - ConvertFromUnicodeToText( m_uniBack , byteOutLen , dcubuf , - kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , ubuf ) ; - } - - free( dcubuf ); - byteOutLen = dcubufwritten ; - ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ; - - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter ; - res = converter.MB2WC( (buf ? buf : tbuf), (const char*)ubuf, n ) ; - free( ubuf ) ; -#else - res = byteOutLen / sizeof( UniChar ) ; -#endif - - if ( buf == NULL ) - free(tbuf) ; - - if ( buf && res < n) - buf[res] = 0; - - return res ; - } - - virtual void CreateIfNeeded() const - { - wxMBConv_mac::CreateIfNeeded() ; - if ( m_uni == NULL ) - { - m_map.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, - kUnicodeNoSubset, kTextEncodingDefaultFormat); - m_map.otherEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, - kUnicodeCanonicalDecompVariant, kTextEncodingDefaultFormat); - m_map.mappingVersion = kUnicodeUseLatestMapping; - - OSStatus err = CreateUnicodeToTextInfo(&m_map, &m_uni); - wxASSERT_MSG( err == noErr , _(" Couldn't create the UnicodeConverter")) ; - - m_map.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, - kUnicodeNoSubset, kTextEncodingDefaultFormat); - m_map.otherEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, - kUnicodeCanonicalCompVariant, kTextEncodingDefaultFormat); - m_map.mappingVersion = kUnicodeUseLatestMapping; - err = CreateUnicodeToTextInfo(&m_map, &m_uniBack); - wxASSERT_MSG( err == noErr , _(" Couldn't create the UnicodeConverter")) ; - } - } -protected : - mutable UnicodeToTextInfo m_uni; - mutable UnicodeToTextInfo m_uniBack; - mutable UnicodeMapping m_map; -}; -#endif // defined(__WXMAC__) && defined(TARGET_CARBON) - -// ============================================================================ -// wxEncodingConverter based conversion classes -// ============================================================================ - -#if wxUSE_FONTMAP - -class wxMBConv_wxwin : public wxMBConv -{ -private: - void Init() - { - m_ok = m2w.Init(m_enc, wxFONTENCODING_UNICODE) && - w2m.Init(wxFONTENCODING_UNICODE, m_enc); - } - -public: - // temporarily just use wxEncodingConverter stuff, - // so that it works while a better implementation is built - wxMBConv_wxwin(const wxChar* name) - { - if (name) - m_enc = wxFontMapperBase::Get()->CharsetToEncoding(name, false); - else - m_enc = wxFONTENCODING_SYSTEM; - - Init(); - } - - wxMBConv_wxwin(wxFontEncoding enc) - { - m_enc = enc; - - Init(); - } - - size_t MB2WC(wchar_t *buf, const char *psz, size_t WXUNUSED(n)) const - { - size_t inbuf = strlen(psz); - if (buf) - { - if (!m2w.Convert(psz, buf)) - return wxCONV_FAILED; - } - return inbuf; - } - - size_t WC2MB(char *buf, const wchar_t *psz, size_t WXUNUSED(n)) const - { - const size_t inbuf = wxWcslen(psz); - if (buf) - { - if (!w2m.Convert(psz, buf)) - return wxCONV_FAILED; - } - - return inbuf; - } - - virtual size_t GetMBNulLen() const - { - switch ( m_enc ) - { - case wxFONTENCODING_UTF16BE: - case wxFONTENCODING_UTF16LE: - return 2; - - case wxFONTENCODING_UTF32BE: - case wxFONTENCODING_UTF32LE: - return 4; - - default: - return 1; - } - } - - virtual wxMBConv *Clone() const { return new wxMBConv_wxwin(m_enc); } - - bool IsOk() const { return m_ok; } - -public: - wxFontEncoding m_enc; - wxEncodingConverter m2w, w2m; - -private: - // were we initialized successfully? - bool m_ok; - - DECLARE_NO_COPY_CLASS(wxMBConv_wxwin) -}; - -// make the constructors available for unit testing -WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name ) -{ - wxMBConv_wxwin* result = new wxMBConv_wxwin( name ); - if ( !result->IsOk() ) - { - delete result; - return 0; - } - - return result; -} - -#endif // wxUSE_FONTMAP - -// ============================================================================ -// wxCSConv implementation -// ============================================================================ - -void wxCSConv::Init() -{ - m_name = NULL; - m_convReal = NULL; - m_deferred = true; -} - -wxCSConv::wxCSConv(const wxChar *charset) -{ - Init(); - - if ( charset ) - { - SetName(charset); - } - -#if wxUSE_FONTMAP - m_encoding = wxFontMapperBase::GetEncodingFromName(charset); - if ( m_encoding == wxFONTENCODING_MAX ) - { - // set to unknown/invalid value - m_encoding = wxFONTENCODING_SYSTEM; - } - else if ( m_encoding == wxFONTENCODING_DEFAULT ) - { - // wxFONTENCODING_DEFAULT is same as US-ASCII in this context - m_encoding = wxFONTENCODING_ISO8859_1; - } -#else - m_encoding = wxFONTENCODING_SYSTEM; -#endif -} - -wxCSConv::wxCSConv(wxFontEncoding encoding) -{ - if ( encoding == wxFONTENCODING_MAX || encoding == wxFONTENCODING_DEFAULT ) - { - wxFAIL_MSG( _T("invalid encoding value in wxCSConv ctor") ); - - encoding = wxFONTENCODING_SYSTEM; - } - - Init(); - - m_encoding = encoding; -} - -wxCSConv::~wxCSConv() -{ - Clear(); -} - -wxCSConv::wxCSConv(const wxCSConv& conv) - : wxMBConv() -{ - Init(); - - SetName(conv.m_name); - m_encoding = conv.m_encoding; -} - -wxCSConv& wxCSConv::operator=(const wxCSConv& conv) -{ - Clear(); - - SetName(conv.m_name); - m_encoding = conv.m_encoding; - - return *this; -} - -void wxCSConv::Clear() -{ - free(m_name); - delete m_convReal; - - m_name = NULL; - m_convReal = NULL; -} - -void wxCSConv::SetName(const wxChar *charset) -{ - if (charset) - { - m_name = wxStrdup(charset); - m_deferred = true; - } -} - -#if wxUSE_FONTMAP - -WX_DECLARE_HASH_MAP( wxFontEncoding, wxString, wxIntegerHash, wxIntegerEqual, - wxEncodingNameCache ); - -static wxEncodingNameCache gs_nameCache; -#endif - -wxMBConv *wxCSConv::DoCreate() const -{ -#if wxUSE_FONTMAP - wxLogTrace(TRACE_STRCONV, - wxT("creating conversion for %s"), - (m_name ? m_name - : wxFontMapperBase::GetEncodingName(m_encoding).c_str())); -#endif // wxUSE_FONTMAP - - // check for the special case of ASCII or ISO8859-1 charset: as we have - // special knowledge of it anyhow, we don't need to create a special - // conversion object - if ( m_encoding == wxFONTENCODING_ISO8859_1 || - m_encoding == wxFONTENCODING_DEFAULT ) - { - // don't convert at all - return NULL; - } - - // we trust OS to do conversion better than we can so try external - // conversion methods first - // - // the full order is: - // 1. OS conversion (iconv() under Unix or Win32 API) - // 2. hard coded conversions for UTF - // 3. wxEncodingConverter as fall back - - // step (1) -#ifdef HAVE_ICONV -#if !wxUSE_FONTMAP - if ( m_name ) -#endif // !wxUSE_FONTMAP - { - wxString name(m_name); -#if wxUSE_FONTMAP - wxFontEncoding encoding(m_encoding); -#endif - - if ( !name.empty() ) - { - wxMBConv_iconv *conv = new wxMBConv_iconv(name); - if ( conv->IsOk() ) - return conv; - - delete conv; - -#if wxUSE_FONTMAP - encoding = - wxFontMapperBase::Get()->CharsetToEncoding(name, false); -#endif // wxUSE_FONTMAP - } -#if wxUSE_FONTMAP - { - const wxEncodingNameCache::iterator it = gs_nameCache.find(encoding); - if ( it != gs_nameCache.end() ) - { - if ( it->second.empty() ) - return NULL; - - wxMBConv_iconv *conv = new wxMBConv_iconv(it->second); - if ( conv->IsOk() ) - return conv; - - delete conv; - } - - const wxChar** names = wxFontMapperBase::GetAllEncodingNames(encoding); - // CS : in case this does not return valid names (eg for MacRoman) encoding - // got a 'failure' entry in the cache all the same, although it just has to - // be created using a different method, so only store failed iconv creation - // attempts (or perhaps we shoulnd't do this at all ?) - if ( names[0] != NULL ) - { - for ( ; *names; ++names ) - { - wxMBConv_iconv *conv = new wxMBConv_iconv(*names); - if ( conv->IsOk() ) - { - gs_nameCache[encoding] = *names; - return conv; - } - - delete conv; - } - - gs_nameCache[encoding] = _T(""); // cache the failure - } - } -#endif // wxUSE_FONTMAP - } -#endif // HAVE_ICONV - -#ifdef wxHAVE_WIN32_MB2WC - { -#if wxUSE_FONTMAP - wxMBConv_win32 *conv = m_name ? new wxMBConv_win32(m_name) - : new wxMBConv_win32(m_encoding); - if ( conv->IsOk() ) - return conv; - - delete conv; -#else - return NULL; -#endif - } -#endif // wxHAVE_WIN32_MB2WC - -#if defined(__WXMAC__) - { - // leave UTF16 and UTF32 to the built-ins of wx - if ( m_name || ( m_encoding < wxFONTENCODING_UTF16BE || - ( m_encoding >= wxFONTENCODING_MACMIN && m_encoding <= wxFONTENCODING_MACMAX ) ) ) - { -#if wxUSE_FONTMAP - wxMBConv_mac *conv = m_name ? new wxMBConv_mac(m_name) - : new wxMBConv_mac(m_encoding); -#else - wxMBConv_mac *conv = new wxMBConv_mac(m_encoding); -#endif - if ( conv->IsOk() ) - return conv; - - delete conv; - } - } -#endif - -#if defined(__WXCOCOA__) - { - if ( m_name || ( m_encoding <= wxFONTENCODING_UTF16 ) ) - { -#if wxUSE_FONTMAP - wxMBConv_cocoa *conv = m_name ? new wxMBConv_cocoa(m_name) - : new wxMBConv_cocoa(m_encoding); -#else - wxMBConv_cocoa *conv = new wxMBConv_cocoa(m_encoding); -#endif - - if ( conv->IsOk() ) - return conv; - - delete conv; - } - } -#endif - // step (2) - wxFontEncoding enc = m_encoding; -#if wxUSE_FONTMAP - if ( enc == wxFONTENCODING_SYSTEM && m_name ) - { - // use "false" to suppress interactive dialogs -- we can be called from - // anywhere and popping up a dialog from here is the last thing we want to - // do - enc = wxFontMapperBase::Get()->CharsetToEncoding(m_name, false); - } -#endif // wxUSE_FONTMAP - - switch ( enc ) - { - case wxFONTENCODING_UTF7: - return new wxMBConvUTF7; - - case wxFONTENCODING_UTF8: - return new wxMBConvUTF8; - - case wxFONTENCODING_UTF16BE: - return new wxMBConvUTF16BE; - - case wxFONTENCODING_UTF16LE: - return new wxMBConvUTF16LE; - - case wxFONTENCODING_UTF32BE: - return new wxMBConvUTF32BE; - - case wxFONTENCODING_UTF32LE: - return new wxMBConvUTF32LE; - - default: - // nothing to do but put here to suppress gcc warnings - break; - } - - // step (3) -#if wxUSE_FONTMAP - { - wxMBConv_wxwin *conv = m_name ? new wxMBConv_wxwin(m_name) - : new wxMBConv_wxwin(m_encoding); - if ( conv->IsOk() ) - return conv; - - delete conv; - } -#endif // wxUSE_FONTMAP - - // NB: This is a hack to prevent deadlock. What could otherwise happen - // in Unicode build: wxConvLocal creation ends up being here - // because of some failure and logs the error. But wxLog will try to - // attach a timestamp, for which it will need wxConvLocal (to convert - // time to char* and then wchar_t*), but that fails, tries to log the - // error, but wxLog has an (already locked) critical section that - // guards the static buffer. - static bool alreadyLoggingError = false; - if (!alreadyLoggingError) - { - alreadyLoggingError = true; - wxLogError(_("Cannot convert from the charset '%s'!"), - m_name ? m_name - : -#if wxUSE_FONTMAP - wxFontMapperBase::GetEncodingDescription(m_encoding).c_str() -#else // !wxUSE_FONTMAP - wxString::Format(_("encoding %i"), m_encoding).c_str() -#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP - ); - - alreadyLoggingError = false; - } - - return NULL; -} - -void wxCSConv::CreateConvIfNeeded() const -{ - if ( m_deferred ) - { - wxCSConv *self = (wxCSConv *)this; // const_cast - - // if we don't have neither the name nor the encoding, use the default - // encoding for this system - if ( !m_name && m_encoding == wxFONTENCODING_SYSTEM ) - { -#if wxUSE_INTL - self->m_encoding = wxLocale::GetSystemEncoding(); -#else - // fallback to some reasonable default: - self->m_encoding = wxFONTENCODING_ISO8859_1; -#endif // wxUSE_INTL - } - - self->m_convReal = DoCreate(); - self->m_deferred = false; - } -} - -bool wxCSConv::IsOk() const -{ - CreateConvIfNeeded(); - - // special case: no convReal created for wxFONTENCODING_ISO8859_1 - if ( m_encoding == wxFONTENCODING_ISO8859_1 ) - return true; // always ok as we do it ourselves - - // m_convReal->IsOk() is called at its own creation, so we know it must - // be ok if m_convReal is non-NULL - return m_convReal != NULL; -} - -size_t wxCSConv::ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen) const -{ - CreateConvIfNeeded(); - - if (m_convReal) - return m_convReal->ToWChar(dst, dstLen, src, srcLen); - - // latin-1 (direct) - if ( srcLen == wxNO_LEN ) - srcLen = strlen(src) + 1; // take trailing NUL too - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - for ( size_t n = 0; n < srcLen; n++ ) - dst[n] = (unsigned char)(src[n]); - } - - return srcLen; -} - -size_t wxCSConv::FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen) const -{ - CreateConvIfNeeded(); - - if (m_convReal) - return m_convReal->FromWChar(dst, dstLen, src, srcLen); - - // latin-1 (direct) - if ( srcLen == wxNO_LEN ) - srcLen = wxWcslen(src) + 1; - - if ( dst ) - { - if ( dstLen < srcLen ) - return wxCONV_FAILED; - - for ( size_t n = 0; n < srcLen; n++ ) - { - if ( src[n] > 0xFF ) - return wxCONV_FAILED; - - dst[n] = (char)src[n]; - } - - } - else // still need to check the input validity - { - for ( size_t n = 0; n < srcLen; n++ ) - { - if ( src[n] > 0xFF ) - return wxCONV_FAILED; - } - } - - return srcLen; -} - -size_t wxCSConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const -{ - // this function exists only for ABI-compatibility in 2.8 branch - return wxMBConv::MB2WC(buf, psz, n); -} - -size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const -{ - // this function exists only for ABI-compatibility in 2.8 branch - return wxMBConv::WC2MB(buf, psz, n); -} - -size_t wxCSConv::GetMBNulLen() const -{ - CreateConvIfNeeded(); - - if ( m_convReal ) - { - return m_convReal->GetMBNulLen(); - } - - return 1; -} - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -#ifdef __WINDOWS__ - static wxMBConv_win32 wxConvLibcObj; -#elif defined(__WXMAC__) && !defined(__MACH__) - static wxMBConv_mac wxConvLibcObj ; -#else - static wxMBConvLibc wxConvLibcObj; -#endif - -static wxCSConv wxConvLocalObj(wxFONTENCODING_SYSTEM); -static wxCSConv wxConvISO8859_1Obj(wxFONTENCODING_ISO8859_1); -static wxMBConvUTF7 wxConvUTF7Obj; -static wxMBConvUTF8 wxConvUTF8Obj; -#if defined(__WXMAC__) && defined(TARGET_CARBON) -static wxMBConv_macUTF8D wxConvMacUTF8DObj; -#endif -WXDLLIMPEXP_DATA_BASE(wxMBConv&) wxConvLibc = wxConvLibcObj; -WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal = wxConvLocalObj; -WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1 = wxConvISO8859_1Obj; -WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7 = wxConvUTF7Obj; -WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8 = wxConvUTF8Obj; -WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent = &wxConvLibcObj; -WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI = &wxConvLocal; -WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName = & -#ifdef __WXOSX__ -#if defined(__WXMAC__) && defined(TARGET_CARBON) - wxConvMacUTF8DObj; -#else - wxConvUTF8Obj; -#endif -#else // !__WXOSX__ - wxConvLibcObj; -#endif // __WXOSX__/!__WXOSX__ - -#if wxUSE_UNICODE - -wxWCharBuffer wxSafeConvertMB2WX(const char *s) -{ - if ( !s ) - return wxWCharBuffer(); - - wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s)); - if ( !wbuf ) - wbuf = wxConvUTF8.cMB2WX(s); - if ( !wbuf ) - wbuf = wxConvISO8859_1.cMB2WX(s); - - return wbuf; -} - -wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) -{ - if ( !ws ) - return wxCharBuffer(); - - wxCharBuffer buf(wxConvLibc.cWX2MB(ws)); - if ( !buf ) - buf = wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL).cWX2MB(ws); - - return buf; -} - -#endif // wxUSE_UNICODE - -#else // !wxUSE_WCHAR_T - -// stand-ins in absence of wchar_t -WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc, - wxConvISO8859_1, - wxConvLocal, - wxConvUTF8; - -WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent = NULL; - -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T diff --git a/Source/3rdParty/wx/src/common/stream.cpp b/Source/3rdParty/wx/src/common/stream.cpp deleted file mode 100644 index 27a9a7cc8..000000000 --- a/Source/3rdParty/wx/src/common/stream.cpp +++ /dev/null @@ -1,1388 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/stream.cpp -// Purpose: wxStream base classes -// Author: Guilhem Lavaux -// Modified by: VZ (23.11.00) to fix realloc()ing new[]ed memory, -// general code review -// Created: 11/07/98 -// RCS-ID: $Id: stream.cpp 51662 2008-02-11 20:23:29Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/stream.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" -#endif - -#include -#include "wx/datstrm.h" -#include "wx/textfile.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the temporary buffer size used when copying from stream to stream -#define BUF_TEMP_SIZE 4096 - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStreamBuffer -// ---------------------------------------------------------------------------- - -void wxStreamBuffer::SetError(wxStreamError err) -{ - if ( m_stream && m_stream->m_lasterror == wxSTREAM_NO_ERROR ) - m_stream->m_lasterror = err; -} - -void wxStreamBuffer::InitBuffer() -{ - m_buffer_start = - m_buffer_end = - m_buffer_pos = NULL; - m_buffer_size = 0; - - // if we are going to allocate the buffer, we should free it later as well - m_destroybuf = true; -} - -void wxStreamBuffer::Init() -{ - InitBuffer(); - - m_fixed = true; -} - -wxStreamBuffer::wxStreamBuffer(BufMode mode) -{ - Init(); - - m_stream = NULL; - m_mode = mode; - - m_flushable = false; -} - -wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode) -{ - Init(); - - m_stream = &stream; - m_mode = mode; - - m_flushable = true; -} - -wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer) -{ - // doing this has big chances to lead to a crash when the source buffer is - // destroyed (otherwise assume the caller knows what he does) - wxASSERT_MSG( !buffer.m_destroybuf, - _T("it's a bad idea to copy this buffer") ); - - m_buffer_start = buffer.m_buffer_start; - m_buffer_end = buffer.m_buffer_end; - m_buffer_pos = buffer.m_buffer_pos; - m_buffer_size = buffer.m_buffer_size; - m_fixed = buffer.m_fixed; - m_flushable = buffer.m_flushable; - m_stream = buffer.m_stream; - m_mode = buffer.m_mode; - m_destroybuf = false; -} - -void wxStreamBuffer::FreeBuffer() -{ - if ( m_destroybuf ) - { - free(m_buffer_start); - m_buffer_start = NULL; - } -} - -wxStreamBuffer::~wxStreamBuffer() -{ - FreeBuffer(); -} - -wxInputStream *wxStreamBuffer::GetInputStream() const -{ - return m_mode == write ? NULL : (wxInputStream *)m_stream; -} - -wxOutputStream *wxStreamBuffer::GetOutputStream() const -{ - return m_mode == read ? NULL : (wxOutputStream *)m_stream; -} - -void wxStreamBuffer::SetBufferIO(void *buffer_start, - void *buffer_end, - bool takeOwnership) -{ - SetBufferIO(buffer_start, (char *)buffer_end - (char *)buffer_start, - takeOwnership); -} - -void wxStreamBuffer::SetBufferIO(void *start, - size_t len, - bool takeOwnership) -{ - // start by freeing the old buffer - FreeBuffer(); - - m_buffer_start = (char *)start; - m_buffer_end = m_buffer_start + len; - - m_buffer_size = len; - - // if we own it, we free it - m_destroybuf = takeOwnership; - - ResetBuffer(); -} - -void wxStreamBuffer::SetBufferIO(size_t bufsize) -{ - if ( bufsize ) - { - // this will free the old buffer and allocate the new one - SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */); - } - else // no buffer size => no buffer - { - // still free the old one - FreeBuffer(); - InitBuffer(); - } -} - -void wxStreamBuffer::ResetBuffer() -{ - if ( m_stream ) - { - m_stream->Reset(); - m_stream->m_lastcount = 0; - } - - m_buffer_pos = m_mode == read && m_flushable - ? m_buffer_end - : m_buffer_start; -} - -// fill the buffer with as much data as possible (only for read buffers) -bool wxStreamBuffer::FillBuffer() -{ - wxInputStream *inStream = GetInputStream(); - - // It's legal to have no stream, so we don't complain about it just return false - if ( !inStream ) - return false; - - size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size); - if ( !count ) - return false; - - m_buffer_end = m_buffer_start + count; - m_buffer_pos = m_buffer_start; - - return true; -} - -// write the buffer contents to the stream (only for write buffers) -bool wxStreamBuffer::FlushBuffer() -{ - wxCHECK_MSG( m_flushable, false, _T("can't flush this buffer") ); - - // FIXME: what is this check for? (VZ) - if ( m_buffer_pos == m_buffer_start ) - return false; - - wxOutputStream *outStream = GetOutputStream(); - - wxCHECK_MSG( outStream, false, _T("should have a stream in wxStreamBuffer") ); - - size_t current = m_buffer_pos - m_buffer_start; - size_t count = outStream->OnSysWrite(m_buffer_start, current); - if ( count != current ) - return false; - - m_buffer_pos = m_buffer_start; - - return true; -} - -size_t wxStreamBuffer::GetDataLeft() -{ - /* Why is this done? RR. */ - if ( m_buffer_pos == m_buffer_end && m_flushable) - FillBuffer(); - - return GetBytesLeft(); -} - -// copy up to size bytes from our buffer into the provided one -void wxStreamBuffer::GetFromBuffer(void *buffer, size_t size) -{ - // don't get more bytes than left in the buffer - size_t left = GetBytesLeft(); - - if ( size > left ) - size = left; - - memcpy(buffer, m_buffer_pos, size); - m_buffer_pos += size; -} - -// copy the contents of the provided buffer into this one -void wxStreamBuffer::PutToBuffer(const void *buffer, size_t size) -{ - size_t left = GetBytesLeft(); - - if ( size > left ) - { - if ( m_fixed ) - { - // we can't realloc the buffer, so just copy what we can - size = left; - } - else // !m_fixed - { - // realloc the buffer to have enough space for the data - size_t delta = m_buffer_pos - m_buffer_start; - - char *startOld = m_buffer_start; - m_buffer_size += size; - m_buffer_start = (char *)realloc(m_buffer_start, m_buffer_size); - if ( !m_buffer_start ) - { - // don't leak memory if realloc() failed - m_buffer_start = startOld; - m_buffer_size -= size; - - // what else can we do? - return; - } - - // adjust the pointers invalidated by realloc() - m_buffer_pos = m_buffer_start + delta; - m_buffer_end = m_buffer_start + m_buffer_size; - } - } - - memcpy(m_buffer_pos, buffer, size); - m_buffer_pos += size; -} - -void wxStreamBuffer::PutChar(char c) -{ - wxOutputStream *outStream = GetOutputStream(); - - wxCHECK_RET( outStream, _T("should have a stream in wxStreamBuffer") ); - - // if we don't have buffer at all, just forward this call to the stream, - if ( !HasBuffer() ) - { - outStream->OnSysWrite(&c, sizeof(c)); - } - else - { - // otherwise check we have enough space left - if ( !GetDataLeft() && !FlushBuffer() ) - { - // we don't - SetError(wxSTREAM_WRITE_ERROR); - } - else - { - PutToBuffer(&c, sizeof(c)); - m_stream->m_lastcount = 1; - } - } -} - -char wxStreamBuffer::Peek() -{ - wxCHECK_MSG( m_stream && HasBuffer(), 0, - _T("should have the stream and the buffer in wxStreamBuffer") ); - - if ( !GetDataLeft() ) - { - SetError(wxSTREAM_READ_ERROR); - return 0; - } - - char c; - GetFromBuffer(&c, sizeof(c)); - m_buffer_pos--; - - return c; -} - -char wxStreamBuffer::GetChar() -{ - wxInputStream *inStream = GetInputStream(); - - wxCHECK_MSG( inStream, 0, _T("should have a stream in wxStreamBuffer") ); - - char c; - if ( !HasBuffer() ) - { - inStream->OnSysRead(&c, sizeof(c)); - } - else - { - if ( !GetDataLeft() ) - { - SetError(wxSTREAM_READ_ERROR); - c = 0; - } - else - { - GetFromBuffer(&c, sizeof(c)); - m_stream->m_lastcount = 1; - } - } - - return c; -} - -size_t wxStreamBuffer::Read(void *buffer, size_t size) -{ - wxASSERT_MSG( buffer, _T("Warning: Null pointer is about to be used") ); - - /* Clear buffer first */ - memset(buffer, 0x00, size); - - // lasterror is reset before all new IO calls - if ( m_stream ) - m_stream->Reset(); - - size_t readBytes; - if ( !HasBuffer() ) - { - wxInputStream *inStream = GetInputStream(); - - wxCHECK_MSG( inStream, 0, _T("should have a stream in wxStreamBuffer") ); - - readBytes = inStream->OnSysRead(buffer, size); - } - else // we have a buffer, use it - { - size_t orig_size = size; - - while ( size > 0 ) - { - size_t left = GetDataLeft(); - - // if the requested number of bytes if greater than the buffer - // size, read data in chunks - if ( size > left ) - { - GetFromBuffer(buffer, left); - size -= left; - buffer = (char *)buffer + left; - - if ( !FillBuffer() ) - { - SetError(wxSTREAM_EOF); - break; - } - } - else // otherwise just do it in one gulp - { - GetFromBuffer(buffer, size); - size = 0; - } - } - - readBytes = orig_size - size; - } - - if ( m_stream ) - m_stream->m_lastcount = readBytes; - - return readBytes; -} - -// this should really be called "Copy()" -size_t wxStreamBuffer::Read(wxStreamBuffer *dbuf) -{ - wxCHECK_MSG( m_mode != write, 0, _T("can't read from this buffer") ); - - char buf[BUF_TEMP_SIZE]; - size_t nRead, - total = 0; - - do - { - nRead = Read(buf, WXSIZEOF(buf)); - if ( nRead ) - { - nRead = dbuf->Write(buf, nRead); - total += nRead; - } - } - while ( nRead ); - - return total; -} - -size_t wxStreamBuffer::Write(const void *buffer, size_t size) -{ - wxASSERT_MSG( buffer, _T("Warning: Null pointer is about to be send") ); - - if (m_stream) - { - // lasterror is reset before all new IO calls - m_stream->Reset(); - } - - size_t ret; - - if ( !HasBuffer() && m_fixed ) - { - wxOutputStream *outStream = GetOutputStream(); - - wxCHECK_MSG( outStream, 0, _T("should have a stream in wxStreamBuffer") ); - - // no buffer, just forward the call to the stream - ret = outStream->OnSysWrite(buffer, size); - } - else // we [may] have a buffer, use it - { - size_t orig_size = size; - - while ( size > 0 ) - { - size_t left = GetBytesLeft(); - - // if the buffer is too large to fit in the stream buffer, split - // it in smaller parts - // - // NB: If stream buffer isn't fixed (as for wxMemoryOutputStream), - // we always go to the second case. - // - // FIXME: fine, but if it fails we should (re)try writing it by - // chunks as this will (hopefully) always work (VZ) - - if ( size > left && m_fixed ) - { - PutToBuffer(buffer, left); - size -= left; - buffer = (char *)buffer + left; - - if ( !FlushBuffer() ) - { - SetError(wxSTREAM_WRITE_ERROR); - - break; - } - - m_buffer_pos = m_buffer_start; - } - else // we can do it in one gulp - { - PutToBuffer(buffer, size); - size = 0; - } - } - - ret = orig_size - size; - } - - if (m_stream) - { - // i am not entirely sure what we do this for - m_stream->m_lastcount = ret; - } - - return ret; -} - -size_t wxStreamBuffer::Write(wxStreamBuffer *sbuf) -{ - wxCHECK_MSG( m_mode != read, 0, _T("can't write to this buffer") ); - wxCHECK_MSG( sbuf->m_mode != write, 0, _T("can't read from that buffer") ); - - char buf[BUF_TEMP_SIZE]; - size_t nWrite, - total = 0; - - do - { - size_t nRead = sbuf->Read(buf, WXSIZEOF(buf)); - if ( nRead ) - { - nWrite = Write(buf, nRead); - if ( nWrite < nRead ) - { - // put back data we couldn't copy - wxInputStream *in_stream = (wxInputStream *)sbuf->GetStream(); - - in_stream->Ungetch(buf + nWrite, nRead - nWrite); - } - - total += nWrite; - } - else - { - nWrite = 0; - } - } - while ( nWrite == WXSIZEOF(buf) ); - - return total; -} - -wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode) -{ - wxFileOffset ret_off, diff; - - wxFileOffset last_access = GetLastAccess(); - - if ( !m_flushable ) - { - switch (mode) - { - case wxFromStart: - diff = pos; - break; - - case wxFromCurrent: - diff = pos + GetIntPosition(); - break; - - case wxFromEnd: - diff = pos + last_access; - break; - - default: - wxFAIL_MSG( _T("invalid seek mode") ); - - return wxInvalidOffset; - } - if (diff < 0 || diff > last_access) - return wxInvalidOffset; - size_t int_diff = wx_truncate_cast(size_t, diff); - wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") ); - SetIntPosition(int_diff); - return diff; - } - - switch ( mode ) - { - case wxFromStart: - // We'll try to compute an internal position later ... - ret_off = m_stream->OnSysSeek(pos, wxFromStart); - ResetBuffer(); - return ret_off; - - case wxFromCurrent: - diff = pos + GetIntPosition(); - - if ( (diff > last_access) || (diff < 0) ) - { - // We must take into account the fact that we have read - // something previously. - ret_off = m_stream->OnSysSeek(diff-last_access, wxFromCurrent); - ResetBuffer(); - return ret_off; - } - else - { - size_t int_diff = wx_truncate_cast(size_t, diff); - wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") ); - SetIntPosition(int_diff); - return pos; - } - - case wxFromEnd: - // Hard to compute: always seek to the requested position. - ret_off = m_stream->OnSysSeek(pos, wxFromEnd); - ResetBuffer(); - return ret_off; - } - - return wxInvalidOffset; -} - -wxFileOffset wxStreamBuffer::Tell() const -{ - wxFileOffset pos; - - // ask the stream for position if we have a real one - if ( m_stream ) - { - pos = m_stream->OnSysTell(); - if ( pos == wxInvalidOffset ) - return wxInvalidOffset; - } - else // no associated stream - { - pos = 0; - } - - pos += GetIntPosition(); - - if ( m_mode == read && m_flushable ) - pos -= GetLastAccess(); - - return pos; -} - -// ---------------------------------------------------------------------------- -// wxStreamBase -// ---------------------------------------------------------------------------- - -wxStreamBase::wxStreamBase() -{ - m_lasterror = wxSTREAM_NO_ERROR; - m_lastcount = 0; -} - -wxStreamBase::~wxStreamBase() -{ -} - -size_t wxStreamBase::GetSize() const -{ - wxFileOffset length = GetLength(); - if ( length == (wxFileOffset)wxInvalidOffset ) - return 0; - - const size_t len = wx_truncate_cast(size_t, length); - wxASSERT_MSG( len == length + size_t(0), _T("large files not supported") ); - - return len; -} - -wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode)) -{ - return wxInvalidOffset; -} - -wxFileOffset wxStreamBase::OnSysTell() const -{ - return wxInvalidOffset; -} - -// ---------------------------------------------------------------------------- -// wxInputStream -// ---------------------------------------------------------------------------- - -wxInputStream::wxInputStream() -{ - m_wback = NULL; - m_wbacksize = - m_wbackcur = 0; -} - -wxInputStream::~wxInputStream() -{ - free(m_wback); -} - -bool wxInputStream::CanRead() const -{ - // we don't know if there is anything to read or not and by default we - // prefer to be optimistic and try to read data unless we know for sure - // there is no more of it - return m_lasterror != wxSTREAM_EOF; -} - -bool wxInputStream::Eof() const -{ - // the only way the base class can know we're at EOF is when we'd already - // tried to read beyond it in which case last error is set accordingly - return GetLastError() == wxSTREAM_EOF; -} - -char *wxInputStream::AllocSpaceWBack(size_t needed_size) -{ - // get number of bytes left from previous wback buffer - size_t toget = m_wbacksize - m_wbackcur; - - // allocate a buffer large enough to hold prev + new data - char *temp_b = (char *)malloc(needed_size + toget); - - if (!temp_b) - return NULL; - - // copy previous data (and free old buffer) if needed - if (m_wback) - { - memmove(temp_b + needed_size, m_wback + m_wbackcur, toget); - free(m_wback); - } - - // done - m_wback = temp_b; - m_wbackcur = 0; - m_wbacksize = needed_size + toget; - - return m_wback; -} - -size_t wxInputStream::GetWBack(void *buf, size_t size) -{ - wxASSERT_MSG( buf, _T("Warning: Null pointer is about to be used") ); - - /* Clear buffer first */ - memset(buf, 0x00, size); - - if (!m_wback) - return 0; - - // how many bytes do we have in the buffer? - size_t toget = m_wbacksize - m_wbackcur; - - if ( size < toget ) - { - // we won't read everything - toget = size; - } - - // copy the data from the cache - memcpy(buf, m_wback + m_wbackcur, toget); - - m_wbackcur += toget; - if ( m_wbackcur == m_wbacksize ) - { - // TODO: should we really free it here all the time? maybe keep it? - free(m_wback); - m_wback = NULL; - m_wbacksize = 0; - m_wbackcur = 0; - } - - // return the number of bytes copied - return toget; -} - -size_t wxInputStream::Ungetch(const void *buf, size_t bufsize) -{ - wxASSERT_MSG( buf, _T("Warning: Null pointer is about to be used in Ungetch()") ); - - if ( m_lasterror != wxSTREAM_NO_ERROR && m_lasterror != wxSTREAM_EOF ) - { - // can't operate on this stream until the error is cleared - return 0; - } - - char *ptrback = AllocSpaceWBack(bufsize); - if (!ptrback) - return 0; - - // Eof() shouldn't return true any longer - if ( m_lasterror == wxSTREAM_EOF ) - m_lasterror = wxSTREAM_NO_ERROR; - - memcpy(ptrback, buf, bufsize); - return bufsize; -} - -bool wxInputStream::Ungetch(char c) -{ - return Ungetch(&c, sizeof(c)) != 0; -} - -int wxInputStream::GetC() -{ - unsigned char c; - Read(&c, sizeof(c)); - return LastRead() ? c : wxEOF; -} - -wxInputStream& wxInputStream::Read(void *buf, size_t size) -{ - wxASSERT_MSG( buf, _T("Warning: Null pointer is about to be read") ); - - char *p = (char *)buf; - m_lastcount = 0; - - size_t read = GetWBack(buf, size); - for ( ;; ) - { - size -= read; - m_lastcount += read; - p += read; - - if ( !size ) - { - // we read the requested amount of data - break; - } - - if ( p != buf && !CanRead() ) - { - // we have already read something and we would block in OnSysRead() - // now: don't do it but return immediately - break; - } - - read = OnSysRead(p, size); - if ( !read ) - { - // no more data available - break; - } - } - - return *this; -} - -char wxInputStream::Peek() -{ - char c; - Read(&c, sizeof(c)); - if (m_lasterror == wxSTREAM_NO_ERROR) - { - Ungetch(c); - return c; - } - - return 0; -} - -wxInputStream& wxInputStream::Read(wxOutputStream& stream_out) -{ - size_t lastcount = 0; - char buf[BUF_TEMP_SIZE]; - - for ( ;; ) - { - size_t bytes_read = Read(buf, WXSIZEOF(buf)).LastRead(); - if ( !bytes_read ) - break; - - if ( stream_out.Write(buf, bytes_read).LastWrite() != bytes_read ) - break; - - lastcount += bytes_read; - } - - m_lastcount = lastcount; - - return *this; -} - -wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) -{ - // RR: This code is duplicated in wxBufferedInputStream. This is - // not really a good design, but buffered stream are different - // from all other in that they handle two stream-related objects, - // the stream buffer and parent stream. - - // I don't know whether it should be put as well in wxFileInputStream::OnSysSeek - if (m_lasterror==wxSTREAM_EOF) - m_lasterror=wxSTREAM_NO_ERROR; - - /* RR: A call to SeekI() will automatically invalidate any previous - call to Ungetch(), otherwise it would be possible to SeekI() to - one position, unread some bytes there, SeekI() to another position - and the data would be corrupted. - - GRG: Could add code here to try to navigate within the wback - buffer if possible, but is it really needed? It would only work - when seeking in wxFromCurrent mode, else it would invalidate - anyway... */ - - if (m_wback) - { - wxLogDebug( wxT("Seeking in stream which has data written back to it.") ); - - free(m_wback); - m_wback = NULL; - m_wbacksize = 0; - m_wbackcur = 0; - } - - return OnSysSeek(pos, mode); -} - -wxFileOffset wxInputStream::TellI() const -{ - wxFileOffset pos = OnSysTell(); - - if (pos != wxInvalidOffset) - pos -= (m_wbacksize - m_wbackcur); - - return pos; -} - - -// ---------------------------------------------------------------------------- -// wxOutputStream -// ---------------------------------------------------------------------------- - -wxOutputStream::wxOutputStream() -{ -} - -wxOutputStream::~wxOutputStream() -{ -} - -size_t wxOutputStream::OnSysWrite(const void * WXUNUSED(buffer), - size_t WXUNUSED(bufsize)) -{ - return 0; -} - -void wxOutputStream::PutC(char c) -{ - Write(&c, sizeof(c)); -} - -wxOutputStream& wxOutputStream::Write(const void *buffer, size_t size) -{ - m_lastcount = OnSysWrite(buffer, size); - return *this; -} - -wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in) -{ - stream_in.Read(*this); - return *this; -} - -wxFileOffset wxOutputStream::TellO() const -{ - return OnSysTell(); -} - -wxFileOffset wxOutputStream::SeekO(wxFileOffset pos, wxSeekMode mode) -{ - return OnSysSeek(pos, mode); -} - -void wxOutputStream::Sync() -{ -} - - -// ---------------------------------------------------------------------------- -// wxCountingOutputStream -// ---------------------------------------------------------------------------- - -wxCountingOutputStream::wxCountingOutputStream () -{ - m_currentPos = 0; -} - -wxFileOffset wxCountingOutputStream::GetLength() const -{ - return m_lastcount; -} - -size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer), - size_t size) -{ - m_currentPos += size; - if (m_currentPos > m_lastcount) - m_lastcount = m_currentPos; - - return m_currentPos; -} - -wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - ssize_t new_pos = wx_truncate_cast(ssize_t, pos); - - switch ( mode ) - { - case wxFromStart: - wxCHECK_MSG( (wxFileOffset)new_pos == pos, wxInvalidOffset, wxT("huge position not supported") ); - break; - - case wxFromEnd: - new_pos = m_lastcount + new_pos; - wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_lastcount + pos), wxInvalidOffset, wxT("huge position not supported") ); - break; - - case wxFromCurrent: - new_pos = m_currentPos + new_pos; - wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_currentPos + pos), wxInvalidOffset, wxT("huge position not supported") ); - break; - - default: - wxFAIL_MSG( _T("invalid seek mode") ); - return wxInvalidOffset; - } - - m_currentPos = new_pos; - - if (m_currentPos > m_lastcount) - m_lastcount = m_currentPos; - - return m_currentPos; -} - -wxFileOffset wxCountingOutputStream::OnSysTell() const -{ - return m_currentPos; -} - -// ---------------------------------------------------------------------------- -// wxFilterInputStream -// ---------------------------------------------------------------------------- - -wxFilterInputStream::wxFilterInputStream() - : m_parent_i_stream(NULL), - m_owns(false) -{ -} - -wxFilterInputStream::wxFilterInputStream(wxInputStream& stream) - : m_parent_i_stream(&stream), - m_owns(false) -{ -} - -wxFilterInputStream::wxFilterInputStream(wxInputStream *stream) - : m_parent_i_stream(stream), - m_owns(true) -{ -} - -wxFilterInputStream::~wxFilterInputStream() -{ - if (m_owns) - delete m_parent_i_stream; -} - -// ---------------------------------------------------------------------------- -// wxFilterOutputStream -// ---------------------------------------------------------------------------- - -wxFilterOutputStream::wxFilterOutputStream() - : m_parent_o_stream(NULL), - m_owns(false) -{ -} - -wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream) - : m_parent_o_stream(&stream), - m_owns(false) -{ -} - -wxFilterOutputStream::wxFilterOutputStream(wxOutputStream *stream) - : m_parent_o_stream(stream), - m_owns(true) -{ -} - -bool wxFilterOutputStream::Close() -{ - if (m_parent_o_stream && m_owns) - return m_parent_o_stream->Close(); - else - return true; -} - -wxFilterOutputStream::~wxFilterOutputStream() -{ - if (m_owns) - delete m_parent_o_stream; -} - -// ---------------------------------------------------------------------------- -// wxFilterClassFactoryBase -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactoryBase, wxObject) - -wxString wxFilterClassFactoryBase::PopExtension(const wxString& location) const -{ - return location.substr(0, FindExtension(location)); -} - -wxString::size_type wxFilterClassFactoryBase::FindExtension( - const wxChar *location) const -{ - size_t len = wxStrlen(location); - - for (const wxChar *const *p = GetProtocols(wxSTREAM_FILEEXT); *p; p++) - { - size_t l = wxStrlen(*p); - - if (l <= len && wxStrcmp(*p, location + len - l) == 0) - return len - l; - } - - return wxString::npos; -} - -bool wxFilterClassFactoryBase::CanHandle(const wxChar *protocol, - wxStreamProtocolType type) const -{ - if (type == wxSTREAM_FILEEXT) - return FindExtension(protocol) != wxString::npos; - else - for (const wxChar *const *p = GetProtocols(type); *p; p++) - if (wxStrcmp(*p, protocol) == 0) - return true; - - return false; -} - -// ---------------------------------------------------------------------------- -// wxFilterClassFactory -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxFilterClassFactoryBase) - -wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL; - -void wxFilterClassFactory::Remove() -{ - if (m_next != this) - { - wxFilterClassFactory **pp = &sm_first; - - while (*pp != this) - pp = &(*pp)->m_next; - - *pp = m_next; - - m_next = this; - } -} - -// ---------------------------------------------------------------------------- -// wxBufferedInputStream -// ---------------------------------------------------------------------------- - -wxBufferedInputStream::wxBufferedInputStream(wxInputStream& s, - wxStreamBuffer *buffer) - : wxFilterInputStream(s) -{ - if ( buffer ) - { - // use the buffer provided by the user - m_i_streambuf = buffer; - } - else // create a default buffer - { - m_i_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::read); - - m_i_streambuf->SetBufferIO(1024); - } -} - -wxBufferedInputStream::~wxBufferedInputStream() -{ - m_parent_i_stream->SeekI(-(wxFileOffset)m_i_streambuf->GetBytesLeft(), - wxFromCurrent); - - delete m_i_streambuf; -} - -char wxBufferedInputStream::Peek() -{ - return m_i_streambuf->Peek(); -} - -wxInputStream& wxBufferedInputStream::Read(void *buf, size_t size) -{ - // reset the error flag - Reset(); - - // first read from the already cached data - m_lastcount = GetWBack(buf, size); - - // do we have to read anything more? - if ( m_lastcount < size ) - { - size -= m_lastcount; - buf = (char *)buf + m_lastcount; - - // the call to wxStreamBuffer::Read() below may reset our m_lastcount - // (but it also may not do it if the buffer is associated to another - // existing stream and wasn't created by us), so save it - size_t countOld = m_lastcount; - - // the new count of the bytes read is the count of bytes read this time - m_lastcount = m_i_streambuf->Read(buf, size); - - // plus those we had read before - m_lastcount += countOld; - } - - return *this; -} - -wxFileOffset wxBufferedInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) -{ - // RR: Look at wxInputStream for comments. - - if (m_lasterror==wxSTREAM_EOF) - Reset(); - - if (m_wback) - { - wxLogDebug( wxT("Seeking in stream which has data written back to it.") ); - - free(m_wback); - m_wback = NULL; - m_wbacksize = 0; - m_wbackcur = 0; - } - - return m_i_streambuf->Seek(pos, mode); -} - -wxFileOffset wxBufferedInputStream::TellI() const -{ - wxFileOffset pos = m_i_streambuf->Tell(); - - if (pos != wxInvalidOffset) - pos -= (m_wbacksize - m_wbackcur); - - return pos; -} - -size_t wxBufferedInputStream::OnSysRead(void *buffer, size_t bufsize) -{ - return m_parent_i_stream->Read(buffer, bufsize).LastRead(); -} - -wxFileOffset wxBufferedInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) -{ - return m_parent_i_stream->SeekI(seek, mode); -} - -wxFileOffset wxBufferedInputStream::OnSysTell() const -{ - return m_parent_i_stream->TellI(); -} - -void wxBufferedInputStream::SetInputStreamBuffer(wxStreamBuffer *buffer) -{ - wxCHECK_RET( buffer, _T("wxBufferedInputStream needs buffer") ); - - delete m_i_streambuf; - m_i_streambuf = buffer; -} - -// ---------------------------------------------------------------------------- -// wxBufferedOutputStream -// ---------------------------------------------------------------------------- - -wxBufferedOutputStream::wxBufferedOutputStream(wxOutputStream& s, - wxStreamBuffer *buffer) - : wxFilterOutputStream(s) -{ - if ( buffer ) - { - m_o_streambuf = buffer; - } - else // create a default one - { - m_o_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::write); - - m_o_streambuf->SetBufferIO(1024); - } -} - -wxBufferedOutputStream::~wxBufferedOutputStream() -{ - Sync(); - delete m_o_streambuf; -} - -bool wxBufferedOutputStream::Close() -{ - Sync(); - return IsOk(); -} - - -wxOutputStream& wxBufferedOutputStream::Write(const void *buffer, size_t size) -{ - m_lastcount = 0; - m_o_streambuf->Write(buffer, size); - return *this; -} - -wxFileOffset wxBufferedOutputStream::SeekO(wxFileOffset pos, wxSeekMode mode) -{ - Sync(); - return m_o_streambuf->Seek(pos, mode); -} - -wxFileOffset wxBufferedOutputStream::TellO() const -{ - return m_o_streambuf->Tell(); -} - -void wxBufferedOutputStream::Sync() -{ - m_o_streambuf->FlushBuffer(); - m_parent_o_stream->Sync(); -} - -size_t wxBufferedOutputStream::OnSysWrite(const void *buffer, size_t bufsize) -{ - return m_parent_o_stream->Write(buffer, bufsize).LastWrite(); -} - -wxFileOffset wxBufferedOutputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) -{ - return m_parent_o_stream->SeekO(seek, mode); -} - -wxFileOffset wxBufferedOutputStream::OnSysTell() const -{ - return m_parent_o_stream->TellO(); -} - -wxFileOffset wxBufferedOutputStream::GetLength() const -{ - return m_parent_o_stream->GetLength() + m_o_streambuf->GetIntPosition(); -} - -void wxBufferedOutputStream::SetOutputStreamBuffer(wxStreamBuffer *buffer) -{ - wxCHECK_RET( buffer, _T("wxBufferedOutputStream needs buffer") ); - - delete m_o_streambuf; - m_o_streambuf = buffer; -} - -// ---------------------------------------------------------------------------- -// Some IOManip function -// ---------------------------------------------------------------------------- - -wxOutputStream& wxEndL(wxOutputStream& stream) -{ - static const wxChar *eol = wxTextFile::GetEOL(); - - return stream.Write(eol, wxStrlen(eol)); -} - -#endif // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/string.cpp b/Source/3rdParty/wx/src/common/string.cpp deleted file mode 100644 index 1bb1052ed..000000000 --- a/Source/3rdParty/wx/src/common/string.cpp +++ /dev/null @@ -1,2659 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/string.cpp -// Purpose: wxString class -// Author: Vadim Zeitlin, Ryan Norton -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: string.cpp 63008 2009-12-28 20:01:39Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// (c) 2004 Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - * About ref counting: - * 1) all empty strings use g_strEmpty, nRefs = -1 (set in Init()) - * 2) AllocBuffer() sets nRefs to 1, Lock() increments it by one - * 3) Unlock() decrements nRefs and frees memory if it goes to 0 - */ - -// =========================================================================== -// headers, declarations, constants -// =========================================================================== - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/thread.h" -#endif - -#include - -#ifndef __WXWINCE__ - #include -#endif - -#include -#include - -#ifdef __SALFORDC__ - #include -#endif - -// allocating extra space for each string consumes more memory but speeds up -// the concatenation operations (nLen is the current string's length) -// NB: EXTRA_ALLOC must be >= 0! -#define EXTRA_ALLOC (19 - nLen % 16) - -// --------------------------------------------------------------------------- -// static class variables definition -// --------------------------------------------------------------------------- - -#if !wxUSE_STL - //According to STL _must_ be a -1 size_t - const size_t wxStringBase::npos = (size_t) -1; -#endif - -// ---------------------------------------------------------------------------- -// static data -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = _T(""); - -#else - -// for an empty string, GetStringData() will return this address: this -// structure has the same layout as wxStringData and it's data() method will -// return the empty string (dummy pointer) -static const struct -{ - wxStringData data; - wxChar dummy; -} g_strEmpty = { {-1, 0, 0}, wxT('\0') }; - -// empty C style string: points to 'string data' byte of g_strEmpty -extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy; - -#endif - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -#if wxUSE_STD_IOSTREAM - -#include - -wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str) -{ -#ifdef __BORLANDC__ - os << str.mb_str(); -#else - os << str.c_str(); -#endif - return os; -} - -#endif // wxUSE_STD_IOSTREAM - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// this small class is used to gather statistics for performance tuning -//#define WXSTRING_STATISTICS -#ifdef WXSTRING_STATISTICS - class Averager - { - public: - Averager(const wxChar *sz) { m_sz = sz; m_nTotal = m_nCount = 0; } - ~Averager() - { wxPrintf("wxString: average %s = %f\n", m_sz, ((float)m_nTotal)/m_nCount); } - - void Add(size_t n) { m_nTotal += n; m_nCount++; } - - private: - size_t m_nCount, m_nTotal; - const wxChar *m_sz; - } g_averageLength("allocation size"), - g_averageSummandLength("summand length"), - g_averageConcatHit("hit probability in concat"), - g_averageInitialLength("initial string length"); - - #define STATISTICS_ADD(av, val) g_average##av.Add(val) -#else - #define STATISTICS_ADD(av, val) -#endif // WXSTRING_STATISTICS - -#if !wxUSE_STL - -// =========================================================================== -// wxStringData class deallocation -// =========================================================================== - -#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) -# pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!") -void wxStringData::Free() -{ - free(this); -} -#endif - -// =========================================================================== -// wxStringBase -// =========================================================================== - -// takes nLength elements of psz starting at nPos -void wxStringBase::InitWith(const wxChar *psz, size_t nPos, size_t nLength) -{ - Init(); - - // if the length is not given, assume the string to be NUL terminated - if ( nLength == npos ) { - wxASSERT_MSG( nPos <= wxStrlen(psz), _T("index out of bounds") ); - - nLength = wxStrlen(psz + nPos); - } - - STATISTICS_ADD(InitialLength, nLength); - - if ( nLength > 0 ) { - // trailing '\0' is written in AllocBuffer() - if ( !AllocBuffer(nLength) ) { - wxFAIL_MSG( _T("out of memory in wxStringBase::InitWith") ); - return; - } - wxTmemcpy(m_pchData, psz + nPos, nLength); - } -} - -// poor man's iterators are "void *" pointers -wxStringBase::wxStringBase(const void *pStart, const void *pEnd) -{ - if ( pEnd >= pStart ) - { - InitWith((const wxChar *)pStart, 0, - (const wxChar *)pEnd - (const wxChar *)pStart); - } - else - { - wxFAIL_MSG( _T("pStart is not before pEnd") ); - Init(); - } -} - -wxStringBase::wxStringBase(size_type n, wxChar ch) -{ - Init(); - append(n, ch); -} - -// --------------------------------------------------------------------------- -// memory allocation -// --------------------------------------------------------------------------- - -// allocates memory needed to store a C string of length nLen -bool wxStringBase::AllocBuffer(size_t nLen) -{ - // allocating 0 sized buffer doesn't make sense, all empty strings should - // reuse g_strEmpty - wxASSERT( nLen > 0 ); - - // make sure that we don't overflow - wxCHECK( nLen < (INT_MAX / sizeof(wxChar)) - - (sizeof(wxStringData) + EXTRA_ALLOC + 1), false ); - - STATISTICS_ADD(Length, nLen); - - // allocate memory: - // 1) one extra character for '\0' termination - // 2) sizeof(wxStringData) for housekeeping info - wxStringData* pData = (wxStringData*) - malloc(sizeof(wxStringData) + (nLen + EXTRA_ALLOC + 1)*sizeof(wxChar)); - - if ( pData == NULL ) { - // allocation failures are handled by the caller - return false; - } - - pData->nRefs = 1; - pData->nDataLength = nLen; - pData->nAllocLength = nLen + EXTRA_ALLOC; - m_pchData = pData->data(); // data starts after wxStringData - m_pchData[nLen] = wxT('\0'); - return true; -} - -// must be called before changing this string -bool wxStringBase::CopyBeforeWrite() -{ - wxStringData* pData = GetStringData(); - - if ( pData->IsShared() ) { - pData->Unlock(); // memory not freed because shared - size_t nLen = pData->nDataLength; - if ( !AllocBuffer(nLen) ) { - // allocation failures are handled by the caller - return false; - } - wxTmemcpy(m_pchData, pData->data(), nLen); - } - - wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner - - return true; -} - -// must be called before replacing contents of this string -bool wxStringBase::AllocBeforeWrite(size_t nLen) -{ - wxASSERT( nLen != 0 ); // doesn't make any sense - - // must not share string and must have enough space - wxStringData* pData = GetStringData(); - if ( pData->IsShared() || pData->IsEmpty() ) { - // can't work with old buffer, get new one - pData->Unlock(); - if ( !AllocBuffer(nLen) ) { - // allocation failures are handled by the caller - return false; - } - } - else { - if ( nLen > pData->nAllocLength ) { - // realloc the buffer instead of calling malloc() again, this is more - // efficient - STATISTICS_ADD(Length, nLen); - - nLen += EXTRA_ALLOC; - - pData = (wxStringData*) - realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar)); - - if ( pData == NULL ) { - // allocation failures are handled by the caller - // keep previous data since reallocation failed - return false; - } - - pData->nAllocLength = nLen; - m_pchData = pData->data(); - } - } - - wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner - - // it doesn't really matter what the string length is as it's going to be - // overwritten later but, for extra safety, set it to 0 for now as we may - // have some junk in m_pchData - GetStringData()->nDataLength = 0; - - return true; -} - -wxStringBase& wxStringBase::append(size_t n, wxChar ch) -{ - size_type len = length(); - - if ( !Alloc(len + n) || !CopyBeforeWrite() ) { - wxFAIL_MSG( _T("out of memory in wxStringBase::append") ); - } - GetStringData()->nDataLength = len + n; - m_pchData[len + n] = '\0'; - for ( size_t i = 0; i < n; ++i ) - m_pchData[len + i] = ch; - return *this; -} - -void wxStringBase::resize(size_t nSize, wxChar ch) -{ - size_t len = length(); - - if ( nSize < len ) - { - erase(begin() + nSize, end()); - } - else if ( nSize > len ) - { - append(nSize - len, ch); - } - //else: we have exactly the specified length, nothing to do -} - -// allocate enough memory for nLen characters -bool wxStringBase::Alloc(size_t nLen) -{ - wxStringData *pData = GetStringData(); - if ( pData->nAllocLength <= nLen ) { - if ( pData->IsEmpty() ) { - nLen += EXTRA_ALLOC; - - pData = (wxStringData *) - malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar)); - - if ( pData == NULL ) { - // allocation failure handled by caller - return false; - } - - pData->nRefs = 1; - pData->nDataLength = 0; - pData->nAllocLength = nLen; - m_pchData = pData->data(); // data starts after wxStringData - m_pchData[0u] = wxT('\0'); - } - else if ( pData->IsShared() ) { - pData->Unlock(); // memory not freed because shared - size_t nOldLen = pData->nDataLength; - if ( !AllocBuffer(nLen) ) { - // allocation failure handled by caller - return false; - } - // +1 to copy the terminator, too - memcpy(m_pchData, pData->data(), (nOldLen+1)*sizeof(wxChar)); - GetStringData()->nDataLength = nOldLen; - } - else { - nLen += EXTRA_ALLOC; - - pData = (wxStringData *) - realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar)); - - if ( pData == NULL ) { - // allocation failure handled by caller - // keep previous data since reallocation failed - return false; - } - - // it's not important if the pointer changed or not (the check for this - // is not faster than assigning to m_pchData in all cases) - pData->nAllocLength = nLen; - m_pchData = pData->data(); - } - } - //else: we've already got enough - return true; -} - -wxStringBase::iterator wxStringBase::begin() -{ - if (length() > 0) - CopyBeforeWrite(); - return m_pchData; -} - -wxStringBase::iterator wxStringBase::end() -{ - if (length() > 0) - CopyBeforeWrite(); - return m_pchData + length(); -} - -wxStringBase::iterator wxStringBase::erase(iterator it) -{ - size_type idx = it - begin(); - erase(idx, 1); - return begin() + idx; -} - -wxStringBase& wxStringBase::erase(size_t nStart, size_t nLen) -{ - wxASSERT(nStart <= length()); - size_t strLen = length() - nStart; - // delete nLen or up to the end of the string characters - nLen = strLen < nLen ? strLen : nLen; - wxString strTmp(c_str(), nStart); - strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen); - - swap(strTmp); - return *this; -} - -wxStringBase& wxStringBase::insert(size_t nPos, const wxChar *sz, size_t n) -{ - wxASSERT( nPos <= length() ); - - if ( n == npos ) n = wxStrlen(sz); - if ( n == 0 ) return *this; - - if ( !Alloc(length() + n) || !CopyBeforeWrite() ) { - wxFAIL_MSG( _T("out of memory in wxStringBase::insert") ); - } - - memmove(m_pchData + nPos + n, m_pchData + nPos, - (length() - nPos) * sizeof(wxChar)); - memcpy(m_pchData + nPos, sz, n * sizeof(wxChar)); - GetStringData()->nDataLength = length() + n; - m_pchData[length()] = '\0'; - - return *this; -} - -void wxStringBase::swap(wxStringBase& str) -{ - wxChar* tmp = str.m_pchData; - str.m_pchData = m_pchData; - m_pchData = tmp; -} - -size_t wxStringBase::find(const wxStringBase& str, size_t nStart) const -{ - // deal with the special case of empty string first - const size_t nLen = length(); - const size_t nLenOther = str.length(); - - if ( !nLenOther ) - { - // empty string is a substring of anything - return 0; - } - - if ( !nLen ) - { - // the other string is non empty so can't be our substring - return npos; - } - - wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart <= nLen ); - - const wxChar * const other = str.c_str(); - - // anchor - const wxChar* p = (const wxChar*)wxTmemchr(c_str() + nStart, - *other, - nLen - nStart); - - if ( !p ) - return npos; - - while ( p - c_str() + nLenOther <= nLen && wxTmemcmp(p, other, nLenOther) ) - { - p++; - - // anchor again - p = (const wxChar*)wxTmemchr(p, *other, nLen - (p - c_str())); - - if ( !p ) - return npos; - } - - return p - c_str() + nLenOther <= nLen ? p - c_str() : npos; -} - -size_t wxStringBase::find(const wxChar* sz, size_t nStart, size_t n) const -{ - return find(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::find(wxChar ch, size_t nStart) const -{ - wxASSERT( nStart <= length() ); - - const wxChar *p = (const wxChar*)wxTmemchr(c_str() + nStart, ch, length() - nStart); - - return p == NULL ? npos : p - c_str(); -} - -size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const -{ - wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart == npos || nStart <= length() ); - - if ( length() >= str.length() ) - { - // avoids a corner case later - if ( length() == 0 && str.length() == 0 ) - return 0; - - // "top" is the point where search starts from - size_t top = length() - str.length(); - - if ( nStart == npos ) - nStart = length() - 1; - if ( nStart < top ) - top = nStart; - - const wxChar *cursor = c_str() + top; - do - { - if ( wxTmemcmp(cursor, str.c_str(), - str.length()) == 0 ) - { - return cursor - c_str(); - } - } while ( cursor-- > c_str() ); - } - - return npos; -} - -size_t wxStringBase::rfind(const wxChar* sz, size_t nStart, size_t n) const -{ - return rfind(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::rfind(wxChar ch, size_t nStart) const -{ - if ( nStart == npos ) - { - nStart = length(); - } - else - { - wxASSERT( nStart <= length() ); - } - - const wxChar *actual; - for ( actual = c_str() + ( nStart == npos ? length() : nStart + 1 ); - actual > c_str(); --actual ) - { - if ( *(actual - 1) == ch ) - return (actual - 1) - c_str(); - } - - return npos; -} - -size_t wxStringBase::find_first_of(const wxChar* sz, size_t nStart) const -{ - wxASSERT(nStart <= length()); - - size_t len = wxStrlen(sz); - - size_t i; - for(i = nStart; i < this->length(); ++i) - { - if (wxTmemchr(sz, *(c_str() + i), len)) - break; - } - - if(i == this->length()) - return npos; - else - return i; -} - -size_t wxStringBase::find_first_of(const wxChar* sz, size_t nStart, - size_t n) const -{ - return find_first_of(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::find_last_of(const wxChar* sz, size_t nStart) const -{ - if ( nStart == npos ) - { - nStart = length() - 1; - } - else - { - wxASSERT_MSG( nStart <= length(), - _T("invalid index in find_last_of()") ); - } - - size_t len = wxStrlen(sz); - - for ( const wxChar *p = c_str() + nStart; p >= c_str(); --p ) - { - if ( wxTmemchr(sz, *p, len) ) - return p - c_str(); - } - - return npos; -} - -size_t wxStringBase::find_last_of(const wxChar* sz, size_t nStart, - size_t n) const -{ - return find_last_of(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::find_first_not_of(const wxChar* sz, size_t nStart) const -{ - if ( nStart == npos ) - { - nStart = length(); - } - else - { - wxASSERT( nStart <= length() ); - } - - size_t len = wxStrlen(sz); - - size_t i; - for(i = nStart; i < this->length(); ++i) - { - if (!wxTmemchr(sz, *(c_str() + i), len)) - break; - } - - if(i == this->length()) - return npos; - else - return i; -} - -size_t wxStringBase::find_first_not_of(const wxChar* sz, size_t nStart, - size_t n) const -{ - return find_first_not_of(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::find_first_not_of(wxChar ch, size_t nStart) const -{ - wxASSERT( nStart <= length() ); - - for ( const wxChar *p = c_str() + nStart; *p; p++ ) - { - if ( *p != ch ) - return p - c_str(); - } - - return npos; -} - -size_t wxStringBase::find_last_not_of(const wxChar* sz, size_t nStart) const -{ - if ( nStart == npos ) - { - nStart = length() - 1; - } - else - { - wxASSERT( nStart <= length() ); - } - - size_t len = wxStrlen(sz); - - for ( const wxChar *p = c_str() + nStart; p >= c_str(); --p ) - { - if ( !wxTmemchr(sz, *p,len) ) - return p - c_str(); - } - - return npos; -} - -size_t wxStringBase::find_last_not_of(const wxChar* sz, size_t nStart, - size_t n) const -{ - return find_last_not_of(wxStringBase(sz, n), nStart); -} - -size_t wxStringBase::find_last_not_of(wxChar ch, size_t nStart) const -{ - if ( nStart == npos ) - { - nStart = length() - 1; - } - else - { - wxASSERT( nStart <= length() ); - } - - for ( const wxChar *p = c_str() + nStart; p >= c_str(); --p ) - { - if ( *p != ch ) - return p - c_str(); - } - - return npos; -} - -wxStringBase& wxStringBase::replace(size_t nStart, size_t nLen, - const wxChar *sz) -{ - wxASSERT_MSG( nStart <= length(), - _T("index out of bounds in wxStringBase::replace") ); - size_t strLen = length() - nStart; - nLen = strLen < nLen ? strLen : nLen; - - wxStringBase strTmp; - strTmp.reserve(length()); // micro optimisation to avoid multiple mem allocs - - //This is kind of inefficient, but its pretty good considering... - //we don't want to use character access operators here because on STL - //it will freeze the reference count of strTmp, which means a deep copy - //at the end when swap is called - // - //Also, we can't use append with the full character pointer and must - //do it manually because this string can contain null characters - for(size_t i1 = 0; i1 < nStart; ++i1) - strTmp.append(1, this->c_str()[i1]); - - //its safe to do the full version here because - //sz must be a normal c string - strTmp.append(sz); - - for(size_t i2 = nStart + nLen; i2 < length(); ++i2) - strTmp.append(1, this->c_str()[i2]); - - swap(strTmp); - return *this; -} - -wxStringBase& wxStringBase::replace(size_t nStart, size_t nLen, - size_t nCount, wxChar ch) -{ - return replace(nStart, nLen, wxStringBase(nCount, ch).c_str()); -} - -wxStringBase& wxStringBase::replace(size_t nStart, size_t nLen, - const wxStringBase& str, - size_t nStart2, size_t nLen2) -{ - return replace(nStart, nLen, str.substr(nStart2, nLen2)); -} - -wxStringBase& wxStringBase::replace(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount) -{ - return replace(nStart, nLen, wxStringBase(sz, nCount).c_str()); -} - -wxStringBase wxStringBase::substr(size_t nStart, size_t nLen) const -{ - if ( nLen == npos ) - nLen = length() - nStart; - return wxStringBase(*this, nStart, nLen); -} - -// assigns one string to another -wxStringBase& wxStringBase::operator=(const wxStringBase& stringSrc) -{ - wxASSERT( stringSrc.GetStringData()->IsValid() ); - - // don't copy string over itself - if ( m_pchData != stringSrc.m_pchData ) { - if ( stringSrc.GetStringData()->IsEmpty() ) { - Reinit(); - } - else { - // adjust references - GetStringData()->Unlock(); - m_pchData = stringSrc.m_pchData; - GetStringData()->Lock(); - } - } - - return *this; -} - -// assigns a single character -wxStringBase& wxStringBase::operator=(wxChar ch) -{ - if ( !AssignCopy(1, &ch) ) { - wxFAIL_MSG( _T("out of memory in wxStringBase::operator=(wxChar)") ); - } - return *this; -} - -// assigns C string -wxStringBase& wxStringBase::operator=(const wxChar *psz) -{ - if ( !AssignCopy(wxStrlen(psz), psz) ) { - wxFAIL_MSG( _T("out of memory in wxStringBase::operator=(const wxChar *)") ); - } - return *this; -} - -// helper function: does real copy -bool wxStringBase::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData) -{ - if ( nSrcLen == 0 ) { - Reinit(); - } - else { - if ( !AllocBeforeWrite(nSrcLen) ) { - // allocation failure handled by caller - return false; - } - - // use memmove() and not memcpy() here as we might be copying from our own - // buffer in case of assignment such as "s = s.c_str()" (see #11294) - memmove(m_pchData, pszSrcData, nSrcLen*sizeof(wxChar)); - - GetStringData()->nDataLength = nSrcLen; - m_pchData[nSrcLen] = wxT('\0'); - } - return true; -} - -// --------------------------------------------------------------------------- -// string concatenation -// --------------------------------------------------------------------------- - -// add something to this string -bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData, - size_t nMaxLen) -{ - STATISTICS_ADD(SummandLength, nSrcLen); - - nSrcLen = nSrcLen < nMaxLen ? nSrcLen : nMaxLen; - - // concatenating an empty string is a NOP - if ( nSrcLen > 0 ) { - wxStringData *pData = GetStringData(); - size_t nLen = pData->nDataLength; - size_t nNewLen = nLen + nSrcLen; - - // take special care when appending part of this string to itself: the code - // below reallocates our buffer and this invalidates pszSrcData pointer so - // we have to copy it in another temporary string in this case (but avoid - // doing this unnecessarily) - if ( pszSrcData >= m_pchData && pszSrcData < m_pchData + nLen ) - { - wxStringBase tmp(pszSrcData, nSrcLen); - return ConcatSelf(nSrcLen, tmp.m_pchData, nSrcLen); - } - - // alloc new buffer if current is too small - if ( pData->IsShared() ) { - STATISTICS_ADD(ConcatHit, 0); - - // we have to allocate another buffer - wxStringData* pOldData = GetStringData(); - if ( !AllocBuffer(nNewLen) ) { - // allocation failure handled by caller - return false; - } - memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxChar)); - pOldData->Unlock(); - } - else if ( nNewLen > pData->nAllocLength ) { - STATISTICS_ADD(ConcatHit, 0); - - reserve(nNewLen); - // we have to grow the buffer - if ( capacity() < nNewLen ) { - // allocation failure handled by caller - return false; - } - } - else { - STATISTICS_ADD(ConcatHit, 1); - - // the buffer is already big enough - } - - // should be enough space - wxASSERT( nNewLen <= GetStringData()->nAllocLength ); - - // fast concatenation - all is done in our buffer - memcpy(m_pchData + nLen, pszSrcData, nSrcLen*sizeof(wxChar)); - - m_pchData[nNewLen] = wxT('\0'); // put terminating '\0' - GetStringData()->nDataLength = nNewLen; // and fix the length - } - //else: the string to append was empty - return true; -} - -// --------------------------------------------------------------------------- -// simple sub-string extraction -// --------------------------------------------------------------------------- - -// helper function: clone the data attached to this string -bool wxStringBase::AllocCopy(wxString& dest, int nCopyLen, int nCopyIndex) const -{ - if ( nCopyLen == 0 ) { - dest.Init(); - } - else { - if ( !dest.AllocBuffer(nCopyLen) ) { - // allocation failure handled by caller - return false; - } - memcpy(dest.m_pchData, m_pchData + nCopyIndex, nCopyLen*sizeof(wxChar)); - } - return true; -} - -#endif // !wxUSE_STL - -#if !wxUSE_STL || !defined(HAVE_STD_STRING_COMPARE) - -#if !wxUSE_STL - #define STRINGCLASS wxStringBase -#else - #define STRINGCLASS wxString -#endif - -static inline int wxDoCmp(const wxChar* s1, size_t l1, - const wxChar* s2, size_t l2) -{ - if( l1 == l2 ) - return wxTmemcmp(s1, s2, l1); - else if( l1 < l2 ) - { - int ret = wxTmemcmp(s1, s2, l1); - return ret == 0 ? -1 : ret; - } - else - { - int ret = wxTmemcmp(s1, s2, l2); - return ret == 0 ? +1 : ret; - } -} - -int STRINGCLASS::compare(const wxStringBase& str) const -{ - return ::wxDoCmp(data(), length(), str.data(), str.length()); -} - -int STRINGCLASS::compare(size_t nStart, size_t nLen, - const wxStringBase& str) const -{ - wxASSERT(nStart <= length()); - size_type strLen = length() - nStart; - nLen = strLen < nLen ? strLen : nLen; - return ::wxDoCmp(data() + nStart, nLen, str.data(), str.length()); -} - -int STRINGCLASS::compare(size_t nStart, size_t nLen, - const wxStringBase& str, - size_t nStart2, size_t nLen2) const -{ - wxASSERT(nStart <= length()); - wxASSERT(nStart2 <= str.length()); - size_type strLen = length() - nStart, - strLen2 = str.length() - nStart2; - nLen = strLen < nLen ? strLen : nLen; - nLen2 = strLen2 < nLen2 ? strLen2 : nLen2; - return ::wxDoCmp(data() + nStart, nLen, str.data() + nStart2, nLen2); -} - -int STRINGCLASS::compare(const wxChar* sz) const -{ - size_t nLen = wxStrlen(sz); - return ::wxDoCmp(data(), length(), sz, nLen); -} - -int STRINGCLASS::compare(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount) const -{ - wxASSERT(nStart <= length()); - size_type strLen = length() - nStart; - nLen = strLen < nLen ? strLen : nLen; - if( nCount == npos ) - nCount = wxStrlen(sz); - - return ::wxDoCmp(data() + nStart, nLen, sz, nCount); -} - -#undef STRINGCLASS - -#endif // !wxUSE_STL || !defined(HAVE_STD_STRING_COMPARE) - -// =========================================================================== -// wxString class core -// =========================================================================== - -// --------------------------------------------------------------------------- -// construction and conversion -// --------------------------------------------------------------------------- - -#if wxUSE_UNICODE - -// from multibyte string -wxString::wxString(const char *psz, const wxMBConv& conv, size_t nLength) -{ - // anything to do? - if ( psz && nLength != 0 ) - { - if ( nLength == npos ) - { - nLength = wxNO_LEN; - } - - size_t nLenWide; - wxWCharBuffer wbuf = conv.cMB2WC(psz, nLength, &nLenWide); - - if ( nLenWide ) - assign(wbuf, nLenWide); - } -} - -//Convert wxString in Unicode mode to a multi-byte string -const wxCharBuffer wxString::mb_str(const wxMBConv& conv) const -{ - return conv.cWC2MB(c_str(), length() + 1 /* size, not length */, NULL); -} - -#else // ANSI - -#if wxUSE_WCHAR_T - -// from wide string -wxString::wxString(const wchar_t *pwz, const wxMBConv& conv, size_t nLength) -{ - // anything to do? - if ( pwz && nLength != 0 ) - { - if ( nLength == npos ) - { - nLength = wxNO_LEN; - } - - size_t nLenMB; - wxCharBuffer buf = conv.cWC2MB(pwz, nLength, &nLenMB); - - if ( nLenMB ) - assign(buf, nLenMB); - } -} - -//Converts this string to a wide character string if unicode -//mode is not enabled and wxUSE_WCHAR_T is enabled -const wxWCharBuffer wxString::wc_str(const wxMBConv& conv) const -{ - return conv.cMB2WC(c_str(), length() + 1 /* size, not length */, NULL); -} - -#endif // wxUSE_WCHAR_T - -#endif // Unicode/ANSI - -// shrink to minimal size (releasing extra memory) -bool wxString::Shrink() -{ - wxString tmp(begin(), end()); - swap(tmp); - return tmp.length() == length(); -} - -#if !wxUSE_STL -// get the pointer to writable buffer of (at least) nLen bytes -wxChar *wxString::GetWriteBuf(size_t nLen) -{ - if ( !AllocBeforeWrite(nLen) ) { - // allocation failure handled by caller - return NULL; - } - - wxASSERT( GetStringData()->nRefs == 1 ); - GetStringData()->Validate(false); - - return m_pchData; -} - -// put string back in a reasonable state after GetWriteBuf -void wxString::UngetWriteBuf() -{ - UngetWriteBuf(wxStrlen(m_pchData)); -} - -void wxString::UngetWriteBuf(size_t nLen) -{ - wxStringData * const pData = GetStringData(); - - wxASSERT_MSG( nLen < pData->nAllocLength, _T("buffer overrun") ); - - // the strings we store are always NUL-terminated - pData->data()[nLen] = _T('\0'); - pData->nDataLength = nLen; - pData->Validate(true); -} -#endif // !wxUSE_STL - -// --------------------------------------------------------------------------- -// data access -// --------------------------------------------------------------------------- - -// all functions are inline in string.h - -// --------------------------------------------------------------------------- -// assignment operators -// --------------------------------------------------------------------------- - -#if !wxUSE_UNICODE - -// same as 'signed char' variant -wxString& wxString::operator=(const unsigned char* psz) -{ - *this = (const char *)psz; - return *this; -} - -#if wxUSE_WCHAR_T -wxString& wxString::operator=(const wchar_t *pwz) -{ - wxString str(pwz); - swap(str); - return *this; -} -#endif - -#endif - -/* - * concatenation functions come in 5 flavours: - * string + string - * char + string and string + char - * C str + string and string + C str - */ - -wxString operator+(const wxString& str1, const wxString& str2) -{ -#if !wxUSE_STL - wxASSERT( str1.GetStringData()->IsValid() ); - wxASSERT( str2.GetStringData()->IsValid() ); -#endif - - wxString s = str1; - s += str2; - - return s; -} - -wxString operator+(const wxString& str, wxChar ch) -{ -#if !wxUSE_STL - wxASSERT( str.GetStringData()->IsValid() ); -#endif - - wxString s = str; - s += ch; - - return s; -} - -wxString operator+(wxChar ch, const wxString& str) -{ -#if !wxUSE_STL - wxASSERT( str.GetStringData()->IsValid() ); -#endif - - wxString s = ch; - s += str; - - return s; -} - -wxString operator+(const wxString& str, const wxChar *psz) -{ -#if !wxUSE_STL - wxASSERT( str.GetStringData()->IsValid() ); -#endif - - wxString s; - if ( !s.Alloc(wxStrlen(psz) + str.length()) ) { - wxFAIL_MSG( _T("out of memory in wxString::operator+") ); - } - s += str; - s += psz; - - return s; -} - -wxString operator+(const wxChar *psz, const wxString& str) -{ -#if !wxUSE_STL - wxASSERT( str.GetStringData()->IsValid() ); -#endif - - wxString s; - if ( !s.Alloc(wxStrlen(psz) + str.length()) ) { - wxFAIL_MSG( _T("out of memory in wxString::operator+") ); - } - s = psz; - s += str; - - return s; -} - -// =========================================================================== -// other common string functions -// =========================================================================== - -int wxString::Cmp(const wxString& s) const -{ - return compare(s); -} - -int wxString::Cmp(const wxChar* psz) const -{ - return compare(psz); -} - -static inline int wxDoCmpNoCase(const wxChar* s1, size_t l1, - const wxChar* s2, size_t l2) -{ - size_t i; - - if( l1 == l2 ) - { - for(i = 0; i < l1; ++i) - { - if(wxTolower(s1[i]) != wxTolower(s2[i])) - break; - } - return i == l1 ? 0 : wxTolower(s1[i]) < wxTolower(s2[i]) ? -1 : 1; - } - else if( l1 < l2 ) - { - for(i = 0; i < l1; ++i) - { - if(wxTolower(s1[i]) != wxTolower(s2[i])) - break; - } - return i == l1 ? -1 : wxTolower(s1[i]) < wxTolower(s2[i]) ? -1 : 1; - } - else - { - for(i = 0; i < l2; ++i) - { - if(wxTolower(s1[i]) != wxTolower(s2[i])) - break; - } - return i == l2 ? 1 : wxTolower(s1[i]) < wxTolower(s2[i]) ? -1 : 1; - } -} - -int wxString::CmpNoCase(const wxString& s) const -{ - return wxDoCmpNoCase(data(), length(), s.data(), s.length()); -} - -int wxString::CmpNoCase(const wxChar* psz) const -{ - int nLen = wxStrlen(psz); - - return wxDoCmpNoCase(data(), length(), psz, nLen); -} - - -#if wxUSE_UNICODE - -#ifdef __MWERKS__ -#ifndef __SCHAR_MAX__ -#define __SCHAR_MAX__ 127 -#endif -#endif - -wxString wxString::FromAscii(const char *ascii) -{ - if (!ascii) - return wxEmptyString; - - size_t len = strlen( ascii ); - wxString res; - - if ( len ) - { - wxStringBuffer buf(res, len); - - wchar_t *dest = buf; - - for ( ;; ) - { - if ( (*dest++ = (wchar_t)(unsigned char)*ascii++) == L'\0' ) - break; - } - } - - return res; -} - -wxString wxString::FromAscii(const char ascii) -{ - // What do we do with '\0' ? - - wxString res; - res += (wchar_t)(unsigned char) ascii; - - return res; -} - -const wxCharBuffer wxString::ToAscii() const -{ - // this will allocate enough space for the terminating NUL too - wxCharBuffer buffer(length()); - - - char *dest = buffer.data(); - - const wchar_t *pwc = c_str(); - for ( ;; ) - { - *dest++ = (char)(*pwc > SCHAR_MAX ? wxT('_') : *pwc); - - // the output string can't have embedded NULs anyhow, so we can safely - // stop at first of them even if we do have any - if ( !*pwc++ ) - break; - } - - return buffer; -} - -#endif // Unicode - -// extract string of length nCount starting at nFirst -wxString wxString::Mid(size_t nFirst, size_t nCount) const -{ - size_t nLen = length(); - - // default value of nCount is npos and means "till the end" - if ( nCount == npos ) - { - nCount = nLen - nFirst; - } - - // out-of-bounds requests return sensible things - if ( nFirst + nCount > nLen ) - { - nCount = nLen - nFirst; - } - - if ( nFirst > nLen ) - { - // AllocCopy() will return empty string - return wxEmptyString; - } - - wxString dest(*this, nFirst, nCount); - if ( dest.length() != nCount ) - { - wxFAIL_MSG( _T("out of memory in wxString::Mid") ); - } - - return dest; -} - -// check that the string starts with prefix and return the rest of the string -// in the provided pointer if it is not NULL, otherwise return false -bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const -{ - wxASSERT_MSG( prefix, _T("invalid parameter in wxString::StartsWith") ); - - // first check if the beginning of the string matches the prefix: note - // that we don't have to check that we don't run out of this string as - // when we reach the terminating NUL, either prefix string ends too (and - // then it's ok) or we break out of the loop because there is no match - const wxChar *p = c_str(); - while ( *prefix ) - { - if ( *prefix++ != *p++ ) - { - // no match - return false; - } - } - - if ( rest ) - { - // put the rest of the string into provided pointer - *rest = p; - } - - return true; -} - - -// check that the string ends with suffix and return the rest of it in the -// provided pointer if it is not NULL, otherwise return false -bool wxString::EndsWith(const wxChar *suffix, wxString *rest) const -{ - wxASSERT_MSG( suffix, _T("invalid parameter in wxString::EndssWith") ); - - int start = length() - wxStrlen(suffix); - if ( start < 0 || wxStrcmp(c_str() + start, suffix) != 0 ) - return false; - - if ( rest ) - { - // put the rest of the string into provided pointer - rest->assign(*this, 0, start); - } - - return true; -} - - -// extract nCount last (rightmost) characters -wxString wxString::Right(size_t nCount) const -{ - if ( nCount > length() ) - nCount = length(); - - wxString dest(*this, length() - nCount, nCount); - if ( dest.length() != nCount ) { - wxFAIL_MSG( _T("out of memory in wxString::Right") ); - } - return dest; -} - -// get all characters after the last occurence of ch -// (returns the whole string if ch not found) -wxString wxString::AfterLast(wxChar ch) const -{ - wxString str; - int iPos = Find(ch, true); - if ( iPos == wxNOT_FOUND ) - str = *this; - else - str = c_str() + iPos + 1; - - return str; -} - -// extract nCount first (leftmost) characters -wxString wxString::Left(size_t nCount) const -{ - if ( nCount > length() ) - nCount = length(); - - wxString dest(*this, 0, nCount); - if ( dest.length() != nCount ) { - wxFAIL_MSG( _T("out of memory in wxString::Left") ); - } - return dest; -} - -// get all characters before the first occurence of ch -// (returns the whole string if ch not found) -wxString wxString::BeforeFirst(wxChar ch) const -{ - int iPos = Find(ch); - if ( iPos == wxNOT_FOUND ) iPos = length(); - return wxString(*this, 0, iPos); -} - -/// get all characters before the last occurence of ch -/// (returns empty string if ch not found) -wxString wxString::BeforeLast(wxChar ch) const -{ - wxString str; - int iPos = Find(ch, true); - if ( iPos != wxNOT_FOUND && iPos != 0 ) - str = wxString(c_str(), iPos); - - return str; -} - -/// get all characters after the first occurence of ch -/// (returns empty string if ch not found) -wxString wxString::AfterFirst(wxChar ch) const -{ - wxString str; - int iPos = Find(ch); - if ( iPos != wxNOT_FOUND ) - str = c_str() + iPos + 1; - - return str; -} - -// replace first (or all) occurences of some substring with another one -size_t -wxString::Replace(const wxChar *szOld, const wxChar *szNew, bool bReplaceAll) -{ - // if we tried to replace an empty string we'd enter an infinite loop below - wxCHECK_MSG( szOld && *szOld && szNew, 0, - _T("wxString::Replace(): invalid parameter") ); - - size_t uiCount = 0; // count of replacements made - - // optimize the special common case of replacing one character with another - // one - if ( szOld[1] == '\0' && (szNew[0] != '\0' && szNew[1] == '\0') ) - { - // this loop is the simplified version of the one below - for ( size_t pos = 0; ; ) - { - pos = find(*szOld, pos); - if ( pos == npos ) - break; - - (*this)[pos++] = *szNew; - - uiCount++; - - if ( !bReplaceAll ) - break; - } - } - else // general case - { - const size_t uiOldLen = wxStrlen(szOld); - const size_t uiNewLen = wxStrlen(szNew); - - for ( size_t pos = 0; ; ) - { - pos = find(szOld, pos); - if ( pos == npos ) - break; - - // replace this occurrence of the old string with the new one - replace(pos, uiOldLen, szNew, uiNewLen); - - // move past the string that was replaced - pos += uiNewLen; - - // increase replace count - uiCount++; - - // stop now? - if ( !bReplaceAll ) - break; - } - } - - return uiCount; -} - -bool wxString::IsAscii() const -{ - const wxChar *s = (const wxChar*) *this; - while(*s){ - if(!isascii(*s)) return(false); - s++; - } - return(true); -} - -bool wxString::IsWord() const -{ - const wxChar *s = (const wxChar*) *this; - while(*s){ - if(!wxIsalpha(*s)) return(false); - s++; - } - return(true); -} - -bool wxString::IsNumber() const -{ - const wxChar *s = (const wxChar*) *this; - if (wxStrlen(s)) - if ((s[0] == wxT('-')) || (s[0] == wxT('+'))) s++; - while(*s){ - if(!wxIsdigit(*s)) return(false); - s++; - } - return(true); -} - -wxString wxString::Strip(stripType w) const -{ - wxString s = *this; - if ( w & leading ) s.Trim(false); - if ( w & trailing ) s.Trim(true); - return s; -} - -// --------------------------------------------------------------------------- -// case conversion -// --------------------------------------------------------------------------- - -wxString& wxString::MakeUpper() -{ - for ( iterator it = begin(), en = end(); it != en; ++it ) - *it = (wxChar)wxToupper(*it); - - return *this; -} - -wxString& wxString::MakeLower() -{ - for ( iterator it = begin(), en = end(); it != en; ++it ) - *it = (wxChar)wxTolower(*it); - - return *this; -} - -// --------------------------------------------------------------------------- -// trimming and padding -// --------------------------------------------------------------------------- - -// some compilers (VC++ 6.0 not to name them) return true for a call to -// isspace('\xEA') in the C locale which seems to be broken to me, but we have -// to live with this by checking that the character is a 7 bit one - even if -// this may fail to detect some spaces (I don't know if Unicode doesn't have -// space-like symbols somewhere except in the first 128 chars), it is arguably -// still better than trimming away accented letters -inline int wxSafeIsspace(wxChar ch) { return (ch < 127) && wxIsspace(ch); } - -// trims spaces (in the sense of isspace) from left or right side -wxString& wxString::Trim(bool bFromRight) -{ - // first check if we're going to modify the string at all - if ( !empty() && - ( - (bFromRight && wxSafeIsspace(GetChar(length() - 1))) || - (!bFromRight && wxSafeIsspace(GetChar(0u))) - ) - ) - { - if ( bFromRight ) - { - // find last non-space character - reverse_iterator psz = rbegin(); - while ( (psz != rend()) && wxSafeIsspace(*psz) ) - psz++; - - // truncate at trailing space start - erase(psz.base(), end()); - } - else - { - // find first non-space character - iterator psz = begin(); - while ( (psz != end()) && wxSafeIsspace(*psz) ) - psz++; - - // fix up data and length - erase(begin(), psz); - } - } - - return *this; -} - -// adds nCount characters chPad to the string from either side -wxString& wxString::Pad(size_t nCount, wxChar chPad, bool bFromRight) -{ - wxString s(chPad, nCount); - - if ( bFromRight ) - *this += s; - else - { - s += *this; - swap(s); - } - - return *this; -} - -// truncate the string -wxString& wxString::Truncate(size_t uiLen) -{ - if ( uiLen < length() ) - { - erase(begin() + uiLen, end()); - } - //else: nothing to do, string is already short enough - - return *this; -} - -// --------------------------------------------------------------------------- -// finding (return wxNOT_FOUND if not found and index otherwise) -// --------------------------------------------------------------------------- - -// find a character -int wxString::Find(wxChar ch, bool bFromEnd) const -{ - size_type idx = bFromEnd ? find_last_of(ch) : find_first_of(ch); - - return (idx == npos) ? wxNOT_FOUND : (int)idx; -} - -// find a sub-string (like strstr) -int wxString::Find(const wxChar *pszSub) const -{ - size_type idx = find(pszSub); - - return (idx == npos) ? wxNOT_FOUND : (int)idx; -} - -// ---------------------------------------------------------------------------- -// conversion to numbers -// ---------------------------------------------------------------------------- - -// the implementation of all the functions below is exactly the same so factor -// it out - -template -bool wxStringToIntType(const wxChar *start, - T *val, - int base, - F func) -{ - wxCHECK_MSG( val, false, _T("NULL output pointer") ); - wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") ); - -#ifndef __WXWINCE__ - errno = 0; -#endif - - wxChar *end; - *val = (*func)(start, &end, base); - - // return true only if scan was stopped by the terminating NUL and if the - // string was not empty to start with and no under/overflow occurred - return !*end && (end != start) -#ifndef __WXWINCE__ - && (errno != ERANGE) -#endif - ; -} - -bool wxString::ToLong(long *val, int base) const -{ - return wxStringToIntType(c_str(), val, base, wxStrtol); -} - -bool wxString::ToULong(unsigned long *val, int base) const -{ - return wxStringToIntType(c_str(), val, base, wxStrtoul); -} - -bool wxString::ToLongLong(wxLongLong_t *val, int base) const -{ -#ifdef wxHAS_STRTOLL - return wxStringToIntType(c_str(), val, base, wxStrtoll); -#else - // TODO: implement this ourselves - wxUnusedVar(val); - wxUnusedVar(base); - return false; -#endif // wxHAS_STRTOLL -} - -bool wxString::ToULongLong(wxULongLong_t *val, int base) const -{ -#ifdef wxHAS_STRTOLL - return wxStringToIntType(c_str(), val, base, wxStrtoull); -#else - // TODO: implement this ourselves - wxUnusedVar(val); - wxUnusedVar(base); - return false; -#endif -} - -bool wxString::ToDouble(double *val) const -{ - wxCHECK_MSG( val, false, _T("NULL pointer in wxString::ToDouble") ); - -#ifndef __WXWINCE__ - errno = 0; -#endif - - const wxChar *start = c_str(); - wxChar *end; - *val = wxStrtod(start, &end); - - // return true only if scan was stopped by the terminating NUL and if the - // string was not empty to start with and no under/overflow occurred - return !*end && (end != start) -#ifndef __WXWINCE__ - && (errno != ERANGE) -#endif - ; -} - -// --------------------------------------------------------------------------- -// formatted output -// --------------------------------------------------------------------------- - -/* static */ -wxString wxString::Format(const wxChar *pszFormat, ...) -{ - va_list argptr; - va_start(argptr, pszFormat); - - wxString s; - s.PrintfV(pszFormat, argptr); - - va_end(argptr); - - return s; -} - -/* static */ -wxString wxString::FormatV(const wxChar *pszFormat, va_list argptr) -{ - wxString s; - s.PrintfV(pszFormat, argptr); - return s; -} - -int wxString::Printf(const wxChar *pszFormat, ...) -{ - va_list argptr; - va_start(argptr, pszFormat); - - int iLen = PrintfV(pszFormat, argptr); - - va_end(argptr); - - return iLen; -} - -/* - Uses wxVsnprintf and places the result into the this string. - - In ANSI build, wxVsnprintf is effectively vsnprintf but in Unicode build - it is vswprintf. Due to a discrepancy between vsnprintf and vswprintf in - the ISO C99 (and thus SUSv3) standard the return value for the case of - an undersized buffer is inconsistent. For conforming vsnprintf - implementations the function must return the number of characters that - would have been printed had the buffer been large enough. For conforming - vswprintf implementations the function must return a negative number - and set errno. - - What vswprintf sets errno to is undefined but Darwin seems to set it to - EOVERFLOW. The only expected errno are EILSEQ and EINVAL. Both of - those are defined in the standard and backed up by several conformance - statements. Note that ENOMEM mentioned in the manual page does not - apply to swprintf, only wprintf and fwprintf. - - Official manual page: - http://www.opengroup.org/onlinepubs/009695399/functions/swprintf.html - - Some conformance statements (AIX, Solaris): - http://www.opengroup.org/csq/view.mhtml?RID=ibm%2FSD1%2F3 - http://www.theopengroup.org/csq/view.mhtml?norationale=1&noreferences=1&RID=Fujitsu%2FSE2%2F10 - - Since EILSEQ and EINVAL are rather common but EOVERFLOW is not and since - EILSEQ and EINVAL are specifically defined to mean the error is other than - an undersized buffer and no other errno are defined we treat those two - as meaning hard errors and everything else gets the old behavior which - is to keep looping and increasing buffer size until the function succeeds. - - In practice it's impossible to determine before compilation which behavior - may be used. The vswprintf function may have vsnprintf-like behavior or - vice-versa. Behavior detected on one release can theoretically change - with an updated release. Not to mention that configure testing for it - would require the test to be run on the host system, not the build system - which makes cross compilation difficult. Therefore, we make no assumptions - about behavior and try our best to handle every known case, including the - case where wxVsnprintf returns a negative number and fails to set errno. - - There is yet one more non-standard implementation and that is our own. - Fortunately, that can be detected at compile-time. - - On top of all that, ISO C99 explicitly defines snprintf to write a null - character to the last position of the specified buffer. That would be at - at the given buffer size minus 1. It is supposed to do this even if it - turns out that the buffer is sized too small. - - Darwin (tested on 10.5) follows the C99 behavior exactly. - - Glibc 2.6 almost follows the C99 behavior except vswprintf never sets - errno even when it fails. However, it only seems to ever fail due - to an undersized buffer. -*/ -int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) -{ - int size = 1024; - - for ( ;; ) - { - // Allocate 1 more character than we tell wxVsnprintf about - // just in case it is buggy. - // FIXME: I have a feeling that the underlying function was not buggy - // and I suspect it was to fix the buf[size] = '\0' line below - wxStringBuffer tmp(*this, size + 1); - wxChar *buf = tmp; - - if ( !buf ) - { - // out of memory - return -1; - } - - // wxVsnprintf() may modify the original arg pointer, so pass it - // only a copy - va_list argptrcopy; - wxVaCopy(argptrcopy, argptr); - -#ifndef __WXWINCE__ - // Set errno to 0 to make it determinate if wxVsnprintf fails to set it. - errno = 0; -#endif - int len = wxVsnprintf(buf, size, pszFormat, argptrcopy); - va_end(argptrcopy); - - // some implementations of vsnprintf() don't NUL terminate - // the string if there is not enough space for it so - // always do it manually - // FIXME: This really seems to be the wrong and would be an off-by-one - // bug except the code above allocates an extra character. - buf[size] = _T('\0'); - - // vsnprintf() may return either -1 (traditional Unix behaviour) or the - // total number of characters which would have been written if the - // buffer were large enough (newer standards such as Unix98) - if ( len < 0 ) - { -#if wxUSE_WXVSNPRINTF - // we know that our own implementation of wxVsnprintf() returns -1 - // only for a format error - thus there's something wrong with - // the user's format string - return -1; -#else // assume that system version only returns error if not enough space -#if !defined(__WXWINCE__) && (!defined(__OS2__) || defined(__INNOTEK_LIBC__)) - if( (errno == EILSEQ) || (errno == EINVAL) ) - // If errno was set to one of the two well-known hard errors - // then fail immediately to avoid an infinite loop. - return -1; - else -#endif // __WXWINCE__ - // still not enough, as we don't know how much we need, double the - // current size of the buffer - size *= 2; -#endif // wxUSE_WXVSNPRINTF/!wxUSE_WXVSNPRINTF - } - else if ( len >= size ) - { -#if wxUSE_WXVSNPRINTF - // we know that our own implementation of wxVsnprintf() returns - // size+1 when there's not enough space but that's not the size - // of the required buffer! - size *= 2; // so we just double the current size of the buffer -#else - // some vsnprintf() implementations NUL-terminate the buffer and - // some don't in len == size case, to be safe always add 1 - // FIXME: I don't quite understand this comment. The vsnprintf - // function is specifically defined to return the number of - // characters printed not including the null terminator. - // So OF COURSE you need to add 1 to get the right buffer size. - // The following line is definitely correct, no question. - size = len + 1; -#endif - } - else // ok, there was enough space - { - break; - } - } - - // we could have overshot - Shrink(); - - return length(); -} - -// ---------------------------------------------------------------------------- -// misc other operations -// ---------------------------------------------------------------------------- - -// returns true if the string matches the pattern which may contain '*' and -// '?' metacharacters (as usual, '?' matches any character and '*' any number -// of them) -bool wxString::Matches(const wxChar *pszMask) const -{ - // I disable this code as it doesn't seem to be faster (in fact, it seems - // to be much slower) than the old, hand-written code below and using it - // here requires always linking with libregex even if the user code doesn't - // use it -#if 0 // wxUSE_REGEX - // first translate the shell-like mask into a regex - wxString pattern; - pattern.reserve(wxStrlen(pszMask)); - - pattern += _T('^'); - while ( *pszMask ) - { - switch ( *pszMask ) - { - case _T('?'): - pattern += _T('.'); - break; - - case _T('*'): - pattern += _T(".*"); - break; - - case _T('^'): - case _T('.'): - case _T('$'): - case _T('('): - case _T(')'): - case _T('|'): - case _T('+'): - case _T('\\'): - // these characters are special in a RE, quote them - // (however note that we don't quote '[' and ']' to allow - // using them for Unix shell like matching) - pattern += _T('\\'); - // fall through - - default: - pattern += *pszMask; - } - - pszMask++; - } - pattern += _T('$'); - - // and now use it - return wxRegEx(pattern, wxRE_NOSUB | wxRE_EXTENDED).Matches(c_str()); -#else // !wxUSE_REGEX - // TODO: this is, of course, awfully inefficient... - - // the char currently being checked - const wxChar *pszTxt = c_str(); - - // the last location where '*' matched - const wxChar *pszLastStarInText = NULL; - const wxChar *pszLastStarInMask = NULL; - -match: - for ( ; *pszMask != wxT('\0'); pszMask++, pszTxt++ ) { - switch ( *pszMask ) { - case wxT('?'): - if ( *pszTxt == wxT('\0') ) - return false; - - // pszTxt and pszMask will be incremented in the loop statement - - break; - - case wxT('*'): - { - // remember where we started to be able to backtrack later - pszLastStarInText = pszTxt; - pszLastStarInMask = pszMask; - - // ignore special chars immediately following this one - // (should this be an error?) - while ( *pszMask == wxT('*') || *pszMask == wxT('?') ) - pszMask++; - - // if there is nothing more, match - if ( *pszMask == wxT('\0') ) - return true; - - // are there any other metacharacters in the mask? - size_t uiLenMask; - const wxChar *pEndMask = wxStrpbrk(pszMask, wxT("*?")); - - if ( pEndMask != NULL ) { - // we have to match the string between two metachars - uiLenMask = pEndMask - pszMask; - } - else { - // we have to match the remainder of the string - uiLenMask = wxStrlen(pszMask); - } - - wxString strToMatch(pszMask, uiLenMask); - const wxChar* pMatch = wxStrstr(pszTxt, strToMatch); - if ( pMatch == NULL ) - return false; - - // -1 to compensate "++" in the loop - pszTxt = pMatch + uiLenMask - 1; - pszMask += uiLenMask - 1; - } - break; - - default: - if ( *pszMask != *pszTxt ) - return false; - break; - } - } - - // match only if nothing left - if ( *pszTxt == wxT('\0') ) - return true; - - // if we failed to match, backtrack if we can - if ( pszLastStarInText ) { - pszTxt = pszLastStarInText + 1; - pszMask = pszLastStarInMask; - - pszLastStarInText = NULL; - - // don't bother resetting pszLastStarInMask, it's unnecessary - - goto match; - } - - return false; -#endif // wxUSE_REGEX/!wxUSE_REGEX -} - -// Count the number of chars -int wxString::Freq(wxChar ch) const -{ - int count = 0; - int len = length(); - for (int i = 0; i < len; i++) - { - if (GetChar(i) == ch) - count ++; - } - return count; -} - -// convert to upper case, return the copy of the string -wxString wxString::Upper() const -{ wxString s(*this); return s.MakeUpper(); } - -// convert to lower case, return the copy of the string -wxString wxString::Lower() const { wxString s(*this); return s.MakeLower(); } - -int wxString::sprintf(const wxChar *pszFormat, ...) - { - va_list argptr; - va_start(argptr, pszFormat); - int iLen = PrintfV(pszFormat, argptr); - va_end(argptr); - return iLen; - } - -// ============================================================================ -// ArrayString -// ============================================================================ - -#include "wx/arrstr.h" - -wxArrayString::wxArrayString(size_t sz, const wxChar** a) -{ -#if !wxUSE_STL - Init(false); -#endif - for (size_t i=0; i < sz; i++) - Add(a[i]); -} - -wxArrayString::wxArrayString(size_t sz, const wxString* a) -{ -#if !wxUSE_STL - Init(false); -#endif - for (size_t i=0; i < sz; i++) - Add(a[i]); -} - -#if !wxUSE_STL - -// size increment = min(50% of current size, ARRAY_MAXSIZE_INCREMENT) -#define ARRAY_MAXSIZE_INCREMENT 4096 - -#ifndef ARRAY_DEFAULT_INITIAL_SIZE // also defined in dynarray.h -#define ARRAY_DEFAULT_INITIAL_SIZE (16) -#endif - -#define STRING(p) ((wxString *)(&(p))) - -// ctor -void wxArrayString::Init(bool autoSort) -{ - m_nSize = - m_nCount = 0; - m_pItems = (wxChar **) NULL; - m_autoSort = autoSort; -} - -// copy ctor -wxArrayString::wxArrayString(const wxArrayString& src) -{ - Init(src.m_autoSort); - - *this = src; -} - -// assignment operator -wxArrayString& wxArrayString::operator=(const wxArrayString& src) -{ - if ( m_nSize > 0 ) - Clear(); - - Copy(src); - - m_autoSort = src.m_autoSort; - - return *this; -} - -void wxArrayString::Copy(const wxArrayString& src) -{ - if ( src.m_nCount > ARRAY_DEFAULT_INITIAL_SIZE ) - Alloc(src.m_nCount); - - for ( size_t n = 0; n < src.m_nCount; n++ ) - Add(src[n]); -} - -// grow the array -void wxArrayString::Grow(size_t nIncrement) -{ - // only do it if no more place - if ( (m_nSize - m_nCount) < nIncrement ) { - // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would - // be never resized! - #if ARRAY_DEFAULT_INITIAL_SIZE == 0 - #error "ARRAY_DEFAULT_INITIAL_SIZE must be > 0!" - #endif - - if ( m_nSize == 0 ) { - // was empty, alloc some memory - m_nSize = ARRAY_DEFAULT_INITIAL_SIZE; - if (m_nSize < nIncrement) - m_nSize = nIncrement; - m_pItems = new wxChar *[m_nSize]; - } - else { - // otherwise when it's called for the first time, nIncrement would be 0 - // and the array would never be expanded - // add 50% but not too much - size_t ndefIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE - ? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1; - if ( ndefIncrement > ARRAY_MAXSIZE_INCREMENT ) - ndefIncrement = ARRAY_MAXSIZE_INCREMENT; - if ( nIncrement < ndefIncrement ) - nIncrement = ndefIncrement; - m_nSize += nIncrement; - wxChar **pNew = new wxChar *[m_nSize]; - - // copy data to new location - memcpy(pNew, m_pItems, m_nCount*sizeof(wxChar *)); - - // delete old memory (but do not release the strings!) - wxDELETEA(m_pItems); - - m_pItems = pNew; - } - } -} - -void wxArrayString::Free() -{ - for ( size_t n = 0; n < m_nCount; n++ ) { - STRING(m_pItems[n])->GetStringData()->Unlock(); - } -} - -// deletes all the strings from the list -void wxArrayString::Empty() -{ - Free(); - - m_nCount = 0; -} - -// as Empty, but also frees memory -void wxArrayString::Clear() -{ - Free(); - - m_nSize = - m_nCount = 0; - - wxDELETEA(m_pItems); -} - -// dtor -wxArrayString::~wxArrayString() -{ - Free(); - - wxDELETEA(m_pItems); -} - -void wxArrayString::reserve(size_t nSize) -{ - Alloc(nSize); -} - -// pre-allocates memory (frees the previous data!) -void wxArrayString::Alloc(size_t nSize) -{ - // only if old buffer was not big enough - if ( nSize > m_nSize ) { - wxChar **pNew = new wxChar *[nSize]; - if ( !pNew ) - return; - - memcpy(pNew, m_pItems, m_nCount*sizeof(wxChar *)); - delete [] m_pItems; - - m_pItems = pNew; - m_nSize = nSize; - } -} - -// minimizes the memory usage by freeing unused memory -void wxArrayString::Shrink() -{ - // only do it if we have some memory to free - if( m_nCount < m_nSize ) { - // allocates exactly as much memory as we need - wxChar **pNew = new wxChar *[m_nCount]; - - // copy data to new location - memcpy(pNew, m_pItems, m_nCount*sizeof(wxChar *)); - delete [] m_pItems; - m_pItems = pNew; - m_nSize = m_nCount; - } -} - -#if WXWIN_COMPATIBILITY_2_4 - -// return a wxString[] as required for some control ctors. -wxString* wxArrayString::GetStringArray() const -{ - wxString *array = 0; - - if( m_nCount > 0 ) - { - array = new wxString[m_nCount]; - for( size_t i = 0; i < m_nCount; i++ ) - array[i] = m_pItems[i]; - } - - return array; -} - -void wxArrayString::Remove(size_t nIndex, size_t nRemove) -{ - RemoveAt(nIndex, nRemove); -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// searches the array for an item (forward or backwards) -int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const -{ - if ( m_autoSort ) { - // use binary search in the sorted array - wxASSERT_MSG( bCase && !bFromEnd, - wxT("search parameters ignored for auto sorted array") ); - - size_t i, - lo = 0, - hi = m_nCount; - int res; - while ( lo < hi ) { - i = (lo + hi)/2; - - res = wxStrcmp(sz, m_pItems[i]); - if ( res < 0 ) - hi = i; - else if ( res > 0 ) - lo = i + 1; - else - return i; - } - - return wxNOT_FOUND; - } - else { - // use linear search in unsorted array - if ( bFromEnd ) { - if ( m_nCount > 0 ) { - size_t ui = m_nCount; - do { - if ( STRING(m_pItems[--ui])->IsSameAs(sz, bCase) ) - return ui; - } - while ( ui != 0 ); - } - } - else { - for( size_t ui = 0; ui < m_nCount; ui++ ) { - if( STRING(m_pItems[ui])->IsSameAs(sz, bCase) ) - return ui; - } - } - } - - return wxNOT_FOUND; -} - -// add item at the end -size_t wxArrayString::Add(const wxString& str, size_t nInsert) -{ - if ( m_autoSort ) { - // insert the string at the correct position to keep the array sorted - size_t i, - lo = 0, - hi = m_nCount; - int res; - while ( lo < hi ) { - i = (lo + hi)/2; - - res = str.Cmp(m_pItems[i]); - if ( res < 0 ) - hi = i; - else if ( res > 0 ) - lo = i + 1; - else { - lo = hi = i; - break; - } - } - - wxASSERT_MSG( lo == hi, wxT("binary search broken") ); - - Insert(str, lo, nInsert); - - return (size_t)lo; - } - else { - wxASSERT( str.GetStringData()->IsValid() ); - - Grow(nInsert); - - for (size_t i = 0; i < nInsert; i++) - { - // the string data must not be deleted! - str.GetStringData()->Lock(); - - // just append - m_pItems[m_nCount + i] = (wxChar *)str.c_str(); // const_cast - } - size_t ret = m_nCount; - m_nCount += nInsert; - return ret; - } -} - -// add item at the given position -void wxArrayString::Insert(const wxString& str, size_t nIndex, size_t nInsert) -{ - wxASSERT( str.GetStringData()->IsValid() ); - - wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArrayString::Insert") ); - wxCHECK_RET( m_nCount <= m_nCount + nInsert, - wxT("array size overflow in wxArrayString::Insert") ); - - Grow(nInsert); - - memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], - (m_nCount - nIndex)*sizeof(wxChar *)); - - for (size_t i = 0; i < nInsert; i++) - { - str.GetStringData()->Lock(); - m_pItems[nIndex + i] = (wxChar *)str.c_str(); - } - m_nCount += nInsert; -} - -// range insert (STL 23.2.4.3) -void -wxArrayString::insert(iterator it, const_iterator first, const_iterator last) -{ - const int idx = it - begin(); - - // grow it once - Grow(last - first); - - // reset "it" since it can change inside Grow() - it = begin() + idx; - - while ( first != last ) - { - it = insert(it, *first); - - // insert returns an iterator to the last element inserted but we need - // insert the next after this one, that is before the next one - ++it; - - ++first; - } -} - -// expand the array -void wxArrayString::SetCount(size_t count) -{ - Alloc(count); - - wxString s; - while ( m_nCount < count ) - m_pItems[m_nCount++] = (wxChar *)s.c_str(); -} - -// removes item from array (by index) -void wxArrayString::RemoveAt(size_t nIndex, size_t nRemove) -{ - wxCHECK_RET( nIndex < m_nCount, wxT("bad index in wxArrayString::Remove") ); - wxCHECK_RET( nIndex + nRemove <= m_nCount, - wxT("removing too many elements in wxArrayString::Remove") ); - - // release our lock - for (size_t i = 0; i < nRemove; i++) - Item(nIndex + i).GetStringData()->Unlock(); - - memmove(&m_pItems[nIndex], &m_pItems[nIndex + nRemove], - (m_nCount - nIndex - nRemove)*sizeof(wxChar *)); - m_nCount -= nRemove; -} - -// removes item from array (by value) -void wxArrayString::Remove(const wxChar *sz) -{ - int iIndex = Index(sz); - - wxCHECK_RET( iIndex != wxNOT_FOUND, - wxT("removing inexistent element in wxArrayString::Remove") ); - - RemoveAt(iIndex); -} - -void wxArrayString::assign(const_iterator first, const_iterator last) -{ - reserve(last - first); - for(; first != last; ++first) - push_back(*first); -} - -// ---------------------------------------------------------------------------- -// sorting -// ---------------------------------------------------------------------------- - -// we can only sort one array at a time with the quick-sort based -// implementation -#if wxUSE_THREADS - // need a critical section to protect access to gs_compareFunction and - // gs_sortAscending variables - static wxCriticalSection gs_critsectStringSort; -#endif // wxUSE_THREADS - -// function to use for string comparaison -static wxArrayString::CompareFunction gs_compareFunction = NULL; - -// if we don't use the compare function, this flag tells us if we sort the -// array in ascending or descending order -static bool gs_sortAscending = true; - -// function which is called by quick sort -extern "C" int wxC_CALLING_CONV // LINKAGEMODE -wxStringCompareFunction(const void *first, const void *second) -{ - wxString *strFirst = (wxString *)first; - wxString *strSecond = (wxString *)second; - - if ( gs_compareFunction ) { - return gs_compareFunction(*strFirst, *strSecond); - } - else { - // maybe we should use wxStrcoll - int result = strFirst->Cmp(*strSecond); - - return gs_sortAscending ? result : -result; - } -} - -// sort array elements using passed comparaison function -void wxArrayString::Sort(CompareFunction compareFunction) -{ - wxCRIT_SECT_LOCKER(lockCmpFunc, gs_critsectStringSort); - - wxASSERT( !gs_compareFunction ); // must have been reset to NULL - gs_compareFunction = compareFunction; - - DoSort(); - - // reset it to NULL so that Sort(bool) will work the next time - gs_compareFunction = NULL; -} - -extern "C" -{ - typedef int (wxC_CALLING_CONV * wxStringCompareFn)(const void *first, - const void *second); -} - -void wxArrayString::Sort(CompareFunction2 compareFunction) -{ - qsort(m_pItems, m_nCount, sizeof(wxChar *), (wxStringCompareFn)compareFunction); -} - -void wxArrayString::Sort(bool reverseOrder) -{ - Sort(reverseOrder ? wxStringSortDescending : wxStringSortAscending); -} - -void wxArrayString::DoSort() -{ - wxCHECK_RET( !m_autoSort, wxT("can't use this method with sorted arrays") ); - - // just sort the pointers using qsort() - of course it only works because - // wxString() *is* a pointer to its data - qsort(m_pItems, m_nCount, sizeof(wxChar *), wxStringCompareFunction); -} - -bool wxArrayString::operator==(const wxArrayString& a) const -{ - if ( m_nCount != a.m_nCount ) - return false; - - for ( size_t n = 0; n < m_nCount; n++ ) - { - if ( Item(n) != a[n] ) - return false; - } - - return true; -} - -#endif // !wxUSE_STL - -int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2) -{ - return s1->Cmp(*s2); -} - -int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) -{ - return -s1->Cmp(*s2); -} - -wxString* wxCArrayString::Release() -{ - wxString *r = GetStrings(); - m_strings = NULL; - return r; -} diff --git a/Source/3rdParty/wx/src/common/sysopt.cpp b/Source/3rdParty/wx/src/common/sysopt.cpp deleted file mode 100644 index 7a61ad01b..000000000 --- a/Source/3rdParty/wx/src/common/sysopt.cpp +++ /dev/null @@ -1,111 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/sysopt.cpp -// Purpose: wxSystemOptions -// Author: Julian Smart -// Modified by: -// Created: 2001-07-10 -// RCS-ID: $Id: sysopt.cpp 39851 2006-06-27 14:33:14Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#if wxUSE_SYSTEM_OPTIONS - -#include "wx/sysopt.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/list.h" - #include "wx/string.h" - #include "wx/arrstr.h" -#endif - -// ---------------------------------------------------------------------------- -// private globals -// ---------------------------------------------------------------------------- - -static wxArrayString gs_optionNames, - gs_optionValues; - -// ============================================================================ -// wxSystemOptions implementation -// ============================================================================ - -// Option functions (arbitrary name/value mapping) -void wxSystemOptions::SetOption(const wxString& name, const wxString& value) -{ - int idx = gs_optionNames.Index(name, false); - if (idx == wxNOT_FOUND) - { - gs_optionNames.Add(name); - gs_optionValues.Add(value); - } - else - { - gs_optionNames[idx] = name; - gs_optionValues[idx] = value; - } -} - -void wxSystemOptions::SetOption(const wxString& name, int value) -{ - SetOption(name, wxString::Format(wxT("%d"), value)); -} - -wxString wxSystemOptions::GetOption(const wxString& name) -{ - wxString val; - - int idx = gs_optionNames.Index(name, false); - if ( idx != wxNOT_FOUND ) - { - val = gs_optionValues[idx]; - } - else // not set explicitely - { - // look in the environment: first for a variable named "wx_appname_name" - // which can be set to affect the behaviour or just this application - // and then for "wx_name" which can be set to change the option globally - wxString var(name); - var.Replace(_T("."), _T("_")); // '.'s not allowed in env var names - - wxString appname; - if ( wxTheApp ) - appname = wxTheApp->GetAppName(); - - if ( !appname.empty() ) - val = wxGetenv(_T("wx_") + appname + _T('_') + var); - - if ( val.empty() ) - val = wxGetenv(_T("wx_") + var); - } - - return val; -} - -int wxSystemOptions::GetOptionInt(const wxString& name) -{ - return wxAtoi(GetOption(name)); -} - -bool wxSystemOptions::HasOption(const wxString& name) -{ - return !GetOption(name).empty(); -} - -#endif // wxUSE_SYSTEM_OPTIONS diff --git a/Source/3rdParty/wx/src/common/tarstrm.cpp b/Source/3rdParty/wx/src/common/tarstrm.cpp deleted file mode 100644 index 5315a996c..000000000 --- a/Source/3rdParty/wx/src/common/tarstrm.cpp +++ /dev/null @@ -1,1534 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tarstrm.cpp -// Purpose: Streams for Tar files -// Author: Mike Wetherell -// RCS-ID: $Id: tarstrm.cpp 63302 2010-01-28 21:46:09Z MW $ -// Copyright: (c) 2004 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TARSTREAM - -#include "wx/tarstrm.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif - -#include "wx/buffer.h" -#include "wx/datetime.h" -#include "wx/ptr_scpd.h" -#include "wx/filename.h" -#include "wx/thread.h" - -#include - -#ifdef __UNIX__ -#include -#include -#endif - - -///////////////////////////////////////////////////////////////////////////// -// constants - -enum { - TAR_NAME, - TAR_MODE, - TAR_UID, - TAR_GID, - TAR_SIZE, - TAR_MTIME, - TAR_CHKSUM, - TAR_TYPEFLAG, - TAR_LINKNAME, - TAR_MAGIC, - TAR_VERSION, - TAR_UNAME, - TAR_GNAME, - TAR_DEVMAJOR, - TAR_DEVMINOR, - TAR_PREFIX, - TAR_UNUSED, - TAR_NUMFIELDS -}; - -enum { - TAR_BLOCKSIZE = 512 -}; - -// checksum type -enum { - SUM_UNKNOWN, - SUM_UNSIGNED, - SUM_SIGNED -}; - -// type of input tar -enum { - TYPE_OLDTAR, // fields after TAR_LINKNAME are invalid - TYPE_GNUTAR, // all fields except TAR_PREFIX are valid - TYPE_USTAR // all fields are valid -}; - -// signatures -static const char *USTAR_MAGIC = "ustar"; -static const char *USTAR_VERSION = "00"; -static const char *GNU_MAGIC = "ustar "; -static const char *GNU_VERION = " "; - -IMPLEMENT_DYNAMIC_CLASS(wxTarEntry, wxArchiveEntry) -IMPLEMENT_DYNAMIC_CLASS(wxTarClassFactory, wxArchiveClassFactory) - - -///////////////////////////////////////////////////////////////////////////// -// Class factory - -static wxTarClassFactory g_wxTarClassFactory; - -wxTarClassFactory::wxTarClassFactory() -{ - if (this == &g_wxTarClassFactory) - PushFront(); -} - -const wxChar * const * -wxTarClassFactory::GetProtocols(wxStreamProtocolType type) const -{ - static const wxChar *protocols[] = { _T("tar"), NULL }; - static const wxChar *mimetypes[] = { _T("application/x-tar"), NULL }; - static const wxChar *fileexts[] = { _T(".tar"), NULL }; - static const wxChar *empty[] = { NULL }; - - switch (type) { - case wxSTREAM_PROTOCOL: return protocols; - case wxSTREAM_MIMETYPE: return mimetypes; - case wxSTREAM_FILEEXT: return fileexts; - default: return empty; - } -} - - -///////////////////////////////////////////////////////////////////////////// -// tar header block - -typedef wxFileOffset wxTarNumber; - -struct wxTarField { const wxChar *name; int pos; }; - -class wxTarHeaderBlock -{ -public: - wxTarHeaderBlock() - { memset(data, 0, sizeof(data)); } - wxTarHeaderBlock(const wxTarHeaderBlock& hb) - { memcpy(data, hb.data, sizeof(data)); } - - bool Read(wxInputStream& in); - bool Write(wxOutputStream& out); - inline bool WriteField(wxOutputStream& out, int id); - - bool IsAllZeros() const; - wxUint32 Sum(bool SignedSum = false); - wxUint32 SumField(int id); - - char *Get(int id) { return data + fields[id].pos + id; } - static size_t Len(int id) { return fields[id + 1].pos - fields[id].pos; } - static const wxChar *Name(int id) { return fields[id].name; } - static size_t Offset(int id) { return fields[id].pos; } - - bool SetOctal(int id, wxTarNumber n); - wxTarNumber GetOctal(int id); - bool SetPath(const wxString& name, wxMBConv& conv); - -private: - char data[TAR_BLOCKSIZE + TAR_NUMFIELDS]; - static const wxTarField fields[]; - static void check(); -}; - -wxDEFINE_SCOPED_PTR_TYPE(wxTarHeaderBlock) - -// A table giving the field names and offsets in a tar header block -const wxTarField wxTarHeaderBlock::fields[] = -{ - { _T("name"), 0 }, // 100 - { _T("mode"), 100 }, // 8 - { _T("uid"), 108 }, // 8 - { _T("gid"), 116 }, // 8 - { _T("size"), 124 }, // 12 - { _T("mtime"), 136 }, // 12 - { _T("chksum"), 148 }, // 8 - { _T("typeflag"), 156 }, // 1 - { _T("linkname"), 157 }, // 100 - { _T("magic"), 257 }, // 6 - { _T("version"), 263 }, // 2 - { _T("uname"), 265 }, // 32 - { _T("gname"), 297 }, // 32 - { _T("devmajor"), 329 }, // 8 - { _T("devminor"), 337 }, // 8 - { _T("prefix"), 345 }, // 155 - { _T("unused"), 500 }, // 12 - { NULL, TAR_BLOCKSIZE } -}; - -void wxTarHeaderBlock::check() -{ -#if 0 - wxCOMPILE_TIME_ASSERT( - WXSIZEOF(fields) == TAR_NUMFIELDS + 1, - Wrong_number_of_elements_in_fields_table - ); -#endif -} - -bool wxTarHeaderBlock::IsAllZeros() const -{ - const char *p = data; - for (size_t i = 0; i < sizeof(data); i++) - if (p[i]) - return false; - return true; -} - -wxUint32 wxTarHeaderBlock::Sum(bool SignedSum /*=false*/) -{ - // the chksum field itself should be blanks during the calculation - memset(Get(TAR_CHKSUM), ' ', Len(TAR_CHKSUM)); - const char *p = data; - wxUint32 n = 0; - - if (SignedSum) - for (size_t i = 0; i < sizeof(data); i++) - n += (signed char)p[i]; - else - for (size_t i = 0; i < sizeof(data); i++) - n += (unsigned char)p[i]; - - return n; -} - -wxUint32 wxTarHeaderBlock::SumField(int id) -{ - unsigned char *p = (unsigned char*)Get(id); - unsigned char *q = p + Len(id); - wxUint32 n = 0; - - while (p < q) - n += *p++; - - return n; -} - -bool wxTarHeaderBlock::Read(wxInputStream& in) -{ - bool ok = true; - - for (int id = 0; id < TAR_NUMFIELDS && ok; id++) - ok = in.Read(Get(id), Len(id)).LastRead() == Len(id); - - return ok; -} - -bool wxTarHeaderBlock::Write(wxOutputStream& out) -{ - bool ok = true; - - for (int id = 0; id < TAR_NUMFIELDS && ok; id++) - ok = WriteField(out, id); - - return ok; -} - -inline bool wxTarHeaderBlock::WriteField(wxOutputStream& out, int id) -{ - return out.Write(Get(id), Len(id)).LastWrite() == Len(id); -} - -wxTarNumber wxTarHeaderBlock::GetOctal(int id) -{ - wxTarNumber n = 0; - const char *p = Get(id); - while (*p == ' ') - p++; - while (*p >= '0' && *p < '8') - n = (n << 3) | (*p++ - '0'); - return n; -} - -bool wxTarHeaderBlock::SetOctal(int id, wxTarNumber n) -{ - // set an octal field, return true if the number fits - char *field = Get(id); - char *p = field + Len(id); - *--p = 0; - while (p > field) { - *--p = char('0' + (n & 7)); - n >>= 3; - } - return n == 0; -} - -bool wxTarHeaderBlock::SetPath(const wxString& name, wxMBConv& conv) -{ - bool badconv = false; - -#if wxUSE_UNICODE - wxCharBuffer nameBuf = name.mb_str(conv); - - // if the conversion fails make an approximation - if (!nameBuf) { - badconv = true; - size_t len = name.length(); - wxCharBuffer approx(len); - for (size_t i = 0; i < len; i++) - approx.data()[i] = name[i] & ~0x7F ? '_' : name[i]; - nameBuf = approx; - } - - const char *mbName = nameBuf; -#else - const char *mbName = name.c_str(); - (void)conv; -#endif - - bool fits; - bool notGoingToFit = false; - size_t len = strlen(mbName); - size_t maxname = Len(TAR_NAME); - size_t maxprefix = Len(TAR_PREFIX); - size_t i = 0; - size_t nexti = 0; - - for (;;) { - fits = i < maxprefix && len - i <= maxname; - - if (!fits) { - const char *p = strchr(mbName + i, '/'); - if (p) - nexti = p - mbName + 1; - if (!p || nexti - 1 > maxprefix) - notGoingToFit = true; - } - - if (fits || notGoingToFit) { - strncpy(Get(TAR_NAME), mbName + i, maxname); - if (i > 0) - strncpy(Get(TAR_PREFIX), mbName, i - 1); - break; - } - - i = nexti; - } - - return fits && !badconv; -} - - -///////////////////////////////////////////////////////////////////////////// -// Some helpers - -static wxFileOffset RoundUpSize(wxFileOffset size, int factor = 1) -{ - wxFileOffset chunk = TAR_BLOCKSIZE * factor; - return ((size + chunk - 1) / chunk) * chunk; -} - -#ifdef __UNIX__ - -static wxString wxTarUserName(int uid) -{ - struct passwd *ppw; - -#ifdef HAVE_GETPWUID_R -#if defined HAVE_SYSCONF && defined _SC_GETPW_R_SIZE_MAX - long pwsize = sysconf(_SC_GETPW_R_SIZE_MAX); - size_t bufsize(wxMin(wxMax(1024l, pwsize), 32768l)); -#else - size_t bufsize = 1024; -#endif - wxCharBuffer buf(bufsize); - struct passwd pw; - - memset(&pw, 0, sizeof(pw)); - if (getpwuid_r(uid, &pw, buf.data(), bufsize, &ppw) == 0 && pw.pw_name) - return wxString(pw.pw_name, wxConvLibc); -#else - if ((ppw = getpwuid(uid)) != NULL) - return wxString(ppw->pw_name, wxConvLibc); -#endif - return _("unknown"); -} - -static wxString wxTarGroupName(int gid) -{ - struct group *pgr; -#ifdef HAVE_GETGRGID_R -#if defined HAVE_SYSCONF && defined _SC_GETGR_R_SIZE_MAX - long grsize = sysconf(_SC_GETGR_R_SIZE_MAX); - size_t bufsize(wxMin(wxMax(1024l, grsize), 32768l)); -#else - size_t bufsize = 1024; -#endif - wxCharBuffer buf(bufsize); - struct group gr; - - memset(&gr, 0, sizeof(gr)); - if (getgrgid_r(gid, &gr, buf.data(), bufsize, &pgr) == 0 && gr.gr_name) - return wxString(gr.gr_name, wxConvLibc); -#else - if ((pgr = getgrgid(gid)) != NULL) - return wxString(pgr->gr_name, wxConvLibc); -#endif - return _("unknown"); -} - -#endif // __UNIX__ - -// Cache the user and group names since getting them can be expensive, -// get both names and ids at the same time. -// -struct wxTarUser -{ - wxTarUser(); - ~wxTarUser() { delete [] uname; delete [] gname; } - - int uid; - int gid; - - wxChar *uname; - wxChar *gname; -}; - -wxTarUser::wxTarUser() -{ -#ifdef __UNIX__ - uid = getuid(); - gid = getgid(); - wxString usr = wxTarUserName(uid); - wxString grp = wxTarGroupName(gid); -#else - uid = 0; - gid = 0; - wxString usr = wxGetUserId(); - wxString grp = _("unknown"); -#endif - - uname = new wxChar[usr.length() + 1]; - wxStrcpy(uname, usr.c_str()); - - gname = new wxChar[grp.length() + 1]; - wxStrcpy(gname, grp.c_str()); -} - -static const wxTarUser& wxGetTarUser() -{ -#if wxUSE_THREADS - static wxCriticalSection cs; - wxCriticalSectionLocker lock(cs); -#endif - static wxTarUser tu; - return tu; -} - -// ignore the size field for entry types 3, 4, 5 and 6 -// -static inline wxFileOffset GetDataSize(const wxTarEntry& entry) -{ - switch (entry.GetTypeFlag()) { - case wxTAR_CHRTYPE: - case wxTAR_BLKTYPE: - case wxTAR_DIRTYPE: - case wxTAR_FIFOTYPE: - return 0; - default: - return entry.GetSize(); - } -} - - -///////////////////////////////////////////////////////////////////////////// -// Tar Entry -// Holds all the meta-data for a file in the tar - -wxTarEntry::wxTarEntry(const wxString& name /*=wxEmptyString*/, - const wxDateTime& dt /*=wxDateTime::Now()*/, - wxFileOffset size /*=0*/) - : m_Mode(0644), - m_IsModeSet(false), - m_UserId(wxGetTarUser().uid), - m_GroupId(wxGetTarUser().gid), - m_Size(size), - m_Offset(wxInvalidOffset), - m_ModifyTime(dt), - m_TypeFlag(wxTAR_REGTYPE), - m_UserName(wxGetTarUser().uname), - m_GroupName(wxGetTarUser().gname), - m_DevMajor(~0), - m_DevMinor(~0) -{ - if (!name.empty()) - SetName(name); -} - -wxTarEntry::~wxTarEntry() -{ -} - -wxTarEntry::wxTarEntry(const wxTarEntry& e) - : wxArchiveEntry(), - m_Name(e.m_Name), - m_Mode(e.m_Mode), - m_IsModeSet(e.m_IsModeSet), - m_UserId(e.m_UserId), - m_GroupId(e.m_GroupId), - m_Size(e.m_Size), - m_Offset(e.m_Offset), - m_ModifyTime(e.m_ModifyTime), - m_AccessTime(e.m_AccessTime), - m_CreateTime(e.m_CreateTime), - m_TypeFlag(e.m_TypeFlag), - m_LinkName(e.m_LinkName), - m_UserName(e.m_UserName), - m_GroupName(e.m_GroupName), - m_DevMajor(e.m_DevMajor), - m_DevMinor(e.m_DevMinor) -{ -} - -wxTarEntry& wxTarEntry::operator=(const wxTarEntry& e) -{ - if (&e != this) { - m_Name = e.m_Name; - m_Mode = e.m_Mode; - m_IsModeSet = e.m_IsModeSet; - m_UserId = e.m_UserId; - m_GroupId = e.m_GroupId; - m_Size = e.m_Size; - m_Offset = e.m_Offset; - m_ModifyTime = e.m_ModifyTime; - m_AccessTime = e.m_AccessTime; - m_CreateTime = e.m_CreateTime; - m_TypeFlag = e.m_TypeFlag; - m_LinkName = e.m_LinkName; - m_UserName = e.m_UserName; - m_GroupName = e.m_GroupName; - m_DevMajor = e.m_DevMajor; - m_DevMinor = e.m_DevMinor; - } - return *this; -} - -wxString wxTarEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const -{ - bool isDir = IsDir() && !m_Name.empty(); - - // optimisations for common (and easy) cases - switch (wxFileName::GetFormat(format)) { - case wxPATH_DOS: - { - wxString name(isDir ? m_Name + _T("\\") : m_Name); - for (size_t i = 0; i < name.length(); i++) - if (name[i] == _T('/')) - name[i] = _T('\\'); - return name; - } - - case wxPATH_UNIX: - return isDir ? m_Name + _T("/") : m_Name; - - default: - ; - } - - wxFileName fn; - - if (isDir) - fn.AssignDir(m_Name, wxPATH_UNIX); - else - fn.Assign(m_Name, wxPATH_UNIX); - - return fn.GetFullPath(format); -} - -void wxTarEntry::SetName(const wxString& name, wxPathFormat format) -{ - bool isDir; - m_Name = GetInternalName(name, format, &isDir); - SetIsDir(isDir); -} - -// Static - Internally tars and zips use forward slashes for the path -// separator, absolute paths aren't allowed, and directory names have a -// trailing slash. This function converts a path into this internal format, -// but without a trailing slash for a directory. -// -wxString wxTarEntry::GetInternalName(const wxString& name, - wxPathFormat format /*=wxPATH_NATIVE*/, - bool *pIsDir /*=NULL*/) -{ - wxString internal; - - if (wxFileName::GetFormat(format) != wxPATH_UNIX) - internal = wxFileName(name, format).GetFullPath(wxPATH_UNIX); - else - internal = name; - - bool isDir = !internal.empty() && internal.Last() == '/'; - if (pIsDir) - *pIsDir = isDir; - if (isDir) - internal.erase(internal.length() - 1); - - while (!internal.empty() && *internal.begin() == '/') - internal.erase(0, 1); - while (!internal.empty() && internal.compare(0, 2, _T("./")) == 0) - internal.erase(0, 2); - if (internal == _T(".") || internal == _T("..")) - internal = wxEmptyString; - - return internal; -} - -bool wxTarEntry::IsDir() const -{ - return m_TypeFlag == wxTAR_DIRTYPE; -} - -void wxTarEntry::SetIsDir(bool isDir) -{ - if (isDir) - m_TypeFlag = wxTAR_DIRTYPE; - else if (m_TypeFlag == wxTAR_DIRTYPE) - m_TypeFlag = wxTAR_REGTYPE; -} - -void wxTarEntry::SetIsReadOnly(bool isReadOnly) -{ - if (isReadOnly) - m_Mode &= ~0222; - else - m_Mode |= 0200; -} - -int wxTarEntry::GetMode() const -{ - if (m_IsModeSet || !IsDir()) - return m_Mode; - else - return m_Mode | 0111; - -} - -void wxTarEntry::SetMode(int mode) -{ - m_Mode = mode & 07777; - m_IsModeSet = true; -} - - -///////////////////////////////////////////////////////////////////////////// -// Input stream - -wxDECLARE_SCOPED_PTR(wxTarEntry, wxTarEntryPtr_) -wxDEFINE_SCOPED_PTR (wxTarEntry, wxTarEntryPtr_) - -wxTarInputStream::wxTarInputStream(wxInputStream& stream, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveInputStream(stream, conv) -{ - Init(); -} - -wxTarInputStream::wxTarInputStream(wxInputStream *stream, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveInputStream(stream, conv) -{ - Init(); -} - -void wxTarInputStream::Init() -{ - m_pos = wxInvalidOffset; - m_offset = 0; - m_size = wxInvalidOffset; - m_sumType = SUM_UNKNOWN; - m_tarType = TYPE_USTAR; - m_hdr = new wxTarHeaderBlock; - m_HeaderRecs = NULL; - m_GlobalHeaderRecs = NULL; - m_lasterror = m_parent_i_stream->GetLastError(); -} - -wxTarInputStream::~wxTarInputStream() -{ - delete m_hdr; - delete m_HeaderRecs; - delete m_GlobalHeaderRecs; -} - -wxTarEntry *wxTarInputStream::GetNextEntry() -{ - m_lasterror = ReadHeaders(); - - if (!IsOk()) - return NULL; - - wxTarEntryPtr_ entry(new wxTarEntry); - - entry->SetMode(GetHeaderNumber(TAR_MODE)); - entry->SetUserId(GetHeaderNumber(TAR_UID)); - entry->SetGroupId(GetHeaderNumber(TAR_UID)); - entry->SetSize(GetHeaderNumber(TAR_SIZE)); - - entry->SetOffset(m_offset); - - entry->SetDateTime(GetHeaderDate(_T("mtime"))); - entry->SetAccessTime(GetHeaderDate(_T("atime"))); - entry->SetCreateTime(GetHeaderDate(_T("ctime"))); - - entry->SetTypeFlag(*m_hdr->Get(TAR_TYPEFLAG)); - bool isDir = entry->IsDir(); - - entry->SetLinkName(GetHeaderString(TAR_LINKNAME)); - - if (m_tarType != TYPE_OLDTAR) { - entry->SetUserName(GetHeaderString(TAR_UNAME)); - entry->SetGroupName(GetHeaderString(TAR_GNAME)); - - entry->SetDevMajor(GetHeaderNumber(TAR_DEVMAJOR)); - entry->SetDevMinor(GetHeaderNumber(TAR_DEVMINOR)); - } - - entry->SetName(GetHeaderPath(), wxPATH_UNIX); - if (isDir) - entry->SetIsDir(); - - if (m_HeaderRecs) - m_HeaderRecs->clear(); - - m_size = GetDataSize(*entry); - m_pos = 0; - - return entry.release(); -} - -bool wxTarInputStream::OpenEntry(wxTarEntry& entry) -{ - wxFileOffset offset = entry.GetOffset(); - - if (GetLastError() != wxSTREAM_READ_ERROR - && m_parent_i_stream->IsSeekable() - && m_parent_i_stream->SeekI(offset) == offset) - { - m_offset = offset; - m_size = GetDataSize(entry); - m_pos = 0; - m_lasterror = wxSTREAM_NO_ERROR; - return true; - } else { - m_lasterror = wxSTREAM_READ_ERROR; - return false; - } -} - -bool wxTarInputStream::OpenEntry(wxArchiveEntry& entry) -{ - wxTarEntry *tarEntry = wxStaticCast(&entry, wxTarEntry); - return tarEntry ? OpenEntry(*tarEntry) : false; -} - -bool wxTarInputStream::CloseEntry() -{ - if (m_lasterror == wxSTREAM_READ_ERROR) - return false; - if (!IsOpened()) - return true; - - wxFileOffset size = RoundUpSize(m_size); - wxFileOffset remainder = size - m_pos; - - if (remainder && m_parent_i_stream->IsSeekable()) { - wxLogNull nolog; - if (m_parent_i_stream->SeekI(remainder, wxFromCurrent) - != wxInvalidOffset) - remainder = 0; - } - - if (remainder) { - const int BUFSIZE = 8192; - wxCharBuffer buf(BUFSIZE); - - while (remainder > 0 && m_parent_i_stream->IsOk()) - remainder -= m_parent_i_stream->Read( - buf.data(), wxMin(BUFSIZE, remainder)).LastRead(); - } - - m_pos = wxInvalidOffset; - m_offset += size; - m_lasterror = m_parent_i_stream->GetLastError(); - - return IsOk(); -} - -wxStreamError wxTarInputStream::ReadHeaders() -{ - if (!CloseEntry()) - return wxSTREAM_READ_ERROR; - - bool done = false; - - while (!done) { - m_hdr->Read(*m_parent_i_stream); - if (m_parent_i_stream->Eof()) - wxLogError(_("incomplete header block in tar")); - if (!*m_parent_i_stream) - return wxSTREAM_READ_ERROR; - m_offset += TAR_BLOCKSIZE; - - // an all-zero header marks the end of the tar - if (m_hdr->IsAllZeros()) - return wxSTREAM_EOF; - - // the checksum is supposed to be the unsigned sum of the header bytes, - // but there have been versions of tar that used the signed sum, so - // accept that too, but only if used throughout. - wxUint32 chksum = m_hdr->GetOctal(TAR_CHKSUM); - bool ok = false; - - if (m_sumType != SUM_SIGNED) { - ok = chksum == m_hdr->Sum(); - if (m_sumType == SUM_UNKNOWN) - m_sumType = ok ? SUM_UNSIGNED : SUM_SIGNED; - } - if (m_sumType == SUM_SIGNED) - ok = chksum == m_hdr->Sum(true); - if (!ok) { - wxLogError(_("checksum failure reading tar header block")); - return wxSTREAM_READ_ERROR; - } - - if (strcmp(m_hdr->Get(TAR_MAGIC), USTAR_MAGIC) == 0) - m_tarType = TYPE_USTAR; - else if (strcmp(m_hdr->Get(TAR_MAGIC), GNU_MAGIC) == 0 && - strcmp(m_hdr->Get(TAR_VERSION), GNU_VERION) == 0) - m_tarType = TYPE_GNUTAR; - else - m_tarType = TYPE_OLDTAR; - - if (m_tarType != TYPE_USTAR) - break; - - switch (*m_hdr->Get(TAR_TYPEFLAG)) { - case 'g': ReadExtendedHeader(m_GlobalHeaderRecs); break; - case 'x': ReadExtendedHeader(m_HeaderRecs); break; - default: done = true; - } - } - - return wxSTREAM_NO_ERROR; -} - -wxString wxTarInputStream::GetExtendedHeader(const wxString& key) const -{ - wxTarHeaderRecords::iterator it; - - // look at normal extended header records first - if (m_HeaderRecs) { - it = m_HeaderRecs->find(key); - if (it != m_HeaderRecs->end()) - return wxString(it->second.wc_str(wxConvUTF8), GetConv()); - } - - // if not found, look at the global header records - if (m_GlobalHeaderRecs) { - it = m_GlobalHeaderRecs->find(key); - if (it != m_GlobalHeaderRecs->end()) - return wxString(it->second.wc_str(wxConvUTF8), GetConv()); - } - - return wxEmptyString; -} - -wxString wxTarInputStream::GetHeaderPath() const -{ - wxString path; - - if ((path = GetExtendedHeader(_T("path"))) != wxEmptyString) - return path; - - path = wxString(m_hdr->Get(TAR_NAME), GetConv()); - if (m_tarType != TYPE_USTAR) - return path; - - const char *prefix = m_hdr->Get(TAR_PREFIX); - return *prefix ? wxString(prefix, GetConv()) + _T("/") + path : path; -} - -wxDateTime wxTarInputStream::GetHeaderDate(const wxString& key) const -{ - wxString value; - - // try extended header, stored as decimal seconds since the epoch - if ((value = GetExtendedHeader(key)) != wxEmptyString) { - wxLongLong ll; - ll.Assign(wxAtof(value) * 1000.0); - return ll; - } - - if (key == _T("mtime")) - return wxLongLong(m_hdr->GetOctal(TAR_MTIME)) * 1000L; - - return wxDateTime(); -} - -wxTarNumber wxTarInputStream::GetHeaderNumber(int id) const -{ - wxString value; - - if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) { - wxTarNumber n = 0; - const wxChar *p = value; - while (*p == ' ') - p++; - while (isdigit(*p)) - n = n * 10 + (*p++ - '0'); - return n; - } else { - return m_hdr->GetOctal(id); - } -} - -wxString wxTarInputStream::GetHeaderString(int id) const -{ - wxString value; - - if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) - return value; - - return wxString(m_hdr->Get(id), GetConv()); -} - -// An extended header consists of one or more records, each constructed: -// "%d %s=%s\n", , , -// is the byte length, and are UTF-8 - -bool wxTarInputStream::ReadExtendedHeader(wxTarHeaderRecords*& recs) -{ - if (!recs) - recs = new wxTarHeaderRecords; - - // round length up to a whole number of blocks - size_t len = m_hdr->GetOctal(TAR_SIZE); - size_t size = RoundUpSize(len); - - // read in the whole header since it should be small - wxCharBuffer buf(size); - size_t lastread = m_parent_i_stream->Read(buf.data(), size).LastRead(); - if (lastread < len) - len = lastread; - buf.data()[len] = 0; - m_offset += lastread; - - size_t recPos, recSize; - bool ok = true; - - for (recPos = 0; recPos < len; recPos += recSize) { - char *pRec = buf.data() + recPos; - char *p = pRec; - - // read the record size (byte count in ascii decimal) - recSize = 0; - while (isdigit((unsigned char) *p)) - recSize = recSize * 10 + *p++ - '0'; - - // validity checks - if (recPos + recSize > len) - break; - if (recSize < p - pRec + (size_t)3 || *p != ' ' - || pRec[recSize - 1] != '\012') { - ok = false; - continue; - } - - // replace the final '\n' with a nul, to terminate value - pRec[recSize - 1] = 0; - // the key is here, following the space - char *pKey = ++p; - - // look forward for the '=', the value follows - while (*p && *p != '=') - p++; - if (!*p) { - ok = false; - continue; - } - // replace the '=' with a nul, to terminate the key - *p++ = 0; - - wxString key(wxConvUTF8.cMB2WC(pKey), GetConv()); - wxString value(wxConvUTF8.cMB2WC(p), GetConv()); - - // an empty value unsets a previously given value - if (value.empty()) - recs->erase(key); - else - (*recs)[key] = value; - } - - if (!ok || recPos < len || size != lastread) { - wxLogWarning(_("invalid data in extended tar header")); - return false; - } - - return true; -} - -wxFileOffset wxTarInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - if (!IsOpened()) { - wxLogError(_("tar entry not open")); - m_lasterror = wxSTREAM_READ_ERROR; - } - if (!IsOk()) - return wxInvalidOffset; - - switch (mode) { - case wxFromStart: break; - case wxFromCurrent: pos += m_pos; break; - case wxFromEnd: pos += m_size; break; - } - - if (pos < 0 || m_parent_i_stream->SeekI(m_offset + pos) == wxInvalidOffset) - return wxInvalidOffset; - - m_pos = pos; - return m_pos; -} - -size_t wxTarInputStream::OnSysRead(void *buffer, size_t size) -{ - if (!IsOpened()) { - wxLogError(_("tar entry not open")); - m_lasterror = wxSTREAM_READ_ERROR; - } - if (!IsOk() || !size) - return 0; - - if (m_pos >= m_size) - size = 0; - else if (m_pos + size > m_size + (size_t)0) - size = m_size - m_pos; - - size_t lastread = m_parent_i_stream->Read(buffer, size).LastRead(); - m_pos += lastread; - - if (m_pos >= m_size) { - m_lasterror = wxSTREAM_EOF; - } else if (!m_parent_i_stream->IsOk()) { - // any other error will have been reported by the underlying stream - if (m_parent_i_stream->Eof()) - wxLogError(_("unexpected end of file")); - m_lasterror = wxSTREAM_READ_ERROR; - } - - return lastread; -} - - -///////////////////////////////////////////////////////////////////////////// -// Output stream - -wxTarOutputStream::wxTarOutputStream(wxOutputStream& stream, - wxTarFormat format /*=wxTAR_PAX*/, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveOutputStream(stream, conv) -{ - Init(format); -} - -wxTarOutputStream::wxTarOutputStream(wxOutputStream *stream, - wxTarFormat format /*=wxTAR_PAX*/, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveOutputStream(stream, conv) -{ - Init(format); -} - -void wxTarOutputStream::Init(wxTarFormat format) -{ - m_pos = wxInvalidOffset; - m_maxpos = wxInvalidOffset; - m_size = wxInvalidOffset; - m_headpos = wxInvalidOffset; - m_datapos = wxInvalidOffset; - m_tarstart = wxInvalidOffset; - m_tarsize = 0; - m_pax = format == wxTAR_PAX; - m_BlockingFactor = m_pax ? 10 : 20; - m_chksum = 0; - m_large = false; - m_hdr = new wxTarHeaderBlock; - m_hdr2 = NULL; - m_extendedHdr = NULL; - m_extendedSize = 0; - m_lasterror = m_parent_o_stream->GetLastError(); -} - -wxTarOutputStream::~wxTarOutputStream() -{ - if (m_tarsize) - Close(); - delete m_hdr; - delete m_hdr2; - delete [] m_extendedHdr; -} - -bool wxTarOutputStream::PutNextEntry(wxTarEntry *entry) -{ - wxTarEntryPtr_ e(entry); - - if (!CloseEntry()) - return false; - - if (!m_tarsize) { - wxLogNull nolog; - m_tarstart = m_parent_o_stream->TellO(); - } - - if (m_tarstart != wxInvalidOffset) - m_headpos = m_tarstart + m_tarsize; - - if (WriteHeaders(*e)) { - m_pos = 0; - m_maxpos = 0; - m_size = GetDataSize(*e); - if (m_tarstart != wxInvalidOffset) - m_datapos = m_tarstart + m_tarsize; - - // types that are not allowd any data - const char nodata[] = { - wxTAR_LNKTYPE, wxTAR_SYMTYPE, wxTAR_CHRTYPE, wxTAR_BLKTYPE, - wxTAR_DIRTYPE, wxTAR_FIFOTYPE, 0 - }; - int typeflag = e->GetTypeFlag(); - - // pax does now allow data for wxTAR_LNKTYPE - if (!m_pax || typeflag != wxTAR_LNKTYPE) - if (strchr(nodata, typeflag) != NULL) - CloseEntry(); - } - - return IsOk(); -} - -bool wxTarOutputStream::PutNextEntry(const wxString& name, - const wxDateTime& dt, - wxFileOffset size) -{ - return PutNextEntry(new wxTarEntry(name, dt, size)); -} - -bool wxTarOutputStream::PutNextDirEntry(const wxString& name, - const wxDateTime& dt) -{ - wxTarEntry *entry = new wxTarEntry(name, dt); - entry->SetIsDir(); - return PutNextEntry(entry); -} - -bool wxTarOutputStream::PutNextEntry(wxArchiveEntry *entry) -{ - wxTarEntry *tarEntry = wxStaticCast(entry, wxTarEntry); - if (!tarEntry) - delete entry; - return PutNextEntry(tarEntry); -} - -bool wxTarOutputStream::CopyEntry(wxTarEntry *entry, - wxTarInputStream& inputStream) -{ - if (PutNextEntry(entry)) - Write(inputStream); - return IsOk() && inputStream.Eof(); -} - -bool wxTarOutputStream::CopyEntry(wxArchiveEntry *entry, - wxArchiveInputStream& inputStream) -{ - if (PutNextEntry(entry)) - Write(inputStream); - return IsOk() && inputStream.Eof(); -} - -bool wxTarOutputStream::CloseEntry() -{ - if (!IsOpened()) - return true; - - if (m_pos < m_maxpos) { - wxASSERT(m_parent_o_stream->IsSeekable()); - m_parent_o_stream->SeekO(m_datapos + m_maxpos); - m_lasterror = m_parent_o_stream->GetLastError(); - m_pos = m_maxpos; - } - - if (IsOk()) { - wxFileOffset size = RoundUpSize(m_pos); - if (size > m_pos) { - memset(m_hdr, 0, size - m_pos); - m_parent_o_stream->Write(m_hdr, size - m_pos); - m_lasterror = m_parent_o_stream->GetLastError(); - } - m_tarsize += size; - } - - if (IsOk() && m_pos != m_size) - ModifyHeader(); - - m_pos = wxInvalidOffset; - m_maxpos = wxInvalidOffset; - m_size = wxInvalidOffset; - m_headpos = wxInvalidOffset; - m_datapos = wxInvalidOffset; - - return IsOk(); -} - -bool wxTarOutputStream::Close() -{ - if (!CloseEntry()) - return false; - - memset(m_hdr, 0, sizeof(*m_hdr)); - int count = (RoundUpSize(m_tarsize + 2 * TAR_BLOCKSIZE, m_BlockingFactor) - - m_tarsize) / TAR_BLOCKSIZE; - while (count--) - m_parent_o_stream->Write(m_hdr, TAR_BLOCKSIZE); - - m_tarsize = 0; - m_tarstart = wxInvalidOffset; - m_lasterror = m_parent_o_stream->GetLastError(); - return IsOk(); -} - -bool wxTarOutputStream::WriteHeaders(wxTarEntry& entry) -{ - memset(m_hdr, 0, sizeof(*m_hdr)); - - SetHeaderPath(entry.GetName(wxPATH_UNIX)); - - SetHeaderNumber(TAR_MODE, entry.GetMode()); - SetHeaderNumber(TAR_UID, entry.GetUserId()); - SetHeaderNumber(TAR_GID, entry.GetGroupId()); - - if (entry.GetSize() == wxInvalidOffset) - entry.SetSize(0); - m_large = !SetHeaderNumber(TAR_SIZE, entry.GetSize()); - - SetHeaderDate(_T("mtime"), entry.GetDateTime()); - if (entry.GetAccessTime().IsValid()) - SetHeaderDate(_T("atime"), entry.GetAccessTime()); - if (entry.GetCreateTime().IsValid()) - SetHeaderDate(_T("ctime"), entry.GetCreateTime()); - - *m_hdr->Get(TAR_TYPEFLAG) = char(entry.GetTypeFlag()); - - strcpy(m_hdr->Get(TAR_MAGIC), USTAR_MAGIC); - strcpy(m_hdr->Get(TAR_VERSION), USTAR_VERSION); - - SetHeaderString(TAR_LINKNAME, entry.GetLinkName()); - SetHeaderString(TAR_UNAME, entry.GetUserName()); - SetHeaderString(TAR_GNAME, entry.GetGroupName()); - - if (~entry.GetDevMajor()) - SetHeaderNumber(TAR_DEVMAJOR, entry.GetDevMajor()); - if (~entry.GetDevMinor()) - SetHeaderNumber(TAR_DEVMINOR, entry.GetDevMinor()); - - m_chksum = m_hdr->Sum(); - m_hdr->SetOctal(TAR_CHKSUM, m_chksum); - if (!m_large) - m_chksum -= m_hdr->SumField(TAR_SIZE); - - // The main header is now fully prepared so we know what extended headers - // (if any) will be needed. Output any extended headers before writing - // the main header. - if (m_extendedHdr && *m_extendedHdr) { - wxASSERT(m_pax); - // the extended headers are written to the tar as a file entry, - // so prepare a regular header block for the pseudo-file. - if (!m_hdr2) - m_hdr2 = new wxTarHeaderBlock; - memset(m_hdr2, 0, sizeof(*m_hdr2)); - - // an old tar that doesn't understand extended headers will - // extract it as a file, so give these fields reasonable values - // so that the user will have access to read and remove it. - m_hdr2->SetPath(PaxHeaderPath(_T("%d/PaxHeaders.%p/%f"), - entry.GetName(wxPATH_UNIX)), GetConv()); - m_hdr2->SetOctal(TAR_MODE, 0600); - strcpy(m_hdr2->Get(TAR_UID), m_hdr->Get(TAR_UID)); - strcpy(m_hdr2->Get(TAR_GID), m_hdr->Get(TAR_GID)); - size_t length = strlen(m_extendedHdr); - m_hdr2->SetOctal(TAR_SIZE, length); - strcpy(m_hdr2->Get(TAR_MTIME), m_hdr->Get(TAR_MTIME)); - *m_hdr2->Get(TAR_TYPEFLAG) = 'x'; - strcpy(m_hdr2->Get(TAR_MAGIC), USTAR_MAGIC); - strcpy(m_hdr2->Get(TAR_VERSION), USTAR_VERSION); - strcpy(m_hdr2->Get(TAR_UNAME), m_hdr->Get(TAR_UNAME)); - strcpy(m_hdr2->Get(TAR_GNAME), m_hdr->Get(TAR_GNAME)); - - m_hdr2->SetOctal(TAR_CHKSUM, m_hdr2->Sum()); - - m_hdr2->Write(*m_parent_o_stream); - m_tarsize += TAR_BLOCKSIZE; - - size_t rounded = RoundUpSize(length); - memset(m_extendedHdr + length, 0, rounded - length); - m_parent_o_stream->Write(m_extendedHdr, rounded); - m_tarsize += rounded; - - *m_extendedHdr = 0; - - // update m_headpos which is used to seek back to fix up the file - // length if it is not known in advance - if (m_tarstart != wxInvalidOffset) - m_headpos = m_tarstart + m_tarsize; - } - - // if don't have extended headers just report error - if (!m_badfit.empty()) { - wxASSERT(!m_pax); - wxLogWarning(_("%s did not fit the tar header for entry '%s'"), - m_badfit.c_str(), entry.GetName().c_str()); - m_badfit.clear(); - } - - m_hdr->Write(*m_parent_o_stream); - m_tarsize += TAR_BLOCKSIZE; - m_lasterror = m_parent_o_stream->GetLastError(); - - return IsOk(); -} - -wxString wxTarOutputStream::PaxHeaderPath(const wxString& format, - const wxString& path) -{ - wxString d = path.BeforeLast(_T('/')); - wxString f = path.AfterLast(_T('/')); - wxString ret; - - if (d.empty()) - d = _T("."); - - ret.reserve(format.length() + path.length() + 16); - - size_t begin = 0; - size_t end; - - for (;;) { - end = format.find('%', begin); - if (end == wxString::npos || end + 1 >= format.length()) - break; - ret << format.substr(begin, end - begin); - switch (format[end + 1]) { - case 'd': ret << d; break; - case 'f': ret << f; break; - case 'p': ret << wxGetProcessId(); break; - case '%': ret << _T("%"); break; - } - begin = end + 2; - } - - ret << format.substr(begin); - - return ret; -} - -bool wxTarOutputStream::ModifyHeader() -{ - wxFileOffset originalPos = wxInvalidOffset; - wxFileOffset sizePos = wxInvalidOffset; - - if (!m_large && m_headpos != wxInvalidOffset - && m_parent_o_stream->IsSeekable()) - { - wxLogNull nolog; - originalPos = m_parent_o_stream->TellO(); - if (originalPos != wxInvalidOffset) - sizePos = - m_parent_o_stream->SeekO(m_headpos + m_hdr->Offset(TAR_SIZE)); - } - - if (sizePos == wxInvalidOffset || !m_hdr->SetOctal(TAR_SIZE, m_pos)) { - wxLogError(_("incorrect size given for tar entry")); - m_lasterror = wxSTREAM_WRITE_ERROR; - return false; - } - - m_chksum += m_hdr->SumField(TAR_SIZE); - m_hdr->SetOctal(TAR_CHKSUM, m_chksum); - wxFileOffset sumPos = m_headpos + m_hdr->Offset(TAR_CHKSUM); - - return - m_hdr->WriteField(*m_parent_o_stream, TAR_SIZE) && - m_parent_o_stream->SeekO(sumPos) == sumPos && - m_hdr->WriteField(*m_parent_o_stream, TAR_CHKSUM) && - m_parent_o_stream->SeekO(originalPos) == originalPos; -} - -void wxTarOutputStream::SetHeaderPath(const wxString& name) -{ - if (!m_hdr->SetPath(name, GetConv()) || (m_pax && !name.IsAscii())) - SetExtendedHeader(_T("path"), name); -} - -bool wxTarOutputStream::SetHeaderNumber(int id, wxTarNumber n) -{ - if (m_hdr->SetOctal(id, n)) { - return true; - } else { - SetExtendedHeader(m_hdr->Name(id), wxLongLong(n).ToString()); - return false; - } -} - -void wxTarOutputStream::SetHeaderString(int id, const wxString& str) -{ - strncpy(m_hdr->Get(id), str.mb_str(GetConv()), m_hdr->Len(id)); - if (str.length() > m_hdr->Len(id)) - SetExtendedHeader(m_hdr->Name(id), str); -} - -void wxTarOutputStream::SetHeaderDate(const wxString& key, - const wxDateTime& datetime) -{ - wxLongLong ll = datetime.IsValid() ? datetime.GetValue() : wxLongLong(0); - wxLongLong secs = ll / 1000L; - - if (key != _T("mtime") - || !m_hdr->SetOctal(TAR_MTIME, wxTarNumber(secs.GetValue())) - || secs <= 0 || secs >= 0x7fffffff) - { - wxString str; - if (ll >= LONG_MIN && ll <= LONG_MAX) { - str.Printf(_T("%g"), ll.ToLong() / 1000.0); - } else { - str = ll.ToString(); - str.insert(str.end() - 3, '.'); - } - SetExtendedHeader(key, str); - } -} - -void wxTarOutputStream::SetExtendedHeader(const wxString& key, - const wxString& value) -{ - if (m_pax) { - const wxWX2WCbuf wide_key = key.wc_str(GetConv()); - const wxCharBuffer utf_key = wxConvUTF8.cWC2MB(wide_key); - - const wxWX2WCbuf wide_value = value.wc_str(GetConv()); - const wxCharBuffer utf_value = wxConvUTF8.cWC2MB(wide_value); - - // a small buffer to format the length field in - char buf[32]; - // length of "99=\n" - unsigned long length = strlen(utf_value) + strlen(utf_key) + 5; - sprintf(buf, "%lu", length); - // the length includes itself - size_t lenlen = strlen(buf); - if (lenlen != 2) { - length += lenlen - 2; - sprintf(buf, "%lu", length); - if (strlen(buf) > lenlen) - sprintf(buf, "%lu", ++length); - } - - // reallocate m_extendedHdr if it's not big enough - if (m_extendedSize < length) { - size_t rounded = RoundUpSize(length); - m_extendedSize <<= 1; - if (rounded > m_extendedSize) - m_extendedSize = rounded; - char *oldHdr = m_extendedHdr; - m_extendedHdr = new char[m_extendedSize]; - if (oldHdr) { - strcpy(m_extendedHdr, oldHdr); - delete oldHdr; - } else { - *m_extendedHdr = 0; - } - } - - // append the new record - char *append = strchr(m_extendedHdr, 0); - sprintf(append, "%s %s=%s\012", buf, - (const char*)utf_key, (const char*)utf_value); - } - else { - // if not pax then make a list of fields to report as errors - if (!m_badfit.empty()) - m_badfit += _T(", "); - m_badfit += key; - } -} - -void wxTarOutputStream::Sync() -{ - m_parent_o_stream->Sync(); -} - -wxFileOffset wxTarOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - if (!IsOpened()) { - wxLogError(_("tar entry not open")); - m_lasterror = wxSTREAM_WRITE_ERROR; - } - if (!IsOk() || m_datapos == wxInvalidOffset) - return wxInvalidOffset; - - switch (mode) { - case wxFromStart: break; - case wxFromCurrent: pos += m_pos; break; - case wxFromEnd: pos += m_maxpos; break; - } - - if (pos < 0 || m_parent_o_stream->SeekO(m_datapos + pos) == wxInvalidOffset) - return wxInvalidOffset; - - m_pos = pos; - return m_pos; -} - -size_t wxTarOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - if (!IsOpened()) { - wxLogError(_("tar entry not open")); - m_lasterror = wxSTREAM_WRITE_ERROR; - } - if (!IsOk() || !size) - return 0; - - size_t lastwrite = m_parent_o_stream->Write(buffer, size).LastWrite(); - m_pos += lastwrite; - if (m_pos > m_maxpos) - m_maxpos = m_pos; - - if (lastwrite != size) - m_lasterror = wxSTREAM_WRITE_ERROR; - - return lastwrite; -} - -#endif // wxUSE_TARSTREAM diff --git a/Source/3rdParty/wx/src/common/tbarbase.cpp b/Source/3rdParty/wx/src/common/tbarbase.cpp deleted file mode 100644 index 084d17c06..000000000 --- a/Source/3rdParty/wx/src/common/tbarbase.cpp +++ /dev/null @@ -1,746 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/tbarbase.cpp -// Purpose: wxToolBarBase implementation -// Author: Julian Smart -// Modified by: VZ at 11.12.99 (wxScrollableToolBar split off) -// Created: 04/01/98 -// RCS-ID: $Id: tbarbase.cpp 42840 2006-10-31 13:09:08Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TOOLBAR - -#include "wx/toolbar.h" - -#ifndef WX_PRECOMP - #include "wx/control.h" - #include "wx/frame.h" - #include "wx/settings.h" - #include "wx/image.h" -#endif - -// ---------------------------------------------------------------------------- -// wxWidgets macros -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxToolBarBase, wxControl) -END_EVENT_TABLE() - -#include "wx/listimpl.cpp" - -WX_DEFINE_LIST(wxToolBarToolsList) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxToolBarToolBase -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject) - -bool wxToolBarToolBase::Enable(bool enable) -{ - if ( m_enabled == enable ) - return false; - - m_enabled = enable; - - return true; -} - -bool wxToolBarToolBase::Toggle(bool toggle) -{ - wxASSERT_MSG( CanBeToggled(), _T("can't toggle this tool") ); - - if ( m_toggled == toggle ) - return false; - - m_toggled = toggle; - - return true; -} - -bool wxToolBarToolBase::SetToggle(bool toggle) -{ - wxItemKind kind = toggle ? wxITEM_CHECK : wxITEM_NORMAL; - if ( m_kind == kind ) - return false; - - m_kind = kind; - - return true; -} - -bool wxToolBarToolBase::SetShortHelp(const wxString& help) -{ - if ( m_shortHelpString == help ) - return false; - - m_shortHelpString = help; - - return true; -} - -bool wxToolBarToolBase::SetLongHelp(const wxString& help) -{ - if ( m_longHelpString == help ) - return false; - - m_longHelpString = help; - - return true; -} - -// ---------------------------------------------------------------------------- -// wxToolBarBase adding/deleting items -// ---------------------------------------------------------------------------- - -wxToolBarBase::wxToolBarBase() -{ - // the list owns the pointers - m_xMargin = m_yMargin = 0; - m_maxRows = m_maxCols = 0; - m_toolPacking = m_toolSeparation = 0; - m_defaultWidth = 16; - m_defaultHeight = 15; -} - -void wxToolBarBase::FixupStyle() -{ - if ( !HasFlag(wxTB_TOP | wxTB_LEFT | wxTB_RIGHT | wxTB_BOTTOM) ) - { - // this is the default - m_windowStyle |= wxTB_TOP; - } -} - -wxToolBarToolBase *wxToolBarBase::DoAddTool(int id, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind, - const wxString& shortHelp, - const wxString& longHelp, - wxObject *clientData, - wxCoord WXUNUSED(xPos), - wxCoord WXUNUSED(yPos)) -{ - InvalidateBestSize(); - return InsertTool(GetToolsCount(), id, label, bitmap, bmpDisabled, - kind, shortHelp, longHelp, clientData); -} - -wxToolBarToolBase *wxToolBarBase::InsertTool(size_t pos, - int id, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind, - const wxString& shortHelp, - const wxString& longHelp, - wxObject *clientData) -{ - wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL, - _T("invalid position in wxToolBar::InsertTool()") ); - - wxToolBarToolBase *tool = CreateTool(id, label, bitmap, bmpDisabled, kind, - clientData, shortHelp, longHelp); - - if ( !InsertTool(pos, tool) ) - { - delete tool; - - return NULL; - } - - return tool; -} - -wxToolBarToolBase *wxToolBarBase::AddTool(wxToolBarToolBase *tool) -{ - return InsertTool(GetToolsCount(), tool); -} - -wxToolBarToolBase * -wxToolBarBase::InsertTool(size_t pos, wxToolBarToolBase *tool) -{ - wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL, - _T("invalid position in wxToolBar::InsertTool()") ); - - if ( !tool || !DoInsertTool(pos, tool) ) - { - return NULL; - } - - m_tools.Insert(pos, tool); - - return tool; -} - -wxToolBarToolBase *wxToolBarBase::AddControl(wxControl *control) -{ - return InsertControl(GetToolsCount(), control); -} - -wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control) -{ - wxCHECK_MSG( control, (wxToolBarToolBase *)NULL, - _T("toolbar: can't insert NULL control") ); - - wxCHECK_MSG( control->GetParent() == this, (wxToolBarToolBase *)NULL, - _T("control must have toolbar as parent") ); - - wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL, - _T("invalid position in wxToolBar::InsertControl()") ); - - wxToolBarToolBase *tool = CreateTool(control); - - if ( !InsertTool(pos, tool) ) - { - delete tool; - - return NULL; - } - - return tool; -} - -wxControl *wxToolBarBase::FindControl( int id ) -{ - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - const wxToolBarToolBase * const tool = node->GetData(); - if ( tool->IsControl() ) - { - wxControl * const control = tool->GetControl(); - - if ( !control ) - { - wxFAIL_MSG( _T("NULL control in toolbar?") ); - } - else if ( control->GetId() == id ) - { - // found - return control; - } - } - } - - return NULL; -} - -wxToolBarToolBase *wxToolBarBase::AddSeparator() -{ - return InsertSeparator(GetToolsCount()); -} - -wxToolBarToolBase *wxToolBarBase::InsertSeparator(size_t pos) -{ - wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL, - _T("invalid position in wxToolBar::InsertSeparator()") ); - - wxToolBarToolBase *tool = CreateTool(wxID_SEPARATOR, - wxEmptyString, - wxNullBitmap, wxNullBitmap, - wxITEM_SEPARATOR, (wxObject *)NULL, - wxEmptyString, wxEmptyString); - - if ( !tool || !DoInsertTool(pos, tool) ) - { - delete tool; - - return NULL; - } - - m_tools.Insert(pos, tool); - - return tool; -} - -wxToolBarToolBase *wxToolBarBase::RemoveTool(int id) -{ - size_t pos = 0; - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - if ( node->GetData()->GetId() == id ) - break; - - pos++; - } - - if ( !node ) - { - // don't give any error messages - sometimes we might call RemoveTool() - // without knowing whether the tool is or not in the toolbar - return (wxToolBarToolBase *)NULL; - } - - wxToolBarToolBase *tool = node->GetData(); - if ( !DoDeleteTool(pos, tool) ) - { - return (wxToolBarToolBase *)NULL; - } - - m_tools.Erase(node); - - return tool; -} - -bool wxToolBarBase::DeleteToolByPos(size_t pos) -{ - wxCHECK_MSG( pos < GetToolsCount(), false, - _T("invalid position in wxToolBar::DeleteToolByPos()") ); - - wxToolBarToolsList::compatibility_iterator node = m_tools.Item(pos); - - if ( !DoDeleteTool(pos, node->GetData()) ) - { - return false; - } - - delete node->GetData(); - m_tools.Erase(node); - - return true; -} - -bool wxToolBarBase::DeleteTool(int id) -{ - size_t pos = 0; - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - if ( node->GetData()->GetId() == id ) - break; - - pos++; - } - - if ( !node || !DoDeleteTool(pos, node->GetData()) ) - { - return false; - } - - delete node->GetData(); - m_tools.Erase(node); - - return true; -} - -wxToolBarToolBase *wxToolBarBase::FindById(int id) const -{ - wxToolBarToolBase *tool = (wxToolBarToolBase *)NULL; - - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - tool = node->GetData(); - if ( tool->GetId() == id ) - { - // found - break; - } - - tool = NULL; - } - - return tool; -} - -void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool) -{ - wxCHECK_RET( tool, _T("NULL tool in wxToolBarTool::UnToggleRadioGroup") ); - - if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) - return; - - wxToolBarToolsList::compatibility_iterator node = m_tools.Find(tool); - wxCHECK_RET( node, _T("invalid tool in wxToolBarTool::UnToggleRadioGroup") ); - - wxToolBarToolsList::compatibility_iterator nodeNext = node->GetNext(); - while ( nodeNext ) - { - wxToolBarToolBase *toolNext = nodeNext->GetData(); - - if ( !toolNext->IsButton() || toolNext->GetKind() != wxITEM_RADIO ) - break; - - if ( toolNext->Toggle(false) ) - { - DoToggleTool(toolNext, false); - } - - nodeNext = nodeNext->GetNext(); - } - - wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); - while ( nodePrev ) - { - wxToolBarToolBase *toolNext = nodePrev->GetData(); - - if ( !toolNext->IsButton() || toolNext->GetKind() != wxITEM_RADIO ) - break; - - if ( toolNext->Toggle(false) ) - { - DoToggleTool(toolNext, false); - } - - nodePrev = nodePrev->GetPrevious(); - } -} - -void wxToolBarBase::ClearTools() -{ - while ( GetToolsCount() ) - { - DeleteToolByPos(0); - } -} - -bool wxToolBarBase::Realize() -{ - return true; -} - -wxToolBarBase::~wxToolBarBase() -{ - WX_CLEAR_LIST(wxToolBarToolsList, m_tools); - - // notify the frame that it doesn't have a tool bar any longer to avoid - // dangling pointers - wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if ( frame && frame->GetToolBar() == this ) - { - frame->SetToolBar(NULL); - } -} - -// ---------------------------------------------------------------------------- -// wxToolBarBase tools state -// ---------------------------------------------------------------------------- - -void wxToolBarBase::EnableTool(int id, bool enable) -{ - wxToolBarToolBase *tool = FindById(id); - if ( tool ) - { - if ( tool->Enable(enable) ) - { - DoEnableTool(tool, enable); - } - } -} - -void wxToolBarBase::ToggleTool(int id, bool toggle) -{ - wxToolBarToolBase *tool = FindById(id); - if ( tool && tool->CanBeToggled() ) - { - if ( tool->Toggle(toggle) ) - { - UnToggleRadioGroup(tool); - DoToggleTool(tool, toggle); - } - } -} - -void wxToolBarBase::SetToggle(int id, bool toggle) -{ - wxToolBarToolBase *tool = FindById(id); - if ( tool ) - { - if ( tool->SetToggle(toggle) ) - { - DoSetToggle(tool, toggle); - } - } -} - -void wxToolBarBase::SetToolShortHelp(int id, const wxString& help) -{ - wxToolBarToolBase *tool = FindById(id); - if ( tool ) - { - (void)tool->SetShortHelp(help); - } -} - -void wxToolBarBase::SetToolLongHelp(int id, const wxString& help) -{ - wxToolBarToolBase *tool = FindById(id); - if ( tool ) - { - (void)tool->SetLongHelp(help); - } -} - -wxObject *wxToolBarBase::GetToolClientData(int id) const -{ - wxToolBarToolBase *tool = FindById(id); - - return tool ? tool->GetClientData() : (wxObject *)NULL; -} - -void wxToolBarBase::SetToolClientData(int id, wxObject *clientData) -{ - wxToolBarToolBase *tool = FindById(id); - - wxCHECK_RET( tool, _T("no such tool in wxToolBar::SetToolClientData") ); - - tool->SetClientData(clientData); -} - -int wxToolBarBase::GetToolPos(int id) const -{ - size_t pos = 0; - wxToolBarToolsList::compatibility_iterator node; - - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - if ( node->GetData()->GetId() == id ) - return pos; - - pos++; - } - - return wxNOT_FOUND; -} - -bool wxToolBarBase::GetToolState(int id) const -{ - wxToolBarToolBase *tool = FindById(id); - wxCHECK_MSG( tool, false, _T("no such tool") ); - - return tool->IsToggled(); -} - -bool wxToolBarBase::GetToolEnabled(int id) const -{ - wxToolBarToolBase *tool = FindById(id); - wxCHECK_MSG( tool, false, _T("no such tool") ); - - return tool->IsEnabled(); -} - -wxString wxToolBarBase::GetToolShortHelp(int id) const -{ - wxToolBarToolBase *tool = FindById(id); - wxCHECK_MSG( tool, wxEmptyString, _T("no such tool") ); - - return tool->GetShortHelp(); -} - -wxString wxToolBarBase::GetToolLongHelp(int id) const -{ - wxToolBarToolBase *tool = FindById(id); - wxCHECK_MSG( tool, wxEmptyString, _T("no such tool") ); - - return tool->GetLongHelp(); -} - -// ---------------------------------------------------------------------------- -// wxToolBarBase geometry -// ---------------------------------------------------------------------------- - -void wxToolBarBase::SetMargins(int x, int y) -{ - m_xMargin = x; - m_yMargin = y; -} - -void wxToolBarBase::SetRows(int WXUNUSED(nRows)) -{ - // nothing -} - -// ---------------------------------------------------------------------------- -// event processing -// ---------------------------------------------------------------------------- - -// Only allow toggle if returns true -bool wxToolBarBase::OnLeftClick(int id, bool toggleDown) -{ - wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, id); - event.SetEventObject(this); - - // we use SetInt() to make wxCommandEvent::IsChecked() return toggleDown - event.SetInt((int)toggleDown); - - // and SetExtraLong() for backwards compatibility - event.SetExtraLong((long)toggleDown); - - // Send events to this toolbar instead (and thence up the window hierarchy) - GetEventHandler()->ProcessEvent(event); - - return true; -} - -// Call when right button down. -void wxToolBarBase::OnRightClick(int id, - long WXUNUSED(x), - long WXUNUSED(y)) -{ - wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, id); - event.SetEventObject(this); - event.SetInt(id); - - GetEventHandler()->ProcessEvent(event); -} - -// Called when the mouse cursor enters a tool bitmap (no button pressed). -// Argument is wxID_ANY if mouse is exiting the toolbar. -// Note that for this event, the id of the window is used, -// and the integer parameter of wxCommandEvent is used to retrieve -// the tool id. -void wxToolBarBase::OnMouseEnter(int id) -{ - wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, GetId()); - event.SetEventObject(this); - event.SetInt(id); - - wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if( frame ) - { - wxString help; - wxToolBarToolBase* tool = id == wxID_ANY ? (wxToolBarToolBase*)NULL : FindById(id); - if(tool) - help = tool->GetLongHelp(); - frame->DoGiveHelp( help, id != wxID_ANY ); - } - - (void)GetEventHandler()->ProcessEvent(event); -} - -// ---------------------------------------------------------------------------- -// UI updates -// ---------------------------------------------------------------------------- - -// Do the toolbar button updates (check for EVT_UPDATE_UI handlers) -void wxToolBarBase::UpdateWindowUI(long flags) -{ - wxWindowBase::UpdateWindowUI(flags); - - // There is no sense in updating the toolbar UI - // if the parent window is about to get destroyed - wxWindow *tlw = wxGetTopLevelParent( this ); - if (tlw && wxPendingDelete.Member( tlw )) - return; - - wxEvtHandler* evtHandler = GetEventHandler() ; - - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - int id = node->GetData()->GetId(); - - wxUpdateUIEvent event(id); - event.SetEventObject(this); - - if ( evtHandler->ProcessEvent(event) ) - { - if ( event.GetSetEnabled() ) - EnableTool(id, event.GetEnabled()); - if ( event.GetSetChecked() ) - ToggleTool(id, event.GetChecked()); -#if 0 - if ( event.GetSetText() ) - // Set tooltip? -#endif // 0 - } - } -} - -#if wxUSE_IMAGE - -/* - * Make a greyed-out image suitable for disabled buttons. - * This code is adapted from wxNewBitmapButton in FL. - */ - -bool wxCreateGreyedImage(const wxImage& src, wxImage& dst) -{ - dst = src.Copy(); - - unsigned char rBg, gBg, bBg; - if ( src.HasMask() ) - { - src.GetOrFindMaskColour(&rBg, &gBg, &bBg); - dst.SetMaskColour(rBg, gBg, bBg); - } - else // assuming the pixels along the edges are of the background color - { - rBg = src.GetRed(0, 0); - gBg = src.GetGreen(0, 0); - bBg = src.GetBlue(0, 0); - } - - const wxColour colBg(rBg, gBg, bBg); - - const wxColour colDark = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); - const wxColour colLight = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT); - - // Second attempt, just making things monochrome - const int width = src.GetWidth(); - const int height = src.GetHeight(); - - for ( int x = 0; x < width; x++ ) - { - for ( int y = 0; y < height; y++ ) - { - const int r = src.GetRed(x, y); - const int g = src.GetGreen(x, y); - const int b = src.GetBlue(x, y); - - if ( r == rBg && g == gBg && b == bBg ) - { - // Leave the background colour as-is - continue; - } - - // Change light things to the background colour - wxColour col; - if ( r >= (colLight.Red() - 50) && - g >= (colLight.Green() - 50) && - b >= (colLight.Blue() - 50) ) - { - col = colBg; - } - else // Change dark things to really dark - { - col = colDark; - } - - dst.SetRGB(x, y, col.Red(), col.Green(), col.Blue()); - } - } - - return true; -} - -#endif // wxUSE_IMAGE - -#endif // wxUSE_TOOLBAR diff --git a/Source/3rdParty/wx/src/common/textbuf.cpp b/Source/3rdParty/wx/src/common/textbuf.cpp deleted file mode 100644 index 6f97b98ca..000000000 --- a/Source/3rdParty/wx/src/common/textbuf.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/textbuf.cpp -// Purpose: implementation of wxTextBuffer class -// Created: 14.11.01 -// Author: Morten Hanssen, Vadim Zeitlin -// RCS-ID: $Id: textbuf.cpp 38570 2006-04-05 14:37:47Z VZ $ -// Copyright: (c) 1998-2001 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// headers -// ============================================================================ - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif //__BORLANDC__ - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" -#endif - -#include "wx/textbuf.h" - -// ============================================================================ -// wxTextBuffer class implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// static methods (always compiled in) -// ---------------------------------------------------------------------------- - -// default type is the native one -// the native type under Mac OS X is: -// - Unix when compiling with the Apple Developer Tools (__UNIX__) -// - Mac when compiling with CodeWarrior (__WXMAC__) - -const wxTextFileType wxTextBuffer::typeDefault = -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__PALMOS__) - wxTextFileType_Dos; -#elif defined(__UNIX__) - wxTextFileType_Unix; -#elif defined(__WXMAC__) - wxTextFileType_Mac; -#elif defined(__OS2__) - wxTextFileType_Os2; -#else - wxTextFileType_None; - #error "wxTextBuffer: unsupported platform." -#endif - -const wxChar *wxTextBuffer::GetEOL(wxTextFileType type) -{ - switch ( type ) { - default: - wxFAIL_MSG(wxT("bad buffer type in wxTextBuffer::GetEOL.")); - // fall through nevertheless - we must return something... - - case wxTextFileType_None: return wxEmptyString; - case wxTextFileType_Unix: return wxT("\n"); - case wxTextFileType_Dos: return wxT("\r\n"); - case wxTextFileType_Mac: return wxT("\r"); - } -} - -wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type) -{ - // don't do anything if there is nothing to do - if ( type == wxTextFileType_None ) - return text; - - // nor if it is empty - if ( text.empty() ) - return text; - - wxString eol = GetEOL(type), result; - - // optimization: we know that the length of the new string will be about - // the same as the length of the old one, so prealloc memory to aviod - // unnecessary relocations - result.Alloc(text.Len()); - - wxChar chLast = 0; - for ( const wxChar *pc = text.c_str(); *pc; pc++ ) - { - wxChar ch = *pc; - switch ( ch ) { - case _T('\n'): - // Dos/Unix line termination - result += eol; - chLast = 0; - break; - - case _T('\r'): - if ( chLast == _T('\r') ) { - // Mac empty line - result += eol; - } - else { - // just remember it: we don't know whether it is just "\r" - // or "\r\n" yet - chLast = _T('\r'); - } - break; - - default: - if ( chLast == _T('\r') ) { - // Mac line termination - result += eol; - - // reset chLast to avoid inserting another eol before the - // next character - chLast = 0; - } - - // add to the current line - result += ch; - } - } - - if ( chLast ) { - // trailing '\r' - result += eol; - } - - return result; -} - -#if wxUSE_TEXTBUFFER - -wxString wxTextBuffer::ms_eof; - -// ---------------------------------------------------------------------------- -// ctors & dtor -// ---------------------------------------------------------------------------- - -wxTextBuffer::wxTextBuffer(const wxString& strBufferName) - : m_strBufferName(strBufferName) -{ - m_nCurLine = 0; - m_isOpened = false; -} - -wxTextBuffer::~wxTextBuffer() -{ - // required here for Darwin -} - -// ---------------------------------------------------------------------------- -// buffer operations -// ---------------------------------------------------------------------------- - -bool wxTextBuffer::Exists() const -{ - return OnExists(); -} - -bool wxTextBuffer::Create(const wxString& strBufferName) -{ - m_strBufferName = strBufferName; - - return Create(); -} - -bool wxTextBuffer::Create() -{ - // buffer name must be either given in ctor or in Create(const wxString&) - wxASSERT( !m_strBufferName.empty() ); - - // if the buffer already exists do nothing - if ( Exists() ) return false; - - if ( !OnOpen(m_strBufferName, WriteAccess) ) - return false; - - OnClose(); - return true; -} - -bool wxTextBuffer::Open(const wxString& strBufferName, const wxMBConv& conv) -{ - m_strBufferName = strBufferName; - - return Open(conv); -} - -bool wxTextBuffer::Open(const wxMBConv& conv) -{ - // buffer name must be either given in ctor or in Open(const wxString&) - wxASSERT( !m_strBufferName.empty() ); - - // open buffer in read-only mode - if ( !OnOpen(m_strBufferName, ReadAccess) ) - return false; - - // read buffer into memory - m_isOpened = OnRead(conv); - - OnClose(); - - return m_isOpened; -} - -// analyse some lines of the buffer trying to guess it's type. -// if it fails, it assumes the native type for our platform. -wxTextFileType wxTextBuffer::GuessType() const -{ - wxASSERT( IsOpened() ); - - // scan the buffer lines - size_t nUnix = 0, // number of '\n's alone - nDos = 0, // number of '\r\n' - nMac = 0; // number of '\r's - - // we take MAX_LINES_SCAN in the beginning, middle and the end of buffer - #define MAX_LINES_SCAN (10) - size_t nCount = m_aLines.Count() / 3, - nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3; - - #define AnalyseLine(n) \ - switch ( m_aTypes[n] ) { \ - case wxTextFileType_Unix: nUnix++; break; \ - case wxTextFileType_Dos: nDos++; break; \ - case wxTextFileType_Mac: nMac++; break; \ - default: wxFAIL_MSG(_("unknown line terminator")); \ - } - - size_t n; - for ( n = 0; n < nScan; n++ ) // the beginning - AnalyseLine(n); - for ( n = (nCount - nScan)/2; n < (nCount + nScan)/2; n++ ) - AnalyseLine(n); - for ( n = nCount - nScan; n < nCount; n++ ) - AnalyseLine(n); - - #undef AnalyseLine - - // interpret the results (FIXME far from being even 50% fool proof) - if ( nScan > 0 && nDos + nUnix + nMac == 0 ) { - // no newlines at all - wxLogWarning(_("'%s' is probably a binary buffer."), m_strBufferName.c_str()); - } - else { - #define GREATER_OF(t1, t2) n##t1 == n##t2 ? typeDefault \ - : n##t1 > n##t2 \ - ? wxTextFileType_##t1 \ - : wxTextFileType_##t2 - -#if !defined(__WATCOMC__) || wxCHECK_WATCOM_VERSION(1,4) - if ( nDos > nUnix ) - return GREATER_OF(Dos, Mac); - else if ( nDos < nUnix ) - return GREATER_OF(Unix, Mac); - else { - // nDos == nUnix - return nMac > nDos ? wxTextFileType_Mac : typeDefault; - } -#endif // __WATCOMC__ - - #undef GREATER_OF - } - - return typeDefault; -} - - -bool wxTextBuffer::Close() -{ - Clear(); - m_isOpened = false; - - return true; -} - -bool wxTextBuffer::Write(wxTextFileType typeNew, const wxMBConv& conv) -{ - return OnWrite(typeNew, conv); -} - -#endif // wxUSE_TEXTBUFFER diff --git a/Source/3rdParty/wx/src/common/textcmn.cpp b/Source/3rdParty/wx/src/common/textcmn.cpp deleted file mode 100644 index 952fcf974..000000000 --- a/Source/3rdParty/wx/src/common/textcmn.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/textcmn.cpp -// Purpose: implementation of platform-independent functions of wxTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 13.07.99 -// RCS-ID: $Id: textcmn.cpp 62095 2009-09-24 18:20:21Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/event.h" -#endif // WX_PRECOMP - -#if wxUSE_TEXTCTRL - -#include "wx/textctrl.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif // WX_PRECOMP - -#include "wx/ffile.h" - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// we don't have any objects of type wxTextCtrlBase in the program, only -// wxTextCtrl, so this cast is safe -#define TEXTCTRL(ptr) ((wxTextCtrl *)(ptr)) - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxTextUrlEvent, wxCommandEvent) - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN) - -IMPLEMENT_ABSTRACT_CLASS(wxTextCtrlBase, wxControl) - -// ---------------------------------------------------------------------------- -// style functions - not implemented here -// ---------------------------------------------------------------------------- - -wxTextAttr::wxTextAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font, - wxTextAttrAlignment alignment) - : m_colText(colText), m_colBack(colBack), m_font(font), m_textAlignment(alignment) -{ - m_flags = 0; - m_leftIndent = 0; - m_leftSubIndent = 0; - m_rightIndent = 0; - if (m_colText.Ok()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR; - if (m_colBack.Ok()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; - if (m_font.Ok()) m_flags |= wxTEXT_ATTR_FONT; - if (alignment != wxTEXT_ALIGNMENT_DEFAULT) - m_flags |= wxTEXT_ATTR_ALIGNMENT; -} - -void wxTextAttr::Init() -{ - m_textAlignment = wxTEXT_ALIGNMENT_DEFAULT; - m_flags = 0; - m_leftIndent = 0; - m_leftSubIndent = 0; - m_rightIndent = 0; -} - -/* static */ -wxTextAttr wxTextAttr::Combine(const wxTextAttr& attr, - const wxTextAttr& attrDef, - const wxTextCtrlBase *text) -{ - wxFont font = attr.GetFont(); - if ( !font.Ok() ) - { - font = attrDef.GetFont(); - - if ( text && !font.Ok() ) - font = text->GetFont(); - } - - wxColour colFg = attr.GetTextColour(); - if ( !colFg.Ok() ) - { - colFg = attrDef.GetTextColour(); - - if ( text && !colFg.Ok() ) - colFg = text->GetForegroundColour(); - } - - wxColour colBg = attr.GetBackgroundColour(); - if ( !colBg.Ok() ) - { - colBg = attrDef.GetBackgroundColour(); - - if ( text && !colBg.Ok() ) - colBg = text->GetBackgroundColour(); - } - - wxTextAttr newAttr(colFg, colBg, font); - - if (attr.HasAlignment()) - newAttr.SetAlignment(attr.GetAlignment()); - else if (attrDef.HasAlignment()) - newAttr.SetAlignment(attrDef.GetAlignment()); - - if (attr.HasTabs()) - newAttr.SetTabs(attr.GetTabs()); - else if (attrDef.HasTabs()) - newAttr.SetTabs(attrDef.GetTabs()); - - if (attr.HasLeftIndent()) - newAttr.SetLeftIndent(attr.GetLeftIndent(), attr.GetLeftSubIndent()); - else if (attrDef.HasLeftIndent()) - newAttr.SetLeftIndent(attrDef.GetLeftIndent(), attr.GetLeftSubIndent()); - - if (attr.HasRightIndent()) - newAttr.SetRightIndent(attr.GetRightIndent()); - else if (attrDef.HasRightIndent()) - newAttr.SetRightIndent(attrDef.GetRightIndent()); - - return newAttr; -} - -void wxTextAttr::operator= (const wxTextAttr& attr) -{ - m_font = attr.m_font; - m_colText = attr.m_colText; - m_colBack = attr.m_colBack; - m_textAlignment = attr.m_textAlignment; - m_leftIndent = attr.m_leftIndent; - m_leftSubIndent = attr.m_leftSubIndent; - m_rightIndent = attr.m_rightIndent; - m_tabs = attr.m_tabs; - m_flags = attr.m_flags; -} - - -// apply styling to text range -bool wxTextCtrlBase::SetStyle(long WXUNUSED(start), long WXUNUSED(end), - const wxTextAttr& WXUNUSED(style)) -{ - // to be implemented in derived TextCtrl classes - return false; -} - -// get the styling at the given position -bool wxTextCtrlBase::GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style)) -{ - // to be implemented in derived TextCtrl classes - return false; -} - -// change default text attributes -bool wxTextCtrlBase::SetDefaultStyle(const wxTextAttr& style) -{ - // keep the old attributes if the new style doesn't specify them unless the - // new style is empty - then reset m_defaultStyle (as there is no other way - // to do it) - if ( style.IsDefault() ) - m_defaultStyle = style; - else - m_defaultStyle = wxTextAttr::Combine(style, m_defaultStyle, this); - - return true; -} - -// get default text attributes -const wxTextAttr& wxTextCtrlBase::GetDefaultStyle() const -{ - return m_defaultStyle; -} - -// ---------------------------------------------------------------------------- -// file IO functions -// ---------------------------------------------------------------------------- - -bool wxTextCtrlBase::DoLoadFile(const wxString& filename, int WXUNUSED(fileType)) -{ -#if wxUSE_FFILE - wxFFile file(filename); - if ( file.IsOpened() ) - { - wxString text; - if ( file.ReadAll(&text) ) - { - SetValue(text); - - DiscardEdits(); - - m_filename = filename; - - return true; - } - } - - wxLogError(_("File couldn't be loaded.")); -#endif // wxUSE_FFILE - - return false; -} - -bool wxTextCtrlBase::SaveFile(const wxString& filename, int fileType) -{ - wxString filenameToUse = filename.empty() ? m_filename : filename; - if ( filenameToUse.empty() ) - { - // what kind of message to give? is it an error or a program bug? - wxLogDebug(wxT("Can't save textctrl to file without filename.")); - - return false; - } - - return DoSaveFile(filenameToUse, fileType); -} - -bool wxTextCtrlBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType)) -{ -#if wxUSE_FFILE - wxFFile file(filename, _T("w")); - if ( file.IsOpened() && file.Write(GetValue()) ) - { - // if it worked, save for future calls - m_filename = filename; - - // it's not modified any longer - DiscardEdits(); - - return true; - } -#endif // wxUSE_FFILE - - wxLogError(_("The text couldn't be saved.")); - - return false; -} - -// ---------------------------------------------------------------------------- -// stream-like insertion operator -// ---------------------------------------------------------------------------- - -wxTextCtrl& wxTextCtrlBase::operator<<(const wxString& s) -{ - AppendText(s); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(float f) -{ - wxString str; - str.Printf(wxT("%.2f"), f); - AppendText(str); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(double d) -{ - wxString str; - str.Printf(wxT("%.2f"), d); - AppendText(str); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(int i) -{ - wxString str; - str.Printf(wxT("%d"), i); - AppendText(str); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(long i) -{ - wxString str; - str.Printf(wxT("%ld"), i); - AppendText(str); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(const wxChar c) -{ - return operator<<(wxString(c)); -} - -// ---------------------------------------------------------------------------- -// streambuf methods implementation -// ---------------------------------------------------------------------------- - -#if wxHAS_TEXT_WINDOW_STREAM - -int wxTextCtrlBase::overflow(int c) -{ - AppendText((wxChar)c); - - // return something different from EOF - return 0; -} - -#endif // wxHAS_TEXT_WINDOW_STREAM - -// ---------------------------------------------------------------------------- -// clipboard stuff -// ---------------------------------------------------------------------------- - -bool wxTextCtrlBase::CanCopy() const -{ - // can copy if there's a selection - long from, to; - GetSelection(&from, &to); - return from != to; -} - -bool wxTextCtrlBase::CanCut() const -{ - // can cut if there's a selection and if we're not read only - return CanCopy() && IsEditable(); -} - -bool wxTextCtrlBase::CanPaste() const -{ - // can paste if we are not read only - return IsEditable(); -} - -// ---------------------------------------------------------------------------- -// emulating key presses -// ---------------------------------------------------------------------------- - -#ifdef __WIN32__ -// the generic version is unused in wxMSW -bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& WXUNUSED(event)) -{ - return false; -} -#else // !__WIN32__ -bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) -{ - wxChar ch = 0; - int keycode = event.GetKeyCode(); - switch ( keycode ) - { - case WXK_NUMPAD0: - case WXK_NUMPAD1: - case WXK_NUMPAD2: - case WXK_NUMPAD3: - case WXK_NUMPAD4: - case WXK_NUMPAD5: - case WXK_NUMPAD6: - case WXK_NUMPAD7: - case WXK_NUMPAD8: - case WXK_NUMPAD9: - ch = (wxChar)(_T('0') + keycode - WXK_NUMPAD0); - break; - - case WXK_MULTIPLY: - case WXK_NUMPAD_MULTIPLY: - ch = _T('*'); - break; - - case WXK_ADD: - case WXK_NUMPAD_ADD: - ch = _T('+'); - break; - - case WXK_SUBTRACT: - case WXK_NUMPAD_SUBTRACT: - ch = _T('-'); - break; - - case WXK_DECIMAL: - case WXK_NUMPAD_DECIMAL: - ch = _T('.'); - break; - - case WXK_DIVIDE: - case WXK_NUMPAD_DIVIDE: - ch = _T('/'); - break; - - case WXK_DELETE: - case WXK_NUMPAD_DELETE: - // delete the character at cursor - { - const long pos = GetInsertionPoint(); - if ( pos < GetLastPosition() ) - Remove(pos, pos + 1); - } - break; - - case WXK_BACK: - // delete the character before the cursor - { - const long pos = GetInsertionPoint(); - if ( pos > 0 ) - Remove(pos - 1, pos); - } - break; - - default: -#if wxUSE_UNICODE - if ( event.GetUnicodeKey() ) - { - ch = event.GetUnicodeKey(); - } - else -#endif - if ( keycode < 256 && keycode >= 0 && wxIsprint(keycode) ) - { - // FIXME this is not going to work for non letters... - if ( !event.ShiftDown() ) - { - keycode = wxTolower(keycode); - } - - ch = (wxChar)keycode; - } - else - { - ch = _T('\0'); - } - } - - if ( ch ) - { - WriteText(ch); - - return true; - } - - return false; -} -#endif // !__WIN32__ - -// ---------------------------------------------------------------------------- -// selection and ranges -// ---------------------------------------------------------------------------- - -void wxTextCtrlBase::SelectAll() -{ - SetSelection(0, GetLastPosition()); -} - -wxString wxTextCtrlBase::GetStringSelection() const -{ - long from, to; - GetSelection(&from, &to); - - return GetRange(from, to); -} - -wxString wxTextCtrlBase::GetRange(long from, long to) const -{ - wxString sel; - if ( from < to ) - { - sel = GetValue().Mid(from, to - from); - } - - return sel; -} - -// do the window-specific processing after processing the update event -void wxTextCtrlBase::DoUpdateWindowUI(wxUpdateUIEvent& event) -{ - // call inherited, but skip the wxControl's version, and call directly the - // wxWindow's one instead, because the only reason why we are overriding this - // function is that we want to use SetValue() instead of wxControl::SetLabel() - wxWindowBase::DoUpdateWindowUI(event); - - // update text - if ( event.GetSetText() ) - { - if ( event.GetText() != GetValue() ) - SetValue(event.GetText()); - } -} - -// ---------------------------------------------------------------------------- -// hit testing -// ---------------------------------------------------------------------------- - -wxTextCtrlHitTestResult -wxTextCtrlBase::HitTest(const wxPoint& pt, wxTextCoord *x, wxTextCoord *y) const -{ - // implement in terms of the other overload as the native ports typically - // can get the position and not (x, y) pair directly (although wxUniv - // directly gets x and y -- and so overrides this method as well) - long pos; - wxTextCtrlHitTestResult rc = HitTest(pt, &pos); - - if ( rc != wxTE_HT_UNKNOWN ) - { - PositionToXY(pos, x, y); - } - - return rc; -} - -wxTextCtrlHitTestResult -wxTextCtrlBase::HitTest(const wxPoint& WXUNUSED(pt), - long * WXUNUSED(pos)) const -{ - // not implemented - return wxTE_HT_UNKNOWN; -} - -// ---------------------------------------------------------------------------- -// events -// ---------------------------------------------------------------------------- - -void wxTextCtrlBase::SendTextUpdatedEvent() -{ - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId()); - - // do not do this as it could be very inefficient if the text control - // contains a lot of text and we're not using ref-counted wxString - // implementation -- instead, event.GetString() will query the control for - // its current text if needed - //event.SetString(GetValue()); - - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); -} - -#else // !wxUSE_TEXTCTRL - -// define this one even if !wxUSE_TEXTCTRL because it is also used by other -// controls (wxComboBox and wxSpinCtrl) - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED) - -#endif // wxUSE_TEXTCTRL/!wxUSE_TEXTCTRL diff --git a/Source/3rdParty/wx/src/common/textfile.cpp b/Source/3rdParty/wx/src/common/textfile.cpp deleted file mode 100644 index d873e1d97..000000000 --- a/Source/3rdParty/wx/src/common/textfile.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/textfile.cpp -// Purpose: implementation of wxTextFile class -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.98 -// RCS-ID: $Id: textfile.cpp 49298 2007-10-21 18:05:49Z SC $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// headers -// ============================================================================ - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif //__BORLANDC__ - -#if !wxUSE_FILE || !wxUSE_TEXTBUFFER - #undef wxUSE_TEXTFILE - #define wxUSE_TEXTFILE 0 -#endif // wxUSE_FILE - -#if wxUSE_TEXTFILE - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/file.h" - #include "wx/log.h" -#endif - -#include "wx/textfile.h" -#include "wx/filename.h" -#include "wx/buffer.h" - -// ============================================================================ -// wxTextFile class implementation -// ============================================================================ - -wxTextFile::wxTextFile(const wxString& strFileName) - : wxTextBuffer(strFileName) -{ -} - - -// ---------------------------------------------------------------------------- -// file operations -// ---------------------------------------------------------------------------- - -bool wxTextFile::OnExists() const -{ - return wxFile::Exists(m_strBufferName); -} - - -bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode OpenMode) -{ - wxFile::OpenMode FileOpenMode; - - switch ( OpenMode ) - { - default: - wxFAIL_MSG( _T("unknown open mode in wxTextFile::Open") ); - // fall through - - case ReadAccess : - FileOpenMode = wxFile::read; - break; - - case WriteAccess : - FileOpenMode = wxFile::write; - break; - } - - return m_file.Open(strBufferName.c_str(), FileOpenMode); -} - - -bool wxTextFile::OnClose() -{ - return m_file.Close(); -} - - -bool wxTextFile::OnRead(const wxMBConv& conv) -{ - // file should be opened - wxASSERT_MSG( m_file.IsOpened(), _T("can't read closed file") ); - - // read the entire file in memory: this is not the most efficient thing to - // do but there is no good way to avoid it in Unicode build because if we - // read the file block by block we can't convert each block to Unicode - // separately (the last multibyte char in the block might be only partially - // read and so the conversion would fail) and, as the file contents is kept - // in memory by wxTextFile anyhow, it shouldn't be a big problem to read - // the file entirely - size_t bufSize = 0, - bufPos = 0; - char block[1024]; - wxCharBuffer buf; - - // first determine if the file is seekable or not and so whether we can - // determine its length in advance - wxFileOffset fileLength; - { - wxLogNull logNull; - fileLength = m_file.Length(); - } - - // some non-seekable files under /proc under Linux pretend that they're - // seekable but always return 0; others do return an error - const bool seekable = fileLength != wxInvalidOffset && fileLength != 0; - if ( seekable ) - { - // we know the required length, so set the buffer size in advance - bufSize = fileLength; - if ( !buf.extend(bufSize - 1 /* it adds 1 internally */) ) - return false; - - // if the file is seekable, also check that we're at its beginning - wxASSERT_MSG( m_file.Tell() == 0, _T("should be at start of file") ); - } - - for ( ;; ) - { - ssize_t nRead = m_file.Read(block, WXSIZEOF(block)); - - if ( nRead == wxInvalidOffset ) - { - // read error (error message already given in wxFile::Read) - return false; - } - - if ( nRead == 0 ) - { - // if no bytes have been read, presumably this is a valid-but-empty file - if ( bufPos == 0 ) - return true; - - // otherwise we've finished reading the file - break; - } - - if ( seekable ) - { - // this shouldn't happen but don't overwrite the buffer if it does - wxCHECK_MSG( bufPos + nRead <= bufSize, false, - _T("read more than file length?") ); - } - else // !seekable - { - // for non-seekable files we have to allocate more memory on the go - if ( !buf.extend(bufPos + nRead - 1 /* it adds 1 internally */) ) - return false; - } - - // append to the buffer - memcpy(buf.data() + bufPos, block, nRead); - bufPos += nRead; - } - - if ( !seekable ) - { - bufSize = bufPos; - } - - const wxString str(buf, conv, bufPos); - - // there's no risk of this happening in ANSI build -#if wxUSE_UNICODE - if ( bufSize > 4 && str.empty() ) - { - wxLogError(_("Failed to convert file \"%s\" to Unicode."), GetName()); - return false; - } -#endif // wxUSE_UNICODE - - free(buf.release()); // we don't need this memory any more - - - // now break the buffer in lines - - // last processed character, we need to know if it was a CR or not - wxChar chLast = '\0'; - - // the beginning of the current line, changes inside the loop - wxString::const_iterator lineStart = str.begin(); - const wxString::const_iterator end = str.end(); - for ( wxString::const_iterator p = lineStart; p != end; p++ ) - { - const wxChar ch = *p; - switch ( ch ) - { - case '\n': - // could be a DOS or Unix EOL - if ( chLast == '\r' ) - { - if ( p - 1 >= lineStart ) - { - AddLine(wxString(lineStart, p - 1), wxTextFileType_Dos); - } - else - { - // there were two line endings, so add an empty line: - AddLine(wxEmptyString, wxTextFileType_Dos); - } - } - else // bare '\n', Unix style - { - AddLine(wxString(lineStart, p), wxTextFileType_Unix); - } - - lineStart = p + 1; - break; - - case '\r': - if ( chLast == '\r' ) - { - if ( p - 1 >= lineStart ) - { - AddLine(wxString(lineStart, p - 1), wxTextFileType_Mac); - } - // Mac empty line - AddLine(wxEmptyString, wxTextFileType_Mac); - lineStart = p + 1; - } - //else: we don't know what this is yet -- could be a Mac EOL or - // start of DOS EOL so wait for next char - break; - - default: - if ( chLast == '\r' ) - { - // Mac line termination - if ( p - 1 >= lineStart ) - { - AddLine(wxString(lineStart, p - 1), wxTextFileType_Mac); - } - else - { - // there were two line endings, so add an empty line: - AddLine(wxEmptyString, wxTextFileType_Mac); - } - lineStart = p; - } - } - - chLast = ch; - } - - // anything in the last line? - if ( lineStart != end ) - { - // add unterminated last line - AddLine(wxString(lineStart, end), wxTextFileType_None); - } - - return true; -} - - -bool wxTextFile::OnWrite(wxTextFileType typeNew, const wxMBConv& conv) -{ - wxFileName fn = m_strBufferName; - - // We do NOT want wxPATH_NORM_CASE here, or the case will not - // be preserved. - if ( !fn.IsAbsolute() ) - fn.Normalize(wxPATH_NORM_ENV_VARS | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | - wxPATH_NORM_ABSOLUTE | wxPATH_NORM_LONG); - - wxTempFile fileTmp(fn.GetFullPath()); - - if ( !fileTmp.IsOpened() ) { - wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName.c_str()); - return false; - } - - size_t nCount = GetLineCount(); - for ( size_t n = 0; n < nCount; n++ ) { - fileTmp.Write(GetLine(n) + - GetEOL(typeNew == wxTextFileType_None ? GetLineType(n) - : typeNew), - conv); - } - - // replace the old file with this one - return fileTmp.Commit(); -} - -#endif // wxUSE_TEXTFILE diff --git a/Source/3rdParty/wx/src/common/timercmn.cpp b/Source/3rdParty/wx/src/common/timercmn.cpp deleted file mode 100644 index 43062b46d..000000000 --- a/Source/3rdParty/wx/src/common/timercmn.cpp +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: common/timercmn.cpp -// Purpose: wxTimerBase implementation -// Author: Julian Smart, Guillermo Rodriguez, Vadim Zeitlin -// Modified by: VZ: extracted all non-wxTimer stuff in stopwatch.cpp (20.06.03) -// Created: 04/01/98 -// RCS-ID: $Id: timercmn.cpp 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// (c) 1999 Guillermo Rodriguez -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxWin headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TIMER - -#ifndef WX_PRECOMP - #include "wx/timer.h" -#endif - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent) - -// ============================================================================ -// wxTimerBase implementation -// ============================================================================ - -wxTimerBase::~wxTimerBase() -{ - // this destructor is required for Darwin -} - -void wxTimerBase::Notify() -{ - // the base class version generates an event if it has owner - which it - // should because otherwise nobody can process timer events - wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") ); - - wxTimerEvent event(m_idTimer, m_milli); - event.SetEventObject(this); - (void)m_owner->ProcessEvent(event); -} - -bool wxTimerBase::Start(int milliseconds, bool oneShot) -{ - // under MSW timers only work when they're started from the main thread so - // let the caller know about it -#if wxUSE_THREADS - wxASSERT_MSG( wxThread::IsMain(), - _T("timer can only be started from the main thread") ); -#endif // wxUSE_THREADS - - if ( IsRunning() ) - { - // not stopping the already running timer might work for some - // platforms (no problems under MSW) but leads to mysterious crashes - // on the others (GTK), so to be on the safe side do it here - Stop(); - } - - if ( milliseconds != -1 ) - { - m_milli = milliseconds; - } - - m_oneShot = oneShot; - - return true; -} - -#endif // wxUSE_TIMER - diff --git a/Source/3rdParty/wx/src/common/tokenzr.cpp b/Source/3rdParty/wx/src/common/tokenzr.cpp deleted file mode 100644 index b539458f8..000000000 --- a/Source/3rdParty/wx/src/common/tokenzr.cpp +++ /dev/null @@ -1,229 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/tokenzr.cpp -// Purpose: String tokenizer -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin (almost full rewrite) -// Created: 04/22/98 -// RCS-ID: $Id: tokenzr.cpp 39694 2006-06-13 11:30:40Z ABX $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/tokenzr.h" - -#ifndef WX_PRECOMP - #include "wx/arrstr.h" -#endif - -// Required for wxIs... functions -#include - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStringTokenizer construction -// ---------------------------------------------------------------------------- - -wxStringTokenizer::wxStringTokenizer(const wxString& str, - const wxString& delims, - wxStringTokenizerMode mode) -{ - SetString(str, delims, mode); -} - -void wxStringTokenizer::SetString(const wxString& str, - const wxString& delims, - wxStringTokenizerMode mode) -{ - if ( mode == wxTOKEN_DEFAULT ) - { - // by default, we behave like strtok() if the delimiters are only - // whitespace characters and as wxTOKEN_RET_EMPTY otherwise (for - // whitespace delimiters, strtok() behaviour is better because we want - // to count consecutive spaces as one delimiter) - const wxChar *p; - for ( p = delims.c_str(); *p; p++ ) - { - if ( !wxIsspace(*p) ) - break; - } - - if ( *p ) - { - // not whitespace char in delims - mode = wxTOKEN_RET_EMPTY; - } - else - { - // only whitespaces - mode = wxTOKEN_STRTOK; - } - } - - m_delims = delims; - m_mode = mode; - - Reinit(str); -} - -void wxStringTokenizer::Reinit(const wxString& str) -{ - wxASSERT_MSG( IsOk(), _T("you should call SetString() first") ); - - m_string = str; - m_pos = 0; - m_lastDelim = _T('\0'); -} - -// ---------------------------------------------------------------------------- -// access to the tokens -// ---------------------------------------------------------------------------- - -// do we have more of them? -bool wxStringTokenizer::HasMoreTokens() const -{ - wxCHECK_MSG( IsOk(), false, _T("you should call SetString() first") ); - - if ( m_string.find_first_not_of(m_delims, m_pos) != wxString::npos ) - { - // there are non delimiter characters left, so we do have more tokens - return true; - } - - switch ( m_mode ) - { - case wxTOKEN_RET_EMPTY: - case wxTOKEN_RET_DELIMS: - // special hack for wxTOKEN_RET_EMPTY: we should return the initial - // empty token even if there are only delimiters after it - return m_pos == 0 && !m_string.empty(); - - case wxTOKEN_RET_EMPTY_ALL: - // special hack for wxTOKEN_RET_EMPTY_ALL: we can know if we had - // already returned the trailing empty token after the last - // delimiter by examining m_lastDelim: it is set to NUL if we run - // up to the end of the string in GetNextToken(), but if it is not - // NUL yet we still have this last token to return even if m_pos is - // already at m_string.length() - return m_pos < m_string.length() || m_lastDelim != _T('\0'); - - case wxTOKEN_INVALID: - case wxTOKEN_DEFAULT: - wxFAIL_MSG( _T("unexpected tokenizer mode") ); - // fall through - - case wxTOKEN_STRTOK: - // never return empty delimiters - break; - } - - return false; -} - -// count the number of (remaining) tokens in the string -size_t wxStringTokenizer::CountTokens() const -{ - wxCHECK_MSG( IsOk(), 0, _T("you should call SetString() first") ); - - // VZ: this function is IMHO not very useful, so it's probably not very - // important if its implementation here is not as efficient as it - // could be -- but OTOH like this we're sure to get the correct answer - // in all modes - wxStringTokenizer tkz(m_string.c_str() + m_pos, m_delims, m_mode); - - size_t count = 0; - while ( tkz.HasMoreTokens() ) - { - count++; - - (void)tkz.GetNextToken(); - } - - return count; -} - -// ---------------------------------------------------------------------------- -// token extraction -// ---------------------------------------------------------------------------- - -wxString wxStringTokenizer::GetNextToken() -{ - wxString token; - do - { - if ( !HasMoreTokens() ) - { - break; - } - - // find the end of this token - size_t pos = m_string.find_first_of(m_delims, m_pos); - - // and the start of the next one - if ( pos == wxString::npos ) - { - // no more delimiters, the token is everything till the end of - // string - token.assign(m_string, m_pos, wxString::npos); - - // skip the token - m_pos = m_string.length(); - - // it wasn't terminated - m_lastDelim = _T('\0'); - } - else // we found a delimiter at pos - { - // in wxTOKEN_RET_DELIMS mode we return the delimiter character - // with token, otherwise leave it out - size_t len = pos - m_pos; - if ( m_mode == wxTOKEN_RET_DELIMS ) - len++; - - token.assign(m_string, m_pos, len); - - // skip the token and the trailing delimiter - m_pos = pos + 1; - - m_lastDelim = m_string[pos]; - } - } - while ( !AllowEmpty() && token.empty() ); - - return token; -} - -// ---------------------------------------------------------------------------- -// public functions -// ---------------------------------------------------------------------------- - -wxArrayString wxStringTokenize(const wxString& str, - const wxString& delims, - wxStringTokenizerMode mode) -{ - wxArrayString tokens; - wxStringTokenizer tk(str, delims, mode); - while ( tk.HasMoreTokens() ) - { - tokens.Add(tk.GetNextToken()); - } - - return tokens; -} diff --git a/Source/3rdParty/wx/src/common/toplvcmn.cpp b/Source/3rdParty/wx/src/common/toplvcmn.cpp deleted file mode 100644 index 304dd3ca7..000000000 --- a/Source/3rdParty/wx/src/common/toplvcmn.cpp +++ /dev/null @@ -1,431 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/toplvcmn.cpp -// Purpose: common (for all platforms) wxTopLevelWindow functions -// Author: Julian Smart, Vadim Zeitlin -// Created: 01/02/97 -// Id: $Id: toplvcmn.cpp 53617 2008-05-17 12:56:18Z VZ $ -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/toplevel.h" - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" - #include "wx/app.h" -#endif // WX_PRECOMP - -#include "wx/display.h" - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow) - EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow) - EVT_SIZE(wxTopLevelWindowBase::OnSize) -END_EVENT_TABLE() - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxTopLevelWindow, wxWindow) - -// ---------------------------------------------------------------------------- -// construction/destruction -// ---------------------------------------------------------------------------- - -wxTopLevelWindowBase::wxTopLevelWindowBase() -{ - // Unlike windows, top level windows are created hidden by default. - m_isShown = false; - m_winDefault = NULL; - m_winTmpDefault = NULL; -} - -wxTopLevelWindowBase::~wxTopLevelWindowBase() -{ - // don't let wxTheApp keep any stale pointers to us - if ( wxTheApp && wxTheApp->GetTopWindow() == this ) - wxTheApp->SetTopWindow(NULL); - - wxTopLevelWindows.DeleteObject(this); - - if ( IsLastBeforeExit() ) - { - // no other (important) windows left, quit the app - wxTheApp->ExitMainLoop(); - } -} - -bool wxTopLevelWindowBase::Destroy() -{ - // delayed destruction: the frame will be deleted during the next idle - // loop iteration - if ( !wxPendingDelete.Member(this) ) - wxPendingDelete.Append(this); - -#ifdef __WXMAC__ - // on mac we know that objects will always be deleted after this event - // has been handled, using Hide we avoid erratic redraws during window - // tear down - Hide(); -#else // !__WXMAC__ - // normally we want to hide the window immediately so that it doesn't get - // stuck on the screen while it's being destroyed, however we shouldn't - // hide the last visible window as then we might not get any idle events - // any more as no events will be sent to the hidden window and without idle - // events we won't prune wxPendingDelete list and the application won't - // terminate - for ( wxWindowList::const_iterator i = wxTopLevelWindows.begin(), - end = wxTopLevelWindows.end(); - i != end; - ++i ) - { - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); - if ( win != this && win->IsShown() ) - { - // there remains at least one other visible TLW, we can hide this - // one - Hide(); - - break; - } - } -#endif // __WXMAC__/!__WXMAC__ - - return true; -} - -bool wxTopLevelWindowBase::IsLastBeforeExit() const -{ - // first of all, automatically exiting the app on last window close can be - // completely disabled at wxTheApp level - if ( !wxTheApp || !wxTheApp->GetExitOnFrameDelete() ) - return false; - - wxWindowList::const_iterator i; - const wxWindowList::const_iterator end = wxTopLevelWindows.end(); - - // then decide whether we should exit at all - for ( i = wxTopLevelWindows.begin(); i != end; ++i ) - { - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); - if ( win->ShouldPreventAppExit() ) - { - // there remains at least one important TLW, don't exit - return false; - } - } - - // if yes, close all the other windows: this could still fail - for ( i = wxTopLevelWindows.begin(); i != end; ++i ) - { - // don't close twice the windows which are already marked for deletion - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); - if ( !wxPendingDelete.Member(win) && !win->Close() ) - { - // one of the windows refused to close, don't exit - // - // NB: of course, by now some other windows could have been already - // closed but there is really nothing we can do about it as we - // have no way just to ask the window if it can close without - // forcing it to do it - return false; - } - } - - return true; -} - -// ---------------------------------------------------------------------------- -// wxTopLevelWindow geometry -// ---------------------------------------------------------------------------- - -void wxTopLevelWindowBase::SetMinSize(const wxSize& minSize) -{ - SetSizeHints( minSize.x, minSize.y, GetMaxWidth(), GetMaxHeight() ); -} - -void wxTopLevelWindowBase::SetMaxSize(const wxSize& maxSize) -{ - SetSizeHints( GetMinWidth(), GetMinHeight(), maxSize.x, maxSize.y ); -} - -// set the min/max size of the window -void wxTopLevelWindowBase::DoSetSizeHints(int minW, int minH, - int maxW, int maxH, - int WXUNUSED(incW), int WXUNUSED(incH)) -{ - // setting min width greater than max width leads to infinite loops under - // X11 and generally doesn't make any sense, so don't allow it - wxCHECK_RET( (minW == wxDefaultCoord || maxW == wxDefaultCoord || minW <= maxW) && - (minH == wxDefaultCoord || maxH == wxDefaultCoord || minH <= maxH), - _T("min width/height must be less than max width/height!") ); - - m_minWidth = minW; - m_maxWidth = maxW; - m_minHeight = minH; - m_maxHeight = maxH; -} - -void wxTopLevelWindowBase::GetRectForTopLevelChildren(int *x, int *y, int *w, int *h) -{ - GetPosition(x,y); - GetSize(w,h); -} - -/* static */ -wxSize wxTopLevelWindowBase::GetDefaultSize() -{ - wxSize size = wxGetClientDisplayRect().GetSize(); - - // create proportionally bigger windows on small screens - if ( size.x >= 1024 ) - size.x = 400; - else if ( size.x >= 800 ) - size.x = 300; - else if ( size.x >= 320 ) - size.x = 240; - - if ( size.y >= 768 ) - size.y = 250; - else if ( size.y > 200 ) - { - size.y *= 2; - size.y /= 3; - } - - return size; -} - -void wxTopLevelWindowBase::DoCentre(int dir) -{ - // on some platforms centering top level windows is impossible - // because they are always maximized by guidelines or limitations - if(IsAlwaysMaximized()) - return; - - // we need the display rect anyhow so store it first: notice that we should - // be centered on the same display as our parent window, the display of - // this window itself is not really defined yet - int nDisplay = wxDisplay::GetFromWindow(GetParent() ? GetParent() : this); - wxDisplay dpy(nDisplay == wxNOT_FOUND ? 0 : nDisplay); - const wxRect rectDisplay(dpy.GetClientArea()); - - // what should we centre this window on? - wxRect rectParent; - if ( !(dir & wxCENTRE_ON_SCREEN) && GetParent() ) - { - // centre on parent window: notice that we need screen coordinates for - // positioning this TLW - rectParent = GetParent()->GetScreenRect(); - - // if the parent is entirely off screen (happens at least with MDI - // parent frame under Mac but could happen elsewhere too if the frame - // was hidden/moved away for some reason), don't use it as otherwise - // this window wouldn't be visible at all - if ( !rectDisplay.Contains(rectParent.GetTopLeft()) && - !rectParent.Contains(rectParent.GetBottomRight()) ) - { - // this is enough to make IsEmpty() test below pass - rectParent.width = 0; - } - } - - if ( rectParent.IsEmpty() ) - { - // we were explicitely asked to centre this window on the entire screen - // or if we have no parent anyhow and so can't centre on it - rectParent = rectDisplay; - } - - // centering maximized window on screen is no-op - if((rectParent == rectDisplay) && IsMaximized()) - return; - - if ( !(dir & wxBOTH) ) - dir |= wxBOTH; // if neither is specified, center in both directions - - // the new window rect candidate - wxRect rect = GetRect().CentreIn(rectParent, dir & ~wxCENTRE_ON_SCREEN); - - // we don't want to place the window off screen if Centre() is called as - // this is (almost?) never wanted and it would be very difficult to prevent - // it from happening from the user code if we didn't check for it here - if ( !rectDisplay.Contains(rect.GetTopLeft()) ) - { - // move the window just enough to make the corner visible - int dx = rectDisplay.GetLeft() - rect.GetLeft(); - int dy = rectDisplay.GetTop() - rect.GetTop(); - rect.Offset(dx > 0 ? dx : 0, dy > 0 ? dy : 0); - } - - if ( !rectDisplay.Contains(rect.GetBottomRight()) ) - { - // do the same for this corner too - int dx = rectDisplay.GetRight() - rect.GetRight(); - int dy = rectDisplay.GetBottom() - rect.GetBottom(); - rect.Offset(dx < 0 ? dx : 0, dy < 0 ? dy : 0); - } - - // the window top left and bottom right corner are both visible now and - // although the window might still be not entirely on screen (with 2 - // staggered displays for example) we wouldn't be able to improve the - // layout much in such case, so we stop here - - // -1 could be valid coordinate here if there are several displays - SetSize(rect, wxSIZE_ALLOW_MINUS_ONE); -} - -// ---------------------------------------------------------------------------- -// wxTopLevelWindow size management: we exclude the areas taken by -// menu/status/toolbars from the client area, so the client area is what's -// really available for the frame contents -// ---------------------------------------------------------------------------- - -void wxTopLevelWindowBase::DoScreenToClient(int *x, int *y) const -{ - wxWindow::DoScreenToClient(x, y); - - // translate the wxWindow client coords to our client coords - wxPoint pt(GetClientAreaOrigin()); - if ( x ) - *x -= pt.x; - if ( y ) - *y -= pt.y; -} - -void wxTopLevelWindowBase::DoClientToScreen(int *x, int *y) const -{ - // our client area origin (0, 0) may be really something like (0, 30) for - // wxWindow if we have a toolbar, account for it before translating - wxPoint pt(GetClientAreaOrigin()); - if ( x ) - *x += pt.x; - if ( y ) - *y += pt.y; - - wxWindow::DoClientToScreen(x, y); -} - -bool wxTopLevelWindowBase::IsAlwaysMaximized() const -{ -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - return true; -#else - return false; -#endif -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -// default resizing behaviour - if only ONE subwindow, resize to fill the -// whole client area -void wxTopLevelWindowBase::DoLayout() -{ - // if we're using constraints or sizers - do use them - if ( GetAutoLayout() ) - { - Layout(); - } - else - { - // do we have _exactly_ one child? - wxWindow *child = (wxWindow *)NULL; - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *win = node->GetData(); - - // exclude top level and managed windows (status bar isn't - // currently in the children list except under wxMac anyhow, but - // it makes no harm to test for it) - if ( !win->IsTopLevel() && !IsOneOfBars(win) ) - { - if ( child ) - { - return; // it's our second subwindow - nothing to do - } - - child = win; - } - } - - // do we have any children at all? - if ( child && child->IsShown() ) - { - // exactly one child - set it's size to fill the whole frame - int clientW, clientH; - DoGetClientSize(&clientW, &clientH); - - child->SetSize(0, 0, clientW, clientH); - } - } -} - -// The default implementation for the close window event. -void wxTopLevelWindowBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) -{ - Destroy(); -} - -bool wxTopLevelWindowBase::SendIconizeEvent(bool iconized) -{ - wxIconizeEvent event(GetId(), iconized); - event.SetEventObject(this); - - return GetEventHandler()->ProcessEvent(event); -} - -// do the window-specific processing after processing the update event -void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event) -{ - // call inherited, but skip the wxControl's version, and call directly the - // wxWindow's one instead, because the only reason why we are overriding this - // function is that we want to use SetTitle() instead of wxControl::SetLabel() - wxWindowBase::DoUpdateWindowUI(event); - - // update title - if ( event.GetSetText() ) - { - if ( event.GetText() != GetTitle() ) - SetTitle(event.GetText()); - } -} - -void wxTopLevelWindowBase::RequestUserAttention(int WXUNUSED(flags)) -{ - // it's probably better than do nothing, isn't it? - Raise(); -} - -void wxTopLevelWindowBase::RemoveChild(wxWindowBase *child) -{ - if ( child == m_winDefault ) - m_winDefault = NULL; - - if ( child == m_winTmpDefault ) - m_winTmpDefault = NULL; - - wxWindow::RemoveChild(child); -} diff --git a/Source/3rdParty/wx/src/common/treebase.cpp b/Source/3rdParty/wx/src/common/treebase.cpp deleted file mode 100644 index 8613ab1d3..000000000 --- a/Source/3rdParty/wx/src/common/treebase.cpp +++ /dev/null @@ -1,239 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: treebase.cpp -// Purpose: Base wxTreeCtrl classes -// Author: Julian Smart -// Created: 01/02/97 -// Modified: -// Id: $Id: treebase.cpp 51356 2008-01-24 11:23:30Z VZ $ -// Copyright: (c) 1998 Robert Roebling, Julian Smart et al -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================= -// declarations -// ============================================================================= - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TREECTRL - -#include "wx/treectrl.h" -#include "wx/imaglist.h" - -// ---------------------------------------------------------------------------- -// events -// ---------------------------------------------------------------------------- - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU) - -// ---------------------------------------------------------------------------- -// Tree event -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxTreeEvent, wxNotifyEvent) - - -wxTreeEvent::wxTreeEvent(wxEventType commandType, - wxTreeCtrlBase *tree, - const wxTreeItemId& item) - : wxNotifyEvent(commandType, tree->GetId()), - m_item(item) -{ - m_editCancelled = false; - - SetEventObject(tree); - - if ( item.IsOk() ) - SetClientObject(tree->GetItemData(item)); -} - -wxTreeEvent::wxTreeEvent(wxEventType commandType, int id) - : wxNotifyEvent(commandType, id) -{ - m_itemOld = 0l; - m_editCancelled = false; -} - -wxTreeEvent::wxTreeEvent(const wxTreeEvent & event) - : wxNotifyEvent(event) -{ - m_evtKey = event.m_evtKey; - m_item = event.m_item; - m_itemOld = event.m_itemOld; - m_pointDrag = event.m_pointDrag; - m_label = event.m_label; - m_editCancelled = event.m_editCancelled; -} - -// ---------------------------------------------------------------------------- -// wxTreeCtrlBase -// ---------------------------------------------------------------------------- - -wxTreeCtrlBase::~wxTreeCtrlBase() -{ - if (m_ownsImageListNormal) - delete m_imageListNormal; - if (m_ownsImageListState) - delete m_imageListState; -} - -static void -wxGetBestTreeSize(const wxTreeCtrlBase* treeCtrl, wxTreeItemId id, wxSize& size) -{ - wxRect rect; - - if ( treeCtrl->GetBoundingRect(id, rect, true /* just the item */) ) - { - // Translate to logical position so we get the full extent -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - rect.x += treeCtrl->GetScrollPos(wxHORIZONTAL); - rect.y += treeCtrl->GetScrollPos(wxVERTICAL); -#endif - - size.IncTo(wxSize(rect.GetRight(), rect.GetBottom())); - } - - wxTreeItemIdValue cookie; - for ( wxTreeItemId item = treeCtrl->GetFirstChild(id, cookie); - item.IsOk(); - item = treeCtrl->GetNextChild(id, cookie) ) - { - wxGetBestTreeSize(treeCtrl, item, size); - } -} - -wxSize wxTreeCtrlBase::DoGetBestSize() const -{ - wxSize size; - - // this doesn't really compute the total bounding rectangle of all items - // but a not too bad guess of it which has the advantage of not having to - // examine all (potentially hundreds or thousands) items in the control - - if (GetQuickBestSize()) - { - for ( wxTreeItemId item = GetRootItem(); - item.IsOk(); - item = GetLastChild(item) ) - { - wxRect rect; - - // last parameter is "true" to get only the dimensions of the text - // label, we don't want to get the entire item width as it's determined - // by the current size - if ( GetBoundingRect(item, rect, true) ) - { - if ( size.x < rect.x + rect.width ) - size.x = rect.x + rect.width; - if ( size.y < rect.y + rect.height ) - size.y = rect.y + rect.height; - } - } - } - else // use precise, if potentially slow, size computation method - { - // iterate over all items recursively - wxTreeItemId idRoot = GetRootItem(); - if ( idRoot.IsOk() ) - wxGetBestTreeSize(this, idRoot, size); - } - - // need some minimal size even for empty tree - if ( !size.x || !size.y ) - size = wxControl::DoGetBestSize(); - else - { - // Add border size - size += GetWindowBorderSize(); - - CacheBestSize(size); - } - - return size; -} - -void wxTreeCtrlBase::ExpandAll() -{ - if ( IsEmpty() ) - return; - - ExpandAllChildren(GetRootItem()); -} - -void wxTreeCtrlBase::ExpandAllChildren(const wxTreeItemId& item) -{ - // expand this item first, this might result in its children being added on - // the fly - if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) ) - Expand(item); - //else: expanding hidden root item is unsupported and unnecessary - - // then (recursively) expand all the children - wxTreeItemIdValue cookie; - for ( wxTreeItemId idCurr = GetFirstChild(item, cookie); - idCurr.IsOk(); - idCurr = GetNextChild(item, cookie) ) - { - ExpandAllChildren(idCurr); - } -} - -void wxTreeCtrlBase::CollapseAll() -{ - if ( IsEmpty() ) - return; - - CollapseAllChildren(GetRootItem()); -} - -void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item) -{ - // first (recursively) collapse all the children - wxTreeItemIdValue cookie; - for ( wxTreeItemId idCurr = GetFirstChild(item, cookie); - idCurr.IsOk(); - idCurr = GetNextChild(item, cookie) ) - { - CollapseAllChildren(idCurr); - } - - // then collapse this element too - Collapse(item); -} - -bool wxTreeCtrlBase::IsEmpty() const -{ - return !GetRootItem().IsOk(); -} - -#endif // wxUSE_TREECTRL - diff --git a/Source/3rdParty/wx/src/common/txtstrm.cpp b/Source/3rdParty/wx/src/common/txtstrm.cpp deleted file mode 100644 index 3dad17012..000000000 --- a/Source/3rdParty/wx/src/common/txtstrm.cpp +++ /dev/null @@ -1,520 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/txtstrm.cpp -// Purpose: Text stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 28/06/98 -// RCS-ID: $Id: txtstrm.cpp 48920 2007-09-24 13:11:36Z JS $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/txtstrm.h" -#include - - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// Unix: "\n" -// Dos: "\r\n" -// Mac: "\r" - -// ---------------------------------------------------------------------------- -// wxTextInputStream -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE -wxTextInputStream::wxTextInputStream(wxInputStream &s, - const wxString &sep, - const wxMBConv& conv) - : m_input(s), m_separators(sep), m_conv(conv.Clone()) -{ - memset((void*)m_lastBytes, 0, 10); -} -#else -wxTextInputStream::wxTextInputStream(wxInputStream &s, const wxString &sep) - : m_input(s), m_separators(sep) -{ - memset((void*)m_lastBytes, 0, 10); -} -#endif - -wxTextInputStream::~wxTextInputStream() -{ -#if wxUSE_UNICODE - delete m_conv; -#endif // wxUSE_UNICODE -} - -void wxTextInputStream::UngetLast() -{ - size_t byteCount = 0; - while(m_lastBytes[byteCount]) // pseudo ANSI strlen (even for Unicode!) - byteCount++; - m_input.Ungetch(m_lastBytes, byteCount); - memset((void*)m_lastBytes, 0, 10); -} - -wxChar wxTextInputStream::NextChar() -{ -#if wxUSE_UNICODE - wxChar wbuf[2]; - memset((void*)m_lastBytes, 0, 10); - for(size_t inlen = 0; inlen < 9; inlen++) - { - // actually read the next character - m_lastBytes[inlen] = m_input.GetC(); - - if(m_input.LastRead() <= 0) - return wxEOT; - - if ( m_conv->ToWChar(wbuf, WXSIZEOF(wbuf), m_lastBytes, inlen + 1) - != wxCONV_FAILED ) - return wbuf[0]; - } - // there should be no encoding which requires more than nine bytes for one character... - return wxEOT; -#else - m_lastBytes[0] = m_input.GetC(); - - if(m_input.LastRead() <= 0) - return wxEOT; - - return m_lastBytes[0]; -#endif - -} - -wxChar wxTextInputStream::NextNonSeparators() -{ - for (;;) - { - wxChar c = NextChar(); - if (c == wxEOT) return (wxChar) 0; - - if (c != wxT('\n') && - c != wxT('\r') && - !m_separators.Contains(c)) - return c; - } - -} - -bool wxTextInputStream::EatEOL(const wxChar &c) -{ - if (c == wxT('\n')) return true; // eat on UNIX - - if (c == wxT('\r')) // eat on both Mac and DOS - { - wxChar c2 = NextChar(); - if(c2 == wxEOT) return true; // end of stream reached, had enough :-) - - if (c2 != wxT('\n')) UngetLast(); // Don't eat on Mac - return true; - } - - return false; -} - -wxUint32 wxTextInputStream::Read32(int base) -{ - wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") ); - if(!m_input) return 0; - - wxString word = ReadWord(); - if(word.empty()) - return 0; - return wxStrtoul(word.c_str(), 0, base); -} - -wxUint16 wxTextInputStream::Read16(int base) -{ - return (wxUint16)Read32(base); -} - -wxUint8 wxTextInputStream::Read8(int base) -{ - return (wxUint8)Read32(base); -} - -wxInt32 wxTextInputStream::Read32S(int base) -{ - wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") ); - if(!m_input) return 0; - - wxString word = ReadWord(); - if(word.empty()) - return 0; - return wxStrtol(word.c_str(), 0, base); -} - -wxInt16 wxTextInputStream::Read16S(int base) -{ - return (wxInt16)Read32S(base); -} - -wxInt8 wxTextInputStream::Read8S(int base) -{ - return (wxInt8)Read32S(base); -} - -double wxTextInputStream::ReadDouble() -{ - if(!m_input) return 0; - wxString word = ReadWord(); - if(word.empty()) - return 0; - return wxStrtod(word.c_str(), 0); -} - -#if WXWIN_COMPATIBILITY_2_6 - -wxString wxTextInputStream::ReadString() -{ - return ReadLine(); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - -wxString wxTextInputStream::ReadLine() -{ - wxString line; - - while ( !m_input.Eof() ) - { - wxChar c = NextChar(); - if(c == wxEOT) - break; - - if (EatEOL(c)) - break; - - line += c; - } - - return line; -} - -wxString wxTextInputStream::ReadWord() -{ - wxString word; - - if ( !m_input ) - return word; - - wxChar c = NextNonSeparators(); - if ( !c ) - return word; - - word += c; - - while ( !m_input.Eof() ) - { - c = NextChar(); - if(c == wxEOT) - break; - - if (m_separators.Contains(c)) - break; - - if (EatEOL(c)) - break; - - word += c; - } - - return word; -} - -wxTextInputStream& wxTextInputStream::operator>>(wxString& word) -{ - word = ReadWord(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(char& c) -{ - c = m_input.GetC(); - if(m_input.LastRead() <= 0) c = 0; - - if (EatEOL(c)) - c = '\n'; - - return *this; -} - -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - -wxTextInputStream& wxTextInputStream::operator>>(wchar_t& wc) -{ - wc = GetChar(); - - return *this; -} - -#endif // wxUSE_UNICODE - -wxTextInputStream& wxTextInputStream::operator>>(wxInt16& i) -{ - i = (wxInt16)Read16(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(wxInt32& i) -{ - i = (wxInt32)Read32(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(wxUint16& i) -{ - i = Read16(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(wxUint32& i) -{ - i = Read32(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(double& i) -{ - i = ReadDouble(); - return *this; -} - -wxTextInputStream& wxTextInputStream::operator>>(float& f) -{ - f = (float)ReadDouble(); - return *this; -} - - - -#if wxUSE_UNICODE -wxTextOutputStream::wxTextOutputStream(wxOutputStream& s, - wxEOL mode, - const wxMBConv& conv) - : m_output(s), m_conv(conv.Clone()) -#else -wxTextOutputStream::wxTextOutputStream(wxOutputStream& s, wxEOL mode) - : m_output(s) -#endif -{ - m_mode = mode; - if (m_mode == wxEOL_NATIVE) - { -#if defined(__WXMSW__) || defined(__WXPM__) - m_mode = wxEOL_DOS; -#elif defined(__WXMAC__) && !defined(__DARWIN__) - m_mode = wxEOL_MAC; -#else - m_mode = wxEOL_UNIX; -#endif - } -} - -wxTextOutputStream::~wxTextOutputStream() -{ -#if wxUSE_UNICODE - delete m_conv; -#endif // wxUSE_UNICODE -} - -void wxTextOutputStream::SetMode(wxEOL mode) -{ - m_mode = mode; - if (m_mode == wxEOL_NATIVE) - { -#if defined(__WXMSW__) || defined(__WXPM__) - m_mode = wxEOL_DOS; -#elif defined(__WXMAC__) && !defined(__DARWIN__) - m_mode = wxEOL_MAC; -#else - m_mode = wxEOL_UNIX; -#endif - } -} - -void wxTextOutputStream::Write32(wxUint32 i) -{ - wxString str; - str.Printf(wxT("%u"), i); - - WriteString(str); -} - -void wxTextOutputStream::Write16(wxUint16 i) -{ - wxString str; - str.Printf(wxT("%u"), (unsigned)i); - - WriteString(str); -} - -void wxTextOutputStream::Write8(wxUint8 i) -{ - wxString str; - str.Printf(wxT("%u"), (unsigned)i); - - WriteString(str); -} - -void wxTextOutputStream::WriteDouble(double d) -{ - wxString str; - - str.Printf(wxT("%f"), d); - WriteString(str); -} - -void wxTextOutputStream::WriteString(const wxString& string) -{ - size_t len = string.length(); - - wxString out; - out.reserve(len); - - for ( size_t i = 0; i < len; i++ ) - { - const wxChar c = string[i]; - if ( c == wxT('\n') ) - { - switch ( m_mode ) - { - case wxEOL_DOS: - out << _T("\r\n"); - continue; - - case wxEOL_MAC: - out << _T('\r'); - continue; - - default: - wxFAIL_MSG( _T("unknown EOL mode in wxTextOutputStream") ); - // fall through - - case wxEOL_UNIX: - // don't treat '\n' specially - ; - } - } - - out << c; - } - -#if wxUSE_UNICODE - wxCharBuffer buffer = m_conv->cWC2MB(out, out.length(), &len); - m_output.Write(buffer, len); -#else - m_output.Write(out.c_str(), out.length() ); -#endif -} - -wxTextOutputStream& wxTextOutputStream::PutChar(wxChar c) -{ -#if wxUSE_UNICODE - WriteString( wxString(&c, *m_conv, 1) ); -#else - WriteString( wxString(&c, wxConvLocal, 1) ); -#endif - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(const wxChar *string) -{ - WriteString( wxString(string) ); - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(const wxString& string) -{ - WriteString( string ); - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(char c) -{ - WriteString( wxString::FromAscii(c) ); - - return *this; -} - -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - -wxTextOutputStream& wxTextOutputStream::operator<<(wchar_t wc) -{ - WriteString( wxString(&wc, *m_conv, 1) ); - - return *this; -} - -#endif // wxUSE_UNICODE - -wxTextOutputStream& wxTextOutputStream::operator<<(wxInt16 c) -{ - wxString str; - str.Printf(wxT("%d"), (signed int)c); - WriteString(str); - - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(wxInt32 c) -{ - wxString str; - str.Printf(wxT("%ld"), (signed long)c); - WriteString(str); - - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(wxUint16 c) -{ - wxString str; - str.Printf(wxT("%u"), (unsigned int)c); - WriteString(str); - - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(wxUint32 c) -{ - wxString str; - str.Printf(wxT("%lu"), (unsigned long)c); - WriteString(str); - - return *this; -} - -wxTextOutputStream &wxTextOutputStream::operator<<(double f) -{ - WriteDouble(f); - return *this; -} - -wxTextOutputStream& wxTextOutputStream::operator<<(float f) -{ - WriteDouble((double)f); - return *this; -} - -wxTextOutputStream &endl( wxTextOutputStream &stream ) -{ - return stream.PutChar(wxT('\n')); -} - -#endif - // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/unictabl.inc b/Source/3rdParty/wx/src/common/unictabl.inc deleted file mode 100644 index d75491642..000000000 --- a/Source/3rdParty/wx/src/common/unictabl.inc +++ /dev/null @@ -1,872 +0,0 @@ - - -/* - * This file is #included by encconv.cpp - * - * CVS-ID: $Id: unictabl.inc 40398 2006-07-31 16:28:43Z VS $ - * - * *** *** CAUTION! *** *** - * Do not modify this file by hand! It is generated by shell - * script $(WXWIN)/misc/unictabl/regenerate - * - * Parts of this file are based on tables published by Unicode, Inc. - * Original tables are freely available at - * ftp://ftp.unicode.org/Public/MAPPINGS - * - * Original copyright info as present in mapping tables follows: - * - * - * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved. - * - * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). - * No claims are made as to fitness for any particular purpose. No - * warranties of any kind are expressed or implied. The recipient - * agrees to determine applicability of information provided. If this - * file has been provided on optical media by Unicode, Inc., the sole - * remedy for any claim will be exchange of defective media within 90 - * days of receipt. - * - * Unicode, Inc. hereby grants the right to freely use the information - * supplied in this file in the creation of products supporting the - * Unicode Standard, and to make copies of this file in any form for - * internal or external distribution as long as this notice remains - * attached. - */ - - - - -/* - * ISO8859_1 to Unicode recoding table - * based on file mappings/8859-1.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_1[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF - }; - - -/* - * ISO8859_10 to Unicode recoding table - * based on file mappings/8859-10.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_10[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, - 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, - 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, - 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138 - }; - - -/* - * ISO8859_13 to Unicode recoding table - * based on file mappings/8859-13.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_13[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, - 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019 - }; - - -/* - * ISO8859_14 to Unicode recoding table - * based on file mappings/8859-14.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_14[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, - 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, - 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, - 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF - }; - - -/* - * ISO8859_15 to Unicode recoding table - * based on file mappings/8859-15.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_15[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, - 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, - 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF - }; - - -/* - * ISO8859_2 to Unicode recoding table - * based on file mappings/8859-2.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_2[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, - 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, - 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, - 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 - }; - - -/* - * ISO8859_3 to Unicode recoding table - * based on file mappings/8859-3.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_3[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, - 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, - 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, - 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, - 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, - 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 - }; - - -/* - * ISO8859_4 to Unicode recoding table - * based on file mappings/8859-4.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_4[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, - 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, - 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, - 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, - 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, - 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 - }; - - -/* - * ISO8859_5 to Unicode recoding table - * based on file mappings/8859-5.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_5[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F - }; - - -/* - * ISO8859_6 to Unicode recoding table - * based on file mappings/8859-6.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_6[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0000, 0x0000, 0x0000, 0x00A4, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x060C, 0x00AD, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x061B, 0x0000, 0x0000, 0x0000, 0x061F, - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, - 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - - -/* - * ISO8859_7 to Unicode recoding table - * based on file mappings/8859-7.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_7[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x2018, 0x2019, 0x00A3, 0x0000, 0x0000, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x0000, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 - }; - - -/* - * ISO8859_8 to Unicode recoding table - * based on file mappings/8859-8.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_8[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - - -/* - * ISO8859_9 to Unicode recoding table - * based on file mappings/8859-9.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__ISO8859_9[128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF - }; - - -/* - * CP1250 to Unicode recoding table - * based on file mappings/CP1250.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1250[128] = { - 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, - 0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, - 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, - 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 - }; - - -/* - * CP1251 to Unicode recoding table - * based on file mappings/CP1251.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1251[128] = { - 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, - 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, - 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x0000, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, - 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, - 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, - 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, - 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F - }; - - -/* - * CP1252 to Unicode recoding table - * based on file mappings/CP1252.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1252[128] = { - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF - }; - - -/* - * CP1253 to Unicode recoding table - * based on file mappings/CP1253.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1253[128] = { - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 - }; - - -/* - * CP1254 to Unicode recoding table - * based on file mappings/CP1254.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1254[128] = { - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF - }; - - -/* - * CP1255 to Unicode recoding table - * based on file mappings/CP1255.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1255[128] = { - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, - 0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, - 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, - 0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 - }; - - -/* - * CP1256 to Unicode recoding table - * based on file mappings/CP1256.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1256[128] = { - 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, - 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, - 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, - 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, - 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, - 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, - 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 - }; - - -/* - * CP1257 to Unicode recoding table - * based on file mappings/CP1257.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__CP1257[128] = { - 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, - 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000, - 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, - 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 - }; - - -/* - * KOI8 to Unicode recoding table - * based on file mappings/KOI8-R.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__KOI8[128] = { - 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, - 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, - 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, - 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, - 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, - 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, - 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A - }; - - -/* - * KOI8_U to Unicode recoding table - * based on file mappings/KOI8-U.TXT by Unicode Consortium - */ - -static const wxUint16 encoding_table__KOI8_U[128] = { - 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, - 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, - 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, - 0x255F, 0x2560, 0x2561, 0x0401, 0x0403, 0x2563, 0x0406, 0x0407, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, - 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, - 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, - 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, - 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A - }; - - - - - -/* - * - * Unicode to 7bit ASCII fallback - * (for use with wxRECODE_SUBSTITUTE recoding mode) - * - */ - -static const struct { - wxUint16 c /*code*/; - wxUint8 s /*inaccurate substitution*/; -} encoding_unicode_fallback[] = { - - {0x00AB, 0x22}, - {0x00BB, 0x22}, - {0x00C0, 0x41}, - {0x00C1, 0x41}, - {0x00C2, 0x41}, - {0x00C3, 0x41}, - {0x00C4, 0x41}, - {0x00C5, 0x41}, - {0x00C7, 0x43}, - {0x00C8, 0x45}, - {0x00C9, 0x45}, - {0x00CA, 0x45}, - {0x00CB, 0x45}, - {0x00CC, 0x49}, - {0x00CD, 0x49}, - {0x00CE, 0x49}, - {0x00CF, 0x49}, - {0x00D1, 0x4E}, - {0x00D2, 0x4F}, - {0x00D3, 0x4F}, - {0x00D4, 0x4F}, - {0x00D5, 0x4F}, - {0x00D6, 0x4F}, - {0x00D8, 0x4F}, - {0x00D9, 0x55}, - {0x00DA, 0x55}, - {0x00DB, 0x55}, - {0x00DC, 0x55}, - {0x00DD, 0x59}, - {0x00E0, 0x61}, - {0x00E1, 0x61}, - {0x00E2, 0x61}, - {0x00E3, 0x61}, - {0x00E4, 0x61}, - {0x00E5, 0x61}, - {0x00E7, 0x63}, - {0x00E8, 0x65}, - {0x00E9, 0x65}, - {0x00EA, 0x65}, - {0x00EB, 0x65}, - {0x00EC, 0x69}, - {0x00ED, 0x69}, - {0x00EE, 0x69}, - {0x00EF, 0x69}, - {0x00F1, 0x6E}, - {0x00F2, 0x6F}, - {0x00F3, 0x6F}, - {0x00F4, 0x6F}, - {0x00F5, 0x6F}, - {0x00F6, 0x6F}, - {0x00F8, 0x6F}, - {0x00F9, 0x75}, - {0x00FA, 0x75}, - {0x00FB, 0x75}, - {0x00FC, 0x75}, - {0x00FD, 0x79}, - {0x00FF, 0x79}, - {0x0100, 0x41}, - {0x0101, 0x61}, - {0x0102, 0x41}, - {0x0103, 0x61}, - {0x0104, 0x41}, - {0x0105, 0x61}, - {0x0106, 0x43}, - {0x0107, 0x63}, - {0x0108, 0x43}, - {0x0109, 0x63}, - {0x010A, 0x43}, - {0x010B, 0x63}, - {0x010C, 0x43}, - {0x010D, 0x63}, - {0x010E, 0x44}, - {0x010F, 0x64}, - {0x0110, 0x44}, - {0x0111, 0x64}, - {0x0112, 0x45}, - {0x0113, 0x65}, - {0x0116, 0x45}, - {0x0117, 0x65}, - {0x0118, 0x45}, - {0x0119, 0x65}, - {0x011A, 0x45}, - {0x011B, 0x65}, - {0x011C, 0x47}, - {0x011D, 0x67}, - {0x011E, 0x47}, - {0x011F, 0x67}, - {0x0120, 0x47}, - {0x0121, 0x67}, - {0x0122, 0x47}, - {0x0123, 0x67}, - {0x0124, 0x48}, - {0x0125, 0x68}, - {0x0126, 0x48}, - {0x0127, 0x68}, - {0x0128, 0x49}, - {0x0129, 0x69}, - {0x012A, 0x49}, - {0x012B, 0x69}, - {0x012E, 0x49}, - {0x012F, 0x69}, - {0x0130, 0x49}, - {0x0134, 0x4A}, - {0x0135, 0x6A}, - {0x0136, 0x4B}, - {0x0137, 0x6B}, - {0x0139, 0x4C}, - {0x013A, 0x6C}, - {0x013B, 0x4C}, - {0x013C, 0x6C}, - {0x013D, 0x4C}, - {0x013E, 0x6C}, - {0x0141, 0x4C}, - {0x0142, 0x6C}, - {0x0143, 0x4E}, - {0x0144, 0x6E}, - {0x0145, 0x4E}, - {0x0146, 0x6E}, - {0x0147, 0x4E}, - {0x0148, 0x6E}, - {0x014C, 0x4F}, - {0x014D, 0x6F}, - {0x0150, 0x4F}, - {0x0151, 0x6F}, - {0x0154, 0x52}, - {0x0155, 0x72}, - {0x0156, 0x52}, - {0x0157, 0x72}, - {0x0158, 0x52}, - {0x0159, 0x72}, - {0x015A, 0x53}, - {0x015B, 0x73}, - {0x015C, 0x53}, - {0x015D, 0x73}, - {0x015E, 0x53}, - {0x015F, 0x73}, - {0x0160, 0x53}, - {0x0161, 0x73}, - {0x0162, 0x54}, - {0x0163, 0x74}, - {0x0164, 0x54}, - {0x0165, 0x74}, - {0x0166, 0x54}, - {0x0167, 0x74}, - {0x0168, 0x55}, - {0x0169, 0x75}, - {0x016A, 0x55}, - {0x016B, 0x75}, - {0x016C, 0x55}, - {0x016D, 0x75}, - {0x016E, 0x55}, - {0x016F, 0x75}, - {0x0170, 0x55}, - {0x0171, 0x75}, - {0x0172, 0x55}, - {0x0173, 0x75}, - {0x0174, 0x57}, - {0x0175, 0x77}, - {0x0176, 0x59}, - {0x0177, 0x79}, - {0x0178, 0x59}, - {0x0179, 0x5A}, - {0x017A, 0x7A}, - {0x017B, 0x5A}, - {0x017C, 0x7A}, - {0x017D, 0x5A}, - {0x017E, 0x7A}, - {0x0192, 0x66}, - {0x1E02, 0x42}, - {0x1E03, 0x62}, - {0x1E0A, 0x44}, - {0x1E0B, 0x64}, - {0x1E1E, 0x46}, - {0x1E1F, 0x66}, - {0x1E40, 0x4D}, - {0x1E41, 0x6D}, - {0x1E56, 0x50}, - {0x1E57, 0x70}, - {0x1E60, 0x53}, - {0x1E61, 0x73}, - {0x1E6A, 0x54}, - {0x1E6B, 0x74}, - {0x1E80, 0x57}, - {0x1E81, 0x77}, - {0x1E82, 0x57}, - {0x1E83, 0x77}, - {0x1E84, 0x57}, - {0x1E85, 0x77}, - {0x1EF2, 0x59}, - {0x1EF3, 0x79}, - {0x2013, 0x2D}, - {0x2014, 0x2D}, - {0x2018, 0x27}, - {0x2019, 0x27}, - {0x201A, 0x27}, - {0x201C, 0x22}, - {0x201D, 0x22}, - {0x201E, 0x22}, - {0x2039, 0x27}, - {0x203A, 0x27}, - {0, 0} - }; - -static const unsigned encoding_unicode_fallback_count = 200; - - - - -/* - * - * Table of all supported encodings: - * - */ - -static const struct { - wxFontEncoding encoding; // encoding identifier - const wxUint16 *table; // 8bit to unicode table -} encodings_list[] = { - - { wxFONTENCODING_ISO8859_1, encoding_table__ISO8859_1}, - { wxFONTENCODING_ISO8859_10, encoding_table__ISO8859_10}, - { wxFONTENCODING_ISO8859_13, encoding_table__ISO8859_13}, - { wxFONTENCODING_ISO8859_14, encoding_table__ISO8859_14}, - { wxFONTENCODING_ISO8859_15, encoding_table__ISO8859_15}, - { wxFONTENCODING_ISO8859_2, encoding_table__ISO8859_2}, - { wxFONTENCODING_ISO8859_3, encoding_table__ISO8859_3}, - { wxFONTENCODING_ISO8859_4, encoding_table__ISO8859_4}, - { wxFONTENCODING_ISO8859_5, encoding_table__ISO8859_5}, - { wxFONTENCODING_ISO8859_6, encoding_table__ISO8859_6}, - { wxFONTENCODING_ISO8859_7, encoding_table__ISO8859_7}, - { wxFONTENCODING_ISO8859_8, encoding_table__ISO8859_8}, - { wxFONTENCODING_ISO8859_9, encoding_table__ISO8859_9}, - { wxFONTENCODING_CP1250, encoding_table__CP1250}, - { wxFONTENCODING_CP1251, encoding_table__CP1251}, - { wxFONTENCODING_CP1252, encoding_table__CP1252}, - { wxFONTENCODING_CP1253, encoding_table__CP1253}, - { wxFONTENCODING_CP1254, encoding_table__CP1254}, - { wxFONTENCODING_CP1255, encoding_table__CP1255}, - { wxFONTENCODING_CP1256, encoding_table__CP1256}, - { wxFONTENCODING_CP1257, encoding_table__CP1257}, - { wxFONTENCODING_KOI8, encoding_table__KOI8}, - { wxFONTENCODING_KOI8_U, encoding_table__KOI8_U}, - {wxFONTENCODING_MAX /*anything*/, NULL} - }; diff --git a/Source/3rdParty/wx/src/common/uri.cpp b/Source/3rdParty/wx/src/common/uri.cpp deleted file mode 100644 index 9ff50a0cc..000000000 --- a/Source/3rdParty/wx/src/common/uri.cpp +++ /dev/null @@ -1,1295 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: uri.cpp -// Purpose: Implementation of a uri parser -// Author: Ryan Norton -// Created: 10/26/04 -// RCS-ID: $Id: uri.cpp 58728 2009-02-07 22:03:30Z VZ $ -// Copyright: (c) 2004 Ryan Norton -// Licence: wxWindows -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// declarations -// =========================================================================== - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/uri.h" - -// --------------------------------------------------------------------------- -// definitions -// --------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxURI, wxObject) - -// =========================================================================== -// implementation -// =========================================================================== - -// --------------------------------------------------------------------------- -// utilities -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// -// wxURI -// -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// Constructors -// --------------------------------------------------------------------------- - -wxURI::wxURI() : m_hostType(wxURI_REGNAME), m_fields(0) -{ -} - -wxURI::wxURI(const wxString& uri) : m_hostType(wxURI_REGNAME), m_fields(0) -{ - Create(uri); -} - -wxURI::wxURI(const wxURI& uri) : wxObject(), m_hostType(wxURI_REGNAME), m_fields(0) -{ - Assign(uri); -} - -// --------------------------------------------------------------------------- -// Destructor and cleanup -// --------------------------------------------------------------------------- - -wxURI::~wxURI() -{ - Clear(); -} - -void wxURI::Clear() -{ - m_scheme = m_userinfo = m_server = m_port = m_path = - m_query = m_fragment = wxEmptyString; - - m_hostType = wxURI_REGNAME; - - m_fields = 0; -} - -// --------------------------------------------------------------------------- -// Create -// -// This creates the URI - all we do here is call the main parsing method -// --------------------------------------------------------------------------- - -const wxChar* wxURI::Create(const wxString& uri) -{ - if (m_fields) - Clear(); - - return Parse(uri); -} - -// --------------------------------------------------------------------------- -// Escape Methods -// -// TranslateEscape unencodes a 3 character URL escape sequence -// -// Escape encodes an invalid URI character into a 3 character sequence -// -// IsEscape determines if the input string contains an escape sequence, -// if it does, then it moves the input string past the escape sequence -// -// Unescape unencodes all 3 character URL escape sequences in a wxString -// --------------------------------------------------------------------------- - -wxChar wxURI::TranslateEscape(const wxChar* s) -{ - wxASSERT_MSG( IsHex(s[0]) && IsHex(s[1]), wxT("Invalid escape sequence!")); - - return wx_truncate_cast(wxChar, (CharToHex(s[0]) << 4 ) | CharToHex(s[1])); -} - -wxString wxURI::Unescape(const wxString& uri) -{ - wxString new_uri; - - for(size_t i = 0; i < uri.length(); ++i) - { - if (uri[i] == wxT('%')) - { - new_uri += wxURI::TranslateEscape( &(uri.c_str()[i+1]) ); - i += 2; - } - else - new_uri += uri[i]; - } - - return new_uri; -} - -void wxURI::Escape(wxString& s, const wxChar& c) -{ - const wxChar* hdig = wxT("0123456789abcdef"); - s += wxT('%'); - s += hdig[(c >> 4) & 15]; - s += hdig[c & 15]; -} - -bool wxURI::IsEscape(const wxChar*& uri) -{ - // pct-encoded = "%" HEXDIG HEXDIG - if(*uri == wxT('%') && IsHex(*(uri+1)) && IsHex(*(uri+2))) - return true; - else - return false; -} - -// --------------------------------------------------------------------------- -// GetUser -// GetPassword -// -// Gets the username and password via the old URL method. -// --------------------------------------------------------------------------- -wxString wxURI::GetUser() const -{ - // if there is no colon at all, find() returns npos and this method returns - // the entire string which is correct as it means that password was omitted - return m_userinfo(0, m_userinfo.find(':')); -} - -wxString wxURI::GetPassword() const -{ - size_t posColon = m_userinfo.find(':'); - - if ( posColon == wxString::npos ) - return wxT(""); - - return m_userinfo(posColon + 1, wxString::npos); -} - -// --------------------------------------------------------------------------- -// BuildURI -// -// BuildURI() builds the entire URI into a useable -// representation, including proper identification characters such as slashes -// -// BuildUnescapedURI() does the same thing as BuildURI(), only it unescapes -// the components that accept escape sequences -// --------------------------------------------------------------------------- - -wxString wxURI::BuildURI() const -{ - wxString ret; - - if (HasScheme()) - ret = ret + m_scheme + wxT(":"); - - if (HasServer()) - { - ret += wxT("//"); - - if (HasUserInfo()) - ret = ret + m_userinfo + wxT("@"); - - ret += m_server; - - if (HasPort()) - ret = ret + wxT(":") + m_port; - } - - ret += m_path; - - if (HasQuery()) - ret = ret + wxT("?") + m_query; - - if (HasFragment()) - ret = ret + wxT("#") + m_fragment; - - return ret; -} - -wxString wxURI::BuildUnescapedURI() const -{ - wxString ret; - - if (HasScheme()) - ret = ret + m_scheme + wxT(":"); - - if (HasServer()) - { - ret += wxT("//"); - - if (HasUserInfo()) - ret = ret + wxURI::Unescape(m_userinfo) + wxT("@"); - - if (m_hostType == wxURI_REGNAME) - ret += wxURI::Unescape(m_server); - else - ret += m_server; - - if (HasPort()) - ret = ret + wxT(":") + m_port; - } - - ret += wxURI::Unescape(m_path); - - if (HasQuery()) - ret = ret + wxT("?") + wxURI::Unescape(m_query); - - if (HasFragment()) - ret = ret + wxT("#") + wxURI::Unescape(m_fragment); - - return ret; -} - -// --------------------------------------------------------------------------- -// Assignment -// --------------------------------------------------------------------------- - -wxURI& wxURI::Assign(const wxURI& uri) -{ - //assign fields - m_fields = uri.m_fields; - - //ref over components - m_scheme = uri.m_scheme; - m_userinfo = uri.m_userinfo; - m_server = uri.m_server; - m_hostType = uri.m_hostType; - m_port = uri.m_port; - m_path = uri.m_path; - m_query = uri.m_query; - m_fragment = uri.m_fragment; - - return *this; -} - -wxURI& wxURI::operator = (const wxURI& uri) -{ - return Assign(uri); -} - -wxURI& wxURI::operator = (const wxString& string) -{ - Create(string); - return *this; -} - -// --------------------------------------------------------------------------- -// Comparison -// --------------------------------------------------------------------------- - -bool wxURI::operator == (const wxURI& uri) const -{ - if (HasScheme()) - { - if(m_scheme != uri.m_scheme) - return false; - } - else if (uri.HasScheme()) - return false; - - - if (HasServer()) - { - if (HasUserInfo()) - { - if (m_userinfo != uri.m_userinfo) - return false; - } - else if (uri.HasUserInfo()) - return false; - - if (m_server != uri.m_server || - m_hostType != uri.m_hostType) - return false; - - if (HasPort()) - { - if(m_port != uri.m_port) - return false; - } - else if (uri.HasPort()) - return false; - } - else if (uri.HasServer()) - return false; - - - if (HasPath()) - { - if(m_path != uri.m_path) - return false; - } - else if (uri.HasPath()) - return false; - - if (HasQuery()) - { - if (m_query != uri.m_query) - return false; - } - else if (uri.HasQuery()) - return false; - - if (HasFragment()) - { - if (m_fragment != uri.m_fragment) - return false; - } - else if (uri.HasFragment()) - return false; - - return true; -} - -// --------------------------------------------------------------------------- -// IsReference -// -// if there is no authority or scheme, it is a reference -// --------------------------------------------------------------------------- - -bool wxURI::IsReference() const -{ return !HasScheme() || !HasServer(); } - -// --------------------------------------------------------------------------- -// Parse -// -// Master URI parsing method. Just calls the individual parsing methods -// -// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] -// URI-reference = URI / relative -// --------------------------------------------------------------------------- - -const wxChar* wxURI::Parse(const wxChar* uri) -{ - uri = ParseScheme(uri); - uri = ParseAuthority(uri); - uri = ParsePath(uri); - uri = ParseQuery(uri); - return ParseFragment(uri); -} - -// --------------------------------------------------------------------------- -// ParseXXX -// -// Individual parsers for each URI component -// --------------------------------------------------------------------------- - -const wxChar* wxURI::ParseScheme(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - //copy of the uri - used for figuring out - //length of each component - const wxChar* uricopy = uri; - - //Does the uri have a scheme (first character alpha)? - if (IsAlpha(*uri)) - { - m_scheme += *uri++; - - //scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) - while (IsAlpha(*uri) || IsDigit(*uri) || - *uri == wxT('+') || - *uri == wxT('-') || - *uri == wxT('.')) - { - m_scheme += *uri++; - } - - //valid scheme? - if (*uri == wxT(':')) - { - //mark the scheme as valid - m_fields |= wxURI_SCHEME; - - //move reference point up to input buffer - uricopy = ++uri; - } - else - //relative uri with relative path reference - m_scheme = wxEmptyString; - } -// else - //relative uri with _possible_ relative path reference - - return uricopy; -} - -const wxChar* wxURI::ParseAuthority(const wxChar* uri) -{ - // authority = [ userinfo "@" ] host [ ":" port ] - if (*uri == wxT('/') && *(uri+1) == wxT('/')) - { - //skip past the two slashes - uri += 2; - - // ############# DEVIATION FROM RFC ######################### - // Don't parse the server component for file URIs - if(m_scheme != wxT("file")) - { - //normal way - uri = ParseUserInfo(uri); - uri = ParseServer(uri); - return ParsePort(uri); - } - } - - return uri; -} - -const wxChar* wxURI::ParseUserInfo(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - //copy of the uri - used for figuring out - //length of each component - const wxChar* uricopy = uri; - - // userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) - while(*uri && *uri != wxT('@') && *uri != wxT('/') && *uri != wxT('#') && *uri != wxT('?')) - { - if(IsUnreserved(*uri) || - IsSubDelim(*uri) || *uri == wxT(':')) - m_userinfo += *uri++; - else if (IsEscape(uri)) - { - m_userinfo += *uri++; - m_userinfo += *uri++; - m_userinfo += *uri++; - } - else - Escape(m_userinfo, *uri++); - } - - if(*uri == wxT('@')) - { - //valid userinfo - m_fields |= wxURI_USERINFO; - - uricopy = ++uri; - } - else - m_userinfo = wxEmptyString; - - return uricopy; -} - -const wxChar* wxURI::ParseServer(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - //copy of the uri - used for figuring out - //length of each component - const wxChar* uricopy = uri; - - // host = IP-literal / IPv4address / reg-name - // IP-literal = "[" ( IPv6address / IPvFuture ) "]" - if (*uri == wxT('[')) - { - ++uri; //some compilers don't support *&ing a ++* - if (ParseIPv6address(uri) && *uri == wxT(']')) - { - ++uri; - m_hostType = wxURI_IPV6ADDRESS; - - wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxTmemcpy(theBuffer, uricopy, uri-uricopy); - theBuffer.SetLength(uri-uricopy); - } - else - { - uri = uricopy; - - ++uri; //some compilers don't support *&ing a ++* - if (ParseIPvFuture(uri) && *uri == wxT(']')) - { - ++uri; - m_hostType = wxURI_IPVFUTURE; - - wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxTmemcpy(theBuffer, uricopy, uri-uricopy); - theBuffer.SetLength(uri-uricopy); - } - else - uri = uricopy; - } - } - else - { - if (ParseIPv4address(uri)) - { - m_hostType = wxURI_IPV4ADDRESS; - - wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxTmemcpy(theBuffer, uricopy, uri-uricopy); - theBuffer.SetLength(uri-uricopy); - } - else - uri = uricopy; - } - - if(m_hostType == wxURI_REGNAME) - { - uri = uricopy; - // reg-name = *( unreserved / pct-encoded / sub-delims ) - while(*uri && *uri != wxT('/') && *uri != wxT(':') && *uri != wxT('#') && *uri != wxT('?')) - { - if(IsUnreserved(*uri) || IsSubDelim(*uri)) - m_server += *uri++; - else if (IsEscape(uri)) - { - m_server += *uri++; - m_server += *uri++; - m_server += *uri++; - } - else - Escape(m_server, *uri++); - } - } - - //mark the server as valid - m_fields |= wxURI_SERVER; - - return uri; -} - - -const wxChar* wxURI::ParsePort(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - // port = *DIGIT - if(*uri == wxT(':')) - { - ++uri; - while(IsDigit(*uri)) - { - m_port += *uri++; - } - - //mark the port as valid - m_fields |= wxURI_PORT; - } - - return uri; -} - -const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormalize) -{ - wxASSERT(uri != NULL); - - //copy of the uri - used for figuring out - //length of each component - const wxChar* uricopy = uri; - - /// hier-part = "//" authority path-abempty - /// / path-absolute - /// / path-rootless - /// / path-empty - /// - /// relative-part = "//" authority path-abempty - /// / path-absolute - /// / path-noscheme - /// / path-empty - /// - /// path-abempty = *( "/" segment ) - /// path-absolute = "/" [ segment-nz *( "/" segment ) ] - /// path-noscheme = segment-nz-nc *( "/" segment ) - /// path-rootless = segment-nz *( "/" segment ) - /// path-empty = 0 - /// - /// segment = *pchar - /// segment-nz = 1*pchar - /// segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) - /// ; non-zero-length segment without any colon ":" - /// - /// pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - if (*uri == wxT('/')) - { - m_path += *uri++; - - while(*uri && *uri != wxT('#') && *uri != wxT('?')) - { - if( IsUnreserved(*uri) || IsSubDelim(*uri) || - *uri == wxT(':') || *uri == wxT('@') || *uri == wxT('/')) - m_path += *uri++; - else if (IsEscape(uri)) - { - m_path += *uri++; - m_path += *uri++; - m_path += *uri++; - } - else - Escape(m_path, *uri++); - } - - if (bNormalize) - { - wxStringBufferLength theBuffer(m_path, m_path.length() + 1); -#if wxUSE_STL - wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1); -#endif - Normalize(theBuffer, true); - theBuffer.SetLength(wxStrlen(theBuffer)); - } - //mark the path as valid - m_fields |= wxURI_PATH; - } - else if(*uri) //Relative path - { - if (bReference) - { - //no colon allowed - while(*uri && *uri != wxT('#') && *uri != wxT('?')) - { - if(IsUnreserved(*uri) || IsSubDelim(*uri) || - *uri == wxT('@') || *uri == wxT('/')) - m_path += *uri++; - else if (IsEscape(uri)) - { - m_path += *uri++; - m_path += *uri++; - m_path += *uri++; - } - else - Escape(m_path, *uri++); - } - } - else - { - while(*uri && *uri != wxT('#') && *uri != wxT('?')) - { - if(IsUnreserved(*uri) || IsSubDelim(*uri) || - *uri == wxT(':') || *uri == wxT('@') || *uri == wxT('/')) - m_path += *uri++; - else if (IsEscape(uri)) - { - m_path += *uri++; - m_path += *uri++; - m_path += *uri++; - } - else - Escape(m_path, *uri++); - } - } - - if (uri != uricopy) - { - if (bNormalize) - { - wxStringBufferLength theBuffer(m_path, m_path.length() + 1); -#if wxUSE_STL - wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1); -#endif - Normalize(theBuffer); - theBuffer.SetLength(wxStrlen(theBuffer)); - } - - //mark the path as valid - m_fields |= wxURI_PATH; - } - } - - return uri; -} - - -const wxChar* wxURI::ParseQuery(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - // query = *( pchar / "/" / "?" ) - if (*uri == wxT('?')) - { - ++uri; - while(*uri && *uri != wxT('#')) - { - if (IsUnreserved(*uri) || IsSubDelim(*uri) || - *uri == wxT(':') || *uri == wxT('@') || *uri == wxT('/') || *uri == wxT('?')) - m_query += *uri++; - else if (IsEscape(uri)) - { - m_query += *uri++; - m_query += *uri++; - m_query += *uri++; - } - else - Escape(m_query, *uri++); - } - - //mark the server as valid - m_fields |= wxURI_QUERY; - } - - return uri; -} - - -const wxChar* wxURI::ParseFragment(const wxChar* uri) -{ - wxASSERT(uri != NULL); - - // fragment = *( pchar / "/" / "?" ) - if (*uri == wxT('#')) - { - ++uri; - while(*uri) - { - if (IsUnreserved(*uri) || IsSubDelim(*uri) || - *uri == wxT(':') || *uri == wxT('@') || *uri == wxT('/') || *uri == wxT('?')) - m_fragment += *uri++; - else if (IsEscape(uri)) - { - m_fragment += *uri++; - m_fragment += *uri++; - m_fragment += *uri++; - } - else - Escape(m_fragment, *uri++); - } - - //mark the server as valid - m_fields |= wxURI_FRAGMENT; - } - - return uri; -} - -// --------------------------------------------------------------------------- -// Resolve -// -// Builds missing components of this uri from a base uri -// -// A version of the algorithm outlined in the RFC is used here -// (it is shown in comments) -// -// Note that an empty URI inherits all components -// --------------------------------------------------------------------------- - -void wxURI::Resolve(const wxURI& base, int flags) -{ - wxASSERT_MSG(!base.IsReference(), - wxT("wxURI to inherit from must not be a reference!")); - - // If we arn't being strict, enable the older (pre-RFC2396) - // loophole that allows this uri to inherit other - // properties from the base uri - even if the scheme - // is defined - if ( !(flags & wxURI_STRICT) && - HasScheme() && base.HasScheme() && - m_scheme == base.m_scheme ) - { - m_fields -= wxURI_SCHEME; - } - - - // Do nothing if this is an absolute wxURI - // if defined(R.scheme) then - // T.scheme = R.scheme; - // T.authority = R.authority; - // T.path = remove_dot_segments(R.path); - // T.query = R.query; - if (HasScheme()) - { - return; - } - - //No scheme - inherit - m_scheme = base.m_scheme; - m_fields |= wxURI_SCHEME; - - // All we need to do for relative URIs with an - // authority component is just inherit the scheme - // if defined(R.authority) then - // T.authority = R.authority; - // T.path = remove_dot_segments(R.path); - // T.query = R.query; - if (HasServer()) - { - return; - } - - //No authority - inherit - if (base.HasUserInfo()) - { - m_userinfo = base.m_userinfo; - m_fields |= wxURI_USERINFO; - } - - m_server = base.m_server; - m_hostType = base.m_hostType; - m_fields |= wxURI_SERVER; - - if (base.HasPort()) - { - m_port = base.m_port; - m_fields |= wxURI_PORT; - } - - - // Simple path inheritance from base - if (!HasPath()) - { - // T.path = Base.path; - m_path = base.m_path; - m_fields |= wxURI_PATH; - - - // if defined(R.query) then - // T.query = R.query; - // else - // T.query = Base.query; - // endif; - if (!HasQuery()) - { - m_query = base.m_query; - m_fields |= wxURI_QUERY; - } - } - else - { - // if (R.path starts-with "/") then - // T.path = remove_dot_segments(R.path); - // else - // T.path = merge(Base.path, R.path); - // T.path = remove_dot_segments(T.path); - // endif; - // T.query = R.query; - if (m_path.empty() || m_path[0u] != wxT('/')) - { - //Merge paths - const wxChar* op = m_path.c_str(); - const wxChar* bp = base.m_path.c_str() + base.m_path.Length(); - - //not a ending directory? move up - if (base.m_path[0] && *(bp-1) != wxT('/')) - UpTree(base.m_path, bp); - - //normalize directories - while(*op == wxT('.') && *(op+1) == wxT('.') && - (*(op+2) == '\0' || *(op+2) == wxT('/')) ) - { - UpTree(base.m_path, bp); - - if (*(op+2) == '\0') - op += 2; - else - op += 3; - } - - m_path = base.m_path.substr(0, bp - base.m_path.c_str()) + - m_path.substr((op - m_path.c_str()), m_path.Length()); - } - } - - //T.fragment = R.fragment; -} - -// --------------------------------------------------------------------------- -// UpTree -// -// Moves a URI path up a directory -// --------------------------------------------------------------------------- - -//static -void wxURI::UpTree(const wxChar* uristart, const wxChar*& uri) -{ - if (uri != uristart && *(uri-1) == wxT('/')) - { - uri -= 2; - } - - for(;uri != uristart; --uri) - { - if (*uri == wxT('/')) - { - ++uri; - break; - } - } - - //!!!TODO:HACK!!!// - if (uri == uristart && *uri == wxT('/')) - ++uri; - //!!!// -} - -// --------------------------------------------------------------------------- -// Normalize -// -// Normalizes directories in-place -// -// I.E. ./ and . are ignored -// -// ../ and .. are removed if a directory is before it, along -// with that directory (leading .. and ../ are kept) -// --------------------------------------------------------------------------- - -//static -void wxURI::Normalize(wxChar* s, bool bIgnoreLeads) -{ - wxChar* cp = s; - wxChar* bp = s; - - if(s[0] == wxT('/')) - ++bp; - - while(*cp) - { - if (*cp == wxT('.') && (*(cp+1) == wxT('/') || *(cp+1) == '\0') - && (bp == cp || *(cp-1) == wxT('/'))) - { - //. _or_ ./ - ignore - if (*(cp+1) == '\0') - cp += 1; - else - cp += 2; - } - else if (*cp == wxT('.') && *(cp+1) == wxT('.') && - (*(cp+2) == wxT('/') || *(cp+2) == '\0') - && (bp == cp || *(cp-1) == wxT('/'))) - { - //.. _or_ ../ - go up the tree - if (s != bp) - { - UpTree((const wxChar*)bp, (const wxChar*&)s); - - if (*(cp+2) == '\0') - cp += 2; - else - cp += 3; - } - else if (!bIgnoreLeads) - - { - *bp++ = *cp++; - *bp++ = *cp++; - if (*cp) - *bp++ = *cp++; - - s = bp; - } - else - { - if (*(cp+2) == '\0') - cp += 2; - else - cp += 3; - } - } - else - *s++ = *cp++; - } - - *s = '\0'; -} - -// --------------------------------------------------------------------------- -// ParseH16 -// -// Parses 1 to 4 hex values. Returns true if the first character of the input -// string is a valid hex character. It is the caller's responsability to move -// the input string back to its original position on failure. -// --------------------------------------------------------------------------- - -bool wxURI::ParseH16(const wxChar*& uri) -{ - // h16 = 1*4HEXDIG - if(!IsHex(*++uri)) - return false; - - if(IsHex(*++uri) && IsHex(*++uri) && IsHex(*++uri)) - ++uri; - - return true; -} - -// --------------------------------------------------------------------------- -// ParseIPXXX -// -// Parses a certain version of an IP address and moves the input string past -// it. Returns true if the input string contains the proper version of an ip -// address. It is the caller's responsability to move the input string back -// to its original position on failure. -// --------------------------------------------------------------------------- - -bool wxURI::ParseIPv4address(const wxChar*& uri) -{ - //IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet - // - //dec-octet = DIGIT ; 0-9 - // / %x31-39 DIGIT ; 10-99 - // / "1" 2DIGIT ; 100-199 - // / "2" %x30-34 DIGIT ; 200-249 - // / "25" %x30-35 ; 250-255 - size_t iIPv4 = 0; - if (IsDigit(*uri)) - { - ++iIPv4; - - - //each ip part must be between 0-255 (dupe of version in for loop) - if( IsDigit(*++uri) && IsDigit(*++uri) && - //100 or less (note !) - !( (*(uri-2) < wxT('2')) || - //240 or less - (*(uri-2) == wxT('2') && - (*(uri-1) < wxT('5') || (*(uri-1) == wxT('5') && *uri <= wxT('5'))) - ) - ) - ) - { - return false; - } - - if(IsDigit(*uri))++uri; - - //compilers should unroll this loop - for(; iIPv4 < 4; ++iIPv4) - { - if (*uri != wxT('.') || !IsDigit(*++uri)) - break; - - //each ip part must be between 0-255 - if( IsDigit(*++uri) && IsDigit(*++uri) && - //100 or less (note !) - !( (*(uri-2) < wxT('2')) || - //240 or less - (*(uri-2) == wxT('2') && - (*(uri-1) < wxT('5') || (*(uri-1) == wxT('5') && *uri <= wxT('5'))) - ) - ) - ) - { - return false; - } - if(IsDigit(*uri))++uri; - } - } - return iIPv4 == 4; -} - -bool wxURI::ParseIPv6address(const wxChar*& uri) -{ - // IPv6address = 6( h16 ":" ) ls32 - // / "::" 5( h16 ":" ) ls32 - // / [ h16 ] "::" 4( h16 ":" ) ls32 - // / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - // / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - // / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - // / [ *4( h16 ":" ) h16 ] "::" ls32 - // / [ *5( h16 ":" ) h16 ] "::" h16 - // / [ *6( h16 ":" ) h16 ] "::" - - size_t numPrefix = 0, - maxPostfix; - - bool bEndHex = false; - - for( ; numPrefix < 6; ++numPrefix) - { - if(!ParseH16(uri)) - { - --uri; - bEndHex = true; - break; - } - - if(*uri != wxT(':')) - { - break; - } - } - - if(!bEndHex && !ParseH16(uri)) - { - --uri; - - if (numPrefix) - return false; - - if (*uri == wxT(':')) - { - if (*++uri != wxT(':')) - return false; - - maxPostfix = 5; - } - else - maxPostfix = 6; - } - else - { - if (*uri != wxT(':') || *(uri+1) != wxT(':')) - { - if (numPrefix != 6) - return false; - - while (*--uri != wxT(':')) {} - ++uri; - - const wxChar* uristart = uri; - //parse ls32 - // ls32 = ( h16 ":" h16 ) / IPv4address - if (ParseH16(uri) && *uri == wxT(':') && ParseH16(uri)) - return true; - - uri = uristart; - - if (ParseIPv4address(uri)) - return true; - else - return false; - } - else - { - uri += 2; - - if (numPrefix > 3) - maxPostfix = 0; - else - maxPostfix = 4 - numPrefix; - } - } - - bool bAllowAltEnding = maxPostfix == 0; - - for(; maxPostfix != 0; --maxPostfix) - { - if(!ParseH16(uri) || *uri != wxT(':')) - return false; - } - - if(numPrefix <= 4) - { - const wxChar* uristart = uri; - //parse ls32 - // ls32 = ( h16 ":" h16 ) / IPv4address - if (ParseH16(uri) && *uri == wxT(':') && ParseH16(uri)) - return true; - - uri = uristart; - - if (ParseIPv4address(uri)) - return true; - - uri = uristart; - - if (!bAllowAltEnding) - return false; - } - - if(numPrefix <= 5 && ParseH16(uri)) - return true; - - return true; -} - -bool wxURI::ParseIPvFuture(const wxChar*& uri) -{ - // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) - if (*++uri != wxT('v') || !IsHex(*++uri)) - return false; - - while (IsHex(*++uri)) {} - - if (*uri != wxT('.') || !(IsUnreserved(*++uri) || IsSubDelim(*uri) || *uri == wxT(':'))) - return false; - - while(IsUnreserved(*++uri) || IsSubDelim(*uri) || *uri == wxT(':')) {} - - return true; -} - - -// --------------------------------------------------------------------------- -// CharToHex -// -// Converts a character into a numeric hexidecimal value, or 0 if the -// passed in character is not a valid hex character -// --------------------------------------------------------------------------- - -//static -wxChar wxURI::CharToHex(const wxChar& c) -{ - if ((c >= wxT('A')) && (c <= wxT('Z'))) return wxChar(c - wxT('A') + 0x0A); - if ((c >= wxT('a')) && (c <= wxT('z'))) return wxChar(c - wxT('a') + 0x0a); - if ((c >= wxT('0')) && (c <= wxT('9'))) return wxChar(c - wxT('0') + 0x00); - - return 0; -} - -// --------------------------------------------------------------------------- -// IsXXX -// -// Returns true if the passed in character meets the criteria of the method -// --------------------------------------------------------------------------- - -//! unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" -bool wxURI::IsUnreserved (const wxChar& c) -{ return IsAlpha(c) || IsDigit(c) || - c == wxT('-') || - c == wxT('.') || - c == wxT('_') || - c == wxT('~') //tilde - ; -} - -bool wxURI::IsReserved (const wxChar& c) -{ - return IsGenDelim(c) || IsSubDelim(c); -} - -//! gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" -bool wxURI::IsGenDelim (const wxChar& c) -{ - return c == wxT(':') || - c == wxT('/') || - c == wxT('?') || - c == wxT('#') || - c == wxT('[') || - c == wxT(']') || - c == wxT('@'); -} - -//! sub-delims = "!" / "$" / "&" / "'" / "(" / ")" -//! / "*" / "+" / "," / ";" / "=" -bool wxURI::IsSubDelim (const wxChar& c) -{ - return c == wxT('!') || - c == wxT('$') || - c == wxT('&') || - c == wxT('\'') || - c == wxT('(') || - c == wxT(')') || - c == wxT('*') || - c == wxT('+') || - c == wxT(',') || - c == wxT(';') || - c == wxT('=') - ; -} - -bool wxURI::IsHex(const wxChar& c) -{ return IsDigit(c) || (c >= wxT('a') && c <= wxT('f')) || (c >= wxT('A') && c <= wxT('F')); } - -bool wxURI::IsAlpha(const wxChar& c) -{ return (c >= wxT('a') && c <= wxT('z')) || (c >= wxT('A') && c <= wxT('Z')); } - -bool wxURI::IsDigit(const wxChar& c) -{ return c >= wxT('0') && c <= wxT('9'); } - - -//end of uri.cpp - - - diff --git a/Source/3rdParty/wx/src/common/utilscmn.cpp b/Source/3rdParty/wx/src/common/utilscmn.cpp deleted file mode 100644 index e2835b7d7..000000000 --- a/Source/3rdParty/wx/src/common/utilscmn.cpp +++ /dev/null @@ -1,1417 +0,0 @@ -// Name: src/common/utilscmn.cpp -// Purpose: Miscellaneous utility functions and classes -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: utilscmn.cpp 66917 2011-02-16 21:51:31Z JS $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/string.h" - #include "wx/utils.h" - #include "wx/intl.h" - #include "wx/log.h" - - #if wxUSE_GUI - #include "wx/window.h" - #include "wx/frame.h" - #include "wx/menu.h" - #include "wx/msgdlg.h" - #include "wx/textdlg.h" - #include "wx/textctrl.h" // for wxTE_PASSWORD - #if wxUSE_ACCEL - #include "wx/menuitem.h" - #include "wx/accel.h" - #endif // wxUSE_ACCEL - #endif // wxUSE_GUI -#endif // WX_PRECOMP - -#include "wx/apptrait.h" - -#include "wx/process.h" -#include "wx/txtstrm.h" -#include "wx/uri.h" -#include "wx/mimetype.h" -#include "wx/config.h" - -#if defined(__WXWINCE__) && wxUSE_DATETIME -#include "wx/datetime.h" -#endif - -#include -#include -#include -#include - -#if !wxONLY_WATCOM_EARLIER_THAN(1,4) - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif -#endif - -#if wxUSE_GUI - #include "wx/colordlg.h" - #include "wx/fontdlg.h" - #include "wx/notebook.h" - #include "wx/statusbr.h" -#endif // wxUSE_GUI - -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/wince/time.h" -#endif - -#ifdef __WXMAC__ -#include "wx/mac/private.h" -#ifndef __DARWIN__ -#include "InternetConfig.h" -#endif -#endif - -#if !defined(__MWERKS__) && !defined(__WXWINCE__) - #include - #include -#endif - -#if defined(__WXMSW__) - #include "wx/msw/private.h" - #include "wx/msw/registry.h" - #include // needed for SHELLEXECUTEINFO -#endif - -#if wxUSE_BASE - -// ---------------------------------------------------------------------------- -// common data -// ---------------------------------------------------------------------------- - -// ============================================================================ -// implementation -// ============================================================================ - -#if WXWIN_COMPATIBILITY_2_4 - -wxChar * -copystring (const wxChar *s) -{ - if (s == NULL) s = wxEmptyString; - size_t len = wxStrlen (s) + 1; - - wxChar *news = new wxChar[len]; - memcpy (news, s, len * sizeof(wxChar)); // Should be the fastest - - return news; -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// String <-> Number conversions (deprecated) -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 - -WXDLLIMPEXP_DATA_BASE(const wxChar *) wxFloatToStringStr = wxT("%.2f"); -WXDLLIMPEXP_DATA_BASE(const wxChar *) wxDoubleToStringStr = wxT("%.2f"); - -void -StringToFloat (const wxChar *s, float *number) -{ - if (s && *s && number) - *number = (float) wxStrtod (s, (wxChar **) NULL); -} - -void -StringToDouble (const wxChar *s, double *number) -{ - if (s && *s && number) - *number = wxStrtod (s, (wxChar **) NULL); -} - -wxChar * -FloatToString (float number, const wxChar *fmt) -{ - static wxChar buf[256]; - - wxSprintf (buf, fmt, number); - return buf; -} - -wxChar * -DoubleToString (double number, const wxChar *fmt) -{ - static wxChar buf[256]; - - wxSprintf (buf, fmt, number); - return buf; -} - -void -StringToInt (const wxChar *s, int *number) -{ - if (s && *s && number) - *number = (int) wxStrtol (s, (wxChar **) NULL, 10); -} - -void -StringToLong (const wxChar *s, long *number) -{ - if (s && *s && number) - *number = wxStrtol (s, (wxChar **) NULL, 10); -} - -wxChar * -IntToString (int number) -{ - static wxChar buf[20]; - - wxSprintf (buf, wxT("%d"), number); - return buf; -} - -wxChar * -LongToString (long number) -{ - static wxChar buf[20]; - - wxSprintf (buf, wxT("%ld"), number); - return buf; -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// Array used in DecToHex conversion routine. -static wxChar hexArray[] = wxT("0123456789ABCDEF"); - -// Convert 2-digit hex number to decimal -int wxHexToDec(const wxString& buf) -{ - int firstDigit, secondDigit; - - if (buf.GetChar(0) >= wxT('A')) - firstDigit = buf.GetChar(0) - wxT('A') + 10; - else - firstDigit = buf.GetChar(0) - wxT('0'); - - if (buf.GetChar(1) >= wxT('A')) - secondDigit = buf.GetChar(1) - wxT('A') + 10; - else - secondDigit = buf.GetChar(1) - wxT('0'); - - return (firstDigit & 0xF) * 16 + (secondDigit & 0xF ); -} - -// Convert decimal integer to 2-character hex string -void wxDecToHex(int dec, wxChar *buf) -{ - int firstDigit = (int)(dec/16.0); - int secondDigit = (int)(dec - (firstDigit*16.0)); - buf[0] = hexArray[firstDigit]; - buf[1] = hexArray[secondDigit]; - buf[2] = 0; -} - -// Convert decimal integer to 2-character hex string -wxString wxDecToHex(int dec) -{ - wxChar buf[3]; - wxDecToHex(dec, buf); - return wxString(buf); -} - -// ---------------------------------------------------------------------------- -// misc functions -// ---------------------------------------------------------------------------- - -// Return the current date/time -wxString wxNow() -{ -#ifdef __WXWINCE__ -#if wxUSE_DATETIME - wxDateTime now = wxDateTime::Now(); - return now.Format(); -#else - return wxEmptyString; -#endif -#else - time_t now = time((time_t *) NULL); - char *date = ctime(&now); - date[24] = '\0'; - return wxString::FromAscii(date); -#endif -} - -void wxUsleep(unsigned long milliseconds) -{ - wxMilliSleep(milliseconds); -} - -const wxChar *wxGetInstallPrefix() -{ - wxString prefix; - - if ( wxGetEnv(wxT("WXPREFIX"), &prefix) ) - return prefix.c_str(); - -#ifdef wxINSTALL_PREFIX - return wxT(wxINSTALL_PREFIX); -#else - return wxEmptyString; -#endif -} - -wxString wxGetDataDir() -{ - wxString dir = wxGetInstallPrefix(); - dir << wxFILE_SEP_PATH << wxT("share") << wxFILE_SEP_PATH << wxT("wx"); - return dir; -} - -bool wxIsPlatformLittleEndian() -{ - // Are we little or big endian? This method is from Harbison & Steele. - union - { - long l; - char c[sizeof(long)]; - } u; - u.l = 1; - - return u.c[0] == 1; -} - - -/* - * Class to make it easier to specify platform-dependent values - */ - -wxArrayInt* wxPlatform::sm_customPlatforms = NULL; - -void wxPlatform::Copy(const wxPlatform& platform) -{ - m_longValue = platform.m_longValue; - m_doubleValue = platform.m_doubleValue; - m_stringValue = platform.m_stringValue; -} - -wxPlatform wxPlatform::If(int platform, long value) -{ - if (Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform wxPlatform::IfNot(int platform, long value) -{ - if (!Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform& wxPlatform::ElseIf(int platform, long value) -{ - if (Is(platform)) - m_longValue = value; - return *this; -} - -wxPlatform& wxPlatform::ElseIfNot(int platform, long value) -{ - if (!Is(platform)) - m_longValue = value; - return *this; -} - -wxPlatform wxPlatform::If(int platform, double value) -{ - if (Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform wxPlatform::IfNot(int platform, double value) -{ - if (!Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform& wxPlatform::ElseIf(int platform, double value) -{ - if (Is(platform)) - m_doubleValue = value; - return *this; -} - -wxPlatform& wxPlatform::ElseIfNot(int platform, double value) -{ - if (!Is(platform)) - m_doubleValue = value; - return *this; -} - -wxPlatform wxPlatform::If(int platform, const wxString& value) -{ - if (Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform wxPlatform::IfNot(int platform, const wxString& value) -{ - if (!Is(platform)) - return wxPlatform(value); - else - return wxPlatform(); -} - -wxPlatform& wxPlatform::ElseIf(int platform, const wxString& value) -{ - if (Is(platform)) - m_stringValue = value; - return *this; -} - -wxPlatform& wxPlatform::ElseIfNot(int platform, const wxString& value) -{ - if (!Is(platform)) - m_stringValue = value; - return *this; -} - -wxPlatform& wxPlatform::Else(long value) -{ - m_longValue = value; - return *this; -} - -wxPlatform& wxPlatform::Else(double value) -{ - m_doubleValue = value; - return *this; -} - -wxPlatform& wxPlatform::Else(const wxString& value) -{ - m_stringValue = value; - return *this; -} - -void wxPlatform::AddPlatform(int platform) -{ - if (!sm_customPlatforms) - sm_customPlatforms = new wxArrayInt; - sm_customPlatforms->Add(platform); -} - -void wxPlatform::ClearPlatforms() -{ - delete sm_customPlatforms; - sm_customPlatforms = NULL; -} - -/// Function for testing current platform - -bool wxPlatform::Is(int platform) -{ -#ifdef __WXMSW__ - if (platform == wxOS_WINDOWS) - return true; -#endif -#ifdef __WXWINCE__ - if (platform == wxOS_WINDOWS_CE) - return true; -#endif - -#if 0 - -// FIXME: wxWinPocketPC and wxWinSmartPhone are unknown symbols - -#if defined(__WXWINCE__) && defined(__POCKETPC__) - if (platform == wxWinPocketPC) - return true; -#endif -#if defined(__WXWINCE__) && defined(__SMARTPHONE__) - if (platform == wxWinSmartPhone) - return true; -#endif - -#endif - -#ifdef __WXGTK__ - if (platform == wxPORT_GTK) - return true; -#endif -#ifdef __WXMAC__ - if (platform == wxPORT_MAC) - return true; -#endif -#ifdef __WXX11__ - if (platform == wxPORT_X11) - return true; -#endif -#ifdef __UNIX__ - if (platform == wxOS_UNIX) - return true; -#endif -#ifdef __WXMGL__ - if (platform == wxPORT_MGL) - return true; -#endif -#ifdef __OS2__ - if (platform == wxOS_OS2) - return true; -#endif -#ifdef __WXPM__ - if (platform == wxPORT_PM) - return true; -#endif -#ifdef __WXCOCOA__ - if (platform == wxPORT_MAC) - return true; -#endif - - if (sm_customPlatforms && sm_customPlatforms->Index(platform) != wxNOT_FOUND) - return true; - - return false; -} - -// ---------------------------------------------------------------------------- -// network and user id functions -// ---------------------------------------------------------------------------- - -// Get Full RFC822 style email address -bool wxGetEmailAddress(wxChar *address, int maxSize) -{ - wxString email = wxGetEmailAddress(); - if ( !email ) - return false; - - wxStrncpy(address, email, maxSize - 1); - address[maxSize - 1] = wxT('\0'); - - return true; -} - -wxString wxGetEmailAddress() -{ - wxString email; - - wxString host = wxGetFullHostName(); - if ( !host.empty() ) - { - wxString user = wxGetUserId(); - if ( !user.empty() ) - { - email << user << wxT('@') << host; - } - } - - return email; -} - -wxString wxGetUserId() -{ - static const int maxLoginLen = 256; // FIXME arbitrary number - - wxString buf; - bool ok = wxGetUserId(wxStringBuffer(buf, maxLoginLen), maxLoginLen); - - if ( !ok ) - buf.Empty(); - - return buf; -} - -wxString wxGetUserName() -{ - static const int maxUserNameLen = 1024; // FIXME arbitrary number - - wxString buf; - bool ok = wxGetUserName(wxStringBuffer(buf, maxUserNameLen), maxUserNameLen); - - if ( !ok ) - buf.Empty(); - - return buf; -} - -wxString wxGetHostName() -{ - static const size_t hostnameSize = 257; - - wxString buf; - bool ok = wxGetHostName(wxStringBuffer(buf, hostnameSize), hostnameSize); - - if ( !ok ) - buf.Empty(); - - return buf; -} - -wxString wxGetFullHostName() -{ - static const size_t hostnameSize = 257; - - wxString buf; - bool ok = wxGetFullHostName(wxStringBuffer(buf, hostnameSize), hostnameSize); - - if ( !ok ) - buf.Empty(); - - return buf; -} - -wxString wxGetHomeDir() -{ - wxString home; - wxGetHomeDir(&home); - - return home; -} - -#if 0 - -wxString wxGetCurrentDir() -{ - wxString dir; - size_t len = 1024; - bool ok; - do - { - ok = getcwd(dir.GetWriteBuf(len + 1), len) != NULL; - dir.UngetWriteBuf(); - - if ( !ok ) - { - if ( errno != ERANGE ) - { - wxLogSysError(_T("Failed to get current directory")); - - return wxEmptyString; - } - else - { - // buffer was too small, retry with a larger one - len *= 2; - } - } - //else: ok - } while ( !ok ); - - return dir; -} - -#endif // 0 - -// ---------------------------------------------------------------------------- -// wxExecute -// ---------------------------------------------------------------------------- - -// wxDoExecuteWithCapture() helper: reads an entire stream into one array -// -// returns true if ok, false if error -#if wxUSE_STREAMS -static bool ReadAll(wxInputStream *is, wxArrayString& output) -{ - wxCHECK_MSG( is, false, _T("NULL stream in wxExecute()?") ); - - // the stream could be already at EOF or in wxSTREAM_BROKEN_PIPE state - is->Reset(); - - wxTextInputStream tis(*is); - - for ( ;; ) - { - wxString line = tis.ReadLine(); - - // check for EOF before other errors as it's not really an error - if ( is->Eof() ) - { - // add the last, possibly incomplete, line - if ( !line.empty() ) - output.Add(line); - break; - } - - // any other error is fatal - if ( !*is ) - return false; - - output.Add(line); - } - - return true; -} -#endif // wxUSE_STREAMS - -// this is a private function because it hasn't a clean interface: the first -// array is passed by reference, the second by pointer - instead we have 2 -// public versions of wxExecute() below -static long wxDoExecuteWithCapture(const wxString& command, - wxArrayString& output, - wxArrayString* error, - int flags) -{ - // create a wxProcess which will capture the output - wxProcess *process = new wxProcess; - process->Redirect(); - - long rc = wxExecute(command, wxEXEC_SYNC | flags, process); - -#if wxUSE_STREAMS - if ( rc != -1 ) - { - if ( !ReadAll(process->GetInputStream(), output) ) - rc = -1; - - if ( error ) - { - if ( !ReadAll(process->GetErrorStream(), *error) ) - rc = -1; - } - - } -#else - wxUnusedVar(output); - wxUnusedVar(error); -#endif // wxUSE_STREAMS/!wxUSE_STREAMS - - delete process; - - return rc; -} - -long wxExecute(const wxString& command, wxArrayString& output, int flags) -{ - return wxDoExecuteWithCapture(command, output, NULL, flags); -} - -long wxExecute(const wxString& command, - wxArrayString& output, - wxArrayString& error, - int flags) -{ - return wxDoExecuteWithCapture(command, output, &error, flags); -} - -// ---------------------------------------------------------------------------- -// Launch default browser -// ---------------------------------------------------------------------------- - -#include "wx/private/browserhack28.h" - -static bool wxLaunchDefaultBrowserBaseImpl(const wxString& url, int flags); - -// Use wxLaunchDefaultBrowserBaseImpl by default -static wxLaunchDefaultBrowserImpl_t s_launchBrowserImpl = &wxLaunchDefaultBrowserBaseImpl; - -// Function the GUI library can call to provide a better implementation -WXDLLIMPEXP_BASE void wxSetLaunchDefaultBrowserImpl(wxLaunchDefaultBrowserImpl_t newImpl) -{ - s_launchBrowserImpl = newImpl!=NULL ? newImpl : &wxLaunchDefaultBrowserBaseImpl; -} - -static bool wxLaunchDefaultBrowserBaseImpl(const wxString& url, int flags) -{ - wxUnusedVar(flags); - -#if defined(__WXMSW__) - -#if wxUSE_IPC - if ( flags & wxBROWSER_NEW_WINDOW ) - { - // ShellExecuteEx() opens the URL in an existing window by default so - // we can't use it if we need a new window - wxURI uri(url); - wxRegKey key(wxRegKey::HKCR, uri.GetScheme() + _T("\\shell\\open")); - if ( !key.Exists() ) - { - // try default browser, it must be registered at least for http URLs - key.SetName(wxRegKey::HKCR, _T("http\\shell\\open")); - } - - if ( key.Exists() ) - { - wxRegKey keyDDE(key, wxT("DDEExec")); - if ( keyDDE.Exists() ) - { - // we only know the syntax of WWW_OpenURL DDE request for IE, - // optimistically assume that all other browsers are compatible - // with it - static const wxString TOPIC_OPEN_URL = wxT("WWW_OpenURL"); - wxString ddeCmd; - wxRegKey keyTopic(keyDDE, wxT("topic")); - bool ok = keyTopic.Exists() && (keyTopic.QueryDefaultValue() = TOPIC_OPEN_URL); - if ( ok ) - { - ddeCmd = keyDDE.QueryDefaultValue(); - ok = !ddeCmd.empty(); - } - - if ( ok ) - { - // for WWW_OpenURL, the index of the window to open the URL - // in is -1 (meaning "current") by default, replace it with - // 0 which means "new" (see KB article 160957) - ok = ddeCmd.Replace(wxT("-1"), wxT("0"), - false /* only first occurence */) == 1; - } - - if ( ok ) - { - // and also replace the parameters: the topic should - // contain a placeholder for the URL - ok = ddeCmd.Replace(wxT("%1"), url, false) == 1; - } - - if ( ok ) - { - // try to send it the DDE request now but ignore the errors - wxLogNull noLog; - - const wxString ddeServer = wxRegKey(keyDDE, wxT("application")).QueryDefaultValue(); - if ( wxExecuteDDE(ddeServer, TOPIC_OPEN_URL, ddeCmd) ) - return true; - - // this is not necessarily an error: maybe browser is - // simply not running, but no matter, in any case we're - // going to launch it using ShellExecuteEx() below now and - // we shouldn't try to open a new window if we open a new - // browser anyhow - } - } - } - } -#endif // wxUSE_IPC - - WinStruct sei; - sei.lpFile = url.c_str(); - sei.lpVerb = _T("open"); - sei.nShow = SW_SHOWNORMAL; - sei.fMask = SEE_MASK_FLAG_NO_UI; // we give error message ourselves - - BOOL nExecResult = ::ShellExecuteEx(&sei); - - //From MSDN for wince - //hInstApp member is only valid if the function fails, in which case it - //receives one of the following error values, which are less than or - //equal to 32. - const int nResult = (int) sei.hInstApp; - - // Firefox returns file not found for some reason, so make an exception - // for it - if ( nResult > 32 || nResult == SE_ERR_FNF || nExecResult == TRUE ) - { -#ifdef __WXDEBUG__ - // Log something if SE_ERR_FNF happens - if ( nResult == SE_ERR_FNF || nExecResult == FALSE ) - wxLogDebug(wxT("SE_ERR_FNF from ShellExecute -- maybe FireFox?")); -#endif // __WXDEBUG__ - return true; - } -#elif defined(__WXMAC__) - OSStatus err; - ICInstance inst; - long int startSel; - long int endSel; - - err = ICStart(&inst, 'STKA'); // put your app creator code here - if (err == noErr) - { -#if !TARGET_CARBON - err = ICFindConfigFile(inst, 0, NULL); -#endif - if (err == noErr) - { - ConstStr255Param hint = 0; - startSel = 0; - endSel = url.length(); - err = ICLaunchURL(inst, hint, url.fn_str(), endSel, &startSel, &endSel); - if (err != noErr) - wxLogDebug(wxT("ICLaunchURL error %d"), (int) err); - } - ICStop(inst); - return true; - } - else - { - wxLogDebug(wxT("ICStart error %d"), (int) err); - return false; - } -#else - // (non-Mac, non-MSW) - -#ifdef __UNIX__ - - // Our best best is to use xdg-open from freedesktop.org cross-desktop - // compatibility suite xdg-utils - // (see http://portland.freedesktop.org/wiki/) -- this is installed on - // most modern distributions and may be tweaked by them to handle - // distribution specifics. Only if that fails, try to find the right - // browser ourselves. - wxString path, xdg_open; - if ( wxGetEnv(_T("PATH"), &path) && - wxFindFileInPath(&xdg_open, path, _T("xdg-open")) ) - { - if ( wxExecute(xdg_open + _T(" ") + url) ) - return true; - } - - wxString desktop = wxTheApp->GetTraits()->GetDesktopEnvironment(); - - // GNOME and KDE desktops have some applications which should be always installed - // together with their main parts, which give us the - if (desktop == wxT("GNOME")) - { - wxArrayString errors; - wxArrayString output; - - // gconf will tell us the path of the application to use as browser - long res = wxExecute( wxT("gconftool-2 --get /desktop/gnome/applications/browser/exec"), - output, errors, wxEXEC_NODISABLE ); - if (res >= 0 && errors.GetCount() == 0) - { - wxString cmd = output[0]; - cmd << _T(' ') << url; - if (wxExecute(cmd)) - return true; - } - } - else if (desktop == wxT("KDE")) - { - // kfmclient directly opens the given URL - if (wxExecute(wxT("kfmclient openURL ") + url)) - return true; - } -#endif - - bool ok = false; - wxString cmd; - -#if wxUSE_MIMETYPE - wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html")); - if ( ft ) - { - wxString mt; - ft->GetMimeType(&mt); - - ok = ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(url)); - delete ft; - } -#endif // wxUSE_MIMETYPE - - if ( !ok || cmd.empty() ) - { - // fallback to checking for the BROWSER environment variable - cmd = wxGetenv(wxT("BROWSER")); - if ( !cmd.empty() ) - cmd << _T(' ') << url; - } - - ok = ( !cmd.empty() && wxExecute(cmd) ); - if (ok) - return ok; - - // no file type for HTML extension - wxLogError(_T("No default application configured for HTML files.")); - -#endif // !wxUSE_MIMETYPE && !__WXMSW__ - return false; -} - -bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags) -{ - // set the scheme of url to http if it does not have one - // RR: This doesn't work if the url is just a local path - wxString url(urlOrig); - wxURI uri(url); - if ( !uri.HasScheme() ) - { - if (wxFileExists(urlOrig)) - url.Prepend( wxT("file://") ); - else - url.Prepend(wxT("http://")); - } - - if(s_launchBrowserImpl(url, flags)) - return true; - - wxLogSysError(_T("Failed to open URL \"%s\" in default browser."), - url.c_str()); - - return false; -} - -// ---------------------------------------------------------------------------- -// wxApp::Yield() wrappers for backwards compatibility -// ---------------------------------------------------------------------------- - -bool wxYield() -{ - return wxTheApp && wxTheApp->Yield(); -} - -bool wxYieldIfNeeded() -{ - return wxTheApp && wxTheApp->Yield(true); -} - -#endif // wxUSE_BASE - -// ============================================================================ -// GUI-only functions from now on -// ============================================================================ - -#if wxUSE_GUI - -// Id generation -static long wxCurrentId = 100; - -long wxNewId() -{ - // skip the part of IDs space that contains hard-coded values: - if (wxCurrentId == wxID_LOWEST) - wxCurrentId = wxID_HIGHEST + 1; - - return wxCurrentId++; -} - -long -wxGetCurrentId(void) { return wxCurrentId; } - -void -wxRegisterId (long id) -{ - if (id >= wxCurrentId) - wxCurrentId = id + 1; -} - -// ---------------------------------------------------------------------------- -// Menu accelerators related functions -// ---------------------------------------------------------------------------- - -wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out) -{ -#if wxUSE_MENUS - wxString s = wxMenuItem::GetLabelFromText(in); -#else - wxString str(in); - wxString s = wxStripMenuCodes(str); -#endif // wxUSE_MENUS - if ( out ) - { - // go smash their buffer if it's not big enough - I love char * params - memcpy(out, s.c_str(), s.length() * sizeof(wxChar)); - } - else - { - // MYcopystring - for easier search... - out = new wxChar[s.length() + 1]; - wxStrcpy(out, s.c_str()); - } - - return out; -} - -wxString wxStripMenuCodes(const wxString& in, int flags) -{ - wxASSERT_MSG( flags, _T("this is useless to call without any flags") ); - - wxString out; - - size_t len = in.length(); - out.reserve(len); - - for ( size_t n = 0; n < len; n++ ) - { - wxChar ch = in[n]; - if ( (flags & wxStrip_Mnemonics) && ch == _T('&') ) - { - // skip it, it is used to introduce the accel char (or to quote - // itself in which case it should still be skipped): note that it - // can't be the last character of the string - if ( ++n == len ) - { - wxLogDebug(_T("Invalid menu string '%s'"), in.c_str()); - } - else - { - // use the next char instead - ch = in[n]; - } - } - else if ( (flags & wxStrip_Accel) && ch == _T('\t') ) - { - // everything after TAB is accel string, exit the loop - break; - } - - out += ch; - } - - return out; -} - -// ---------------------------------------------------------------------------- -// Window search functions -// ---------------------------------------------------------------------------- - -/* - * If parent is non-NULL, look through children for a label or title - * matching the specified string. If NULL, look through all top-level windows. - * - */ - -wxWindow * -wxFindWindowByLabel (const wxString& title, wxWindow * parent) -{ - return wxWindow::FindWindowByLabel( title, parent ); -} - - -/* - * If parent is non-NULL, look through children for a name - * matching the specified string. If NULL, look through all top-level windows. - * - */ - -wxWindow * -wxFindWindowByName (const wxString& name, wxWindow * parent) -{ - return wxWindow::FindWindowByName( name, parent ); -} - -// Returns menu item id or wxNOT_FOUND if none. -int -wxFindMenuItemId (wxFrame * frame, const wxString& menuString, const wxString& itemString) -{ -#if wxUSE_MENUS - wxMenuBar *menuBar = frame->GetMenuBar (); - if ( menuBar ) - return menuBar->FindMenuItem (menuString, itemString); -#endif // wxUSE_MENUS - - return wxNOT_FOUND; -} - -// Try to find the deepest child that contains 'pt'. -// We go backwards, to try to allow for controls that are spacially -// within other controls, but are still siblings (e.g. buttons within -// static boxes). Static boxes are likely to be created _before_ controls -// that sit inside them. -wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt) -{ - if (!win->IsShown()) - return NULL; - - // Hack for wxNotebook case: at least in wxGTK, all pages - // claim to be shown, so we must only deal with the selected one. -#if wxUSE_NOTEBOOK - if (win->IsKindOf(CLASSINFO(wxNotebook))) - { - wxNotebook* nb = (wxNotebook*) win; - int sel = nb->GetSelection(); - if (sel >= 0) - { - wxWindow* child = nb->GetPage(sel); - wxWindow* foundWin = wxFindWindowAtPoint(child, pt); - if (foundWin) - return foundWin; - } - } -#endif - - wxWindowList::compatibility_iterator node = win->GetChildren().GetLast(); - while (node) - { - wxWindow* child = node->GetData(); - wxWindow* foundWin = wxFindWindowAtPoint(child, pt); - if (foundWin) - return foundWin; - node = node->GetPrevious(); - } - - wxPoint pos = win->GetPosition(); - wxSize sz = win->GetSize(); - if ( !win->IsTopLevel() && win->GetParent() ) - { - pos = win->GetParent()->ClientToScreen(pos); - } - - wxRect rect(pos, sz); - if (rect.Contains(pt)) - return win; - - return NULL; -} - -wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt) -{ - // Go backwards through the list since windows - // on top are likely to have been appended most - // recently. - wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetLast(); - while (node) - { - wxWindow* win = node->GetData(); - wxWindow* found = wxFindWindowAtPoint(win, pt); - if (found) - return found; - node = node->GetPrevious(); - } - return NULL; -} - -// ---------------------------------------------------------------------------- -// GUI helpers -// ---------------------------------------------------------------------------- - -/* - * N.B. these convenience functions must be separate from msgdlgg.cpp, textdlgg.cpp - * since otherwise the generic code may be pulled in unnecessarily. - */ - -#if wxUSE_MSGDLG - -int wxMessageBox(const wxString& message, const wxString& caption, long style, - wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) ) -{ - long decorated_style = style; - - if ( ( style & ( wxICON_EXCLAMATION | wxICON_HAND | wxICON_INFORMATION | wxICON_QUESTION ) ) == 0 ) - { - decorated_style |= ( style & wxYES ) ? wxICON_QUESTION : wxICON_INFORMATION ; - } - - wxMessageDialog dialog(parent, message, caption, decorated_style); - - int ans = dialog.ShowModal(); - switch ( ans ) - { - case wxID_OK: - return wxOK; - case wxID_YES: - return wxYES; - case wxID_NO: - return wxNO; - case wxID_CANCEL: - return wxCANCEL; - } - - wxFAIL_MSG( _T("unexpected return code from wxMessageDialog") ); - - return wxCANCEL; -} - -#endif // wxUSE_MSGDLG - -#if wxUSE_TEXTDLG - -wxString wxGetTextFromUser(const wxString& message, const wxString& caption, - const wxString& defaultValue, wxWindow *parent, - wxCoord x, wxCoord y, bool centre ) -{ - wxString str; - long style = wxTextEntryDialogStyle; - - if (centre) - style |= wxCENTRE; - else - style &= ~wxCENTRE; - - wxTextEntryDialog dialog(parent, message, caption, defaultValue, style, wxPoint(x, y)); - - if (dialog.ShowModal() == wxID_OK) - { - str = dialog.GetValue(); - } - - return str; -} - -wxString wxGetPasswordFromUser(const wxString& message, - const wxString& caption, - const wxString& defaultValue, - wxWindow *parent, - wxCoord x, wxCoord y, bool centre ) -{ - wxString str; - long style = wxTextEntryDialogStyle; - - if (centre) - style |= wxCENTRE; - else - style &= ~wxCENTRE; - - wxPasswordEntryDialog dialog(parent, message, caption, defaultValue, - style, wxPoint(x, y)); - if ( dialog.ShowModal() == wxID_OK ) - { - str = dialog.GetValue(); - } - - return str; -} - -#endif // wxUSE_TEXTDLG - -#if wxUSE_COLOURDLG - -wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit, const wxString& caption) -{ - static wxColourData data; - data.SetChooseFull(true); - if ( colInit.Ok() ) - { - data.SetColour((wxColour &)colInit); // const_cast - } - - wxColour colRet; - wxColourDialog dialog(parent, &data); - if (!caption.empty()) - dialog.SetTitle(caption); - if ( dialog.ShowModal() == wxID_OK ) - { - colRet = dialog.GetColourData().GetColour(); - } - //else: leave it invalid - - return colRet; -} - -#endif // wxUSE_COLOURDLG - -#if wxUSE_FONTDLG - -wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit, const wxString& caption) -{ - wxFontData data; - if ( fontInit.Ok() ) - { - data.SetInitialFont(fontInit); - } - - wxFont fontRet; - wxFontDialog dialog(parent, data); - if (!caption.empty()) - dialog.SetTitle(caption); - if ( dialog.ShowModal() == wxID_OK ) - { - fontRet = dialog.GetFontData().GetChosenFont(); - } - //else: leave it invalid - - return fontRet; -} - -#endif // wxUSE_FONTDLG - -// ---------------------------------------------------------------------------- -// wxSafeYield and supporting functions -// ---------------------------------------------------------------------------- - -void wxEnableTopLevelWindows(bool enable) -{ - wxWindowList::compatibility_iterator node; - for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) - node->GetData()->Enable(enable); -} - -wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip) -{ - // remember the top level windows which were already disabled, so that we - // don't reenable them later - m_winDisabled = NULL; - - wxWindowList::compatibility_iterator node; - for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) - { - wxWindow *winTop = node->GetData(); - if ( winTop == winToSkip ) - continue; - - // we don't need to disable the hidden or already disabled windows - if ( winTop->IsEnabled() && winTop->IsShown() ) - { - winTop->Disable(); - } - else - { - if ( !m_winDisabled ) - { - m_winDisabled = new wxWindowList; - } - - m_winDisabled->Append(winTop); - } - } -} - -wxWindowDisabler::~wxWindowDisabler() -{ - wxWindowList::compatibility_iterator node; - for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) - { - wxWindow *winTop = node->GetData(); - if ( !m_winDisabled || !m_winDisabled->Find(winTop) ) - { - winTop->Enable(); - } - //else: had been already disabled, don't reenable - } - - delete m_winDisabled; -} - -// Yield to other apps/messages and disable user input to all windows except -// the given one -bool wxSafeYield(wxWindow *win, bool onlyIfNeeded) -{ - wxWindowDisabler wd(win); - - bool rc; - if (onlyIfNeeded) - rc = wxYieldIfNeeded(); - else - rc = wxYield(); - - return rc; -} - -// Don't synthesize KeyUp events holding down a key and producing KeyDown -// events with autorepeat. On by default and always on in wxMSW. wxGTK version -// in utilsgtk.cpp. -#ifndef __WXGTK__ -bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) -{ - return true; // detectable auto-repeat is the only mode MSW supports -} -#endif // !wxGTK - -#endif // wxUSE_GUI diff --git a/Source/3rdParty/wx/src/common/valgen.cpp b/Source/3rdParty/wx/src/common/valgen.cpp deleted file mode 100644 index b010537ce..000000000 --- a/Source/3rdParty/wx/src/common/valgen.cpp +++ /dev/null @@ -1,591 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/valgen.cpp -// Purpose: wxGenericValidator class -// Author: Kevin Smith -// Modified by: -// Created: Jan 22 1999 -// RCS-ID: $Id: valgen.cpp 39463 2006-05-29 21:26:35Z ABX $ -// Copyright: (c) 1999 Kevin Smith -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_VALIDATORS - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/utils.h" - #include "wx/intl.h" - #include "wx/choice.h" - #include "wx/combobox.h" - #include "wx/radiobox.h" - #include "wx/radiobut.h" - #include "wx/checkbox.h" - #include "wx/scrolbar.h" - #include "wx/gauge.h" - #include "wx/stattext.h" - #include "wx/textctrl.h" - #include "wx/button.h" - #include "wx/listbox.h" - #include "wx/slider.h" - #include "wx/checklst.h" -#endif - -#include "wx/spinctrl.h" - -#if wxUSE_SPINBTN - #include "wx/spinbutt.h" -#endif -#if wxUSE_TOGGLEBTN - #include "wx/tglbtn.h" -#endif - -#include "wx/valgen.h" - -IMPLEMENT_CLASS(wxGenericValidator, wxValidator) - -wxGenericValidator::wxGenericValidator(bool *val) -{ - Initialize(); - m_pBool = val; -} - -wxGenericValidator::wxGenericValidator(int *val) -{ - Initialize(); - m_pInt = val; -} - -wxGenericValidator::wxGenericValidator(wxString *val) -{ - Initialize(); - m_pString = val; -} - -wxGenericValidator::wxGenericValidator(wxArrayInt *val) -{ - Initialize(); - m_pArrayInt = val; -} - -wxGenericValidator::wxGenericValidator(const wxGenericValidator& val) - : wxValidator() -{ - Copy(val); -} - -bool wxGenericValidator::Copy(const wxGenericValidator& val) -{ - wxValidator::Copy(val); - - m_pBool = val.m_pBool; - m_pInt = val.m_pInt; - m_pString = val.m_pString; - m_pArrayInt = val.m_pArrayInt; - - return true; -} - -// Called to transfer data to the window -bool wxGenericValidator::TransferToWindow(void) -{ - if ( !m_validatorWindow ) - return false; - - // bool controls -#if wxUSE_CHECKBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) ) - { - wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow; - if (m_pBool) - { - pControl->SetValue(*m_pBool); - return true; - } - } else -#endif -#if wxUSE_RADIOBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) - { - wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow; - if (m_pBool) - { - pControl->SetValue(*m_pBool) ; - return true; - } - } else -#endif -#if wxUSE_TOGGLEBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) ) - { - wxToggleButton * pControl = (wxToggleButton *) m_validatorWindow; - if (m_pBool) - { - pControl->SetValue(*m_pBool); - return true; - } - } else -#endif - - // int controls -#if wxUSE_GAUGE - if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) - { - wxGauge* pControl = (wxGauge*) m_validatorWindow; - if (m_pInt) - { - pControl->SetValue(*m_pInt); - return true; - } - } else -#endif -#if wxUSE_RADIOBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) - { - wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow; - if (m_pInt) - { - pControl->SetSelection(*m_pInt) ; - return true; - } - } else -#endif -#if wxUSE_SCROLLBAR - if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) - { - wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow; - if (m_pInt) - { - pControl->SetThumbPosition(*m_pInt) ; - return true; - } - } else -#endif -#if wxUSE_SPINCTRL && !defined(__WXMOTIF__) - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) ) - { - wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow; - if (m_pInt) - { - pControl->SetValue(*m_pInt); - return true; - } - } else -#endif -#if wxUSE_SPINBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) - { - wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; - if (m_pInt) - { - pControl->SetValue(*m_pInt) ; - return true; - } - } else -#endif -#if wxUSE_SLIDER - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) ) - { - wxSlider* pControl = (wxSlider*) m_validatorWindow; - if (m_pInt) - { - pControl->SetValue(*m_pInt) ; - return true; - } - } else -#endif - - // string controls -#if wxUSE_BUTTON - if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) - { - wxButton* pControl = (wxButton*) m_validatorWindow; - if (m_pString) - { - pControl->SetLabel(*m_pString) ; - return true; - } - } else -#endif -#if wxUSE_COMBOBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) - { - wxComboBox* pControl = (wxComboBox*) m_validatorWindow; - if (m_pInt) - { - pControl->SetSelection(*m_pInt) ; - return true; - } - else if (m_pString) - { - if (pControl->FindString(* m_pString) != wxNOT_FOUND) - { - pControl->SetStringSelection(* m_pString); - } - if ((m_validatorWindow->GetWindowStyle() & wxCB_READONLY) == 0) - { - pControl->SetValue(* m_pString); - } - return true; - } - } else -#endif -#if wxUSE_CHOICE - if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) - { - wxChoice* pControl = (wxChoice*) m_validatorWindow; - if (m_pInt) - { - pControl->SetSelection(*m_pInt) ; - return true; - } - else if (m_pString) - { - if (pControl->FindString(* m_pString) != wxNOT_FOUND) - { - pControl->SetStringSelection(* m_pString); - } - return true; - } - } else -#endif -#if wxUSE_STATTEXT - if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) - { - wxStaticText* pControl = (wxStaticText*) m_validatorWindow; - if (m_pString) - { - pControl->SetLabel(*m_pString) ; - return true; - } - } else -#endif -#if wxUSE_TEXTCTRL - if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) - { - wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; - if (m_pString) - { - pControl->SetValue(*m_pString) ; - return true; - } - else if (m_pInt) - { - wxString str; - str.Printf(wxT("%d"), *m_pInt); - pControl->SetValue(str); - return true; - } - } else -#endif - - // array controls -#if wxUSE_CHECKLISTBOX - // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first: - if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) - { - wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow; - if (m_pArrayInt) - { - // clear all selections - size_t i, - count = pControl->GetCount(); - for ( i = 0 ; i < count; i++ ) - pControl->Check(i, false); - - // select each item in our array - count = m_pArrayInt->GetCount(); - for ( i = 0 ; i < count; i++ ) - pControl->Check(m_pArrayInt->Item(i)); - - return true; - } - else - return false; - } else -#endif -#if wxUSE_LISTBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) - { - wxListBox* pControl = (wxListBox*) m_validatorWindow; - if (m_pArrayInt) - { - // clear all selections - size_t i, - count = pControl->GetCount(); - for ( i = 0 ; i < count; i++ ) - pControl->Deselect(i); - - // select each item in our array - count = m_pArrayInt->GetCount(); - for ( i = 0 ; i < count; i++ ) - pControl->SetSelection(m_pArrayInt->Item(i)); - - return true; - } - } else -#endif - ; // to match the last 'else' above - - // unrecognized control, or bad pointer - return false; -} - -// Called to transfer data from the window -bool wxGenericValidator::TransferFromWindow(void) -{ - if ( !m_validatorWindow ) - return false; - - // BOOL CONTROLS ************************************** -#if wxUSE_CHECKBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) ) - { - wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow; - if (m_pBool) - { - *m_pBool = pControl->GetValue() ; - return true; - } - } else -#endif -#if wxUSE_RADIOBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) - { - wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow; - if (m_pBool) - { - *m_pBool = pControl->GetValue() ; - return true; - } - } else -#endif -#if wxUSE_TOGGLEBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) ) - { - wxToggleButton *pControl = (wxToggleButton *) m_validatorWindow; - if (m_pBool) - { - *m_pBool = pControl->GetValue() ; - return true; - } - } else -#endif - - // INT CONTROLS *************************************** -#if wxUSE_GAUGE - if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) - { - wxGauge* pControl = (wxGauge*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetValue() ; - return true; - } - } else -#endif -#if wxUSE_RADIOBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) - { - wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetSelection() ; - return true; - } - } else -#endif -#if wxUSE_SCROLLBAR - if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) - { - wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetThumbPosition() ; - return true; - } - } else -#endif -#if wxUSE_SPINCTRL && !defined(__WXMOTIF__) - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) ) - { - wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow; - if (m_pInt) - { - *m_pInt=pControl->GetValue(); - return true; - } - } else -#endif -#if wxUSE_SPINBTN - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) - { - wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetValue() ; - return true; - } - } else -#endif -#if wxUSE_SLIDER - if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) ) - { - wxSlider* pControl = (wxSlider*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetValue() ; - return true; - } - } else -#endif - - // STRING CONTROLS ************************************ -#if wxUSE_BUTTON - if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) - { - wxButton* pControl = (wxButton*) m_validatorWindow; - if (m_pString) - { - *m_pString = pControl->GetLabel() ; - return true; - } - } else -#endif -#if wxUSE_COMBOBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) - { - wxComboBox* pControl = (wxComboBox*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetSelection() ; - return true; - } - else if (m_pString) - { - if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY) - *m_pString = pControl->GetStringSelection(); - else - *m_pString = pControl->GetValue(); - return true; - } - } else -#endif -#if wxUSE_CHOICE - if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) - { - wxChoice* pControl = (wxChoice*) m_validatorWindow; - if (m_pInt) - { - *m_pInt = pControl->GetSelection() ; - return true; - } - else if (m_pString) - { - *m_pString = pControl->GetStringSelection(); - return true; - } - } else -#endif -#if wxUSE_STATTEXT - if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) - { - wxStaticText* pControl = (wxStaticText*) m_validatorWindow; - if (m_pString) - { - *m_pString = pControl->GetLabel() ; - return true; - } - } else -#endif -#if wxUSE_TEXTCTRL - if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) - { - wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; - if (m_pString) - { - *m_pString = pControl->GetValue() ; - return true; - } - else if (m_pInt) - { - *m_pInt = wxAtoi(pControl->GetValue()); - return true; - } - } else -#endif - - // ARRAY CONTROLS ************************************* -#if wxUSE_CHECKLISTBOX - // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first: - if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) - { - wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow; - if (m_pArrayInt) - { - // clear our array - m_pArrayInt->Clear(); - - // add each selected item to our array - size_t i, - count = pControl->GetCount(); - for ( i = 0; i < count; i++ ) - { - if (pControl->IsChecked(i)) - m_pArrayInt->Add(i); - } - - return true; - } - else - return false; - } else -#endif -#if wxUSE_LISTBOX - if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) - { - wxListBox* pControl = (wxListBox*) m_validatorWindow; - if (m_pArrayInt) - { - // clear our array - m_pArrayInt->Clear(); - - // add each selected item to our array - size_t i, - count = pControl->GetCount(); - for ( i = 0; i < count; i++ ) - { - if (pControl->IsSelected(i)) - m_pArrayInt->Add(i); - } - - return true; - } - } else -#endif - - // unrecognized control, or bad pointer - return false; - - return false; -} - -/* - Called by constructors to initialize ALL data members -*/ -void wxGenericValidator::Initialize() -{ - m_pBool = 0; - m_pInt = 0; - m_pString = 0; - m_pArrayInt = 0; -} - -#endif - // wxUSE_VALIDATORS diff --git a/Source/3rdParty/wx/src/common/validate.cpp b/Source/3rdParty/wx/src/common/validate.cpp deleted file mode 100644 index e01711bae..000000000 --- a/Source/3rdParty/wx/src/common/validate.cpp +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/validate.cpp -// Purpose: wxValidator -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: validate.cpp 39656 2006-06-09 21:21:53Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_VALIDATORS - -#include "wx/validate.h" - -#ifndef WX_PRECOMP - #include "wx/window.h" -#endif - -const wxValidator wxDefaultValidator; - -IMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler) - -// VZ: personally, I think true would be more appropriate - these bells are -// _annoying_ -bool wxValidator::ms_isSilent = false; - -wxValidator::wxValidator() -{ - m_validatorWindow = (wxWindow *) NULL; -} - -wxValidator::~wxValidator() -{ -} - -#endif - // wxUSE_VALIDATORS diff --git a/Source/3rdParty/wx/src/common/valtext.cpp b/Source/3rdParty/wx/src/common/valtext.cpp deleted file mode 100644 index 6f3d8b560..000000000 --- a/Source/3rdParty/wx/src/common/valtext.cpp +++ /dev/null @@ -1,344 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/valtext.cpp -// Purpose: wxTextValidator -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: valtext.cpp 39656 2006-06-09 21:21:53Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL - -#include "wx/valtext.h" - -#ifndef WX_PRECOMP - #include - #include "wx/textctrl.h" - #include "wx/utils.h" - #include "wx/msgdlg.h" - #include "wx/intl.h" -#endif - -#include -#include -#include - -#ifdef __SALFORDC__ - #include -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxTextValidator, wxValidator) - -BEGIN_EVENT_TABLE(wxTextValidator, wxValidator) - EVT_CHAR(wxTextValidator::OnChar) -END_EVENT_TABLE() - -static bool wxIsNumeric(const wxString& val); - -wxTextValidator::wxTextValidator(long style, wxString *val) -{ - m_validatorStyle = style; - m_stringValue = val; -/* - m_refData = new wxVTextRefData; - - M_VTEXTDATA->m_validatorStyle = style; - M_VTEXTDATA->m_stringValue = val; -*/ -} - -wxTextValidator::wxTextValidator(const wxTextValidator& val) - : wxValidator() -{ - Copy(val); -} - -bool wxTextValidator::Copy(const wxTextValidator& val) -{ - wxValidator::Copy(val); - - m_validatorStyle = val.m_validatorStyle; - m_stringValue = val.m_stringValue; - - m_includes = val.m_includes; - m_excludes = val.m_excludes; - - return true; -} - -static bool wxIsAlpha(const wxString& val) -{ - int i; - for ( i = 0; i < (int)val.length(); i++) - { - if (!wxIsalpha(val[i])) - return false; - } - return true; -} - -static bool wxIsAlphaNumeric(const wxString& val) -{ - int i; - for ( i = 0; i < (int)val.length(); i++) - { - if (!wxIsalnum(val[i])) - return false; - } - return true; -} - -// Called when the value in the window must be validated. -// This function can pop up an error message. -bool wxTextValidator::Validate(wxWindow *parent) -{ - if( !CheckValidator() ) - return false; - - wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow; - - // If window is disabled, simply return - if ( !control->IsEnabled() ) - return true; - - wxString val(control->GetValue()); - - bool ok = true; - - // NB: this format string should contian exactly one '%s' - wxString errormsg; - - bool includes = (m_validatorStyle & wxFILTER_INCLUDE_LIST) != 0; - if ( includes || (m_validatorStyle & wxFILTER_EXCLUDE_LIST) ) - { - // if includes, it's only ok to have the members of the list, - // otherwise it's only ok to have non-members - ok = includes == (m_includes.Index(val) != wxNOT_FOUND); - if ( !ok ) - { - errormsg = _("'%s' is invalid"); - } - } - else if ( (m_validatorStyle & wxFILTER_ASCII) && !val.IsAscii() ) - { - ok = false; - - errormsg = _("'%s' should only contain ASCII characters."); - } - else if ( (m_validatorStyle & wxFILTER_ALPHA) && !wxIsAlpha(val) ) - { - ok = false; - - errormsg = _("'%s' should only contain alphabetic characters."); - } - else if ( (m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsAlphaNumeric(val)) - { - ok = false; - - errormsg = _("'%s' should only contain alphabetic or numeric characters."); - } - else if ( (m_validatorStyle & wxFILTER_NUMERIC) && !wxIsNumeric(val)) - { - ok = false; - - errormsg = _("'%s' should be numeric."); - } - else if ( (m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludes(val)) - { - //it's only ok to have the members of the list - errormsg = _("'%s' is invalid"); - ok = false; - } - else if ( (m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludes(val)) - { - // it's only ok to have non-members of the list - errormsg = _("'%s' is invalid"); - ok = false; - } - - if ( !ok ) - { - wxASSERT_MSG( !errormsg.empty(), _T("you forgot to set errormsg") ); - - m_validatorWindow->SetFocus(); - - wxString buf; - buf.Printf(errormsg, val.c_str()); - - wxMessageBox(buf, _("Validation conflict"), - wxOK | wxICON_EXCLAMATION, parent); - } - - return ok; -} - -// Called to transfer data to the window -bool wxTextValidator::TransferToWindow(void) -{ - if( !CheckValidator() ) - return false; - - if ( m_stringValue ) - { - wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow; - control->SetValue(* m_stringValue); - } - - return true; -} - -// Called to transfer data to the window -bool wxTextValidator::TransferFromWindow(void) -{ - if( !CheckValidator() ) - return false; - - if ( m_stringValue ) - { - wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow; - *m_stringValue = control->GetValue(); - } - - return true; -} - -#if WXWIN_COMPATIBILITY_2_4 - -inline void wxCopyStringListToArrayString(wxArrayString& to, const wxStringList& from) -{ - to.Clear(); - - for ( wxStringList::compatibility_iterator pNode = from.GetFirst(); - pNode; - pNode = pNode->GetNext() ) - { - to.Add(pNode->GetData()); - } -} - -inline void wxCopyArrayStringToStringList(wxStringList& to, const wxArrayString& from) -{ - to.Clear(); - - for(size_t i = 0; i < from.GetCount(); ++i) - to.Add(from[i]); -} - -wxStringList& wxTextValidator::GetIncludeList() -{ - wxCopyArrayStringToStringList(m_includeList, m_includes); - return m_includeList; -} - -wxStringList& wxTextValidator::GetExcludeList() -{ - wxCopyArrayStringToStringList(m_excludeList, m_excludes); - return m_excludeList; -} - -void wxTextValidator::SetIncludeList(const wxStringList& list) -{ - wxCopyStringListToArrayString(m_includes, list); -} - -void wxTextValidator::SetExcludeList(const wxStringList& list) -{ - wxCopyStringListToArrayString(m_excludes, list); -} - -bool wxTextValidator::IsInCharIncludeList(const wxString& val) -{ - return IsInCharIncludes(val); -} - -bool wxTextValidator::IsNotInCharExcludeList(const wxString& val) -{ - return IsNotInCharExcludes(val); -} - -#endif //compat 2.4 - - -bool wxTextValidator::IsInCharIncludes(const wxString& val) -{ - size_t i; - for ( i = 0; i < val.length(); i++) - { - if (m_includes.Index((wxString) val[i]) == wxNOT_FOUND) - return false; - } - return true; -} - -bool wxTextValidator::IsNotInCharExcludes(const wxString& val) -{ - size_t i; - for ( i = 0; i < val.length(); i++) - { - if (m_excludes.Index((wxString) val[i]) != wxNOT_FOUND) - return false; - } - return true; -} - -void wxTextValidator::OnChar(wxKeyEvent& event) -{ -/* - if ( !M_VTEXTDATA ) - return; -*/ - - if ( m_validatorWindow ) - { - int keyCode = event.GetKeyCode(); - - // we don't filter special keys and Delete - if ( - !(keyCode < WXK_SPACE || keyCode == WXK_DELETE || keyCode > WXK_START) && - ( - ((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludes(wxString((wxChar) keyCode, 1))) || - ((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludes(wxString((wxChar) keyCode, 1))) || - ((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) || - ((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) || - ((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) || - ((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode) - && keyCode != wxT('.') && keyCode != wxT(',') && keyCode != wxT('-') && keyCode != wxT('+') && keyCode != wxT('e') && keyCode != wxT('E')) - ) - ) - { - if ( !wxValidator::IsSilent() ) - wxBell(); - - // eat message - return; - } - } - - event.Skip(); -} - -static bool wxIsNumeric(const wxString& val) -{ - int i; - for ( i = 0; i < (int)val.length(); i++) - { - // Allow for "," (French) as well as "." -- in future we should - // use wxSystemSettings or other to do better localisation - if ((!wxIsdigit(val[i])) && (val[i] != wxT('.')) && (val[i] != wxT(',')) && (val[i] != wxT('e')) && (val[i] != wxT('E')) && (val[i] != wxT('+')) && (val[i] != wxT('-'))) - return false; - } - return true; -} - - -#endif - // wxUSE_VALIDATORS && wxUSE_TEXTCTRL diff --git a/Source/3rdParty/wx/src/common/variant.cpp b/Source/3rdParty/wx/src/common/variant.cpp deleted file mode 100644 index eb653c0ff..000000000 --- a/Source/3rdParty/wx/src/common/variant.cpp +++ /dev/null @@ -1,2040 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/variant.cpp -// Purpose: wxVariant class, container for any type -// Author: Julian Smart -// Modified by: -// Created: 10/09/98 -// RCS-ID: $Id: variant.cpp 58054 2009-01-12 17:27:53Z JMS $ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/variant.h" - -#if wxUSE_VARIANT - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/math.h" - #if wxUSE_STREAMS - #include "wx/stream.h" - #endif -#endif - -#if wxUSE_STD_IOSTREAM - #if wxUSE_IOSTREAMH - #include - #else - #include - #endif -#endif - -#if defined(__MWERKS__) && __MSL__ >= 0x6000 -namespace std {} -using namespace std ; -#endif - -#if wxUSE_STREAMS - #include "wx/txtstrm.h" -#endif - -#include "wx/string.h" -#include "wx/tokenzr.h" - -IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) - -wxVariant WXDLLIMPEXP_BASE wxNullVariant; - - -/* - * wxVariant - */ - -IMPLEMENT_DYNAMIC_CLASS(wxVariant, wxObject) - -wxVariant::wxVariant() -{ - m_data = (wxVariantData*) NULL; -} - -bool wxVariant::IsNull() const -{ - return (m_data == (wxVariantData*) NULL); -} - -void wxVariant::MakeNull() -{ - UnRef(); -} - -void wxVariant::Clear() -{ - m_name = wxEmptyString; -} - -wxVariant::wxVariant(const wxVariant& variant) - : wxObject() -{ - m_data = (wxVariantData*) NULL; - - if (!variant.IsNull()) - Ref(variant); - - m_name = variant.m_name; -} - -wxVariant::wxVariant(wxVariantData* data, const wxString& name) // User-defined data -{ - m_data = data; - m_name = name; -} - -wxVariant::~wxVariant() -{ - UnRef(); -} - -// Assignment -void wxVariant::operator= (const wxVariant& variant) -{ - Ref(variant); - m_name = variant.m_name; -} - -// myVariant = new wxStringVariantData("hello") -void wxVariant::operator= (wxVariantData* variantData) -{ - UnRef(); - m_data = variantData; -} - -bool wxVariant::operator== (const wxVariant& variant) const -{ - if (IsNull() || variant.IsNull()) - return (IsNull() == variant.IsNull()); - - return (GetData()->Eq(* variant.GetData())); -} - -bool wxVariant::operator!= (const wxVariant& variant) const -{ - return (!(*this == variant)); -} - - -wxString wxVariant::MakeString() const -{ - if (!IsNull()) - { - wxString str; - if (GetData()->Write(str)) - return str; - } - return wxEmptyString; -} - -void wxVariant::SetData(wxVariantData* data) -{ - UnRef(); - m_data = data; -} - -void wxVariant::Ref(const wxVariant& clone) -{ - // nothing to be done - if (m_data == clone.m_data) - return; - - // delete reference to old data - UnRef(); - - // reference new data - if ( clone.m_data ) - { - m_data = clone.m_data; - m_data->m_count++; - } -} - - -void wxVariant::UnRef() -{ - if ( m_data ) - { - wxASSERT_MSG( m_data->m_count > 0, _T("invalid ref data count") ); - - m_data->DecRef(); - m_data = NULL; - } -} - - -// Returns a string representing the type of the variant, -// e.g. "string", "bool", "list", "double", "long" -wxString wxVariant::GetType() const -{ - if (IsNull()) - return wxString(wxT("null")); - else - return GetData()->GetType(); -} - - -bool wxVariant::IsType(const wxString& type) const -{ - return (GetType() == type); -} - -bool wxVariant::IsValueKindOf(const wxClassInfo* type) const -{ - wxClassInfo* info=GetData()->GetValueClassInfo(); - return info ? info->IsKindOf(type) : false ; -} - - -// ----------------------------------------------------------------- -// wxVariantDataLong -// ----------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDataLong: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataLong) -public: - wxVariantDataLong() { m_value = 0; } - wxVariantDataLong(long value) { m_value = value; } - - inline long GetValue() const { return m_value; } - inline void SetValue(long value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; - - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; -#endif -#if wxUSE_STREAMS - virtual bool Read(wxInputStream& str); - virtual bool Write(wxOutputStream &str) const; -#endif // wxUSE_STREAMS - - virtual wxString GetType() const { return wxT("long"); } - -protected: - long m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataLong, wxVariantData) - -bool wxVariantDataLong::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("long")), wxT("wxVariantDataLong::Eq: argument mismatch") ); - - wxVariantDataLong& otherData = (wxVariantDataLong&) data; - - return (otherData.m_value == m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataLong::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataLong::Write(wxString& str) const -{ - str.Printf(wxT("%ld"), m_value); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataLong::Read(wxSTD istream& str) -{ - str >> m_value; - return true; -} -#endif - -#if wxUSE_STREAMS -bool wxVariantDataLong::Write(wxOutputStream& str) const -{ - wxTextOutputStream s(str); - - s.Write32((size_t)m_value); - return true; -} - -bool wxVariantDataLong::Read(wxInputStream& str) -{ - wxTextInputStream s(str); - m_value = s.Read32(); - return true; -} -#endif // wxUSE_STREAMS - -bool wxVariantDataLong::Read(wxString& str) -{ - m_value = wxAtol((const wxChar*) str); - return true; -} - -// wxVariant - -wxVariant::wxVariant(long val, const wxString& name) -{ - m_data = new wxVariantDataLong(val); - m_name = name; -} - -wxVariant::wxVariant(int val, const wxString& name) -{ - m_data = new wxVariantDataLong((long)val); - m_name = name; -} - -wxVariant::wxVariant(short val, const wxString& name) -{ - m_data = new wxVariantDataLong((long)val); - m_name = name; -} - -bool wxVariant::operator== (long value) const -{ - long thisValue; - if (!Convert(&thisValue)) - return false; - else - return (value == thisValue); -} - -bool wxVariant::operator!= (long value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (long value) -{ - if (GetType() == wxT("long") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataLong*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataLong(value); - } -} - -long wxVariant::GetLong() const -{ - long value; - if (Convert(& value)) - return value; - else - { - wxFAIL_MSG(wxT("Could not convert to a long")); - return 0; - } -} - -// ----------------------------------------------------------------- -// wxVariantDoubleData -// ----------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDoubleData: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDoubleData) -public: - wxVariantDoubleData() { m_value = 0.0; } - wxVariantDoubleData(double value) { m_value = value; } - - inline double GetValue() const { return m_value; } - inline void SetValue(double value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; - virtual bool Read(wxString& str); -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif -#if wxUSE_STREAMS - virtual bool Read(wxInputStream& str); - virtual bool Write(wxOutputStream &str) const; -#endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("double"); } - -protected: - double m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDoubleData, wxVariantData) - -bool wxVariantDoubleData::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("double")), wxT("wxVariantDoubleData::Eq: argument mismatch") ); - - wxVariantDoubleData& otherData = (wxVariantDoubleData&) data; - - return wxIsSameDouble(otherData.m_value, m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDoubleData::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDoubleData::Write(wxString& str) const -{ - str.Printf(wxT("%.14g"), m_value); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDoubleData::Read(wxSTD istream& str) -{ - str >> m_value; - return true; -} -#endif - -#if wxUSE_STREAMS -bool wxVariantDoubleData::Write(wxOutputStream& str) const -{ - wxTextOutputStream s(str); - s.WriteDouble((double)m_value); - return true; -} - -bool wxVariantDoubleData::Read(wxInputStream& str) -{ - wxTextInputStream s(str); - m_value = (float)s.ReadDouble(); - return true; -} -#endif // wxUSE_STREAMS - -bool wxVariantDoubleData::Read(wxString& str) -{ - m_value = wxAtof((const wxChar*) str); - return true; -} - -// wxVariant double code - -wxVariant::wxVariant(double val, const wxString& name) -{ - m_data = new wxVariantDoubleData(val); - m_name = name; -} - -bool wxVariant::operator== (double value) const -{ - double thisValue; - if (!Convert(&thisValue)) - return false; - - return wxIsSameDouble(value, thisValue); -} - -bool wxVariant::operator!= (double value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (double value) -{ - if (GetType() == wxT("double") && - m_data->GetRefCount() == 1) - { - ((wxVariantDoubleData*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDoubleData(value); - } -} - -double wxVariant::GetDouble() const -{ - double value; - if (Convert(& value)) - return value; - else - { - wxFAIL_MSG(wxT("Could not convert to a double number")); - return 0.0; - } -} - -// ----------------------------------------------------------------- -// wxVariantBoolData -// ----------------------------------------------------------------- - -#ifdef HAVE_BOOL - -class WXDLLIMPEXP_BASE wxVariantDataBool: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataBool) -public: - wxVariantDataBool() { m_value = 0; } - wxVariantDataBool(bool value) { m_value = value; } - - inline bool GetValue() const { return m_value; } - inline void SetValue(bool value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; - virtual bool Read(wxString& str); -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif -#if wxUSE_STREAMS - virtual bool Read(wxInputStream& str); - virtual bool Write(wxOutputStream& str) const; -#endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("bool"); } - -protected: - bool m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataBool, wxVariantData) - -bool wxVariantDataBool::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("bool")), wxT("wxVariantDataBool::Eq: argument mismatch") ); - - wxVariantDataBool& otherData = (wxVariantDataBool&) data; - - return (otherData.m_value == m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataBool::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataBool::Write(wxString& str) const -{ - str.Printf(wxT("%d"), (int) m_value); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataBool::Read(wxSTD istream& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); -// str >> (long) m_value; - return false; -} -#endif - -#if wxUSE_STREAMS -bool wxVariantDataBool::Write(wxOutputStream& str) const -{ - wxTextOutputStream s(str); - - s.Write8(m_value); - return true; -} - -bool wxVariantDataBool::Read(wxInputStream& str) -{ - wxTextInputStream s(str); - - m_value = s.Read8() != 0; - return true; -} -#endif // wxUSE_STREAMS - -bool wxVariantDataBool::Read(wxString& str) -{ - m_value = (wxAtol((const wxChar*) str) != 0); - return true; -} - -// wxVariant **** - -wxVariant::wxVariant(bool val, const wxString& name) -{ - m_data = new wxVariantDataBool(val); - m_name = name; -} - -bool wxVariant::operator== (bool value) const -{ - bool thisValue; - if (!Convert(&thisValue)) - return false; - else - return (value == thisValue); -} - -bool wxVariant::operator!= (bool value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (bool value) -{ - if (GetType() == wxT("bool") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataBool*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataBool(value); - } -} - -bool wxVariant::GetBool() const -{ - bool value; - if (Convert(& value)) - return value; - else - { - wxFAIL_MSG(wxT("Could not convert to a bool")); - return 0; - } -} - -#endif // HAVE_BOOL - -// ----------------------------------------------------------------- -// wxVariantDataChar -// ----------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDataChar: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataChar) -public: - wxVariantDataChar() { m_value = 0; } - wxVariantDataChar(wxChar value) { m_value = value; } - - inline wxChar GetValue() const { return m_value; } - inline void SetValue(wxChar value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; -#if wxUSE_STREAMS - virtual bool Read(wxInputStream& str); - virtual bool Write(wxOutputStream& str) const; -#endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("char"); } - -protected: - wxChar m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataChar, wxVariantData) - -bool wxVariantDataChar::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("char")), wxT("wxVariantDataChar::Eq: argument mismatch") ); - - wxVariantDataChar& otherData = (wxVariantDataChar&) data; - - return (otherData.m_value == m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataChar::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataChar::Write(wxString& str) const -{ - str.Printf(wxT("%c"), m_value); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataChar::Read(wxSTD istream& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); - - return false; -} -#endif - -#if wxUSE_STREAMS -bool wxVariantDataChar::Write(wxOutputStream& str) const -{ - wxTextOutputStream s(str); - - s << m_value; - - return true; -} - -bool wxVariantDataChar::Read(wxInputStream& str) -{ - wxTextInputStream s(str); - - s >> m_value; - - return true; -} -#endif // wxUSE_STREAMS - -bool wxVariantDataChar::Read(wxString& str) -{ - m_value = str[size_t(0)]; - return true; -} - -wxVariant::wxVariant(wxChar val, const wxString& name) -{ - m_data = new wxVariantDataChar(val); - m_name = name; -} - -bool wxVariant::operator== (wxChar value) const -{ - wxChar thisValue; - if (!Convert(&thisValue)) - return false; - else - return (value == thisValue); -} - -bool wxVariant::operator!= (wxChar value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (wxChar value) -{ - if (GetType() == wxT("char") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataChar*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataChar(value); - } -} - -wxChar wxVariant::GetChar() const -{ - wxChar value; - if (Convert(& value)) - return value; - else - { - wxFAIL_MSG(wxT("Could not convert to a char")); - return 0; - } -} - -// ---------------------------------------------------------------------------- -// wxVariantDataString -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDataString: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataString) -public: - wxVariantDataString() { } - wxVariantDataString(const wxString& value) { m_value = value; } - - inline wxString GetValue() const { return m_value; } - inline void SetValue(const wxString& value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } -#endif -#if wxUSE_STREAMS - virtual bool Read(wxInputStream& str); - virtual bool Write(wxOutputStream& str) const; -#endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("string"); } - -protected: - wxString m_value; -}; - -bool wxVariantDataString::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("string")), wxT("wxVariantDataString::Eq: argument mismatch") ); - - wxVariantDataString& otherData = (wxVariantDataString&) data; - - return (otherData.m_value == m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataString::Write(wxSTD ostream& str) const -{ - str << (const char*) m_value.mb_str(); - return true; -} -#endif - -bool wxVariantDataString::Write(wxString& str) const -{ - str = m_value; - return true; -} - -#if wxUSE_STREAMS -bool wxVariantDataString::Write(wxOutputStream& str) const -{ - // why doesn't wxOutputStream::operator<< take "const wxString&" - wxTextOutputStream s(str); - s.WriteString(m_value); - return true; -} - -bool wxVariantDataString::Read(wxInputStream& str) -{ - wxTextInputStream s(str); - - m_value = s.ReadLine(); - return true; -} -#endif // wxUSE_STREAMS - -bool wxVariantDataString::Read(wxString& str) -{ - m_value = str; - return true; -} - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataString, wxVariantData) - -// wxVariant **** - -wxVariant::wxVariant(const wxString& val, const wxString& name) -{ - m_data = new wxVariantDataString(val); - m_name = name; -} - -wxVariant::wxVariant(const wxChar* val, const wxString& name) -{ - m_data = new wxVariantDataString(wxString(val)); - m_name = name; -} - -bool wxVariant::operator== (const wxString& value) const -{ - wxString thisValue; - if (!Convert(&thisValue)) - return false; - - return value == thisValue; -} - -bool wxVariant::operator!= (const wxString& value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (const wxString& value) -{ - if (GetType() == wxT("string") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataString*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataString(value); - } -} - -void wxVariant::operator= (const wxChar* value) -{ - if (GetType() == wxT("string") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataString*)GetData())->SetValue(wxString(value)); - } - else - { - UnRef(); - m_data = new wxVariantDataString(wxString(value)); - } -} - -wxString wxVariant::GetString() const -{ - wxString value; - if (!Convert(& value)) - { - wxFAIL_MSG(wxT("Could not convert to a string")); - } - - return value; -} - -// ---------------------------------------------------------------------------- -// wxVariantDataWxObjectPtr -// ---------------------------------------------------------------------------- - -class wxVariantDataWxObjectPtr: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataWxObjectPtr) -public: - wxVariantDataWxObjectPtr() { } - wxVariantDataWxObjectPtr(wxObject* value) { m_value = value; } - - inline wxObject* GetValue() const { return m_value; } - inline void SetValue(wxObject* value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const ; - virtual wxVariantData* Clone() { return new wxVariantDataWxObjectPtr; } - - virtual wxClassInfo* GetValueClassInfo() ; -protected: - wxObject* m_value; - - DECLARE_NO_COPY_CLASS(wxVariantDataWxObjectPtr) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataWxObjectPtr, wxVariantData) - -bool wxVariantDataWxObjectPtr::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( wxIsKindOf((&data), wxVariantDataWxObjectPtr), wxT("wxVariantDataWxObjectPtr::Eq: argument mismatch") ); - - wxVariantDataWxObjectPtr& otherData = (wxVariantDataWxObjectPtr&) data; - - return (otherData.m_value == m_value); -} - -wxString wxVariantDataWxObjectPtr::GetType() const -{ - wxString returnVal(wxT("wxObject")); - if (m_value) { - returnVal = m_value->GetClassInfo()->GetClassName(); - } - return returnVal; -} - -wxClassInfo* wxVariantDataWxObjectPtr::GetValueClassInfo() -{ - wxClassInfo* returnVal=NULL; - - if (m_value) returnVal = m_value->GetClassInfo(); - - return returnVal; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataWxObjectPtr::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataWxObjectPtr::Write(wxString& str) const -{ - str.Printf(wxT("%s(%p)"), GetType().c_str(), wx_static_cast(void*, m_value)); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataWxObjectPtr::Read(wxSTD istream& WXUNUSED(str)) -{ - // Not implemented - return false; -} -#endif - -bool wxVariantDataWxObjectPtr::Read(wxString& WXUNUSED(str)) -{ - // Not implemented - return false; -} - -// wxVariant - -wxVariant::wxVariant( wxObject* val, const wxString& name) -{ - m_data = new wxVariantDataWxObjectPtr(val); - m_name = name; -} - -bool wxVariant::operator== (wxObject* value) const -{ - return (value == ((wxVariantDataWxObjectPtr*)GetData())->GetValue()); -} - -bool wxVariant::operator!= (wxObject* value) const -{ - return (!((*this) == (wxObject*) value)); -} - -void wxVariant::operator= (wxObject* value) -{ - UnRef(); - m_data = new wxVariantDataWxObjectPtr(value); -} - -wxObject* wxVariant::GetWxObjectPtr() const -{ - wxASSERT(wxIsKindOf(GetData(), wxVariantDataWxObjectPtr)); - return (wxObject*) ((wxVariantDataWxObjectPtr*) m_data)->GetValue(); -} - -// ---------------------------------------------------------------------------- -// wxVariantDataVoidPtr -// ---------------------------------------------------------------------------- - -class wxVariantDataVoidPtr: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataVoidPtr) -public: - wxVariantDataVoidPtr() { } - wxVariantDataVoidPtr(void* value) { m_value = value; } - - inline void* GetValue() const { return m_value; } - inline void SetValue(void* value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("void*"); } - virtual wxVariantData* Clone() { return new wxVariantDataVoidPtr; } - -protected: - void* m_value; - - DECLARE_NO_COPY_CLASS(wxVariantDataVoidPtr) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataVoidPtr, wxVariantData) - -bool wxVariantDataVoidPtr::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("void*")), wxT("wxVariantDataVoidPtr::Eq: argument mismatch") ); - - wxVariantDataVoidPtr& otherData = (wxVariantDataVoidPtr&) data; - - return (otherData.m_value == m_value); -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataVoidPtr::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataVoidPtr::Write(wxString& str) const -{ - str.Printf(wxT("%p"), m_value); - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataVoidPtr::Read(wxSTD istream& WXUNUSED(str)) -{ - // Not implemented - return false; -} -#endif - -bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str)) -{ - // Not implemented - return false; -} - -// wxVariant - -wxVariant::wxVariant( void* val, const wxString& name) -{ - m_data = new wxVariantDataVoidPtr(val); - m_name = name; -} - -bool wxVariant::operator== (void* value) const -{ - return (value == ((wxVariantDataVoidPtr*)GetData())->GetValue()); -} - -bool wxVariant::operator!= (void* value) const -{ - return (!((*this) == (void*) value)); -} - -void wxVariant::operator= (void* value) -{ - if (GetType() == wxT("void*") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataVoidPtr*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataVoidPtr(value); - } -} - -void* wxVariant::GetVoidPtr() const -{ - wxASSERT( (GetType() == wxT("void*")) ); - - return (void*) ((wxVariantDataVoidPtr*) m_data)->GetValue(); -} - -// ---------------------------------------------------------------------------- -// wxVariantDataDateTime -// ---------------------------------------------------------------------------- - -#if wxUSE_DATETIME - -class wxVariantDataDateTime: public wxVariantData -{ - DECLARE_DYNAMIC_CLASS(wxVariantDataDateTime) - -public: - wxVariantDataDateTime() { } - wxVariantDataDateTime(const wxDateTime& value) { m_value = value; } -#if wxUSE_ODBC - wxVariantDataDateTime(const TIME_STRUCT* valptr) - { m_value = wxDateTime(valptr->hour, valptr->minute, valptr->second); } - wxVariantDataDateTime(const DATE_STRUCT* valptr) - { m_value = wxDateTime(valptr->day, (wxDateTime::Month) (valptr->month - 1),valptr->year); } - wxVariantDataDateTime(const TIMESTAMP_STRUCT* valptr) - { m_value = wxDateTime(valptr->day, (wxDateTime::Month) (valptr->month - 1), valptr->year, - valptr->hour, valptr->minute, valptr->second, (wxDateTime::wxDateTime_t)valptr->fraction ); } -#endif //ODBC - - inline wxDateTime GetValue() const { return m_value; } - inline void SetValue(const wxDateTime& value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("datetime"); } - virtual wxVariantData* Clone() { return new wxVariantDataDateTime; } - -protected: - wxDateTime m_value; -}; - - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataDateTime, wxVariantData) - -bool wxVariantDataDateTime::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("datetime")), wxT("wxVariantDataDateTime::Eq: argument mismatch") ); - - wxVariantDataDateTime& otherData = (wxVariantDataDateTime&) data; - - return (otherData.m_value == m_value); -} - - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataDateTime::Write(wxSTD ostream& str) const -{ - wxString value; - Write( value ); - str << value.c_str(); - return true; -} -#endif - - -bool wxVariantDataDateTime::Write(wxString& str) const -{ - if ( m_value.IsValid() ) - str = m_value.Format(); - else - str = wxT("Invalid"); - - return true; -} - - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str)) -{ - // Not implemented - return false; -} -#endif - - -bool wxVariantDataDateTime::Read(wxString& str) -{ - if ( str == wxT("Invalid") ) - { - m_value = wxInvalidDateTime; - return true; - } - - if(! m_value.ParseDateTime(str)) - return false; - return true; -} - -// wxVariant - -wxVariant::wxVariant(const wxDateTime& val, const wxString& name) // Date -{ - m_data = new wxVariantDataDateTime(val); - m_name = name; -} - -#if wxUSE_ODBC -wxVariant::wxVariant(const TIME_STRUCT* valptr, const wxString& name) // Date -{ - m_data = new wxVariantDataDateTime(valptr); - m_name = name; -} - -wxVariant::wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name) // Date -{ - m_data = new wxVariantDataDateTime(valptr); - m_name = name; -} - -wxVariant::wxVariant(const DATE_STRUCT* valptr, const wxString& name) // Date -{ - m_data = new wxVariantDataDateTime(valptr); - m_name = name; -} -#endif // wxUSE_ODBC - -bool wxVariant::operator== (const wxDateTime& value) const -{ - wxDateTime thisValue; - if (!Convert(&thisValue)) - return false; - - return value.IsEqualTo(thisValue); -} - -bool wxVariant::operator!= (const wxDateTime& value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (const wxDateTime& value) -{ - if (GetType() == wxT("datetime") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataDateTime*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataDateTime(value); - } -} - -#if wxUSE_ODBC -void wxVariant::operator= (const DATE_STRUCT* value) -{ - UnRef(); - m_data = new wxVariantDataDateTime(value); -} - -void wxVariant::operator= (const TIME_STRUCT* value) -{ - UnRef(); - m_data = new wxVariantDataDateTime(value); -} - -void wxVariant::operator= (const TIMESTAMP_STRUCT* value) -{ - UnRef(); - m_data = new wxVariantDataDateTime(value); -} - -#endif // wxUSE_ODBC - -wxDateTime wxVariant::GetDateTime() const -{ - wxDateTime value; - if (!Convert(& value)) - { - wxFAIL_MSG(wxT("Could not convert to a datetime")); - } - - return value; -} - -#endif // wxUSE_DATETIME - -// ---------------------------------------------------------------------------- -// wxVariantDataArrayString -// ---------------------------------------------------------------------------- - -class wxVariantDataArrayString: public wxVariantData -{ -public: - wxVariantDataArrayString() { } - wxVariantDataArrayString(const wxArrayString& value) { m_value = value; } - - wxArrayString GetValue() const { return m_value; } - void SetValue(const wxArrayString& value) { m_value = value; } - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("arrstring"); } - virtual wxVariantData* Clone() { return new wxVariantDataArrayString; } - -protected: - wxArrayString m_value; - - DECLARE_DYNAMIC_CLASS(wxVariantDataArrayString) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataArrayString, wxVariantData) - -bool wxVariantDataArrayString::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( data.GetType() == GetType(), wxT("wxVariantDataArrayString::Eq: argument mismatch") ); - - wxVariantDataArrayString& otherData = (wxVariantDataArrayString&) data; - - return otherData.m_value == m_value; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataArrayString::Write(wxSTD ostream& WXUNUSED(str)) const -{ - // Not implemented - return false; -} -#endif - -bool wxVariantDataArrayString::Write(wxString& str) const -{ - size_t count = m_value.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( n ) - str += _T(';'); - - str += m_value[n]; - } - - return true; -} - - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataArrayString::Read(wxSTD istream& WXUNUSED(str)) -{ - // Not implemented - return false; -} -#endif - - -bool wxVariantDataArrayString::Read(wxString& str) -{ - wxStringTokenizer tk(str, _T(";")); - while ( tk.HasMoreTokens() ) - { - m_value.Add(tk.GetNextToken()); - } - - return true; -} - -// wxVariant - -wxVariant::wxVariant(const wxArrayString& val, const wxString& name) // Strings -{ - m_data = new wxVariantDataArrayString(val); - m_name = name; -} - -bool wxVariant::operator==(const wxArrayString& WXUNUSED(value)) const -{ - wxFAIL_MSG( _T("TODO") ); - - return false; -} - -bool wxVariant::operator!=(const wxArrayString& value) const -{ - return !(*this == value); -} - -void wxVariant::operator=(const wxArrayString& value) -{ - if (GetType() == wxT("arrstring") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataArrayString *)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataArrayString(value); - } -} - -wxArrayString wxVariant::GetArrayString() const -{ - if ( GetType() == wxT("arrstring") ) - return ((wxVariantDataArrayString *)GetData())->GetValue(); - - return wxArrayString(); -} - -// ---------------------------------------------------------------------------- -// wxVariantDataList -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDataList: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataList) -public: - wxVariantDataList() {} - wxVariantDataList(const wxList& list); - virtual ~wxVariantDataList(); - - wxList& GetValue() { return m_value; } - void SetValue(const wxList& value) ; - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("list"); } - - void Clear(); - -protected: - wxList m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataList, wxVariantData) - -wxVariantDataList::wxVariantDataList(const wxList& list) -{ - SetValue(list); -} - -wxVariantDataList::~wxVariantDataList() -{ - Clear(); -} - -void wxVariantDataList::SetValue(const wxList& value) -{ - Clear(); - wxList::compatibility_iterator node = value.GetFirst(); - while (node) - { - wxVariant* var = (wxVariant*) node->GetData(); - m_value.Append(new wxVariant(*var)); - node = node->GetNext(); - } -} - -void wxVariantDataList::Clear() -{ - wxList::compatibility_iterator node = m_value.GetFirst(); - while (node) - { - wxVariant* var = (wxVariant*) node->GetData(); - delete var; - node = node->GetNext(); - } - m_value.Clear(); -} - -bool wxVariantDataList::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("list")), wxT("wxVariantDataList::Eq: argument mismatch") ); - - wxVariantDataList& listData = (wxVariantDataList&) data; - wxList::compatibility_iterator node1 = m_value.GetFirst(); - wxList::compatibility_iterator node2 = listData.GetValue().GetFirst(); - while (node1 && node2) - { - wxVariant* var1 = (wxVariant*) node1->GetData(); - wxVariant* var2 = (wxVariant*) node2->GetData(); - if ((*var1) != (*var2)) - return false; - node1 = node1->GetNext(); - node2 = node2->GetNext(); - } - if (node1 || node2) return false; - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataList::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataList::Write(wxString& str) const -{ - str = wxEmptyString; - wxList::compatibility_iterator node = m_value.GetFirst(); - while (node) - { - wxVariant* var = (wxVariant*) node->GetData(); - if (node != m_value.GetFirst()) - str += wxT(" "); - wxString str1; - str += var->MakeString(); - node = node->GetNext(); - } - - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataList::Read(wxSTD istream& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); - // TODO - return false; -} -#endif - -bool wxVariantDataList::Read(wxString& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); - // TODO - return false; -} - -// wxVariant - -wxVariant::wxVariant(const wxList& val, const wxString& name) // List of variants -{ - m_data = new wxVariantDataList(val); - m_name = name; -} - -bool wxVariant::operator== (const wxList& value) const -{ - wxASSERT_MSG( (GetType() == wxT("list")), wxT("Invalid type for == operator") ); - - wxVariantDataList other(value); - return (GetData()->Eq(other)); -} - -bool wxVariant::operator!= (const wxList& value) const -{ - return (!((*this) == value)); -} - -void wxVariant::operator= (const wxList& value) -{ - if (GetType() == wxT("list") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataList*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataList(value); - } -} - -wxList& wxVariant::GetList() const -{ - wxASSERT( (GetType() == wxT("list")) ); - - return (wxList&) ((wxVariantDataList*) m_data)->GetValue(); -} - -// Make empty list -void wxVariant::NullList() -{ - SetData(new wxVariantDataList()); -} - -// Append to list -void wxVariant::Append(const wxVariant& value) -{ - wxList& list = GetList(); - - list.Append(new wxVariant(value)); -} - -// Insert at front of list -void wxVariant::Insert(const wxVariant& value) -{ - wxList& list = GetList(); - - list.Insert(new wxVariant(value)); -} - -// Returns true if the variant is a member of the list -bool wxVariant::Member(const wxVariant& value) const -{ - wxList& list = GetList(); - - wxList::compatibility_iterator node = list.GetFirst(); - while (node) - { - wxVariant* other = (wxVariant*) node->GetData(); - if (value == *other) - return true; - node = node->GetNext(); - } - return false; -} - -// Deletes the nth element of the list -bool wxVariant::Delete(size_t item) -{ - wxList& list = GetList(); - - wxASSERT_MSG( (item < list.GetCount()), wxT("Invalid index to Delete") ); - wxList::compatibility_iterator node = list.Item(item); - wxVariant* variant = (wxVariant*) node->GetData(); - delete variant; - list.Erase(node); - return true; -} - -// Clear list -void wxVariant::ClearList() -{ - if (!IsNull() && (GetType() == wxT("list"))) - { - ((wxVariantDataList*) m_data)->Clear(); - } - else - { - if (!GetType().IsSameAs(wxT("list"))) - UnRef(); - - m_data = new wxVariantDataList; - } -} - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// wxVariantDataStringList -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxVariantDataStringList: public wxVariantData -{ -DECLARE_DYNAMIC_CLASS(wxVariantDataStringList) -public: - wxVariantDataStringList() {} - wxVariantDataStringList(const wxStringList& list) { m_value = list; } - - wxStringList& GetValue() const { return (wxStringList&) m_value; } - void SetValue(const wxStringList& value); - - virtual bool Eq(wxVariantData& data) const; -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; -#endif - virtual bool Write(wxString& str) const; -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); -#endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("stringlist"); }; - -protected: - wxStringList m_value; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxVariantDataStringList, wxVariantData) - -void wxVariantDataStringList::SetValue(const wxStringList& value) -{ - m_value = value; -} - -bool wxVariantDataStringList::Eq(wxVariantData& data) const -{ - wxASSERT_MSG( (data.GetType() == wxT("stringlist")), wxT("wxVariantDataStringList::Eq: argument mismatch") ); - - wxVariantDataStringList& listData = (wxVariantDataStringList&) data; - wxStringList::compatibility_iterator node1 = m_value.GetFirst(); - wxStringList::compatibility_iterator node2 = listData.GetValue().GetFirst(); - while (node1 && node2) - { - wxString str1 ( node1->GetData() ); - wxString str2 ( node2->GetData() ); - if (str1 != str2) - return false; - node1 = node1->GetNext(); - node2 = node2->GetNext(); - } - if (node1 || node2) return false; - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataStringList::Write(wxSTD ostream& str) const -{ - wxString s; - Write(s); - str << (const char*) s.mb_str(); - return true; -} -#endif - -bool wxVariantDataStringList::Write(wxString& str) const -{ - str.Empty(); - wxStringList::compatibility_iterator node = m_value.GetFirst(); - while (node) - { - const wxChar* s = node->GetData(); - if (node != m_value.GetFirst()) - str += wxT(" "); - str += s; - node = node->GetNext(); - } - - return true; -} - -#if wxUSE_STD_IOSTREAM -bool wxVariantDataStringList::Read(wxSTD istream& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); - // TODO - return false; -} -#endif - -bool wxVariantDataStringList::Read(wxString& WXUNUSED(str)) -{ - wxFAIL_MSG(wxT("Unimplemented")); - // TODO - return false; -} - -#endif //2.4 compat - -#if WXWIN_COMPATIBILITY_2_4 - -wxVariant::wxVariant(const wxStringList& val, const wxString& name) -{ - m_data = new wxVariantDataStringList(val); - m_name = name; -} - -bool wxVariant::operator== (const wxStringList& value) const -{ - wxASSERT_MSG( (GetType() == wxT("stringlist")), wxT("Invalid type for == operator") ); - - wxVariantDataStringList other(value); - return (GetData()->Eq(other)); -} - -bool wxVariant::operator!= (const wxStringList& value) const -{ - wxASSERT_MSG( (GetType() == wxT("stringlist")), wxT("Invalid type for == operator") ); - - wxVariantDataStringList other(value); - return !(GetData()->Eq(other)); -} - -void wxVariant::operator= (const wxStringList& value) -{ - if (GetType() == wxT("stringlist") && - m_data->GetRefCount() == 1) - { - ((wxVariantDataStringList*)GetData())->SetValue(value); - } - else - { - UnRef(); - m_data = new wxVariantDataStringList(value); - } -} - -// wxVariant - -wxStringList& wxVariant::GetStringList() const -{ - wxASSERT( (GetType() == wxT("stringlist")) ); - - return (wxStringList&) ((wxVariantDataStringList*) m_data)->GetValue(); -} - -#endif - -// Treat a list variant as an array -wxVariant wxVariant::operator[] (size_t idx) const -{ -#if WXWIN_COMPATIBILITY_2_4 - wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for array operator") ); -#else - wxASSERT_MSG( GetType() == wxT("list"), wxT("Invalid type for array operator") ); -#endif - - if (GetType() == wxT("list")) - { - wxVariantDataList* data = (wxVariantDataList*) m_data; - wxASSERT_MSG( (idx < data->GetValue().GetCount()), wxT("Invalid index for array") ); - return * (wxVariant*) (data->GetValue().Item(idx)->GetData()); - } -#if WXWIN_COMPATIBILITY_2_4 - else if (GetType() == wxT("stringlist")) - { - wxVariantDataStringList* data = (wxVariantDataStringList*) m_data; - wxASSERT_MSG( (idx < data->GetValue().GetCount()), wxT("Invalid index for array") ); - - wxString str( (const wxChar*) (data->GetValue().Item(idx)->GetData()) ); - wxVariant variant( str ); - return variant; - } -#endif - return wxNullVariant; -} - -wxVariant& wxVariant::operator[] (size_t idx) -{ - // We can't return a reference to a variant for a string list, since the string - // is actually stored as a char*, not a variant. - - wxASSERT_MSG( (GetType() == wxT("list")), wxT("Invalid type for array operator") ); - - wxVariantDataList* data = (wxVariantDataList*) m_data; - wxASSERT_MSG( (idx < data->GetValue().GetCount()), wxT("Invalid index for array") ); - - return * (wxVariant*) (data->GetValue().Item(idx)->GetData()); -} - -// Return the number of elements in a list -size_t wxVariant::GetCount() const -{ -#if WXWIN_COMPATIBILITY_2_4 - wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for GetCount()") ); -#else - wxASSERT_MSG( GetType() == wxT("list"), wxT("Invalid type for GetCount()") ); -#endif - - if (GetType() == wxT("list")) - { - wxVariantDataList* data = (wxVariantDataList*) m_data; - return data->GetValue().GetCount(); - } -#if WXWIN_COMPATIBILITY_2_4 - else if (GetType() == wxT("stringlist")) - { - wxVariantDataStringList* data = (wxVariantDataStringList*) m_data; - return data->GetValue().GetCount(); - } -#endif - return 0; -} - -// ---------------------------------------------------------------------------- -// Type conversion -// ---------------------------------------------------------------------------- - -bool wxVariant::Convert(long* value) const -{ - wxString type(GetType()); - if (type == wxT("double")) - *value = (long) (((wxVariantDoubleData*)GetData())->GetValue()); - else if (type == wxT("long")) - *value = ((wxVariantDataLong*)GetData())->GetValue(); -#ifdef HAVE_BOOL - else if (type == wxT("bool")) - *value = (long) (((wxVariantDataBool*)GetData())->GetValue()); -#endif - else if (type == wxT("string")) - *value = wxAtol((const wxChar*) ((wxVariantDataString*)GetData())->GetValue()); - else - return false; - - return true; -} - -bool wxVariant::Convert(bool* value) const -{ - wxString type(GetType()); - if (type == wxT("double")) - *value = ((int) (((wxVariantDoubleData*)GetData())->GetValue()) != 0); - else if (type == wxT("long")) - *value = (((wxVariantDataLong*)GetData())->GetValue() != 0); -#ifdef HAVE_BOOL - else if (type == wxT("bool")) - *value = ((wxVariantDataBool*)GetData())->GetValue(); -#endif - else if (type == wxT("string")) - { - wxString val(((wxVariantDataString*)GetData())->GetValue()); - val.MakeLower(); - if (val == wxT("true") || val == wxT("yes") || val == wxT('1') ) - *value = true; - else if (val == wxT("false") || val == wxT("no") || val == wxT('0') ) - *value = false; - else - return false; - } - else - return false; - - return true; -} - -bool wxVariant::Convert(double* value) const -{ - wxString type(GetType()); - if (type == wxT("double")) - *value = ((wxVariantDoubleData*)GetData())->GetValue(); - else if (type == wxT("long")) - *value = (double) (((wxVariantDataLong*)GetData())->GetValue()); -#ifdef HAVE_BOOL - else if (type == wxT("bool")) - *value = (double) (((wxVariantDataBool*)GetData())->GetValue()); -#endif - else if (type == wxT("string")) - *value = (double) wxAtof((const wxChar*) ((wxVariantDataString*)GetData())->GetValue()); - else - return false; - - return true; -} - -bool wxVariant::Convert(wxChar* value) const -{ - wxString type(GetType()); - if (type == wxT("char")) - *value = ((wxVariantDataChar*)GetData())->GetValue(); - else if (type == wxT("long")) - *value = (char) (((wxVariantDataLong*)GetData())->GetValue()); -#ifdef HAVE_BOOL - else if (type == wxT("bool")) - *value = (char) (((wxVariantDataBool*)GetData())->GetValue()); -#endif - else - return false; - - return true; -} - -bool wxVariant::Convert(wxString* value) const -{ - *value = MakeString(); - return true; -} - -#if wxUSE_DATETIME -bool wxVariant::Convert(wxDateTime* value) const -{ - wxString type(GetType()); - if (type == wxT("datetime")) - { - *value = ((wxVariantDataDateTime*)GetData())->GetValue(); - return true; - } - // Fallback to string conversion - wxString val; - return Convert(&val) && - (value->ParseDateTime(val) || value->ParseDate(val) || value->ParseTime(val)); -} -#endif // wxUSE_DATETIME - -#endif // wxUSE_VARIANT diff --git a/Source/3rdParty/wx/src/common/wfstream.cpp b/Source/3rdParty/wx/src/common/wfstream.cpp deleted file mode 100644 index c5fe73be6..000000000 --- a/Source/3rdParty/wx/src/common/wfstream.cpp +++ /dev/null @@ -1,418 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/fstream.cpp -// Purpose: "File stream" classes -// Author: Julian Smart -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: wfstream.cpp 54418 2008-06-29 01:28:43Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STREAMS - -#include "wx/wfstream.h" - -#ifndef WX_PRECOMP - #include "wx/stream.h" -#endif - -#include - -#if wxUSE_FILE - -// ---------------------------------------------------------------------------- -// wxFileInputStream -// ---------------------------------------------------------------------------- - -wxFileInputStream::wxFileInputStream(const wxString& fileName) - : wxInputStream() -{ - m_file = new wxFile(fileName, wxFile::read); - m_file_destroy = true; - if ( !m_file->IsOpened() ) - m_lasterror = wxSTREAM_READ_ERROR; -} - -wxFileInputStream::wxFileInputStream() - : wxInputStream() -{ - m_file_destroy = false; - m_file = NULL; -} - -wxFileInputStream::wxFileInputStream(wxFile& file) -{ - m_file = &file; - m_file_destroy = false; -} - -wxFileInputStream::wxFileInputStream(int fd) -{ - m_file = new wxFile(fd); - m_file_destroy = true; -} - -wxFileInputStream::~wxFileInputStream() -{ - if (m_file_destroy) - delete m_file; -} - -wxFileOffset wxFileInputStream::GetLength() const -{ - return m_file->Length(); -} - -size_t wxFileInputStream::OnSysRead(void *buffer, size_t size) -{ - ssize_t ret = m_file->Read(buffer, size); - - // NB: we can't use a switch here because HP-UX CC doesn't allow - // switching over long long (which size_t is in 64bit mode) - - if ( !ret ) - { - // nothing read, so nothing more to read - m_lasterror = wxSTREAM_EOF; - } - else if ( ret == wxInvalidOffset ) - { - m_lasterror = wxSTREAM_READ_ERROR; - ret = 0; - } - else - { - // normal case - m_lasterror = wxSTREAM_NO_ERROR; - } - - return ret; -} - -wxFileOffset wxFileInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_file->Seek(pos, mode); -} - -wxFileOffset wxFileInputStream::OnSysTell() const -{ - return m_file->Tell(); -} - -bool wxFileInputStream::IsOk() const -{ - return (wxStreamBase::IsOk() && m_file->IsOpened()); -} - -// ---------------------------------------------------------------------------- -// wxFileOutputStream -// ---------------------------------------------------------------------------- - -wxFileOutputStream::wxFileOutputStream(const wxString& fileName) -{ - m_file = new wxFile(fileName, wxFile::write); - m_file_destroy = true; - - if (!m_file->IsOpened()) - m_lasterror = wxSTREAM_WRITE_ERROR; -} - -wxFileOutputStream::wxFileOutputStream(wxFile& file) -{ - m_file = &file; - m_file_destroy = false; -} - -wxFileOutputStream::wxFileOutputStream() - : wxOutputStream() -{ - m_file_destroy = false; - m_file = NULL; -} - -wxFileOutputStream::wxFileOutputStream(int fd) -{ - m_file = new wxFile(fd); - m_file_destroy = true; -} - -wxFileOutputStream::~wxFileOutputStream() -{ - if (m_file_destroy) - { - Sync(); - delete m_file; - } -} - -size_t wxFileOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - size_t ret = m_file->Write(buffer, size); - - m_lasterror = m_file->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR; - - return ret; -} - -wxFileOffset wxFileOutputStream::OnSysTell() const -{ - return m_file->Tell(); -} - -wxFileOffset wxFileOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_file->Seek(pos, mode); -} - -void wxFileOutputStream::Sync() -{ - wxOutputStream::Sync(); - m_file->Flush(); -} - -wxFileOffset wxFileOutputStream::GetLength() const -{ - return m_file->Length(); -} - -bool wxFileOutputStream::IsOk() const -{ - return (wxStreamBase::IsOk() && m_file->IsOpened()); -} - -// ---------------------------------------------------------------------------- -// wxTempFileOutputStream -// ---------------------------------------------------------------------------- - -wxTempFileOutputStream::wxTempFileOutputStream(const wxString& fileName) -{ - m_file = new wxTempFile(fileName); - - if (!m_file->IsOpened()) - m_lasterror = wxSTREAM_WRITE_ERROR; -} - -wxTempFileOutputStream::~wxTempFileOutputStream() -{ - if (m_file->IsOpened()) - Discard(); - delete m_file; -} - -size_t wxTempFileOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - if (IsOk() && m_file->Write(buffer, size)) - return size; - m_lasterror = wxSTREAM_WRITE_ERROR; - return 0; -} - -// ---------------------------------------------------------------------------- -// wxFileStream -// ---------------------------------------------------------------------------- - -wxFileStream::wxFileStream(const wxString& fileName) - : wxFileInputStream(), - wxFileOutputStream() -{ - wxFileOutputStream::m_file = - wxFileInputStream::m_file = new wxFile(fileName, wxFile::read_write); - - // this is a bit ugly as streams are symmetric but we still have to delete - // the file we created above exactly once so we decide to (arbitrarily) do - // it in wxFileInputStream - wxFileInputStream::m_file_destroy = true; -} - -#endif //wxUSE_FILE - -#if wxUSE_FFILE - -// ---------------------------------------------------------------------------- -// wxFFileInputStream -// ---------------------------------------------------------------------------- - -wxFFileInputStream::wxFFileInputStream(const wxString& fileName, - const wxChar *mode) - : wxInputStream() -{ - m_file = new wxFFile(fileName, mode); - m_file_destroy = true; - - if (!m_file->IsOpened()) - m_lasterror = wxSTREAM_WRITE_ERROR; -} - -wxFFileInputStream::wxFFileInputStream() - : wxInputStream() -{ - m_file = NULL; - m_file_destroy = false; -} - -wxFFileInputStream::wxFFileInputStream(wxFFile& file) -{ - m_file = &file; - m_file_destroy = false; -} - -wxFFileInputStream::wxFFileInputStream(FILE *file) -{ - m_file = new wxFFile(file); - m_file_destroy = true; -} - -wxFFileInputStream::~wxFFileInputStream() -{ - if (m_file_destroy) - delete m_file; -} - -wxFileOffset wxFFileInputStream::GetLength() const -{ - return m_file->Length(); -} - -size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size) -{ - ssize_t ret = m_file->Read(buffer, size); - - // It is not safe to call Eof() if the file is not opened. - if (!m_file->IsOpened() || m_file->Eof()) - m_lasterror = wxSTREAM_EOF; - if (ret == wxInvalidOffset) - { - m_lasterror = wxSTREAM_READ_ERROR; - ret = 0; - } - - return ret; -} - -wxFileOffset wxFFileInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset; -} - -wxFileOffset wxFFileInputStream::OnSysTell() const -{ - return m_file->Tell(); -} - -bool wxFFileInputStream::IsOk() const -{ - return (wxStreamBase::IsOk() && m_file->IsOpened()); -} - -// ---------------------------------------------------------------------------- -// wxFFileOutputStream -// ---------------------------------------------------------------------------- - -wxFFileOutputStream::wxFFileOutputStream(const wxString& fileName, - const wxChar *mode) -{ - m_file = new wxFFile(fileName, mode); - m_file_destroy = true; - - if (!m_file->IsOpened()) - { - m_lasterror = wxSTREAM_WRITE_ERROR; - } - else - { - if (m_file->Error()) - m_lasterror = wxSTREAM_WRITE_ERROR; - } -} - -wxFFileOutputStream::wxFFileOutputStream(wxFFile& file) -{ - m_file = &file; - m_file_destroy = false; -} - -wxFFileOutputStream::wxFFileOutputStream() - : wxOutputStream() -{ - m_file = NULL; - m_file_destroy = false; -} - -wxFFileOutputStream::wxFFileOutputStream(FILE *file) -{ - m_file = new wxFFile(file); - m_file_destroy = true; -} - -wxFFileOutputStream::~wxFFileOutputStream() -{ - if (m_file_destroy) - { - Sync(); - delete m_file; - } -} - -size_t wxFFileOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - size_t ret = m_file->Write(buffer, size); - // It is not safe to call Error() if the file is not opened. - if (!m_file->IsOpened() || m_file->Error()) - m_lasterror = wxSTREAM_WRITE_ERROR; - else - m_lasterror = wxSTREAM_NO_ERROR; - return ret; -} - -wxFileOffset wxFFileOutputStream::OnSysTell() const -{ - return m_file->Tell(); -} - -wxFileOffset wxFFileOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) -{ - return m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset; -} - -void wxFFileOutputStream::Sync() -{ - wxOutputStream::Sync(); - m_file->Flush(); -} - -wxFileOffset wxFFileOutputStream::GetLength() const -{ - return m_file->Length(); -} - -bool wxFFileOutputStream::IsOk() const -{ - return (wxStreamBase::IsOk() && m_file->IsOpened()); -} - -// ---------------------------------------------------------------------------- -// wxFFileStream -// ---------------------------------------------------------------------------- - -wxFFileStream::wxFFileStream(const wxString& fileName) - : wxFFileInputStream(), - wxFFileOutputStream() -{ - wxFFileOutputStream::m_file = - wxFFileInputStream::m_file = new wxFFile(fileName, _T("w+b")); - - // see comment in wxFileStream ctor - wxFFileInputStream::m_file_destroy = true; -} - -#endif //wxUSE_FFILE - -#endif // wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/common/wincmn.cpp b/Source/3rdParty/wx/src/common/wincmn.cpp deleted file mode 100644 index 03394bf2b..000000000 --- a/Source/3rdParty/wx/src/common/wincmn.cpp +++ /dev/null @@ -1,3255 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/window.cpp -// Purpose: common (to all ports) wxWindow functions -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 13/07/98 -// RCS-ID: $Id: wincmn.cpp 63032 2009-12-31 13:37:24Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/frame.h" - #include "wx/window.h" - #include "wx/control.h" - #include "wx/checkbox.h" - #include "wx/radiobut.h" - #include "wx/statbox.h" - #include "wx/textctrl.h" - #include "wx/settings.h" - #include "wx/dialog.h" - #include "wx/msgdlg.h" - #include "wx/statusbr.h" - #include "wx/toolbar.h" - #include "wx/dcclient.h" - #include "wx/scrolbar.h" - #include "wx/layout.h" - #include "wx/sizer.h" -#endif //WX_PRECOMP - -#if wxUSE_DRAG_AND_DROP - #include "wx/dnd.h" -#endif // wxUSE_DRAG_AND_DROP - -#if wxUSE_ACCESSIBILITY - #include "wx/access.h" -#endif - -#if wxUSE_HELP - #include "wx/cshelp.h" -#endif // wxUSE_HELP - -#if wxUSE_TOOLTIPS - #include "wx/tooltip.h" -#endif // wxUSE_TOOLTIPS - -#if wxUSE_CARET - #include "wx/caret.h" -#endif // wxUSE_CARET - -#if wxUSE_SYSTEM_OPTIONS - #include "wx/sysopt.h" -#endif - -// For reporting compile- and runtime version of GTK+ in the ctrl+alt+mclick dialog. -// The gtk includes don't pull any other headers in, at least not on my system - MR -#ifdef __WXGTK__ - #ifdef __WXGTK20__ - #include - #else - #include - #endif - extern const unsigned int gtk_major_version; - extern const unsigned int gtk_minor_version; - extern const unsigned int gtk_micro_version; -#endif - -#include "wx/platinfo.h" - -// Windows List -WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows; - -// ---------------------------------------------------------------------------- -// static data -// ---------------------------------------------------------------------------- - -#if defined(__WXPALMOS__) -int wxWindowBase::ms_lastControlId = 32767; -#elif defined(__WXPM__) -int wxWindowBase::ms_lastControlId = 2000; -#else -int wxWindowBase::ms_lastControlId = -200; -#endif - -IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler) - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler) - EVT_SYS_COLOUR_CHANGED(wxWindowBase::OnSysColourChanged) - EVT_INIT_DIALOG(wxWindowBase::OnInitDialog) - EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick) - -#if wxUSE_HELP - EVT_HELP(wxID_ANY, wxWindowBase::OnHelp) -#endif // wxUSE_HELP - -END_EVENT_TABLE() - -// ============================================================================ -// implementation of the common functionality of the wxWindow class -// ============================================================================ - -// ---------------------------------------------------------------------------- -// initialization -// ---------------------------------------------------------------------------- - -// the default initialization -wxWindowBase::wxWindowBase() -{ - // no window yet, no parent nor children - m_parent = (wxWindow *)NULL; - m_windowId = wxID_ANY; - - // no constraints on the minimal window size - m_minWidth = - m_maxWidth = wxDefaultCoord; - m_minHeight = - m_maxHeight = wxDefaultCoord; - - // invalidiated cache value - m_bestSizeCache = wxDefaultSize; - - // window are created enabled and visible by default - m_isShown = - m_isEnabled = true; - - // the default event handler is just this window - m_eventHandler = this; - -#if wxUSE_VALIDATORS - // no validator - m_windowValidator = (wxValidator *) NULL; -#endif // wxUSE_VALIDATORS - - // the colours/fonts are default for now, so leave m_font, - // m_backgroundColour and m_foregroundColour uninitialized and set those - m_hasBgCol = - m_hasFgCol = - m_hasFont = false; - m_inheritBgCol = - m_inheritFgCol = - m_inheritFont = false; - - // no style bits - m_exStyle = - m_windowStyle = 0; - - m_backgroundStyle = wxBG_STYLE_SYSTEM; - -#if wxUSE_CONSTRAINTS - // no constraints whatsoever - m_constraints = (wxLayoutConstraints *) NULL; - m_constraintsInvolvedIn = (wxWindowList *) NULL; -#endif // wxUSE_CONSTRAINTS - - m_windowSizer = (wxSizer *) NULL; - m_containingSizer = (wxSizer *) NULL; - m_autoLayout = false; - -#if wxUSE_DRAG_AND_DROP - m_dropTarget = (wxDropTarget *)NULL; -#endif // wxUSE_DRAG_AND_DROP - -#if wxUSE_TOOLTIPS - m_tooltip = (wxToolTip *)NULL; -#endif // wxUSE_TOOLTIPS - -#if wxUSE_CARET - m_caret = (wxCaret *)NULL; -#endif // wxUSE_CARET - -#if wxUSE_PALETTE - m_hasCustomPalette = false; -#endif // wxUSE_PALETTE - -#if wxUSE_ACCESSIBILITY - m_accessible = NULL; -#endif - - m_virtualSize = wxDefaultSize; - - m_scrollHelper = (wxScrollHelper *) NULL; - - m_minVirtualWidth = - m_maxVirtualWidth = wxDefaultCoord; - m_minVirtualHeight = - m_maxVirtualHeight = wxDefaultCoord; - - m_windowVariant = wxWINDOW_VARIANT_NORMAL; -#if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption(wxWINDOW_DEFAULT_VARIANT) ) - { - m_windowVariant = (wxWindowVariant) wxSystemOptions::GetOptionInt( wxWINDOW_DEFAULT_VARIANT ) ; - } -#endif - - // Whether we're using the current theme for this window (wxGTK only for now) - m_themeEnabled = false; - - // VZ: this one shouldn't exist... - m_isBeingDeleted = false; -} - -// common part of window creation process -bool wxWindowBase::CreateBase(wxWindowBase *parent, - wxWindowID id, - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(size), - long style, - const wxValidator& wxVALIDATOR_PARAM(validator), - const wxString& name) -{ -#if wxUSE_STATBOX - // wxGTK doesn't allow to create controls with static box as the parent so - // this will result in a crash when the program is ported to wxGTK so warn - // the user about it - - // if you get this assert, the correct solution is to create the controls - // as siblings of the static box - wxASSERT_MSG( !parent || !wxDynamicCast(parent, wxStaticBox), - _T("wxStaticBox can't be used as a window parent!") ); -#endif // wxUSE_STATBOX - - // ids are limited to 16 bits under MSW so if you care about portability, - // it's not a good idea to use ids out of this range (and negative ids are - // reserved for wxWidgets own usage) - wxASSERT_MSG( id == wxID_ANY || (id >= 0 && id < 32767), - _T("invalid id value") ); - - // generate a new id if the user doesn't care about it - m_windowId = id == wxID_ANY ? NewControlId() : id; - - // don't use SetWindowStyleFlag() here, this function should only be called - // to change the flag after creation as it tries to reflect the changes in - // flags by updating the window dynamically and we don't need this here - m_windowStyle = style; - - SetName(name); - SetParent(parent); - -#if wxUSE_VALIDATORS - SetValidator(validator); -#endif // wxUSE_VALIDATORS - - // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to - // have it too - like this it's possible to set it only in the top level - // dialog/frame and all children will inherit it by defult - if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) ) - { - SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY); - } - - return true; -} - -bool wxWindowBase::ToggleWindowStyle(int flag) -{ - wxASSERT_MSG( flag, _T("flags with 0 value can't be toggled") ); - - bool rc; - long style = GetWindowStyleFlag(); - if ( style & flag ) - { - style &= ~flag; - rc = false; - } - else // currently off - { - style |= flag; - rc = true; - } - - SetWindowStyleFlag(style); - - return rc; -} - -// ---------------------------------------------------------------------------- -// destruction -// ---------------------------------------------------------------------------- - -// common clean up -wxWindowBase::~wxWindowBase() -{ - wxASSERT_MSG( GetCapture() != this, wxT("attempt to destroy window with mouse capture") ); - - // FIXME if these 2 cases result from programming errors in the user code - // we should probably assert here instead of silently fixing them - - // Just in case the window has been Closed, but we're then deleting - // immediately: don't leave dangling pointers. - wxPendingDelete.DeleteObject(this); - - // Just in case we've loaded a top-level window via LoadNativeDialog but - // we weren't a dialog class - wxTopLevelWindows.DeleteObject((wxWindow*)this); - - wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") ); - - // reset the top-level parent's default item if it is this widget - if ( m_parent ) - { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent((wxWindow*)this), - wxTopLevelWindow); - - if ( tlw ) - { - wxWindow* tmpDefaultItem = tlw->GetTmpDefaultItem(); - if ( tmpDefaultItem == this ) - tlw->SetTmpDefaultItem(NULL); - else if ( tmpDefaultItem ) - { - // A temporary default item masks the real default item, so - // temporarily unset the temporary default item so we can access the - // real default item. - tlw->SetTmpDefaultItem(NULL); - - if ( tlw->GetDefaultItem() == this ) - tlw->SetDefaultItem(NULL); - - // Set the temporary default item back. - tlw->SetTmpDefaultItem(tmpDefaultItem); - } - else if ( tlw->GetDefaultItem() == this ) - tlw->SetDefaultItem(NULL); - } - } - - // reset the dangling pointer our parent window may keep to us - if ( m_parent ) - { - m_parent->RemoveChild(this); - } - -#if wxUSE_CARET - delete m_caret; -#endif // wxUSE_CARET - -#if wxUSE_VALIDATORS - delete m_windowValidator; -#endif // wxUSE_VALIDATORS - -#if wxUSE_CONSTRAINTS - // Have to delete constraints/sizer FIRST otherwise sizers may try to look - // at deleted windows as they delete themselves. - DeleteRelatedConstraints(); - - if ( m_constraints ) - { - // This removes any dangling pointers to this window in other windows' - // constraintsInvolvedIn lists. - UnsetConstraints(m_constraints); - delete m_constraints; - m_constraints = NULL; - } -#endif // wxUSE_CONSTRAINTS - - if ( m_containingSizer ) - m_containingSizer->Detach( (wxWindow*)this ); - - delete m_windowSizer; - -#if wxUSE_DRAG_AND_DROP - delete m_dropTarget; -#endif // wxUSE_DRAG_AND_DROP - -#if wxUSE_TOOLTIPS - delete m_tooltip; -#endif // wxUSE_TOOLTIPS - -#if wxUSE_ACCESSIBILITY - delete m_accessible; -#endif - -#if wxUSE_HELP - // NB: this has to be called unconditionally, because we don't - // know whether this window has associated help text or not - wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider ) - helpProvider->RemoveHelp(this); -#endif -} - -void wxWindowBase::SendDestroyEvent() -{ - wxWindowDestroyEvent event; - event.SetEventObject(this); - event.SetId(GetId()); - GetEventHandler()->ProcessEvent(event); -} - -bool wxWindowBase::Destroy() -{ - delete this; - - return true; -} - -bool wxWindowBase::Close(bool force) -{ - wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); - event.SetEventObject(this); - event.SetCanVeto(!force); - - // return false if window wasn't closed because the application vetoed the - // close event - return GetEventHandler()->ProcessEvent(event) && !event.GetVeto(); -} - -bool wxWindowBase::DestroyChildren() -{ - wxWindowList::compatibility_iterator node; - for ( ;; ) - { - // we iterate until the list becomes empty - node = GetChildren().GetFirst(); - if ( !node ) - break; - - wxWindow *child = node->GetData(); - - // note that we really want to call delete and not ->Destroy() here - // because we want to delete the child immediately, before we are - // deleted, and delayed deletion would result in problems as our (top - // level) child could outlive its parent - delete child; - - wxASSERT_MSG( !GetChildren().Find(child), - wxT("child didn't remove itself using RemoveChild()") ); - } - - return true; -} - -// ---------------------------------------------------------------------------- -// size/position related methods -// ---------------------------------------------------------------------------- - -// centre the window with respect to its parent in either (or both) directions -void wxWindowBase::DoCentre(int dir) -{ - wxCHECK_RET( !(dir & wxCENTRE_ON_SCREEN) && GetParent(), - _T("this method only implements centering child windows") ); - - SetSize(GetRect().CentreIn(GetParent()->GetClientSize(), dir)); -} - -// fits the window around the children -void wxWindowBase::Fit() -{ - if ( !GetChildren().empty() ) - { - SetSize(GetBestSize()); - } - //else: do nothing if we have no children -} - -// fits virtual size (ie. scrolled area etc.) around children -void wxWindowBase::FitInside() -{ - if ( GetChildren().GetCount() > 0 ) - { - SetVirtualSize( GetBestVirtualSize() ); - } -} - -// On Mac, scrollbars are explicitly children. -#ifdef __WXMAC__ -static bool wxHasRealChildren(const wxWindowBase* win) -{ - int realChildCount = 0; - - for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *win = node->GetData(); - if ( !win->IsTopLevel() && win->IsShown() && !win->IsKindOf(CLASSINFO(wxScrollBar))) - realChildCount ++; - } - return (realChildCount > 0); -} -#endif - -void wxWindowBase::InvalidateBestSize() -{ - m_bestSizeCache = wxDefaultSize; - - // parent's best size calculation may depend on its children's - // as long as child window we are in is not top level window itself - // (because the TLW size is never resized automatically) - // so let's invalidate it as well to be safe: - if (m_parent && !IsTopLevel()) - m_parent->InvalidateBestSize(); -} - -// return the size best suited for the current window -wxSize wxWindowBase::DoGetBestSize() const -{ - wxSize best; - - if ( m_windowSizer ) - { - // Adjust to window size, since the return value of GetWindowSizeForVirtualSize is - // expressed in window and not client size - wxSize minSize = m_windowSizer->GetMinSize(); - wxSize size(GetSize()); - wxSize clientSize(GetClientSize()); - - wxSize minWindowSize(minSize.x + size.x - clientSize.x, - minSize.y + size.y - clientSize.y); - - best = GetWindowSizeForVirtualSize(minWindowSize); - - return best; - } -#if wxUSE_CONSTRAINTS - else if ( m_constraints ) - { - wxConstCast(this, wxWindowBase)->SatisfyConstraints(); - - // our minimal acceptable size is such that all our windows fit inside - int maxX = 0, - maxY = 0; - - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxLayoutConstraints *c = node->GetData()->GetConstraints(); - if ( !c ) - { - // it's not normal that we have an unconstrained child, but - // what can we do about it? - continue; - } - - int x = c->right.GetValue(), - y = c->bottom.GetValue(); - - if ( x > maxX ) - maxX = x; - - if ( y > maxY ) - maxY = y; - - // TODO: we must calculate the overlaps somehow, otherwise we - // will never return a size bigger than the current one :-( - } - - best = wxSize(maxX, maxY); - } -#endif // wxUSE_CONSTRAINTS - else if ( !GetChildren().empty() -#ifdef __WXMAC__ - && wxHasRealChildren(this) -#endif - ) - { - // our minimal acceptable size is such that all our visible child - // windows fit inside - int maxX = 0, - maxY = 0; - - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *win = node->GetData(); - if ( win->IsTopLevel() - || !win->IsShown() -#if wxUSE_STATUSBAR - || wxDynamicCast(win, wxStatusBar) -#endif // wxUSE_STATUSBAR - ) - { - // dialogs and frames lie in different top level windows - - // don't deal with them here; as for the status bars, they - // don't lie in the client area at all - continue; - } - - int wx, wy, ww, wh; - win->GetPosition(&wx, &wy); - - // if the window hadn't been positioned yet, assume that it is in - // the origin - if ( wx == wxDefaultCoord ) - wx = 0; - if ( wy == wxDefaultCoord ) - wy = 0; - - win->GetSize(&ww, &wh); - if ( wx + ww > maxX ) - maxX = wx + ww; - if ( wy + wh > maxY ) - maxY = wy + wh; - } - - best = wxSize(maxX, maxY); - } - else // ! has children - { - // for a generic window there is no natural best size so, if the - // minimal size is not set, use the current size but take care to - // remember it as minimal size for the next time because our best size - // should be constant: otherwise we could get into a situation when the - // window is initially at some size, then expanded to a larger size and - // then, when the containing window is shrunk back (because our initial - // best size had been used for computing the parent min size), we can't - // be shrunk back any more because our best size is now bigger - wxSize size = GetMinSize(); - if ( !size.IsFullySpecified() ) - { - size.SetDefaults(GetSize()); - wxConstCast(this, wxWindowBase)->SetMinSize(size); - } - - // return as-is, unadjusted by the client size difference. - return size; - } - - // Add any difference between size and client size - wxSize diff = GetSize() - GetClientSize(); - best.x += wxMax(0, diff.x); - best.y += wxMax(0, diff.y); - - return best; -} - -// helper of GetWindowBorderSize(): as many ports don't implement support for -// wxSYS_BORDER/EDGE_X/Y metrics in their wxSystemSettings, use hard coded -// fallbacks in this case -static int wxGetMetricOrDefault(wxSystemMetric what) -{ - int rc = wxSystemSettings::GetMetric(what); - if ( rc == -1 ) - { - switch ( what ) - { - case wxSYS_BORDER_X: - case wxSYS_BORDER_Y: - // 2D border is by default 1 pixel wide - rc = 1; - break; - - case wxSYS_EDGE_X: - case wxSYS_EDGE_Y: - // 3D borders are by default 2 pixels - rc = 2; - break; - - default: - wxFAIL_MSG( _T("unexpected wxGetMetricOrDefault() argument") ); - rc = 0; - } - } - - return rc; -} - -wxSize wxWindowBase::GetWindowBorderSize() const -{ - wxSize size; - - switch ( GetBorder() ) - { - case wxBORDER_NONE: - // nothing to do, size is already (0, 0) - break; - - case wxBORDER_SIMPLE: - case wxBORDER_STATIC: - size.x = wxGetMetricOrDefault(wxSYS_BORDER_X); - size.y = wxGetMetricOrDefault(wxSYS_BORDER_Y); - break; - - case wxBORDER_SUNKEN: - case wxBORDER_RAISED: - size.x = wxMax(wxGetMetricOrDefault(wxSYS_EDGE_X), - wxGetMetricOrDefault(wxSYS_BORDER_X)); - size.y = wxMax(wxGetMetricOrDefault(wxSYS_EDGE_Y), - wxGetMetricOrDefault(wxSYS_BORDER_Y)); - break; - - case wxBORDER_DOUBLE: - size.x = wxGetMetricOrDefault(wxSYS_EDGE_X) + - wxGetMetricOrDefault(wxSYS_BORDER_X); - size.y = wxGetMetricOrDefault(wxSYS_EDGE_Y) + - wxGetMetricOrDefault(wxSYS_BORDER_Y); - break; - - default: - wxFAIL_MSG(_T("Unknown border style.")); - break; - } - - // we have borders on both sides - return size*2; -} - -wxSize wxWindowBase::GetEffectiveMinSize() const -{ - // merge the best size with the min size, giving priority to the min size - wxSize min = GetMinSize(); - if (min.x == wxDefaultCoord || min.y == wxDefaultCoord) - { - wxSize best = GetBestSize(); - if (min.x == wxDefaultCoord) min.x = best.x; - if (min.y == wxDefaultCoord) min.y = best.y; - } - return min; -} - - -void wxWindowBase::SetInitialSize(const wxSize& size) -{ - // Set the min size to the size passed in. This will usually either be - // wxDefaultSize or the size passed to this window's ctor/Create function. - SetMinSize(size); - - // Merge the size with the best size if needed - wxSize best = GetEffectiveMinSize(); - - // If the current size doesn't match then change it - if (GetSize() != best) - SetSize(best); -} - - -// by default the origin is not shifted -wxPoint wxWindowBase::GetClientAreaOrigin() const -{ - return wxPoint(0,0); -} - -wxSize wxWindowBase::ClientToWindowSize(const wxSize& size) const -{ - const wxSize diff(GetSize() - GetClientSize()); - - return wxSize(size.x == -1 ? -1 : size.x + diff.x, - size.y == -1 ? -1 : size.y + diff.y); -} - -wxSize wxWindowBase::WindowToClientSize(const wxSize& size) const -{ - const wxSize diff(GetSize() - GetClientSize()); - - return wxSize(size.x == -1 ? -1 : size.x - diff.x, - size.y == -1 ? -1 : size.y - diff.y); -} - -void wxWindowBase::SetWindowVariant( wxWindowVariant variant ) -{ - if ( m_windowVariant != variant ) - { - m_windowVariant = variant; - - DoSetWindowVariant(variant); - } -} - -void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant ) -{ - // adjust the font height to correspond to our new variant (notice that - // we're only called if something really changed) - wxFont font = GetFont(); - int size = font.GetPointSize(); - switch ( variant ) - { - case wxWINDOW_VARIANT_NORMAL: - break; - - case wxWINDOW_VARIANT_SMALL: - size *= 3; - size /= 4; - break; - - case wxWINDOW_VARIANT_MINI: - size *= 2; - size /= 3; - break; - - case wxWINDOW_VARIANT_LARGE: - size *= 5; - size /= 4; - break; - - default: - wxFAIL_MSG(_T("unexpected window variant")); - break; - } - - font.SetPointSize(size); - SetFont(font); -} - -void wxWindowBase::DoSetSizeHints( int minW, int minH, - int maxW, int maxH, - int WXUNUSED(incW), int WXUNUSED(incH) ) -{ - wxCHECK_RET( (minW == wxDefaultCoord || maxW == wxDefaultCoord || minW <= maxW) && - (minH == wxDefaultCoord || maxH == wxDefaultCoord || minH <= maxH), - _T("min width/height must be less than max width/height!") ); - - m_minWidth = minW; - m_maxWidth = maxW; - m_minHeight = minH; - m_maxHeight = maxH; -} - - -void wxWindowBase::SetVirtualSizeHints( int minW, int minH, - int maxW, int maxH ) -{ - m_minVirtualWidth = minW; - m_maxVirtualWidth = maxW; - m_minVirtualHeight = minH; - m_maxVirtualHeight = maxH; -} - -void wxWindowBase::DoSetVirtualSize( int x, int y ) -{ - if ( m_minVirtualWidth != wxDefaultCoord && m_minVirtualWidth > x ) - x = m_minVirtualWidth; - if ( m_maxVirtualWidth != wxDefaultCoord && m_maxVirtualWidth < x ) - x = m_maxVirtualWidth; - if ( m_minVirtualHeight != wxDefaultCoord && m_minVirtualHeight > y ) - y = m_minVirtualHeight; - if ( m_maxVirtualHeight != wxDefaultCoord && m_maxVirtualHeight < y ) - y = m_maxVirtualHeight; - - m_virtualSize = wxSize(x, y); -} - -wxSize wxWindowBase::DoGetVirtualSize() const -{ - // we should use the entire client area so if it is greater than our - // virtual size, expand it to fit (otherwise if the window is big enough we - // wouldn't be using parts of it) - wxSize size = GetClientSize(); - if ( m_virtualSize.x > size.x ) - size.x = m_virtualSize.x; - - if ( m_virtualSize.y >= size.y ) - size.y = m_virtualSize.y; - - return size; -} - -void wxWindowBase::DoGetScreenPosition(int *x, int *y) const -{ - // screen position is the same as (0, 0) in client coords for non TLWs (and - // TLWs override this method) - if ( x ) - *x = 0; - if ( y ) - *y = 0; - - ClientToScreen(x, y); -} - -// ---------------------------------------------------------------------------- -// show/hide/enable/disable the window -// ---------------------------------------------------------------------------- - -bool wxWindowBase::Show(bool show) -{ - if ( show != m_isShown ) - { - m_isShown = show; - - return true; - } - else - { - return false; - } -} - -bool wxWindowBase::Enable(bool enable) -{ - if ( enable != m_isEnabled ) - { - m_isEnabled = enable; - - return true; - } - else - { - return false; - } -} - -bool wxWindowBase::IsShownOnScreen() const -{ - // A window is shown on screen if it itself is shown and so are all its - // parents. But if a window is toplevel one, then its always visible on - // screen if IsShown() returns true, even if it has a hidden parent. - return IsShown() && - (IsTopLevel() || !GetParent() || GetParent()->IsShownOnScreen()); -} - -// ---------------------------------------------------------------------------- -// RTTI -// ---------------------------------------------------------------------------- - -bool wxWindowBase::IsTopLevel() const -{ - return false; -} - -// ---------------------------------------------------------------------------- -// reparenting the window -// ---------------------------------------------------------------------------- - -void wxWindowBase::AddChild(wxWindowBase *child) -{ - wxCHECK_RET( child, wxT("can't add a NULL child") ); - - // this should never happen and it will lead to a crash later if it does - // because RemoveChild() will remove only one node from the children list - // and the other(s) one(s) will be left with dangling pointers in them - wxASSERT_MSG( !GetChildren().Find((wxWindow*)child), _T("AddChild() called twice") ); - - GetChildren().Append((wxWindow*)child); - child->SetParent(this); -} - -void wxWindowBase::RemoveChild(wxWindowBase *child) -{ - wxCHECK_RET( child, wxT("can't remove a NULL child") ); - - GetChildren().DeleteObject((wxWindow *)child); - child->SetParent(NULL); -} - -bool wxWindowBase::Reparent(wxWindowBase *newParent) -{ - wxWindow *oldParent = GetParent(); - if ( newParent == oldParent ) - { - // nothing done - return false; - } - - // unlink this window from the existing parent. - if ( oldParent ) - { - oldParent->RemoveChild(this); - } - else - { - wxTopLevelWindows.DeleteObject((wxWindow *)this); - } - - // add it to the new one - if ( newParent ) - { - newParent->AddChild(this); - } - else - { - wxTopLevelWindows.Append((wxWindow *)this); - } - - return true; -} - -// ---------------------------------------------------------------------------- -// event handler stuff -// ---------------------------------------------------------------------------- - -void wxWindowBase::PushEventHandler(wxEvtHandler *handler) -{ - wxEvtHandler *handlerOld = GetEventHandler(); - - handler->SetNextHandler(handlerOld); - - if ( handlerOld ) - GetEventHandler()->SetPreviousHandler(handler); - - SetEventHandler(handler); -} - -wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler) -{ - wxEvtHandler *handlerA = GetEventHandler(); - if ( handlerA ) - { - wxEvtHandler *handlerB = handlerA->GetNextHandler(); - handlerA->SetNextHandler((wxEvtHandler *)NULL); - - if ( handlerB ) - handlerB->SetPreviousHandler((wxEvtHandler *)NULL); - SetEventHandler(handlerB); - - if ( deleteHandler ) - { - delete handlerA; - handlerA = (wxEvtHandler *)NULL; - } - } - - return handlerA; -} - -bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler) -{ - wxCHECK_MSG( handler, false, _T("RemoveEventHandler(NULL) called") ); - - wxEvtHandler *handlerPrev = NULL, - *handlerCur = GetEventHandler(); - while ( handlerCur ) - { - wxEvtHandler *handlerNext = handlerCur->GetNextHandler(); - - if ( handlerCur == handler ) - { - if ( handlerPrev ) - { - handlerPrev->SetNextHandler(handlerNext); - } - else - { - SetEventHandler(handlerNext); - } - - if ( handlerNext ) - { - handlerNext->SetPreviousHandler ( handlerPrev ); - } - - handler->SetNextHandler(NULL); - handler->SetPreviousHandler(NULL); - - return true; - } - - handlerPrev = handlerCur; - handlerCur = handlerNext; - } - - wxFAIL_MSG( _T("where has the event handler gone?") ); - - return false; -} - -// ---------------------------------------------------------------------------- -// colours, fonts &c -// ---------------------------------------------------------------------------- - -void wxWindowBase::InheritAttributes() -{ - const wxWindowBase * const parent = GetParent(); - if ( !parent ) - return; - - // we only inherit attributes which had been explicitly set for the parent - // which ensures that this only happens if the user really wants it and - // not by default which wouldn't make any sense in modern GUIs where the - // controls don't all use the same fonts (nor colours) - if ( parent->m_inheritFont && !m_hasFont ) - SetFont(parent->GetFont()); - - // in addition, there is a possibility to explicitly forbid inheriting - // colours at each class level by overriding ShouldInheritColours() - if ( ShouldInheritColours() ) - { - if ( parent->m_inheritFgCol && !m_hasFgCol ) - SetForegroundColour(parent->GetForegroundColour()); - - // inheriting (solid) background colour is wrong as it totally breaks - // any kind of themed backgrounds - // - // instead, the controls should use the same background as their parent - // (ideally by not drawing it at all) -#if 0 - if ( parent->m_inheritBgCol && !m_hasBgCol ) - SetBackgroundColour(parent->GetBackgroundColour()); -#endif // 0 - } -} - -/* static */ wxVisualAttributes -wxWindowBase::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - // it is important to return valid values for all attributes from here, - // GetXXX() below rely on this - wxVisualAttributes attrs; - attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - - // On Smartphone/PocketPC, wxSYS_COLOUR_WINDOW is a better reflection of - // the usual background colour than wxSYS_COLOUR_BTNFACE. - // It's a pity that wxSYS_COLOUR_WINDOW isn't always a suitable background - // colour on other platforms. - -#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#else - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); -#endif - return attrs; -} - -wxColour wxWindowBase::GetBackgroundColour() const -{ - if ( !m_backgroundColour.Ok() ) - { - wxASSERT_MSG( !m_hasBgCol, _T("we have invalid explicit bg colour?") ); - - // get our default background colour - wxColour colBg = GetDefaultAttributes().colBg; - - // we must return some valid colour to avoid redoing this every time - // and also to avoid surprizing the applications written for older - // wxWidgets versions where GetBackgroundColour() always returned - // something -- so give them something even if it doesn't make sense - // for this window (e.g. it has a themed background) - if ( !colBg.Ok() ) - colBg = GetClassDefaultAttributes().colBg; - - return colBg; - } - else - return m_backgroundColour; -} - -wxColour wxWindowBase::GetForegroundColour() const -{ - // logic is the same as above - if ( !m_hasFgCol && !m_foregroundColour.Ok() ) - { - wxASSERT_MSG( !m_hasFgCol, _T("we have invalid explicit fg colour?") ); - - wxColour colFg = GetDefaultAttributes().colFg; - - if ( !colFg.Ok() ) - colFg = GetClassDefaultAttributes().colFg; - - return colFg; - } - else - return m_foregroundColour; -} - -bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) -{ - if ( colour == m_backgroundColour ) - return false; - - m_hasBgCol = colour.Ok(); - if ( m_backgroundStyle != wxBG_STYLE_CUSTOM ) - m_backgroundStyle = m_hasBgCol ? wxBG_STYLE_COLOUR : wxBG_STYLE_SYSTEM; - - m_inheritBgCol = m_hasBgCol; - m_backgroundColour = colour; - SetThemeEnabled( !m_hasBgCol && !m_foregroundColour.Ok() ); - return true; -} - -bool wxWindowBase::SetForegroundColour( const wxColour &colour ) -{ - if (colour == m_foregroundColour ) - return false; - - m_hasFgCol = colour.Ok(); - m_inheritFgCol = m_hasFgCol; - m_foregroundColour = colour; - SetThemeEnabled( !m_hasFgCol && !m_backgroundColour.Ok() ); - return true; -} - -bool wxWindowBase::SetCursor(const wxCursor& cursor) -{ - // setting an invalid cursor is ok, it means that we don't have any special - // cursor - if ( m_cursor.IsSameAs(cursor) ) - { - // no change - return false; - } - - m_cursor = cursor; - - return true; -} - -wxFont wxWindowBase::GetFont() const -{ - // logic is the same as in GetBackgroundColour() - if ( !m_font.Ok() ) - { - wxASSERT_MSG( !m_hasFont, _T("we have invalid explicit font?") ); - - wxFont font = GetDefaultAttributes().font; - if ( !font.Ok() ) - font = GetClassDefaultAttributes().font; - - return font; - } - else - return m_font; -} - -bool wxWindowBase::SetFont(const wxFont& font) -{ - if ( font == m_font ) - { - // no change - return false; - } - - m_font = font; - m_hasFont = font.Ok(); - m_inheritFont = m_hasFont; - - InvalidateBestSize(); - - return true; -} - -#if wxUSE_PALETTE - -void wxWindowBase::SetPalette(const wxPalette& pal) -{ - m_hasCustomPalette = true; - m_palette = pal; - - // VZ: can anyone explain me what do we do here? - wxWindowDC d((wxWindow *) this); - d.SetPalette(pal); -} - -wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const -{ - wxWindow *win = (wxWindow *)this; - while ( win && !win->HasCustomPalette() ) - { - win = win->GetParent(); - } - - return win; -} - -#endif // wxUSE_PALETTE - -#if wxUSE_CARET -void wxWindowBase::SetCaret(wxCaret *caret) -{ - if ( m_caret ) - { - delete m_caret; - } - - m_caret = caret; - - if ( m_caret ) - { - wxASSERT_MSG( m_caret->GetWindow() == this, - wxT("caret should be created associated to this window") ); - } -} -#endif // wxUSE_CARET - -#if wxUSE_VALIDATORS -// ---------------------------------------------------------------------------- -// validators -// ---------------------------------------------------------------------------- - -void wxWindowBase::SetValidator(const wxValidator& validator) -{ - if ( m_windowValidator ) - delete m_windowValidator; - - m_windowValidator = (wxValidator *)validator.Clone(); - - if ( m_windowValidator ) - m_windowValidator->SetWindow(this); -} -#endif // wxUSE_VALIDATORS - -// ---------------------------------------------------------------------------- -// update region stuff -// ---------------------------------------------------------------------------- - -wxRect wxWindowBase::GetUpdateClientRect() const -{ - wxRegion rgnUpdate = GetUpdateRegion(); - rgnUpdate.Intersect(GetClientRect()); - wxRect rectUpdate = rgnUpdate.GetBox(); - wxPoint ptOrigin = GetClientAreaOrigin(); - rectUpdate.x -= ptOrigin.x; - rectUpdate.y -= ptOrigin.y; - - return rectUpdate; -} - -bool wxWindowBase::DoIsExposed(int x, int y) const -{ - return m_updateRegion.Contains(x, y) != wxOutRegion; -} - -bool wxWindowBase::DoIsExposed(int x, int y, int w, int h) const -{ - return m_updateRegion.Contains(x, y, w, h) != wxOutRegion; -} - -void wxWindowBase::ClearBackground() -{ - // wxGTK uses its own version, no need to add never used code -#ifndef __WXGTK__ - wxClientDC dc((wxWindow *)this); - wxBrush brush(GetBackgroundColour(), wxSOLID); - dc.SetBackground(brush); - dc.Clear(); -#endif // __WXGTK__ -} - -// ---------------------------------------------------------------------------- -// find child window by id or name -// ---------------------------------------------------------------------------- - -wxWindow *wxWindowBase::FindWindow(long id) const -{ - if ( id == m_windowId ) - return (wxWindow *)this; - - wxWindowBase *res = (wxWindow *)NULL; - wxWindowList::compatibility_iterator node; - for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) - { - wxWindowBase *child = node->GetData(); - res = child->FindWindow( id ); - } - - return (wxWindow *)res; -} - -wxWindow *wxWindowBase::FindWindow(const wxString& name) const -{ - if ( name == m_windowName ) - return (wxWindow *)this; - - wxWindowBase *res = (wxWindow *)NULL; - wxWindowList::compatibility_iterator node; - for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - res = child->FindWindow(name); - } - - return (wxWindow *)res; -} - - -// find any window by id or name or label: If parent is non-NULL, look through -// children for a label or title matching the specified string. If NULL, look -// through all top-level windows. -// -// to avoid duplicating code we reuse the same helper function but with -// different comparators - -typedef bool (*wxFindWindowCmp)(const wxWindow *win, - const wxString& label, long id); - -static -bool wxFindWindowCmpLabels(const wxWindow *win, const wxString& label, - long WXUNUSED(id)) -{ - return win->GetLabel() == label; -} - -static -bool wxFindWindowCmpNames(const wxWindow *win, const wxString& label, - long WXUNUSED(id)) -{ - return win->GetName() == label; -} - -static -bool wxFindWindowCmpIds(const wxWindow *win, const wxString& WXUNUSED(label), - long id) -{ - return win->GetId() == id; -} - -// recursive helper for the FindWindowByXXX() functions -static -wxWindow *wxFindWindowRecursively(const wxWindow *parent, - const wxString& label, - long id, - wxFindWindowCmp cmp) -{ - if ( parent ) - { - // see if this is the one we're looking for - if ( (*cmp)(parent, label, id) ) - return (wxWindow *)parent; - - // It wasn't, so check all its children - for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - // recursively check each child - wxWindow *win = (wxWindow *)node->GetData(); - wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp); - if (retwin) - return retwin; - } - } - - // Not found - return NULL; -} - -// helper for FindWindowByXXX() -static -wxWindow *wxFindWindowHelper(const wxWindow *parent, - const wxString& label, - long id, - wxFindWindowCmp cmp) -{ - if ( parent ) - { - // just check parent and all its children - return wxFindWindowRecursively(parent, label, id, cmp); - } - - // start at very top of wx's windows - for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); - node; - node = node->GetNext() ) - { - // recursively check each window & its children - wxWindow *win = node->GetData(); - wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp); - if (retwin) - return retwin; - } - - return NULL; -} - -/* static */ -wxWindow * -wxWindowBase::FindWindowByLabel(const wxString& title, const wxWindow *parent) -{ - return wxFindWindowHelper(parent, title, 0, wxFindWindowCmpLabels); -} - -/* static */ -wxWindow * -wxWindowBase::FindWindowByName(const wxString& title, const wxWindow *parent) -{ - wxWindow *win = wxFindWindowHelper(parent, title, 0, wxFindWindowCmpNames); - - if ( !win ) - { - // fall back to the label - win = FindWindowByLabel(title, parent); - } - - return win; -} - -/* static */ -wxWindow * -wxWindowBase::FindWindowById( long id, const wxWindow* parent ) -{ - return wxFindWindowHelper(parent, wxEmptyString, id, wxFindWindowCmpIds); -} - -// ---------------------------------------------------------------------------- -// dialog oriented functions -// ---------------------------------------------------------------------------- - -void wxWindowBase::MakeModal(bool modal) -{ - // Disable all other windows - if ( IsTopLevel() ) - { - wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); - while (node) - { - wxWindow *win = node->GetData(); - if (win != this) - win->Enable(!modal); - - node = node->GetNext(); - } - } -} - -bool wxWindowBase::Validate() -{ -#if wxUSE_VALIDATORS - bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; - - wxWindowList::compatibility_iterator node; - for ( node = m_children.GetFirst(); node; node = node->GetNext() ) - { - wxWindowBase *child = node->GetData(); - wxValidator *validator = child->GetValidator(); - if ( validator && !validator->Validate((wxWindow *)this) ) - { - return false; - } - - if ( recurse && !child->Validate() ) - { - return false; - } - } -#endif // wxUSE_VALIDATORS - - return true; -} - -bool wxWindowBase::TransferDataToWindow() -{ -#if wxUSE_VALIDATORS - bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; - - wxWindowList::compatibility_iterator node; - for ( node = m_children.GetFirst(); node; node = node->GetNext() ) - { - wxWindowBase *child = node->GetData(); - wxValidator *validator = child->GetValidator(); - if ( validator && !validator->TransferToWindow() ) - { - wxLogWarning(_("Could not transfer data to window")); -#if wxUSE_LOG - wxLog::FlushActive(); -#endif // wxUSE_LOG - - return false; - } - - if ( recurse ) - { - if ( !child->TransferDataToWindow() ) - { - // warning already given - return false; - } - } - } -#endif // wxUSE_VALIDATORS - - return true; -} - -bool wxWindowBase::TransferDataFromWindow() -{ -#if wxUSE_VALIDATORS - bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; - - wxWindowList::compatibility_iterator node; - for ( node = m_children.GetFirst(); node; node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - wxValidator *validator = child->GetValidator(); - if ( validator && !validator->TransferFromWindow() ) - { - // nop warning here because the application is supposed to give - // one itself - we don't know here what might have gone wrongly - - return false; - } - - if ( recurse ) - { - if ( !child->TransferDataFromWindow() ) - { - // warning already given - return false; - } - } - } -#endif // wxUSE_VALIDATORS - - return true; -} - -void wxWindowBase::InitDialog() -{ - wxInitDialogEvent event(GetId()); - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event); -} - -// ---------------------------------------------------------------------------- -// context-sensitive help support -// ---------------------------------------------------------------------------- - -#if wxUSE_HELP - -// associate this help text with this window -void wxWindowBase::SetHelpText(const wxString& text) -{ - wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider ) - { - helpProvider->AddHelp(this, text); - } -} - -// associate this help text with all windows with the same id as this -// one -void wxWindowBase::SetHelpTextForId(const wxString& text) -{ - wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider ) - { - helpProvider->AddHelp(GetId(), text); - } -} - -// get the help string associated with this window (may be empty) -// default implementation forwards calls to the help provider -wxString -wxWindowBase::GetHelpTextAtPoint(const wxPoint & WXUNUSED(pt), - wxHelpEvent::Origin WXUNUSED(origin)) const -{ - wxString text; - wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider ) - { - text = helpProvider->GetHelp(this); - } - - return text; -} - -// show help for this window -void wxWindowBase::OnHelp(wxHelpEvent& event) -{ - wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider ) - { - wxPoint pos = event.GetPosition(); - const wxHelpEvent::Origin origin = event.GetOrigin(); - if ( origin == wxHelpEvent::Origin_Keyboard ) - { - // if the help event was generated from keyboard it shouldn't - // appear at the mouse position (which is still the only position - // associated with help event) if the mouse is far away, although - // we still do use the mouse position if it's over the window - // because we suppose the user looks approximately at the mouse - // already and so it would be more convenient than showing tooltip - // at some arbitrary position which can be quite far from it - const wxRect rectClient = GetClientRect(); - if ( !rectClient.Contains(ScreenToClient(pos)) ) - { - // position help slightly under and to the right of this window - pos = ClientToScreen(wxPoint( - 2*GetCharWidth(), - rectClient.height + GetCharHeight() - )); - } - } - - if ( helpProvider->ShowHelpAtPoint(this, pos, origin) ) - { - // skip the event.Skip() below - return; - } - } - - event.Skip(); -} - -#endif // wxUSE_HELP - -// ---------------------------------------------------------------------------- -// tooltips -// ---------------------------------------------------------------------------- - -#if wxUSE_TOOLTIPS - -void wxWindowBase::SetToolTip( const wxString &tip ) -{ - // don't create the new tooltip if we already have one - if ( m_tooltip ) - { - m_tooltip->SetTip( tip ); - } - else - { - SetToolTip( new wxToolTip( tip ) ); - } - - // setting empty tooltip text does not remove the tooltip any more - use - // SetToolTip((wxToolTip *)NULL) for this -} - -void wxWindowBase::DoSetToolTip(wxToolTip *tooltip) -{ - if ( m_tooltip != tooltip ) - { - if ( m_tooltip ) - delete m_tooltip; - - m_tooltip = tooltip; - } -} - -#endif // wxUSE_TOOLTIPS - -// ---------------------------------------------------------------------------- -// constraints and sizers -// ---------------------------------------------------------------------------- - -#if wxUSE_CONSTRAINTS - -void wxWindowBase::SetConstraints( wxLayoutConstraints *constraints ) -{ - if ( m_constraints ) - { - UnsetConstraints(m_constraints); - delete m_constraints; - } - m_constraints = constraints; - if ( m_constraints ) - { - // Make sure other windows know they're part of a 'meaningful relationship' - if ( m_constraints->left.GetOtherWindow() && (m_constraints->left.GetOtherWindow() != this) ) - m_constraints->left.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->top.GetOtherWindow() && (m_constraints->top.GetOtherWindow() != this) ) - m_constraints->top.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->right.GetOtherWindow() && (m_constraints->right.GetOtherWindow() != this) ) - m_constraints->right.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->bottom.GetOtherWindow() && (m_constraints->bottom.GetOtherWindow() != this) ) - m_constraints->bottom.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->width.GetOtherWindow() && (m_constraints->width.GetOtherWindow() != this) ) - m_constraints->width.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->height.GetOtherWindow() && (m_constraints->height.GetOtherWindow() != this) ) - m_constraints->height.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->centreX.GetOtherWindow() && (m_constraints->centreX.GetOtherWindow() != this) ) - m_constraints->centreX.GetOtherWindow()->AddConstraintReference(this); - if ( m_constraints->centreY.GetOtherWindow() && (m_constraints->centreY.GetOtherWindow() != this) ) - m_constraints->centreY.GetOtherWindow()->AddConstraintReference(this); - } -} - -// This removes any dangling pointers to this window in other windows' -// constraintsInvolvedIn lists. -void wxWindowBase::UnsetConstraints(wxLayoutConstraints *c) -{ - if ( c ) - { - if ( c->left.GetOtherWindow() && (c->top.GetOtherWindow() != this) ) - c->left.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->top.GetOtherWindow() && (c->top.GetOtherWindow() != this) ) - c->top.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->right.GetOtherWindow() && (c->right.GetOtherWindow() != this) ) - c->right.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->bottom.GetOtherWindow() && (c->bottom.GetOtherWindow() != this) ) - c->bottom.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->width.GetOtherWindow() && (c->width.GetOtherWindow() != this) ) - c->width.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->height.GetOtherWindow() && (c->height.GetOtherWindow() != this) ) - c->height.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->centreX.GetOtherWindow() && (c->centreX.GetOtherWindow() != this) ) - c->centreX.GetOtherWindow()->RemoveConstraintReference(this); - if ( c->centreY.GetOtherWindow() && (c->centreY.GetOtherWindow() != this) ) - c->centreY.GetOtherWindow()->RemoveConstraintReference(this); - } -} - -// Back-pointer to other windows we're involved with, so if we delete this -// window, we must delete any constraints we're involved with. -void wxWindowBase::AddConstraintReference(wxWindowBase *otherWin) -{ - if ( !m_constraintsInvolvedIn ) - m_constraintsInvolvedIn = new wxWindowList; - if ( !m_constraintsInvolvedIn->Find((wxWindow *)otherWin) ) - m_constraintsInvolvedIn->Append((wxWindow *)otherWin); -} - -// REMOVE back-pointer to other windows we're involved with. -void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin) -{ - if ( m_constraintsInvolvedIn ) - m_constraintsInvolvedIn->DeleteObject((wxWindow *)otherWin); -} - -// Reset any constraints that mention this window -void wxWindowBase::DeleteRelatedConstraints() -{ - if ( m_constraintsInvolvedIn ) - { - wxWindowList::compatibility_iterator node = m_constraintsInvolvedIn->GetFirst(); - while (node) - { - wxWindow *win = node->GetData(); - wxLayoutConstraints *constr = win->GetConstraints(); - - // Reset any constraints involving this window - if ( constr ) - { - constr->left.ResetIfWin(this); - constr->top.ResetIfWin(this); - constr->right.ResetIfWin(this); - constr->bottom.ResetIfWin(this); - constr->width.ResetIfWin(this); - constr->height.ResetIfWin(this); - constr->centreX.ResetIfWin(this); - constr->centreY.ResetIfWin(this); - } - - wxWindowList::compatibility_iterator next = node->GetNext(); - m_constraintsInvolvedIn->Erase(node); - node = next; - } - - delete m_constraintsInvolvedIn; - m_constraintsInvolvedIn = (wxWindowList *) NULL; - } -} - -#endif // wxUSE_CONSTRAINTS - -void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld) -{ - if ( sizer == m_windowSizer) - return; - - if ( m_windowSizer ) - { - m_windowSizer->SetContainingWindow(NULL); - - if ( deleteOld ) - delete m_windowSizer; - } - - m_windowSizer = sizer; - if ( m_windowSizer ) - { - m_windowSizer->SetContainingWindow((wxWindow *)this); - } - - SetAutoLayout(m_windowSizer != NULL); -} - -void wxWindowBase::SetSizerAndFit(wxSizer *sizer, bool deleteOld) -{ - SetSizer( sizer, deleteOld ); - sizer->SetSizeHints( (wxWindow*) this ); -} - - -void wxWindowBase::SetContainingSizer(wxSizer* sizer) -{ - // adding a window to a sizer twice is going to result in fatal and - // hard to debug problems later because when deleting the second - // associated wxSizerItem we're going to dereference a dangling - // pointer; so try to detect this as early as possible - wxASSERT_MSG( !sizer || m_containingSizer != sizer, - _T("Adding a window to the same sizer twice?") ); - - m_containingSizer = sizer; -} - -#if wxUSE_CONSTRAINTS - -void wxWindowBase::SatisfyConstraints() -{ - wxLayoutConstraints *constr = GetConstraints(); - bool wasOk = constr && constr->AreSatisfied(); - - ResetConstraints(); // Mark all constraints as unevaluated - - int noChanges = 1; - - // if we're a top level panel (i.e. our parent is frame/dialog), our - // own constraints will never be satisfied any more unless we do it - // here - if ( wasOk ) - { - while ( noChanges > 0 ) - { - LayoutPhase1(&noChanges); - } - } - - LayoutPhase2(&noChanges); -} - -#endif // wxUSE_CONSTRAINTS - -bool wxWindowBase::Layout() -{ - // If there is a sizer, use it instead of the constraints - if ( GetSizer() ) - { - int w = 0, h = 0; - GetVirtualSize(&w, &h); - GetSizer()->SetDimension( 0, 0, w, h ); - } -#if wxUSE_CONSTRAINTS - else - { - SatisfyConstraints(); // Find the right constraints values - SetConstraintSizes(); // Recursively set the real window sizes - } -#endif - - return true; -} - -#if wxUSE_CONSTRAINTS - -// first phase of the constraints evaluation: set our own constraints -bool wxWindowBase::LayoutPhase1(int *noChanges) -{ - wxLayoutConstraints *constr = GetConstraints(); - - return !constr || constr->SatisfyConstraints(this, noChanges); -} - -// second phase: set the constraints for our children -bool wxWindowBase::LayoutPhase2(int *noChanges) -{ - *noChanges = 0; - - // Layout children - DoPhase(1); - - // Layout grand children - DoPhase(2); - - return true; -} - -// Do a phase of evaluating child constraints -bool wxWindowBase::DoPhase(int phase) -{ - // the list containing the children for which the constraints are already - // set correctly - wxWindowList succeeded; - - // the max number of iterations we loop before concluding that we can't set - // the constraints - static const int maxIterations = 500; - - for ( int noIterations = 0; noIterations < maxIterations; noIterations++ ) - { - int noChanges = 0; - - // loop over all children setting their constraints - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - if ( child->IsTopLevel() ) - { - // top level children are not inside our client area - continue; - } - - if ( !child->GetConstraints() || succeeded.Find(child) ) - { - // this one is either already ok or nothing we can do about it - continue; - } - - int tempNoChanges = 0; - bool success = phase == 1 ? child->LayoutPhase1(&tempNoChanges) - : child->LayoutPhase2(&tempNoChanges); - noChanges += tempNoChanges; - - if ( success ) - { - succeeded.Append(child); - } - } - - if ( !noChanges ) - { - // constraints are set - break; - } - } - - return true; -} - -void wxWindowBase::ResetConstraints() -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - constr->left.SetDone(false); - constr->top.SetDone(false); - constr->right.SetDone(false); - constr->bottom.SetDone(false); - constr->width.SetDone(false); - constr->height.SetDone(false); - constr->centreX.SetDone(false); - constr->centreY.SetDone(false); - } - - wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - while (node) - { - wxWindow *win = node->GetData(); - if ( !win->IsTopLevel() ) - win->ResetConstraints(); - node = node->GetNext(); - } -} - -// Need to distinguish between setting the 'fake' size for windows and sizers, -// and setting the real values. -void wxWindowBase::SetConstraintSizes(bool recurse) -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr && constr->AreSatisfied() ) - { - int x = constr->left.GetValue(); - int y = constr->top.GetValue(); - int w = constr->width.GetValue(); - int h = constr->height.GetValue(); - - if ( (constr->width.GetRelationship() != wxAsIs ) || - (constr->height.GetRelationship() != wxAsIs) ) - { - SetSize(x, y, w, h); - } - else - { - // If we don't want to resize this window, just move it... - Move(x, y); - } - } - else if ( constr ) - { - wxLogDebug(wxT("Constraints not satisfied for %s named '%s'."), - GetClassInfo()->GetClassName(), - GetName().c_str()); - } - - if ( recurse ) - { - wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - while (node) - { - wxWindow *win = node->GetData(); - if ( !win->IsTopLevel() && win->GetConstraints() ) - win->SetConstraintSizes(); - node = node->GetNext(); - } - } -} - -// Only set the size/position of the constraint (if any) -void wxWindowBase::SetSizeConstraint(int x, int y, int w, int h) -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - if ( x != wxDefaultCoord ) - { - constr->left.SetValue(x); - constr->left.SetDone(true); - } - if ( y != wxDefaultCoord ) - { - constr->top.SetValue(y); - constr->top.SetDone(true); - } - if ( w != wxDefaultCoord ) - { - constr->width.SetValue(w); - constr->width.SetDone(true); - } - if ( h != wxDefaultCoord ) - { - constr->height.SetValue(h); - constr->height.SetDone(true); - } - } -} - -void wxWindowBase::MoveConstraint(int x, int y) -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - if ( x != wxDefaultCoord ) - { - constr->left.SetValue(x); - constr->left.SetDone(true); - } - if ( y != wxDefaultCoord ) - { - constr->top.SetValue(y); - constr->top.SetDone(true); - } - } -} - -void wxWindowBase::GetSizeConstraint(int *w, int *h) const -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - *w = constr->width.GetValue(); - *h = constr->height.GetValue(); - } - else - GetSize(w, h); -} - -void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - *w = constr->width.GetValue(); - *h = constr->height.GetValue(); - } - else - GetClientSize(w, h); -} - -void wxWindowBase::GetPositionConstraint(int *x, int *y) const -{ - wxLayoutConstraints *constr = GetConstraints(); - if ( constr ) - { - *x = constr->left.GetValue(); - *y = constr->top.GetValue(); - } - else - GetPosition(x, y); -} - -#endif // wxUSE_CONSTRAINTS - -void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) const -{ - // don't do it for the dialogs/frames - they float independently of their - // parent - if ( !IsTopLevel() ) - { - wxWindow *parent = GetParent(); - if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) - { - wxPoint pt(parent->GetClientAreaOrigin()); - x += pt.x; - y += pt.y; - } - } -} - -// ---------------------------------------------------------------------------- -// Update UI processing -// ---------------------------------------------------------------------------- - -void wxWindowBase::UpdateWindowUI(long flags) -{ - wxUpdateUIEvent event(GetId()); - event.SetEventObject(this); - - if ( GetEventHandler()->ProcessEvent(event) ) - { - DoUpdateWindowUI(event); - } - - if (flags & wxUPDATE_UI_RECURSE) - { - wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - while (node) - { - wxWindow* child = (wxWindow*) node->GetData(); - child->UpdateWindowUI(flags); - node = node->GetNext(); - } - } -} - -// do the window-specific processing after processing the update event -void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event) -{ - if ( event.GetSetEnabled() ) - Enable(event.GetEnabled()); - - if ( event.GetSetShown() ) - Show(event.GetShown()); -} - -// ---------------------------------------------------------------------------- -// dialog units translations -// ---------------------------------------------------------------------------- - -wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt) -{ - int charWidth = GetCharWidth(); - int charHeight = GetCharHeight(); - wxPoint pt2 = wxDefaultPosition; - if (pt.x != wxDefaultCoord) - pt2.x = (int) ((pt.x * 4) / charWidth); - if (pt.y != wxDefaultCoord) - pt2.y = (int) ((pt.y * 8) / charHeight); - - return pt2; -} - -wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt) -{ - int charWidth = GetCharWidth(); - int charHeight = GetCharHeight(); - wxPoint pt2 = wxDefaultPosition; - if (pt.x != wxDefaultCoord) - pt2.x = (int) ((pt.x * charWidth) / 4); - if (pt.y != wxDefaultCoord) - pt2.y = (int) ((pt.y * charHeight) / 8); - - return pt2; -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -// propagate the colour change event to the subwindows -void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - while ( node ) - { - // Only propagate to non-top-level windows - wxWindow *win = node->GetData(); - if ( !win->IsTopLevel() ) - { - wxSysColourChangedEvent event2; - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event2); - } - - node = node->GetNext(); - } - - Refresh(); -} - -// the default action is to populate dialog with data when it's created, -// and nudge the UI into displaying itself correctly in case -// we've turned the wxUpdateUIEvents frequency down low. -void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) ) -{ - TransferDataToWindow(); - - // Update the UI at this point - UpdateWindowUI(wxUPDATE_UI_RECURSE); -} - -// methods for drawing the sizers in a visible way -#ifdef __WXDEBUG__ - -static void DrawSizers(wxWindowBase *win); - -static void DrawBorder(wxWindowBase *win, const wxRect& rect, bool fill = false) -{ - wxClientDC dc((wxWindow *)win); - dc.SetPen(*wxRED_PEN); - dc.SetBrush(fill ? wxBrush(*wxRED, wxCROSSDIAG_HATCH): *wxTRANSPARENT_BRUSH); - dc.DrawRectangle(rect.Deflate(1, 1)); -} - -static void DrawSizer(wxWindowBase *win, wxSizer *sizer) -{ - const wxSizerItemList& items = sizer->GetChildren(); - for ( wxSizerItemList::const_iterator i = items.begin(), - end = items.end(); - i != end; - ++i ) - { - wxSizerItem *item = *i; - if ( item->IsSizer() ) - { - DrawBorder(win, item->GetRect().Deflate(2)); - DrawSizer(win, item->GetSizer()); - } - else if ( item->IsSpacer() ) - { - DrawBorder(win, item->GetRect().Deflate(2), true); - } - else if ( item->IsWindow() ) - { - DrawSizers(item->GetWindow()); - } - } -} - -static void DrawSizers(wxWindowBase *win) -{ - wxSizer *sizer = win->GetSizer(); - if ( sizer ) - { - DrawBorder(win, win->GetClientSize()); - DrawSizer(win, sizer); - } - else // no sizer, still recurse into the children - { - const wxWindowList& children = win->GetChildren(); - for ( wxWindowList::const_iterator i = children.begin(), - end = children.end(); - i != end; - ++i ) - { - DrawSizers(*i); - } - } -} - -#endif // __WXDEBUG__ - -// process special middle clicks -void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) -{ - if ( event.ControlDown() && event.AltDown() ) - { -#ifdef __WXDEBUG__ - // Ctrl-Alt-Shift-mclick makes the sizers visible in debug builds - if ( event.ShiftDown() ) - { - DrawSizers(this); - return; - } -#endif // __WXDEBUG__ - -#if wxUSE_MSGDLG - // don't translate these strings, they're for diagnostics purposes only - wxString msg; - msg.Printf(_T("wxWidgets Library (%s port)\n") - _T("Version %d.%d.%d%s%s, compiled at %s %s\n") - _T("Runtime version of toolkit used is %d.%d.%s\n") - _T("Copyright (c) 1995-2010 wxWidgets team"), - wxPlatformInfo::Get().GetPortIdName().c_str(), - wxMAJOR_VERSION, - wxMINOR_VERSION, - wxRELEASE_NUMBER, -#if wxUSE_UNICODE - L" (Unicode)", -#else - wxEmptyString, -#endif -#ifdef __WXDEBUG__ - _T(" Debug build"), -#else - wxEmptyString, -#endif - __TDATE__, - __TTIME__, - wxPlatformInfo::Get().GetToolkitMajorVersion(), - wxPlatformInfo::Get().GetToolkitMinorVersion(), -#ifdef __WXGTK__ - wxString::Format(_T("\nThe compile-time GTK+ version is %d.%d.%d."), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION).c_str() -#else - wxEmptyString -#endif - ); - - wxMessageBox(msg, _T("wxWidgets information"), - wxICON_INFORMATION | wxOK, - (wxWindow *)this); - } - else -#endif // wxUSE_MSGDLG - { - event.Skip(); - } -} - -// ---------------------------------------------------------------------------- -// accessibility -// ---------------------------------------------------------------------------- - -#if wxUSE_ACCESSIBILITY -void wxWindowBase::SetAccessible(wxAccessible* accessible) -{ - if (m_accessible && (accessible != m_accessible)) - delete m_accessible; - m_accessible = accessible; - if (m_accessible) - m_accessible->SetWindow((wxWindow*) this); -} - -// Returns the accessible object, creating if necessary. -wxAccessible* wxWindowBase::GetOrCreateAccessible() -{ - if (!m_accessible) - m_accessible = CreateAccessible(); - return m_accessible; -} - -// Override to create a specific accessible object. -wxAccessible* wxWindowBase::CreateAccessible() -{ - return new wxWindowAccessible((wxWindow*) this); -} - -#endif - -// ---------------------------------------------------------------------------- -// list classes implementation -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxWindowList) - -#else // !wxUSE_STL - -void wxWindowListNode::DeleteData() -{ - delete (wxWindow *)GetData(); -} - -#endif // wxUSE_STL/!wxUSE_STL - -// ---------------------------------------------------------------------------- -// borders -// ---------------------------------------------------------------------------- - -wxBorder wxWindowBase::GetBorder(long flags) const -{ - wxBorder border = (wxBorder)(flags & wxBORDER_MASK); - if ( border == wxBORDER_DEFAULT ) - { - border = GetDefaultBorder(); - } - - return border; -} - -wxBorder wxWindowBase::GetDefaultBorder() const -{ - return wxBORDER_NONE; -} - -// ---------------------------------------------------------------------------- -// hit testing -// ---------------------------------------------------------------------------- - -wxHitTest wxWindowBase::DoHitTest(wxCoord x, wxCoord y) const -{ - // here we just check if the point is inside the window or not - - // check the top and left border first - bool outside = x < 0 || y < 0; - if ( !outside ) - { - // check the right and bottom borders too - wxSize size = GetSize(); - outside = x >= size.x || y >= size.y; - } - - return outside ? wxHT_WINDOW_OUTSIDE : wxHT_WINDOW_INSIDE; -} - -// ---------------------------------------------------------------------------- -// mouse capture -// ---------------------------------------------------------------------------- - -struct WXDLLEXPORT wxWindowNext -{ - wxWindow *win; - wxWindowNext *next; -} *wxWindowBase::ms_winCaptureNext = NULL; -wxWindow *wxWindowBase::ms_winCaptureCurrent = NULL; -bool wxWindowBase::ms_winCaptureChanging = false; - -void wxWindowBase::CaptureMouse() -{ - wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), wx_static_cast(void*, this)); - - wxASSERT_MSG( !ms_winCaptureChanging, _T("recursive CaptureMouse call?") ); - - ms_winCaptureChanging = true; - - wxWindow *winOld = GetCapture(); - if ( winOld ) - { - ((wxWindowBase*) winOld)->DoReleaseMouse(); - - // save it on stack - wxWindowNext *item = new wxWindowNext; - item->win = winOld; - item->next = ms_winCaptureNext; - ms_winCaptureNext = item; - } - //else: no mouse capture to save - - DoCaptureMouse(); - ms_winCaptureCurrent = (wxWindow*)this; - - ms_winCaptureChanging = false; -} - -void wxWindowBase::ReleaseMouse() -{ - wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), wx_static_cast(void*, this)); - - wxASSERT_MSG( !ms_winCaptureChanging, _T("recursive ReleaseMouse call?") ); - - wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") ); - - ms_winCaptureChanging = true; - - DoReleaseMouse(); - ms_winCaptureCurrent = NULL; - - if ( ms_winCaptureNext ) - { - ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse(); - ms_winCaptureCurrent = ms_winCaptureNext->win; - - wxWindowNext *item = ms_winCaptureNext; - ms_winCaptureNext = item->next; - delete item; - } - //else: stack is empty, no previous capture - - ms_winCaptureChanging = false; - - wxLogTrace(_T("mousecapture"), - (const wxChar *) _T("After ReleaseMouse() mouse is captured by %p"), - wx_static_cast(void*, GetCapture())); -} - -static void DoNotifyWindowAboutCaptureLost(wxWindow *win) -{ - wxMouseCaptureLostEvent event(win->GetId()); - event.SetEventObject(win); - if ( !win->GetEventHandler()->ProcessEvent(event) ) - { - // windows must handle this event, otherwise the app wouldn't behave - // correctly if it loses capture unexpectedly; see the discussion here: - // http://sourceforge.net/tracker/index.php?func=detail&aid=1153662&group_id=9863&atid=109863 - // http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/82376 - wxFAIL_MSG( _T("window that captured the mouse didn't process wxEVT_MOUSE_CAPTURE_LOST") ); - } -} - -/* static */ -void wxWindowBase::NotifyCaptureLost() -{ - // don't do anything if capture lost was expected, i.e. resulted from - // a wx call to ReleaseMouse or CaptureMouse: - if ( ms_winCaptureChanging ) - return; - - // if the capture was lost unexpectedly, notify every window that has - // capture (on stack or current) about it and clear the stack: - - if ( ms_winCaptureCurrent ) - { - DoNotifyWindowAboutCaptureLost(ms_winCaptureCurrent); - ms_winCaptureCurrent = NULL; - } - - while ( ms_winCaptureNext ) - { - wxWindowNext *item = ms_winCaptureNext; - ms_winCaptureNext = item->next; - - DoNotifyWindowAboutCaptureLost(item->win); - - delete item; - } -} - -#if wxUSE_HOTKEY - -bool -wxWindowBase::RegisterHotKey(int WXUNUSED(hotkeyId), - int WXUNUSED(modifiers), - int WXUNUSED(keycode)) -{ - // not implemented - return false; -} - -bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId)) -{ - // not implemented - return false; -} - -#endif // wxUSE_HOTKEY - -// ---------------------------------------------------------------------------- -// event processing -// ---------------------------------------------------------------------------- - -bool wxWindowBase::TryValidator(wxEvent& wxVALIDATOR_PARAM(event)) -{ -#if wxUSE_VALIDATORS - // Can only use the validator of the window which - // is receiving the event - if ( event.GetEventObject() == this ) - { - wxValidator *validator = GetValidator(); - if ( validator && validator->ProcessEvent(event) ) - { - return true; - } - } -#endif // wxUSE_VALIDATORS - - return false; -} - -bool wxWindowBase::TryParent(wxEvent& event) -{ - // carry on up the parent-child hierarchy if the propagation count hasn't - // reached zero yet - if ( event.ShouldPropagate() ) - { - // honour the requests to stop propagation at this window: this is - // used by the dialogs, for example, to prevent processing the events - // from the dialog controls in the parent frame which rarely, if ever, - // makes sense - if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) ) - { - wxWindow *parent = GetParent(); - if ( parent && !parent->IsBeingDeleted() ) - { - wxPropagateOnce propagateOnce(event); - - return parent->GetEventHandler()->ProcessEvent(event); - } - } - } - - return wxEvtHandler::TryParent(event); -} - -// ---------------------------------------------------------------------------- -// window relationships -// ---------------------------------------------------------------------------- - -wxWindow *wxWindowBase::DoGetSibling(MoveKind order) const -{ - wxCHECK_MSG( GetParent(), NULL, - _T("GetPrev/NextSibling() don't work for TLWs!") ); - - wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::compatibility_iterator i = siblings.Find((wxWindow *)this); - wxCHECK_MSG( i, NULL, _T("window not a child of its parent?") ); - - if ( order == MoveBefore ) - i = i->GetPrevious(); - else // MoveAfter - i = i->GetNext(); - - return i ? i->GetData() : NULL; -} - -// ---------------------------------------------------------------------------- -// keyboard navigation -// ---------------------------------------------------------------------------- - -// Navigates in the specified direction. -bool wxWindowBase::Navigate(int flags) -{ - wxNavigationKeyEvent eventNav; - eventNav.SetFlags(flags); - eventNav.SetEventObject(this); - if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) ) - { - return true; - } - return false; -} - -void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move) -{ - // check that we're not a top level window - wxCHECK_RET( GetParent(), - _T("MoveBefore/AfterInTabOrder() don't work for TLWs!") ); - - // detect the special case when we have nothing to do anyhow and when the - // code below wouldn't work - if ( win == this ) - return; - - // find the target window in the siblings list - wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::compatibility_iterator i = siblings.Find(win); - wxCHECK_RET( i, _T("MoveBefore/AfterInTabOrder(): win is not a sibling") ); - - // unfortunately, when wxUSE_STL == 1 DetachNode() is not implemented so we - // can't just move the node around - wxWindow *self = (wxWindow *)this; - siblings.DeleteObject(self); - if ( move == MoveAfter ) - { - i = i->GetNext(); - } - - if ( i ) - { - siblings.Insert(i, self); - } - else // MoveAfter and win was the last sibling - { - siblings.Append(self); - } -} - -// ---------------------------------------------------------------------------- -// focus handling -// ---------------------------------------------------------------------------- - -/*static*/ wxWindow* wxWindowBase::FindFocus() -{ - wxWindowBase *win = DoFindFocus(); - return win ? win->GetMainWindowOfCompositeControl() : NULL; -} - -// ---------------------------------------------------------------------------- -// drag and drop -// ---------------------------------------------------------------------------- - -#if wxUSE_DRAG_AND_DROP && !defined(__WXMSW__) - -class wxDragAcceptFilesImplTarget : public wxFileDropTarget -{ -public: - wxDragAcceptFilesImplTarget(wxWindowBase *win) : m_win(win) {} - - virtual bool OnDropFiles(wxCoord x, wxCoord y, - const wxArrayString& filenames) - { - wxDropFilesEvent event(wxEVT_DROP_FILES, - filenames.size(), - wxCArrayString(filenames).Release()); - event.SetEventObject(m_win); - event.m_pos.x = x; - event.m_pos.y = y; - - return m_win->GetEventHandler()->ProcessEvent(event); - } - -private: - wxWindowBase * const m_win; - - DECLARE_NO_COPY_CLASS(wxDragAcceptFilesImplTarget) -}; - - -// Generic version of DragAcceptFiles(). It works by installing a simple -// wxFileDropTarget-to-EVT_DROP_FILES adaptor and therefore cannot be used -// together with explicit SetDropTarget() calls. -void wxWindowBase::DragAcceptFiles(bool accept) -{ - if ( accept ) - { - wxASSERT_MSG( !GetDropTarget(), - _T("cannot use DragAcceptFiles() and SetDropTarget() together") ); - SetDropTarget(new wxDragAcceptFilesImplTarget(this)); - } - else - { - SetDropTarget(NULL); - } -} - -#endif // wxUSE_DRAG_AND_DROP && !defined(__WXMSW__) - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -wxWindow* wxGetTopLevelParent(wxWindow *win) -{ - while ( win && !win->IsTopLevel() ) - win = win->GetParent(); - - return win; -} - -#if wxUSE_ACCESSIBILITY -// ---------------------------------------------------------------------------- -// accessible object for windows -// ---------------------------------------------------------------------------- - -// Can return either a child object, or an integer -// representing the child element, starting from 1. -wxAccStatus wxWindowAccessible::HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Returns the rectangle for this object (id = 0) or a child element (id > 0). -wxAccStatus wxWindowAccessible::GetLocation(wxRect& rect, int elementId) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - wxWindow* win = NULL; - if (elementId == 0) - { - win = GetWindow(); - } - else - { - if (elementId <= (int) GetWindow()->GetChildren().GetCount()) - { - win = GetWindow()->GetChildren().Item(elementId-1)->GetData(); - } - else - return wxACC_FAIL; - } - if (win) - { - rect = win->GetRect(); - if (win->GetParent() && !win->IsKindOf(CLASSINFO(wxTopLevelWindow))) - rect.SetPosition(win->GetParent()->ClientToScreen(rect.GetPosition())); - return wxACC_OK; - } - - return wxACC_NOT_IMPLEMENTED; -} - -// Navigates from fromId to toId/toObject. -wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId, - int* WXUNUSED(toId), wxAccessible** toObject) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - switch (navDir) - { - case wxNAVDIR_FIRSTCHILD: - { - if (GetWindow()->GetChildren().GetCount() == 0) - return wxACC_FALSE; - wxWindow* childWindow = (wxWindow*) GetWindow()->GetChildren().GetFirst()->GetData(); - *toObject = childWindow->GetOrCreateAccessible(); - - return wxACC_OK; - } - case wxNAVDIR_LASTCHILD: - { - if (GetWindow()->GetChildren().GetCount() == 0) - return wxACC_FALSE; - wxWindow* childWindow = (wxWindow*) GetWindow()->GetChildren().GetLast()->GetData(); - *toObject = childWindow->GetOrCreateAccessible(); - - return wxACC_OK; - } - case wxNAVDIR_RIGHT: - case wxNAVDIR_DOWN: - case wxNAVDIR_NEXT: - { - wxWindowList::compatibility_iterator node = - wxWindowList::compatibility_iterator(); - if (fromId == 0) - { - // Can't navigate to sibling of this window - // if we're a top-level window. - if (!GetWindow()->GetParent()) - return wxACC_NOT_IMPLEMENTED; - - node = GetWindow()->GetParent()->GetChildren().Find(GetWindow()); - } - else - { - if (fromId <= (int) GetWindow()->GetChildren().GetCount()) - node = GetWindow()->GetChildren().Item(fromId-1); - } - - if (node && node->GetNext()) - { - wxWindow* nextWindow = node->GetNext()->GetData(); - *toObject = nextWindow->GetOrCreateAccessible(); - return wxACC_OK; - } - else - return wxACC_FALSE; - } - case wxNAVDIR_LEFT: - case wxNAVDIR_UP: - case wxNAVDIR_PREVIOUS: - { - wxWindowList::compatibility_iterator node = - wxWindowList::compatibility_iterator(); - if (fromId == 0) - { - // Can't navigate to sibling of this window - // if we're a top-level window. - if (!GetWindow()->GetParent()) - return wxACC_NOT_IMPLEMENTED; - - node = GetWindow()->GetParent()->GetChildren().Find(GetWindow()); - } - else - { - if (fromId <= (int) GetWindow()->GetChildren().GetCount()) - node = GetWindow()->GetChildren().Item(fromId-1); - } - - if (node && node->GetPrevious()) - { - wxWindow* previousWindow = node->GetPrevious()->GetData(); - *toObject = previousWindow->GetOrCreateAccessible(); - return wxACC_OK; - } - else - return wxACC_FALSE; - } - } - - return wxACC_NOT_IMPLEMENTED; -} - -// Gets the name of the specified object. -wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - wxString title; - - // If a child, leave wxWidgets to call the function on the actual - // child object. - if (childId > 0) - return wxACC_NOT_IMPLEMENTED; - - // This will eventually be replaced by specialised - // accessible classes, one for each kind of wxWidgets - // control or window. -#if wxUSE_BUTTON - if (GetWindow()->IsKindOf(CLASSINFO(wxButton))) - title = ((wxButton*) GetWindow())->GetLabel(); - else -#endif - title = GetWindow()->GetName(); - - if (!title.empty()) - { - *name = title; - return wxACC_OK; - } - else - return wxACC_NOT_IMPLEMENTED; -} - -// Gets the number of children. -wxAccStatus wxWindowAccessible::GetChildCount(int* childId) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - *childId = (int) GetWindow()->GetChildren().GetCount(); - return wxACC_OK; -} - -// Gets the specified child (starting from 1). -// If *child is NULL and return value is wxACC_OK, -// this means that the child is a simple element and -// not an accessible object. -wxAccStatus wxWindowAccessible::GetChild(int childId, wxAccessible** child) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - if (childId == 0) - { - *child = this; - return wxACC_OK; - } - - if (childId > (int) GetWindow()->GetChildren().GetCount()) - return wxACC_FAIL; - - wxWindow* childWindow = GetWindow()->GetChildren().Item(childId-1)->GetData(); - *child = childWindow->GetOrCreateAccessible(); - if (*child) - return wxACC_OK; - else - return wxACC_FAIL; -} - -// Gets the parent, or NULL. -wxAccStatus wxWindowAccessible::GetParent(wxAccessible** parent) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - wxWindow* parentWindow = GetWindow()->GetParent(); - if (!parentWindow) - { - *parent = NULL; - return wxACC_OK; - } - else - { - *parent = parentWindow->GetOrCreateAccessible(); - if (*parent) - return wxACC_OK; - else - return wxACC_FAIL; - } -} - -// Performs the default action. childId is 0 (the action for this object) -// or > 0 (the action for a child). -// Return wxACC_NOT_SUPPORTED if there is no default action for this -// window (e.g. an edit control). -wxAccStatus wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Gets the default action for this object (0) or > 0 (the action for a child). -// Return wxACC_OK even if there is no action. actionName is the action, or the empty -// string if there is no action. -// The retrieved string describes the action that is performed on an object, -// not what the object does as a result. For example, a toolbar button that prints -// a document has a default action of "Press" rather than "Prints the current document." -wxAccStatus wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Returns the description for this object or a child. -wxAccStatus wxWindowAccessible::GetDescription(int WXUNUSED(childId), wxString* description) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - wxString ht(GetWindow()->GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Keyboard)); - if (!ht.empty()) - { - *description = ht; - return wxACC_OK; - } - return wxACC_NOT_IMPLEMENTED; -} - -// Returns help text for this object or a child, similar to tooltip text. -wxAccStatus wxWindowAccessible::GetHelpText(int WXUNUSED(childId), wxString* helpText) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - wxString ht(GetWindow()->GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Keyboard)); - if (!ht.empty()) - { - *helpText = ht; - return wxACC_OK; - } - return wxACC_NOT_IMPLEMENTED; -} - -// Returns the keyboard shortcut for this object or child. -// Return e.g. ALT+K -wxAccStatus wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Returns a role constant. -wxAccStatus wxWindowAccessible::GetRole(int childId, wxAccRole* role) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - // If a child, leave wxWidgets to call the function on the actual - // child object. - if (childId > 0) - return wxACC_NOT_IMPLEMENTED; - - if (GetWindow()->IsKindOf(CLASSINFO(wxControl))) - return wxACC_NOT_IMPLEMENTED; -#if wxUSE_STATUSBAR - if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar))) - return wxACC_NOT_IMPLEMENTED; -#endif -#if wxUSE_TOOLBAR - if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar))) - return wxACC_NOT_IMPLEMENTED; -#endif - - //*role = wxROLE_SYSTEM_CLIENT; - *role = wxROLE_SYSTEM_CLIENT; - return wxACC_OK; - - #if 0 - return wxACC_NOT_IMPLEMENTED; - #endif -} - -// Returns a state constant. -wxAccStatus wxWindowAccessible::GetState(int childId, long* state) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - // If a child, leave wxWidgets to call the function on the actual - // child object. - if (childId > 0) - return wxACC_NOT_IMPLEMENTED; - - if (GetWindow()->IsKindOf(CLASSINFO(wxControl))) - return wxACC_NOT_IMPLEMENTED; - -#if wxUSE_STATUSBAR - if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar))) - return wxACC_NOT_IMPLEMENTED; -#endif -#if wxUSE_TOOLBAR - if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar))) - return wxACC_NOT_IMPLEMENTED; -#endif - - *state = 0; - return wxACC_OK; - - #if 0 - return wxACC_NOT_IMPLEMENTED; - #endif -} - -// Returns a localized string representing the value for the object -// or child. -wxAccStatus wxWindowAccessible::GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Selects the object or child. -wxAccStatus wxWindowAccessible::Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -// Gets the window with the keyboard focus. -// If childId is 0 and child is NULL, no object in -// this subhierarchy has the focus. -// If this object has the focus, child should be 'this'. -wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} - -#if wxUSE_VARIANT -// Gets a variant representing the selected children -// of this object. -// Acceptable values: -// - a null variant (IsNull() returns true) -// - a list variant (GetType() == wxT("list") -// - an integer representing the selected child element, -// or 0 if this object is selected (GetType() == wxT("long") -// - a "void*" pointer to a wxAccessible child object -wxAccStatus wxWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections)) -{ - wxASSERT( GetWindow() != NULL ); - if (!GetWindow()) - return wxACC_FAIL; - - return wxACC_NOT_IMPLEMENTED; -} -#endif // wxUSE_VARIANT - -#endif // wxUSE_ACCESSIBILITY - -// ---------------------------------------------------------------------------- -// RTL support -// ---------------------------------------------------------------------------- - -wxCoord -wxWindowBase::AdjustForLayoutDirection(wxCoord x, - wxCoord width, - wxCoord widthTotal) const -{ - if ( GetLayoutDirection() == wxLayout_RightToLeft ) - { - x = widthTotal - x - width; - } - - return x; -} - diff --git a/Source/3rdParty/wx/src/common/wxchar.cpp b/Source/3rdParty/wx/src/common/wxchar.cpp deleted file mode 100644 index 068a1a09e..000000000 --- a/Source/3rdParty/wx/src/common/wxchar.cpp +++ /dev/null @@ -1,2293 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/wxchar.cpp -// Purpose: wxChar implementation -// Author: Ove Kaven -// Modified by: Ron Lee, Francesco Montorsi -// Created: 09/04/99 -// RCS-ID: $Id: wxchar.cpp 58994 2009-02-18 15:49:09Z FM $ -// Copyright: (c) wxWidgets copyright -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// headers, declarations, constants -// =========================================================================== - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/wxchar.h" - -#define _ISOC9X_SOURCE 1 // to get vsscanf() -#define _BSD_SOURCE 1 // to still get strdup() - -#include -#include -#include - -#ifndef __WXWINCE__ - #include - #include -#else - #include "wx/msw/wince/time.h" -#endif - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/hash.h" - #include "wx/utils.h" // for wxMin and wxMax - #include "wx/log.h" -#endif - -#if defined(__WIN32__) && defined(wxNEED_WX_CTYPE_H) - #include - #include - #include - #include -#endif - -#if defined(__MWERKS__) && __MSL__ >= 0x6000 -namespace std {} -using namespace std ; -#endif - -#if wxUSE_WCHAR_T -size_t WXDLLEXPORT wxMB2WC(wchar_t *buf, const char *psz, size_t n) -{ - // assume that we have mbsrtowcs() too if we have wcsrtombs() -#ifdef HAVE_WCSRTOMBS - mbstate_t mbstate; - memset(&mbstate, 0, sizeof(mbstate_t)); -#endif - - if (buf) { - if (!n || !*psz) { - if (n) *buf = wxT('\0'); - return 0; - } -#ifdef HAVE_WCSRTOMBS - return mbsrtowcs(buf, &psz, n, &mbstate); -#else - return wxMbstowcs(buf, psz, n); -#endif - } - - // note that we rely on common (and required by Unix98 but unfortunately not - // C99) extension which allows to call mbs(r)towcs() with NULL output pointer - // to just get the size of the needed buffer -- this is needed as otherwise - // we have no idea about how much space we need and if the CRT doesn't - // support it (the only currently known example being Metrowerks, see - // wx/wxchar.h) we don't use its mbstowcs() at all -#ifdef HAVE_WCSRTOMBS - return mbsrtowcs((wchar_t *) NULL, &psz, 0, &mbstate); -#else - return wxMbstowcs((wchar_t *) NULL, psz, 0); -#endif -} - -size_t WXDLLEXPORT wxWC2MB(char *buf, const wchar_t *pwz, size_t n) -{ -#ifdef HAVE_WCSRTOMBS - mbstate_t mbstate; - memset(&mbstate, 0, sizeof(mbstate_t)); -#endif - - if (buf) { - if (!n || !*pwz) { - // glibc2.1 chokes on null input - if (n) *buf = '\0'; - return 0; - } -#ifdef HAVE_WCSRTOMBS - return wcsrtombs(buf, &pwz, n, &mbstate); -#else - return wxWcstombs(buf, pwz, n); -#endif - } - -#ifdef HAVE_WCSRTOMBS - return wcsrtombs((char *) NULL, &pwz, 0, &mbstate); -#else - return wxWcstombs((char *) NULL, pwz, 0); -#endif -} -#endif // wxUSE_WCHAR_T - -bool WXDLLEXPORT wxOKlibc() -{ -#if wxUSE_WCHAR_T && defined(__UNIX__) && defined(__GLIBC__) && !defined(__WINE__) - // glibc 2.0 uses UTF-8 even when it shouldn't - wchar_t res = 0; - if ((MB_CUR_MAX == 2) && - (wxMB2WC(&res, "\xdd\xa5", 1) == 1) && - (res==0x765)) { - // this is UTF-8 allright, check whether that's what we want - char *cur_locale = setlocale(LC_CTYPE, NULL); - if ((strlen(cur_locale) < 4) || - (strcasecmp(cur_locale + strlen(cur_locale) - 4, "utf8")) || - (strcasecmp(cur_locale + strlen(cur_locale) - 5, "utf-8"))) { - // nope, don't use libc conversion - return false; - } - } -#endif - return true; -} - -// ============================================================================ -// printf() functions business -// ============================================================================ - -// special test mode: define all functions below even if we don't really need -// them to be able to test them -#ifdef wxTEST_PRINTF - #undef wxFprintf - #undef wxPrintf - #undef wxSprintf - #undef wxVfprintf - #undef wxVsprintf - #undef wxVprintf - #undef wxVsnprintf_ - #undef wxSnprintf_ - - #define wxNEED_WPRINTF - - int wxVfprintf( FILE *stream, const wxChar *format, va_list argptr ); -#endif - -// ---------------------------------------------------------------------------- -// implement [v]snprintf() if the system doesn't provide a safe one -// or if the system's one does not support positional parameters -// (very useful for i18n purposes) -// ---------------------------------------------------------------------------- - -#if !defined(wxVsnprintf_) - -#if !wxUSE_WXVSNPRINTF - #error wxUSE_WXVSNPRINTF must be 1 if our wxVsnprintf_ is used -#endif - -// wxUSE_STRUTILS says our wxVsnprintf_ implementation to use or not to -// use wxStrlen and wxStrncpy functions over one-char processing loops. -// -// Some benchmarking revealed that wxUSE_STRUTILS == 1 has the following -// effects: -// -> on Windows: -// when in ANSI mode, this setting does not change almost anything -// when in Unicode mode, it gives ~ 50% of slowdown ! -// -> on Linux: -// both in ANSI and Unicode mode it gives ~ 60% of speedup ! -// -#if defined(WIN32) && wxUSE_UNICODE -#define wxUSE_STRUTILS 0 -#else -#define wxUSE_STRUTILS 1 -#endif - -// some limits of our implementation -#define wxMAX_SVNPRINTF_ARGUMENTS 64 -#define wxMAX_SVNPRINTF_FLAGBUFFER_LEN 32 -#define wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN 512 - -// prefer snprintf over sprintf -#if defined(__VISUALC__) || \ - (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) - #define system_sprintf(buff, max, flags, data) \ - ::_snprintf(buff, max, flags, data) -#elif defined(HAVE_SNPRINTF) - #define system_sprintf(buff, max, flags, data) \ - ::snprintf(buff, max, flags, data) -#else // NB: at least sprintf() should always be available - // since 'max' is not used in this case, wxVsnprintf() should always - // ensure that 'buff' is big enough for all common needs - // (see wxMAX_SVNPRINTF_FLAGBUFFER_LEN and wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN) - #define system_sprintf(buff, max, flags, data) \ - ::sprintf(buff, flags, data) - - #define SYSTEM_SPRINTF_IS_UNSAFE -#endif - -// the conversion specifiers accepted by wxVsnprintf_ -enum wxPrintfArgType { - wxPAT_INVALID = -1, - - wxPAT_INT, // %d, %i, %o, %u, %x, %X - wxPAT_LONGINT, // %ld, etc -#ifdef wxLongLong_t - wxPAT_LONGLONGINT, // %Ld, etc -#endif - wxPAT_SIZET, // %Zd, etc - - wxPAT_DOUBLE, // %e, %E, %f, %g, %G - wxPAT_LONGDOUBLE, // %le, etc - - wxPAT_POINTER, // %p - - wxPAT_CHAR, // %hc (in ANSI mode: %c, too) - wxPAT_WCHAR, // %lc (in Unicode mode: %c, too) - - wxPAT_PCHAR, // %s (related to a char *) - wxPAT_PWCHAR, // %s (related to a wchar_t *) - - wxPAT_NINT, // %n - wxPAT_NSHORTINT, // %hn - wxPAT_NLONGINT // %ln -}; - -// an argument passed to wxVsnprintf_ -typedef union { - int pad_int; // %d, %i, %o, %u, %x, %X - long int pad_longint; // %ld, etc -#ifdef wxLongLong_t - wxLongLong_t pad_longlongint; // %Ld, etc -#endif - size_t pad_sizet; // %Zd, etc - - double pad_double; // %e, %E, %f, %g, %G - long double pad_longdouble; // %le, etc - - void *pad_pointer; // %p - - char pad_char; // %hc (in ANSI mode: %c, too) - wchar_t pad_wchar; // %lc (in Unicode mode: %c, too) - - char *pad_pchar; // %s (related to a char *) - wchar_t *pad_pwchar; // %s (related to a wchar_t *) - - int *pad_nint; // %n - short int *pad_nshortint; // %hn - long int *pad_nlongint; // %ln -} wxPrintfArg; - - -// Contains parsed data relative to a conversion specifier given to -// wxVsnprintf_ and parsed from the format string -// NOTE: in C++ there is almost no difference between struct & classes thus -// there is no performance gain by using a struct here... -class wxPrintfConvSpec -{ -public: - - // the position of the argument relative to this conversion specifier - size_t m_pos; - - // the type of this conversion specifier - wxPrintfArgType m_type; - - // the minimum and maximum width - // when one of this var is set to -1 it means: use the following argument - // in the stack as minimum/maximum width for this conversion specifier - int m_nMinWidth, m_nMaxWidth; - - // does the argument need to the be aligned to left ? - bool m_bAlignLeft; - - // pointer to the '%' of this conversion specifier in the format string - // NOTE: this points somewhere in the string given to the Parse() function - - // it's task of the caller ensure that memory is still valid ! - const wxChar *m_pArgPos; - - // pointer to the last character of this conversion specifier in the - // format string - // NOTE: this points somewhere in the string given to the Parse() function - - // it's task of the caller ensure that memory is still valid ! - const wxChar *m_pArgEnd; - - // a little buffer where formatting flags like #+\.hlqLZ are stored by Parse() - // for use in Process() - // NB: even if this buffer is used only for numeric conversion specifiers and - // thus could be safely declared as a char[] buffer, we want it to be wxChar - // so that in Unicode builds we can avoid to convert its contents to Unicode - // chars when copying it in user's buffer. - char m_szFlags[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; - - -public: - - // we don't declare this as a constructor otherwise it would be called - // automatically and we don't want this: to be optimized, wxVsnprintf_ - // calls this function only on really-used instances of this class. - void Init(); - - // Parses the first conversion specifier in the given string, which must - // begin with a '%'. Returns false if the first '%' does not introduce a - // (valid) conversion specifier and thus should be ignored. - bool Parse(const wxChar *format); - - // Process this conversion specifier and puts the result in the given - // buffer. Returns the number of characters written in 'buf' or -1 if - // there's not enough space. - int Process(wxChar *buf, size_t lenMax, wxPrintfArg *p, size_t written); - - // Loads the argument of this conversion specifier from given va_list. - bool LoadArg(wxPrintfArg *p, va_list &argptr); - -private: - // An helper function of LoadArg() which is used to handle the '*' flag - void ReplaceAsteriskWith(int w); -}; - -void wxPrintfConvSpec::Init() -{ - m_nMinWidth = 0; - m_nMaxWidth = 0xFFFF; - m_pos = 0; - m_bAlignLeft = false; - m_pArgPos = m_pArgEnd = NULL; - m_type = wxPAT_INVALID; - - // this character will never be removed from m_szFlags array and - // is important when calling sprintf() in wxPrintfConvSpec::Process() ! - m_szFlags[0] = '%'; -} - -bool wxPrintfConvSpec::Parse(const wxChar *format) -{ - bool done = false; - - // temporary parse data - size_t flagofs = 1; - bool in_prec, // true if we found the dot in some previous iteration - prec_dot; // true if the dot has been already added to m_szFlags - int ilen = 0; - - m_bAlignLeft = in_prec = prec_dot = false; - m_pArgPos = m_pArgEnd = format; - do - { -#define CHECK_PREC \ - if (in_prec && !prec_dot) \ - { \ - m_szFlags[flagofs++] = '.'; \ - prec_dot = true; \ - } - - // what follows '%'? - const wxChar ch = *(++m_pArgEnd); - switch ( ch ) - { - case wxT('\0'): - return false; // not really an argument - - case wxT('%'): - return false; // not really an argument - - case wxT('#'): - case wxT('0'): - case wxT(' '): - case wxT('+'): - case wxT('\''): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('-'): - CHECK_PREC - m_bAlignLeft = true; - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('.'): - CHECK_PREC - in_prec = true; - prec_dot = false; - m_nMaxWidth = 0; - // dot will be auto-added to m_szFlags if non-negative - // number follows - break; - - case wxT('h'): - ilen = -1; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('l'): - // NB: it's safe to use flagofs-1 as flagofs always start from 1 - if (m_szFlags[flagofs-1] == 'l') // 'll' modifier is the same as 'L' or 'q' - ilen = 2; - else - ilen = 1; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('q'): - case wxT('L'): - ilen = 2; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; -#ifdef __WXMSW__ - // under Windows we support the special '%I64' notation as longlong - // integer conversion specifier for MSVC compatibility - // (it behaves exactly as '%lli' or '%Li' or '%qi') - case wxT('I'): - if (*(m_pArgEnd+1) != wxT('6') || - *(m_pArgEnd+2) != wxT('4')) - return false; // bad format - - m_pArgEnd++; - m_pArgEnd++; - - ilen = 2; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs++] = '6'; - m_szFlags[flagofs++] = '4'; - break; -#endif // __WXMSW__ - - case wxT('Z'): - ilen = 3; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('*'): - if (in_prec) - { - CHECK_PREC - - // tell Process() to use the next argument - // in the stack as maxwidth... - m_nMaxWidth = -1; - } - else - { - // tell Process() to use the next argument - // in the stack as minwidth... - m_nMinWidth = -1; - } - - // save the * in our formatting buffer... - // will be replaced later by Process() - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('1'): case wxT('2'): case wxT('3'): - case wxT('4'): case wxT('5'): case wxT('6'): - case wxT('7'): case wxT('8'): case wxT('9'): - { - int len = 0; - CHECK_PREC - while ( (*m_pArgEnd >= wxT('0')) && - (*m_pArgEnd <= wxT('9')) ) - { - m_szFlags[flagofs++] = char(*m_pArgEnd); - len = len*10 + (*m_pArgEnd - wxT('0')); - m_pArgEnd++; - } - - if (in_prec) - m_nMaxWidth = len; - else - m_nMinWidth = len; - - m_pArgEnd--; // the main loop pre-increments n again - } - break; - - case wxT('$'): // a positional parameter (e.g. %2$s) ? - { - if (m_nMinWidth <= 0) - break; // ignore this formatting flag as no - // numbers are preceding it - - // remove from m_szFlags all digits previously added - do { - flagofs--; - } while (m_szFlags[flagofs] >= '1' && - m_szFlags[flagofs] <= '9'); - - // re-adjust the offset making it point to the - // next free char of m_szFlags - flagofs++; - - m_pos = m_nMinWidth; - m_nMinWidth = 0; - } - break; - - case wxT('d'): - case wxT('i'): - case wxT('o'): - case wxT('u'): - case wxT('x'): - case wxT('X'): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - if (ilen == 0) - m_type = wxPAT_INT; - else if (ilen == -1) - // NB: 'short int' value passed through '...' - // is promoted to 'int', so we have to get - // an int from stack even if we need a short - m_type = wxPAT_INT; - else if (ilen == 1) - m_type = wxPAT_LONGINT; - else if (ilen == 2) -#ifdef wxLongLong_t - m_type = wxPAT_LONGLONGINT; -#else // !wxLongLong_t - m_type = wxPAT_LONGINT; -#endif // wxLongLong_t/!wxLongLong_t - else if (ilen == 3) - m_type = wxPAT_SIZET; - done = true; - break; - - case wxT('e'): - case wxT('E'): - case wxT('f'): - case wxT('g'): - case wxT('G'): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - if (ilen == 2) - m_type = wxPAT_LONGDOUBLE; - else - m_type = wxPAT_DOUBLE; - done = true; - break; - - case wxT('p'): - m_type = wxPAT_POINTER; - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - done = true; - break; - - case wxT('c'): - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - if (ilen == -1) - { - // in Unicode mode %hc == ANSI character - // and in ANSI mode, %hc == %c == ANSI... - m_type = wxPAT_CHAR; - } - else if (ilen == 1) - { - // in ANSI mode %lc == Unicode character - // and in Unicode mode, %lc == %c == Unicode... - m_type = wxPAT_WCHAR; - } - else - { -#if wxUSE_UNICODE - // in Unicode mode, %c == Unicode character - m_type = wxPAT_WCHAR; -#else - // in ANSI mode, %c == ANSI character - m_type = wxPAT_CHAR; -#endif - } - done = true; - break; - - case wxT('s'): - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - if (ilen == -1) - { - // Unicode mode wx extension: we'll let %hs mean non-Unicode - // strings (when in ANSI mode, %s == %hs == ANSI string) - m_type = wxPAT_PCHAR; - } - else if (ilen == 1) - { - // in Unicode mode, %ls == %s == Unicode string - // in ANSI mode, %ls == Unicode string - m_type = wxPAT_PWCHAR; - } - else - { -#if wxUSE_UNICODE - m_type = wxPAT_PWCHAR; -#else - m_type = wxPAT_PCHAR; -#endif - } - done = true; - break; - - case wxT('n'): - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs] = '\0'; - if (ilen == 0) - m_type = wxPAT_NINT; - else if (ilen == -1) - m_type = wxPAT_NSHORTINT; - else if (ilen >= 1) - m_type = wxPAT_NLONGINT; - done = true; - break; - - default: - // bad format, don't consider this an argument; - // leave it unchanged - return false; - } - - if (flagofs == wxMAX_SVNPRINTF_FLAGBUFFER_LEN) - { - wxLogDebug(wxT("Too many flags specified for a single conversion specifier!")); - return false; - } - } - while (!done); - - return true; // parsing was successful -} - - -void wxPrintfConvSpec::ReplaceAsteriskWith(int width) -{ - char temp[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; - - // find the first * in our flag buffer - char *pwidth = strchr(m_szFlags, '*'); - wxCHECK_RET(pwidth, _T("field width must be specified")); - - // save what follows the * (the +1 is to skip the asterisk itself!) - strcpy(temp, pwidth+1); - if (width < 0) - { - pwidth[0] = wxT('-'); - pwidth++; - } - - // replace * with the actual integer given as width -#ifndef SYSTEM_SPRINTF_IS_UNSAFE - int maxlen = (m_szFlags + wxMAX_SVNPRINTF_FLAGBUFFER_LEN - pwidth) / - sizeof(*m_szFlags); -#endif - int offset = system_sprintf(pwidth, maxlen, "%d", abs(width)); - - // restore after the expanded * what was following it - strcpy(pwidth+offset, temp); -} - -bool wxPrintfConvSpec::LoadArg(wxPrintfArg *p, va_list &argptr) -{ - // was the '*' width/precision specifier used ? - if (m_nMaxWidth == -1) - { - // take the maxwidth specifier from the stack - m_nMaxWidth = va_arg(argptr, int); - if (m_nMaxWidth < 0) - m_nMaxWidth = 0; - else - ReplaceAsteriskWith(m_nMaxWidth); - } - - if (m_nMinWidth == -1) - { - // take the minwidth specifier from the stack - m_nMinWidth = va_arg(argptr, int); - - ReplaceAsteriskWith(m_nMinWidth); - if (m_nMinWidth < 0) - { - m_bAlignLeft = !m_bAlignLeft; - m_nMinWidth = -m_nMinWidth; - } - } - - switch (m_type) { - case wxPAT_INT: - p->pad_int = va_arg(argptr, int); - break; - case wxPAT_LONGINT: - p->pad_longint = va_arg(argptr, long int); - break; -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: - p->pad_longlongint = va_arg(argptr, wxLongLong_t); - break; -#endif // wxLongLong_t - case wxPAT_SIZET: - p->pad_sizet = va_arg(argptr, size_t); - break; - case wxPAT_DOUBLE: - p->pad_double = va_arg(argptr, double); - break; - case wxPAT_LONGDOUBLE: - p->pad_longdouble = va_arg(argptr, long double); - break; - case wxPAT_POINTER: - p->pad_pointer = va_arg(argptr, void *); - break; - - case wxPAT_CHAR: - p->pad_char = (char)va_arg(argptr, int); // char is promoted to int when passed through '...' - break; - case wxPAT_WCHAR: - p->pad_wchar = (wchar_t)va_arg(argptr, int); // char is promoted to int when passed through '...' - break; - - case wxPAT_PCHAR: - p->pad_pchar = va_arg(argptr, char *); - break; - case wxPAT_PWCHAR: - p->pad_pwchar = va_arg(argptr, wchar_t *); - break; - - case wxPAT_NINT: - p->pad_nint = va_arg(argptr, int *); - break; - case wxPAT_NSHORTINT: - p->pad_nshortint = va_arg(argptr, short int *); - break; - case wxPAT_NLONGINT: - p->pad_nlongint = va_arg(argptr, long int *); - break; - - case wxPAT_INVALID: - default: - return false; - } - - return true; // loading was successful -} - -int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p, size_t written) -{ - // buffer to avoid dynamic memory allocation each time for small strings; - // note that this buffer is used only to hold results of number formatting, - // %s directly writes user's string in buf, without using szScratch - char szScratch[wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN]; - size_t lenScratch = 0, lenCur = 0; - -#define APPEND_CH(ch) \ - { \ - if ( lenCur == lenMax ) \ - return -1; \ - \ - buf[lenCur++] = ch; \ - } - -#define APPEND_STR(s) \ - { \ - for ( const wxChar *p = s; *p; p++ ) \ - { \ - APPEND_CH(*p); \ - } \ - } - - switch ( m_type ) - { - case wxPAT_INT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_int); - break; - - case wxPAT_LONGINT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longint); - break; - -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longlongint); - break; -#endif // SIZEOF_LONG_LONG - - case wxPAT_SIZET: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_sizet); - break; - - case wxPAT_LONGDOUBLE: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longdouble); - break; - - case wxPAT_DOUBLE: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_double); - break; - - case wxPAT_POINTER: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_pointer); - break; - - case wxPAT_CHAR: - case wxPAT_WCHAR: - { - wxChar val = -#if wxUSE_UNICODE - p->pad_wchar; - - if (m_type == wxPAT_CHAR) - { - // user passed a character explicitely indicated as ANSI... - const char buf[2] = { p->pad_char, 0 }; - val = wxString(buf, wxConvLibc)[0u]; - - //wprintf(L"converting ANSI=>Unicode"); // for debug - } -#else - p->pad_char; - -#if wxUSE_WCHAR_T - if (m_type == wxPAT_WCHAR) - { - // user passed a character explicitely indicated as Unicode... - const wchar_t buf[2] = { p->pad_wchar, 0 }; - val = wxString(buf, wxConvLibc)[0u]; - - //printf("converting Unicode=>ANSI"); // for debug - } -#endif -#endif - - size_t i; - - if (!m_bAlignLeft) - for (i = 1; i < (size_t)m_nMinWidth; i++) - APPEND_CH(_T(' ')); - - APPEND_CH(val); - - if (m_bAlignLeft) - for (i = 1; i < (size_t)m_nMinWidth; i++) - APPEND_CH(_T(' ')); - } - break; - - case wxPAT_PCHAR: - case wxPAT_PWCHAR: - { - wxString s; - const wxChar *val = -#if wxUSE_UNICODE - p->pad_pwchar; - - if (m_type == wxPAT_PCHAR) - { - // user passed a string explicitely indicated as ANSI... - val = s = wxString(p->pad_pchar, wxConvLibc); - - //wprintf(L"converting ANSI=>Unicode"); // for debug - } -#else - p->pad_pchar; - -#if wxUSE_WCHAR_T - if (m_type == wxPAT_PWCHAR) - { - // user passed a string explicitely indicated as Unicode... - val = s = wxString(p->pad_pwchar, wxConvLibc); - - //printf("converting Unicode=>ANSI"); // for debug - } -#endif -#endif - int len; - - if (val) - { -#if wxUSE_STRUTILS - // at this point we are sure that m_nMaxWidth is positive or null - // (see top of wxPrintfConvSpec::LoadArg) - len = wxMin((unsigned int)m_nMaxWidth, wxStrlen(val)); -#else - for ( len = 0; val[len] && (len < m_nMaxWidth); len++ ) - ; -#endif - } - else if (m_nMaxWidth >= 6) - { - val = wxT("(null)"); - len = 6; - } - else - { - val = wxEmptyString; - len = 0; - } - - int i; - - if (!m_bAlignLeft) - { - for (i = len; i < m_nMinWidth; i++) - APPEND_CH(_T(' ')); - } - -#if wxUSE_STRUTILS - len = wxMin((unsigned int)len, lenMax-lenCur); - wxStrncpy(buf+lenCur, val, len); - lenCur += len; -#else - for (i = 0; i < len; i++) - APPEND_CH(val[i]); -#endif - - if (m_bAlignLeft) - { - for (i = len; i < m_nMinWidth; i++) - APPEND_CH(_T(' ')); - } - } - break; - - case wxPAT_NINT: - *p->pad_nint = written; - break; - - case wxPAT_NSHORTINT: - *p->pad_nshortint = (short int)written; - break; - - case wxPAT_NLONGINT: - *p->pad_nlongint = written; - break; - - case wxPAT_INVALID: - default: - return -1; - } - - // if we used system's sprintf() then we now need to append the s_szScratch - // buffer to the given one... - switch (m_type) - { - case wxPAT_INT: - case wxPAT_LONGINT: -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: -#endif - case wxPAT_SIZET: - case wxPAT_LONGDOUBLE: - case wxPAT_DOUBLE: - case wxPAT_POINTER: - wxASSERT(lenScratch < wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN); -#if !wxUSE_UNICODE - { - if (lenMax < lenScratch) - { - // fill output buffer and then return -1 - wxStrncpy(buf, szScratch, lenMax); - return -1; - } - wxStrncpy(buf, szScratch, lenScratch); - lenCur += lenScratch; - } -#else - { - // Copy the char scratch to the wide output. This requires - // conversion, but we can optimise by making use of the fact - // that we are formatting numbers, this should mean only 7-bit - // ascii characters are involved. - wxChar *bufptr = buf; - const wxChar *bufend = buf + lenMax; - const char *scratchptr = szScratch; - - // Simply copy each char to a wxChar, stopping on the first - // null or non-ascii byte. Checking '(signed char)*scratchptr - // > 0' is an extra optimisation over '*scratchptr != 0 && - // isascii(*scratchptr)', though it assumes signed char is - // 8-bit 2 complement. - while ((signed char)*scratchptr > 0 && bufptr != bufend) - *bufptr++ = *scratchptr++; - - if (bufptr == bufend) - return -1; - - lenCur += bufptr - buf; - - // check if the loop stopped on a non-ascii char, if yes then - // fall back to wxMB2WX - if (*scratchptr) - { - size_t len = wxMB2WX(bufptr, scratchptr, bufend - bufptr); - - if (len && len != (size_t)(-1)) - if (bufptr[len - 1]) - return -1; - else - lenCur += len; - } - } -#endif - break; - - default: - break; // all other cases were completed previously - } - - return lenCur; -} - -// Copy chars from source to dest converting '%%' to '%'. Takes at most maxIn -// chars from source and write at most outMax chars to dest, returns the -// number of chars actually written. Does not treat null specially. -// -static int wxCopyStrWithPercents( - size_t maxOut, - wxChar *dest, - size_t maxIn, - const wxChar *source) -{ - size_t written = 0; - - if (maxIn == 0) - return 0; - - size_t i; - for ( i = 0; i < maxIn-1 && written < maxOut; source++, i++) - { - dest[written++] = *source; - if (*(source+1) == wxT('%')) - { - // skip this additional '%' character - source++; - i++; - } - } - - if (i < maxIn && written < maxOut) - // copy last character inconditionally - dest[written++] = *source; - - return written; -} - -int WXDLLEXPORT wxVsnprintf_(wxChar *buf, size_t lenMax, - const wxChar *format, va_list argptr) -{ - // useful for debugging, to understand if we are really using this function - // rather than the system implementation -#if 0 - wprintf(L"Using wxVsnprintf_\n"); -#endif - - // required memory: - wxPrintfConvSpec arg[wxMAX_SVNPRINTF_ARGUMENTS]; - wxPrintfArg argdata[wxMAX_SVNPRINTF_ARGUMENTS]; - wxPrintfConvSpec *pspec[wxMAX_SVNPRINTF_ARGUMENTS] = { NULL }; - - size_t i; - - // number of characters in the buffer so far, must be less than lenMax - size_t lenCur = 0; - - size_t nargs = 0; - const wxChar *toparse = format; - - // parse the format string - bool posarg_present = false, nonposarg_present = false; - for (; *toparse != wxT('\0'); toparse++) - { - if (*toparse == wxT('%') ) - { - arg[nargs].Init(); - - // let's see if this is a (valid) conversion specifier... - if (arg[nargs].Parse(toparse)) - { - // ...yes it is - wxPrintfConvSpec *current = &arg[nargs]; - - // make toparse point to the end of this specifier - toparse = current->m_pArgEnd; - - if (current->m_pos > 0) - { - // the positionals start from number 1... adjust the index - current->m_pos--; - posarg_present = true; - } - else - { - // not a positional argument... - current->m_pos = nargs; - nonposarg_present = true; - } - - // this conversion specifier is tied to the pos-th argument... - pspec[current->m_pos] = current; - nargs++; - - if (nargs == wxMAX_SVNPRINTF_ARGUMENTS) - { - wxLogDebug(wxT("A single call to wxVsnprintf() has more than %d arguments; ") - wxT("ignoring all remaining arguments."), wxMAX_SVNPRINTF_ARGUMENTS); - break; // cannot handle any additional conv spec - } - } - else - { - // it's safe to look in the next character of toparse as at worst - // we'll hit its \0 - if (*(toparse+1) == wxT('%')) - toparse++; // the Parse() returned false because we've found a %% - } - } - } - - if (posarg_present && nonposarg_present) - { - buf[0] = 0; - return -1; // format strings with both positional and - } // non-positional conversion specifier are unsupported !! - - // on platforms where va_list is an array type, it is necessary to make a - // copy to be able to pass it to LoadArg as a reference. - bool ok = true; - va_list ap; - wxVaCopy(ap, argptr); - - // now load arguments from stack - for (i=0; i < nargs && ok; i++) - { - // !pspec[i] means that the user forgot a positional parameter (e.g. %$1s %$3s); - // LoadArg == false means that wxPrintfConvSpec::Parse failed to set the - // conversion specifier 'type' to a valid value... - ok = pspec[i] && pspec[i]->LoadArg(&argdata[i], ap); - } - - va_end(ap); - - // something failed while loading arguments from the variable list... - // (e.g. the user repeated twice the same positional argument) - if (!ok) - { - buf[0] = 0; - return -1; - } - - // finally, process each conversion specifier with its own argument - toparse = format; - for (i=0; i < nargs; i++) - { - // copy in the output buffer the portion of the format string between - // last specifier and the current one - size_t tocopy = ( arg[i].m_pArgPos - toparse ); - - lenCur += wxCopyStrWithPercents(lenMax - lenCur, buf + lenCur, - tocopy, toparse); - if (lenCur == lenMax) - { - buf[lenMax - 1] = 0; - return lenMax+1; // not enough space in the output buffer ! - } - - // process this specifier directly in the output buffer - int n = arg[i].Process(buf+lenCur, lenMax - lenCur, &argdata[arg[i].m_pos], lenCur); - if (n == -1) - { - buf[lenMax-1] = wxT('\0'); // be sure to always NUL-terminate the string - return lenMax+1; // not enough space in the output buffer ! - } - lenCur += n; - - // the +1 is because wxPrintfConvSpec::m_pArgEnd points to the last character - // of the format specifier, but we are not interested to it... - toparse = arg[i].m_pArgEnd + 1; - } - - // copy portion of the format string after last specifier - // NOTE: toparse is pointing to the character just after the last processed - // conversion specifier - // NOTE2: the +1 is because we want to copy also the '\0' - size_t tocopy = wxStrlen(format) + 1 - ( toparse - format ) ; - - lenCur += wxCopyStrWithPercents(lenMax - lenCur, buf + lenCur, - tocopy, toparse) - 1; - if (buf[lenCur]) - { - buf[lenCur] = 0; - return lenMax+1; // not enough space in the output buffer ! - } - - // Don't do: - // wxASSERT(lenCur == wxStrlen(buf)); - // in fact if we embedded NULLs in the output buffer (using %c with a '\0') - // such check would fail - - return lenCur; -} - -#undef APPEND_CH -#undef APPEND_STR -#undef CHECK_PREC - -#else // wxVsnprintf_ is defined - -#if wxUSE_WXVSNPRINTF - #error wxUSE_WXVSNPRINTF must be 0 if our wxVsnprintf_ is not used -#endif - -#endif // !wxVsnprintf_ - -#if !defined(wxSnprintf_) -int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) -{ - va_list argptr; - va_start(argptr, format); - - int iLen = wxVsnprintf_(buf, len, format, argptr); - - va_end(argptr); - - return iLen; -} -#endif // wxSnprintf_ - -#if defined(__DMC__) - /* Digital Mars adds count to _stprintf (C99) so convert */ - #if wxUSE_UNICODE - int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) - { - va_list arglist; - - va_start( arglist, format ); - int iLen = swprintf ( s, -1, format, arglist ); - va_end( arglist ); - return iLen ; - } - - #endif // wxUSE_UNICODE - -#endif //__DMC__ - -#if defined(__MINGW32__) && ( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) - /* MinGW with STLPort 5.1 has clashing defines for _stprintf so use swprintf */ - /* STLPort 5.1 defines standard (C99) vswprintf() and swprintf() that takes count. */ - int wxSprintf (wchar_t * s, const wchar_t * format, ... ) - { - va_list arglist; - - va_start( arglist, format ); - int iLen = swprintf ( s, -1, format, arglist ); - va_end( arglist ); - return iLen ; - } -#endif // MINGW32 _STLPORT_VERSION >= 0x510 - -// ---------------------------------------------------------------------------- -// implement the standard IO functions for wide char if libc doesn't have them -// ---------------------------------------------------------------------------- - -#ifdef wxNEED_FPUTS -int wxFputs(const wchar_t *ws, FILE *stream) -{ - wxCharBuffer buf(wxConvLibc.cWC2MB(ws)); - if ( !buf ) - return -1; - - // counting the number of wide characters written isn't worth the trouble, - // simply distinguish between ok and error - return fputs(buf, stream) == -1 ? -1 : 0; -} -#endif // wxNEED_FPUTS - -#ifdef wxNEED_PUTS -int wxPuts(const wxChar *ws) -{ - int rc = wxFputs(ws, stdout); - if ( rc != -1 ) - { - if ( wxFputs(L"\n", stdout) == -1 ) - return -1; - - rc++; - } - - return rc; -} -#endif // wxNEED_PUTS - -#ifdef wxNEED_PUTC -int /* not wint_t */ wxPutc(wchar_t wc, FILE *stream) -{ - wchar_t ws[2] = { wc, L'\0' }; - - return wxFputs(ws, stream); -} -#endif // wxNEED_PUTC - -// NB: we only implement va_list functions here, the ones taking ... are -// defined below for wxNEED_PRINTF_CONVERSION case anyhow and we reuse -// the definitions there to avoid duplicating them here -#ifdef wxNEED_WPRINTF - -// TODO: implement the scanf() functions -int vwscanf(const wxChar *format, va_list argptr) -{ - wxFAIL_MSG( _T("TODO") ); - - return -1; -} - -int vswscanf(const wxChar *ws, const wxChar *format, va_list argptr) -{ - // The best we can do without proper Unicode support in glibc is to - // convert the strings into MB representation and run ANSI version - // of the function. This doesn't work with %c and %s because of difference - // in size of char and wchar_t, though. - - wxCHECK_MSG( wxStrstr(format, _T("%s")) == NULL, -1, - _T("incomplete vswscanf implementation doesn't allow %s") ); - wxCHECK_MSG( wxStrstr(format, _T("%c")) == NULL, -1, - _T("incomplete vswscanf implementation doesn't allow %c") ); - - va_list argcopy; - wxVaCopy(argcopy, argptr); - return vsscanf(wxConvLibc.cWX2MB(ws), wxConvLibc.cWX2MB(format), argcopy); -} - -int vfwscanf(FILE *stream, const wxChar *format, va_list argptr) -{ - wxFAIL_MSG( _T("TODO") ); - - return -1; -} - -#define vswprintf wxVsnprintf_ - -int vfwprintf(FILE *stream, const wxChar *format, va_list argptr) -{ - wxString s; - int rc = s.PrintfV(format, argptr); - - if ( rc != -1 ) - { - // we can't do much better without Unicode support in libc... - if ( fprintf(stream, "%s", (const char*)s.mb_str() ) == -1 ) - return -1; - } - - return rc; -} - -int vwprintf(const wxChar *format, va_list argptr) -{ - return wxVfprintf(stdout, format, argptr); -} - -#endif // wxNEED_WPRINTF - -#ifdef wxNEED_PRINTF_CONVERSION - -// ---------------------------------------------------------------------------- -// wxFormatConverter: class doing the "%s" -> "%ls" conversion -// ---------------------------------------------------------------------------- - -/* - Here are the gory details. We want to follow the Windows/MS conventions, - that is to have - - In ANSI mode: - - format specifier results in - ----------------------------------- - %c, %hc, %hC char - %lc, %C, %lC wchar_t - - In Unicode mode: - - format specifier results in - ----------------------------------- - %hc, %C, %hC char - %c, %lc, %lC wchar_t - - - while on POSIX systems we have %C identical to %lc and %c always means char - (in any mode) while %lc always means wchar_t, - - So to use native functions in order to get our semantics we must do the - following translations in Unicode mode (nothing to do in ANSI mode): - - wxWidgets specifier POSIX specifier - ---------------------------------------- - - %hc, %C, %hC %c - %c %lc - - - And, of course, the same should be done for %s as well. -*/ - -class wxFormatConverter -{ -public: - wxFormatConverter(const wxChar *format); - - // notice that we only translated the string if m_fmtOrig == NULL (as set - // by CopyAllBefore()), otherwise we should simply use the original format - operator const wxChar *() const - { return m_fmtOrig ? m_fmtOrig : m_fmt.c_str(); } - -private: - // copy another character to the translated format: this function does the - // copy if we are translating but doesn't do anything at all if we don't, - // so we don't create the translated format string at all unless we really - // need to (i.e. InsertFmtChar() is called) - wxChar CopyFmtChar(wxChar ch) - { - if ( !m_fmtOrig ) - { - // we're translating, do copy - m_fmt += ch; - } - else - { - // simply increase the count which should be copied by - // CopyAllBefore() later if needed - m_nCopied++; - } - - return ch; - } - - // insert an extra character - void InsertFmtChar(wxChar ch) - { - if ( m_fmtOrig ) - { - // so far we haven't translated anything yet - CopyAllBefore(); - } - - m_fmt += ch; - } - - void CopyAllBefore() - { - wxASSERT_MSG( m_fmtOrig && m_fmt.empty(), _T("logic error") ); - - m_fmt = wxString(m_fmtOrig, m_nCopied); - - // we won't need it any longer - m_fmtOrig = NULL; - } - - static bool IsFlagChar(wxChar ch) - { - return ch == _T('-') || ch == _T('+') || - ch == _T('0') || ch == _T(' ') || ch == _T('#'); - } - - void SkipDigits(const wxChar **ptpc) - { - while ( **ptpc >= _T('0') && **ptpc <= _T('9') ) - CopyFmtChar(*(*ptpc)++); - } - - // the translated format - wxString m_fmt; - - // the original format - const wxChar *m_fmtOrig; - - // the number of characters already copied - size_t m_nCopied; -}; - -wxFormatConverter::wxFormatConverter(const wxChar *format) -{ - m_fmtOrig = format; - m_nCopied = 0; - - while ( *format ) - { - if ( CopyFmtChar(*format++) == _T('%') ) - { - // skip any flags - while ( IsFlagChar(*format) ) - CopyFmtChar(*format++); - - // and possible width - if ( *format == _T('*') ) - CopyFmtChar(*format++); - else - SkipDigits(&format); - - // precision? - if ( *format == _T('.') ) - { - CopyFmtChar(*format++); - if ( *format == _T('*') ) - CopyFmtChar(*format++); - else - SkipDigits(&format); - } - - // next we can have a size modifier - enum - { - Default, - Short, - Long - } size; - - switch ( *format ) - { - case _T('h'): - size = Short; - format++; - break; - - case _T('l'): - // "ll" has a different meaning! - if ( format[1] != _T('l') ) - { - size = Long; - format++; - break; - } - //else: fall through - - default: - size = Default; - } - - // and finally we should have the type - switch ( *format ) - { - case _T('C'): - case _T('S'): - // %C and %hC -> %c and %lC -> %lc - if ( size == Long ) - CopyFmtChar(_T('l')); - - InsertFmtChar(*format++ == _T('C') ? _T('c') : _T('s')); - break; - - case _T('c'): - case _T('s'): - // %c -> %lc but %hc stays %hc and %lc is still %lc - if ( size == Default) - InsertFmtChar(_T('l')); - // fall through - - default: - // nothing special to do - if ( size != Default ) - CopyFmtChar(*(format - 1)); - CopyFmtChar(*format++); - } - } - } -} - -#else // !wxNEED_PRINTF_CONVERSION - // no conversion necessary - #define wxFormatConverter(x) (x) -#endif // wxNEED_PRINTF_CONVERSION/!wxNEED_PRINTF_CONVERSION - -#ifdef __WXDEBUG__ -// For testing the format converter -wxString wxConvertFormat(const wxChar *format) -{ - return wxString(wxFormatConverter(format)); -} -#endif - -// ---------------------------------------------------------------------------- -// wxPrintf(), wxScanf() and relatives -// ---------------------------------------------------------------------------- - -#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF) - -int wxScanf( const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - - int ret = vwscanf(wxFormatConverter(format), argptr ); - - va_end(argptr); - - return ret; -} - -int wxSscanf( const wxChar *str, const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - - int ret = vswscanf( str, wxFormatConverter(format), argptr ); - - va_end(argptr); - - return ret; -} - -int wxFscanf( FILE *stream, const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - int ret = vfwscanf(stream, wxFormatConverter(format), argptr); - - va_end(argptr); - - return ret; -} - -int wxPrintf( const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - - int ret = vwprintf( wxFormatConverter(format), argptr ); - - va_end(argptr); - - return ret; -} - -#ifndef wxSnprintf -int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - - int ret = vswprintf( str, size, wxFormatConverter(format), argptr ); - - // VsnprintfTestCase reveals that glibc's implementation of vswprintf - // doesn't nul terminate on truncation. - str[size - 1] = 0; - - va_end(argptr); - - return ret; -} -#endif // wxSnprintf - -int wxSprintf( wxChar *str, const wxChar *format, ... ) -{ - va_list argptr; - va_start(argptr, format); - - // note that wxString::FormatV() uses wxVsnprintf(), not wxSprintf(), so - // it's safe to implement this one in terms of it - wxString s(wxString::FormatV(format, argptr)); - wxStrcpy(str, s); - - va_end(argptr); - - return s.length(); -} - -int wxFprintf( FILE *stream, const wxChar *format, ... ) -{ - va_list argptr; - va_start( argptr, format ); - - int ret = vfwprintf( stream, wxFormatConverter(format), argptr ); - - va_end(argptr); - - return ret; -} - -int wxVsscanf( const wxChar *str, const wxChar *format, va_list argptr ) -{ - return vswscanf( str, wxFormatConverter(format), argptr ); -} - -int wxVfprintf( FILE *stream, const wxChar *format, va_list argptr ) -{ - return vfwprintf( stream, wxFormatConverter(format), argptr ); -} - -int wxVprintf( const wxChar *format, va_list argptr ) -{ - return vwprintf( wxFormatConverter(format), argptr ); -} - -#ifndef wxVsnprintf -int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list argptr ) -{ - return vswprintf( str, size, wxFormatConverter(format), argptr ); -} -#endif // wxVsnprintf - -int wxVsprintf( wxChar *str, const wxChar *format, va_list argptr ) -{ - // same as for wxSprintf() - return vswprintf(str, INT_MAX / 4, wxFormatConverter(format), argptr); -} - -#endif // wxNEED_PRINTF_CONVERSION - -#if wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// ctype.h stuff (currently unused) -// ---------------------------------------------------------------------------- - -#if defined(__WIN32__) && defined(wxNEED_WX_CTYPE_H) -inline WORD wxMSW_ctype(wxChar ch) -{ - WORD ret; - GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE1, &ch, 1, &ret); - return ret; -} - -WXDLLEXPORT int wxIsalnum(wxChar ch) { return IsCharAlphaNumeric(ch); } -WXDLLEXPORT int wxIsalpha(wxChar ch) { return IsCharAlpha(ch); } -WXDLLEXPORT int wxIscntrl(wxChar ch) { return wxMSW_ctype(ch) & C1_CNTRL; } -WXDLLEXPORT int wxIsdigit(wxChar ch) { return wxMSW_ctype(ch) & C1_DIGIT; } -WXDLLEXPORT int wxIsgraph(wxChar ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_PUNCT|C1_ALPHA); } -WXDLLEXPORT int wxIslower(wxChar ch) { return IsCharLower(ch); } -WXDLLEXPORT int wxIsprint(wxChar ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_SPACE|C1_PUNCT|C1_ALPHA); } -WXDLLEXPORT int wxIspunct(wxChar ch) { return wxMSW_ctype(ch) & C1_PUNCT; } -WXDLLEXPORT int wxIsspace(wxChar ch) { return wxMSW_ctype(ch) & C1_SPACE; } -WXDLLEXPORT int wxIsupper(wxChar ch) { return IsCharUpper(ch); } -WXDLLEXPORT int wxIsxdigit(wxChar ch) { return wxMSW_ctype(ch) & C1_XDIGIT; } -WXDLLEXPORT int wxTolower(wxChar ch) { return (wxChar)CharLower((LPTSTR)(ch)); } -WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)CharUpper((LPTSTR)(ch)); } -#endif - -#ifdef wxNEED_WX_MBSTOWCS - -WXDLLEXPORT size_t wxMbstowcs (wchar_t * out, const char * in, size_t outlen) -{ - if (!out) - { - size_t outsize = 0; - while(*in++) - outsize++; - return outsize; - } - - const char* origin = in; - - while (outlen-- && *in) - { - *out++ = (wchar_t) *in++; - } - - *out = '\0'; - - return in - origin; -} - -WXDLLEXPORT size_t wxWcstombs (char * out, const wchar_t * in, size_t outlen) -{ - if (!out) - { - size_t outsize = 0; - while(*in++) - outsize++; - return outsize; - } - - const wchar_t* origin = in; - - while (outlen-- && *in) - { - *out++ = (char) *in++; - } - - *out = '\0'; - - return in - origin; -} - -#endif // wxNEED_WX_MBSTOWCS - -#if defined(wxNEED_WX_CTYPE_H) - -#include - -#define cfalnumset CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric) -#define cfalphaset CFCharacterSetGetPredefined(kCFCharacterSetLetter) -#define cfcntrlset CFCharacterSetGetPredefined(kCFCharacterSetControl) -#define cfdigitset CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit) -//CFCharacterSetRef cfgraphset = kCFCharacterSetControl && !' ' -#define cflowerset CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter) -//CFCharacterSetRef cfprintset = !kCFCharacterSetControl -#define cfpunctset CFCharacterSetGetPredefined(kCFCharacterSetPunctuation) -#define cfspaceset CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline) -#define cfupperset CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter) - -WXDLLEXPORT int wxIsalnum(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalnumset, ch); } -WXDLLEXPORT int wxIsalpha(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalphaset, ch); } -WXDLLEXPORT int wxIscntrl(wxChar ch) { return CFCharacterSetIsCharacterMember(cfcntrlset, ch); } -WXDLLEXPORT int wxIsdigit(wxChar ch) { return CFCharacterSetIsCharacterMember(cfdigitset, ch); } -WXDLLEXPORT int wxIsgraph(wxChar ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch) && ch != ' '; } -WXDLLEXPORT int wxIslower(wxChar ch) { return CFCharacterSetIsCharacterMember(cflowerset, ch); } -WXDLLEXPORT int wxIsprint(wxChar ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch); } -WXDLLEXPORT int wxIspunct(wxChar ch) { return CFCharacterSetIsCharacterMember(cfpunctset, ch); } -WXDLLEXPORT int wxIsspace(wxChar ch) { return CFCharacterSetIsCharacterMember(cfspaceset, ch); } -WXDLLEXPORT int wxIsupper(wxChar ch) { return CFCharacterSetIsCharacterMember(cfupperset, ch); } -WXDLLEXPORT int wxIsxdigit(wxChar ch) { return wxIsdigit(ch) || (ch>='a' && ch<='f') || (ch>='A' && ch<='F'); } -WXDLLEXPORT int wxTolower(wxChar ch) { return (wxChar)tolower((char)(ch)); } -WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)toupper((char)(ch)); } - -#endif // wxNEED_WX_CTYPE_H - -#ifndef wxStrdupA - -WXDLLEXPORT char *wxStrdupA(const char *s) -{ - return strcpy((char *)malloc(strlen(s) + 1), s); -} - -#endif // wxStrdupA - -#ifndef wxStrdupW - -WXDLLEXPORT wchar_t * wxStrdupW(const wchar_t *pwz) -{ - size_t size = (wxWcslen(pwz) + 1) * sizeof(wchar_t); - wchar_t *ret = (wchar_t *) malloc(size); - memcpy(ret, pwz, size); - return ret; -} - -#endif // wxStrdupW - -#ifndef wxStricmp -int WXDLLEXPORT wxStricmp(const wxChar *psz1, const wxChar *psz2) -{ - register wxChar c1, c2; - do { - c1 = wxTolower(*psz1++); - c2 = wxTolower(*psz2++); - } while ( c1 && (c1 == c2) ); - return c1 - c2; -} -#endif - -#ifndef wxStricmp -int WXDLLEXPORT wxStrnicmp(const wxChar *s1, const wxChar *s2, size_t n) -{ - // initialize the variables just to suppress stupid gcc warning - register wxChar c1 = 0, c2 = 0; - while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1) n--, s1++, s2++; - if (n) { - if (c1 < c2) return -1; - if (c1 > c2) return 1; - } - return 0; -} -#endif - -#ifndef wxSetlocale -WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale) -{ - char *localeOld = setlocale(category, wxConvLibc.cWX2MB(locale)); - - return wxWCharBuffer(wxConvLibc.cMB2WC(localeOld)); -} -#endif - -#if wxUSE_WCHAR_T && !defined(HAVE_WCSLEN) -WXDLLEXPORT size_t wxWcslen(const wchar_t *s) -{ - size_t n = 0; - while ( *s++ ) - n++; - - return n; -} -#endif - -// ---------------------------------------------------------------------------- -// string.h functions -// ---------------------------------------------------------------------------- - -#ifdef wxNEED_WX_STRING_H - -// RN: These need to be c externed for the regex lib -#ifdef __cplusplus -extern "C" { -#endif - -WXDLLEXPORT wxChar * wxStrcat(wxChar *dest, const wxChar *src) -{ - wxChar *ret = dest; - while (*dest) dest++; - while ((*dest++ = *src++)); - return ret; -} - -WXDLLEXPORT const wxChar * wxStrchr(const wxChar *s, wxChar c) -{ - // be careful here as the terminating NUL makes part of the string - while ( *s != c ) - { - if ( !*s++ ) - return NULL; - } - - return s; -} - -WXDLLEXPORT int wxStrcmp(const wxChar *s1, const wxChar *s2) -{ - while ((*s1 == *s2) && *s1) s1++, s2++; - if ((wxUChar)*s1 < (wxUChar)*s2) return -1; - if ((wxUChar)*s1 > (wxUChar)*s2) return 1; - return 0; -} - -WXDLLEXPORT wxChar * wxStrcpy(wxChar *dest, const wxChar *src) -{ - wxChar *ret = dest; - while ((*dest++ = *src++)); - return ret; -} - -WXDLLEXPORT size_t wxStrlen_(const wxChar *s) -{ - size_t n = 0; - while ( *s++ ) - n++; - - return n; -} - - -WXDLLEXPORT wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n) -{ - wxChar *ret = dest; - while (*dest) dest++; - while (n && (*dest++ = *src++)) n--; - return ret; -} - -WXDLLEXPORT int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n) -{ - while (n && (*s1 == *s2) && *s1) n--, s1++, s2++; - if (n) { - if ((wxUChar)*s1 < (wxUChar)*s2) return -1; - if ((wxUChar)*s1 > (wxUChar)*s2) return 1; - } - return 0; -} - -WXDLLEXPORT wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n) -{ - wxChar *ret = dest; - while (n && (*dest++ = *src++)) n--; - while (n) *dest++=0, n--; // the docs specify padding with zeroes - return ret; -} - -WXDLLEXPORT const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept) -{ - while (*s && !wxStrchr(accept, *s)) - s++; - - return *s ? s : NULL; -} - -WXDLLEXPORT const wxChar * wxStrrchr(const wxChar *s, wxChar c) -{ - const wxChar *ret = NULL; - do - { - if ( *s == c ) - ret = s; - s++; - } - while ( *s ); - - return ret; -} - -WXDLLEXPORT size_t wxStrspn(const wxChar *s, const wxChar *accept) -{ - size_t len = 0; - while (wxStrchr(accept, *s++)) len++; - return len; -} - -WXDLLEXPORT const wxChar *wxStrstr(const wxChar *haystack, const wxChar *needle) -{ - wxASSERT_MSG( needle != NULL, _T("NULL argument in wxStrstr") ); - - // VZ: this is not exactly the most efficient string search algorithm... - - const size_t len = wxStrlen(needle); - - while ( const wxChar *fnd = wxStrchr(haystack, *needle) ) - { - if ( !wxStrncmp(fnd, needle, len) ) - return fnd; - - haystack = fnd + 1; - } - - return NULL; -} - -#ifdef __cplusplus -} -#endif - -WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr) -{ - const wxChar decSep( -#if wxUSE_INTL - wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0] -#else - _T('.') -#endif - ); - const wxChar *start = nptr; - - while (wxIsspace(*nptr)) nptr++; - if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++; - while (wxIsdigit(*nptr)) nptr++; - if (*nptr == decSep) { - nptr++; - while (wxIsdigit(*nptr)) nptr++; - } - if (*nptr == wxT('E') || *nptr == wxT('e')) { - nptr++; - if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++; - while (wxIsdigit(*nptr)) nptr++; - } - - wxString data(start, nptr-start); - const wxWX2MBbuf dat = data.mb_str(wxConvLibc); - char *rdat = wxMBSTRINGCAST dat; - double ret = strtod(dat, &rdat); - - if (endptr) *endptr = (wxChar *)(start + (rdat - (const char *)dat)); - - return ret; -} - -WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base) -{ - const wxChar *start = nptr; - - while (wxIsspace(*nptr)) nptr++; - if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++; - if (((base == 0) || (base == 16)) && - (nptr[0] == wxT('0') && nptr[1] == wxT('x'))) { - nptr += 2; - base = 16; - } - else if ((base == 0) && (nptr[0] == wxT('0'))) base = 8; - else if (base == 0) base = 10; - - while ((wxIsdigit(*nptr) && (*nptr - wxT('0') < base)) || - (wxIsalpha(*nptr) && (wxToupper(*nptr) - wxT('A') + 10 < base))) nptr++; - - wxString data(start, nptr-start); - wxWX2MBbuf dat = data.mb_str(wxConvLibc); - char *rdat = wxMBSTRINGCAST dat; - long int ret = strtol(dat, &rdat, base); - - if (endptr) *endptr = (wxChar *)(start + (rdat - (const char *)dat)); - - return ret; -} - -WXDLLEXPORT unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base) -{ - return (unsigned long int) wxStrtol(nptr, endptr, base); -} - -#endif // wxNEED_WX_STRING_H - -#ifdef wxNEED_WX_STDIO_H -WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode) -{ - char mode_buffer[10]; - for (size_t i = 0; i < wxStrlen(mode)+1; i++) - mode_buffer[i] = (char) mode[i]; - - return fopen( wxConvFile.cWX2MB(path), mode_buffer ); -} - -WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream) -{ - char mode_buffer[10]; - for (size_t i = 0; i < wxStrlen(mode)+1; i++) - mode_buffer[i] = (char) mode[i]; - - return freopen( wxConvFile.cWX2MB(path), mode_buffer, stream ); -} - -WXDLLEXPORT int wxRemove(const wxChar *path) -{ - return remove( wxConvFile.cWX2MB(path) ); -} - -WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath) -{ - return rename( wxConvFile.cWX2MB(oldpath), wxConvFile.cWX2MB(newpath) ); -} -#endif - -#ifndef wxAtof -double WXDLLEXPORT wxAtof(const wxChar *psz) -{ -#ifdef __WXWINCE__ - double d; - wxString str(psz); - if (str.ToDouble(& d)) - return d; - - return 0.0; -#else - return atof(wxConvLibc.cWX2MB(psz)); -#endif -} -#endif - -#ifdef wxNEED_WX_STDLIB_H -int WXDLLEXPORT wxAtoi(const wxChar *psz) -{ - return atoi(wxConvLibc.cWX2MB(psz)); -} - -long WXDLLEXPORT wxAtol(const wxChar *psz) -{ - return atol(wxConvLibc.cWX2MB(psz)); -} - -wxChar * WXDLLEXPORT wxGetenv(const wxChar *name) -{ -#if wxUSE_UNICODE - // NB: buffer returned by getenv() is allowed to be overwritten next - // time getenv() is called, so it is OK to use static string - // buffer to hold the data. - static wxWCharBuffer value((wxChar*)NULL); - value = wxConvLibc.cMB2WX(getenv(wxConvLibc.cWX2MB(name))); - return value.data(); -#else - return getenv(name); -#endif -} -#endif // wxNEED_WX_STDLIB_H - -#ifdef wxNEED_WXSYSTEM -int WXDLLEXPORT wxSystem(const wxChar *psz) -{ - return system(wxConvLibc.cWX2MB(psz)); -} -#endif // wxNEED_WXSYSTEM - -#ifdef wxNEED_WX_TIME_H -WXDLLEXPORT size_t -wxStrftime(wxChar *s, size_t maxsize, const wxChar *fmt, const struct tm *tm) -{ - if ( !maxsize ) - return 0; - - wxCharBuffer buf(maxsize); - - wxCharBuffer bufFmt(wxConvLibc.cWX2MB(fmt)); - if ( !bufFmt ) - return 0; - - size_t ret = strftime(buf.data(), maxsize, bufFmt, tm); - if ( !ret ) - return 0; - - wxWCharBuffer wbuf = wxConvLibc.cMB2WX(buf); - if ( !wbuf ) - return 0; - - wxStrncpy(s, wbuf, maxsize); - return wxStrlen(s); -} -#endif // wxNEED_WX_TIME_H - -#ifndef wxCtime -WXDLLEXPORT wxChar *wxCtime(const time_t *timep) -{ - // normally the string is 26 chars but give one more in case some broken - // DOS compiler decides to use "\r\n" instead of "\n" at the end - static wxChar buf[27]; - - // ctime() is guaranteed to return a string containing only ASCII - // characters, as its format is always the same for any locale - wxStrncpy(buf, wxString::FromAscii(ctime(timep)), WXSIZEOF(buf)); - buf[WXSIZEOF(buf) - 1] = _T('\0'); - - return buf; -} -#endif // wxCtime - -#endif // wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// functions which we may need even if !wxUSE_WCHAR_T -// ---------------------------------------------------------------------------- - -#ifndef wxStrtok - -WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr) -{ - if (!psz) - { - psz = *save_ptr; - if ( !psz ) - return NULL; - } - - psz += wxStrspn(psz, delim); - if (!*psz) - { - *save_ptr = (wxChar *)NULL; - return (wxChar *)NULL; - } - - wxChar *ret = psz; - psz = wxStrpbrk(psz, delim); - if (!psz) - { - *save_ptr = (wxChar*)NULL; - } - else - { - *psz = wxT('\0'); - *save_ptr = psz + 1; - } - - return ret; -} - -#endif // wxStrtok - -// ---------------------------------------------------------------------------- -// missing C RTL functions -// ---------------------------------------------------------------------------- - -#ifdef wxNEED_STRDUP - -char *strdup(const char *s) -{ - char *dest = (char*) malloc( strlen( s ) + 1 ) ; - if ( dest ) - strcpy( dest , s ) ; - return dest ; -} -#endif // wxNEED_STRDUP - -#if defined(__WXWINCE__) && (_WIN32_WCE <= 211) - -void *calloc( size_t num, size_t size ) -{ - void** ptr = (void **)malloc(num * size); - memset( ptr, 0, num * size); - return ptr; -} - -#endif // __WXWINCE__ <= 211 - -#ifdef __WXWINCE__ - -int wxRemove(const wxChar *path) -{ - return ::DeleteFile(path) == 0; -} - -#endif diff --git a/Source/3rdParty/wx/src/common/xpmdecod.cpp b/Source/3rdParty/wx/src/common/xpmdecod.cpp deleted file mode 100644 index 3b01094c6..000000000 --- a/Source/3rdParty/wx/src/common/xpmdecod.cpp +++ /dev/null @@ -1,833 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/xpmdecod.cpp -// Purpose: wxXPMDecoder -// Author: John Cristy, Vaclav Slavik -// RCS-ID: $Id: xpmdecod.cpp 54948 2008-08-03 10:54:33Z VZ $ -// Copyright: (c) John Cristy, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - -This file is partially based on source code of ImageMagick by John Cristy. Its -license is as follows: - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -% X X PPPP M M % -% X X P P MM MM % -% X PPPP M M M % -% X X P M M % -% X X P M M % -% % -% % -% Read/Write ImageMagick Image Format. % -% % -% % -% Software Design % -% John Cristy % -% July 1992 % -% % -% % -% Copyright (C) 2001 ImageMagick Studio, a non-profit organization dedicated % -% to making software imaging solutions freely available. % -% % -% Permission is hereby granted, free of charge, to any person obtaining a % -% copy of this software and associated documentation files ("ImageMagick"), % -% to deal in ImageMagick without restriction, including without limitation % -% the rights to use, copy, modify, merge, publish, distribute, sublicense, % -% and/or sell copies of ImageMagick, and to permit persons to whom the % -% ImageMagick is furnished to do so, subject to the following conditions: % -% % -% The above copyright notice and this permission notice shall be included in % -% all copies or substantial portions of ImageMagick. % -% % -% The software is provided "as is", without warranty of any kind, express or % -% implied, including but not limited to the warranties of merchantability, % -% fitness for a particular purpose and noninfringement. In no event shall % -% ImageMagick Studio be liable for any claim, damages or other liability, % -% whether in an action of contract, tort or otherwise, arising from, out of % -% or in connection with ImageMagick or the use or other dealings in % -% ImageMagick. % -% % -% Except as contained in this notice, the name of the ImageMagick Studio % -% shall not be used in advertising or otherwise to promote the sale, use or % -% other dealings in ImageMagick without prior written authorization from the % -% ImageMagick Studio. % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% -*/ - -/* - * Also contains some pieces from libxpm and its modification for win32 by - * HeDu : - * - * Copyright (C) 1989-95 GROUPE BULL - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of GROUPE BULL shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from GROUPE BULL. - */ - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_XPM - -#include "wx/xpmdecod.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/hashmap.h" - #include "wx/stream.h" - #include "wx/image.h" - #include "wx/palette.h" -#endif - -#include -#include - -#if wxUSE_STREAMS -bool wxXPMDecoder::CanRead(wxInputStream& stream) -{ - unsigned char buf[9]; - - if ( !stream.Read(buf, WXSIZEOF(buf)) ) - return false; - - stream.SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent); - - return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0; -} - -wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) -{ - size_t length = stream.GetSize(); - wxCHECK_MSG( length != 0, wxNullImage, - wxT("Cannot read XPM from stream of unknown size") ); - - // use a smart buffer to be sure to free memory even when we return on - // error - wxCharBuffer buffer(length); - - char *xpm_buffer = (char *)buffer.data(); - if ( stream.Read(xpm_buffer, length).GetLastError() == wxSTREAM_READ_ERROR ) - return wxNullImage; - xpm_buffer[length] = '\0'; - - /* - * Remove comments from the file: - */ - char *p, *q; - for (p = xpm_buffer; *p != '\0'; p++) - { - if ( (*p == '"') || (*p == '\'') ) - { - if (*p == '"') - { - for (p++; *p != '\0'; p++) - if ( (*p == '"') && (*(p - 1) != '\\') ) - break; - } - else // *p == '\'' - { - for (p++; *p != '\0'; p++) - if ( (*p == '\'') && (*(p - 1) != '\\') ) - break; - } - if (*p == '\0') - break; - continue; - } - if ( (*p != '/') || (*(p + 1) != '*') ) - continue; - for (q = p + 2; *q != '\0'; q++) - { - if ( (*q == '*') && (*(q + 1) == '/') ) - break; - } - - // memmove allows overlaps (unlike strcpy): - size_t cpylen = strlen(q + 2) + 1; - memmove(p, q + 2, cpylen); - } - - /* - * Remove unquoted characters: - */ - size_t i = 0; - for (p = xpm_buffer; *p != '\0'; p++) - { - if ( *p != '"' ) - continue; - for (q = p + 1; *q != '\0'; q++) - if (*q == '"') - break; - strncpy(xpm_buffer + i, p + 1, q - p - 1); - i += q - p - 1; - xpm_buffer[i++] = '\n'; - p = q + 1; - } - xpm_buffer[i] = '\0'; - - /* - * Create array of lines and convert \n's to \0's: - */ - const char **xpm_lines; - size_t lines_cnt = 0; - size_t line; - - for (p = xpm_buffer; *p != '\0'; p++) - { - if ( *p == '\n' ) - lines_cnt++; - } - - if ( !lines_cnt ) - { - // this doesn't really look an XPM image - return wxNullImage; - } - - xpm_lines = new const char*[lines_cnt + 1]; - xpm_lines[0] = xpm_buffer; - line = 1; - for (p = xpm_buffer; (*p != '\0') && (line < lines_cnt); p++) - { - if ( *p == '\n' ) - { - xpm_lines[line] = p + 1; - *p = '\0'; - line++; - } - } - - xpm_lines[lines_cnt] = NULL; - - /* - * Read the image: - */ - wxImage img = ReadData(xpm_lines); - - delete[] xpm_lines; - - return img; -} -#endif // wxUSE_STREAMS - - -/*****************************************************************************\ -* rgbtab.h * -* * -* A hard coded rgb.txt. To keep it short I removed all colornames with * -* trailing numbers, Blue3 etc, except the GrayXX. Sorry Grey-lovers I prefer * -* Gray ;-). But Grey is recognized on lookups, only on save Gray will be * -* used, maybe you want to do some substitue there too. * -* * -* To save memory the RGBs are coded in one long value, as done by the RGB * -* macro. * -* * -* Developed by HeDu 3/94 (hedu@cul-ipn.uni-kiel.de) * -\*****************************************************************************/ - - -typedef struct -{ - const char *name; - wxUint32 rgb; -} rgbRecord; - -#define myRGB(r,g,b) ((wxUint32)r<<16|(wxUint32)g<<8|(wxUint32)b) - -static rgbRecord theRGBRecords[] = -{ - {"aliceblue", myRGB(240, 248, 255)}, - {"antiquewhite", myRGB(250, 235, 215)}, - {"aquamarine", myRGB(50, 191, 193)}, - {"azure", myRGB(240, 255, 255)}, - {"beige", myRGB(245, 245, 220)}, - {"bisque", myRGB(255, 228, 196)}, - {"black", myRGB(0, 0, 0)}, - {"blanchedalmond", myRGB(255, 235, 205)}, - {"blue", myRGB(0, 0, 255)}, - {"blueviolet", myRGB(138, 43, 226)}, - {"brown", myRGB(165, 42, 42)}, - {"burlywood", myRGB(222, 184, 135)}, - {"cadetblue", myRGB(95, 146, 158)}, - {"chartreuse", myRGB(127, 255, 0)}, - {"chocolate", myRGB(210, 105, 30)}, - {"coral", myRGB(255, 114, 86)}, - {"cornflowerblue", myRGB(34, 34, 152)}, - {"cornsilk", myRGB(255, 248, 220)}, - {"cyan", myRGB(0, 255, 255)}, - {"darkgoldenrod", myRGB(184, 134, 11)}, - {"darkgreen", myRGB(0, 86, 45)}, - {"darkkhaki", myRGB(189, 183, 107)}, - {"darkolivegreen", myRGB(85, 86, 47)}, - {"darkorange", myRGB(255, 140, 0)}, - {"darkorchid", myRGB(139, 32, 139)}, - {"darksalmon", myRGB(233, 150, 122)}, - {"darkseagreen", myRGB(143, 188, 143)}, - {"darkslateblue", myRGB(56, 75, 102)}, - {"darkslategray", myRGB(47, 79, 79)}, - {"darkturquoise", myRGB(0, 166, 166)}, - {"darkviolet", myRGB(148, 0, 211)}, - {"deeppink", myRGB(255, 20, 147)}, - {"deepskyblue", myRGB(0, 191, 255)}, - {"dimgray", myRGB(84, 84, 84)}, - {"dodgerblue", myRGB(30, 144, 255)}, - {"firebrick", myRGB(142, 35, 35)}, - {"floralwhite", myRGB(255, 250, 240)}, - {"forestgreen", myRGB(80, 159, 105)}, - {"gainsboro", myRGB(220, 220, 220)}, - {"ghostwhite", myRGB(248, 248, 255)}, - {"gold", myRGB(218, 170, 0)}, - {"goldenrod", myRGB(239, 223, 132)}, - {"gray", myRGB(126, 126, 126)}, - {"gray0", myRGB(0, 0, 0)}, - {"gray1", myRGB(3, 3, 3)}, - {"gray10", myRGB(26, 26, 26)}, - {"gray100", myRGB(255, 255, 255)}, - {"gray11", myRGB(28, 28, 28)}, - {"gray12", myRGB(31, 31, 31)}, - {"gray13", myRGB(33, 33, 33)}, - {"gray14", myRGB(36, 36, 36)}, - {"gray15", myRGB(38, 38, 38)}, - {"gray16", myRGB(41, 41, 41)}, - {"gray17", myRGB(43, 43, 43)}, - {"gray18", myRGB(46, 46, 46)}, - {"gray19", myRGB(48, 48, 48)}, - {"gray2", myRGB(5, 5, 5)}, - {"gray20", myRGB(51, 51, 51)}, - {"gray21", myRGB(54, 54, 54)}, - {"gray22", myRGB(56, 56, 56)}, - {"gray23", myRGB(59, 59, 59)}, - {"gray24", myRGB(61, 61, 61)}, - {"gray25", myRGB(64, 64, 64)}, - {"gray26", myRGB(66, 66, 66)}, - {"gray27", myRGB(69, 69, 69)}, - {"gray28", myRGB(71, 71, 71)}, - {"gray29", myRGB(74, 74, 74)}, - {"gray3", myRGB(8, 8, 8)}, - {"gray30", myRGB(77, 77, 77)}, - {"gray31", myRGB(79, 79, 79)}, - {"gray32", myRGB(82, 82, 82)}, - {"gray33", myRGB(84, 84, 84)}, - {"gray34", myRGB(87, 87, 87)}, - {"gray35", myRGB(89, 89, 89)}, - {"gray36", myRGB(92, 92, 92)}, - {"gray37", myRGB(94, 94, 94)}, - {"gray38", myRGB(97, 97, 97)}, - {"gray39", myRGB(99, 99, 99)}, - {"gray4", myRGB(10, 10, 10)}, - {"gray40", myRGB(102, 102, 102)}, - {"gray41", myRGB(105, 105, 105)}, - {"gray42", myRGB(107, 107, 107)}, - {"gray43", myRGB(110, 110, 110)}, - {"gray44", myRGB(112, 112, 112)}, - {"gray45", myRGB(115, 115, 115)}, - {"gray46", myRGB(117, 117, 117)}, - {"gray47", myRGB(120, 120, 120)}, - {"gray48", myRGB(122, 122, 122)}, - {"gray49", myRGB(125, 125, 125)}, - {"gray5", myRGB(13, 13, 13)}, - {"gray50", myRGB(127, 127, 127)}, - {"gray51", myRGB(130, 130, 130)}, - {"gray52", myRGB(133, 133, 133)}, - {"gray53", myRGB(135, 135, 135)}, - {"gray54", myRGB(138, 138, 138)}, - {"gray55", myRGB(140, 140, 140)}, - {"gray56", myRGB(143, 143, 143)}, - {"gray57", myRGB(145, 145, 145)}, - {"gray58", myRGB(148, 148, 148)}, - {"gray59", myRGB(150, 150, 150)}, - {"gray6", myRGB(15, 15, 15)}, - {"gray60", myRGB(153, 153, 153)}, - {"gray61", myRGB(156, 156, 156)}, - {"gray62", myRGB(158, 158, 158)}, - {"gray63", myRGB(161, 161, 161)}, - {"gray64", myRGB(163, 163, 163)}, - {"gray65", myRGB(166, 166, 166)}, - {"gray66", myRGB(168, 168, 168)}, - {"gray67", myRGB(171, 171, 171)}, - {"gray68", myRGB(173, 173, 173)}, - {"gray69", myRGB(176, 176, 176)}, - {"gray7", myRGB(18, 18, 18)}, - {"gray70", myRGB(179, 179, 179)}, - {"gray71", myRGB(181, 181, 181)}, - {"gray72", myRGB(184, 184, 184)}, - {"gray73", myRGB(186, 186, 186)}, - {"gray74", myRGB(189, 189, 189)}, - {"gray75", myRGB(191, 191, 191)}, - {"gray76", myRGB(194, 194, 194)}, - {"gray77", myRGB(196, 196, 196)}, - {"gray78", myRGB(199, 199, 199)}, - {"gray79", myRGB(201, 201, 201)}, - {"gray8", myRGB(20, 20, 20)}, - {"gray80", myRGB(204, 204, 204)}, - {"gray81", myRGB(207, 207, 207)}, - {"gray82", myRGB(209, 209, 209)}, - {"gray83", myRGB(212, 212, 212)}, - {"gray84", myRGB(214, 214, 214)}, - {"gray85", myRGB(217, 217, 217)}, - {"gray86", myRGB(219, 219, 219)}, - {"gray87", myRGB(222, 222, 222)}, - {"gray88", myRGB(224, 224, 224)}, - {"gray89", myRGB(227, 227, 227)}, - {"gray9", myRGB(23, 23, 23)}, - {"gray90", myRGB(229, 229, 229)}, - {"gray91", myRGB(232, 232, 232)}, - {"gray92", myRGB(235, 235, 235)}, - {"gray93", myRGB(237, 237, 237)}, - {"gray94", myRGB(240, 240, 240)}, - {"gray95", myRGB(242, 242, 242)}, - {"gray96", myRGB(245, 245, 245)}, - {"gray97", myRGB(247, 247, 247)}, - {"gray98", myRGB(250, 250, 250)}, - {"gray99", myRGB(252, 252, 252)}, - {"green", myRGB(0, 255, 0)}, - {"greenyellow", myRGB(173, 255, 47)}, - {"honeydew", myRGB(240, 255, 240)}, - {"hotpink", myRGB(255, 105, 180)}, - {"indianred", myRGB(107, 57, 57)}, - {"ivory", myRGB(255, 255, 240)}, - {"khaki", myRGB(179, 179, 126)}, - {"lavender", myRGB(230, 230, 250)}, - {"lavenderblush", myRGB(255, 240, 245)}, - {"lawngreen", myRGB(124, 252, 0)}, - {"lemonchiffon", myRGB(255, 250, 205)}, - {"lightblue", myRGB(176, 226, 255)}, - {"lightcoral", myRGB(240, 128, 128)}, - {"lightcyan", myRGB(224, 255, 255)}, - {"lightgoldenrod", myRGB(238, 221, 130)}, - {"lightgoldenrodyellow", myRGB(250, 250, 210)}, - {"lightgray", myRGB(168, 168, 168)}, - {"lightpink", myRGB(255, 182, 193)}, - {"lightsalmon", myRGB(255, 160, 122)}, - {"lightseagreen", myRGB(32, 178, 170)}, - {"lightskyblue", myRGB(135, 206, 250)}, - {"lightslateblue", myRGB(132, 112, 255)}, - {"lightslategray", myRGB(119, 136, 153)}, - {"lightsteelblue", myRGB(124, 152, 211)}, - {"lightyellow", myRGB(255, 255, 224)}, - {"limegreen", myRGB(0, 175, 20)}, - {"linen", myRGB(250, 240, 230)}, - {"magenta", myRGB(255, 0, 255)}, - {"maroon", myRGB(143, 0, 82)}, - {"mediumaquamarine", myRGB(0, 147, 143)}, - {"mediumblue", myRGB(50, 50, 204)}, - {"mediumforestgreen", myRGB(50, 129, 75)}, - {"mediumgoldenrod", myRGB(209, 193, 102)}, - {"mediumorchid", myRGB(189, 82, 189)}, - {"mediumpurple", myRGB(147, 112, 219)}, - {"mediumseagreen", myRGB(52, 119, 102)}, - {"mediumslateblue", myRGB(106, 106, 141)}, - {"mediumspringgreen", myRGB(35, 142, 35)}, - {"mediumturquoise", myRGB(0, 210, 210)}, - {"mediumvioletred", myRGB(213, 32, 121)}, - {"midnightblue", myRGB(47, 47, 100)}, - {"mintcream", myRGB(245, 255, 250)}, - {"mistyrose", myRGB(255, 228, 225)}, - {"moccasin", myRGB(255, 228, 181)}, - {"navajowhite", myRGB(255, 222, 173)}, - {"navy", myRGB(35, 35, 117)}, - {"navyblue", myRGB(35, 35, 117)}, - {"oldlace", myRGB(253, 245, 230)}, - {"olivedrab", myRGB(107, 142, 35)}, - {"orange", myRGB(255, 135, 0)}, - {"orangered", myRGB(255, 69, 0)}, - {"orchid", myRGB(239, 132, 239)}, - {"palegoldenrod", myRGB(238, 232, 170)}, - {"palegreen", myRGB(115, 222, 120)}, - {"paleturquoise", myRGB(175, 238, 238)}, - {"palevioletred", myRGB(219, 112, 147)}, - {"papayawhip", myRGB(255, 239, 213)}, - {"peachpuff", myRGB(255, 218, 185)}, - {"peru", myRGB(205, 133, 63)}, - {"pink", myRGB(255, 181, 197)}, - {"plum", myRGB(197, 72, 155)}, - {"powderblue", myRGB(176, 224, 230)}, - {"purple", myRGB(160, 32, 240)}, - {"red", myRGB(255, 0, 0)}, - {"rosybrown", myRGB(188, 143, 143)}, - {"royalblue", myRGB(65, 105, 225)}, - {"saddlebrown", myRGB(139, 69, 19)}, - {"salmon", myRGB(233, 150, 122)}, - {"sandybrown", myRGB(244, 164, 96)}, - {"seagreen", myRGB(82, 149, 132)}, - {"seashell", myRGB(255, 245, 238)}, - {"sienna", myRGB(150, 82, 45)}, - {"silver", myRGB(192, 192, 192)}, - {"skyblue", myRGB(114, 159, 255)}, - {"slateblue", myRGB(126, 136, 171)}, - {"slategray", myRGB(112, 128, 144)}, - {"snow", myRGB(255, 250, 250)}, - {"springgreen", myRGB(65, 172, 65)}, - {"steelblue", myRGB(84, 112, 170)}, - {"tan", myRGB(222, 184, 135)}, - {"thistle", myRGB(216, 191, 216)}, - {"tomato", myRGB(255, 99, 71)}, - {"transparent", myRGB(0, 0, 1)}, - {"turquoise", myRGB(25, 204, 223)}, - {"violet", myRGB(156, 62, 206)}, - {"violetred", myRGB(243, 62, 150)}, - {"wheat", myRGB(245, 222, 179)}, - {"white", myRGB(255, 255, 255)}, - {"whitesmoke", myRGB(245, 245, 245)}, - {"yellow", myRGB(255, 255, 0)}, - {"yellowgreen", myRGB(50, 216, 56)}, - {NULL, myRGB(0, 0, 0)} -}; -static int numTheRGBRecords = 235; - -static unsigned char ParseHexadecimal(char digit1, char digit2) -{ - unsigned char i1, i2; - - if (digit1 >= 'a') - i1 = (unsigned char)(digit1 - 'a' + 0x0A); - else if (digit1 >= 'A') - i1 = (unsigned char)(digit1 - 'A' + 0x0A); - else - i1 = (unsigned char)(digit1 - '0'); - if (digit2 >= 'a') - i2 = (unsigned char)(digit2 - 'a' + 0x0A); - else if (digit2 >= 'A') - i2 = (unsigned char)(digit2 - 'A' + 0x0A); - else - i2 = (unsigned char)(digit2 - '0'); - return (unsigned char)(0x10 * i1 + i2); -} - -static bool GetRGBFromName(const char *inname, bool *isNone, - unsigned char *r, unsigned char*g, unsigned char *b) -{ - int left, right, middle; - int cmp; - wxUint32 rgbVal; - char *name; - char *grey, *p; - - // Neither #rrggbb nor #rrrrggggbbbb are in database, we parse them directly - size_t inname_len = strlen(inname); - if ( *inname == '#' && (inname_len == 7 || inname_len == 13)) - { - size_t ofs = (inname_len == 7) ? 2 : 4; - *r = ParseHexadecimal(inname[1], inname[2]); - *g = ParseHexadecimal(inname[1*ofs+1], inname[1*ofs+2]); - *b = ParseHexadecimal(inname[2*ofs+1], inname[2*ofs+2]); - *isNone = false; - return true; - } - - name = wxStrdupA(inname); - - // theRGBRecords[] has no names with spaces, and no grey, but a - // lot of gray... - - // so first extract ' ' - while ((p = strchr(name, ' ')) != NULL) - { - while (*(p)) // till eof of string - { - *p = *(p + 1); // copy to the left - p++; - } - } - // fold to lower case - p = name; - while (*p) - { - *p = (char)tolower(*p); - p++; - } - - // substitute Grey with Gray, else rgbtab.h would have more than 100 - // 'duplicate' entries - if ( (grey = strstr(name, "grey")) != NULL ) - grey[2] = 'a'; - - // check for special 'none' colour: - bool found; - if ( strcmp(name, "none") == 0 ) - { - *isNone = true; - found = true; - } - else // not "None" - { - found = false; - - // binary search: - left = 0; - right = numTheRGBRecords - 1; - do - { - middle = (left + right) / 2; - cmp = strcmp(name, theRGBRecords[middle].name); - if ( cmp == 0 ) - { - rgbVal = theRGBRecords[middle].rgb; - *r = (unsigned char)((rgbVal >> 16) & 0xFF); - *g = (unsigned char)((rgbVal >> 8) & 0xFF); - *b = (unsigned char)((rgbVal) & 0xFF); - *isNone = false; - found = true; - break; - } - else if ( cmp < 0 ) - { - right = middle - 1; - } - else // cmp > 0 - { - left = middle + 1; - } - } while (left <= right); - } - - free(name); - - return found; -} - -static const char *ParseColor(const char *data) -{ - static const char *targets[] = - {"c ", "g ", "g4 ", "m ", "b ", "s ", NULL}; - - const char *p, *r; - const char *q; - int i; - - for (i = 0; targets[i] != NULL; i++) - { - r = data; - for (q = targets[i]; *r != '\0'; r++) - { - if ( *r != *q ) - continue; - if ( !isspace((int) (*(r - 1))) ) - continue; - p = r; - for (;;) - { - if ( *q == '\0' ) - return p; - if ( *p++ != *q++ ) - break; - } - q = targets[i]; - } - } - return NULL; -} - -struct wxXPMColourMapData -{ - wxXPMColourMapData() { R = G = B = 0; } - unsigned char R,G,B; -}; -WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap); - -wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) -{ - wxCHECK_MSG(xpm_data, wxNullImage, wxT("NULL XPM data") ); - - wxImage img; - int count; - unsigned width, height, colors_cnt, chars_per_pixel; - size_t i, j, i_key; - wxChar key[64]; - const char *clr_def; - bool hasMask; - wxXPMColourMap clr_tbl; - wxXPMColourMap::iterator it; - wxString maskKey; - - /* - * Read hints and initialize structures: - */ - - count = sscanf(xpm_data[0], "%u %u %u %u", - &width, &height, &colors_cnt, &chars_per_pixel); - if ( count != 4 || width * height * colors_cnt == 0 ) - { - wxLogError(_("XPM: incorrect header format!")); - return wxNullImage; - } - - // VS: XPM color map this large would be insane, since XPMs are encoded with - // 92 possible values on each position, 92^64 is *way* larger space than - // 8bit RGB... - wxCHECK_MSG(chars_per_pixel < 64, wxNullImage, wxT("XPM colormaps this large not supported.")); - - if ( !img.Create(width, height) ) - return wxNullImage; - - img.SetMask(false); - key[chars_per_pixel] = wxT('\0'); - hasMask = false; - - /* - * Create colour map: - */ - wxXPMColourMapData clr_data; - for (i = 0; i < colors_cnt; i++) - { - const char *xmpColLine = xpm_data[1 + i]; - - // we must have at least " x y" after the colour index, hence +5 - if ( !xmpColLine || strlen(xmpColLine) < chars_per_pixel + 5 ) - { - wxLogError(_("XPM: incorrect colour description in line %d"), - (int)(1 + i)); - return wxNullImage; - } - - for (i_key = 0; i_key < chars_per_pixel; i_key++) - key[i_key] = (wxChar)xmpColLine[i_key]; - clr_def = ParseColor(xmpColLine + chars_per_pixel); - - if ( clr_def == NULL ) - { - wxLogError(_("XPM: malformed colour definition '%s' at line %d!"), - xmpColLine, (int)(1 + i)); - return wxNullImage; - } - - bool isNone = false; - if ( !GetRGBFromName(clr_def, &isNone, - &clr_data.R, &clr_data.G, &clr_data.B) ) - { - wxLogError(_("XPM: malformed colour definition '%s' at line %d!"), - xmpColLine, (int)(1 + i)); - return wxNullImage; - } - - if ( isNone ) - { - img.SetMask(true); - img.SetMaskColour(255, 0, 255); - clr_data.R = - clr_data.B = 255; - clr_data.G = 0; - hasMask = true; - maskKey = key; - } - - clr_tbl[key] = clr_data; - } - - /* - * Modify colour entries with RGB = (255,0,255) to (255,0,254) if - * mask colour is present (so that existing pixels with (255,0,255) - * magenta colour are not incorrectly made transparent): - */ - if (hasMask) - { - for (it = clr_tbl.begin(); it != clr_tbl.end(); ++it) - { - if (it->second.R == 255 && it->second.G == 0 && - it->second.B == 255 && - it->first != maskKey) - { - it->second.B = 254; - } - } - } - - /* - * Parse image data: - */ - - unsigned char *img_data = img.GetData(); - wxXPMColourMap::iterator entry; - wxXPMColourMap::iterator end = clr_tbl.end(); - - for (j = 0; j < height; j++) - { - for (i = 0; i < width; i++, img_data += 3) - { - const char *xpmImgLine = xpm_data[1 + colors_cnt + j]; - if ( !xpmImgLine || strlen(xpmImgLine) < width*chars_per_pixel ) - { - wxLogError(_("XPM: truncated image data at line %d!"), - (int)(1 + colors_cnt + j)); - return wxNullImage; - } - - for (i_key = 0; i_key < chars_per_pixel; i_key++) - { - key[i_key] = (wxChar)xpmImgLine[chars_per_pixel * i + i_key]; - } - - entry = clr_tbl.find(key); - if ( entry == end ) - { - wxLogError(_("XPM: Malformed pixel data!")); - - // better return right now as otherwise we risk to flood the - // user with error messages as something seems to be seriously - // wrong with the file and so we could give this message for - // each remaining pixel if we don't bail out - return wxNullImage; - } - else - { - img_data[0] = entry->second.R; - img_data[1] = entry->second.G; - img_data[2] = entry->second.B; - } - } - } - -#if wxUSE_PALETTE - unsigned char* r = new unsigned char[colors_cnt]; - unsigned char* g = new unsigned char[colors_cnt]; - unsigned char* b = new unsigned char[colors_cnt]; - - for (it = clr_tbl.begin(), i = 0; it != clr_tbl.end(); it++, i++) - { - r[i] = it->second.R; - g[i] = it->second.G; - b[i] = it->second.B; - } - wxASSERT(i == colors_cnt); - img.SetPalette(wxPalette(colors_cnt, r, g, b)); - delete[] r; - delete[] g; - delete[] b; -#endif // wxUSE_PALETTE - - return img; -} - -#endif // wxUSE_IMAGE && wxUSE_XPM diff --git a/Source/3rdParty/wx/src/common/xti.cpp b/Source/3rdParty/wx/src/common/xti.cpp deleted file mode 100644 index 9542896f7..000000000 --- a/Source/3rdParty/wx/src/common/xti.cpp +++ /dev/null @@ -1,767 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/xti.cpp -// Purpose: runtime metadata information (extended class info -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xti.cpp 38857 2006-04-20 07:31:44Z ABX $ -// Copyright: (c) 1997 Julian Smart -// (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_EXTENDED_RTTI - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/list.h" - #include "wx/hash.h" -#endif - -#include "wx/xti.h" -#include "wx/xml/xml.h" -#include "wx/tokenzr.h" -#include - -#include "wx/beforestd.h" -#include -#include -#include -#include "wx/afterstd.h" - -using namespace std ; - -// ---------------------------------------------------------------------------- -// Enum Support -// ---------------------------------------------------------------------------- - -wxEnumData::wxEnumData( wxEnumMemberData* data ) -{ - m_members = data ; - for ( m_count = 0; m_members[m_count].m_name ; m_count++) - {} ; -} - -bool wxEnumData::HasEnumMemberValue(const wxChar *name, int *value) const -{ - int i; - for (i = 0; m_members[i].m_name ; i++ ) - { - if (!wxStrcmp(name, m_members[i].m_name)) - { - if ( value ) - *value = m_members[i].m_value; - return true ; - } - } - return false ; -} - -int wxEnumData::GetEnumMemberValue(const wxChar *name) const -{ - int i; - for (i = 0; m_members[i].m_name ; i++ ) - { - if (!wxStrcmp(name, m_members[i].m_name)) - { - return m_members[i].m_value; - } - } - return 0 ; -} - -const wxChar *wxEnumData::GetEnumMemberName(int value) const -{ - int i; - for (i = 0; m_members[i].m_name ; i++) - if (value == m_members[i].m_value) - return m_members[i].m_name; - - return wxEmptyString ; -} - -int wxEnumData::GetEnumMemberValueByIndex( int idx ) const -{ - // we should cache the count in order to avoid out-of-bounds errors - return m_members[idx].m_value ; -} - -const wxChar * wxEnumData::GetEnumMemberNameByIndex( int idx ) const -{ - // we should cache the count in order to avoid out-of-bounds errors - return m_members[idx].m_name ; -} - -// ---------------------------------------------------------------------------- -// Type Information -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// value streaming -// ---------------------------------------------------------------------------- - -// streamer specializations -// for all built-in types - -// bool - -template<> void wxStringReadValue(const wxString &s , bool &data ) -{ - int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; - data = (bool)intdata ; -} - -template<> void wxStringWriteValue(wxString &s , const bool &data ) -{ - s = wxString::Format(_T("%d"), data ) ; -} - -// char - -template<> void wxStringReadValue(const wxString &s , char &data ) -{ - int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; - data = char(intdata) ; -} - -template<> void wxStringWriteValue(wxString &s , const char &data ) -{ - s = wxString::Format(_T("%d"), data ) ; -} - -// unsigned char - -template<> void wxStringReadValue(const wxString &s , unsigned char &data ) -{ - int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; - data = (unsigned char)(intdata) ; -} - -template<> void wxStringWriteValue(wxString &s , const unsigned char &data ) -{ - s = wxString::Format(_T("%d"), data ) ; -} - -// int - -template<> void wxStringReadValue(const wxString &s , int &data ) -{ - wxSscanf(s, _T("%d"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const int &data ) -{ - s = wxString::Format(_T("%d"), data ) ; -} - -// unsigned int - -template<> void wxStringReadValue(const wxString &s , unsigned int &data ) -{ - wxSscanf(s, _T("%d"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const unsigned int &data ) -{ - s = wxString::Format(_T("%d"), data ) ; -} - -// long - -template<> void wxStringReadValue(const wxString &s , long &data ) -{ - wxSscanf(s, _T("%ld"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const long &data ) -{ - s = wxString::Format(_T("%ld"), data ) ; -} - -// unsigned long - -template<> void wxStringReadValue(const wxString &s , unsigned long &data ) -{ - wxSscanf(s, _T("%ld"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const unsigned long &data ) -{ - s = wxString::Format(_T("%ld"), data ) ; -} - -// float - -template<> void wxStringReadValue(const wxString &s , float &data ) -{ - wxSscanf(s, _T("%f"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const float &data ) -{ - s = wxString::Format(_T("%f"), data ) ; -} - -// double - -template<> void wxStringReadValue(const wxString &s , double &data ) -{ - wxSscanf(s, _T("%lf"), &data ) ; -} - -template<> void wxStringWriteValue(wxString &s , const double &data ) -{ - s = wxString::Format(_T("%lf"), data ) ; -} - -// wxString - -template<> void wxStringReadValue(const wxString &s , wxString &data ) -{ - data = s ; -} - -template<> void wxStringWriteValue(wxString &s , const wxString &data ) -{ - s = data ; -} - -// built-ins -// - -#if wxUSE_FUNC_TEMPLATE_POINTER -#define wxBUILTIN_TYPE_INFO( element , type ) \ - wxBuiltInTypeInfo s_typeInfo##type(element , &wxToStringConverter , &wxFromStringConverter , typeid(type).name()) ; -#else -#define wxBUILTIN_TYPE_INFO( element , type ) \ - void _toString##element( const wxxVariant& data , wxString &result ) { wxToStringConverter(data, result); } \ - void _fromString##element( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } \ - wxBuiltInTypeInfo s_typeInfo##type(element , &_toString##element , &_fromString##element , typeid(type).name()) ; -#endif - -typedef unsigned char unsigned_char; -typedef unsigned int unsigned_int; -typedef unsigned long unsigned_long; - -wxBuiltInTypeInfo s_typeInfovoid( wxT_VOID , NULL , NULL , typeid(void).name()); -wxBUILTIN_TYPE_INFO( wxT_BOOL , bool); -wxBUILTIN_TYPE_INFO( wxT_CHAR , char); -wxBUILTIN_TYPE_INFO( wxT_UCHAR , unsigned_char); -wxBUILTIN_TYPE_INFO( wxT_INT , int); -wxBUILTIN_TYPE_INFO( wxT_UINT , unsigned_int); -wxBUILTIN_TYPE_INFO( wxT_LONG , long); -wxBUILTIN_TYPE_INFO( wxT_ULONG , unsigned_long); -wxBUILTIN_TYPE_INFO( wxT_FLOAT , float); -wxBUILTIN_TYPE_INFO( wxT_DOUBLE , double); -wxBUILTIN_TYPE_INFO( wxT_STRING , wxString); - - -// this are compiler induced specialization which are never used anywhere - -wxILLEGAL_TYPE_SPECIALIZATION( char const * ) -wxILLEGAL_TYPE_SPECIALIZATION( char * ) -wxILLEGAL_TYPE_SPECIALIZATION( unsigned char * ) -wxILLEGAL_TYPE_SPECIALIZATION( int * ) -wxILLEGAL_TYPE_SPECIALIZATION( bool * ) -wxILLEGAL_TYPE_SPECIALIZATION( long * ) -wxILLEGAL_TYPE_SPECIALIZATION( wxString * ) - -wxCOLLECTION_TYPE_INFO( wxString , wxArrayString ) ; - -template<> void wxCollectionToVariantArray( wxArrayString const &theArray, wxxVariantArray &value) -{ - wxArrayCollectionToVariantArray( theArray , value ) ; -} - -wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL ; - -wxTypeInfo *wxTypeInfo::FindType(const wxChar *typeName) -{ - wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName) ; - wxASSERT_MSG( iter != ms_typeTable->end() , wxT("lookup for a non-existent type-info") ) ; - return (wxTypeInfo *)iter->second; -} - -#if wxUSE_UNICODE -wxClassTypeInfo::wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name) : -wxTypeInfo( kind , to , from , name) -{ wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT , wxT("Illegal Kind for Enum Type")) ; m_classInfo = classInfo ;} -#endif - -wxClassTypeInfo::wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const wxString &name) : -wxTypeInfo( kind , to , from , name) -{ wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT , wxT("Illegal Kind for Enum Type")) ; m_classInfo = classInfo ;} - -wxDelegateTypeInfo::wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to , converterFromString_t from ) : -wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString ) -{ m_eventClass = eventClass ; m_eventType = eventType ; m_lastEventType = -1 ;} - -wxDelegateTypeInfo::wxDelegateTypeInfo( int eventType , int lastEventType , wxClassInfo* eventClass , converterToString_t to , converterFromString_t from ) : -wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString ) -{ m_eventClass = eventClass ; m_eventType = eventType ; m_lastEventType = lastEventType; } - -void wxTypeInfo::Register() -{ - if ( ms_typeTable == NULL ) - ms_typeTable = new wxTypeInfoMap() ; - - if( !m_name.empty() ) - (*ms_typeTable)[m_name] = this ; -} - -void wxTypeInfo::Unregister() -{ - if( !m_name.empty() ) - ms_typeTable->erase(m_name); -} - -// removing header dependancy on string tokenizer - -void wxSetStringToArray( const wxString &s , wxArrayString &array ) -{ - wxStringTokenizer tokenizer(s, wxT("| \t\n"), wxTOKEN_STRTOK); - wxString flag; - array.Clear() ; - while (tokenizer.HasMoreTokens()) - { - array.Add(tokenizer.GetNextToken()) ; - } -} - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -wxPropertyInfo::~wxPropertyInfo() -{ - if ( this == m_itsClass->m_firstProperty ) - { - m_itsClass->m_firstProperty = m_next; - } - else - { - wxPropertyInfo *info = m_itsClass->m_firstProperty; - while (info) - { - if ( info->m_next == this ) - { - info->m_next = m_next; - break; - } - - info = info->m_next; - } - } -} - -wxHandlerInfo::~wxHandlerInfo() -{ - if ( this == m_itsClass->m_firstHandler ) - { - m_itsClass->m_firstHandler = m_next; - } - else - { - wxHandlerInfo *info = m_itsClass->m_firstHandler; - while (info) - { - if ( info->m_next == this ) - { - info->m_next = m_next; - break; - } - - info = info->m_next; - } - } -} - -const wxPropertyAccessor *wxClassInfo::FindAccessor(const wxChar *PropertyName) const -{ - const wxPropertyInfo* info = FindPropertyInfo( PropertyName ) ; - - if ( info ) - return info->GetAccessor() ; - - return NULL ; -} - -wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const -{ - wxPropertyInfo* info = m_firstProperty ; - - while( info ) - { - if ( wxStrcmp( info->GetName() , PropertyName ) == 0 ) - return info ; - info = info->GetNext() ; - } - - return 0; -} - -const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const wxChar *PropertyName) const -{ - const wxPropertyInfo* info = FindPropertyInfoInThisClass( PropertyName ) ; - if ( info ) - return info ; - - const wxClassInfo** parents = GetParents() ; - for ( int i = 0 ; parents[i] ; ++ i ) - { - if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != NULL ) - return info ; - } - - return 0; -} - -wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyName) const -{ - wxHandlerInfo* info = m_firstHandler ; - - while( info ) - { - if ( wxStrcmp( info->GetName() , PropertyName ) == 0 ) - return info ; - info = info->GetNext() ; - } - - return 0; -} - -const wxHandlerInfo *wxClassInfo::FindHandlerInfo (const wxChar *PropertyName) const -{ - const wxHandlerInfo* info = FindHandlerInfoInThisClass( PropertyName ) ; - - if ( info ) - return info ; - - const wxClassInfo** parents = GetParents() ; - for ( int i = 0 ; parents[i] ; ++ i ) - { - if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != NULL ) - return info ; - } - - return 0; -} - -wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const -{ - if ( m_streamingCallback ) - return m_streamingCallback ; - - wxObjectStreamingCallback retval = NULL ; - const wxClassInfo** parents = GetParents() ; - for ( int i = 0 ; parents[i] && retval == NULL ; ++ i ) - { - retval = parents[i]->GetStreamingCallback() ; - } - return retval ; -} - -bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const -{ - wxObjectStreamingCallback sb = GetStreamingCallback() ; - if ( sb ) - return (*sb)(obj , streamer , persister , metadata ) ; - - return true ; -} - -void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxxVariant &value) const -{ - const wxPropertyAccessor *accessor; - - accessor = FindAccessor(propertyName); - wxASSERT(accessor->HasSetter()); - accessor->SetProperty( object , value ) ; -} - -wxxVariant wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const -{ - const wxPropertyAccessor *accessor; - - accessor = FindAccessor(propertyName); - wxASSERT(accessor->HasGetter()); - wxxVariant result ; - accessor->GetProperty(object,result); - return result ; -} - -wxxVariantArray wxClassInfo::GetPropertyCollection(wxObject *object, const wxChar *propertyName) const -{ - const wxPropertyAccessor *accessor; - - accessor = FindAccessor(propertyName); - wxASSERT(accessor->HasGetter()); - wxxVariantArray result ; - accessor->GetPropertyCollection(object,result); - return result ; -} - -void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const -{ - const wxPropertyAccessor *accessor; - - accessor = FindAccessor(propertyName); - wxASSERT(accessor->HasAdder()); - accessor->AddToPropertyCollection( object , value ) ; -} - -// void wxClassInfo::GetProperties( wxPropertyInfoMap &map ) const -// The map parameter (the name map that is) seems something special -// to MSVC and so we use a other name. -void wxClassInfo::GetProperties( wxPropertyInfoMap &infomap ) const -{ - const wxPropertyInfo *pi = GetFirstProperty() ; - while( pi ) - { - if ( infomap.find( pi->GetName() ) == infomap.end() ) - infomap[pi->GetName()] = (wxPropertyInfo*) pi ; - - pi = pi->GetNext() ; - } - - const wxClassInfo** parents = GetParents() ; - for ( int i = 0 ; parents[i] ; ++ i ) - { - parents[i]->GetProperties( infomap ) ; - } -} - -/* -VARIANT TO OBJECT -*/ - -wxObject* wxxVariant::GetAsObject() -{ - const wxClassTypeInfo *ti = dynamic_cast( m_data->GetTypeInfo() ) ; - if ( ti ) - return ti->GetClassInfo()->VariantToInstance(*this) ; - else - return NULL ; -} - -// ---------------------------------------------------------------------------- -// wxDynamicObject support -// ---------------------------------------------------------------------------- -// -// Dynamic Objects are objects that have a real superclass instance and carry their -// own attributes in a hash map. Like this it is possible to create the objects and -// stream them, as if their class information was already available from compiled data - -struct wxDynamicObject::wxDynamicObjectInternal -{ - wxDynamicObjectInternal() {} - -#if wxUSE_UNICODE - map m_properties ; -#else - map m_properties ; -#endif -} ; - -typedef list< wxDynamicObject* > wxDynamicObjectList ; - -struct wxDynamicClassInfo::wxDynamicClassInfoInternal -{ - wxDynamicObjectList m_dynamicObjects ; -} ; - -// instantiates this object with an instance of its superclass -wxDynamicObject::wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) -{ - m_superClassInstance = superClassInstance ; - m_classInfo = info ; - m_data = new wxDynamicObjectInternal ; -} - -wxDynamicObject::~wxDynamicObject() -{ - dynamic_cast(m_classInfo)->m_data->m_dynamicObjects.remove( this ) ; - delete m_data ; - delete m_superClassInstance ; -} - -void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant &value) -{ - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ; - m_data->m_properties[propertyName] = value ; -} - -wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const -{ - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ; - return m_data->m_properties[propertyName] ; -} - -void wxDynamicObject::RemoveProperty( const wxChar *propertyName ) -{ - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Removing Unknown Property in a Dynamic Object") ) ; - m_data->m_properties.erase( propertyName ) ; -} - -void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) -{ - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),wxT("Renaming Unknown Property in a Dynamic Object") ) ; - wxxVariant value = m_data->m_properties[oldPropertyName] ; - m_data->m_properties.erase( oldPropertyName ) ; - m_data->m_properties[newPropertyName] = value ; -} - - -// ---------------------------------------------------------------------------- -// wxDynamiClassInfo -// ---------------------------------------------------------------------------- - -wxDynamicClassInfo::wxDynamicClassInfo( const wxChar *unitName, const wxChar *className , const wxClassInfo* superClass ) : -wxClassInfo( unitName, className , new const wxClassInfo*[2]) -{ - GetParents()[0] = superClass ; - GetParents()[1] = NULL ; - m_data = new wxDynamicClassInfoInternal ; -} - -wxDynamicClassInfo::~wxDynamicClassInfo() -{ - delete[] GetParents() ; - delete m_data ; -} - -wxObject *wxDynamicClassInfo::AllocateObject() const -{ - wxObject* parent = GetParents()[0]->AllocateObject() ; - wxDynamicObject *obj = new wxDynamicObject( parent , this ) ; - m_data->m_dynamicObjects.push_back( obj ) ; - return obj ; -} - -void wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxxVariant *params) const -{ - wxDynamicObject *dynobj = dynamic_cast< wxDynamicObject *>( object ) ; - wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::Create on an object other than wxDynamicObject") ) ; - GetParents()[0]->Create( dynobj->GetSuperClassInstance() , paramCount , params ) ; -} - -// get number of parameters for constructor -int wxDynamicClassInfo::GetCreateParamCount() const -{ - return GetParents()[0]->GetCreateParamCount() ; -} - -// get i-th constructor parameter -const wxChar* wxDynamicClassInfo::GetCreateParamName(int i) const -{ - return GetParents()[0]->GetCreateParamName( i ) ; -} - -void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxxVariant &value) const -{ - wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; - wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; - if ( FindPropertyInfoInThisClass(propertyName) ) - dynobj->SetProperty( propertyName , value ) ; - else - GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance() , propertyName , value ) ; -} - -wxxVariant wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const -{ - wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; - wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; - if ( FindPropertyInfoInThisClass(propertyName) ) - return dynobj->GetProperty( propertyName ) ; - else - return GetParents()[0]->GetProperty( dynobj->GetSuperClassInstance() , propertyName ) ; -} - -void wxDynamicClassInfo::AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) -{ - new wxPropertyInfo( m_firstProperty , this , propertyName , typeInfo->GetTypeName() , new wxGenericPropertyAccessor( propertyName ) , wxxVariant() ) ; -} - -void wxDynamicClassInfo::AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) -{ - new wxHandlerInfo( m_firstHandler , this , handlerName , address , eventClassInfo ) ; -} - -// removes an existing runtime-property -void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) -{ - for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter ) - (*iter)->RemoveProperty( propertyName ) ; - delete FindPropertyInfoInThisClass(propertyName) ; -} - -// removes an existing runtime-handler -void wxDynamicClassInfo::RemoveHandler( const wxChar *handlerName ) -{ - delete FindHandlerInfoInThisClass(handlerName) ; -} - -// renames an existing runtime-property -void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) -{ - wxPropertyInfo* pi = FindPropertyInfoInThisClass(oldPropertyName) ; - wxASSERT_MSG( pi ,wxT("not existing property") ) ; - pi->m_name = newPropertyName ; - dynamic_cast(pi->GetAccessor())->RenameProperty( oldPropertyName , newPropertyName ) ; - for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter ) - (*iter)->RenameProperty( oldPropertyName , newPropertyName ) ; -} - -// renames an existing runtime-handler -void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) -{ - wxASSERT_MSG(FindHandlerInfoInThisClass(oldHandlerName),wxT("not existing handler") ) ; - FindHandlerInfoInThisClass(oldHandlerName)->m_name = newHandlerName ; -} - -// ---------------------------------------------------------------------------- -// wxGenericPropertyAccessor -// ---------------------------------------------------------------------------- - -struct wxGenericPropertyAccessor::wxGenericPropertyAccessorInternal -{ - char filler ; -} ; - -wxGenericPropertyAccessor::wxGenericPropertyAccessor( const wxString& propertyName ) -: wxPropertyAccessor( NULL , NULL , NULL , NULL ) -{ - m_data = new wxGenericPropertyAccessorInternal ; - m_propertyName = propertyName ; - m_getterName = wxT("Get")+propertyName ; - m_setterName = wxT("Set")+propertyName ; -} - -wxGenericPropertyAccessor::~wxGenericPropertyAccessor() -{ - delete m_data ; -} -void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxxVariant &value) const -{ - wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; - wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; - dynobj->SetProperty(m_propertyName , value ) ; -} - -void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxxVariant& value) const -{ - const wxDynamicObject* dynobj = dynamic_cast< const wxDynamicObject * >( object ) ; - wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; - value = dynobj->GetProperty( m_propertyName ) ; -} - -#endif // wxUSE_EXTENDED_RTTI diff --git a/Source/3rdParty/wx/src/common/xtistrm.cpp b/Source/3rdParty/wx/src/common/xtistrm.cpp deleted file mode 100644 index eeb0cf4d5..000000000 --- a/Source/3rdParty/wx/src/common/xtistrm.cpp +++ /dev/null @@ -1,847 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/xtistrm.cpp -// Purpose: streaming runtime metadata information -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xtistrm.cpp 38939 2006-04-27 12:47:14Z ABX $ -// Copyright: (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_EXTENDED_RTTI - -#include "wx/xtistrm.h" - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/hash.h" - #include "wx/event.h" -#endif - -#include "wx/tokenzr.h" -#include "wx/txtstrm.h" - -#include "wx/beforestd.h" -#include -#include -#include -#include "wx/afterstd.h" - -using namespace std ; - -struct wxWriter::wxWriterInternal -{ - map< const wxObject* , int > m_writtenObjects ; - int m_nextId ; -} ; - -wxWriter::wxWriter() -{ - m_data = new wxWriterInternal ; - m_data->m_nextId = 0 ; -} - -wxWriter::~wxWriter() -{ - delete m_data ; -} - -struct wxWriter::wxWriterInternalPropertiesData -{ - char nothing ; -} ; - -void wxWriter::ClearObjectContext() -{ - delete m_data ; - m_data = new wxWriterInternal() ; - m_data->m_nextId = 0 ; -} - -void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , const wxString &name , wxxVariantArray &metadata ) -{ - DoBeginWriteTopLevelEntry( name ) ; - WriteObject( object , classInfo , persister , false , metadata) ; - DoEndWriteTopLevelEntry( name ) ; -} - -void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded, wxxVariantArray &metadata ) -{ - if ( !classInfo->BeforeWriteObject( object , this , persister , metadata) ) - return ; - - if ( persister->BeforeWriteObject( this , object , classInfo , metadata) ) - { - if ( object == NULL ) - DoWriteNullObject() ; - else if ( IsObjectKnown( object ) ) - DoWriteRepeatedObject( GetObjectID(object) ) ; - else - { - int oid = m_data->m_nextId++ ; - if ( !isEmbedded ) - m_data->m_writtenObjects[object] = oid ; - - // in case this object is a wxDynamicObject we also have to insert is superclass - // instance with the same id, so that object relations are streamed out correctly - const wxDynamicObject* dynobj = dynamic_cast( object ) ; - if ( !isEmbedded && dynobj ) - m_data->m_writtenObjects[dynobj->GetSuperClassInstance()] = oid ; - - DoBeginWriteObject( object , classInfo , oid , metadata ) ; - wxWriterInternalPropertiesData data ; - WriteAllProperties( object , classInfo , persister , &data ) ; - DoEndWriteObject( object , classInfo , oid ) ; - } - persister->AfterWriteObject( this ,object , classInfo ) ; - } -} - -void wxWriter::FindConnectEntry(const wxEvtHandler * evSource,const wxDelegateTypeInfo* dti, const wxObject* &sink , const wxHandlerInfo *&handler) -{ - wxList *dynamicEvents = evSource->GetDynamicEventTable() ; - - if ( dynamicEvents ) - { - wxList::compatibility_iterator node = dynamicEvents->GetFirst(); - while (node) - { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); - - // find the match - if ( entry->m_fn && - (dti->GetEventType() == entry->m_eventType) && - (entry->m_id == -1 ) && - (entry->m_eventSink != NULL ) ) - { - sink = entry->m_eventSink ; - const wxClassInfo* sinkClassInfo = sink->GetClassInfo() ; - const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler() ; - while ( sinkHandler ) - { - if ( sinkHandler->GetEventFunction() == entry->m_fn ) - { - handler = sinkHandler ; - break ; - } - sinkHandler = sinkHandler->GetNext() ; - } - break ; - } - node = node->GetNext(); - } - } -} -void wxWriter::WriteAllProperties( const wxObject * obj , const wxClassInfo* ci , wxPersister *persister, wxWriterInternalPropertiesData * data ) -{ - wxPropertyInfoMap map ; - ci->GetProperties( map ) ; - for ( int i = 0 ; i < ci->GetCreateParamCount() ; ++i ) - { - wxString name = ci->GetCreateParamName(i) ; - const wxPropertyInfo* prop = map.find(name)->second ; - if ( prop ) - { - WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; - } - else - { - wxLogError( _("Create Parameter not found in declared RTTI Parameters") ) ; - } - map.erase( name ) ; - } - { // Extra block for broken compilers - for( wxPropertyInfoMap::iterator iter = map.begin() ; iter != map.end() ; ++iter ) - { - const wxPropertyInfo* prop = iter->second ; - if ( prop->GetFlags() & wxPROP_OBJECT_GRAPH ) - { - WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; - } - } - } - { // Extra block for broken compilers - for( wxPropertyInfoMap::iterator iter = map.begin() ; iter != map.end() ; ++iter ) - { - const wxPropertyInfo* prop = iter->second ; - if ( !(prop->GetFlags() & wxPROP_OBJECT_GRAPH) ) - { - WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; - } - } - } -} - -void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *WXUNUSED(data) ) -{ - if ( pi->GetFlags() & wxPROP_DONT_STREAM ) - return ; - - // make sure that we are picking the correct object for accessing the property - const wxDynamicObject* dynobj = dynamic_cast< const wxDynamicObject* > (obj ) ; - if ( dynobj && (dynamic_cast(ci) == NULL) ) - obj = dynobj->GetSuperClassInstance() ; - - if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION ) - { - wxxVariantArray data ; - pi->GetAccessor()->GetPropertyCollection(obj, data) ; - const wxTypeInfo * elementType = dynamic_cast< const wxCollectionTypeInfo* >( pi->GetTypeInfo() )->GetElementType() ; - for ( size_t i = 0 ; i < data.GetCount() ; ++i ) - { - if ( i == 0 ) - DoBeginWriteProperty( pi ) ; - - DoBeginWriteElement() ; - wxxVariant value = data[i] ; - if ( persister->BeforeWriteProperty( this , obj, pi , value ) ) - { - const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( elementType ) ; - if ( cti ) - { - const wxClassInfo* pci = cti->GetClassInfo() ; - wxObject *vobj = pci->VariantToInstance( value ) ; - wxxVariantArray md ; - WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md ) ; - } - else - { - DoWriteSimpleType( value ) ; - } - } - DoEndWriteElement() ; - if ( i == data.GetCount() - 1 ) - DoEndWriteProperty( pi ) ; - } - } - else - { - const wxDelegateTypeInfo* dti = dynamic_cast< const wxDelegateTypeInfo* > ( pi->GetTypeInfo() ) ; - if ( dti ) - { - const wxObject* sink = NULL ; - const wxHandlerInfo *handler = NULL ; - - const wxEvtHandler * evSource = dynamic_cast(obj) ; - if ( evSource ) - { - FindConnectEntry( evSource , dti , sink , handler ) ; - if ( persister->BeforeWriteDelegate( this , obj , ci , pi , sink , handler ) ) - { - if ( sink != NULL && handler != NULL ) - { - DoBeginWriteProperty( pi ) ; - if ( IsObjectKnown( sink ) ) - { - DoWriteDelegate( obj , ci , pi , sink , GetObjectID( sink ) , sink->GetClassInfo() , handler ) ; - DoEndWriteProperty( pi ) ; - } - else - { - wxLogError( _("Streaming delegates for not already streamed objects not yet supported") ) ; - } - } - } - } - else - { - wxLogError(_("Illegal Object Class (Non-wxEvtHandler) as Event Source") ) ; - } - } - else - { - wxxVariant value ; - pi->GetAccessor()->GetProperty(obj, value) ; - - // avoid streaming out void objects - if( value.IsEmpty() ) - return ; - - if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG ) - { - const wxEnumTypeInfo *eti = dynamic_cast( pi->GetTypeInfo() ) ; - if ( eti ) - { - eti->ConvertFromLong( value.wxTEMPLATED_MEMBER_CALL(Get , long) , value ) ; - } - else - { - wxLogError( _("Type must have enum - long conversion") ) ; - } - } - - // avoid streaming out default values - if ( pi->GetTypeInfo()->HasStringConverters() && !pi->GetDefaultValue().IsEmpty() ) - { - if ( value.GetAsString() == pi->GetDefaultValue().GetAsString() ) - return ; - } - - // avoid streaming out null objects - const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( pi->GetTypeInfo() ) ; - - if ( cti && value.GetAsObject() == NULL ) - return ; - - if ( persister->BeforeWriteProperty( this , obj, pi , value ) ) - { - DoBeginWriteProperty( pi ) ; - if ( cti ) - { - const wxClassInfo* pci = cti->GetClassInfo() ; - wxObject *vobj = pci->VariantToInstance( value ) ; - if ( vobj && pi->GetTypeInfo()->HasStringConverters() ) - { - wxString stringValue ; - cti->ConvertToString( value , stringValue ) ; - wxxVariant convertedValue(stringValue) ; - DoWriteSimpleType( convertedValue ) ; - } - else - { - wxxVariantArray md ; - WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md) ; - } - } - else - { - DoWriteSimpleType( value ) ; - } - DoEndWriteProperty( pi ) ; - } - } - } -} - -int wxWriter::GetObjectID(const wxObject *obj) -{ - if ( !IsObjectKnown( obj ) ) - return wxInvalidObjectID ; - - return m_data->m_writtenObjects[obj] ; -} - -bool wxWriter::IsObjectKnown( const wxObject *obj ) -{ - return m_data->m_writtenObjects.find( obj ) != m_data->m_writtenObjects.end() ; -} - - -// ---------------------------------------------------------------------------- -// reading objects in -// ---------------------------------------------------------------------------- - -struct wxReader::wxReaderInternal -{ - map m_classInfos; -}; - -wxReader::wxReader() -{ - m_data = new wxReaderInternal; -} - -wxReader::~wxReader() -{ - delete m_data; -} - -wxClassInfo* wxReader::GetObjectClassInfo(int objectID) -{ - if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) - { - wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ; - return NULL ; - } - if ( m_data->m_classInfos.find(objectID) == m_data->m_classInfos.end() ) - { - wxLogError( _("Unknown Object passed to GetObjectClassInfo" ) ) ; - return NULL ; - } - return m_data->m_classInfos[objectID] ; -} - -void wxReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo ) -{ - if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) - { - wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ; - return ; - } - if ( m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ) - { - wxLogError( _("Already Registered Object passed to SetObjectClassInfo" ) ) ; - return ; - } - m_data->m_classInfos[objectID] = classInfo ; -} - -bool wxReader::HasObjectClassInfo( int objectID ) -{ - if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) - { - wxLogError( _("Invalid or Null Object ID passed to HasObjectClassInfo" ) ) ; - return NULL ; - } - return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ; -} - - -// ---------------------------------------------------------------------------- -// reading xml in -// ---------------------------------------------------------------------------- - -/* -Reading components has not to be extended for components -as properties are always sought by typeinfo over all levels -and create params are always toplevel class only -*/ - - -// ---------------------------------------------------------------------------- -// depersisting to memory -// ---------------------------------------------------------------------------- - -struct wxRuntimeDepersister::wxRuntimeDepersisterInternal -{ - map m_objects; - - void SetObject(int objectID, wxObject *obj ) - { - if ( m_objects.find(objectID) != m_objects.end() ) - { - wxLogError( _("Passing a already registered object to SetObject") ) ; - return ; - } - m_objects[objectID] = obj ; - } - wxObject* GetObject( int objectID ) - { - if ( objectID == wxNullObjectID ) - return NULL ; - if ( m_objects.find(objectID) == m_objects.end() ) - { - wxLogError( _("Passing an unkown object to GetObject") ) ; - return NULL ; - } - - return m_objects[objectID] ; - } -} ; - -wxRuntimeDepersister::wxRuntimeDepersister() -{ - m_data = new wxRuntimeDepersisterInternal() ; -} - -wxRuntimeDepersister::~wxRuntimeDepersister() -{ - delete m_data ; -} - -void wxRuntimeDepersister::AllocateObject(int objectID, wxClassInfo *classInfo , - wxxVariantArray &WXUNUSED(metadata)) -{ - wxObject *O; - O = classInfo->CreateObject(); - m_data->SetObject(objectID, O); -} - -void wxRuntimeDepersister::CreateObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *params, - int *objectIdValues, - const wxClassInfo **objectClassInfos , - wxxVariantArray &WXUNUSED(metadata)) -{ - wxObject *o; - o = m_data->GetObject(objectID); - for ( int i = 0 ; i < paramCount ; ++i ) - { - if ( objectIdValues[i] != wxInvalidObjectID ) - { - wxObject *o; - o = m_data->GetObject(objectIdValues[i]); - // if this is a dynamic object and we are asked for another class - // than wxDynamicObject we cast it down manually. - wxDynamicObject *dyno = dynamic_cast< wxDynamicObject * > (o) ; - if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) - { - o = dyno->GetSuperClassInstance() ; - } - params[i] = objectClassInfos[i]->InstanceToVariant(o) ; - } - } - classInfo->Create(o, paramCount, params); -} - -void wxRuntimeDepersister::ConstructObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *params, - int *objectIdValues, - const wxClassInfo **objectClassInfos , - wxxVariantArray &WXUNUSED(metadata)) -{ - wxObject *o; - for ( int i = 0 ; i < paramCount ; ++i ) - { - if ( objectIdValues[i] != wxInvalidObjectID ) - { - wxObject *o; - o = m_data->GetObject(objectIdValues[i]); - // if this is a dynamic object and we are asked for another class - // than wxDynamicObject we cast it down manually. - wxDynamicObject *dyno = dynamic_cast< wxDynamicObject * > (o) ; - if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) - { - o = dyno->GetSuperClassInstance() ; - } - params[i] = objectClassInfos[i]->InstanceToVariant(o) ; - } - } - o = classInfo->ConstructObject(paramCount, params); - m_data->SetObject(objectID, o); -} - - -void wxRuntimeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) -{ - wxObject *o; - o = m_data->GetObject(objectID); - delete o ; -} - -void wxRuntimeDepersister::SetProperty(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo, - const wxxVariant &value) -{ - wxObject *o; - o = m_data->GetObject(objectID); - classInfo->SetProperty( o , propertyInfo->GetName() , value ) ; -} - -void wxRuntimeDepersister::SetPropertyAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo, - int valueObjectId) -{ - wxObject *o, *valo; - o = m_data->GetObject(objectID); - valo = m_data->GetObject(valueObjectId); - const wxClassInfo* valClassInfo = (dynamic_cast(propertyInfo->GetTypeInfo()))->GetClassInfo() ; - // if this is a dynamic object and we are asked for another class - // than wxDynamicObject we cast it down manually. - wxDynamicObject *dynvalo = dynamic_cast< wxDynamicObject * > (valo) ; - if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) - { - valo = dynvalo->GetSuperClassInstance() ; - } - - classInfo->SetProperty( o , propertyInfo->GetName() , valClassInfo->InstanceToVariant(valo) ) ; -} - -void wxRuntimeDepersister::SetConnect(int eventSourceObjectID, - const wxClassInfo *WXUNUSED(eventSourceClassInfo), - const wxPropertyInfo *delegateInfo , - const wxClassInfo *WXUNUSED(eventSinkClassInfo) , - const wxHandlerInfo* handlerInfo , - int eventSinkObjectID ) -{ - wxEvtHandler *ehsource = dynamic_cast< wxEvtHandler* >( m_data->GetObject( eventSourceObjectID ) ) ; - wxEvtHandler *ehsink = dynamic_cast< wxEvtHandler *>(m_data->GetObject(eventSinkObjectID) ) ; - - if ( ehsource && ehsink ) - { - const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast(delegateInfo->GetTypeInfo()); - if( delegateTypeInfo && delegateTypeInfo->GetLastEventType() == -1 ) - { - ehsource->Connect( -1 , delegateTypeInfo->GetEventType() , - handlerInfo->GetEventFunction() , NULL /*user data*/ , - ehsink ) ; - } - else - { - for ( wxEventType iter = delegateTypeInfo->GetEventType() ; iter <= delegateTypeInfo->GetLastEventType() ; ++iter ) - { - ehsource->Connect( -1 , iter , - handlerInfo->GetEventFunction() , NULL /*user data*/ , - ehsink ) ; - } - } - } -} - -wxObject *wxRuntimeDepersister::GetObject(int objectID) -{ - return m_data->GetObject( objectID ) ; -} - -// adds an element to a property collection -void wxRuntimeDepersister::AddToPropertyCollection( int objectID , - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &value) -{ - wxObject *o; - o = m_data->GetObject(objectID); - classInfo->AddToPropertyCollection( o , propertyInfo->GetName() , value ) ; -} - -// sets the corresponding property (value is an object) -void wxRuntimeDepersister::AddToPropertyCollectionAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) -{ - wxObject *o, *valo; - o = m_data->GetObject(objectID); - valo = m_data->GetObject(valueObjectId); - const wxCollectionTypeInfo * collectionTypeInfo = dynamic_cast< const wxCollectionTypeInfo * >(propertyInfo->GetTypeInfo() ) ; - const wxClassInfo* valClassInfo = (dynamic_cast(collectionTypeInfo->GetElementType()))->GetClassInfo() ; - // if this is a dynamic object and we are asked for another class - // than wxDynamicObject we cast it down manually. - wxDynamicObject *dynvalo = dynamic_cast< wxDynamicObject * > (valo) ; - if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) - { - valo = dynvalo->GetSuperClassInstance() ; - } - - classInfo->AddToPropertyCollection( o , propertyInfo->GetName() , valClassInfo->InstanceToVariant(valo) ) ; -} - -// ---------------------------------------------------------------------------- -// depersisting to code -// ---------------------------------------------------------------------------- - -struct wxCodeDepersister::wxCodeDepersisterInternal -{ -#if wxUSE_UNICODE - map m_objectNames ; -#else - map m_objectNames ; -#endif - - void SetObjectName(int objectID, const wxString &name ) - { - if ( m_objectNames.find(objectID) != m_objectNames.end() ) - { - wxLogError( _("Passing a already registered object to SetObjectName") ) ; - return ; - } - m_objectNames[objectID] = (const wxChar *)name; - } - - wxString GetObjectName( int objectID ) - { - if ( objectID == wxNullObjectID ) - return wxT("NULL") ; - - if ( m_objectNames.find(objectID) == m_objectNames.end() ) - { - wxLogError( _("Passing an unkown object to GetObject") ) ; - return wxEmptyString ; - } - return wxString( m_objectNames[objectID].c_str() ) ; - } -} ; - -wxCodeDepersister::wxCodeDepersister(wxTextOutputStream *out) -: m_fp(out) -{ - m_data = new wxCodeDepersisterInternal ; -} - -wxCodeDepersister::~wxCodeDepersister() -{ - delete m_data ; -} - -void wxCodeDepersister::AllocateObject(int objectID, wxClassInfo *classInfo , - wxxVariantArray &WXUNUSED(metadata)) -{ - wxString objectName = wxString::Format( wxT("LocalObject_%d") , objectID ) ; - m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s;\n"), - classInfo->GetClassName(), - objectName.c_str(), - classInfo->GetClassName()) ); - m_data->SetObjectName( objectID , objectName ) ; -} - -void wxCodeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) -{ - m_fp->WriteString( wxString::Format( wxT("\tdelete %s;\n"), - m_data->GetObjectName( objectID).c_str() ) ); -} - -wxString wxCodeDepersister::ValueAsCode( const wxxVariant ¶m ) -{ - wxString value ; - const wxTypeInfo* type = param.GetTypeInfo() ; - if ( type->GetKind() == wxT_CUSTOM ) - { - const wxCustomTypeInfo* cti = dynamic_cast(type) ; - if ( cti ) - { - value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),param.GetAsString().c_str() ); - } - else - { - wxLogError ( _("Internal error, illegal wxCustomTypeInfo") ) ; - } - } - else if ( type->GetKind() == wxT_STRING ) - { - value.Printf( wxT("\"%s\""),param.GetAsString().c_str() ); - } - else - { - value.Printf( wxT("%s"), param.GetAsString().c_str() ); - } - return value ; -} - -void wxCodeDepersister::CreateObject(int objectID, - const wxClassInfo *WXUNUSED(classInfo), - int paramCount, - wxxVariant *params, - int *objectIDValues, - const wxClassInfo **WXUNUSED(objectClassInfos) , - wxxVariantArray &WXUNUSED(metadata) - ) -{ - int i; - m_fp->WriteString( wxString::Format( wxT("\t%s->Create("), m_data->GetObjectName(objectID).c_str() ) ); - for (i = 0; i < paramCount; i++) - { - if ( objectIDValues[i] != wxInvalidObjectID ) - m_fp->WriteString( wxString::Format( wxT("%s"), m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); - else - { - m_fp->WriteString( wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); - } - if (i < paramCount - 1) - m_fp->WriteString( wxT(", ")); - } - m_fp->WriteString( wxT(");\n") ); -} - -void wxCodeDepersister::ConstructObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *params, - int *objectIDValues, - const wxClassInfo **WXUNUSED(objectClassInfos) , - wxxVariantArray &WXUNUSED(metadata) - ) -{ - wxString objectName = wxString::Format( wxT("LocalObject_%d") , objectID ) ; - m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s("), - classInfo->GetClassName(), - objectName.c_str(), - classInfo->GetClassName()) ); - m_data->SetObjectName( objectID , objectName ) ; - - int i; - for (i = 0; i < paramCount; i++) - { - if ( objectIDValues[i] != wxInvalidObjectID ) - m_fp->WriteString( wxString::Format( wxT("%s"), m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); - else - { - m_fp->WriteString( wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); - } - if (i < paramCount - 1) - m_fp->WriteString( wxT(", ") ); - } - m_fp->WriteString( wxT(");\n") ); -} - -void wxCodeDepersister::SetProperty(int objectID, - const wxClassInfo *WXUNUSED(classInfo), - const wxPropertyInfo* propertyInfo, - const wxxVariant &value) -{ - m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - ValueAsCode(value).c_str()) ); -} - -void wxCodeDepersister::SetPropertyAsObject(int objectID, - const wxClassInfo *WXUNUSED(classInfo), - const wxPropertyInfo* propertyInfo, - int valueObjectId) -{ - if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT ) - m_fp->WriteString( wxString::Format( wxT("\t%s->%s(*%s);\n"), - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - m_data->GetObjectName( valueObjectId).c_str() ) ); - else - m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - m_data->GetObjectName( valueObjectId).c_str() ) ); -} - -void wxCodeDepersister::AddToPropertyCollection( int objectID , - const wxClassInfo *WXUNUSED(classInfo), - const wxPropertyInfo* propertyInfo , - const wxxVariant &value) -{ - m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetAdderName().c_str(), - ValueAsCode(value).c_str()) ); -} - -// sets the corresponding property (value is an object) -void wxCodeDepersister::AddToPropertyCollectionAsObject(int WXUNUSED(objectID), - const wxClassInfo *WXUNUSED(classInfo), - const wxPropertyInfo* WXUNUSED(propertyInfo) , - int WXUNUSED(valueObjectId)) -{ - // TODO -} - -void wxCodeDepersister::SetConnect(int eventSourceObjectID, - const wxClassInfo *WXUNUSED(eventSourceClassInfo), - const wxPropertyInfo *delegateInfo , - const wxClassInfo *eventSinkClassInfo , - const wxHandlerInfo* handlerInfo , - int eventSinkObjectID ) -{ - wxString ehsource = m_data->GetObjectName( eventSourceObjectID ) ; - wxString ehsink = m_data->GetObjectName(eventSinkObjectID) ; - wxString ehsinkClass = eventSinkClassInfo->GetClassName() ; - const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast(delegateInfo->GetTypeInfo()); - if ( delegateTypeInfo ) - { - int eventType = delegateTypeInfo->GetEventType() ; - wxString handlerName = handlerInfo->GetName() ; - - m_fp->WriteString( wxString::Format( wxT("\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;") , - ehsource.c_str() , ehsource.c_str() , eventType , ehsinkClass.c_str() , handlerName.c_str() , ehsink.c_str() ) ); - } - else - { - wxLogError(_("delegate has no type info")); - } -} - -#include "wx/arrimpl.cpp" - -WX_DEFINE_OBJARRAY(wxxVariantArray); - -#endif // wxUSE_EXTENDED_RTTI diff --git a/Source/3rdParty/wx/src/common/zipstrm.cpp b/Source/3rdParty/wx/src/common/zipstrm.cpp deleted file mode 100644 index a77df8dc8..000000000 --- a/Source/3rdParty/wx/src/common/zipstrm.cpp +++ /dev/null @@ -1,2425 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/zipstrm.cpp -// Purpose: Streams for Zip files -// Author: Mike Wetherell -// RCS-ID: $Id: zipstrm.cpp 51009 2008-01-03 17:11:45Z MW $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ZIPSTREAM - -#include "wx/zipstrm.h" - -#ifndef WX_PRECOMP - #include "wx/hashmap.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif - -#include "wx/datstrm.h" -#include "wx/zstream.h" -#include "wx/mstream.h" -#include "wx/ptr_scpd.h" -#include "wx/wfstream.h" -#include "zlib.h" - -// value for the 'version needed to extract' field (20 means 2.0) -enum { - VERSION_NEEDED_TO_EXTRACT = 20 -}; - -// signatures for the various records (PKxx) -enum { - CENTRAL_MAGIC = 0x02014b50, // central directory record - LOCAL_MAGIC = 0x04034b50, // local header - END_MAGIC = 0x06054b50, // end of central directory record - SUMS_MAGIC = 0x08074b50 // data descriptor (info-zip) -}; - -// unix file attributes. zip stores them in the high 16 bits of the -// 'external attributes' field, hence the extra zeros. -enum { - wxZIP_S_IFMT = 0xF0000000, - wxZIP_S_IFDIR = 0x40000000, - wxZIP_S_IFREG = 0x80000000 -}; - -// minimum sizes for the various records -enum { - CENTRAL_SIZE = 46, - LOCAL_SIZE = 30, - END_SIZE = 22, - SUMS_SIZE = 12 -}; - -// The number of bytes that must be written to an wxZipOutputStream before -// a zip entry is created. The purpose of this latency is so that -// OpenCompressor() can see a little data before deciding which compressor -// it should use. -enum { - OUTPUT_LATENCY = 4096 -}; - -// Some offsets into the local header -enum { - SUMS_OFFSET = 14 -}; - -IMPLEMENT_DYNAMIC_CLASS(wxZipEntry, wxArchiveEntry) -IMPLEMENT_DYNAMIC_CLASS(wxZipClassFactory, wxArchiveClassFactory) - - -///////////////////////////////////////////////////////////////////////////// -// Helpers - -// read a string of a given length -// -static wxString ReadString(wxInputStream& stream, wxUint16 len, wxMBConv& conv) -{ - if (len == 0) - return wxEmptyString; - -#if wxUSE_UNICODE - wxCharBuffer buf(len); - stream.Read(buf.data(), len); - wxString str(buf, conv); -#else - wxString str; - (void)conv; - { - wxStringBuffer buf(str, len); - stream.Read(buf, len); - } -#endif - - return str; -} - -// Decode a little endian wxUint32 number from a character array -// -static inline wxUint32 CrackUint32(const char *m) -{ - const unsigned char *n = (const unsigned char*)m; - return (n[3] << 24) | (n[2] << 16) | (n[1] << 8) | n[0]; -} - -// Decode a little endian wxUint16 number from a character array -// -static inline wxUint16 CrackUint16(const char *m) -{ - const unsigned char *n = (const unsigned char*)m; - return (n[1] << 8) | n[0]; -} - -// Temporarily lower the logging level in debug mode to avoid a warning -// from SeekI about seeking on a stream with data written back to it. -// -static wxFileOffset QuietSeek(wxInputStream& stream, wxFileOffset pos) -{ -#if defined(__WXDEBUG__) && wxUSE_LOG - wxLogLevel level = wxLog::GetLogLevel(); - wxLog::SetLogLevel(wxLOG_Debug - 1); - wxFileOffset result = stream.SeekI(pos); - wxLog::SetLogLevel(level); - return result; -#else - return stream.SeekI(pos); -#endif -} - - -///////////////////////////////////////////////////////////////////////////// -// Class factory - -wxZipClassFactory g_wxZipClassFactory; - -wxZipClassFactory::wxZipClassFactory() -{ - if (this == &g_wxZipClassFactory) - PushFront(); -} - -const wxChar * const * -wxZipClassFactory::GetProtocols(wxStreamProtocolType type) const -{ - static const wxChar *protocols[] = { _T("zip"), NULL }; - static const wxChar *mimetypes[] = { _T("application/zip"), NULL }; - static const wxChar *fileexts[] = { _T(".zip"), _T(".htb"), NULL }; - static const wxChar *empty[] = { NULL }; - - switch (type) { - case wxSTREAM_PROTOCOL: return protocols; - case wxSTREAM_MIMETYPE: return mimetypes; - case wxSTREAM_FILEEXT: return fileexts; - default: return empty; - } -} - - -///////////////////////////////////////////////////////////////////////////// -// Read a zip header - -class wxZipHeader -{ -public: - wxZipHeader(wxInputStream& stream, size_t size); - - inline wxUint8 Read8(); - inline wxUint16 Read16(); - inline wxUint32 Read32(); - - const char *GetData() const { return m_data; } - size_t GetSize() const { return m_size; } - operator bool() const { return m_ok; } - - size_t Seek(size_t pos) { m_pos = pos; return m_pos; } - size_t Skip(size_t size) { m_pos += size; return m_pos; } - - wxZipHeader& operator>>(wxUint8& n) { n = Read8(); return *this; } - wxZipHeader& operator>>(wxUint16& n) { n = Read16(); return *this; } - wxZipHeader& operator>>(wxUint32& n) { n = Read32(); return *this; } - -private: - char m_data[64]; - size_t m_size; - size_t m_pos; - bool m_ok; -}; - -wxZipHeader::wxZipHeader(wxInputStream& stream, size_t size) - : m_size(0), - m_pos(0), - m_ok(false) -{ - wxCHECK_RET(size <= sizeof(m_data), _T("buffer too small")); - m_size = stream.Read(m_data, size).LastRead(); - m_ok = m_size == size; -} - -inline wxUint8 wxZipHeader::Read8() -{ - wxASSERT(m_pos < m_size); - return m_data[m_pos++]; -} - -inline wxUint16 wxZipHeader::Read16() -{ - wxASSERT(m_pos + 2 <= m_size); - wxUint16 n = CrackUint16(m_data + m_pos); - m_pos += 2; - return n; -} - -inline wxUint32 wxZipHeader::Read32() -{ - wxASSERT(m_pos + 4 <= m_size); - wxUint32 n = CrackUint32(m_data + m_pos); - m_pos += 4; - return n; -} - - -///////////////////////////////////////////////////////////////////////////// -// Stored input stream -// Trival decompressor for files which are 'stored' in the zip file. - -class wxStoredInputStream : public wxFilterInputStream -{ -public: - wxStoredInputStream(wxInputStream& stream); - - void Open(wxFileOffset len) { Close(); m_len = len; } - void Close() { m_pos = 0; m_lasterror = wxSTREAM_NO_ERROR; } - - virtual char Peek() { return wxInputStream::Peek(); } - virtual wxFileOffset GetLength() const { return m_len; } - -protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } - -private: - wxFileOffset m_pos; - wxFileOffset m_len; - - DECLARE_NO_COPY_CLASS(wxStoredInputStream) -}; - -wxStoredInputStream::wxStoredInputStream(wxInputStream& stream) - : wxFilterInputStream(stream), - m_pos(0), - m_len(0) -{ -} - -size_t wxStoredInputStream::OnSysRead(void *buffer, size_t size) -{ - size_t count = wx_truncate_cast(size_t, - wxMin(size + wxFileOffset(0), m_len - m_pos + size_t(0))); - count = m_parent_i_stream->Read(buffer, count).LastRead(); - m_pos += count; - - if (count < size) - m_lasterror = m_pos == m_len ? wxSTREAM_EOF : wxSTREAM_READ_ERROR; - - return count; -} - - -///////////////////////////////////////////////////////////////////////////// -// Stored output stream -// Trival compressor for files which are 'stored' in the zip file. - -class wxStoredOutputStream : public wxFilterOutputStream -{ -public: - wxStoredOutputStream(wxOutputStream& stream) : - wxFilterOutputStream(stream), m_pos(0) { } - - bool Close() { - m_pos = 0; - m_lasterror = wxSTREAM_NO_ERROR; - return true; - } - -protected: - virtual size_t OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } - -private: - wxFileOffset m_pos; - DECLARE_NO_COPY_CLASS(wxStoredOutputStream) -}; - -size_t wxStoredOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - if (!IsOk() || !size) - return 0; - size_t count = m_parent_o_stream->Write(buffer, size).LastWrite(); - if (count != size) - m_lasterror = wxSTREAM_WRITE_ERROR; - m_pos += count; - return count; -} - - -///////////////////////////////////////////////////////////////////////////// -// wxRawInputStream -// -// Used to handle the unusal case of raw copying an entry of unknown -// length. This can only happen when the zip being copied from is being -// read from a non-seekable stream, and also was original written to a -// non-seekable stream. -// -// In this case there's no option but to decompress the stream to find -// it's length, but we can still write the raw compressed data to avoid the -// compression overhead (which is the greater one). -// -// Usage is like this: -// m_rawin = new wxRawInputStream(*m_parent_i_stream); -// m_decomp = m_rawin->Open(OpenDecompressor(m_rawin->GetTee())); -// -// The wxRawInputStream owns a wxTeeInputStream object, the role of which -// is something like the unix 'tee' command; it is a transparent filter, but -// allows the data read to be read a second time via an extra method 'GetData'. -// -// The wxRawInputStream then draws data through the tee using a decompressor -// then instead of returning the decompressed data, retuns the raw data -// from wxTeeInputStream::GetData(). - -class wxTeeInputStream : public wxFilterInputStream -{ -public: - wxTeeInputStream(wxInputStream& stream); - - size_t GetCount() const { return m_end - m_start; } - size_t GetData(char *buffer, size_t size); - - void Open(); - bool Final(); - - wxInputStream& Read(void *buffer, size_t size); - -protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } - -private: - wxFileOffset m_pos; - wxMemoryBuffer m_buf; - size_t m_start; - size_t m_end; - - DECLARE_NO_COPY_CLASS(wxTeeInputStream) -}; - -wxTeeInputStream::wxTeeInputStream(wxInputStream& stream) - : wxFilterInputStream(stream), - m_pos(0), m_buf(8192), m_start(0), m_end(0) -{ -} - -void wxTeeInputStream::Open() -{ - m_pos = m_start = m_end = 0; - m_lasterror = wxSTREAM_NO_ERROR; -} - -bool wxTeeInputStream::Final() -{ - bool final = m_end == m_buf.GetDataLen(); - m_end = m_buf.GetDataLen(); - return final; -} - -wxInputStream& wxTeeInputStream::Read(void *buffer, size_t size) -{ - size_t count = wxInputStream::Read(buffer, size).LastRead(); - m_end = m_buf.GetDataLen(); - m_buf.AppendData(buffer, count); - return *this; -} - -size_t wxTeeInputStream::OnSysRead(void *buffer, size_t size) -{ - size_t count = m_parent_i_stream->Read(buffer, size).LastRead(); - if (count < size) - m_lasterror = m_parent_i_stream->GetLastError(); - return count; -} - -size_t wxTeeInputStream::GetData(char *buffer, size_t size) -{ - if (m_wbacksize) { - size_t len = m_buf.GetDataLen(); - len = len > m_wbacksize ? len - m_wbacksize : 0; - m_buf.SetDataLen(len); - if (m_end > len) { - wxFAIL; // we've already returned data that's now being ungot - m_end = len; - } - m_parent_i_stream->Reset(); - m_parent_i_stream->Ungetch(m_wback, m_wbacksize); - free(m_wback); - m_wback = NULL; - m_wbacksize = 0; - m_wbackcur = 0; - } - - if (size > GetCount()) - size = GetCount(); - if (size) { - memcpy(buffer, m_buf + m_start, size); - m_start += size; - wxASSERT(m_start <= m_end); - } - - if (m_start == m_end && m_start > 0 && m_buf.GetDataLen() > 0) { - size_t len = m_buf.GetDataLen(); - char *buf = (char*)m_buf.GetWriteBuf(len); - len -= m_end; - memmove(buf, buf + m_end, len); - m_buf.UngetWriteBuf(len); - m_start = m_end = 0; - } - - return size; -} - -class wxRawInputStream : public wxFilterInputStream -{ -public: - wxRawInputStream(wxInputStream& stream); - virtual ~wxRawInputStream() { delete m_tee; } - - wxInputStream* Open(wxInputStream *decomp); - wxInputStream& GetTee() const { return *m_tee; } - -protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } - -private: - wxFileOffset m_pos; - wxTeeInputStream *m_tee; - - enum { BUFSIZE = 8192 }; - wxCharBuffer m_dummy; - - DECLARE_NO_COPY_CLASS(wxRawInputStream) -}; - -wxRawInputStream::wxRawInputStream(wxInputStream& stream) - : wxFilterInputStream(stream), - m_pos(0), - m_tee(new wxTeeInputStream(stream)), - m_dummy(BUFSIZE) -{ -} - -wxInputStream *wxRawInputStream::Open(wxInputStream *decomp) -{ - if (decomp) { - m_parent_i_stream = decomp; - m_pos = 0; - m_lasterror = wxSTREAM_NO_ERROR; - m_tee->Open(); - return this; - } else { - return NULL; - } -} - -size_t wxRawInputStream::OnSysRead(void *buffer, size_t size) -{ - char *buf = (char*)buffer; - size_t count = 0; - - while (count < size && IsOk()) - { - while (m_parent_i_stream->IsOk() && m_tee->GetCount() == 0) - m_parent_i_stream->Read(m_dummy.data(), BUFSIZE); - - size_t n = m_tee->GetData(buf + count, size - count); - count += n; - - if (n == 0 && m_tee->Final()) - m_lasterror = m_parent_i_stream->GetLastError(); - } - - m_pos += count; - return count; -} - - -///////////////////////////////////////////////////////////////////////////// -// Zlib streams than can be reused without recreating. - -class wxZlibOutputStream2 : public wxZlibOutputStream -{ -public: - wxZlibOutputStream2(wxOutputStream& stream, int level) : - wxZlibOutputStream(stream, level, wxZLIB_NO_HEADER) { } - - bool Open(wxOutputStream& stream); - bool Close() { DoFlush(true); m_pos = wxInvalidOffset; return IsOk(); } -}; - -bool wxZlibOutputStream2::Open(wxOutputStream& stream) -{ - wxCHECK(m_pos == wxInvalidOffset, false); - - m_deflate->next_out = m_z_buffer; - m_deflate->avail_out = m_z_size; - m_pos = 0; - m_lasterror = wxSTREAM_NO_ERROR; - m_parent_o_stream = &stream; - - if (deflateReset(m_deflate) != Z_OK) { - wxLogError(_("can't re-initialize zlib deflate stream")); - m_lasterror = wxSTREAM_WRITE_ERROR; - return false; - } - - return true; -} - -class wxZlibInputStream2 : public wxZlibInputStream -{ -public: - wxZlibInputStream2(wxInputStream& stream) : - wxZlibInputStream(stream, wxZLIB_NO_HEADER) { } - - bool Open(wxInputStream& stream); -}; - -bool wxZlibInputStream2::Open(wxInputStream& stream) -{ - m_inflate->avail_in = 0; - m_pos = 0; - m_lasterror = wxSTREAM_NO_ERROR; - m_parent_i_stream = &stream; - - if (inflateReset(m_inflate) != Z_OK) { - wxLogError(_("can't re-initialize zlib inflate stream")); - m_lasterror = wxSTREAM_READ_ERROR; - return false; - } - - return true; -} - - -///////////////////////////////////////////////////////////////////////////// -// Class to hold wxZipEntry's Extra and LocalExtra fields - -class wxZipMemory -{ -public: - wxZipMemory() : m_data(NULL), m_size(0), m_capacity(0), m_ref(1) { } - - wxZipMemory *AddRef() { m_ref++; return this; } - void Release() { if (--m_ref == 0) delete this; } - - char *GetData() const { return m_data; } - size_t GetSize() const { return m_size; } - size_t GetCapacity() const { return m_capacity; } - - wxZipMemory *Unique(size_t size); - -private: - ~wxZipMemory() { delete [] m_data; } - - char *m_data; - size_t m_size; - size_t m_capacity; - int m_ref; - - wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(wxZipMemory) -}; - -wxZipMemory *wxZipMemory::Unique(size_t size) -{ - wxZipMemory *zm; - - if (m_ref > 1) { - --m_ref; - zm = new wxZipMemory; - } else { - zm = this; - } - - if (zm->m_capacity < size) { - delete [] zm->m_data; - zm->m_data = new char[size]; - zm->m_capacity = size; - } - - zm->m_size = size; - return zm; -} - -static inline wxZipMemory *AddRef(wxZipMemory *zm) -{ - if (zm) - zm->AddRef(); - return zm; -} - -static inline void Release(wxZipMemory *zm) -{ - if (zm) - zm->Release(); -} - -static void Copy(wxZipMemory*& dest, wxZipMemory *src) -{ - Release(dest); - dest = AddRef(src); -} - -static void Unique(wxZipMemory*& zm, size_t size) -{ - if (!zm && size) - zm = new wxZipMemory; - if (zm) - zm = zm->Unique(size); -} - - -///////////////////////////////////////////////////////////////////////////// -// Collection of weak references to entries - -WX_DECLARE_HASH_MAP(long, wxZipEntry*, wxIntegerHash, - wxIntegerEqual, wxOffsetZipEntryMap_); - -class wxZipWeakLinks -{ -public: - wxZipWeakLinks() : m_ref(1) { } - - void Release(const wxZipInputStream* WXUNUSED(x)) - { if (--m_ref == 0) delete this; } - void Release(wxFileOffset key) - { RemoveEntry(key); if (--m_ref == 0) delete this; } - - wxZipWeakLinks *AddEntry(wxZipEntry *entry, wxFileOffset key); - void RemoveEntry(wxFileOffset key) - { m_entries.erase(wx_truncate_cast(key_type, key)); } - wxZipEntry *GetEntry(wxFileOffset key) const; - bool IsEmpty() const { return m_entries.empty(); } - -private: - ~wxZipWeakLinks() { wxASSERT(IsEmpty()); } - - typedef wxOffsetZipEntryMap_::key_type key_type; - - int m_ref; - wxOffsetZipEntryMap_ m_entries; - - wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(wxZipWeakLinks) -}; - -wxZipWeakLinks *wxZipWeakLinks::AddEntry(wxZipEntry *entry, wxFileOffset key) -{ - m_entries[wx_truncate_cast(key_type, key)] = entry; - m_ref++; - return this; -} - -wxZipEntry *wxZipWeakLinks::GetEntry(wxFileOffset key) const -{ - wxOffsetZipEntryMap_::const_iterator it = - m_entries.find(wx_truncate_cast(key_type, key)); - return it != m_entries.end() ? it->second : NULL; -} - - -///////////////////////////////////////////////////////////////////////////// -// ZipEntry - -wxZipEntry::wxZipEntry( - const wxString& name /*=wxEmptyString*/, - const wxDateTime& dt /*=wxDateTime::Now()*/, - wxFileOffset size /*=wxInvalidOffset*/) - : - m_SystemMadeBy(wxZIP_SYSTEM_MSDOS), - m_VersionMadeBy(wxMAJOR_VERSION * 10 + wxMINOR_VERSION), - m_VersionNeeded(VERSION_NEEDED_TO_EXTRACT), - m_Flags(0), - m_Method(wxZIP_METHOD_DEFAULT), - m_DateTime(dt), - m_Crc(0), - m_CompressedSize(wxInvalidOffset), - m_Size(size), - m_Key(wxInvalidOffset), - m_Offset(wxInvalidOffset), - m_DiskStart(0), - m_InternalAttributes(0), - m_ExternalAttributes(0), - m_Extra(NULL), - m_LocalExtra(NULL), - m_zipnotifier(NULL), - m_backlink(NULL) -{ - if (!name.empty()) - SetName(name); -} - -wxZipEntry::~wxZipEntry() -{ - if (m_backlink) - m_backlink->Release(m_Key); - Release(m_Extra); - Release(m_LocalExtra); -} - -wxZipEntry::wxZipEntry(const wxZipEntry& e) - : wxArchiveEntry(e), - m_SystemMadeBy(e.m_SystemMadeBy), - m_VersionMadeBy(e.m_VersionMadeBy), - m_VersionNeeded(e.m_VersionNeeded), - m_Flags(e.m_Flags), - m_Method(e.m_Method), - m_DateTime(e.m_DateTime), - m_Crc(e.m_Crc), - m_CompressedSize(e.m_CompressedSize), - m_Size(e.m_Size), - m_Name(e.m_Name), - m_Key(e.m_Key), - m_Offset(e.m_Offset), - m_Comment(e.m_Comment), - m_DiskStart(e.m_DiskStart), - m_InternalAttributes(e.m_InternalAttributes), - m_ExternalAttributes(e.m_ExternalAttributes), - m_Extra(AddRef(e.m_Extra)), - m_LocalExtra(AddRef(e.m_LocalExtra)), - m_zipnotifier(NULL), - m_backlink(NULL) -{ -} - -wxZipEntry& wxZipEntry::operator=(const wxZipEntry& e) -{ - if (&e != this) { - m_SystemMadeBy = e.m_SystemMadeBy; - m_VersionMadeBy = e.m_VersionMadeBy; - m_VersionNeeded = e.m_VersionNeeded; - m_Flags = e.m_Flags; - m_Method = e.m_Method; - m_DateTime = e.m_DateTime; - m_Crc = e.m_Crc; - m_CompressedSize = e.m_CompressedSize; - m_Size = e.m_Size; - m_Name = e.m_Name; - m_Key = e.m_Key; - m_Offset = e.m_Offset; - m_Comment = e.m_Comment; - m_DiskStart = e.m_DiskStart; - m_InternalAttributes = e.m_InternalAttributes; - m_ExternalAttributes = e.m_ExternalAttributes; - Copy(m_Extra, e.m_Extra); - Copy(m_LocalExtra, e.m_LocalExtra); - m_zipnotifier = NULL; - if (m_backlink) { - m_backlink->Release(m_Key); - m_backlink = NULL; - } - } - return *this; -} - -wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const -{ - bool isDir = IsDir() && !m_Name.empty(); - - // optimisations for common (and easy) cases - switch (wxFileName::GetFormat(format)) { - case wxPATH_DOS: - { - wxString name(isDir ? m_Name + _T("\\") : m_Name); - for (size_t i = 0; i < name.length(); i++) - if (name[i] == _T('/')) - name[i] = _T('\\'); - return name; - } - - case wxPATH_UNIX: - return isDir ? m_Name + _T("/") : m_Name; - - default: - ; - } - - wxFileName fn; - - if (isDir) - fn.AssignDir(m_Name, wxPATH_UNIX); - else - fn.Assign(m_Name, wxPATH_UNIX); - - return fn.GetFullPath(format); -} - -// Static - Internally tars and zips use forward slashes for the path -// separator, absolute paths aren't allowed, and directory names have a -// trailing slash. This function converts a path into this internal format, -// but without a trailing slash for a directory. -// -wxString wxZipEntry::GetInternalName(const wxString& name, - wxPathFormat format /*=wxPATH_NATIVE*/, - bool *pIsDir /*=NULL*/) -{ - wxString internal; - - if (wxFileName::GetFormat(format) != wxPATH_UNIX) - internal = wxFileName(name, format).GetFullPath(wxPATH_UNIX); - else - internal = name; - - bool isDir = !internal.empty() && internal.Last() == '/'; - if (pIsDir) - *pIsDir = isDir; - if (isDir) - internal.erase(internal.length() - 1); - - while (!internal.empty() && *internal.begin() == '/') - internal.erase(0, 1); - while (!internal.empty() && internal.compare(0, 2, _T("./")) == 0) - internal.erase(0, 2); - if (internal == _T(".") || internal == _T("..")) - internal = wxEmptyString; - - return internal; -} - -void wxZipEntry::SetSystemMadeBy(int system) -{ - int mode = GetMode(); - bool wasUnix = IsMadeByUnix(); - - m_SystemMadeBy = (wxUint8)system; - - if (!wasUnix && IsMadeByUnix()) { - SetIsDir(IsDir()); - SetMode(mode); - } else if (wasUnix && !IsMadeByUnix()) { - m_ExternalAttributes &= 0xffff; - } -} - -void wxZipEntry::SetIsDir(bool isDir /*=true*/) -{ - if (isDir) - m_ExternalAttributes |= wxZIP_A_SUBDIR; - else - m_ExternalAttributes &= ~wxZIP_A_SUBDIR; - - if (IsMadeByUnix()) { - m_ExternalAttributes &= ~wxZIP_S_IFMT; - if (isDir) - m_ExternalAttributes |= wxZIP_S_IFDIR; - else - m_ExternalAttributes |= wxZIP_S_IFREG; - } -} - -// Return unix style permission bits -// -int wxZipEntry::GetMode() const -{ - // return unix permissions if present - if (IsMadeByUnix()) - return (m_ExternalAttributes >> 16) & 0777; - - // otherwise synthesize from the dos attribs - int mode = 0644; - if (m_ExternalAttributes & wxZIP_A_RDONLY) - mode &= ~0200; - if (m_ExternalAttributes & wxZIP_A_SUBDIR) - mode |= 0111; - - return mode; -} - -// Set unix permissions -// -void wxZipEntry::SetMode(int mode) -{ - // Set dos attrib bits to be compatible - if (mode & 0222) - m_ExternalAttributes &= ~wxZIP_A_RDONLY; - else - m_ExternalAttributes |= wxZIP_A_RDONLY; - - // set the actual unix permission bits if the system type allows - if (IsMadeByUnix()) { - m_ExternalAttributes &= ~(0777L << 16); - m_ExternalAttributes |= (mode & 0777L) << 16; - } -} - -const char *wxZipEntry::GetExtra() const -{ - return m_Extra ? m_Extra->GetData() : NULL; -} - -size_t wxZipEntry::GetExtraLen() const -{ - return m_Extra ? m_Extra->GetSize() : 0; -} - -void wxZipEntry::SetExtra(const char *extra, size_t len) -{ - Unique(m_Extra, len); - if (len) - memcpy(m_Extra->GetData(), extra, len); -} - -const char *wxZipEntry::GetLocalExtra() const -{ - return m_LocalExtra ? m_LocalExtra->GetData() : NULL; -} - -size_t wxZipEntry::GetLocalExtraLen() const -{ - return m_LocalExtra ? m_LocalExtra->GetSize() : 0; -} - -void wxZipEntry::SetLocalExtra(const char *extra, size_t len) -{ - Unique(m_LocalExtra, len); - if (len) - memcpy(m_LocalExtra->GetData(), extra, len); -} - -void wxZipEntry::SetNotifier(wxZipNotifier& notifier) -{ - wxArchiveEntry::UnsetNotifier(); - m_zipnotifier = ¬ifier; - m_zipnotifier->OnEntryUpdated(*this); -} - -void wxZipEntry::Notify() -{ - if (m_zipnotifier) - m_zipnotifier->OnEntryUpdated(*this); - else if (GetNotifier()) - GetNotifier()->OnEntryUpdated(*this); -} - -void wxZipEntry::UnsetNotifier() -{ - wxArchiveEntry::UnsetNotifier(); - m_zipnotifier = NULL; -} - -size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) -{ - wxUint16 nameLen, extraLen; - wxUint32 compressedSize, size, crc; - - wxZipHeader ds(stream, LOCAL_SIZE - 4); - if (!ds) - return 0; - - ds >> m_VersionNeeded >> m_Flags >> m_Method; - SetDateTime(wxDateTime().SetFromDOS(ds.Read32())); - ds >> crc >> compressedSize >> size >> nameLen >> extraLen; - - bool sumsValid = (m_Flags & wxZIP_SUMS_FOLLOW) == 0; - - if (sumsValid || crc) - m_Crc = crc; - if ((sumsValid || compressedSize) || m_Method == wxZIP_METHOD_STORE) - m_CompressedSize = compressedSize; - if ((sumsValid || size) || m_Method == wxZIP_METHOD_STORE) - m_Size = size; - - SetName(ReadString(stream, nameLen, conv), wxPATH_UNIX); - if (stream.LastRead() != nameLen + 0u) - return 0; - - if (extraLen || GetLocalExtraLen()) { - Unique(m_LocalExtra, extraLen); - if (extraLen) { - stream.Read(m_LocalExtra->GetData(), extraLen); - if (stream.LastRead() != extraLen + 0u) - return 0; - } - } - - return LOCAL_SIZE + nameLen + extraLen; -} - -size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const -{ - wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); - const char *name = name_buf; - if (!name) name = ""; - wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); - - wxDataOutputStream ds(stream); - - ds << m_VersionNeeded << m_Flags << m_Method; - ds.Write32(GetDateTime().GetAsDOS()); - - ds.Write32(m_Crc); - ds.Write32(m_CompressedSize != wxInvalidOffset ? - wx_truncate_cast(wxUint32, m_CompressedSize) : 0); - ds.Write32(m_Size != wxInvalidOffset ? - wx_truncate_cast(wxUint32, m_Size) : 0); - - ds << nameLen; - wxUint16 extraLen = wx_truncate_cast(wxUint16, GetLocalExtraLen()); - ds.Write16(extraLen); - - stream.Write(name, nameLen); - if (extraLen) - stream.Write(m_LocalExtra->GetData(), extraLen); - - return LOCAL_SIZE + nameLen + extraLen; -} - -size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) -{ - wxUint16 nameLen, extraLen, commentLen; - - wxZipHeader ds(stream, CENTRAL_SIZE - 4); - if (!ds) - return 0; - - ds >> m_VersionMadeBy >> m_SystemMadeBy; - - SetVersionNeeded(ds.Read16()); - SetFlags(ds.Read16()); - SetMethod(ds.Read16()); - SetDateTime(wxDateTime().SetFromDOS(ds.Read32())); - SetCrc(ds.Read32()); - SetCompressedSize(ds.Read32()); - SetSize(ds.Read32()); - - ds >> nameLen >> extraLen >> commentLen - >> m_DiskStart >> m_InternalAttributes >> m_ExternalAttributes; - SetOffset(ds.Read32()); - - SetName(ReadString(stream, nameLen, conv), wxPATH_UNIX); - if (stream.LastRead() != nameLen + 0u) - return 0; - - if (extraLen || GetExtraLen()) { - Unique(m_Extra, extraLen); - if (extraLen) { - stream.Read(m_Extra->GetData(), extraLen); - if (stream.LastRead() != extraLen + 0u) - return 0; - } - } - - if (commentLen) { - m_Comment = ReadString(stream, commentLen, conv); - if (stream.LastRead() != commentLen + 0u) - return 0; - } else { - m_Comment.clear(); - } - - return CENTRAL_SIZE + nameLen + extraLen + commentLen; -} - -size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const -{ - wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); - const char *name = name_buf; - if (!name) name = ""; - wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); - - const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); - const char *comment = comment_buf; - if (!comment) comment = ""; - wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment)); - - wxUint16 extraLen = wx_truncate_cast(wxUint16, GetExtraLen()); - - wxDataOutputStream ds(stream); - - ds << CENTRAL_MAGIC << m_VersionMadeBy << m_SystemMadeBy; - - ds.Write16(wx_truncate_cast(wxUint16, GetVersionNeeded())); - ds.Write16(wx_truncate_cast(wxUint16, GetFlags())); - ds.Write16(wx_truncate_cast(wxUint16, GetMethod())); - ds.Write32(GetDateTime().GetAsDOS()); - ds.Write32(GetCrc()); - ds.Write32(wx_truncate_cast(wxUint32, GetCompressedSize())); - ds.Write32(wx_truncate_cast(wxUint32, GetSize())); - ds.Write16(nameLen); - ds.Write16(extraLen); - - ds << commentLen << m_DiskStart << m_InternalAttributes - << m_ExternalAttributes << wx_truncate_cast(wxUint32, GetOffset()); - - stream.Write(name, nameLen); - if (extraLen) - stream.Write(GetExtra(), extraLen); - stream.Write(comment, commentLen); - - return CENTRAL_SIZE + nameLen + extraLen + commentLen; -} - -// Info-zip prefixes this record with a signature, but pkzip doesn't. So if -// the 1st value is the signature then it is probably an info-zip record, -// though there is a small chance that it is in fact a pkzip record which -// happens to have the signature as it's CRC. -// -size_t wxZipEntry::ReadDescriptor(wxInputStream& stream) -{ - wxZipHeader ds(stream, SUMS_SIZE); - if (!ds) - return 0; - - m_Crc = ds.Read32(); - m_CompressedSize = ds.Read32(); - m_Size = ds.Read32(); - - // if 1st value is the signature then this is probably an info-zip record - if (m_Crc == SUMS_MAGIC) - { - wxZipHeader buf(stream, 8); - wxUint32 u1 = buf.GetSize() >= 4 ? buf.Read32() : (wxUint32)LOCAL_MAGIC; - wxUint32 u2 = buf.GetSize() == 8 ? buf.Read32() : 0; - - // look for the signature of the following record to decide which - if ((u1 == LOCAL_MAGIC || u1 == CENTRAL_MAGIC) && - (u2 != LOCAL_MAGIC && u2 != CENTRAL_MAGIC)) - { - // it's a pkzip style record after all! - if (buf.GetSize() > 0) - stream.Ungetch(buf.GetData(), buf.GetSize()); - } - else - { - // it's an info-zip record as expected - if (buf.GetSize() > 4) - stream.Ungetch(buf.GetData() + 4, buf.GetSize() - 4); - m_Crc = wx_truncate_cast(wxUint32, m_CompressedSize); - m_CompressedSize = m_Size; - m_Size = u1; - return SUMS_SIZE + 4; - } - } - - return SUMS_SIZE; -} - -size_t wxZipEntry::WriteDescriptor(wxOutputStream& stream, wxUint32 crc, - wxFileOffset compressedSize, wxFileOffset size) -{ - m_Crc = crc; - m_CompressedSize = compressedSize; - m_Size = size; - - wxDataOutputStream ds(stream); - - ds.Write32(crc); - ds.Write32(wx_truncate_cast(wxUint32, compressedSize)); - ds.Write32(wx_truncate_cast(wxUint32, size)); - - return SUMS_SIZE; -} - - -///////////////////////////////////////////////////////////////////////////// -// wxZipEndRec - holds the end of central directory record - -class wxZipEndRec -{ -public: - wxZipEndRec(); - - int GetDiskNumber() const { return m_DiskNumber; } - int GetStartDisk() const { return m_StartDisk; } - int GetEntriesHere() const { return m_EntriesHere; } - int GetTotalEntries() const { return m_TotalEntries; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxString GetComment() const { return m_Comment; } - - void SetDiskNumber(int num) - { m_DiskNumber = wx_truncate_cast(wxUint16, num); } - void SetStartDisk(int num) - { m_StartDisk = wx_truncate_cast(wxUint16, num); } - void SetEntriesHere(int num) - { m_EntriesHere = wx_truncate_cast(wxUint16, num); } - void SetTotalEntries(int num) - { m_TotalEntries = wx_truncate_cast(wxUint16, num); } - void SetSize(wxFileOffset size) - { m_Size = wx_truncate_cast(wxUint32, size); } - void SetOffset(wxFileOffset offset) - { m_Offset = wx_truncate_cast(wxUint32, offset); } - void SetComment(const wxString& comment) - { m_Comment = comment; } - - bool Read(wxInputStream& stream, wxMBConv& conv); - bool Write(wxOutputStream& stream, wxMBConv& conv) const; - -private: - wxUint16 m_DiskNumber; - wxUint16 m_StartDisk; - wxUint16 m_EntriesHere; - wxUint16 m_TotalEntries; - wxUint32 m_Size; - wxUint32 m_Offset; - wxString m_Comment; -}; - -wxZipEndRec::wxZipEndRec() - : m_DiskNumber(0), - m_StartDisk(0), - m_EntriesHere(0), - m_TotalEntries(0), - m_Size(0), - m_Offset(0) -{ -} - -bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const -{ - const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); - const char *comment = comment_buf; - if (!comment) comment = ""; - wxUint16 commentLen = (wxUint16)strlen(comment); - - wxDataOutputStream ds(stream); - - ds << END_MAGIC << m_DiskNumber << m_StartDisk << m_EntriesHere - << m_TotalEntries << m_Size << m_Offset << commentLen; - - stream.Write(comment, commentLen); - - return stream.IsOk(); -} - -bool wxZipEndRec::Read(wxInputStream& stream, wxMBConv& conv) -{ - wxZipHeader ds(stream, END_SIZE - 4); - if (!ds) - return false; - - wxUint16 commentLen; - - ds >> m_DiskNumber >> m_StartDisk >> m_EntriesHere - >> m_TotalEntries >> m_Size >> m_Offset >> commentLen; - - if (commentLen) { - m_Comment = ReadString(stream, commentLen, conv); - if (stream.LastRead() != commentLen + 0u) - return false; - } - - if (m_DiskNumber != 0 || m_StartDisk != 0 || - m_EntriesHere != m_TotalEntries) - wxLogWarning(_("assuming this is a multi-part zip concatenated")); - - return true; -} - - -///////////////////////////////////////////////////////////////////////////// -// A weak link from an input stream to an output stream - -class wxZipStreamLink -{ -public: - wxZipStreamLink(wxZipOutputStream *stream) : m_ref(1), m_stream(stream) { } - - wxZipStreamLink *AddRef() { m_ref++; return this; } - wxZipOutputStream *GetOutputStream() const { return m_stream; } - - void Release(class wxZipInputStream *WXUNUSED(s)) - { if (--m_ref == 0) delete this; } - void Release(class wxZipOutputStream *WXUNUSED(s)) - { m_stream = NULL; if (--m_ref == 0) delete this; } - -private: - ~wxZipStreamLink() { } - - int m_ref; - wxZipOutputStream *m_stream; - - wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(wxZipStreamLink) -}; - - -///////////////////////////////////////////////////////////////////////////// -// Input stream - -// leave the default wxZipEntryPtr free for users -wxDECLARE_SCOPED_PTR(wxZipEntry, wxZipEntryPtr_) -wxDEFINE_SCOPED_PTR (wxZipEntry, wxZipEntryPtr_) - -// constructor -// -wxZipInputStream::wxZipInputStream(wxInputStream& stream, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveInputStream(stream, conv) -{ - Init(); -} - -wxZipInputStream::wxZipInputStream(wxInputStream *stream, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveInputStream(stream, conv) -{ - Init(); -} - -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - -// Part of the compatibility constructor, which has been made inline to -// avoid a problem with it not being exported by mingw 3.2.3 -// -void wxZipInputStream::Init(const wxString& file) -{ - // no error messages - wxLogNull nolog; - Init(); - m_allowSeeking = true; - wxFFileInputStream *ffile; - ffile = wx_static_cast(wxFFileInputStream*, m_parent_i_stream); - wxZipEntryPtr_ entry; - - if (ffile->Ok()) { - do { - entry.reset(GetNextEntry()); - } - while (entry.get() != NULL && entry->GetInternalName() != file); - } - - if (entry.get() == NULL) - m_lasterror = wxSTREAM_READ_ERROR; -} - -wxInputStream* wxZipInputStream::OpenFile(const wxString& archive) -{ - wxLogNull nolog; - return new wxFFileInputStream(archive); -} - -#endif // WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - -void wxZipInputStream::Init() -{ - m_store = new wxStoredInputStream(*m_parent_i_stream); - m_inflate = NULL; - m_rawin = NULL; - m_raw = false; - m_headerSize = 0; - m_decomp = NULL; - m_parentSeekable = false; - m_weaklinks = new wxZipWeakLinks; - m_streamlink = NULL; - m_offsetAdjustment = 0; - m_position = wxInvalidOffset; - m_signature = 0; - m_TotalEntries = 0; - m_lasterror = m_parent_i_stream->GetLastError(); -#if WXWIN_COMPATIBILITY_2_6 - m_allowSeeking = false; -#endif -} - -wxZipInputStream::~wxZipInputStream() -{ - CloseDecompressor(m_decomp); - - delete m_store; - delete m_inflate; - delete m_rawin; - - m_weaklinks->Release(this); - - if (m_streamlink) - m_streamlink->Release(this); -} - -wxString wxZipInputStream::GetComment() -{ - if (m_position == wxInvalidOffset) - if (!LoadEndRecord()) - return wxEmptyString; - - if (!m_parentSeekable && Eof() && m_signature) { - m_lasterror = wxSTREAM_NO_ERROR; - m_lasterror = ReadLocal(true); - } - - return m_Comment; -} - -int wxZipInputStream::GetTotalEntries() -{ - if (m_position == wxInvalidOffset) - LoadEndRecord(); - return m_TotalEntries; -} - -wxZipStreamLink *wxZipInputStream::MakeLink(wxZipOutputStream *out) -{ - wxZipStreamLink *link = NULL; - - if (!m_parentSeekable && (IsOpened() || !Eof())) { - link = new wxZipStreamLink(out); - if (m_streamlink) - m_streamlink->Release(this); - m_streamlink = link->AddRef(); - } - - return link; -} - -bool wxZipInputStream::LoadEndRecord() -{ - wxCHECK(m_position == wxInvalidOffset, false); - if (!IsOk()) - return false; - - m_position = 0; - - // First find the end-of-central-directory record. - if (!FindEndRecord()) { - // failed, so either this is a non-seekable stream (ok), or not a zip - if (m_parentSeekable) { - m_lasterror = wxSTREAM_READ_ERROR; - wxLogError(_("invalid zip file")); - return false; - } - else { - wxLogNull nolog; - wxFileOffset pos = m_parent_i_stream->TellI(); - if (pos != wxInvalidOffset) - m_offsetAdjustment = m_position = pos; - return true; - } - } - - wxZipEndRec endrec; - - // Read in the end record - wxFileOffset endPos = m_parent_i_stream->TellI() - 4; - if (!endrec.Read(*m_parent_i_stream, GetConv())) - return false; - - m_TotalEntries = endrec.GetTotalEntries(); - m_Comment = endrec.GetComment(); - - // Now find the central-directory. we have the file offset of - // the CD, so look there first. - if (m_parent_i_stream->SeekI(endrec.GetOffset()) != wxInvalidOffset && - ReadSignature() == CENTRAL_MAGIC) { - m_signature = CENTRAL_MAGIC; - m_position = endrec.GetOffset(); - m_offsetAdjustment = 0; - return true; - } - - // If it's not there, then it could be that the zip has been appended - // to a self extractor, so take the CD size (also in endrec), subtract - // it from the file offset of the end-central-directory and look there. - if (m_parent_i_stream->SeekI(endPos - endrec.GetSize()) - != wxInvalidOffset && ReadSignature() == CENTRAL_MAGIC) { - m_signature = CENTRAL_MAGIC; - m_position = endPos - endrec.GetSize(); - m_offsetAdjustment = m_position - endrec.GetOffset(); - return true; - } - - wxLogError(_("can't find central directory in zip")); - m_lasterror = wxSTREAM_READ_ERROR; - return false; -} - -// Find the end-of-central-directory record. -// If found the stream will be positioned just past the 4 signature bytes. -// -bool wxZipInputStream::FindEndRecord() -{ - if (!m_parent_i_stream->IsSeekable()) - return false; - - // usually it's 22 bytes in size and the last thing in the file - { - wxLogNull nolog; - if (m_parent_i_stream->SeekI(-END_SIZE, wxFromEnd) == wxInvalidOffset) - return false; - } - - m_parentSeekable = true; - m_signature = 0; - char magic[4]; - if (m_parent_i_stream->Read(magic, 4).LastRead() != 4) - return false; - if ((m_signature = CrackUint32(magic)) == END_MAGIC) - return true; - - // unfortunately, the record has a comment field that can be up to 65535 - // bytes in length, so if the signature not found then search backwards. - wxFileOffset pos = m_parent_i_stream->TellI(); - const int BUFSIZE = 1024; - wxCharBuffer buf(BUFSIZE); - - memcpy(buf.data(), magic, 3); - wxFileOffset minpos = wxMax(pos - 65535L, 0); - - while (pos > minpos) { - size_t len = wx_truncate_cast(size_t, - pos - wxMax(pos - (BUFSIZE - 3), minpos)); - memcpy(buf.data() + len, buf, 3); - pos -= len; - - if (m_parent_i_stream->SeekI(pos, wxFromStart) == wxInvalidOffset || - m_parent_i_stream->Read(buf.data(), len).LastRead() != len) - return false; - - char *p = buf.data() + len; - - while (p-- > buf.data()) { - if ((m_signature = CrackUint32(p)) == END_MAGIC) { - size_t remainder = buf.data() + len - p; - if (remainder > 4) - m_parent_i_stream->Ungetch(p + 4, remainder - 4); - return true; - } - } - } - - return false; -} - -wxZipEntry *wxZipInputStream::GetNextEntry() -{ - if (m_position == wxInvalidOffset) - if (!LoadEndRecord()) - return NULL; - - m_lasterror = m_parentSeekable ? ReadCentral() : ReadLocal(); - if (!IsOk()) - return NULL; - - wxZipEntryPtr_ entry(new wxZipEntry(m_entry)); - entry->m_backlink = m_weaklinks->AddEntry(entry.get(), entry->GetKey()); - return entry.release(); -} - -wxStreamError wxZipInputStream::ReadCentral() -{ - if (!AtHeader()) - CloseEntry(); - - if (m_signature == END_MAGIC) - return wxSTREAM_EOF; - - if (m_signature != CENTRAL_MAGIC) { - wxLogError(_("error reading zip central directory")); - return wxSTREAM_READ_ERROR; - } - - if (QuietSeek(*m_parent_i_stream, m_position + 4) == wxInvalidOffset) - return wxSTREAM_READ_ERROR; - - size_t size = m_entry.ReadCentral(*m_parent_i_stream, GetConv()); - if (!size) { - m_signature = 0; - return wxSTREAM_READ_ERROR; - } - - m_position += size; - m_signature = ReadSignature(); - - if (m_offsetAdjustment) - m_entry.SetOffset(m_entry.GetOffset() + m_offsetAdjustment); - m_entry.SetKey(m_entry.GetOffset()); - - return wxSTREAM_NO_ERROR; -} - -wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/) -{ - if (!AtHeader()) - CloseEntry(); - - if (!m_signature) - m_signature = ReadSignature(); - - if (m_signature == CENTRAL_MAGIC || m_signature == END_MAGIC) { - if (m_streamlink && !m_streamlink->GetOutputStream()) { - m_streamlink->Release(this); - m_streamlink = NULL; - } - } - - while (m_signature == CENTRAL_MAGIC) { - if (m_weaklinks->IsEmpty() && m_streamlink == NULL) - return wxSTREAM_EOF; - - size_t size = m_entry.ReadCentral(*m_parent_i_stream, GetConv()); - m_position += size; - m_signature = 0; - if (!size) - return wxSTREAM_READ_ERROR; - - wxZipEntry *entry = m_weaklinks->GetEntry(m_entry.GetOffset()); - if (entry) { - entry->SetSystemMadeBy(m_entry.GetSystemMadeBy()); - entry->SetVersionMadeBy(m_entry.GetVersionMadeBy()); - entry->SetComment(m_entry.GetComment()); - entry->SetDiskStart(m_entry.GetDiskStart()); - entry->SetInternalAttributes(m_entry.GetInternalAttributes()); - entry->SetExternalAttributes(m_entry.GetExternalAttributes()); - Copy(entry->m_Extra, m_entry.m_Extra); - entry->Notify(); - m_weaklinks->RemoveEntry(entry->GetOffset()); - } - - m_signature = ReadSignature(); - } - - if (m_signature == END_MAGIC) { - if (readEndRec || m_streamlink) { - wxZipEndRec endrec; - endrec.Read(*m_parent_i_stream, GetConv()); - m_Comment = endrec.GetComment(); - m_signature = 0; - if (m_streamlink) { - m_streamlink->GetOutputStream()->SetComment(endrec.GetComment()); - m_streamlink->Release(this); - m_streamlink = NULL; - } - } - return wxSTREAM_EOF; - } - - if (m_signature == LOCAL_MAGIC) { - m_headerSize = m_entry.ReadLocal(*m_parent_i_stream, GetConv()); - m_signature = 0; - m_entry.SetOffset(m_position); - m_entry.SetKey(m_position); - - if (m_headerSize) { - m_TotalEntries++; - return wxSTREAM_NO_ERROR; - } - } - - wxLogError(_("error reading zip local header")); - return wxSTREAM_READ_ERROR; -} - -wxUint32 wxZipInputStream::ReadSignature() -{ - char magic[4]; - m_parent_i_stream->Read(magic, 4); - return m_parent_i_stream->LastRead() == 4 ? CrackUint32(magic) : 0; -} - -bool wxZipInputStream::OpenEntry(wxArchiveEntry& entry) -{ - wxZipEntry *zipEntry = wxStaticCast(&entry, wxZipEntry); - return zipEntry ? OpenEntry(*zipEntry) : false; -} - -// Open an entry -// -bool wxZipInputStream::DoOpen(wxZipEntry *entry, bool raw) -{ - if (m_position == wxInvalidOffset) - if (!LoadEndRecord()) - return false; - if (m_lasterror == wxSTREAM_READ_ERROR) - return false; - if (IsOpened()) - CloseEntry(); - - m_raw = raw; - - if (entry) { - if (AfterHeader() && entry->GetKey() == m_entry.GetOffset()) - return true; - // can only open the current entry on a non-seekable stream - wxCHECK(m_parentSeekable, false); - } - - m_lasterror = wxSTREAM_READ_ERROR; - - if (entry) - m_entry = *entry; - - if (m_parentSeekable) { - if (QuietSeek(*m_parent_i_stream, m_entry.GetOffset()) - == wxInvalidOffset) - return false; - if (ReadSignature() != LOCAL_MAGIC) { - wxLogError(_("bad zipfile offset to entry")); - return false; - } - } - - if (m_parentSeekable || AtHeader()) { - m_headerSize = m_entry.ReadLocal(*m_parent_i_stream, GetConv()); - if (m_headerSize && m_parentSeekable) { - wxZipEntry *ref = m_weaklinks->GetEntry(m_entry.GetKey()); - if (ref) { - Copy(ref->m_LocalExtra, m_entry.m_LocalExtra); - ref->Notify(); - m_weaklinks->RemoveEntry(ref->GetKey()); - } - if (entry && entry != ref) { - Copy(entry->m_LocalExtra, m_entry.m_LocalExtra); - entry->Notify(); - } - } - } - - if (m_headerSize) - m_lasterror = wxSTREAM_NO_ERROR; - return IsOk(); -} - -bool wxZipInputStream::OpenDecompressor(bool raw /*=false*/) -{ - wxASSERT(AfterHeader()); - - wxFileOffset compressedSize = m_entry.GetCompressedSize(); - - if (raw) - m_raw = true; - - if (m_raw) { - if (compressedSize != wxInvalidOffset) { - m_store->Open(compressedSize); - m_decomp = m_store; - } else { - if (!m_rawin) - m_rawin = new wxRawInputStream(*m_parent_i_stream); - m_decomp = m_rawin->Open(OpenDecompressor(m_rawin->GetTee())); - } - } else { - if (compressedSize != wxInvalidOffset && - (m_entry.GetMethod() != wxZIP_METHOD_DEFLATE || - wxZlibInputStream::CanHandleGZip())) { - m_store->Open(compressedSize); - m_decomp = OpenDecompressor(*m_store); - } else { - m_decomp = OpenDecompressor(*m_parent_i_stream); - } - } - - m_crcAccumulator = crc32(0, Z_NULL, 0); - m_lasterror = m_decomp ? m_decomp->GetLastError() : wxSTREAM_READ_ERROR; - return IsOk(); -} - -// Can be overriden to add support for additional decompression methods -// -wxInputStream *wxZipInputStream::OpenDecompressor(wxInputStream& stream) -{ - switch (m_entry.GetMethod()) { - case wxZIP_METHOD_STORE: - if (m_entry.GetSize() == wxInvalidOffset) { - wxLogError(_("stored file length not in Zip header")); - break; - } - m_store->Open(m_entry.GetSize()); - return m_store; - - case wxZIP_METHOD_DEFLATE: - if (!m_inflate) - m_inflate = new wxZlibInputStream2(stream); - else - m_inflate->Open(stream); - return m_inflate; - - default: - wxLogError(_("unsupported Zip compression method")); - } - - return NULL; -} - -bool wxZipInputStream::CloseDecompressor(wxInputStream *decomp) -{ - if (decomp && decomp == m_rawin) - return CloseDecompressor(m_rawin->GetFilterInputStream()); - if (decomp != m_store && decomp != m_inflate) - delete decomp; - return true; -} - -// Closes the current entry and positions the underlying stream at the start -// of the next entry -// -bool wxZipInputStream::CloseEntry() -{ - if (AtHeader()) - return true; - if (m_lasterror == wxSTREAM_READ_ERROR) - return false; - - if (!m_parentSeekable) { - if (!IsOpened() && !OpenDecompressor(true)) - return false; - - const int BUFSIZE = 8192; - wxCharBuffer buf(BUFSIZE); - while (IsOk()) - Read(buf.data(), BUFSIZE); - - m_position += m_headerSize + m_entry.GetCompressedSize(); - } - - if (m_lasterror == wxSTREAM_EOF) - m_lasterror = wxSTREAM_NO_ERROR; - - CloseDecompressor(m_decomp); - m_decomp = NULL; - m_entry = wxZipEntry(); - m_headerSize = 0; - m_raw = false; - - return IsOk(); -} - -size_t wxZipInputStream::OnSysRead(void *buffer, size_t size) -{ - if (!IsOpened()) - if ((AtHeader() && !DoOpen()) || !OpenDecompressor()) - m_lasterror = wxSTREAM_READ_ERROR; - if (!IsOk() || !size) - return 0; - - size_t count = m_decomp->Read(buffer, size).LastRead(); - if (!m_raw) - m_crcAccumulator = crc32(m_crcAccumulator, (Byte*)buffer, count); - if (count < size) - m_lasterror = m_decomp->GetLastError(); - - if (Eof()) { - if ((m_entry.GetFlags() & wxZIP_SUMS_FOLLOW) != 0) { - m_headerSize += m_entry.ReadDescriptor(*m_parent_i_stream); - wxZipEntry *entry = m_weaklinks->GetEntry(m_entry.GetKey()); - - if (entry) { - entry->SetCrc(m_entry.GetCrc()); - entry->SetCompressedSize(m_entry.GetCompressedSize()); - entry->SetSize(m_entry.GetSize()); - entry->Notify(); - } - } - - if (!m_raw) { - m_lasterror = wxSTREAM_READ_ERROR; - - if (m_entry.GetSize() != TellI()) - wxLogError(_("reading zip stream (entry %s): bad length"), - m_entry.GetName().c_str()); - else if (m_crcAccumulator != m_entry.GetCrc()) - wxLogError(_("reading zip stream (entry %s): bad crc"), - m_entry.GetName().c_str()); - else - m_lasterror = wxSTREAM_EOF; - } - } - - return count; -} - -#if WXWIN_COMPATIBILITY_2_6 - -// Borrowed from VS's zip stream (c) 1999 Vaclav Slavik -// -wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) -{ - // seeking works when the stream is created with the compatibility - // constructor - if (!m_allowSeeking) - return wxInvalidOffset; - if (!IsOpened()) - if ((AtHeader() && !DoOpen()) || !OpenDecompressor()) - m_lasterror = wxSTREAM_READ_ERROR; - if (!IsOk()) - return wxInvalidOffset; - - // NB: since ZIP files don't natively support seeking, we have to - // implement a brute force workaround -- reading all the data - // between current and the new position (or between beginning of - // the file and new position...) - - wxFileOffset nextpos; - wxFileOffset pos = TellI(); - - switch ( mode ) - { - case wxFromCurrent : nextpos = seek + pos; break; - case wxFromStart : nextpos = seek; break; - case wxFromEnd : nextpos = GetLength() + seek; break; - default : nextpos = pos; break; /* just to fool compiler, never happens */ - } - - wxFileOffset toskip wxDUMMY_INITIALIZE(0); - if ( nextpos >= pos ) - { - toskip = nextpos - pos; - } - else - { - wxZipEntry current(m_entry); - if (!OpenEntry(current)) - { - m_lasterror = wxSTREAM_READ_ERROR; - return pos; - } - toskip = nextpos; - } - - if ( toskip > 0 ) - { - const int BUFSIZE = 4096; - size_t sz; - char buffer[BUFSIZE]; - while ( toskip > 0 ) - { - sz = wx_truncate_cast(size_t, wxMin(toskip, BUFSIZE)); - Read(buffer, sz); - toskip -= sz; - } - } - - pos = nextpos; - return pos; -} - -#endif // WXWIN_COMPATIBILITY_2_6 - - -///////////////////////////////////////////////////////////////////////////// -// Output stream - -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxZipEntryList_) - -wxZipOutputStream::wxZipOutputStream(wxOutputStream& stream, - int level /*=-1*/, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveOutputStream(stream, conv) -{ - Init(level); -} - -wxZipOutputStream::wxZipOutputStream(wxOutputStream *stream, - int level /*=-1*/, - wxMBConv& conv /*=wxConvLocal*/) - : wxArchiveOutputStream(stream, conv) -{ - Init(level); -} - -void wxZipOutputStream::Init(int level) -{ - m_store = new wxStoredOutputStream(*m_parent_o_stream); - m_deflate = NULL; - m_backlink = NULL; - m_initialData = new char[OUTPUT_LATENCY]; - m_initialSize = 0; - m_pending = NULL; - m_raw = false; - m_headerOffset = 0; - m_headerSize = 0; - m_entrySize = 0; - m_comp = NULL; - m_level = level; - m_offsetAdjustment = wxInvalidOffset; -} - -wxZipOutputStream::~wxZipOutputStream() -{ - Close(); - WX_CLEAR_LIST(wxZipEntryList_, m_entries); - delete m_store; - delete m_deflate; - delete m_pending; - delete [] m_initialData; - if (m_backlink) - m_backlink->Release(this); -} - -bool wxZipOutputStream::PutNextEntry( - const wxString& name, - const wxDateTime& dt /*=wxDateTime::Now()*/, - wxFileOffset size /*=wxInvalidOffset*/) -{ - return PutNextEntry(new wxZipEntry(name, dt, size)); -} - -bool wxZipOutputStream::PutNextDirEntry( - const wxString& name, - const wxDateTime& dt /*=wxDateTime::Now()*/) -{ - wxZipEntry *entry = new wxZipEntry(name, dt); - entry->SetIsDir(); - return PutNextEntry(entry); -} - -bool wxZipOutputStream::CopyEntry(wxZipEntry *entry, - wxZipInputStream& inputStream) -{ - wxZipEntryPtr_ e(entry); - - return - inputStream.DoOpen(e.get(), true) && - DoCreate(e.release(), true) && - Write(inputStream).IsOk() && inputStream.Eof(); -} - -bool wxZipOutputStream::PutNextEntry(wxArchiveEntry *entry) -{ - wxZipEntry *zipEntry = wxStaticCast(entry, wxZipEntry); - if (!zipEntry) - delete entry; - return PutNextEntry(zipEntry); -} - -bool wxZipOutputStream::CopyEntry(wxArchiveEntry *entry, - wxArchiveInputStream& stream) -{ - wxZipEntry *zipEntry = wxStaticCast(entry, wxZipEntry); - - if (!zipEntry || !stream.OpenEntry(*zipEntry)) { - delete entry; - return false; - } - - return CopyEntry(zipEntry, wx_static_cast(wxZipInputStream&, stream)); -} - -bool wxZipOutputStream::CopyArchiveMetaData(wxZipInputStream& inputStream) -{ - m_Comment = inputStream.GetComment(); - if (m_backlink) - m_backlink->Release(this); - m_backlink = inputStream.MakeLink(this); - return true; -} - -bool wxZipOutputStream::CopyArchiveMetaData(wxArchiveInputStream& stream) -{ - return CopyArchiveMetaData(wx_static_cast(wxZipInputStream&, stream)); -} - -void wxZipOutputStream::SetLevel(int level) -{ - if (level != m_level) { - if (m_comp != m_deflate) - delete m_deflate; - m_deflate = NULL; - m_level = level; - } -} - -bool wxZipOutputStream::DoCreate(wxZipEntry *entry, bool raw /*=false*/) -{ - CloseEntry(); - - m_pending = entry; - if (!m_pending) - return false; - - // write the signature bytes right away - wxDataOutputStream ds(*m_parent_o_stream); - ds << LOCAL_MAGIC; - - // and if this is the first entry test for seekability - if (m_headerOffset == 0 && m_parent_o_stream->IsSeekable()) { -#if wxUSE_LOG - bool logging = wxLog::IsEnabled(); - wxLogNull nolog; -#endif // wxUSE_LOG - wxFileOffset here = m_parent_o_stream->TellO(); - - if (here != wxInvalidOffset && here >= 4) { - if (m_parent_o_stream->SeekO(here - 4) == here - 4) { - m_offsetAdjustment = here - 4; -#if wxUSE_LOG - wxLog::EnableLogging(logging); -#endif // wxUSE_LOG - m_parent_o_stream->SeekO(here); - } - } - } - - m_pending->SetOffset(m_headerOffset); - - m_crcAccumulator = crc32(0, Z_NULL, 0); - - if (raw) - m_raw = true; - - m_lasterror = wxSTREAM_NO_ERROR; - return true; -} - -// Can be overriden to add support for additional compression methods -// -wxOutputStream *wxZipOutputStream::OpenCompressor( - wxOutputStream& stream, - wxZipEntry& entry, - const Buffer bufs[]) -{ - if (entry.GetMethod() == wxZIP_METHOD_DEFAULT) { - if (GetLevel() == 0 - && (IsParentSeekable() - || entry.GetCompressedSize() != wxInvalidOffset - || entry.GetSize() != wxInvalidOffset)) { - entry.SetMethod(wxZIP_METHOD_STORE); - } else { - int size = 0; - for (int i = 0; bufs[i].m_data; ++i) - size += bufs[i].m_size; - entry.SetMethod(size <= 6 ? - wxZIP_METHOD_STORE : wxZIP_METHOD_DEFLATE); - } - } - - switch (entry.GetMethod()) { - case wxZIP_METHOD_STORE: - if (entry.GetCompressedSize() == wxInvalidOffset) - entry.SetCompressedSize(entry.GetSize()); - return m_store; - - case wxZIP_METHOD_DEFLATE: - { - int defbits = wxZIP_DEFLATE_NORMAL; - switch (GetLevel()) { - case 0: case 1: - defbits = wxZIP_DEFLATE_SUPERFAST; - break; - case 2: case 3: case 4: - defbits = wxZIP_DEFLATE_FAST; - break; - case 8: case 9: - defbits = wxZIP_DEFLATE_EXTRA; - break; - } - entry.SetFlags((entry.GetFlags() & ~wxZIP_DEFLATE_MASK) | - defbits | wxZIP_SUMS_FOLLOW); - - if (!m_deflate) - m_deflate = new wxZlibOutputStream2(stream, GetLevel()); - else - m_deflate->Open(stream); - - return m_deflate; - } - - default: - wxLogError(_("unsupported Zip compression method")); - } - - return NULL; -} - -bool wxZipOutputStream::CloseCompressor(wxOutputStream *comp) -{ - if (comp == m_deflate) - m_deflate->Close(); - else if (comp != m_store) - delete comp; - return true; -} - -// This is called when OUPUT_LATENCY bytes has been written to the -// wxZipOutputStream to actually create the zip entry. -// -void wxZipOutputStream::CreatePendingEntry(const void *buffer, size_t size) -{ - wxASSERT(IsOk() && m_pending && !m_comp); - wxZipEntryPtr_ spPending(m_pending); - m_pending = NULL; - - Buffer bufs[] = { - { m_initialData, m_initialSize }, - { (const char*)buffer, size }, - { NULL, 0 } - }; - - if (m_raw) - m_comp = m_store; - else - m_comp = OpenCompressor(*m_store, *spPending, - m_initialSize ? bufs : bufs + 1); - - if (IsParentSeekable() - || (spPending->m_Crc - && spPending->m_CompressedSize != wxInvalidOffset - && spPending->m_Size != wxInvalidOffset)) - spPending->m_Flags &= ~wxZIP_SUMS_FOLLOW; - else - if (spPending->m_CompressedSize != wxInvalidOffset) - spPending->m_Flags |= wxZIP_SUMS_FOLLOW; - - m_headerSize = spPending->WriteLocal(*m_parent_o_stream, GetConv()); - m_lasterror = m_parent_o_stream->GetLastError(); - - if (IsOk()) { - m_entries.push_back(spPending.release()); - OnSysWrite(m_initialData, m_initialSize); - } - - m_initialSize = 0; -} - -// This is called to write out the zip entry when Close has been called -// before OUTPUT_LATENCY bytes has been written to the wxZipOutputStream. -// -void wxZipOutputStream::CreatePendingEntry() -{ - wxASSERT(IsOk() && m_pending && !m_comp); - wxZipEntryPtr_ spPending(m_pending); - m_pending = NULL; - m_lasterror = wxSTREAM_WRITE_ERROR; - - if (!m_raw) { - // Initially compresses the data to memory, then fall back to 'store' - // if the compressor makes the data larger rather than smaller. - wxMemoryOutputStream mem; - Buffer bufs[] = { { m_initialData, m_initialSize }, { NULL, 0 } }; - wxOutputStream *comp = OpenCompressor(mem, *spPending, bufs); - - if (!comp) - return; - if (comp != m_store) { - bool ok = comp->Write(m_initialData, m_initialSize).IsOk(); - CloseCompressor(comp); - if (!ok) - return; - } - - m_entrySize = m_initialSize; - m_crcAccumulator = crc32(0, (Byte*)m_initialData, m_initialSize); - - if (mem.GetSize() > 0 && mem.GetSize() < m_initialSize) { - m_initialSize = mem.GetSize(); - mem.CopyTo(m_initialData, m_initialSize); - } else { - spPending->SetMethod(wxZIP_METHOD_STORE); - } - - spPending->SetSize(m_entrySize); - spPending->SetCrc(m_crcAccumulator); - spPending->SetCompressedSize(m_initialSize); - } - - spPending->m_Flags &= ~wxZIP_SUMS_FOLLOW; - m_headerSize = spPending->WriteLocal(*m_parent_o_stream, GetConv()); - - if (m_parent_o_stream->IsOk()) { - m_entries.push_back(spPending.release()); - m_comp = m_store; - m_store->Write(m_initialData, m_initialSize); - } - - m_initialSize = 0; - m_lasterror = m_parent_o_stream->GetLastError(); -} - -// Write the 'central directory' and the 'end-central-directory' records. -// -bool wxZipOutputStream::Close() -{ - CloseEntry(); - - if (m_lasterror == wxSTREAM_WRITE_ERROR || m_entries.size() == 0) { - wxFilterOutputStream::Close(); - return false; - } - - wxZipEndRec endrec; - - endrec.SetEntriesHere(m_entries.size()); - endrec.SetTotalEntries(m_entries.size()); - endrec.SetOffset(m_headerOffset); - endrec.SetComment(m_Comment); - - wxZipEntryList_::iterator it; - wxFileOffset size = 0; - - for (it = m_entries.begin(); it != m_entries.end(); ++it) { - size += (*it)->WriteCentral(*m_parent_o_stream, GetConv()); - delete *it; - } - m_entries.clear(); - - endrec.SetSize(size); - endrec.Write(*m_parent_o_stream, GetConv()); - - m_lasterror = m_parent_o_stream->GetLastError(); - - if (!wxFilterOutputStream::Close() || !IsOk()) - return false; - m_lasterror = wxSTREAM_EOF; - return true; -} - -// Finish writing the current entry -// -bool wxZipOutputStream::CloseEntry() -{ - if (IsOk() && m_pending) - CreatePendingEntry(); - if (!IsOk()) - return false; - if (!m_comp) - return true; - - CloseCompressor(m_comp); - m_comp = NULL; - - wxFileOffset compressedSize = m_store->TellO(); - - wxZipEntry& entry = *m_entries.back(); - - // When writing raw the crc and size can't be checked - if (m_raw) { - m_crcAccumulator = entry.GetCrc(); - m_entrySize = entry.GetSize(); - } - - // Write the sums in the trailing 'data descriptor' if necessary - if (entry.m_Flags & wxZIP_SUMS_FOLLOW) { - wxASSERT(!IsParentSeekable()); - m_headerOffset += - entry.WriteDescriptor(*m_parent_o_stream, m_crcAccumulator, - compressedSize, m_entrySize); - m_lasterror = m_parent_o_stream->GetLastError(); - } - - // If the local header didn't have the correct crc and size written to - // it then seek back and fix it - else if (m_crcAccumulator != entry.GetCrc() - || m_entrySize != entry.GetSize() - || compressedSize != entry.GetCompressedSize()) - { - if (IsParentSeekable()) { - wxFileOffset here = m_parent_o_stream->TellO(); - wxFileOffset headerOffset = m_headerOffset + m_offsetAdjustment; - m_parent_o_stream->SeekO(headerOffset + SUMS_OFFSET); - entry.WriteDescriptor(*m_parent_o_stream, m_crcAccumulator, - compressedSize, m_entrySize); - m_parent_o_stream->SeekO(here); - m_lasterror = m_parent_o_stream->GetLastError(); - } else { - m_lasterror = wxSTREAM_WRITE_ERROR; - } - } - - m_headerOffset += m_headerSize + compressedSize; - m_headerSize = 0; - m_entrySize = 0; - m_store->Close(); - m_raw = false; - - if (IsOk()) - m_lasterror = m_parent_o_stream->GetLastError(); - else - wxLogError(_("error writing zip entry '%s': bad crc or length"), - entry.GetName().c_str()); - return IsOk(); -} - -void wxZipOutputStream::Sync() -{ - if (IsOk() && m_pending) - CreatePendingEntry(NULL, 0); - if (!m_comp) - m_lasterror = wxSTREAM_WRITE_ERROR; - if (IsOk()) { - m_comp->Sync(); - m_lasterror = m_comp->GetLastError(); - } -} - -size_t wxZipOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - if (IsOk() && m_pending) { - if (m_initialSize + size < OUTPUT_LATENCY) { - memcpy(m_initialData + m_initialSize, buffer, size); - m_initialSize += size; - return size; - } else { - CreatePendingEntry(buffer, size); - } - } - - if (!m_comp) - m_lasterror = wxSTREAM_WRITE_ERROR; - if (!IsOk() || !size) - return 0; - - if (m_comp->Write(buffer, size).LastWrite() != size) - m_lasterror = wxSTREAM_WRITE_ERROR; - m_crcAccumulator = crc32(m_crcAccumulator, (Byte*)buffer, size); - m_entrySize += m_comp->LastWrite(); - - return m_comp->LastWrite(); -} - -#endif // wxUSE_ZIPSTREAM diff --git a/Source/3rdParty/wx/src/common/zstream.cpp b/Source/3rdParty/wx/src/common/zstream.cpp deleted file mode 100644 index 8f66fce17..000000000 --- a/Source/3rdParty/wx/src/common/zstream.cpp +++ /dev/null @@ -1,428 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: src/common/zstream.cpp -// Purpose: Compressed stream classes -// Author: Guilhem Lavaux -// Modified by: Mike Wetherell -// Created: 11/07/98 -// RCS-ID: $Id: zstream.cpp 42621 2006-10-29 16:47:20Z MW $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ZLIB && wxUSE_STREAMS - -#include "wx/zstream.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" -#endif - - -// normally, the compiler options should contain -I../zlib, but it is -// apparently not the case for all MSW makefiles and so, unless we use -// configure (which defines __WX_SETUP_H__) or it is explicitly overridden by -// the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here -#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) - #include "../zlib/zlib.h" -#else - #include "zlib.h" -#endif - -enum { - ZSTREAM_BUFFER_SIZE = 16384, - ZSTREAM_GZIP = 0x10, // gzip header - ZSTREAM_AUTO = 0x20 // auto detect between gzip and zlib -}; - - -///////////////////////////////////////////////////////////////////////////// -// Zlib Class factory - -IMPLEMENT_DYNAMIC_CLASS(wxZlibClassFactory, wxFilterClassFactory) - -static wxZlibClassFactory g_wxZlibClassFactory; - -wxZlibClassFactory::wxZlibClassFactory() -{ - if (this == &g_wxZlibClassFactory) - PushFront(); -} - -const wxChar * const * -wxZlibClassFactory::GetProtocols(wxStreamProtocolType type) const -{ - static const wxChar *mimes[] = { _T("application/x-deflate"), NULL }; - static const wxChar *encs[] = { _T("deflate"), NULL }; - static const wxChar *empty[] = { NULL }; - - switch (type) { - case wxSTREAM_MIMETYPE: return mimes; - case wxSTREAM_ENCODING: return encs; - default: return empty; - } -} - - -///////////////////////////////////////////////////////////////////////////// -// Gzip Class factory - -IMPLEMENT_DYNAMIC_CLASS(wxGzipClassFactory, wxFilterClassFactory) - -static wxGzipClassFactory g_wxGzipClassFactory; - -wxGzipClassFactory::wxGzipClassFactory() -{ - if (this == &g_wxGzipClassFactory && wxZlibInputStream::CanHandleGZip()) - PushFront(); -} - -const wxChar * const * -wxGzipClassFactory::GetProtocols(wxStreamProtocolType type) const -{ - static const wxChar *protos[] = - { _T("gzip"), NULL }; - static const wxChar *mimes[] = - { _T("application/gzip"), _T("application/x-gzip"), NULL }; - static const wxChar *encs[] = - { _T("gzip"), NULL }; - static const wxChar *exts[] = - { _T(".gz"), _T(".gzip"), NULL }; - static const wxChar *empty[] = - { NULL }; - - switch (type) { - case wxSTREAM_PROTOCOL: return protos; - case wxSTREAM_MIMETYPE: return mimes; - case wxSTREAM_ENCODING: return encs; - case wxSTREAM_FILEEXT: return exts; - default: return empty; - } -} - - -////////////////////// -// wxZlibInputStream -////////////////////// - -wxZlibInputStream::wxZlibInputStream(wxInputStream& stream, int flags) - : wxFilterInputStream(stream) -{ - Init(flags); -} - -wxZlibInputStream::wxZlibInputStream(wxInputStream *stream, int flags) - : wxFilterInputStream(stream) -{ - Init(flags); -} - -void wxZlibInputStream::Init(int flags) -{ - m_inflate = NULL; - m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE]; - m_z_size = ZSTREAM_BUFFER_SIZE; - m_pos = 0; - -#if WXWIN_COMPATIBILITY_2_4 - // treat compatibility mode as auto - m_24compatibilty = flags == wxZLIB_24COMPATIBLE; - if (m_24compatibilty) - flags = wxZLIB_AUTO; -#endif - - // if gzip is asked for but not supported... - if ((flags == wxZLIB_GZIP || flags == wxZLIB_AUTO) && !CanHandleGZip()) { - if (flags == wxZLIB_AUTO) { - // an error will come later if the input turns out not to be a zlib - flags = wxZLIB_ZLIB; - } - else { - wxLogError(_("Gzip not supported by this version of zlib")); - m_lasterror = wxSTREAM_READ_ERROR; - return; - } - } - - if (m_z_buffer) { - m_inflate = new z_stream_s; - - if (m_inflate) { - memset(m_inflate, 0, sizeof(z_stream_s)); - - // see zlib.h for documentation on windowBits - int windowBits = MAX_WBITS; - switch (flags) { - case wxZLIB_NO_HEADER: windowBits = -MAX_WBITS; break; - case wxZLIB_ZLIB: windowBits = MAX_WBITS; break; - case wxZLIB_GZIP: windowBits = MAX_WBITS | ZSTREAM_GZIP; break; - case wxZLIB_AUTO: windowBits = MAX_WBITS | ZSTREAM_AUTO; break; - default: wxFAIL_MSG(wxT("Invalid zlib flag")); - } - - if (inflateInit2(m_inflate, windowBits) == Z_OK) - return; - } - } - - wxLogError(_("Can't initialize zlib inflate stream.")); - m_lasterror = wxSTREAM_READ_ERROR; -} - -wxZlibInputStream::~wxZlibInputStream() -{ - inflateEnd(m_inflate); - delete m_inflate; - - delete [] m_z_buffer; -} - -size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) -{ - wxASSERT_MSG(m_inflate && m_z_buffer, wxT("Inflate stream not open")); - - if (!m_inflate || !m_z_buffer) - m_lasterror = wxSTREAM_READ_ERROR; - if (!IsOk() || !size) - return 0; - - int err = Z_OK; - m_inflate->next_out = (unsigned char *)buffer; - m_inflate->avail_out = size; - - while (err == Z_OK && m_inflate->avail_out > 0) { - if (m_inflate->avail_in == 0 && m_parent_i_stream->IsOk()) { - m_parent_i_stream->Read(m_z_buffer, m_z_size); - m_inflate->next_in = m_z_buffer; - m_inflate->avail_in = m_parent_i_stream->LastRead(); - } - err = inflate(m_inflate, Z_SYNC_FLUSH); - } - - switch (err) { - case Z_OK: - break; - - case Z_STREAM_END: - if (m_inflate->avail_out) { - // Unread any data taken from past the end of the deflate stream, so that - // any additional data can be read from the underlying stream (the crc - // in a gzip for example) - if (m_inflate->avail_in) { - m_parent_i_stream->Reset(); - m_parent_i_stream->Ungetch(m_inflate->next_in, m_inflate->avail_in); - m_inflate->avail_in = 0; - } - m_lasterror = wxSTREAM_EOF; - } - break; - - case Z_BUF_ERROR: - // Indicates that zlib was expecting more data, but the parent stream - // has none. Other than Eof the error will have been already reported - // by the parent strean, - m_lasterror = wxSTREAM_READ_ERROR; - if (m_parent_i_stream->Eof()) -#if WXWIN_COMPATIBILITY_2_4 - if (m_24compatibilty) - m_lasterror = wxSTREAM_EOF; - else -#endif - wxLogError(_("Can't read inflate stream: unexpected EOF in underlying stream.")); - break; - - default: - wxString msg(m_inflate->msg, *wxConvCurrent); - if (!msg) - msg = wxString::Format(_("zlib error %d"), err); - wxLogError(_("Can't read from inflate stream: %s"), msg.c_str()); - m_lasterror = wxSTREAM_READ_ERROR; - } - - size -= m_inflate->avail_out; - m_pos += size; - return size; -} - -/* static */ bool wxZlibInputStream::CanHandleGZip() -{ - const char *dot = strchr(zlibVersion(), '.'); - int major = atoi(zlibVersion()); - int minor = dot ? atoi(dot + 1) : 0; - return major > 1 || (major == 1 && minor >= 2); -} - - -////////////////////// -// wxZlibOutputStream -////////////////////// - -wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream, - int level, - int flags) - : wxFilterOutputStream(stream) -{ - Init(level, flags); -} - -wxZlibOutputStream::wxZlibOutputStream(wxOutputStream *stream, - int level, - int flags) - : wxFilterOutputStream(stream) -{ - Init(level, flags); -} - -void wxZlibOutputStream::Init(int level, int flags) -{ - m_deflate = NULL; - m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE]; - m_z_size = ZSTREAM_BUFFER_SIZE; - m_pos = 0; - - if ( level == -1 ) - { - level = Z_DEFAULT_COMPRESSION; - } - else - { - wxASSERT_MSG(level >= 0 && level <= 9, wxT("wxZlibOutputStream compression level must be between 0 and 9!")); - } - - // if gzip is asked for but not supported... - if (flags == wxZLIB_GZIP && !CanHandleGZip()) { - wxLogError(_("Gzip not supported by this version of zlib")); - m_lasterror = wxSTREAM_WRITE_ERROR; - return; - } - - if (m_z_buffer) { - m_deflate = new z_stream_s; - - if (m_deflate) { - memset(m_deflate, 0, sizeof(z_stream_s)); - m_deflate->next_out = m_z_buffer; - m_deflate->avail_out = m_z_size; - - // see zlib.h for documentation on windowBits - int windowBits = MAX_WBITS; - switch (flags) { - case wxZLIB_NO_HEADER: windowBits = -MAX_WBITS; break; - case wxZLIB_ZLIB: windowBits = MAX_WBITS; break; - case wxZLIB_GZIP: windowBits = MAX_WBITS | ZSTREAM_GZIP; break; - default: wxFAIL_MSG(wxT("Invalid zlib flag")); - } - - if (deflateInit2(m_deflate, level, Z_DEFLATED, windowBits, - 8, Z_DEFAULT_STRATEGY) == Z_OK) - return; - } - } - - wxLogError(_("Can't initialize zlib deflate stream.")); - m_lasterror = wxSTREAM_WRITE_ERROR; -} - -bool wxZlibOutputStream::Close() - { - DoFlush(true); - deflateEnd(m_deflate); - delete m_deflate; - - m_deflate = NULL; - delete[] m_z_buffer; - m_z_buffer = NULL; - - return wxFilterOutputStream::Close() && IsOk(); - } - -void wxZlibOutputStream::DoFlush(bool final) -{ - if (!m_deflate || !m_z_buffer) - m_lasterror = wxSTREAM_WRITE_ERROR; - if (!IsOk()) - return; - - int err = Z_OK; - bool done = false; - - while (err == Z_OK || err == Z_STREAM_END) { - size_t len = m_z_size - m_deflate->avail_out; - if (len) { - if (m_parent_o_stream->Write(m_z_buffer, len).LastWrite() != len) { - m_lasterror = wxSTREAM_WRITE_ERROR; - wxLogDebug(wxT("wxZlibOutputStream: Error writing to underlying stream")); - break; - } - m_deflate->next_out = m_z_buffer; - m_deflate->avail_out = m_z_size; - } - - if (done) - break; - err = deflate(m_deflate, final ? Z_FINISH : Z_FULL_FLUSH); - done = m_deflate->avail_out != 0 || err == Z_STREAM_END; - } -} - -size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size) -{ - wxASSERT_MSG(m_deflate && m_z_buffer, wxT("Deflate stream not open")); - - if (!m_deflate || !m_z_buffer) - { - // notice that this will make IsOk() test just below return false - m_lasterror = wxSTREAM_WRITE_ERROR; - } - - if (!IsOk() || !size) - return 0; - - int err = Z_OK; - m_deflate->next_in = (unsigned char *)buffer; - m_deflate->avail_in = size; - - while (err == Z_OK && m_deflate->avail_in > 0) { - if (m_deflate->avail_out == 0) { - m_parent_o_stream->Write(m_z_buffer, m_z_size); - if (m_parent_o_stream->LastWrite() != m_z_size) { - m_lasterror = wxSTREAM_WRITE_ERROR; - wxLogDebug(wxT("wxZlibOutputStream: Error writing to underlying stream")); - break; - } - - m_deflate->next_out = m_z_buffer; - m_deflate->avail_out = m_z_size; - } - - err = deflate(m_deflate, Z_NO_FLUSH); - } - - if (err != Z_OK) { - m_lasterror = wxSTREAM_WRITE_ERROR; - wxString msg(m_deflate->msg, *wxConvCurrent); - if (!msg) - msg = wxString::Format(_("zlib error %d"), err); - wxLogError(_("Can't write to deflate stream: %s"), msg.c_str()); - } - - size -= m_deflate->avail_in; - m_pos += size; - return size; -} - -/* static */ bool wxZlibOutputStream::CanHandleGZip() -{ - return wxZlibInputStream::CanHandleGZip(); -} - -#endif - // wxUSE_ZLIB && wxUSE_STREAMS diff --git a/Source/3rdParty/wx/src/generic/busyinfo.cpp b/Source/3rdParty/wx/src/generic/busyinfo.cpp deleted file mode 100644 index 257c23366..000000000 --- a/Source/3rdParty/wx/src/generic/busyinfo.cpp +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/busyinfo.cpp -// Purpose: Information window when app is busy -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: busyinfo.cpp 44898 2007-03-18 20:39:13Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_BUSYINFO - -// for all others, include the necessary headers -#ifndef WX_PRECOMP - #include "wx/frame.h" - #include "wx/stattext.h" - #include "wx/panel.h" - #include "wx/utils.h" -#endif - -#include "wx/busyinfo.h" - -class WXDLLEXPORT wxInfoFrame : public wxFrame -{ -public: - wxInfoFrame(wxWindow *parent, const wxString& message); - -private: - DECLARE_NO_COPY_CLASS(wxInfoFrame) -}; - - -wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) - : wxFrame(parent, wxID_ANY, wxT("Busy"), - wxDefaultPosition, wxDefaultSize, -#if defined(__WXX11__) - wxRESIZE_BORDER -#else - wxSIMPLE_BORDER -#endif - | wxFRAME_TOOL_WINDOW) -{ - wxPanel *panel = new wxPanel( this ); - wxStaticText *text = new wxStaticText(panel, wxID_ANY, message); - - panel->SetCursor(*wxHOURGLASS_CURSOR); - text->SetCursor(*wxHOURGLASS_CURSOR); - - // make the frame of at least the standard size (400*80) but big enough - // for the text we show - wxSize sizeText = text->GetBestSize(); -#ifdef __WXPM__ - int nX = 0; - int nY = 0; - int nWidth = 0; - int nHeight = 0; - int nParentHeight = parent->GetClientSize().y; - int nParentWidth = parent->GetClientSize().x; - int nColor; - - SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwnd() - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - panel->SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)panel->GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwndOf(panel) - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - nWidth = wxMax(sizeText.x, 340) + 60; - nHeight = wxMax(sizeText.y, 40) + 40; - nX = (nParentWidth - nWidth) / 2; - nY = (nParentHeight / 2) - (nHeight / 2); - nY = nParentHeight - (nY + nHeight); - ::WinSetWindowPos( m_hFrame - ,HWND_TOP - ,nX - ,nY - ,nWidth - ,nHeight - ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE - ); - text->SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)text->GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwndOf(text) - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - text->Center(wxBOTH); -#else - SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40); - - // need to size the panel correctly first so that text->Centre() works - panel->SetSize(GetClientSize()); - - text->Centre(wxBOTH); - Centre(wxBOTH); -#endif -} - -wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent) -{ - m_InfoFrame = new wxInfoFrame( parent, message); - if ( parent && parent->HasFlag(wxSTAY_ON_TOP) ) - { - // we must have this flag to be in front of our parent if it has it - m_InfoFrame->SetWindowStyleFlag(wxSTAY_ON_TOP); - } - - m_InfoFrame->Show(true); - m_InfoFrame->Refresh(); - m_InfoFrame->Update(); -} - -wxBusyInfo::~wxBusyInfo() -{ - m_InfoFrame->Show(false); - m_InfoFrame->Close(); -} - -#endif // wxUSE_BUSYINFO diff --git a/Source/3rdParty/wx/src/generic/buttonbar.cpp b/Source/3rdParty/wx/src/generic/buttonbar.cpp deleted file mode 100644 index b229d7275..000000000 --- a/Source/3rdParty/wx/src/generic/buttonbar.cpp +++ /dev/null @@ -1,555 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/buttonbar.cpp -// Purpose: wxButtonToolBar implementation -// Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech -// Modified by: -// Created: 2006-04-13 -// Id: $Id: buttonbar.cpp 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, -// SciTech Software, Inc. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// Currently, only for Mac as a toolbar replacement. -#if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON - -#include "wx/generic/buttonbar.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/log.h" - #include "wx/frame.h" - #include "wx/dcclient.h" - #include "wx/settings.h" - #include "wx/image.h" -#endif - -// ---------------------------------------------------------------------------- -// wxButtonToolBarTool: our implementation of wxToolBarToolBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButtonToolBarTool : public wxToolBarToolBase -{ -public: - wxButtonToolBarTool(wxButtonToolBar *tbar, - int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) - : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp) - { - m_x = m_y = wxDefaultCoord; - m_width = - m_height = 0; - - m_button = NULL; - } - - wxButtonToolBarTool(wxButtonToolBar *tbar, wxControl *control) - : wxToolBarToolBase(tbar, control) - { - m_x = m_y = wxDefaultCoord; - m_width = - m_height = 0; - m_button = NULL; - } - - wxBitmapButton* GetButton() const { return m_button; } - void SetButton(wxBitmapButton* button) { m_button = button; } - -public: - // the tool position (for controls) - wxCoord m_x; - wxCoord m_y; - wxCoord m_width; - wxCoord m_height; - -private: - // the control representing the button - wxBitmapButton* m_button; -}; - -// ============================================================================ -// wxButtonToolBar implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxButtonToolBar, wxControl) - -BEGIN_EVENT_TABLE(wxButtonToolBar, wxControl) - EVT_BUTTON(wxID_ANY, wxButtonToolBar::OnCommand) - EVT_PAINT(wxButtonToolBar::OnPaint) - EVT_LEFT_UP(wxButtonToolBar::OnLeftUp) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// wxButtonToolBar creation -// ---------------------------------------------------------------------------- - -void wxButtonToolBar::Init() -{ - // no tools yet - m_needsLayout = false; - - // unknown widths for the tools and separators - m_widthSeparator = wxDefaultCoord; - - m_maxWidth = m_maxHeight = 0; - - m_labelMargin = 2; - m_labelHeight = 0; - - SetMargins(8, 2); - SetToolPacking(8); -} - -bool wxButtonToolBar::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( !wxToolBarBase::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - { - return false; - } - - // wxColour lightBackground(244, 244, 244); - - wxFont font(wxSMALL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxNORMAL); - SetFont(font); - - // Calculate the label height if necessary - if (GetWindowStyle() & wxTB_TEXT) - { - wxClientDC dc(this); - dc.SetFont(font); - int w, h; - dc.GetTextExtent(wxT("X"), & w, & h); - m_labelHeight = h; - } - return true; -} - -wxButtonToolBar::~wxButtonToolBar() -{ -} - -// ---------------------------------------------------------------------------- -// wxButtonToolBar tool-related methods -// ---------------------------------------------------------------------------- - -wxToolBarToolBase *wxButtonToolBar::FindToolForPosition(wxCoord x, wxCoord y) const -{ - // check the "other" direction first: it must be inside the toolbar or we - // don't risk finding anything - if ( IsVertical() ) - { - if ( x < 0 || x > m_maxWidth ) - return NULL; - - // we always use x, even for a vertical toolbar, this makes the code - // below simpler - x = y; - } - else // horizontal - { - if ( y < 0 || y > m_maxHeight ) - return NULL; - } - - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - wxButtonToolBarTool *tool = (wxButtonToolBarTool*) node->GetData(); - wxRect rectTool = GetToolRect(tool); - - wxCoord startTool, endTool; - GetRectLimits(rectTool, &startTool, &endTool); - - if ( x >= startTool && x <= endTool ) - { - // don't return the separators from here, they don't accept any - // input anyhow - return tool->IsSeparator() ? NULL : tool; - } - } - - return NULL; -} - -void wxButtonToolBar::GetRectLimits(const wxRect& rect, - wxCoord *start, - wxCoord *end) const -{ - wxCHECK_RET( start && end, _T("NULL pointer in GetRectLimits") ); - - if ( IsVertical() ) - { - *start = rect.GetTop(); - *end = rect.GetBottom(); - } - else // horizontal - { - *start = rect.GetLeft(); - *end = rect.GetRight(); - } -} - - -void wxButtonToolBar::SetToolShortHelp(int id, const wxString& help) -{ - wxToolBarToolBase *tool = FindById(id); - - wxCHECK_RET( tool, _T("SetToolShortHelp: no such tool") ); - - // TODO: set tooltip/short help - tool->SetShortHelp(help); -} - -bool wxButtonToolBar::DoInsertTool(size_t WXUNUSED(pos), - wxToolBarToolBase * WXUNUSED(tool)) -{ - return true; -} - -bool wxButtonToolBar::DoDeleteTool(size_t WXUNUSED(pos), - wxToolBarToolBase * WXUNUSED(tool)) -{ - // TODO - return true; -} - -void wxButtonToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(enable)) -{ - // TODO -} - -void wxButtonToolBar::DoToggleTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) -{ - // TODO -} - -void wxButtonToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) -{ - // TODO -} - -wxToolBarToolBase *wxButtonToolBar::CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) -{ - return new wxButtonToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp); -} - -wxToolBarToolBase *wxButtonToolBar::CreateTool(wxControl *control) -{ - return new wxButtonToolBarTool(this, control); -} - -// ---------------------------------------------------------------------------- -// wxButtonToolBar geometry -// ---------------------------------------------------------------------------- - -wxRect wxButtonToolBar::GetToolRect(wxToolBarToolBase *toolBase) const -{ - const wxButtonToolBarTool *tool = (wxButtonToolBarTool *)toolBase; - - wxRect rect; - - wxCHECK_MSG( tool, rect, _T("GetToolRect: NULL tool") ); - - // ensure that we always have the valid tool position - if ( m_needsLayout ) - { - wxConstCast(this, wxButtonToolBar)->DoLayout(); - } - - rect.x = tool->m_x - (m_toolPacking/2); - rect.y = tool->m_y; - - if ( IsVertical() ) - { - if (tool->IsButton()) - { - rect.width = m_defaultWidth; - rect.height = m_defaultHeight; - if (tool->GetButton()) - rect.SetSize(wxSize(tool->m_width, tool->m_height)); - } - else if (tool->IsSeparator()) - { - rect.width = m_defaultWidth; - rect.height = m_widthSeparator; - } - else // control - { - rect.width = tool->m_width; - rect.height = tool->m_height; - } - } - else // horizontal - { - if (tool->IsButton()) - { - rect.width = m_defaultWidth; - rect.height = m_defaultHeight; - if (tool->GetButton()) - rect.SetSize(wxSize(tool->m_width, tool->m_height)); - } - else if (tool->IsSeparator()) - { - rect.width = m_widthSeparator; - rect.height = m_defaultHeight; - } - else // control - { - rect.width = tool->m_width; - rect.height = tool->m_height; - } - } - - rect.width += m_toolPacking; - - return rect; -} - -bool wxButtonToolBar::Realize() -{ - if ( !wxToolBarBase::Realize() ) - return false; - - m_needsLayout = true; - DoLayout(); - - SetInitialSize(wxSize(m_maxWidth, m_maxHeight)); - - return true; -} - -void wxButtonToolBar::DoLayout() -{ - m_needsLayout = false; - - wxCoord x = m_xMargin, - y = m_yMargin; - - int maxHeight = 0; - - const wxCoord widthTool = IsVertical() ? m_defaultHeight : m_defaultWidth; - wxCoord margin = IsVertical() ? m_xMargin : m_yMargin; - wxCoord *pCur = IsVertical() ? &y : &x; - - // calculate the positions of all elements - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - wxButtonToolBarTool *tool = (wxButtonToolBarTool *) node->GetData(); - - tool->m_x = x; - tool->m_y = y; - - if (tool->IsButton()) - { - if (!tool->GetButton()) - { - wxBitmapButton* bmpButton = new wxBitmapButton(this, tool->GetId(), tool->GetNormalBitmap(), wxPoint(tool->m_x, tool->m_y), wxDefaultSize, - wxBU_AUTODRAW|wxBORDER_NONE); - if (!tool->GetShortHelp().empty()) - bmpButton->SetLabel(tool->GetShortHelp()); - - tool->SetButton(bmpButton); - } - else - { - tool->GetButton()->Move(wxPoint(tool->m_x, tool->m_y)); - } - - int w = widthTool; - if (tool->GetButton()) - { - wxSize sz = tool->GetButton()->GetSize(); - w = sz.x; - - if (m_labelHeight > 0) - { - sz.y += (m_labelHeight + m_labelMargin); - - if (!tool->GetShortHelp().empty()) - { - wxClientDC dc(this); - dc.SetFont(GetFont()); - int tw, th; - dc.GetTextExtent(tool->GetShortHelp(), & tw, & th); - - // If the label is bigger than the icon, the label width - // becomes the new tool width, and we need to centre the - // the bitmap in this box. - if (tw > sz.x) - { - int newX = int(tool->m_x + (tw - sz.x)/2.0); - tool->GetButton()->Move(newX, tool->m_y); - sz.x = tw; - } - } - } - - maxHeight = wxMax(maxHeight, sz.y); - - tool->m_width = sz.x; - tool->m_height = sz.y; - w = sz.x; - } - - *pCur += (w + GetToolPacking()); - } - else if (tool->IsSeparator()) - { - *pCur += m_widthSeparator; - } - else if (!IsVertical()) // horizontal control - { - wxControl *control = tool->GetControl(); - wxSize size = control->GetSize(); - tool->m_y += (m_defaultHeight - size.y)/2; - tool->m_width = size.x; - tool->m_height = size.y; - - *pCur += tool->m_width; - - maxHeight = wxMax(maxHeight, size.y); - } - *pCur += margin; - } - - // calculate the total toolbar size - m_maxWidth = x + 2*m_xMargin; - m_maxHeight = maxHeight + 2*m_yMargin; - - if ((GetWindowStyle() & wxTB_NODIVIDER) == 0) - m_maxHeight += 2; - -} - -wxSize wxButtonToolBar::DoGetBestClientSize() const -{ - return wxSize(m_maxWidth, m_maxHeight); -} - -// receives button commands -void wxButtonToolBar::OnCommand(wxCommandEvent& event) -{ - wxButtonToolBarTool* tool = (wxButtonToolBarTool*) FindById(event.GetId()); - if (!tool) - { - event.Skip(); - return; - } - - if (tool->CanBeToggled()) - tool->Toggle(tool->IsToggled()); - - // TODO: handle toggle items - OnLeftClick(event.GetId(), false); - - if (tool->GetKind() == wxITEM_RADIO) - UnToggleRadioGroup(tool); - - if (tool->CanBeToggled()) - Refresh(); -} - -// paints a border -void wxButtonToolBar::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - - dc.SetFont(GetFont()); - dc.SetBackgroundMode(wxTRANSPARENT); - - for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - node; - node = node->GetNext() ) - { - wxButtonToolBarTool *tool = (wxButtonToolBarTool*) node->GetData(); - wxRect rectTool = GetToolRect(tool); - if (tool->IsToggled()) - { - wxRect backgroundRect = rectTool; - backgroundRect.y = -1; backgroundRect.height = GetClientSize().y + 1; - wxBrush brush(wxColour(219, 219, 219)); - wxPen pen(wxColour(159, 159, 159)); - dc.SetBrush(brush); - dc.SetPen(pen); - dc.DrawRectangle(backgroundRect); - } - - if (m_labelHeight > 0 && !tool->GetShortHelp().empty()) - { - int tw, th; - dc.GetTextExtent(tool->GetShortHelp(), & tw, & th); - - int x = tool->m_x; - dc.DrawText(tool->GetShortHelp(), x, tool->m_y + tool->GetButton()->GetSize().y + m_labelMargin); - } - } - - if ((GetWindowStyle() & wxTB_NODIVIDER) == 0) - { - wxPen pen(wxColour(159, 159, 159)); - dc.SetPen(pen); - int x1 = 0; - int y1 = GetClientSize().y-1; - int x2 = GetClientSize().x; - int y2 = y1; - dc.DrawLine(x1, y1, x2, y2); - } -} - -// detects mouse clicks outside buttons -void wxButtonToolBar::OnLeftUp(wxMouseEvent& event) -{ - if (m_labelHeight > 0) - { - wxButtonToolBarTool* tool = (wxButtonToolBarTool*) FindToolForPosition(event.GetX(), event.GetY()); - if (tool && tool->GetButton() && (event.GetY() > (tool->m_y + tool->GetButton()->GetSize().y))) - { - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, tool->GetId()); - event.SetEventObject(tool->GetButton()); - if (!ProcessEvent(event)) - event.Skip(); - } - } -} - -#endif // wxUSE_TOOLBAR && wxUSE_BMPBUTTON diff --git a/Source/3rdParty/wx/src/generic/choicbkg.cpp b/Source/3rdParty/wx/src/generic/choicbkg.cpp deleted file mode 100644 index a5df5f1e4..000000000 --- a/Source/3rdParty/wx/src/generic/choicbkg.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/choicbkg.cpp -// Purpose: generic implementation of wxChoicebook -// Author: Vadim Zeitlin -// Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp -// Created: 15.09.04 -// RCS-ID: $Id: choicbkg.cpp 58355 2009-01-24 14:12:59Z VZ $ -// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHOICEBOOK - -#include "wx/choicebk.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/choice.h" - #include "wx/sizer.h" -#endif - -#include "wx/imaglist.h" - -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent) - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES -const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType(); -const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType(); -#endif - -BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) - EVT_CHOICE(wxID_ANY, wxChoicebook::OnChoiceSelected) -END_EVENT_TABLE() - -// ============================================================================ -// wxChoicebook implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxChoicebook creation -// ---------------------------------------------------------------------------- - -void wxChoicebook::Init() -{ - m_selection = wxNOT_FOUND; -} - -bool -wxChoicebook::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) - { - style |= wxBK_TOP; - } - - // no border for this control, it doesn't look nice together with - // wxChoice border - style &= ~wxBORDER_MASK; - style |= wxBORDER_NONE; - - if ( !wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - return false; - - m_bookctrl = new wxChoice - ( - this, - wxID_ANY, - wxDefaultPosition, - wxDefaultSize - ); - - wxSizer* mainSizer = new wxBoxSizer(IsVertical() ? wxVERTICAL : wxHORIZONTAL); - - if (style & wxBK_RIGHT || style & wxBK_BOTTOM) - mainSizer->Add(0, 0, 1, wxEXPAND, 0); - - m_controlSizer = new wxBoxSizer(IsVertical() ? wxHORIZONTAL : wxVERTICAL); - m_controlSizer->Add(m_bookctrl, 1, (IsVertical() ? wxALIGN_CENTRE_VERTICAL : wxALIGN_CENTRE) |wxGROW, 0); - mainSizer->Add(m_controlSizer, 0, (IsVertical() ? (int) wxGROW : (int) wxALIGN_CENTRE_VERTICAL)|wxALL, m_controlMargin); - SetSizer(mainSizer); - return true; -} - -// ---------------------------------------------------------------------------- -// wxChoicebook geometry management -// ---------------------------------------------------------------------------- - -wxSize wxChoicebook::GetControllerSize() const -{ - const wxSize sizeClient = GetClientSize(), - sizeChoice = m_controlSizer->CalcMin(); - - wxSize size; - if ( IsVertical() ) - { - size.x = sizeClient.x; - size.y = sizeChoice.y; - } - else // left/right aligned - { - size.x = sizeChoice.x; - size.y = sizeClient.y; - } - - return size; -} - -wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const -{ - // we need to add the size of the choice control and the border between - const wxSize sizeChoice = GetControllerSize(); - - wxSize size = sizePage; - if ( IsVertical() ) - { - if ( sizeChoice.x > sizePage.x ) - size.x = sizeChoice.x; - size.y += sizeChoice.y + GetInternalBorder(); - } - else // left/right aligned - { - size.x += sizeChoice.x + GetInternalBorder(); - if ( sizeChoice.y > sizePage.y ) - size.y = sizeChoice.y; - } - - return size; -} - - -// ---------------------------------------------------------------------------- -// accessing the pages -// ---------------------------------------------------------------------------- - -bool wxChoicebook::SetPageText(size_t n, const wxString& strText) -{ - GetChoiceCtrl()->SetString(n, strText); - - return true; -} - -wxString wxChoicebook::GetPageText(size_t n) const -{ - return GetChoiceCtrl()->GetString(n); -} - -int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const -{ - wxFAIL_MSG( _T("wxChoicebook::GetPageImage() not implemented") ); - - return wxNOT_FOUND; -} - -bool wxChoicebook::SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) -{ - wxFAIL_MSG( _T("wxChoicebook::SetPageImage() not implemented") ); - - return false; -} - -// ---------------------------------------------------------------------------- -// image list stuff -// ---------------------------------------------------------------------------- - -void wxChoicebook::SetImageList(wxImageList *imageList) -{ - // TODO: can be implemented in form of static bitmap near choice control - - wxBookCtrlBase::SetImageList(imageList); -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -int wxChoicebook::GetSelection() const -{ - return m_selection; -} - -wxBookCtrlBaseEvent* wxChoicebook::CreatePageChangingEvent() const -{ - return new wxChoicebookEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); -} - -void wxChoicebook::MakeChangedEvent(wxBookCtrlBaseEvent &event) -{ - event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); -} - -// ---------------------------------------------------------------------------- -// adding/removing the pages -// ---------------------------------------------------------------------------- - -bool -wxChoicebook::InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) - return false; - - GetChoiceCtrl()->Insert(text, n); - - // if the inserted page is before the selected one, we must update the - // index of the selected page - if ( int(n) <= m_selection ) - { - // one extra page added - m_selection++; - GetChoiceCtrl()->Select(m_selection); - } - - // some page should be selected: either this one or the first one if there - // is still no selection - int selNew = wxNOT_FOUND; - if ( bSelect ) - selNew = n; - else if ( m_selection == wxNOT_FOUND ) - selNew = 0; - - if ( selNew != m_selection ) - page->Hide(); - - if ( selNew != wxNOT_FOUND ) - SetSelection(selNew); - - return true; -} - -wxWindow *wxChoicebook::DoRemovePage(size_t page) -{ - const size_t page_count = GetPageCount(); - wxWindow *win = wxBookCtrlBase::DoRemovePage(page); - - if ( win ) - { - GetChoiceCtrl()->Delete(page); - - if (m_selection >= (int)page) - { - // force new sel valid if possible - int sel = m_selection - 1; - if (page_count == 1) - sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == -1)) - sel = 0; - - // force sel invalid if deleting current page - don't try to hide it - m_selection = (m_selection == (int)page) ? wxNOT_FOUND : m_selection - 1; - - if ((sel != wxNOT_FOUND) && (sel != m_selection)) - SetSelection(sel); - } - } - - return win; -} - - -bool wxChoicebook::DeleteAllPages() -{ - m_selection = wxNOT_FOUND; - GetChoiceCtrl()->Clear(); - return wxBookCtrlBase::DeleteAllPages(); -} - -// ---------------------------------------------------------------------------- -// wxChoicebook events -// ---------------------------------------------------------------------------- - -void wxChoicebook::OnChoiceSelected(wxCommandEvent& eventChoice) -{ - if ( eventChoice.GetEventObject() != m_bookctrl ) - { - eventChoice.Skip(); - return; - } - - const int selNew = eventChoice.GetSelection(); - - if ( selNew == m_selection ) - { - // this event can only come from our own Select(m_selection) below - // which we call when the page change is vetoed, so we should simply - // ignore it - return; - } - - SetSelection(selNew); - - // change wasn't allowed, return to previous state - if (m_selection != selNew) - GetChoiceCtrl()->Select(m_selection); -} - -#endif // wxUSE_CHOICEBOOK diff --git a/Source/3rdParty/wx/src/generic/choicdgg.cpp b/Source/3rdParty/wx/src/generic/choicdgg.cpp deleted file mode 100644 index 1caf90aa3..000000000 --- a/Source/3rdParty/wx/src/generic/choicdgg.cpp +++ /dev/null @@ -1,556 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/choicdgg.cpp -// Purpose: Choice dialogs -// Author: Julian Smart -// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions -// Created: 04/01/98 -// RCS-ID: $Id: choicdgg.cpp 44620 2007-03-06 09:56:43Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHOICEDLG - -#ifndef WX_PRECOMP - #include - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/button.h" - #include "wx/listbox.h" - #include "wx/checklst.h" - #include "wx/stattext.h" - #include "wx/intl.h" - #include "wx/sizer.h" - #include "wx/arrstr.h" -#endif - -#include "wx/statline.h" -#include "wx/settings.h" -#include "wx/generic/choicdgg.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#define wxID_LISTBOX 3000 - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// convert wxArrayString into a wxString[] which must be delete[]d by caller -static int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices); - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// helpers -// ---------------------------------------------------------------------------- - -int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices) -{ - int n = aChoices.GetCount(); - *choices = new wxString[n]; - - for ( int i = 0; i < n; i++ ) - { - (*choices)[i] = aChoices[i]; - } - - return n; -} - -// ---------------------------------------------------------------------------- -// wrapper functions -// ---------------------------------------------------------------------------- - -wxString wxGetSingleChoice( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), - bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) -{ - wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - wxString choice; - if ( dialog.ShowModal() == wxID_OK ) - choice = dialog.GetStringSelection(); - - return choice; -} - -wxString wxGetSingleChoice( const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - wxString res = wxGetSingleChoice(message, caption, n, choices, parent, - x, y, centre, width, height); - delete [] choices; - - return res; -} - -int wxGetSingleChoiceIndex( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), - bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) -{ - wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - int choice; - if ( dialog.ShowModal() == wxID_OK ) - choice = dialog.GetSelection(); - else - choice = -1; - - return choice; -} - -int wxGetSingleChoiceIndex( const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - int res = wxGetSingleChoiceIndex(message, caption, n, choices, parent, - x, y, centre, width, height); - delete [] choices; - - return res; -} - -void *wxGetSingleChoiceData( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - void **client_data, - wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), - bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) -{ - wxSingleChoiceDialog dialog(parent, message, caption, n, choices, - (char **)client_data); - void *data; - if ( dialog.ShowModal() == wxID_OK ) - data = dialog.GetSelectionClientData(); - else - data = NULL; - - return data; -} - -void *wxGetSingleChoiceData( const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - void **client_data, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - void *res = wxGetSingleChoiceData(message, caption, n, choices, - client_data, parent, - x, y, centre, width, height); - delete [] choices; - - return res; -} - -size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), - bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height)) -{ - wxMultiChoiceDialog dialog(parent, message, caption, n, choices); - - // call this even if selections array is empty and this then (correctly) - // deselects the first item which is selected by default - dialog.SetSelections(selections); - - if ( dialog.ShowModal() == wxID_OK ) - selections = dialog.GetSelections(); - else - selections.Empty(); - - return selections.GetCount(); -} - -size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - size_t res = wxGetMultipleChoices(selections, message, caption, - n, choices, parent, - x, y, centre, width, height); - delete [] choices; - - return res; -} - -// ---------------------------------------------------------------------------- -// wxAnyChoiceDialog -// ---------------------------------------------------------------------------- - -bool wxAnyChoiceDialog::Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - long styleDlg, - const wxPoint& pos, - long styleLbox) -{ -#ifdef __WXMAC__ - // FIXME: why?? - if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) ) - return false; -#else - if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) - return false; -#endif - - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - - // 1) text message - topsizer-> - Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder()); - - // 2) list box - m_listbox = CreateList(n, choices, styleLbox); - - if ( n > 0 ) - m_listbox->SetSelection(0); - - topsizer-> - Add(m_listbox, wxSizerFlags().Expand().Proportion(1).TripleBorder(wxLEFT | wxRIGHT)); - - // 3) buttons if any - wxSizer * - buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags); - if ( buttonSizer ) - { - topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); - } - - SetSizer( topsizer ); - - topsizer->SetSizeHints( this ); - topsizer->Fit( this ); - - if ( styleDlg & wxCENTRE ) - Centre(wxBOTH); - - m_listbox->SetFocus(); - - return true; -} - -bool wxAnyChoiceDialog::Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long styleDlg, - const wxPoint& pos, - long styleLbox) -{ - wxCArrayString chs(choices); - return Create(parent, message, caption, chs.GetCount(), chs.GetStrings(), - styleDlg, pos, styleLbox); -} - -wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) -{ - wxSize size = wxDefaultSize; - if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) - size = wxSize(300, 200); - return new wxListBox( this, wxID_LISTBOX, - wxDefaultPosition, size, - n, choices, - styleLbox ); -} - -// ---------------------------------------------------------------------------- -// wxSingleChoiceDialog -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) -#ifndef __SMARTPHONE__ - EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) -#endif -#ifdef __WXWINCE__ - EVT_JOY_BUTTON_DOWN(wxSingleChoiceDialog::OnJoystickButtonDown) -#endif -END_EVENT_TABLE() - -IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog) - -wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData, - long style, - const wxPoint& WXUNUSED(pos)) -{ - Create(parent, message, caption, n, choices, clientData, style); -} - -wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData, - long style, - const wxPoint& WXUNUSED(pos)) -{ - Create(parent, message, caption, choices, clientData, style); -} - -bool wxSingleChoiceDialog::Create( wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData, - long style, - const wxPoint& pos ) -{ - if ( !wxAnyChoiceDialog::Create(parent, message, caption, - n, choices, - style, pos) ) - return false; - - m_selection = n > 0 ? 0 : -1; - - if (clientData) - { - for (int i = 0; i < n; i++) - m_listbox->SetClientData(i, clientData[i]); - } - - return true; -} - -bool wxSingleChoiceDialog::Create( wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData, - long style, - const wxPoint& pos ) -{ - wxCArrayString chs(choices); - return Create( parent, message, caption, chs.GetCount(), chs.GetStrings(), - clientData, style, pos ); -} - -// Set the selection -void wxSingleChoiceDialog::SetSelection(int sel) -{ - m_listbox->SetSelection(sel); - m_selection = sel; -} - -void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) -{ - DoChoice(); -} - -#ifndef __SMARTPHONE__ -void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) -{ - DoChoice(); -} -#endif - -#ifdef __WXWINCE__ -void wxSingleChoiceDialog::OnJoystickButtonDown(wxJoystickEvent& WXUNUSED(event)) -{ - DoChoice(); -} -#endif - -void wxSingleChoiceDialog::DoChoice() -{ - m_selection = m_listbox->GetSelection(); - m_stringSelection = m_listbox->GetStringSelection(); - - if ( m_listbox->HasClientUntypedData() ) - SetClientData(m_listbox->GetClientData(m_selection)); - - EndModal(wxID_OK); -} - -// ---------------------------------------------------------------------------- -// wxMultiChoiceDialog -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog) - -bool wxMultiChoiceDialog::Create( wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - long style, - const wxPoint& pos ) -{ - long styleLbox; -#if wxUSE_CHECKLISTBOX - styleLbox = wxLB_ALWAYS_SB; -#else - styleLbox = wxLB_ALWAYS_SB | wxLB_EXTENDED; -#endif - - if ( !wxAnyChoiceDialog::Create(parent, message, caption, - n, choices, - style, pos, - styleLbox) ) - return false; - - return true; -} - -bool wxMultiChoiceDialog::Create( wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long style, - const wxPoint& pos ) -{ - wxCArrayString chs(choices); - return Create( parent, message, caption, chs.GetCount(), - chs.GetStrings(), style, pos ); -} - -void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) -{ -#if wxUSE_CHECKLISTBOX - wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox); - if (checkListBox) - { - // first clear all currently selected items - size_t n, - count = checkListBox->GetCount(); - for ( n = 0; n < count; ++n ) - { - if (checkListBox->IsChecked(n)) - checkListBox->Check(n, false); - } - - // now select the ones which should be selected - count = selections.GetCount(); - for ( n = 0; n < count; n++ ) - { - checkListBox->Check(selections[n]); - } - - return; - } -#endif - - // first clear all currently selected items - size_t n, - count = m_listbox->GetCount(); - for ( n = 0; n < count; ++n ) - { - m_listbox->Deselect(n); - } - - // now select the ones which should be selected - count = selections.GetCount(); - for ( n = 0; n < count; n++ ) - { - m_listbox->Select(selections[n]); - } -} - -bool wxMultiChoiceDialog::TransferDataFromWindow() -{ - m_selections.Empty(); - -#if wxUSE_CHECKLISTBOX - wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox); - if (checkListBox) - { - size_t count = checkListBox->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( checkListBox->IsChecked(n) ) - m_selections.Add(n); - } - return true; - } -#endif - - size_t count = m_listbox->GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if ( m_listbox->IsSelected(n) ) - m_selections.Add(n); - } - - return true; -} - -#if wxUSE_CHECKLISTBOX - -wxListBoxBase *wxMultiChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) -{ - wxSize size = wxDefaultSize; - if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) - size = wxSize(300, 200); - - return new wxCheckListBox( this, wxID_LISTBOX, - wxDefaultPosition, size, - n, choices, - styleLbox ); -} - -#endif // wxUSE_CHECKLISTBOX - -#endif // wxUSE_CHOICEDLG diff --git a/Source/3rdParty/wx/src/generic/clrpickerg.cpp b/Source/3rdParty/wx/src/generic/clrpickerg.cpp deleted file mode 100644 index a02d2accd..000000000 --- a/Source/3rdParty/wx/src/generic/clrpickerg.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/clrpickerg.cpp -// Purpose: wxGenericColourButton class implementation -// Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: clrpickerg.cpp 58967 2009-02-17 13:31:28Z SC $ -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COLOURPICKERCTRL - -#include "wx/clrpicker.h" - -#include "wx/colordlg.h" - - -// ============================================================================ -// implementation -// ============================================================================ - -wxColourData wxGenericColourButton::ms_data; -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxCLRBTN_BASE_CLASS) - -// ---------------------------------------------------------------------------- -// wxGenericColourButton -// ---------------------------------------------------------------------------- - -bool wxGenericColourButton::Create( wxWindow *parent, wxWindowID id, - const wxColour &col, const wxPoint &pos, - const wxSize &size, long style, - const wxValidator& validator, const wxString &name) -{ - // create this button -#if wxCLRBTN_USES_BMP_BUTTON - wxBitmap empty(1,1); - if (!wxBitmapButton::Create( parent, id, empty, pos, - size, style, validator, name )) -#else - if (!wxButton::Create( parent, id, wxEmptyString, pos, - size, style, validator, name )) -#endif - { - wxFAIL_MSG( wxT("wxGenericColourButton creation failed") ); - return false; - } - - // and handle user clicks on it - Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(wxGenericColourButton::OnButtonClick), - NULL, this); - - m_colour = col; - UpdateColour(); - InitColourData(); - - return true; -} - -void wxGenericColourButton::InitColourData() -{ - ms_data.SetChooseFull(true); - unsigned char grey = 0; - for (int i = 0; i < 16; i++, grey += 16) - { - // fill with grey tones the custom colors palette - wxColour colour(grey, grey, grey); - ms_data.SetCustomColour(i, colour); - } -} - -void wxGenericColourButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) -{ - // update the wxColouData to be shown in the the dialog - ms_data.SetColour(m_colour); - - // create the colour dialog and display it - wxColourDialog dlg(this, &ms_data); - if (dlg.ShowModal() == wxID_OK) - { - ms_data = dlg.GetColourData(); - SetColour(ms_data.GetColour()); - - // fire an event - wxColourPickerEvent event(this, GetId(), m_colour); - GetEventHandler()->ProcessEvent(event); - } -} - -void wxGenericColourButton::UpdateColour() -{ - if ( !m_colour.Ok() ) - { -#if wxCLRBTN_USES_BMP_BUTTON - wxBitmap empty(1,1); - SetBitmapLabel(empty); -#else - if ( HasFlag(wxCLRP_SHOW_LABEL) ) - SetLabel(wxEmptyString); -#endif - return; - } - - // some combinations of the fg/bg colours may be unreadable, so we invert - // the colour to make sure fg colour is different enough from m_colour - wxColour colFg(~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue()); - -#if wxCLRBTN_USES_BMP_BUTTON - wxSize sz = GetSize(); - sz.x -= 2*GetMarginX(); - sz.y -= 2*GetMarginY(); - - wxPoint topleft; - - if ( sz.x < 1 ) - sz.x = 1; - else - if ( sz.y < 1 ) - sz.y = 1; - - wxBitmap bmp(sz.x, sz.y); - { - wxMemoryDC memdc(bmp); - memdc.SetPen(colFg); - memdc.SetBrush(m_colour); - memdc.DrawRectangle(topleft,sz); - if ( HasFlag(wxCLRP_SHOW_LABEL) ) - { - int x, y, leading, desc; - wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX); - memdc.GetTextExtent(label,&x,&y,&desc,&leading); - if ( x <= sz.x && y <= sz.y ) - { - topleft.x += (sz.x-x)/2; - topleft.y += (sz.y-y)/2; - memdc.SetTextForeground(colFg); - memdc.DrawText(label,topleft); - } - } - } - SetBitmapLabel(bmp); -#else - SetForegroundColour(colFg); - SetBackgroundColour(m_colour); - - if ( HasFlag(wxCLRP_SHOW_LABEL) ) - SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX)); -#endif -} - -wxSize wxGenericColourButton::DoGetBestSize() const -{ - wxSize sz(wxButton::DoGetBestSize()); - if ( HasFlag(wxCLRP_SHOW_LABEL) ) - { -#if wxCLRBTN_USES_BMP_BUTTON - int x, y, leading, desc; - wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX); - wxClientDC dc(const_cast(this)); - dc.GetTextExtent(label,&x,&y,&desc,&leading); - sz.x = sz.y+x; -#endif - return sz; - } - - // if we have no label, then make this button a square - // (like e.g. native GTK version of this control) - sz.SetWidth(sz.GetHeight()); - return sz; -} - -#endif // wxUSE_COLOURPICKERCTRL diff --git a/Source/3rdParty/wx/src/generic/collpaneg.cpp b/Source/3rdParty/wx/src/generic/collpaneg.cpp deleted file mode 100644 index 7f8848f4b..000000000 --- a/Source/3rdParty/wx/src/generic/collpaneg.cpp +++ /dev/null @@ -1,307 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/collpaneg.cpp -// Purpose: wxGenericCollapsiblePane -// Author: Francesco Montorsi -// Modified By: -// Created: 8/10/2006 -// Id: $Id: collpaneg.cpp 43371 2006-11-12 21:38:49Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" -#include "wx/defs.h" - -#if wxUSE_COLLPANE && wxUSE_BUTTON && wxUSE_STATLINE - -#include "wx/collpane.h" - -#ifndef WX_PRECOMP - #include "wx/toplevel.h" - #include "wx/button.h" - #include "wx/sizer.h" - #include "wx/panel.h" -#endif // !WX_PRECOMP - -#include "wx/statline.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// ============================================================================ -// implementation -// ============================================================================ - -const wxChar wxCollapsiblePaneNameStr[] = wxT("collapsiblePane"); - -//----------------------------------------------------------------------------- -// wxGenericCollapsiblePane -//----------------------------------------------------------------------------- - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLLPANE_CHANGED) -IMPLEMENT_DYNAMIC_CLASS(wxGenericCollapsiblePane, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent) - -BEGIN_EVENT_TABLE(wxGenericCollapsiblePane, wxControl) - EVT_BUTTON(wxID_ANY, wxGenericCollapsiblePane::OnButton) - EVT_SIZE(wxGenericCollapsiblePane::OnSize) -END_EVENT_TABLE() - - -bool wxGenericCollapsiblePane::Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& val, - const wxString& name) -{ - if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) - return false; - - m_strLabel = label; - - // create children and lay them out using a wxBoxSizer - // (so that we automatically get RTL features) - m_pButton = new wxButton(this, wxID_ANY, GetBtnLabel(), wxPoint(0, 0), - wxDefaultSize, wxBU_EXACTFIT); - m_pStaticLine = new wxStaticLine(this, wxID_ANY); -#ifdef __WXMAC__ - // on Mac we put the static libe above the button - m_sz = new wxBoxSizer(wxVERTICAL); - m_sz->Add(m_pStaticLine, 0, wxALL|wxGROW, GetBorder()); - m_sz->Add(m_pButton, 0, wxLEFT|wxRIGHT|wxBOTTOM, GetBorder()); -#else - // on other platforms we put the static line and the button horizontally - m_sz = new wxBoxSizer(wxHORIZONTAL); - m_sz->Add(m_pButton, 0, wxLEFT|wxTOP|wxBOTTOM, GetBorder()); - m_sz->Add(m_pStaticLine, 1, wxALIGN_CENTER|wxLEFT|wxRIGHT, GetBorder()); -#endif - - // FIXME: at least under wxCE and wxGTK1 the background is black if we don't do - // this, no idea why... -#if defined(__WXWINCE__) || (defined(__WXGTK__) && !defined(__WXGTK20__)) - SetBackgroundColour(parent->GetBackgroundColour()); -#endif - - // do not set sz as our sizers since we handle the pane window without using sizers - m_pPane = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxTAB_TRAVERSAL|wxNO_BORDER); - - // start as collapsed: - m_pPane->Hide(); - - return true; -} - -wxGenericCollapsiblePane::~wxGenericCollapsiblePane() -{ - if (m_pButton && m_pStaticLine && m_sz) - { - m_pButton->SetContainingSizer(NULL); - m_pStaticLine->SetContainingSizer(NULL); - - // our sizer is not deleted automatically since we didn't use SetSizer()! - wxDELETE(m_sz); - } -} - -wxSize wxGenericCollapsiblePane::DoGetBestSize() const -{ - // NB: do not use GetSize() but rather GetMinSize() - wxSize sz = m_sz->GetMinSize(); - - // when expanded, we need more vertical space - if ( IsExpanded() ) - { - sz.SetWidth(wxMax( sz.GetWidth(), m_pPane->GetBestSize().x )); - sz.SetHeight(sz.y + GetBorder() + m_pPane->GetBestSize().y); - } - - return sz; -} - -wxString wxGenericCollapsiblePane::GetBtnLabel() const -{ - return m_strLabel + (IsCollapsed() ? wxT(" >>") : wxT(" <<")); -} - -void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) -{ - // minimal size has priority over the best size so set here our min size - SetMinSize(sz); - SetSize(sz); - - if (this->HasFlag(wxCP_NO_TLW_RESIZE)) - { - // the user asked to explicitely handle the resizing itself... - return; - } - - - // - // NB: the following block of code has been accurately designed to - // as much flicker-free as possible; be careful when modifying it! - // - - wxTopLevelWindow * - top = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( top ) - { - // NB: don't Layout() the 'top' window as its size has not been correctly - // updated yet and we don't want to do an initial Layout() with the old - // size immediately followed by a SetClientSize/Fit call for the new - // size; that would provoke flickering! - - if (top->GetSizer()) -#ifdef __WXGTK__ - // FIXME: the SetSizeHints() call would be required also for GTK+ for - // the expanded->collapsed transition. Unfortunately if we - // enable this line, then the GTK+ top window won't always be - // resized by the SetClientSize() call below! As a side effect - // of this dirty fix, the minimal size for the pane window is - // not set in GTK+ and the user can hide it shrinking the "top" - // window... - if (IsCollapsed()) -#endif - top->GetSizer()->SetSizeHints(top); - - - // we shouldn't attempt to resize a maximized window, whatever happens - if ( !top->IsMaximized() ) - { - if ( IsCollapsed() ) - { - // expanded -> collapsed transition - if (top->GetSizer()) - { - // we have just set the size hints... - wxSize sz = top->GetSizer()->CalcMin(); - - // use SetClientSize() and not SetSize() otherwise the size for - // e.g. a wxFrame with a menubar wouldn't be correctly set - top->SetClientSize(sz); - } - else - top->Layout(); - } - else - { - // collapsed -> expanded transition - - // force our parent to "fit", i.e. expand so that it can honour - // our minimal size - top->Fit(); - } - } - } -} - -void wxGenericCollapsiblePane::Collapse(bool collapse) -{ - // optimization - if ( IsCollapsed() == collapse ) - return; - - // update our state - m_pPane->Show(!collapse); - - // update button label - // NB: this must be done after updating our "state" - m_pButton->SetLabel(GetBtnLabel()); - - OnStateChange(GetBestSize()); -} - -void wxGenericCollapsiblePane::SetLabel(const wxString &label) -{ - m_strLabel = label; - m_pButton->SetLabel(GetBtnLabel()); - m_pButton->SetInitialSize(); - - Layout(); -} - -bool wxGenericCollapsiblePane::Layout() -{ - if (!m_pButton || !m_pStaticLine || !m_pPane || !m_sz) - return false; // we need to complete the creation first! - - wxSize oursz(GetSize()); - - // move & resize the button and the static line - m_sz->SetDimension(0, 0, oursz.GetWidth(), m_sz->GetMinSize().GetHeight()); - m_sz->Layout(); - - if ( IsExpanded() ) - { - // move & resize the container window - int yoffset = m_sz->GetSize().GetHeight() + GetBorder(); - m_pPane->SetSize(0, yoffset, - oursz.x, oursz.y - yoffset); - - // this is very important to make the pane window layout show correctly - m_pPane->Layout(); - } - - return true; -} - -int wxGenericCollapsiblePane::GetBorder() const -{ -#if defined( __WXMAC__ ) - return 6; -#elif defined(__WXGTK20__) - return 3; -#elif defined(__WXMSW__) - wxASSERT(m_pButton); - return m_pButton->ConvertDialogToPixels(wxSize(2, 0)).x; -#else - return 5; -#endif -} - - - -//----------------------------------------------------------------------------- -// wxGenericCollapsiblePane - event handlers -//----------------------------------------------------------------------------- - -void wxGenericCollapsiblePane::OnButton(wxCommandEvent& event) -{ - if ( event.GetEventObject() != m_pButton ) - { - event.Skip(); - return; - } - - Collapse(!IsCollapsed()); - - // this change was generated by the user - send the event - wxCollapsiblePaneEvent ev(this, GetId(), IsCollapsed()); - GetEventHandler()->ProcessEvent(ev); -} - -void wxGenericCollapsiblePane::OnSize(wxSizeEvent& WXUNUSED(event)) -{ -#if 0 // for debug only - wxClientDC dc(this); - dc.SetPen(*wxBLACK_PEN); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRectangle(wxPoint(0,0), GetSize()); - dc.SetPen(*wxRED_PEN); - dc.DrawRectangle(wxPoint(0,0), GetBestSize()); -#endif - - Layout(); -} - -#endif // wxUSE_COLLPANE && wxUSE_BUTTON && wxUSE_STATLINE diff --git a/Source/3rdParty/wx/src/generic/combog.cpp b/Source/3rdParty/wx/src/generic/combog.cpp deleted file mode 100644 index 798170e91..000000000 --- a/Source/3rdParty/wx/src/generic/combog.cpp +++ /dev/null @@ -1,489 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/combog.cpp -// Purpose: Generic wxComboCtrl -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combog.cpp 67178 2011-03-13 09:32:19Z JMS $ -// Copyright: (c) 2005 Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COMBOCTRL - -#include "wx/combo.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/combobox.h" - #include "wx/dcclient.h" - #include "wx/settings.h" -#endif - -#include "wx/dcbuffer.h" - -// ---------------------------------------------------------------------------- -// Some constant adjustments to make the generic more bearable - -#if defined(__WXUNIVERSAL__) - -#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent -#define TEXTCTRLYADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted -#define DEFAULT_DROPBUTTON_WIDTH 19 - -#elif defined(__WXMSW__) - -#define TEXTCTRLXADJUST 2 // position adjustment for wxTextCtrl, with zero indent -#define TEXTCTRLYADJUST 3 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted -#define DEFAULT_DROPBUTTON_WIDTH 17 - -#elif defined(__WXGTK__) - -#define TEXTCTRLXADJUST -1 // position adjustment for wxTextCtrl, with zero indent -#define TEXTCTRLYADJUST 0 -#define TEXTXADJUST 1 // how much is read-only text's x adjusted -#define DEFAULT_DROPBUTTON_WIDTH 23 - -#elif defined(__WXMAC__) - -#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent -#define TEXTCTRLYADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted -#define DEFAULT_DROPBUTTON_WIDTH 22 - -#else - -#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent -#define TEXTCTRLYADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted -#define DEFAULT_DROPBUTTON_WIDTH 19 - -#endif - - -// ============================================================================ -// implementation -// ============================================================================ - -// Only implement if no native or it wasn't fully featured -#ifndef wxCOMBOCONTROL_FULLY_FEATURED - - -// ---------------------------------------------------------------------------- -// wxGenericComboCtrl -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxGenericComboCtrl, wxComboCtrlBase) - EVT_PAINT(wxGenericComboCtrl::OnPaintEvent) - EVT_MOUSE_EVENTS(wxGenericComboCtrl::OnMouseEvent) -END_EVENT_TABLE() - - -IMPLEMENT_DYNAMIC_CLASS(wxGenericComboCtrl, wxComboCtrlBase) - -void wxGenericComboCtrl::Init() -{ -} - -bool wxGenericComboCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - // - // Note that technically we only support 'default' border and wxNO_BORDER. - long border = style & wxBORDER_MASK; - int tcBorder = wxNO_BORDER; - -#if defined(__WXUNIVERSAL__) - if ( !border ) - border = wxBORDER_SIMPLE; -#elif defined(__WXMSW__) - if ( !border ) - // For XP, have 1-width custom border, for older version use sunken - /*if ( wxUxThemeEngine::GetIfActive() ) - { - border = wxBORDER_NONE; - m_widthCustomBorder = 1; - } - else*/ - border = wxBORDER_SUNKEN; -#else - - // - // Generic version is optimized for wxGTK - // - - #define UNRELIABLE_TEXTCTRL_BORDER - - if ( !border ) - { - if ( style & wxCB_READONLY ) - { - m_widthCustomBorder = 1; - } - else - { - m_widthCustomBorder = 0; - tcBorder = 0; - } - } - else - { - // Have textctrl instead use the border given. - tcBorder = border; - } - - // Because we are going to have button outside the border, - // let's use wxBORDER_NONE for the whole control. - border = wxBORDER_NONE; - - Customize( wxCC_BUTTON_OUTSIDE_BORDER | - wxCC_NO_TEXT_AUTO_SELECT ); - -#endif - - style = (style & ~(wxBORDER_MASK)) | border; - if ( style & wxCC_STD_BUTTON ) - m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; - - // create main window - if ( !wxComboCtrlBase::Create(parent, - id, - value, - pos, - size, - style | wxFULL_REPAINT_ON_RESIZE, - wxDefaultValidator, - name) ) - return false; - - // Create textctrl, if necessary - CreateTextCtrl( tcBorder, validator ); - - // Add keyboard input handlers for main control and textctrl - InstallInputHandlers(); - - // Set background - SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering - - // SetInitialSize should be called last - SetInitialSize(size); - - return true; -} - -wxGenericComboCtrl::~wxGenericComboCtrl() -{ -} - -void wxGenericComboCtrl::OnResize() -{ - - // Recalculates button and textctrl areas - CalculateAreas(DEFAULT_DROPBUTTON_WIDTH); - -#if 0 - // Move separate button control, if any, to correct position - if ( m_btn ) - { - wxSize sz = GetClientSize(); - m_btn->SetSize( m_btnArea.x + m_btnSpacingX, - (sz.y-m_btnSize.y)/2, - m_btnSize.x, - m_btnSize.y ); - } -#endif - - // Move textctrl, if any, accordingly - PositionTextCtrl( TEXTCTRLXADJUST, TEXTCTRLYADJUST ); -} - -void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) -{ - wxSize sz = GetClientSize(); - wxAutoBufferedPaintDC dc(this); - - const wxRect& rectb = m_btnArea; - wxRect rect = m_tcArea; - - // artificial simple border - if ( m_widthCustomBorder ) - { - int customBorder = m_widthCustomBorder; - - // Set border colour - wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), - customBorder, - wxSOLID ); - dc.SetPen( pen1 ); - - // area around both controls - wxRect rect2(0,0,sz.x,sz.y); - if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) - { - rect2 = m_tcArea; - if ( customBorder == 1 ) - { - rect2.Inflate(1); - } - else - { - #ifdef __WXGTK__ - rect2.x -= 1; - rect2.y -= 1; - #else - rect2.x -= customBorder; - rect2.y -= customBorder; - #endif - rect2.width += 1 + customBorder; - rect2.height += 1 + customBorder; - } - } - - dc.SetBrush( *wxTRANSPARENT_BRUSH ); - dc.DrawRectangle(rect2); - } - -#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange - wxColour winCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#else - wxColour winCol = GetBackgroundColour(); -#endif - dc.SetBrush(winCol); - dc.SetPen(winCol); - - //wxLogDebug(wxT("hei: %i tcy: %i tchei: %i"),GetClientSize().y,m_tcArea.y,m_tcArea.height); - //wxLogDebug(wxT("btnx: %i tcx: %i tcwid: %i"),m_btnArea.x,m_tcArea.x,m_tcArea.width); - - // clear main background - dc.DrawRectangle(rect); - - if ( !m_btn ) - { - #ifdef __WXGTK__ - // Under GTK+ this avoids drawing the button background with wrong - // colour - DrawButton(dc,rectb,0); - #else - // Standard button rendering - DrawButton(dc,rectb); - #endif - } - - // paint required portion on the control - if ( (!m_text || m_widthCustomPaint) ) - { - wxASSERT( m_widthCustomPaint >= 0 ); - - // this is intentionally here to allow drawed rectangle's - // right edge to be hidden - if ( m_text ) - rect.width = m_widthCustomPaint; - - dc.SetFont( GetFont() ); - - dc.SetClippingRegion(rect); - if ( m_popupInterface ) - m_popupInterface->PaintComboControl(dc,rect); - else - wxComboPopup::DefaultPaintComboControl(this,dc,rect); - } -} - -void wxGenericComboCtrl::OnMouseEvent( wxMouseEvent& event ) -{ - int mx = event.m_x; - bool isOnButtonArea = m_btnArea.Contains(mx,event.m_y); - int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0; - - if ( PreprocessMouseEvent(event,handlerFlags) ) - return; - - const bool ctrlIsButton = wxPlatformIs(wxOS_WINDOWS); - - if ( ctrlIsButton && - (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) - { - // if no textctrl and no special double-click, then the entire control acts - // as a button - handlerFlags |= wxCC_MF_ON_BUTTON; - if ( HandleButtonMouseEvent(event,handlerFlags) ) - return; - } - else - { - if ( isOnButtonArea || HasCapture() || - (m_widthCustomPaint && mx < (m_tcArea.x+m_widthCustomPaint)) ) - { - handlerFlags |= wxCC_MF_ON_CLICK_AREA; - - if ( HandleButtonMouseEvent(event,handlerFlags) ) - return; - } - else if ( m_btnState ) - { - // otherwise need to clear the hover status - m_btnState = 0; - RefreshRect(m_btnArea); - } - } - - // - // This will handle left_down and left_dclick events outside button in a Windows/GTK-like manner. - // See header file for further information on this method. - HandleNormalMouseEvent(event); - -} - -void wxGenericComboCtrl::SetCustomPaintWidth( int width ) -{ -#ifdef UNRELIABLE_TEXTCTRL_BORDER - // - // If starting/stopping to show an image in front - // of a writable text-field, then re-create textctrl - // with different kind of border (because we can't - // assume that textctrl fully supports wxNO_BORDER). - // - wxTextCtrl* tc = GetTextCtrl(); - - if ( tc && (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ) - { - int borderType = tc->GetWindowStyle() & wxBORDER_MASK; - int tcCreateStyle = -1; - - if ( width > 0 ) - { - // Re-create textctrl with no border - if ( borderType != wxNO_BORDER ) - { - m_widthCustomBorder = 1; - tcCreateStyle = wxNO_BORDER; - } - } - else if ( width == 0 ) - { - // Re-create textctrl with normal border - if ( borderType == wxNO_BORDER ) - { - m_widthCustomBorder = 0; - tcCreateStyle = 0; - } - } - - // Common textctrl re-creation code - if ( tcCreateStyle != -1 ) - { - tc->RemoveEventHandler(m_textEvtHandler); - delete m_textEvtHandler; - -#if wxUSE_VALIDATORS - wxValidator* pValidator = tc->GetValidator(); - if ( pValidator ) - { - pValidator = (wxValidator*) pValidator->Clone(); - CreateTextCtrl( tcCreateStyle, *pValidator ); - delete pValidator; - } - else -#endif - { - CreateTextCtrl( tcCreateStyle, wxDefaultValidator ); - } - - InstallInputHandlers(); - } - } -#endif // UNRELIABLE_TEXTCTRL_BORDER - - wxComboCtrlBase::SetCustomPaintWidth( width ); -} - -bool wxGenericComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const -{ - int keycode = event.GetKeyCode(); - bool isPopupShown = IsPopupShown(); - - // This code is AFAIK appropriate for wxGTK. - - if ( isPopupShown ) - { - if ( keycode == WXK_ESCAPE || - ( keycode == WXK_UP && event.AltDown() ) ) - return true; - } - else - { - if ( keycode == WXK_DOWN && event.AltDown() ) - return true; - } - - return false; -} - -#ifdef __WXUNIVERSAL__ - -bool wxGenericComboCtrl::PerformAction(const wxControlAction& action, - long numArg, - const wxString& strArg) -{ - bool processed = false; - if ( action == wxACTION_COMBOBOX_POPUP ) - { - if ( !IsPopupShown() ) - { - ShowPopup(); - - processed = true; - } - } - else if ( action == wxACTION_COMBOBOX_DISMISS ) - { - if ( IsPopupShown() ) - { - HidePopup(); - - processed = true; - } - } - - if ( !processed ) - { - // pass along - return wxControl::PerformAction(action, numArg, strArg); - } - - return true; -} - -#endif // __WXUNIVERSAL__ - -// If native wxComboCtrl was not defined, then prepare a simple -// front-end so that wxRTTI works as expected. -#ifndef _WX_COMBOCONTROL_H_ -IMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxGenericComboCtrl) -#endif - -#endif // !wxCOMBOCONTROL_FULLY_FEATURED - -#endif // wxUSE_COMBOCTRL diff --git a/Source/3rdParty/wx/src/generic/dcpsg.cpp b/Source/3rdParty/wx/src/generic/dcpsg.cpp deleted file mode 100644 index f19e75d66..000000000 --- a/Source/3rdParty/wx/src/generic/dcpsg.cpp +++ /dev/null @@ -1,2262 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/dcpsg.cpp -// Purpose: Generic wxPostScriptDC implementation -// Author: Julian Smart, Robert Roebling, Markus Holzhem -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: dcpsg.cpp 55927 2008-09-28 09:12:16Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT - -#include "wx/generic/dcpsg.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/dcmemory.h" - #include "wx/math.h" - #include "wx/image.h" - #include "wx/icon.h" -#endif // WX_PRECOMP - -#include "wx/prntbase.h" -#include "wx/generic/prntdlgg.h" -#include "wx/paper.h" -#include "wx/filefn.h" -#include "wx/stdpaths.h" - -WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; - -#ifdef __WXMSW__ - -#ifdef DrawText -#undef DrawText -#endif - -#ifdef StartDoc -#undef StartDoc -#endif - -#ifdef GetCharWidth -#undef GetCharWidth -#endif - -#ifdef FindWindow -#undef FindWindow -#endif - -#endif - -//----------------------------------------------------------------------------- -// start and end of document/page -//----------------------------------------------------------------------------- - -static const char *wxPostScriptHeaderConicTo = "\ -/conicto {\n\ - /to_y exch def\n\ - /to_x exch def\n\ - /conic_cntrl_y exch def\n\ - /conic_cntrl_x exch def\n\ - currentpoint\n\ - /p0_y exch def\n\ - /p0_x exch def\n\ - /p1_x p0_x conic_cntrl_x p0_x sub 2 3 div mul add def\n\ - /p1_y p0_y conic_cntrl_y p0_y sub 2 3 div mul add def\n\ - /p2_x p1_x to_x p0_x sub 1 3 div mul add def\n\ - /p2_y p1_y to_y p0_y sub 1 3 div mul add def\n\ - p1_x p1_y p2_x p2_y to_x to_y curveto\n\ -} bind def\n\ -"; - -static const char *wxPostScriptHeaderEllipse = "\ -/ellipsedict 8 dict def\n\ -ellipsedict /mtrx matrix put\n\ -/ellipse {\n\ - ellipsedict begin\n\ - /endangle exch def\n\ - /startangle exch def\n\ - /yrad exch def\n\ - /xrad exch def\n\ - /y exch def\n\ - /x exch def\n\ - /savematrix mtrx currentmatrix def\n\ - x y translate\n\ - xrad yrad scale\n\ - 0 0 1 startangle endangle arc\n\ - savematrix setmatrix\n\ - end\n\ - } def\n\ -"; - -static const char *wxPostScriptHeaderEllipticArc= "\ -/ellipticarcdict 8 dict def\n\ -ellipticarcdict /mtrx matrix put\n\ -/ellipticarc\n\ -{ ellipticarcdict begin\n\ - /do_fill exch def\n\ - /endangle exch def\n\ - /startangle exch def\n\ - /yrad exch def\n\ - /xrad exch def \n\ - /y exch def\n\ - /x exch def\n\ - /savematrix mtrx currentmatrix def\n\ - x y translate\n\ - xrad yrad scale\n\ - do_fill { 0 0 moveto } if\n\ - 0 0 1 startangle endangle arc\n\ - savematrix setmatrix\n\ - do_fill { fill }{ stroke } ifelse\n\ - end\n\ -} def\n"; - -static const char *wxPostScriptHeaderSpline = "\ -/DrawSplineSection {\n\ - /y3 exch def\n\ - /x3 exch def\n\ - /y2 exch def\n\ - /x2 exch def\n\ - /y1 exch def\n\ - /x1 exch def\n\ - /xa x1 x2 x1 sub 0.666667 mul add def\n\ - /ya y1 y2 y1 sub 0.666667 mul add def\n\ - /xb x3 x2 x3 sub 0.666667 mul add def\n\ - /yb y3 y2 y3 sub 0.666667 mul add def\n\ - x1 y1 lineto\n\ - xa ya xb yb x3 y3 curveto\n\ - } def\n\ -"; - -static const char *wxPostScriptHeaderColourImage = "\ -% define 'colorimage' if it isn't defined\n\ -% ('colortogray' and 'mergeprocs' come from xwd2ps\n\ -% via xgrab)\n\ -/colorimage where % do we know about 'colorimage'?\n\ - { pop } % yes: pop off the 'dict' returned\n\ - { % no: define one\n\ - /colortogray { % define an RGB->I function\n\ - /rgbdata exch store % call input 'rgbdata'\n\ - rgbdata length 3 idiv\n\ - /npixls exch store\n\ - /rgbindx 0 store\n\ - 0 1 npixls 1 sub {\n\ - grays exch\n\ - rgbdata rgbindx get 20 mul % Red\n\ - rgbdata rgbindx 1 add get 32 mul % Green\n\ - rgbdata rgbindx 2 add get 12 mul % Blue\n\ - add add 64 idiv % I = .5G + .31R + .18B\n\ - put\n\ - /rgbindx rgbindx 3 add store\n\ - } for\n\ - grays 0 npixls getinterval\n\ - } bind def\n\ -\n\ - % Utility procedure for colorimage operator.\n\ - % This procedure takes two procedures off the\n\ - % stack and merges them into a single procedure.\n\ -\n\ - /mergeprocs { % def\n\ - dup length\n\ - 3 -1 roll\n\ - dup\n\ - length\n\ - dup\n\ - 5 1 roll\n\ - 3 -1 roll\n\ - add\n\ - array cvx\n\ - dup\n\ - 3 -1 roll\n\ - 0 exch\n\ - putinterval\n\ - dup\n\ - 4 2 roll\n\ - putinterval\n\ - } bind def\n\ -\n\ - /colorimage { % def\n\ - pop pop % remove 'false 3' operands\n\ - {colortogray} mergeprocs\n\ - image\n\ - } bind def\n\ - } ifelse % end of 'false' case\n\ -"; - -static char wxPostScriptHeaderReencodeISO1[] = - "\n/reencodeISO {\n" -"dup dup findfont dup length dict begin\n" -"{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n" -"/Encoding ISOLatin1Encoding def\n" -"currentdict end definefont\n" -"} def\n" -"/ISOLatin1Encoding [\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n" -"/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n" -"/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n" -"/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n" -"/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n" -"/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n" -"/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n" -"/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve\n" -"/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut\n"; - -static char wxPostScriptHeaderReencodeISO2[] = -"/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar\n" -"/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot\n" -"/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior\n" -"/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine\n" -"/guillemotright/onequarter/onehalf/threequarters/questiondown\n" -"/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla\n" -"/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex\n" -"/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis\n" -"/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute\n" -"/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis\n" -"/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave\n" -"/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex\n" -"/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis\n" -"/yacute/thorn/ydieresis\n" - "] def\n\n"; - -//------------------------------------------------------------------------------- -// wxPostScriptDC -//------------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) - -float wxPostScriptDC::ms_PSScaleFactor = 1.0; - -void wxPostScriptDC::SetResolution(int ppi) -{ - ms_PSScaleFactor = (float)ppi / 72.0; -} - -int wxPostScriptDC::GetResolution() -{ - return (int)(ms_PSScaleFactor * 72.0); -} - -//------------------------------------------------------------------------------- - -wxPostScriptDC::wxPostScriptDC () -{ - m_pstream = (FILE*) NULL; - - m_currentRed = 0; - m_currentGreen = 0; - m_currentBlue = 0; - - m_pageNumber = 0; - - m_clipping = false; - - m_underlinePosition = 0.0; - m_underlineThickness = 0.0; - - m_signX = 1; // default x-axis left to right - m_signY = -1; // default y-axis bottom up -> top down -} - -wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData) -{ - m_pstream = (FILE*) NULL; - - m_currentRed = 0; - m_currentGreen = 0; - m_currentBlue = 0; - - m_pageNumber = 0; - - m_clipping = false; - - m_underlinePosition = 0.0; - m_underlineThickness = 0.0; - - m_signX = 1; // default x-axis left to right - m_signY = -1; // default y-axis bottom up -> top down - - m_printData = printData; - - m_ok = true; -} - -wxPostScriptDC::~wxPostScriptDC () -{ - if (m_pstream) - { - fclose( m_pstream ); - m_pstream = (FILE*) NULL; - } -} - -bool wxPostScriptDC::IsOk() const -{ - return m_ok; -} - -void wxPostScriptDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); - - if (m_clipping) DestroyClippingRegion(); - - wxDC::DoSetClippingRegion(x, y, w, h); - - m_clipping = true; - - PsPrintf( wxT("gsave\n newpath\n") - wxT("%d %d moveto\n") - wxT("%d %d lineto\n") - wxT("%d %d lineto\n") - wxT("%d %d lineto\n") - wxT("closepath clip newpath\n"), - LogicalToDeviceX(x), LogicalToDeviceY(y), - LogicalToDeviceX(x+w), LogicalToDeviceY(y), - LogicalToDeviceX(x+w), LogicalToDeviceY(y+h), - LogicalToDeviceX(x), LogicalToDeviceY(y+h) ); -} - - -void wxPostScriptDC::DestroyClippingRegion() -{ - wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); - - if (m_clipping) - { - m_clipping = false; - PsPrint( "grestore\n" ); - } - - wxDC::DestroyClippingRegion(); -} - -void wxPostScriptDC::Clear() -{ - // This should fail silently to avoid unnecessary - // asserts - // wxFAIL_MSG( wxT("wxPostScriptDC::Clear not implemented.") ); -} - -bool wxPostScriptDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style)) -{ - wxFAIL_MSG( wxT("wxPostScriptDC::FloodFill not implemented.") ); - return false; -} - -bool wxPostScriptDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const -{ - wxFAIL_MSG( wxT("wxPostScriptDC::GetPixel not implemented.") ); - return false; -} - -void wxPostScriptDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) -{ - wxFAIL_MSG( wxT("wxPostScriptDC::CrossHair not implemented.") ); -} - -void wxPostScriptDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (m_pen.GetStyle() == wxTRANSPARENT) return; - - SetPen( m_pen ); - - PsPrintf( wxT("newpath\n") - wxT("%d %d moveto\n") - wxT("%d %d lineto\n") - wxT("stroke\n"), - LogicalToDeviceX(x1), LogicalToDeviceY(y1), - LogicalToDeviceX(x2), LogicalToDeviceY (y2) ); - - CalcBoundingBox( x1, y1 ); - CalcBoundingBox( x2, y2 ); -} - -#define RAD2DEG 57.29577951308 - -void wxPostScriptDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - wxCoord dx = x1 - xc; - wxCoord dy = y1 - yc; - wxCoord radius = (wxCoord) sqrt( (double)(dx*dx+dy*dy) ); - double alpha1, alpha2; - - if (x1 == x2 && y1 == y2) - { - alpha1 = 0.0; - alpha2 = 360.0; - } - else if ( wxIsNullDouble(radius) ) - { - alpha1 = - alpha2 = 0.0; - } - else - { - alpha1 = (x1 - xc == 0) ? - (y1 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y1-yc), double(x1-xc)) * RAD2DEG; - alpha2 = (x2 - xc == 0) ? - (y2 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y2-yc), double(x2-xc)) * RAD2DEG; - } - while (alpha1 <= 0) alpha1 += 360; - while (alpha2 <= 0) alpha2 += 360; // adjust angles to be between - while (alpha1 > 360) alpha1 -= 360; // 0 and 360 degree - while (alpha2 > 360) alpha2 -= 360; - - if (m_brush.GetStyle() != wxTRANSPARENT) - { - SetBrush( m_brush ); - - PsPrintf( wxT("newpath\n") - wxT("%d %d %d %d %d %d ellipse\n") - wxT("%d %d lineto\n") - wxT("closepath\n") - wxT("fill\n"), - LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2, - LogicalToDeviceX(xc), LogicalToDeviceY(yc) ); - - CalcBoundingBox( xc-radius, yc-radius ); - CalcBoundingBox( xc+radius, yc+radius ); - } - - if (m_pen.GetStyle() != wxTRANSPARENT) - { - SetPen( m_pen ); - - PsPrintf( wxT("newpath\n") - wxT("%d %d %d %d %d %d ellipse\n") - wxT("%d %d lineto\n") - wxT("closepath\n") - wxT("stroke\n"), - LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2, - LogicalToDeviceX(xc), LogicalToDeviceY(yc) ); - - CalcBoundingBox( xc-radius, yc-radius ); - CalcBoundingBox( xc+radius, yc+radius ); - } -} - -void wxPostScriptDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if ( sa >= 360 || sa <= -360 ) - sa -= int(sa/360)*360; - if ( ea >= 360 || ea <=- 360 ) - ea -= int(ea/360)*360; - if ( sa < 0 ) - sa += 360; - if ( ea < 0 ) - ea += 360; - - if ( wxIsSameDouble(sa, ea) ) - { - DrawEllipse(x,y,w,h); - return; - } - - if (m_brush.GetStyle () != wxTRANSPARENT) - { - SetBrush( m_brush ); - - PsPrintf( wxT("newpath\n") - wxT("%d %d %d %d %d %d true ellipticarc\n"), - LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2), - LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2), - (wxCoord)sa, (wxCoord)ea ); - - CalcBoundingBox( x ,y ); - CalcBoundingBox( x+w, y+h ); - } - - if (m_pen.GetStyle () != wxTRANSPARENT) - { - SetPen( m_pen ); - - PsPrintf( wxT("newpath\n") - wxT("%d %d %d %d %d %d false ellipticarc\n"), - LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2), - LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2), - (wxCoord)sa, (wxCoord)ea ); - - CalcBoundingBox( x ,y ); - CalcBoundingBox( x+w, y+h ); - } -} - -void wxPostScriptDC::DoDrawPoint (wxCoord x, wxCoord y) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (m_pen.GetStyle() == wxTRANSPARENT) return; - - SetPen (m_pen); - - PsPrintf( wxT("newpath\n") - wxT("%d %d moveto\n") - wxT("%d %d lineto\n") - wxT("stroke\n"), - LogicalToDeviceX(x), LogicalToDeviceY(y), - LogicalToDeviceX(x+1), LogicalToDeviceY(y) ); - - CalcBoundingBox( x, y ); -} - -void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (n <= 0) return; - - if (m_brush.GetStyle () != wxTRANSPARENT) - { - SetBrush( m_brush ); - - PsPrint( "newpath\n" ); - - wxCoord xx = LogicalToDeviceX(points[0].x + xoffset); - wxCoord yy = LogicalToDeviceY(points[0].y + yoffset); - - PsPrintf( wxT("%d %d moveto\n"), xx, yy ); - - CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset ); - - for (int i = 1; i < n; i++) - { - xx = LogicalToDeviceX(points[i].x + xoffset); - yy = LogicalToDeviceY(points[i].y + yoffset); - - PsPrintf( wxT("%d %d lineto\n"), xx, yy ); - - CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset); - } - - PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") ); - } - - if (m_pen.GetStyle () != wxTRANSPARENT) - { - SetPen( m_pen ); - - PsPrint( "newpath\n" ); - - wxCoord xx = LogicalToDeviceX(points[0].x + xoffset); - wxCoord yy = LogicalToDeviceY(points[0].y + yoffset); - - PsPrintf( wxT("%d %d moveto\n"), xx, yy ); - - CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset ); - - for (int i = 1; i < n; i++) - { - xx = LogicalToDeviceX(points[i].x + xoffset); - yy = LogicalToDeviceY(points[i].y + yoffset); - - PsPrintf( wxT("%d %d lineto\n"), xx, yy ); - - CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset); - } - - PsPrint( "closepath\n" ); - PsPrint( "stroke\n" ); - } -} - -void wxPostScriptDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (n <= 0) return; - - if (m_brush.GetStyle () != wxTRANSPARENT) - { - SetBrush( m_brush ); - - PsPrint( "newpath\n" ); - - int ofs = 0; - for (int i = 0; i < n; ofs += count[i++]) - { - wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset); - wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset); - - PsPrintf( wxT("%d %d moveto\n"), xx, yy ); - - CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset ); - - for (int j = 1; j < count[i]; j++) - { - xx = LogicalToDeviceX(points[ofs+j].x + xoffset); - yy = LogicalToDeviceY(points[ofs+j].y + yoffset); - - PsPrintf( wxT("%d %d lineto\n"), xx, yy ); - - CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset); - } - } - PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") ); - } - - if (m_pen.GetStyle () != wxTRANSPARENT) - { - SetPen( m_pen ); - - PsPrint( "newpath\n" ); - - int ofs = 0; - for (int i = 0; i < n; ofs += count[i++]) - { - wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset); - wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset); - - PsPrintf( wxT("%d %d moveto\n"), xx, yy ); - - CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset ); - - for (int j = 1; j < count[i]; j++) - { - xx = LogicalToDeviceX(points[ofs+j].x + xoffset); - yy = LogicalToDeviceY(points[ofs+j].y + yoffset); - - PsPrintf( wxT("%d %d lineto\n"), xx, yy ); - - CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset); - } - } - PsPrint( "closepath\n" ); - PsPrint( "stroke\n" ); - } -} - -void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (m_pen.GetStyle() == wxTRANSPARENT) return; - - if (n <= 0) return; - - SetPen (m_pen); - - int i; - for ( i =0; i= 128 ) - { - /* Cope with character codes > 127 */ - PsPrintf( wxT("\\%o"), c); - } - else - { - PsPrint(c); - } - } - - PsPrint( ") show\n" ); - - if (m_font.GetUnderlined()) - { - wxCoord uy = (wxCoord)(y + size - m_underlinePosition); - char buffer[100]; - - sprintf( buffer, - "gsave\n" - "%d %d moveto\n" - "%f setlinewidth\n" - "%d %d lineto\n" - "stroke\n" - "grestore\n", - LogicalToDeviceX(x), LogicalToDeviceY(uy), - m_underlineThickness, - LogicalToDeviceX(x + text_w), LogicalToDeviceY(uy) ); - for (i = 0; i < 100; i++) - if (buffer[i] == ',') buffer[i] = '.'; - PsPrint( buffer ); - } - - CalcBoundingBox( x, y ); - CalcBoundingBox( x + size * text.length() * 2/3 , y ); -} - -void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle ) -{ - if ( wxIsNullDouble(angle) ) - { - DoDrawText(text, x, y); - return; - } - - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - SetFont( m_font ); - - if (m_textForegroundColour.Ok()) - { - unsigned char red = m_textForegroundColour.Red(); - unsigned char blue = m_textForegroundColour.Blue(); - unsigned char green = m_textForegroundColour.Green(); - - if (!m_colour) - { - // Anything not white is black - if (! (red == (unsigned char) 255 && - blue == (unsigned char) 255 && - green == (unsigned char) 255)) - { - red = (unsigned char) 0; - green = (unsigned char) 0; - blue = (unsigned char) 0; - } - } - - // maybe setgray here ? - if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue)) - { - double redPS = (double)(red) / 255.0; - double bluePS = (double)(blue) / 255.0; - double greenPS = (double)(green) / 255.0; - - char buffer[100]; - sprintf( buffer, - "%.8f %.8f %.8f setrgbcolor\n", - redPS, greenPS, bluePS ); - for (int i = 0; i < 100; i++) - if (buffer[i] == ',') buffer[i] = '.'; - PsPrint( buffer ); - - m_currentRed = red; - m_currentBlue = blue; - m_currentGreen = green; - } - } - - int size = m_font.GetPointSize(); - - PsPrintf( wxT("%d %d moveto\n"), - LogicalToDeviceX(x), LogicalToDeviceY(y)); - - char buffer[100]; - sprintf(buffer, "%.8f rotate\n", angle); - size_t i; - for (i = 0; i < 100; i++) - { - if (buffer[i] == ',') buffer[i] = '.'; - } - PsPrint( buffer); - - PsPrint( "(" ); - const wxWX2MBbuf textbuf = text.mb_str(); - size_t len = strlen(textbuf); - for (i = 0; i < len; i++) - { - int c = (unsigned char) textbuf[i]; - if (c == ')' || c == '(' || c == '\\') - { - /* Cope with special characters */ - PsPrint( "\\" ); - PsPrint(c); - } - else if ( c >= 128 ) - { - /* Cope with character codes > 127 */ - PsPrintf( wxT("\\%o"), c); - } - else - { - PsPrint(c); - } - } - - PsPrint( ") show\n" ); - - sprintf( buffer, "%.8f rotate\n", -angle ); - for (i = 0; i < 100; i++) - { - if (buffer[i] == ',') buffer[i] = '.'; - } - PsPrint( buffer ); - - if (m_font.GetUnderlined()) - { - wxCoord uy = (wxCoord)(y + size - m_underlinePosition); - wxCoord w, h; - GetTextExtent(text, &w, &h); - - sprintf( buffer, - "gsave\n" - "%d %d moveto\n" - "%f setlinewidth\n" - "%d %d lineto\n" - "stroke\n" - "grestore\n", - LogicalToDeviceX(x), LogicalToDeviceY(uy), - m_underlineThickness, - LogicalToDeviceX(x + w), LogicalToDeviceY(uy) ); - for (i = 0; i < 100; i++) - { - if (buffer[i] == ',') buffer[i] = '.'; - } - PsPrint( buffer ); - } - - CalcBoundingBox( x, y ); - CalcBoundingBox( x + size * text.length() * 2/3 , y ); -} - -void wxPostScriptDC::SetBackground (const wxBrush& brush) -{ - m_backgroundBrush = brush; -} - -void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function)) -{ - wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") ); -} - -#if wxUSE_SPLINES -void wxPostScriptDC::DoDrawSpline( wxList *points ) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - SetPen( m_pen ); - - // a and b are not used - //double a, b; - double c, d, x1, y1, x2, y2, x3, y3; - wxPoint *p, *q; - - wxList::compatibility_iterator node = points->GetFirst(); - p = (wxPoint *)node->GetData(); - x1 = p->x; - y1 = p->y; - - node = node->GetNext(); - p = (wxPoint *)node->GetData(); - c = p->x; - d = p->y; - x3 = - #if 0 - a = - #endif - (double)(x1 + c) / 2; - y3 = - #if 0 - b = - #endif - (double)(y1 + d) / 2; - - PsPrintf( wxT("newpath\n") - wxT("%d %d moveto\n") - wxT("%d %d lineto\n"), - LogicalToDeviceX((wxCoord)x1), LogicalToDeviceY((wxCoord)y1), - LogicalToDeviceX((wxCoord)x3), LogicalToDeviceY((wxCoord)y3) ); - - CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); - CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); - - node = node->GetNext(); - while (node) - { - q = (wxPoint *)node->GetData(); - - x1 = x3; - y1 = y3; - x2 = c; - y2 = d; - c = q->x; - d = q->y; - x3 = (double)(x2 + c) / 2; - y3 = (double)(y2 + d) / 2; - - PsPrintf( wxT("%d %d %d %d %d %d DrawSplineSection\n"), - LogicalToDeviceX((wxCoord)x1), LogicalToDeviceY((wxCoord)y1), - LogicalToDeviceX((wxCoord)x2), LogicalToDeviceY((wxCoord)y2), - LogicalToDeviceX((wxCoord)x3), LogicalToDeviceY((wxCoord)y3) ); - - CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); - CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); - - node = node->GetNext(); - } - - /* - At this point, (x2,y2) and (c,d) are the position of the - next-to-last and last point respectively, in the point list - */ - - PsPrintf( wxT("%d %d lineto\n") - wxT("stroke\n"), - LogicalToDeviceX((wxCoord)c), LogicalToDeviceY((wxCoord)d) ); -} -#endif // wxUSE_SPLINES - -wxCoord wxPostScriptDC::GetCharWidth() const -{ - // Chris Breeze: reasonable approximation using wxMODERN/Courier - return (wxCoord) (GetCharHeight() * 72.0 / 120.0); -} - - -void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - m_signX = (xLeftRight ? 1 : -1); - m_signY = (yBottomUp ? 1 : -1); - - ComputeScaleAndOrigin(); -} - -void wxPostScriptDC::SetDeviceOrigin( wxCoord x, wxCoord y ) -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - int h = 0; - int w = 0; - GetSize( &w, &h ); - - wxDC::SetDeviceOrigin( x, h-y ); -} - -void wxPostScriptDC::DoGetSize(int* width, int* height) const -{ - wxPaperSize id = m_printData.GetPaperId(); - - wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(id); - - if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); - - int w = 595; - int h = 842; - if (paper) - { - w = paper->GetSizeDeviceUnits().x; - h = paper->GetSizeDeviceUnits().y; - } - - if (m_printData.GetOrientation() == wxLANDSCAPE) - { - int tmp = w; - w = h; - h = tmp; - } - - if (width) *width = (int)(w * ms_PSScaleFactor); - if (height) *height = (int)(h * ms_PSScaleFactor); -} - -void wxPostScriptDC::DoGetSizeMM(int *width, int *height) const -{ - wxPaperSize id = m_printData.GetPaperId(); - - wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(id); - - if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); - - int w = 210; - int h = 297; - if (paper) - { - w = paper->GetWidth() / 10; - h = paper->GetHeight() / 10; - } - - if (m_printData.GetOrientation() == wxLANDSCAPE) - { - int tmp = w; - w = h; - h = tmp; - } - - if (width) *width = w; - if (height) *height = h; -} - -// Resolution in pixels per logical inch -wxSize wxPostScriptDC::GetPPI(void) const -{ - return wxSize((int)(72 * ms_PSScaleFactor), - (int)(72 * ms_PSScaleFactor)); -} - - -bool wxPostScriptDC::StartDoc( const wxString& message ) -{ - wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") ); - - if (m_printData.GetPrintMode() != wxPRINT_MODE_STREAM ) - { - if (m_printData.GetFilename() == wxEmptyString) - { - wxString filename = wxGetTempFileName( wxT("ps") ); - m_printData.SetFilename(filename); - } - - m_pstream = wxFopen( m_printData.GetFilename(), wxT("w+") ); - - if (!m_pstream) - { - wxLogError( _("Cannot open file for PostScript printing!")); - m_ok = false; - return false; - } - } - - m_ok = true; - m_title = message; - - PsPrint( "%!PS-Adobe-2.0\n" ); - PsPrint( "%%Creator: wxWidgets PostScript renderer\n" ); - PsPrintf( wxT("%%%%CreationDate: %s\n"), wxNow().c_str() ); - if (m_printData.GetOrientation() == wxLANDSCAPE) - PsPrint( "%%Orientation: Landscape\n" ); - else - PsPrint( "%%Orientation: Portrait\n" ); - - // PsPrintf( wxT("%%%%Pages: %d\n"), (wxPageNumber - 1) ); - - const wxChar *paper; - switch (m_printData.GetPaperId()) - { - case wxPAPER_LETTER: paper = wxT("Letter"); break; // Letter: paper ""; 8 1/2 by 11 inches - case wxPAPER_LEGAL: paper = wxT("Legal"); break; // Legal, 8 1/2 by 14 inches - case wxPAPER_A4: paper = wxT("A4"); break; // A4 Sheet, 210 by 297 millimeters - case wxPAPER_TABLOID: paper = wxT("Tabloid"); break; // Tabloid, 11 by 17 inches - case wxPAPER_LEDGER: paper = wxT("Ledger"); break; // Ledger, 17 by 11 inches - case wxPAPER_STATEMENT: paper = wxT("Statement"); break; // Statement, 5 1/2 by 8 1/2 inches - case wxPAPER_EXECUTIVE: paper = wxT("Executive"); break; // Executive, 7 1/4 by 10 1/2 inches - case wxPAPER_A3: paper = wxT("A3"); break; // A3 sheet, 297 by 420 millimeters - case wxPAPER_A5: paper = wxT("A5"); break; // A5 sheet, 148 by 210 millimeters - case wxPAPER_B4: paper = wxT("B4"); break; // B4 sheet, 250 by 354 millimeters - case wxPAPER_B5: paper = wxT("B5"); break; // B5 sheet, 182-by-257-millimeter paper - case wxPAPER_FOLIO: paper = wxT("Folio"); break; // Folio, 8-1/2-by-13-inch paper - case wxPAPER_QUARTO: paper = wxT("Quaro"); break; // Quarto, 215-by-275-millimeter paper - case wxPAPER_10X14: paper = wxT("10x14"); break; // 10-by-14-inch sheet - default: paper = wxT("A4"); - } - PsPrintf( wxT("%%%%DocumentPaperSizes: %s\n"), paper ); - PsPrint( "%%EndComments\n\n" ); - - PsPrint( "%%BeginProlog\n" ); - PsPrint( wxPostScriptHeaderConicTo ); - PsPrint( wxPostScriptHeaderEllipse ); - PsPrint( wxPostScriptHeaderEllipticArc ); - PsPrint( wxPostScriptHeaderColourImage ); - PsPrint( wxPostScriptHeaderReencodeISO1 ); - PsPrint( wxPostScriptHeaderReencodeISO2 ); - if (wxPostScriptHeaderSpline) - PsPrint( wxPostScriptHeaderSpline ); - PsPrint( "%%EndProlog\n" ); - - SetBrush( *wxBLACK_BRUSH ); - SetPen( *wxBLACK_PEN ); - SetBackground( *wxWHITE_BRUSH ); - SetTextForeground( *wxBLACK ); - - // set origin according to paper size - SetDeviceOrigin( 0,0 ); - - wxPageNumber = 1; - m_pageNumber = 1; - return true; -} - -void wxPostScriptDC::EndDoc () -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - if (m_clipping) - { - m_clipping = false; - PsPrint( "grestore\n" ); - } - - if ( m_pstream ) { - fclose( m_pstream ); - m_pstream = (FILE *) NULL; - } - -#if 0 - // THE FOLLOWING HAS BEEN CONTRIBUTED BY Andy Fyfe - wxCoord wx_printer_translate_x, wx_printer_translate_y; - double wx_printer_scale_x, wx_printer_scale_y; - - wx_printer_translate_x = (wxCoord)m_printData.GetPrinterTranslateX(); - wx_printer_translate_y = (wxCoord)m_printData.GetPrinterTranslateY(); - - wx_printer_scale_x = m_printData.GetPrinterScaleX(); - wx_printer_scale_y = m_printData.GetPrinterScaleY(); - - // Compute the bounding box. Note that it is in the default user - // coordinate system, thus we have to convert the values. - wxCoord minX = (wxCoord) LogicalToDeviceX(m_minX); - wxCoord minY = (wxCoord) LogicalToDeviceY(m_minY); - wxCoord maxX = (wxCoord) LogicalToDeviceX(m_maxX); - wxCoord maxY = (wxCoord) LogicalToDeviceY(m_maxY); - - // LOG2DEV may have changed the minimum to maximum vice versa - if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; } - if ( minY > maxY ) { wxCoord tmp = minY; minY = maxY; maxY = tmp; } - - // account for used scaling (boundingbox is before scaling in ps-file) - double scale_x = m_printData.GetPrinterScaleX() / ms_PSScaleFactor; - double scale_y = m_printData.GetPrinterScaleY() / ms_PSScaleFactor; - - wxCoord llx, lly, urx, ury; - llx = (wxCoord) ((minX+wx_printer_translate_x)*scale_x); - lly = (wxCoord) ((minY+wx_printer_translate_y)*scale_y); - urx = (wxCoord) ((maxX+wx_printer_translate_x)*scale_x); - ury = (wxCoord) ((maxY+wx_printer_translate_y)*scale_y); - // (end of bounding box computation) - - - // If we're landscape, our sense of "x" and "y" is reversed. - if (m_printData.GetOrientation() == wxLANDSCAPE) - { - wxCoord tmp; - tmp = llx; llx = lly; lly = tmp; - tmp = urx; urx = ury; ury = tmp; - - // We need either the two lines that follow, or we need to subtract - // min_x from real_translate_y, which is commented out below. - llx = llx - (wxCoord)(m_minX*wx_printer_scale_y); - urx = urx - (wxCoord)(m_minX*wx_printer_scale_y); - } - - // The Adobe specifications call for integers; we round as to make - // the bounding larger. - PsPrintf( wxT("%%%%BoundingBox: %d %d %d %d\n"), - (wxCoord)floor((double)llx), (wxCoord)floor((double)lly), - (wxCoord)ceil((double)urx), (wxCoord)ceil((double)ury) ); - - // To check the correctness of the bounding box, postscript commands - // to draw a box corresponding to the bounding box are generated below. - // But since we typically don't want to print such a box, the postscript - // commands are generated within comments. These lines appear before any - // adjustment of scale, rotation, or translation, and hence are in the - // default user coordinates. - PsPrint( "% newpath\n" ); - PsPrintf( wxT("%% %d %d moveto\n"), llx, lly ); - PsPrintf( wxT("%% %d %d lineto\n"), urx, lly ); - PsPrintf( wxT("%% %d %d lineto\n"), urx, ury ); - PsPrintf( wxT("%% %d %d lineto closepath stroke\n"), llx, ury ); -#endif - -#ifndef __WXMSW__ - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - if (m_ok && (m_printData.GetPrintMode() == wxPRINT_MODE_PRINTER)) - { - wxString command; - command += data->GetPrinterCommand(); - command += wxT(" "); - command += data->GetPrinterOptions(); - command += wxT(" "); - command += m_printData.GetFilename(); - - wxExecute( command, true ); - wxRemoveFile( m_printData.GetFilename() ); - } -#endif -} - -void wxPostScriptDC::StartPage() -{ - wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - - PsPrintf( wxT("%%%%Page: %d\n"), wxPageNumber++ ); - - // What is this one supposed to do? RR. -// *m_pstream << "matrix currentmatrix\n"; - - // Added by Chris Breeze - - // Each page starts with an "initgraphics" which resets the - // transformation and so we need to reset the origin - // (and rotate the page for landscape printing) - - // Output scaling - wxCoord translate_x, translate_y; - double scale_x, scale_y; - - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - translate_x = (wxCoord)data->GetPrinterTranslateX(); - translate_y = (wxCoord)data->GetPrinterTranslateY(); - - scale_x = data->GetPrinterScaleX(); - scale_y = data->GetPrinterScaleY(); - - if (m_printData.GetOrientation() == wxLANDSCAPE) - { - int h; - GetSize( (int*) NULL, &h ); - translate_y -= h; - PsPrint( "90 rotate\n" ); - // I copied this one from a PostScript tutorial, but to no avail. RR. - // PsPrint( "90 rotate llx neg ury nef translate\n" ); - } - - char buffer[100]; - sprintf( buffer, "%.8f %.8f scale\n", scale_x / ms_PSScaleFactor, - scale_y / ms_PSScaleFactor); - for (int i = 0; i < 100; i++) - if (buffer[i] == ',') buffer[i] = '.'; - PsPrint( buffer ); - - PsPrintf( wxT("%d %d translate\n"), translate_x, translate_y ); -} - -void wxPostScriptDC::EndPage () -{ - wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); - - PsPrint( "showpage\n" ); -} - -bool wxPostScriptDC::DoBlit( wxCoord xdest, wxCoord ydest, - wxCoord fwidth, wxCoord fheight, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - int rop, bool WXUNUSED(useMask), wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask) ) -{ - wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") ); - - wxCHECK_MSG( source, false, wxT("invalid source dc") ); - - /* blit into a bitmap */ - wxBitmap bitmap( (int)fwidth, (int)fheight ); - wxMemoryDC memDC; - memDC.SelectObject(bitmap); - memDC.Blit(0, 0, fwidth, fheight, source, xsrc, ysrc, rop); /* TODO: Blit transparently? */ - memDC.SelectObject(wxNullBitmap); - - /* draw bitmap. scaling and positioning is done there */ - DrawBitmap( bitmap, xdest, ydest ); - - return true; -} - -wxCoord wxPostScriptDC::GetCharHeight() const -{ - if (m_font.Ok()) - return m_font.GetPointSize(); - else - return 12; -} - -void wxPostScriptDC::DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent, wxCoord *externalLeading, - wxFont *theFont ) const -{ - wxFont *fontToUse = theFont; - - if (!fontToUse) fontToUse = (wxFont*) &m_font; - - const float fontSize = - fontToUse->GetPointSize() * GetFontPointSizeAdjustment(72.0); - - if (string.empty()) - { - if (x) (*x) = 0; - if (y) (*y) = 0; - if (descent) (*descent) = 0; - if (externalLeading) (*externalLeading) = 0; - return; - } - - // GTK 2.0 - - const wxWX2MBbuf strbuf = string.mb_str(); - -#if !wxUSE_AFM_FOR_POSTSCRIPT - /* Provide a VERY rough estimate (avoid using it). - * Produces accurate results for mono-spaced font - * such as Courier (aka wxMODERN) */ - - if ( x ) - *x = strlen (strbuf) * fontSize * 72.0 / 120.0; - if ( y ) - *y = (wxCoord) (fontSize * 1.32); /* allow for descender */ - if (descent) *descent = 0; - if (externalLeading) *externalLeading = 0; -#else - - /* method for calculating string widths in postscript: - / read in the AFM (adobe font metrics) file for the - / actual font, parse it and extract the character widths - / and also the descender. this may be improved, but for now - / it works well. the AFM file is only read in if the - / font is changed. this may be chached in the future. - / calls to GetTextExtent with the font unchanged are rather - / efficient!!! - / - / for each font and style used there is an AFM file necessary. - / currently i have only files for the roman font family. - / I try to get files for the other ones! - / - / CAVE: the size of the string is currently always calculated - / in 'points' (1/72 of an inch). this should later on be - / changed to depend on the mapping mode. - / CAVE: the path to the AFM files must be set before calling this - / function. this is usually done by a call like the following: - / wxSetAFMPath("d:\\wxw161\\afm\\"); - / - / example: - / - / wxPostScriptDC dc(NULL, true); - / if (dc.Ok()){ - / wxSetAFMPath("d:\\wxw161\\afm\\"); - / dc.StartDoc("Test"); - / dc.StartPage(); - / wxCoord w,h; - / dc.SetFont(new wxFont(10, wxROMAN, wxNORMAL, wxNORMAL)); - / dc.GetTextExtent("Hallo",&w,&h); - / dc.EndPage(); - / dc.EndDoc(); - / } - / - / by steve (stefan.hammes@urz.uni-heidelberg.de) - / created: 10.09.94 - / updated: 14.05.95 */ - - /* these static vars are for storing the state between calls */ - static int lastFamily= INT_MIN; - static int lastSize= INT_MIN; - static int lastStyle= INT_MIN; - static int lastWeight= INT_MIN; - static int lastDescender = INT_MIN; - static int lastWidths[256]; /* widths of the characters */ - - double UnderlinePosition = 0.0; - double UnderlineThickness = 0.0; - - // Get actual parameters - int Family = fontToUse->GetFamily(); - int Size = fontToUse->GetPointSize(); - int Style = fontToUse->GetStyle(); - int Weight = fontToUse->GetWeight(); - - // If we have another font, read the font-metrics - if (Family!=lastFamily || Size!=lastSize || Style!=lastStyle || Weight!=lastWeight) - { - // Store actual values - lastFamily = Family; - lastSize = Size; - lastStyle = Style; - lastWeight = Weight; - - const wxChar *name; - - switch (Family) - { - case wxMODERN: - case wxTELETYPE: - { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("CourO.afm"); - else name = wxT("Cour.afm"); - break; - } - case wxROMAN: - { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("TimesO.afm"); - else name = wxT("TimesRo.afm"); - break; - } - case wxSCRIPT: - { - name = wxT("Zapf.afm"); - break; - } - case wxSWISS: - default: - { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("HelvO.afm"); - else name = wxT("Helv.afm"); - break; - } - } - - FILE *afmFile = NULL; - - // Get the directory of the AFM files - wxString afmName; - - // VZ: I don't know if the cast always works under Unix but it clearly - // never does under Windows where the pointer is - // wxWindowsPrintNativeData and so calling GetFontMetricPath() on - // it just crashes -#ifndef __WIN32__ - wxPostScriptPrintNativeData *data = - wxDynamicCast(m_printData.GetNativeData(), wxPostScriptPrintNativeData); - - if (data && !data->GetFontMetricPath().empty()) - { - afmName = data->GetFontMetricPath(); - afmName << wxFILE_SEP_PATH << name; - } -#endif // __WIN32__ - - if ( !afmName.empty() ) - afmFile = wxFopen(afmName, wxT("r")); - - if ( !afmFile ) - { -#if defined(__UNIX__) && !defined(__VMS__) - afmName = wxGetDataDir(); -#else // !__UNIX__ - afmName = wxStandardPaths::Get().GetDataDir(); -#endif // __UNIX__/!__UNIX__ - - afmName << wxFILE_SEP_PATH -#if defined(__LINUX__) || defined(__FREEBSD__) - << wxT("gs_afm") << wxFILE_SEP_PATH -#else - << wxT("afm") << wxFILE_SEP_PATH -#endif - << name; - afmFile = wxFopen(afmName,wxT("r")); - } - - /* 2. open and process the file - / a short explanation of the AFM format: - / we have for each character a line, which gives its size - / e.g.: - / - / C 63 ; WX 444 ; N question ; B 49 -14 395 676 ; - / - / that means, we have a character with ascii code 63, and width - / (444/1000 * fontSize) points. - / the other data is ignored for now! - / - / when the font has changed, we read in the right AFM file and store the - / character widths in an array, which is processed below (see point 3.). */ - if (afmFile==NULL) - { - wxLogDebug( wxT("GetTextExtent: can't open AFM file '%s'"), afmName.c_str() ); - wxLogDebug( wxT(" using approximate values")); - for (int i=0; i<256; i++) lastWidths[i] = 500; /* an approximate value */ - lastDescender = -150; /* dito. */ - } - else - { - /* init the widths array */ - for(int i=0; i<256; i++) lastWidths[i] = INT_MIN; - /* some variables for holding parts of a line */ - char cString[10], semiString[10], WXString[10]; - char descString[20]; - char upString[30], utString[30]; - char encString[50]; - char line[256]; - int ascii,cWidth; - /* read in the file and parse it */ - while(fgets(line,sizeof(line),afmFile)!=NULL) - { - /* A.) check for descender definition */ - if (strncmp(line,"Descender",9)==0) - { - if ((sscanf(line,"%s%d",descString,&lastDescender)!=2) || - (strcmp(descString,"Descender")!=0)) - { - wxLogDebug( wxT("AFM-file '%s': line '%s' has error (bad descender)"), afmName.c_str(),line ); - } - } - /* JC 1.) check for UnderlinePosition */ - else if(strncmp(line,"UnderlinePosition",17)==0) - { - if ((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) || - (strcmp(upString,"UnderlinePosition")!=0)) - { - wxLogDebug( wxT("AFM-file '%s': line '%s' has error (bad UnderlinePosition)"), afmName.c_str(), line ); - } - } - /* JC 2.) check for UnderlineThickness */ - else if(strncmp(line,"UnderlineThickness",18)==0) - { - if ((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) || - (strcmp(utString,"UnderlineThickness")!=0)) - { - wxLogDebug( wxT("AFM-file '%s': line '%s' has error (bad UnderlineThickness)"), afmName.c_str(), line ); - } - } - /* JC 3.) check for EncodingScheme */ - else if(strncmp(line,"EncodingScheme",14)==0) - { - if ((sscanf(line,"%s%s",utString,encString)!=2) || - (strcmp(utString,"EncodingScheme")!=0)) - { - wxLogDebug( wxT("AFM-file '%s': line '%s' has error (bad EncodingScheme)"), afmName.c_str(), line ); - } - else if (strncmp(encString, "AdobeStandardEncoding", 21)) - { - wxLogDebug( wxT("AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)"), - afmName.c_str(),line, encString); - } - } - /* B.) check for char-width */ - else if(strncmp(line,"C ",2)==0) - { - if (sscanf(line,"%s%d%s%s%d",cString,&ascii,semiString,WXString,&cWidth)!=5) - { - wxLogDebug(wxT("AFM-file '%s': line '%s' has an error (bad character width)"),afmName.c_str(),line); - } - if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0) - { - wxLogDebug(wxT("AFM-file '%s': line '%s' has a format error"),afmName.c_str(),line); - } - /* printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); */ - if (ascii>=0 && ascii<256) - { - lastWidths[ascii] = cWidth; /* store width */ - } - else - { - /* MATTHEW: this happens a lot; don't print an error */ - /* wxLogDebug("AFM-file '%s': ASCII value %d out of range",afmName.c_str(),ascii); */ - } - } - /* C.) ignore other entries. */ - } - fclose(afmFile); - } - /* hack to compute correct values for german 'Umlaute' - / the correct way would be to map the character names - / like 'adieresis' to corresp. positions of ISOEnc and read - / these values from AFM files, too. Maybe later ... */ - - // NB: casts to int are needed to suppress gcc 3.3 warnings - lastWidths[196] = lastWidths[(int)'A']; // U+00C4 A Umlaute - lastWidths[228] = lastWidths[(int)'a']; // U+00E4 a Umlaute - lastWidths[214] = lastWidths[(int)'O']; // U+00D6 O Umlaute - lastWidths[246] = lastWidths[(int)'o']; // U+00F6 o Umlaute - lastWidths[220] = lastWidths[(int)'U']; // U+00DC U Umlaute - lastWidths[252] = lastWidths[(int)'u']; // U+00FC u Umlaute - lastWidths[223] = lastWidths[(int)251]; // U+00DF eszett (scharfes s) - - /* JC: calculate UnderlineThickness/UnderlinePosition */ - - // VS: dirty, but is there any better solution? - double *pt; - pt = (double*) &m_underlinePosition; - *pt = LogicalToDeviceYRel((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f; - pt = (double*) &m_underlineThickness; - *pt = LogicalToDeviceYRel((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f; - - } - - - /* 3. now the font metrics are read in, calc size this - / is done by adding the widths of the characters in the - / string. they are given in 1/1000 of the size! */ - - long sum=0; - float height=fontSize; /* by default */ - unsigned char *p; - for(p=(unsigned char *)wxMBSTRINGCAST strbuf; *p; p++) - { - if(lastWidths[*p]== INT_MIN) - { - wxLogDebug(wxT("GetTextExtent: undefined width for character '%c' (%d)"), *p,*p); - sum += lastWidths[(unsigned char)' ']; /* assume space */ - } - else - { - sum += lastWidths[*p]; - } - } - - double widthSum = sum; - widthSum *= fontSize; - widthSum /= 1000.0F; - - /* add descender to height (it is usually a negative value) */ - //if (lastDescender != INT_MIN) - //{ - // height += (wxCoord)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */ - //} - // - commented by V. Slavik - height already contains descender in it - // (judging from few experiments) - - /* return size values */ - if ( x ) - *x = (wxCoord)widthSum; - if ( y ) - *y = (wxCoord)height; - - /* return other parameters */ - if (descent) - { - if(lastDescender!=INT_MIN) - { - *descent = (wxCoord)(((-lastDescender)/1000.0F) * fontSize); /* MATTHEW: forgot scale */ - } - else - { - *descent = 0; - } - } - - /* currently no idea how to calculate this! */ - if (externalLeading) *externalLeading = 0; -#endif - // Use AFM -} - -// print postscript datas via required method (file, stream) -void wxPostScriptDC::PsPrintf( const wxChar* fmt, ... ) -{ - va_list argptr; - va_start(argptr, fmt); - - PsPrint( wxString::FormatV( fmt, argptr ).c_str() ); -} - -void wxPostScriptDC::PsPrint( const char* psdata ) -{ - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - switch (m_printData.GetPrintMode()) - { -#if wxUSE_STREAMS - // append to output stream - case wxPRINT_MODE_STREAM: - { - wxOutputStream* outputstream = data->GetOutputStream(); - wxCHECK_RET( outputstream, wxT("invalid outputstream") ); - outputstream->Write( psdata, strlen( psdata ) ); - } - break; -#endif // wxUSE_STREAMS - - // save data into file - default: - wxCHECK_RET( m_pstream, wxT("invalid postscript dc") ); - fwrite( psdata, 1, strlen( psdata ), m_pstream ); - } -} - -void wxPostScriptDC::PsPrint( int ch ) -{ - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - switch (m_printData.GetPrintMode()) - { -#if wxUSE_STREAMS - // append to output stream - case wxPRINT_MODE_STREAM: - { - wxOutputStream* outputstream = data->GetOutputStream(); - wxCHECK_RET( outputstream, wxT("invalid outputstream") ); - outputstream->PutC( (char)ch ); - } - break; -#endif // wxUSE_STREAMS - - // save data into file - default: - wxCHECK_RET( m_pstream, wxT("invalid postscript dc") ); - fputc( ch, m_pstream ); - } -} - -#endif // wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT - -// vi:sts=4:sw=4:et diff --git a/Source/3rdParty/wx/src/generic/dirctrlg.cpp b/Source/3rdParty/wx/src/generic/dirctrlg.cpp deleted file mode 100644 index 9edf105f6..000000000 --- a/Source/3rdParty/wx/src/generic/dirctrlg.cpp +++ /dev/null @@ -1,1700 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/dirctrlg.cpp -// Purpose: wxGenericDirCtrl -// Author: Harm van der Heijden, Robert Roebling, Julian Smart -// Modified by: -// Created: 12/12/98 -// RCS-ID: $Id: dirctrlg.cpp 62093 2009-09-24 17:04:10Z JS $ -// Copyright: (c) Harm van der Heijden, Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - -#include "wx/generic/dirctrlg.h" - -#ifndef WX_PRECOMP - #include "wx/hash.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/utils.h" - #include "wx/button.h" - #include "wx/icon.h" - #include "wx/settings.h" - #include "wx/msgdlg.h" - #include "wx/cmndata.h" - #include "wx/choice.h" - #include "wx/textctrl.h" - #include "wx/layout.h" - #include "wx/sizer.h" - #include "wx/textdlg.h" - #include "wx/gdicmn.h" - #include "wx/image.h" - #include "wx/module.h" -#endif - -#include "wx/filefn.h" -#include "wx/imaglist.h" -#include "wx/tokenzr.h" -#include "wx/dir.h" -#include "wx/artprov.h" -#include "wx/mimetype.h" - -#if wxUSE_STATLINE - #include "wx/statline.h" -#endif - -#if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers -#endif - -#ifdef __WXMSW__ -#include -#include "wx/msw/winundef.h" - -// FIXME - Mingw32 1.0 has both _getdrive() and _chdrive(). For now, let's assume -// older releases don't, but it should be verified and the checks modified -// accordingly. -#if !defined(__GNUWIN32__) || (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) -#if !defined(__WXWINCE__) - #include -#endif - #include - #include -#endif - -#endif - -#if defined(__OS2__) || defined(__DOS__) - #ifdef __OS2__ - #define INCL_BASE - #include - #ifndef __EMX__ - #include - #endif - #include - #include - #endif - extern bool wxIsDriveAvailable(const wxString& dirName); -#endif // __OS2__ - -#if defined(__WXMAC__) - #include "MoreFilesX.h" -#endif - -#ifdef __BORLANDC__ - #include "dos.h" -#endif - -// If compiled under Windows, this macro can cause problems -#ifdef GetFirstChild -#undef GetFirstChild -#endif - -// ---------------------------------------------------------------------------- -// wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/") -// ---------------------------------------------------------------------------- - -size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids) -{ -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) - -#ifdef __WXWINCE__ - // No logical drives; return "\" - paths.Add(wxT("\\")); - names.Add(wxT("\\")); - icon_ids.Add(wxFileIconsTable::computer); -#elif defined(__WIN32__) - wxChar driveBuffer[256]; - size_t n = (size_t) GetLogicalDriveStrings(255, driveBuffer); - size_t i = 0; - while (i < n) - { - wxString path, name; - path.Printf(wxT("%c:\\"), driveBuffer[i]); - name.Printf(wxT("%c:"), driveBuffer[i]); - - // Do not use GetVolumeInformation to further decorate the - // name, since it can cause severe delays on network drives. - - int imageId; - int driveType = ::GetDriveType(path); - switch (driveType) - { - case DRIVE_REMOVABLE: - if (path == wxT("a:\\") || path == wxT("b:\\")) - imageId = wxFileIconsTable::floppy; - else - imageId = wxFileIconsTable::removeable; - break; - case DRIVE_CDROM: - imageId = wxFileIconsTable::cdrom; - break; - case DRIVE_REMOTE: - case DRIVE_FIXED: - default: - imageId = wxFileIconsTable::drive; - break; - } - - paths.Add(path); - names.Add(name); - icon_ids.Add(imageId); - - while (driveBuffer[i] != wxT('\0')) - i ++; - i ++; - if (driveBuffer[i] == wxT('\0')) - break; - } -#elif defined(__OS2__) - APIRET rc; - ULONG ulDriveNum = 0; - ULONG ulDriveMap = 0; - rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); - if ( rc == 0) - { - size_t i = 0; - while (i < 26) - { - if (ulDriveMap & ( 1 << i )) - { - wxString path, name; - path.Printf(wxT("%c:\\"), 'A' + i); - name.Printf(wxT("%c:"), 'A' + i); - - // Note: If _filesys is unsupported by some compilers, - // we can always replace it by DosQueryFSAttach - char filesysname[20]; -#ifdef __WATCOMC__ - ULONG cbBuffer = sizeof(filesysname); - PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)filesysname; - APIRET rc = ::DosQueryFSAttach(name.fn_str(),0,FSAIL_QUERYNAME,pfsqBuffer,&cbBuffer); - if (rc != NO_ERROR) - { - filesysname[0] = '\0'; - } -#else - _filesys(name.fn_str(), filesysname, sizeof(filesysname)); -#endif - /* FAT, LAN, HPFS, CDFS, NFS */ - int imageId; - if (path == wxT("A:\\") || path == wxT("B:\\")) - imageId = wxFileIconsTable::floppy; - else if (!strcmp(filesysname, "CDFS")) - imageId = wxFileIconsTable::cdrom; - else if (!strcmp(filesysname, "LAN") || - !strcmp(filesysname, "NFS")) - imageId = wxFileIconsTable::drive; - else - imageId = wxFileIconsTable::drive; - paths.Add(path); - names.Add(name); - icon_ids.Add(imageId); - } - i ++; - } - } -#else // !__WIN32__, !__OS2__ - int drive; - - /* If we can switch to the drive, it exists. */ - for( drive = 1; drive <= 26; drive++ ) - { - wxString path, name; - path.Printf(wxT("%c:\\"), (char) (drive + 'a' - 1)); - name.Printf(wxT("%c:"), (char) (drive + 'A' - 1)); - - if (wxIsDriveAvailable(path)) - { - paths.Add(path); - names.Add(name); - icon_ids.Add((drive <= 2) ? wxFileIconsTable::floppy : wxFileIconsTable::drive); - } - } -#endif // __WIN32__/!__WIN32__ - -#elif defined(__WXMAC__) - - ItemCount volumeIndex = 1; - OSErr err = noErr ; - - while( noErr == err ) - { - HFSUniStr255 volumeName ; - FSRef fsRef ; - FSVolumeInfo volumeInfo ; - err = FSGetVolumeInfo(0, volumeIndex, NULL, kFSVolInfoFlags , &volumeInfo , &volumeName, &fsRef); - if( noErr == err ) - { - wxString path = wxMacFSRefToPath( &fsRef ) ; - wxString name = wxMacHFSUniStrToString( &volumeName ) ; - - if ( (volumeInfo.flags & kFSVolFlagSoftwareLockedMask) || (volumeInfo.flags & kFSVolFlagHardwareLockedMask) ) - { - icon_ids.Add(wxFileIconsTable::cdrom); - } - else - { - icon_ids.Add(wxFileIconsTable::drive); - } - // todo other removable - - paths.Add(path); - names.Add(name); - volumeIndex++ ; - } - } - -#elif defined(__UNIX__) - paths.Add(wxT("/")); - names.Add(wxT("/")); - icon_ids.Add(wxFileIconsTable::computer); -#else - #error "Unsupported platform in wxGenericDirCtrl!" -#endif - wxASSERT_MSG( (paths.GetCount() == names.GetCount()), wxT("The number of paths and their human readable names should be equal in number.")); - wxASSERT_MSG( (paths.GetCount() == icon_ids.GetCount()), wxT("Wrong number of icons for available drives.")); - return paths.GetCount(); -} - -// ---------------------------------------------------------------------------- -// wxIsDriveAvailable -// ---------------------------------------------------------------------------- - -#if defined(__DOS__) - -bool wxIsDriveAvailable(const wxString& dirName) -{ - // FIXME_MGL - this method leads to hang up under Watcom for some reason -#ifdef __WATCOMC__ - wxUnusedVar(dirName); -#else - if ( dirName.length() == 3 && dirName[1u] == wxT(':') ) - { - wxString dirNameLower(dirName.Lower()); - // VS: always return true for removable media, since Win95 doesn't - // like it when MS-DOS app accesses empty floppy drive - return (dirNameLower[0u] == wxT('a') || - dirNameLower[0u] == wxT('b') || - wxDirExists(dirNameLower)); - } - else -#endif - return true; -} - -#elif defined(__WINDOWS__) || defined(__OS2__) - -int setdrive(int WXUNUSED_IN_WINCE(drive)) -{ -#ifdef __WXWINCE__ - return 0; -#elif defined(__GNUWIN32__) && \ - (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) - return _chdrive(drive); -#else - wxChar newdrive[4]; - - if (drive < 1 || drive > 31) - return -1; - newdrive[0] = (wxChar)(wxT('A') + drive - 1); - newdrive[1] = wxT(':'); -#ifdef __OS2__ - newdrive[2] = wxT('\\'); - newdrive[3] = wxT('\0'); -#else - newdrive[2] = wxT('\0'); -#endif -#if defined(__WXMSW__) - if (::SetCurrentDirectory(newdrive)) -#else - // VA doesn't know what LPSTR is and has its own set - if (!DosSetCurrentDir((PSZ)newdrive)) -#endif - return 0; - else - return -1; -#endif // !GNUWIN32 -} - -bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) -{ -#ifdef __WXWINCE__ - return false; -#else -#ifdef __WIN32__ - UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); -#endif - bool success = true; - - // Check if this is a root directory and if so, - // whether the drive is available. - if (dirName.length() == 3 && dirName[(size_t)1] == wxT(':')) - { - wxString dirNameLower(dirName.Lower()); -#if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) - success = wxDirExists(dirNameLower); -#else - #if defined(__OS2__) - // Avoid changing to drive since no media may be inserted. - if (dirNameLower[(size_t)0] == 'a' || dirNameLower[(size_t)0] == 'b') - return success; - #endif - int currentDrive = _getdrive(); - int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ; - int err = setdrive( thisDrive ) ; - setdrive( currentDrive ); - - if (err == -1) - { - success = false; - } -#endif - } -#ifdef __WIN32__ - (void) SetErrorMode(errorMode); -#endif - - return success; -#endif -} -#endif // __WINDOWS__ || __OS2__ - -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG - - - -#if wxUSE_DIRDLG - -// Function which is called by quick sort. We want to override the default wxArrayString behaviour, -// and sort regardless of case. -static int wxCMPFUNC_CONV wxDirCtrlStringCompareFunction(const wxString& strFirst, const wxString& strSecond) -{ - return strFirst.CmpNoCase(strSecond); -} - -//----------------------------------------------------------------------------- -// wxDirItemData -//----------------------------------------------------------------------------- - -wxDirItemData::wxDirItemData(const wxString& path, const wxString& name, - bool isDir) -{ - m_path = path; - m_name = name; - /* Insert logic to detect hidden files here - * In UnixLand we just check whether the first char is a dot - * For FileNameFromPath read LastDirNameInThisPath ;-) */ - // m_isHidden = (bool)(wxFileNameFromPath(*m_path)[0] == '.'); - m_isHidden = false; - m_isExpanded = false; - m_isDir = isDir; -} - -void wxDirItemData::SetNewDirName(const wxString& path) -{ - m_path = path; - m_name = wxFileNameFromPath(path); -} - -bool wxDirItemData::HasSubDirs() const -{ - if (m_path.empty()) - return false; - - wxDir dir; - { - wxLogNull nolog; - if ( !dir.Open(m_path) ) - return false; - } - - return dir.HasSubDirs(); -} - -bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const -{ - if (m_path.empty()) - return false; - - wxDir dir; - { - wxLogNull nolog; - if ( !dir.Open(m_path) ) - return false; - } - - return dir.HasFiles(); -} - -//----------------------------------------------------------------------------- -// wxGenericDirCtrl -//----------------------------------------------------------------------------- - - -#if wxUSE_EXTENDED_RTTI -WX_DEFINE_FLAGS( wxGenericDirCtrlStyle ) - -wxBEGIN_FLAGS( wxGenericDirCtrlStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxDIRCTRL_DIR_ONLY) - wxFLAGS_MEMBER(wxDIRCTRL_3D_INTERNAL) - wxFLAGS_MEMBER(wxDIRCTRL_SELECT_FIRST) - wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS) - -wxEND_FLAGS( wxGenericDirCtrlStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl,"wx/dirctrl.h") - -wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl) - wxHIDE_PROPERTY( Children ) - wxPROPERTY( DefaultPath , wxString , SetDefaultPath , GetDefaultPath , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Filter , wxString , SetFilter , GetFilter , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) - wxPROPERTY( DefaultFilter , int , SetFilterIndex, GetFilterIndex, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) - wxPROPERTY_FLAGS( WindowStyle, wxGenericDirCtrlStyle, long, SetWindowStyleFlag, GetWindowStyleFlag, EMPTY_MACROVALUE , 0, wxT("Helpstring"), wxT("group") ) -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxGenericDirCtrl) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_8( wxGenericDirCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , DefaultPath , - wxPoint , Position , wxSize , Size , long , WindowStyle , wxString , Filter , int , DefaultFilter ) -#else -IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrl, wxControl) -#endif - -BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) - EVT_TREE_ITEM_EXPANDING (wxID_TREECTRL, wxGenericDirCtrl::OnExpandItem) - EVT_TREE_ITEM_COLLAPSED (wxID_TREECTRL, wxGenericDirCtrl::OnCollapseItem) - EVT_TREE_BEGIN_LABEL_EDIT (wxID_TREECTRL, wxGenericDirCtrl::OnBeginEditItem) - EVT_TREE_END_LABEL_EDIT (wxID_TREECTRL, wxGenericDirCtrl::OnEndEditItem) - EVT_SIZE (wxGenericDirCtrl::OnSize) -END_EVENT_TABLE() - -wxGenericDirCtrl::wxGenericDirCtrl(void) -{ - Init(); -} - -void wxGenericDirCtrl::ExpandRoot() -{ - ExpandDir(m_rootId); // automatically expand first level - - // Expand and select the default path - if (!m_defaultPath.empty()) - { - ExpandPath(m_defaultPath); - } -#ifdef __UNIX__ - else - { - // On Unix, there's only one node under the (hidden) root node. It - // represents the / path, so the user would always have to expand it; - // let's do it ourselves - ExpandPath( wxT("/") ); - } -#endif -} - -bool wxGenericDirCtrl::Create(wxWindow *parent, - const wxWindowID id, - const wxString& dir, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& filter, - int defaultFilter, - const wxString& name) -{ - if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) - return false; - - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); - - Init(); - - long treeStyle = wxTR_HAS_BUTTONS; - - // On Windows CE, if you hide the root, you get a crash when - // attempting to access data for children of the root item. -#ifndef __WXWINCE__ - treeStyle |= wxTR_HIDE_ROOT; -#endif - -#ifdef __WXGTK20__ - treeStyle |= wxTR_NO_LINES; -#endif - - if (style & wxDIRCTRL_EDIT_LABELS) - treeStyle |= wxTR_EDIT_LABELS; - - if ((style & wxDIRCTRL_3D_INTERNAL) == 0) - treeStyle |= wxNO_BORDER; - else - treeStyle |= wxBORDER_SUNKEN; - - long filterStyle = 0; - if ((style & wxDIRCTRL_3D_INTERNAL) == 0) - filterStyle |= wxNO_BORDER; - else - filterStyle |= wxBORDER_SUNKEN; - - m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL, - wxPoint(0,0), GetClientSize(), treeStyle); - - if (!filter.empty() && (style & wxDIRCTRL_SHOW_FILTERS)) - m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL, wxDefaultPosition, wxDefaultSize, filterStyle); - - m_defaultPath = dir; - m_filter = filter; - - if (m_filter.empty()) -#ifdef __UNIX__ - m_filter = wxT("*"); -#else - m_filter = wxT("*.*"); -#endif - - SetFilterIndex(defaultFilter); - - if (m_filterListCtrl) - m_filterListCtrl->FillFilterList(filter, defaultFilter); - - m_treeCtrl->SetImageList(wxTheFileIconsTable->GetSmallImageList()); - - m_showHidden = false; - wxDirItemData* rootData = new wxDirItemData(wxEmptyString, wxEmptyString, true); - - wxString rootName; - -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__) - rootName = _("Computer"); -#else - rootName = _("Sections"); -#endif - - m_rootId = m_treeCtrl->AddRoot( rootName, 3, -1, rootData); - m_treeCtrl->SetItemHasChildren(m_rootId); - - ExpandRoot(); - - SetInitialSize(size); - DoResize(); - - return true; -} - -wxGenericDirCtrl::~wxGenericDirCtrl() -{ -} - -void wxGenericDirCtrl::Init() -{ - m_showHidden = false; - m_currentFilter = 0; - m_currentFilterStr = wxEmptyString; // Default: any file - m_treeCtrl = NULL; - m_filterListCtrl = NULL; -} - -wxTreeCtrl* wxGenericDirCtrl::CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle) -{ - return new wxTreeCtrl(parent, id, pos, size, treeStyle); -} - -void wxGenericDirCtrl::ShowHidden( bool show ) -{ - m_showHidden = show; - - wxString path = GetPath(); - ReCreateTree(); - SetPath(path); -} - -const wxTreeItemId -wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId) -{ - wxDirItemData *dir_item = new wxDirItemData(path,name,true); - - wxTreeItemId id = AppendItem( m_rootId, name, imageId, -1, dir_item); - - m_treeCtrl->SetItemHasChildren(id); - - return id; -} - -void wxGenericDirCtrl::SetupSections() -{ - wxArrayString paths, names; - wxArrayInt icons; - - size_t n, count = wxGetAvailableDrives(paths, names, icons); - -#ifdef __WXGTK20__ - wxString home = wxGetHomeDir(); - AddSection( home, _("Home directory"), 1); - home += wxT("/Desktop"); - AddSection( home, _("Desktop"), 1); -#endif - - for (n = 0; n < count; n++) - AddSection(paths[n], names[n], icons[n]); -} - -void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event) -{ - // don't rename the main entry "Sections" - if (event.GetItem() == m_rootId) - { - event.Veto(); - return; - } - - // don't rename the individual sections - if (m_treeCtrl->GetItemParent( event.GetItem() ) == m_rootId) - { - event.Veto(); - return; - } -} - -void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event) -{ - if (event.IsEditCancelled()) - return; - - if ((event.GetLabel().empty()) || - (event.GetLabel() == wxT(".")) || - (event.GetLabel() == wxT("..")) || - (event.GetLabel().Find(wxT('/')) != wxNOT_FOUND) || - (event.GetLabel().Find(wxT('\\')) != wxNOT_FOUND) || - (event.GetLabel().Find(wxT('|')) != wxNOT_FOUND)) - { - wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - return; - } - - wxTreeItemId id = event.GetItem(); - wxDirItemData *data = (wxDirItemData*)m_treeCtrl->GetItemData( id ); - wxASSERT( data ); - - wxString new_name( wxPathOnly( data->m_path ) ); - new_name += wxString(wxFILE_SEP_PATH); - new_name += event.GetLabel(); - - wxLogNull log; - - if (wxFileExists(new_name)) - { - wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - } - - if (wxRenameFile(data->m_path,new_name)) - { - data->SetNewDirName( new_name ); - } - else - { - wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - } -} - -void wxGenericDirCtrl::OnExpandItem(wxTreeEvent &event) -{ - wxTreeItemId parentId = event.GetItem(); - - // VS: this is needed because the event handler is called from wxTreeCtrl - // ctor when wxTR_HIDE_ROOT was specified - - if (!m_rootId.IsOk()) - - m_rootId = m_treeCtrl->GetRootItem(); - - ExpandDir(parentId); -} - -void wxGenericDirCtrl::OnCollapseItem(wxTreeEvent &event ) -{ - CollapseDir(event.GetItem()); -} - -void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId) -{ - wxTreeItemId child; - - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(parentId); - if (!data->m_isExpanded) - return; - - data->m_isExpanded = false; - - m_treeCtrl->Freeze(); - if (parentId != m_treeCtrl->GetRootItem()) - m_treeCtrl->CollapseAndReset(parentId); - m_treeCtrl->DeleteChildren(parentId); - m_treeCtrl->Thaw(); -} - -void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) -{ - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(parentId); - - if (data->m_isExpanded) - return; - - data->m_isExpanded = true; - - if (parentId == m_treeCtrl->GetRootItem()) - { - SetupSections(); - return; - } - - wxASSERT(data); - - wxString search,path,filename; - - wxString dirName(data->m_path); - -#if (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__DOS__) || defined(__OS2__) - // Check if this is a root directory and if so, - // whether the drive is avaiable. - if (!wxIsDriveAvailable(dirName)) - { - data->m_isExpanded = false; - //wxMessageBox(wxT("Sorry, this drive is not available.")); - return; - } -#endif - - // This may take a longish time. Go to busy cursor - wxBusyCursor busy; - -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) - if (dirName.Last() == ':') - dirName += wxString(wxFILE_SEP_PATH); -#endif - - wxArrayString dirs; - wxArrayString filenames; - - wxDir d; - wxString eachFilename; - - wxLogNull log; - d.Open(dirName); - - if (d.IsOpened()) - { - int style = wxDIR_DIRS; - if (m_showHidden) style |= wxDIR_HIDDEN; - if (d.GetFirst(& eachFilename, wxEmptyString, style)) - { - do - { - if ((eachFilename != wxT(".")) && (eachFilename != wxT(".."))) - { - dirs.Add(eachFilename); - } - } - while (d.GetNext(&eachFilename)); - } - } - dirs.Sort(wxDirCtrlStringCompareFunction); - - // Now do the filenames -- but only if we're allowed to - if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) - { - d.Open(dirName); - - if (d.IsOpened()) - { - int style = wxDIR_FILES; - if (m_showHidden) style |= wxDIR_HIDDEN; - // Process each filter (ex: "JPEG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg") - wxStringTokenizer strTok; - wxString curFilter; - strTok.SetString(m_currentFilterStr,wxT(";")); - while(strTok.HasMoreTokens()) - { - curFilter = strTok.GetNextToken(); - if (d.GetFirst(& eachFilename, curFilter, style)) - { - do - { - if ((eachFilename != wxT(".")) && (eachFilename != wxT(".."))) - { - filenames.Add(eachFilename); - } - } - while (d.GetNext(& eachFilename)); - } - } - } - filenames.Sort(wxDirCtrlStringCompareFunction); - } - - // Add the sorted dirs - size_t i; - for (i = 0; i < dirs.Count(); i++) - { - eachFilename = dirs[i]; - path = dirName; - if (!wxEndsWithPathSeparator(path)) - path += wxString(wxFILE_SEP_PATH); - path += eachFilename; - - wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,true); - wxTreeItemId id = AppendItem( parentId, eachFilename, - wxFileIconsTable::folder, -1, dir_item); - m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open, - wxTreeItemIcon_Expanded ); - - // Has this got any children? If so, make it expandable. - // (There are two situations when a dir has children: either it - // has subdirectories or it contains files that weren't filtered - // out. The latter only applies to dirctrl with files.) - if ( dir_item->HasSubDirs() || - (((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) && - dir_item->HasFiles(m_currentFilterStr)) ) - { - m_treeCtrl->SetItemHasChildren(id); - } - } - - // Add the sorted filenames - if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) - { - for (i = 0; i < filenames.Count(); i++) - { - eachFilename = filenames[i]; - path = dirName; - if (!wxEndsWithPathSeparator(path)) - path += wxString(wxFILE_SEP_PATH); - path += eachFilename; - //path = dirName + wxString(wxT("/")) + eachFilename; - wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,false); - int image_id = wxFileIconsTable::file; - if (eachFilename.Find(wxT('.')) != wxNOT_FOUND) - image_id = wxTheFileIconsTable->GetIconID(eachFilename.AfterLast(wxT('.'))); - (void) AppendItem( parentId, eachFilename, image_id, -1, dir_item); - } - } -} - -void wxGenericDirCtrl::ReCreateTree() -{ - CollapseDir(m_treeCtrl->GetRootItem()); - ExpandRoot(); -} - -void wxGenericDirCtrl::CollapseTree() -{ - wxTreeItemIdValue cookie; - wxTreeItemId child = m_treeCtrl->GetFirstChild(m_rootId, cookie); - while (child.IsOk()) - { - CollapseDir(child); - child = m_treeCtrl->GetNextChild(m_rootId, cookie); - } -} - -// Find the child that matches the first part of 'path'. -// E.g. if a child path is "/usr" and 'path' is "/usr/include" -// then the child for /usr is returned. -wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& path, bool& done) -{ - wxString path2(path); - - // Make sure all separators are as per the current platform - path2.Replace(wxT("\\"), wxString(wxFILE_SEP_PATH)); - path2.Replace(wxT("/"), wxString(wxFILE_SEP_PATH)); - - // Append a separator to foil bogus substring matching - path2 += wxString(wxFILE_SEP_PATH); - - // In MSW or PM, case is not significant -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) - path2.MakeLower(); -#endif - - wxTreeItemIdValue cookie; - wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie); - while (childId.IsOk()) - { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId); - - if (data && !data->m_path.empty()) - { - wxString childPath(data->m_path); - if (!wxEndsWithPathSeparator(childPath)) - childPath += wxString(wxFILE_SEP_PATH); - - // In MSW and PM, case is not significant -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) - childPath.MakeLower(); -#endif - - if (childPath.length() <= path2.length()) - { - wxString path3 = path2.Mid(0, childPath.length()); - if (childPath == path3) - { - if (path3.length() == path2.length()) - done = true; - else - done = false; - return childId; - } - } - } - - childId = m_treeCtrl->GetNextChild(parentId, cookie); - } - wxTreeItemId invalid; - return invalid; -} - -// Try to expand as much of the given path as possible, -// and select the given tree item. -bool wxGenericDirCtrl::ExpandPath(const wxString& path) -{ - bool done = false; - wxTreeItemId id = FindChild(m_rootId, path, done); - wxTreeItemId lastId = id; // The last non-zero id - while (id.IsOk() && !done) - { - ExpandDir(id); - - id = FindChild(id, path, done); - if (id.IsOk()) - lastId = id; - } - if (!lastId.IsOk()) - return false; - - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId); - if (data->m_isDir) - { - m_treeCtrl->Expand(lastId); - } - if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) - { - // Find the first file in this directory - wxTreeItemIdValue cookie; - wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); - bool selectedChild = false; - while (childId.IsOk()) - { - data = (wxDirItemData*) m_treeCtrl->GetItemData(childId); - - if (data && data->m_path != wxEmptyString && !data->m_isDir) - { - m_treeCtrl->SelectItem(childId); - m_treeCtrl->EnsureVisible(childId); - selectedChild = true; - break; - } - childId = m_treeCtrl->GetNextChild(lastId, cookie); - } - if (!selectedChild) - { - m_treeCtrl->SelectItem(lastId); - m_treeCtrl->EnsureVisible(lastId); - } - } - else - { - m_treeCtrl->SelectItem(lastId); - m_treeCtrl->EnsureVisible(lastId); - } - - return true; -} - - -bool wxGenericDirCtrl::CollapsePath(const wxString& path) -{ - bool done = false; - wxTreeItemId id = FindChild(m_rootId, path, done); - wxTreeItemId lastId = id; // The last non-zero id - - while ( id.IsOk() && !done ) - { - CollapseDir(id); - - id = FindChild(id, path, done); - - if ( id.IsOk() ) - lastId = id; - } - - if ( !lastId.IsOk() ) - return false; - - m_treeCtrl->SelectItem(lastId); - m_treeCtrl->EnsureVisible(lastId); - - return true; -} - - -wxString wxGenericDirCtrl::GetPath() const -{ - wxTreeItemId id = m_treeCtrl->GetSelection(); - if (id) - { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id); - return data->m_path; - } - else - return wxEmptyString; -} - -wxString wxGenericDirCtrl::GetFilePath() const -{ - wxTreeItemId id = m_treeCtrl->GetSelection(); - if (id) - { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id); - if (data->m_isDir) - return wxEmptyString; - else - return data->m_path; - } - else - return wxEmptyString; -} - -void wxGenericDirCtrl::SetPath(const wxString& path) -{ - m_defaultPath = path; - if (m_rootId) - ExpandPath(path); -} - -// Not used -#if 0 -void wxGenericDirCtrl::FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames) -{ - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(id); - - // This may take a longish time. Go to busy cursor - wxBusyCursor busy; - - wxASSERT(data); - - wxString search,path,filename; - - wxString dirName(data->m_path); - -#if defined(__WXMSW__) || defined(__OS2__) - if (dirName.Last() == ':') - dirName += wxString(wxFILE_SEP_PATH); -#endif - - wxDir d; - wxString eachFilename; - - wxLogNull log; - d.Open(dirName); - - if (d.IsOpened()) - { - if (d.GetFirst(& eachFilename, m_currentFilterStr, dirFlags)) - { - do - { - if ((eachFilename != wxT(".")) && (eachFilename != wxT(".."))) - { - filenames.Add(eachFilename); - } - } - while (d.GetNext(& eachFilename)) ; - } - } -} -#endif - -void wxGenericDirCtrl::SetFilterIndex(int n) -{ - m_currentFilter = n; - - wxString f, d; - if (ExtractWildcard(m_filter, n, f, d)) - m_currentFilterStr = f; - else -#ifdef __UNIX__ - m_currentFilterStr = wxT("*"); -#else - m_currentFilterStr = wxT("*.*"); -#endif -} - -void wxGenericDirCtrl::SetFilter(const wxString& filter) -{ - m_filter = filter; - - wxString f, d; - if (ExtractWildcard(m_filter, m_currentFilter, f, d)) - m_currentFilterStr = f; - else -#ifdef __UNIX__ - m_currentFilterStr = wxT("*"); -#else - m_currentFilterStr = wxT("*.*"); -#endif - - // current filter index is meaningless after filter change, set it to zero - SetFilterIndex(0); - if (m_filterListCtrl) - m_filterListCtrl->FillFilterList(m_filter, 0); -} - -// Extract description and actual filter from overall filter string -bool wxGenericDirCtrl::ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description) -{ - wxArrayString filters, descriptions; - int count = wxParseCommonDialogsFilter(filterStr, descriptions, filters); - if (count > 0 && n < count) - { - filter = filters[n]; - description = descriptions[n]; - return true; - } - - return false; -} - -#if WXWIN_COMPATIBILITY_2_4 -// Parses the global filter, returning the number of filters. -// Returns 0 if none or if there's a problem. -// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg" -int wxGenericDirCtrl::ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions) -{ - return wxParseCommonDialogsFilter(filterStr, descriptions, filters ); -} -#endif // WXWIN_COMPATIBILITY_2_4 - -void wxGenericDirCtrl::DoResize() -{ - wxSize sz = GetClientSize(); - int verticalSpacing = 3; - if (m_treeCtrl) - { - wxSize filterSz ; - if (m_filterListCtrl) - { - filterSz = m_filterListCtrl->GetSize(); - sz.y -= (filterSz.y + verticalSpacing); - } - m_treeCtrl->SetSize(0, 0, sz.x, sz.y); - if (m_filterListCtrl) - { - m_filterListCtrl->SetSize(0, sz.y + verticalSpacing, sz.x, filterSz.y); - // Don't know why, but this needs refreshing after a resize (wxMSW) - m_filterListCtrl->Refresh(); - } - } -} - - -void wxGenericDirCtrl::OnSize(wxSizeEvent& WXUNUSED(event)) -{ - DoResize(); -} - -wxTreeItemId wxGenericDirCtrl::AppendItem (const wxTreeItemId & parent, - const wxString & text, - int image, int selectedImage, - wxTreeItemData * data) -{ - wxTreeCtrl *treeCtrl = GetTreeCtrl (); - - wxASSERT (treeCtrl); - - if (treeCtrl) - { - return treeCtrl->AppendItem (parent, text, image, selectedImage, data); - } - else - { - return wxTreeItemId(); - } -} - - -//----------------------------------------------------------------------------- -// wxDirFilterListCtrl -//----------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxDirFilterListCtrl, wxChoice) - -BEGIN_EVENT_TABLE(wxDirFilterListCtrl, wxChoice) - EVT_CHOICE(wxID_ANY, wxDirFilterListCtrl::OnSelFilter) -END_EVENT_TABLE() - -bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, const wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style) -{ - m_dirCtrl = parent; - return wxChoice::Create(parent, id, pos, size, 0, NULL, style); -} - -void wxDirFilterListCtrl::Init() -{ - m_dirCtrl = NULL; -} - -void wxDirFilterListCtrl::OnSelFilter(wxCommandEvent& WXUNUSED(event)) -{ - int sel = GetSelection(); - - wxString currentPath = m_dirCtrl->GetPath(); - - m_dirCtrl->SetFilterIndex(sel); - - // If the filter has changed, the view is out of date, so - // collapse the tree. - m_dirCtrl->ReCreateTree(); - - // Try to restore the selection, or at least the directory - m_dirCtrl->ExpandPath(currentPath); -} - -void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilter) -{ - Clear(); - wxArrayString descriptions, filters; - size_t n = (size_t) wxParseCommonDialogsFilter(filter, descriptions, filters); - - if (n > 0 && defaultFilter < (int) n) - { - for (size_t i = 0; i < n; i++) - Append(descriptions[i]); - SetSelection(defaultFilter); - } -} -#endif // wxUSE_DIRDLG - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - -// ---------------------------------------------------------------------------- -// wxFileIconsTable icons -// ---------------------------------------------------------------------------- - -#ifndef __WXGTK24__ -/* Computer (c) Julian Smart */ -static const char * file_icons_tbl_computer_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 42 1", -"r c #4E7FD0", -"$ c #7198D9", -"; c #DCE6F6", -"q c #FFFFFF", -"u c #4A7CCE", -"# c #779DDB", -"w c #95B2E3", -"y c #7FA2DD", -"f c #3263B4", -"= c #EAF0FA", -"< c #B1C7EB", -"% c #6992D7", -"9 c #D9E4F5", -"o c #9BB7E5", -"6 c #F7F9FD", -", c #BED0EE", -"3 c #F0F5FC", -"1 c #A8C0E8", -" c None", -"0 c #FDFEFF", -"4 c #C4D5F0", -"@ c #81A4DD", -"e c #4377CD", -"- c #E2EAF8", -"i c #9FB9E5", -"> c #CCDAF2", -"+ c #89A9DF", -"s c #5584D1", -"t c #5D89D3", -": c #D2DFF4", -"5 c #FAFCFE", -"2 c #F5F8FD", -"8 c #DFE8F7", -"& c #5E8AD4", -"X c #638ED5", -"a c #CEDCF2", -"p c #90AFE2", -"d c #2F5DA9", -"* c #5282D0", -"7 c #E5EDF9", -". c #A2BCE6", -"O c #8CACE0", -/* pixels */ -" ", -" .XXXXXXXXXXX ", -" oXO++@#$%&*X ", -" oX=-;:>,<1%X ", -" oX23=-;:4,$X ", -" oX5633789:@X ", -" oX05623=78+X ", -" oXqq05623=OX ", -" oX,,,,,<<<$X ", -" wXXXXXXXXXXe ", -" XrtX%$$y@+O,, ", -" uyiiiiiiiii@< ", -" ouiiiiiiiiiipAdd(wxArtProvider::GetBitmap(wxART_FOLDER, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // folder_open - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER_OPEN, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // computer -#ifdef __WXGTK24__ - // GTK24 uses this icon in the file open dialog - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, - wxART_CMN_DIALOG, - wxSize(16, 16))); -#else - m_smallImageList->Add(wxIcon(file_icons_tbl_computer_xpm)); -#endif - // drive - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // cdrom - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_CDROM, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // floppy - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FLOPPY, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // removeable - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_REMOVABLE, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // file - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, - wxART_CMN_DIALOG, - wxSize(16, 16))); - // executable - if (GetIconID(wxEmptyString, _T("application/x-executable")) == file) - { - m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, - wxART_CMN_DIALOG, - wxSize(16, 16))); - delete m_HashTable->Get(_T("exe")); - m_HashTable->Delete(_T("exe")); - m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable)); - } - /* else put into list by GetIconID - (KDE defines application/x-executable for *.exe and has nice icon) - */ -} - -wxImageList *wxFileIconsTable::GetSmallImageList() -{ - if (!m_smallImageList) - Create(); - - return m_smallImageList; -} - -#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) -// VS: we don't need this function w/o wxMimeTypesManager because we'll only have -// one icon and we won't resize it - -static wxBitmap CreateAntialiasedBitmap(const wxImage& img) -{ - const unsigned int size = 16; - - wxImage smallimg (size, size); - unsigned char *p1, *p2, *ps; - unsigned char mr = img.GetMaskRed(), - mg = img.GetMaskGreen(), - mb = img.GetMaskBlue(); - - unsigned x, y; - unsigned sr, sg, sb, smask; - - p1 = img.GetData(), p2 = img.GetData() + 3 * size*2, ps = smallimg.GetData(); - smallimg.SetMaskColour(mr, mr, mr); - - for (y = 0; y < size; y++) - { - for (x = 0; x < size; x++) - { - sr = sg = sb = smask = 0; - if (p1[0] != mr || p1[1] != mg || p1[2] != mb) - sr += p1[0], sg += p1[1], sb += p1[2]; - else smask++; - p1 += 3; - if (p1[0] != mr || p1[1] != mg || p1[2] != mb) - sr += p1[0], sg += p1[1], sb += p1[2]; - else smask++; - p1 += 3; - if (p2[0] != mr || p2[1] != mg || p2[2] != mb) - sr += p2[0], sg += p2[1], sb += p2[2]; - else smask++; - p2 += 3; - if (p2[0] != mr || p2[1] != mg || p2[2] != mb) - sr += p2[0], sg += p2[1], sb += p2[2]; - else smask++; - p2 += 3; - - if (smask > 2) - ps[0] = ps[1] = ps[2] = mr; - else - { - ps[0] = (unsigned char)(sr >> 2); - ps[1] = (unsigned char)(sg >> 2); - ps[2] = (unsigned char)(sb >> 2); - } - ps += 3; - } - p1 += size*2 * 3, p2 += size*2 * 3; - } - - return wxBitmap(smallimg); -} - -// This function is currently not unused anymore -#if 0 -// finds empty borders and return non-empty area of image: -static wxImage CutEmptyBorders(const wxImage& img) -{ - unsigned char mr = img.GetMaskRed(), - mg = img.GetMaskGreen(), - mb = img.GetMaskBlue(); - unsigned char *dt = img.GetData(), *dttmp; - unsigned w = img.GetWidth(), h = img.GetHeight(); - - unsigned top, bottom, left, right, i; - bool empt; - -#define MK_DTTMP(x,y) dttmp = dt + ((x + y * w) * 3) -#define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = false; break;} - - for (empt = true, top = 0; empt && top < h; top++) - { - MK_DTTMP(0, top); - for (i = 0; i < w; i++, dttmp+=3) - NOEMPTY_PIX(empt) - } - for (empt = true, bottom = h-1; empt && bottom > top; bottom--) - { - MK_DTTMP(0, bottom); - for (i = 0; i < w; i++, dttmp+=3) - NOEMPTY_PIX(empt) - } - for (empt = true, left = 0; empt && left < w; left++) - { - MK_DTTMP(left, 0); - for (i = 0; i < h; i++, dttmp+=3*w) - NOEMPTY_PIX(empt) - } - for (empt = true, right = w-1; empt && right > left; right--) - { - MK_DTTMP(right, 0); - for (i = 0; i < h; i++, dttmp+=3*w) - NOEMPTY_PIX(empt) - } - top--, left--, bottom++, right++; - - return img.GetSubImage(wxRect(left, top, right - left + 1, bottom - top + 1)); -} -#endif // #if 0 - -#endif // wxUSE_MIMETYPE - -int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) -{ - if (!m_smallImageList) - Create(); - -#if wxUSE_MIMETYPE - if (!extension.empty()) - { - wxFileIconEntry *entry = (wxFileIconEntry*) m_HashTable->Get(extension); - if (entry) return (entry -> id); - } - - wxFileType *ft = (mime.empty()) ? - wxTheMimeTypesManager -> GetFileTypeFromExtension(extension) : - wxTheMimeTypesManager -> GetFileTypeFromMimeType(mime); - - wxIconLocation iconLoc; - wxIcon ic; - - { - wxLogNull logNull; - if ( ft && ft->GetIcon(&iconLoc) ) - { - ic = wxIcon( iconLoc ); - } - } - - delete ft; - - if ( !ic.Ok() ) - { - int newid = file; - m_HashTable->Put(extension, new wxFileIconEntry(newid)); - return newid; - } - - wxBitmap bmp; - bmp.CopyFromIcon(ic); - - if ( !bmp.Ok() ) - { - int newid = file; - m_HashTable->Put(extension, new wxFileIconEntry(newid)); - return newid; - } - - const unsigned int size = 16; - - int id = m_smallImageList->GetImageCount(); - if ((bmp.GetWidth() == (int) size) && (bmp.GetHeight() == (int) size)) - { - m_smallImageList->Add(bmp); - } -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - else - { - wxImage img = bmp.ConvertToImage(); - - if ((img.GetWidth() != size*2) || (img.GetHeight() != size*2)) -// m_smallImageList->Add(CreateAntialiasedBitmap(CutEmptyBorders(img).Rescale(size*2, size*2))); - m_smallImageList->Add(CreateAntialiasedBitmap(img.Rescale(size*2, size*2))); - else - m_smallImageList->Add(CreateAntialiasedBitmap(img)); - } -#endif // wxUSE_IMAGE - - m_HashTable->Put(extension, new wxFileIconEntry(id)); - return id; - -#else // !wxUSE_MIMETYPE - - wxUnusedVar(mime); - if (extension == wxT("exe")) - return executable; - else - return file; -#endif // wxUSE_MIMETYPE/!wxUSE_MIMETYPE -} - -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG diff --git a/Source/3rdParty/wx/src/generic/dragimgg.cpp b/Source/3rdParty/wx/src/generic/dragimgg.cpp deleted file mode 100644 index d3c8ac474..000000000 --- a/Source/3rdParty/wx/src/generic/dragimgg.cpp +++ /dev/null @@ -1,574 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/dragimgg.cpp -// Purpose: Generic wxDragImage implementation -// Author: Julian Smart -// Modified by: -// Created: 29/2/2000 -// RCS-ID: $Id: dragimgg.cpp 42397 2006-10-25 12:12:56Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DRAGIMAGE - -#ifndef WX_PRECOMP - #include - #include "wx/window.h" - #include "wx/frame.h" - #include "wx/dcclient.h" - #include "wx/dcscreen.h" - #include "wx/dcmemory.h" - #include "wx/settings.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/image.h" -#endif - -#define wxUSE_IMAGE_IN_DRAGIMAGE 1 - -#include "wx/generic/dragimgg.h" - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGenericDragImage, wxObject) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxGenericDragImage ctors/dtor -// ---------------------------------------------------------------------------- - -wxGenericDragImage::~wxGenericDragImage() -{ - if (m_windowDC) - { - delete m_windowDC; - } -} - -void wxGenericDragImage::Init() -{ - m_isDirty = false; - m_isShown = false; - m_windowDC = (wxDC*) NULL; - m_window = (wxWindow*) NULL; - m_fullScreen = false; -#ifdef wxHAS_NATIVE_OVERLAY - m_dcOverlay = NULL; -#else - m_pBackingBitmap = (wxBitmap*) NULL; -#endif -} - -#if WXWIN_COMPATIBILITY_2_6 -wxGenericDragImage::wxGenericDragImage(const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - Create(cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(image, cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(image, cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(str, cursor); -} - -bool wxGenericDragImage::Create(const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(cursor); -} - -bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(image, cursor); -} - -bool wxGenericDragImage::Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(image, cursor); -} - -bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(str, cursor); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -// Attributes -//////////////////////////////////////////////////////////////////////////// - - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) -bool wxGenericDragImage::Create(const wxCursor& cursor) -{ - m_cursor = cursor; - - return true; -} - -// Create a drag image from a bitmap and optional cursor -bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor) -{ - // We don't have to combine the cursor explicitly since we simply show the cursor - // as we drag. This currently will only work within one window. - - m_cursor = cursor; - m_bitmap = image; - - return true ; -} - -// Create a drag image from an icon and optional cursor -bool wxGenericDragImage::Create(const wxIcon& image, const wxCursor& cursor) -{ - // We don't have to combine the cursor explicitly since we simply show the cursor - // as we drag. This currently will only work within one window. - - m_cursor = cursor; - m_icon = image; - - return true ; -} - -// Create a drag image from a string and optional cursor -bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor) -{ - wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - - long w = 0, h = 0; - wxScreenDC dc; - dc.SetFont(font); - dc.GetTextExtent(str, & w, & h); - dc.SetFont(wxNullFont); - - wxMemoryDC dc2; - - // Sometimes GetTextExtent isn't accurate enough, so make it longer - wxBitmap bitmap((int) ((w+2) * 1.5), (int) h+2); - dc2.SelectObject(bitmap); - - dc2.SetFont(font); - dc2.SetBackground(* wxWHITE_BRUSH); - dc2.Clear(); - dc2.SetBackgroundMode(wxTRANSPARENT); - dc2.SetTextForeground(* wxLIGHT_GREY); - dc2.DrawText(str, 0, 0); - dc2.DrawText(str, 1, 0); - dc2.DrawText(str, 2, 0); - dc2.DrawText(str, 1, 1); - dc2.DrawText(str, 2, 1); - dc2.DrawText(str, 1, 2); - dc2.DrawText(str, 2, 2); - - dc2.SetTextForeground(* wxBLACK); - dc2.DrawText(str, 1, 1); - - dc2.SelectObject(wxNullBitmap); - -#if wxUSE_IMAGE_IN_DRAGIMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - // Make the bitmap masked - wxImage image = bitmap.ConvertToImage(); - image.SetMaskColour(255, 255, 255); - bitmap = wxBitmap(image); -#endif - - return Create(bitmap, cursor); -} - -#if wxUSE_TREECTRL -// Create a drag image for the given tree control item -bool wxGenericDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) -{ - wxString str = treeCtrl.GetItemText(id); - return Create(str); -} -#endif - -#if wxUSE_LISTCTRL -// Create a drag image for the given list control item -bool wxGenericDragImage::Create(const wxListCtrl& listCtrl, long id) -{ - wxString str = listCtrl.GetItemText(id); - return Create(str); -} -#endif - -// Begin drag -bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, - wxWindow* window, - bool fullScreen, - wxRect* rect) -{ - wxASSERT_MSG( (window != 0), wxT("Window must not be null in BeginDrag.")); - - // The image should be offset by this amount - m_offset = hotspot; - m_window = window; - m_fullScreen = fullScreen; - - if (rect) - m_boundingRect = * rect; - - m_isDirty = false; - m_isDirty = false; - - if (window) - { - window->CaptureMouse(); - - if (m_cursor.Ok()) - { - m_oldCursor = window->GetCursor(); - window->SetCursor(m_cursor); - } - } - - // Make a copy of the window so we can repair damage done as the image is - // dragged. - - wxSize clientSize; - wxPoint pt; - if (!m_fullScreen) - { - clientSize = window->GetClientSize(); - m_boundingRect.x = 0; m_boundingRect.y = 0; - m_boundingRect.width = clientSize.x; m_boundingRect.height = clientSize.y; - } - else - { - int w, h; - wxDisplaySize(& w, & h); - clientSize.x = w; clientSize.y = h; - if (rect) - { - pt.x = m_boundingRect.x; pt.y = m_boundingRect.y; - clientSize.x = m_boundingRect.width; clientSize.y = m_boundingRect.height; - } - else - { - m_boundingRect.x = 0; m_boundingRect.y = 0; - m_boundingRect.width = w; m_boundingRect.height = h; - } - } - -#ifndef wxHAS_NATIVE_OVERLAY - wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - - if (!backing->Ok() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) - (*backing) = wxBitmap(clientSize.x, clientSize.y); -#endif // !wxHAS_NATIVE_OVERLAY - - if (!m_fullScreen) - { - m_windowDC = new wxClientDC(window); - } - else - { - m_windowDC = new wxScreenDC; - -#if 0 - // Use m_boundingRect to limit the area considered. - ((wxScreenDC*) m_windowDC)->StartDrawingOnTop(rect); -#endif - - m_windowDC->SetClippingRegion(m_boundingRect.x, m_boundingRect.y, - m_boundingRect.width, m_boundingRect.height); - } - - return true; -} - -// Begin drag. hotspot is the location of the drag position relative to the upper-left -// corner of the image. This is full screen only. fullScreenRect gives the -// position of the window on the screen, to restrict the drag to. -bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect) -{ - wxRect rect; - - int x = fullScreenRect->GetPosition().x; - int y = fullScreenRect->GetPosition().y; - - wxSize sz = fullScreenRect->GetSize(); - - if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame))) - fullScreenRect->GetParent()->ClientToScreen(& x, & y); - - rect.x = x; rect.y = y; - rect.width = sz.x; rect.height = sz.y; - - return BeginDrag(hotspot, window, true, & rect); -} - -// End drag -bool wxGenericDragImage::EndDrag() -{ - if (m_window) - { -#ifdef __WXMSW__ - // Under Windows we can be pretty sure this test will give - // the correct results - if (wxWindow::GetCapture() == m_window) -#endif - m_window->ReleaseMouse(); - - if (m_cursor.Ok() && m_oldCursor.Ok()) - { - m_window->SetCursor(m_oldCursor); - } - } - - if (m_windowDC) - { -#ifdef wxHAS_NATIVE_OVERLAY - m_overlay.Reset(); -#else - m_windowDC->DestroyClippingRegion(); -#endif - delete m_windowDC; - m_windowDC = (wxDC*) NULL; - } - -#ifndef wxHAS_NATIVE_OVERLAY - m_repairBitmap = wxNullBitmap; -#endif - - return true; -} - -// Move the image: call from OnMouseMove. Pt is in window client coordinates if window -// is non-NULL, or in screen coordinates if NULL. -bool wxGenericDragImage::Move(const wxPoint& pt) -{ - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Move()") ); - - wxPoint pt2(pt); - if (m_fullScreen) - pt2 = m_window->ClientToScreen(pt); - - // Erase at old position, then show at the current position - wxPoint oldPos = m_position; - - bool eraseOldImage = (m_isDirty && m_isShown); - - if (m_isShown) - RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, true); - - m_position = pt2; - - if (m_isShown) - m_isDirty = true; - - return true; -} - -bool wxGenericDragImage::Show() -{ - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Show()") ); - - // Show at the current position - - if (!m_isShown) - { - // This is where we restore the backing bitmap, in case - // something has changed on the window. - -#ifndef wxHAS_NATIVE_OVERLAY - wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - wxMemoryDC memDC; - memDC.SelectObject(* backing); - - UpdateBackingFromWindow(* m_windowDC, memDC, m_boundingRect, wxRect(0, 0, m_boundingRect.width, m_boundingRect.height)); - - //memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y); - memDC.SelectObject(wxNullBitmap); -#endif // !wxHAS_NATIVE_OVERLAY - - RedrawImage(m_position - m_offset, m_position - m_offset, false, true); - } - - m_isShown = true; - m_isDirty = true; - - return true; -} - -bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, - const wxRect& sourceRect, const wxRect& destRect) const -{ - return destDC.Blit(destRect.x, destRect.y, destRect.width, destRect.height, & windowDC, - sourceRect.x, sourceRect.y); -} - -bool wxGenericDragImage::Hide() -{ - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Hide()") ); - - // Repair the old position - - if (m_isShown && m_isDirty) - { - RedrawImage(m_position - m_offset, m_position - m_offset, true, false); - } - - m_isShown = false; - m_isDirty = false; - - return true; -} - -// More efficient: erase and redraw simultaneously if possible -bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, - bool eraseOld, bool drawNew) -{ - if (!m_windowDC) - return false; - -#ifdef wxHAS_NATIVE_OVERLAY - wxDCOverlay dcoverlay( m_overlay, (wxWindowDC*) m_windowDC ) ; - if ( eraseOld ) - dcoverlay.Clear() ; - if (drawNew) - DoDrawImage(*m_windowDC, newPos); -#else // !wxHAS_NATIVE_OVERLAY - wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - if (!backing->Ok()) - return false; - - wxRect oldRect(GetImageRect(oldPos)); - wxRect newRect(GetImageRect(newPos)); - - wxRect fullRect; - - // Full rect: the combination of both rects - if (eraseOld && drawNew) - { - int oldRight = oldRect.GetRight(); - int oldBottom = oldRect.GetBottom(); - int newRight = newRect.GetRight(); - int newBottom = newRect.GetBottom(); - - wxPoint topLeft = wxPoint(wxMin(oldPos.x, newPos.x), wxMin(oldPos.y, newPos.y)); - wxPoint bottomRight = wxPoint(wxMax(oldRight, newRight), wxMax(oldBottom, newBottom)); - - fullRect.x = topLeft.x; fullRect.y = topLeft.y; - fullRect.SetRight(bottomRight.x); - fullRect.SetBottom(bottomRight.y); - } - else if (eraseOld) - fullRect = oldRect; - else if (drawNew) - fullRect = newRect; - - // Make the bitmap bigger than it need be, so we don't - // keep reallocating all the time. - int excess = 50; - - if (!m_repairBitmap.Ok() || (m_repairBitmap.GetWidth() < fullRect.GetWidth() || m_repairBitmap.GetHeight() < fullRect.GetHeight())) - { - m_repairBitmap = wxBitmap(fullRect.GetWidth() + excess, fullRect.GetHeight() + excess); - } - - wxMemoryDC memDC; - memDC.SelectObject(* backing); - - wxMemoryDC memDCTemp; - memDCTemp.SelectObject(m_repairBitmap); - - // Draw the backing bitmap onto the repair bitmap. - // If full-screen, we may have specified the rect on the - // screen that we're using for our backing bitmap. - // So subtract this when we're blitting from the backing bitmap - // (translate from screen to backing-bitmap coords). - - memDCTemp.Blit(0, 0, fullRect.GetWidth(), fullRect.GetHeight(), & memDC, fullRect.x - m_boundingRect.x, fullRect.y - m_boundingRect.y); - - // If drawing, draw the image onto the mem DC - if (drawNew) - { - wxPoint pos(newPos.x - fullRect.x, newPos.y - fullRect.y) ; - DoDrawImage(memDCTemp, pos); - } - - // Now blit to the window - // Finally, blit the temp mem DC to the window. - m_windowDC->Blit(fullRect.x, fullRect.y, fullRect.width, fullRect.height, & memDCTemp, 0, 0); - - memDCTemp.SelectObject(wxNullBitmap); - memDC.SelectObject(wxNullBitmap); -#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY - - return true; -} - -// Override this if you are using a virtual image (drawing your own image) -bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const -{ - if (m_bitmap.Ok()) - { - dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0)); - return true; - } - else if (m_icon.Ok()) - { - dc.DrawIcon(m_icon, pos.x, pos.y); - return true; - } - else - return false; -} - -// Override this if you are using a virtual image (drawing your own image) -wxRect wxGenericDragImage::GetImageRect(const wxPoint& pos) const -{ - if (m_bitmap.Ok()) - { - return wxRect(pos.x, pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight()); - } - else if (m_icon.Ok()) - { - return wxRect(pos.x, pos.y, m_icon.GetWidth(), m_icon.GetHeight()); - } - else - { - return wxRect(pos.x, pos.y, 0, 0); - } -} - -#endif // wxUSE_DRAGIMAGE diff --git a/Source/3rdParty/wx/src/generic/filepickerg.cpp b/Source/3rdParty/wx/src/generic/filepickerg.cpp deleted file mode 100644 index 96eb79916..000000000 --- a/Source/3rdParty/wx/src/generic/filepickerg.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/filepickerg.cpp -// Purpose: wxGenericFileDirButton class implementation -// Author: Francesco Montorsi -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: filepickerg.cpp 52835 2008-03-26 15:49:08Z JS $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#include "wx/filepicker.h" - - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxGenericFileButton, wxButton) -IMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton, wxButton) - -// ---------------------------------------------------------------------------- -// wxGenericFileButton -// ---------------------------------------------------------------------------- - -bool wxGenericFileDirButton::Create( wxWindow *parent, wxWindowID id, - const wxString &label, const wxString &path, - const wxString &message, const wxString &wildcard, - const wxPoint &pos, const wxSize &size, long style, - const wxValidator& validator, const wxString &name) -{ - // create this button - if (!wxButton::Create(parent, id, label, pos, size, style, - validator, name)) - { - wxFAIL_MSG( wxT("wxGenericFileButton creation failed") ); - return false; - } - - // and handle user clicks on it - Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(wxGenericFileDirButton::OnButtonClick), - NULL, this); - - // create the dialog associated with this button - m_path = path; - m_message = message; - m_wildcard = wildcard; - - return true; -} - -void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) -{ - wxDialog *p = CreateDialog(); - if (p->ShowModal() == wxID_OK) - { - // save updated path in m_path - UpdatePathFromDialog(p); - - // fire an event - wxFileDirPickerEvent event(GetEventType(), this, GetId(), m_path); - GetEventHandler()->ProcessEvent(event); - } - - wxDELETE(p); -} - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL diff --git a/Source/3rdParty/wx/src/generic/fontpickerg.cpp b/Source/3rdParty/wx/src/generic/fontpickerg.cpp deleted file mode 100644 index e01bcd544..000000000 --- a/Source/3rdParty/wx/src/generic/fontpickerg.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/fontpickerg.cpp -// Purpose: wxGenericFontButton class implementation -// Author: Francesco Montorsi -// Modified by: -// Created: 15/04/2006 -// RCS-ID: $Id: fontpickerg.cpp 52835 2008-03-26 15:49:08Z JS $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FONTPICKERCTRL - -#include "wx/fontpicker.h" - -#include "wx/fontdlg.h" - - -// ============================================================================ -// implementation -// ============================================================================ - -wxFontData wxGenericFontButton::ms_data; -IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton) - -// ---------------------------------------------------------------------------- -// wxGenericFontButton -// ---------------------------------------------------------------------------- - -bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, - const wxFont &initial, const wxPoint &pos, - const wxSize &size, long style, - const wxValidator& validator, const wxString &name) -{ - wxString label = (style & wxFNTP_FONTDESC_AS_LABEL) ? - wxEmptyString : // label will be updated by UpdateFont - wxT("Choose font"); - - // create this button - if (!wxButton::Create( parent, id, label, pos, - size, style, validator, name )) - { - wxFAIL_MSG( wxT("wxGenericFontButton creation failed") ); - return false; - } - - // and handle user clicks on it - Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(wxGenericFontButton::OnButtonClick), - NULL, this); - - m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT; - UpdateFont(); - InitFontData(); - - return true; -} - -void wxGenericFontButton::InitFontData() -{ - ms_data.SetAllowSymbols(true); - ms_data.SetColour(*wxBLACK); - ms_data.EnableEffects(true); -} - -void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) -{ - // update the wxFontData to be shown in the the dialog - ms_data.SetInitialFont(m_selectedFont); - - // create the font dialog and display it - wxFontDialog dlg(this, ms_data); - if (dlg.ShowModal() == wxID_OK) - { - ms_data = dlg.GetFontData(); - SetSelectedFont(ms_data.GetChosenFont()); - - // fire an event - wxFontPickerEvent event(this, GetId(), m_selectedFont); - GetEventHandler()->ProcessEvent(event); - } -} - -void wxGenericFontButton::UpdateFont() -{ - if ( !m_selectedFont.Ok() ) - return; - - SetForegroundColour(ms_data.GetColour()); - - if (HasFlag(wxFNTP_USEFONT_FOR_LABEL)) - { - // use currently selected font for the label... - wxButton::SetFont(m_selectedFont); - } - - if (HasFlag(wxFNTP_FONTDESC_AS_LABEL)) - { - SetLabel(wxString::Format(wxT("%s, %d"), - m_selectedFont.GetFaceName().c_str(), - m_selectedFont.GetPointSize())); - } -} - -#endif // wxUSE_FONTPICKERCTRL diff --git a/Source/3rdParty/wx/src/generic/graphicc.cpp b/Source/3rdParty/wx/src/generic/graphicc.cpp deleted file mode 100644 index 75744b086..000000000 --- a/Source/3rdParty/wx/src/generic/graphicc.cpp +++ /dev/null @@ -1,1615 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/graphicc.cpp -// Purpose: cairo device context class -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-03 -// RCS-ID: $Id: graphicc.cpp 66928 2011-02-16 23:31:13Z JS $ -// Copyright: (c) 2006 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_GRAPHICS_CONTEXT - -#ifndef WX_PRECOMP -#include "wx/image.h" -#include "wx/window.h" -#include "wx/dc.h" -#include "wx/utils.h" -#include "wx/dialog.h" -#include "wx/app.h" -#include "wx/bitmap.h" -#include "wx/dcmemory.h" -#include "wx/log.h" -#include "wx/icon.h" -#include "wx/dcprint.h" -#include "wx/module.h" -#endif - -#ifdef __WXGTK__ -#include "wx/gtk/win_gtk.h" -#endif - -#include "wx/graphics.h" -#include "wx/rawbmp.h" - -#if wxUSE_CAIRO - -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -const double RAD2DEG = 180.0 / M_PI; - -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double dmin(double a, double b) -{ - return a < b ? a : b; -} -static inline double dmax(double a, double b) -{ - return a > b ? a : b; -} - -static inline double DegToRad(double deg) -{ - return (deg * M_PI) / 180.0; -} -static inline double RadToDeg(double deg) -{ - return (deg * 180.0) / M_PI; -} - -//----------------------------------------------------------------------------- -// device context implementation -// -// more and more of the dc functionality should be implemented by calling -// the appropricate wxCairoContext, but we will have to do that step by step -// also coordinate conversions should be moved to native matrix ops -//----------------------------------------------------------------------------- - -// we always stock two context states, one at entry, to be able to preserve the -// state we were called with, the other one after changing to HI Graphics orientation -// (this one is used for getting back clippings etc) - -//----------------------------------------------------------------------------- -// wxGraphicsPath implementation -//----------------------------------------------------------------------------- - -// TODO remove this dependency (gdiplus needs the macros) - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#include -#ifdef __WXMSW__ -#include -#endif - -#ifdef __WXGTK__ -#include -#endif - -class WXDLLIMPEXP_CORE wxCairoPathData : public wxGraphicsPathData -{ -public : - wxCairoPathData(wxGraphicsRenderer* renderer, cairo_t* path = NULL); - ~wxCairoPathData(); - - virtual wxGraphicsObjectRefData *Clone() const; - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ); - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ); - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ); - - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; - - // adds another path - virtual void AddPath( const wxGraphicsPathData* path ); - - // closes the current sub-path - virtual void CloseSubpath(); - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - /* - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ; - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddEllipsis( wxDouble x, wxDouble y, wxDouble w , wxDouble h ) ; - - // draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - */ - - // returns the native path - virtual void * GetNativePath() const ; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p) const; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ) ; - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const; - - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxWINDING_RULE) const; - -private : - cairo_t* m_pathContext; -}; - -class WXDLLIMPEXP_CORE wxCairoMatrixData : public wxGraphicsMatrixData -{ -public : - wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_matrix_t* matrix = NULL ) ; - virtual ~wxCairoMatrixData() ; - - virtual wxGraphicsObjectRefData *Clone() const ; - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ); - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; - - // makes this the inverse matrix - virtual void Invert(); - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const ; - - // return true if this is the identity matrix - virtual bool IsIdentity() const; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ); - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ); - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ); - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; - - // returns the native representation - virtual void * GetNativeMatrix() const; -private: - cairo_matrix_t m_matrix ; -} ; - -class WXDLLIMPEXP_CORE wxCairoPenData : public wxGraphicsObjectRefData -{ -public: - wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ); - ~wxCairoPenData(); - - void Init(); - - virtual void Apply( wxGraphicsContext* context ); - virtual wxDouble GetWidth() { return m_width; } - -private : - double m_width; - - double m_red; - double m_green; - double m_blue; - double m_alpha; - - cairo_line_cap_t m_cap; - cairo_line_join_t m_join; - - int m_count; - const double *m_lengths; - double *m_userLengths; - - wxPen m_pen; -}; - -class WXDLLIMPEXP_CORE wxCairoBrushData : public wxGraphicsObjectRefData -{ -public: - wxCairoBrushData( wxGraphicsRenderer* renderer ); - wxCairoBrushData( wxGraphicsRenderer* renderer, const wxBrush &brush ); - ~wxCairoBrushData (); - - virtual void Apply( wxGraphicsContext* context ); - void CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2 ); - void CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor ); - -protected: - virtual void Init(); - -private : - double m_red; - double m_green; - double m_blue; - double m_alpha; - - cairo_pattern_t* m_brushPattern; -}; - -class wxCairoFontData : public wxGraphicsObjectRefData -{ -public: - wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col ); - ~wxCairoFontData(); - - virtual void Apply( wxGraphicsContext* context ); -private : - wxCharBuffer m_fontName; - double m_size; - cairo_font_slant_t m_slant; - cairo_font_weight_t m_weight; - double m_red; - double m_green; - double m_blue; - double m_alpha; -}; - -class wxCairoBitmapData : public wxGraphicsObjectRefData -{ -public: - wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ); - ~wxCairoBitmapData(); - - virtual cairo_surface_t* GetCairoSurface() { return m_surface; } - virtual cairo_pattern_t* GetCairoPattern() { return m_pattern; } - virtual wxSize GetSize() { return wxSize(m_width, m_height); } -private : - cairo_surface_t* m_surface; - cairo_pattern_t* m_pattern; - int m_width; - int m_height; - unsigned char* m_buffer; -}; - -class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext -{ - DECLARE_NO_COPY_CLASS(wxCairoContext) - -public: - wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ); -#ifdef __WXMSW__ - wxCairoContext( wxGraphicsRenderer* renderer, HDC context ); -#endif -#ifdef __WXGTK__ - wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable ); -#endif - wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ); - wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window); - wxCairoContext(); - virtual ~wxCairoContext(); - - virtual void Clip( const wxRegion ®ion ); - - // clips drawings to the rect - virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // resets the clipping to original extent - virtual void ResetClip(); - - virtual void * GetNativeContext(); - - virtual void StrokePath( const wxGraphicsPath& p ); - virtual void FillPath( const wxGraphicsPath& p , int fillStyle = wxWINDING_RULE ); - - virtual void Translate( wxDouble dx , wxDouble dy ); - virtual void Scale( wxDouble xScale , wxDouble yScale ); - virtual void Rotate( wxDouble angle ); - - // concatenates this transform with the current transform of this context - virtual void ConcatTransform( const wxGraphicsMatrix& matrix ); - - // sets the transform of this context - virtual void SetTransform( const wxGraphicsMatrix& matrix ); - - // gets the matrix of this context - virtual wxGraphicsMatrix GetTransform() const; - - void DrawGraphicsBitmapInternal( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void PushState(); - virtual void PopState(); - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y); - virtual void GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const; - virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const; - -private: - cairo_t* m_context; -#ifdef __WXMSW__ - cairo_surface_t* m_mswSurface; -#endif -}; - -//----------------------------------------------------------------------------- -// wxCairoPenData implementation -//----------------------------------------------------------------------------- - -wxCairoPenData::~wxCairoPenData() -{ - delete[] m_userLengths; -} - -void wxCairoPenData::Init() -{ - m_lengths = NULL; - m_userLengths = NULL; - m_width = 0; - m_count = 0; -} - -wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) -: wxGraphicsObjectRefData(renderer) -{ - Init(); - m_pen = pen; - m_width = m_pen.GetWidth(); - if (m_width <= 0.0) - m_width = 0.1; - - m_red = m_pen.GetColour().Red()/255.0; - m_green = m_pen.GetColour().Green()/255.0; - m_blue = m_pen.GetColour().Blue()/255.0; - m_alpha = m_pen.GetColour().Alpha()/255.0; - - switch ( m_pen.GetCap() ) - { - case wxCAP_ROUND : - m_cap = CAIRO_LINE_CAP_ROUND; - break; - - case wxCAP_PROJECTING : - m_cap = CAIRO_LINE_CAP_SQUARE; - break; - - case wxCAP_BUTT : - m_cap = CAIRO_LINE_CAP_BUTT; - break; - - default : - m_cap = CAIRO_LINE_CAP_BUTT; - break; - } - - switch ( m_pen.GetJoin() ) - { - case wxJOIN_BEVEL : - m_join = CAIRO_LINE_JOIN_BEVEL; - break; - - case wxJOIN_MITER : - m_join = CAIRO_LINE_JOIN_MITER; - break; - - case wxJOIN_ROUND : - m_join = CAIRO_LINE_JOIN_ROUND; - break; - - default : - m_join = CAIRO_LINE_JOIN_MITER; - break; - } - - const double dashUnit = m_width < 1.0 ? 1.0 : m_width; - const double dotted[] = - { - dashUnit , dashUnit + 2.0 - }; - static const double short_dashed[] = - { - 9.0 , 6.0 - }; - static const double dashed[] = - { - 19.0 , 9.0 - }; - static const double dotted_dashed[] = - { - 9.0 , 6.0 , 3.0 , 3.0 - }; - - switch ( m_pen.GetStyle() ) - { - case wxSOLID : - break; - - case wxDOT : - m_count = WXSIZEOF(dotted); - m_userLengths = new double[ m_count ] ; - memcpy( m_userLengths, dotted, sizeof(dotted) ); - m_lengths = m_userLengths; - break; - - case wxLONG_DASH : - m_lengths = dotted ; - m_count = WXSIZEOF(dashed); - break; - - case wxSHORT_DASH : - m_lengths = dotted ; - m_count = WXSIZEOF(short_dashed); - break; - - case wxDOT_DASH : - m_lengths = dotted ; - m_count = WXSIZEOF(dotted_dashed); - break; - - case wxUSER_DASH : - { - wxDash *wxdashes ; - m_count = m_pen.GetDashes( &wxdashes ) ; - if ((wxdashes != NULL) && (m_count > 0)) - { - m_userLengths = new double[m_count] ; - for ( int i = 0 ; i < m_count ; ++i ) - { - m_userLengths[i] = wxdashes[i] * dashUnit ; - - if ( i % 2 == 1 && m_userLengths[i] < dashUnit + 2.0 ) - m_userLengths[i] = dashUnit + 2.0 ; - else if ( i % 2 == 0 && m_userLengths[i] < dashUnit ) - m_userLengths[i] = dashUnit ; - } - } - m_lengths = m_userLengths ; - } - break; - case wxSTIPPLE : - { - /* - wxBitmap* bmp = pen.GetStipple(); - if ( bmp && bmp->Ok() ) - { - wxDELETE( m_penImage ); - wxDELETE( m_penBrush ); - m_penImage = Bitmap::FromHBITMAP((HBITMAP)bmp->GetHBITMAP(),(HPALETTE)bmp->GetPalette()->GetHPALETTE()); - m_penBrush = new TextureBrush(m_penImage); - m_pen->SetBrush( m_penBrush ); - } - */ - } - break; - default : - if ( m_pen.GetStyle() >= wxFIRST_HATCH && m_pen.GetStyle() <= wxLAST_HATCH ) - { - /* - wxDELETE( m_penBrush ); - HatchStyle style = HatchStyleHorizontal; - switch( pen.GetStyle() ) - { - case wxBDIAGONAL_HATCH : - style = HatchStyleBackwardDiagonal; - break ; - case wxCROSSDIAG_HATCH : - style = HatchStyleDiagonalCross; - break ; - case wxFDIAGONAL_HATCH : - style = HatchStyleForwardDiagonal; - break ; - case wxCROSS_HATCH : - style = HatchStyleCross; - break ; - case wxHORIZONTAL_HATCH : - style = HatchStyleHorizontal; - break ; - case wxVERTICAL_HATCH : - style = HatchStyleVertical; - break ; - - } - m_penBrush = new HatchBrush(style,Color( pen.GetColour().Alpha() , pen.GetColour().Red() , - pen.GetColour().Green() , pen.GetColour().Blue() ), Color.Transparent ); - m_pen->SetBrush( m_penBrush ) - */ - } - break; - } -} - -void wxCairoPenData::Apply( wxGraphicsContext* context ) -{ - cairo_t * ctext = (cairo_t*) context->GetNativeContext(); - cairo_set_line_width(ctext,m_width); - cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); - cairo_set_line_cap(ctext,m_cap); - cairo_set_line_join(ctext,m_join); - cairo_set_dash(ctext,(double*)m_lengths,m_count,0.0); -} - -//----------------------------------------------------------------------------- -// wxCairoBrushData implementation -//----------------------------------------------------------------------------- - -wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer ) - : wxGraphicsObjectRefData( renderer ) -{ - Init(); -} - -wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, const wxBrush &brush ) - : wxGraphicsObjectRefData(renderer) -{ - Init(); - - m_red = brush.GetColour().Red()/255.0; - m_green = brush.GetColour().Green()/255.0; - m_blue = brush.GetColour().Blue()/255.0; - m_alpha = brush.GetColour().Alpha()/255.0; - /* - if ( brush.GetStyle() == wxSOLID) - { - m_brush = new SolidBrush( Color( brush.GetColour().Alpha() , brush.GetColour().Red() , - brush.GetColour().Green() , brush.GetColour().Blue() ) ); - } - else if ( brush.IsHatch() ) - { - HatchStyle style = HatchStyleHorizontal; - switch( brush.GetStyle() ) - { - case wxBDIAGONAL_HATCH : - style = HatchStyleBackwardDiagonal; - break ; - case wxCROSSDIAG_HATCH : - style = HatchStyleDiagonalCross; - break ; - case wxFDIAGONAL_HATCH : - style = HatchStyleForwardDiagonal; - break ; - case wxCROSS_HATCH : - style = HatchStyleCross; - break ; - case wxHORIZONTAL_HATCH : - style = HatchStyleHorizontal; - break ; - case wxVERTICAL_HATCH : - style = HatchStyleVertical; - break ; - - } - m_brush = new HatchBrush(style,Color( brush.GetColour().Alpha() , brush.GetColour().Red() , - brush.GetColour().Green() , brush.GetColour().Blue() ), Color.Transparent ); - } - else - { - wxBitmap* bmp = brush.GetStipple(); - if ( bmp && bmp->Ok() ) - { - wxDELETE( m_brushImage ); - m_brushImage = Bitmap::FromHBITMAP((HBITMAP)bmp->GetHBITMAP(),(HPALETTE)bmp->GetPalette()->GetHPALETTE()); - m_brush = new TextureBrush(m_brushImage); - } - } - */ -} - -wxCairoBrushData::~wxCairoBrushData () -{ - if (m_brushPattern) - cairo_pattern_destroy(m_brushPattern); -} - -void wxCairoBrushData::Apply( wxGraphicsContext* context ) -{ - cairo_t * ctext = (cairo_t*) context->GetNativeContext(); - if ( m_brushPattern ) - { - cairo_set_source(ctext,m_brushPattern); - } - else - { - cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); - } -} - -void wxCairoBrushData::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2 ) -{ - m_brushPattern = cairo_pattern_create_linear(x1,y1,x2,y2); - cairo_pattern_add_color_stop_rgba(m_brushPattern,0.0,c1.Red()/255.0, - c1.Green()/255.0, c1.Blue()/255.0,c1.Alpha()/255.0); - cairo_pattern_add_color_stop_rgba(m_brushPattern,1.0,c2.Red()/255.0, - c2.Green()/255.0, c2.Blue()/255.0,c2.Alpha()/255.0); - wxASSERT_MSG(cairo_pattern_status(m_brushPattern) == CAIRO_STATUS_SUCCESS, wxT("Couldn't create cairo pattern")); -} - -void wxCairoBrushData::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor ) -{ - m_brushPattern = cairo_pattern_create_radial(xo,yo,0.0,xc,yc,radius); - cairo_pattern_add_color_stop_rgba(m_brushPattern,0.0,oColor.Red()/255.0, - oColor.Green()/255.0, oColor.Blue()/255.0,oColor.Alpha()/255.0); - cairo_pattern_add_color_stop_rgba(m_brushPattern,1.0,cColor.Red()/255.0, - cColor.Green()/255.0, cColor.Blue()/255.0,cColor.Alpha()/255.0); - wxASSERT_MSG(cairo_pattern_status(m_brushPattern) == CAIRO_STATUS_SUCCESS, wxT("Couldn't create cairo pattern")); -} - -void wxCairoBrushData::Init() -{ - m_brushPattern = NULL; -} - -//----------------------------------------------------------------------------- -// wxCairoFontData implementation -//----------------------------------------------------------------------------- - -wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, - const wxColour& col ) : wxGraphicsObjectRefData(renderer) -{ - m_red = col.Red()/255.0; - m_green = col.Green()/255.0; - m_blue = col.Blue()/255.0; - m_alpha = col.Alpha()/255.0; - - m_size = font.GetPointSize(); - m_fontName = font.GetFaceName().mb_str(wxConvUTF8); - m_slant = font.GetStyle() == wxFONTSTYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC:CAIRO_FONT_SLANT_NORMAL; - m_weight = font.GetWeight() == wxFONTWEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD:CAIRO_FONT_WEIGHT_NORMAL; -} - -wxCairoFontData::~wxCairoFontData() -{ -} - -void wxCairoFontData::Apply( wxGraphicsContext* context ) -{ - cairo_t * ctext = (cairo_t*) context->GetNativeContext(); - cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); - cairo_select_font_face(ctext,m_fontName,m_slant,m_weight); - cairo_set_font_size(ctext,m_size); - // TODO UNDERLINE - // TODO FIX SIZE -} - -//----------------------------------------------------------------------------- -// wxCairoPathData implementation -//----------------------------------------------------------------------------- - -wxCairoPathData::wxCairoPathData( wxGraphicsRenderer* renderer, cairo_t* pathcontext) - : wxGraphicsPathData(renderer) -{ - if (pathcontext) - { - m_pathContext = pathcontext; - } - else - { - cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,1,1); - m_pathContext = cairo_create(surface); - cairo_surface_destroy (surface); - } -} - -wxCairoPathData::~wxCairoPathData() -{ - cairo_destroy(m_pathContext); -} - -wxGraphicsObjectRefData *wxCairoPathData::Clone() const -{ - cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,1,1); - cairo_t* pathcontext = cairo_create(surface); - cairo_surface_destroy (surface); - - cairo_path_t* path = cairo_copy_path(m_pathContext); - cairo_append_path(pathcontext, path); - cairo_path_destroy(path); - return new wxCairoPathData( GetRenderer() ,pathcontext); -} - - -void* wxCairoPathData::GetNativePath() const -{ - return cairo_copy_path(m_pathContext) ; -} - -void wxCairoPathData::UnGetNativePath(void *p) const -{ - cairo_path_destroy((cairo_path_t*)p); -} - -// -// The Primitives -// - -void wxCairoPathData::MoveToPoint( wxDouble x , wxDouble y ) -{ - cairo_move_to(m_pathContext,x,y); -} - -void wxCairoPathData::AddLineToPoint( wxDouble x , wxDouble y ) -{ - cairo_line_to(m_pathContext,x,y); -} - -void wxCairoPathData::AddPath( const wxGraphicsPathData* path ) -{ - cairo_path_t* p = (cairo_path_t*)path->GetNativePath(); - cairo_append_path(m_pathContext, p); - UnGetNativePath(p); -} - -void wxCairoPathData::CloseSubpath() -{ - cairo_close_path(m_pathContext); -} - -void wxCairoPathData::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) -{ - cairo_curve_to(m_pathContext,cx1,cy1,cx2,cy2,x,y); -} - -// gets the last point of the current path, (0,0) if not yet set -void wxCairoPathData::GetCurrentPoint( wxDouble* x, wxDouble* y) const -{ - double dx,dy; - cairo_get_current_point(m_pathContext,&dx,&dy); - if (x) - *x = dx; - if (y) - *y = dy; -} - -void wxCairoPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, double startAngle, double endAngle, bool clockwise ) -{ - // as clockwise means positive in our system (y pointing downwards) - // TODO make this interpretation dependent of the - // real device trans - if ( clockwise||(endAngle-startAngle)>=2*M_PI) - cairo_arc(m_pathContext,x,y,r,startAngle,endAngle); - else - cairo_arc_negative(m_pathContext,x,y,r,startAngle,endAngle); -} - -// transforms each point of this path by the matrix -void wxCairoPathData::Transform( const wxGraphicsMatrixData* matrix ) -{ - // as we don't have a true path object, we have to apply the inverse - // matrix to the context - cairo_matrix_t m = *((cairo_matrix_t*) matrix->GetNativeMatrix()); - cairo_matrix_invert( &m ); - cairo_transform(m_pathContext,&m); -} - -// gets the bounding box enclosing all points (possibly including control points) -void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const -{ - double x1,y1,x2,y2; - - cairo_stroke_extents( m_pathContext, &x1, &y1, &x2, &y2 ); - if ( x2 < x1 ) - { - *x = x2; - *w = x1-x2; - } - else - { - *x = x1; - *w = x2-x1; - } - - if( y2 < y1 ) - { - *y = y2; - *h = y1-y2; - } - else - { - *y = y1; - *h = y2-y1; - } -} - -bool wxCairoPathData::Contains( wxDouble x, wxDouble y, int fillStyle ) const -{ - return cairo_in_stroke( m_pathContext, x, y) != 0; -} - -//----------------------------------------------------------------------------- -// wxCairoMatrixData implementation -//----------------------------------------------------------------------------- - -wxCairoMatrixData::wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_matrix_t* matrix ) - : wxGraphicsMatrixData(renderer) -{ - if ( matrix ) - m_matrix = *matrix; -} - -wxCairoMatrixData::~wxCairoMatrixData() -{ - // nothing to do -} - -wxGraphicsObjectRefData *wxCairoMatrixData::Clone() const -{ - return new wxCairoMatrixData(GetRenderer(),&m_matrix); -} - -// concatenates the matrix -void wxCairoMatrixData::Concat( const wxGraphicsMatrixData *t ) -{ - cairo_matrix_multiply( &m_matrix, &m_matrix, (cairo_matrix_t*) t->GetNativeMatrix()); -} - -// sets the matrix to the respective values -void wxCairoMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, - wxDouble tx, wxDouble ty) -{ - cairo_matrix_init( &m_matrix, a, b, c, d, tx, ty); -} - -// gets the component valuess of the matrix -void wxCairoMatrixData::Get(wxDouble* a, wxDouble* b, wxDouble* c, - wxDouble* d, wxDouble* tx, wxDouble* ty) const -{ - if (a) *a = m_matrix.xx; - if (b) *b = m_matrix.yx; - if (c) *c = m_matrix.xy; - if (d) *d = m_matrix.yy; - if (tx) *tx= m_matrix.x0; - if (ty) *ty= m_matrix.y0; -} - -// makes this the inverse matrix -void wxCairoMatrixData::Invert() -{ - cairo_matrix_invert( &m_matrix ); -} - -// returns true if the elements of the transformation matrix are equal ? -bool wxCairoMatrixData::IsEqual( const wxGraphicsMatrixData* t) const -{ - const cairo_matrix_t* tm = (cairo_matrix_t*) t->GetNativeMatrix(); - return ( - m_matrix.xx == tm->xx && - m_matrix.yx == tm->yx && - m_matrix.xy == tm->xy && - m_matrix.yy == tm->yy && - m_matrix.x0 == tm->x0 && - m_matrix.y0 == tm->y0 ) ; -} - -// return true if this is the identity matrix -bool wxCairoMatrixData::IsIdentity() const -{ - return ( m_matrix.xx == 1 && m_matrix.yy == 1 && - m_matrix.yx == 0 && m_matrix.xy == 0 && m_matrix.x0 == 0 && m_matrix.y0 == 0); -} - -// -// transformation -// - -// add the translation to this matrix -void wxCairoMatrixData::Translate( wxDouble dx , wxDouble dy ) -{ - cairo_matrix_translate( &m_matrix, dx, dy) ; -} - -// add the scale to this matrix -void wxCairoMatrixData::Scale( wxDouble xScale , wxDouble yScale ) -{ - cairo_matrix_scale( &m_matrix, xScale, yScale) ; -} - -// add the rotation to this matrix (radians) -void wxCairoMatrixData::Rotate( wxDouble angle ) -{ - cairo_matrix_rotate( &m_matrix, angle) ; -} - -// -// apply the transforms -// - -// applies that matrix to the point -void wxCairoMatrixData::TransformPoint( wxDouble *x, wxDouble *y ) const -{ - double lx = *x, ly = *y ; - cairo_matrix_transform_point( &m_matrix, &lx, &ly); - *x = lx; - *y = ly; -} - -// applies the matrix except for translations -void wxCairoMatrixData::TransformDistance( wxDouble *dx, wxDouble *dy ) const -{ - double lx = *dx, ly = *dy ; - cairo_matrix_transform_distance( &m_matrix, &lx, &ly); - *dx = lx; - *dy = ly; -} - -// returns the native representation -void * wxCairoMatrixData::GetNativeMatrix() const -{ - return (void*) &m_matrix; -} - -//----------------------------------------------------------------------------- -// wxCairoBitmap implementation -//----------------------------------------------------------------------------- - -wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsObjectRefData( renderer ) -{ - wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap")); - - int bw = m_width = bmp.GetWidth(); - int bh = m_height = bmp.GetHeight(); - wxBitmap bmpSource = bmp; // we need a non-const instance - m_buffer = new unsigned char[bw*bh*4]; - wxUint32* data = (wxUint32*)m_buffer; - - // Create a surface object and copy the bitmap pixel data to it. if the - // image has alpha (or a mask represented as alpha) then we'll use a - // different format and iterator than if it doesn't... - if (bmpSource.HasAlpha() || bmpSource.GetMask()) - { - m_surface = cairo_image_surface_create_for_data( - m_buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4); - wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh)); - wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data.")); - - wxAlphaPixelData::Iterator p(pixData); - for (int y=0; ym_wxwindow; - - // Some controls don't have m_wxwindow - like wxStaticBox, but the user - // code should still be able to create wxClientDCs for them, so we will - // use the parent window here then. - if ( !widget ) - { - window = window->GetParent(); - widget = window->m_wxwindow; - } - - wxASSERT_MSG( widget, wxT("wxCairoContext needs a widget") ); - - GtkPizza *pizza = GTK_PIZZA( widget ); - GdkDrawable* drawable = pizza->bin_window; - m_context = gdk_cairo_create( drawable ) ; -#endif -#ifdef __WXMSW__ - m_mswSurface = cairo_win32_surface_create((HDC)window->GetHandle()); - m_context = cairo_create(m_mswSurface); -#endif - PushState(); - PushState(); -} - -wxCairoContext::~wxCairoContext() -{ - if ( m_context ) - { - PopState(); - PopState(); - cairo_destroy(m_context); - } -#ifdef __WXMSW__ - if ( m_mswSurface ) - cairo_surface_destroy(m_mswSurface); -#endif -} - - -void wxCairoContext::Clip( const wxRegion& region ) -{ - // Create a path with all the rectangles in the region - wxGraphicsPath path = GetRenderer()->CreatePath(); - wxRegionIterator ri(region); - while (ri) - { - path.AddRectangle(ri.GetX(), ri.GetY(), ri.GetW(), ri.GetH()); - ri++; - } - - // Put it in the context - cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; - cairo_append_path(m_context, cp); - - // clip to that path - cairo_clip(m_context); - path.UnGetNativePath(cp); -} - -void wxCairoContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - // Create a path with this rectangle - wxGraphicsPath path = GetRenderer()->CreatePath(); - path.AddRectangle(x,y,w,h); - - // Put it in the context - cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; - cairo_append_path(m_context, cp); - - // clip to that path - cairo_clip(m_context); - path.UnGetNativePath(cp); -} - -void wxCairoContext::ResetClip() -{ - cairo_reset_clip(m_context); -} - - -void wxCairoContext::StrokePath( const wxGraphicsPath& path ) -{ - if ( !m_pen.IsNull() ) - { - cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; - cairo_append_path(m_context,cp); - ((wxCairoPenData*)m_pen.GetRefData())->Apply(this); - cairo_stroke(m_context); - path.UnGetNativePath(cp); - } -} - -void wxCairoContext::FillPath( const wxGraphicsPath& path , int fillStyle ) -{ - if ( !m_brush.IsNull() ) - { - cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; - cairo_append_path(m_context,cp); - ((wxCairoBrushData*)m_brush.GetRefData())->Apply(this); - cairo_set_fill_rule(m_context,fillStyle==wxODDEVEN_RULE ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - cairo_fill(m_context); - path.UnGetNativePath(cp); - } -} - -void wxCairoContext::Rotate( wxDouble angle ) -{ - cairo_rotate(m_context,angle); -} - -void wxCairoContext::Translate( wxDouble dx , wxDouble dy ) -{ - cairo_translate(m_context,dx,dy); -} - -void wxCairoContext::Scale( wxDouble xScale , wxDouble yScale ) -{ - cairo_scale(m_context,xScale,yScale); -} - -// concatenates this transform with the current transform of this context -void wxCairoContext::ConcatTransform( const wxGraphicsMatrix& matrix ) -{ - cairo_transform(m_context,(const cairo_matrix_t *) matrix.GetNativeMatrix()); -} - -// sets the transform of this context -void wxCairoContext::SetTransform( const wxGraphicsMatrix& matrix ) -{ - cairo_set_matrix(m_context,(const cairo_matrix_t*) matrix.GetNativeMatrix()); -} - -// gets the matrix of this context -wxGraphicsMatrix wxCairoContext::GetTransform() const -{ - wxGraphicsMatrix matrix = CreateMatrix(); - cairo_get_matrix(m_context,(cairo_matrix_t*) matrix.GetNativeMatrix()); - return matrix; -} - - - -void wxCairoContext::PushState() -{ - cairo_save(m_context); -} - -void wxCairoContext::PopState() -{ - cairo_restore(m_context); -} - -void wxGraphicsContext::DrawGraphicsBitmap(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) -{ - static_cast(this)->DrawGraphicsBitmapInternal(bmp, x, y, w, h); -} - -void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp); - DrawGraphicsBitmapInternal(bitmap, x, y, w, h); -} - -void wxCairoContext::DrawGraphicsBitmapInternal(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - wxCairoBitmapData* data = static_cast(bmp.GetRefData()); - cairo_pattern_t* pattern = data->GetCairoPattern(); - wxSize size = data->GetSize(); - PushState(); - - // prepare to draw the image - cairo_translate(m_context, x, y); - // In case we're scaling the image by using a width and height different - // than the bitmap's size create a pattern transformation on the surface and - // draw the transformed pattern. - wxDouble scaleX = w / size.GetWidth(); - wxDouble scaleY = h / size.GetHeight(); - cairo_scale(m_context, scaleX, scaleY); - cairo_set_source(m_context, pattern); - // use the original size here since the context is scaled already... - cairo_rectangle(m_context, 0, 0, size.GetWidth(), size.GetHeight()); - // fill the rectangle using the pattern - cairo_fill(m_context); - - // clean up - PopState(); -} - -void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) -{ - // An icon is a bitmap on wxGTK, so do this the easy way. When we want to - // start using the Cairo backend on other platforms then we may need to - // fiddle with this... - DrawBitmap(icon, x, y, w, h); -} - - -void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) -{ - wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::DrawText - no valid font set") ); - - if ( str.empty()) - return; - - ((wxCairoFontData*)m_font.GetRefData())->Apply(this); - - // Cairo's x,y for drawing text is at the baseline, so we need to adjust - // the position we move to by the ascent. - cairo_font_extents_t fe; - cairo_font_extents(m_context, &fe); - cairo_move_to(m_context, x, y+fe.ascent); - - const wxWX2MBbuf buf(str.mb_str(wxConvUTF8)); - cairo_show_text(m_context,buf); -} - -void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const -{ - wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") ); - - if ( str.empty()) - return; - - ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this); - - if (width) - { - const wxWX2MBbuf buf(str.mb_str(wxConvUTF8)); - cairo_text_extents_t te; - cairo_text_extents(m_context, buf, &te); - *width = te.width; - } - - if (height || descent || externalLeading) - { - cairo_font_extents_t fe; - cairo_font_extents(m_context, &fe); - - if (height) - *height = fe.height; - if ( descent ) - *descent = fe.descent; - if ( externalLeading ) - *externalLeading = wxMax(0, fe.height - (fe.ascent + fe.descent)); - } -} - -void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const -{ - widths.Empty(); - widths.Add(0, text.length()); - - wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") ); - - if (text.empty()) - return; - - // TODO -} - -void * wxCairoContext::GetNativeContext() -{ - return m_context; -} - -//----------------------------------------------------------------------------- -// wxCairoRenderer declaration -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxCairoRenderer : public wxGraphicsRenderer -{ -public : - wxCairoRenderer() {} - - virtual ~wxCairoRenderer() {} - - // Context - - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc); - -#ifdef __WXMSW__ - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); -#endif - - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); - - virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); - - virtual wxGraphicsContext * CreateContext( wxWindow* window ); - - virtual wxGraphicsContext * CreateMeasuringContext(); - - // Path - - virtual wxGraphicsPath CreatePath(); - - // Matrix - - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); - - - virtual wxGraphicsPen CreatePen(const wxPen& pen) ; - - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ; - - // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 - virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) ; - - // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) - // with radius r and color cColor - virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) ; - - // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ; - - wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ; - -private : - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer) -} ; - -//----------------------------------------------------------------------------- -// wxCairoRenderer implementation -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer) - -static wxCairoRenderer gs_cairoGraphicsRenderer; - -#ifdef __WXGTK__ -wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() -{ - return &gs_cairoGraphicsRenderer; -} -#endif - -wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc) -{ - return new wxCairoContext(this,dc); -} - -#ifdef __WXMSW__ -wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) -{ - return NULL; -} -#endif - -wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context ) -{ -#if __WXMSW__ - return new wxCairoContext(this,(HDC)context); -#endif -#if __WXGTK__ - return new wxCairoContext(this,(cairo_t*)context); -#endif -} - - -wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeWindow( void * window ) -{ -#ifdef __WXGTK__ - return new wxCairoContext(this,(GdkDrawable*)window); -#else - return NULL; -#endif -} - -wxGraphicsContext * wxCairoRenderer::CreateMeasuringContext() -{ -#ifdef __WXGTK__ - return CreateContextFromNativeWindow(gdk_get_default_root_window()); -#endif - return NULL; - // TODO -} - -wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) -{ - return new wxCairoContext(this, window ); -} - -// Path - -wxGraphicsPath wxCairoRenderer::CreatePath() -{ - wxGraphicsPath path; - path.SetRefData( new wxCairoPathData(this) ); - return path; -} - - -// Matrix - -wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d, - wxDouble tx, wxDouble ty) - -{ - wxGraphicsMatrix m; - wxCairoMatrixData* data = new wxCairoMatrixData( this ); - data->Set( a,b,c,d,tx,ty ) ; - m.SetRefData(data); - return m; -} - -wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) -{ - if ( !pen.Ok() || pen.GetStyle() == wxTRANSPARENT ) - return wxNullGraphicsPen; - else - { - wxGraphicsPen p; - p.SetRefData(new wxCairoPenData( this, pen )); - return p; - } -} - -wxGraphicsBrush wxCairoRenderer::CreateBrush(const wxBrush& brush ) -{ - if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT ) - return wxNullGraphicsBrush; - else - { - wxGraphicsBrush p; - p.SetRefData(new wxCairoBrushData( this, brush )); - return p; - } -} - -// sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 -wxGraphicsBrush wxCairoRenderer::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) -{ - wxGraphicsBrush p; - wxCairoBrushData* d = new wxCairoBrushData( this ); - d->CreateLinearGradientBrush(x1, y1, x2, y2, c1, c2); - p.SetRefData(d); - return p; -} - -// sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) -// with radius r and color cColor -wxGraphicsBrush wxCairoRenderer::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) -{ - wxGraphicsBrush p; - wxCairoBrushData* d = new wxCairoBrushData( this ); - d->CreateRadialGradientBrush(xo,yo,xc,yc,radius,oColor,cColor); - p.SetRefData(d); - return p; -} - -// sets the font -wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour &col ) -{ - if ( font.Ok() ) - { - wxGraphicsFont p; - p.SetRefData(new wxCairoFontData( this , font, col )); - return p; - } - else - return wxNullGraphicsFont; -} - -wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap( const wxBitmap& bmp ) -{ - if ( bmp.Ok() ) - { - wxGraphicsBitmap p; - p.SetRefData(new wxCairoBitmapData( this , bmp )); - return p; - } - else - return wxNullGraphicsBitmap; -} - -#endif // wxUSE_CAIRO - -wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() -{ -#if wxUSE_CAIRO - return &gs_cairoGraphicsRenderer; -#else - return NULL; -#endif -} - -#endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Source/3rdParty/wx/src/generic/listbkg.cpp b/Source/3rdParty/wx/src/generic/listbkg.cpp deleted file mode 100644 index 50a6ea40e..000000000 --- a/Source/3rdParty/wx/src/generic/listbkg.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/listbkg.cpp -// Purpose: generic implementation of wxListbook -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: listbkg.cpp 48783 2007-09-19 11:24:38Z RR $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_LISTBOOK - -#include "wx/listbook.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" -#endif - -#include "wx/listctrl.h" -#include "wx/statline.h" -#include "wx/imaglist.h" - -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent) - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES -const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType(); -const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType(); -#endif - -BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase) - EVT_SIZE(wxListbook::OnSize) - EVT_LIST_ITEM_SELECTED(wxID_ANY, wxListbook::OnListSelected) -END_EVENT_TABLE() - -// ============================================================================ -// wxListbook implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxListbook creation -// ---------------------------------------------------------------------------- - -void wxListbook::Init() -{ - m_selection = wxNOT_FOUND; -} - -bool -wxListbook::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) - { -#ifdef __WXMAC__ - style |= wxBK_TOP; -#else // !__WXMAC__ - style |= wxBK_LEFT; -#endif // __WXMAC__/!__WXMAC__ - } - - // no border for this control, it doesn't look nice together with - // wxListCtrl border - style &= ~wxBORDER_MASK; - style |= wxBORDER_NONE; - - if ( !wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - return false; - - m_bookctrl = new wxListView - ( - this, - wxID_ANY, - wxDefaultPosition, - wxDefaultSize, - wxLC_ICON | wxLC_SINGLE_SEL | - (IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP) - ); - -#ifdef __WXMSW__ - // On XP with themes enabled the GetViewRect used in GetControllerSize() to - // determine the space needed for the list view will incorrectly return - // (0,0,0,0) the first time. So send a pending event so OnSize will be - // called again after the window is ready to go. Technically we don't - // need to do this on non-XP windows, but if things are already sized - // correctly then nothing changes and so there is no harm. - wxSizeEvent evt; - GetEventHandler()->AddPendingEvent(evt); -#endif - return true; -} - -// ---------------------------------------------------------------------------- -// wxListbook geometry management -// ---------------------------------------------------------------------------- - -wxSize wxListbook::GetControllerSize() const -{ - const wxSize sizeClient = GetClientSize(), - sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), - sizeList = GetListView()->GetViewRect().GetSize() + sizeBorder; - - wxSize size; - - if ( IsVertical() ) - { - size.x = sizeClient.x; - size.y = sizeList.y; - } - else // left/right aligned - { - size.x = sizeList.x; - size.y = sizeClient.y; - } - - return size; -} - -void wxListbook::OnSize(wxSizeEvent& event) -{ - // arrange the icons before calling SetClientSize(), otherwise it wouldn't - // account for the scrollbars the list control might need and, at least - // under MSW, we'd finish with an ugly looking list control with both - // vertical and horizontal scrollbar (with one of them being added because - // the other one is not accounted for in client size computations) - wxListView *list = GetListView(); - if (list) list->Arrange(); - wxBookCtrlBase::OnSize(event); -} - -int wxListbook::HitTest(const wxPoint& pt, long *flags) const -{ - int pagePos = wxNOT_FOUND; - - if ( flags ) - *flags = wxBK_HITTEST_NOWHERE; - - // convert from listbook control coordinates to list control coordinates - const wxListView * const list = GetListView(); - const wxPoint listPt = list->ScreenToClient(ClientToScreen(pt)); - - // is the point inside list control? - if ( wxRect(list->GetSize()).Contains(listPt) ) - { - int flagsList; - pagePos = list->HitTest(listPt, flagsList); - - if ( flags ) - { - if ( pagePos != wxNOT_FOUND ) - *flags = 0; - - if ( flagsList & (wxLIST_HITTEST_ONITEMICON | - wxLIST_HITTEST_ONITEMSTATEICON ) ) - *flags |= wxBK_HITTEST_ONICON; - - if ( flagsList & wxLIST_HITTEST_ONITEMLABEL ) - *flags |= wxBK_HITTEST_ONLABEL; - } - } - else // not over list control at all - { - if ( flags && GetPageRect().Contains(pt) ) - *flags |= wxBK_HITTEST_ONPAGE; - } - - return pagePos; -} - -wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const -{ - // we need to add the size of the list control and the border between - const wxSize sizeList = GetControllerSize(); - - wxSize size = sizePage; - if ( IsVertical() ) - { - size.y += sizeList.y + GetInternalBorder(); - } - else // left/right aligned - { - size.x += sizeList.x + GetInternalBorder(); - } - - return size; -} - - -// ---------------------------------------------------------------------------- -// accessing the pages -// ---------------------------------------------------------------------------- - -bool wxListbook::SetPageText(size_t n, const wxString& strText) -{ - GetListView()->SetItemText(n, strText); - - return true; -} - -wxString wxListbook::GetPageText(size_t n) const -{ - return GetListView()->GetItemText(n); -} - -int wxListbook::GetPageImage(size_t WXUNUSED(n)) const -{ - wxFAIL_MSG( _T("wxListbook::GetPageImage() not implemented") ); - - return wxNOT_FOUND; -} - -bool wxListbook::SetPageImage(size_t n, int imageId) -{ - return GetListView()->SetItemImage(n, imageId); -} - -// ---------------------------------------------------------------------------- -// image list stuff -// ---------------------------------------------------------------------------- - -void wxListbook::SetImageList(wxImageList *imageList) -{ - GetListView()->SetImageList(imageList, wxIMAGE_LIST_NORMAL); - - wxBookCtrlBase::SetImageList(imageList); -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -void wxListbook::UpdateSelectedPage(size_t newsel) -{ - m_selection = newsel; - GetListView()->Select(newsel); - GetListView()->Focus(newsel); -} - -int wxListbook::GetSelection() const -{ - return m_selection; -} - -wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const -{ - return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); -} - -void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) -{ - event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED); -} - - -// ---------------------------------------------------------------------------- -// adding/removing the pages -// ---------------------------------------------------------------------------- - -bool -wxListbook::InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) - return false; - - GetListView()->InsertItem(n, text, imageId); - - // if the inserted page is before the selected one, we must update the - // index of the selected page - if ( int(n) <= m_selection ) - { - // one extra page added - m_selection++; - GetListView()->Select(m_selection); - GetListView()->Focus(m_selection); - } - - // some page should be selected: either this one or the first one if there - // is still no selection - int selNew = -1; - if ( bSelect ) - selNew = n; - else if ( m_selection == -1 ) - selNew = 0; - - if ( selNew != m_selection ) - page->Hide(); - - if ( selNew != -1 ) - SetSelection(selNew); - - wxSizeEvent sz(GetSize(), GetId()); - GetEventHandler()->ProcessEvent(sz); - - return true; -} - -wxWindow *wxListbook::DoRemovePage(size_t page) -{ - const size_t page_count = GetPageCount(); - wxWindow *win = wxBookCtrlBase::DoRemovePage(page); - - if ( win ) - { - GetListView()->DeleteItem(page); - - if (m_selection >= (int)page) - { - // force new sel valid if possible - int sel = m_selection - 1; - if (page_count == 1) - sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == -1)) - sel = 0; - - // force sel invalid if deleting current page - don't try to hide it - m_selection = (m_selection == (int)page) ? wxNOT_FOUND : m_selection - 1; - - if ((sel != wxNOT_FOUND) && (sel != m_selection)) - SetSelection(sel); - } - - GetListView()->Arrange(); - if (GetPageCount() == 0) - { - wxSizeEvent sz(GetSize(), GetId()); - ProcessEvent(sz); - } - } - - return win; -} - - -bool wxListbook::DeleteAllPages() -{ - GetListView()->DeleteAllItems(); - if (!wxBookCtrlBase::DeleteAllPages()) - return false; - - m_selection = -1; - - wxSizeEvent sz(GetSize(), GetId()); - ProcessEvent(sz); - - return true; -} - -// ---------------------------------------------------------------------------- -// wxListbook events -// ---------------------------------------------------------------------------- - -void wxListbook::OnListSelected(wxListEvent& eventList) -{ - if ( eventList.GetEventObject() != m_bookctrl ) - { - eventList.Skip(); - return; - } - - const int selNew = eventList.GetIndex(); - - if ( selNew == m_selection ) - { - // this event can only come from our own Select(m_selection) below - // which we call when the page change is vetoed, so we should simply - // ignore it - return; - } - - SetSelection(selNew); - - // change wasn't allowed, return to previous state - if (m_selection != selNew) - { - GetListView()->Select(m_selection); - GetListView()->Focus(m_selection); - } -} - -#endif // wxUSE_LISTBOOK diff --git a/Source/3rdParty/wx/src/generic/logg.cpp b/Source/3rdParty/wx/src/generic/logg.cpp deleted file mode 100644 index e370dc4ea..000000000 --- a/Source/3rdParty/wx/src/generic/logg.cpp +++ /dev/null @@ -1,1229 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/logg.cpp -// Purpose: wxLog-derived classes which need GUI support (the rest is in -// src/common/log.cpp) -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.99 (extracted from src/common/log.cpp) -// RCS-ID: $Id: logg.cpp 43078 2006-11-04 23:46:02Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/button.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/menu.h" - #include "wx/frame.h" - #include "wx/filedlg.h" - #include "wx/msgdlg.h" - #include "wx/textctrl.h" - #include "wx/sizer.h" - #include "wx/statbmp.h" - #include "wx/settings.h" -#endif // WX_PRECOMP - -#if wxUSE_LOGGUI || wxUSE_LOGWINDOW - -#include "wx/file.h" -#include "wx/textfile.h" -#include "wx/statline.h" -#include "wx/artprov.h" - -#ifdef __WXMSW__ - // for OutputDebugString() - #include "wx/msw/private.h" -#endif // Windows - -#ifdef __WXPM__ - #include -#endif - -#if wxUSE_LOG_DIALOG - #include "wx/listctrl.h" - #include "wx/imaglist.h" - #include "wx/image.h" -#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG - -#if defined(__MWERKS__) && wxUSE_UNICODE - #include -#endif - -#include "wx/datetime.h" - -// the suffix we add to the button to show that the dialog can be expanded -#define EXPAND_SUFFIX _T(" >>") - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -#if wxUSE_LOG_DIALOG - -// this function is a wrapper around strftime(3) -// allows to exclude the usage of wxDateTime -static wxString TimeStamp(const wxChar *format, time_t t) -{ -#if wxUSE_DATETIME - wxChar buf[4096]; - struct tm tm; - if ( !wxStrftime(buf, WXSIZEOF(buf), format, wxLocaltime_r(&t, &tm)) ) - { - // buffer is too small? - wxFAIL_MSG(_T("strftime() failed")); - } - return wxString(buf); -#else // !wxUSE_DATETIME - return wxEmptyString; -#endif // wxUSE_DATETIME/!wxUSE_DATETIME -} - - -class wxLogDialog : public wxDialog -{ -public: - wxLogDialog(wxWindow *parent, - const wxArrayString& messages, - const wxArrayInt& severity, - const wxArrayLong& timess, - const wxString& caption, - long style); - virtual ~wxLogDialog(); - - // event handlers - void OnOk(wxCommandEvent& event); - void OnDetails(wxCommandEvent& event); -#if wxUSE_FILE - void OnSave(wxCommandEvent& event); -#endif // wxUSE_FILE - void OnListSelect(wxListEvent& event); - -private: - // create controls needed for the details display - void CreateDetailsControls(); - - // the data for the listctrl - wxArrayString m_messages; - wxArrayInt m_severity; - wxArrayLong m_times; - - // the "toggle" button and its state -#ifndef __SMARTPHONE__ - wxButton *m_btnDetails; -#endif - bool m_showingDetails; - - // the controls which are not shown initially (but only when details - // button is pressed) - wxListCtrl *m_listctrl; -#ifndef __SMARTPHONE__ -#if wxUSE_STATLINE - wxStaticLine *m_statline; -#endif // wxUSE_STATLINE -#if wxUSE_FILE - wxButton *m_btnSave; -#endif // wxUSE_FILE -#endif // __SMARTPHONE__ - - // the translated "Details" string - static wxString ms_details; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxLogDialog) -}; - -BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxLogDialog::OnOk) - EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails) -#if wxUSE_FILE - EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave) -#endif // wxUSE_FILE - EVT_LIST_ITEM_SELECTED(wxID_ANY, wxLogDialog::OnListSelect) -END_EVENT_TABLE() - -#endif // wxUSE_LOG_DIALOG - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -#if wxUSE_FILE && wxUSE_FILEDLG - -// pass an uninitialized file object, the function will ask the user for the -// filename and try to open it, returns true on success (file was opened), -// false if file couldn't be opened/created and -1 if the file selection -// dialog was cancelled -static int OpenLogFile(wxFile& file, wxString *filename = NULL, wxWindow *parent = NULL); - -#endif // wxUSE_FILE - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// we use a global variable to store the frame pointer for wxLogStatus - bad, -// but it's the easiest way -static wxFrame *gs_pFrame = NULL; // FIXME MT-unsafe - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// accepts an additional argument which tells to which frame the output should -// be directed -void wxVLogStatus(wxFrame *pFrame, const wxChar *szFormat, va_list argptr) -{ - wxString msg; - - wxLog *pLog = wxLog::GetActiveTarget(); - if ( pLog != NULL ) { - msg.PrintfV(szFormat, argptr); - - wxASSERT( gs_pFrame == NULL ); // should be reset! - gs_pFrame = pFrame; -#ifdef __WXWINCE__ - wxLog::OnLog(wxLOG_Status, msg, 0); -#else - wxLog::OnLog(wxLOG_Status, msg, time(NULL)); -#endif - gs_pFrame = (wxFrame *) NULL; - } -} - -void wxLogStatus(wxFrame *pFrame, const wxChar *szFormat, ...) -{ - va_list argptr; - va_start(argptr, szFormat); - wxVLogStatus(pFrame, szFormat, argptr); - va_end(argptr); -} - -// ---------------------------------------------------------------------------- -// wxLogGui implementation (FIXME MT-unsafe) -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGGUI - -wxLogGui::wxLogGui() -{ - Clear(); -} - -void wxLogGui::Clear() -{ - m_bErrors = - m_bWarnings = - m_bHasMessages = false; - - m_aMessages.Empty(); - m_aSeverity.Empty(); - m_aTimes.Empty(); -} - -void wxLogGui::Flush() -{ - if ( !m_bHasMessages ) - return; - - // do it right now to block any new calls to Flush() while we're here - m_bHasMessages = false; - - unsigned repeatCount = 0; - if ( wxLog::GetRepetitionCounting() ) - { - repeatCount = wxLog::DoLogNumberOfRepeats(); - } - - wxString appName = wxTheApp->GetAppName(); - if ( !appName.empty() ) - appName[0u] = (wxChar)wxToupper(appName[0u]); - - long style; - wxString titleFormat; - if ( m_bErrors ) { - titleFormat = _("%s Error"); - style = wxICON_STOP; - } - else if ( m_bWarnings ) { - titleFormat = _("%s Warning"); - style = wxICON_EXCLAMATION; - } - else { - titleFormat = _("%s Information"); - style = wxICON_INFORMATION; - } - - wxString title; - title.Printf(titleFormat, appName.c_str()); - - size_t nMsgCount = m_aMessages.Count(); - - // avoid showing other log dialogs until we're done with the dialog we're - // showing right now: nested modal dialogs make for really bad UI! - Suspend(); - - wxString str; - if ( nMsgCount == 1 ) - { - str = m_aMessages[0]; - } - else // more than one message - { -#if wxUSE_LOG_DIALOG - - if ( repeatCount > 0 ) - m_aMessages[nMsgCount-1] += wxString::Format(wxT(" (%s)"), m_aMessages[nMsgCount-2].c_str()); - wxLogDialog dlg(NULL, - m_aMessages, m_aSeverity, m_aTimes, - title, style); - - // clear the message list before showing the dialog because while it's - // shown some new messages may appear - Clear(); - - (void)dlg.ShowModal(); -#else // !wxUSE_LOG_DIALOG - // concatenate all strings (but not too many to not overfill the msg box) - size_t nLines = 0; - - // start from the most recent message - for ( size_t n = nMsgCount; n > 0; n-- ) { - // for Windows strings longer than this value are wrapped (NT 4.0) - const size_t nMsgLineWidth = 156; - - nLines += (m_aMessages[n - 1].Len() + nMsgLineWidth - 1) / nMsgLineWidth; - - if ( nLines > 25 ) // don't put too many lines in message box - break; - - str << m_aMessages[n - 1] << wxT("\n"); - } -#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG - } - - // this catches both cases of 1 message with wxUSE_LOG_DIALOG and any - // situation without it - if ( !str.empty() ) - { - wxMessageBox(str, title, wxOK | style); - - // no undisplayed messages whatsoever - Clear(); - } - - // allow flushing the logs again - Resume(); -} - -// log all kinds of messages -void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - switch ( level ) { - case wxLOG_Info: - if ( GetVerbose() ) - case wxLOG_Message: - { - m_aMessages.Add(szString); - m_aSeverity.Add(wxLOG_Message); - m_aTimes.Add((long)t); - m_bHasMessages = true; - } - break; - - case wxLOG_Status: -#if wxUSE_STATUSBAR - { - // find the top window and set it's status text if it has any - wxFrame *pFrame = gs_pFrame; - if ( pFrame == NULL ) { - wxWindow *pWin = wxTheApp->GetTopWindow(); - if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) { - pFrame = (wxFrame *)pWin; - } - } - - if ( pFrame && pFrame->GetStatusBar() ) - pFrame->SetStatusText(szString); - } -#endif // wxUSE_STATUSBAR - break; - - case wxLOG_Trace: - case wxLOG_Debug: - #ifdef __WXDEBUG__ - { - wxString str; - TimeStamp(&str); - str += szString; - - #if defined(__WXMSW__) && !defined(__WXMICROWIN__) - // don't prepend debug/trace here: it goes to the - // debug window anyhow - str += wxT("\r\n"); - OutputDebugString(str); - #else - // send them to stderr - wxFprintf(stderr, wxT("[%s] %s\n"), - level == wxLOG_Trace ? wxT("Trace") - : wxT("Debug"), - str.c_str()); - fflush(stderr); - #endif - } - #endif // __WXDEBUG__ - - break; - - case wxLOG_FatalError: - // show this one immediately - wxMessageBox(szString, _("Fatal error"), wxICON_HAND); - wxExit(); - break; - - case wxLOG_Error: - if ( !m_bErrors ) { -#if !wxUSE_LOG_DIALOG - // discard earlier informational messages if this is the 1st - // error because they might not make sense any more and showing - // them in a message box might be confusing - m_aMessages.Empty(); - m_aSeverity.Empty(); - m_aTimes.Empty(); -#endif // wxUSE_LOG_DIALOG - m_bErrors = true; - } - // fall through - - case wxLOG_Warning: - if ( !m_bErrors ) { - // for the warning we don't discard the info messages - m_bWarnings = true; - } - - m_aMessages.Add(szString); - m_aSeverity.Add((int)level); - m_aTimes.Add((long)t); - m_bHasMessages = true; - break; - } -} - -#endif // wxUSE_LOGGUI - -// ---------------------------------------------------------------------------- -// wxLogWindow and wxLogFrame implementation -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGWINDOW - -// log frame class -// --------------- -class wxLogFrame : public wxFrame -{ -public: - // ctor & dtor - wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxChar *szTitle); - virtual ~wxLogFrame(); - - // menu callbacks - void OnClose(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent& event); -#if wxUSE_FILE - void OnSave (wxCommandEvent& event); -#endif // wxUSE_FILE - void OnClear(wxCommandEvent& event); - - // accessors - wxTextCtrl *TextCtrl() const { return m_pTextCtrl; } - -private: - // use standard ids for our commands! - enum - { - Menu_Close = wxID_CLOSE, - Menu_Save = wxID_SAVE, - Menu_Clear = wxID_CLEAR - }; - - // common part of OnClose() and OnCloseWindow() - void DoClose(); - - wxTextCtrl *m_pTextCtrl; - wxLogWindow *m_log; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxLogFrame) -}; - -BEGIN_EVENT_TABLE(wxLogFrame, wxFrame) - // wxLogWindow menu events - EVT_MENU(Menu_Close, wxLogFrame::OnClose) -#if wxUSE_FILE - EVT_MENU(Menu_Save, wxLogFrame::OnSave) -#endif // wxUSE_FILE - EVT_MENU(Menu_Clear, wxLogFrame::OnClear) - - EVT_CLOSE(wxLogFrame::OnCloseWindow) -END_EVENT_TABLE() - -wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxChar *szTitle) - : wxFrame(pParent, wxID_ANY, szTitle) -{ - m_log = log; - - m_pTextCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, - wxDefaultSize, - wxTE_MULTILINE | - wxHSCROLL | - // needed for Win32 to avoid 65Kb limit but it doesn't work well - // when using RichEdit 2.0 which we always do in the Unicode build -#if !wxUSE_UNICODE - wxTE_RICH | -#endif // !wxUSE_UNICODE - wxTE_READONLY); - -#if wxUSE_MENUS - // create menu - wxMenuBar *pMenuBar = new wxMenuBar; - wxMenu *pMenu = new wxMenu; -#if wxUSE_FILE - pMenu->Append(Menu_Save, _("&Save..."), _("Save log contents to file")); -#endif // wxUSE_FILE - pMenu->Append(Menu_Clear, _("C&lear"), _("Clear the log contents")); - pMenu->AppendSeparator(); - pMenu->Append(Menu_Close, _("&Close"), _("Close this window")); - pMenuBar->Append(pMenu, _("&Log")); - SetMenuBar(pMenuBar); -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - // status bar for menu prompts - CreateStatusBar(); -#endif // wxUSE_STATUSBAR - - m_log->OnFrameCreate(this); -} - -void wxLogFrame::DoClose() -{ - if ( m_log->OnFrameClose(this) ) - { - // instead of closing just hide the window to be able to Show() it - // later - Show(false); - } -} - -void wxLogFrame::OnClose(wxCommandEvent& WXUNUSED(event)) -{ - DoClose(); -} - -void wxLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) -{ - DoClose(); -} - -#if wxUSE_FILE -void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) -{ -#if wxUSE_FILEDLG - wxString filename; - wxFile file; - int rc = OpenLogFile(file, &filename, this); - if ( rc == -1 ) - { - // cancelled - return; - } - - bool bOk = rc != 0; - - // retrieve text and save it - // ------------------------- - int nLines = m_pTextCtrl->GetNumberOfLines(); - for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) { - bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + - wxTextFile::GetEOL()); - } - - if ( bOk ) - bOk = file.Close(); - - if ( !bOk ) { - wxLogError(_("Can't save log contents to file.")); - } - else { - wxLogStatus(this, _("Log saved to the file '%s'."), filename.c_str()); - } -#endif -} -#endif // wxUSE_FILE - -void wxLogFrame::OnClear(wxCommandEvent& WXUNUSED(event)) -{ - m_pTextCtrl->Clear(); -} - -wxLogFrame::~wxLogFrame() -{ - m_log->OnFrameDelete(this); -} - -// wxLogWindow -// ----------- - -wxLogWindow::wxLogWindow(wxWindow *pParent, - const wxChar *szTitle, - bool bShow, - bool bDoPass) -{ - PassMessages(bDoPass); - - m_pLogFrame = new wxLogFrame(pParent, this, szTitle); - - if ( bShow ) - m_pLogFrame->Show(); -} - -void wxLogWindow::Show(bool bShow) -{ - m_pLogFrame->Show(bShow); -} - -void wxLogWindow::DoLog(wxLogLevel level, const wxChar *szString, time_t t) -{ - // first let the previous logger show it - wxLogPassThrough::DoLog(level, szString, t); - - if ( m_pLogFrame ) { - switch ( level ) { - case wxLOG_Status: - // by default, these messages are ignored by wxLog, so process - // them ourselves - if ( !wxIsEmpty(szString) ) - { - wxString str; - str << _("Status: ") << szString; - DoLogString(str, t); - } - break; - - // don't put trace messages in the text window for 2 reasons: - // 1) there are too many of them - // 2) they may provoke other trace messages thus sending a program - // into an infinite loop - case wxLOG_Trace: - break; - - default: - // and this will format it nicely and call our DoLogString() - wxLog::DoLog(level, szString, t); - } - } -} - -void wxLogWindow::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) -{ - // put the text into our window - wxTextCtrl *pText = m_pLogFrame->TextCtrl(); - - // remove selection (WriteText is in fact ReplaceSelection) -#ifdef __WXMSW__ - wxTextPos nLen = pText->GetLastPosition(); - pText->SetSelection(nLen, nLen); -#endif // Windows - - wxString msg; - TimeStamp(&msg); - msg << szString << wxT('\n'); - - pText->AppendText(msg); - - // TODO ensure that the line can be seen -} - -wxFrame *wxLogWindow::GetFrame() const -{ - return m_pLogFrame; -} - -void wxLogWindow::OnFrameCreate(wxFrame * WXUNUSED(frame)) -{ -} - -bool wxLogWindow::OnFrameClose(wxFrame * WXUNUSED(frame)) -{ - // allow to close - return true; -} - -void wxLogWindow::OnFrameDelete(wxFrame * WXUNUSED(frame)) -{ - m_pLogFrame = (wxLogFrame *)NULL; -} - -wxLogWindow::~wxLogWindow() -{ - // may be NULL if log frame already auto destroyed itself - delete m_pLogFrame; -} - -#endif // wxUSE_LOGWINDOW - -// ---------------------------------------------------------------------------- -// wxLogDialog -// ---------------------------------------------------------------------------- - -#if wxUSE_LOG_DIALOG - -#ifndef __SMARTPHONE__ -static const size_t MARGIN = 10; -#else -static const size_t MARGIN = 0; -#endif - -wxString wxLogDialog::ms_details; - -wxLogDialog::wxLogDialog(wxWindow *parent, - const wxArrayString& messages, - const wxArrayInt& severity, - const wxArrayLong& times, - const wxString& caption, - long style) - : wxDialog(parent, wxID_ANY, caption, - wxDefaultPosition, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) -{ - if ( ms_details.empty() ) - { - // ensure that we won't loop here if wxGetTranslation() - // happens to pop up a Log message while translating this :-) - ms_details = wxTRANSLATE("&Details"); - ms_details = wxGetTranslation(ms_details); -#ifdef __SMARTPHONE__ - ms_details = wxStripMenuCodes(ms_details); -#endif - } - - size_t count = messages.GetCount(); - m_messages.Alloc(count); - m_severity.Alloc(count); - m_times.Alloc(count); - - for ( size_t n = 0; n < count; n++ ) - { - wxString msg = messages[n]; - msg.Replace(wxT("\n"), wxT(" ")); - m_messages.Add(msg); - m_severity.Add(severity[n]); - m_times.Add(times[n]); - } - - m_showingDetails = false; // not initially - m_listctrl = (wxListCtrl *)NULL; - -#ifndef __SMARTPHONE__ - -#if wxUSE_STATLINE - m_statline = (wxStaticLine *)NULL; -#endif // wxUSE_STATLINE - -#if wxUSE_FILE - m_btnSave = (wxButton *)NULL; -#endif // wxUSE_FILE - -#endif // __SMARTPHONE__ - - bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - - // create the controls which are always shown and layout them: we use - // sizers even though our window is not resizeable to calculate the size of - // the dialog properly - wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); -#ifndef __SMARTPHONE__ - wxBoxSizer *sizerButtons = new wxBoxSizer(isPda ? wxHORIZONTAL : wxVERTICAL); -#endif - wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL); - -#ifdef __SMARTPHONE__ - SetLeftMenu(wxID_OK); - SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX); -#else - wxButton *btnOk = new wxButton(this, wxID_OK); - sizerButtons->Add(btnOk, 0, isPda ? wxCENTRE : wxCENTRE|wxBOTTOM, MARGIN/2); - m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX); - sizerButtons->Add(m_btnDetails, 0, isPda ? wxCENTRE|wxLEFT : wxCENTRE | wxTOP, MARGIN/2 - 1); -#endif - - wxBitmap bitmap; - switch ( style & wxICON_MASK ) - { - case wxICON_ERROR: - bitmap = wxArtProvider::GetBitmap(wxART_ERROR, wxART_MESSAGE_BOX); -#ifdef __WXPM__ - bitmap.SetId(wxICON_SMALL_ERROR); -#endif - break; - - case wxICON_INFORMATION: - bitmap = wxArtProvider::GetBitmap(wxART_INFORMATION, wxART_MESSAGE_BOX); -#ifdef __WXPM__ - bitmap.SetId(wxICON_SMALL_INFO); -#endif - break; - - case wxICON_WARNING: - bitmap = wxArtProvider::GetBitmap(wxART_WARNING, wxART_MESSAGE_BOX); -#ifdef __WXPM__ - bitmap.SetId(wxICON_SMALL_WARNING); -#endif - break; - - default: - wxFAIL_MSG(_T("incorrect log style")); - } - - if (!isPda) - sizerAll->Add(new wxStaticBitmap(this, wxID_ANY, bitmap), 0, - wxALIGN_CENTRE_VERTICAL); - - const wxString& message = messages.Last(); - sizerAll->Add(CreateTextSizer(message), 1, - wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, MARGIN); -#ifndef __SMARTPHONE__ - sizerAll->Add(sizerButtons, 0, isPda ? wxCENTRE|wxTOP|wxBOTTOM : (wxALIGN_RIGHT | wxLEFT), MARGIN); -#endif - - sizerTop->Add(sizerAll, 0, wxALL | wxEXPAND, MARGIN); - - SetSizer(sizerTop); - - // see comments in OnDetails() - // - // Note: Doing this, this way, triggered a nasty bug in - // wxTopLevelWindowGTK::GtkOnSize which took -1 literally once - // either of maxWidth or maxHeight was set. This symptom has been - // fixed there, but it is a problem that remains as long as we allow - // unchecked access to the internal size members. We really need to - // encapuslate window sizes more cleanly and make it clear when -1 will - // be substituted and when it will not. - - wxSize size = sizerTop->Fit(this); - m_maxHeight = size.y; - SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight); - -#ifndef __SMARTPHONE__ - btnOk->SetFocus(); -#endif - - Centre(); - - if (isPda) - { - // Move up the screen so that when we expand the dialog, - // there's enough space. - Move(wxPoint(GetPosition().x, GetPosition().y / 2)); - } -} - -void wxLogDialog::CreateDetailsControls() -{ -#ifndef __SMARTPHONE__ - // create the save button and separator line if possible -#if wxUSE_FILE - m_btnSave = new wxButton(this, wxID_SAVE); -#endif // wxUSE_FILE - -#if wxUSE_STATLINE - m_statline = new wxStaticLine(this, wxID_ANY); -#endif // wxUSE_STATLINE - -#endif // __SMARTPHONE__ - - // create the list ctrl now - m_listctrl = new wxListCtrl(this, wxID_ANY, - wxDefaultPosition, wxDefaultSize, - wxSUNKEN_BORDER | - wxLC_REPORT | - wxLC_NO_HEADER | - wxLC_SINGLE_SEL); -#ifdef __WXWINCE__ - // This maks a big aesthetic difference on WinCE but I - // don't want to risk problems on other platforms - m_listctrl->Hide(); -#endif - - // no need to translate these strings as they're not shown to the - // user anyhow (we use wxLC_NO_HEADER style) - m_listctrl->InsertColumn(0, _T("Message")); - m_listctrl->InsertColumn(1, _T("Time")); - - // prepare the imagelist - static const int ICON_SIZE = 16; - wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE); - - // order should be the same as in the switch below! - static const wxChar* icons[] = - { - wxART_ERROR, - wxART_WARNING, - wxART_INFORMATION - }; - - bool loadedIcons = true; - - for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ ) - { - wxBitmap bmp = wxArtProvider::GetBitmap(icons[icon], wxART_MESSAGE_BOX, - wxSize(ICON_SIZE, ICON_SIZE)); - - // This may very well fail if there are insufficient colours available. - // Degrade gracefully. - if ( !bmp.Ok() ) - { - loadedIcons = false; - - break; - } - - imageList->Add(bmp); - } - - m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL); - - // and fill it - wxString fmt = wxLog::GetTimestamp(); - if ( !fmt ) - { - // default format - fmt = _T("%c"); - } - - size_t count = m_messages.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - int image; - - if ( loadedIcons ) - { - switch ( m_severity[n] ) - { - case wxLOG_Error: - image = 0; - break; - - case wxLOG_Warning: - image = 1; - break; - - default: - image = 2; - } - } - else // failed to load images - { - image = -1; - } - - m_listctrl->InsertItem(n, m_messages[n], image); - m_listctrl->SetItem(n, 1, TimeStamp(fmt, (time_t)m_times[n])); - } - - // let the columns size themselves - m_listctrl->SetColumnWidth(0, wxLIST_AUTOSIZE); - m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE); - - // calculate an approximately nice height for the listctrl - int height = GetCharHeight()*(count + 4); - - // but check that the dialog won't fall fown from the screen - // - // we use GetMinHeight() to get the height of the dialog part without the - // details and we consider that the "Save" button below and the separator - // line (and the margins around it) take about as much, hence double it - int heightMax = wxGetDisplaySize().y - GetPosition().y - 2*GetMinHeight(); - - // we should leave a margin - heightMax *= 9; - heightMax /= 10; - - m_listctrl->SetSize(wxDefaultCoord, wxMin(height, heightMax)); -} - -void wxLogDialog::OnListSelect(wxListEvent& event) -{ - // we can't just disable the control because this looks ugly under Windows - // (wrong bg colour, no scrolling...), but we still want to disable - // selecting items - it makes no sense here - m_listctrl->SetItemState(event.GetIndex(), 0, wxLIST_STATE_SELECTED); -} - -void wxLogDialog::OnOk(wxCommandEvent& WXUNUSED(event)) -{ - EndModal(wxID_OK); -} - -#if wxUSE_FILE - -void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) -{ -#if wxUSE_FILEDLG - wxFile file; - int rc = OpenLogFile(file, NULL, this); - if ( rc == -1 ) - { - // cancelled - return; - } - - bool ok = rc != 0; - - wxString fmt = wxLog::GetTimestamp(); - if ( !fmt ) - { - // default format - fmt = _T("%c"); - } - - size_t count = m_messages.GetCount(); - for ( size_t n = 0; ok && (n < count); n++ ) - { - wxString line; - line << TimeStamp(fmt, (time_t)m_times[n]) - << _T(": ") - << m_messages[n] - << wxTextFile::GetEOL(); - - ok = file.Write(line); - } - - if ( ok ) - ok = file.Close(); - - if ( !ok ) - wxLogError(_("Can't save log contents to file.")); -#endif // wxUSE_FILEDLG -} - -#endif // wxUSE_FILE - -void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) -{ - wxSizer *sizer = GetSizer(); - - if ( m_showingDetails ) - { -#ifdef __SMARTPHONE__ - SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX); -#else - m_btnDetails->SetLabel(ms_details + EXPAND_SUFFIX); -#endif - - sizer->Detach( m_listctrl ); - -#ifndef __SMARTPHONE__ - -#if wxUSE_STATLINE - sizer->Detach( m_statline ); -#endif // wxUSE_STATLINE - -#if wxUSE_FILE - sizer->Detach( m_btnSave ); -#endif // wxUSE_FILE - -#endif // __SMARTPHONE__ - } - else // show details now - { -#ifdef __SMARTPHONE__ - SetRightMenu(wxID_MORE, wxString(_T("<< ")) + ms_details); -#else - m_btnDetails->SetLabel(wxString(_T("<< ")) + ms_details); -#endif - - if ( !m_listctrl ) - { - CreateDetailsControls(); - } - -#if wxUSE_STATLINE && !defined(__SMARTPHONE__) - bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - if (!isPda) - sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN); -#endif // wxUSE_STATLINE - - sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN); - - // VZ: this doesn't work as this becomes the initial (and not only - // minimal) listctrl height as well - why? -#if 0 - // allow the user to make the dialog shorter than its initial height - - // without this it wouldn't work as the list ctrl would have been - // incompressible - sizer->SetItemMinSize(m_listctrl, 100, 3*GetCharHeight()); -#endif // 0 - -#if wxUSE_FILE && !defined(__SMARTPHONE__) - sizer->Add(m_btnSave, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), MARGIN); -#endif // wxUSE_FILE - } - - m_showingDetails = !m_showingDetails; - - // in any case, our size changed - relayout everything and set new hints - // --------------------------------------------------------------------- - - // we have to reset min size constraints or Fit() would never reduce the - // dialog size when collapsing it and we have to reset max constraint - // because it wouldn't expand it otherwise - - m_minHeight = - m_maxHeight = -1; - - // wxSizer::FitSize() is private, otherwise we might use it directly... - wxSize sizeTotal = GetSize(), - sizeClient = GetClientSize(); - - wxSize size = sizer->GetMinSize(); - size.x += sizeTotal.x - sizeClient.x; - size.y += sizeTotal.y - sizeClient.y; - - // we don't want to allow expanding the dialog in vertical direction as - // this would show the "hidden" details but we can resize the dialog - // vertically while the details are shown - if ( !m_showingDetails ) - m_maxHeight = size.y; - - SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight); - -#ifdef __WXWINCE__ - if (m_showingDetails) - m_listctrl->Show(); -#endif - - // don't change the width when expanding/collapsing - SetSize(wxDefaultCoord, size.y); - -#ifdef __WXGTK__ - // VS: this is necessary in order to force frame redraw under - // WindowMaker or fvwm2 (and probably other broken WMs). - // Otherwise, detailed list wouldn't be displayed. - Show(); -#endif // wxGTK -} - -wxLogDialog::~wxLogDialog() -{ - if ( m_listctrl ) - { - delete m_listctrl->GetImageList(wxIMAGE_LIST_SMALL); - } -} - -#endif // wxUSE_LOG_DIALOG - -#if wxUSE_FILE && wxUSE_FILEDLG - -// pass an uninitialized file object, the function will ask the user for the -// filename and try to open it, returns true on success (file was opened), -// false if file couldn't be opened/created and -1 if the file selection -// dialog was cancelled -static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent) -{ - // get the file name - // ----------------- - wxString filename = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt"), parent); - if ( !filename ) { - // cancelled - return -1; - } - - // open file - // --------- - bool bOk wxDUMMY_INITIALIZE(false); - if ( wxFile::Exists(filename) ) { - bool bAppend = false; - wxString strMsg; - strMsg.Printf(_("Append log to file '%s' (choosing [No] will overwrite it)?"), - filename.c_str()); - switch ( wxMessageBox(strMsg, _("Question"), - wxICON_QUESTION | wxYES_NO | wxCANCEL) ) { - case wxYES: - bAppend = true; - break; - - case wxNO: - bAppend = false; - break; - - case wxCANCEL: - return -1; - - default: - wxFAIL_MSG(_("invalid message box return value")); - } - - if ( bAppend ) { - bOk = file.Open(filename, wxFile::write_append); - } - else { - bOk = file.Create(filename, true /* overwrite */); - } - } - else { - bOk = file.Create(filename); - } - - if ( pFilename ) - *pFilename = filename; - - return bOk; -} - -#endif // wxUSE_FILE - -#endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW) - -#if wxUSE_LOG && wxUSE_TEXTCTRL - -// ---------------------------------------------------------------------------- -// wxLogTextCtrl implementation -// ---------------------------------------------------------------------------- - -wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl) -{ - m_pTextCtrl = pTextCtrl; -} - -void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) -{ - wxString msg; - TimeStamp(&msg); - - msg << szString << wxT('\n'); - m_pTextCtrl->AppendText(msg); -} - -#endif // wxUSE_LOG && wxUSE_TEXTCTRL diff --git a/Source/3rdParty/wx/src/generic/msgdlgg.cpp b/Source/3rdParty/wx/src/generic/msgdlgg.cpp deleted file mode 100644 index 8887f131b..000000000 --- a/Source/3rdParty/wx/src/generic/msgdlgg.cpp +++ /dev/null @@ -1,159 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/msgdlgg.cpp -// Purpose: wxGenericMessageDialog -// Author: Julian Smart, Robert Roebling -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: msgdlgg.cpp 41838 2006-10-09 21:08:45Z VZ $ -// Copyright: (c) Julian Smart and Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_MSGDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__) || defined(__WXGPE__)) - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/button.h" - #include "wx/stattext.h" - #include "wx/statbmp.h" - #include "wx/layout.h" - #include "wx/intl.h" - #include "wx/icon.h" - #include "wx/sizer.h" - #include "wx/app.h" - #include "wx/settings.h" -#endif - -#include -#include - -#define __WX_COMPILING_MSGDLGG_CPP__ 1 -#include "wx/msgdlg.h" -#include "wx/artprov.h" - -#if wxUSE_STATLINE - #include "wx/statline.h" -#endif - -// ---------------------------------------------------------------------------- -// icons -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) - EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) - EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) - EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) -END_EVENT_TABLE() - -IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) - -wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, - const wxString& message, - const wxString& caption, - long style, - const wxPoint& pos) - : wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) -{ - SetMessageDialogStyle(style); - - bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); - -#if wxUSE_STATBMP - // 1) icon - if (style & wxICON_MASK) - { - wxBitmap bitmap; - switch ( style & wxICON_MASK ) - { - default: - wxFAIL_MSG(_T("incorrect log style")); - // fall through - - case wxICON_ERROR: - bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX); - break; - - case wxICON_INFORMATION: - bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX); - break; - - case wxICON_WARNING: - bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX); - break; - - case wxICON_QUESTION: - bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX); - break; - } - wxStaticBitmap *icon = new wxStaticBitmap(this, wxID_ANY, bitmap); - if (is_pda) - topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 ); - else - icon_text->Add( icon, 0, wxCENTER ); - } -#endif // wxUSE_STATBMP - -#if wxUSE_STATTEXT - // 2) text - icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 ); - - topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); -#endif // wxUSE_STATTEXT - - // 3) buttons - int center_flag = wxEXPAND; - if (style & wxYES_NO) - center_flag = wxALIGN_CENTRE; - wxSizer *sizerBtn = CreateSeparatedButtonSizer(style & ButtonSizerFlags); - if ( sizerBtn ) - topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 ); - - SetAutoLayout( true ); - SetSizer( topsizer ); - - topsizer->SetSizeHints( this ); - topsizer->Fit( this ); - wxSize size( GetSize() ); - if (size.x < size.y*3/2) - { - size.x = size.y*3/2; - SetSize( size ); - } - - Centre( wxBOTH | wxCENTER_FRAME); -} - -void wxGenericMessageDialog::OnYes(wxCommandEvent& WXUNUSED(event)) -{ - EndModal( wxID_YES ); -} - -void wxGenericMessageDialog::OnNo(wxCommandEvent& WXUNUSED(event)) -{ - EndModal( wxID_NO ); -} - -void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) -{ - // Allow cancellation via ESC/Close button except if - // only YES and NO are specified. - const long style = GetMessageDialogStyle(); - if ( (style & wxYES_NO) != wxYES_NO || (style & wxCANCEL) ) - { - EndModal( wxID_CANCEL ); - } -} - -#endif // wxUSE_MSGDLG && !defined(__WXGTK20__) diff --git a/Source/3rdParty/wx/src/generic/numdlgg.cpp b/Source/3rdParty/wx/src/generic/numdlgg.cpp deleted file mode 100644 index 38c1376d8..000000000 --- a/Source/3rdParty/wx/src/generic/numdlgg.cpp +++ /dev/null @@ -1,181 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/numdlgg.cpp -// Purpose: wxGetNumberFromUser implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.07.99 -// RCS-ID: $Id: numdlgg.cpp 54861 2008-07-30 21:53:26Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_NUMBERDLG - -#ifndef WX_PRECOMP - #include - - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/button.h" - #include "wx/stattext.h" - #include "wx/textctrl.h" - #include "wx/intl.h" - #include "wx/sizer.h" -#endif - -#if wxUSE_STATLINE - #include "wx/statline.h" -#endif - -#if wxUSE_SPINCTRL -#include "wx/spinctrl.h" -#endif - -// this is where wxGetNumberFromUser() is declared -#include "wx/numdlg.h" - -#if !wxUSE_SPINCTRL - // wxTextCtrl will do instead of wxSpinCtrl if we don't have it - #define wxSpinCtrl wxTextCtrl -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxNumberEntryDialog -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxNumberEntryDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxNumberEntryDialog::OnOK) - EVT_BUTTON(wxID_CANCEL, wxNumberEntryDialog::OnCancel) -END_EVENT_TABLE() - -IMPLEMENT_CLASS(wxNumberEntryDialog, wxDialog) - -wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& prompt, - const wxString& caption, - long value, - long min, - long max, - const wxPoint& pos) - : wxDialog(parent, wxID_ANY, caption, - pos, wxDefaultSize) -{ - m_value = value; - m_max = max; - m_min = min; - - wxBeginBusyCursor(); - - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); -#if wxUSE_STATTEXT - // 1) text message - topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 ); -#endif - - // 2) prompt and text ctrl - wxBoxSizer *inputsizer = new wxBoxSizer( wxHORIZONTAL ); - -#if wxUSE_STATTEXT - // prompt if any - if (!prompt.empty()) - inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 ); -#endif - - // spin ctrl - wxString valStr; - valStr.Printf(wxT("%ld"), m_value); - m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ), wxSP_ARROW_KEYS, (int)m_min, (int)m_max, (int)m_value); - inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 ); - // add both - topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 ); - - // 3) buttons if any - wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); - if ( buttonSizer ) - { - topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); - } - - SetSizer( topsizer ); - SetAutoLayout( true ); - - topsizer->SetSizeHints( this ); - topsizer->Fit( this ); - - Centre( wxBOTH ); - - m_spinctrl->SetSelection(-1, -1); - m_spinctrl->SetFocus(); - - wxEndBusyCursor(); -} - -void wxNumberEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event)) -{ -#if !wxUSE_SPINCTRL - wxString tmp = m_spinctrl->GetValue(); - if ( wxSscanf(tmp, _T("%ld"), &m_value) != 1 ) - EndModal(wxID_CANCEL); - else -#else - m_value = m_spinctrl->GetValue(); -#endif - if ( m_value < m_min || m_value > m_max ) - { - // not a number or out of range - m_value = -1; - EndModal(wxID_CANCEL); - } - - EndModal(wxID_OK); -} - -void wxNumberEntryDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) -{ - EndModal(wxID_CANCEL); -} - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// wxGetTextFromUser is in utilscmn.cpp - -long wxGetNumberFromUser(const wxString& msg, - const wxString& prompt, - const wxString& title, - long value, - long min, - long max, - wxWindow *parent, - const wxPoint& pos) -{ - wxNumberEntryDialog dialog(parent, msg, prompt, title, - value, min, max, pos); - if (dialog.ShowModal() == wxID_OK) - return dialog.GetValue(); - - return -1; -} - -#endif // wxUSE_NUMBERDLG diff --git a/Source/3rdParty/wx/src/generic/panelg.cpp b/Source/3rdParty/wx/src/generic/panelg.cpp deleted file mode 100644 index cd4dbee65..000000000 --- a/Source/3rdParty/wx/src/generic/panelg.cpp +++ /dev/null @@ -1,180 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/panelg.cpp -// Purpose: wxPanel and the keyboard handling code -// Author: Julian Smart, Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: panelg.cpp 40307 2006-07-25 01:31:13Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/font.h" - #include "wx/colour.h" - #include "wx/settings.h" - #include "wx/log.h" - #include "wx/panel.h" - #include "wx/containr.h" -#endif - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -#if wxUSE_EXTENDED_RTTI -WX_DEFINE_FLAGS( wxPanelStyle ) - -wxBEGIN_FLAGS( wxPanelStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - -wxEND_FLAGS( wxPanelStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow,"wx/panel.h") - -wxBEGIN_PROPERTIES_TABLE(wxPanel) - wxPROPERTY_FLAGS( WindowStyle , wxPanelStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style -// style wxTAB_TRAVERSAL -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxPanel) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_5( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) - -#else -IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) -#endif - -BEGIN_EVENT_TABLE(wxPanel, wxWindow) - EVT_SIZE(wxPanel::OnSize) - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel) -END_EVENT_TABLE() - -// ============================================================================ -// implementation -// ============================================================================ - -WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel, wxWindow) - -// ---------------------------------------------------------------------------- -// wxPanel creation -// ---------------------------------------------------------------------------- - -void wxPanel::Init() -{ - m_container.SetContainerWindow(this); -} - -bool wxPanel::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( !wxWindow::Create(parent, id, pos, size, style, name) ) - return false; - - // so that non-solid background renders correctly under GTK+: - SetThemeEnabled(true); - -#if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__)) - // Required to get solid control backgrounds under WinCE - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); -#endif - - return true; -} - -wxPanel::~wxPanel() -{ -} - -void wxPanel::InitDialog() -{ - wxInitDialogEvent event(GetId()); - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -void wxPanel::OnSize(wxSizeEvent& event) -{ - if (GetAutoLayout()) - Layout(); -#if wxUSE_CONSTRAINTS -#if defined(__WXPM__) && 0 - else - { - // Need to properly move child windows under OS/2 - - PSWP pWinSwp = GetSwp(); - - if (pWinSwp->cx == 0 && pWinSwp->cy == 0 && pWinSwp->fl == 0) - { - // Uninitialized - - ::WinQueryWindowPos(GetHWND(), pWinSwp); - } - else - { - SWP vSwp; - int nYDiff; - - ::WinQueryWindowPos(GetHWND(), &vSwp); - nYDiff = pWinSwp->cy - vSwp.cy; - MoveChildren(nYDiff); - pWinSwp->cx = vSwp.cx; - pWinSwp->cy = vSwp.cy; - } - } -#endif -#endif // wxUSE_CONSTRAINTS - - event.Skip(); -} diff --git a/Source/3rdParty/wx/src/generic/printps.cpp b/Source/3rdParty/wx/src/generic/printps.cpp deleted file mode 100644 index fafc3d8f1..000000000 --- a/Source/3rdParty/wx/src/generic/printps.cpp +++ /dev/null @@ -1,370 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/printps.cpp -// Purpose: Postscript print/preview framework -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: printps.cpp 42522 2006-10-27 13:07:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dc.h" - #include "wx/app.h" - #include "wx/msgdlg.h" - #include "wx/intl.h" - #include "wx/progdlg.h" - #include "wx/log.h" - #include "wx/dcprint.h" -#endif - -#include "wx/generic/printps.h" -#include "wx/printdlg.h" -#include "wx/generic/prntdlgg.h" -#include "wx/generic/progdlgg.h" -#include "wx/paper.h" - -#include - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - - IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase) - IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Printer -// ---------------------------------------------------------------------------- - -wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data) - : wxPrinterBase(data) -{ -} - -wxPostScriptPrinter::~wxPostScriptPrinter() -{ -} - -bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) -{ - sm_abortIt = false; - sm_abortWindow = (wxWindow *) NULL; - - if (!printout) - { - sm_lastError = wxPRINTER_ERROR; - return false; - } - - printout->SetIsPreview(false); - - if (m_printDialogData.GetMinPage() < 1) - m_printDialogData.SetMinPage(1); - if (m_printDialogData.GetMaxPage() < 1) - m_printDialogData.SetMaxPage(9999); - - // Create a suitable device context - wxDC *dc; - if (prompt) - { - dc = PrintDialog(parent); - if (!dc) - return false; - } - else - { - dc = new wxPostScriptDC(GetPrintDialogData().GetPrintData()); - } - - // May have pressed cancel. - if (!dc || !dc->Ok()) - { - if (dc) delete dc; - sm_lastError = wxPRINTER_ERROR; - return false; - } - - wxSize ScreenPixels = wxGetDisplaySize(); - wxSize ScreenMM = wxGetDisplaySizeMM(); - - printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), - (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); - printout->SetPPIPrinter( wxPostScriptDC::GetResolution(), - wxPostScriptDC::GetResolution() ); - - // Set printout parameters - printout->SetDC(dc); - - int w, h; - dc->GetSize(&w, &h); - printout->SetPageSizePixels((int)w, (int)h); - printout->SetPaperRectPixels(wxRect(0, 0, w, h)); - int mw, mh; - dc->GetSizeMM(&mw, &mh); - printout->SetPageSizeMM((int)mw, (int)mh); - - // Create an abort window - wxBeginBusyCursor(); - - printout->OnPreparePrinting(); - - // Get some parameters from the printout, if defined - int fromPage, toPage; - int minPage, maxPage; - printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); - - if (maxPage == 0) - { - sm_lastError = wxPRINTER_ERROR; - wxEndBusyCursor(); - return false; - } - - // Only set min and max, because from and to have been - // set by the user - m_printDialogData.SetMinPage(minPage); - m_printDialogData.SetMaxPage(maxPage); - - if (m_printDialogData.GetFromPage() < minPage) - m_printDialogData.SetFromPage( minPage ); - if (m_printDialogData.GetToPage() > maxPage) - m_printDialogData.SetToPage( maxPage ); - - int - pagesPerCopy = m_printDialogData.GetToPage()-m_printDialogData.GetFromPage()+1, - totalPages = pagesPerCopy * m_printDialogData.GetNoCopies(), - printedPages = 0; - // Open the progress bar dialog - wxProgressDialog *progressDialog = new wxProgressDialog ( - printout->GetTitle(), - _("Printing..."), - totalPages, - parent, - wxPD_CAN_ABORT|wxPD_AUTO_HIDE|wxPD_APP_MODAL); - - printout->OnBeginPrinting(); - - sm_lastError = wxPRINTER_NO_ERROR; - - bool keepGoing = true; - - int copyCount; - for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++) - { - if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) - { - wxEndBusyCursor(); - wxLogError(_("Could not start printing.")); - sm_lastError = wxPRINTER_ERROR; - break; - } - if (sm_abortIt) - { - sm_lastError = wxPRINTER_CANCELLED; - break; - } - - int pn; - for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn); - pn++) - { - if (sm_abortIt) - { - keepGoing = false; - sm_lastError = wxPRINTER_CANCELLED; - break; - } - else - { - wxString msg; - msg.Printf(_("Printing page %d..."), printedPages+1); - if(progressDialog->Update(printedPages++, msg)) - { - dc->StartPage(); - printout->OnPrintPage(pn); - dc->EndPage(); - } - else - { - sm_abortIt = true; - sm_lastError = wxPRINTER_CANCELLED; - keepGoing = false; - } - } - wxYield(); - } - printout->OnEndDocument(); - } - - printout->OnEndPrinting(); - delete progressDialog; - - wxEndBusyCursor(); - - delete dc; - - return (sm_lastError == wxPRINTER_NO_ERROR); -} - -wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) -{ - wxDC* dc = (wxDC*) NULL; - - wxGenericPrintDialog dialog( parent, &m_printDialogData ); - if (dialog.ShowModal() == wxID_OK) - { - dc = dialog.GetPrintDC(); - m_printDialogData = dialog.GetPrintDialogData(); - - if (dc == NULL) - sm_lastError = wxPRINTER_ERROR; - else - sm_lastError = wxPRINTER_NO_ERROR; - } - else - sm_lastError = wxPRINTER_CANCELLED; - - return dc; -} - -bool wxPostScriptPrinter::Setup(wxWindow *WXUNUSED(parent)) -{ -#if 0 - wxGenericPrintDialog* dialog = new wxGenericPrintDialog(parent, & m_printDialogData); - dialog->GetPrintDialogData().SetSetupDialog(true); - - int ret = dialog->ShowModal(); - - if (ret == wxID_OK) - { - m_printDialogData = dialog->GetPrintDialogData(); - } - - dialog->Destroy(); - - return (ret == wxID_OK); -#endif - - return false; -} - -// ---------------------------------------------------------------------------- -// Print preview -// ---------------------------------------------------------------------------- - -void wxPostScriptPrintPreview::Init(wxPrintout * WXUNUSED(printout), - wxPrintout * WXUNUSED(printoutForPrinting)) -{ - // Have to call it here since base constructor can't call it - DetermineScaling(); -} - -wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintDialogData *data) - : wxPrintPreviewBase(printout, printoutForPrinting, data) -{ - Init(printout, printoutForPrinting); -} - -wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data) - : wxPrintPreviewBase(printout, printoutForPrinting, data) -{ - Init(printout, printoutForPrinting); -} - -wxPostScriptPrintPreview::~wxPostScriptPrintPreview() -{ -} - -bool wxPostScriptPrintPreview::Print(bool interactive) -{ - if (!m_printPrintout) - return false; - - // Assume that on Unix, the preview may use the PostScript - // (generic) version, but printing using the native system is required. - // TODO: make a generic print preview class from which wxPostScriptPrintPreview - // is derived. -#ifdef __UNIX__ - wxPrinter printer(& m_printDialogData); -#else - wxPostScriptPrinter printer(& m_printDialogData); -#endif - return printer.Print(m_previewFrame, m_printPrintout, interactive); -} - -void wxPostScriptPrintPreview::DetermineScaling() -{ - wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId(); - if (paperType == wxPAPER_NONE) - paperType = wxPAPER_NONE; - - wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType); - if (!paper) - paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); - - if (paper) - { - wxSize ScreenPixels = wxGetDisplaySize(); - wxSize ScreenMM = wxGetDisplaySizeMM(); - - m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), - (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); - m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution()); - - wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); - sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxPostScriptDC::GetResolution() / 72.0); - sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxPostScriptDC::GetResolution() / 72.0); - wxSize sizeTenthsMM(paper->GetSize()); - wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); - - // If in landscape mode, we need to swap the width and height. - if ( m_printDialogData.GetPrintData().GetOrientation() == wxLANDSCAPE ) - { - m_pageWidth = sizeDevUnits.y; - m_pageHeight = sizeDevUnits.x; - m_previewPrintout->SetPageSizeMM(sizeMM.y, sizeMM.x); - } - else - { - m_pageWidth = sizeDevUnits.x; - m_pageHeight = sizeDevUnits.y; - m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y); - } - m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight); - m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight)); - - // At 100%, the page should look about page-size on the screen. - m_previewScaleX = (float)0.8 * 72.0 / (float)wxPostScriptDC::GetResolution(); - m_previewScaleY = m_previewScaleX; - } -} - -#endif diff --git a/Source/3rdParty/wx/src/generic/prntdlgg.cpp b/Source/3rdParty/wx/src/generic/prntdlgg.cpp deleted file mode 100644 index 42658569c..000000000 --- a/Source/3rdParty/wx/src/generic/prntdlgg.cpp +++ /dev/null @@ -1,1102 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/prntdlgg.cpp -// Purpose: Generic print dialogs -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: prntdlgg.cpp 55256 2008-08-25 14:39:11Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) - -#include "wx/generic/prntdlgg.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dc.h" - #include "wx/stattext.h" - #include "wx/statbox.h" - #include "wx/button.h" - #include "wx/checkbox.h" - #include "wx/textctrl.h" - #include "wx/radiobox.h" - #include "wx/filedlg.h" - #include "wx/combobox.h" - #include "wx/intl.h" - #include "wx/sizer.h" - #include "wx/cmndata.h" -#endif - -#if wxUSE_STATLINE - #include "wx/statline.h" -#endif - -#if wxUSE_POSTSCRIPT - #include "wx/generic/dcpsg.h" -#endif - -#include "wx/prntbase.h" -#include "wx/printdlg.h" -#include "wx/paper.h" -#include "wx/filename.h" -#include "wx/tokenzr.h" -#include "wx/imaglist.h" - -#include -#include - -#ifndef __WXUNIVERSAL__ - -#if wxUSE_LIBGNOMEPRINT - #include "wx/link.h" - wxFORCE_LINK_MODULE(gnome_print) -#endif - -#endif // !__WXUNIVERSAL__ - -// ---------------------------------------------------------------------------- -// global vars -// ---------------------------------------------------------------------------- - -extern wxPrintPaperDatabase *wxThePrintPaperDatabase; - -#if wxUSE_POSTSCRIPT - -//---------------------------------------------------------------------------- -// wxPostScriptNativeData -//---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPostScriptPrintNativeData, wxPrintNativeDataBase) - -wxPostScriptPrintNativeData::wxPostScriptPrintNativeData() -{ - m_previewCommand = wxEmptyString; -#ifdef __VMS__ - m_printerCommand = wxT("print"); - m_printerOptions = wxT("/nonotify/queue=psqueue"); - m_afmPath = wxT("sys$ps_font_metrics:"); -#endif - -#ifdef __WXMSW__ - m_printerCommand = wxT("print"); - m_printerOptions = wxEmptyString; - m_afmPath = wxT("c:\\windows\\system\\"); -#endif - -#if !defined(__VMS__) && !defined(__WXMSW__) - m_printerCommand = wxT("lpr"); - m_printerOptions = wxEmptyString; - m_afmPath = wxEmptyString; -#endif - - m_printerScaleX = 1.0; - m_printerScaleY = 1.0; - m_printerTranslateX = 0; - m_printerTranslateY = 0; -} - -wxPostScriptPrintNativeData::~wxPostScriptPrintNativeData() -{ -} - -bool wxPostScriptPrintNativeData::TransferTo( wxPrintData &WXUNUSED(data) ) -{ - return true; -} - -bool wxPostScriptPrintNativeData::TransferFrom( const wxPrintData &WXUNUSED(data) ) -{ - return true; -} - -// ---------------------------------------------------------------------------- -// Generic print dialog for non-Windows printing use. -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxGenericPrintDialog, wxPrintDialogBase) - -BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxPrintDialogBase) - EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK) - EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup) - EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange) -END_EVENT_TABLE() - -wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, - wxPrintDialogData* data) - : wxPrintDialogBase(parent, wxID_ANY, _("Print"), - wxPoint(0,0), wxSize(600, 600), - wxDEFAULT_DIALOG_STYLE | - wxTAB_TRAVERSAL) -{ - if ( data ) - m_printDialogData = *data; - - Init(parent); -} - -wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, - wxPrintData* data) - : wxPrintDialogBase(parent, wxID_ANY, _("Print"), - wxPoint(0,0), wxSize(600, 600), - wxDEFAULT_DIALOG_STYLE | - wxTAB_TRAVERSAL) -{ - if ( data ) - m_printDialogData = *data; - - Init(parent); -} - -void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) -{ - // wxDialog::Create(parent, wxID_ANY, _("Print"), wxPoint(0,0), wxSize(600, 600), - // wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL); - - wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); - - // 1) top row - - wxPrintFactory* factory = wxPrintFactory::GetFactory(); - - wxStaticBoxSizer *topsizer = new wxStaticBoxSizer( - new wxStaticBox( this, wxID_ANY, _( "Printer options" ) ), wxHORIZONTAL ); - wxFlexGridSizer *flex = new wxFlexGridSizer( 2 ); - flex->AddGrowableCol( 1 ); - topsizer->Add( flex, 1, wxGROW ); - - m_printToFileCheckBox = new wxCheckBox( this, wxPRINTID_PRINTTOFILE, _("Print to File") ); - flex->Add( m_printToFileCheckBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup...") ); - flex->Add( m_setupButton, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - - if (!factory->HasPrintSetupDialog()) - m_setupButton->Enable( false ); - - if (factory->HasPrinterLine()) - { - flex->Add( new wxStaticText( this, wxID_ANY, _("Printer:") ), - 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - flex->Add( new wxStaticText( this, wxID_ANY, factory->CreatePrinterLine() ), - 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - } - - if (factory->HasStatusLine()) - { - flex->Add( new wxStaticText( this, wxID_ANY, _("Status:") ), - 0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 ); - flex->Add( new wxStaticText( this, wxID_ANY, factory->CreateStatusLine() ), - 0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 ); - } - - mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT|wxGROW, 10 ); - - // 2) middle row with radio box - - wxString *choices = new wxString[2]; - choices[0] = _("All"); - choices[1] = _("Pages"); - - m_fromText = (wxTextCtrl*)NULL; - m_toText = (wxTextCtrl*)NULL; - m_rangeRadioBox = (wxRadioBox *)NULL; - - if (m_printDialogData.GetFromPage() != 0) - { - m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), - wxDefaultPosition, wxDefaultSize, - 2, choices, - 1, wxRA_VERTICAL); - m_rangeRadioBox->SetSelection(1); - - mainsizer->Add( m_rangeRadioBox, 0, wxLEFT|wxTOP|wxRIGHT, 10 ); - } - - // 3) bottom row - - wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL ); - - if (m_printDialogData.GetFromPage() != 0) - { - bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("From:") ), 0, wxCENTER|wxALL, 5 ); - m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultCoord)); - bottomsizer->Add( m_fromText, 1, wxCENTER|wxRIGHT, 10 ); - - bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("To:") ), 0, wxCENTER|wxALL, 5); - m_toText = new wxTextCtrl(this, wxPRINTID_TO, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultCoord)); - bottomsizer->Add( m_toText, 1, wxCENTER|wxRIGHT, 10 ); - } - - bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Copies:") ), 0, wxCENTER|wxALL, 5 ); - m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, wxEmptyString, wxPoint(252, 130), wxSize(40, wxDefaultCoord)); - bottomsizer->Add( m_noCopiesText, 1, wxCENTER|wxRIGHT, 10 ); - - mainsizer->Add( bottomsizer, 0, wxTOP|wxLEFT|wxRIGHT, 12 ); - - // 4) buttons - - wxSizer *sizerBtn = CreateSeparatedButtonSizer( wxOK|wxCANCEL); - if ( sizerBtn ) - mainsizer->Add(sizerBtn, 0, wxEXPAND|wxALL, 10 ); - - SetAutoLayout( true ); - SetSizer( mainsizer ); - - mainsizer->Fit( this ); - Centre(wxBOTH); - - // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow - InitDialog(); - delete[] choices; -} - -int wxGenericPrintDialog::ShowModal() -{ - return wxDialog::ShowModal(); -} - -wxGenericPrintDialog::~wxGenericPrintDialog() -{ -} - -void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event)) -{ - TransferDataFromWindow(); - - // An empty 'to' field signals printing just the - // 'from' page. - if (m_printDialogData.GetToPage() < 1) - m_printDialogData.SetToPage(m_printDialogData.GetFromPage()); - - // There are some interactions between the global setup data - // and the standard print dialog. The global printing 'mode' - // is determined by whether the user checks Print to file - // or not. - if (m_printDialogData.GetPrintToFile()) - { - m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE); - - wxFileName fname( m_printDialogData.GetPrintData().GetFilename() ); - - wxFileDialog dialog( this, _("PostScript file"), - fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - if (dialog.ShowModal() != wxID_OK) return; - - m_printDialogData.GetPrintData().SetFilename( dialog.GetPath() ); - } - else - { - m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER); - } - - EndModal(wxID_OK); -} - -void wxGenericPrintDialog::OnRange(wxCommandEvent& event) -{ - if (!m_fromText) return; - - if (event.GetInt() == 0) - { - m_fromText->Enable(false); - m_toText->Enable(false); - } - else if (event.GetInt() == 1) - { - m_fromText->Enable(true); - m_toText->Enable(true); - } -} - -void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event)) -{ - wxPrintFactory* factory = wxPrintFactory::GetFactory(); - - if (factory->HasPrintSetupDialog()) - { - // The print setup dialog should change the - // print data in-place if not cancelled. - wxDialog *dialog = factory->CreatePrintSetupDialog( this, &m_printDialogData.GetPrintData() ); - dialog->ShowModal(); - dialog->Destroy(); - } -} - -bool wxGenericPrintDialog::TransferDataToWindow() -{ - if(m_printDialogData.GetFromPage() != 0) - { - if(m_fromText) - { - if (m_printDialogData.GetEnablePageNumbers()) - { - m_fromText->Enable(true); - m_toText->Enable(true); - if (m_printDialogData.GetFromPage() > 0) - m_fromText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetFromPage())); - if (m_printDialogData.GetToPage() > 0) - m_toText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetToPage())); - if(m_rangeRadioBox) - { - if (m_printDialogData.GetAllPages() || m_printDialogData.GetFromPage() == 0) - m_rangeRadioBox->SetSelection(0); - else - m_rangeRadioBox->SetSelection(1); - } - } - else - { - m_fromText->Enable(false); - m_toText->Enable(false); - if(m_rangeRadioBox) - { - m_rangeRadioBox->SetSelection(0); - m_rangeRadioBox->wxRadioBox::Enable(1, false); - } - } - } - } - m_noCopiesText->SetValue( - wxString::Format(_T("%d"), m_printDialogData.GetNoCopies())); - - m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile()); - m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile()); - return true; -} - -bool wxGenericPrintDialog::TransferDataFromWindow() -{ - long res = 0; - if(m_printDialogData.GetFromPage() != -1) - { - if (m_printDialogData.GetEnablePageNumbers()) - { - if(m_fromText) - { - wxString value = m_fromText->GetValue(); - if (value.ToLong( &res )) - m_printDialogData.SetFromPage( res ); - } - if(m_toText) - { - wxString value = m_toText->GetValue(); - if (value.ToLong( &res )) - m_printDialogData.SetToPage( res ); - } - } - if(m_rangeRadioBox) - { - if (m_rangeRadioBox->GetSelection() == 0) - { - m_printDialogData.SetAllPages(true); - - // This means all pages, more or less - m_printDialogData.SetFromPage(1); - m_printDialogData.SetToPage(32000); - } - else - m_printDialogData.SetAllPages(false); - } - } - else - { // continuous printing - m_printDialogData.SetFromPage(1); - m_printDialogData.SetToPage(32000); - } - - wxString value = m_noCopiesText->GetValue(); - if (value.ToLong( &res )) - m_printDialogData.SetNoCopies( res ); - - m_printDialogData.SetPrintToFile(m_printToFileCheckBox->GetValue()); - - return true; -} - -wxDC *wxGenericPrintDialog::GetPrintDC() -{ - return new wxPostScriptDC(GetPrintDialogData().GetPrintData()); -} - -// ---------------------------------------------------------------------------- -// Generic print setup dialog -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog) - -BEGIN_EVENT_TABLE(wxGenericPrintSetupDialog, wxDialog) - EVT_LIST_ITEM_ACTIVATED(wxPRINTID_PRINTER, wxGenericPrintSetupDialog::OnPrinter) -END_EVENT_TABLE() - -wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data): -wxDialog(parent, wxID_ANY, _("Print Setup"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL) -{ - Init(data); -} - -/* XPM */ -static const char * check_xpm[] = { -/* width height ncolors chars_per_pixel */ -"16 16 3 1", -/* colors */ -" s None c None", -"X c #000000", -". c #808080", -/* pixels */ -" ", -" ", -" ", -" .. ", -" XX ", -" XX. ", -" .XX ", -" XX ", -" X XX. ", -" XX .XX ", -" XX XX ", -" XXXX. ", -" XX. ", -" . ", -" ", -" " -}; - - -void wxGenericPrintSetupDialog::Init(wxPrintData* data) -{ - if ( data ) - m_printData = *data; - - m_targetData = data; - - wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); - - // printer selection - - wxStaticBoxSizer *printer_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Printer") ), wxVERTICAL ); - main_sizer->Add( printer_sizer, 0, wxALL|wxGROW, 10 ); - - m_printerListCtrl = new wxListCtrl( this, wxPRINTID_PRINTER, - wxDefaultPosition, wxSize(wxDefaultCoord,100), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER ); - wxImageList *image_list = new wxImageList; - image_list->Add( wxBitmap(check_xpm) ); - m_printerListCtrl->AssignImageList( image_list, wxIMAGE_LIST_SMALL ); - - m_printerListCtrl->InsertColumn( 0, wxT(" "), wxLIST_FORMAT_LEFT, 20 ); - m_printerListCtrl->InsertColumn( 1, wxT("Printer"), wxLIST_FORMAT_LEFT, 150 ); - m_printerListCtrl->InsertColumn( 2, wxT("Device"), wxLIST_FORMAT_LEFT, 150 ); - m_printerListCtrl->InsertColumn( 3, wxT("Status"), wxLIST_FORMAT_LEFT, 80 ); - - wxListItem item; - item.SetMask( wxLIST_MASK_TEXT ); - item.SetColumn( 1 ); - item.SetText( _("Default printer") ); - item.SetId( m_printerListCtrl->InsertItem( item ) ); - - if (data->GetPrinterName().empty()) - { - wxListItem item2; - item2.SetId( item.GetId() ); - item2.SetMask( wxLIST_MASK_IMAGE ); - item2.SetImage( 0 ); - m_printerListCtrl->SetItem( item2 ); - // also select item - m_printerListCtrl->SetItemState( item.GetId(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - } - - item.SetId( 1+ item.GetId() ); - - wxArrayString errors; - wxArrayString output; - long res = wxExecute( wxT("lpstat -v"), output, errors, wxEXEC_NODISABLE ); - if (res >= 0 && errors.GetCount() == 0) - { - size_t i; - for (i = 0; i < output.GetCount(); i++) - { - wxStringTokenizer tok( output[i], wxT(" ") ); - wxString tmp = tok.GetNextToken(); // "device" - if (tmp != wxT("device")) - break; // the lpstat syntax must have changed. - tmp = tok.GetNextToken(); // "for" - if (tmp != wxT("for")) - break; // the lpstat syntax must have changed. - tmp = tok.GetNextToken(); // "hp_deskjet930c:" - if (tmp[tmp.length()-1] == wxT(':')) - tmp.Remove(tmp.length()-1,1); - wxString name = tmp; - item.SetText( name ); - item.SetId( m_printerListCtrl->InsertItem( item ) ); - tmp = tok.GetNextToken(); // "parallel:/dev/lp0" - item.SetColumn( 2 ); - item.SetText( tmp ); - m_printerListCtrl->SetItem( item ); - if (data->GetPrinterName() == name) - { - wxListItem item2; - item2.SetId( item.GetId() ); - item2.SetMask( wxLIST_MASK_IMAGE ); - item2.SetImage( 0 ); - m_printerListCtrl->SetItem( item2 ); - // also select item - m_printerListCtrl->SetItemState( item.GetId(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - } - - wxString command = wxT("lpstat -p "); - command += name; - wxArrayString errors2; - wxArrayString output2; - res = wxExecute( command, output2, errors2, wxEXEC_NODISABLE ); - if (res >= 0 && errors2.GetCount() == 0 && output2.GetCount() > 0) - { - tmp = output2[0]; // "printer hp_deskjet930c is idle. enable since ..." - int pos = tmp.Find( wxT('.') ); - if (pos != wxNOT_FOUND) - tmp.Remove( (size_t)pos, tmp.length()-(size_t)pos ); - wxStringTokenizer tok2( tmp, wxT(" ") ); - tmp = tok2.GetNextToken(); // "printer" - tmp = tok2.GetNextToken(); // "hp_deskjet930c" - tmp = wxEmptyString; - while (tok2.HasMoreTokens()) - { - tmp += tok2.GetNextToken(); - tmp += wxT(" "); - } - item.SetColumn( 3 ); - item.SetText( tmp ); - m_printerListCtrl->SetItem( item ); - } - - item.SetColumn( 1 ); - item.SetId( 1+ item.GetId() ); - } - } - - - printer_sizer->Add( m_printerListCtrl, 0, wxALL|wxGROW, 5 ); - - wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); - main_sizer->Add( item1, 0, wxALL, 5 ); - - // printer options (on the left) - - wxBoxSizer *item2 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBox *item4 = new wxStaticBox( this, wxPRINTID_STATIC, _("Paper size") ); - wxStaticBoxSizer *item3 = new wxStaticBoxSizer( item4, wxVERTICAL ); - - m_paperTypeChoice = CreatePaperTypeChoice(); - item3->Add( m_paperTypeChoice, 0, wxALIGN_CENTER|wxALL, 5 ); - - item2->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 ); - - wxString strs6[] = - { - _("Portrait"), - _("Landscape") - }; - m_orientationRadioBox= new wxRadioBox( this, wxPRINTID_ORIENTATION, _("Orientation"), wxDefaultPosition, wxDefaultSize, 2, strs6, 1, wxRA_SPECIFY_ROWS ); - item2->Add( m_orientationRadioBox, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - wxStaticBox *item8 = new wxStaticBox( this, wxID_ANY, _("Options") ); - wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxHORIZONTAL ); - - m_colourCheckBox = new wxCheckBox( this, wxPRINTID_PRINTCOLOUR, _("Print in colour") ); - item7->Add( m_colourCheckBox, 0, wxALIGN_CENTER|wxALL, 5 ); - - item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - item1->Add( item2, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - // spooling options (on the right) - - wxStaticBox *item11 = new wxStaticBox( this, wxID_ANY, _("Print spooling") ); - wxStaticBoxSizer *item10 = new wxStaticBoxSizer( item11, wxVERTICAL ); - - wxStaticText *item12 = new wxStaticText( this, wxID_ANY, _("Printer command:") ); - item10->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - wxBoxSizer *item13 = new wxBoxSizer( wxHORIZONTAL ); - - item13->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); - - m_printerCommandText = new wxTextCtrl( this, wxPRINTID_COMMAND, wxEmptyString, wxDefaultPosition, wxSize(160,wxDefaultCoord) ); - item13->Add( m_printerCommandText, 0, wxALIGN_CENTER|wxALL, 5 ); - - item10->Add( item13, 0, wxALIGN_CENTER|wxALL, 0 ); - - wxStaticText *item15 = new wxStaticText( this, wxID_ANY, _("Printer options:") ); - item10->Add( item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL ); - - item16->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); - - m_printerOptionsText = new wxTextCtrl( this, wxPRINTID_OPTIONS, wxEmptyString, wxDefaultPosition, wxSize(160,wxDefaultCoord) ); - item16->Add( m_printerOptionsText, 0, wxALIGN_CENTER|wxALL, 5 ); - - item10->Add( item16, 0, wxALIGN_CENTER|wxALL, 0 ); - - item1->Add( item10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - -#if wxUSE_STATLINE - // static line - main_sizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 ); -#endif - - // buttons - - main_sizer->Add( CreateButtonSizer( wxOK|wxCANCEL), 0, wxEXPAND|wxALL, 10 ); - - SetAutoLayout( true ); - SetSizer( main_sizer ); - - main_sizer->Fit( this ); - Centre(wxBOTH); - - - Fit(); - Centre(wxBOTH); - - InitDialog(); -} - -wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog() -{ -} - -void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event) -{ - // Delete check mark - for (long item = 0; item < m_printerListCtrl->GetItemCount(); item++) - m_printerListCtrl->SetItemImage( item, -1 ); - - m_printerListCtrl->SetItemImage( event.GetIndex(), 0 ); - - if (event.GetIndex() == 0) - { - m_printerCommandText->SetValue( wxT("lpr") ); - } - else - { - wxListItem li; - li.SetColumn( 1 ); - li.SetMask( wxLIST_MASK_TEXT ); - li.SetId( event.GetIndex() ); - m_printerListCtrl->GetItem( li ); - m_printerCommandText->SetValue( _T("lpr -P") + li.GetText() ); - } -} - -bool wxGenericPrintSetupDialog::TransferDataToWindow() -{ - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - if (m_printerCommandText && data->GetPrinterCommand()) - m_printerCommandText->SetValue(data->GetPrinterCommand()); - if (m_printerOptionsText && data->GetPrinterOptions()) - m_printerOptionsText->SetValue(data->GetPrinterOptions()); - if (m_colourCheckBox) - m_colourCheckBox->SetValue(m_printData.GetColour()); - - if (m_orientationRadioBox) - { - if (m_printData.GetOrientation() == wxPORTRAIT) - m_orientationRadioBox->SetSelection(0); - else - m_orientationRadioBox->SetSelection(1); - } - return true; -} - -bool wxGenericPrintSetupDialog::TransferDataFromWindow() -{ - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - // find selected printer - long id = m_printerListCtrl->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); - if (id == 0) - { - m_printData.SetPrinterName( wxEmptyString ); - } - else - { - wxListItem item; - item.SetId( id ); - item.SetMask( wxLIST_MASK_TEXT ); - item.SetColumn( 1 ); - m_printerListCtrl->GetItem( item ); - m_printData.SetPrinterName( item.GetText() ); - } - - if (m_printerCommandText) - data->SetPrinterCommand(m_printerCommandText->GetValue()); - if (m_printerOptionsText) - data->SetPrinterOptions(m_printerOptionsText->GetValue()); - if (m_colourCheckBox) - m_printData.SetColour(m_colourCheckBox->GetValue()); - if (m_orientationRadioBox) - { - int sel = m_orientationRadioBox->GetSelection(); - if (sel == 0) - m_printData.SetOrientation(wxPORTRAIT); - else - m_printData.SetOrientation(wxLANDSCAPE); - } - if (m_paperTypeChoice) - { - int selectedItem = m_paperTypeChoice->GetSelection(); - if (selectedItem != -1) - { - wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem); - if (paper != NULL) - m_printData.SetPaperId( paper->GetId()); - } - } - - if (m_targetData) - *m_targetData = m_printData; - - return true; -} - -wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice() -{ - size_t n = wxThePrintPaperDatabase->GetCount(); - wxString *choices = new wxString [n]; - size_t sel = 0; - - for (size_t i = 0; i < n; i++) - { - wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i); - choices[i] = paper->GetName(); - if (m_printData.GetPaperId() == paper->GetId()) - sel = i; - } - - int width = 250; - - wxComboBox *choice = new wxComboBox( this, - wxPRINTID_PAPERSIZE, - _("Paper Size"), - wxDefaultPosition, - wxSize(width, wxDefaultCoord), - n, choices ); - - delete[] choices; - - choice->SetSelection(sel); - return choice; -} - -#endif // wxUSE_POSTSCRIPT - -// ---------------------------------------------------------------------------- -// Generic page setup dialog -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxPageSetupDialogBase) - -BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxPageSetupDialogBase) - EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter) -END_EVENT_TABLE() - -wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, - wxPageSetupDialogData* data) - : wxPageSetupDialogBase( parent, - wxID_ANY, - _("Page Setup"), - wxPoint(0,0), - wxSize(600, 600), - wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL ) -{ - if (data) - m_pageData = *data; - - int textWidth = 80; - - wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); - - // 1) top - wxStaticBoxSizer *topsizer = new wxStaticBoxSizer( - new wxStaticBox(this,wxPRINTID_STATIC, _("Paper size")), wxHORIZONTAL ); - - size_t n = wxThePrintPaperDatabase->GetCount(); - wxString *choices = new wxString [n]; - - for (size_t i = 0; i < n; i++) - { - wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i); - choices[i] = paper->GetName(); - } - - m_paperTypeChoice = new wxComboBox( this, - wxPRINTID_PAPERSIZE, - _("Paper Size"), - wxDefaultPosition, - wxSize(300, wxDefaultCoord), - n, choices ); - topsizer->Add( m_paperTypeChoice, 1, wxEXPAND|wxALL, 5 ); -// m_paperTypeChoice->SetSelection(sel); - - mainsizer->Add( topsizer, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 ); - - // 2) middle sizer with radio box - - wxString *choices2 = new wxString[2]; - choices2[0] = _("Portrait"); - choices2[1] = _("Landscape"); - m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"), - wxDefaultPosition, wxDefaultSize, 2, choices2, 2); - m_orientationRadioBox->SetSelection(0); - - mainsizer->Add( m_orientationRadioBox, 0, wxTOP|wxLEFT|wxRIGHT, 10 ); - - // 3) margins - - wxBoxSizer *table = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer *column1 = new wxBoxSizer( wxVERTICAL ); - column1->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 ); - column1->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 ); - table->Add( column1, 0, wxALL | wxEXPAND, 5 ); - - wxBoxSizer *column2 = new wxBoxSizer( wxVERTICAL ); - m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultCoord)); - m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultCoord)); - column2->Add( m_marginLeftText, 1, wxALL, 5 ); - column2->Add( m_marginTopText, 1, wxALL, 5 ); - table->Add( column2, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, 5 ); - - wxBoxSizer *column3 = new wxBoxSizer( wxVERTICAL ); - column3->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 ); - column3->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 ); - table->Add( column3, 0, wxALL | wxEXPAND, 5 ); - - wxBoxSizer *column4 = new wxBoxSizer( wxVERTICAL ); - m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultCoord)); - m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultCoord)); - column4->Add( m_marginRightText, 1, wxALL, 5 ); - column4->Add( m_marginBottomText, 1, wxALL, 5 ); - table->Add( column4, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, 5 ); - - mainsizer->Add( table, 0 ); - -#if wxUSE_STATLINE - // 5) static line - mainsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 ); -#endif - - // 6) buttons - - wxSizer* buttonsizer = CreateButtonSizer( wxOK|wxCANCEL); - - if (wxPrintFactory::GetFactory()->HasPrintSetupDialog()) - { - m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") ); - buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 ); - if ( !m_pageData.GetEnablePrinter() ) - m_printerButton->Enable(false); - } - else - { - m_printerButton = NULL; - } - - // if (m_printData.GetEnableHelp()) - // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), wxDefaultCoord, wxDefaultCoord, buttonWidth, buttonHeight); - mainsizer->Add( buttonsizer, 0, wxEXPAND|wxALL, 10 ); - - - SetAutoLayout( true ); - SetSizer( mainsizer ); - - mainsizer->Fit( this ); - Centre(wxBOTH); - - InitDialog(); - - delete[] choices; - delete [] choices2; -} - -wxGenericPageSetupDialog::~wxGenericPageSetupDialog() -{ -} - -wxPageSetupDialogData& wxGenericPageSetupDialog::GetPageSetupDialogData() -{ - return m_pageData; -} - -bool wxGenericPageSetupDialog::TransferDataToWindow() -{ - if (m_marginLeftText) - m_marginLeftText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginTopLeft().x)); - if (m_marginTopText) - m_marginTopText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginTopLeft().y)); - if (m_marginRightText) - m_marginRightText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginBottomRight().x)); - if (m_marginBottomText) - m_marginBottomText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginBottomRight().y)); - - if (m_orientationRadioBox) - { - if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT) - m_orientationRadioBox->SetSelection(0); - else - m_orientationRadioBox->SetSelection(1); - } - - // Find the paper type from either the current paper size in the wxPageSetupDialogData, or - // failing that, the id in the wxPrintData object. - - wxPrintPaperType* type = wxThePrintPaperDatabase->FindPaperType( - wxSize(m_pageData.GetPaperSize().x * 10, m_pageData.GetPaperSize().y * 10)); - - if (!type && m_pageData.GetPrintData().GetPaperId() != wxPAPER_NONE) - type = wxThePrintPaperDatabase->FindPaperType(m_pageData.GetPrintData().GetPaperId()); - - if (type) - { - m_paperTypeChoice->SetStringSelection(type->GetName()); - } - - return true; -} - -bool wxGenericPageSetupDialog::TransferDataFromWindow() -{ - if (m_marginLeftText && m_marginTopText) - { - int left = wxAtoi( m_marginLeftText->GetValue().c_str() ); - int top = wxAtoi( m_marginTopText->GetValue().c_str() ); - m_pageData.SetMarginTopLeft( wxPoint(left,top) ); - } - if (m_marginRightText && m_marginBottomText) - { - int right = wxAtoi( m_marginRightText->GetValue().c_str() ); - int bottom = wxAtoi( m_marginBottomText->GetValue().c_str() ); - m_pageData.SetMarginBottomRight( wxPoint(right,bottom) ); - } - - if (m_orientationRadioBox) - { - int sel = m_orientationRadioBox->GetSelection(); - if (sel == 0) - { - m_pageData.GetPrintData().SetOrientation(wxPORTRAIT); - } - else - { - m_pageData.GetPrintData().SetOrientation(wxLANDSCAPE); - } - } - - if (m_paperTypeChoice) - { - int selectedItem = m_paperTypeChoice->GetSelection(); - if (selectedItem != -1) - { - wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem); - if ( paper ) - { - m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10)); - m_pageData.GetPrintData().SetPaperId(paper->GetId()); - } - } - } - - return true; -} - -wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y) -{ -/* - if (!wxThePrintPaperDatabase) - { - wxThePrintPaperDatabase = new wxPrintPaperDatabase; - wxThePrintPaperDatabase->CreateDatabase(); - } -*/ - - size_t n = wxThePrintPaperDatabase->GetCount(); - wxString *choices = new wxString [n]; - - for (size_t i = 0; i < n; i++) - { - wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i); - choices[i] = paper->GetName(); - } - - (void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y)); - *y += 25; - - wxComboBox *choice = new wxComboBox( this, - wxPRINTID_PAPERSIZE, - _("Paper Size"), - wxPoint(*x, *y), - wxSize(300, wxDefaultCoord), - n, choices ); - *y += 35; - delete[] choices; - -// choice->SetSelection(sel); - return choice; -} - -void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) -{ - // We no longer query GetPrintMode, so we can eliminate the need - // to call SetPrintMode. - // This has the limitation that we can't explicitly call the PostScript - // print setup dialog from the generic Page Setup dialog under Windows, - // but since this choice would only happen when trying to do PostScript - // printing under Windows (and only in 16-bit Windows which - // doesn't have a Windows-specific page setup dialog) it's worth it. - - // First save the current settings, so the wxPrintData object is up to date. - TransferDataFromWindow(); - - // Transfer the current print settings from this dialog to the page setup dialog. - -#if 0 - // Use print factory later - - wxPrintDialogData data; - data = GetPageSetupData().GetPrintData(); - data.SetSetupDialog(true); - wxPrintDialog printDialog(this, & data); - printDialog.ShowModal(); - - // Transfer the page setup print settings from the page dialog to this dialog again, in case - // the page setup dialog changed something. - GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData(); - GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData - - // Now update the dialog in case the page setup dialog changed some of our settings. - TransferDataToWindow(); -#endif -} - -#endif diff --git a/Source/3rdParty/wx/src/generic/progdlgg.cpp b/Source/3rdParty/wx/src/generic/progdlgg.cpp deleted file mode 100644 index 3b63456cf..000000000 --- a/Source/3rdParty/wx/src/generic/progdlgg.cpp +++ /dev/null @@ -1,673 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/progdlgg.cpp -// Purpose: wxProgressDialog class -// Author: Karsten Ballueder -// Modified by: -// Created: 09.05.1999 -// RCS-ID: $Id: progdlgg.cpp 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) Karsten Ballueder -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_PROGRESSDLG - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/frame.h" - #include "wx/button.h" - #include "wx/stattext.h" - #include "wx/sizer.h" - #include "wx/event.h" - #include "wx/gauge.h" - #include "wx/intl.h" - #include "wx/dcclient.h" - #include "wx/timer.h" - #include "wx/settings.h" -#endif - -#include "wx/progdlg.h" - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -/* Macro for avoiding #ifdefs when value have to be different depending on size of - device we display on - take it from something like wxDesktopPolicy in the future - */ - -#if defined(__SMARTPHONE__) - #define wxLARGESMALL(large,small) small -#else - #define wxLARGESMALL(large,small) large -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#define LAYOUT_MARGIN wxLARGESMALL(8,2) - -static const int wxID_SKIP = 32000; // whatever - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// update the label to show the given time (in seconds) -static void SetTimeLabel(unsigned long val, wxStaticText *label); - -// ---------------------------------------------------------------------------- -// event tables -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxProgressDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxProgressDialog::OnCancel) - EVT_BUTTON(wxID_SKIP, wxProgressDialog::OnSkip) - - EVT_CLOSE(wxProgressDialog::OnClose) -END_EVENT_TABLE() - -IMPLEMENT_CLASS(wxProgressDialog, wxDialog) - -// ============================================================================ -// wxProgressDialog implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxProgressDialog creation -// ---------------------------------------------------------------------------- - -wxProgressDialog::wxProgressDialog(wxString const &title, - wxString const &message, - int maximum, - wxWindow *parent, - int style) - : wxDialog(parent, wxID_ANY, title), - m_skip(false), - m_delay(3), - m_hasAbortButton(false), - m_hasSkipButton(false) -{ - // we may disappear at any moment, let the others know about it - SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); - m_windowStyle |= style; - - m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0; - m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0; - - bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - // we have to remove the "Close" button from the title bar then as it is - // confusing to have it - it doesn't work anyhow - // - // FIXME: should probably have a (extended?) window style for this - if ( !m_hasAbortButton ) - { - EnableCloseButton(false); - } -#endif // wxMSW - -#if defined(__SMARTPHONE__) - SetLeftMenu(); -#endif - - m_state = m_hasAbortButton ? Continue : Uncancelable; - m_maximum = maximum; - -#if defined(__WXMSW__) || defined(__WXPM__) - // we can't have values > 65,536 in the progress control under Windows, so - // scale everything down - m_factor = m_maximum / 65536 + 1; - m_maximum /= m_factor; -#endif // __WXMSW__ - - m_parentTop = wxGetTopLevelParent(parent); - - wxClientDC dc(this); - dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - long widthText = 0; - dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL); - - wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - - m_msg = new wxStaticText(this, wxID_ANY, message); - sizer->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); - - wxSize sizeDlg, - sizeLabel = m_msg->GetSize(); - sizeDlg.y = 2*LAYOUT_MARGIN + sizeLabel.y; - - if ( maximum > 0 ) - { - int gauge_style = wxGA_HORIZONTAL; - if ( ( style & wxPD_SMOOTH ) == wxPD_SMOOTH ) - gauge_style |= wxGA_SMOOTH; - m_gauge = new wxGauge(this, wxID_ANY, m_maximum, - wxDefaultPosition, wxDefaultSize, - gauge_style ); - - sizer->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN); - m_gauge->SetValue(0); - - wxSize sizeGauge = m_gauge->GetSize(); - sizeDlg.y += 2*LAYOUT_MARGIN + sizeGauge.y; - } - else - m_gauge = (wxGauge *)NULL; - - // create the estimated/remaining/total time zones if requested - m_elapsed = m_estimated = m_remaining = (wxStaticText*)NULL; - m_display_estimated = m_last_timeupdate = m_break = 0; - m_ctdelay = 0; - - // if we are going to have at least one label, remember it in this var - wxStaticText *label = NULL; - - // also count how many labels we really have - size_t nTimeLabels = 0; - - if ( style & wxPD_ELAPSED_TIME ) - { - nTimeLabels++; - - label = - m_elapsed = CreateLabel(_("Elapsed time : "), sizer); - } - - if ( style & wxPD_ESTIMATED_TIME ) - { - nTimeLabels++; - - label = - m_estimated = CreateLabel(_("Estimated time : "), sizer); - } - - if ( style & wxPD_REMAINING_TIME ) - { - nTimeLabels++; - - label = - m_remaining = CreateLabel(_("Remaining time : "), sizer); - } - - if ( nTimeLabels > 0 ) - { - // set it to the current time - m_timeStart = wxGetCurrentTime(); - sizeDlg.y += nTimeLabels * (label->GetSize().y + LAYOUT_MARGIN); - } - -#if defined(__SMARTPHONE__) - if ( m_hasSkipButton ) - SetRightMenu(wxID_SKIP, _("Skip")); - if ( m_hasAbortButton ) - SetLeftMenu(wxID_CANCEL); -#else - m_btnAbort = m_btnSkip = (wxButton *)NULL; - bool sizeDlgModified = false; - wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); - - const int sizerFlags = -#if defined(__WXMSW__) || defined(__WXPM__) - wxALIGN_RIGHT | wxALL -#else // !MSW - wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP -#endif // MSW/!MSW - ; - - if ( m_hasSkipButton ) - { - m_btnSkip = new wxButton(this, wxID_SKIP, _("Skip")); - - // Windows dialogs usually have buttons in the lower right corner - buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN); - sizeDlg.y += 2*LAYOUT_MARGIN + wxButton::GetDefaultSize().y; - sizeDlgModified = true; - } - - if ( m_hasAbortButton ) - { - m_btnAbort = new wxButton(this, wxID_CANCEL); - - // Windows dialogs usually have buttons in the lower right corner - buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN); - if(!sizeDlgModified) - sizeDlg.y += 2*LAYOUT_MARGIN + wxButton::GetDefaultSize().y; - } - - sizer->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); -#endif // __SMARTPHONE__/!__SMARTPHONE__ - - SetSizerAndFit(sizer); - - if (!isPda) - { - sizeDlg.y += 2*LAYOUT_MARGIN; - - // try to make the dialog not square but rectangular of reasonable width - sizeDlg.x = (wxCoord)wxMax(3*widthText/2, 4*sizeDlg.y/3); - SetClientSize(sizeDlg); - } - - Centre(wxCENTER_FRAME | wxBOTH); - - if ( style & wxPD_APP_MODAL ) - { - m_winDisabler = new wxWindowDisabler(this); - } - else - { - if ( m_parentTop ) - m_parentTop->Disable(); - m_winDisabler = NULL; - } - - Show(); - Enable(); - - // this one can be initialized even if the others are unknown for now - // - // NB: do it after calling Layout() to keep the labels correctly aligned - if ( m_elapsed ) - { - SetTimeLabel(0, m_elapsed); - } - - Update(); -} - -wxStaticText *wxProgressDialog::CreateLabel(const wxString& text, - wxSizer *sizer) -{ - wxBoxSizer *locsizer = new wxBoxSizer(wxLARGESMALL(wxHORIZONTAL,wxVERTICAL)); - - wxStaticText *dummy = new wxStaticText(this, wxID_ANY, text); - wxStaticText *label = new wxStaticText(this, wxID_ANY, _("unknown")); - - // select placement most native or nice on target GUI -#if defined(__SMARTPHONE__) - // label and time to the left in two rows - locsizer->Add(dummy, 1, wxALIGN_LEFT); - locsizer->Add(label, 1, wxALIGN_LEFT); - sizer->Add(locsizer, 0, wxALIGN_LEFT | wxTOP | wxLEFT, LAYOUT_MARGIN); -#elif defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMAC__) || defined(__WXGTK20__) - // label and time centered in one row - locsizer->Add(dummy, 1, wxLARGESMALL(wxALIGN_RIGHT,wxALIGN_LEFT)); - locsizer->Add(label, 1, wxALIGN_LEFT | wxLEFT, LAYOUT_MARGIN); - sizer->Add(locsizer, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); -#else - // label and time to the right in one row - sizer->Add(locsizer, 0, wxALIGN_RIGHT | wxRIGHT | wxTOP, LAYOUT_MARGIN); - locsizer->Add(dummy); - locsizer->Add(label, 0, wxLEFT, LAYOUT_MARGIN); -#endif - - return label; -} - -// ---------------------------------------------------------------------------- -// wxProgressDialog operations -// ---------------------------------------------------------------------------- - -bool -wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip) -{ - wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") ); - -#ifdef __WXMSW__ - value /= m_factor; -#endif // __WXMSW__ - - wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") ); - - if ( m_gauge ) - m_gauge->SetValue(value); - - UpdateMessage(newmsg); - - if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) ) - { - unsigned long elapsed = wxGetCurrentTime() - m_timeStart; - if ( m_last_timeupdate < elapsed - || value == m_maximum - ) - { - m_last_timeupdate = elapsed; - unsigned long estimated = m_break + - (unsigned long)(( (double) (elapsed-m_break) * m_maximum ) / ((double)value)) ; - if ( estimated > m_display_estimated - && m_ctdelay >= 0 - ) - { - ++m_ctdelay; - } - else if ( estimated < m_display_estimated - && m_ctdelay <= 0 - ) - { - --m_ctdelay; - } - else - { - m_ctdelay = 0; - } - if ( m_ctdelay >= m_delay // enough confirmations for a higher value - || m_ctdelay <= (m_delay*-1) // enough confirmations for a lower value - || value == m_maximum // to stay consistent - || elapsed > m_display_estimated // to stay consistent - || ( elapsed > 0 && elapsed < 4 ) // additional updates in the beginning - ) - { - m_display_estimated = estimated; - m_ctdelay = 0; - } - } - - long display_remaining = m_display_estimated - elapsed; - if ( display_remaining < 0 ) - { - display_remaining = 0; - } - - SetTimeLabel(elapsed, m_elapsed); - SetTimeLabel(m_display_estimated, m_estimated); - SetTimeLabel(display_remaining, m_remaining); - } - - if ( value == m_maximum ) - { - if ( m_state == Finished ) - { - // ignore multiple calls to Update(m_maximum): it may sometimes be - // troublesome to ensure that Update() is not called twice with the - // same value (e.g. because of the rounding errors) and if we don't - // return now we're going to generate asserts below - return true; - } - - // so that we return true below and that out [Cancel] handler knew what - // to do - m_state = Finished; - if( !(GetWindowStyle() & wxPD_AUTO_HIDE) ) - { - EnableClose(); - DisableSkip(); -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - EnableCloseButton(); -#endif // __WXMSW__ - - if ( newmsg.empty() ) - { - // also provide the finishing message if the application didn't - m_msg->SetLabel(_("Done.")); - } - - wxYieldIfNeeded() ; - - (void)ShowModal(); - } - else // auto hide - { - // reenable other windows before hiding this one because otherwise - // Windows wouldn't give the focus back to the window which had - // been previously focused because it would still be disabled - ReenableOtherWindows(); - - Hide(); - } - } - else // not at maximum yet - { - return DoAfterUpdate(skip); - } - - // update the display in case yielding above didn't do it - Update(); - - return m_state != Canceled; -} - -bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip) -{ - wxASSERT_MSG( m_gauge, wxT("cannot update non existent dialog") ); - - // show a bit of progress - m_gauge->Pulse(); - - UpdateMessage(newmsg); - - if (m_elapsed || m_remaining || m_estimated) - { - unsigned long elapsed = wxGetCurrentTime() - m_timeStart; - - SetTimeLabel(elapsed, m_elapsed); - SetTimeLabel((unsigned long)-1, m_estimated); - SetTimeLabel((unsigned long)-1, m_remaining); - } - - return DoAfterUpdate(skip); -} - -bool wxProgressDialog::DoAfterUpdate(bool *skip) -{ - // we have to yield because not only we want to update the display but - // also to process the clicks on the cancel and skip buttons - wxYieldIfNeeded(); - - Update(); - - if ( m_skip && skip && !*skip ) - { - *skip = true; - m_skip = false; - EnableSkip(); - } - - return m_state != Canceled; -} - -void wxProgressDialog::Resume() -{ - m_state = Continue; - m_ctdelay = m_delay; // force an update of the elapsed/estimated/remaining time - m_break += wxGetCurrentTime()-m_timeStop; - - EnableAbort(); - EnableSkip(); - m_skip = false; -} - -bool wxProgressDialog::Show( bool show ) -{ - // reenable other windows before hiding this one because otherwise - // Windows wouldn't give the focus back to the window which had - // been previously focused because it would still be disabled - if(!show) - ReenableOtherWindows(); - - return wxDialog::Show(show); -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -void wxProgressDialog::OnCancel(wxCommandEvent& event) -{ - if ( m_state == Finished ) - { - // this means that the count down is already finished and we're being - // shown as a modal dialog - so just let the default handler do the job - event.Skip(); - } - else - { - // request to cancel was received, the next time Update() is called we - // will handle it - m_state = Canceled; - - // update the buttons state immediately so that the user knows that the - // request has been noticed - DisableAbort(); - DisableSkip(); - - // save the time when the dialog was stopped - m_timeStop = wxGetCurrentTime(); - } -} - -void wxProgressDialog::OnSkip(wxCommandEvent& WXUNUSED(event)) -{ - DisableSkip(); - m_skip = true; -} - -void wxProgressDialog::OnClose(wxCloseEvent& event) -{ - if ( m_state == Uncancelable ) - { - // can't close this dialog - event.Veto(); - } - else if ( m_state == Finished ) - { - // let the default handler close the window as we already terminated - event.Skip(); - } - else - { - // next Update() will notice it - m_state = Canceled; - DisableAbort(); - DisableSkip(); - - m_timeStop = wxGetCurrentTime(); - } -} - -// ---------------------------------------------------------------------------- -// destruction -// ---------------------------------------------------------------------------- - -wxProgressDialog::~wxProgressDialog() -{ - // normally this should have been already done, but just in case - ReenableOtherWindows(); -} - -void wxProgressDialog::ReenableOtherWindows() -{ - if ( GetWindowStyle() & wxPD_APP_MODAL ) - { - delete m_winDisabler; - m_winDisabler = (wxWindowDisabler *)NULL; - } - else - { - if ( m_parentTop ) - m_parentTop->Enable(); - } -} - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -static void SetTimeLabel(unsigned long val, wxStaticText *label) -{ - if ( label ) - { - wxString s; - - if (val != (unsigned long)-1) - { - unsigned long hours = val / 3600; - unsigned long minutes = (val % 3600) / 60; - unsigned long seconds = val % 60; - s.Printf(wxT("%lu:%02lu:%02lu"), hours, minutes, seconds); - } - else - { - s = _("Unknown"); - } - - if ( s != label->GetLabel() ) - label->SetLabel(s); - } -} - -void wxProgressDialog::EnableSkip(bool enable) -{ - if(m_hasSkipButton) - { -#ifdef __SMARTPHONE__ - if(enable) - SetRightMenu(wxID_SKIP, _("Skip")); - else - SetRightMenu(); -#else - if(m_btnSkip) - m_btnSkip->Enable(enable); -#endif - } -} - -void wxProgressDialog::EnableAbort(bool enable) -{ - if(m_hasAbortButton) - { -#ifdef __SMARTPHONE__ - if(enable) - SetLeftMenu(wxID_CANCEL); // stock buttons makes Cancel label - else - SetLeftMenu(); -#else - if(m_btnAbort) - m_btnAbort->Enable(enable); -#endif - } -} - -void wxProgressDialog::EnableClose() -{ - if(m_hasAbortButton) - { -#ifdef __SMARTPHONE__ - SetLeftMenu(wxID_CANCEL, _("Close")); -#else - if(m_btnAbort) - { - m_btnAbort->Enable(); - m_btnAbort->SetLabel(_("Close")); - } -#endif - } -} - -void wxProgressDialog::UpdateMessage(const wxString &newmsg) -{ - if ( !newmsg.empty() && newmsg != m_msg->GetLabel() ) - { - m_msg->SetLabel(newmsg); - - wxYieldIfNeeded() ; - } -} - -#endif // wxUSE_PROGRESSDLG diff --git a/Source/3rdParty/wx/src/generic/renderg.cpp b/Source/3rdParty/wx/src/generic/renderg.cpp deleted file mode 100644 index 8c36e31d1..000000000 --- a/Source/3rdParty/wx/src/generic/renderg.cpp +++ /dev/null @@ -1,678 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/renderg.cpp -// Purpose: generic implementation of wxRendererNative (for any platform) -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.07.2003 -// RCS-ID: $Id: renderg.cpp 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/renderer.h" - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/dc.h" - #include "wx/settings.h" - #include "wx/gdicmn.h" - #include "wx/module.h" -#endif //WX_PRECOMP - -#include "wx/splitter.h" -#include "wx/dcmirror.h" - -// ---------------------------------------------------------------------------- -// wxRendererGeneric: our wxRendererNative implementation -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRendererGeneric : public wxRendererNative -{ -public: - wxRendererGeneric(); - - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); - - virtual int DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); - - virtual int GetHeaderButtonHeight(wxWindow *win); - - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position, - wxOrientation orient, - int flags = 0); - - virtual void DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawCheckBox(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual void DrawItemSelectionRect(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); - - virtual wxRendererVersion GetVersion() const - { - return wxRendererVersion(wxRendererVersion::Current_Version, - wxRendererVersion::Current_Age); - } - - - // Cleanup by deleting standard renderer - static void Cleanup(); - - // Get the generic object - static wxRendererGeneric* DoGetGeneric(); - -protected: - // draw the rectange using the first pen for the left and top sides and - // the second one for the bottom and right ones - void DrawShadedRect(wxDC& dc, wxRect *rect, - const wxPen& pen1, const wxPen& pen2); - - // the standard pens - wxPen m_penBlack, - m_penDarkGrey, - m_penLightGrey, - m_penHighlight; - - static wxRendererGeneric* sm_rendererGeneric; -}; - -// ============================================================================ -// wxRendererGeneric implementation -// ============================================================================ - -// Get the generic object -wxRendererGeneric* wxRendererGeneric::DoGetGeneric() -{ - if (!sm_rendererGeneric) - sm_rendererGeneric = new wxRendererGeneric; - return sm_rendererGeneric; -} - -// ---------------------------------------------------------------------------- -// wxRendererGeneric creation -// ---------------------------------------------------------------------------- - -/* static */ -wxRendererNative& wxRendererNative::GetGeneric() -{ - return * wxRendererGeneric::DoGetGeneric(); -} - -void wxRendererGeneric::Cleanup() -{ - if (sm_rendererGeneric) - delete sm_rendererGeneric; - - sm_rendererGeneric = NULL; -} - -wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL; - -wxRendererGeneric::wxRendererGeneric() - : m_penBlack(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)), - m_penDarkGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)), - m_penLightGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)), - m_penHighlight(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT)) -{ -} - -// ---------------------------------------------------------------------------- -// wxRendererGeneric helpers -// ---------------------------------------------------------------------------- - -void -wxRendererGeneric::DrawShadedRect(wxDC& dc, - wxRect *rect, - const wxPen& pen1, - const wxPen& pen2) -{ - // draw the rectangle - dc.SetPen(pen1); - dc.DrawLine(rect->GetLeft(), rect->GetTop(), - rect->GetLeft(), rect->GetBottom()); - dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(), - rect->GetRight(), rect->GetTop()); - dc.SetPen(pen2); - dc.DrawLine(rect->GetRight(), rect->GetTop(), - rect->GetRight(), rect->GetBottom()); - dc.DrawLine(rect->GetLeft(), rect->GetBottom(), - rect->GetRight() + 1, rect->GetBottom()); - - // adjust the rect - rect->Inflate(-1); -} - -// ---------------------------------------------------------------------------- -// tree/list ctrl drawing -// ---------------------------------------------------------------------------- - -int -wxRendererGeneric::DrawHeaderButton(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags, - wxHeaderSortIconType sortArrow, - wxHeaderButtonParams* params) -{ - const int CORNER = 1; - - const wxCoord x = rect.x, - y = rect.y, - w = rect.width, - h = rect.height; - - dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); - dc.SetPen(*wxTRANSPARENT_PEN); - dc.DrawRectangle(rect); - - dc.SetBrush(*wxTRANSPARENT_BRUSH); - - dc.SetPen(m_penBlack); - dc.DrawLine( x+w-CORNER+1, y, x+w, y+h ); // right (outer) - dc.DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer) - - dc.SetPen(m_penDarkGrey); - dc.DrawLine( x+w-CORNER, y, x+w-1, y+h ); // right (inner) - dc.DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner) - - dc.SetPen(m_penHighlight); - dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer) - dc.DrawRectangle( x, y, 1, h ); // left (outer) - dc.DrawLine( x, y+h-1, x+1, y+h-1 ); - dc.DrawLine( x+w-1, y, x+w-1, y+1 ); - - return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); -} - - -int -wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags, - wxHeaderSortIconType sortArrow, - wxHeaderButtonParams* params) -{ - int labelWidth = 0; - - // Mark this item as selected. For the generic version we'll just draw an - // underline - if ( flags & wxCONTROL_SELECTED ) - { - // draw a line at the bottom of the header button, overlaying the - // native hot-tracking line (on XP) - const int penwidth = 3; - int y = rect.y + rect.height + 1 - penwidth; - wxColour c = (params && params->m_selectionColour.Ok()) ? - params->m_selectionColour : wxColour(0x66, 0x66, 0x66); - wxPen pen(c, penwidth); - pen.SetCap(wxCAP_BUTT); - dc.SetPen(pen); - dc.DrawLine(rect.x, y, rect.x + rect.width, y); - } - - // Draw an up or down arrow - int arrowSpace = 0; - if (sortArrow != wxHDR_SORT_ICON_NONE ) - { - wxRect ar = rect; - - // make a rect for the arrow - ar.height = 4; - ar.width = 8; - ar.y += (rect.height - ar.height)/2; - ar.x = ar.x + rect.width - 3*ar.width/2; - arrowSpace = 3*ar.width/2; // space to preserve when drawing the label - - wxPoint triPt[3]; - if ( sortArrow & wxHDR_SORT_ICON_UP ) - { - triPt[0].x = ar.width / 2; - triPt[0].y = 0; - triPt[1].x = ar.width; - triPt[1].y = ar.height; - triPt[2].x = 0; - triPt[2].y = ar.height; - } - else - { - triPt[0].x = 0; - triPt[0].y = 0; - triPt[1].x = ar.width; - triPt[1].y = 0; - triPt[2].x = ar.width / 2; - triPt[2].y = ar.height; - } - - wxColour c = (params && params->m_arrowColour.Ok()) ? - params->m_arrowColour : wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); - dc.SetPen(wxPen(c)); - dc.SetBrush(wxBrush(c)); - dc.DrawPolygon( 3, triPt, ar.x, ar.y); - } - labelWidth += arrowSpace; - - const int margin = 5; // number of pixels to reserve on either side of the label - int bmpWidth = 0; - int txtEnd = 0; - - if ( params && params->m_labelBitmap.Ok() ) - bmpWidth = params->m_labelBitmap.GetWidth() + 2; - - labelWidth += bmpWidth + 2*margin; - - // Draw a label if one is given - if ( params && !params->m_labelText.empty() ) - { - wxFont font = params->m_labelFont.Ok() ? - params->m_labelFont : win->GetFont(); - wxColour clr = params->m_labelColour.Ok() ? - params->m_labelColour : win->GetForegroundColour(); - - wxString label( params->m_labelText ); - - dc.SetFont(font); - dc.SetTextForeground(clr); - dc.SetBackgroundMode(wxTRANSPARENT); - - int tw, th, td, x, y; - dc.GetTextExtent( label, &tw, &th, &td); - labelWidth += tw; - y = rect.y + wxMax(0, (rect.height - (th+td)) / 2); - - // truncate and add an ellipsis (...) if the text is too wide. - int targetWidth = rect.width - arrowSpace - bmpWidth - 2*margin; - if ( tw > targetWidth ) - { - int ellipsisWidth; - dc.GetTextExtent( wxT("..."), &ellipsisWidth, NULL); - do { - label.Truncate( label.length() - 1 ); - dc.GetTextExtent( label, &tw, &th); - } while (tw + ellipsisWidth > targetWidth && label.length() ); - label.append( wxT("...") ); - tw += ellipsisWidth; - } - - switch (params->m_labelAlignment) - { - default: - case wxALIGN_LEFT: - x = rect.x + margin; - break; - case wxALIGN_CENTER: - x = rect.x + wxMax(0, (rect.width - arrowSpace - tw - bmpWidth)/2); - break; - case wxALIGN_RIGHT: - x = rect.x + wxMax(0, rect.width - arrowSpace - margin - tw - bmpWidth); - break; - } - - dc.DrawText(label, x, y); - txtEnd = x + tw + 2; - } - - // draw the bitmap if there is one - if ( params && params->m_labelBitmap.Ok() ) - { - int w, h, x, y; - w = params->m_labelBitmap.GetWidth(); - h = params->m_labelBitmap.GetHeight(); - - y = rect.y + wxMax(1, (rect.height - h) / 2); - - // if there is a text label, then put the bitmap at the end of the label - if ( txtEnd != 0 ) - { - x = txtEnd; - } - // otherwise use the alignment flags - else - { - switch (params->m_labelAlignment) - { - default: - case wxALIGN_LEFT: - x = rect.x + margin; - break; - case wxALIGN_CENTER: - x = rect.x + wxMax(1, (rect.width - arrowSpace - w)/2); - break; - case wxALIGN_RIGHT: - x = rect.x + wxMax(1, rect.width - arrowSpace - margin - w); - break; - } - } - dc.DrawBitmap(params->m_labelBitmap, x, y, true); - } - return labelWidth; -} - - -int wxRendererGeneric::GetHeaderButtonHeight(wxWindow *win) -{ - // Copied and adapted from src/generic/listctrl.cpp - const int HEADER_OFFSET_Y = 1; - const int EXTRA_HEIGHT = 4; - - int w=0, h=14, d=0; - if (win) - win->GetTextExtent(wxT("Hg"), &w, &h, &d); - - return h + d + 2 * HEADER_OFFSET_Y + EXTRA_HEIGHT; -} - - -// draw the plus or minus sign -void -wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win), - wxDC& dc, - const wxRect& rect, - int flags) -{ - // store settings - wxDCPenChanger penChanger(dc, *wxGREY_PEN); - wxDCBrushChanger brushChanger(dc, *wxWHITE_BRUSH); - - dc.DrawRectangle(rect); - - // black lines - const wxCoord xMiddle = rect.x + rect.width/2; - const wxCoord yMiddle = rect.y + rect.height/2; - - // half of the length of the horz lines in "-" and "+" - const wxCoord halfWidth = rect.width/2 - 2; - dc.SetPen(*wxBLACK_PEN); - dc.DrawLine(xMiddle - halfWidth, yMiddle, - xMiddle + halfWidth + 1, yMiddle); - - if ( !(flags & wxCONTROL_EXPANDED) ) - { - // turn "-" into "+" - const wxCoord halfHeight = rect.height/2 - 2; - dc.DrawLine(xMiddle, yMiddle - halfHeight, - xMiddle, yMiddle + halfHeight + 1); - } -} - -// ---------------------------------------------------------------------------- -// sash drawing -// ---------------------------------------------------------------------------- - -wxSplitterRenderParams -wxRendererGeneric::GetSplitterParams(const wxWindow *win) -{ - // see below - wxCoord sashWidth, - border; - - if ( win->HasFlag(wxSP_3DSASH) ) - sashWidth = 7; - else if ( win->HasFlag(wxSP_NOSASH) ) - sashWidth = 0; - else // no 3D effect - sashWidth = 3; - - if ( win->HasFlag(wxSP_3DBORDER) ) - border = 2; - else // no 3D effect - border = 0; - - return wxSplitterRenderParams(sashWidth, border, false); -} - -void -wxRendererGeneric::DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rectOrig, - int WXUNUSED(falgs)) -{ - if ( win->HasFlag(wxSP_3DBORDER) ) - { - wxRect rect = rectOrig; - DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight); - DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey); - } -} - -void -wxRendererGeneric::DrawSplitterSash(wxWindow *win, - wxDC& dcReal, - const wxSize& sizeReal, - wxCoord position, - wxOrientation orient, - int WXUNUSED(flags)) -{ - // to avoid duplicating the same code for horizontal and vertical sashes, - // simply mirror the DC instead if needed (i.e. if horz splitter) - wxMirrorDC dc(dcReal, orient != wxVERTICAL); - wxSize size = dc.Reflect(sizeReal); - - - // we draw a Win32-like grey sash with possible 3D border here: - // - // ---- this is position - // / - // v - // dWGGGDd - // GWGGGDB - // GWGGGDB where G is light grey (face) - // GWGGGDB W white (light) - // GWGGGDB D dark grey (shadow) - // GWGGGDB B black (dark shadow) - // GWGGGDB - // GWGGGDB and lower letters are our border (already drawn) - // GWGGGDB - // wWGGGDd - // - // only the middle 3 columns are drawn unless wxSP_3D is specified - - const wxCoord h = size.y; - wxCoord offset = 0; - - // If we're drawing the border, draw the sash 3d lines shorter - if ( win->HasFlag(wxSP_3DBORDER) ) - { - offset = 1; - } - - dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); - - if ( win->HasFlag(wxSP_3DSASH) ) - { - // Draw the 3D sash - dc.DrawRectangle(position + 2, 0, 3, h); - - dc.SetPen(m_penLightGrey); - dc.DrawLine(position, offset, position, h - offset); - - dc.SetPen(m_penHighlight); - dc.DrawLine(position + 1, 0, position + 1, h); - - dc.SetPen(m_penDarkGrey); - dc.DrawLine(position + 5, 0, position + 5, h); - - dc.SetPen(m_penBlack); - dc.DrawLine(position + 6, offset, position + 6, h - offset); - } - else - { - // Draw a flat sash - dc.DrawRectangle(position, 0, 3, h); - } -} - -// ---------------------------------------------------------------------------- -// button drawing -// ---------------------------------------------------------------------------- - -void -wxRendererGeneric::DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags) -{ - DrawPushButton(win,dc,rect,flags); - DrawDropArrow(win,dc,rect,flags); -} - -void -wxRendererGeneric::DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int WXUNUSED(flags)) -{ - // This generic implementation should be good - // enough for Windows platforms (including XP). - - int arrowHalf = rect.width/5; - int rectMid = rect.width / 2; - int arrowTopY = (rect.height/2) - (arrowHalf/2); - - // This should always result in arrow with odd width. - wxPoint pt[] = - { - wxPoint(rectMid - arrowHalf, arrowTopY), - wxPoint(rectMid + arrowHalf, arrowTopY), - wxPoint(rectMid, arrowTopY + arrowHalf) - }; - dc.SetBrush(wxBrush(win->GetForegroundColour())); - dc.SetPen(wxPen(win->GetForegroundColour())); - dc.DrawPolygon(WXSIZEOF(pt), pt, rect.x, rect.y); -} - -void -wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win), - wxDC& dc, - const wxRect& rect, - int flags) -{ - dc.SetPen(*(flags & wxCONTROL_DISABLED ? wxGREY_PEN : wxBLACK_PEN)); - dc.SetBrush( *wxTRANSPARENT_BRUSH ); - dc.DrawRectangle(rect); - - if ( flags & wxCONTROL_CHECKED ) - { - dc.DrawCheckMark(rect.Deflate(2, 2)); - } -} - -void -wxRendererGeneric::DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags) -{ - // Don't try anything too fancy. It'll just turn out looking - // out-of-place on most platforms. - wxColour bgCol = flags & wxCONTROL_DISABLED ? - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) : - win->GetBackgroundColour(); - dc.SetBrush(wxBrush(bgCol)); - dc.SetPen(wxPen(bgCol)); - dc.DrawRectangle(rect); -} - -void -wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win), - wxDC& dc, - const wxRect& rect, - int flags) -{ - wxBrush brush; - if ( flags & wxCONTROL_SELECTED ) - { - if ( flags & wxCONTROL_FOCUSED ) - { - brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); - } - else // !focused - { - brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); - } - } - else // !selected - { - brush = *wxTRANSPARENT_BRUSH; - } - - dc.SetBrush(brush); - dc.SetPen(flags & wxCONTROL_CURRENT ? *wxBLACK_PEN : *wxTRANSPARENT_PEN); - - dc.DrawRectangle( rect ); -} - - -// ---------------------------------------------------------------------------- -// A module to allow cleanup of generic renderer. -// ---------------------------------------------------------------------------- - -class wxGenericRendererModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxGenericRendererModule) -public: - wxGenericRendererModule() {} - bool OnInit() { return true; } - void OnExit() { wxRendererGeneric::Cleanup(); } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule) diff --git a/Source/3rdParty/wx/src/generic/scrlwing.cpp b/Source/3rdParty/wx/src/generic/scrlwing.cpp deleted file mode 100644 index 4ee236b03..000000000 --- a/Source/3rdParty/wx/src/generic/scrlwing.cpp +++ /dev/null @@ -1,1542 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/scrlwing.cpp -// Purpose: wxScrolledWindow implementation -// Author: Julian Smart -// Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement. -// Ron Lee on 10.4.02: virtual size / auto scrollbars et al. -// Created: 01/02/97 -// RCS-ID: $Id: scrlwing.cpp 60600 2009-05-12 10:33:49Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/scrolwin.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/panel.h" - #include "wx/dcclient.h" - #if wxUSE_TIMER - #include "wx/timer.h" - #endif - #include "wx/sizer.h" - #include "wx/settings.h" -#endif - -#ifdef __WXMAC__ -#include "wx/scrolbar.h" -#endif - -#include "wx/recguard.h" - -#ifdef __WXMSW__ - #include // for DLGC_WANTARROWS - #include "wx/msw/winundef.h" -#endif - -#ifdef __WXMOTIF__ -// For wxRETAINED implementation -#ifdef __VMS__ //VMS's Xm.h is not (yet) compatible with C++ - //This code switches off the compiler warnings -# pragma message disable nosimpint -#endif -#include -#ifdef __VMS__ -# pragma message enable nosimpint -#endif -#endif - -/* - TODO PROPERTIES - style wxHSCROLL | wxVSCROLL -*/ - -// ---------------------------------------------------------------------------- -// wxScrollHelperEvtHandler: intercept the events from the window and forward -// them to wxScrollHelper -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollHelperEvtHandler : public wxEvtHandler -{ -public: - wxScrollHelperEvtHandler(wxScrollHelper *scrollHelper) - { - m_scrollHelper = scrollHelper; - } - - virtual bool ProcessEvent(wxEvent& event); - - void ResetDrawnFlag() { m_hasDrawnWindow = false; } - -private: - wxScrollHelper *m_scrollHelper; - - bool m_hasDrawnWindow; - - DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler) -}; - -#if wxUSE_TIMER -// ---------------------------------------------------------------------------- -// wxAutoScrollTimer: the timer used to generate a stream of scroll events when -// a captured mouse is held outside the window -// ---------------------------------------------------------------------------- - -class wxAutoScrollTimer : public wxTimer -{ -public: - wxAutoScrollTimer(wxWindow *winToScroll, wxScrollHelper *scroll, - wxEventType eventTypeToSend, - int pos, int orient); - - virtual void Notify(); - -private: - wxWindow *m_win; - wxScrollHelper *m_scrollHelper; - wxEventType m_eventType; - int m_pos, - m_orient; - - DECLARE_NO_COPY_CLASS(wxAutoScrollTimer) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxAutoScrollTimer -// ---------------------------------------------------------------------------- - -wxAutoScrollTimer::wxAutoScrollTimer(wxWindow *winToScroll, - wxScrollHelper *scroll, - wxEventType eventTypeToSend, - int pos, int orient) -{ - m_win = winToScroll; - m_scrollHelper = scroll; - m_eventType = eventTypeToSend; - m_pos = pos; - m_orient = orient; -} - -void wxAutoScrollTimer::Notify() -{ - // only do all this as long as the window is capturing the mouse - if ( wxWindow::GetCapture() != m_win ) - { - Stop(); - } - else // we still capture the mouse, continue generating events - { - // first scroll the window if we are allowed to do it - wxScrollWinEvent event1(m_eventType, m_pos, m_orient); - event1.SetEventObject(m_win); - if ( m_scrollHelper->SendAutoScrollEvents(event1) && - m_win->GetEventHandler()->ProcessEvent(event1) ) - { - // and then send a pseudo mouse-move event to refresh the selection - wxMouseEvent event2(wxEVT_MOTION); - wxGetMousePosition(&event2.m_x, &event2.m_y); - - // the mouse event coordinates should be client, not screen as - // returned by wxGetMousePosition - wxWindow *parentTop = m_win; - while ( parentTop->GetParent() ) - parentTop = parentTop->GetParent(); - wxPoint ptOrig = parentTop->GetPosition(); - event2.m_x -= ptOrig.x; - event2.m_y -= ptOrig.y; - - event2.SetEventObject(m_win); - - // FIXME: we don't fill in the other members - ok? - - m_win->GetEventHandler()->ProcessEvent(event2); - } - else // can't scroll further, stop - { - Stop(); - } - } -} -#endif - -// ---------------------------------------------------------------------------- -// wxScrollHelperEvtHandler -// ---------------------------------------------------------------------------- - -bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) -{ - wxEventType evType = event.GetEventType(); - - // the explanation of wxEVT_PAINT processing hack: for historic reasons - // there are 2 ways to process this event in classes deriving from - // wxScrolledWindow. The user code may - // - // 1. override wxScrolledWindow::OnDraw(dc) - // 2. define its own OnPaint() handler - // - // In addition, in wxUniversal wxWindow defines OnPaint() itself and - // always processes the draw event, so we can't just try the window - // OnPaint() first and call our HandleOnPaint() if it doesn't process it - // (the latter would never be called in wxUniversal). - // - // So the solution is to have a flag telling us whether the user code drew - // anything in the window. We set it to true here but reset it to false in - // wxScrolledWindow::OnPaint() handler (which wouldn't be called if the - // user code defined OnPaint() in the derived class) - m_hasDrawnWindow = true; - - // pass it on to the real handler - bool processed = wxEvtHandler::ProcessEvent(event); - - // always process the size events ourselves, even if the user code handles - // them as well, as we need to AdjustScrollbars() - // - // NB: it is important to do it after processing the event in the normal - // way as HandleOnSize() may generate a wxEVT_SIZE itself if the - // scrollbar[s] (dis)appear and it should be seen by the user code - // after this one - if ( evType == wxEVT_SIZE ) - { - m_scrollHelper->HandleOnSize((wxSizeEvent &)event); - - return true; - } - - if ( processed ) - { - // normally, nothing more to do here - except if it was a paint event - // which wasn't really processed, then we'll try to call our - // OnDraw() below (from HandleOnPaint) - if ( m_hasDrawnWindow || event.IsCommandEvent() ) - { - return true; - } - } - - // reset the skipped flag to false as it might have been set to true in - // ProcessEvent() above - event.Skip(false); - - if ( evType == wxEVT_PAINT ) - { - m_scrollHelper->HandleOnPaint((wxPaintEvent &)event); - return true; - } - - if ( evType == wxEVT_CHILD_FOCUS ) - { - m_scrollHelper->HandleOnChildFocus((wxChildFocusEvent &)event); - return true; - } - - if ( evType == wxEVT_SCROLLWIN_TOP || - evType == wxEVT_SCROLLWIN_BOTTOM || - evType == wxEVT_SCROLLWIN_LINEUP || - evType == wxEVT_SCROLLWIN_LINEDOWN || - evType == wxEVT_SCROLLWIN_PAGEUP || - evType == wxEVT_SCROLLWIN_PAGEDOWN || - evType == wxEVT_SCROLLWIN_THUMBTRACK || - evType == wxEVT_SCROLLWIN_THUMBRELEASE ) - { - m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event); - return !event.GetSkipped(); - } - - if ( evType == wxEVT_ENTER_WINDOW ) - { - m_scrollHelper->HandleOnMouseEnter((wxMouseEvent &)event); - } - else if ( evType == wxEVT_LEAVE_WINDOW ) - { - m_scrollHelper->HandleOnMouseLeave((wxMouseEvent &)event); - } -#if wxUSE_MOUSEWHEEL - else if ( evType == wxEVT_MOUSEWHEEL ) - { - m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event); - return true; - } -#endif // wxUSE_MOUSEWHEEL - else if ( evType == wxEVT_CHAR ) - { - m_scrollHelper->HandleOnChar((wxKeyEvent &)event); - return !event.GetSkipped(); - } - - return false; -} - -// ---------------------------------------------------------------------------- -// wxScrollHelper construction -// ---------------------------------------------------------------------------- - -wxScrollHelper::wxScrollHelper(wxWindow *win) -{ - wxASSERT_MSG( win, _T("associated window can't be NULL in wxScrollHelper") ); - - m_xScrollPixelsPerLine = - m_yScrollPixelsPerLine = - m_xScrollPosition = - m_yScrollPosition = - m_xScrollLines = - m_yScrollLines = - m_xScrollLinesPerPage = - m_yScrollLinesPerPage = 0; - - m_xScrollingEnabled = - m_yScrollingEnabled = true; - - m_scaleX = - m_scaleY = 1.0; -#if wxUSE_MOUSEWHEEL - m_wheelRotation = 0; -#endif - - m_win = - m_targetWindow = (wxWindow *)NULL; - - m_timerAutoScroll = (wxTimer *)NULL; - - m_handler = NULL; - - m_win = win; - - m_win->SetScrollHelper( this ); - - // by default, the associated window is also the target window - DoSetTargetWindow(win); -} - -wxScrollHelper::~wxScrollHelper() -{ - StopAutoScrolling(); - - DeleteEvtHandler(); -} - -// ---------------------------------------------------------------------------- -// setting scrolling parameters -// ---------------------------------------------------------------------------- - -void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, - int pixelsPerUnitY, - int noUnitsX, - int noUnitsY, - int xPos, - int yPos, - bool noRefresh) -{ - int xpos, ypos; - - CalcUnscrolledPosition(xPos, yPos, &xpos, &ypos); - bool do_refresh = - ( - (noUnitsX != 0 && m_xScrollLines == 0) || - (noUnitsX < m_xScrollLines && xpos > pixelsPerUnitX * noUnitsX) || - - (noUnitsY != 0 && m_yScrollLines == 0) || - (noUnitsY < m_yScrollLines && ypos > pixelsPerUnitY * noUnitsY) || - (xPos != m_xScrollPosition) || - (yPos != m_yScrollPosition) - ); - - m_xScrollPixelsPerLine = pixelsPerUnitX; - m_yScrollPixelsPerLine = pixelsPerUnitY; - m_xScrollPosition = xPos; - m_yScrollPosition = yPos; - - int w = noUnitsX * pixelsPerUnitX; - int h = noUnitsY * pixelsPerUnitY; - - // For better backward compatibility we set persisting limits - // here not just the size. It makes SetScrollbars 'sticky' - // emulating the old non-autoscroll behaviour. - // m_targetWindow->SetVirtualSizeHints( w, h ); - - // The above should arguably be deprecated, this however we still need. - - // take care not to set 0 virtual size, 0 means that we don't have any - // scrollbars and hence we should use the real size instead of the virtual - // one which is indicated by using wxDefaultCoord - m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord, - h ? h : wxDefaultCoord); - - if (do_refresh && !noRefresh) - m_targetWindow->Refresh(true, GetScrollRect()); - -#ifndef __WXUNIVERSAL__ - // If the target is not the same as the window with the scrollbars, - // then we need to update the scrollbars here, since they won't have - // been updated by SetVirtualSize(). - if ( m_targetWindow != m_win ) -#endif // !__WXUNIVERSAL__ - { - AdjustScrollbars(); - } -#ifndef __WXUNIVERSAL__ - else - { - // otherwise this has been done by AdjustScrollbars, above - } -#endif // !__WXUNIVERSAL__ -} - -// ---------------------------------------------------------------------------- -// [target] window handling -// ---------------------------------------------------------------------------- - -void wxScrollHelper::DeleteEvtHandler() -{ - // search for m_handler in the handler list - if ( m_win && m_handler ) - { - if ( m_win->RemoveEventHandler(m_handler) ) - { - delete m_handler; - } - //else: something is very wrong, so better [maybe] leak memory than - // risk a crash because of double deletion - - m_handler = NULL; - } -} - -void wxScrollHelper::DoSetTargetWindow(wxWindow *target) -{ - m_targetWindow = target; -#ifdef __WXMAC__ - target->MacSetClipChildren( true ) ; -#endif - - // install the event handler which will intercept the events we're - // interested in (but only do it for our real window, not the target window - // which we scroll - we don't need to hijack its events) - if ( m_targetWindow == m_win ) - { - // if we already have a handler, delete it first - DeleteEvtHandler(); - - m_handler = new wxScrollHelperEvtHandler(this); - m_targetWindow->PushEventHandler(m_handler); - } -} - -void wxScrollHelper::SetTargetWindow(wxWindow *target) -{ - wxCHECK_RET( target, wxT("target window must not be NULL") ); - - if ( target == m_targetWindow ) - return; - - DoSetTargetWindow(target); -} - -wxWindow *wxScrollHelper::GetTargetWindow() const -{ - return m_targetWindow; -} - -// ---------------------------------------------------------------------------- -// scrolling implementation itself -// ---------------------------------------------------------------------------- - -void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event) -{ - int nScrollInc = CalcScrollInc(event); - if ( nScrollInc == 0 ) - { - // can't scroll further - event.Skip(); - - return; - } - - bool needsRefresh = false; - - int dx = 0, - dy = 0; - int orient = event.GetOrientation(); - if (orient == wxHORIZONTAL) - { - if ( m_xScrollingEnabled ) - { - dx = -m_xScrollPixelsPerLine * nScrollInc; - } - else - { - needsRefresh = true; - } - } - else - { - if ( m_yScrollingEnabled ) - { - dy = -m_yScrollPixelsPerLine * nScrollInc; - } - else - { - needsRefresh = true; - } - } - - if ( !needsRefresh ) - { - // flush all pending repaints before we change m_{x,y}ScrollPosition, as - // otherwise invalidated area could be updated incorrectly later when - // ScrollWindow() makes sure they're repainted before scrolling them -#ifdef __WXMAC__ - // wxWindowMac is taking care of making sure the update area is correctly - // set up, while not forcing an immediate redraw -#else - m_targetWindow->Update(); -#endif - } - - if (orient == wxHORIZONTAL) - { - m_xScrollPosition += nScrollInc; - m_win->SetScrollPos(wxHORIZONTAL, m_xScrollPosition); - } - else - { - m_yScrollPosition += nScrollInc; - m_win->SetScrollPos(wxVERTICAL, m_yScrollPosition); - } - - if ( needsRefresh ) - { - m_targetWindow->Refresh(true, GetScrollRect()); - } - else - { - m_targetWindow->ScrollWindow(dx, dy, GetScrollRect()); - } -} - -int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) -{ - int pos = event.GetPosition(); - int orient = event.GetOrientation(); - - int nScrollInc = 0; - if (event.GetEventType() == wxEVT_SCROLLWIN_TOP) - { - if (orient == wxHORIZONTAL) - nScrollInc = - m_xScrollPosition; - else - nScrollInc = - m_yScrollPosition; - } else - if (event.GetEventType() == wxEVT_SCROLLWIN_BOTTOM) - { - if (orient == wxHORIZONTAL) - nScrollInc = m_xScrollLines - m_xScrollPosition; - else - nScrollInc = m_yScrollLines - m_yScrollPosition; - } else - if (event.GetEventType() == wxEVT_SCROLLWIN_LINEUP) - { - nScrollInc = -1; - } else - if (event.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN) - { - nScrollInc = 1; - } else - if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEUP) - { - if (orient == wxHORIZONTAL) - nScrollInc = -GetScrollPageSize(wxHORIZONTAL); - else - nScrollInc = -GetScrollPageSize(wxVERTICAL); - } else - if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN) - { - if (orient == wxHORIZONTAL) - nScrollInc = GetScrollPageSize(wxHORIZONTAL); - else - nScrollInc = GetScrollPageSize(wxVERTICAL); - } else - if ((event.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK) || - (event.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE)) - { - if (orient == wxHORIZONTAL) - nScrollInc = pos - m_xScrollPosition; - else - nScrollInc = pos - m_yScrollPosition; - } - - if (orient == wxHORIZONTAL) - { - if (m_xScrollPixelsPerLine > 0) - { - if ( m_xScrollPosition + nScrollInc < 0 ) - { - // As -ve as we can go - nScrollInc = -m_xScrollPosition; - } - else // check for the other bound - { - const int posMax = m_xScrollLines - m_xScrollLinesPerPage; - if ( m_xScrollPosition + nScrollInc > posMax ) - { - // As +ve as we can go - nScrollInc = posMax - m_xScrollPosition; - } - } - } - else - m_targetWindow->Refresh(true, GetScrollRect()); - } - else - { - if ( m_yScrollPixelsPerLine > 0 ) - { - if ( m_yScrollPosition + nScrollInc < 0 ) - { - // As -ve as we can go - nScrollInc = -m_yScrollPosition; - } - else // check for the other bound - { - const int posMax = m_yScrollLines - m_yScrollLinesPerPage; - if ( m_yScrollPosition + nScrollInc > posMax ) - { - // As +ve as we can go - nScrollInc = posMax - m_yScrollPosition; - } - } - } - else - { - // VZ: why do we do this? (FIXME) - m_targetWindow->Refresh(true, GetScrollRect()); - } - } - - return nScrollInc; -} - -// Adjust the scrollbars - new version. -void wxScrollHelper::AdjustScrollbars() -{ - static wxRecursionGuardFlag s_flagReentrancy; - wxRecursionGuard guard(s_flagReentrancy); - if ( guard.IsInside() ) - { - // don't reenter AdjustScrollbars() while another call to - // AdjustScrollbars() is in progress because this may lead to calling - // ScrollWindow() twice and this can really happen under MSW if - // SetScrollbar() call below adds or removes the scrollbar which - // changes the window size and hence results in another - // AdjustScrollbars() call - return; - } - - int w = 0, h = 0; - int oldw, oldh; - - int oldXScroll = m_xScrollPosition; - int oldYScroll = m_yScrollPosition; - - // VZ: at least under Windows this loop is useless because when scrollbars - // [dis]appear we get a WM_SIZE resulting in another call to - // AdjustScrollbars() anyhow. As it doesn't seem to do any harm I leave - // it here for now but it would be better to ensure that all ports - // generate EVT_SIZE when scrollbars [dis]appear, emulating it if - // necessary, and remove it later - // JACS: Stop potential infinite loop by limiting number of iterations - int iterationCount = 0; - const int iterationMax = 5; - do - { - iterationCount ++; - - GetTargetSize(&w, 0); - - // scroll lines per page: if 0, no scrolling is needed - int linesPerPage; - - if ( m_xScrollPixelsPerLine == 0 ) - { - // scrolling is disabled - m_xScrollLines = 0; - m_xScrollPosition = 0; - linesPerPage = 0; - } - else // might need scrolling - { - // Round up integer division to catch any "leftover" client space. - const int wVirt = m_targetWindow->GetVirtualSize().GetWidth(); - m_xScrollLines = (wVirt + m_xScrollPixelsPerLine - 1) / m_xScrollPixelsPerLine; - - // Calculate page size i.e. number of scroll units you get on the - // current client window. - linesPerPage = w / m_xScrollPixelsPerLine; - - // Special case. When client and virtual size are very close but - // the client is big enough, kill scrollbar. - if ((linesPerPage < m_xScrollLines) && (w >= wVirt)) ++linesPerPage; - - if (linesPerPage >= m_xScrollLines) - { - // we're big enough to not need scrolling - linesPerPage = - m_xScrollLines = - m_xScrollPosition = 0; - } - else // we do need a scrollbar - { - if ( linesPerPage < 1 ) - linesPerPage = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - const int posMax = m_xScrollLines - linesPerPage; - if ( m_xScrollPosition > posMax ) - m_xScrollPosition = posMax; - else if ( m_xScrollPosition < 0 ) - m_xScrollPosition = 0; - } - } - - m_win->SetScrollbar(wxHORIZONTAL, m_xScrollPosition, - linesPerPage, m_xScrollLines); - - // The amount by which we scroll when paging - SetScrollPageSize(wxHORIZONTAL, linesPerPage); - - GetTargetSize(0, &h); - - if ( m_yScrollPixelsPerLine == 0 ) - { - // scrolling is disabled - m_yScrollLines = 0; - m_yScrollPosition = 0; - linesPerPage = 0; - } - else // might need scrolling - { - // Round up integer division to catch any "leftover" client space. - const int hVirt = m_targetWindow->GetVirtualSize().GetHeight(); - m_yScrollLines = ( hVirt + m_yScrollPixelsPerLine - 1 ) / m_yScrollPixelsPerLine; - - // Calculate page size i.e. number of scroll units you get on the - // current client window. - linesPerPage = h / m_yScrollPixelsPerLine; - - // Special case. When client and virtual size are very close but - // the client is big enough, kill scrollbar. - if ((linesPerPage < m_yScrollLines) && (h >= hVirt)) ++linesPerPage; - - if (linesPerPage >= m_yScrollLines) - { - // we're big enough to not need scrolling - linesPerPage = - m_yScrollLines = - m_yScrollPosition = 0; - } - else // we do need a scrollbar - { - if ( linesPerPage < 1 ) - linesPerPage = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - const int posMax = m_yScrollLines - linesPerPage; - if ( m_yScrollPosition > posMax ) - m_yScrollPosition = posMax; - else if ( m_yScrollPosition < 0 ) - m_yScrollPosition = 0; - } - } - - m_win->SetScrollbar(wxVERTICAL, m_yScrollPosition, - linesPerPage, m_yScrollLines); - - // The amount by which we scroll when paging - SetScrollPageSize(wxVERTICAL, linesPerPage); - - - // If a scrollbar (dis)appeared as a result of this, adjust them again. - oldw = w; - oldh = h; - - GetTargetSize( &w, &h ); - } while ( (w != oldw || h != oldh) && (iterationCount < iterationMax) ); - -#ifdef __WXMOTIF__ - // Sorry, some Motif-specific code to implement a backing pixmap - // for the wxRETAINED style. Implementing a backing store can't - // be entirely generic because it relies on the wxWindowDC implementation - // to duplicate X drawing calls for the backing pixmap. - - if ( m_targetWindow->GetWindowStyle() & wxRETAINED ) - { - Display* dpy = XtDisplay((Widget)m_targetWindow->GetMainWidget()); - - int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine; - int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine; - if (m_targetWindow->GetBackingPixmap() && - !((m_targetWindow->GetPixmapWidth() == totalPixelWidth) && - (m_targetWindow->GetPixmapHeight() == totalPixelHeight))) - { - XFreePixmap (dpy, (Pixmap) m_targetWindow->GetBackingPixmap()); - m_targetWindow->SetBackingPixmap((WXPixmap) 0); - } - - if (!m_targetWindow->GetBackingPixmap() && - (m_xScrollLines != 0) && (m_yScrollLines != 0)) - { - int depth = wxDisplayDepth(); - m_targetWindow->SetPixmapWidth(totalPixelWidth); - m_targetWindow->SetPixmapHeight(totalPixelHeight); - m_targetWindow->SetBackingPixmap((WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)), - m_targetWindow->GetPixmapWidth(), m_targetWindow->GetPixmapHeight(), depth)); - } - - } -#endif // Motif - - if (oldXScroll != m_xScrollPosition) - { - if (m_xScrollingEnabled) - m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0, - GetScrollRect() ); - else - m_targetWindow->Refresh(true, GetScrollRect()); - } - - if (oldYScroll != m_yScrollPosition) - { - if (m_yScrollingEnabled) - m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), - GetScrollRect() ); - else - m_targetWindow->Refresh(true, GetScrollRect()); - } -} - -void wxScrollHelper::DoPrepareDC(wxDC& dc) -{ - wxPoint pt = dc.GetDeviceOrigin(); -#ifdef __WXGTK__ - // It may actually be correct to always query - // the m_sign from the DC here, but I leve the - // #ifdef GTK for now. - if (m_win->GetLayoutDirection() == wxLayout_RightToLeft) - dc.SetDeviceOrigin( pt.x + m_xScrollPosition * m_xScrollPixelsPerLine, - pt.y - m_yScrollPosition * m_yScrollPixelsPerLine ); - else -#endif - dc.SetDeviceOrigin( pt.x - m_xScrollPosition * m_xScrollPixelsPerLine, - pt.y - m_yScrollPosition * m_yScrollPixelsPerLine ); - dc.SetUserScale( m_scaleX, m_scaleY ); -} - -void wxScrollHelper::SetScrollRate( int xstep, int ystep ) -{ - int old_x = m_xScrollPixelsPerLine * m_xScrollPosition; - int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; - - m_xScrollPixelsPerLine = xstep; - m_yScrollPixelsPerLine = ystep; - - int new_x = m_xScrollPixelsPerLine * m_xScrollPosition; - int new_y = m_yScrollPixelsPerLine * m_yScrollPosition; - - m_win->SetScrollPos( wxHORIZONTAL, m_xScrollPosition ); - m_win->SetScrollPos( wxVERTICAL, m_yScrollPosition ); - m_targetWindow->ScrollWindow( old_x - new_x, old_y - new_y ); - - AdjustScrollbars(); -} - -void wxScrollHelper::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const -{ - if ( x_unit ) - *x_unit = m_xScrollPixelsPerLine; - if ( y_unit ) - *y_unit = m_yScrollPixelsPerLine; -} - - -int wxScrollHelper::GetScrollLines( int orient ) const -{ - if ( orient == wxHORIZONTAL ) - return m_xScrollLines; - else - return m_yScrollLines; -} - -int wxScrollHelper::GetScrollPageSize(int orient) const -{ - if ( orient == wxHORIZONTAL ) - return m_xScrollLinesPerPage; - else - return m_yScrollLinesPerPage; -} - -void wxScrollHelper::SetScrollPageSize(int orient, int pageSize) -{ - if ( orient == wxHORIZONTAL ) - m_xScrollLinesPerPage = pageSize; - else - m_yScrollLinesPerPage = pageSize; -} - -/* - * Scroll to given position (scroll position, not pixel position) - */ -void wxScrollHelper::Scroll( int x_pos, int y_pos ) -{ - if (!m_targetWindow) - return; - - if (((x_pos == -1) || (x_pos == m_xScrollPosition)) && - ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; - - int w = 0, h = 0; - GetTargetSize(&w, &h); - - // compute new position: - int new_x = m_xScrollPosition; - int new_y = m_yScrollPosition; - - if ((x_pos != -1) && (m_xScrollPixelsPerLine)) - { - new_x = x_pos; - - // Calculate page size i.e. number of scroll units you get on the - // current client window - int noPagePositions = w/m_xScrollPixelsPerLine; - if (noPagePositions < 1) noPagePositions = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - new_x = wxMin( m_xScrollLines-noPagePositions, new_x ); - new_x = wxMax( 0, new_x ); - } - if ((y_pos != -1) && (m_yScrollPixelsPerLine)) - { - new_y = y_pos; - - // Calculate page size i.e. number of scroll units you get on the - // current client window - int noPagePositions = h/m_yScrollPixelsPerLine; - if (noPagePositions < 1) noPagePositions = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - new_y = wxMin( m_yScrollLines-noPagePositions, new_y ); - new_y = wxMax( 0, new_y ); - } - - if ( new_x == m_xScrollPosition && new_y == m_yScrollPosition ) - return; // nothing to do, the position didn't change - - // flush all pending repaints before we change m_{x,y}ScrollPosition, as - // otherwise invalidated area could be updated incorrectly later when - // ScrollWindow() makes sure they're repainted before scrolling them - m_targetWindow->Update(); - - // update the position and scroll the window now: - if (m_xScrollPosition != new_x) - { - int old_x = m_xScrollPosition; - m_xScrollPosition = new_x; - m_win->SetScrollPos( wxHORIZONTAL, new_x ); - m_targetWindow->ScrollWindow( (old_x-new_x)*m_xScrollPixelsPerLine, 0, - GetScrollRect() ); - } - - if (m_yScrollPosition != new_y) - { - int old_y = m_yScrollPosition; - m_yScrollPosition = new_y; - m_win->SetScrollPos( wxVERTICAL, new_y ); - m_targetWindow->ScrollWindow( 0, (old_y-new_y)*m_yScrollPixelsPerLine, - GetScrollRect() ); - } -} - -void wxScrollHelper::EnableScrolling (bool x_scroll, bool y_scroll) -{ - m_xScrollingEnabled = x_scroll; - m_yScrollingEnabled = y_scroll; -} - -// Where the current view starts from -void wxScrollHelper::GetViewStart (int *x, int *y) const -{ - if ( x ) - *x = m_xScrollPosition; - if ( y ) - *y = m_yScrollPosition; -} - -void wxScrollHelper::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const -{ - if ( xx ) - *xx = x - m_xScrollPosition * m_xScrollPixelsPerLine; - if ( yy ) - *yy = y - m_yScrollPosition * m_yScrollPixelsPerLine; -} - -void wxScrollHelper::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const -{ - if ( xx ) - *xx = x + m_xScrollPosition * m_xScrollPixelsPerLine; - if ( yy ) - *yy = y + m_yScrollPosition * m_yScrollPixelsPerLine; -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -bool wxScrollHelper::ScrollLayout() -{ - if ( m_win->GetSizer() && m_targetWindow == m_win ) - { - // If we're the scroll target, take into account the - // virtual size and scrolled position of the window. - - int x = 0, y = 0, w = 0, h = 0; - CalcScrolledPosition(0,0, &x,&y); - m_win->GetVirtualSize(&w, &h); - m_win->GetSizer()->SetDimension(x, y, w, h); - return true; - } - - // fall back to default for LayoutConstraints - return m_win->wxWindow::Layout(); -} - -void wxScrollHelper::ScrollDoSetVirtualSize(int x, int y) -{ - m_win->wxWindow::DoSetVirtualSize( x, y ); - AdjustScrollbars(); - - if (m_win->GetAutoLayout()) - m_win->Layout(); -} - -// wxWindow's GetBestVirtualSize returns the actual window size, -// whereas we want to return the virtual size -wxSize wxScrollHelper::ScrollGetBestVirtualSize() const -{ - wxSize clientSize(m_win->GetClientSize()); - if ( m_win->GetSizer() ) - clientSize.IncTo(m_win->GetSizer()->CalcMin()); - - return clientSize; -} - -// return the window best size from the given best virtual size -wxSize -wxScrollHelper::ScrollGetWindowSizeForVirtualSize(const wxSize& size) const -{ - // Only use the content to set the window size in the direction - // where there's no scrolling; otherwise we're going to get a huge - // window in the direction in which scrolling is enabled - int ppuX, ppuY; - GetScrollPixelsPerUnit(&ppuX, &ppuY); - - wxSize minSize = m_win->GetMinSize(); - - wxSize best(size); - if (ppuX > 0) - best.x = minSize.x + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - if (ppuY > 0) - best.y = minSize.y + wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); - - return best; -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -// Default OnSize resets scrollbars, if any -void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event)) -{ - if ( m_targetWindow->GetAutoLayout() ) - { - wxSize size = m_targetWindow->GetBestVirtualSize(); - - // This will call ::Layout() and ::AdjustScrollbars() - m_win->SetVirtualSize( size ); - } - else - { - AdjustScrollbars(); - } -} - -// This calls OnDraw, having adjusted the origin according to the current -// scroll position -void wxScrollHelper::HandleOnPaint(wxPaintEvent& WXUNUSED(event)) -{ - // don't use m_targetWindow here, this is always called for ourselves - wxPaintDC dc(m_win); - DoPrepareDC(dc); - - OnDraw(dc); -} - -// kbd handling: notice that we use OnChar() and not OnKeyDown() for -// compatibility here - if we used OnKeyDown(), the programs which process -// arrows themselves in their OnChar() would never get the message and like -// this they always have the priority -void wxScrollHelper::HandleOnChar(wxKeyEvent& event) -{ - int stx = 0, sty = 0, // view origin - szx = 0, szy = 0, // view size (total) - clix = 0, cliy = 0; // view size (on screen) - - GetViewStart(&stx, &sty); - GetTargetSize(&clix, &cliy); - m_targetWindow->GetVirtualSize(&szx, &szy); - - if( m_xScrollPixelsPerLine ) - { - clix /= m_xScrollPixelsPerLine; - szx /= m_xScrollPixelsPerLine; - } - else - { - clix = 0; - szx = -1; - } - if( m_yScrollPixelsPerLine ) - { - cliy /= m_yScrollPixelsPerLine; - szy /= m_yScrollPixelsPerLine; - } - else - { - cliy = 0; - szy = -1; - } - - int xScrollOld = m_xScrollPosition, - yScrollOld = m_yScrollPosition; - - int dsty; - switch ( event.GetKeyCode() ) - { - case WXK_PAGEUP: - dsty = sty - (5 * cliy / 6); - Scroll(-1, (dsty == -1) ? 0 : dsty); - break; - - case WXK_PAGEDOWN: - Scroll(-1, sty + (5 * cliy / 6)); - break; - - case WXK_HOME: - Scroll(0, event.ControlDown() ? 0 : -1); - break; - - case WXK_END: - Scroll(szx - clix, event.ControlDown() ? szy - cliy : -1); - break; - - case WXK_UP: - Scroll(-1, sty - 1); - break; - - case WXK_DOWN: - Scroll(-1, sty + 1); - break; - - case WXK_LEFT: - Scroll(stx - 1, -1); - break; - - case WXK_RIGHT: - Scroll(stx + 1, -1); - break; - - default: - // not for us - event.Skip(); - } - - if ( m_xScrollPosition != xScrollOld ) - { - wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_xScrollPosition, - wxHORIZONTAL); - event.SetEventObject(m_win); - m_win->GetEventHandler()->ProcessEvent(event); - } - - if ( m_yScrollPosition != yScrollOld ) - { - wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_yScrollPosition, - wxVERTICAL); - event.SetEventObject(m_win); - m_win->GetEventHandler()->ProcessEvent(event); - } -} - -// ---------------------------------------------------------------------------- -// autoscroll stuff: these functions deal with sending fake scroll events when -// a captured mouse is being held outside the window -// ---------------------------------------------------------------------------- - -bool wxScrollHelper::SendAutoScrollEvents(wxScrollWinEvent& event) const -{ - // only send the event if the window is scrollable in this direction - wxWindow *win = (wxWindow *)event.GetEventObject(); - return win->HasScrollbar(event.GetOrientation()); -} - -void wxScrollHelper::StopAutoScrolling() -{ -#if wxUSE_TIMER - if ( m_timerAutoScroll ) - { - delete m_timerAutoScroll; - m_timerAutoScroll = (wxTimer *)NULL; - } -#endif -} - -void wxScrollHelper::HandleOnMouseEnter(wxMouseEvent& event) -{ - StopAutoScrolling(); - - event.Skip(); -} - -void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event) -{ - // don't prevent the usual processing of the event from taking place - event.Skip(); - - // when a captured mouse leave a scrolled window we start generate - // scrolling events to allow, for example, extending selection beyond the - // visible area in some controls - if ( wxWindow::GetCapture() == m_targetWindow ) - { - // where is the mouse leaving? - int pos, orient; - wxPoint pt = event.GetPosition(); - if ( pt.x < 0 ) - { - orient = wxHORIZONTAL; - pos = 0; - } - else if ( pt.y < 0 ) - { - orient = wxVERTICAL; - pos = 0; - } - else // we're lower or to the right of the window - { - wxSize size = m_targetWindow->GetClientSize(); - if ( pt.x > size.x ) - { - orient = wxHORIZONTAL; - pos = m_xScrollLines; - } - else if ( pt.y > size.y ) - { - orient = wxVERTICAL; - pos = m_yScrollLines; - } - else // this should be impossible - { - // but seems to happen sometimes under wxMSW - maybe it's a bug - // there but for now just ignore it - - //wxFAIL_MSG( _T("can't understand where has mouse gone") ); - - return; - } - } - - // only start the auto scroll timer if the window can be scrolled in - // this direction - if ( !m_targetWindow->HasScrollbar(orient) ) - return; - -#if wxUSE_TIMER - delete m_timerAutoScroll; - m_timerAutoScroll = new wxAutoScrollTimer - ( - m_targetWindow, this, - pos == 0 ? wxEVT_SCROLLWIN_LINEUP - : wxEVT_SCROLLWIN_LINEDOWN, - pos, - orient - ); - m_timerAutoScroll->Start(50); // FIXME: make configurable -#else - wxUnusedVar(pos); -#endif - } -} - -#if wxUSE_MOUSEWHEEL - -void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event) -{ - m_wheelRotation += event.GetWheelRotation(); - int lines = m_wheelRotation / event.GetWheelDelta(); - m_wheelRotation -= lines * event.GetWheelDelta(); - - if (lines != 0) - { - - wxScrollWinEvent newEvent; - - newEvent.SetPosition(0); - newEvent.SetOrientation(wxVERTICAL); - newEvent.SetEventObject(m_win); - - if (event.IsPageScroll()) - { - if (lines > 0) - newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEUP); - else - newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEDOWN); - - m_win->GetEventHandler()->ProcessEvent(newEvent); - } - else - { - lines *= event.GetLinesPerAction(); - if (lines > 0) - newEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP); - else - newEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN); - - int times = abs(lines); - for (; times > 0; times--) - m_win->GetEventHandler()->ProcessEvent(newEvent); - } - } -} - -#endif // wxUSE_MOUSEWHEEL - -void wxScrollHelper::HandleOnChildFocus(wxChildFocusEvent& event) -{ - // this event should be processed by all windows in parenthood chain, - // e.g. so that nested wxScrolledWindows work correctly - event.Skip(); - - // find the immediate child under which the window receiving focus is: - wxWindow *win = event.GetWindow(); - - if ( win == m_targetWindow ) - return; // nothing to do - -#ifdef __WXMAC__ - if (wxDynamicCast(win, wxScrollBar)) - return; -#endif - - // Fixing ticket: http://trac.wxwidgets.org/ticket/9563 - // When a child inside a wxControlContainer receives a focus, the - // wxControlContainer generates an artificial wxChildFocusEvent for - // itself, telling its parent that 'it' received the focus. The effect is - // that this->HandleOnChildFocus is called twice, first with the - // artificial wxChildFocusEvent and then with the original event. We need - // to ignore the artificial event here or otherwise HandleOnChildFocus - // would first scroll the target window to make the entire - // wxControlContainer visible and immediately afterwards scroll the target - // window again to make the child widget visible. This leads to ugly - // flickering when using nested wxPanels/wxScrolledWindows. - // - // Ignore this event if 'win' is derived from wxControlContainer AND its - // parent is the m_targetWindow AND 'win' is not actually reciving the - // focus (win != FindFocus). TODO: This affects all wxControlContainer - // objects, but wxControlContainer is not part of the wxWidgets RTTI and - // so wxDynamicCast(win, wxControlContainer) does not compile. Find a way - // to determine if 'win' derives from wxControlContainer. Until then, - // testing if 'win' derives from wxPanel will probably get >90% of all - // cases. - - wxWindow *actual_focus=wxWindow::FindFocus(); - if (win != actual_focus && - wxDynamicCast(win, wxPanel) != 0 && - win->GetParent() == m_targetWindow) - // if win is a wxPanel and receives the focus, it should not be - // scrolled into view - return; - - const wxRect viewRect(m_targetWindow->GetClientRect()); - - // For composite controls such as wxComboCtrl we should try to fit the - // entire control inside the visible area of the target window, not just - // the focused child of the control. Otherwise we'd make only the textctrl - // part of a wxComboCtrl visible and the button would still be outside the - // scrolled area. But do so only if the parent fits *entirely* inside the - // scrolled window. In other situations, such as nested wxPanel or - // wxScrolledWindows, the parent might be way to big to fit inside the - // scrolled window. If that is the case, then make only the focused window - // visible - if ( win->GetParent() != m_targetWindow) - { - wxWindow *parent=win->GetParent(); - wxSize parent_size=parent->GetSize(); - if (parent_size.GetWidth() <= viewRect.GetWidth() && - parent_size.GetHeight() <= viewRect.GetHeight()) - // make the immediate parent visible instead of the focused control - win=parent; - } - - // make win position relative to the m_targetWindow viewing area instead of - // its parent - const wxRect - winRect(m_targetWindow->ScreenToClient(win->GetScreenPosition()), - win->GetSize()); - - // check if it's fully visible - if ( viewRect.Contains(winRect) ) - { - // it is, nothing to do - return; - } - - // check if we can make it fully visible: this is only possible if it's not - // larger than our view area - if ( winRect.GetWidth() > viewRect.GetWidth() || - winRect.GetHeight() > viewRect.GetHeight() ) - { - // we can't make it fit so avoid scrolling it at all, this is only - // going to be confusing and not helpful - return; - } - - - // do make the window fit inside the view area by scrolling to it - int stepx, stepy; - GetScrollPixelsPerUnit(&stepx, &stepy); - - int startx, starty; - GetViewStart(&startx, &starty); - - // first in vertical direction: - if ( stepy > 0 ) - { - int diff = 0; - - if ( winRect.GetTop() < 0 ) - { - diff = winRect.GetTop(); - } - else if ( winRect.GetBottom() > viewRect.GetHeight() ) - { - diff = winRect.GetBottom() - viewRect.GetHeight() + 1; - // round up to next scroll step if we can't get exact position, - // so that the window is fully visible: - diff += stepy - 1; - } - - starty = (starty * stepy + diff) / stepy; - } - - // then horizontal: - if ( stepx > 0 ) - { - int diff = 0; - - if ( winRect.GetLeft() < 0 ) - { - diff = winRect.GetLeft(); - } - else if ( winRect.GetRight() > viewRect.GetWidth() ) - { - diff = winRect.GetRight() - viewRect.GetWidth() + 1; - // round up to next scroll step if we can't get exact position, - // so that the window is fully visible: - diff += stepx - 1; - } - - startx = (startx * stepx + diff) / stepx; - } - - Scroll(startx, starty); -} - -// ---------------------------------------------------------------------------- -// wxScrolledWindow implementation -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel) - -BEGIN_EVENT_TABLE(wxScrolledWindow, wxPanel) - EVT_PAINT(wxScrolledWindow::OnPaint) -END_EVENT_TABLE() - -bool wxScrolledWindow::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - m_targetWindow = this; -#ifdef __WXMAC__ - MacSetClipChildren( true ) ; -#endif - - bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name); - - return ok; -} - -wxScrolledWindow::~wxScrolledWindow() -{ -} - -void wxScrolledWindow::OnPaint(wxPaintEvent& event) -{ - // the user code didn't really draw the window if we got here, so set this - // flag to try to call OnDraw() later - m_handler->ResetDrawnFlag(); - - event.Skip(); -} - -#ifdef __WXMSW__ -WXLRESULT wxScrolledWindow::MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam) -{ - WXLRESULT rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam); - -#ifndef __WXWINCE__ - // we need to process arrows ourselves for scrolling - if ( nMsg == WM_GETDLGCODE ) - { - rc |= DLGC_WANTARROWS; - } -#endif - - return rc; -} - -#endif // __WXMSW__ diff --git a/Source/3rdParty/wx/src/generic/selstore.cpp b/Source/3rdParty/wx/src/generic/selstore.cpp deleted file mode 100644 index 653de1511..000000000 --- a/Source/3rdParty/wx/src/generic/selstore.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: generic/selstore.cpp -// Purpose: wxSelectionStore implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.06.03 (extracted from src/generic/listctrl.cpp) -// RCS-ID: $Id: selstore.cpp 27853 2004-06-17 16:22:36Z ABX $ -// Copyright: (c) 2000-2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/selstore.h" - -// ============================================================================ -// wxSelectionStore -// ============================================================================ - -// ---------------------------------------------------------------------------- -// tests -// ---------------------------------------------------------------------------- - -bool wxSelectionStore::IsSelected(size_t item) const -{ - bool isSel = m_itemsSel.Index(item) != wxNOT_FOUND; - - // if the default state is to be selected, being in m_itemsSel means that - // the item is not selected, so we have to inverse the logic - return m_defaultState ? !isSel : isSel; -} - -// ---------------------------------------------------------------------------- -// Select*() -// ---------------------------------------------------------------------------- - -bool wxSelectionStore::SelectItem(size_t item, bool select) -{ - // search for the item ourselves as like this we get the index where to - // insert it later if needed, so we do only one search in the array instead - // of two (adding item to a sorted array requires a search) - size_t index = m_itemsSel.IndexForInsert(item); - bool isSel = index < m_itemsSel.GetCount() && m_itemsSel[index] == item; - - if ( select != m_defaultState ) - { - if ( !isSel ) - { - m_itemsSel.AddAt(item, index); - - return true; - } - } - else // reset to default state - { - if ( isSel ) - { - m_itemsSel.RemoveAt(index); - return true; - } - } - - return false; -} - -bool wxSelectionStore::SelectRange(size_t itemFrom, size_t itemTo, - bool select, - wxArrayInt *itemsChanged) -{ - // 100 is hardcoded but it shouldn't matter much: the important thing is - // that we don't refresh everything when really few (e.g. 1 or 2) items - // change state - static const size_t MANY_ITEMS = 100; - - wxASSERT_MSG( itemFrom <= itemTo, _T("should be in order") ); - - // are we going to have more [un]selected items than the other ones? - if ( itemTo - itemFrom > m_count/2 ) - { - if ( select != m_defaultState ) - { - // the default state now becomes the same as 'select' - m_defaultState = select; - - // so all the old selections (which had state select) shouldn't be - // selected any more, but all the other ones should - wxSelectedIndices selOld = m_itemsSel; - m_itemsSel.Empty(); - - // TODO: it should be possible to optimize the searches a bit - // knowing the possible range - - size_t item; - for ( item = 0; item < itemFrom; item++ ) - { - if ( selOld.Index(item) == wxNOT_FOUND ) - m_itemsSel.Add(item); - } - - for ( item = itemTo + 1; item < m_count; item++ ) - { - if ( selOld.Index(item) == wxNOT_FOUND ) - m_itemsSel.Add(item); - } - - // many items (> half) changed state - itemsChanged = NULL; - } - else // select == m_defaultState - { - // get the inclusive range of items between itemFrom and itemTo - size_t count = m_itemsSel.GetCount(), - start = m_itemsSel.IndexForInsert(itemFrom), - end = m_itemsSel.IndexForInsert(itemTo); - - if ( start == count || m_itemsSel[start] < itemFrom ) - { - start++; - } - - if ( end == count || m_itemsSel[end] > itemTo ) - { - end--; - } - - if ( start <= end ) - { - // delete all of them (from end to avoid changing indices) - for ( int i = end; i >= (int)start; i-- ) - { - if ( itemsChanged ) - { - if ( itemsChanged->GetCount() > MANY_ITEMS ) - { - // stop counting (see comment below) - itemsChanged = NULL; - } - else - { - itemsChanged->Add(m_itemsSel[i]); - } - } - - m_itemsSel.RemoveAt(i); - } - } - } - } - else // "few" items change state - { - if ( itemsChanged ) - { - itemsChanged->Empty(); - } - - // just add the items to the selection - for ( size_t item = itemFrom; item <= itemTo; item++ ) - { - if ( SelectItem(item, select) && itemsChanged ) - { - itemsChanged->Add(item); - - if ( itemsChanged->GetCount() > MANY_ITEMS ) - { - // stop counting them, we'll just eat gobs of memory - // for nothing at all - faster to refresh everything in - // this case - itemsChanged = NULL; - } - } - } - } - - // we set it to NULL if there are many items changing state - return itemsChanged != NULL; -} - -// ---------------------------------------------------------------------------- -// callbacks -// ---------------------------------------------------------------------------- - -void wxSelectionStore::OnItemDelete(size_t item) -{ - size_t count = m_itemsSel.GetCount(), - i = m_itemsSel.IndexForInsert(item); - - if ( i < count && m_itemsSel[i] == item ) - { - // this item itself was in m_itemsSel, remove it from there - m_itemsSel.RemoveAt(i); - - count--; - } - - // and adjust the index of all which follow it - while ( i < count ) - { - // all following elements must be greater than the one we deleted - wxASSERT_MSG( m_itemsSel[i] > item, _T("logic error") ); - - m_itemsSel[i++]--; - } -} - diff --git a/Source/3rdParty/wx/src/generic/spinctlg.cpp b/Source/3rdParty/wx/src/generic/spinctlg.cpp deleted file mode 100644 index 92f3eeea4..000000000 --- a/Source/3rdParty/wx/src/generic/spinctlg.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/spinctlg.cpp -// Purpose: implements wxSpinCtrl as a composite control -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.01.01 -// RCS-ID: $Id: spinctlg.cpp 52582 2008-03-17 13:46:31Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// There are port-specific versions for MSW, GTK, OS/2 and Mac, so exclude the -// contents of this file in those cases -#if !(defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || \ - defined(__WXMAC__)) || defined(__WXUNIVERSAL__) - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" -#endif //WX_PRECOMP - -#if wxUSE_SPINCTRL - -#include "wx/spinbutt.h" -#include "wx/spinctrl.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the text control and the spin -static const wxCoord MARGIN = 2; - -// ---------------------------------------------------------------------------- -// wxSpinCtrlText: text control used by spin control -// ---------------------------------------------------------------------------- - -class wxSpinCtrlText : public wxTextCtrl -{ -public: - wxSpinCtrlText(wxSpinCtrl *spin, const wxString& value) - : wxTextCtrl(spin->GetParent(), wxID_ANY, value) - { - m_spin = spin; - - // remove the default minsize, the spinctrl will have one instead - SetSizeHints(wxDefaultCoord,wxDefaultCoord); - } - -protected: - void OnTextChange(wxCommandEvent& event) - { - int val; - if ( m_spin->GetTextValue(&val) ) - { - m_spin->GetSpinButton()->SetValue(val); - } - - event.Skip(); - } - - bool ProcessEvent(wxEvent &event) - { - // Hand button down events to wxSpinCtrl. Doesn't work. - if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event )) - return true; - - return wxTextCtrl::ProcessEvent( event ); - } - -private: - wxSpinCtrl *m_spin; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSpinCtrlText, wxTextCtrl) - EVT_TEXT(wxID_ANY, wxSpinCtrlText::OnTextChange) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// wxSpinCtrlButton: spin button used by spin control -// ---------------------------------------------------------------------------- - -class wxSpinCtrlButton : public wxSpinButton -{ -public: - wxSpinCtrlButton(wxSpinCtrl *spin, int style) - : wxSpinButton(spin->GetParent()) - { - m_spin = spin; - - SetWindowStyle(style | wxSP_VERTICAL); - - // remove the default minsize, the spinctrl will have one instead - SetSizeHints(wxDefaultCoord,wxDefaultCoord); - } - -protected: - void OnSpinButton(wxSpinEvent& eventSpin) - { - m_spin->SetTextValue(eventSpin.GetPosition()); - - wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId()); - event.SetEventObject(m_spin); - event.SetInt(eventSpin.GetPosition()); - - m_spin->GetEventHandler()->ProcessEvent(event); - - eventSpin.Skip(); - } - -private: - wxSpinCtrl *m_spin; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) - EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton) -END_EVENT_TABLE() - -IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxSpinCtrl creation -// ---------------------------------------------------------------------------- - -void wxSpinCtrl::Init() -{ - m_text = NULL; - m_btn = NULL; -} - -bool wxSpinCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - int min, - int max, - int initial, - const wxString& name) -{ - if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, - wxDefaultValidator, name) ) - { - return false; - } - - // the string value overrides the numeric one (for backwards compatibility - // reasons and also because it is simpler to satisfy the string value which - // comes much sooner in the list of arguments and leave the initial - // parameter unspecified) - if ( !value.empty() ) - { - long l; - if ( value.ToLong(&l) ) - initial = l; - } - - m_text = new wxSpinCtrlText(this, value); - m_btn = new wxSpinCtrlButton(this, style); - - m_btn->SetRange(min, max); - m_btn->SetValue(initial); - SetInitialSize(size); - Move(pos); - - // have to disable this window to avoid interfering it with message - // processing to the text and the button... but pretend it is enabled to - // make IsEnabled() return true - wxControl::Enable(false); // don't use non virtual Disable() here! - m_isEnabled = true; - - // we don't even need to show this window itself - and not doing it avoids - // that it overwrites the text control - wxControl::Show(false); - m_isShown = true; - return true; -} - -wxSpinCtrl::~wxSpinCtrl() -{ - // delete the controls now, don't leave them alive even though they would - // still be eventually deleted by our parent - but it will be too late, the - // user code expects them to be gone now - delete m_text; - m_text = NULL ; - delete m_btn; - m_btn = NULL ; -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxSpinCtrl::DoGetBestSize() const -{ - wxSize sizeBtn = m_btn->GetBestSize(), - sizeText = m_text->GetBestSize(); - - return wxSize(sizeBtn.x + sizeText.x + MARGIN, sizeText.y); -} - -void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) -{ - wxControl::DoMoveWindow(x, y, width, height); - - // position the subcontrols inside the client area - wxSize sizeBtn = m_btn->GetSize(); - - wxCoord wText = width - sizeBtn.x; - m_text->SetSize(x, y, wText, height); - m_btn->SetSize(x + wText + MARGIN, y, wxDefaultCoord, height); -} - -// ---------------------------------------------------------------------------- -// operations forwarded to the subcontrols -// ---------------------------------------------------------------------------- - -bool wxSpinCtrl::Enable(bool enable) -{ - if ( !wxControl::Enable(enable) ) - return false; - - m_btn->Enable(enable); - m_text->Enable(enable); - - return true; -} - -bool wxSpinCtrl::Show(bool show) -{ - if ( !wxControl::Show(show) ) - return false; - - // under GTK Show() is called the first time before we are fully - // constructed - if ( m_btn ) - { - m_btn->Show(show); - m_text->Show(show); - } - - return true; -} - -bool wxSpinCtrl::Reparent(wxWindow *newParent) -{ - if ( m_btn ) - { - m_btn->Reparent(newParent); - m_text->Reparent(newParent); - } - - return true; -} - -// ---------------------------------------------------------------------------- -// value and range access -// ---------------------------------------------------------------------------- - -bool wxSpinCtrl::GetTextValue(int *val) const -{ - long l; - if ( !m_text->GetValue().ToLong(&l) ) - { - // not a number at all - return false; - } - - if ( l < GetMin() || l > GetMax() ) - { - // out of range - return false; - } - - *val = l; - - return true; -} - -int wxSpinCtrl::GetValue() const -{ - return m_btn ? m_btn->GetValue() : 0; -} - -int wxSpinCtrl::GetMin() const -{ - return m_btn ? m_btn->GetMin() : 0; -} - -int wxSpinCtrl::GetMax() const -{ - return m_btn ? m_btn->GetMax() : 0; -} - -// ---------------------------------------------------------------------------- -// changing value and range -// ---------------------------------------------------------------------------- - -void wxSpinCtrl::SetTextValue(int val) -{ - wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetTextValue") ); - - m_text->SetValue(wxString::Format(_T("%d"), val)); - - // select all text - m_text->SetSelection(0, -1); - - // and give focus to the control! - // m_text->SetFocus(); Why???? TODO. - -#ifdef __WXCOCOA__ - /* It's sort of a hack to do this from here but the idea is that if the - user has clicked on us, which is the main reason this method is called, - then focus probably ought to go to the text control since clicking on - a text control usually gives it focus. - - However, if the focus is already on us (i.e. the user has turned on - the ability to tab to controls) then we don't want to drop focus. - So we only set focus if we would steal it away from a different - control, not if we would steal it away from ourself. - */ - wxWindow *currentFocusedWindow = wxWindow::FindFocus(); - if(currentFocusedWindow != this && currentFocusedWindow != m_text) - m_text->SetFocus(); -#endif -} - -void wxSpinCtrl::SetValue(int val) -{ - wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetValue") ); - - SetTextValue(val); - - m_btn->SetValue(val); -} - -void wxSpinCtrl::SetValue(const wxString& text) -{ - wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetValue") ); - - long val; - if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) ) - { - SetValue((int)val); - } - else // not a number at all or out of range - { - m_text->SetValue(text); - m_text->SetSelection(0, -1); - } -} - -void wxSpinCtrl::SetRange(int min, int max) -{ - wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetRange") ); - - m_btn->SetRange(min, max); -} - -void wxSpinCtrl::SetSelection(long from, long to) -{ - wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetSelection") ); - - m_text->SetSelection(from, to); -} - -#endif // wxUSE_SPINCTRL -#endif // !wxPort-with-native-spinctrl diff --git a/Source/3rdParty/wx/src/generic/splitter.cpp b/Source/3rdParty/wx/src/generic/splitter.cpp deleted file mode 100644 index ccad80b62..000000000 --- a/Source/3rdParty/wx/src/generic/splitter.cpp +++ /dev/null @@ -1,1064 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/splitter.cpp -// Purpose: wxSplitterWindow implementation -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: splitter.cpp 60837 2009-05-31 13:13:07Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_SPLITTER - -#include "wx/splitter.h" - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/utils.h" - #include "wx/log.h" - - #include "wx/dcclient.h" - #include "wx/dcscreen.h" - - #include "wx/window.h" - #include "wx/dialog.h" - #include "wx/frame.h" - - #include "wx/settings.h" -#endif - -#include "wx/renderer.h" - -#include - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT) - -IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) - -/* - TODO PROPERTIES - style wxSP_3D - sashpos (long , 0 ) - minsize (long -1 ) - object, object_ref - orientation -*/ - -IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent) - -BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) - EVT_PAINT(wxSplitterWindow::OnPaint) - EVT_SIZE(wxSplitterWindow::OnSize) - EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent) - -#if defined( __WXMSW__ ) || defined( __WXMAC__) - EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor) -#endif // wxMSW - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxSplitterWindow) -END_EVENT_TABLE() - -WX_DELEGATE_TO_CONTROL_CONTAINER(wxSplitterWindow, wxWindow) - -bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - // allow TABbing from one window to the other - style |= wxTAB_TRAVERSAL; - - // we draw our border ourselves to blend the sash with it - style &= ~wxBORDER_MASK; - style |= wxBORDER_NONE; - -#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS - // CoreGraphics can't paint sash feedback - style |= wxSP_LIVE_UPDATE; -#endif - - if ( !wxWindow::Create(parent, id, pos, size, style, name) ) - return false; - - if (size.x >= 0) - m_lastSize.x = size.x; - if (size.y >= 0) - m_lastSize.y = size.y; - - m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0; - - // FIXME: with this line the background is not erased at all under GTK1, - // so temporary avoid it there -#if !defined(__WXGTK__) || defined(__WXGTK20__) - // don't erase the splitter background, it's pointless as we overwrite it - // anyhow - SetBackgroundStyle(wxBG_STYLE_CUSTOM); -#endif - - return true; -} - -void wxSplitterWindow::Init() -{ - m_container.SetContainerWindow(this); - - m_splitMode = wxSPLIT_VERTICAL; - m_permitUnsplitAlways = true; - m_windowOne = (wxWindow *) NULL; - m_windowTwo = (wxWindow *) NULL; - m_dragMode = wxSPLIT_DRAG_NONE; - m_oldX = 0; - m_oldY = 0; - m_firstX = 0; - m_firstY = 0; - m_sashPosition = m_requestedSashPosition = 0; - m_sashGravity = 0.0; - m_sashSize = -1; // -1 means use the native sash size - m_lastSize = wxSize(0,0); - m_checkRequestedSashPosition = false; - m_minimumPaneSize = 0; - m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE); - m_sashCursorNS = wxCursor(wxCURSOR_SIZENS); - m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID); - - m_needUpdating = false; - m_isHot = false; -} - -wxSplitterWindow::~wxSplitterWindow() -{ - delete m_sashTrackerPen; -} - -// ---------------------------------------------------------------------------- -// entering/leaving sash -// ---------------------------------------------------------------------------- - -void wxSplitterWindow::RedrawIfHotSensitive(bool isHot) -{ - if ( wxRendererNative::Get().GetSplitterParams(this).isHotSensitive ) - { - m_isHot = isHot; - - wxClientDC dc(this); - DrawSash(dc); - } - //else: we don't change our appearance, don't redraw to avoid flicker -} - -void wxSplitterWindow::OnEnterSash() -{ - SetResizeCursor(); - - RedrawIfHotSensitive(true); -} - -void wxSplitterWindow::OnLeaveSash() -{ - SetCursor(*wxSTANDARD_CURSOR); - - RedrawIfHotSensitive(false); -} - -void wxSplitterWindow::SetResizeCursor() -{ - SetCursor(m_splitMode == wxSPLIT_VERTICAL ? m_sashCursorWE - : m_sashCursorNS); -} - -// ---------------------------------------------------------------------------- -// other event handlers -// ---------------------------------------------------------------------------- - -void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - - DrawSash(dc); -} - -void wxSplitterWindow::OnInternalIdle() -{ - wxWindow::OnInternalIdle(); - - // if this is the first idle time after a sash position has potentially - // been set, allow SizeWindows to check for a requested size. - if (!m_checkRequestedSashPosition) - { - m_checkRequestedSashPosition = true; - SizeWindows(); - return; // it won't needUpdating in this case - } - - if (m_needUpdating) - SizeWindows(); -} - -void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) -{ - int x = (int)event.GetX(), - y = (int)event.GetY(); - - if ( GetWindowStyle() & wxSP_NOSASH ) - { - event.Skip(); - return; - } - - // with wxSP_LIVE_UPDATE style the splitter windows are always resized - // following the mouse movement while it drags the sash, without it we only - // draw the sash at the new position but only resize the windows when the - // dragging is finished -#if defined( __WXMAC__ ) && defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX == 1 - bool isLive = true ; // FIXME: why? -#else - bool isLive = HasFlag(wxSP_LIVE_UPDATE); -#endif - if (event.LeftDown()) - { - if ( SashHitTest(x, y) ) - { - // Start the drag now - m_dragMode = wxSPLIT_DRAG_DRAGGING; - - // Capture mouse and set the cursor - CaptureMouse(); - SetResizeCursor(); - - if ( !isLive ) - { - // remember the initial sash position and draw the initial - // shadow sash - m_sashPositionCurrent = m_sashPosition; - - DrawSashTracker(x, y); - } - - m_oldX = x; - m_oldY = y; - - SetResizeCursor(); - return; - } - } - else if (event.LeftUp() && m_dragMode == wxSPLIT_DRAG_DRAGGING) - { - // We can stop dragging now and see what we've got. - m_dragMode = wxSPLIT_DRAG_NONE; - - // Release mouse and unset the cursor - ReleaseMouse(); - SetCursor(* wxSTANDARD_CURSOR); - - // exit if unsplit after doubleclick - if ( !IsSplit() ) - { - return; - } - - // Erase old tracker - if ( !isLive ) - { - DrawSashTracker(m_oldX, m_oldY); - } - - // the position of the click doesn't exactly correspond to - // m_sashPosition, rather it changes it by the distance by which the - // mouse has moved - int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY; - - int posSashOld = isLive ? m_sashPosition : m_sashPositionCurrent; - int posSashNew = OnSashPositionChanging(posSashOld + diff); - if ( posSashNew == -1 ) - { - // change not allowed - return; - } - - if ( m_permitUnsplitAlways || m_minimumPaneSize == 0 ) - { - // Deal with possible unsplit scenarios - if ( posSashNew == 0 ) - { - // We remove the first window from the view - wxWindow *removedWindow = m_windowOne; - m_windowOne = m_windowTwo; - m_windowTwo = (wxWindow *) NULL; - OnUnsplit(removedWindow); - wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - eventUnsplit.m_data.win = removedWindow; - (void)DoSendEvent(eventUnsplit); - SetSashPositionAndNotify(0); - } - else if ( posSashNew == GetWindowSize() ) - { - // We remove the second window from the view - wxWindow *removedWindow = m_windowTwo; - m_windowTwo = (wxWindow *) NULL; - OnUnsplit(removedWindow); - wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - eventUnsplit.m_data.win = removedWindow; - (void)DoSendEvent(eventUnsplit); - SetSashPositionAndNotify(0); - } - else - { - SetSashPositionAndNotify(posSashNew); - } - } - else - { - SetSashPositionAndNotify(posSashNew); - } - - SizeWindows(); - } // left up && dragging - else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE)) - { - if ( event.Leaving() || !SashHitTest(x, y) ) - OnLeaveSash(); - else - OnEnterSash(); - } - else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING)) - { - int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY; - if ( !diff ) - { - // nothing to do, mouse didn't really move far enough - return; - } - - int posSashOld = isLive ? m_sashPosition : m_sashPositionCurrent; - int posSashNew = OnSashPositionChanging(posSashOld + diff); - if ( posSashNew == -1 ) - { - // change not allowed - return; - } - - if ( posSashNew == m_sashPosition ) - return; - - // Erase old tracker - if ( !isLive ) - { - DrawSashTracker(m_oldX, m_oldY); - } - - if (m_splitMode == wxSPLIT_VERTICAL) - x = posSashNew; - else - y = posSashNew; - - // Remember old positions - m_oldX = x; - m_oldY = y; - -#ifdef __WXMSW__ - // As we captured the mouse, we may get the mouse events from outside - // our window - for example, negative values in x, y. This has a weird - // consequence under MSW where we use unsigned values sometimes and - // signed ones other times: the coordinates turn as big positive - // numbers and so the sash is drawn on the *right* side of the window - // instead of the left (or bottom instead of top). Correct this. - if ( (short)m_oldX < 0 ) - m_oldX = 0; - if ( (short)m_oldY < 0 ) - m_oldY = 0; -#endif // __WXMSW__ - - // Draw new one - if ( !isLive ) - { - m_sashPositionCurrent = posSashNew; - - DrawSashTracker(m_oldX, m_oldY); - } - else - { - DoSetSashPosition(posSashNew); - m_needUpdating = true; - } - } - else if ( event.LeftDClick() && m_windowTwo ) - { - OnDoubleClickSash(x, y); - } - else - { - event.Skip(); - } -} - -void wxSplitterWindow::OnSize(wxSizeEvent& event) -{ - // only process this message if we're not iconized - otherwise iconizing - // and restoring a window containing the splitter has a funny side effect - // of changing the splitter position! - wxWindow *parent = wxGetTopLevelParent(this); - bool iconized; - - wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow); - if ( winTop ) - { - iconized = winTop->IsIconized(); - } - else - { - wxFAIL_MSG(wxT("should have a top level parent!")); - - iconized = false; - } - - if ( iconized ) - { - m_lastSize = wxSize(0,0); - - event.Skip(); - - return; - } - - if ( m_windowTwo ) - { - int w, h; - GetClientSize(&w, &h); - - int size = m_splitMode == wxSPLIT_VERTICAL ? w : h; - - int old_size = m_splitMode == wxSPLIT_VERTICAL ? m_lastSize.x : m_lastSize.y; - if ( old_size != 0 ) - { - int delta = (int) ( (size - old_size)*m_sashGravity ); - if ( delta != 0 ) - { - int newPosition = m_sashPosition + delta; - if( newPosition < m_minimumPaneSize ) - newPosition = m_minimumPaneSize; - SetSashPositionAndNotify(newPosition); - } - } - - if ( m_sashPosition >= size - 5 ) - SetSashPositionAndNotify(wxMax(10, size - 40)); - m_lastSize = wxSize(w,h); - } - - SizeWindows(); -} - -void wxSplitterWindow::SetSashGravity(double gravity) -{ - wxCHECK_RET( gravity >= 0. && gravity <= 1., - _T("invalid gravity value") ); - - m_sashGravity = gravity; -} - -bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) -{ - if ( m_windowTwo == NULL || m_sashPosition == 0) - return false; // No sash - - int z = m_splitMode == wxSPLIT_VERTICAL ? x : y; - int hitMin = m_sashPosition - tolerance; - int hitMax = m_sashPosition + GetSashSize() + tolerance; - - return z >= hitMin && z <= hitMax; -} - -int wxSplitterWindow::GetSashSize() const -{ - return m_sashSize > -1 ? m_sashSize : wxRendererNative::Get().GetSplitterParams(this).widthSash; -} - -int wxSplitterWindow::GetBorderSize() const -{ - return wxRendererNative::Get().GetSplitterParams(this).border; -} - -// Draw the sash -void wxSplitterWindow::DrawSash(wxDC& dc) -{ - if (HasFlag(wxSP_3DBORDER)) - wxRendererNative::Get().DrawSplitterBorder - ( - this, - dc, - GetClientRect() - ); - - // don't draw sash if we're not split - if ( m_sashPosition == 0 || !m_windowTwo ) - return; - - // nor if we're configured to not show it - if ( HasFlag(wxSP_NOSASH) ) - return; - - wxRendererNative::Get().DrawSplitterSash - ( - this, - dc, - GetClientSize(), - m_sashPosition, - m_splitMode == wxSPLIT_VERTICAL ? wxVERTICAL - : wxHORIZONTAL, - m_isHot ? (int)wxCONTROL_CURRENT : 0 - ); -} - -// Draw the sash tracker (for whilst moving the sash) -void wxSplitterWindow::DrawSashTracker(int x, int y) -{ - int w, h; - GetClientSize(&w, &h); - - wxScreenDC screenDC; - int x1, y1; - int x2, y2; - - if ( m_splitMode == wxSPLIT_VERTICAL ) - { - x1 = x; y1 = 2; - x2 = x; y2 = h-2; - - if ( x1 > w ) - { - x1 = w; x2 = w; - } - else if ( x1 < 0 ) - { - x1 = 0; x2 = 0; - } - } - else - { - x1 = 2; y1 = y; - x2 = w-2; y2 = y; - - if ( y1 > h ) - { - y1 = h; - y2 = h; - } - else if ( y1 < 0 ) - { - y1 = 0; - y2 = 0; - } - } - - ClientToScreen(&x1, &y1); - ClientToScreen(&x2, &y2); - - screenDC.SetLogicalFunction(wxINVERT); - screenDC.SetPen(*m_sashTrackerPen); - screenDC.SetBrush(*wxTRANSPARENT_BRUSH); - - screenDC.DrawLine(x1, y1, x2, y2); - - screenDC.SetLogicalFunction(wxCOPY); -} - -int wxSplitterWindow::GetWindowSize() const -{ - wxSize size = GetClientSize(); - - return m_splitMode == wxSPLIT_VERTICAL ? size.x : size.y; -} - -int wxSplitterWindow::AdjustSashPosition(int sashPos) const -{ - wxWindow *win; - - win = GetWindow1(); - if ( win ) - { - // the window shouldn't be smaller than its own minimal size nor - // smaller than the minimual pane size specified for this splitter - int minSize = m_splitMode == wxSPLIT_VERTICAL ? win->GetMinWidth() - : win->GetMinHeight(); - - if ( minSize == -1 || m_minimumPaneSize > minSize ) - minSize = m_minimumPaneSize; - - minSize += GetBorderSize(); - - if ( sashPos < minSize ) - sashPos = minSize; - } - - win = GetWindow2(); - if ( win ) - { - int minSize = m_splitMode == wxSPLIT_VERTICAL ? win->GetMinWidth() - : win->GetMinHeight(); - - if ( minSize == -1 || m_minimumPaneSize > minSize ) - minSize = m_minimumPaneSize; - - int maxSize = GetWindowSize() - minSize - GetBorderSize() - GetSashSize(); - if ( maxSize > 0 && sashPos > maxSize && maxSize >= m_minimumPaneSize) - sashPos = maxSize; - } - - return sashPos; -} - -bool wxSplitterWindow::DoSetSashPosition(int sashPos) -{ - int newSashPosition = AdjustSashPosition(sashPos); - - if ( newSashPosition == m_sashPosition ) - return false; - - m_sashPosition = newSashPosition; - - return true; -} - -void wxSplitterWindow::SetSashPositionAndNotify(int sashPos) -{ - // we must reset the request here, otherwise the sash would be stuck at - // old position if the user attempted to move the sash after invalid - // (e.g. smaller than minsize) sash position was requested using - // SetSashPosition(): - m_requestedSashPosition = INT_MAX; - - // note that we must send the event in any case, i.e. even if the sash - // position hasn't changed and DoSetSashPosition() returns false because we - // must generate a CHANGED event at the end of resizing - DoSetSashPosition(sashPos); - - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this); - event.m_data.pos = m_sashPosition; - - (void)DoSendEvent(event); -} - -// Position and size subwindows. -// Note that the border size applies to each subwindow, not -// including the edges next to the sash. -void wxSplitterWindow::SizeWindows() -{ - // check if we have delayed setting the real sash position - if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) - { - int newSashPosition = ConvertSashPosition(m_requestedSashPosition); - if ( newSashPosition != m_sashPosition ) - { - DoSetSashPosition(newSashPosition); - } - - if ( newSashPosition <= m_sashPosition - && newSashPosition >= m_sashPosition - GetBorderSize() ) - { - // don't update it any more - m_requestedSashPosition = INT_MAX; - } - } - - int w, h; - GetClientSize(&w, &h); - - if ( GetWindow1() && !GetWindow2() ) - { - GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), - w - 2*GetBorderSize(), h - 2*GetBorderSize()); - } - else if ( GetWindow1() && GetWindow2() ) - { - const int border = GetBorderSize(), - sash = GetSashSize(); - - int size1 = GetSashPosition() - border, - size2 = GetSashPosition() + sash; - - int x2, y2, w1, h1, w2, h2; - if ( GetSplitMode() == wxSPLIT_VERTICAL ) - { - w1 = size1; - w2 = w - 2*border - sash - w1; - if (w2 < 0) - w2 = 0; - h2 = h - 2*border; - if (h2 < 0) - h2 = 0; - h1 = h2; - x2 = size2; - y2 = border; - } - else // horz splitter - { - w2 = w - 2*border; - if (w2 < 0) - w2 = 0; - w1 = w2; - h1 = size1; - h2 = h - 2*border - sash - h1; - if (h2 < 0) - h2 = 0; - x2 = border; - y2 = size2; - } - - GetWindow2()->SetSize(x2, y2, w2, h2); - GetWindow1()->SetSize(border, border, w1, h1); - } - - wxClientDC dc(this); - DrawSash(dc); - - SetNeedUpdating(false); -} - -// Set pane for unsplit window -void wxSplitterWindow::Initialize(wxWindow *window) -{ - wxASSERT_MSG( (!window || (window && window->GetParent() == this)), - _T("windows in the splitter should have it as parent!") ); - - if (window && !window->IsShown()) - window->Show(); - - m_windowOne = window; - m_windowTwo = (wxWindow *) NULL; - DoSetSashPosition(0); -} - -// Associates the given window with window 2, drawing the appropriate sash -// and changing the split mode. -// Does nothing and returns false if the window is already split. -bool wxSplitterWindow::DoSplit(wxSplitMode mode, - wxWindow *window1, wxWindow *window2, - int sashPosition) -{ - if ( IsSplit() ) - return false; - - wxCHECK_MSG( window1 && window2, false, - _T("can not split with NULL window(s)") ); - - wxCHECK_MSG( window1->GetParent() == this && window2->GetParent() == this, false, - _T("windows in the splitter should have it as parent!") ); - - if (! window1->IsShown()) - window1->Show(); - if (! window2->IsShown()) - window2->Show(); - - m_splitMode = mode; - m_windowOne = window1; - m_windowTwo = window2; - - // remember the sash position we want to set for later if we can't set it - // right now (e.g. because the window is too small) - m_requestedSashPosition = sashPosition; - m_checkRequestedSashPosition = false; - - DoSetSashPosition(ConvertSashPosition(sashPosition)); - - SizeWindows(); - - return true; -} - -int wxSplitterWindow::ConvertSashPosition(int sashPosition) const -{ - if ( sashPosition > 0 ) - { - return sashPosition; - } - else if ( sashPosition < 0 ) - { - // It's negative so adding is subtracting - return GetWindowSize() + sashPosition; - } - else // sashPosition == 0 - { - // default, put it in the centre - return GetWindowSize() / 2; - } -} - -// Remove the specified (or second) window from the view -// Doesn't actually delete the window. -bool wxSplitterWindow::Unsplit(wxWindow *toRemove) -{ - if ( ! IsSplit() ) - return false; - - wxWindow *win; - if ( toRemove == NULL || toRemove == m_windowTwo) - { - win = m_windowTwo ; - m_windowTwo = (wxWindow *) NULL; - } - else if ( toRemove == m_windowOne ) - { - win = m_windowOne ; - m_windowOne = m_windowTwo; - m_windowTwo = (wxWindow *) NULL; - } - else - { - wxFAIL_MSG(wxT("splitter: attempt to remove a non-existent window")); - - return false; - } - - OnUnsplit(win); - DoSetSashPosition(0); - SizeWindows(); - - return true; -} - -// Replace a window with another one -bool wxSplitterWindow::ReplaceWindow(wxWindow *winOld, wxWindow *winNew) -{ - wxCHECK_MSG( winOld, false, wxT("use one of Split() functions instead") ); - wxCHECK_MSG( winNew, false, wxT("use Unsplit() functions instead") ); - - if ( winOld == m_windowTwo ) - { - m_windowTwo = winNew; - } - else if ( winOld == m_windowOne ) - { - m_windowOne = winNew; - } - else - { - wxFAIL_MSG(wxT("splitter: attempt to replace a non-existent window")); - - return false; - } - - SizeWindows(); - - return true; -} - -void wxSplitterWindow::SetMinimumPaneSize(int min) -{ - m_minimumPaneSize = min; - int pos = m_requestedSashPosition != INT_MAX ? m_requestedSashPosition : m_sashPosition; - SetSashPosition(pos); // re-check limits -} - -void wxSplitterWindow::SetSashPosition(int position, bool redraw) -{ - // remember the sash position we want to set for later if we can't set it - // right now (e.g. because the window is too small) - m_requestedSashPosition = position; - m_checkRequestedSashPosition = false; - - DoSetSashPosition(ConvertSashPosition(position)); - - if ( redraw ) - { - SizeWindows(); - } -} - -// Make sure the child window sizes are updated. This is useful -// for reducing flicker by updating the sizes before a -// window is shown, if you know the overall size is correct. -void wxSplitterWindow::UpdateSize() -{ - m_checkRequestedSashPosition = true; - SizeWindows(); - m_checkRequestedSashPosition = false; -} - -bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event) -{ - return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed(); -} - -wxSize wxSplitterWindow::DoGetBestSize() const -{ - // get best sizes of subwindows - wxSize size1, size2; - if ( m_windowOne ) - size1 = m_windowOne->GetEffectiveMinSize(); - if ( m_windowTwo ) - size2 = m_windowTwo->GetEffectiveMinSize(); - - // sum them - // - // pSash points to the size component to which sash size must be added - int *pSash; - wxSize sizeBest; - if ( m_splitMode == wxSPLIT_VERTICAL ) - { - sizeBest.y = wxMax(size1.y, size2.y); - sizeBest.x = wxMax(size1.x, m_minimumPaneSize) + - wxMax(size2.x, m_minimumPaneSize); - - pSash = &sizeBest.x; - } - else // wxSPLIT_HORIZONTAL - { - sizeBest.x = wxMax(size1.x, size2.x); - sizeBest.y = wxMax(size1.y, m_minimumPaneSize) + - wxMax(size2.y, m_minimumPaneSize); - - pSash = &sizeBest.y; - } - - // account for the sash if the window is actually split - if ( m_windowOne && m_windowTwo ) - *pSash += GetSashSize(); - - // account for the border too - int border = 2*GetBorderSize(); - sizeBest.x += border; - sizeBest.y += border; - - return sizeBest; -} - -// --------------------------------------------------------------------------- -// wxSplitterWindow virtual functions: they now just generate the events -// --------------------------------------------------------------------------- - -bool wxSplitterWindow::OnSashPositionChange(int WXUNUSED(newSashPosition)) -{ - // always allow by default - return true; -} - -int wxSplitterWindow::OnSashPositionChanging(int newSashPosition) -{ - // If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure. - const int UNSPLIT_THRESHOLD = 4; - - // first of all, check if OnSashPositionChange() doesn't forbid this change - if ( !OnSashPositionChange(newSashPosition) ) - { - // it does - return -1; - } - - // Obtain relevant window dimension for bottom / right threshold check - int window_size = GetWindowSize(); - - bool unsplit_scenario = false; - if ( m_permitUnsplitAlways || m_minimumPaneSize == 0 ) - { - // Do edge detection if unsplit premitted - if ( newSashPosition <= UNSPLIT_THRESHOLD ) - { - // threshold top / left check - newSashPosition = 0; - unsplit_scenario = true; - } - if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD ) - { - // threshold bottom/right check - newSashPosition = window_size; - unsplit_scenario = true; - } - } - - if ( !unsplit_scenario ) - { - // If resultant pane would be too small, enlarge it - newSashPosition = AdjustSashPosition(newSashPosition); - } - - // If the result is out of bounds it means minimum size is too big, - // so split window in half as best compromise. - if ( newSashPosition < 0 || newSashPosition > window_size ) - newSashPosition = window_size / 2; - - // now let the event handler have it - // - // FIXME: shouldn't we do it before the adjustments above so as to ensure - // that the sash position is always reasonable? - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, this); - event.m_data.pos = newSashPosition; - - if ( !DoSendEvent(event) ) - { - // the event handler vetoed the change - newSashPosition = -1; - } - else - { - // it could have been changed by it - newSashPosition = event.GetSashPosition(); - } - - return newSashPosition; -} - -// Called when the sash is double-clicked. The default behaviour is to remove -// the sash if the minimum pane size is zero. -void wxSplitterWindow::OnDoubleClickSash(int x, int y) -{ - wxCHECK_RET(m_windowTwo, wxT("splitter: no window to remove")); - - // new code should handle events instead of using the virtual functions - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, this); - event.m_data.pt.x = x; - event.m_data.pt.y = y; - if ( DoSendEvent(event) ) - { - if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways ) - { - wxWindow* win = m_windowTwo; - if ( Unsplit(win) ) - { - wxSplitterEvent unsplitEvent(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - unsplitEvent.m_data.win = win; - (void)DoSendEvent(unsplitEvent); - } - } - } - //else: blocked by user -} - -void wxSplitterWindow::OnUnsplit(wxWindow *winRemoved) -{ - // call this before calling the event handler which may delete the window - winRemoved->Show(false); -} - -#if defined( __WXMSW__ ) || defined( __WXMAC__) - -// this is currently called (and needed) under MSW only... -void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event) -{ - // if we don't do it, the resizing cursor might be set for child window: - // and like this we explicitly say that our cursor should not be used for - // children windows which overlap us - - if ( SashHitTest(event.GetX(), event.GetY(), 0) ) - { - // default processing is ok - event.Skip(); - } - //else: do nothing, in particular, don't call Skip() -} - -#endif // wxMSW || wxMac - -#endif // wxUSE_SPLITTER - diff --git a/Source/3rdParty/wx/src/generic/srchctlg.cpp b/Source/3rdParty/wx/src/generic/srchctlg.cpp deleted file mode 100644 index 8b7edad0d..000000000 --- a/Source/3rdParty/wx/src/generic/srchctlg.cpp +++ /dev/null @@ -1,1216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/srchctlg.cpp -// Purpose: implements wxSearchCtrl as a composite control -// Author: Vince Harron -// Created: 2006-02-19 -// RCS-ID: $Id: srchctlg.cpp 47962 2007-08-08 12:38:13Z JS $ -// Copyright: Vince Harron -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_SEARCHCTRL - -#include "wx/srchctrl.h" - -#ifndef WX_PRECOMP - #include "wx/button.h" - #include "wx/dcclient.h" - #include "wx/menu.h" - #include "wx/dcmemory.h" -#endif //WX_PRECOMP - -#if !wxUSE_NATIVE_SEARCH_CONTROL - -#include "wx/image.h" - -#define WXMAX(a,b) ((a)>(b)?(a):(b)) - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the text control and the search/cancel buttons -static const wxCoord MARGIN = 2; - -// border around all controls to compensate for wxSIMPLE_BORDER -#if defined(__WXMSW__) -static const wxCoord BORDER = 0; -static const wxCoord ICON_MARGIN = 2; -static const wxCoord ICON_OFFSET = 2; -#else -static const wxCoord BORDER = 2; -static const wxCoord ICON_MARGIN = 0; -static const wxCoord ICON_OFFSET = 0; -#endif - -// ---------------------------------------------------------------------------- -// TODO: These functions or something like them should probably be made -// public. There are similar functions in src/aui/dockart.cpp... - -static double wxBlendColour(double fg, double bg, double alpha) -{ - double result = bg + (alpha * (fg - bg)); - if (result < 0.0) - result = 0.0; - if (result > 255) - result = 255; - return result; -} - -static wxColor wxStepColour(const wxColor& c, int ialpha) -{ - if (ialpha == 100) - return c; - - double r = c.Red(), g = c.Green(), b = c.Blue(); - double bg; - - // ialpha is 0..200 where 0 is completely black - // and 200 is completely white and 100 is the same - // convert that to normal alpha 0.0 - 1.0 - ialpha = wxMin(ialpha, 200); - ialpha = wxMax(ialpha, 0); - double alpha = ((double)(ialpha - 100.0))/100.0; - - if (ialpha > 100) - { - // blend with white - bg = 255.0; - alpha = 1.0 - alpha; // 0 = transparent fg; 1 = opaque fg - } - else - { - // blend with black - bg = 0.0; - alpha = 1.0 + alpha; // 0 = transparent fg; 1 = opaque fg - } - - r = wxBlendColour(r, bg, alpha); - g = wxBlendColour(g, bg, alpha); - b = wxBlendColour(b, bg, alpha); - - return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b); -} - -#define LIGHT_STEP 160 - -// ---------------------------------------------------------------------------- -// wxSearchTextCtrl: text control used by search control -// ---------------------------------------------------------------------------- - -class wxSearchTextCtrl : public wxTextCtrl -{ -public: - wxSearchTextCtrl(wxSearchCtrl *search, const wxString& value, int style) - : wxTextCtrl(search, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, - style | wxNO_BORDER) - { - m_search = search; - m_defaultFG = GetForegroundColour(); - - // remove the default minsize, the searchctrl will have one instead - SetSizeHints(wxDefaultCoord,wxDefaultCoord); - } - - void SetDescriptiveText(const wxString& text) - { - if ( GetValue() == m_descriptiveText ) - { - ChangeValue(wxEmptyString); - } - - m_descriptiveText = text; - } - - wxString GetDescriptiveText() const - { - return m_descriptiveText; - } - -protected: - void OnText(wxCommandEvent& eventText) - { - wxCommandEvent event(eventText); - event.SetEventObject(m_search); - event.SetId(m_search->GetId()); - - m_search->GetEventHandler()->ProcessEvent(event); - } - - void OnTextUrl(wxTextUrlEvent& eventText) - { - // copy constructor is disabled for some reason? - //wxTextUrlEvent event(eventText); - wxTextUrlEvent event( - m_search->GetId(), - eventText.GetMouseEvent(), - eventText.GetURLStart(), - eventText.GetURLEnd() - ); - event.SetEventObject(m_search); - - m_search->GetEventHandler()->ProcessEvent(event); - } - - void OnIdle(wxIdleEvent& WXUNUSED(event)) - { - if ( IsEmpty() && !(wxWindow::FindFocus() == this) ) - { - ChangeValue(m_descriptiveText); - SetInsertionPoint(0); - SetForegroundColour(wxStepColour(m_defaultFG, LIGHT_STEP)); - } - } - - void OnFocus(wxFocusEvent& event) - { - event.Skip(); - if ( GetValue() == m_descriptiveText ) - { - ChangeValue(wxEmptyString); - SetForegroundColour(m_defaultFG); - } - } - -private: - wxSearchCtrl* m_search; - wxString m_descriptiveText; - wxColour m_defaultFG; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) - EVT_TEXT(wxID_ANY, wxSearchTextCtrl::OnText) - EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText) - EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl) - EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText) - EVT_IDLE(wxSearchTextCtrl::OnIdle) - EVT_SET_FOCUS(wxSearchTextCtrl::OnFocus) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// wxSearchButton: search button used by search control -// ---------------------------------------------------------------------------- - -class wxSearchButton : public wxControl -{ -public: - wxSearchButton(wxSearchCtrl *search, int eventType, const wxBitmap& bmp) - : wxControl(search, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER), - m_search(search), - m_eventType(eventType), - m_bmp(bmp) - { } - - void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; } - - -protected: - wxSize DoGetBestSize() const - { - return wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()); - } - - void OnLeftUp(wxMouseEvent&) - { - wxCommandEvent event(m_eventType, m_search->GetId()); - event.SetEventObject(m_search); - - GetEventHandler()->ProcessEvent(event); - - m_search->SetFocus(); - -#if wxUSE_MENUS - if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN ) - { - // this happens automatically, just like on Mac OS X - m_search->PopupSearchMenu(); - } -#endif // wxUSE_MENUS - } - - void OnPaint(wxPaintEvent&) - { - wxPaintDC dc(this); - dc.DrawBitmap(m_bmp, 0,0, true); - } - - -private: - wxSearchCtrl *m_search; - wxEventType m_eventType; - wxBitmap m_bmp; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSearchButton, wxControl) - EVT_LEFT_UP(wxSearchButton::OnLeftUp) - EVT_PAINT(wxSearchButton::OnPaint) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) - EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton) - EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus) - EVT_SIZE(wxSearchCtrl::OnSize) -END_EVENT_TABLE() - -IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxSearchCtrl creation -// ---------------------------------------------------------------------------- - -// creation -// -------- - -wxSearchCtrl::wxSearchCtrl() -{ - Init(); -} - -wxSearchCtrl::wxSearchCtrl(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - Init(); - - Create(parent, id, value, pos, size, style, validator, name); -} - -void wxSearchCtrl::Init() -{ - m_text = NULL; - m_searchButton = NULL; - m_cancelButton = NULL; -#if wxUSE_MENUS - m_menu = NULL; -#endif // wxUSE_MENUS - - m_searchButtonVisible = true; - m_cancelButtonVisible = false; - - m_searchBitmapUser = false; - m_cancelBitmapUser = false; -#if wxUSE_MENUS - m_searchMenuBitmapUser = false; -#endif // wxUSE_MENUS -} - -bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - int borderStyle = wxBORDER_SIMPLE; - -#if defined(__WXMSW__) - borderStyle = GetThemedBorderStyle(); - if (borderStyle == wxBORDER_SUNKEN) - borderStyle = wxBORDER_SIMPLE; -#elif defined(__WXGTK__) - borderStyle = wxBORDER_SUNKEN; -#endif - - if ( !wxTextCtrlBase::Create(parent, id, pos, size, borderStyle | (style & ~wxBORDER_MASK), validator, name) ) - { - return false; - } - - m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK); - m_text->SetDescriptiveText(_("Search")); - - wxSize sizeText = m_text->GetBestSize(); - - m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap); - m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap); - - SetForegroundColour( m_text->GetForegroundColour() ); - m_searchButton->SetForegroundColour( m_text->GetForegroundColour() ); - m_cancelButton->SetForegroundColour( m_text->GetForegroundColour() ); - - SetBackgroundColour( m_text->GetBackgroundColour() ); - m_searchButton->SetBackgroundColour( m_text->GetBackgroundColour() ); - m_cancelButton->SetBackgroundColour( m_text->GetBackgroundColour() ); - - RecalcBitmaps(); - - SetInitialSize(size); - Move(pos); - return true; -} - -wxSearchCtrl::~wxSearchCtrl() -{ - delete m_text; - delete m_searchButton; - delete m_cancelButton; -#if wxUSE_MENUS - delete m_menu; -#endif // wxUSE_MENUS -} - - -// search control specific interfaces -#if wxUSE_MENUS - -void wxSearchCtrl::SetMenu( wxMenu* menu ) -{ - if ( menu == m_menu ) - { - // no change - return; - } - bool hadMenu = (m_menu != NULL); - delete m_menu; - m_menu = menu; - - if ( m_menu && !hadMenu ) - { - m_searchButton->SetBitmapLabel(m_searchMenuBitmap); - m_searchButton->Refresh(); - } - else if ( !m_menu && hadMenu ) - { - m_searchButton->SetBitmapLabel(m_searchBitmap); - if ( m_searchButtonVisible ) - { - m_searchButton->Refresh(); - } - } - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -} - -wxMenu* wxSearchCtrl::GetMenu() -{ - return m_menu; -} - -#endif // wxUSE_MENUS - -void wxSearchCtrl::ShowSearchButton( bool show ) -{ - if ( m_searchButtonVisible == show ) - { - // no change - return; - } - m_searchButtonVisible = show; - if ( m_searchButtonVisible ) - { - RecalcBitmaps(); - } - - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -} - -bool wxSearchCtrl::IsSearchButtonVisible() const -{ - return m_searchButtonVisible; -} - - -void wxSearchCtrl::ShowCancelButton( bool show ) -{ - if ( m_cancelButtonVisible == show ) - { - // no change - return; - } - m_cancelButtonVisible = show; - - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -} - -bool wxSearchCtrl::IsCancelButtonVisible() const -{ - return m_cancelButtonVisible; -} - -void wxSearchCtrl::SetDescriptiveText(const wxString& text) -{ - m_text->SetDescriptiveText(text); -} - -wxString wxSearchCtrl::GetDescriptiveText() const -{ - return m_text->GetDescriptiveText(); -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxSearchCtrl::DoGetBestSize() const -{ - wxSize sizeText = m_text->GetBestSize(); - wxSize sizeSearch(0,0); - wxSize sizeCancel(0,0); - int searchMargin = 0; - int cancelMargin = 0; - if ( m_searchButtonVisible || HasMenu() ) - { - sizeSearch = m_searchButton->GetBestSize(); - searchMargin = MARGIN; - } - if ( m_cancelButtonVisible ) - { - sizeCancel = m_cancelButton->GetBestSize(); - cancelMargin = MARGIN; - } - - int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2; - - // buttons are square and equal to the height of the text control - int height = sizeText.y; - return wxSize(sizeSearch.x + searchMargin + sizeText.x + cancelMargin + sizeCancel.x + 2*horizontalBorder, - height + 2*BORDER); -} - -void wxSearchCtrl::DoMoveWindow(int x, int y, int width, int height) -{ - wxSearchCtrlBase::DoMoveWindow(x, y, width, height); - - LayoutControls(0, 0, width, height); -} - -void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) -{ - if ( !m_text ) - return; - - wxSize sizeText = m_text->GetBestSize(); - // make room for the search menu & clear button - int horizontalBorder = ( sizeText.y - sizeText.y * 14 / 21 ) / 2; - x += horizontalBorder; - y += BORDER; - width -= horizontalBorder*2; - height -= BORDER*2; - - wxSize sizeSearch(0,0); - wxSize sizeCancel(0,0); - int searchMargin = 0; - int cancelMargin = 0; - if ( m_searchButtonVisible || HasMenu() ) - { - sizeSearch = m_searchButton->GetBestSize(); - searchMargin = MARGIN; - } - if ( m_cancelButtonVisible ) - { - sizeCancel = m_cancelButton->GetBestSize(); - cancelMargin = MARGIN; - } - m_searchButton->Show( m_searchButtonVisible || HasMenu() ); - m_cancelButton->Show( m_cancelButtonVisible ); - - if ( sizeSearch.x + sizeCancel.x > width ) - { - sizeSearch.x = width/2; - sizeCancel.x = width/2; - searchMargin = 0; - cancelMargin = 0; - } - wxCoord textWidth = width - sizeSearch.x - sizeCancel.x - searchMargin - cancelMargin - 1; - - // position the subcontrols inside the client area - - m_searchButton->SetSize(x, y + ICON_OFFSET - 1, sizeSearch.x, height); - m_text->SetSize( x + sizeSearch.x + searchMargin, - y + ICON_OFFSET - BORDER, - textWidth, - height); - m_cancelButton->SetSize(x + sizeSearch.x + searchMargin + textWidth + cancelMargin, - y + ICON_OFFSET - 1, sizeCancel.x, height); -} - - -// accessors -// --------- - -wxString wxSearchCtrl::GetValue() const -{ - wxString value = m_text->GetValue(); - if (value == m_text->GetDescriptiveText()) - return wxEmptyString; - else - return value; -} -void wxSearchCtrl::SetValue(const wxString& value) -{ - m_text->SetValue(value); -} - -wxString wxSearchCtrl::GetRange(long from, long to) const -{ - return m_text->GetRange(from, to); -} - -int wxSearchCtrl::GetLineLength(long lineNo) const -{ - return m_text->GetLineLength(lineNo); -} -wxString wxSearchCtrl::GetLineText(long lineNo) const -{ - return m_text->GetLineText(lineNo); -} -int wxSearchCtrl::GetNumberOfLines() const -{ - return m_text->GetNumberOfLines(); -} - -bool wxSearchCtrl::IsModified() const -{ - return m_text->IsModified(); -} -bool wxSearchCtrl::IsEditable() const -{ - return m_text->IsEditable(); -} - -// more readable flag testing methods -bool wxSearchCtrl::IsSingleLine() const -{ - return m_text->IsSingleLine(); -} -bool wxSearchCtrl::IsMultiLine() const -{ - return m_text->IsMultiLine(); -} - -// If the return values from and to are the same, there is no selection. -void wxSearchCtrl::GetSelection(long* from, long* to) const -{ - m_text->GetSelection(from, to); -} - -wxString wxSearchCtrl::GetStringSelection() const -{ - return m_text->GetStringSelection(); -} - -// operations -// ---------- - -// editing -void wxSearchCtrl::Clear() -{ - m_text->Clear(); -} -void wxSearchCtrl::Replace(long from, long to, const wxString& value) -{ - m_text->Replace(from, to, value); -} -void wxSearchCtrl::Remove(long from, long to) -{ - m_text->Remove(from, to); -} - -// load/save the controls contents from/to the file -bool wxSearchCtrl::LoadFile(const wxString& file) -{ - return m_text->LoadFile(file); -} -bool wxSearchCtrl::SaveFile(const wxString& file) -{ - return m_text->SaveFile(file); -} - -// sets/clears the dirty flag -void wxSearchCtrl::MarkDirty() -{ - m_text->MarkDirty(); -} -void wxSearchCtrl::DiscardEdits() -{ - m_text->DiscardEdits(); -} - -// set the max number of characters which may be entered in a single line -// text control -void wxSearchCtrl::SetMaxLength(unsigned long len) -{ - m_text->SetMaxLength(len); -} - -// writing text inserts it at the current position, appending always -// inserts it at the end -void wxSearchCtrl::WriteText(const wxString& text) -{ - m_text->WriteText(text); -} -void wxSearchCtrl::AppendText(const wxString& text) -{ - m_text->AppendText(text); -} - -// insert the character which would have resulted from this key event, -// return true if anything has been inserted -bool wxSearchCtrl::EmulateKeyPress(const wxKeyEvent& event) -{ - return m_text->EmulateKeyPress(event); -} - -// text control under some platforms supports the text styles: these -// methods allow to apply the given text style to the given selection or to -// set/get the style which will be used for all appended text -bool wxSearchCtrl::SetStyle(long start, long end, const wxTextAttr& style) -{ - return m_text->SetStyle(start, end, style); -} -bool wxSearchCtrl::GetStyle(long position, wxTextAttr& style) -{ - return m_text->GetStyle(position, style); -} -bool wxSearchCtrl::SetDefaultStyle(const wxTextAttr& style) -{ - return m_text->SetDefaultStyle(style); -} -const wxTextAttr& wxSearchCtrl::GetDefaultStyle() const -{ - return m_text->GetDefaultStyle(); -} - -// translate between the position (which is just an index in the text ctrl -// considering all its contents as a single strings) and (x, y) coordinates -// which represent column and line. -long wxSearchCtrl::XYToPosition(long x, long y) const -{ - return m_text->XYToPosition(x, y); -} -bool wxSearchCtrl::PositionToXY(long pos, long *x, long *y) const -{ - return m_text->PositionToXY(pos, x, y); -} - -void wxSearchCtrl::ShowPosition(long pos) -{ - m_text->ShowPosition(pos); -} - -// find the character at position given in pixels -// -// NB: pt is in device coords (not adjusted for the client area origin nor -// scrolling) -wxTextCtrlHitTestResult wxSearchCtrl::HitTest(const wxPoint& pt, long *pos) const -{ - return m_text->HitTest(pt, pos); -} -wxTextCtrlHitTestResult wxSearchCtrl::HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const -{ - return m_text->HitTest(pt, col, row); -} - -// Clipboard operations -void wxSearchCtrl::Copy() -{ - m_text->Copy(); -} -void wxSearchCtrl::Cut() -{ - m_text->Cut(); -} -void wxSearchCtrl::Paste() -{ - m_text->Paste(); -} - -bool wxSearchCtrl::CanCopy() const -{ - return m_text->CanCopy(); -} -bool wxSearchCtrl::CanCut() const -{ - return m_text->CanCut(); -} -bool wxSearchCtrl::CanPaste() const -{ - return m_text->CanPaste(); -} - -// Undo/redo -void wxSearchCtrl::Undo() -{ - m_text->Undo(); -} -void wxSearchCtrl::Redo() -{ - m_text->Redo(); -} - -bool wxSearchCtrl::CanUndo() const -{ - return m_text->CanUndo(); -} -bool wxSearchCtrl::CanRedo() const -{ - return m_text->CanRedo(); -} - -// Insertion point -void wxSearchCtrl::SetInsertionPoint(long pos) -{ - m_text->SetInsertionPoint(pos); -} -void wxSearchCtrl::SetInsertionPointEnd() -{ - m_text->SetInsertionPointEnd(); -} -long wxSearchCtrl::GetInsertionPoint() const -{ - return m_text->GetInsertionPoint(); -} -wxTextPos wxSearchCtrl::GetLastPosition() const -{ - return m_text->GetLastPosition(); -} - -void wxSearchCtrl::SetSelection(long from, long to) -{ - m_text->SetSelection(from, to); -} -void wxSearchCtrl::SelectAll() -{ - m_text->SelectAll(); -} - -void wxSearchCtrl::SetEditable(bool editable) -{ - m_text->SetEditable(editable); -} - -bool wxSearchCtrl::SetFont(const wxFont& font) -{ - bool result = wxSearchCtrlBase::SetFont(font); - if ( result && m_text ) - { - result = m_text->SetFont(font); - } - RecalcBitmaps(); - return result; -} - -// search control generic only -void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) -{ - m_searchBitmap = bitmap; - m_searchBitmapUser = bitmap.Ok(); - if ( m_searchBitmapUser ) - { - if ( m_searchButton && !HasMenu() ) - { - m_searchButton->SetBitmapLabel( m_searchBitmap ); - } - } - else - { - // the user bitmap was just cleared, generate one - RecalcBitmaps(); - } -} - -#if wxUSE_MENUS - -void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) -{ - m_searchMenuBitmap = bitmap; - m_searchMenuBitmapUser = bitmap.Ok(); - if ( m_searchMenuBitmapUser ) - { - if ( m_searchButton && m_menu ) - { - m_searchButton->SetBitmapLabel( m_searchMenuBitmap ); - } - } - else - { - // the user bitmap was just cleared, generate one - RecalcBitmaps(); - } -} - -#endif // wxUSE_MENUS - -void wxSearchCtrl::SetCancelBitmap( const wxBitmap& bitmap ) -{ - m_cancelBitmap = bitmap; - m_cancelBitmapUser = bitmap.Ok(); - if ( m_cancelBitmapUser ) - { - if ( m_cancelButton ) - { - m_cancelButton->SetBitmapLabel( m_cancelBitmap ); - } - } - else - { - // the user bitmap was just cleared, generate one - RecalcBitmaps(); - } -} - -#if 0 - -// override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM -int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - -// stream-like insertion operators: these are always available, whether we -// were, or not, compiled with streambuf support -wxTextCtrl& operator<<(const wxString& s); -wxTextCtrl& operator<<(int i); -wxTextCtrl& operator<<(long i); -wxTextCtrl& operator<<(float f); -wxTextCtrl& operator<<(double d); -wxTextCtrl& operator<<(const wxChar c); -#endif - -void wxSearchCtrl::DoSetValue(const wxString& value, int flags) -{ - m_text->ChangeValue( value ); - if ( flags & SetValue_SendEvent ) - SendTextUpdatedEvent(); -} - -// do the window-specific processing after processing the update event -void wxSearchCtrl::DoUpdateWindowUI(wxUpdateUIEvent& event) -{ - wxSearchCtrlBase::DoUpdateWindowUI(event); -} - -bool wxSearchCtrl::ShouldInheritColours() const -{ - return true; -} - -// icons are rendered at 3-8 times larger than necessary and downscaled for -// antialiasing -static int GetMultiplier() -{ -#ifdef __WXWINCE__ - // speed up bitmap generation by using a small bitmap - return 3; -#else - int depth = ::wxDisplayDepth(); - - if ( depth >= 24 ) - { - return 8; - } - return 6; -#endif -} - -wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) -{ - wxColour bg = GetBackgroundColour(); - wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP-20); - - //=============================================================================== - // begin drawing code - //=============================================================================== - // image stats - - // force width:height ratio - if ( 14*x > y*20 ) - { - // x is too big - x = y*20/14; - } - else - { - // y is too big - y = x*14/20; - } - - // glass 11x11, top left corner - // handle (9,9)-(13,13) - // drop (13,16)-(19,6)-(16,9) - - int multiplier = GetMultiplier(); - int penWidth = multiplier * 2; - - penWidth = penWidth * x / 20; - - wxBitmap bitmap( multiplier*x, multiplier*y ); - wxMemoryDC mem; - mem.SelectObject(bitmap); - - // clear background - mem.SetBrush( wxBrush(bg) ); - mem.SetPen( wxPen(bg) ); - mem.DrawRectangle(0,0,bitmap.GetWidth(),bitmap.GetHeight()); - - // draw drop glass - mem.SetBrush( wxBrush(fg) ); - mem.SetPen( wxPen(fg) ); - int glassBase = 5 * x / 20; - int glassFactor = 2*glassBase + 1; - int radius = multiplier*glassFactor/2; - mem.DrawCircle(radius,radius,radius); - mem.SetBrush( wxBrush(bg) ); - mem.SetPen( wxPen(bg) ); - mem.DrawCircle(radius,radius,radius-penWidth); - - // draw handle - int lineStart = radius + (radius-penWidth/2) * 707 / 1000; // 707 / 1000 = 0.707 = 1/sqrt(2); - - mem.SetPen( wxPen(fg) ); - mem.SetBrush( wxBrush(fg) ); - int handleCornerShift = penWidth * 707 / 1000 / 2; // 707 / 1000 = 0.707 = 1/sqrt(2); - handleCornerShift = WXMAX( handleCornerShift, 1 ); - int handleBase = 4 * x / 20; - int handleLength = 2*handleBase+1; - wxPoint handlePolygon[] = - { - wxPoint(-handleCornerShift,+handleCornerShift), - wxPoint(+handleCornerShift,-handleCornerShift), - wxPoint(multiplier*handleLength/2+handleCornerShift,multiplier*handleLength/2-handleCornerShift), - wxPoint(multiplier*handleLength/2-handleCornerShift,multiplier*handleLength/2+handleCornerShift), - }; - mem.DrawPolygon(WXSIZEOF(handlePolygon),handlePolygon,lineStart,lineStart); - - // draw drop triangle - int triangleX = 13 * x / 20; - int triangleY = 5 * x / 20; - int triangleBase = 3 * x / 20; - int triangleFactor = triangleBase*2+1; - if ( renderDrop ) - { - wxPoint dropPolygon[] = - { - wxPoint(multiplier*0,multiplier*0), // triangle left - wxPoint(multiplier*triangleFactor-1,multiplier*0), // triangle right - wxPoint(multiplier*triangleFactor/2,multiplier*triangleFactor/2), // triangle bottom - }; - mem.DrawPolygon(WXSIZEOF(dropPolygon),dropPolygon,multiplier*triangleX,multiplier*triangleY); - } - mem.SelectObject(wxNullBitmap); - - //=============================================================================== - // end drawing code - //=============================================================================== - - if ( multiplier != 1 ) - { - wxImage image = bitmap.ConvertToImage(); - image.Rescale(x,y); - bitmap = wxBitmap( image ); - } - if ( !renderDrop ) - { - // Trim the edge where the arrow would have gone - bitmap = bitmap.GetSubBitmap(wxRect(0,0, y,y)); - } - - return bitmap; -} - -wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y ) -{ - wxColour bg = GetBackgroundColour(); - wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP); - - //=============================================================================== - // begin drawing code - //=============================================================================== - // image stats - - // total size 14x14 - // force 1:1 ratio - if ( x > y ) - { - // x is too big - x = y; - } - else - { - // y is too big - y = x; - } - - // 14x14 circle - // cross line starts (4,4)-(10,10) - // drop (13,16)-(19,6)-(16,9) - - int multiplier = GetMultiplier(); - - int penWidth = multiplier * x / 14; - - wxBitmap bitmap( multiplier*x, multiplier*y ); - wxMemoryDC mem; - mem.SelectObject(bitmap); - - // clear background - mem.SetBrush( wxBrush(bg) ); - mem.SetPen( wxPen(bg) ); - mem.DrawRectangle(0,0,bitmap.GetWidth(),bitmap.GetHeight()); - - // draw drop glass - mem.SetBrush( wxBrush(fg) ); - mem.SetPen( wxPen(fg) ); - int radius = multiplier*x/2; - mem.DrawCircle(radius,radius,radius); - - // draw cross - int lineStartBase = 4 * x / 14; - int lineLength = x - 2*lineStartBase; - - mem.SetPen( wxPen(bg) ); - mem.SetBrush( wxBrush(bg) ); - int handleCornerShift = penWidth/2; - handleCornerShift = WXMAX( handleCornerShift, 1 ); - wxPoint handlePolygon[] = - { - wxPoint(-handleCornerShift,+handleCornerShift), - wxPoint(+handleCornerShift,-handleCornerShift), - wxPoint(multiplier*lineLength+handleCornerShift,multiplier*lineLength-handleCornerShift), - wxPoint(multiplier*lineLength-handleCornerShift,multiplier*lineLength+handleCornerShift), - }; - mem.DrawPolygon(WXSIZEOF(handlePolygon),handlePolygon,multiplier*lineStartBase,multiplier*lineStartBase); - wxPoint handlePolygon2[] = - { - wxPoint(+handleCornerShift,+handleCornerShift), - wxPoint(-handleCornerShift,-handleCornerShift), - wxPoint(multiplier*lineLength-handleCornerShift,-multiplier*lineLength-handleCornerShift), - wxPoint(multiplier*lineLength+handleCornerShift,-multiplier*lineLength+handleCornerShift), - }; - mem.DrawPolygon(WXSIZEOF(handlePolygon2),handlePolygon2,multiplier*lineStartBase,multiplier*(x-lineStartBase)); - - //=============================================================================== - // end drawing code - //=============================================================================== - - if ( multiplier != 1 ) - { - wxImage image = bitmap.ConvertToImage(); - image.Rescale(x,y); - bitmap = wxBitmap( image ); - } - - return bitmap; -} - -void wxSearchCtrl::RecalcBitmaps() -{ - if ( !m_text ) - { - return; - } - wxSize sizeText = m_text->GetBestSize(); - - int bitmapHeight = sizeText.y - 2 * ICON_MARGIN; - int bitmapWidth = sizeText.y * 20 / 14; - - if ( !m_searchBitmapUser ) - { - if ( - !m_searchBitmap.Ok() || - m_searchBitmap.GetHeight() != bitmapHeight || - m_searchBitmap.GetWidth() != bitmapWidth - ) - { - m_searchBitmap = RenderSearchBitmap(bitmapWidth,bitmapHeight,false); - if ( !HasMenu() ) - { - m_searchButton->SetBitmapLabel(m_searchBitmap); - } - } - // else this bitmap was set by user, don't alter - } - -#if wxUSE_MENUS - if ( !m_searchMenuBitmapUser ) - { - if ( - !m_searchMenuBitmap.Ok() || - m_searchMenuBitmap.GetHeight() != bitmapHeight || - m_searchMenuBitmap.GetWidth() != bitmapWidth - ) - { - m_searchMenuBitmap = RenderSearchBitmap(bitmapWidth,bitmapHeight,true); - if ( m_menu ) - { - m_searchButton->SetBitmapLabel(m_searchMenuBitmap); - } - } - // else this bitmap was set by user, don't alter - } -#endif // wxUSE_MENUS - - if ( !m_cancelBitmapUser ) - { - if ( - !m_cancelBitmap.Ok() || - m_cancelBitmap.GetHeight() != bitmapHeight || - m_cancelBitmap.GetWidth() != bitmapHeight - ) - { - m_cancelBitmap = RenderCancelBitmap(bitmapHeight-BORDER-1,bitmapHeight-BORDER-1); // square - m_cancelButton->SetBitmapLabel(m_cancelBitmap); - } - // else this bitmap was set by user, don't alter - } -} - -void wxSearchCtrl::OnSearchButton( wxCommandEvent& event ) -{ - event.Skip(); -} - -void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ ) -{ - if ( m_text ) - { - m_text->SetFocus(); - } -} - -void wxSearchCtrl::OnSize( wxSizeEvent& WXUNUSED(event) ) -{ - int width, height; - GetSize(&width, &height); - LayoutControls(0, 0, width, height); -} - -#if wxUSE_MENUS - -void wxSearchCtrl::PopupSearchMenu() -{ - if ( m_menu ) - { - wxSize size = GetSize(); - PopupMenu( m_menu, 0, size.y ); - } -} - -#endif // wxUSE_MENUS - -#endif // !wxUSE_NATIVE_SEARCH_CONTROL - -#endif // wxUSE_SEARCHCTRL diff --git a/Source/3rdParty/wx/src/generic/statusbr.cpp b/Source/3rdParty/wx/src/generic/statusbr.cpp deleted file mode 100644 index c392cefcd..000000000 --- a/Source/3rdParty/wx/src/generic/statusbr.cpp +++ /dev/null @@ -1,488 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/statusbr.cpp -// Purpose: wxStatusBarGeneric class implementation -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: statusbr.cpp 57542 2008-12-25 13:03:24Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STATUSBAR - -#include "wx/statusbr.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/dcclient.h" -#endif - -#ifdef __WXGTK20__ - #include - #include "wx/gtk/win_gtk.h" -#endif - -// we only have to do it here when we use wxStatusBarGeneric in addition to the -// standard wxStatusBar class, if wxStatusBarGeneric is the same as -// wxStatusBar, then the corresponding IMPLEMENT_DYNAMIC_CLASS is already in -// common/statbar.cpp -#if defined(__WXMAC__) || \ - (defined(wxUSE_NATIVE_STATUSBAR) && wxUSE_NATIVE_STATUSBAR) - #include "wx/generic/statusbr.h" - - IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow) -#endif // wxUSE_NATIVE_STATUSBAR - -BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) - EVT_PAINT(wxStatusBarGeneric::OnPaint) - EVT_LEFT_DOWN(wxStatusBarGeneric::OnLeftDown) - EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown) - EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged) -END_EVENT_TABLE() - -// Default status border dimensions -#define wxTHICK_LINE_BORDER 2 - -void wxStatusBarGeneric::Init() -{ - m_borderX = wxTHICK_LINE_BORDER; - m_borderY = wxTHICK_LINE_BORDER; -} - -wxStatusBarGeneric::~wxStatusBarGeneric() -{ -} - -bool wxStatusBarGeneric::Create(wxWindow *parent, - wxWindowID id, - long style, - const wxString& name) -{ - style |= wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE; - if ( !wxWindow::Create(parent, id, - wxDefaultPosition, wxDefaultSize, - style, name) ) - return false; - - // The status bar should have a themed background - SetThemeEnabled( true ); - - InitColours(); - -#ifdef __WXPM__ - SetFont(*wxSMALL_FONT); -#endif - - wxCoord y; - { - // Set the height according to the font and the border size - wxClientDC dc(this); - dc.SetFont(GetFont()); - - dc.GetTextExtent(_T("X"), NULL, &y ); - } - int height = (int)( (11*y)/10 + 2*GetBorderY()); - - SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); - - SetFieldsCount(1); - - return true; -} - - -wxSize wxStatusBarGeneric::DoGetBestSize() const -{ - int width, height; - - // best width is the width of the parent - GetParent()->GetClientSize(&width, NULL); - - // best height is as calculated above in Create - wxClientDC dc((wxWindow*)this); - dc.SetFont(GetFont()); - wxCoord y; - dc.GetTextExtent(_T("X"), NULL, &y ); - height = (int)( (11*y)/10 + 2*GetBorderY()); - - return wxSize(width, height); -} - -void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths) -{ - wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") ); - - int i; - for(i = m_nFields; i < number; ++i) - m_statusStrings.Add( wxEmptyString ); - - for (i = m_nFields - 1; i >= number; --i) - m_statusStrings.RemoveAt(i); - - // forget the old cached pixel widths - m_widthsAbs.Empty(); - - wxStatusBarBase::SetFieldsCount(number, widths); - - wxASSERT_MSG( m_nFields == (int)m_statusStrings.GetCount(), - _T("This really should never happen, can we do away with m_nFields here?") ); -} - -void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) -{ - wxCHECK_RET( (number >= 0) && (number < m_nFields), - _T("invalid status bar field index") ); - - wxString oldText = m_statusStrings[number]; - if (oldText != text) - { - m_statusStrings[number] = text; - - wxRect rect; - GetFieldRect(number, rect); - - Refresh(true, &rect); - - // it's common to show some text in the status bar before starting a - // relatively lengthy operation, ensure that the text is shown to the - // user immediately and not after the lengthy operation end - Update(); - } -} - -wxString wxStatusBarGeneric::GetStatusText(int n) const -{ - wxCHECK_MSG( (n >= 0) && (n < m_nFields), wxEmptyString, - _T("invalid status bar field index") ); - - return m_statusStrings[n]; -} - -void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[]) -{ - // only set status widths, when n == number of statuswindows - wxCHECK_RET( n == m_nFields, _T("status bar field count mismatch") ); - - // delete the old widths in any case - this function may be used to reset - // the widths to the default (all equal) - // MBN: this is incompatible with at least wxMSW and wxMAC and not - // documented, but let's keep it for now - ReinitWidths(); - - // forget the old cached pixel widths - m_widthsAbs.Empty(); - - if ( !widths_field ) - { - // not an error, see the comment above - Refresh(); - return; - } - - wxStatusBarBase::SetStatusWidths(n, widths_field); -} - -void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) -{ - wxPaintDC dc(this); - - dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); -#ifdef __WXGTK20__ - // Draw grip first - if (HasFlag( wxST_SIZEGRIP )) - { - int width, height; - GetClientSize(&width, &height); - - if (GetLayoutDirection() == wxLayout_RightToLeft) - { - gtk_paint_resize_grip( m_widget->style, - GTK_PIZZA(m_wxwindow)->bin_window, - (GtkStateType) GTK_WIDGET_STATE (m_widget), - NULL, - m_widget, - "statusbar", - GDK_WINDOW_EDGE_SOUTH_WEST, - 2, 2, height-2, height-4 ); - } - else - { - gtk_paint_resize_grip( m_widget->style, - GTK_PIZZA(m_wxwindow)->bin_window, - (GtkStateType) GTK_WIDGET_STATE (m_widget), - NULL, - m_widget, - "statusbar", - GDK_WINDOW_EDGE_SOUTH_EAST, - width-height-2, 2, height-2, height-4 ); - } - } -#endif - - if (GetFont().Ok()) - dc.SetFont(GetFont()); - - dc.SetBackgroundMode(wxTRANSPARENT); - -#ifdef __WXPM__ - wxColour vColor; - - vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR); - ::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel()); -#endif - - for (int i = 0; i < m_nFields; i ++) - DrawField(dc, i); -} - -void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i) -{ - int leftMargin = 2; - - wxRect rect; - GetFieldRect(i, rect); - - wxString text(GetStatusText(i)); - - long x = 0, y = 0; - - dc.GetTextExtent(text, &x, &y); - - int xpos = rect.x + leftMargin; - int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ; - -#if defined( __WXGTK__ ) || defined(__WXMAC__) - xpos++; - ypos++; -#endif - - dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height); - - dc.DrawText(text, xpos, ypos); - - dc.DestroyClippingRegion(); -} - -void wxStatusBarGeneric::DrawField(wxDC& dc, int i) -{ - wxRect rect; - GetFieldRect(i, rect); - - int style = wxSB_NORMAL; - if (m_statusStyles) - style = m_statusStyles[i]; - - if (style != wxSB_FLAT) - { - // Draw border - // For wxSB_NORMAL: - // Have grey background, plus 3-d border - - // One black rectangle. - // Inside this, left and top sides - dark grey. Bottom and right - - // white. - // Reverse it for wxSB_RAISED - - dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen); - - #ifndef __WXPM__ - - // Right and bottom lines - dc.DrawLine(rect.x + rect.width, rect.y, - rect.x + rect.width, rect.y + rect.height); - dc.DrawLine(rect.x + rect.width, rect.y + rect.height, - rect.x, rect.y + rect.height); - - dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen); - - // Left and top lines - dc.DrawLine(rect.x, rect.y + rect.height, - rect.x, rect.y); - dc.DrawLine(rect.x, rect.y, - rect.x + rect.width, rect.y); - #else - - dc.DrawLine(rect.x + rect.width, rect.height + 2, - rect.x, rect.height + 2); - dc.DrawLine(rect.x + rect.width, rect.y, - rect.x + rect.width, rect.y + rect.height); - - dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen); - dc.DrawLine(rect.x, rect.y, - rect.x + rect.width, rect.y); - dc.DrawLine(rect.x, rect.y + rect.height, - rect.x, rect.y); - -#endif - } - - DrawFieldText(dc, i); -} - - // Get the position and size of the field's internal bounding rectangle -bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const -{ - wxCHECK_MSG( (n >= 0) && (n < m_nFields), false, - _T("invalid status bar field index") ); - - // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ) - int width, height; -#ifdef __WXPM__ - GetSize(&width, &height); -#else - GetClientSize(&width, &height); -#endif - - // we cache m_widthsAbs between calls and recompute it if client - // width has changed (or when it is initially empty) - if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) ) - { - wxConstCast(this, wxStatusBarGeneric)-> - m_widthsAbs = CalculateAbsWidths(width); - // remember last width for which we have recomputed the widths in pixels - wxConstCast(this, wxStatusBarGeneric)-> - m_lastClientWidth = width; - } - - rect.x = 0; - for ( int i = 0; i < n; i++ ) - { - rect.x += m_widthsAbs[i]; - } - - rect.x += m_borderX; - rect.y = m_borderY; - - rect.width = m_widthsAbs[n] - 2*m_borderX; - rect.height = height - 2*m_borderY; - - return true; -} - -// Initialize colours -void wxStatusBarGeneric::InitColours() -{ -#if defined(__WXPM__) - m_mediumShadowPen = wxPen(wxColour(127, 127, 127), 1, wxSOLID); - m_hilightPen = *wxWHITE_PEN; - - SetBackgroundColour(*wxLIGHT_GREY); - SetForegroundColour(*wxBLACK); -#else // !__WXPM__ - m_mediumShadowPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); - m_hilightPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT)); -#endif // __WXPM__/!__WXPM__ -} - -// Responds to colour changes, and passes event on to children. -void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - InitColours(); - - // Propagate the event to the non-top-level children - wxWindow::OnSysColourChanged(event); -} - -void wxStatusBarGeneric::SetMinHeight(int height) -{ - // check that this min height is not less than minimal height for the - // current font - wxClientDC dc(this); - wxCoord y; - dc.GetTextExtent( wxT("X"), NULL, &y ); - - if ( height > (11*y)/10 ) - { - SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height + 2*m_borderY); - } -} - -void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) -{ -#ifdef __WXGTK20__ - int width, height; - GetClientSize(&width, &height); - - if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height)) - { - GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); - - if (!GTK_IS_WINDOW (ancestor)) - return; - - GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window; - - int org_x = 0; - int org_y = 0; - gdk_window_get_origin( source, &org_x, &org_y ); - - if (GetLayoutDirection() == wxLayout_RightToLeft) - { - gtk_window_begin_resize_drag (GTK_WINDOW (ancestor), - GDK_WINDOW_EDGE_SOUTH_WEST, - 1, - org_x - event.GetX() + GetSize().x , - org_y + event.GetY(), - 0); - } - else - { - gtk_window_begin_resize_drag (GTK_WINDOW (ancestor), - GDK_WINDOW_EDGE_SOUTH_EAST, - 1, - org_x + event.GetX(), - org_y + event.GetY(), - 0); - } - } - else - { - event.Skip( true ); - } -#else - event.Skip( true ); -#endif -} - -void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) -{ -#ifdef __WXGTK20__ - int width, height; - GetClientSize(&width, &height); - - if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height)) - { - GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); - - if (!GTK_IS_WINDOW (ancestor)) - return; - - GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window; - - int org_x = 0; - int org_y = 0; - gdk_window_get_origin( source, &org_x, &org_y ); - - gtk_window_begin_move_drag (GTK_WINDOW (ancestor), - 2, - org_x + event.GetX(), - org_y + event.GetY(), - 0); - } - else - { - event.Skip( true ); - } -#else - event.Skip( true ); -#endif -} - -#endif // wxUSE_STATUSBAR diff --git a/Source/3rdParty/wx/src/generic/textdlgg.cpp b/Source/3rdParty/wx/src/generic/textdlgg.cpp deleted file mode 100644 index f1c8aa64b..000000000 --- a/Source/3rdParty/wx/src/generic/textdlgg.cpp +++ /dev/null @@ -1,185 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/textdlgg.cpp -// Purpose: wxTextEntryDialog -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: textdlgg.cpp 41838 2006-10-09 21:08:45Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TEXTDLG - -#include "wx/generic/textdlgg.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/button.h" - #include "wx/stattext.h" - #include "wx/textctrl.h" - #include "wx/intl.h" - #include "wx/sizer.h" -#endif - -#if wxUSE_STATLINE - #include "wx/statline.h" -#endif - -const wxChar wxGetTextFromUserPromptStr[] = wxT("Input Text"); -const wxChar wxGetPasswordFromUserPromptStr[] = wxT("Enter Password"); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -static const int wxID_TEXT = 3000; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxTextEntryDialog -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) -END_EVENT_TABLE() - -IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) - -wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxString& value, - long style, - const wxPoint& pos) - : wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE), - m_value(value) -{ - m_dialogStyle = style; - m_value = value; - - wxBeginBusyCursor(); - - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - - wxSizerFlags flagsBorder2; - flagsBorder2.DoubleBorder(); - -#if wxUSE_STATTEXT - // 1) text message - topsizer->Add(CreateTextSizer(message), flagsBorder2); -#endif - - // 2) text ctrl - m_textctrl = new wxTextCtrl(this, wxID_TEXT, value, - wxDefaultPosition, wxSize(300, wxDefaultCoord), - style & ~wxTextEntryDialogStyle); - - topsizer->Add(m_textctrl, - wxSizerFlags(style & wxTE_MULTILINE ? 1 : 0). - Expand(). - TripleBorder(wxLEFT | wxRIGHT)); - -#if wxUSE_VALIDATORS - wxTextValidator validator( wxFILTER_NONE, &m_value ); - m_textctrl->SetValidator( validator ); -#endif // wxUSE_VALIDATORS - - // 3) buttons if any - wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags); - if ( buttonSizer ) - { - topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand()); - } - - SetAutoLayout( true ); - SetSizer( topsizer ); - - topsizer->SetSizeHints( this ); - topsizer->Fit( this ); - - if ( style & wxCENTRE ) - Centre( wxBOTH ); - - m_textctrl->SetSelection(-1, -1); - m_textctrl->SetFocus(); - - wxEndBusyCursor(); -} - -void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) ) -{ -#if wxUSE_VALIDATORS - if( Validate() && TransferDataFromWindow() ) - { - EndModal( wxID_OK ); - } -#else - m_value = m_textctrl->GetValue(); - - EndModal(wxID_OK); -#endif - // wxUSE_VALIDATORS -} - -void wxTextEntryDialog::SetValue(const wxString& val) -{ - m_value = val; - - m_textctrl->SetValue(val); -} - -#if wxUSE_VALIDATORS -void wxTextEntryDialog::SetTextValidator( long style ) -{ - wxTextValidator validator( style, &m_value ); - m_textctrl->SetValidator( validator ); -} - -void wxTextEntryDialog::SetTextValidator( const wxTextValidator& validator ) -{ - m_textctrl->SetValidator( validator ); -} - -#endif - // wxUSE_VALIDATORS - -// ---------------------------------------------------------------------------- -// wxPasswordEntryDialog -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxPasswordEntryDialog, wxTextEntryDialog) - -wxPasswordEntryDialog::wxPasswordEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxString& value, - long style, - const wxPoint& pos) - : wxTextEntryDialog(parent, message, caption, value, - style | wxTE_PASSWORD, pos) -{ - // Only change from wxTextEntryDialog is the password style -} - -#endif // wxUSE_TEXTDLG diff --git a/Source/3rdParty/wx/src/generic/timer.cpp b/Source/3rdParty/wx/src/generic/timer.cpp deleted file mode 100644 index 1fad2018b..000000000 --- a/Source/3rdParty/wx/src/generic/timer.cpp +++ /dev/null @@ -1,283 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/timer.cpp -// Purpose: wxTimer implementation -// Author: Vaclav Slavik -// Id: $Id: timer.cpp 40943 2006-08-31 19:31:43Z ABX $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// ---------------------------------------------------------------------------- -// NB: when using generic wxTimer implementation in your port, you *must* call -// wxTimer::NotifyTimers() often enough. The ideal place for this -// is in wxEventLoop::Dispatch(). -// ---------------------------------------------------------------------------- - -#if wxUSE_TIMER - -#include "wx/timer.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/module.h" -#endif - -// ---------------------------------------------------------------------------- -// Time input function -// ---------------------------------------------------------------------------- - -#ifdef __WXMGL__ - // We take advantage of wxMGL's _EVT_getTicks because it is faster - // (especially under MS-DOS!) and more precise than wxGetLocalTimeMillis - // if we are unlucky and the latter combines information from two sources. - #include "wx/mgl/private.h" - extern "C" ulong _EVT_getTicks(); - #define GetMillisecondsTime _EVT_getTicks - - typedef ulong wxTimerTick_t; - - #define wxTimerTickFmtSpec _T("lu") - #define wxTimerTickPrintfArg(tt) (tt) - - #ifdef __DOS__ - // Under DOS the MGL timer has a 24hr period, so consider the 12 hours - // before y to be 'less' and the the 12 hours after 'greater' modulo - // 24 hours. - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - // _EVT_getTicks wraps at 1573040 * 55 - const wxTimerTick_t modulus = 1573040 * 55; - return (2 * modulus + x - y) % modulus < modulus / 2; - } - #else - // If wxTimerTick_t is 32-bits then it'll wrap in around 50 days. So - // let the 25 days before y be 'less' and 25 days after be 'greater'. - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - // This code assumes wxTimerTick_t is an unsigned type. - // Set half_modulus with top bit set and the rest zeros. - const wxTimerTick_t half_modulus = ~((~(wxTimerTick_t)0) >> 1); - return x - y < half_modulus; - } - #endif -#else // !__WXMGL__ - #define GetMillisecondsTime wxGetLocalTimeMillis - - typedef wxLongLong wxTimerTick_t; - - #if wxUSE_LONGLONG_WX - #define wxTimerTickFmtSpec wxLongLongFmtSpec _T("d") - #define wxTimerTickPrintfArg(tt) (tt.GetValue()) - #else // using native wxLongLong - #define wxTimerTickFmtSpec _T("s") - #define wxTimerTickPrintfArg(tt) (tt.ToString().c_str()) - #endif // wx/native long long - - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - return x >= y; - } -#endif // __WXMGL__/!__WXMGL__ - -// ---------------------------------------------------------------------------- -// helper structures and wxTimerScheduler -// ---------------------------------------------------------------------------- - -class wxTimerDesc -{ -public: - wxTimerDesc(wxTimer *t) : - timer(t), running(false), next(NULL), prev(NULL), - shotTime(0), deleteFlag(NULL) {} - - wxTimer *timer; - bool running; - wxTimerDesc *next, *prev; - wxTimerTick_t shotTime; - volatile bool *deleteFlag; // see comment in ~wxTimer -}; - -class wxTimerScheduler -{ -public: - wxTimerScheduler() : m_timers(NULL) {} - - void QueueTimer(wxTimerDesc *desc, wxTimerTick_t when = 0); - void RemoveTimer(wxTimerDesc *desc); - void NotifyTimers(); - -private: - wxTimerDesc *m_timers; -}; - -void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, wxTimerTick_t when) -{ - if ( desc->running ) - return; // already scheduled - - if ( when == 0 ) - when = GetMillisecondsTime() + desc->timer->GetInterval(); - desc->shotTime = when; - desc->running = true; - - wxLogTrace( wxT("timer"), - wxT("queued timer %p at tick %") wxTimerTickFmtSpec, - desc->timer, wxTimerTickPrintfArg(when)); - - if ( m_timers ) - { - wxTimerDesc *d = m_timers; - while ( d->next && d->next->shotTime < when ) d = d->next; - desc->next = d->next; - desc->prev = d; - if ( d->next ) - d->next->prev = desc; - d->next = desc; - } - else - { - m_timers = desc; - desc->prev = desc->next = NULL; - } -} - -void wxTimerScheduler::RemoveTimer(wxTimerDesc *desc) -{ - desc->running = false; - if ( desc == m_timers ) - m_timers = desc->next; - if ( desc->prev ) - desc->prev->next = desc->next; - if ( desc->next ) - desc->next->prev = desc->prev; - desc->prev = desc->next = NULL; -} - -void wxTimerScheduler::NotifyTimers() -{ - if ( m_timers ) - { - bool oneShot; - volatile bool timerDeleted; - wxTimerTick_t now = GetMillisecondsTime(); - - for ( wxTimerDesc *desc = m_timers; desc; desc = desc->next ) - { - if ( desc->running && wxTickGreaterEqual(now, desc->shotTime) ) - { - oneShot = desc->timer->IsOneShot(); - RemoveTimer(desc); - - timerDeleted = false; - desc->deleteFlag = &timerDeleted; - desc->timer->Notify(); - - if ( !timerDeleted ) - { - wxLogTrace( wxT("timer"), - wxT("notified timer %p sheduled for %") - wxTimerTickFmtSpec, - desc->timer, - wxTimerTickPrintfArg(desc->shotTime) ); - - desc->deleteFlag = NULL; - if ( !oneShot ) - QueueTimer(desc, now + desc->timer->GetInterval()); - } - else - { - desc = m_timers; - if (!desc) - break; - } - } - } - } -} - - -// ---------------------------------------------------------------------------- -// wxTimer -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler) - -wxTimerScheduler *gs_scheduler = NULL; - -void wxTimer::Init() -{ - if ( !gs_scheduler ) - gs_scheduler = new wxTimerScheduler; - m_desc = new wxTimerDesc(this); -} - -wxTimer::~wxTimer() -{ - wxLogTrace( wxT("timer"), wxT("destroying timer %p..."), this); - if ( IsRunning() ) - Stop(); - - // NB: this is a hack: wxTimerScheduler must have some way of knowing - // that wxTimer object was deleted under its hands -- this may - // happen if somebody is really nasty and deletes the timer - // from wxTimer::Notify() - if ( m_desc->deleteFlag != NULL ) - *m_desc->deleteFlag = true; - - delete m_desc; - wxLogTrace( wxT("timer"), wxT(" ...done destroying timer %p..."), this); -} - -bool wxTimer::IsRunning() const -{ - return m_desc->running; -} - -bool wxTimer::Start(int millisecs, bool oneShot) -{ - wxLogTrace( wxT("timer"), wxT("started timer %p: %i ms, oneshot=%i"), - this, millisecs, oneShot); - - if ( !wxTimerBase::Start(millisecs, oneShot) ) - return false; - - gs_scheduler->QueueTimer(m_desc); - return true; -} - -void wxTimer::Stop() -{ - if ( !m_desc->running ) return; - - gs_scheduler->RemoveTimer(m_desc); -} - -/*static*/ void wxTimer::NotifyTimers() -{ - if ( gs_scheduler ) - gs_scheduler->NotifyTimers(); -} - - - -// A module to deallocate memory properly: -class wxTimerModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxTimerModule) -public: - wxTimerModule() {} - bool OnInit() { return true; } - void OnExit() { delete gs_scheduler; gs_scheduler = NULL; } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxTimerModule, wxModule) - - -#endif //wxUSE_TIMER diff --git a/Source/3rdParty/wx/src/generic/tipwin.cpp b/Source/3rdParty/wx/src/generic/tipwin.cpp deleted file mode 100644 index 0f2f2bb18..000000000 --- a/Source/3rdParty/wx/src/generic/tipwin.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/tipwin.cpp -// Purpose: implementation of wxTipWindow -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: tipwin.cpp 43033 2006-11-04 13:31:10Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TIPWINDOW - -#include "wx/tipwin.h" - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" - #include "wx/timer.h" - #include "wx/settings.h" -#endif // WX_PRECOMP - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -static const wxCoord TEXT_MARGIN_X = 3; -static const wxCoord TEXT_MARGIN_Y = 3; - -// ---------------------------------------------------------------------------- -// wxTipWindowView -// ---------------------------------------------------------------------------- - -// Viewer window to put in the frame -class WXDLLEXPORT wxTipWindowView : public wxWindow -{ -public: - wxTipWindowView(wxWindow *parent); - - // event handlers - void OnPaint(wxPaintEvent& event); - void OnMouseClick(wxMouseEvent& event); - void OnMouseMove(wxMouseEvent& event); - -#if !wxUSE_POPUPWIN - void OnKillFocus(wxFocusEvent& event); -#endif // wxUSE_POPUPWIN - - // calculate the client rect we need to display the text - void Adjust(const wxString& text, wxCoord maxLength); - -private: - wxTipWindow* m_parent; - -#if !wxUSE_POPUPWIN - long m_creationTime; -#endif // !wxUSE_POPUPWIN - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTipWindowView) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// event tables -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxTipWindow, wxTipWindowBase) - EVT_LEFT_DOWN(wxTipWindow::OnMouseClick) - EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick) - EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick) - -#if !wxUSE_POPUPWIN - EVT_KILL_FOCUS(wxTipWindow::OnKillFocus) - EVT_ACTIVATE(wxTipWindow::OnActivate) -#endif // !wxUSE_POPUPWIN -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxTipWindowView, wxWindow) - EVT_PAINT(wxTipWindowView::OnPaint) - - EVT_LEFT_DOWN(wxTipWindowView::OnMouseClick) - EVT_RIGHT_DOWN(wxTipWindowView::OnMouseClick) - EVT_MIDDLE_DOWN(wxTipWindowView::OnMouseClick) - - EVT_MOTION(wxTipWindowView::OnMouseMove) - -#if !wxUSE_POPUPWIN - EVT_KILL_FOCUS(wxTipWindowView::OnKillFocus) -#endif // !wxUSE_POPUPWIN -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// wxTipWindow -// ---------------------------------------------------------------------------- - -wxTipWindow::wxTipWindow(wxWindow *parent, - const wxString& text, - wxCoord maxLength, - wxTipWindow** windowPtr, - wxRect *rectBounds) -#if wxUSE_POPUPWIN - : wxPopupTransientWindow(parent) -#else - : wxFrame(parent, wxID_ANY, wxEmptyString, - wxDefaultPosition, wxDefaultSize, - wxNO_BORDER | wxFRAME_NO_TASKBAR ) -#endif -{ - SetTipWindowPtr(windowPtr); - if ( rectBounds ) - { - SetBoundingRect(*rectBounds); - } - - // set colours - SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK)); - - // set size, position and show it - m_view = new wxTipWindowView(this); - m_view->Adjust(text, maxLength); - m_view->SetFocus(); - - int x, y; - wxGetMousePosition(&x, &y); - - // we want to show the tip below the mouse, not over it - // - // NB: the reason we use "/ 2" here is that we don't know where the current - // cursors hot spot is... it would be nice if we could find this out - // though - y += wxSystemSettings::GetMetric(wxSYS_CURSOR_Y) / 2; - -#if wxUSE_POPUPWIN - Position(wxPoint(x, y), wxSize(0,0)); - Popup(m_view); - #ifdef __WXGTK__ - m_view->CaptureMouse(); - #endif -#else - Move(x, y); - Show(true); -#endif -} - -wxTipWindow::~wxTipWindow() -{ - if ( m_windowPtr ) - { - *m_windowPtr = NULL; - } - #ifdef wxUSE_POPUPWIN - #ifdef __WXGTK__ - if ( m_view->HasCapture() ) - m_view->ReleaseMouse(); - #endif - #endif -} - -void wxTipWindow::OnMouseClick(wxMouseEvent& WXUNUSED(event)) -{ - Close(); -} - -#if wxUSE_POPUPWIN - -void wxTipWindow::OnDismiss() -{ - Close(); -} - -#else // !wxUSE_POPUPWIN - -void wxTipWindow::OnActivate(wxActivateEvent& event) -{ - if (!event.GetActive()) - Close(); -} - -void wxTipWindow::OnKillFocus(wxFocusEvent& WXUNUSED(event)) -{ - // Under Windows at least, we will get this immediately - // because when the view window is focussed, the - // tip window goes out of focus. -#ifdef __WXGTK__ - Close(); -#endif -} - -#endif // wxUSE_POPUPWIN // !wxUSE_POPUPWIN - -void wxTipWindow::SetBoundingRect(const wxRect& rectBound) -{ - m_rectBound = rectBound; -} - -void wxTipWindow::Close() -{ - if ( m_windowPtr ) - { - *m_windowPtr = NULL; - m_windowPtr = NULL; - } - -#if wxUSE_POPUPWIN - Show(false); - #ifdef __WXGTK__ - if ( m_view->HasCapture() ) - m_view->ReleaseMouse(); - #endif - Destroy(); -#else - wxFrame::Close(); -#endif -} - -// ---------------------------------------------------------------------------- -// wxTipWindowView -// ---------------------------------------------------------------------------- - -wxTipWindowView::wxTipWindowView(wxWindow *parent) - : wxWindow(parent, wxID_ANY, - wxDefaultPosition, wxDefaultSize, - wxNO_BORDER) -{ - // set colours - SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK)); - -#if !wxUSE_POPUPWIN - m_creationTime = wxGetLocalTime(); -#endif // !wxUSE_POPUPWIN - - m_parent = (wxTipWindow*)parent; -} - -void wxTipWindowView::Adjust(const wxString& text, wxCoord maxLength) -{ - wxClientDC dc(this); - dc.SetFont(GetFont()); - - // calculate the length: we want each line be no longer than maxLength - // pixels and we only break lines at words boundary - wxString current; - wxCoord height, width, - widthMax = 0; - m_parent->m_heightLine = 0; - - bool breakLine = false; - for ( const wxChar *p = text.c_str(); ; p++ ) - { - if ( *p == _T('\n') || *p == _T('\0') ) - { - dc.GetTextExtent(current, &width, &height); - if ( width > widthMax ) - widthMax = width; - - if ( height > m_parent->m_heightLine ) - m_parent->m_heightLine = height; - - m_parent->m_textLines.Add(current); - - if ( !*p ) - { - // end of text - break; - } - - current.clear(); - breakLine = false; - } - else if ( breakLine && (*p == _T(' ') || *p == _T('\t')) ) - { - // word boundary - break the line here - m_parent->m_textLines.Add(current); - current.clear(); - breakLine = false; - } - else // line goes on - { - current += *p; - dc.GetTextExtent(current, &width, &height); - if ( width > maxLength ) - breakLine = true; - - if ( width > widthMax ) - widthMax = width; - - if ( height > m_parent->m_heightLine ) - m_parent->m_heightLine = height; - } - } - - // take into account the border size and the margins - width = 2*(TEXT_MARGIN_X + 1) + widthMax; - height = 2*(TEXT_MARGIN_Y + 1) + wx_truncate_cast(wxCoord, m_parent->m_textLines.GetCount())*m_parent->m_heightLine; - m_parent->SetClientSize(width, height); - SetSize(0, 0, width, height); -} - -void wxTipWindowView::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - - wxRect rect; - wxSize size = GetClientSize(); - rect.width = size.x; - rect.height = size.y; - - // first filll the background - dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); - dc.SetPen( wxPen(GetForegroundColour(), 1, wxSOLID) ); - dc.DrawRectangle(rect); - - // and then draw the text line by line - dc.SetTextBackground(GetBackgroundColour()); - dc.SetTextForeground(GetForegroundColour()); - dc.SetFont(GetFont()); - - wxPoint pt; - pt.x = TEXT_MARGIN_X; - pt.y = TEXT_MARGIN_Y; - size_t count = m_parent->m_textLines.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - dc.DrawText(m_parent->m_textLines[n], pt); - - pt.y += m_parent->m_heightLine; - } -} - -void wxTipWindowView::OnMouseClick(wxMouseEvent& WXUNUSED(event)) -{ - m_parent->Close(); -} - -void wxTipWindowView::OnMouseMove(wxMouseEvent& event) -{ - const wxRect& rectBound = m_parent->m_rectBound; - - if ( rectBound.width && - !rectBound.Contains(ClientToScreen(event.GetPosition())) ) - { - // mouse left the bounding rect, disappear - m_parent->Close(); - } - else - { - event.Skip(); - } -} - -#if !wxUSE_POPUPWIN -void wxTipWindowView::OnKillFocus(wxFocusEvent& WXUNUSED(event)) -{ - // Workaround the kill focus event happening just after creation in wxGTK - if (wxGetLocalTime() > m_creationTime + 1) - m_parent->Close(); -} -#endif // !wxUSE_POPUPWIN - -#endif // wxUSE_TIPWINDOW diff --git a/Source/3rdParty/wx/src/generic/toolbkg.cpp b/Source/3rdParty/wx/src/generic/toolbkg.cpp deleted file mode 100644 index fa3bbdf97..000000000 --- a/Source/3rdParty/wx/src/generic/toolbkg.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/toolbkg.cpp -// Purpose: generic implementation of wxToolbook -// Author: Julian Smart -// Modified by: -// Created: 2006-01-29 -// RCS-ID: $Id: toolbkg.cpp 44271 2007-01-21 00:52:05Z VZ $ -// Copyright: (c) 2006 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TOOLBOOK - -#ifndef WX_PRECOMP - #include "wx/icon.h" - #include "wx/settings.h" - #include "wx/toolbar.h" -#endif - -#include "wx/imaglist.h" -#include "wx/sysopt.h" -#include "wx/toolbook.h" - -#if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON -#include "wx/generic/buttonbar.h" -#endif - -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxToolbookEvent, wxNotifyEvent) - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES -const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxNewEventType(); -const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxNewEventType(); -#endif - -BEGIN_EVENT_TABLE(wxToolbook, wxBookCtrlBase) - EVT_SIZE(wxToolbook::OnSize) - EVT_TOOL_RANGE(1, 50, wxToolbook::OnToolSelected) - EVT_IDLE(wxToolbook::OnIdle) -END_EVENT_TABLE() - -// ============================================================================ -// wxToolbook implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxToolbook creation -// ---------------------------------------------------------------------------- - -void wxToolbook::Init() -{ - m_selection = wxNOT_FOUND; - m_needsRealizing = false; -} - -bool wxToolbook::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) - style |= wxBK_TOP; - - // no border for this control - style &= ~wxBORDER_MASK; - style |= wxBORDER_NONE; - - if ( !wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - return false; - - int orient = wxTB_HORIZONTAL; - if ( (style & (wxBK_LEFT | wxBK_RIGHT)) != 0) - orient = wxTB_VERTICAL; - - // TODO: make more configurable - -#if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON - if (style & wxBK_BUTTONBAR) - { - m_bookctrl = new wxButtonToolBar - ( - this, - wxID_ANY, - wxDefaultPosition, - wxDefaultSize, - orient|wxTB_TEXT|wxTB_FLAT|wxNO_BORDER - ); - } - else -#endif - { - m_bookctrl = new wxToolBar - ( - this, - wxID_ANY, - wxDefaultPosition, - wxDefaultSize, - orient|wxTB_TEXT|wxTB_FLAT|wxTB_NODIVIDER|wxNO_BORDER - ); - } - - return true; -} - -// ---------------------------------------------------------------------------- -// wxToolbook geometry management -// ---------------------------------------------------------------------------- - -wxSize wxToolbook::GetControllerSize() const -{ - const wxSize sizeClient = GetClientSize(), - sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), - sizeToolBar = GetToolBar()->GetSize() + sizeBorder; - - wxSize size; - - if ( IsVertical() ) - { - size.x = sizeClient.x; - size.y = sizeToolBar.y; - } - else // left/right aligned - { - size.x = sizeToolBar.x; - size.y = sizeClient.y; - } - - return size; -} - -void wxToolbook::OnSize(wxSizeEvent& event) -{ - if (m_needsRealizing) - Realize(); - - wxBookCtrlBase::OnSize(event); -} - -wxSize wxToolbook::CalcSizeFromPage(const wxSize& sizePage) const -{ - // we need to add the size of the list control and the border between - const wxSize sizeToolBar = GetControllerSize(); - - wxSize size = sizePage; - if ( IsVertical() ) - { - size.y += sizeToolBar.y + GetInternalBorder(); - } - else // left/right aligned - { - size.x += sizeToolBar.x + GetInternalBorder(); - } - - return size; -} - -// ---------------------------------------------------------------------------- -// accessing the pages -// ---------------------------------------------------------------------------- - -bool wxToolbook::SetPageText(size_t n, const wxString& strText) -{ - // Assume tool ids start from 1 - wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1); - if (tool) - { - tool->SetLabel(strText); - return true; - } - else - return false; -} - -wxString wxToolbook::GetPageText(size_t n) const -{ - wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1); - if (tool) - return tool->GetLabel(); - else - return wxEmptyString; -} - -int wxToolbook::GetPageImage(size_t WXUNUSED(n)) const -{ - wxFAIL_MSG( _T("wxToolbook::GetPageImage() not implemented") ); - - return wxNOT_FOUND; -} - -bool wxToolbook::SetPageImage(size_t n, int imageId) -{ - wxASSERT( GetImageList() != NULL ); - if (!GetImageList()) - return false; - - wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1); - if (tool) - { - // Find the image list index for this tool - wxBitmap bitmap = GetImageList()->GetBitmap(imageId); - tool->SetNormalBitmap(bitmap); - return true; - } - else - return false; -} - -// ---------------------------------------------------------------------------- -// image list stuff -// ---------------------------------------------------------------------------- - -void wxToolbook::SetImageList(wxImageList *imageList) -{ - wxBookCtrlBase::SetImageList(imageList); -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -int wxToolbook::GetSelection() const -{ - return m_selection; -} - -wxBookCtrlBaseEvent* wxToolbook::CreatePageChangingEvent() const -{ - return new wxToolbookEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId); -} - -void wxToolbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) -{ - event.SetEventType(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED); -} - -void wxToolbook::UpdateSelectedPage(size_t newsel) -{ - m_selection = newsel; - GetToolBar()->ToggleTool(newsel + 1, true); -} - -// Not part of the wxBookctrl API, but must be called in OnIdle or -// by application to realize the toolbar and select the initial page. -void wxToolbook::Realize() -{ - if (m_needsRealizing) - { - GetToolBar()->SetToolBitmapSize(m_maxBitmapSize); - - int remap = wxSystemOptions::GetOptionInt(wxT("msw.remap")); - wxSystemOptions::SetOption(wxT("msw.remap"), 0); - GetToolBar()->Realize(); - wxSystemOptions::SetOption(wxT("msw.remap"), remap); - } - - m_needsRealizing = false; - - if (m_selection == -1) - m_selection = 0; - - if (GetPageCount() > 0) - { - int sel = m_selection; - m_selection = -1; - SetSelection(sel); - } - - DoSize(); -} - -int wxToolbook::HitTest(const wxPoint& pt, long *flags) const -{ - int pagePos = wxNOT_FOUND; - - if ( flags ) - *flags = wxBK_HITTEST_NOWHERE; - - // convert from wxToolbook coordinates to wxToolBar ones - const wxToolBarBase * const tbar = GetToolBar(); - const wxPoint tbarPt = tbar->ScreenToClient(ClientToScreen(pt)); - - // is the point over the toolbar? - if ( wxRect(tbar->GetSize()).Contains(tbarPt) ) - { - const wxToolBarToolBase * const - tool = tbar->FindToolForPosition(tbarPt.x, tbarPt.y); - - if ( tool ) - { - pagePos = tbar->GetToolPos(tool->GetId()); - if ( flags ) - *flags = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL; - } - } - else // not over the toolbar - { - if ( flags && GetPageRect().Contains(pt) ) - *flags |= wxBK_HITTEST_ONPAGE; - } - - return pagePos; -} - -void wxToolbook::OnIdle(wxIdleEvent& event) -{ - if (m_needsRealizing) - Realize(); - event.Skip(); -} - -// ---------------------------------------------------------------------------- -// adding/removing the pages -// ---------------------------------------------------------------------------- - -bool wxToolbook::InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) - return false; - - m_needsRealizing = true; - - wxASSERT(GetImageList() != NULL); - - if (!GetImageList()) - return false; - - // TODO: make sure all platforms can convert between icon and bitmap, - // and/or test whether the image is a bitmap or an icon. -#ifdef __WXMAC__ - wxBitmap bitmap = GetImageList()->GetBitmap(imageId); -#else - // On Windows, we can lose information by using GetBitmap, so extract icon instead - wxIcon icon = GetImageList()->GetIcon(imageId); - wxBitmap bitmap; - bitmap.CopyFromIcon(icon); -#endif - - m_maxBitmapSize.x = wxMax(bitmap.GetWidth(), m_maxBitmapSize.x); - m_maxBitmapSize.y = wxMax(bitmap.GetHeight(), m_maxBitmapSize.y); - - GetToolBar()->SetToolBitmapSize(m_maxBitmapSize); - GetToolBar()->AddRadioTool(n + 1, text, bitmap, wxNullBitmap, text); - - if (bSelect) - { - GetToolBar()->ToggleTool(n, true); - m_selection = n; - } - else - page->Hide(); - - InvalidateBestSize(); - return true; -} - -wxWindow *wxToolbook::DoRemovePage(size_t page) -{ - const size_t page_count = GetPageCount(); - wxWindow *win = wxBookCtrlBase::DoRemovePage(page); - - if ( win ) - { - GetToolBar()->DeleteTool(page + 1); - - if (m_selection >= (int)page) - { - // force new sel valid if possible - int sel = m_selection - 1; - if (page_count == 1) - sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == -1)) - sel = 0; - - // force sel invalid if deleting current page - don't try to hide it - m_selection = (m_selection == (int)page) ? wxNOT_FOUND : m_selection - 1; - - if ((sel != wxNOT_FOUND) && (sel != m_selection)) - SetSelection(sel); - } - } - - return win; -} - - -bool wxToolbook::DeleteAllPages() -{ - GetToolBar()->ClearTools(); - return wxBookCtrlBase::DeleteAllPages(); -} - -// ---------------------------------------------------------------------------- -// wxToolbook events -// ---------------------------------------------------------------------------- - -void wxToolbook::OnToolSelected(wxCommandEvent& event) -{ - const int selNew = event.GetId() - 1; - - if ( selNew == m_selection ) - { - // this event can only come from our own Select(m_selection) below - // which we call when the page change is vetoed, so we should simply - // ignore it - return; - } - - SetSelection(selNew); - - // change wasn't allowed, return to previous state - if (m_selection != selNew) - { - GetToolBar()->ToggleTool(m_selection, false); - } -} - -#endif // wxUSE_TOOLBOOK diff --git a/Source/3rdParty/wx/src/generic/treebkg.cpp b/Source/3rdParty/wx/src/generic/treebkg.cpp deleted file mode 100644 index 23f09eccb..000000000 --- a/Source/3rdParty/wx/src/generic/treebkg.cpp +++ /dev/null @@ -1,794 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/treebkg.cpp -// Purpose: generic implementation of wxTreebook -// Author: Evgeniy Tarassov, Vadim Zeitlin -// Modified by: -// Created: 2005-09-15 -// RCS-ID: $Id: treebkg.cpp 54645 2008-07-15 21:29:10Z JS $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TREEBOOK - -#include "wx/treebook.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" -#endif - -#include "wx/imaglist.h" - -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < DoInternalGetPageCount()) - -// ---------------------------------------------------------------------------- -// event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent) - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES -const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType(); -const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxNewEventType(); -const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED = wxNewEventType(); -const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED = wxNewEventType(); -#endif - -BEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase) - EVT_TREE_SEL_CHANGED (wxID_ANY, wxTreebook::OnTreeSelectionChange) - EVT_TREE_ITEM_EXPANDED (wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) - EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxTreebook) -END_EVENT_TABLE() - -// ============================================================================ -// wxTreebook implementation -// ============================================================================ - -WX_DELEGATE_TO_CONTROL_CONTAINER(wxTreebook, wxControl) - -// ---------------------------------------------------------------------------- -// wxTreebook creation -// ---------------------------------------------------------------------------- - -void wxTreebook::Init() -{ - m_container.SetContainerWindow(this); - - m_selection = - m_actualSelection = wxNOT_FOUND; -} - -bool -wxTreebook::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - // Check the style flag to have either wxTBK_RIGHT or wxTBK_LEFT - if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) - { - style |= wxBK_LEFT; - } - style |= wxTAB_TRAVERSAL; - - // no border for this control, it doesn't look nice together with the tree - style &= ~wxBORDER_MASK; - style |= wxBORDER_NONE; - - if ( !wxControl::Create(parent, id, pos, size, - style, wxDefaultValidator, name) ) - return false; - -#ifdef __WXMSW__ - long treeStyle = GetThemedBorderStyle(); -#else - long treeStyle = wxBORDER_SUNKEN; -#endif - m_bookctrl = new wxTreeCtrl - ( - this, - wxID_ANY, - wxDefaultPosition, - wxDefaultSize, - treeStyle| - wxTR_DEFAULT_STYLE | - wxTR_HIDE_ROOT | - wxTR_SINGLE - ); - GetTreeCtrl()->SetQuickBestSize(false); // do full size calculation - GetTreeCtrl()->AddRoot(wxEmptyString); // label doesn't matter, it's hidden - -#ifdef __WXMSW__ - // We need to add dummy size event to force possible scrollbar hiding - wxSizeEvent evt; - GetEventHandler()->AddPendingEvent(evt); -#endif - - return true; -} - - -// insert a new page just before the pagePos -bool wxTreebook::InsertPage(size_t pagePos, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - return DoInsertPage(pagePos, page, text, bSelect, imageId); -} - -bool wxTreebook::InsertSubPage(size_t pagePos, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - return DoInsertSubPage(pagePos, page, text, bSelect, imageId); -} - -bool wxTreebook::AddPage(wxWindow *page, const wxString& text, bool bSelect, - int imageId) -{ - return DoInsertPage(m_treeIds.GetCount(), page, text, bSelect, imageId); -} - -// insertion time is linear to the number of top-pages -bool wxTreebook::AddSubPage(wxWindow *page, const wxString& text, bool bSelect, int imageId) -{ - return DoAddSubPage(page, text, bSelect, imageId); -} - - -bool wxTreebook::DoInsertPage(size_t pagePos, - wxWindow *page, - const wxString& text, - bool bSelect, - int imageId) -{ - wxCHECK_MSG( pagePos <= DoInternalGetPageCount(), false, - wxT("Invalid treebook page position") ); - - if ( !wxBookCtrlBase::InsertPage(pagePos, page, text, bSelect, imageId) ) - return false; - - wxTreeCtrl *tree = GetTreeCtrl(); - wxTreeItemId newId; - if ( pagePos == DoInternalGetPageCount() ) - { - // append the page to the end - wxTreeItemId rootId = tree->GetRootItem(); - - newId = tree->AppendItem(rootId, text, imageId); - } - else // insert the new page before the given one - { - wxTreeItemId nodeId = m_treeIds[pagePos]; - - wxTreeItemId previousId = tree->GetPrevSibling(nodeId); - wxTreeItemId parentId = tree->GetItemParent(nodeId); - - if ( previousId.IsOk() ) - { - // insert before the sibling - previousId - newId = tree->InsertItem(parentId, previousId, text, imageId); - } - else // no prev siblings -- insert as a first child - { - wxASSERT_MSG( parentId.IsOk(), wxT( "Tree has no root node?" ) ); - - newId = tree->PrependItem(parentId, text, imageId); - } - } - - if ( !newId.IsOk() ) - { - //something wrong -> cleaning and returning with false - (void)wxBookCtrlBase::DoRemovePage(pagePos); - - wxFAIL_MSG( wxT("Failed to insert treebook page") ); - return false; - } - - DoInternalAddPage(pagePos, page, newId); - - DoUpdateSelection(bSelect, pagePos); - - return true; -} - -bool wxTreebook::DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect, int imageId) -{ - wxTreeCtrl *tree = GetTreeCtrl(); - - wxTreeItemId rootId = tree->GetRootItem(); - - wxTreeItemId lastNodeId = tree->GetLastChild(rootId); - - wxCHECK_MSG( lastNodeId.IsOk(), false, - _T("Can't insert sub page when there are no pages") ); - - // now calculate its position (should we save/update it too?) - size_t newPos = tree->GetCount() - - (tree->GetChildrenCount(lastNodeId, true) + 1); - - return DoInsertSubPage(newPos, page, text, bSelect, imageId); -} - -bool wxTreebook::DoInsertSubPage(size_t pagePos, - wxTreebookPage *page, - const wxString& text, - bool bSelect, - int imageId) -{ - wxTreeItemId parentId = DoInternalGetPage(pagePos); - wxCHECK_MSG( parentId.IsOk(), false, wxT("invalid tree item") ); - - wxTreeCtrl *tree = GetTreeCtrl(); - - size_t newPos = pagePos + tree->GetChildrenCount(parentId, true) + 1; - wxASSERT_MSG( newPos <= DoInternalGetPageCount(), - wxT("Internal error in tree insert point calculation") ); - - if ( !wxBookCtrlBase::InsertPage(newPos, page, text, bSelect, imageId) ) - return false; - - wxTreeItemId newId = tree->AppendItem(parentId, text, imageId); - - if ( !newId.IsOk() ) - { - (void)wxBookCtrlBase::DoRemovePage(newPos); - - wxFAIL_MSG( wxT("Failed to insert treebook page") ); - return false; - } - - DoInternalAddPage(newPos, page, newId); - - DoUpdateSelection(bSelect, newPos); - - return true; -} - -bool wxTreebook::DeletePage(size_t pagePos) -{ - wxCHECK_MSG( IS_VALID_PAGE(pagePos), false, wxT("Invalid tree index") ); - - wxTreebookPage *oldPage = DoRemovePage(pagePos); - if ( !oldPage ) - return false; - - delete oldPage; - - return true; -} - -wxTreebookPage *wxTreebook::DoRemovePage(size_t pagePos) -{ - wxTreeItemId pageId = DoInternalGetPage(pagePos); - wxCHECK_MSG( pageId.IsOk(), NULL, wxT("Invalid tree index") ); - - wxTreebookPage * oldPage = GetPage(pagePos); - wxTreeCtrl *tree = GetTreeCtrl(); - - size_t subCount = tree->GetChildrenCount(pageId, true); - wxASSERT_MSG ( IS_VALID_PAGE(pagePos + subCount), - wxT("Internal error in wxTreebook::DoRemovePage") ); - - // here we are going to delete ALL the pages in the range - // [pagePos, pagePos + subCount] -- the page and its children - - // deleting all the pages from the base class - for ( size_t i = 0; i <= subCount; ++i ) - { - wxTreebookPage *page = wxBookCtrlBase::DoRemovePage(pagePos); - - // don't delete the page itself though -- it will be deleted in - // DeletePage() when we return - if ( i ) - { - delete page; - } - } - - DoInternalRemovePageRange(pagePos, subCount); - - tree->DeleteChildren( pageId ); - tree->Delete( pageId ); - - return oldPage; -} - -bool wxTreebook::DeleteAllPages() -{ - wxBookCtrlBase::DeleteAllPages(); - m_treeIds.Clear(); - m_selection = - m_actualSelection = wxNOT_FOUND; - - wxTreeCtrl *tree = GetTreeCtrl(); - tree->DeleteChildren(tree->GetRootItem()); - - return true; -} - -void wxTreebook::DoInternalAddPage(size_t newPos, - wxTreebookPage *page, - wxTreeItemId pageId) -{ - wxASSERT_MSG( newPos <= m_treeIds.GetCount(), wxT("Ivalid index passed to wxTreebook::DoInternalAddPage") ); - - // hide newly inserted page initially (it will be shown when selected) - if ( page ) - page->Hide(); - - if ( newPos == m_treeIds.GetCount() ) - { - // append - m_treeIds.Add(pageId); - } - else // insert - { - m_treeIds.Insert(pageId, newPos); - - if ( m_selection != wxNOT_FOUND && newPos <= (size_t)m_selection ) - { - // selection has been moved one unit toward the end - ++m_selection; - if ( m_actualSelection != wxNOT_FOUND ) - ++m_actualSelection; - } - else if ( m_actualSelection != wxNOT_FOUND && - newPos <= (size_t)m_actualSelection ) - { - DoSetSelection(m_selection); - } - } -} - -void wxTreebook::DoInternalRemovePageRange(size_t pagePos, size_t subCount) -{ - // Attention: this function is only for a situation when we delete a node - // with all its children so pagePos is the node's index and subCount is the - // node children count - wxASSERT_MSG( pagePos + subCount < m_treeIds.GetCount(), - wxT("Ivalid page index") ); - - wxTreeItemId pageId = m_treeIds[pagePos]; - - m_treeIds.RemoveAt(pagePos, subCount + 1); - - if ( m_selection != wxNOT_FOUND ) - { - if ( (size_t)m_selection > pagePos + subCount) - { - // selection is far after the deleted page, so just update the index and move on - m_selection -= 1 + subCount; - if ( m_actualSelection != wxNOT_FOUND) - { - m_actualSelection -= subCount + 1; - } - } - else if ( (size_t)m_selection >= pagePos ) - { - wxTreeCtrl *tree = GetTreeCtrl(); - - // as selected page is going to be deleted, try to select the next - // sibling if exists, if not then the parent - wxTreeItemId nodeId = tree->GetNextSibling(pageId); - - m_selection = wxNOT_FOUND; - m_actualSelection = wxNOT_FOUND; - - if ( nodeId.IsOk() ) - { - // selecting next siblings - tree->SelectItem(nodeId); - } - else // no next sibling, select the parent - { - wxTreeItemId parentId = tree->GetItemParent(pageId); - - if ( parentId.IsOk() && parentId != tree->GetRootItem() ) - { - tree->SelectItem(parentId); - } - else // parent is root - { - // we can't select it as it's hidden - DoUpdateSelection(false, wxNOT_FOUND); - } - } - } - else if ( m_actualSelection != wxNOT_FOUND && - (size_t)m_actualSelection >= pagePos ) - { - // nothing to do -- selection is before the deleted node, but - // actually shown page (the first (sub)child with page != NULL) is - // already deleted - m_actualSelection = m_selection; - - // send event as documented - DoSetSelection(m_selection, SetSelection_SendEvent); - } - //else: nothing to do -- selection is before the deleted node - } - else - { - DoUpdateSelection(false, wxNOT_FOUND); - } -} - - -void wxTreebook::DoUpdateSelection(bool bSelect, int newPos) -{ - int newSelPos; - if ( bSelect ) - { - newSelPos = newPos; - } - else if ( m_selection == wxNOT_FOUND && DoInternalGetPageCount() > 0 ) - { - newSelPos = 0; - } - else - { - newSelPos = wxNOT_FOUND; - } - - if ( newSelPos != wxNOT_FOUND ) - { - SetSelection((size_t)newSelPos); - } -} - -wxTreeItemId wxTreebook::DoInternalGetPage(size_t pagePos) const -{ - if ( pagePos >= m_treeIds.GetCount() ) - { - // invalid position but ok here, in this internal function, don't assert - // (the caller will do it) - return wxTreeItemId(); - } - - return m_treeIds[pagePos]; -} - -int wxTreebook::DoInternalFindPageById(wxTreeItemId pageId) const -{ - const size_t count = m_treeIds.GetCount(); - for ( size_t i = 0; i < count; ++i ) - { - if ( m_treeIds[i] == pageId ) - return i; - } - - return wxNOT_FOUND; -} - -bool wxTreebook::IsNodeExpanded(size_t pagePos) const -{ - wxTreeItemId pageId = DoInternalGetPage(pagePos); - - wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") ); - - return GetTreeCtrl()->IsExpanded(pageId); -} - -bool wxTreebook::ExpandNode(size_t pagePos, bool expand) -{ - wxTreeItemId pageId = DoInternalGetPage(pagePos); - - wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") ); - - if ( expand ) - { - GetTreeCtrl()->Expand( pageId ); - } - else // collapse - { - GetTreeCtrl()->Collapse( pageId ); - - // rely on the events generated by wxTreeCtrl to update selection - } - - return true; -} - -int wxTreebook::GetPageParent(size_t pagePos) const -{ - wxTreeItemId nodeId = DoInternalGetPage( pagePos ); - wxCHECK_MSG( nodeId.IsOk(), wxNOT_FOUND, wxT("Invalid page index spacified!") ); - - const wxTreeItemId parent = GetTreeCtrl()->GetItemParent( nodeId ); - - return parent.IsOk() ? DoInternalFindPageById(parent) : wxNOT_FOUND; -} - -bool wxTreebook::SetPageText(size_t n, const wxString& strText) -{ - wxTreeItemId pageId = DoInternalGetPage(n); - - wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") ); - - GetTreeCtrl()->SetItemText(pageId, strText); - - return true; -} - -wxString wxTreebook::GetPageText(size_t n) const -{ - wxTreeItemId pageId = DoInternalGetPage(n); - - wxCHECK_MSG( pageId.IsOk(), wxString(), wxT("invalid tree item") ); - - return GetTreeCtrl()->GetItemText(pageId); -} - -int wxTreebook::GetPageImage(size_t n) const -{ - wxTreeItemId pageId = DoInternalGetPage(n); - - wxCHECK_MSG( pageId.IsOk(), wxNOT_FOUND, wxT("invalid tree item") ); - - return GetTreeCtrl()->GetItemImage(pageId); -} - -bool wxTreebook::SetPageImage(size_t n, int imageId) -{ - wxTreeItemId pageId = DoInternalGetPage(n); - - wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") ); - - GetTreeCtrl()->SetItemImage(pageId, imageId); - - return true; -} - -wxSize wxTreebook::CalcSizeFromPage(const wxSize& sizePage) const -{ - const wxSize sizeTree = GetControllerSize(); - - wxSize size = sizePage; - size.x += sizeTree.x; - - return size; -} - -int wxTreebook::GetSelection() const -{ - return m_selection; -} - -int wxTreebook::DoSetSelection(size_t pagePos, int flags) -{ - wxCHECK_MSG( IS_VALID_PAGE(pagePos), wxNOT_FOUND, - wxT("invalid page index in wxListbook::DoSetSelection()") ); - wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(), - wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!")); - - wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId); - const int oldSel = m_selection; - wxTreeCtrl *tree = GetTreeCtrl(); - bool allowed = false; - - if (flags & SetSelection_SendEvent) - { - event.SetEventObject(this); - event.SetSelection(pagePos); - event.SetOldSelection(m_selection); - - // don't send the event if the old and new pages are the same; do send it - // otherwise and be prepared for it to be vetoed - allowed = (int)pagePos == m_selection || - !GetEventHandler()->ProcessEvent(event) || - event.IsAllowed(); - } - - if ( !(flags & SetSelection_SendEvent) || allowed ) - { - // hide the previously shown page - wxTreebookPage * const oldPage = DoGetCurrentPage(); - if ( oldPage ) - oldPage->Hide(); - - // then show the new one - m_selection = pagePos; - wxTreebookPage *page = wxBookCtrlBase::GetPage(m_selection); - if ( !page ) - { - // find the next page suitable to be shown: the first (grand)child - // of this one with a non-NULL associated page - wxTreeItemId childId = m_treeIds[pagePos]; - int actualPagePos = pagePos; - while ( !page && childId.IsOk() ) - { - wxTreeItemIdValue cookie; - childId = tree->GetFirstChild( childId, cookie ); - if ( childId.IsOk() ) - { - page = wxBookCtrlBase::GetPage(++actualPagePos); - } - } - - m_actualSelection = page ? actualPagePos : m_selection; - } - - if ( page ) - page->Show(); - - tree->SelectItem(DoInternalGetPage(pagePos)); - - if (flags & SetSelection_SendEvent) - { - // notify about the (now completed) page change - event.SetEventType(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED); - (void)GetEventHandler()->ProcessEvent(event); - } - } - else if ( (flags & SetSelection_SendEvent) && !allowed) // page change vetoed - { - // tree selection might have already had changed - if ( oldSel != wxNOT_FOUND ) - tree->SelectItem(DoInternalGetPage(oldSel)); - } - - return oldSel; -} - -wxTreebookPage *wxTreebook::DoGetCurrentPage() const -{ - if ( m_selection == wxNOT_FOUND ) - return NULL; - - wxTreebookPage *page = wxBookCtrlBase::GetPage(m_selection); - if ( !page && m_actualSelection != wxNOT_FOUND ) - { - page = wxBookCtrlBase::GetPage(m_actualSelection); - } - - return page; -} - -void wxTreebook::SetImageList(wxImageList *imageList) -{ - wxBookCtrlBase::SetImageList(imageList); - GetTreeCtrl()->SetImageList(imageList); -} - -void wxTreebook::AssignImageList(wxImageList *imageList) -{ - wxBookCtrlBase::AssignImageList(imageList); - GetTreeCtrl()->SetImageList(imageList); -} - -// ---------------------------------------------------------------------------- -// event handlers -// ---------------------------------------------------------------------------- - -void wxTreebook::OnTreeSelectionChange(wxTreeEvent& event) -{ - if ( event.GetEventObject() != m_bookctrl ) - { - event.Skip(); - return; - } - - wxTreeItemId newId = event.GetItem(); - - if ( (m_selection == wxNOT_FOUND && - (!newId.IsOk() || newId == GetTreeCtrl()->GetRootItem())) || - (m_selection != wxNOT_FOUND && newId == m_treeIds[m_selection]) ) - { - // this event can only come when we modify the tree selection ourselves - // so we should simply ignore it - return; - } - - int newPos = DoInternalFindPageById(newId); - - if ( newPos != wxNOT_FOUND ) - SetSelection( newPos ); -} - -void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event) -{ - if ( event.GetEventObject() != m_bookctrl ) - { - event.Skip(); - return; - } - - wxTreeItemId nodeId = event.GetItem(); - if ( !nodeId.IsOk() || nodeId == GetTreeCtrl()->GetRootItem() ) - return; - int pagePos = DoInternalFindPageById(nodeId); - wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") ); - - wxTreebookEvent ev(GetTreeCtrl()->IsExpanded(nodeId) - ? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED - : wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, - m_windowId); - - ev.SetSelection(pagePos); - ev.SetOldSelection(pagePos); - ev.SetEventObject(this); - - GetEventHandler()->ProcessEvent(ev); -} - -// ---------------------------------------------------------------------------- -// wxTreebook geometry management -// ---------------------------------------------------------------------------- - -int wxTreebook::HitTest(wxPoint const & pt, long * flags) const -{ - int pagePos = wxNOT_FOUND; - - if ( flags ) - *flags = wxBK_HITTEST_NOWHERE; - - // convert from wxTreebook coorindates to wxTreeCtrl ones - const wxTreeCtrl * const tree = GetTreeCtrl(); - const wxPoint treePt = tree->ScreenToClient(ClientToScreen(pt)); - - // is it over the tree? - if ( wxRect(tree->GetSize()).Contains(treePt) ) - { - int flagsTree; - wxTreeItemId id = tree->HitTest(treePt, flagsTree); - - if ( id.IsOk() && (flagsTree & wxTREE_HITTEST_ONITEM) ) - { - pagePos = DoInternalFindPageById(id); - } - - if ( flags ) - { - if ( pagePos != wxNOT_FOUND ) - *flags = 0; - - if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON | - wxTREE_HITTEST_ONITEMICON | - wxTREE_HITTEST_ONITEMSTATEICON) ) - *flags |= wxBK_HITTEST_ONICON; - - if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL ) - *flags |= wxBK_HITTEST_ONLABEL; - } - } - else // not over the tree - { - if ( flags && GetPageRect().Contains( pt ) ) - *flags |= wxBK_HITTEST_ONPAGE; - } - - return pagePos; -} - -#endif // wxUSE_TREEBOOK diff --git a/Source/3rdParty/wx/src/generic/treectlg.cpp b/Source/3rdParty/wx/src/generic/treectlg.cpp deleted file mode 100644 index e00ee5b1e..000000000 --- a/Source/3rdParty/wx/src/generic/treectlg.cpp +++ /dev/null @@ -1,3823 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/treectlg.cpp -// Purpose: generic tree control implementation -// Author: Robert Roebling -// Created: 01/02/97 -// Modified: 22/10/98 - almost total rewrite, simpler interface (VZ) -// Id: $Id: treectlg.cpp 67017 2011-02-25 09:37:28Z JS $ -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================= -// declarations -// ============================================================================= - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TREECTRL - -#include "wx/treectrl.h" - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" - #include "wx/timer.h" - #include "wx/settings.h" - #include "wx/listbox.h" - #include "wx/textctrl.h" -#endif - -#include "wx/generic/treectlg.h" -#include "wx/imaglist.h" - -#include "wx/renderer.h" - -#ifdef __WXMAC__ - #include "wx/mac/private.h" -#endif - -// ----------------------------------------------------------------------------- -// array types -// ----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxGenericTreeItem *, wxArrayGenericTreeItems); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -static const int NO_IMAGE = -1; - -static const int PIXELS_PER_UNIT = 10; - -// the margin between the item image and the item text -static const int MARGIN_BETWEEN_IMAGE_AND_TEXT = 4; - -// ----------------------------------------------------------------------------- -// private classes -// ----------------------------------------------------------------------------- - -// timer used for enabling in-place edit -class WXDLLEXPORT wxTreeRenameTimer: public wxTimer -{ -public: - // start editing the current item after half a second (if the mouse hasn't - // been clicked/moved) - enum { DELAY = 250 }; - - wxTreeRenameTimer( wxGenericTreeCtrl *owner ); - - virtual void Notify(); - -private: - wxGenericTreeCtrl *m_owner; - - DECLARE_NO_COPY_CLASS(wxTreeRenameTimer) -}; - -// control used for in-place edit -class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl -{ -public: - wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item); - - void EndEdit(bool discardChanges); - - const wxGenericTreeItem* item() const { return m_itemEdited; } - -protected: - void OnChar( wxKeyEvent &event ); - void OnKeyUp( wxKeyEvent &event ); - void OnKillFocus( wxFocusEvent &event ); - - bool AcceptChanges(); - void Finish( bool setfocus = true ); - -private: - wxGenericTreeCtrl *m_owner; - wxGenericTreeItem *m_itemEdited; - wxString m_startValue; - bool m_aboutToFinish; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTreeTextCtrl) -}; - -// timer used to clear wxGenericTreeCtrl::m_findPrefix if no key was pressed -// for a sufficiently long time -class WXDLLEXPORT wxTreeFindTimer : public wxTimer -{ -public: - // reset the current prefix after half a second of inactivity - enum { DELAY = 500 }; - - wxTreeFindTimer( wxGenericTreeCtrl *owner ) { m_owner = owner; } - - virtual void Notify() { m_owner->m_findPrefix.clear(); } - -private: - wxGenericTreeCtrl *m_owner; - - DECLARE_NO_COPY_CLASS(wxTreeFindTimer) -}; - -// a tree item -class WXDLLEXPORT wxGenericTreeItem -{ -public: - // ctors & dtor - wxGenericTreeItem() { - m_data = NULL; - m_widthText = - m_heightText = -1; - } - - wxGenericTreeItem( wxGenericTreeItem *parent, - const wxString& text, - int image, - int selImage, - wxTreeItemData *data ); - - ~wxGenericTreeItem(); - - // trivial accessors - wxArrayGenericTreeItems& GetChildren() { return m_children; } - - const wxString& GetText() const { return m_text; } - int GetImage(wxTreeItemIcon which = wxTreeItemIcon_Normal) const - { return m_images[which]; } - wxTreeItemData *GetData() const { return m_data; } - - // returns the current image for the item (depending on its - // selected/expanded/whatever state) - int GetCurrentImage() const; - - void SetText(const wxString& text) - { - m_text = text; - - ResetTextSize(); - } - - void SetImage(int image, wxTreeItemIcon which) - { - m_images[which] = image; - m_width = 0; - } - - void SetData(wxTreeItemData *data) { m_data = data; } - - void SetHasPlus(bool has = true) { m_hasPlus = has; } - - void SetBold(bool bold) - { - m_isBold = bold; - - ResetTextSize(); - } - - int GetX() const { return m_x; } - int GetY() const { return m_y; } - - void SetX(int x) { m_x = x; } - void SetY(int y) { m_y = y; } - - int GetHeight() const { return m_height; } - int GetWidth() const { return m_width; } - - int GetTextHeight() const - { - wxASSERT_MSG( m_heightText != -1, _T("must call CalculateSize() first") ); - - return m_heightText; - } - - int GetTextWidth() const - { - wxASSERT_MSG( m_widthText != -1, _T("must call CalculateSize() first") ); - - return m_widthText; - } - - wxGenericTreeItem *GetParent() const { return m_parent; } - - // sets the items font for the specified DC if it uses any special font or - // simply returns false otherwise - bool SetFont(wxGenericTreeCtrl *control, wxDC& dc) const - { - wxFont font; - - wxTreeItemAttr * const attr = GetAttributes(); - if ( attr && attr->HasFont() ) - font = attr->GetFont(); - else if ( IsBold() ) - font = control->m_boldFont; - else - return false; - - dc.SetFont(font); - return true; - } - - // operations - - // deletes all children notifying the treectrl about it - void DeleteChildren(wxGenericTreeCtrl *tree); - - // get count of all children (and grand children if 'recursively') - size_t GetChildrenCount(bool recursively = true) const; - - void Insert(wxGenericTreeItem *child, size_t index) - { m_children.Insert(child, index); } - - // calculate and cache the item size using either the provided DC (which is - // supposed to have wxGenericTreeCtrl::m_normalFont selected into it!) or a - // wxClientDC on the control window - void CalculateSize(wxGenericTreeCtrl *control, wxDC& dc) - { DoCalculateSize(control, dc, true /* dc uses normal font */); } - void CalculateSize(wxGenericTreeCtrl *control); - - void GetSize( int &x, int &y, const wxGenericTreeCtrl* ); - - void ResetSize() { m_width = 0; } - void ResetTextSize() { m_width = 0; m_widthText = -1; } - void RecursiveResetSize(); - void RecursiveResetTextSize(); - - // return the item at given position (or NULL if no item), onButton is - // true if the point belongs to the item's button, otherwise it lies - // on the item's label - wxGenericTreeItem *HitTest( const wxPoint& point, - const wxGenericTreeCtrl *, - int &flags, - int level ); - - void Expand() { m_isCollapsed = false; } - void Collapse() { m_isCollapsed = true; } - - void SetHilight( bool set = true ) { m_hasHilight = set; } - - // status inquiries - bool HasChildren() const { return !m_children.IsEmpty(); } - bool IsSelected() const { return m_hasHilight != 0; } - bool IsExpanded() const { return !m_isCollapsed; } - bool HasPlus() const { return m_hasPlus || HasChildren(); } - bool IsBold() const { return m_isBold != 0; } - - // attributes - // get them - may be NULL - wxTreeItemAttr *GetAttributes() const { return m_attr; } - // get them ensuring that the pointer is not NULL - wxTreeItemAttr& Attr() - { - if ( !m_attr ) - { - m_attr = new wxTreeItemAttr; - m_ownsAttr = true; - } - return *m_attr; - } - // set them - void SetAttributes(wxTreeItemAttr *attr) - { - if ( m_ownsAttr ) delete m_attr; - m_attr = attr; - m_ownsAttr = false; - m_width = 0; - m_widthText = -1; - } - // set them and delete when done - void AssignAttributes(wxTreeItemAttr *attr) - { - SetAttributes(attr); - m_ownsAttr = true; - m_width = 0; - m_widthText = -1; - } - -private: - // calculate the size of this item, i.e. set m_width, m_height and - // m_widthText and m_heightText properly - // - // if dcUsesNormalFont is true, the current dc font must be the normal tree - // control font - void DoCalculateSize(wxGenericTreeCtrl *control, - wxDC& dc, - bool dcUsesNormalFont); - - // since there can be very many of these, we save size by chosing - // the smallest representation for the elements and by ordering - // the members to avoid padding. - wxString m_text; // label to be rendered for item - int m_widthText; - int m_heightText; - - wxTreeItemData *m_data; // user-provided data - - wxArrayGenericTreeItems m_children; // list of children - wxGenericTreeItem *m_parent; // parent of this item - - wxTreeItemAttr *m_attr; // attributes??? - - // tree ctrl images for the normal, selected, expanded and - // expanded+selected states - int m_images[wxTreeItemIcon_Max]; - - wxCoord m_x; // (virtual) offset from top - wxCoord m_y; // (virtual) offset from left - int m_width; // width of this item - int m_height; // height of this item - - // use bitfields to save size - unsigned int m_isCollapsed :1; - unsigned int m_hasHilight :1; // same as focused - unsigned int m_hasPlus :1; // used for item which doesn't have - // children but has a [+] button - unsigned int m_isBold :1; // render the label in bold font - unsigned int m_ownsAttr :1; // delete attribute when done - - DECLARE_NO_COPY_CLASS(wxGenericTreeItem) -}; - -// ============================================================================= -// implementation -// ============================================================================= - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// translate the key or mouse event flags to the type of selection we're -// dealing with -static void EventFlagsToSelType(long style, - bool shiftDown, - bool ctrlDown, - bool &is_multiple, - bool &extended_select, - bool &unselect_others) -{ - is_multiple = (style & wxTR_MULTIPLE) != 0; - extended_select = shiftDown && is_multiple; - unselect_others = !(extended_select || (ctrlDown && is_multiple)); -} - -// check if the given item is under another one -static bool IsDescendantOf(const wxGenericTreeItem *parent, const wxGenericTreeItem *item) -{ - while ( item ) - { - if ( item == parent ) - { - // item is a descendant of parent - return true; - } - - item = item->GetParent(); - } - - return false; -} - -// ----------------------------------------------------------------------------- -// wxTreeRenameTimer (internal) -// ----------------------------------------------------------------------------- - -wxTreeRenameTimer::wxTreeRenameTimer( wxGenericTreeCtrl *owner ) -{ - m_owner = owner; -} - -void wxTreeRenameTimer::Notify() -{ - m_owner->OnRenameTimer(); -} - -//----------------------------------------------------------------------------- -// wxTreeTextCtrl (internal) -//----------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxTreeTextCtrl,wxTextCtrl) - EVT_CHAR (wxTreeTextCtrl::OnChar) - EVT_KEY_UP (wxTreeTextCtrl::OnKeyUp) - EVT_KILL_FOCUS (wxTreeTextCtrl::OnKillFocus) -END_EVENT_TABLE() - -wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, - wxGenericTreeItem *item) - : m_itemEdited(item), m_startValue(item->GetText()) -{ - m_owner = owner; - m_aboutToFinish = false; - - int w = m_itemEdited->GetWidth(), - h = m_itemEdited->GetHeight(); - - int x, y; - m_owner->CalcScrolledPosition(item->GetX(), item->GetY(), &x, &y); - - int image_h = 0, - image_w = 0; - - int image = item->GetCurrentImage(); - if ( image != NO_IMAGE ) - { - if ( m_owner->m_imageListNormal ) - { - m_owner->m_imageListNormal->GetSize( image, image_w, image_h ); - image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - else - { - wxFAIL_MSG(_T("you must create an image list to use images!")); - } - } - - // FIXME: what are all these hardcoded 4, 8 and 11s really? - x += image_w; - w -= image_w + 4; -#ifdef __WXMAC__ - wxSize bs = DoGetBestSize() ; - // edit control height - if ( h > bs.y - 8 ) - { - int diff = h - ( bs.y - 8 ) ; - h -= diff ; - y += diff / 2 ; - } -#endif - - (void)Create(m_owner, wxID_ANY, m_startValue, - wxPoint(x - 4, y - 4), wxSize(w + 11, h + 8)); -} - -void wxTreeTextCtrl::EndEdit(bool discardChanges) -{ - m_aboutToFinish = true; - - if ( discardChanges ) - { - m_owner->OnRenameCancelled(m_itemEdited); - - Finish(); - } - else - { - // Notify the owner about the changes - AcceptChanges(); - - // Even if vetoed, close the control (consistent with MSW) - Finish(); - } -} - -bool wxTreeTextCtrl::AcceptChanges() -{ - const wxString value = GetValue(); - - if ( value == m_startValue ) - { - // nothing changed, always accept - // when an item remains unchanged, the owner - // needs to be notified that the user decided - // not to change the tree item label, and that - // the edit has been cancelled - - m_owner->OnRenameCancelled(m_itemEdited); - return true; - } - - if ( !m_owner->OnRenameAccept(m_itemEdited, value) ) - { - // vetoed by the user - return false; - } - - // accepted, do rename the item - m_owner->SetItemText(m_itemEdited, value); - - return true; -} - -void wxTreeTextCtrl::Finish( bool setfocus ) -{ - m_owner->ResetTextControl(); - - wxPendingDelete.Append(this); - - if (setfocus) - m_owner->SetFocus(); -} - -void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) -{ - switch ( event.m_keyCode ) - { - case WXK_RETURN: - EndEdit( false ); - break; - - case WXK_ESCAPE: - EndEdit( true ); - break; - - default: - event.Skip(); - } -} - -void wxTreeTextCtrl::OnKeyUp( wxKeyEvent &event ) -{ - if ( !m_aboutToFinish ) - { - // auto-grow the textctrl: - wxSize parentSize = m_owner->GetSize(); - wxPoint myPos = GetPosition(); - wxSize mySize = GetSize(); - int sx, sy; - GetTextExtent(GetValue() + _T("M"), &sx, &sy); - if (myPos.x + sx > parentSize.x) - sx = parentSize.x - myPos.x; - if (mySize.x > sx) - sx = mySize.x; - SetSize(sx, wxDefaultCoord); - } - - event.Skip(); -} - -void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event ) -{ - if ( !m_aboutToFinish ) - { - if ( !AcceptChanges() ) - m_owner->OnRenameCancelled( m_itemEdited ); - - Finish( false ); - } - - // We should let the native text control handle focus, too. - event.Skip(); -} - -// ----------------------------------------------------------------------------- -// wxGenericTreeItem -// ----------------------------------------------------------------------------- - -wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent, - const wxString& text, - int image, int selImage, - wxTreeItemData *data) - : m_text(text) -{ - m_images[wxTreeItemIcon_Normal] = image; - m_images[wxTreeItemIcon_Selected] = selImage; - m_images[wxTreeItemIcon_Expanded] = NO_IMAGE; - m_images[wxTreeItemIcon_SelectedExpanded] = NO_IMAGE; - - m_data = data; - m_x = m_y = 0; - - m_isCollapsed = true; - m_hasHilight = false; - m_hasPlus = false; - m_isBold = false; - - m_parent = parent; - - m_attr = (wxTreeItemAttr *)NULL; - m_ownsAttr = false; - - // We don't know the height here yet. - m_width = 0; - m_height = 0; - - m_widthText = -1; - m_heightText = -1; -} - -wxGenericTreeItem::~wxGenericTreeItem() -{ - delete m_data; - - if (m_ownsAttr) delete m_attr; - - wxASSERT_MSG( m_children.IsEmpty(), - wxT("please call DeleteChildren() before deleting the item") ); -} - -void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) -{ - size_t count = m_children.Count(); - for ( size_t n = 0; n < count; n++ ) - { - wxGenericTreeItem *child = m_children[n]; - tree->SendDeleteEvent(child); - - child->DeleteChildren(tree); - if ( child == tree->m_select_me ) - tree->m_select_me = NULL; - delete child; - } - - m_children.Empty(); -} - -size_t wxGenericTreeItem::GetChildrenCount(bool recursively) const -{ - size_t count = m_children.Count(); - if ( !recursively ) - return count; - - size_t total = count; - for (size_t n = 0; n < count; ++n) - { - total += m_children[n]->GetChildrenCount(); - } - - return total; -} - -void wxGenericTreeItem::GetSize( int &x, int &y, - const wxGenericTreeCtrl *theButton ) -{ - int bottomY=m_y+theButton->GetLineHeight(this); - if ( y < bottomY ) y = bottomY; - int width = m_x + m_width; - if ( x < width ) x = width; - - if (IsExpanded()) - { - size_t count = m_children.Count(); - for ( size_t n = 0; n < count; ++n ) - { - m_children[n]->GetSize( x, y, theButton ); - } - } -} - -wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, - const wxGenericTreeCtrl *theCtrl, - int &flags, - int level) -{ - // for a hidden root node, don't evaluate it, but do evaluate children - if ( !(level == 0 && theCtrl->HasFlag(wxTR_HIDE_ROOT)) ) - { - // evaluate the item - int h = theCtrl->GetLineHeight(this); - if ((point.y > m_y) && (point.y < m_y + h)) - { - int y_mid = m_y + h/2; - if (point.y < y_mid ) - flags |= wxTREE_HITTEST_ONITEMUPPERPART; - else - flags |= wxTREE_HITTEST_ONITEMLOWERPART; - - int xCross = m_x - theCtrl->GetSpacing(); -#ifdef __WXMAC__ - // according to the drawing code the triangels are drawn - // at -4 , -4 from the position up to +10/+10 max - if ((point.x > xCross-4) && (point.x < xCross+10) && - (point.y > y_mid-4) && (point.y < y_mid+10) && - HasPlus() && theCtrl->HasButtons() ) -#else - // 5 is the size of the plus sign - if ((point.x > xCross-6) && (point.x < xCross+6) && - (point.y > y_mid-6) && (point.y < y_mid+6) && - HasPlus() && theCtrl->HasButtons() ) -#endif - { - flags |= wxTREE_HITTEST_ONITEMBUTTON; - return this; - } - - if ((point.x >= m_x) && (point.x <= m_x+m_width)) - { - int image_w = -1; - int image_h; - - // assuming every image (normal and selected) has the same size! - if ( (GetImage() != NO_IMAGE) && theCtrl->m_imageListNormal ) - theCtrl->m_imageListNormal->GetSize(GetImage(), - image_w, image_h); - - if ((image_w != -1) && (point.x <= m_x + image_w + 1)) - flags |= wxTREE_HITTEST_ONITEMICON; - else - flags |= wxTREE_HITTEST_ONITEMLABEL; - - return this; - } - - if (point.x < m_x) - flags |= wxTREE_HITTEST_ONITEMINDENT; - if (point.x > m_x+m_width) - flags |= wxTREE_HITTEST_ONITEMRIGHT; - - return this; - } - - // if children are expanded, fall through to evaluate them - if (m_isCollapsed) return (wxGenericTreeItem*) NULL; - } - - // evaluate children - size_t count = m_children.Count(); - for ( size_t n = 0; n < count; n++ ) - { - wxGenericTreeItem *res = m_children[n]->HitTest( point, - theCtrl, - flags, - level + 1 ); - if ( res != NULL ) - return res; - } - - return (wxGenericTreeItem*) NULL; -} - -int wxGenericTreeItem::GetCurrentImage() const -{ - int image = NO_IMAGE; - if ( IsExpanded() ) - { - if ( IsSelected() ) - { - image = GetImage(wxTreeItemIcon_SelectedExpanded); - } - - if ( image == NO_IMAGE ) - { - // we usually fall back to the normal item, but try just the - // expanded one (and not selected) first in this case - image = GetImage(wxTreeItemIcon_Expanded); - } - } - else // not expanded - { - if ( IsSelected() ) - image = GetImage(wxTreeItemIcon_Selected); - } - - // maybe it doesn't have the specific image we want, - // try the default one instead - if ( image == NO_IMAGE ) image = GetImage(); - - return image; -} - -void wxGenericTreeItem::CalculateSize(wxGenericTreeCtrl* control) -{ - // check if we need to do anything before creating the DC - if ( m_width != 0 ) - return; - - wxClientDC dc(control); - DoCalculateSize(control, dc, false /* normal font not used */); -} - -void -wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control, - wxDC& dc, - bool dcUsesNormalFont) -{ - if ( m_width != 0 ) // Size known, nothing to do - return; - - if ( m_widthText == -1 ) - { - bool fontChanged; - if ( SetFont(control, dc) ) - { - fontChanged = true; - } - else // we have no special font - { - if ( !dcUsesNormalFont ) - { - // but we do need to ensure that the normal font is used: notice - // that this doesn't count as changing the font as we don't need - // to restore it - dc.SetFont(control->m_normalFont); - } - - fontChanged = false; - } - - dc.GetTextExtent( GetText(), &m_widthText, &m_heightText ); - - // restore normal font if the DC used it previously and we changed it - if ( fontChanged ) - dc.SetFont(control->m_normalFont); - } - - int text_h = m_heightText + 2; - - int image_h = 0; - int image_w = 0; - int image = GetCurrentImage(); - if ( image != NO_IMAGE ) - { - if ( control->m_imageListNormal ) - { - control->m_imageListNormal->GetSize( image, image_w, image_h ); - image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - } - - m_height = (image_h > text_h) ? image_h : text_h; - - if (m_height < 30) - m_height += 2; // at least 2 pixels - else - m_height += m_height / 10; // otherwise 10% extra spacing - - if (m_height > control->m_lineHeight) - control->m_lineHeight = m_height; - - m_width = image_w + m_widthText + 2; -} - -void wxGenericTreeItem::RecursiveResetSize() -{ - m_width = 0; - - const size_t count = m_children.Count(); - for (size_t i = 0; i < count; i++ ) - m_children[i]->RecursiveResetSize(); -} - -void wxGenericTreeItem::RecursiveResetTextSize() -{ - m_width = 0; - m_widthText = -1; - - const size_t count = m_children.Count(); - for (size_t i = 0; i < count; i++ ) - m_children[i]->RecursiveResetTextSize(); -} - -// ----------------------------------------------------------------------------- -// wxGenericTreeCtrl implementation -// ----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxGenericTreeCtrl, wxControl) - -BEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase) - EVT_PAINT (wxGenericTreeCtrl::OnPaint) - EVT_SIZE (wxGenericTreeCtrl::OnSize) - EVT_MOUSE_EVENTS (wxGenericTreeCtrl::OnMouse) - EVT_CHAR (wxGenericTreeCtrl::OnChar) - EVT_SET_FOCUS (wxGenericTreeCtrl::OnSetFocus) - EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus) - EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxGenericTreeCtrl::OnGetToolTip) -END_EVENT_TABLE() - -#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) -/* - * wxTreeCtrl has to be a real class or we have problems with - * the run-time information. - */ - -IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxGenericTreeCtrl) -#endif - -// ----------------------------------------------------------------------------- -// construction/destruction -// ----------------------------------------------------------------------------- - -void wxGenericTreeCtrl::Init() -{ - m_current = - m_key_current = - m_anchor = - m_select_me = (wxGenericTreeItem *) NULL; - m_hasFocus = false; - m_dirty = false; - - m_lineHeight = 10; - m_indent = 15; - m_spacing = 18; - - m_hilightBrush = new wxBrush - ( - wxSystemSettings::GetColour - ( - wxSYS_COLOUR_HIGHLIGHT - ), - wxSOLID - ); - - m_hilightUnfocusedBrush = new wxBrush - ( - wxSystemSettings::GetColour - ( - wxSYS_COLOUR_BTNSHADOW - ), - wxSOLID - ); - - m_imageListButtons = NULL; - m_ownsImageListButtons = false; - - m_dragCount = 0; - m_isDragging = false; - m_dropTarget = m_oldSelection = NULL; - m_underMouse = NULL; - m_textCtrl = NULL; - - m_renameTimer = NULL; - m_freezeCount = 0; - - m_findTimer = NULL; - - m_dropEffectAboveItem = false; - - m_lastOnSame = false; - -#ifdef __WXMAC_CARBON__ - m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ; -#else - m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); -#endif - m_boldFont = wxFont(m_normalFont.GetPointSize(), - m_normalFont.GetFamily(), - m_normalFont.GetStyle(), - wxBOLD, - m_normalFont.GetUnderlined(), - m_normalFont.GetFaceName(), - m_normalFont.GetEncoding()); -} - -bool wxGenericTreeCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name ) -{ -#ifdef __WXMAC__ - int major,minor; - wxGetOsVersion( &major, &minor ); - - style &= ~wxTR_LINES_AT_ROOT; - style |= wxTR_NO_LINES; - if (major < 10) - style |= wxTR_ROW_LINES; - - if (style == 0 || style & wxTR_DEFAULT_STYLE) - style |= wxTR_FULL_ROW_HIGHLIGHT; - -#endif // __WXMAC__ -#ifdef __WXGTK20__ - style |= wxTR_NO_LINES; -#endif - - if ( !wxControl::Create( parent, id, pos, size, - style|wxHSCROLL|wxVSCROLL, - validator, - name ) ) - return false; - - // If the tree display has no buttons, but does have - // connecting lines, we can use a narrower layout. - // It may not be a good idea to force this... - if (!HasButtons() && !HasFlag(wxTR_NO_LINES)) - { - m_indent= 10; - m_spacing = 10; - } - - wxVisualAttributes attr = GetDefaultAttributes(); - SetOwnForegroundColour( attr.colFg ); - SetOwnBackgroundColour( attr.colBg ); - if (!m_hasFont) - SetOwnFont(attr.font); - - m_dottedPen = wxPen( wxT("grey"), 0, 0 ); - - SetInitialSize(size); - - return true; -} - -wxGenericTreeCtrl::~wxGenericTreeCtrl() -{ - delete m_hilightBrush; - delete m_hilightUnfocusedBrush; - - DeleteAllItems(); - - delete m_renameTimer; - delete m_findTimer; - - if (m_ownsImageListButtons) - delete m_imageListButtons; -} - -// ----------------------------------------------------------------------------- -// accessors -// ----------------------------------------------------------------------------- - -unsigned int wxGenericTreeCtrl::GetCount() const -{ - if ( !m_anchor ) - { - // the tree is empty - return 0; - } - - unsigned int count = m_anchor->GetChildrenCount(); - if ( !HasFlag(wxTR_HIDE_ROOT) ) - { - // take the root itself into account - count++; - } - - return count; -} - -void wxGenericTreeCtrl::SetIndent(unsigned int indent) -{ - m_indent = (unsigned short) indent; - m_dirty = true; -} - -size_t -wxGenericTreeCtrl::GetChildrenCount(const wxTreeItemId& item, - bool recursively) const -{ - wxCHECK_MSG( item.IsOk(), 0u, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->GetChildrenCount(recursively); -} - -void wxGenericTreeCtrl::SetWindowStyle(const long styles) -{ - // Do not try to expand the root node if it hasn't been created yet - if (m_anchor && !HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) - { - // if we will hide the root, make sure children are visible - m_anchor->SetHasPlus(); - m_anchor->Expand(); - CalculatePositions(); - } - - // right now, just sets the styles. Eventually, we may - // want to update the inherited styles, but right now - // none of the parents has updatable styles - m_windowStyle = styles; - m_dirty = true; -} - -// ----------------------------------------------------------------------------- -// functions to work with tree items -// ----------------------------------------------------------------------------- - -wxString wxGenericTreeCtrl::GetItemText(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxEmptyString, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->GetText(); -} - -int wxGenericTreeCtrl::GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which) const -{ - wxCHECK_MSG( item.IsOk(), -1, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->GetImage(which); -} - -wxTreeItemData *wxGenericTreeCtrl::GetItemData(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->GetData(); -} - -wxColour wxGenericTreeCtrl::GetItemTextColour(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxNullColour, wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - return pItem->Attr().GetTextColour(); -} - -wxColour wxGenericTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxNullColour, wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - return pItem->Attr().GetBackgroundColour(); -} - -wxFont wxGenericTreeCtrl::GetItemFont(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxNullFont, wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - return pItem->Attr().GetFont(); -} - -void wxGenericTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->SetText(text); - pItem->CalculateSize(this); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemImage(const wxTreeItemId& item, - int image, - wxTreeItemIcon which) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->SetImage(image, which); - pItem->CalculateSize(this); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - if (data) - data->SetId( item ); - - ((wxGenericTreeItem*) item.m_pItem)->SetData(data); -} - -void wxGenericTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->SetHasPlus(has); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - // avoid redrawing the tree if no real change - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - if ( pItem->IsBold() != bold ) - { - pItem->SetBold(bold); - - // recalculate the item size as bold and non bold fonts have different - // widths - pItem->CalculateSize(this); - } -} - -void wxGenericTreeCtrl::SetItemDropHighlight(const wxTreeItemId& item, - bool highlight) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxColour fg, bg; - - if (highlight) - { - bg = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - fg = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - } - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->Attr().SetTextColour(fg); - pItem->Attr().SetBackgroundColour(bg); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemTextColour(const wxTreeItemId& item, - const wxColour& col) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->Attr().SetTextColour(col); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item, - const wxColour& col) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->Attr().SetBackgroundColour(col); - RefreshLine(pItem); -} - -void wxGenericTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->Attr().SetFont(font); - pItem->ResetTextSize(); - pItem->CalculateSize(this); - RefreshLine(pItem); -} - -bool wxGenericTreeCtrl::SetFont( const wxFont &font ) -{ - wxTreeCtrlBase::SetFont(font); - - m_normalFont = font ; - m_boldFont = wxFont(m_normalFont.GetPointSize(), - m_normalFont.GetFamily(), - m_normalFont.GetStyle(), - wxBOLD, - m_normalFont.GetUnderlined(), - m_normalFont.GetFaceName(), - m_normalFont.GetEncoding()); - - if (m_anchor) - m_anchor->RecursiveResetTextSize(); - - return true; -} - - -// ----------------------------------------------------------------------------- -// item status inquiries -// ----------------------------------------------------------------------------- - -bool wxGenericTreeCtrl::IsVisible(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); - - // An item is only visible if it's not a descendant of a collapsed item - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - wxGenericTreeItem* parent = pItem->GetParent(); - while (parent) - { - if (!parent->IsExpanded()) - return false; - parent = parent->GetParent(); - } - - int startX, startY; - GetViewStart(& startX, & startY); - - wxSize clientSize = GetClientSize(); - - wxRect rect; - if (!GetBoundingRect(item, rect)) - return false; - if (rect.GetWidth() == 0 || rect.GetHeight() == 0) - return false; - if (rect.GetBottom() < 0 || rect.GetTop() > clientSize.y) - return false; - if (rect.GetRight() < 0 || rect.GetLeft() > clientSize.x) - return false; - - return true; -} - -bool wxGenericTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); - - // consider that the item does have children if it has the "+" button: it - // might not have them (if it had never been expanded yet) but then it - // could have them as well and it's better to err on this side rather than - // disabling some operations which are restricted to the items with - // children for an item which does have them - return ((wxGenericTreeItem*) item.m_pItem)->HasPlus(); -} - -bool wxGenericTreeCtrl::IsExpanded(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->IsExpanded(); -} - -bool wxGenericTreeCtrl::IsSelected(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->IsSelected(); -} - -bool wxGenericTreeCtrl::IsBold(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->IsBold(); -} - -// ----------------------------------------------------------------------------- -// navigation -// ----------------------------------------------------------------------------- - -wxTreeItemId wxGenericTreeCtrl::GetItemParent(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - return ((wxGenericTreeItem*) item.m_pItem)->GetParent(); -} - -wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - cookie = 0; - return GetNextChild(item, cookie); -} - -wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); - - // it's ok to cast cookie to size_t, we never have indices big enough to - // overflow "void *" - size_t *pIndex = (size_t *)&cookie; - if ( *pIndex < children.Count() ) - { - return children.Item((*pIndex)++); - } - else - { - // there are no more of them - return wxTreeItemId(); - } -} - -#if WXWIN_COMPATIBILITY_2_4 - -wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, - long& cookie) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - cookie = 0; - return GetNextChild(item, cookie); -} - -wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, - long& cookie) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); - if ( (size_t)cookie < children.Count() ) - { - return children.Item((size_t)cookie++); - } - else - { - // there are no more of them - return wxTreeItemId(); - } -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -wxTreeItemId wxGenericTreeCtrl::GetLastChild(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); - return (children.IsEmpty() ? wxTreeItemId() : wxTreeItemId(children.Last())); -} - -wxTreeItemId wxGenericTreeCtrl::GetNextSibling(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - wxGenericTreeItem *parent = i->GetParent(); - if ( parent == NULL ) - { - // root item doesn't have any siblings - return wxTreeItemId(); - } - - wxArrayGenericTreeItems& siblings = parent->GetChildren(); - int index = siblings.Index(i); - wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? - - size_t n = (size_t)(index + 1); - return n == siblings.Count() ? wxTreeItemId() : wxTreeItemId(siblings[n]); -} - -wxTreeItemId wxGenericTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - wxGenericTreeItem *parent = i->GetParent(); - if ( parent == NULL ) - { - // root item doesn't have any siblings - return wxTreeItemId(); - } - - wxArrayGenericTreeItems& siblings = parent->GetChildren(); - int index = siblings.Index(i); - wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? - - return index == 0 ? wxTreeItemId() - : wxTreeItemId(siblings[(size_t)(index - 1)]); -} - -// Only for internal use right now, but should probably be public -wxTreeItemId wxGenericTreeCtrl::GetNext(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - - // First see if there are any children. - wxArrayGenericTreeItems& children = i->GetChildren(); - if (children.GetCount() > 0) - { - return children.Item(0); - } - else - { - // Try a sibling of this or ancestor instead - wxTreeItemId p = item; - wxTreeItemId toFind; - do - { - toFind = GetNextSibling(p); - p = GetItemParent(p); - } while (p.IsOk() && !toFind.IsOk()); - return toFind; - } -} - -wxTreeItemId wxGenericTreeCtrl::GetFirstVisibleItem() const -{ - wxTreeItemId id = GetRootItem(); - if (!id.IsOk()) - return id; - - do - { - if (IsVisible(id)) - return id; - id = GetNext(id); - } while (id.IsOk()); - - return wxTreeItemId(); -} - -wxTreeItemId wxGenericTreeCtrl::GetNextVisible(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxTreeItemId id = item; - if (id.IsOk()) - { - while (id = GetNext(id), id.IsOk()) - { - if (IsVisible(id)) - return id; - } - } - return wxTreeItemId(); -} - -wxTreeItemId wxGenericTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - - wxFAIL_MSG(wxT("not implemented")); - - return wxTreeItemId(); -} - -// called by wxTextTreeCtrl when it marks itself for deletion -void wxGenericTreeCtrl::ResetTextControl() -{ - m_textCtrl = NULL; -} - -// find the first item starting with the given prefix after the given item -wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent, - const wxString& prefixOrig) const -{ - // match is case insensitive as this is more convenient to the user: having - // to press Shift-letter to go to the item starting with a capital letter - // would be too bothersome - wxString prefix = prefixOrig.Lower(); - - // determine the starting point: we shouldn't take the current item (this - // allows to switch between two items starting with the same letter just by - // pressing it) but we shouldn't jump to the next one if the user is - // continuing to type as otherwise he might easily skip the item he wanted - wxTreeItemId id = idParent; - if ( prefix.length() == 1 ) - { - id = GetNext(id); - } - - // look for the item starting with the given prefix after it - while ( id.IsOk() && !GetItemText(id).Lower().StartsWith(prefix) ) - { - id = GetNext(id); - } - - // if we haven't found anything... - if ( !id.IsOk() ) - { - // ... wrap to the beginning - id = GetRootItem(); - if ( HasFlag(wxTR_HIDE_ROOT) ) - { - // can't select virtual root - id = GetNext(id); - } - - // and try all the items (stop when we get to the one we started from) - while (id.IsOk() && id != idParent && !GetItemText(id).Lower().StartsWith(prefix) ) - { - id = GetNext(id); - } - // If we haven't found the item, id.IsOk() will be false, as per - // documentation - } - - return id; -} - -// ----------------------------------------------------------------------------- -// operations -// ----------------------------------------------------------------------------- - -wxTreeItemId wxGenericTreeCtrl::DoInsertItem(const wxTreeItemId& parentId, - size_t previous, - const wxString& text, - int image, - int selImage, - wxTreeItemData *data) -{ - wxGenericTreeItem *parent = (wxGenericTreeItem*) parentId.m_pItem; - if ( !parent ) - { - // should we give a warning here? - return AddRoot(text, image, selImage, data); - } - - m_dirty = true; // do this first so stuff below doesn't cause flicker - - wxGenericTreeItem *item = - new wxGenericTreeItem( parent, text, image, selImage, data ); - - if ( data != NULL ) - { - data->m_pItem = item; - } - - parent->Insert( item, previous == (size_t)-1 ? parent->GetChildren().size() - : previous ); - - InvalidateBestSize(); - return item; -} - -wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text, - int image, - int selImage, - wxTreeItemData *data) -{ - wxCHECK_MSG( !m_anchor, wxTreeItemId(), wxT("tree can have only one root") ); - - m_dirty = true; // do this first so stuff below doesn't cause flicker - - m_anchor = new wxGenericTreeItem((wxGenericTreeItem *)NULL, text, - image, selImage, data); - if ( data != NULL ) - { - data->m_pItem = m_anchor; - } - - if (HasFlag(wxTR_HIDE_ROOT)) - { - // if root is hidden, make sure we can navigate - // into children - m_anchor->SetHasPlus(); - m_anchor->Expand(); - } - CalculatePositions(); - - if (!HasFlag(wxTR_MULTIPLE)) - { - m_current = m_key_current = m_anchor; - m_current->SetHilight( true ); - } - - InvalidateBestSize(); - return m_anchor; -} - -wxTreeItemId wxGenericTreeCtrl::DoInsertAfter(const wxTreeItemId& parentId, - const wxTreeItemId& idPrevious, - const wxString& text, - int image, int selImage, - wxTreeItemData *data) -{ - wxGenericTreeItem *parent = (wxGenericTreeItem*) parentId.m_pItem; - if ( !parent ) - { - // should we give a warning here? - return AddRoot(text, image, selImage, data); - } - - int index = -1; - if (idPrevious.IsOk()) - { - index = parent->GetChildren().Index((wxGenericTreeItem*) idPrevious.m_pItem); - wxASSERT_MSG( index != wxNOT_FOUND, - wxT("previous item in wxGenericTreeCtrl::InsertItem() is not a sibling") ); - } - - return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data); -} - - -void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item) -{ - wxTreeEvent event(wxEVT_COMMAND_TREE_DELETE_ITEM, this, item); - ProcessEvent( event ); -} - -// Don't leave edit or selection on a child which is about to disappear -void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item) -{ - if (m_textCtrl != NULL && item != m_textCtrl->item() && IsDescendantOf(item, m_textCtrl->item())) { - m_textCtrl->EndEdit( true ); - } - if (item != m_key_current && IsDescendantOf(item, m_key_current)) { - m_key_current = NULL; - } - if (IsDescendantOf(item, m_select_me)) { - m_select_me = item; - } - if (item != m_current && IsDescendantOf(item, m_current)) { - m_current->SetHilight( false ); - m_current = NULL; - m_select_me = item; - } -} - -void wxGenericTreeCtrl::DeleteChildren(const wxTreeItemId& itemId) -{ - m_dirty = true; // do this first so stuff below doesn't cause flicker - - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - ChildrenClosing(item); - item->DeleteChildren(this); - InvalidateBestSize(); -} - -void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) -{ - m_dirty = true; // do this first so stuff below doesn't cause flicker - - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - if (m_textCtrl != NULL && IsDescendantOf(item, m_textCtrl->item())) - { - // can't delete the item being edited, cancel editing it first - m_textCtrl->EndEdit( true ); - } - - wxGenericTreeItem *parent = item->GetParent(); - - // don't keep stale pointers around! - if ( IsDescendantOf(item, m_key_current) ) - { - // Don't silently change the selection: - // do it properly in idle time, so event - // handlers get called. - - // m_key_current = parent; - m_key_current = NULL; - } - - // m_select_me records whether we need to select - // a different item, in idle time. - if ( m_select_me && IsDescendantOf(item, m_select_me) ) - { - m_select_me = parent; - } - - if ( IsDescendantOf(item, m_current) ) - { - // Don't silently change the selection: - // do it properly in idle time, so event - // handlers get called. - - // m_current = parent; - m_current = NULL; - m_select_me = parent; - } - - // remove the item from the tree - if ( parent ) - { - parent->GetChildren().Remove( item ); // remove by value - } - else // deleting the root - { - // nothing will be left in the tree - m_anchor = NULL; - } - - // and delete all of its children and the item itself now - item->DeleteChildren(this); - SendDeleteEvent(item); - - if (item == m_select_me) - m_select_me = NULL; - - delete item; - - InvalidateBestSize(); -} - -void wxGenericTreeCtrl::DeleteAllItems() -{ - if ( m_anchor ) - { - Delete(m_anchor); - } -} - -void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId) -{ - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - wxCHECK_RET( item, _T("invalid item in wxGenericTreeCtrl::Expand") ); - wxCHECK_RET( !HasFlag(wxTR_HIDE_ROOT) || itemId != GetRootItem(), - _T("can't expand hidden root") ); - - if ( !item->HasPlus() ) - return; - - if ( item->IsExpanded() ) - return; - - wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, this, item); - - if ( ProcessEvent( event ) && !event.IsAllowed() ) - { - // cancelled by program - return; - } - - item->Expand(); - CalculatePositions(); - - RefreshSubtree(item); - - event.SetEventType(wxEVT_COMMAND_TREE_ITEM_EXPANDED); - ProcessEvent( event ); -} - -void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) -{ - wxCHECK_RET( !HasFlag(wxTR_HIDE_ROOT) || itemId != GetRootItem(), - _T("can't collapse hidden root") ); - - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - if ( !item->IsExpanded() ) - return; - - wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, this, item); - if ( ProcessEvent( event ) && !event.IsAllowed() ) - { - // cancelled by program - return; - } - - ChildrenClosing(item); - item->Collapse(); - -#if 0 // TODO why should items be collapsed recursively? - wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.Count(); - for ( size_t n = 0; n < count; n++ ) - { - Collapse(children[n]); - } -#endif - - CalculatePositions(); - - RefreshSubtree(item); - - event.SetEventType(wxEVT_COMMAND_TREE_ITEM_COLLAPSED); - ProcessEvent( event ); -} - -void wxGenericTreeCtrl::CollapseAndReset(const wxTreeItemId& item) -{ - Collapse(item); - DeleteChildren(item); -} - -void wxGenericTreeCtrl::Toggle(const wxTreeItemId& itemId) -{ - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - if (item->IsExpanded()) - Collapse(itemId); - else - Expand(itemId); -} - -void wxGenericTreeCtrl::Unselect() -{ - if (m_current) - { - m_current->SetHilight( false ); - RefreshLine( m_current ); - - m_current = NULL; - m_select_me = NULL; - } -} - -void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item) -{ - if (item->IsSelected()) - { - item->SetHilight(false); - RefreshLine(item); - } - - if (item->HasChildren()) - { - wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.Count(); - for ( size_t n = 0; n < count; ++n ) - { - UnselectAllChildren(children[n]); - } - } -} - -void wxGenericTreeCtrl::UnselectAll() -{ - wxTreeItemId rootItem = GetRootItem(); - - // the tree might not have the root item at all - if ( rootItem ) - { - UnselectAllChildren((wxGenericTreeItem*) rootItem.m_pItem); - } -} - -// Recursive function ! -// To stop we must have crt_itemGetParent(); - - if (parent == NULL) // This is root item - return TagAllChildrenUntilLast(crt_item, last_item, select); - - wxArrayGenericTreeItems& children = parent->GetChildren(); - int index = children.Index(crt_item); - wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? - - size_t count = children.Count(); - for (size_t n=(size_t)(index+1); nSetHilight(select); - RefreshLine(crt_item); - - if (crt_item==last_item) - return true; - - if (crt_item->HasChildren()) - { - wxArrayGenericTreeItems& children = crt_item->GetChildren(); - size_t count = children.Count(); - for ( size_t n = 0; n < count; ++n ) - { - if (TagAllChildrenUntilLast(children[n], last_item, select)) - return true; - } - } - - return false; -} - -void wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2) -{ - m_select_me = NULL; - - // item2 is not necessary after item1 - // choice first' and 'last' between item1 and item2 - wxGenericTreeItem *first= (item1->GetY()GetY()) ? item1 : item2; - wxGenericTreeItem *last = (item1->GetY()GetY()) ? item2 : item1; - - bool select = m_current->IsSelected(); - - if ( TagAllChildrenUntilLast(first,last,select) ) - return; - - TagNextChildren(first,last,select); -} - -void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, - bool unselect_others, - bool extended_select) -{ - wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") ); - - m_select_me = NULL; - - bool is_single=!(GetWindowStyleFlag() & wxTR_MULTIPLE); - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - //wxCHECK_RET( ( (!unselect_others) && is_single), - // wxT("this is a single selection tree") ); - - // to keep going anyhow !!! - if (is_single) - { - if (item->IsSelected()) - return; // nothing to do - unselect_others = true; - extended_select = false; - } - else if ( unselect_others && item->IsSelected() ) - { - // selection change if there is more than one item currently selected - wxArrayTreeItemIds selected_items; - if ( GetSelections(selected_items) == 1 ) - return; - } - - wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item); - event.m_itemOld = m_current; - // TODO : Here we don't send any selection mode yet ! - - if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) - return; - - wxTreeItemId parent = GetItemParent( itemId ); - while (parent.IsOk()) - { - if (!IsExpanded(parent)) - Expand( parent ); - - parent = GetItemParent( parent ); - } - - // ctrl press - if (unselect_others) - { - if (is_single) Unselect(); // to speed up thing - else UnselectAll(); - } - - // shift press - if (extended_select) - { - if ( !m_current ) - { - m_current = m_key_current = (wxGenericTreeItem*) GetRootItem().m_pItem; - } - - // don't change the mark (m_current) - SelectItemRange(m_current, item); - } - else - { - bool select = true; // the default - - // Check if we need to toggle hilight (ctrl mode) - if (!unselect_others) - select=!item->IsSelected(); - - m_current = m_key_current = item; - m_current->SetHilight(select); - RefreshLine( m_current ); - } - - // This can cause idle processing to select the root - // if no item is selected, so it must be after the - // selection is set - EnsureVisible( itemId ); - - event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); - GetEventHandler()->ProcessEvent( event ); -} - -void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select) -{ - wxGenericTreeItem * const item = (wxGenericTreeItem*) itemId.m_pItem; - wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") ); - - if ( select ) - { - if (!item->IsSelected()) - DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE)); - } - else // deselect - { - wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item); - if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) - return; - - item->SetHilight(false); - RefreshLine(item); - - event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); - GetEventHandler()->ProcessEvent( event ); - } -} - -void wxGenericTreeCtrl::FillArray(wxGenericTreeItem *item, - wxArrayTreeItemIds &array) const -{ - if ( item->IsSelected() ) - array.Add(wxTreeItemId(item)); - - if ( item->HasChildren() ) - { - wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.GetCount(); - for ( size_t n = 0; n < count; ++n ) - FillArray(children[n], array); - } -} - -size_t wxGenericTreeCtrl::GetSelections(wxArrayTreeItemIds &array) const -{ - array.Empty(); - wxTreeItemId idRoot = GetRootItem(); - if ( idRoot.IsOk() ) - { - FillArray((wxGenericTreeItem*) idRoot.m_pItem, array); - } - //else: the tree is empty, so no selections - - return array.Count(); -} - -void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - if (!item.IsOk()) return; - - wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem; - - // first expand all parent branches - wxGenericTreeItem *parent = gitem->GetParent(); - - if ( HasFlag(wxTR_HIDE_ROOT) ) - { - while ( parent && parent != m_anchor ) - { - Expand(parent); - parent = parent->GetParent(); - } - } - else - { - while ( parent ) - { - Expand(parent); - parent = parent->GetParent(); - } - } - - //if (parent) CalculatePositions(); - - ScrollTo(item); -} - -void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item) -{ - if (!item.IsOk()) return; - - // We have to call this here because the label in - // question might just have been added and no screen - // update taken place. - if (m_dirty) -#if defined( __WXMSW__ ) || defined(__WXMAC__) - Update(); -#else - DoDirtyProcessing(); -#endif - wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem; - - // now scroll to the item - int item_y = gitem->GetY(); - - int start_x = 0; - int start_y = 0; - GetViewStart( &start_x, &start_y ); - start_y *= PIXELS_PER_UNIT; - - int client_h = 0; - int client_w = 0; - GetClientSize( &client_w, &client_h ); - - if (item_y < start_y+3) - { - // going down - int x = 0; - int y = 0; - m_anchor->GetSize( x, y, this ); - y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - int x_pos = GetScrollPos( wxHORIZONTAL ); - // Item should appear at top - SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, item_y/PIXELS_PER_UNIT ); - } - else if (item_y+GetLineHeight(gitem) > start_y+client_h) - { - // going up - int x = 0; - int y = 0; - m_anchor->GetSize( x, y, this ); - y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - item_y += PIXELS_PER_UNIT+2; - int x_pos = GetScrollPos( wxHORIZONTAL ); - // Item should appear at bottom - SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, (item_y+GetLineHeight(gitem)-client_h)/PIXELS_PER_UNIT ); - } -} - -// FIXME: tree sorting functions are not reentrant and not MT-safe! -static wxGenericTreeCtrl *s_treeBeingSorted = NULL; - -static int LINKAGEMODE tree_ctrl_compare_func(wxGenericTreeItem **item1, - wxGenericTreeItem **item2) -{ - wxCHECK_MSG( s_treeBeingSorted, 0, wxT("bug in wxGenericTreeCtrl::SortChildren()") ); - - return s_treeBeingSorted->OnCompareItems(*item1, *item2); -} - -void wxGenericTreeCtrl::SortChildren(const wxTreeItemId& itemId) -{ - wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - - wxCHECK_RET( !s_treeBeingSorted, - wxT("wxGenericTreeCtrl::SortChildren is not reentrant") ); - - wxArrayGenericTreeItems& children = item->GetChildren(); - if ( children.Count() > 1 ) - { - m_dirty = true; - - s_treeBeingSorted = this; - children.Sort(tree_ctrl_compare_func); - s_treeBeingSorted = NULL; - } - //else: don't make the tree dirty as nothing changed -} - -void wxGenericTreeCtrl::CalculateLineHeight() -{ - wxClientDC dc(this); - m_lineHeight = (int)(dc.GetCharHeight() + 4); - - if ( m_imageListNormal ) - { - // Calculate a m_lineHeight value from the normal Image sizes. - // May be toggle off. Then wxGenericTreeCtrl will spread when - // necessary (which might look ugly). - int n = m_imageListNormal->GetImageCount(); - for (int i = 0; i < n ; i++) - { - int width = 0, height = 0; - m_imageListNormal->GetSize(i, width, height); - if (height > m_lineHeight) m_lineHeight = height; - } - } - - if (m_imageListButtons) - { - // Calculate a m_lineHeight value from the Button image sizes. - // May be toggle off. Then wxGenericTreeCtrl will spread when - // necessary (which might look ugly). - int n = m_imageListButtons->GetImageCount(); - for (int i = 0; i < n ; i++) - { - int width = 0, height = 0; - m_imageListButtons->GetSize(i, width, height); - if (height > m_lineHeight) m_lineHeight = height; - } - } - - if (m_lineHeight < 30) - m_lineHeight += 2; // at least 2 pixels - else - m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing -} - -void wxGenericTreeCtrl::SetImageList(wxImageList *imageList) -{ - if (m_ownsImageListNormal) delete m_imageListNormal; - m_imageListNormal = imageList; - m_ownsImageListNormal = false; - m_dirty = true; - - if (m_anchor) - m_anchor->RecursiveResetSize(); - - // Don't do any drawing if we're setting the list to NULL, - // since we may be in the process of deleting the tree control. - if (imageList) - CalculateLineHeight(); -} - -void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList) -{ - if (m_ownsImageListState) delete m_imageListState; - m_imageListState = imageList; - m_ownsImageListState = false; -} - -void wxGenericTreeCtrl::SetButtonsImageList(wxImageList *imageList) -{ - if (m_ownsImageListButtons) delete m_imageListButtons; - m_imageListButtons = imageList; - m_ownsImageListButtons = false; - m_dirty = true; - - if (m_anchor) - m_anchor->RecursiveResetSize(); - - CalculateLineHeight(); -} - -void wxGenericTreeCtrl::AssignButtonsImageList(wxImageList *imageList) -{ - SetButtonsImageList(imageList); - m_ownsImageListButtons = true; -} - -// ----------------------------------------------------------------------------- -// helpers -// ----------------------------------------------------------------------------- - -void wxGenericTreeCtrl::AdjustMyScrollbars() -{ - if (m_anchor) - { - int x = 0, y = 0; - m_anchor->GetSize( x, y, this ); - y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels - int x_pos = GetScrollPos( wxHORIZONTAL ); - int y_pos = GetScrollPos( wxVERTICAL ); - SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, y_pos ); - } - else - { - SetScrollbars( 0, 0, 0, 0 ); - } -} - -int wxGenericTreeCtrl::GetLineHeight(wxGenericTreeItem *item) const -{ - if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT) - return item->GetHeight(); - else - return m_lineHeight; -} - -void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) -{ - item->SetFont(this, dc); - - wxCoord text_h = item->GetTextHeight(); - - int image_h = 0, image_w = 0; - int image = item->GetCurrentImage(); - if ( image != NO_IMAGE ) - { - if ( m_imageListNormal ) - { - m_imageListNormal->GetSize( image, image_w, image_h ); - image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - else - { - image = NO_IMAGE; - } - } - - int total_h = GetLineHeight(item); - bool drawItemBackground = false, - hasBgColour = false; - - if ( item->IsSelected() ) - { - dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush)); - drawItemBackground = true; - } - else - { - wxColour colBg; - wxTreeItemAttr * const attr = item->GetAttributes(); - if ( attr && attr->HasBackgroundColour() ) - { - drawItemBackground = - hasBgColour = true; - colBg = attr->GetBackgroundColour(); - } - else - { - colBg = GetBackgroundColour(); - } - dc.SetBrush(wxBrush(colBg, wxSOLID)); - } - - int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0; - - if ( HasFlag(wxTR_FULL_ROW_HIGHLIGHT) ) - { - int x = 0, w = 0, h = 0; - GetVirtualSize(&w, &h); - wxRect rect( x, item->GetY()+offset, w, total_h-offset); -#if !defined(__WXGTK20__) && !defined(__WXMAC__) - dc.DrawRectangle(rect); -#else - if (!item->IsSelected()) - { - dc.DrawRectangle(rect); - } - else - { - int flags = wxCONTROL_SELECTED; - if (m_hasFocus -#ifdef __WXMAC__ - && IsControlActive( (ControlRef)GetHandle() ) -#endif - ) - flags |= wxCONTROL_FOCUSED; - if ((item == m_current) && (m_hasFocus)) - flags |= wxCONTROL_CURRENT; - wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); - } -#endif - } - else - { - if ( item->IsSelected() && image != NO_IMAGE ) - { - // If it's selected, and there's an image, then we should - // take care to leave the area under the image painted in the - // background colour. - wxRect rect( item->GetX() + image_w - 2, item->GetY()+offset, - item->GetWidth() - image_w + 2, total_h-offset ); -#if !defined(__WXGTK20__) && !defined(__WXMAC__) - dc.DrawRectangle( rect ); -#else - rect.x -= 1; - rect.width += 2; - - int flags = wxCONTROL_SELECTED; - if (m_hasFocus) - flags |= wxCONTROL_FOCUSED; - if ((item == m_current) && (m_hasFocus)) - flags |= wxCONTROL_CURRENT; - wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); -#endif - } - // On GTK+ 2, drawing a 'normal' background is wrong for themes that - // don't allow backgrounds to be customized. Not drawing the background, - // except for custom item backgrounds, works for both kinds of theme. - else if (drawItemBackground) - { - wxRect rect( item->GetX()-2, item->GetY()+offset, - item->GetWidth()+2, total_h-offset ); -#if !defined(__WXGTK20__) && !defined(__WXMAC__) - dc.DrawRectangle( rect ); -#else - if ( hasBgColour ) - { - dc.DrawRectangle( rect ); - } - else - { - rect.x -= 1; - rect.width += 2; - - int flags = wxCONTROL_SELECTED; - if (m_hasFocus) - flags |= wxCONTROL_FOCUSED; - if ((item == m_current) && (m_hasFocus)) - flags |= wxCONTROL_CURRENT; - wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); - } -#endif - } - } - - if ( image != NO_IMAGE ) - { - dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h ); - m_imageListNormal->Draw( image, dc, - item->GetX(), - item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0), - wxIMAGELIST_DRAW_TRANSPARENT ); - dc.DestroyClippingRegion(); - } - - dc.SetBackgroundMode(wxTRANSPARENT); - int extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0; - dc.DrawText( item->GetText(), - (wxCoord)(image_w + item->GetX()), - (wxCoord)(item->GetY() + extraH)); - - // restore normal font - dc.SetFont( m_normalFont ); -} - -// Now y stands for the top of the item, whereas it used to stand for middle ! -void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) -{ - int x = level*m_indent; - if (!HasFlag(wxTR_HIDE_ROOT)) - { - x += m_indent; - } - else if (level == 0) - { - // always expand hidden root - int origY = y; - wxArrayGenericTreeItems& children = item->GetChildren(); - int count = children.Count(); - if (count > 0) - { - int n = 0, oldY; - do { - oldY = y; - PaintLevel(children[n], dc, 1, y); - } while (++n < count); - - if (!HasFlag(wxTR_NO_LINES) && HasFlag(wxTR_LINES_AT_ROOT) && count > 0) - { - // draw line down to last child - origY += GetLineHeight(children[0])>>1; - oldY += GetLineHeight(children[n-1])>>1; - dc.DrawLine(3, origY, 3, oldY); - } - } - return; - } - - item->SetX(x+m_spacing); - item->SetY(y); - - int h = GetLineHeight(item); - int y_top = y; - int y_mid = y_top + (h>>1); - y += h; - - int exposed_x = dc.LogicalToDeviceX(0); - int exposed_y = dc.LogicalToDeviceY(y_top); - - if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much - { - const wxPen *pen = -#ifndef __WXMAC__ - // don't draw rect outline if we already have the - // background color under Mac - (item->IsSelected() && m_hasFocus) ? wxBLACK_PEN : -#endif // !__WXMAC__ - wxTRANSPARENT_PEN; - - wxColour colText; - if ( item->IsSelected() -#ifdef __WXMAC__ - // On wxMac, if the tree doesn't have the focus we draw an empty - // rectangle, so we want to make sure that the text is visible - // against the normal background, not the highlightbackground, so - // don't use the highlight text colour unless we have the focus. - && m_hasFocus && IsControlActive( (ControlRef)GetHandle() ) -#endif - ) - { -#ifdef __WXMAC__ - colText = *wxWHITE; -#else - if (m_hasFocus) - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); -#endif - } - else - { - wxTreeItemAttr *attr = item->GetAttributes(); - if (attr && attr->HasTextColour()) - colText = attr->GetTextColour(); - else - colText = GetForegroundColour(); - } - - // prepare to draw - dc.SetTextForeground(colText); - dc.SetPen(*pen); - - // draw - PaintItem(item, dc); - - if (HasFlag(wxTR_ROW_LINES)) - { - // if the background colour is white, choose a - // contrasting color for the lines - dc.SetPen(*((GetBackgroundColour() == *wxWHITE) - ? wxMEDIUM_GREY_PEN : wxWHITE_PEN)); - dc.DrawLine(0, y_top, 10000, y_top); - dc.DrawLine(0, y, 10000, y); - } - - // restore DC objects - dc.SetBrush(*wxWHITE_BRUSH); - dc.SetPen(m_dottedPen); - dc.SetTextForeground(*wxBLACK); - - if ( !HasFlag(wxTR_NO_LINES) ) - { - // draw the horizontal line here - int x_start = x; - if (x > (signed)m_indent) - x_start -= m_indent; - else if (HasFlag(wxTR_LINES_AT_ROOT)) - x_start = 3; - dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid); - } - - // should the item show a button? - if ( item->HasPlus() && HasButtons() ) - { - if ( m_imageListButtons ) - { - // draw the image button here - int image_h = 0, - image_w = 0; - int image = item->IsExpanded() ? wxTreeItemIcon_Expanded - : wxTreeItemIcon_Normal; - if ( item->IsSelected() ) - image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal; - - m_imageListButtons->GetSize(image, image_w, image_h); - int xx = x - image_w/2; - int yy = y_mid - image_h/2; - - wxDCClipper clip(dc, xx, yy, image_w, image_h); - m_imageListButtons->Draw(image, dc, xx, yy, - wxIMAGELIST_DRAW_TRANSPARENT); - } - else // no custom buttons - { - static const int wImage = 9; - static const int hImage = 9; - - int flag = 0; - if (item->IsExpanded()) - flag |= wxCONTROL_EXPANDED; - if (item == m_underMouse) - flag |= wxCONTROL_CURRENT; - - wxRendererNative::Get().DrawTreeItemButton - ( - this, - dc, - wxRect(x - wImage/2, - y_mid - hImage/2, - wImage, hImage), - flag - ); - } - } - } - - if (item->IsExpanded()) - { - wxArrayGenericTreeItems& children = item->GetChildren(); - int count = children.Count(); - if (count > 0) - { - int n = 0, oldY; - ++level; - do { - oldY = y; - PaintLevel(children[n], dc, level, y); - } while (++n < count); - - if (!HasFlag(wxTR_NO_LINES) && count > 0) - { - // draw line down to last child - oldY += GetLineHeight(children[n-1])>>1; - if (HasButtons()) y_mid += 5; - - // Only draw the portion of the line that is visible, in case it is huge - wxCoord xOrigin=0, yOrigin=0, width, height; - dc.GetDeviceOrigin(&xOrigin, &yOrigin); - yOrigin = abs(yOrigin); - GetClientSize(&width, &height); - - // Move end points to the begining/end of the view? - if (y_mid < yOrigin) - y_mid = yOrigin; - if (oldY > yOrigin + height) - oldY = yOrigin + height; - - // after the adjustments if y_mid is larger than oldY then the line - // isn't visible at all so don't draw anything - if (y_mid < oldY) - dc.DrawLine(x, y_mid, x, oldY); - } - } - } -} - -void wxGenericTreeCtrl::DrawDropEffect(wxGenericTreeItem *item) -{ - if ( item ) - { - if ( item->HasPlus() ) - { - // it's a folder, indicate it by a border - DrawBorder(item); - } - else - { - // draw a line under the drop target because the item will be - // dropped there - DrawLine(item, !m_dropEffectAboveItem ); - } - - SetCursor(wxCURSOR_BULLSEYE); - } - else - { - // can't drop here - SetCursor(wxCURSOR_NO_ENTRY); - } -} - -void wxGenericTreeCtrl::DrawBorder(const wxTreeItemId &item) -{ - wxCHECK_RET( item.IsOk(), _T("invalid item in wxGenericTreeCtrl::DrawLine") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - - wxClientDC dc(this); - PrepareDC( dc ); - dc.SetLogicalFunction(wxINVERT); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - - int w = i->GetWidth() + 2; - int h = GetLineHeight(i) + 2; - - dc.DrawRectangle( i->GetX() - 1, i->GetY() - 1, w, h); -} - -void wxGenericTreeCtrl::DrawLine(const wxTreeItemId &item, bool below) -{ - wxCHECK_RET( item.IsOk(), _T("invalid item in wxGenericTreeCtrl::DrawLine") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - - wxClientDC dc(this); - PrepareDC( dc ); - dc.SetLogicalFunction(wxINVERT); - - int x = i->GetX(), - y = i->GetY(); - if ( below ) - { - y += GetLineHeight(i) - 1; - } - - dc.DrawLine( x, y, x + i->GetWidth(), y); -} - -// ----------------------------------------------------------------------------- -// wxWidgets callbacks -// ----------------------------------------------------------------------------- - -void wxGenericTreeCtrl::OnSize( wxSizeEvent &event ) -{ -#ifdef __WXGTK__ - if (HasFlag( wxTR_FULL_ROW_HIGHLIGHT) && m_current) - RefreshLine( m_current ); -#endif - - event.Skip(true); -} - -void wxGenericTreeCtrl::OnPaint( wxPaintEvent &WXUNUSED(event) ) -{ - wxPaintDC dc(this); - PrepareDC( dc ); - - if ( !m_anchor) - return; - - dc.SetFont( m_normalFont ); - dc.SetPen( m_dottedPen ); - - // this is now done dynamically - //if(GetImageList() == NULL) - // m_lineHeight = (int)(dc.GetCharHeight() + 4); - - int y = 2; - PaintLevel( m_anchor, dc, 0, y ); -} - -void wxGenericTreeCtrl::OnSetFocus( wxFocusEvent &event ) -{ - m_hasFocus = true; - - RefreshSelected(); - - event.Skip(); -} - -void wxGenericTreeCtrl::OnKillFocus( wxFocusEvent &event ) -{ - m_hasFocus = false; - - RefreshSelected(); - - event.Skip(); -} - -void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) -{ - wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, this); - te.m_evtKey = event; - if ( GetEventHandler()->ProcessEvent( te ) ) - { - // intercepted by the user code - return; - } - - if ( (m_current == 0) || (m_key_current == 0) ) - { - event.Skip(); - return; - } - - // how should the selection work for this event? - bool is_multiple, extended_select, unselect_others; - EventFlagsToSelType(GetWindowStyleFlag(), - event.ShiftDown(), - event.CmdDown(), - is_multiple, extended_select, unselect_others); - - if (GetLayoutDirection() == wxLayout_RightToLeft) - { - if (event.GetKeyCode() == WXK_RIGHT) - event.m_keyCode = WXK_LEFT; - else if (event.GetKeyCode() == WXK_LEFT) - event.m_keyCode = WXK_RIGHT; - } - - // + : Expand - // - : Collaspe - // * : Expand all/Collapse all - // ' ' | return : activate - // up : go up (not last children!) - // down : go down - // left : go to parent - // right : open if parent and go next - // home : go to root - // end : go to last item without opening parents - // alnum : start or continue searching for the item with this prefix - int keyCode = event.GetKeyCode(); - switch ( keyCode ) - { - case '+': - case WXK_ADD: - if (m_current->HasPlus() && !IsExpanded(m_current)) - { - Expand(m_current); - } - break; - - case '*': - case WXK_MULTIPLY: - if ( !IsExpanded(m_current) ) - { - // expand all - ExpandAllChildren(m_current); - break; - } - //else: fall through to Collapse() it - - case '-': - case WXK_SUBTRACT: - if (IsExpanded(m_current)) - { - Collapse(m_current); - } - break; - - case WXK_MENU: - { - // Use the item's bounding rectangle to determine position for the event - wxRect ItemRect; - GetBoundingRect(m_current, ItemRect, true); - - wxTreeEvent eventMenu(wxEVT_COMMAND_TREE_ITEM_MENU, this, m_current); - // Use the left edge, vertical middle - eventMenu.m_pointDrag = wxPoint(ItemRect.GetX(), - ItemRect.GetY() + ItemRect.GetHeight() / 2); - GetEventHandler()->ProcessEvent( eventMenu ); - } - break; - - case ' ': - case WXK_RETURN: - if ( !event.HasModifiers() ) - { - wxTreeEvent eventAct(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, m_current); - GetEventHandler()->ProcessEvent( eventAct ); - } - - // in any case, also generate the normal key event for this key, - // even if we generated the ACTIVATED event above: this is what - // wxMSW does and it makes sense because you might not want to - // process ACTIVATED event at all and handle Space and Return - // directly (and differently) which would be impossible otherwise - event.Skip(); - break; - - // up goes to the previous sibling or to the last - // of its children if it's expanded - case WXK_UP: - { - wxTreeItemId prev = GetPrevSibling( m_key_current ); - if (!prev) - { - prev = GetItemParent( m_key_current ); - if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) - { - break; // don't go to root if it is hidden - } - if (prev) - { - wxTreeItemIdValue cookie; - wxTreeItemId current = m_key_current; - // TODO: Huh? If we get here, we'd better be the first child of our parent. How else could it be? - if (current == GetFirstChild( prev, cookie )) - { - // otherwise we return to where we came from - DoSelectItem( prev, unselect_others, extended_select ); - m_key_current= (wxGenericTreeItem*) prev.m_pItem; - break; - } - } - } - if (prev) - { - while ( IsExpanded(prev) && HasChildren(prev) ) - { - wxTreeItemId child = GetLastChild(prev); - if ( child ) - { - prev = child; - } - } - - DoSelectItem( prev, unselect_others, extended_select ); - m_key_current=(wxGenericTreeItem*) prev.m_pItem; - } - } - break; - - // left arrow goes to the parent - case WXK_LEFT: - { - wxTreeItemId prev = GetItemParent( m_current ); - if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) - { - // don't go to root if it is hidden - prev = GetPrevSibling( m_current ); - } - if (prev) - { - DoSelectItem( prev, unselect_others, extended_select ); - } - } - break; - - case WXK_RIGHT: - // this works the same as the down arrow except that we - // also expand the item if it wasn't expanded yet - if (m_current != GetRootItem().m_pItem || !HasFlag(wxTR_HIDE_ROOT)) - Expand(m_current); - //else: don't try to expand hidden root item (which can be the - // current one when the tree is empty) - - // fall through - - case WXK_DOWN: - { - if (IsExpanded(m_key_current) && HasChildren(m_key_current)) - { - wxTreeItemIdValue cookie; - wxTreeItemId child = GetFirstChild( m_key_current, cookie ); - if ( !child ) - break; - - DoSelectItem( child, unselect_others, extended_select ); - m_key_current=(wxGenericTreeItem*) child.m_pItem; - } - else - { - wxTreeItemId next = GetNextSibling( m_key_current ); - if (!next) - { - wxTreeItemId current = m_key_current; - while (current.IsOk() && !next) - { - current = GetItemParent( current ); - if (current) next = GetNextSibling( current ); - } - } - if (next) - { - DoSelectItem( next, unselect_others, extended_select ); - m_key_current=(wxGenericTreeItem*) next.m_pItem; - } - } - } - break; - - // selects the last visible tree item - case WXK_END: - { - wxTreeItemId last = GetRootItem(); - - while ( last.IsOk() && IsExpanded(last) ) - { - wxTreeItemId lastChild = GetLastChild(last); - - // it may happen if the item was expanded but then all of - // its children have been deleted - so IsExpanded() returned - // true, but GetLastChild() returned invalid item - if ( !lastChild ) - break; - - last = lastChild; - } - - if ( last.IsOk() ) - { - DoSelectItem( last, unselect_others, extended_select ); - } - } - break; - - // selects the root item - case WXK_HOME: - { - wxTreeItemId prev = GetRootItem(); - if (!prev) - break; - - if ( HasFlag(wxTR_HIDE_ROOT) ) - { - wxTreeItemIdValue cookie; - prev = GetFirstChild(prev, cookie); - if (!prev) - break; - } - - DoSelectItem( prev, unselect_others, extended_select ); - } - break; - - default: - // do not use wxIsalnum() here - if ( !event.HasModifiers() && - ((keyCode >= '0' && keyCode <= '9') || - (keyCode >= 'a' && keyCode <= 'z') || - (keyCode >= 'A' && keyCode <= 'Z' ))) - { - // find the next item starting with the given prefix - wxChar ch = (wxChar)keyCode; - - wxTreeItemId id = FindItem(m_current, m_findPrefix + ch); - if ( !id.IsOk() ) - { - // no such item - break; - } - - SelectItem(id); - - m_findPrefix += ch; - - // also start the timer to reset the current prefix if the user - // doesn't press any more alnum keys soon -- we wouldn't want - // to use this prefix for a new item search - if ( !m_findTimer ) - { - m_findTimer = new wxTreeFindTimer(this); - } - - m_findTimer->Start(wxTreeFindTimer::DELAY, wxTIMER_ONE_SHOT); - } - else - { - event.Skip(); - } - } -} - -wxTreeItemId -wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const -{ - int w, h; - GetSize(&w, &h); - flags=0; - if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT; - if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT; - if (point.y<0) flags |= wxTREE_HITTEST_ABOVE; - if (point.y>h) flags |= wxTREE_HITTEST_BELOW; - if (flags) return wxTreeItemId(); - - if (m_anchor == NULL) - { - flags = wxTREE_HITTEST_NOWHERE; - return wxTreeItemId(); - } - - wxGenericTreeItem *hit = m_anchor->HitTest(CalcUnscrolledPosition(point), - this, flags, 0); - if (hit == NULL) - { - flags = wxTREE_HITTEST_NOWHERE; - return wxTreeItemId(); - } - return hit; -} - -// get the bounding rectangle of the item (or of its label only) -bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly) const -{ - wxCHECK_MSG( item.IsOk(), false, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") ); - - wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - - if ( textOnly ) - { - rect.x = i->GetX(); - rect.width = i->GetWidth(); - - if ( m_imageListNormal ) - { - int image = ((wxGenericTreeItem*) item.m_pItem)->GetCurrentImage(); - if ( image != NO_IMAGE ) - { - int image_w, image_h; - m_imageListNormal->GetSize( image, image_w, image_h ); - rect.width += image_w + MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - } - } - else // the entire line - { - rect.x = 0; - rect.width = GetClientSize().x; - } - - rect.y = i->GetY(); - rect.height = GetLineHeight(i); - - // we have to return the logical coordinates, not physical ones - rect.SetTopLeft(CalcScrolledPosition(rect.GetTopLeft())); - - return true; -} - -wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, - wxClassInfo * WXUNUSED(textCtrlClass)) -{ - wxCHECK_MSG( item.IsOk(), NULL, _T("can't edit an invalid item") ); - - wxGenericTreeItem *itemEdit = (wxGenericTreeItem *)item.m_pItem; - - wxTreeEvent te(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, this, itemEdit); - if ( GetEventHandler()->ProcessEvent( te ) && !te.IsAllowed() ) - { - // vetoed by user - return NULL; - } - - // We have to call this here because the label in - // question might just have been added and no screen - // update taken place. - if ( m_dirty ) -#if defined( __WXMSW__ ) || defined(__WXMAC__) - Update(); -#else - DoDirtyProcessing(); -#endif - - // TODO: use textCtrlClass here to create the control of correct class - m_textCtrl = new wxTreeTextCtrl(this, itemEdit); - - m_textCtrl->SetFocus(); - - return m_textCtrl; -} - -// returns a pointer to the text edit control if the item is being -// edited, NULL otherwise (it's assumed that no more than one item may -// be edited simultaneously) -wxTextCtrl* wxGenericTreeCtrl::GetEditControl() const -{ - return m_textCtrl; -} - -void wxGenericTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), - bool discardChanges) -{ - wxCHECK_RET( m_textCtrl, _T("not editing label") ); - - m_textCtrl->EndEdit(discardChanges); -} - -bool wxGenericTreeCtrl::OnRenameAccept(wxGenericTreeItem *item, - const wxString& value) -{ - wxTreeEvent le(wxEVT_COMMAND_TREE_END_LABEL_EDIT, this, item); - le.m_label = value; - le.m_editCancelled = false; - - return !GetEventHandler()->ProcessEvent( le ) || le.IsAllowed(); -} - -void wxGenericTreeCtrl::OnRenameCancelled(wxGenericTreeItem *item) -{ - // let owner know that the edit was cancelled - wxTreeEvent le(wxEVT_COMMAND_TREE_END_LABEL_EDIT, this, item); - le.m_label = wxEmptyString; - le.m_editCancelled = true; - - GetEventHandler()->ProcessEvent( le ); -} - -void wxGenericTreeCtrl::OnRenameTimer() -{ - EditLabel( m_current ); -} - -void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) -{ - if ( !m_anchor )return; - - wxPoint pt = CalcUnscrolledPosition(event.GetPosition()); - - // Is the mouse over a tree item button? - int flags = 0; - wxGenericTreeItem *thisItem = m_anchor->HitTest(pt, this, flags, 0); - wxGenericTreeItem *underMouse = thisItem; -#if wxUSE_TOOLTIPS - bool underMouseChanged = (underMouse != m_underMouse) ; -#endif // wxUSE_TOOLTIPS - - if ((underMouse) && - (flags & wxTREE_HITTEST_ONITEMBUTTON) && - (!event.LeftIsDown()) && - (!m_isDragging) && - (!m_renameTimer || !m_renameTimer->IsRunning())) - { - } - else - { - underMouse = NULL; - } - - if (underMouse != m_underMouse) - { - if (m_underMouse) - { - // unhighlight old item - wxGenericTreeItem *tmp = m_underMouse; - m_underMouse = NULL; - RefreshLine( tmp ); - } - - m_underMouse = underMouse; - if (m_underMouse) - RefreshLine( m_underMouse ); - } - -#if wxUSE_TOOLTIPS - // Determines what item we are hovering over and need a tooltip for - wxTreeItemId hoverItem = thisItem; - - // We do not want a tooltip if we are dragging, or if the rename timer is running - if (underMouseChanged && hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning())) - { - // Ask the tree control what tooltip (if any) should be shown - wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, this, hoverItem); - - if ( GetEventHandler()->ProcessEvent(hevent) && hevent.IsAllowed() ) - { - SetToolTip(hevent.m_label); - } - } -#endif - - // we process left mouse up event (enables in-place edit), middle/right down - // (pass to the user code), left dbl click (activate item) and - // dragging/moving events for items drag-and-drop - if ( !(event.LeftDown() || - event.LeftUp() || - event.MiddleDown() || - event.RightDown() || - event.LeftDClick() || - event.Dragging() || - ((event.Moving() || event.RightUp()) && m_isDragging)) ) - { - event.Skip(); - - return; - } - - - flags = 0; - wxGenericTreeItem *item = m_anchor->HitTest(pt, this, flags, 0); - - if ( event.Dragging() && !m_isDragging ) - { - if (m_dragCount == 0) - m_dragStart = pt; - - m_dragCount++; - - if (m_dragCount != 3) - { - // wait until user drags a bit further... - return; - } - - wxEventType command = event.RightIsDown() - ? wxEVT_COMMAND_TREE_BEGIN_RDRAG - : wxEVT_COMMAND_TREE_BEGIN_DRAG; - - wxTreeEvent nevent(command, this, m_current); - nevent.SetPoint(CalcScrolledPosition(pt)); - - // by default the dragging is not supported, the user code must - // explicitly allow the event for it to take place - nevent.Veto(); - - if ( GetEventHandler()->ProcessEvent(nevent) && nevent.IsAllowed() ) - { - // we're going to drag this item - m_isDragging = true; - - // remember the old cursor because we will change it while - // dragging - m_oldCursor = m_cursor; - - // in a single selection control, hide the selection temporarily - if ( !(GetWindowStyleFlag() & wxTR_MULTIPLE) ) - { - m_oldSelection = (wxGenericTreeItem*) GetSelection().m_pItem; - - if ( m_oldSelection ) - { - m_oldSelection->SetHilight(false); - RefreshLine(m_oldSelection); - } - } - - CaptureMouse(); - } - } - else if ( event.Dragging() ) - { - if ( item != m_dropTarget ) - { - // unhighlight the previous drop target - DrawDropEffect(m_dropTarget); - - m_dropTarget = item; - - // highlight the current drop target if any - DrawDropEffect(m_dropTarget); - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) - Update(); -#else - wxYieldIfNeeded(); -#endif - } - } - else if ( (event.LeftUp() || event.RightUp()) && m_isDragging ) - { - ReleaseMouse(); - - // erase the highlighting - DrawDropEffect(m_dropTarget); - - if ( m_oldSelection ) - { - m_oldSelection->SetHilight(true); - RefreshLine(m_oldSelection); - m_oldSelection = (wxGenericTreeItem *)NULL; - } - - // generate the drag end event - wxTreeEvent eventEndDrag(wxEVT_COMMAND_TREE_END_DRAG, this, item); - - eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); - - (void)GetEventHandler()->ProcessEvent(eventEndDrag); - - m_isDragging = false; - m_dropTarget = (wxGenericTreeItem *)NULL; - - SetCursor(m_oldCursor); - -#if defined( __WXMSW__ ) || defined(__WXMAC__) - Update(); -#else - wxYieldIfNeeded(); -#endif - } - else - { - // If we got to this point, we are not dragging or moving the mouse. - // Because the code in carbon/toplevel.cpp will only set focus to the tree - // if we skip for EVT_LEFT_DOWN, we MUST skip this event here for focus to work. - // We skip even if we didn't hit an item because we still should - // restore focus to the tree control even if we didn't exactly hit an item. - if ( event.LeftDown() ) - { - event.Skip(); - } - - // here we process only the messages which happen on tree items - - m_dragCount = 0; - - if (item == NULL) return; /* we hit the blank area */ - - if ( event.RightDown() ) - { - // If the item is already selected, do not update the selection. - // Multi-selections should not be cleared if a selected item is clicked. - if (!IsSelected(item)) - { - DoSelectItem(item, true, false); - } - - wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, this, item); - nevent.m_pointDrag = CalcScrolledPosition(pt); - event.Skip(!GetEventHandler()->ProcessEvent(nevent)); - - // Consistent with MSW (for now), send the ITEM_MENU *after* - // the RIGHT_CLICK event. TODO: This behavior may change. - wxTreeEvent nevent2(wxEVT_COMMAND_TREE_ITEM_MENU, this, item); - nevent2.m_pointDrag = CalcScrolledPosition(pt); - GetEventHandler()->ProcessEvent(nevent2); - } - else if ( event.MiddleDown() ) - { - wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, this, item); - nevent.m_pointDrag = CalcScrolledPosition(pt); - event.Skip(!GetEventHandler()->ProcessEvent(nevent)); - } - else if ( event.LeftUp() ) - { - // this facilitates multiple-item drag-and-drop - - if ( /* item && */ HasFlag(wxTR_MULTIPLE)) - { - wxArrayTreeItemIds selections; - size_t count = GetSelections(selections); - - if (count > 1 && - !event.CmdDown() && - !event.ShiftDown()) - { - DoSelectItem(item, true, false); - } - } - - if ( m_lastOnSame ) - { - if ( (item == m_current) && - (flags & wxTREE_HITTEST_ONITEMLABEL) && - HasFlag(wxTR_EDIT_LABELS) ) - { - if ( m_renameTimer ) - { - if ( m_renameTimer->IsRunning() ) - m_renameTimer->Stop(); - } - else - { - m_renameTimer = new wxTreeRenameTimer( this ); - } - - m_renameTimer->Start( wxTreeRenameTimer::DELAY, true ); - } - - m_lastOnSame = false; - } - } - else // !RightDown() && !MiddleDown() && !LeftUp() ==> LeftDown() || LeftDClick() - { - if ( event.LeftDown() ) - { - m_lastOnSame = item == m_current; - } - - if ( flags & wxTREE_HITTEST_ONITEMBUTTON ) - { - // only toggle the item for a single click, double click on - // the button doesn't do anything (it toggles the item twice) - if ( event.LeftDown() ) - { - Toggle( item ); - } - - // don't select the item if the button was clicked - return; - } - - - // clear the previously selected items, if the - // user clicked outside of the present selection. - // otherwise, perform the deselection on mouse-up. - // this allows multiple drag and drop to work. - // but if Cmd is down, toggle selection of the clicked item - if (!IsSelected(item) || event.CmdDown()) - { - // how should the selection work for this event? - bool is_multiple, extended_select, unselect_others; - EventFlagsToSelType(GetWindowStyleFlag(), - event.ShiftDown(), - event.CmdDown(), - is_multiple, extended_select, unselect_others); - - DoSelectItem(item, unselect_others, extended_select); - } - - - // For some reason, Windows isn't recognizing a left double-click, - // so we need to simulate it here. Allow 200 milliseconds for now. - if ( event.LeftDClick() ) - { - // double clicking should not start editing the item label - if ( m_renameTimer ) - m_renameTimer->Stop(); - - m_lastOnSame = false; - - // send activate event first - wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, item); - nevent.m_pointDrag = CalcScrolledPosition(pt); - if ( !GetEventHandler()->ProcessEvent( nevent ) ) - { - // if the user code didn't process the activate event, - // handle it ourselves by toggling the item when it is - // double clicked - if ( item->HasPlus() ) - { - Toggle(item); - } - } - } - } - } -} - -void wxGenericTreeCtrl::OnInternalIdle() -{ - wxWindow::OnInternalIdle(); - - // Check if we need to select the root item - // because nothing else has been selected. - // Delaying it means that we can invoke event handlers - // as required, when a first item is selected. - if (!HasFlag(wxTR_MULTIPLE) && !GetSelection().IsOk()) - { - if (m_select_me) - SelectItem(m_select_me); - else if (GetRootItem().IsOk()) - SelectItem(GetRootItem()); - } - - // after all changes have been done to the tree control, - // actually redraw the tree when everything is over - if (m_dirty) - DoDirtyProcessing(); -} - -void wxGenericTreeCtrl::CalculateSize( wxGenericTreeItem *WXUNUSED(item), wxDC &WXUNUSED(dc) ) -{ - // Should not be called anymore, keeping for ABI compatibility. -} - -// ----------------------------------------------------------------------------- -// for developper : y is now the top of the level -// not the middle of it ! -void wxGenericTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) -{ - int x = level*m_indent; - if (!HasFlag(wxTR_HIDE_ROOT)) - { - x += m_indent; - } - else if (level == 0) - { - // a hidden root is not evaluated, but its - // children are always calculated - goto Recurse; - } - - item->CalculateSize(this, dc); - - // set its position - item->SetX( x+m_spacing ); - item->SetY( y ); - y += GetLineHeight(item); - - if ( !item->IsExpanded() ) - { - // we don't need to calculate collapsed branches - return; - } - - Recurse: - wxArrayGenericTreeItems& children = item->GetChildren(); - size_t n, count = children.Count(); - ++level; - for (n = 0; n < count; ++n ) - CalculateLevel( children[n], dc, level, y ); // recurse -} - -void wxGenericTreeCtrl::CalculatePositions() -{ - if ( !m_anchor ) return; - - wxClientDC dc(this); - PrepareDC( dc ); - - dc.SetFont( m_normalFont ); - - dc.SetPen( m_dottedPen ); - - m_anchor->CalculateSize(this, dc); - - int y = 2; - CalculateLevel( m_anchor, dc, 0, y ); // start recursion -} - -void wxGenericTreeCtrl::Refresh(bool eraseBackground, const wxRect *rect) -{ - if ( !m_freezeCount ) - wxTreeCtrlBase::Refresh(eraseBackground, rect); -} - -void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) -{ - if (m_dirty || m_freezeCount) - return; - - wxSize client = GetClientSize(); - - wxRect rect; - CalcScrolledPosition(0, item->GetY(), NULL, &rect.y); - rect.width = client.x; - rect.height = client.y; - - Refresh(true, &rect); - - AdjustMyScrollbars(); -} - -void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) -{ - if (m_dirty || m_freezeCount) - return; - - wxRect rect; - CalcScrolledPosition(0, item->GetY(), NULL, &rect.y); - rect.width = GetClientSize().x; - rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6; - - Refresh(true, &rect); -} - -void wxGenericTreeCtrl::RefreshSelected() -{ - if (m_freezeCount) - return; - - // TODO: this is awfully inefficient, we should keep the list of all - // selected items internally, should be much faster - if ( m_anchor ) - RefreshSelectedUnder(m_anchor); -} - -void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item) -{ - if (m_freezeCount) - return; - - if ( item->IsSelected() ) - RefreshLine(item); - - const wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - RefreshSelectedUnder(children[n]); - } -} - -void wxGenericTreeCtrl::Freeze() -{ - m_freezeCount++; -} - -void wxGenericTreeCtrl::Thaw() -{ - wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") ); - - if ( --m_freezeCount == 0 ) - { - Refresh(); - } -} - -// ---------------------------------------------------------------------------- -// changing colours: we need to refresh the tree control -// ---------------------------------------------------------------------------- - -bool wxGenericTreeCtrl::SetBackgroundColour(const wxColour& colour) -{ - if ( !wxWindow::SetBackgroundColour(colour) ) - return false; - - Refresh(); - - return true; -} - -bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour) -{ - if ( !wxWindow::SetForegroundColour(colour) ) - return false; - - Refresh(); - - return true; -} - -// Process the tooltip event, to speed up event processing. -// Doesn't actually get a tooltip. -void wxGenericTreeCtrl::OnGetToolTip( wxTreeEvent &event ) -{ - event.Veto(); -} - - -// NOTE: If using the wxListBox visual attributes works everywhere then this can -// be removed, as well as the #else case below. -#define _USE_VISATTR 0 - -//static -wxVisualAttributes -#if _USE_VISATTR -wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant variant) -#else -wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -#endif -{ -#if _USE_VISATTR - // Use the same color scheme as wxListBox - return wxListBox::GetClassDefaultAttributes(variant); -#else - wxVisualAttributes attr; - attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); - attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); - attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - return attr; -#endif -} - -#if WXWIN_COMPATIBILITY_2_4 - -int wxGenericTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const -{ - return GetItemImage(item, wxTreeItemIcon_Selected); -} - -void wxGenericTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image) -{ - SetItemImage(item, image, wxTreeItemIcon_Selected); -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -void wxGenericTreeCtrl::DoDirtyProcessing() -{ - if (m_freezeCount) - return; - - m_dirty = false; - - CalculatePositions(); - Refresh(); - AdjustMyScrollbars(); -} - -wxSize wxGenericTreeCtrl::DoGetBestSize() const -{ - // make sure all positions are calculated as normally this only done during - // idle time but we need them for base class DoGetBestSize() to return the - // correct result - wxConstCast(this, wxGenericTreeCtrl)->CalculatePositions(); - - wxSize size = wxTreeCtrlBase::DoGetBestSize(); - - // there seems to be an implicit extra border around the items, although - // I'm not really sure where does it come from -- but without this, the - // scrollbars appear in a tree with default/best size - size.IncBy(4, 4); - - // and the border has to be rounded up to a multiple of PIXELS_PER_UNIT or - // scrollbars still appear - const wxSize& borderSize = GetWindowBorderSize(); - - int dx = (size.x - borderSize.x) % PIXELS_PER_UNIT; - if ( dx ) - size.x += PIXELS_PER_UNIT - dx; - int dy = (size.y - borderSize.y) % PIXELS_PER_UNIT; - if ( dy ) - size.y += PIXELS_PER_UNIT - dy; - - // we need to update the cache too as the base class cached its own value - CacheBestSize(size); - - return size; -} - -#endif // wxUSE_TREECTRL diff --git a/Source/3rdParty/wx/src/generic/vlbox.cpp b/Source/3rdParty/wx/src/generic/vlbox.cpp deleted file mode 100644 index 70a5bc109..000000000 --- a/Source/3rdParty/wx/src/generic/vlbox.cpp +++ /dev/null @@ -1,653 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/vlbox.cpp -// Purpose: implementation of wxVListBox -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.05.03 -// RCS-ID: $Id: vlbox.cpp 53998 2008-06-06 22:55:23Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_LISTBOX - -#include "wx/vlbox.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/dcclient.h" - #include "wx/listbox.h" -#endif //WX_PRECOMP - -#include "wx/dcbuffer.h" -#include "wx/selstore.h" - -// ---------------------------------------------------------------------------- -// event tables -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow) - EVT_PAINT(wxVListBox::OnPaint) - - EVT_KEY_DOWN(wxVListBox::OnKeyDown) - EVT_LEFT_DOWN(wxVListBox::OnLeftDown) - EVT_LEFT_DCLICK(wxVListBox::OnLeftDClick) -END_EVENT_TABLE() - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxVListBox, wxVScrolledWindow) - -// ---------------------------------------------------------------------------- -// wxVListBox creation -// ---------------------------------------------------------------------------- - -void wxVListBox::Init() -{ - m_current = - m_anchor = wxNOT_FOUND; - m_selStore = NULL; -} - -bool wxVListBox::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE; - if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) ) - return false; - - if ( style & wxLB_MULTIPLE ) - m_selStore = new wxSelectionStore; - - // make sure the native widget has the right colour since we do - // transparent drawing by default - SetBackgroundColour(GetBackgroundColour()); - m_colBgSel = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - - // flicker-free drawing requires this - SetBackgroundStyle(wxBG_STYLE_CUSTOM); - - return true; -} - -wxVListBox::~wxVListBox() -{ - delete m_selStore; -} - -void wxVListBox::SetItemCount(size_t count) -{ - // don't leave the current index invalid - if ( m_current != wxNOT_FOUND && (size_t)m_current >= count ) - m_current = count - 1; // also ok when count == 0 as wxNOT_FOUND == -1 - - if ( m_selStore ) - { - // tell the selection store that our number of items has changed - m_selStore->SetItemCount(count); - } - - SetLineCount(count); -} - -// ---------------------------------------------------------------------------- -// selection handling -// ---------------------------------------------------------------------------- - -bool wxVListBox::IsSelected(size_t line) const -{ - return m_selStore ? m_selStore->IsSelected(line) : (int)line == m_current; -} - -bool wxVListBox::Select(size_t item, bool select) -{ - wxCHECK_MSG( m_selStore, false, - _T("Select() may only be used with multiselection listbox") ); - - wxCHECK_MSG( item < GetItemCount(), false, - _T("Select(): invalid item index") ); - - bool changed = m_selStore->SelectItem(item, select); - if ( changed ) - { - // selection really changed - RefreshLine(item); - } - - DoSetCurrent(item); - - return changed; -} - -bool wxVListBox::SelectRange(size_t from, size_t to) -{ - wxCHECK_MSG( m_selStore, false, - _T("SelectRange() may only be used with multiselection listbox") ); - - // make sure items are in correct order - if ( from > to ) - { - size_t tmp = from; - from = to; - to = tmp; - } - - wxCHECK_MSG( to < GetItemCount(), false, - _T("SelectRange(): invalid item index") ); - - wxArrayInt changed; - if ( !m_selStore->SelectRange(from, to, true, &changed) ) - { - // too many items have changed, we didn't record them in changed array - // so we have no choice but to refresh everything between from and to - RefreshLines(from, to); - } - else // we've got the indices of the changed items - { - const size_t count = changed.GetCount(); - if ( !count ) - { - // nothing changed - return false; - } - - // refresh just the lines which have really changed - for ( size_t n = 0; n < count; n++ ) - { - RefreshLine(changed[n]); - } - } - - // something changed - return true; -} - -bool wxVListBox::DoSelectAll(bool select) -{ - wxCHECK_MSG( m_selStore, false, - _T("SelectAll may only be used with multiselection listbox") ); - - size_t count = GetItemCount(); - if ( count ) - { - wxArrayInt changed; - if ( !m_selStore->SelectRange(0, count - 1, select) || - !changed.IsEmpty() ) - { - Refresh(); - - // something changed - return true; - } - } - - return false; -} - -bool wxVListBox::DoSetCurrent(int current) -{ - wxASSERT_MSG( current == wxNOT_FOUND || - (current >= 0 && (size_t)current < GetItemCount()), - _T("wxVListBox::DoSetCurrent(): invalid item index") ); - - if ( current == m_current ) - { - // nothing to do - return false; - } - - if ( m_current != wxNOT_FOUND ) - RefreshLine(m_current); - - m_current = current; - - if ( m_current != wxNOT_FOUND ) - { - // if the line is not visible at all, we scroll it into view but we - // don't need to refresh it -- it will be redrawn anyhow - if ( !IsVisible(m_current) ) - { - ScrollToLine(m_current); - } - else // line is at least partly visible - { - // it is, indeed, only partly visible, so scroll it into view to - // make it entirely visible - while ( (size_t)m_current == GetLastVisibleLine() && - ScrollToLine(GetVisibleBegin()+1) ) ; - - // but in any case refresh it as even if it was only partly visible - // before we need to redraw it entirely as its background changed - RefreshLine(m_current); - } - } - - return true; -} - -void wxVListBox::SendSelectedEvent() -{ - wxASSERT_MSG( m_current != wxNOT_FOUND, - _T("SendSelectedEvent() shouldn't be called") ); - - wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId()); - event.SetEventObject(this); - event.SetInt(m_current); - - (void)GetEventHandler()->ProcessEvent(event); -} - -void wxVListBox::SetSelection(int selection) -{ - wxCHECK_RET( selection == wxNOT_FOUND || - (selection >= 0 && (size_t)selection < GetItemCount()), - _T("wxVListBox::SetSelection(): invalid item index") ); - - if ( HasMultipleSelection() ) - { - if (selection != wxNOT_FOUND) - Select(selection); - else - DeselectAll(); - m_anchor = selection; - } - - DoSetCurrent(selection); -} - -size_t wxVListBox::GetSelectedCount() const -{ - return m_selStore ? m_selStore->GetSelectedCount() - : m_current == wxNOT_FOUND ? 0 : 1; -} - -int wxVListBox::GetFirstSelected(unsigned long& cookie) const -{ - cookie = 0; - - return GetNextSelected(cookie); -} - -int wxVListBox::GetNextSelected(unsigned long& cookie) const -{ - wxCHECK_MSG( m_selStore, wxNOT_FOUND, - _T("GetFirst/NextSelected() may only be used with multiselection listboxes") ); - - while ( cookie < GetItemCount() ) - { - if ( IsSelected(cookie++) ) - return cookie - 1; - } - - return wxNOT_FOUND; -} - -// ---------------------------------------------------------------------------- -// wxVListBox appearance parameters -// ---------------------------------------------------------------------------- - -void wxVListBox::SetMargins(const wxPoint& pt) -{ - if ( pt != m_ptMargins ) - { - m_ptMargins = pt; - - Refresh(); - } -} - -void wxVListBox::SetSelectionBackground(const wxColour& col) -{ - m_colBgSel = col; -} - -// ---------------------------------------------------------------------------- -// wxVListBox painting -// ---------------------------------------------------------------------------- - -wxCoord wxVListBox::OnGetLineHeight(size_t line) const -{ - return OnMeasureItem(line) + 2*m_ptMargins.y; -} - -void wxVListBox::OnDrawSeparator(wxDC& WXUNUSED(dc), - wxRect& WXUNUSED(rect), - size_t WXUNUSED(n)) const -{ -} - -void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const -{ - // we need to render selected and current items differently - const bool isSelected = IsSelected(n), - isCurrent = IsCurrent(n); - if ( isSelected || isCurrent ) - { - if ( isSelected ) - { - dc.SetBrush(wxBrush(m_colBgSel, wxSOLID)); - } - else // !selected - { - dc.SetBrush(*wxTRANSPARENT_BRUSH); - } - - dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN)); - - dc.DrawRectangle(rect); - } - //else: do nothing for the normal items -} - -void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxSize clientSize = GetClientSize(); - - wxAutoBufferedPaintDC dc(this); - - // the update rectangle - wxRect rectUpdate = GetUpdateClientRect(); - - // fill it with background colour - dc.SetBackground(GetBackgroundColour()); - dc.Clear(); - - // the bounding rectangle of the current line - wxRect rectLine; - rectLine.width = clientSize.x; - - // iterate over all visible lines - const size_t lineMax = GetVisibleEnd(); - for ( size_t line = GetFirstVisibleLine(); line < lineMax; line++ ) - { - const wxCoord hLine = OnGetLineHeight(line); - - rectLine.height = hLine; - - // and draw the ones which intersect the update rect - if ( rectLine.Intersects(rectUpdate) ) - { - // don't allow drawing outside of the lines rectangle - wxDCClipper clip(dc, rectLine); - - wxRect rect = rectLine; - OnDrawBackground(dc, rect, line); - - OnDrawSeparator(dc, rect, line); - - rect.Deflate(m_ptMargins.x, m_ptMargins.y); - OnDrawItem(dc, rect, line); - } - else // no intersection - { - if ( rectLine.GetTop() > rectUpdate.GetBottom() ) - { - // we are already below the update rect, no need to continue - // further - break; - } - //else: the next line may intersect the update rect - } - - rectLine.y += hLine; - } -} - -// ============================================================================ -// wxVListBox keyboard/mouse handling -// ============================================================================ - -void wxVListBox::DoHandleItemClick(int item, int flags) -{ - // has anything worth telling the client code about happened? - bool notify = false; - - if ( HasMultipleSelection() ) - { - // select the iteem clicked? - bool select = true; - - // NB: the keyboard interface we implement here corresponds to - // wxLB_EXTENDED rather than wxLB_MULTIPLE but this one makes more - // sense IMHO - if ( flags & ItemClick_Shift ) - { - if ( m_current != wxNOT_FOUND ) - { - if ( m_anchor == wxNOT_FOUND ) - m_anchor = m_current; - - select = false; - - // only the range from the selection anchor to new m_current - // must be selected - if ( DeselectAll() ) - notify = true; - - if ( SelectRange(m_anchor, item) ) - notify = true; - } - //else: treat it as ordinary click/keypress - } - else // Shift not pressed - { - m_anchor = item; - - if ( flags & ItemClick_Ctrl ) - { - select = false; - - if ( !(flags & ItemClick_Kbd) ) - { - Toggle(item); - - // the status of the item has definitely changed - notify = true; - } - //else: Ctrl-arrow pressed, don't change selection - } - //else: behave as in single selection case - } - - if ( select ) - { - // make the clicked item the only selection - if ( DeselectAll() ) - notify = true; - - if ( Select(item) ) - notify = true; - } - } - - // in any case the item should become the current one - if ( DoSetCurrent(item) ) - { - if ( !HasMultipleSelection() ) - { - // this has also changed the selection for single selection case - notify = true; - } - } - - if ( notify ) - { - // notify the user about the selection change - SendSelectedEvent(); - } - //else: nothing changed at all -} - -// ---------------------------------------------------------------------------- -// keyboard handling -// ---------------------------------------------------------------------------- - -void wxVListBox::OnKeyDown(wxKeyEvent& event) -{ - // flags for DoHandleItemClick() - int flags = ItemClick_Kbd; - - int current; - switch ( event.GetKeyCode() ) - { - case WXK_HOME: - current = 0; - break; - - case WXK_END: - current = GetLineCount() - 1; - break; - - case WXK_DOWN: - if ( m_current == (int)GetLineCount() - 1 ) - return; - - current = m_current + 1; - break; - - case WXK_UP: - if ( m_current == wxNOT_FOUND ) - current = GetLineCount() - 1; - else if ( m_current != 0 ) - current = m_current - 1; - else // m_current == 0 - return; - break; - - case WXK_PAGEDOWN: - PageDown(); - current = GetFirstVisibleLine(); - break; - - case WXK_PAGEUP: - if ( m_current == (int)GetFirstVisibleLine() ) - { - PageUp(); - } - - current = GetFirstVisibleLine(); - break; - - case WXK_SPACE: - // hack: pressing space should work like a mouse click rather than - // like a keyboard arrow press, so trick DoHandleItemClick() in - // thinking we were clicked - flags &= ~ItemClick_Kbd; - current = m_current; - break; - -#ifdef __WXMSW__ - case WXK_TAB: - // Since we are using wxWANTS_CHARS we need to send navigation - // events for the tabs on MSW - { - wxNavigationKeyEvent ne; - ne.SetDirection(!event.ShiftDown()); - ne.SetCurrentFocus(this); - ne.SetEventObject(this); - GetParent()->GetEventHandler()->ProcessEvent(ne); - } - // fall through to default -#endif - default: - event.Skip(); - current = 0; // just to silent the stupid compiler warnings - wxUnusedVar(current); - return; - } - - if ( event.ShiftDown() ) - flags |= ItemClick_Shift; - if ( event.ControlDown() ) - flags |= ItemClick_Ctrl; - - DoHandleItemClick(current, flags); -} - -// ---------------------------------------------------------------------------- -// wxVListBox mouse handling -// ---------------------------------------------------------------------------- - -void wxVListBox::OnLeftDown(wxMouseEvent& event) -{ - SetFocus(); - - int item = HitTest(event.GetPosition()); - - if ( item != wxNOT_FOUND ) - { - int flags = 0; - if ( event.ShiftDown() ) - flags |= ItemClick_Shift; - - // under Mac Apple-click is used in the same way as Ctrl-click - // elsewhere -#ifdef __WXMAC__ - if ( event.MetaDown() ) -#else - if ( event.ControlDown() ) -#endif - flags |= ItemClick_Ctrl; - - DoHandleItemClick(item, flags); - } -} - -void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse) -{ - int item = HitTest(eventMouse.GetPosition()); - if ( item != wxNOT_FOUND ) - { - - // if item double-clicked was not yet selected, then treat - // this event as a left-click instead - if ( item == m_current ) - { - wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId()); - event.SetEventObject(this); - event.SetInt(item); - - (void)GetEventHandler()->ProcessEvent(event); - } - else - { - OnLeftDown(eventMouse); - } - - } -} - - -// ---------------------------------------------------------------------------- -// use the same default attributes as wxListBox -// ---------------------------------------------------------------------------- - -//static -wxVisualAttributes -wxVListBox::GetClassDefaultAttributes(wxWindowVariant variant) -{ - return wxListBox::GetClassDefaultAttributes(variant); -} - -#endif diff --git a/Source/3rdParty/wx/src/generic/vscroll.cpp b/Source/3rdParty/wx/src/generic/vscroll.cpp deleted file mode 100644 index af47dca25..000000000 --- a/Source/3rdParty/wx/src/generic/vscroll.cpp +++ /dev/null @@ -1,519 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/vscroll.cpp -// Purpose: wxVScrolledWindow implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.05.03 -// RCS-ID: $Id: vscroll.cpp 57359 2008-12-15 19:09:31Z BP $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/sizer.h" -#endif - -#include "wx/vscroll.h" - -// ---------------------------------------------------------------------------- -// event tables -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxVScrolledWindow, wxPanel) - EVT_SIZE(wxVScrolledWindow::OnSize) - EVT_SCROLLWIN(wxVScrolledWindow::OnScroll) -#if wxUSE_MOUSEWHEEL - EVT_MOUSEWHEEL(wxVScrolledWindow::OnMouseWheel) -#endif -END_EVENT_TABLE() - - -// ============================================================================ -// implementation -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel) - -// ---------------------------------------------------------------------------- -// initialization -// ---------------------------------------------------------------------------- - -void wxVScrolledWindow::Init() -{ - // we're initially empty - m_lineMax = - m_lineFirst = 0; - - // this one should always be strictly positive - m_nVisible = 1; - - m_heightTotal = 0; - -#if wxUSE_MOUSEWHEEL - m_sumWheelRotation = 0; -#endif -} - -// ---------------------------------------------------------------------------- -// various helpers -// ---------------------------------------------------------------------------- - -wxCoord wxVScrolledWindow::EstimateTotalHeight() const -{ - // estimate the total height: it is impossible to call - // OnGetLineHeight() for every line because there may be too many of - // them, so we just make a guess using some lines in the beginning, - // some in the end and some in the middle - static const size_t NUM_LINES_TO_SAMPLE = 10; - - wxCoord heightTotal; - if ( m_lineMax < 3*NUM_LINES_TO_SAMPLE ) - { - // in this case calculating exactly is faster and more correct than - // guessing - heightTotal = GetLinesHeight(0, m_lineMax); - } - else // too many lines to calculate exactly - { - // look at some lines in the beginning/middle/end - heightTotal = - GetLinesHeight(0, NUM_LINES_TO_SAMPLE) + - GetLinesHeight(m_lineMax - NUM_LINES_TO_SAMPLE, m_lineMax) + - GetLinesHeight(m_lineMax/2 - NUM_LINES_TO_SAMPLE/2, - m_lineMax/2 + NUM_LINES_TO_SAMPLE/2); - - // use the height of the lines we looked as the average - heightTotal = (wxCoord) - (((float)heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); - } - - return heightTotal; -} - -wxCoord wxVScrolledWindow::GetLinesHeight(size_t lineMin, size_t lineMax) const -{ - if ( lineMin == lineMax ) - return 0; - else if ( lineMin > lineMax ) - return -GetLinesHeight(lineMax, lineMin); - //else: lineMin < lineMax - - // let the user code know that we're going to need all these lines - OnGetLinesHint(lineMin, lineMax); - - // do sum up their heights - wxCoord height = 0; - for ( size_t line = lineMin; line < lineMax; line++ ) - { - height += OnGetLineHeight(line); - } - - return height; -} - -size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast, bool full) -{ - const wxCoord hWindow = GetClientSize().y; - - // go upwards until we arrive at a line such that lineLast is not visible - // any more when it is shown - size_t lineFirst = lineLast; - wxCoord h = 0; - for ( ;; ) - { - h += OnGetLineHeight(lineFirst); - - if ( h > hWindow ) - { - // for this line to be fully visible we need to go one line - // down, but if it is enough for it to be only partly visible then - // this line will do as well - if ( full ) - { - lineFirst++; - } - - break; - } - - if ( !lineFirst ) - break; - - lineFirst--; - } - - return lineFirst; -} - -void wxVScrolledWindow::RemoveScrollbar() -{ - m_lineFirst = 0; - m_nVisible = m_lineMax; - SetScrollbar(wxVERTICAL, 0, 0, 0); -} - -void wxVScrolledWindow::UpdateScrollbar() -{ - // see how many lines can we fit on screen - const wxCoord hWindow = GetClientSize().y; - - wxCoord h = 0; - size_t line; - for ( line = m_lineFirst; line < m_lineMax; line++ ) - { - if ( h > hWindow ) - break; - - h += OnGetLineHeight(line); - } - - // if we still have remaining space below, maybe we can fit everything? - if ( h < hWindow ) - { - wxCoord hAll = h; - for ( size_t lineFirst = m_lineFirst; lineFirst > 0; lineFirst-- ) - { - hAll += OnGetLineHeight(m_lineFirst - 1); - if ( hAll > hWindow ) - break; - } - - if ( hAll < hWindow ) - { - // we don't need scrollbar at all - RemoveScrollbar(); - return; - } - } - - m_nVisible = line - m_lineFirst; - - int pageSize = m_nVisible; - if ( h > hWindow ) - { - // last line is only partially visible, we still need the scrollbar and - // so we have to "fix" pageSize because if it is equal to m_lineMax the - // scrollbar is not shown at all under MSW - pageSize--; - } - - // set the scrollbar parameters to reflect this - SetScrollbar(wxVERTICAL, m_lineFirst, pageSize, m_lineMax); -} - -// ---------------------------------------------------------------------------- -// operations -// ---------------------------------------------------------------------------- - -void wxVScrolledWindow::SetLineCount(size_t count) -{ - // save the number of lines - m_lineMax = count; - - // and our estimate for their total height - m_heightTotal = EstimateTotalHeight(); - - // recalculate the scrollbars parameters - if ( count ) - { - m_lineFirst = 1; // make sure it is != 0 - ScrollToLine(0); - } - else // no items - { - RemoveScrollbar(); - } -} - -void wxVScrolledWindow::RefreshLine(size_t line) -{ - // is this line visible? - if ( !IsVisible(line) ) - { - // no, it is useless to do anything - return; - } - - // calculate the rect occupied by this line on screen - wxRect rect; - rect.width = GetClientSize().x; - rect.height = OnGetLineHeight(line); - for ( size_t n = GetVisibleBegin(); n < line; n++ ) - { - rect.y += OnGetLineHeight(n); - } - - // do refresh it - RefreshRect(rect); -} - -void wxVScrolledWindow::RefreshLines(size_t from, size_t to) -{ - wxASSERT_MSG( from <= to, _T("RefreshLines(): empty range") ); - - // clump the range to just the visible lines -- it is useless to refresh - // the other ones - if ( from < GetVisibleBegin() ) - from = GetVisibleBegin(); - - if ( to >= GetVisibleEnd() ) - to = GetVisibleEnd(); - else - to++; - - // calculate the rect occupied by these lines on screen - wxRect rect; - rect.width = GetClientSize().x; - for ( size_t nBefore = GetVisibleBegin(); nBefore < from; nBefore++ ) - { - rect.y += OnGetLineHeight(nBefore); - } - - for ( size_t nBetween = from; nBetween < to; nBetween++ ) - { - rect.height += OnGetLineHeight(nBetween); - } - - // do refresh it - RefreshRect(rect); -} - -void wxVScrolledWindow::RefreshAll() -{ - UpdateScrollbar(); - - Refresh(); -} - -bool wxVScrolledWindow::Layout() -{ - if ( GetSizer() ) - { - // adjust the sizer dimensions/position taking into account the - // virtual size and scrolled position of the window. - - int w = 0, h = 0; - GetVirtualSize(&w, &h); - - // x is always 0 so no variable needed - int y = -GetLinesHeight(0, GetFirstVisibleLine()); - - GetSizer()->SetDimension(0, y, w, h); - return true; - } - - // fall back to default for LayoutConstraints - return wxPanel::Layout(); -} - -int wxVScrolledWindow::HitTest(wxCoord WXUNUSED(x), wxCoord y) const -{ - const size_t lineMax = GetVisibleEnd(); - for ( size_t line = GetVisibleBegin(); line < lineMax; line++ ) - { - y -= OnGetLineHeight(line); - if ( y < 0 ) - return line; - } - - return wxNOT_FOUND; -} - -// ---------------------------------------------------------------------------- -// scrolling -// ---------------------------------------------------------------------------- - -bool wxVScrolledWindow::ScrollToLine(size_t line) -{ - if ( !m_lineMax ) - { - // we're empty, code below doesn't make sense in this case - return false; - } - - // determine the real first line to scroll to: we shouldn't scroll beyond - // the end - size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1, true); - if ( line > lineFirstLast ) - line = lineFirstLast; - - // anything to do? - if ( line == m_lineFirst ) - { - // no - return false; - } - - - // remember the currently shown lines for the refresh code below - size_t lineFirstOld = GetVisibleBegin(), - lineLastOld = GetVisibleEnd(); - - m_lineFirst = line; - - - // the size of scrollbar thumb could have changed - UpdateScrollbar(); - - - // finally refresh the display -- but only redraw as few lines as possible - // to avoid flicker - if ( GetChildren().empty() && - (GetVisibleBegin() >= lineLastOld || GetVisibleEnd() <= lineFirstOld ) ) - { - // the simplest case: we don't have any old lines left, just redraw - // everything - Refresh(); - } - else // overlap between the lines we showed before and should show now - { - // Avoid scrolling visible parts of the screen on Mac -#ifdef __WXMAC__ - if (!IsShownOnScreen()) - Refresh(); - else -#endif - ScrollWindow(0, GetLinesHeight(GetVisibleBegin(), lineFirstOld)); - } - - return true; -} - -bool wxVScrolledWindow::ScrollLines(int lines) -{ - lines += m_lineFirst; - if ( lines < 0 ) - lines = 0; - - return ScrollToLine(lines); -} - -bool wxVScrolledWindow::ScrollPages(int pages) -{ - bool didSomething = false; - - while ( pages ) - { - int line; - if ( pages > 0 ) - { - line = GetVisibleEnd(); - if ( line ) - line--; - pages--; - } - else // pages < 0 - { - line = FindFirstFromBottom(GetVisibleBegin()); - pages++; - } - - didSomething = ScrollToLine(line); - } - - return didSomething; -} - -// ---------------------------------------------------------------------------- -// event handling -// ---------------------------------------------------------------------------- - -void wxVScrolledWindow::OnSize(wxSizeEvent& event) -{ - UpdateScrollbar(); - - event.Skip(); -} - -void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) -{ - size_t lineFirstNew; - - const wxEventType evtType = event.GetEventType(); - - if ( evtType == wxEVT_SCROLLWIN_TOP ) - { - lineFirstNew = 0; - } - else if ( evtType == wxEVT_SCROLLWIN_BOTTOM ) - { - lineFirstNew = m_lineMax; - } - else if ( evtType == wxEVT_SCROLLWIN_LINEUP ) - { - lineFirstNew = m_lineFirst ? m_lineFirst - 1 : 0; - } - else if ( evtType == wxEVT_SCROLLWIN_LINEDOWN ) - { - lineFirstNew = m_lineFirst + 1; - } - else if ( evtType == wxEVT_SCROLLWIN_PAGEUP ) - { - lineFirstNew = FindFirstFromBottom(m_lineFirst); - } - else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN ) - { - lineFirstNew = GetVisibleEnd(); - if ( lineFirstNew ) - lineFirstNew--; - } - else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) - { - lineFirstNew = event.GetPosition(); - } - else if ( evtType == wxEVT_SCROLLWIN_THUMBTRACK ) - { - lineFirstNew = event.GetPosition(); - } - - else // unknown scroll event? - { - wxFAIL_MSG( _T("unknown scroll event type?") ); - return; - } - - ScrollToLine(lineFirstNew); - -#ifdef __WXMAC__ - Update(); -#endif // __WXMAC__ -} - -#if wxUSE_MOUSEWHEEL - -void wxVScrolledWindow::OnMouseWheel(wxMouseEvent& event) -{ - m_sumWheelRotation += event.GetWheelRotation(); - int delta = event.GetWheelDelta(); - - // how much to scroll this time - int units_to_scroll = -(m_sumWheelRotation/delta); - if ( !units_to_scroll ) - return; - - m_sumWheelRotation += units_to_scroll*delta; - - if ( !event.IsPageScroll() ) - ScrollLines( units_to_scroll*event.GetLinesPerAction() ); - else - // scroll pages instead of lines - ScrollPages( units_to_scroll ); -} - -#endif // wxUSE_MOUSEWHEEL - diff --git a/Source/3rdParty/wx/src/jpeg/README b/Source/3rdParty/wx/src/jpeg/README deleted file mode 100644 index 86cc20669..000000000 --- a/Source/3rdParty/wx/src/jpeg/README +++ /dev/null @@ -1,385 +0,0 @@ -The Independent JPEG Group's JPEG software -========================================== - -README for release 6b of 27-Mar-1998 -==================================== - -This distribution contains the sixth public release of the Independent JPEG -Group's free JPEG software. You are welcome to redistribute this software and -to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. - -Serious users of this software (particularly those incorporating it into -larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to -our electronic mailing list. Mailing list members are notified of updates -and have a chance to participate in technical discussions, etc. - -This software is the work of Tom Lane, Philip Gladstone, Jim Boucher, -Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, -Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG -Group. - -IJG is not affiliated with the official ISO JPEG standards committee. - - -DOCUMENTATION ROADMAP -===================== - -This file contains the following sections: - -OVERVIEW General description of JPEG and the IJG software. -LEGAL ISSUES Copyright, lack of warranty, terms of distribution. -REFERENCES Where to learn more about JPEG. -ARCHIVE LOCATIONS Where to find newer versions of this software. -RELATED SOFTWARE Other stuff you should get. -FILE FORMAT WARS Software *not* to get. -TO DO Plans for future IJG releases. - -Other documentation files in the distribution are: - -User documentation: - install.doc How to configure and install the IJG software. - usage.doc Usage instructions for cjpeg, djpeg, jpegtran, - rdjpgcom, and wrjpgcom. - *.1 Unix-style man pages for programs (same info as usage.doc). - wizard.doc Advanced usage instructions for JPEG wizards only. - change.log Version-to-version change highlights. -Programmer and internal documentation: - libjpeg.doc How to use the JPEG library in your own programs. - example.c Sample code for calling the JPEG library. - structure.doc Overview of the JPEG library's internal structure. - filelist.doc Road map of IJG files. - coderules.doc Coding style rules --- please read if you contribute code. - -Please read at least the files install.doc and usage.doc. Useful information -can also be found in the JPEG FAQ (Frequently Asked Questions) article. See -ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. - -If you want to understand how the JPEG code works, we suggest reading one or -more of the REFERENCES, then looking at the documentation files (in roughly -the order listed) before diving into the code. - - -OVERVIEW -======== - -This package contains C software to implement JPEG image compression and -decompression. JPEG (pronounced "jay-peg") is a standardized compression -method for full-color and gray-scale images. JPEG is intended for compressing -"real-world" scenes; line drawings, cartoons and other non-realistic images -are not its strong suit. JPEG is lossy, meaning that the output image is not -exactly identical to the input image. Hence you must not use JPEG if you -have to have identical output bits. However, on typical photographic images, -very good compression levels can be obtained with no visible change, and -remarkably high compression levels are possible if you can tolerate a -low-quality image. For more details, see the references, or just experiment -with various compression settings. - -This software implements JPEG baseline, extended-sequential, and progressive -compression processes. Provision is made for supporting all variants of these -processes, although some uncommon parameter settings aren't implemented yet. -For legal reasons, we are not distributing code for the arithmetic-coding -variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting -the hierarchical or lossless processes defined in the standard. - -We provide a set of library routines for reading and writing JPEG image files, -plus two sample applications "cjpeg" and "djpeg", which use the library to -perform conversion between JPEG and some other popular image file formats. -The library is intended to be reused in other applications. - -In order to support file conversion and viewing software, we have included -considerable functionality beyond the bare JPEG coding/decoding capability; -for example, the color quantization modules are not strictly part of JPEG -decoding, but they are essential for output to colormapped file formats or -colormapped displays. These extra functions can be compiled out of the -library if not required for a particular application. We have also included -"jpegtran", a utility for lossless transcoding between different JPEG -processes, and "rdjpgcom" and "wrjpgcom", two simple applications for -inserting and extracting textual comments in JFIF files. - -The emphasis in designing this software has been on achieving portability and -flexibility, while also making it fast enough to be useful. In particular, -the software is not intended to be read as a tutorial on JPEG. (See the -REFERENCES section for introductory material.) Rather, it is intended to -be reliable, portable, industrial-strength code. We do not claim to have -achieved that goal in every aspect of the software, but we strive for it. - -We welcome the use of this software as a component of commercial products. -No royalty is required, but we do ask for an acknowledgement in product -documentation, as described under LEGAL ISSUES. - - -LEGAL ISSUES -============ - -In plain English: - -1. We don't promise that this software works. (But if you find any bugs, - please let us know!) -2. You can use this software for whatever you want. You don't have to pay us. -3. You may not pretend that you wrote this software. If you use it in a - program, you must acknowledge somewhere in your documentation that - you've used the IJG code. - -In legalese: - -The authors make NO WARRANTY or representation, either express or implied, -with respect to this software, its quality, accuracy, merchantability, or -fitness for a particular purpose. This software is provided "AS IS", and you, -its user, assume the entire risk as to its quality and accuracy. - -This software is copyright (C) 1991-1998, Thomas G. Lane. -All Rights Reserved except as specified below. - -Permission is hereby granted to use, copy, modify, and distribute this -software (or portions thereof) for any purpose, without fee, subject to these -conditions: -(1) If any part of the source code for this software is distributed, then this -README file must be included, with this copyright and no-warranty notice -unaltered; and any additions, deletions, or changes to the original files -must be clearly indicated in accompanying documentation. -(2) If only executable code is distributed, then the accompanying -documentation must state that "this software is based in part on the work of -the Independent JPEG Group". -(3) Permission for use of this software is granted only if the user accepts -full responsibility for any undesirable consequences; the authors accept -NO LIABILITY for damages of any kind. - -These conditions apply to any software derived from or based on the IJG code, -not just to the unmodified library. If you use our work, you ought to -acknowledge us. - -Permission is NOT granted for the use of any IJG author's name or company name -in advertising or publicity relating to this software or products derived from -it. This software may be referred to only as "the Independent JPEG Group's -software". - -We specifically permit and encourage the use of this software as the basis of -commercial products, provided that all warranty or liability claims are -assumed by the product vendor. - - -ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, -sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. -ansi2knr.c is NOT covered by the above copyright and conditions, but instead -by the usual distribution terms of the Free Software Foundation; principally, -that you must include source code if you redistribute it. (See the file -ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part -of any program generated from the IJG code, this does not limit you more than -the foregoing paragraphs do. - -The Unix configuration script "configure" was produced with GNU Autoconf. -It is copyright by the Free Software Foundation but is freely distributable. -The same holds for its supporting scripts (config.guess, config.sub, -ltconfig, ltmain.sh). Another support script, install-sh, is copyright -by M.I.T. but is also freely distributable. - -It appears that the arithmetic coding option of the JPEG spec is covered by -patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot -legally be used without obtaining one or more licenses. For this reason, -support for arithmetic coding has been removed from the free JPEG software. -(Since arithmetic coding provides only a marginal gain over the unpatented -Huffman mode, it is unlikely that very many implementations will support it.) -So far as we are aware, there are no patent restrictions on the remaining -code. - -The IJG distribution formerly included code to read and write GIF files. -To avoid entanglement with the Unisys LZW patent, GIF reading support has -been removed altogether, and the GIF writer has been simplified to produce -"uncompressed GIFs". This technique does not use the LZW algorithm; the -resulting GIF files are larger than usual, but are readable by all standard -GIF decoders. - -We are required to state that - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." - - -REFERENCES -========== - -We highly recommend reading one or more of these references before trying to -understand the innards of the JPEG software. - -The best short technical introduction to the JPEG compression algorithm is - Wallace, Gregory K. "The JPEG Still Picture Compression Standard", - Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. -(Adjacent articles in that issue discuss MPEG motion picture compression, -applications of JPEG, and related topics.) If you don't have the CACM issue -handy, a PostScript file containing a revised version of Wallace's article is -available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually -a preprint for an article that appeared in IEEE Trans. Consumer Electronics) -omits the sample images that appeared in CACM, but it includes corrections -and some added material. Note: the Wallace article is copyright ACM and IEEE, -and it may not be used for commercial purposes. - -A somewhat less technical, more leisurely introduction to JPEG can be found in -"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by -M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides -good explanations and example C code for a multitude of compression methods -including JPEG. It is an excellent source if you are comfortable reading C -code but don't know much about data compression in general. The book's JPEG -sample code is far from industrial-strength, but when you are ready to look -at a full implementation, you've got one here... - -The best full description of JPEG is the textbook "JPEG Still Image Data -Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published -by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. -The book includes the complete text of the ISO JPEG standards (DIS 10918-1 -and draft DIS 10918-2). This is by far the most complete exposition of JPEG -in existence, and we highly recommend it. - -The JPEG standard itself is not available electronically; you must order a -paper copy through ISO or ITU. (Unless you feel a need to own a certified -official copy, we recommend buying the Pennebaker and Mitchell book instead; -it's much cheaper and includes a great deal of useful explanatory material.) -In the USA, copies of the standard may be ordered from ANSI Sales at (212) -642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI -doesn't take credit card orders, but Global does.) It's not cheap: as of -1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% -shipping/handling. The standard is divided into two parts, Part 1 being the -actual specification, while Part 2 covers compliance testing methods. Part 1 -is titled "Digital Compression and Coding of Continuous-tone Still Images, -Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS -10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of -Continuous-tone Still Images, Part 2: Compliance testing" and has document -numbers ISO/IEC IS 10918-2, ITU-T T.83. - -Some extensions to the original JPEG standard are defined in JPEG Part 3, -a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG -currently does not support any Part 3 extensions. - -The JPEG standard does not specify all details of an interchangeable file -format. For the omitted details we follow the "JFIF" conventions, revision -1.02. A copy of the JFIF spec is available from: - Literature Department - C-Cube Microsystems, Inc. - 1778 McCarthy Blvd. - Milpitas, CA 95035 - phone (408) 944-6300, fax (408) 944-6314 -A PostScript version of this document is available by FTP at -ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text -version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing -the figures. - -The TIFF 6.0 file format specification can be obtained by FTP from -ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme -found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. -IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). -Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 -(Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or -from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision -of the TIFF spec will replace the 6.0 JPEG design with the Note's design. -Although IJG's own code does not support TIFF/JPEG, the free libtiff library -uses our library to implement TIFF/JPEG per the Note. libtiff is available -from ftp://ftp.sgi.com/graphics/tiff/. - - -ARCHIVE LOCATIONS -================= - -The "official" archive site for this software is ftp.uu.net (Internet -address 192.48.96.9). The most recent released version can always be found -there in directory graphics/jpeg. This particular version will be archived -as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have -direct Internet access, UUNET's archives are also available via UUCP; contact -help@uunet.uu.net for information on retrieving files that way. - -Numerous Internet sites maintain copies of the UUNET files. However, only -ftp.uu.net is guaranteed to have the latest official version. - -You can also obtain this software in DOS-compatible "zip" archive format from -the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or -on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 -"JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net -release. - -The JPEG FAQ (Frequently Asked Questions) article is a useful source of -general information about JPEG. It is updated constantly and therefore is -not included in this distribution. The FAQ is posted every two weeks to -Usenet newsgroups comp.graphics.misc, news.answers, and other groups. -It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ -and other news.answers archive sites, including the official news.answers -archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. -If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu -with body - send usenet/news.answers/jpeg-faq/part1 - send usenet/news.answers/jpeg-faq/part2 - - -RELATED SOFTWARE -================ - -Numerous viewing and image manipulation programs now support JPEG. (Quite a -few of them use this library to do so.) The JPEG FAQ described above lists -some of the more popular free and shareware viewers, and tells where to -obtain them on Internet. - -If you are on a Unix machine, we highly recommend Jef Poskanzer's free -PBMPLUS software, which provides many useful operations on PPM-format image -files. In particular, it can convert PPM images to and from a wide range of -other formats, thus making cjpeg/djpeg considerably more useful. The latest -version is distributed by the NetPBM group, and is available from numerous -sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/. -Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is; -you are likely to have difficulty making it work on any non-Unix machine. - -A different free JPEG implementation, written by the PVRG group at Stanford, -is available from ftp://havefun.stanford.edu/pub/jpeg/. This program -is designed for research and experimentation rather than production use; -it is slower, harder to use, and less portable than the IJG code, but it -is easier to read and modify. Also, the PVRG code supports lossless JPEG, -which we do not. (On the other hand, it doesn't do progressive JPEG.) - - -FILE FORMAT WARS -================ - -Some JPEG programs produce files that are not compatible with our library. -The root of the problem is that the ISO JPEG committee failed to specify a -concrete file format. Some vendors "filled in the blanks" on their own, -creating proprietary formats that no one else could read. (For example, none -of the early commercial JPEG implementations for the Macintosh were able to -exchange compressed files.) - -The file format we have adopted is called JFIF (see REFERENCES). This format -has been agreed to by a number of major commercial JPEG vendors, and it has -become the de facto standard. JFIF is a minimal or "low end" representation. -We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF -Technical Note #2) for "high end" applications that need to record a lot of -additional data about an image. TIFF/JPEG is fairly new and not yet widely -supported, unfortunately. - -The upcoming JPEG Part 3 standard defines a file format called SPIFF. -SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should -be able to read the most common variant of SPIFF. SPIFF has some technical -advantages over JFIF, but its major claim to fame is simply that it is an -official standard rather than an informal one. At this point it is unclear -whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto -standard. IJG intends to support SPIFF once the standard is frozen, but we -have not decided whether it should become our default output format or not. -(In any case, our decoder will remain capable of reading JFIF indefinitely.) - -Various proprietary file formats incorporating JPEG compression also exist. -We have little or no sympathy for the existence of these formats. Indeed, -one of the original reasons for developing this free software was to help -force convergence on common, open format standards for JPEG files. Don't -use a proprietary file format! - - -TO DO -===== - -The major thrust for v7 will probably be improvement of visual quality. -The current method for scaling the quantization tables is known not to be -very good at low Q values. We also intend to investigate block boundary -smoothing, "poor man's variable quantization", and other means of improving -quality-vs-file-size performance without sacrificing compatibility. - -In future versions, we are considering supporting some of the upcoming JPEG -Part 3 extensions --- principally, variable quantization and the SPIFF file -format. - -As always, speeding things up is of great interest. - -Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. diff --git a/Source/3rdParty/wx/src/jpeg/ansi2knr.c b/Source/3rdParty/wx/src/jpeg/ansi2knr.c deleted file mode 100644 index 4e05fc2d3..000000000 --- a/Source/3rdParty/wx/src/jpeg/ansi2knr.c +++ /dev/null @@ -1,693 +0,0 @@ -/* ansi2knr.c */ -/* Convert ANSI C function definitions to K&R ("traditional C") syntax */ - -/* -ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY. No author or distributor accepts responsibility to anyone for the -consequences of using it or for whether it serves any particular purpose or -works at all, unless he says so in writing. Refer to the GNU General Public -License (the "GPL") for full details. - -Everyone is granted permission to copy, modify and redistribute ansi2knr, -but only under the conditions described in the GPL. A copy of this license -is supposed to have been given to you along with ansi2knr so you can know -your rights and responsibilities. It should be in a file named COPYLEFT. -[In the IJG distribution, the GPL appears below, not in a separate file.] -Among other things, the copyright notice and this notice must be preserved -on all copies. - -We explicitly state here what we believe is already implied by the GPL: if -the ansi2knr program is distributed as a separate set of sources and a -separate executable file which are aggregated on a storage medium together -with another program, this in itself does not bring the other program under -the GPL, nor does the mere fact that such a program or the procedures for -constructing it invoke the ansi2knr executable bring any other part of the -program under the GPL. -*/ - -/* ----------- Here is the GNU GPL file COPYLEFT, referred to above ---------- ------ These terms do NOT apply to the JPEG software itself; see README ------ - - GHOSTSCRIPT GENERAL PUBLIC LICENSE - (Clarified 11 Feb 1988) - - Copyright (C) 1988 Richard M. Stallman - Everyone is permitted to copy and distribute verbatim copies of this - license, but changing it is not allowed. You can also use this wording - to make the terms for other programs. - - The license agreements of most software companies keep you at the -mercy of those companies. By contrast, our general public license is -intended to give everyone the right to share Ghostscript. To make sure -that you get the rights we want you to have, we need to make -restrictions that forbid anyone to deny you these rights or to ask you -to surrender the rights. Hence this license agreement. - - Specifically, we want to make sure that you have the right to give -away copies of Ghostscript, that you receive source code or else can get -it if you want it, that you can change Ghostscript or use pieces of it -in new free programs, and that you know you can do these things. - - To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights. For example, if you distribute -copies of Ghostscript, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - Also, for our own protection, we must make certain that everyone finds -out that there is no warranty for Ghostscript. If Ghostscript is -modified by someone else and passed on, we want its recipients to know -that what they have is not what we distributed, so that any problems -introduced by others will not reflect on our reputation. - - Therefore we (Richard M. Stallman and the Free Software Foundation, -Inc.) make the following terms which say what you must do to be allowed -to distribute or change Ghostscript. - - - COPYING POLICIES - - 1. You may copy and distribute verbatim copies of Ghostscript source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy a valid copyright and license -notice "Copyright (C) 1989 Aladdin Enterprises. All rights reserved. -Distributed by Free Software Foundation, Inc." (or with whatever year is -appropriate); keep intact the notices on all files that refer to this -License Agreement and to the absence of any warranty; and give any other -recipients of the Ghostscript program a copy of this License Agreement -along with the program. You may charge a distribution fee for the -physical act of transferring a copy. - - 2. You may modify your copy or copies of Ghostscript or any portion of -it, and copy and distribute such modifications under the terms of -Paragraph 1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating - that you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, - that in whole or in part contains or is a derivative of Ghostscript - or any part thereof, to be licensed at no charge to all third - parties on terms identical to those contained in this License - Agreement (except that you may choose to grant more extensive - warranty protection to some or all third parties, at your option). - - c) You may charge a distribution fee for the physical act of - transferring a copy, and you may at your option offer warranty - protection in exchange for a fee. - -Mere aggregation of another unrelated program with this program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other program under the scope of these terms. - - 3. You may copy and distribute Ghostscript (or a portion or derivative -of it, under Paragraph 2) in object code or executable form under the -terms of Paragraphs 1 and 2 above provided that you also do one of the -following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal - shipping charge) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -For an executable file, complete source code means all the source code for -all modules it contains; but, as a special exception, it need not include -source code for modules which are standard libraries that accompany the -operating system on which the executable file runs. - - 4. You may not copy, sublicense, distribute or transfer Ghostscript -except as expressly provided under this License Agreement. Any attempt -otherwise to copy, sublicense, distribute or transfer Ghostscript is -void and your rights to use the program under this License agreement -shall be automatically terminated. However, parties who have received -computer software programs from you with this License Agreement will not -have their licenses terminated so long as such parties remain in full -compliance. - - 5. If you wish to incorporate parts of Ghostscript into other free -programs whose distribution conditions are different, write to the Free -Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not -yet worked out a simple rule that can be stated here, but we will often -permit this. We will be guided by the two goals of preserving the free -status of all derivatives of our free software and of promoting the -sharing and reuse of software. - -Your comments and suggestions about our licensing policies and our -software are welcome! Please contact the Free Software Foundation, -Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296. - - NO WARRANTY - - BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT -WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD -M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES -PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH -YOU. SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. -STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN -ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE -GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU -HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM -BY ANY OTHER PARTY. - --------------------- End of file COPYLEFT ------------------------------ -*/ - -/* - * Usage: - ansi2knr input_file [output_file] - * If no output_file is supplied, output goes to stdout. - * There are no error messages. - * - * ansi2knr recognizes function definitions by seeing a non-keyword - * identifier at the left margin, followed by a left parenthesis, - * with a right parenthesis as the last character on the line, - * and with a left brace as the first token on the following line - * (ignoring possible intervening comments). - * It will recognize a multi-line header provided that no intervening - * line ends with a left or right brace or a semicolon. - * These algorithms ignore whitespace and comments, except that - * the function name must be the first thing on the line. - * The following constructs will confuse it: - * - Any other construct that starts at the left margin and - * follows the above syntax (such as a macro or function call). - * - Some macros that tinker with the syntax of the function header. - */ - -/* - * The original and principal author of ansi2knr is L. Peter Deutsch - * . Other authors are noted in the change history - * that follows (in reverse chronological order): - lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with - compilers that don't understand void, as suggested by - Tom Lane - lpd 96-01-15 changed to require that the first non-comment token - on the line following a function header be a left brace, - to reduce sensitivity to macros, as suggested by Tom Lane - - lpd 95-06-22 removed #ifndefs whose sole purpose was to define - undefined preprocessor symbols as 0; changed all #ifdefs - for configuration symbols to #ifs - lpd 95-04-05 changed copyright notice to make it clear that - including ansi2knr in a program does not bring the entire - program under the GPL - lpd 94-12-18 added conditionals for systems where ctype macros - don't handle 8-bit characters properly, suggested by - Francois Pinard ; - removed --varargs switch (this is now the default) - lpd 94-10-10 removed CONFIG_BROKETS conditional - lpd 94-07-16 added some conditionals to help GNU `configure', - suggested by Francois Pinard ; - properly erase prototype args in function parameters, - contributed by Jim Avera ; - correct error in writeblanks (it shouldn't erase EOLs) - lpd 89-xx-xx original version - */ - -/* Most of the conditionals here are to make ansi2knr work with */ -/* or without the GNU configure machinery. */ - -#if HAVE_CONFIG_H -# include -#endif - -#include -#include - -#if HAVE_CONFIG_H - -/* - For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). - This will define HAVE_CONFIG_H and so, activate the following lines. - */ - -# if STDC_HEADERS || HAVE_STRING_H -# include -# else -# include -# endif - -#else /* not HAVE_CONFIG_H */ - -/* Otherwise do it the hard way */ - -# ifdef BSD -# include -# else -# ifdef VMS - extern int strlen(), strncmp(); -# else -# include -# endif -# endif - -#endif /* not HAVE_CONFIG_H */ - -#if STDC_HEADERS -# include -#else -/* - malloc and free should be declared in stdlib.h, - but if you've got a K&R compiler, they probably aren't. - */ -# ifdef MSDOS -# include -# else -# ifdef VMS - extern char *malloc(); - extern void free(); -# else - extern char *malloc(); - extern int free(); -# endif -# endif - -#endif - -/* - * The ctype macros don't always handle 8-bit characters correctly. - * Compensate for this here. - */ -#ifdef isascii -# undef HAVE_ISASCII /* just in case */ -# define HAVE_ISASCII 1 -#else -#endif -#if STDC_HEADERS || !HAVE_ISASCII -# define is_ascii(c) 1 -#else -# define is_ascii(c) isascii(c) -#endif - -#define is_space(c) (is_ascii(c) && isspace(c)) -#define is_alpha(c) (is_ascii(c) && isalpha(c)) -#define is_alnum(c) (is_ascii(c) && isalnum(c)) - -/* Scanning macros */ -#define isidchar(ch) (is_alnum(ch) || (ch) == '_') -#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') - -/* Forward references */ -char *skipspace(); -int writeblanks(); -int test1(); -int convert1(); - -/* The main program */ -int -main(argc, argv) - int argc; - char *argv[]; -{ FILE *in, *out; -#define bufsize 5000 /* arbitrary size */ - char *buf; - char *line; - char *more; - /* - * In previous versions, ansi2knr recognized a --varargs switch. - * If this switch was supplied, ansi2knr would attempt to convert - * a ... argument to va_alist and va_dcl; if this switch was not - * supplied, ansi2knr would simply drop any such arguments. - * Now, ansi2knr always does this conversion, and we only - * check for this switch for backward compatibility. - */ - int convert_varargs = 1; - - if ( argc > 1 && argv[1][0] == '-' ) - { if ( !strcmp(argv[1], "--varargs") ) - { convert_varargs = 1; - argc--; - argv++; - } - else - { fprintf(stderr, "Unrecognized switch: %s\n", argv[1]); - exit(1); - } - } - switch ( argc ) - { - default: - printf("Usage: ansi2knr input_file [output_file]\n"); - exit(0); - case 2: - out = stdout; - break; - case 3: - out = fopen(argv[2], "w"); - if ( out == NULL ) - { fprintf(stderr, "Cannot open output file %s\n", argv[2]); - exit(1); - } - } - in = fopen(argv[1], "r"); - if ( in == NULL ) - { fprintf(stderr, "Cannot open input file %s\n", argv[1]); - exit(1); - } - fprintf(out, "#line 1 \"%s\"\n", argv[1]); - buf = malloc(bufsize); - line = buf; - while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) - { -test: line += strlen(line); - switch ( test1(buf) ) - { - case 2: /* a function header */ - convert1(buf, out, 1, convert_varargs); - break; - case 1: /* a function */ - /* Check for a { at the start of the next line. */ - more = ++line; -f: if ( line >= buf + (bufsize - 1) ) /* overflow check */ - goto wl; - if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL ) - goto wl; - switch ( *skipspace(more, 1) ) - { - case '{': - /* Definitely a function header. */ - convert1(buf, out, 0, convert_varargs); - fputs(more, out); - break; - case 0: - /* The next line was blank or a comment: */ - /* keep scanning for a non-comment. */ - line += strlen(line); - goto f; - default: - /* buf isn't a function header, but */ - /* more might be. */ - fputs(buf, out); - strcpy(buf, more); - line = buf; - goto test; - } - break; - case -1: /* maybe the start of a function */ - if ( line != buf + (bufsize - 1) ) /* overflow check */ - continue; - /* falls through */ - default: /* not a function */ -wl: fputs(buf, out); - break; - } - line = buf; - } - if ( line != buf ) - fputs(buf, out); - free(buf); - fclose(out); - fclose(in); - return 0; -} - -/* Skip over space and comments, in either direction. */ -char * -skipspace(p, dir) - register char *p; - register int dir; /* 1 for forward, -1 for backward */ -{ for ( ; ; ) - { while ( is_space(*p) ) - p += dir; - if ( !(*p == '/' && p[dir] == '*') ) - break; - p += dir; p += dir; - while ( !(*p == '*' && p[dir] == '/') ) - { if ( *p == 0 ) - return p; /* multi-line comment?? */ - p += dir; - } - p += dir; p += dir; - } - return p; -} - -/* - * Write blanks over part of a string. - * Don't overwrite end-of-line characters. - */ -int -writeblanks(start, end) - char *start; - char *end; -{ char *p; - for ( p = start; p < end; p++ ) - if ( *p != '\r' && *p != '\n' ) - *p = ' '; - return 0; -} - -/* - * Test whether the string in buf is a function definition. - * The string may contain and/or end with a newline. - * Return as follows: - * 0 - definitely not a function definition; - * 1 - definitely a function definition; - * 2 - definitely a function prototype (NOT USED); - * -1 - may be the beginning of a function definition, - * append another line and look again. - * The reason we don't attempt to convert function prototypes is that - * Ghostscript's declaration-generating macros look too much like - * prototypes, and confuse the algorithms. - */ -int -test1(buf) - char *buf; -{ register char *p = buf; - char *bend; - char *endfn; - int contin; - - if ( !isidfirstchar(*p) ) - return 0; /* no name at left margin */ - bend = skipspace(buf + strlen(buf) - 1, -1); - switch ( *bend ) - { - case ';': contin = 0 /*2*/; break; - case ')': contin = 1; break; - case '{': return 0; /* not a function */ - case '}': return 0; /* not a function */ - default: contin = -1; - } - while ( isidchar(*p) ) - p++; - endfn = p; - p = skipspace(p, 1); - if ( *p++ != '(' ) - return 0; /* not a function */ - p = skipspace(p, 1); - if ( *p == ')' ) - return 0; /* no parameters */ - /* Check that the apparent function name isn't a keyword. */ - /* We only need to check for keywords that could be followed */ - /* by a left parenthesis (which, unfortunately, is most of them). */ - { static char *words[] = - { "asm", "auto", "case", "char", "const", "double", - "extern", "float", "for", "if", "int", "long", - "register", "return", "short", "signed", "sizeof", - "static", "switch", "typedef", "unsigned", - "void", "volatile", "while", 0 - }; - char **key = words; - char *kp; - int len = endfn - buf; - - while ( (kp = *key) != 0 ) - { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) - return 0; /* name is a keyword */ - key++; - } - } - return contin; -} - -/* Convert a recognized function definition or header to K&R syntax. */ -int -convert1(buf, out, header, convert_varargs) - char *buf; - FILE *out; - int header; /* Boolean */ - int convert_varargs; /* Boolean */ -{ char *endfn; - register char *p; - char **breaks; - unsigned num_breaks = 2; /* for testing */ - char **btop; - char **bp; - char **ap; - char *vararg = 0; - - /* Pre-ANSI implementations don't agree on whether strchr */ - /* is called strchr or index, so we open-code it here. */ - for ( endfn = buf; *(endfn++) != '('; ) - ; -top: p = endfn; - breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); - if ( breaks == 0 ) - { /* Couldn't allocate break table, give up */ - fprintf(stderr, "Unable to allocate break table!\n"); - fputs(buf, out); - return -1; - } - btop = breaks + num_breaks * 2 - 2; - bp = breaks; - /* Parse the argument list */ - do - { int level = 0; - char *lp = NULL; - char *rp; - char *end = NULL; - - if ( bp >= btop ) - { /* Filled up break table. */ - /* Allocate a bigger one and start over. */ - free((char *)breaks); - num_breaks <<= 1; - goto top; - } - *bp++ = p; - /* Find the end of the argument */ - for ( ; end == NULL; p++ ) - { switch(*p) - { - case ',': - if ( !level ) end = p; - break; - case '(': - if ( !level ) lp = p; - level++; - break; - case ')': - if ( --level < 0 ) end = p; - else rp = p; - break; - case '/': - p = skipspace(p, 1) - 1; - break; - default: - ; - } - } - /* Erase any embedded prototype parameters. */ - if ( lp ) - writeblanks(lp + 1, rp); - p--; /* back up over terminator */ - /* Find the name being declared. */ - /* This is complicated because of procedure and */ - /* array modifiers. */ - for ( ; ; ) - { p = skipspace(p - 1, -1); - switch ( *p ) - { - case ']': /* skip array dimension(s) */ - case ')': /* skip procedure args OR name */ - { int level = 1; - while ( level ) - switch ( *--p ) - { - case ']': case ')': level++; break; - case '[': case '(': level--; break; - case '/': p = skipspace(p, -1) + 1; break; - default: ; - } - } - if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) - { /* We found the name being declared */ - while ( !isidfirstchar(*p) ) - p = skipspace(p, 1) + 1; - goto found; - } - break; - default: - goto found; - } - } -found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) - { if ( convert_varargs ) - { *bp++ = "va_alist"; - vararg = p-2; - } - else - { p++; - if ( bp == breaks + 1 ) /* sole argument */ - writeblanks(breaks[0], p); - else - writeblanks(bp[-1] - 1, p); - bp--; - } - } - else - { while ( isidchar(*p) ) p--; - *bp++ = p+1; - } - p = end; - } - while ( *p++ == ',' ); - *bp = p; - /* Make a special check for 'void' arglist */ - if ( bp == breaks+2 ) - { p = skipspace(breaks[0], 1); - if ( !strncmp(p, "void", 4) ) - { p = skipspace(p+4, 1); - if ( p == breaks[2] - 1 ) - { bp = breaks; /* yup, pretend arglist is empty */ - writeblanks(breaks[0], p + 1); - } - } - } - /* Put out the function name and left parenthesis. */ - p = buf; - while ( p != endfn ) putc(*p, out), p++; - /* Put out the declaration. */ - if ( header ) - { fputs(");", out); - for ( p = breaks[0]; *p; p++ ) - if ( *p == '\r' || *p == '\n' ) - putc(*p, out); - } - else - { for ( ap = breaks+1; ap < bp; ap += 2 ) - { p = *ap; - while ( isidchar(*p) ) - putc(*p, out), p++; - if ( ap < bp - 1 ) - fputs(", ", out); - } - fputs(") ", out); - /* Put out the argument declarations */ - for ( ap = breaks+2; ap <= bp; ap += 2 ) - (*ap)[-1] = ';'; - if ( vararg != 0 ) - { *vararg = 0; - fputs(breaks[0], out); /* any prior args */ - fputs("va_dcl", out); /* the final arg */ - fputs(bp[0], out); - } - else - fputs(breaks[0], out); - } - free((char *)breaks); - return 0; -} diff --git a/Source/3rdParty/wx/src/jpeg/change.log b/Source/3rdParty/wx/src/jpeg/change.log deleted file mode 100644 index 74102c0db..000000000 --- a/Source/3rdParty/wx/src/jpeg/change.log +++ /dev/null @@ -1,217 +0,0 @@ -CHANGE LOG for Independent JPEG Group's JPEG software - - -Version 6b 27-Mar-1998 ------------------------ - -jpegtran has new features for lossless image transformations (rotation -and flipping) as well as "lossless" reduction to grayscale. - -jpegtran now copies comments by default; it has a -copy switch to enable -copying all APPn blocks as well, or to suppress comments. (Formerly it -always suppressed comments and APPn blocks.) jpegtran now also preserves -JFIF version and resolution information. - -New decompressor library feature: COM and APPn markers found in the input -file can be saved in memory for later use by the application. (Before, -you had to code this up yourself with a custom marker processor.) - -There is an unused field "void * client_data" now in compress and decompress -parameter structs; this may be useful in some applications. - -JFIF version number information is now saved by the decoder and accepted by -the encoder. jpegtran uses this to copy the source file's version number, -to ensure "jpegtran -copy all" won't create bogus files that contain JFXX -extensions but claim to be version 1.01. Applications that generate their -own JFXX extension markers also (finally) have a supported way to cause the -encoder to emit JFIF version number 1.02. - -djpeg's trace mode reports JFIF 1.02 thumbnail images as such, rather -than as unknown APP0 markers. - -In -verbose mode, djpeg and rdjpgcom will try to print the contents of -APP12 markers as text. Some digital cameras store useful text information -in APP12 markers. - -Handling of truncated data streams is more robust: blocks beyond the one in -which the error occurs will be output as uniform gray, or left unchanged -if decoding a progressive JPEG. The appearance no longer depends on the -Huffman tables being used. - -Huffman tables are checked for validity much more carefully than before. - -To avoid the Unisys LZW patent, djpeg's GIF output capability has been -changed to produce "uncompressed GIFs", and cjpeg's GIF input capability -has been removed altogether. We're not happy about it either, but there -seems to be no good alternative. - -The configure script now supports building libjpeg as a shared library -on many flavors of Unix (all the ones that GNU libtool knows how to -build shared libraries for). Use "./configure --enable-shared" to -try this out. - -New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio. -Also, a jconfig file and a build script for Metrowerks CodeWarrior -on Apple Macintosh. makefile.dj has been updated for DJGPP v2, and there -are miscellaneous other minor improvements in the makefiles. - -jmemmac.c now knows how to create temporary files following Mac System 7 -conventions. - -djpeg's -map switch is now able to read raw-format PPM files reliably. - -cjpeg -progressive -restart no longer generates any unnecessary DRI markers. - -Multiple calls to jpeg_simple_progression for a single JPEG object -no longer leak memory. - - -Version 6a 7-Feb-96 --------------------- - -Library initialization sequence modified to detect version mismatches -and struct field packing mismatches between library and calling application. -This change requires applications to be recompiled, but does not require -any application source code change. - -All routine declarations changed to the style "GLOBAL(type) name ...", -that is, GLOBAL, LOCAL, METHODDEF, EXTERN are now macros taking the -routine's return type as an argument. This makes it possible to add -Microsoft-style linkage keywords to all the routines by changing just -these macros. Note that any application code that was using these macros -will have to be changed. - -DCT coefficient quantization tables are now stored in normal array order -rather than zigzag order. Application code that calls jpeg_add_quant_table, -or otherwise manipulates quantization tables directly, will need to be -changed. If you need to make such code work with either older or newer -versions of the library, a test like "#if JPEG_LIB_VERSION >= 61" is -recommended. - -djpeg's trace capability now dumps DQT tables in natural order, not zigzag -order. This allows the trace output to be made into a "-qtables" file -more easily. - -New system-dependent memory manager module for use on Apple Macintosh. - -Fix bug in cjpeg's -smooth option: last one or two scanlines would be -duplicates of the prior line unless the image height mod 16 was 1 or 2. - -Repair minor problems in VMS, BCC, MC6 makefiles. - -New configure script based on latest GNU Autoconf. - -Correct the list of include files needed by MetroWerks C for ccommand(). - -Numerous small documentation updates. - - -Version 6 2-Aug-95 -------------------- - -Progressive JPEG support: library can read and write full progressive JPEG -files. A "buffered image" mode supports incremental decoding for on-the-fly -display of progressive images. Simply recompiling an existing IJG-v5-based -decoder with v6 should allow it to read progressive files, though of course -without any special progressive display. - -New "jpegtran" application performs lossless transcoding between different -JPEG formats; primarily, it can be used to convert baseline to progressive -JPEG and vice versa. In support of jpegtran, the library now allows lossless -reading and writing of JPEG files as DCT coefficient arrays. This ability -may be of use in other applications. - -Notes for programmers: -* We changed jpeg_start_decompress() to be able to suspend; this makes all -decoding modes available to suspending-input applications. However, -existing applications that use suspending input will need to be changed -to check the return value from jpeg_start_decompress(). You don't need to -do anything if you don't use a suspending data source. -* We changed the interface to the virtual array routines: access_virt_array -routines now take a count of the number of rows to access this time. The -last parameter to request_virt_array routines is now interpreted as the -maximum number of rows that may be accessed at once, but not necessarily -the height of every access. - - -Version 5b 15-Mar-95 ---------------------- - -Correct bugs with grayscale images having v_samp_factor > 1. - -jpeg_write_raw_data() now supports output suspension. - -Correct bugs in "configure" script for case of compiling in -a directory other than the one containing the source files. - -Repair bug in jquant1.c: sometimes didn't use as many colors as it could. - -Borland C makefile and jconfig file work under either MS-DOS or OS/2. - -Miscellaneous improvements to documentation. - - -Version 5a 7-Dec-94 --------------------- - -Changed color conversion roundoff behavior so that grayscale values are -represented exactly. (This causes test image files to change.) - -Make ordered dither use 16x16 instead of 4x4 pattern for a small quality -improvement. - -New configure script based on latest GNU Autoconf. -Fix configure script to handle CFLAGS correctly. -Rename *.auto files to *.cfg, so that configure script still works if -file names have been truncated for DOS. - -Fix bug in rdbmp.c: didn't allow for extra data between header and image. - -Modify rdppm.c/wrppm.c to handle 2-byte raw PPM/PGM formats for 12-bit data. - -Fix several bugs in rdrle.c. - -NEED_SHORT_EXTERNAL_NAMES option was broken. - -Revise jerror.h/jerror.c for more flexibility in message table. - -Repair oversight in jmemname.c NO_MKTEMP case: file could be there -but unreadable. - - -Version 5 24-Sep-94 --------------------- - -Version 5 represents a nearly complete redesign and rewrite of the IJG -software. Major user-visible changes include: - * Automatic configuration simplifies installation for most Unix systems. - * A range of speed vs. image quality tradeoffs are supported. - This includes resizing of an image during decompression: scaling down - by a factor of 1/2, 1/4, or 1/8 is handled very efficiently. - * New programs rdjpgcom and wrjpgcom allow insertion and extraction - of text comments in a JPEG file. - -The application programmer's interface to the library has changed completely. -Notable improvements include: - * We have eliminated the use of callback routines for handling the - uncompressed image data. The application now sees the library as a - set of routines that it calls to read or write image data on a - scanline-by-scanline basis. - * The application image data is represented in a conventional interleaved- - pixel format, rather than as a separate array for each color channel. - This can save a copying step in many programs. - * The handling of compressed data has been cleaned up: the application can - supply routines to source or sink the compressed data. It is possible to - suspend processing on source/sink buffer overrun, although this is not - supported in all operating modes. - * All static state has been eliminated from the library, so that multiple - instances of compression or decompression can be active concurrently. - * JPEG abbreviated datastream formats are supported, ie, quantization and - Huffman tables can be stored separately from the image data. - * And not only that, but the documentation of the library has improved - considerably! - - -The last widely used release before the version 5 rewrite was version 4A of -18-Feb-93. Change logs before that point have been discarded, since they -are not of much interest after the rewrite. diff --git a/Source/3rdParty/wx/src/jpeg/jcapimin.c b/Source/3rdParty/wx/src/jpeg/jcapimin.c deleted file mode 100644 index 270a35368..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcapimin.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * jcapimin.c - * - * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains application interface code for the compression half - * of the JPEG library. These are the "minimum" API routines that may be - * needed in either the normal full-compression case or the transcoding-only - * case. - * - * Most of the routines intended to be called directly by an application - * are in this file or in jcapistd.c. But also see jcparam.c for - * parameter-setup helper routines, jcomapi.c for routines shared by - * compression and decompression, and jctrans.c for the transcoding case. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Initialization of a JPEG compression object. - * The error manager must already be set up (in case memory manager fails). - */ - -GLOBAL(void) -jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) -{ - int i; - - /* Guard against version mismatches between library and caller. */ - cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ - if (version != JPEG_LIB_VERSION) - ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); - if (structsize != SIZEOF(struct jpeg_compress_struct)) - ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, - (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); - - /* For debugging purposes, we zero the whole master structure. - * But the application has already set the err pointer, and may have set - * client_data, so we have to save and restore those fields. - * Note: if application hasn't set client_data, tools like Purify may - * complain here. - */ - { - struct jpeg_error_mgr * err = cinfo->err; - void * client_data = cinfo->client_data; /* ignore Purify complaint here */ - MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); - cinfo->err = err; - cinfo->client_data = client_data; - } - cinfo->is_decompressor = FALSE; - - /* Initialize a memory manager instance for this object */ - jinit_memory_mgr((j_common_ptr) cinfo); - - /* Zero out pointers to permanent structures. */ - cinfo->progress = NULL; - cinfo->dest = NULL; - - cinfo->comp_info = NULL; - - for (i = 0; i < NUM_QUANT_TBLS; i++) - cinfo->quant_tbl_ptrs[i] = NULL; - - for (i = 0; i < NUM_HUFF_TBLS; i++) { - cinfo->dc_huff_tbl_ptrs[i] = NULL; - cinfo->ac_huff_tbl_ptrs[i] = NULL; - } - - cinfo->script_space = NULL; - - cinfo->input_gamma = 1.0; /* in case application forgets */ - - /* OK, I'm ready */ - cinfo->global_state = CSTATE_START; -} - - -/* - * Destruction of a JPEG compression object - */ - -GLOBAL(void) -jpeg_destroy_compress (j_compress_ptr cinfo) -{ - jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ -} - - -/* - * Abort processing of a JPEG compression operation, - * but don't destroy the object itself. - */ - -GLOBAL(void) -jpeg_abort_compress (j_compress_ptr cinfo) -{ - jpeg_abort((j_common_ptr) cinfo); /* use common routine */ -} - - -/* - * Forcibly suppress or un-suppress all quantization and Huffman tables. - * Marks all currently defined tables as already written (if suppress) - * or not written (if !suppress). This will control whether they get emitted - * by a subsequent jpeg_start_compress call. - * - * This routine is exported for use by applications that want to produce - * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but - * since it is called by jpeg_start_compress, we put it here --- otherwise - * jcparam.o would be linked whether the application used it or not. - */ - -GLOBAL(void) -jpeg_suppress_tables (j_compress_ptr cinfo, wxjpeg_boolean suppress) -{ - int i; - JQUANT_TBL * qtbl; - JHUFF_TBL * htbl; - - for (i = 0; i < NUM_QUANT_TBLS; i++) { - if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) - qtbl->sent_table = suppress; - } - - for (i = 0; i < NUM_HUFF_TBLS; i++) { - if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) - htbl->sent_table = suppress; - if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) - htbl->sent_table = suppress; - } -} - - -/* - * Finish JPEG compression. - * - * If a multipass operating mode was selected, this may do a great deal of - * work including most of the actual output. - */ - -GLOBAL(void) -jpeg_finish_compress (j_compress_ptr cinfo) -{ - JDIMENSION iMCU_row; - - if (cinfo->global_state == CSTATE_SCANNING || - cinfo->global_state == CSTATE_RAW_OK) { - /* Terminate first pass */ - if (cinfo->next_scanline < cinfo->image_height) - ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); - (*cinfo->master->finish_pass) (cinfo); - } else if (cinfo->global_state != CSTATE_WRCOEFS) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - /* Perform any remaining passes */ - while (! cinfo->master->is_last_pass) { - (*cinfo->master->prepare_for_pass) (cinfo); - for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) iMCU_row; - cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - /* We bypass the main controller and invoke coef controller directly; - * all work is being done from the coefficient buffer. - */ - if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) - ERREXIT(cinfo, JERR_CANT_SUSPEND); - } - (*cinfo->master->finish_pass) (cinfo); - } - /* Write EOI, do final cleanup */ - (*cinfo->marker->write_file_trailer) (cinfo); - (*cinfo->dest->term_destination) (cinfo); - /* We can use jpeg_abort to release memory and reset global_state */ - jpeg_abort((j_common_ptr) cinfo); -} - - -/* - * Write a special marker. - * This is only recommended for writing COM or APPn markers. - * Must be called after jpeg_start_compress() and before - * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). - */ - -GLOBAL(void) -jpeg_write_marker (j_compress_ptr cinfo, int marker, - const JOCTET *dataptr, unsigned int datalen) -{ - JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); - - if (cinfo->next_scanline != 0 || - (cinfo->global_state != CSTATE_SCANNING && - cinfo->global_state != CSTATE_RAW_OK && - cinfo->global_state != CSTATE_WRCOEFS)) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); - write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ - while (datalen--) { - (*write_marker_byte) (cinfo, *dataptr); - dataptr++; - } -} - -/* Same, but piecemeal. */ - -GLOBAL(void) -jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) -{ - if (cinfo->next_scanline != 0 || - (cinfo->global_state != CSTATE_SCANNING && - cinfo->global_state != CSTATE_RAW_OK && - cinfo->global_state != CSTATE_WRCOEFS)) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); -} - -GLOBAL(void) -jpeg_write_m_byte (j_compress_ptr cinfo, int val) -{ - (*cinfo->marker->write_marker_byte) (cinfo, val); -} - - -/* - * Alternate compression function: just write an abbreviated table file. - * Before calling this, all parameters and a data destination must be set up. - * - * To produce a pair of files containing abbreviated tables and abbreviated - * image data, one would proceed as follows: - * - * initialize JPEG object - * set JPEG parameters - * set destination to table file - * jpeg_write_tables(cinfo); - * set destination to image file - * jpeg_start_compress(cinfo, FALSE); - * write data... - * jpeg_finish_compress(cinfo); - * - * jpeg_write_tables has the side effect of marking all tables written - * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress - * will not re-emit the tables unless it is passed write_all_tables=TRUE. - */ - -GLOBAL(void) -jpeg_write_tables (j_compress_ptr cinfo) -{ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - /* (Re)initialize error mgr and destination modules */ - (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); - (*cinfo->dest->init_destination) (cinfo); - /* Initialize the marker writer ... bit of a crock to do it here. */ - jinit_marker_writer(cinfo); - /* Write them tables! */ - (*cinfo->marker->write_tables_only) (cinfo); - /* And clean up. */ - (*cinfo->dest->term_destination) (cinfo); - /* - * In library releases up through v6a, we called jpeg_abort() here to free - * any working memory allocated by the destination manager and marker - * writer. Some applications had a problem with that: they allocated space - * of their own from the library memory manager, and didn't want it to go - * away during write_tables. So now we do nothing. This will cause a - * memory leak if an app calls write_tables repeatedly without doing a full - * compression cycle or otherwise resetting the JPEG object. However, that - * seems less bad than unexpectedly freeing memory in the normal case. - * An app that prefers the old behavior can call jpeg_abort for itself after - * each call to jpeg_write_tables(). - */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jcapistd.c b/Source/3rdParty/wx/src/jpeg/jcapistd.c deleted file mode 100644 index c138b7c12..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcapistd.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * jcapistd.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains application interface code for the compression half - * of the JPEG library. These are the "standard" API routines that are - * used in the normal full-compression case. They are not used by a - * transcoding-only application. Note that if an application links in - * jpeg_start_compress, it will end up linking in the entire compressor. - * We thus must separate this file from jcapimin.c to avoid linking the - * whole compression library into a transcoder. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Compression initialization. - * Before calling this, all parameters and a data destination must be set up. - * - * We require a write_all_tables parameter as a failsafe check when writing - * multiple datastreams from the same compression object. Since prior runs - * will have left all the tables marked sent_table=TRUE, a subsequent run - * would emit an abbreviated stream (no tables) by default. This may be what - * is wanted, but for safety's sake it should not be the default behavior: - * programmers should have to make a deliberate choice to emit abbreviated - * images. Therefore the documentation and examples should encourage people - * to pass write_all_tables=TRUE; then it will take active thought to do the - * wrong thing. - */ - -GLOBAL(void) -jpeg_start_compress (j_compress_ptr cinfo, wxjpeg_boolean write_all_tables) -{ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - if (write_all_tables) - jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ - - /* (Re)initialize error mgr and destination modules */ - (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); - (*cinfo->dest->init_destination) (cinfo); - /* Perform master selection of active modules */ - jinit_compress_master(cinfo); - /* Set up for the first pass */ - (*cinfo->master->prepare_for_pass) (cinfo); - /* Ready for application to drive first pass through jpeg_write_scanlines - * or jpeg_write_raw_data. - */ - cinfo->next_scanline = 0; - cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING); -} - - -/* - * Write some scanlines of data to the JPEG compressor. - * - * The return value will be the number of lines actually written. - * This should be less than the supplied num_lines only in case that - * the data destination module has requested suspension of the compressor, - * or if more than image_height scanlines are passed in. - * - * Note: we warn about excess calls to jpeg_write_scanlines() since - * this likely signals an application programmer error. However, - * excess scanlines passed in the last valid call are *silently* ignored, - * so that the application need not adjust num_lines for end-of-image - * when using a multiple-scanline buffer. - */ - -GLOBAL(JDIMENSION) -jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, - JDIMENSION num_lines) -{ - JDIMENSION row_ctr, rows_left; - - if (cinfo->global_state != CSTATE_SCANNING) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - if (cinfo->next_scanline >= cinfo->image_height) - WARNMS(cinfo, JWRN_TOO_MUCH_DATA); - - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->next_scanline; - cinfo->progress->pass_limit = (long) cinfo->image_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - - /* Give master control module another chance if this is first call to - * jpeg_write_scanlines. This lets output of the frame/scan headers be - * delayed so that application can write COM, etc, markers between - * jpeg_start_compress and jpeg_write_scanlines. - */ - if (cinfo->master->call_pass_startup) - (*cinfo->master->pass_startup) (cinfo); - - /* Ignore any extra scanlines at bottom of image. */ - rows_left = cinfo->image_height - cinfo->next_scanline; - if (num_lines > rows_left) - num_lines = rows_left; - - row_ctr = 0; - (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); - cinfo->next_scanline += row_ctr; - return row_ctr; -} - - -/* - * Alternate entry point to write raw data. - * Processes exactly one iMCU row per call, unless suspended. - */ - -GLOBAL(JDIMENSION) -jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION num_lines) -{ - JDIMENSION lines_per_iMCU_row; - - if (cinfo->global_state != CSTATE_RAW_OK) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - if (cinfo->next_scanline >= cinfo->image_height) { - WARNMS(cinfo, JWRN_TOO_MUCH_DATA); - return 0; - } - - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->next_scanline; - cinfo->progress->pass_limit = (long) cinfo->image_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - - /* Give master control module another chance if this is first call to - * jpeg_write_raw_data. This lets output of the frame/scan headers be - * delayed so that application can write COM, etc, markers between - * jpeg_start_compress and jpeg_write_raw_data. - */ - if (cinfo->master->call_pass_startup) - (*cinfo->master->pass_startup) (cinfo); - - /* Verify that at least one iMCU row has been passed. */ - lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE; - if (num_lines < lines_per_iMCU_row) - ERREXIT(cinfo, JERR_BUFFER_SIZE); - - /* Directly compress the row. */ - if (! (*cinfo->coef->compress_data) (cinfo, data)) { - /* If compressor did not consume the whole row, suspend processing. */ - return 0; - } - - /* OK, we processed one iMCU row. */ - cinfo->next_scanline += lines_per_iMCU_row; - return lines_per_iMCU_row; -} diff --git a/Source/3rdParty/wx/src/jpeg/jccoefct.c b/Source/3rdParty/wx/src/jpeg/jccoefct.c deleted file mode 100644 index 3315f21b3..000000000 --- a/Source/3rdParty/wx/src/jpeg/jccoefct.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * jccoefct.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the coefficient buffer controller for compression. - * This controller is the top level of the JPEG compressor proper. - * The coefficient buffer lies between forward-DCT and entropy encoding steps. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* We use a full-image coefficient buffer when doing Huffman optimization, - * and also for writing multiple-scan JPEG files. In all cases, the DCT - * step is run during the first pass, and subsequent passes need only read - * the buffered coefficients. - */ -#ifdef ENTROPY_OPT_SUPPORTED -#define FULL_COEF_BUFFER_SUPPORTED -#else -#ifdef C_MULTISCAN_FILES_SUPPORTED -#define FULL_COEF_BUFFER_SUPPORTED -#endif -#endif - - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_c_coef_controller pub; /* public fields */ - - JDIMENSION iMCU_row_num; /* iMCU row # within image */ - JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ - - /* For single-pass compression, it's sufficient to buffer just one MCU - * (although this may prove a bit slow in practice). We allocate a - * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each - * MCU constructed and sent. (On 80x86, the workspace is FAR even though - * it's not really very big; this is to keep the module interfaces unchanged - * when a large coefficient buffer is necessary.) - * In multi-pass modes, this array points to the current MCU's blocks - * within the virtual arrays. - */ - JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; - - /* In multi-pass modes, we need a virtual block array for each component. */ - jvirt_barray_ptr whole_image[MAX_COMPONENTS]; -} my_coef_controller; - -typedef my_coef_controller * my_coef_ptr; - - -/* Forward declarations */ -METHODDEF(wxjpeg_boolean) compress_data - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); -#ifdef FULL_COEF_BUFFER_SUPPORTED -METHODDEF(wxjpeg_boolean) compress_first_pass - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); -METHODDEF(wxjpeg_boolean) compress_output - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); -#endif - - -LOCAL(void) -start_iMCU_row (j_compress_ptr cinfo) -/* Reset within-iMCU-row counters for a new row */ -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - /* In an interleaved scan, an MCU row is the same as an iMCU row. - * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. - * But at the bottom of the image, process only what's left. - */ - if (cinfo->comps_in_scan > 1) { - coef->MCU_rows_per_iMCU_row = 1; - } else { - if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; - else - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; - } - - coef->mcu_ctr = 0; - coef->MCU_vert_offset = 0; -} - - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - coef->iMCU_row_num = 0; - start_iMCU_row(cinfo); - - switch (pass_mode) { - case JBUF_PASS_THRU: - if (coef->whole_image[0] != NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - coef->pub.compress_data = compress_data; - break; -#ifdef FULL_COEF_BUFFER_SUPPORTED - case JBUF_SAVE_AND_PASS: - if (coef->whole_image[0] == NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - coef->pub.compress_data = compress_first_pass; - break; - case JBUF_CRANK_DEST: - if (coef->whole_image[0] == NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - coef->pub.compress_data = compress_output; - break; -#endif - default: - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - break; - } -} - - -/* - * Process some data in the single-pass case. - * We process the equivalent of one fully interleaved MCU row ("iMCU" row) - * per call, ie, v_samp_factor block rows for each component in the image. - * Returns TRUE if the iMCU row is completed, FALSE if suspended. - * - * NB: input_buf contains a plane for each component in image, - * which we index according to the component's SOF position. - */ - -METHODDEF(wxjpeg_boolean) -compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ - JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - int blkn, bi, ci, yindex, yoffset, blockcnt; - JDIMENSION ypos, xpos; - jpeg_component_info *compptr; - - /* Loop to write as much as one whole iMCU row */ - for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; - yoffset++) { - for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col; - MCU_col_num++) { - /* Determine where data comes from in input_buf and do the DCT thing. - * Each call on forward_DCT processes a horizontal row of DCT blocks - * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks - * sequentially. Dummy blocks at the right or bottom edge are filled in - * specially. The data in them does not matter for image reconstruction, - * so we fill them with values that will encode to the smallest amount of - * data, viz: all zeroes in the AC entries, DC entries equal to previous - * block's DC value. (Thanks to Thomas Kinsman for this idea.) - */ - blkn = 0; - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - xpos = MCU_col_num * compptr->MCU_sample_width; - ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (coef->iMCU_row_num < last_iMCU_row || - yoffset+yindex < compptr->last_row_height) { - (*cinfo->fdct->forward_DCT) (cinfo, compptr, - input_buf[compptr->component_index], - coef->MCU_buffer[blkn], - ypos, xpos, (JDIMENSION) blockcnt); - if (blockcnt < compptr->MCU_width) { - /* Create some dummy blocks at the right edge of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], - (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); - for (bi = blockcnt; bi < compptr->MCU_width; bi++) { - coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; - } - } - } else { - /* Create a row of dummy blocks at the bottom of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn], - compptr->MCU_width * SIZEOF(JBLOCK)); - for (bi = 0; bi < compptr->MCU_width; bi++) { - coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; - } - } - blkn += compptr->MCU_width; - ypos += DCTSIZE; - } - } - /* Try to write the MCU. In event of a suspension failure, we will - * re-DCT the MCU on restart (a bit inefficient, could be fixed...) - */ - if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; - } - } - /* Completed an MCU row, but perhaps not an iMCU row */ - coef->mcu_ctr = 0; - } - /* Completed the iMCU row, advance counters for next one */ - coef->iMCU_row_num++; - start_iMCU_row(cinfo); - return TRUE; -} - - -#ifdef FULL_COEF_BUFFER_SUPPORTED - -/* - * Process some data in the first pass of a multi-pass case. - * We process the equivalent of one fully interleaved MCU row ("iMCU" row) - * per call, ie, v_samp_factor block rows for each component in the image. - * This amount of data is read from the source buffer, DCT'd and quantized, - * and saved into the virtual arrays. We also generate suitable dummy blocks - * as needed at the right and lower edges. (The dummy blocks are constructed - * in the virtual arrays, which have been padded appropriately.) This makes - * it possible for subsequent passes not to worry about real vs. dummy blocks. - * - * We must also emit the data to the entropy encoder. This is conveniently - * done by calling compress_output() after we've loaded the current strip - * of the virtual arrays. - * - * NB: input_buf contains a plane for each component in image. All - * components are DCT'd and loaded into the virtual arrays in this pass. - * However, it may be that only a subset of the components are emitted to - * the entropy encoder during this first pass; be careful about looking - * at the scan-dependent variables (MCU dimensions, etc). - */ - -METHODDEF(wxjpeg_boolean) -compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - JDIMENSION blocks_across, MCUs_across, MCUindex; - int bi, ci, h_samp_factor, block_row, block_rows, ndummy; - JCOEF lastDC; - jpeg_component_info *compptr; - JBLOCKARRAY buffer; - JBLOCKROW thisblockrow, lastblockrow; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Align the virtual buffer for this component. */ - buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); - /* Count non-dummy DCT block rows in this iMCU row. */ - if (coef->iMCU_row_num < last_iMCU_row) - block_rows = compptr->v_samp_factor; - else { - /* NB: can't use last_row_height here, since may not be set! */ - block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); - if (block_rows == 0) block_rows = compptr->v_samp_factor; - } - blocks_across = compptr->width_in_blocks; - h_samp_factor = compptr->h_samp_factor; - /* Count number of dummy blocks to be added at the right margin. */ - ndummy = (int) (blocks_across % h_samp_factor); - if (ndummy > 0) - ndummy = h_samp_factor - ndummy; - /* Perform DCT for all non-dummy blocks in this iMCU row. Each call - * on forward_DCT processes a complete horizontal row of DCT blocks. - */ - for (block_row = 0; block_row < block_rows; block_row++) { - thisblockrow = buffer[block_row]; - (*cinfo->fdct->forward_DCT) (cinfo, compptr, - input_buf[ci], thisblockrow, - (JDIMENSION) (block_row * DCTSIZE), - (JDIMENSION) 0, blocks_across); - if (ndummy > 0) { - /* Create dummy blocks at the right edge of the image. */ - thisblockrow += blocks_across; /* => first dummy block */ - jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); - lastDC = thisblockrow[-1][0]; - for (bi = 0; bi < ndummy; bi++) { - thisblockrow[bi][0] = lastDC; - } - } - } - /* If at end of image, create dummy block rows as needed. - * The tricky part here is that within each MCU, we want the DC values - * of the dummy blocks to match the last real block's DC value. - * This squeezes a few more bytes out of the resulting file... - */ - if (coef->iMCU_row_num == last_iMCU_row) { - blocks_across += ndummy; /* include lower right corner */ - MCUs_across = blocks_across / h_samp_factor; - for (block_row = block_rows; block_row < compptr->v_samp_factor; - block_row++) { - thisblockrow = buffer[block_row]; - lastblockrow = buffer[block_row-1]; - jzero_far((void FAR *) thisblockrow, - (size_t) (blocks_across * SIZEOF(JBLOCK))); - for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { - lastDC = lastblockrow[h_samp_factor-1][0]; - for (bi = 0; bi < h_samp_factor; bi++) { - thisblockrow[bi][0] = lastDC; - } - thisblockrow += h_samp_factor; /* advance to next MCU in row */ - lastblockrow += h_samp_factor; - } - } - } - } - /* NB: compress_output will increment iMCU_row_num if successful. - * A suspension return will result in redoing all the work above next time. - */ - - /* Emit data to the entropy encoder, sharing code with subsequent passes */ - return compress_output(cinfo, input_buf); -} - - -/* - * Process some data in subsequent passes of a multi-pass case. - * We process the equivalent of one fully interleaved MCU row ("iMCU" row) - * per call, ie, v_samp_factor block rows for each component in the scan. - * The data is obtained from the virtual arrays and fed to the entropy coder. - * Returns TRUE if the iMCU row is completed, FALSE if suspended. - * - * NB: input_buf is ignored; it is likely to be a NULL pointer. - */ - -METHODDEF(wxjpeg_boolean) -compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ - int blkn, ci, xindex, yindex, yoffset; - JDIMENSION start_col; - JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; - JBLOCKROW buffer_ptr; - jpeg_component_info *compptr; - - /* Align the virtual buffers for the components used in this scan. - * NB: during first pass, this is safe only because the buffers will - * already be aligned properly, so jmemmgr.c won't need to do any I/O. - */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - buffer[ci] = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], - coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } - - /* Loop to process one whole iMCU row */ - for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; - yoffset++) { - for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { - /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < compptr->MCU_width; xindex++) { - coef->MCU_buffer[blkn++] = buffer_ptr++; - } - } - } - /* Try to write the MCU. */ - if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; - } - } - /* Completed an MCU row, but perhaps not an iMCU row */ - coef->mcu_ctr = 0; - } - /* Completed the iMCU row, advance counters for next one */ - coef->iMCU_row_num++; - start_iMCU_row(cinfo); - return TRUE; -} - -#endif /* FULL_COEF_BUFFER_SUPPORTED */ - - -/* - * Initialize coefficient buffer controller. - */ - -GLOBAL(void) -jinit_c_coef_controller (j_compress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_coef_ptr coef; - - coef = (my_coef_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); - cinfo->coef = (struct jpeg_c_coef_controller *) coef; - coef->pub.start_pass = start_pass_coef; - - /* Create the coefficient buffer. */ - if (need_full_buffer) { -#ifdef FULL_COEF_BUFFER_SUPPORTED - /* Allocate a full-image virtual array for each component, */ - /* padded to a multiple of samp_factor DCT blocks in each direction. */ - int ci; - jpeg_component_info *compptr; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) compptr->v_samp_factor); - } -#else - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); -#endif - } else { - /* We only need a single-MCU buffer. */ - JBLOCKROW buffer; - int i; - - buffer = (JBLOCKROW) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { - coef->MCU_buffer[i] = buffer + i; - } - coef->whole_image[0] = NULL; /* flag for no virtual arrays */ - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jccolor.c b/Source/3rdParty/wx/src/jpeg/jccolor.c deleted file mode 100644 index 2f74cc2a3..000000000 --- a/Source/3rdParty/wx/src/jpeg/jccolor.c +++ /dev/null @@ -1,459 +0,0 @@ -/* - * jccolor.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains input colorspace conversion routines. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Private subobject */ - -typedef struct { - struct jpeg_color_converter pub; /* public fields */ - - /* Private state for RGB->YCC conversion */ - JPEG_INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ -} my_color_converter; - -typedef my_color_converter * my_cconvert_ptr; - - -/**************** RGB -> YCbCr conversion: most common case **************/ - -/* - * YCbCr is defined per CCIR 601-1, except that Cb and Cr are - * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. - * The conversion equations to be implemented are therefore - * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) - * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, - * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and - * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0) - * were not represented exactly. Now we sacrifice exact representation of - * maximum red and maximum blue in order to get exact grayscales. - * - * To avoid floating-point arithmetic, we represent the fractional constants - * as integers scaled up by 2^16 (about 4 digits precision); we have to divide - * the products by 2^16, with appropriate rounding, to get the correct answer. - * - * For even more speed, we avoid doing any multiplications in the inner loop - * by precalculating the constants times R,G,B for all possible values. - * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); - * for 12-bit samples it is still acceptable. It's not very reasonable for - * 16-bit samples, but if you want lossless storage you shouldn't be changing - * colorspace anyway. - * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included - * in the tables to save adding them separately in the inner loop. - */ - -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define CBCR_OFFSET ((JPEG_INT32) CENTERJSAMPLE << SCALEBITS) -#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((JPEG_INT32) ((x) * (1L< Y section */ -#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ -#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ -#define R_CB_OFF (3*(MAXJSAMPLE+1)) -#define G_CB_OFF (4*(MAXJSAMPLE+1)) -#define B_CB_OFF (5*(MAXJSAMPLE+1)) -#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */ -#define G_CR_OFF (6*(MAXJSAMPLE+1)) -#define B_CR_OFF (7*(MAXJSAMPLE+1)) -#define TABLE_SIZE (8*(MAXJSAMPLE+1)) - - -/* - * Initialize for RGB->YCC colorspace conversion. - */ - -METHODDEF(void) -rgb_ycc_start (j_compress_ptr cinfo) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - JPEG_INT32 * rgb_ycc_tab; - JPEG_INT32 i; - - /* Allocate and fill in the conversion tables. */ - cconvert->rgb_ycc_tab = rgb_ycc_tab = (JPEG_INT32 *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(JPEG_INT32))); - - for (i = 0; i <= MAXJSAMPLE; i++) { - rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; - rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i; - rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF; - rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i; - rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i; - /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. - * This ensures that the maximum output will round to MAXJSAMPLE - * not MAXJSAMPLE+1, and thus that we don't have to range-limit. - */ - rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; -/* B=>Cb and R=>Cr tables are the same - rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; -*/ - rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i; - rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i; - } -} - - -/* - * Convert some rows of samples to the JPEG colorspace. - * - * Note that we change from the application's interleaved-pixel format - * to our internal noninterleaved, one-plane-per-component format. - * The input buffer is therefore three times as wide as the output buffer. - * - * A starting row offset is provided only for the output buffer. The caller - * can easily adjust the passed input_buf value to accommodate any row - * offset required on that side. - */ - -METHODDEF(void) -rgb_ycc_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; - register JSAMPROW inptr; - register JSAMPROW outptr0, outptr1, outptr2; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr0 = output_buf[0][output_row]; - outptr1 = output_buf[1][output_row]; - outptr2 = output_buf[2][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[RGB_RED]); - g = GETJSAMPLE(inptr[RGB_GREEN]); - b = GETJSAMPLE(inptr[RGB_BLUE]); - inptr += RGB_PIXELSIZE; - /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations - * must be too; we do not need an explicit range-limiting operation. - * Hence the value being shifted is never negative, and we don't - * need the general RIGHT_SHIFT macro. - */ - /* Y */ - outptr0[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); - /* Cb */ - outptr1[col] = (JSAMPLE) - ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) - >> SCALEBITS); - /* Cr */ - outptr2[col] = (JSAMPLE) - ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) - >> SCALEBITS); - } - } -} - - -/**************** Cases other than RGB -> YCbCr **************/ - - -/* - * Convert some rows of samples to the JPEG colorspace. - * This version handles RGB->grayscale conversion, which is the same - * as the RGB->Y portion of RGB->YCbCr. - * We assume rgb_ycc_start has been called (we only use the Y tables). - */ - -METHODDEF(void) -rgb_gray_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; - register JSAMPROW inptr; - register JSAMPROW outptr; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr = output_buf[0][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[RGB_RED]); - g = GETJSAMPLE(inptr[RGB_GREEN]); - b = GETJSAMPLE(inptr[RGB_BLUE]); - inptr += RGB_PIXELSIZE; - /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); - } - } -} - - -/* - * Convert some rows of samples to the JPEG colorspace. - * This version handles Adobe-style CMYK->YCCK conversion, - * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same - * conversion as above, while passing K (black) unchanged. - * We assume rgb_ycc_start has been called. - */ - -METHODDEF(void) -cmyk_ycck_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; - register JSAMPROW inptr; - register JSAMPROW outptr0, outptr1, outptr2, outptr3; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr0 = output_buf[0][output_row]; - outptr1 = output_buf[1][output_row]; - outptr2 = output_buf[2][output_row]; - outptr3 = output_buf[3][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - r = MAXJSAMPLE - GETJSAMPLE(inptr[0]); - g = MAXJSAMPLE - GETJSAMPLE(inptr[1]); - b = MAXJSAMPLE - GETJSAMPLE(inptr[2]); - /* K passes through as-is */ - outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */ - inptr += 4; - /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations - * must be too; we do not need an explicit range-limiting operation. - * Hence the value being shifted is never negative, and we don't - * need the general RIGHT_SHIFT macro. - */ - /* Y */ - outptr0[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); - /* Cb */ - outptr1[col] = (JSAMPLE) - ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) - >> SCALEBITS); - /* Cr */ - outptr2[col] = (JSAMPLE) - ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) - >> SCALEBITS); - } - } -} - - -/* - * Convert some rows of samples to the JPEG colorspace. - * This version handles grayscale output with no conversion. - * The source can be either plain grayscale or YCbCr (since Y == gray). - */ - -METHODDEF(void) -grayscale_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) -{ - register JSAMPROW inptr; - register JSAMPROW outptr; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - int instride = cinfo->input_components; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr = output_buf[0][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */ - inptr += instride; - } - } -} - - -/* - * Convert some rows of samples to the JPEG colorspace. - * This version handles multi-component colorspaces without conversion. - * We assume input_components == num_components. - */ - -METHODDEF(void) -null_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) -{ - register JSAMPROW inptr; - register JSAMPROW outptr; - register JDIMENSION col; - register int ci; - int nc = cinfo->num_components; - JDIMENSION num_cols = cinfo->image_width; - - while (--num_rows >= 0) { - /* It seems fastest to make a separate pass for each component. */ - for (ci = 0; ci < nc; ci++) { - inptr = *input_buf; - outptr = output_buf[ci][output_row]; - for (col = 0; col < num_cols; col++) { - outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ - inptr += nc; - } - } - input_buf++; - output_row++; - } -} - - -/* - * Empty method for start_pass. - */ - -METHODDEF(void) -null_method (j_compress_ptr cinfo) -{ - /* no work needed */ -} - - -/* - * Module initialization routine for input colorspace conversion. - */ - -GLOBAL(void) -jinit_color_converter (j_compress_ptr cinfo) -{ - my_cconvert_ptr cconvert; - - cconvert = (my_cconvert_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_converter)); - cinfo->cconvert = (struct jpeg_color_converter *) cconvert; - /* set start_pass to null method until we find out differently */ - cconvert->pub.start_pass = null_method; - - /* Make sure input_components agrees with in_color_space */ - switch (cinfo->in_color_space) { - case JCS_GRAYSCALE: - if (cinfo->input_components != 1) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; - - case JCS_RGB: -#if RGB_PIXELSIZE != 3 - if (cinfo->input_components != RGB_PIXELSIZE) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; -#endif /* else share code with YCbCr */ - - case JCS_YCbCr: - if (cinfo->input_components != 3) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; - - case JCS_CMYK: - case JCS_YCCK: - if (cinfo->input_components != 4) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; - - default: /* JCS_UNKNOWN can be anything */ - if (cinfo->input_components < 1) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; - } - - /* Check num_components, set conversion method based on requested space */ - switch (cinfo->jpeg_color_space) { - case JCS_GRAYSCALE: - if (cinfo->num_components != 1) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_GRAYSCALE) - cconvert->pub.color_convert = grayscale_convert; - else if (cinfo->in_color_space == JCS_RGB) { - cconvert->pub.start_pass = rgb_ycc_start; - cconvert->pub.color_convert = rgb_gray_convert; - } else if (cinfo->in_color_space == JCS_YCbCr) - cconvert->pub.color_convert = grayscale_convert; - else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_RGB: - if (cinfo->num_components != 3) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3) - cconvert->pub.color_convert = null_convert; - else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_YCbCr: - if (cinfo->num_components != 3) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_RGB) { - cconvert->pub.start_pass = rgb_ycc_start; - cconvert->pub.color_convert = rgb_ycc_convert; - } else if (cinfo->in_color_space == JCS_YCbCr) - cconvert->pub.color_convert = null_convert; - else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_CMYK: - if (cinfo->num_components != 4) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_CMYK) - cconvert->pub.color_convert = null_convert; - else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_YCCK: - if (cinfo->num_components != 4) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_CMYK) { - cconvert->pub.start_pass = rgb_ycc_start; - cconvert->pub.color_convert = cmyk_ycck_convert; - } else if (cinfo->in_color_space == JCS_YCCK) - cconvert->pub.color_convert = null_convert; - else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - default: /* allow null conversion of JCS_UNKNOWN */ - if (cinfo->jpeg_color_space != cinfo->in_color_space || - cinfo->num_components != cinfo->input_components) - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - cconvert->pub.color_convert = null_convert; - break; - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jcdctmgr.c b/Source/3rdParty/wx/src/jpeg/jcdctmgr.c deleted file mode 100644 index 03ffc8ae4..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcdctmgr.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * jcdctmgr.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the forward-DCT management logic. - * This code selects a particular DCT implementation to be used, - * and it performs related housekeeping chores including coefficient - * quantization. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - - -/* Private subobject for this module */ - -typedef struct { - struct jpeg_forward_dct pub; /* public fields */ - - /* Pointer to the DCT routine actually in use */ - forward_DCT_method_ptr do_dct; - - /* The actual post-DCT divisors --- not identical to the quant table - * entries, because of scaling (especially for an unnormalized DCT). - * Each table is given in normal array order. - */ - DCTELEM * divisors[NUM_QUANT_TBLS]; - -#ifdef DCT_FLOAT_SUPPORTED - /* Same as above for the floating-point case. */ - float_DCT_method_ptr do_float_dct; - FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; -#endif -} my_fdct_controller; - -typedef my_fdct_controller * my_fdct_ptr; - - -/* - * Initialize for a processing pass. - * Verify that all referenced Q-tables are present, and set up - * the divisor table for each one. - * In the current implementation, DCT of all components is done during - * the first pass, even if only some components will be output in the - * first scan. Hence all components should be examined here. - */ - -METHODDEF(void) -start_pass_fdctmgr (j_compress_ptr cinfo) -{ - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; - int ci, qtblno, i; - jpeg_component_info *compptr; - JQUANT_TBL * qtbl; - DCTELEM * dtbl; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - qtblno = compptr->quant_tbl_no; - /* Make sure specified quantization table is present */ - if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || - cinfo->quant_tbl_ptrs[qtblno] == NULL) - ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); - qtbl = cinfo->quant_tbl_ptrs[qtblno]; - /* Compute divisors for this quant table */ - /* We may do this more than once for same table, but it's not a big deal */ - switch (cinfo->dct_method) { -#ifdef DCT_ISLOW_SUPPORTED - case JDCT_ISLOW: - /* For LL&M IDCT method, divisors are equal to raw quantization - * coefficients multiplied by 8 (to counteract scaling). - */ - if (fdct->divisors[qtblno] == NULL) { - fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(DCTELEM)); - } - dtbl = fdct->divisors[qtblno]; - for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; - } - break; -#endif -#ifdef DCT_IFAST_SUPPORTED - case JDCT_IFAST: - { - /* For AA&N IDCT method, divisors are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * We apply a further scale factor of 8. - */ -#define CONST_BITS 14 - static const INT16 aanscales[DCTSIZE2] = { - /* precomputed values scaled up by 14 bits */ - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, - 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 - }; - SHIFT_TEMPS - - if (fdct->divisors[qtblno] == NULL) { - fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(DCTELEM)); - } - dtbl = fdct->divisors[qtblno]; - for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = (DCTELEM) - DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[i], - (JPEG_INT32) aanscales[i]), - CONST_BITS-3); - } - } - break; -#endif -#ifdef DCT_FLOAT_SUPPORTED - case JDCT_FLOAT: - { - /* For float AA&N IDCT method, divisors are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * We apply a further scale factor of 8. - * What's actually stored is 1/divisor so that the inner loop can - * use a multiplication rather than a division. - */ - FAST_FLOAT * fdtbl; - int row, col; - static const double aanscalefactor[DCTSIZE] = { - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - }; - - if (fdct->float_divisors[qtblno] == NULL) { - fdct->float_divisors[qtblno] = (FAST_FLOAT *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(FAST_FLOAT)); - } - fdtbl = fdct->float_divisors[qtblno]; - i = 0; - for (row = 0; row < DCTSIZE; row++) { - for (col = 0; col < DCTSIZE; col++) { - fdtbl[i] = (FAST_FLOAT) - (1.0 / (((double) qtbl->quantval[i] * - aanscalefactor[row] * aanscalefactor[col] * 8.0))); - i++; - } - } - } - break; -#endif - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; - } - } -} - - -/* - * Perform forward DCT on one or more blocks of a component. - * - * The input samples are taken from the sample_data[] array starting at - * position start_row/start_col, and moving to the right for any additional - * blocks. The quantized coefficients are returned in coef_blocks[]. - */ - -METHODDEF(void) -forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks) -/* This version is used for integer DCT implementations. */ -{ - /* This routine is heavily used, so it's worth coding it tightly. */ - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; - forward_DCT_method_ptr do_dct = fdct->do_dct; - DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; - DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ - JDIMENSION bi; - - sample_data += start_row; /* fold in the vertical offset once */ - - for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { - /* Load data into workspace, applying unsigned->signed conversion */ - { register DCTELEM *workspaceptr; - register JSAMPROW elemptr; - register int elemr; - - workspaceptr = workspace; - for (elemr = 0; elemr < DCTSIZE; elemr++) { - elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; -#else - { register int elemc; - for (elemc = DCTSIZE; elemc > 0; elemc--) { - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - } - } -#endif - } - } - - /* Perform the DCT */ - (*do_dct) (workspace); - - /* Quantize/descale the coefficients, and store into coef_blocks[] */ - { register DCTELEM temp, qval; - register int i; - register JCOEFPTR output_ptr = coef_blocks[bi]; - - for (i = 0; i < DCTSIZE2; i++) { - qval = divisors[i]; - temp = workspace[i]; - /* Divide the coefficient value by qval, ensuring proper rounding. - * Since C does not specify the direction of rounding for negative - * quotients, we have to force the dividend positive for portability. - * - * In most files, at least half of the output values will be zero - * (at default quantization settings, more like three-quarters...) - * so we should ensure that this case is fast. On many machines, - * a comparison is enough cheaper than a divide to make a special test - * a win. Since both inputs will be nonnegative, we need only test - * for a < b to discover whether a/b is 0. - * If your machine's division is fast enough, define FAST_DIVIDE. - */ -#ifdef FAST_DIVIDE -#define DIVIDE_BY(a,b) a /= b -#else -#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 -#endif - if (temp < 0) { - temp = -temp; - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - temp = -temp; - } else { - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - } - output_ptr[i] = (JCOEF) temp; - } - } - } -} - - -#ifdef DCT_FLOAT_SUPPORTED - -METHODDEF(void) -forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks) -/* This version is used for floating-point DCT implementations. */ -{ - /* This routine is heavily used, so it's worth coding it tightly. */ - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; - float_DCT_method_ptr do_dct = fdct->do_float_dct; - FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; - FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ - JDIMENSION bi; - - sample_data += start_row; /* fold in the vertical offset once */ - - for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { - /* Load data into workspace, applying unsigned->signed conversion */ - { register FAST_FLOAT *workspaceptr; - register JSAMPROW elemptr; - register int elemr; - - workspaceptr = workspace; - for (elemr = 0; elemr < DCTSIZE; elemr++) { - elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); -#else - { register int elemc; - for (elemc = DCTSIZE; elemc > 0; elemc--) { - *workspaceptr++ = (FAST_FLOAT) - (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - } - } -#endif - } - } - - /* Perform the DCT */ - (*do_dct) (workspace); - - /* Quantize/descale the coefficients, and store into coef_blocks[] */ - { register FAST_FLOAT temp; - register int i; - register JCOEFPTR output_ptr = coef_blocks[bi]; - - for (i = 0; i < DCTSIZE2; i++) { - /* Apply the quantization and scaling factor */ - temp = workspace[i] * divisors[i]; - /* Round to nearest integer. - * Since C does not specify the direction of rounding for negative - * quotients, we have to force the dividend positive for portability. - * The maximum coefficient size is +-16K (for 12-bit data), so this - * code should work for either 16-bit or 32-bit ints. - */ - output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); - } - } - } -} - -#endif /* DCT_FLOAT_SUPPORTED */ - - -/* - * Initialize FDCT manager. - */ - -GLOBAL(void) -jinit_forward_dct (j_compress_ptr cinfo) -{ - my_fdct_ptr fdct; - int i; - - fdct = (my_fdct_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_fdct_controller)); - cinfo->fdct = (struct jpeg_forward_dct *) fdct; - fdct->pub.start_pass = start_pass_fdctmgr; - - switch (cinfo->dct_method) { -#ifdef DCT_ISLOW_SUPPORTED - case JDCT_ISLOW: - fdct->pub.forward_DCT = forward_DCT; - fdct->do_dct = jpeg_fdct_islow; - break; -#endif -#ifdef DCT_IFAST_SUPPORTED - case JDCT_IFAST: - fdct->pub.forward_DCT = forward_DCT; - fdct->do_dct = jpeg_fdct_ifast; - break; -#endif -#ifdef DCT_FLOAT_SUPPORTED - case JDCT_FLOAT: - fdct->pub.forward_DCT = forward_DCT_float; - fdct->do_float_dct = jpeg_fdct_float; - break; -#endif - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; - } - - /* Mark divisor tables unallocated */ - for (i = 0; i < NUM_QUANT_TBLS; i++) { - fdct->divisors[i] = NULL; -#ifdef DCT_FLOAT_SUPPORTED - fdct->float_divisors[i] = NULL; -#endif - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jchuff.c b/Source/3rdParty/wx/src/jpeg/jchuff.c deleted file mode 100644 index 45b3d2b6f..000000000 --- a/Source/3rdParty/wx/src/jpeg/jchuff.c +++ /dev/null @@ -1,909 +0,0 @@ -/* - * jchuff.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains Huffman entropy encoding routines. - * - * Much of the complexity here has to do with supporting output suspension. - * If the data destination module demands suspension, we want to be able to - * back up to the start of the current MCU. To do this, we copy state - * variables into local working storage, and update them back to the - * permanent JPEG objects only upon successful completion of an MCU. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jchuff.h" /* Declarations shared with jcphuff.c */ - - -/* Expanded entropy encoder object for Huffman encoding. - * - * The savable_state subrecord contains fields that change within an MCU, - * but must not be updated permanently until we complete the MCU. - */ - -typedef struct { - JPEG_INT32 put_buffer; /* current bit-accumulation buffer */ - int put_bits; /* # of bits now in it */ - int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ -} savable_state; - -/* This macro is to work around compilers with missing or broken - * structure assignment. You'll need to fix this code if you have - * such a compiler and you change MAX_COMPS_IN_SCAN. - */ - -#ifndef NO_STRUCT_ASSIGN -#define ASSIGN_STATE(dest,src) ((dest) = (src)) -#else -#if MAX_COMPS_IN_SCAN == 4 -#define ASSIGN_STATE(dest,src) \ - ((dest).put_buffer = (src).put_buffer, \ - (dest).put_bits = (src).put_bits, \ - (dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) -#endif -#endif - - -typedef struct { - struct jpeg_entropy_encoder pub; /* public fields */ - - savable_state saved; /* Bit buffer & DC state at start of MCU */ - - /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - int next_restart_num; /* next restart number to write (0-7) */ - - /* Pointers to derived tables (these workspaces have image lifespan) */ - c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; - c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; - -#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ - long * dc_count_ptrs[NUM_HUFF_TBLS]; - long * ac_count_ptrs[NUM_HUFF_TBLS]; -#endif -} huff_entropy_encoder; - -typedef huff_entropy_encoder * huff_entropy_ptr; - -/* Working state while writing an MCU. - * This struct contains all the fields that are needed by subroutines. - */ - -typedef struct { - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - savable_state cur; /* Current bit buffer & DC state */ - j_compress_ptr cinfo; /* dump_buffer needs access to this */ -} working_state; - - -/* Forward declarations */ -METHODDEF(wxjpeg_boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); -#ifdef ENTROPY_OPT_SUPPORTED -METHODDEF(wxjpeg_boolean) encode_mcu_gather JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); -#endif - - -/* - * Initialize for a Huffman-compressed scan. - * If gather_statistics is TRUE, we do not output anything during the scan, - * just count the Huffman symbols used and generate Huffman code tables. - */ - -METHODDEF(void) -start_pass_huff (j_compress_ptr cinfo, wxjpeg_boolean gather_statistics) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int ci, dctbl, actbl; - jpeg_component_info * compptr; - - if (gather_statistics) { -#ifdef ENTROPY_OPT_SUPPORTED - entropy->pub.encode_mcu = encode_mcu_gather; - entropy->pub.finish_pass = finish_pass_gather; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - entropy->pub.encode_mcu = encode_mcu_huff; - entropy->pub.finish_pass = finish_pass_huff; - } - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - dctbl = compptr->dc_tbl_no; - actbl = compptr->ac_tbl_no; - if (gather_statistics) { -#ifdef ENTROPY_OPT_SUPPORTED - /* Check for invalid table indexes */ - /* (make_c_derived_tbl does this in the other path) */ - if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); - if (actbl < 0 || actbl >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl); - /* Allocate and zero the statistics tables */ - /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ - if (entropy->dc_count_ptrs[dctbl] == NULL) - entropy->dc_count_ptrs[dctbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long)); - if (entropy->ac_count_ptrs[actbl] == NULL) - entropy->ac_count_ptrs[actbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long)); -#endif - } else { - /* Compute derived values for Huffman tables */ - /* We may do this more than once for a table, but it's not expensive */ - jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl, - & entropy->dc_derived_tbls[dctbl]); - jpeg_make_c_derived_tbl(cinfo, FALSE, actbl, - & entropy->ac_derived_tbls[actbl]); - } - /* Initialize DC predictions to 0 */ - entropy->saved.last_dc_val[ci] = 0; - } - - /* Initialize bit buffer to empty */ - entropy->saved.put_buffer = 0; - entropy->saved.put_bits = 0; - - /* Initialize restart stuff */ - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num = 0; -} - - -/* - * Compute the derived values for a Huffman table. - * This routine also performs some validation checks on the table. - * - * Note this is also used by jcphuff.c. - */ - -GLOBAL(void) -jpeg_make_c_derived_tbl (j_compress_ptr cinfo, wxjpeg_boolean isDC, int tblno, - c_derived_tbl ** pdtbl) -{ - JHUFF_TBL *htbl; - c_derived_tbl *dtbl; - int p, i, l, lastp, si, maxsymbol; - char huffsize[257]; - unsigned int huffcode[257]; - unsigned int code; - - /* Note that huffsize[] and huffcode[] are filled in code-length order, - * paralleling the order of the symbols themselves in htbl->huffval[]. - */ - - /* Find the input Huffman table */ - if (tblno < 0 || tblno >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); - htbl = - isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; - if (htbl == NULL) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); - - /* Allocate a workspace if we haven't already done so. */ - if (*pdtbl == NULL) - *pdtbl = (c_derived_tbl *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(c_derived_tbl)); - dtbl = *pdtbl; - - /* Figure C.1: make table of Huffman code length for each symbol */ - - p = 0; - for (l = 1; l <= 16; l++) { - i = (int) htbl->bits[l]; - if (i < 0 || p + i > 256) /* protect against table overrun */ - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - while (i--) - huffsize[p++] = (char) l; - } - huffsize[p] = 0; - lastp = p; - - /* Figure C.2: generate the codes themselves */ - /* We also validate that the counts represent a legal Huffman code tree. */ - - code = 0; - si = huffsize[0]; - p = 0; - while (huffsize[p]) { - while (((int) huffsize[p]) == si) { - huffcode[p++] = code; - code++; - } - /* code is now 1 more than the last code used for codelength si; but - * it must still fit in si bits, since no code is allowed to be all ones. - */ - if (((JPEG_INT32) code) >= (((JPEG_INT32) 1) << si)) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - code <<= 1; - si++; - } - - /* Figure C.3: generate encoding tables */ - /* These are code and size indexed by symbol value */ - - /* Set all codeless symbols to have code length 0; - * this lets us detect duplicate VAL entries here, and later - * allows emit_bits to detect any attempt to emit such symbols. - */ - MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi)); - - /* This is also a convenient place to check for out-of-range - * and duplicated VAL entries. We allow 0..255 for AC symbols - * but only 0..15 for DC. (We could constrain them further - * based on data depth and mode, but this seems enough.) - */ - maxsymbol = isDC ? 15 : 255; - - for (p = 0; p < lastp; p++) { - i = htbl->huffval[p]; - if (i < 0 || i > maxsymbol || dtbl->ehufsi[i]) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - dtbl->ehufco[i] = huffcode[p]; - dtbl->ehufsi[i] = huffsize[p]; - } -} - - -/* Outputting bytes to the file */ - -/* Emit a byte, taking 'action' if must suspend. */ -#define emit_byte(state,val,action) \ - { *(state)->next_output_byte++ = (JOCTET) (val); \ - if (--(state)->free_in_buffer == 0) \ - if (! dump_buffer(state)) \ - { action; } } - - -LOCAL(wxjpeg_boolean) -dump_buffer (working_state * state) -/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ -{ - struct jpeg_destination_mgr * dest = state->cinfo->dest; - - if (! (*dest->empty_output_buffer) (state->cinfo)) - return FALSE; - /* After a successful buffer dump, must reset buffer pointers */ - state->next_output_byte = dest->next_output_byte; - state->free_in_buffer = dest->free_in_buffer; - return TRUE; -} - - -/* Outputting bits to the file */ - -/* Only the right 24 bits of put_buffer are used; the valid bits are - * left-justified in this part. At most 16 bits can be passed to emit_bits - * in one call, and we never retain more than 7 bits in put_buffer - * between calls, so 24 bits are sufficient. - */ - -INLINE -LOCAL(wxjpeg_boolean) -emit_bits (working_state * state, unsigned int code, int size) -/* Emit some bits; return TRUE if successful, FALSE if must suspend */ -{ - /* This routine is heavily used, so it's worth coding tightly. */ - register JPEG_INT32 put_buffer = (JPEG_INT32) code; - register int put_bits = state->cur.put_bits; - - /* if size is 0, caller used an invalid Huffman table entry */ - if (size == 0) - ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); - - put_buffer &= (((JPEG_INT32) 1)<cur.put_buffer; /* and merge with old buffer contents */ - - while (put_bits >= 8) { - int c = (int) ((put_buffer >> 16) & 0xFF); - - emit_byte(state, c, return FALSE); - if (c == 0xFF) { /* need to stuff a zero byte? */ - emit_byte(state, 0, return FALSE); - } - put_buffer <<= 8; - put_bits -= 8; - } - - state->cur.put_buffer = put_buffer; /* update state variables */ - state->cur.put_bits = put_bits; - - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -flush_bits (working_state * state) -{ - if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ - return FALSE; - state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ - state->cur.put_bits = 0; - return TRUE; -} - - -/* Encode a single block's worth of coefficients */ - -LOCAL(wxjpeg_boolean) -encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, - c_derived_tbl *dctbl, c_derived_tbl *actbl) -{ - register int temp, temp2; - register int nbits; - register int k, r, i; - - /* Encode the DC coefficient difference per section F.1.2.1 */ - - temp = temp2 = block[0] - last_dc_val; - - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* For a negative input, want temp2 = bitwise complement of abs(input) */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - - /* Emit the Huffman-coded symbol for the number of bits */ - if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) - return FALSE; - - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ - if (! emit_bits(state, (unsigned int) temp2, nbits)) - return FALSE; - - /* Encode the AC coefficients per section F.1.2.2 */ - - r = 0; /* r = run length of zeros */ - - for (k = 1; k < DCTSIZE2; k++) { - if ((temp = block[jpeg_natural_order[k]]) == 0) { - r++; - } else { - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) - return FALSE; - r -= 16; - } - - temp2 = temp; - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - - /* Emit Huffman symbol for run length / number of bits */ - i = (r << 4) + nbits; - if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i])) - return FALSE; - - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (! emit_bits(state, (unsigned int) temp2, nbits)) - return FALSE; - - r = 0; - } - } - - /* If the last coef(s) were zero, emit an end-of-block code */ - if (r > 0) - if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0])) - return FALSE; - - return TRUE; -} - - -/* - * Emit a restart marker & resynchronize predictions. - */ - -LOCAL(wxjpeg_boolean) -emit_restart (working_state * state, int restart_num) -{ - int ci; - - if (! flush_bits(state)) - return FALSE; - - emit_byte(state, 0xFF, return FALSE); - emit_byte(state, JPEG_RST0 + restart_num, return FALSE); - - /* Re-initialize DC predictions to 0 */ - for (ci = 0; ci < state->cinfo->comps_in_scan; ci++) - state->cur.last_dc_val[ci] = 0; - - /* The restart counter is not updated until we successfully write the MCU. */ - - return TRUE; -} - - -/* - * Encode and output one MCU's worth of Huffman-compressed coefficients. - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - working_state state; - int blkn, ci; - jpeg_component_info * compptr; - - /* Load up working state */ - state.next_output_byte = cinfo->dest->next_output_byte; - state.free_in_buffer = cinfo->dest->free_in_buffer; - ASSIGN_STATE(state.cur, entropy->saved); - state.cinfo = cinfo; - - /* Emit restart marker if needed */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! emit_restart(&state, entropy->next_restart_num)) - return FALSE; - } - - /* Encode the MCU data blocks */ - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - ci = cinfo->MCU_membership[blkn]; - compptr = cinfo->cur_comp_info[ci]; - if (! encode_one_block(&state, - MCU_data[blkn][0], state.cur.last_dc_val[ci], - entropy->dc_derived_tbls[compptr->dc_tbl_no], - entropy->ac_derived_tbls[compptr->ac_tbl_no])) - return FALSE; - /* Update last_dc_val */ - state.cur.last_dc_val[ci] = MCU_data[blkn][0][0]; - } - - /* Completed MCU, so update state */ - cinfo->dest->next_output_byte = state.next_output_byte; - cinfo->dest->free_in_buffer = state.free_in_buffer; - ASSIGN_STATE(entropy->saved, state.cur); - - /* Update restart-interval state too */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num++; - entropy->next_restart_num &= 7; - } - entropy->restarts_to_go--; - } - - return TRUE; -} - - -/* - * Finish up at the end of a Huffman-compressed scan. - */ - -METHODDEF(void) -finish_pass_huff (j_compress_ptr cinfo) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - working_state state; - - /* Load up working state ... flush_bits needs it */ - state.next_output_byte = cinfo->dest->next_output_byte; - state.free_in_buffer = cinfo->dest->free_in_buffer; - ASSIGN_STATE(state.cur, entropy->saved); - state.cinfo = cinfo; - - /* Flush out the last data */ - if (! flush_bits(&state)) - ERREXIT(cinfo, JERR_CANT_SUSPEND); - - /* Update state */ - cinfo->dest->next_output_byte = state.next_output_byte; - cinfo->dest->free_in_buffer = state.free_in_buffer; - ASSIGN_STATE(entropy->saved, state.cur); -} - - -/* - * Huffman coding optimization. - * - * We first scan the supplied data and count the number of uses of each symbol - * that is to be Huffman-coded. (This process MUST agree with the code above.) - * Then we build a Huffman coding tree for the observed counts. - * Symbols which are not needed at all for the particular image are not - * assigned any code, which saves space in the DHT marker as well as in - * the compressed data. - */ - -#ifdef ENTROPY_OPT_SUPPORTED - - -/* Process a single block's worth of coefficients */ - -LOCAL(void) -htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, - long dc_counts[], long ac_counts[]) -{ - register int temp; - register int nbits; - register int k, r; - - /* Encode the DC coefficient difference per section F.1.2.1 */ - - temp = block[0] - last_dc_val; - if (temp < 0) - temp = -temp; - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); - - /* Count the Huffman symbol for the number of bits */ - dc_counts[nbits]++; - - /* Encode the AC coefficients per section F.1.2.2 */ - - r = 0; /* r = run length of zeros */ - - for (k = 1; k < DCTSIZE2; k++) { - if ((temp = block[jpeg_natural_order[k]]) == 0) { - r++; - } else { - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - ac_counts[0xF0]++; - r -= 16; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - if (temp < 0) - temp = -temp; - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); - - /* Count Huffman symbol for run length / number of bits */ - ac_counts[(r << 4) + nbits]++; - - r = 0; - } - } - - /* If the last coef(s) were zero, emit an end-of-block code */ - if (r > 0) - ac_counts[0]++; -} - - -/* - * Trial-encode one MCU's worth of Huffman-compressed coefficients. - * No data is actually output, so no suspension return is possible. - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int blkn, ci; - jpeg_component_info * compptr; - - /* Take care of restart intervals if needed */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - /* Re-initialize DC predictions to 0 */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) - entropy->saved.last_dc_val[ci] = 0; - /* Update restart state */ - entropy->restarts_to_go = cinfo->restart_interval; - } - entropy->restarts_to_go--; - } - - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - ci = cinfo->MCU_membership[blkn]; - compptr = cinfo->cur_comp_info[ci]; - htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci], - entropy->dc_count_ptrs[compptr->dc_tbl_no], - entropy->ac_count_ptrs[compptr->ac_tbl_no]); - entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0]; - } - - return TRUE; -} - - -/* - * Generate the best Huffman code table for the given counts, fill htbl. - * Note this is also used by jcphuff.c. - * - * The JPEG standard requires that no symbol be assigned a codeword of all - * one bits (so that padding bits added at the end of a compressed segment - * can't look like a valid code). Because of the canonical ordering of - * codewords, this just means that there must be an unused slot in the - * longest codeword length category. Section K.2 of the JPEG spec suggests - * reserving such a slot by pretending that symbol 256 is a valid symbol - * with count 1. In theory that's not optimal; giving it count zero but - * including it in the symbol set anyway should give a better Huffman code. - * But the theoretically better code actually seems to come out worse in - * practice, because it produces more all-ones bytes (which incur stuffed - * zero bytes in the final file). In any case the difference is tiny. - * - * The JPEG standard requires Huffman codes to be no more than 16 bits long. - * If some symbols have a very small but nonzero probability, the Huffman tree - * must be adjusted to meet the code length restriction. We currently use - * the adjustment method suggested in JPEG section K.2. This method is *not* - * optimal; it may not choose the best possible limited-length code. But - * typically only very-low-frequency symbols will be given less-than-optimal - * lengths, so the code is almost optimal. Experimental comparisons against - * an optimal limited-length-code algorithm indicate that the difference is - * microscopic --- usually less than a hundredth of a percent of total size. - * So the extra complexity of an optimal algorithm doesn't seem worthwhile. - */ - -GLOBAL(void) -jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) -{ -#define MAX_CLEN 32 /* assumed maximum initial code length */ - UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ - int codesize[257]; /* codesize[k] = code length of symbol k */ - int others[257]; /* next symbol in current branch of tree */ - int c1, c2; - int p, i, j; - long v; - - /* This algorithm is explained in section K.2 of the JPEG standard */ - - MEMZERO(bits, SIZEOF(bits)); - MEMZERO(codesize, SIZEOF(codesize)); - for (i = 0; i < 257; i++) - others[i] = -1; /* init links to empty */ - - freq[256] = 1; /* make sure 256 has a nonzero count */ - /* Including the pseudo-symbol 256 in the Huffman procedure guarantees - * that no real symbol is given code-value of all ones, because 256 - * will be placed last in the largest codeword category. - */ - - /* Huffman's basic algorithm to assign optimal code lengths to symbols */ - - for (;;) { - /* Find the smallest nonzero frequency, set c1 = its symbol */ - /* In case of ties, take the larger symbol number */ - c1 = -1; - v = 1000000000L; - for (i = 0; i <= 256; i++) { - if (freq[i] && freq[i] <= v) { - v = freq[i]; - c1 = i; - } - } - - /* Find the next smallest nonzero frequency, set c2 = its symbol */ - /* In case of ties, take the larger symbol number */ - c2 = -1; - v = 1000000000L; - for (i = 0; i <= 256; i++) { - if (freq[i] && freq[i] <= v && i != c1) { - v = freq[i]; - c2 = i; - } - } - - /* Done if we've merged everything into one frequency */ - if (c2 < 0) - break; - - /* Else merge the two counts/trees */ - freq[c1] += freq[c2]; - freq[c2] = 0; - - /* Increment the codesize of everything in c1's tree branch */ - codesize[c1]++; - while (others[c1] >= 0) { - c1 = others[c1]; - codesize[c1]++; - } - - others[c1] = c2; /* chain c2 onto c1's tree branch */ - - /* Increment the codesize of everything in c2's tree branch */ - codesize[c2]++; - while (others[c2] >= 0) { - c2 = others[c2]; - codesize[c2]++; - } - } - - /* Now count the number of symbols of each code length */ - for (i = 0; i <= 256; i++) { - if (codesize[i]) { - /* The JPEG standard seems to think that this can't happen, */ - /* but I'm paranoid... */ - if (codesize[i] > MAX_CLEN) - ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW); - - bits[codesize[i]]++; - } - } - - /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure - * Huffman procedure assigned any such lengths, we must adjust the coding. - * Here is what the JPEG spec says about how this next bit works: - * Since symbols are paired for the longest Huffman code, the symbols are - * removed from this length category two at a time. The prefix for the pair - * (which is one bit shorter) is allocated to one of the pair; then, - * skipping the BITS entry for that prefix length, a code word from the next - * shortest nonzero BITS entry is converted into a prefix for two code words - * one bit longer. - */ - - for (i = MAX_CLEN; i > 16; i--) { - while (bits[i] > 0) { - j = i - 2; /* find length of new prefix to be used */ - while (bits[j] == 0) - j--; - - bits[i] -= 2; /* remove two symbols */ - bits[i-1]++; /* one goes in this length */ - bits[j+1] += 2; /* two new symbols in this length */ - bits[j]--; /* symbol of this length is now a prefix */ - } - } - - /* Remove the count for the pseudo-symbol 256 from the largest codelength */ - while (bits[i] == 0) /* find largest codelength still in use */ - i--; - bits[i]--; - - /* Return final symbol counts (only for lengths 0..16) */ - MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); - - /* Return a list of the symbols sorted by code length */ - /* It's not real clear to me why we don't need to consider the codelength - * changes made above, but the JPEG spec seems to think this works. - */ - p = 0; - for (i = 1; i <= MAX_CLEN; i++) { - for (j = 0; j <= 255; j++) { - if (codesize[j] == i) { - htbl->huffval[p] = (UINT8) j; - p++; - } - } - } - - /* Set sent_table FALSE so updated table will be written to JPEG file. */ - htbl->sent_table = FALSE; -} - - -/* - * Finish up a statistics-gathering pass and create the new Huffman tables. - */ - -METHODDEF(void) -finish_pass_gather (j_compress_ptr cinfo) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int ci, dctbl, actbl; - jpeg_component_info * compptr; - JHUFF_TBL **htblptr; - wxjpeg_boolean did_dc[NUM_HUFF_TBLS]; - wxjpeg_boolean did_ac[NUM_HUFF_TBLS]; - - /* It's important not to apply jpeg_gen_optimal_table more than once - * per table, because it clobbers the input frequency counts! - */ - MEMZERO(did_dc, SIZEOF(did_dc)); - MEMZERO(did_ac, SIZEOF(did_ac)); - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - dctbl = compptr->dc_tbl_no; - actbl = compptr->ac_tbl_no; - if (! did_dc[dctbl]) { - htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; - if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); - did_dc[dctbl] = TRUE; - } - if (! did_ac[actbl]) { - htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; - if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); - did_ac[actbl] = TRUE; - } - } -} - - -#endif /* ENTROPY_OPT_SUPPORTED */ - - -/* - * Module initialization routine for Huffman entropy encoding. - */ - -GLOBAL(void) -jinit_huff_encoder (j_compress_ptr cinfo) -{ - huff_entropy_ptr entropy; - int i; - - entropy = (huff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_encoder)); - cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; - entropy->pub.start_pass = start_pass_huff; - - /* Mark tables unallocated */ - for (i = 0; i < NUM_HUFF_TBLS; i++) { - entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; -#ifdef ENTROPY_OPT_SUPPORTED - entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL; -#endif - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jchuff.h b/Source/3rdParty/wx/src/jpeg/jchuff.h deleted file mode 100644 index 881962ad5..000000000 --- a/Source/3rdParty/wx/src/jpeg/jchuff.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * jchuff.h - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains declarations for Huffman entropy encoding routines - * that are shared between the sequential encoder (jchuff.c) and the - * progressive encoder (jcphuff.c). No other modules need to see these. - */ - -/* The legal range of a DCT coefficient is - * -1024 .. +1023 for 8-bit data; - * -16384 .. +16383 for 12-bit data. - * Hence the magnitude should always fit in 10 or 14 bits respectively. - */ - -#if BITS_IN_JSAMPLE == 8 -#define MAX_COEF_BITS 10 -#else -#define MAX_COEF_BITS 14 -#endif - -/* Derived data constructed for each Huffman table */ - -typedef struct { - unsigned int ehufco[256]; /* code for each symbol */ - char ehufsi[256]; /* length of code for each symbol */ - /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ -} c_derived_tbl; - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_c_derived_tbl jMkCDerived -#define jpeg_gen_optimal_table jGenOptTbl -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - -/* Expand a Huffman table definition into the derived format */ -EXTERN(void) jpeg_make_c_derived_tbl - JPP((j_compress_ptr cinfo, wxjpeg_boolean isDC, int tblno, - c_derived_tbl ** pdtbl)); - -/* Generate an optimal table definition given the specified counts */ -EXTERN(void) jpeg_gen_optimal_table - JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); diff --git a/Source/3rdParty/wx/src/jpeg/jcinit.c b/Source/3rdParty/wx/src/jpeg/jcinit.c deleted file mode 100644 index b9e68a9ad..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcinit.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * jcinit.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains initialization logic for the JPEG compressor. - * This routine is in charge of selecting the modules to be executed and - * making an initialization call to each one. - * - * Logically, this code belongs in jcmaster.c. It's split out because - * linking this routine implies linking the entire compression library. - * For a transcoding-only application, we want to be able to use jcmaster.c - * without linking in the whole library. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Master selection of compression modules. - * This is done once at the start of processing an image. We determine - * which modules will be used and give them appropriate initialization calls. - */ - -GLOBAL(void) -jinit_compress_master (j_compress_ptr cinfo) -{ - /* Initialize master control (includes parameter checking/processing) */ - jinit_c_master_control(cinfo, FALSE /* full compression */); - - /* Preprocessing */ - if (! cinfo->raw_data_in) { - jinit_color_converter(cinfo); - jinit_downsampler(cinfo); - jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); - } - /* Forward DCT */ - jinit_forward_dct(cinfo); - /* Entropy encoding: either Huffman or arithmetic coding. */ - if (cinfo->arith_code) { - ERREXIT(cinfo, JERR_ARITH_NOTIMPL); - } else { - if (cinfo->progressive_mode) { -#ifdef C_PROGRESSIVE_SUPPORTED - jinit_phuff_encoder(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else - jinit_huff_encoder(cinfo); - } - - /* Need a full-image coefficient buffer in any multi-pass mode. */ - jinit_c_coef_controller(cinfo, - (wxjpeg_boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); - jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); - - jinit_marker_writer(cinfo); - - /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); - - /* Write the datastream header (SOI) immediately. - * Frame and scan headers are postponed till later. - * This lets application insert special markers after the SOI. - */ - (*cinfo->marker->write_file_header) (cinfo); -} diff --git a/Source/3rdParty/wx/src/jpeg/jcmainct.c b/Source/3rdParty/wx/src/jpeg/jcmainct.c deleted file mode 100644 index 42846cb51..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcmainct.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * jcmainct.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the main buffer controller for compression. - * The main buffer lies between the pre-processor and the JPEG - * compressor proper; it holds downsampled data in the JPEG colorspace. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Note: currently, there is no operating mode in which a full-image buffer - * is needed at this step. If there were, that mode could not be used with - * "raw data" input, since this module is bypassed in that case. However, - * we've left the code here for possible use in special applications. - */ -#undef FULL_MAIN_BUFFER_SUPPORTED - - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_c_main_controller pub; /* public fields */ - - JDIMENSION cur_iMCU_row; /* number of current iMCU row */ - JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ - wxjpeg_boolean suspended; /* remember if we suspended output */ - J_BUF_MODE pass_mode; /* current operating mode */ - - /* If using just a strip buffer, this points to the entire set of buffers - * (we allocate one for each component). In the full-image case, this - * points to the currently accessible strips of the virtual arrays. - */ - JSAMPARRAY buffer[MAX_COMPONENTS]; - -#ifdef FULL_MAIN_BUFFER_SUPPORTED - /* If using full-image storage, this array holds pointers to virtual-array - * control blocks for each component. Unused if not full-image storage. - */ - jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; -#endif -} my_main_controller; - -typedef my_main_controller * my_main_ptr; - - -/* Forward declarations */ -METHODDEF(void) process_data_simple_main - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); -#ifdef FULL_MAIN_BUFFER_SUPPORTED -METHODDEF(void) process_data_buffer_main - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); -#endif - - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_main_ptr mymain = (my_main_ptr) cinfo->main; - - /* Do nothing in raw-data mode. */ - if (cinfo->raw_data_in) - return; - - mymain->cur_iMCU_row = 0; /* initialize counters */ - mymain->rowgroup_ctr = 0; - mymain->suspended = FALSE; - mymain->pass_mode = pass_mode; /* save mode for use by process_data */ - - switch (pass_mode) { - case JBUF_PASS_THRU: -#ifdef FULL_MAIN_BUFFER_SUPPORTED - if (mymain->whole_image[0] != NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); -#endif - mymain->pub.process_data = process_data_simple_main; - break; -#ifdef FULL_MAIN_BUFFER_SUPPORTED - case JBUF_SAVE_SOURCE: - case JBUF_CRANK_DEST: - case JBUF_SAVE_AND_PASS: - if (mymain->whole_image[0] == NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - mymain->pub.process_data = process_data_buffer_main; - break; -#endif - default: - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - break; - } -} - - -/* - * Process some data. - * This routine handles the simple pass-through mode, - * where we have only a strip buffer. - */ - -METHODDEF(void) -process_data_simple_main (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail) -{ - my_main_ptr mymain = (my_main_ptr) cinfo->main; - - while (mymain->cur_iMCU_row < cinfo->total_iMCU_rows) { - /* Read input data if we haven't filled the main buffer yet */ - if (mymain->rowgroup_ctr < DCTSIZE) - (*cinfo->prep->pre_process_data) (cinfo, - input_buf, in_row_ctr, in_rows_avail, - mymain->buffer, &mymain->rowgroup_ctr, - (JDIMENSION) DCTSIZE); - - /* If we don't have a full iMCU row buffered, return to application for - * more data. Note that preprocessor will always pad to fill the iMCU row - * at the bottom of the image. - */ - if (mymain->rowgroup_ctr != DCTSIZE) - return; - - /* Send the completed row to the compressor */ - if (! (*cinfo->coef->compress_data) (cinfo, mymain->buffer)) { - /* If compressor did not consume the whole row, then we must need to - * suspend processing and return to the application. In this situation - * we pretend we didn't yet consume the last input row; otherwise, if - * it happened to be the last row of the image, the application would - * think we were done. - */ - if (! mymain->suspended) { - (*in_row_ctr)--; - mymain->suspended = TRUE; - } - return; - } - /* We did finish the row. Undo our little suspension hack if a previous - * call suspended; then mark the main buffer empty. - */ - if (mymain->suspended) { - (*in_row_ctr)++; - mymain->suspended = FALSE; - } - mymain->rowgroup_ctr = 0; - mymain->cur_iMCU_row++; - } -} - - -#ifdef FULL_MAIN_BUFFER_SUPPORTED - -/* - * Process some data. - * This routine handles all of the modes that use a full-size buffer. - */ - -METHODDEF(void) -process_data_buffer_main (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail) -{ - my_main_ptr mymain = (my_main_ptr) cinfo->main; - int ci; - jpeg_component_info *compptr; - wxjpeg_boolean writing = (mymain->pass_mode != JBUF_CRANK_DEST); - - while (mymain->cur_iMCU_row < cinfo->total_iMCU_rows) { - /* Realign the virtual buffers if at the start of an iMCU row. */ - if (mymain->rowgroup_ctr == 0) { - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - mymain->buffer[ci] = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, mymain->whole_image[ci], - mymain->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); - } - /* In a read pass, pretend we just read some source data. */ - if (! writing) { - *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; - mymain->rowgroup_ctr = DCTSIZE; - } - } - - /* If a write pass, read input data until the current iMCU row is full. */ - /* Note: preprocessor will pad if necessary to fill the last iMCU row. */ - if (writing) { - (*cinfo->prep->pre_process_data) (cinfo, - input_buf, in_row_ctr, in_rows_avail, - mymain->buffer, &mymain->rowgroup_ctr, - (JDIMENSION) DCTSIZE); - /* Return to application if we need more data to fill the iMCU row. */ - if (mymain->rowgroup_ctr < DCTSIZE) - return; - } - - /* Emit data, unless this is a sink-only pass. */ - if (mymain->pass_mode != JBUF_SAVE_SOURCE) { - if (! (*cinfo->coef->compress_data) (cinfo, mymain->buffer)) { - /* If compressor did not consume the whole row, then we must need to - * suspend processing and return to the application. In this situation - * we pretend we didn't yet consume the last input row; otherwise, if - * it happened to be the last row of the image, the application would - * think we were done. - */ - if (! mymain->suspended) { - (*in_row_ctr)--; - mymain->suspended = TRUE; - } - return; - } - /* We did finish the row. Undo our little suspension hack if a previous - * call suspended; then mark the main buffer empty. - */ - if (mymain->suspended) { - (*in_row_ctr)++; - mymain->suspended = FALSE; - } - } - - /* If get here, we are done with this iMCU row. Mark buffer empty. */ - mymain->rowgroup_ctr = 0; - mymain->cur_iMCU_row++; - } -} - -#endif /* FULL_MAIN_BUFFER_SUPPORTED */ - - -/* - * Initialize main buffer controller. - */ - -GLOBAL(void) -jinit_c_main_controller (j_compress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_main_ptr mymain; - int ci; - jpeg_component_info *compptr; - - mymain = (my_main_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); - cinfo->main = (struct jpeg_c_main_controller *) mymain; - mymain->pub.start_pass = start_pass_main; - - /* We don't need to create a buffer in raw-data mode. */ - if (cinfo->raw_data_in) - return; - - /* Create the buffer. It holds downsampled data, so each component - * may be of a different size. - */ - if (need_full_buffer) { -#ifdef FULL_MAIN_BUFFER_SUPPORTED - /* Allocate a full-image virtual array for each component */ - /* Note we pad the bottom to a multiple of the iMCU height */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - mymain->whole_image[ci] = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - compptr->width_in_blocks * DCTSIZE, - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor) * DCTSIZE, - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); - } -#else - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); -#endif - } else { -#ifdef FULL_MAIN_BUFFER_SUPPORTED - mymain->whole_image[0] = NULL; /* flag for no virtual arrays */ -#endif - /* Allocate a strip buffer for each component */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - mymain->buffer[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - compptr->width_in_blocks * DCTSIZE, - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); - } - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jcmarker.c b/Source/3rdParty/wx/src/jpeg/jcmarker.c deleted file mode 100644 index b6d987af8..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcmarker.c +++ /dev/null @@ -1,664 +0,0 @@ -/* - * jcmarker.c - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains routines to write JPEG datastream markers. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -typedef enum { /* JPEG marker codes */ - M_SOF0 = 0xc0, - M_SOF1 = 0xc1, - M_SOF2 = 0xc2, - M_SOF3 = 0xc3, - - M_SOF5 = 0xc5, - M_SOF6 = 0xc6, - M_SOF7 = 0xc7, - - M_JPG = 0xc8, - M_SOF9 = 0xc9, - M_SOF10 = 0xca, - M_SOF11 = 0xcb, - - M_SOF13 = 0xcd, - M_SOF14 = 0xce, - M_SOF15 = 0xcf, - - M_DHT = 0xc4, - - M_DAC = 0xcc, - - M_RST0 = 0xd0, - M_RST1 = 0xd1, - M_RST2 = 0xd2, - M_RST3 = 0xd3, - M_RST4 = 0xd4, - M_RST5 = 0xd5, - M_RST6 = 0xd6, - M_RST7 = 0xd7, - - M_SOI = 0xd8, - M_EOI = 0xd9, - M_SOS = 0xda, - M_DQT = 0xdb, - M_DNL = 0xdc, - M_DRI = 0xdd, - M_DHP = 0xde, - M_EXP = 0xdf, - - M_APP0 = 0xe0, - M_APP1 = 0xe1, - M_APP2 = 0xe2, - M_APP3 = 0xe3, - M_APP4 = 0xe4, - M_APP5 = 0xe5, - M_APP6 = 0xe6, - M_APP7 = 0xe7, - M_APP8 = 0xe8, - M_APP9 = 0xe9, - M_APP10 = 0xea, - M_APP11 = 0xeb, - M_APP12 = 0xec, - M_APP13 = 0xed, - M_APP14 = 0xee, - M_APP15 = 0xef, - - M_JPG0 = 0xf0, - M_JPG13 = 0xfd, - M_COM = 0xfe, - - M_TEM = 0x01, - - M_ERROR = 0x100 -} JPEG_MARKER; - - -/* Private state */ - -typedef struct { - struct jpeg_marker_writer pub; /* public fields */ - - unsigned int last_restart_interval; /* last DRI value emitted; 0 after SOI */ -} my_marker_writer; - -typedef my_marker_writer * my_marker_ptr; - - -/* - * Basic output routines. - * - * Note that we do not support suspension while writing a marker. - * Therefore, an application using suspension must ensure that there is - * enough buffer space for the initial markers (typ. 600-700 bytes) before - * calling jpeg_start_compress, and enough space to write the trailing EOI - * (a few bytes) before calling jpeg_finish_compress. Multipass compression - * modes are not supported at all with suspension, so those two are the only - * points where markers will be written. - */ - -LOCAL(void) -emit_byte (j_compress_ptr cinfo, int val) -/* Emit a byte */ -{ - struct jpeg_destination_mgr * dest = cinfo->dest; - - *(dest->next_output_byte)++ = (JOCTET) val; - if (--dest->free_in_buffer == 0) { - if (! (*dest->empty_output_buffer) (cinfo)) - ERREXIT(cinfo, JERR_CANT_SUSPEND); - } -} - - -LOCAL(void) -emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) -/* Emit a marker code */ -{ - emit_byte(cinfo, 0xFF); - emit_byte(cinfo, (int) mark); -} - - -LOCAL(void) -emit_2bytes (j_compress_ptr cinfo, int value) -/* Emit a 2-byte integer; these are always MSB first in JPEG files */ -{ - emit_byte(cinfo, (value >> 8) & 0xFF); - emit_byte(cinfo, value & 0xFF); -} - - -/* - * Routines to write specific marker types. - */ - -LOCAL(int) -emit_dqt (j_compress_ptr cinfo, int index) -/* Emit a DQT marker */ -/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ -{ - JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index]; - int prec; - int i; - - if (qtbl == NULL) - ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index); - - prec = 0; - for (i = 0; i < DCTSIZE2; i++) { - if (qtbl->quantval[i] > 255) - prec = 1; - } - - if (! qtbl->sent_table) { - emit_marker(cinfo, M_DQT); - - emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); - - emit_byte(cinfo, index + (prec<<4)); - - for (i = 0; i < DCTSIZE2; i++) { - /* The table entries must be emitted in zigzag order. */ - unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; - if (prec) - emit_byte(cinfo, (int) (qval >> 8)); - emit_byte(cinfo, (int) (qval & 0xFF)); - } - - qtbl->sent_table = TRUE; - } - - return prec; -} - - -LOCAL(void) -emit_dht (j_compress_ptr cinfo, int index, wxjpeg_boolean is_ac) -/* Emit a DHT marker */ -{ - JHUFF_TBL * htbl; - int length, i; - - if (is_ac) { - htbl = cinfo->ac_huff_tbl_ptrs[index]; - index += 0x10; /* output index has AC bit set */ - } else { - htbl = cinfo->dc_huff_tbl_ptrs[index]; - } - - if (htbl == NULL) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); - - if (! htbl->sent_table) { - emit_marker(cinfo, M_DHT); - - length = 0; - for (i = 1; i <= 16; i++) - length += htbl->bits[i]; - - emit_2bytes(cinfo, length + 2 + 1 + 16); - emit_byte(cinfo, index); - - for (i = 1; i <= 16; i++) - emit_byte(cinfo, htbl->bits[i]); - - for (i = 0; i < length; i++) - emit_byte(cinfo, htbl->huffval[i]); - - htbl->sent_table = TRUE; - } -} - - -LOCAL(void) -emit_dac (j_compress_ptr cinfo) -/* Emit a DAC marker */ -/* Since the useful info is so small, we want to emit all the tables in */ -/* one DAC marker. Therefore this routine does its own scan of the table. */ -{ -#ifdef C_ARITH_CODING_SUPPORTED - char dc_in_use[NUM_ARITH_TBLS]; - char ac_in_use[NUM_ARITH_TBLS]; - int length, i; - jpeg_component_info *compptr; - - for (i = 0; i < NUM_ARITH_TBLS; i++) - dc_in_use[i] = ac_in_use[i] = 0; - - for (i = 0; i < cinfo->comps_in_scan; i++) { - compptr = cinfo->cur_comp_info[i]; - dc_in_use[compptr->dc_tbl_no] = 1; - ac_in_use[compptr->ac_tbl_no] = 1; - } - - length = 0; - for (i = 0; i < NUM_ARITH_TBLS; i++) - length += dc_in_use[i] + ac_in_use[i]; - - emit_marker(cinfo, M_DAC); - - emit_2bytes(cinfo, length*2 + 2); - - for (i = 0; i < NUM_ARITH_TBLS; i++) { - if (dc_in_use[i]) { - emit_byte(cinfo, i); - emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); - } - if (ac_in_use[i]) { - emit_byte(cinfo, i + 0x10); - emit_byte(cinfo, cinfo->arith_ac_K[i]); - } - } -#endif /* C_ARITH_CODING_SUPPORTED */ -} - - -LOCAL(void) -emit_dri (j_compress_ptr cinfo) -/* Emit a DRI marker */ -{ - emit_marker(cinfo, M_DRI); - - emit_2bytes(cinfo, 4); /* fixed length */ - - emit_2bytes(cinfo, (int) cinfo->restart_interval); -} - - -LOCAL(void) -emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) -/* Emit a SOF marker */ -{ - int ci; - jpeg_component_info *compptr; - - emit_marker(cinfo, code); - - emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ - - /* Make sure image isn't bigger than SOF field can handle */ - if ((long) cinfo->image_height > 65535L || - (long) cinfo->image_width > 65535L) - ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); - - emit_byte(cinfo, cinfo->data_precision); - emit_2bytes(cinfo, (int) cinfo->image_height); - emit_2bytes(cinfo, (int) cinfo->image_width); - - emit_byte(cinfo, cinfo->num_components); - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - emit_byte(cinfo, compptr->component_id); - emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); - emit_byte(cinfo, compptr->quant_tbl_no); - } -} - - -LOCAL(void) -emit_sos (j_compress_ptr cinfo) -/* Emit a SOS marker */ -{ - int i, td, ta; - jpeg_component_info *compptr; - - emit_marker(cinfo, M_SOS); - - emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ - - emit_byte(cinfo, cinfo->comps_in_scan); - - for (i = 0; i < cinfo->comps_in_scan; i++) { - compptr = cinfo->cur_comp_info[i]; - emit_byte(cinfo, compptr->component_id); - td = compptr->dc_tbl_no; - ta = compptr->ac_tbl_no; - if (cinfo->progressive_mode) { - /* Progressive mode: only DC or only AC tables are used in one scan; - * furthermore, Huffman coding of DC refinement uses no table at all. - * We emit 0 for unused field(s); this is recommended by the P&M text - * but does not seem to be specified in the standard. - */ - if (cinfo->Ss == 0) { - ta = 0; /* DC scan */ - if (cinfo->Ah != 0 && !cinfo->arith_code) - td = 0; /* no DC table either */ - } else { - td = 0; /* AC scan */ - } - } - emit_byte(cinfo, (td << 4) + ta); - } - - emit_byte(cinfo, cinfo->Ss); - emit_byte(cinfo, cinfo->Se); - emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); -} - - -LOCAL(void) -emit_jfif_app0 (j_compress_ptr cinfo) -/* Emit a JFIF-compliant APP0 marker */ -{ - /* - * Length of APP0 block (2 bytes) - * Block ID (4 bytes - ASCII "JFIF") - * Zero byte (1 byte to terminate the ID string) - * Version Major, Minor (2 bytes - major first) - * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) - * Xdpu (2 bytes - dots per unit horizontal) - * Ydpu (2 bytes - dots per unit vertical) - * Thumbnail X size (1 byte) - * Thumbnail Y size (1 byte) - */ - - emit_marker(cinfo, M_APP0); - - emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ - - emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ - emit_byte(cinfo, 0x46); - emit_byte(cinfo, 0x49); - emit_byte(cinfo, 0x46); - emit_byte(cinfo, 0); - emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */ - emit_byte(cinfo, cinfo->JFIF_minor_version); - emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ - emit_2bytes(cinfo, (int) cinfo->X_density); - emit_2bytes(cinfo, (int) cinfo->Y_density); - emit_byte(cinfo, 0); /* No thumbnail image */ - emit_byte(cinfo, 0); -} - - -LOCAL(void) -emit_adobe_app14 (j_compress_ptr cinfo) -/* Emit an Adobe APP14 marker */ -{ - /* - * Length of APP14 block (2 bytes) - * Block ID (5 bytes - ASCII "Adobe") - * Version Number (2 bytes - currently 100) - * Flags0 (2 bytes - currently 0) - * Flags1 (2 bytes - currently 0) - * Color transform (1 byte) - * - * Although Adobe TN 5116 mentions Version = 101, all the Adobe files - * now in circulation seem to use Version = 100, so that's what we write. - * - * We write the color transform byte as 1 if the JPEG color space is - * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with - * whether the encoder performed a transformation, which is pretty useless. - */ - - emit_marker(cinfo, M_APP14); - - emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ - - emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ - emit_byte(cinfo, 0x64); - emit_byte(cinfo, 0x6F); - emit_byte(cinfo, 0x62); - emit_byte(cinfo, 0x65); - emit_2bytes(cinfo, 100); /* Version */ - emit_2bytes(cinfo, 0); /* Flags0 */ - emit_2bytes(cinfo, 0); /* Flags1 */ - switch (cinfo->jpeg_color_space) { - case JCS_YCbCr: - emit_byte(cinfo, 1); /* Color transform = 1 */ - break; - case JCS_YCCK: - emit_byte(cinfo, 2); /* Color transform = 2 */ - break; - default: - emit_byte(cinfo, 0); /* Color transform = 0 */ - break; - } -} - - -/* - * These routines allow writing an arbitrary marker with parameters. - * The only intended use is to emit COM or APPn markers after calling - * write_file_header and before calling write_frame_header. - * Other uses are not guaranteed to produce desirable results. - * Counting the parameter bytes properly is the caller's responsibility. - */ - -METHODDEF(void) -write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen) -/* Emit an arbitrary marker header */ -{ - if (datalen > (unsigned int) 65533) /* safety check */ - ERREXIT(cinfo, JERR_BAD_LENGTH); - - emit_marker(cinfo, (JPEG_MARKER) marker); - - emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ -} - -METHODDEF(void) -write_marker_byte (j_compress_ptr cinfo, int val) -/* Emit one byte of marker parameters following write_marker_header */ -{ - emit_byte(cinfo, val); -} - - -/* - * Write datastream header. - * This consists of an SOI and optional APPn markers. - * We recommend use of the JFIF marker, but not the Adobe marker, - * when using YCbCr or grayscale data. The JFIF marker should NOT - * be used for any other JPEG colorspace. The Adobe marker is helpful - * to distinguish RGB, CMYK, and YCCK colorspaces. - * Note that an application can write additional header markers after - * jpeg_start_compress returns. - */ - -METHODDEF(void) -write_file_header (j_compress_ptr cinfo) -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - - emit_marker(cinfo, M_SOI); /* first the SOI */ - - /* SOI is defined to reset restart interval to 0 */ - marker->last_restart_interval = 0; - - if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ - emit_jfif_app0(cinfo); - if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ - emit_adobe_app14(cinfo); -} - - -/* - * Write frame header. - * This consists of DQT and SOFn markers. - * Note that we do not emit the SOF until we have emitted the DQT(s). - * This avoids compatibility problems with incorrect implementations that - * try to error-check the quant table numbers as soon as they see the SOF. - */ - -METHODDEF(void) -write_frame_header (j_compress_ptr cinfo) -{ - int ci, prec; - wxjpeg_boolean is_baseline; - jpeg_component_info *compptr; - - /* Emit DQT for each quantization table. - * Note that emit_dqt() suppresses any duplicate tables. - */ - prec = 0; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - prec += emit_dqt(cinfo, compptr->quant_tbl_no); - } - /* now prec is nonzero iff there are any 16-bit quant tables. */ - - /* Check for a non-baseline specification. - * Note we assume that Huffman table numbers won't be changed later. - */ - if (cinfo->arith_code || cinfo->progressive_mode || - cinfo->data_precision != 8) { - is_baseline = FALSE; - } else { - is_baseline = TRUE; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1) - is_baseline = FALSE; - } - if (prec && is_baseline) { - is_baseline = FALSE; - /* If it's baseline except for quantizer size, warn the user */ - TRACEMS(cinfo, 0, JTRC_16BIT_TABLES); - } - } - - /* Emit the proper SOF marker */ - if (cinfo->arith_code) { - emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ - } else { - if (cinfo->progressive_mode) - emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ - else if (is_baseline) - emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ - else - emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ - } -} - - -/* - * Write scan header. - * This consists of DHT or DAC markers, optional DRI, and SOS. - * Compressed data will be written following the SOS. - */ - -METHODDEF(void) -write_scan_header (j_compress_ptr cinfo) -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - int i; - jpeg_component_info *compptr; - - if (cinfo->arith_code) { - /* Emit arith conditioning info. We may have some duplication - * if the file has multiple scans, but it's so small it's hardly - * worth worrying about. - */ - emit_dac(cinfo); - } else { - /* Emit Huffman tables. - * Note that emit_dht() suppresses any duplicate tables. - */ - for (i = 0; i < cinfo->comps_in_scan; i++) { - compptr = cinfo->cur_comp_info[i]; - if (cinfo->progressive_mode) { - /* Progressive mode: only DC or only AC tables are used in one scan */ - if (cinfo->Ss == 0) { - if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ - emit_dht(cinfo, compptr->dc_tbl_no, FALSE); - } else { - emit_dht(cinfo, compptr->ac_tbl_no, TRUE); - } - } else { - /* Sequential mode: need both DC and AC tables */ - emit_dht(cinfo, compptr->dc_tbl_no, FALSE); - emit_dht(cinfo, compptr->ac_tbl_no, TRUE); - } - } - } - - /* Emit DRI if required --- note that DRI value could change for each scan. - * We avoid wasting space with unnecessary DRIs, however. - */ - if (cinfo->restart_interval != marker->last_restart_interval) { - emit_dri(cinfo); - marker->last_restart_interval = cinfo->restart_interval; - } - - emit_sos(cinfo); -} - - -/* - * Write datastream trailer. - */ - -METHODDEF(void) -write_file_trailer (j_compress_ptr cinfo) -{ - emit_marker(cinfo, M_EOI); -} - - -/* - * Write an abbreviated table-specification datastream. - * This consists of SOI, DQT and DHT tables, and EOI. - * Any table that is defined and not marked sent_table = TRUE will be - * emitted. Note that all tables will be marked sent_table = TRUE at exit. - */ - -METHODDEF(void) -write_tables_only (j_compress_ptr cinfo) -{ - int i; - - emit_marker(cinfo, M_SOI); - - for (i = 0; i < NUM_QUANT_TBLS; i++) { - if (cinfo->quant_tbl_ptrs[i] != NULL) - (void) emit_dqt(cinfo, i); - } - - if (! cinfo->arith_code) { - for (i = 0; i < NUM_HUFF_TBLS; i++) { - if (cinfo->dc_huff_tbl_ptrs[i] != NULL) - emit_dht(cinfo, i, FALSE); - if (cinfo->ac_huff_tbl_ptrs[i] != NULL) - emit_dht(cinfo, i, TRUE); - } - } - - emit_marker(cinfo, M_EOI); -} - - -/* - * Initialize the marker writer module. - */ - -GLOBAL(void) -jinit_marker_writer (j_compress_ptr cinfo) -{ - my_marker_ptr marker; - - /* Create the subobject */ - marker = (my_marker_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_marker_writer)); - cinfo->marker = (struct jpeg_marker_writer *) marker; - /* Initialize method pointers */ - marker->pub.write_file_header = write_file_header; - marker->pub.write_frame_header = write_frame_header; - marker->pub.write_scan_header = write_scan_header; - marker->pub.write_file_trailer = write_file_trailer; - marker->pub.write_tables_only = write_tables_only; - marker->pub.write_marker_header = write_marker_header; - marker->pub.write_marker_byte = write_marker_byte; - /* Initialize private state */ - marker->last_restart_interval = 0; -} diff --git a/Source/3rdParty/wx/src/jpeg/jcmaster.c b/Source/3rdParty/wx/src/jpeg/jcmaster.c deleted file mode 100644 index af887794c..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcmaster.c +++ /dev/null @@ -1,590 +0,0 @@ -/* - * jcmaster.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains master control logic for the JPEG compressor. - * These routines are concerned with parameter validation, initial setup, - * and inter-pass control (determining the number of passes and the work - * to be done in each pass). - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Private state */ - -typedef enum { - main_pass, /* input data, also do first output step */ - huff_opt_pass, /* Huffman code optimization pass */ - output_pass /* data output pass */ -} c_pass_type; - -typedef struct { - struct jpeg_comp_master pub; /* public fields */ - - c_pass_type pass_type; /* the type of the current pass */ - - int pass_number; /* # of passes completed */ - int total_passes; /* total # of passes needed */ - - int scan_number; /* current index in scan_info[] */ -} my_comp_master; - -typedef my_comp_master * my_master_ptr; - - -/* - * Support routines that do various essential calculations. - */ - -LOCAL(void) -initial_setup (j_compress_ptr cinfo) -/* Do computations that are needed before master selection phase */ -{ - int ci; - jpeg_component_info *compptr; - long samplesperrow; - JDIMENSION jd_samplesperrow; - - /* Sanity check on image dimensions */ - if (cinfo->image_height <= 0 || cinfo->image_width <= 0 - || cinfo->num_components <= 0 || cinfo->input_components <= 0) - ERREXIT(cinfo, JERR_EMPTY_IMAGE); - - /* Make sure image isn't bigger than I can handle */ - if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || - (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) - ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); - - /* Width of an input scanline must be representable as JDIMENSION. */ - samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; - jd_samplesperrow = (JDIMENSION) samplesperrow; - if ((long) jd_samplesperrow != samplesperrow) - ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); - - /* For now, precision must match compiled-in value... */ - if (cinfo->data_precision != BITS_IN_JSAMPLE) - ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); - - /* Check that number of components won't exceed internal array sizes */ - if (cinfo->num_components > MAX_COMPONENTS) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); - - /* Compute maximum sampling factors; check factor validity */ - cinfo->max_h_samp_factor = 1; - cinfo->max_v_samp_factor = 1; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || - compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) - ERREXIT(cinfo, JERR_BAD_SAMPLING); - cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, - compptr->h_samp_factor); - cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, - compptr->v_samp_factor); - } - - /* Compute dimensions of components */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Fill in the correct component_index value; don't rely on application */ - compptr->component_index = ci; - /* For compression, we never do DCT scaling. */ - compptr->DCT_scaled_size = DCTSIZE; - /* Size in DCT blocks */ - compptr->width_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); - compptr->height_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) (cinfo->max_v_samp_factor * DCTSIZE)); - /* Size in samples */ - compptr->downsampled_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) cinfo->max_h_samp_factor); - compptr->downsampled_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) cinfo->max_v_samp_factor); - /* Mark component needed (this flag isn't actually used for compression) */ - compptr->component_needed = TRUE; - } - - /* Compute number of fully interleaved MCU rows (number of times that - * main controller will call coefficient controller). - */ - cinfo->total_iMCU_rows = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); -} - - -#ifdef C_MULTISCAN_FILES_SUPPORTED - -LOCAL(void) -validate_script (j_compress_ptr cinfo) -/* Verify that the scan script in cinfo->scan_info[] is valid; also - * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. - */ -{ - const jpeg_scan_info * scanptr; - int scanno, ncomps, ci, coefi, thisi; - int Ss, Se, Ah, Al; - wxjpeg_boolean component_sent[MAX_COMPONENTS]; -#ifdef C_PROGRESSIVE_SUPPORTED - int * last_bitpos_ptr; - int last_bitpos[MAX_COMPONENTS][DCTSIZE2]; - /* -1 until that coefficient has been seen; then last Al for it */ -#endif - - if (cinfo->num_scans <= 0) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0); - - /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1; - * for progressive JPEG, no scan can have this. - */ - scanptr = cinfo->scan_info; - if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) { -#ifdef C_PROGRESSIVE_SUPPORTED - cinfo->progressive_mode = TRUE; - last_bitpos_ptr = & last_bitpos[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) - for (coefi = 0; coefi < DCTSIZE2; coefi++) - *last_bitpos_ptr++ = -1; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - cinfo->progressive_mode = FALSE; - for (ci = 0; ci < cinfo->num_components; ci++) - component_sent[ci] = FALSE; - } - - for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) { - /* Validate component indexes */ - ncomps = scanptr->comps_in_scan; - if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN); - for (ci = 0; ci < ncomps; ci++) { - thisi = scanptr->component_index[ci]; - if (thisi < 0 || thisi >= cinfo->num_components) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); - /* Components must appear in SOF order within each scan */ - if (ci > 0 && thisi <= scanptr->component_index[ci-1]) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); - } - /* Validate progression parameters */ - Ss = scanptr->Ss; - Se = scanptr->Se; - Ah = scanptr->Ah; - Al = scanptr->Al; - if (cinfo->progressive_mode) { -#ifdef C_PROGRESSIVE_SUPPORTED - /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that - * seems wrong: the upper bound ought to depend on data precision. - * Perhaps they really meant 0..N+1 for N-bit precision. - * Here we allow 0..10 for 8-bit data; Al larger than 10 results in - * out-of-range reconstructed DC values during the first DC scan, - * which might cause problems for some decoders. - */ -#if BITS_IN_JSAMPLE == 8 -#define MAX_AH_AL 10 -#else -#define MAX_AH_AL 13 -#endif - if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || - Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - if (Ss == 0) { - if (Se != 0) /* DC and AC together not OK */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } else { - if (ncomps != 1) /* AC scans must be for only one component */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } - for (ci = 0; ci < ncomps; ci++) { - last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; - if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - for (coefi = Ss; coefi <= Se; coefi++) { - if (last_bitpos_ptr[coefi] < 0) { - /* first scan of this coefficient */ - if (Ah != 0) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } else { - /* not first scan */ - if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } - last_bitpos_ptr[coefi] = Al; - } - } -#endif - } else { - /* For sequential JPEG, all progression parameters must be these: */ - if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - /* Make sure components are not sent twice */ - for (ci = 0; ci < ncomps; ci++) { - thisi = scanptr->component_index[ci]; - if (component_sent[thisi]) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); - component_sent[thisi] = TRUE; - } - } - } - - /* Now verify that everything got sent. */ - if (cinfo->progressive_mode) { -#ifdef C_PROGRESSIVE_SUPPORTED - /* For progressive mode, we only check that at least some DC data - * got sent for each component; the spec does not require that all bits - * of all coefficients be transmitted. Would it be wiser to enforce - * transmission of all coefficient bits?? - */ - for (ci = 0; ci < cinfo->num_components; ci++) { - if (last_bitpos[ci][0] < 0) - ERREXIT(cinfo, JERR_MISSING_DATA); - } -#endif - } else { - for (ci = 0; ci < cinfo->num_components; ci++) { - if (! component_sent[ci]) - ERREXIT(cinfo, JERR_MISSING_DATA); - } - } -} - -#endif /* C_MULTISCAN_FILES_SUPPORTED */ - - -LOCAL(void) -select_scan_parameters (j_compress_ptr cinfo) -/* Set up the scan parameters for the current scan */ -{ - int ci; - -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (cinfo->scan_info != NULL) { - /* Prepare for current scan --- the script is already validated */ - my_master_ptr master = (my_master_ptr) cinfo->master; - const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number; - - cinfo->comps_in_scan = scanptr->comps_in_scan; - for (ci = 0; ci < scanptr->comps_in_scan; ci++) { - cinfo->cur_comp_info[ci] = - &cinfo->comp_info[scanptr->component_index[ci]]; - } - cinfo->Ss = scanptr->Ss; - cinfo->Se = scanptr->Se; - cinfo->Ah = scanptr->Ah; - cinfo->Al = scanptr->Al; - } - else -#endif - { - /* Prepare for single sequential-JPEG scan containing all components */ - if (cinfo->num_components > MAX_COMPS_IN_SCAN) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPS_IN_SCAN); - cinfo->comps_in_scan = cinfo->num_components; - for (ci = 0; ci < cinfo->num_components; ci++) { - cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; - } - cinfo->Ss = 0; - cinfo->Se = DCTSIZE2-1; - cinfo->Ah = 0; - cinfo->Al = 0; - } -} - - -LOCAL(void) -per_scan_setup (j_compress_ptr cinfo) -/* Do computations that are needed before processing a JPEG scan */ -/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ -{ - int ci, mcublks, tmp; - jpeg_component_info *compptr; - - if (cinfo->comps_in_scan == 1) { - - /* Noninterleaved (single-component) scan */ - compptr = cinfo->cur_comp_info[0]; - - /* Overall image size in MCUs */ - cinfo->MCUs_per_row = compptr->width_in_blocks; - cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - - /* For noninterleaved scan, always one block per MCU */ - compptr->MCU_width = 1; - compptr->MCU_height = 1; - compptr->MCU_blocks = 1; - compptr->MCU_sample_width = DCTSIZE; - compptr->last_col_width = 1; - /* For noninterleaved scans, it is convenient to define last_row_height - * as the number of block rows present in the last iMCU row. - */ - tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); - if (tmp == 0) tmp = compptr->v_samp_factor; - compptr->last_row_height = tmp; - - /* Prepare array describing MCU composition */ - cinfo->blocks_in_MCU = 1; - cinfo->MCU_membership[0] = 0; - - } else { - - /* Interleaved (multi-component) scan */ - if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, - MAX_COMPS_IN_SCAN); - - /* Overall image size in MCUs */ - cinfo->MCUs_per_row = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width, - (long) (cinfo->max_h_samp_factor*DCTSIZE)); - cinfo->MCU_rows_in_scan = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); - - cinfo->blocks_in_MCU = 0; - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Sampling factors give # of blocks of component in each MCU */ - compptr->MCU_width = compptr->h_samp_factor; - compptr->MCU_height = compptr->v_samp_factor; - compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; - compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE; - /* Figure number of non-dummy blocks in last MCU column & row */ - tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); - if (tmp == 0) tmp = compptr->MCU_width; - compptr->last_col_width = tmp; - tmp = (int) (compptr->height_in_blocks % compptr->MCU_height); - if (tmp == 0) tmp = compptr->MCU_height; - compptr->last_row_height = tmp; - /* Prepare array describing MCU composition */ - mcublks = compptr->MCU_blocks; - if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU) - ERREXIT(cinfo, JERR_BAD_MCU_SIZE); - while (mcublks-- > 0) { - cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; - } - } - - } - - /* Convert restart specified in rows to actual MCU count. */ - /* Note that count must fit in 16 bits, so we provide limiting. */ - if (cinfo->restart_in_rows > 0) { - long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; - cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); - } -} - - -/* - * Per-pass setup. - * This is called at the beginning of each pass. We determine which modules - * will be active during this pass and give them appropriate start_pass calls. - * We also set is_last_pass to indicate whether any more passes will be - * required. - */ - -METHODDEF(void) -prepare_for_pass (j_compress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - - switch (master->pass_type) { - case main_pass: - /* Initial pass: will collect input data, and do either Huffman - * optimization or data output for the first scan. - */ - select_scan_parameters(cinfo); - per_scan_setup(cinfo); - if (! cinfo->raw_data_in) { - (*cinfo->cconvert->start_pass) (cinfo); - (*cinfo->downsample->start_pass) (cinfo); - (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); - } - (*cinfo->fdct->start_pass) (cinfo); - (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding); - (*cinfo->coef->start_pass) (cinfo, - (master->total_passes > 1 ? - JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); - (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); - if (cinfo->optimize_coding) { - /* No immediate data output; postpone writing frame/scan headers */ - master->pub.call_pass_startup = FALSE; - } else { - /* Will write frame/scan headers at first jpeg_write_scanlines call */ - master->pub.call_pass_startup = TRUE; - } - break; -#ifdef ENTROPY_OPT_SUPPORTED - case huff_opt_pass: - /* Do Huffman optimization for a scan after the first one. */ - select_scan_parameters(cinfo); - per_scan_setup(cinfo); - if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) { - (*cinfo->entropy->start_pass) (cinfo, TRUE); - (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); - master->pub.call_pass_startup = FALSE; - break; - } - /* Special case: Huffman DC refinement scans need no Huffman table - * and therefore we can skip the optimization pass for them. - */ - master->pass_type = output_pass; - master->pass_number++; - /*FALLTHROUGH*/ -#endif - case output_pass: - /* Do a data-output pass. */ - /* We need not repeat per-scan setup if prior optimization pass did it. */ - if (! cinfo->optimize_coding) { - select_scan_parameters(cinfo); - per_scan_setup(cinfo); - } - (*cinfo->entropy->start_pass) (cinfo, FALSE); - (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); - /* We emit frame/scan headers now */ - if (master->scan_number == 0) - (*cinfo->marker->write_frame_header) (cinfo); - (*cinfo->marker->write_scan_header) (cinfo); - master->pub.call_pass_startup = FALSE; - break; - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - } - - master->pub.is_last_pass = (master->pass_number == master->total_passes-1); - - /* Set up progress monitor's pass info if present */ - if (cinfo->progress != NULL) { - cinfo->progress->completed_passes = master->pass_number; - cinfo->progress->total_passes = master->total_passes; - } -} - - -/* - * Special start-of-pass hook. - * This is called by jpeg_write_scanlines if call_pass_startup is TRUE. - * In single-pass processing, we need this hook because we don't want to - * write frame/scan headers during jpeg_start_compress; we want to let the - * application write COM markers etc. between jpeg_start_compress and the - * jpeg_write_scanlines loop. - * In multi-pass processing, this routine is not used. - */ - -METHODDEF(void) -pass_startup (j_compress_ptr cinfo) -{ - cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ - - (*cinfo->marker->write_frame_header) (cinfo); - (*cinfo->marker->write_scan_header) (cinfo); -} - - -/* - * Finish up at end of pass. - */ - -METHODDEF(void) -finish_pass_master (j_compress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - - /* The entropy coder always needs an end-of-pass call, - * either to analyze statistics or to flush its output buffer. - */ - (*cinfo->entropy->finish_pass) (cinfo); - - /* Update state for next pass */ - switch (master->pass_type) { - case main_pass: - /* next pass is either output of scan 0 (after optimization) - * or output of scan 1 (if no optimization). - */ - master->pass_type = output_pass; - if (! cinfo->optimize_coding) - master->scan_number++; - break; - case huff_opt_pass: - /* next pass is always output of current scan */ - master->pass_type = output_pass; - break; - case output_pass: - /* next pass is either optimization or output of next scan */ - if (cinfo->optimize_coding) - master->pass_type = huff_opt_pass; - master->scan_number++; - break; - } - - master->pass_number++; -} - - -/* - * Initialize master compression control. - */ - -GLOBAL(void) -jinit_c_master_control (j_compress_ptr cinfo, wxjpeg_boolean transcode_only) -{ - my_master_ptr master; - - master = (my_master_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_comp_master)); - cinfo->master = (struct jpeg_comp_master *) master; - master->pub.prepare_for_pass = prepare_for_pass; - master->pub.pass_startup = pass_startup; - master->pub.finish_pass = finish_pass_master; - master->pub.is_last_pass = FALSE; - - /* Validate parameters, determine derived values */ - initial_setup(cinfo); - - if (cinfo->scan_info != NULL) { -#ifdef C_MULTISCAN_FILES_SUPPORTED - validate_script(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - cinfo->progressive_mode = FALSE; - cinfo->num_scans = 1; - } - - if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */ - cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ - - /* Initialize my private state */ - if (transcode_only) { - /* no main pass in transcoding */ - if (cinfo->optimize_coding) - master->pass_type = huff_opt_pass; - else - master->pass_type = output_pass; - } else { - /* for normal compression, first pass is always this type: */ - master->pass_type = main_pass; - } - master->scan_number = 0; - master->pass_number = 0; - if (cinfo->optimize_coding) - master->total_passes = cinfo->num_scans * 2; - else - master->total_passes = cinfo->num_scans; -} diff --git a/Source/3rdParty/wx/src/jpeg/jcomapi.c b/Source/3rdParty/wx/src/jpeg/jcomapi.c deleted file mode 100644 index 9b1fa7568..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcomapi.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * jcomapi.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains application interface routines that are used for both - * compression and decompression. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Abort processing of a JPEG compression or decompression operation, - * but don't destroy the object itself. - * - * For this, we merely clean up all the nonpermanent memory pools. - * Note that temp files (virtual arrays) are not allowed to belong to - * the permanent pool, so we will be able to close all temp files here. - * Closing a data source or destination, if necessary, is the application's - * responsibility. - */ - -GLOBAL(void) -jpeg_abort (j_common_ptr cinfo) -{ - int pool; - - /* Do nothing if called on a not-initialized or destroyed JPEG object. */ - if (cinfo->mem == NULL) - return; - - /* Releasing pools in reverse order might help avoid fragmentation - * with some (brain-damaged) malloc libraries. - */ - for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { - (*cinfo->mem->free_pool) (cinfo, pool); - } - - /* Reset overall state for possible reuse of object */ - if (cinfo->is_decompressor) { - cinfo->global_state = DSTATE_START; - /* Try to keep application from accessing now-deleted marker list. - * A bit kludgy to do it here, but this is the most central place. - */ - ((j_decompress_ptr) cinfo)->marker_list = NULL; - } else { - cinfo->global_state = CSTATE_START; - } -} - - -/* - * Destruction of a JPEG object. - * - * Everything gets deallocated except the master jpeg_compress_struct itself - * and the error manager struct. Both of these are supplied by the application - * and must be freed, if necessary, by the application. (Often they are on - * the stack and so don't need to be freed anyway.) - * Closing a data source or destination, if necessary, is the application's - * responsibility. - */ - -GLOBAL(void) -jpeg_destroy (j_common_ptr cinfo) -{ - /* We need only tell the memory manager to release everything. */ - /* NB: mem pointer is NULL if memory mgr failed to initialize. */ - if (cinfo->mem != NULL) - (*cinfo->mem->self_destruct) (cinfo); - cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ - cinfo->global_state = 0; /* mark it destroyed */ -} - - -/* - * Convenience routines for allocating quantization and Huffman tables. - * (Would jutils.c be a more reasonable place to put these?) - */ - -GLOBAL(JQUANT_TBL *) -jpeg_alloc_quant_table (j_common_ptr cinfo) -{ - JQUANT_TBL *tbl; - - tbl = (JQUANT_TBL *) - (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); - tbl->sent_table = FALSE; /* make sure this is false in any new table */ - return tbl; -} - - -GLOBAL(JHUFF_TBL *) -jpeg_alloc_huff_table (j_common_ptr cinfo) -{ - JHUFF_TBL *tbl; - - tbl = (JHUFF_TBL *) - (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); - tbl->sent_table = FALSE; /* make sure this is false in any new table */ - return tbl; -} diff --git a/Source/3rdParty/wx/src/jpeg/jconfig.h b/Source/3rdParty/wx/src/jpeg/jconfig.h deleted file mode 100644 index 254d9264d..000000000 --- a/Source/3rdParty/wx/src/jpeg/jconfig.h +++ /dev/null @@ -1,109 +0,0 @@ -/* This test added by JACS as a quick fix. What should we do - * to make it work with configure? - */ - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__DMC__) -#include "jconfig.vc" -#else - -/* jconfig.h. Generated automatically by configure. */ -/* jconfig.cfg --- source file edited by configure script */ -/* see jconfig.doc for explanations */ - -/* If using MetroWerks on Mac define __WXMAC__ if it isn't already - FIXME: Is this necessary any longer? */ -#ifdef __MWERKS__ -#if (__MWERKS__ < 0x0900) || macintosh || defined ( __MACH__ ) -# ifndef __WXMAC__ -# define __WXMAC__ -# endif -#endif -#endif - -/* use wxWidgets' configure */ -#include "wx/setup.h" - -/* If using Metrowerks and not using configure-generated setup */ -#if defined(__MWERKS__) && !defined(__WX_SETUP_H__) -#if (__MWERKS__ < 0x0900) || macintosh || defined ( __MACH__ ) - -# define USE_MAC_MEMMGR - -# ifdef __MACH__ -# include -# include -# include -# undef WCHAR_MAX -# include -# endif - -/* automatically includes MacHeaders */ -#elif (__MWERKS__ >= 0x0900) && __INTEL__ - #define __WXMSW__ -#endif -#endif - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -#undef void -#undef const - -/* use wxWidgets' configure */ -/* #undef CHAR_IS_UNSIGNED */ -#ifdef __CHAR_UNSIGNED__ - #ifndef CHAR_IS_UNSIGNED - #define CHAR_IS_UNSIGNED - #endif -#else - #undef CHAR_IS_UNSIGNED -#endif - -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -/* Define this if you get warnings about undefined structures. */ -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -/* use wxWidgets' configure */ -/* #define INLINE __inline__ */ -#if defined(__VISAGECPP__) && (__IBMCPP__ >= 400 || __IBMC__ >= 400) -#define INLINE -#elif defined(__WATCOMC__) -#define INLINE -#else -#define INLINE inline -#endif - -/* These are for configuring the JPEG memory manager. */ -#undef DEFAULT_MAX_MEM -#undef NO_MKTEMP - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#undef TWO_FILE_COMMANDLINE -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE - -/* Define this if you want percent-done progress reports from cjpeg/djpeg. */ -#undef PROGRESS_REPORT - -#endif /* JPEG_CJPEG_DJPEG */ -#endif - /* _MSC_VER */ - diff --git a/Source/3rdParty/wx/src/jpeg/jconfig.vc b/Source/3rdParty/wx/src/jpeg/jconfig.vc deleted file mode 100644 index 7e291c75b..000000000 --- a/Source/3rdParty/wx/src/jpeg/jconfig.vc +++ /dev/null @@ -1,45 +0,0 @@ -/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -/* Define "boolean" as unsigned char, not int, per Windows custom */ -#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ -typedef unsigned char boolean; -#endif -#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ - - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE /* optional */ -#define USE_SETMODE /* Microsoft has setmode() */ -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/Source/3rdParty/wx/src/jpeg/jcparam.c b/Source/3rdParty/wx/src/jpeg/jcparam.c deleted file mode 100644 index 046bd87e0..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcparam.c +++ /dev/null @@ -1,610 +0,0 @@ -/* - * jcparam.c - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains optional default-setting code for the JPEG compressor. - * Applications do not have to use this file, but those that don't use it - * must know a lot more about the innards of the JPEG code. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Quantization table setup routines - */ - -GLOBAL(void) -jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, wxjpeg_boolean force_baseline) -/* Define a quantization table equal to the basic_table times - * a scale factor (given as a percentage). - * If force_baseline is TRUE, the computed quantization table entries - * are limited to 1..255 for JPEG baseline compatibility. - */ -{ - JQUANT_TBL ** qtblptr; - int i; - long temp; - - /* Safety check to ensure start_compress not called yet. */ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS) - ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl); - - qtblptr = & cinfo->quant_tbl_ptrs[which_tbl]; - - if (*qtblptr == NULL) - *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo); - - for (i = 0; i < DCTSIZE2; i++) { - temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; - /* limit the values to the valid range */ - if (temp <= 0L) temp = 1L; - if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */ - if (force_baseline && temp > 255L) - temp = 255L; /* limit to baseline range if requested */ - (*qtblptr)->quantval[i] = (UINT16) temp; - } - - /* Initialize sent_table FALSE so table will be written to JPEG file. */ - (*qtblptr)->sent_table = FALSE; -} - - -GLOBAL(void) -jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - wxjpeg_boolean force_baseline) -/* Set or change the 'quality' (quantization) setting, using default tables - * and a straight percentage-scaling quality scale. In most cases it's better - * to use jpeg_set_quality (below); this entry point is provided for - * applications that insist on a linear percentage scaling. - */ -{ - /* These are the sample quantization tables given in JPEG spec section K.1. - * The spec says that the values given produce "good" quality, and - * when divided by 2, "very good" quality. - */ - static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { - 16, 11, 10, 16, 24, 40, 51, 61, - 12, 12, 14, 19, 26, 58, 60, 55, - 14, 13, 16, 24, 40, 57, 69, 56, - 14, 17, 22, 29, 51, 87, 80, 62, - 18, 22, 37, 56, 68, 109, 103, 77, - 24, 35, 55, 64, 81, 104, 113, 92, - 49, 64, 78, 87, 103, 121, 120, 101, - 72, 92, 95, 98, 112, 100, 103, 99 - }; - static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { - 17, 18, 24, 47, 99, 99, 99, 99, - 18, 21, 26, 66, 99, 99, 99, 99, - 24, 26, 56, 99, 99, 99, 99, 99, - 47, 66, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99 - }; - - /* Set up two quantization tables using the specified scaling */ - jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, - scale_factor, force_baseline); - jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, - scale_factor, force_baseline); -} - - -GLOBAL(int) -jpeg_quality_scaling (int quality) -/* Convert a user-specified quality rating to a percentage scaling factor - * for an underlying quantization table, using our recommended scaling curve. - * The input 'quality' factor should be 0 (terrible) to 100 (very good). - */ -{ - /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */ - if (quality <= 0) quality = 1; - if (quality > 100) quality = 100; - - /* The basic table is used as-is (scaling 100) for a quality of 50. - * Qualities 50..100 are converted to scaling percentage 200 - 2*Q; - * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table - * to make all the table entries 1 (hence, minimum quantization loss). - * Qualities 1..50 are converted to scaling percentage 5000/Q. - */ - if (quality < 50) - quality = 5000 / quality; - else - quality = 200 - quality*2; - - return quality; -} - - -GLOBAL(void) -jpeg_set_quality (j_compress_ptr cinfo, int quality, wxjpeg_boolean force_baseline) -/* Set or change the 'quality' (quantization) setting, using default tables. - * This is the standard quality-adjusting entry point for typical user - * interfaces; only those who want detailed control over quantization tables - * would use the preceding three routines directly. - */ -{ - /* Convert user 0-100 rating to percentage scaling */ - quality = jpeg_quality_scaling(quality); - - /* Set up standard quality tables */ - jpeg_set_linear_quality(cinfo, quality, force_baseline); -} - - -/* - * Huffman table setup routines - */ - -LOCAL(void) -add_huff_table (j_compress_ptr cinfo, - JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) -/* Define a Huffman table */ -{ - int nsymbols, len; - - if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - - /* Copy the number-of-symbols-of-each-code-length counts */ - MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); - - /* Validate the counts. We do this here mainly so we can copy the right - * number of symbols from the val[] array, without risking marching off - * the end of memory. jchuff.c will do a more thorough test later. - */ - nsymbols = 0; - for (len = 1; len <= 16; len++) - nsymbols += bits[len]; - if (nsymbols < 1 || nsymbols > 256) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - - MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8)); - - /* Initialize sent_table FALSE so table will be written to JPEG file. */ - (*htblptr)->sent_table = FALSE; -} - - -LOCAL(void) -std_huff_tables (j_compress_ptr cinfo) -/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ -/* IMPORTANT: these are only valid for 8-bit data precision! */ -{ - static const UINT8 bits_dc_luminance[17] = - { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; - static const UINT8 val_dc_luminance[] = - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; - - static const UINT8 bits_dc_chrominance[17] = - { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; - static const UINT8 val_dc_chrominance[] = - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; - - static const UINT8 bits_ac_luminance[17] = - { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; - static const UINT8 val_ac_luminance[] = - { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, - 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, - 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, - 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, - 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, - 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, - 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, - 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, - 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, - 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, - 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, - 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, - 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, - 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, - 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, - 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, - 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, - 0xf9, 0xfa }; - - static const UINT8 bits_ac_chrominance[17] = - { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; - static const UINT8 val_ac_chrominance[] = - { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, - 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, - 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, - 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, - 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, - 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, - 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, - 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, - 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, - 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, - 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, - 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, - 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, - 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, - 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, - 0xf9, 0xfa }; - - add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], - bits_dc_luminance, val_dc_luminance); - add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], - bits_ac_luminance, val_ac_luminance); - add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1], - bits_dc_chrominance, val_dc_chrominance); - add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1], - bits_ac_chrominance, val_ac_chrominance); -} - - -/* - * Default parameter setup for compression. - * - * Applications that don't choose to use this routine must do their - * own setup of all these parameters. Alternately, you can call this - * to establish defaults and then alter parameters selectively. This - * is the recommended approach since, if we add any new parameters, - * your code will still work (they'll be set to reasonable defaults). - */ - -GLOBAL(void) -jpeg_set_defaults (j_compress_ptr cinfo) -{ - int i; - - /* Safety check to ensure start_compress not called yet. */ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - /* Allocate comp_info array large enough for maximum component count. - * Array is made permanent in case application wants to compress - * multiple images at same param settings. - */ - if (cinfo->comp_info == NULL) - cinfo->comp_info = (jpeg_component_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - MAX_COMPONENTS * SIZEOF(jpeg_component_info)); - - /* Initialize everything not dependent on the color space */ - - cinfo->data_precision = BITS_IN_JSAMPLE; - /* Set up two quantization tables using default quality of 75 */ - jpeg_set_quality(cinfo, 75, TRUE); - /* Set up two Huffman tables */ - std_huff_tables(cinfo); - - /* Initialize default arithmetic coding conditioning */ - for (i = 0; i < NUM_ARITH_TBLS; i++) { - cinfo->arith_dc_L[i] = 0; - cinfo->arith_dc_U[i] = 1; - cinfo->arith_ac_K[i] = 5; - } - - /* Default is no multiple-scan output */ - cinfo->scan_info = NULL; - cinfo->num_scans = 0; - - /* Expect normal source image, not raw downsampled data */ - cinfo->raw_data_in = FALSE; - - /* Use Huffman coding, not arithmetic coding, by default */ - cinfo->arith_code = FALSE; - - /* By default, don't do extra passes to optimize entropy coding */ - cinfo->optimize_coding = FALSE; - /* The standard Huffman tables are only valid for 8-bit data precision. - * If the precision is higher, force optimization on so that usable - * tables will be computed. This test can be removed if default tables - * are supplied that are valid for the desired precision. - */ - if (cinfo->data_precision > 8) - cinfo->optimize_coding = TRUE; - - /* By default, use the simpler non-cosited sampling alignment */ - cinfo->CCIR601_sampling = FALSE; - - /* No input smoothing */ - cinfo->smoothing_factor = 0; - - /* DCT algorithm preference */ - cinfo->dct_method = JDCT_DEFAULT; - - /* No restart markers */ - cinfo->restart_interval = 0; - cinfo->restart_in_rows = 0; - - /* Fill in default JFIF marker parameters. Note that whether the marker - * will actually be written is determined by jpeg_set_colorspace. - * - * By default, the library emits JFIF version code 1.01. - * An application that wants to emit JFIF 1.02 extension markers should set - * JFIF_minor_version to 2. We could probably get away with just defaulting - * to 1.02, but there may still be some decoders in use that will complain - * about that; saying 1.01 should minimize compatibility problems. - */ - cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */ - cinfo->JFIF_minor_version = 1; - cinfo->density_unit = 0; /* Pixel size is unknown by default */ - cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ - cinfo->Y_density = 1; - - /* Choose JPEG colorspace based on input space, set defaults accordingly */ - - jpeg_default_colorspace(cinfo); -} - - -/* - * Select an appropriate JPEG colorspace for in_color_space. - */ - -GLOBAL(void) -jpeg_default_colorspace (j_compress_ptr cinfo) -{ - switch (cinfo->in_color_space) { - case JCS_GRAYSCALE: - jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); - break; - case JCS_RGB: - jpeg_set_colorspace(cinfo, JCS_YCbCr); - break; - case JCS_YCbCr: - jpeg_set_colorspace(cinfo, JCS_YCbCr); - break; - case JCS_CMYK: - jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */ - break; - case JCS_YCCK: - jpeg_set_colorspace(cinfo, JCS_YCCK); - break; - case JCS_UNKNOWN: - jpeg_set_colorspace(cinfo, JCS_UNKNOWN); - break; - default: - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - } -} - - -/* - * Set the JPEG colorspace, and choose colorspace-dependent default values. - */ - -GLOBAL(void) -jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) -{ - jpeg_component_info * compptr; - int ci; - -#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \ - (compptr = &cinfo->comp_info[index], \ - compptr->component_id = (id), \ - compptr->h_samp_factor = (hsamp), \ - compptr->v_samp_factor = (vsamp), \ - compptr->quant_tbl_no = (quant), \ - compptr->dc_tbl_no = (dctbl), \ - compptr->ac_tbl_no = (actbl) ) - - /* Safety check to ensure start_compress not called yet. */ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - /* For all colorspaces, we use Q and Huff tables 0 for luminance components, - * tables 1 for chrominance components. - */ - - cinfo->jpeg_color_space = colorspace; - - cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */ - cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */ - - switch (colorspace) { - case JCS_GRAYSCALE: - cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ - cinfo->num_components = 1; - /* JFIF specifies component ID 1 */ - SET_COMP(0, 1, 1,1, 0, 0,0); - break; - case JCS_RGB: - cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */ - cinfo->num_components = 3; - SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0); - SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0); - SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0); - break; - case JCS_YCbCr: - cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ - cinfo->num_components = 3; - /* JFIF specifies component IDs 1,2,3 */ - /* We default to 2x2 subsamples of chrominance */ - SET_COMP(0, 1, 2,2, 0, 0,0); - SET_COMP(1, 2, 1,1, 1, 1,1); - SET_COMP(2, 3, 1,1, 1, 1,1); - break; - case JCS_CMYK: - cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */ - cinfo->num_components = 4; - SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0); - SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0); - SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0); - SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0); - break; - case JCS_YCCK: - cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */ - cinfo->num_components = 4; - SET_COMP(0, 1, 2,2, 0, 0,0); - SET_COMP(1, 2, 1,1, 1, 1,1); - SET_COMP(2, 3, 1,1, 1, 1,1); - SET_COMP(3, 4, 2,2, 0, 0,0); - break; - case JCS_UNKNOWN: - cinfo->num_components = cinfo->input_components; - if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); - for (ci = 0; ci < cinfo->num_components; ci++) { - SET_COMP(ci, ci, 1,1, 0, 0,0); - } - break; - default: - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - } -} - - -#ifdef C_PROGRESSIVE_SUPPORTED - -LOCAL(jpeg_scan_info *) -fill_a_scan (jpeg_scan_info * scanptr, int ci, - int Ss, int Se, int Ah, int Al) -/* Support routine: generate one scan for specified component */ -{ - scanptr->comps_in_scan = 1; - scanptr->component_index[0] = ci; - scanptr->Ss = Ss; - scanptr->Se = Se; - scanptr->Ah = Ah; - scanptr->Al = Al; - scanptr++; - return scanptr; -} - -LOCAL(jpeg_scan_info *) -fill_scans (jpeg_scan_info * scanptr, int ncomps, - int Ss, int Se, int Ah, int Al) -/* Support routine: generate one scan for each component */ -{ - int ci; - - for (ci = 0; ci < ncomps; ci++) { - scanptr->comps_in_scan = 1; - scanptr->component_index[0] = ci; - scanptr->Ss = Ss; - scanptr->Se = Se; - scanptr->Ah = Ah; - scanptr->Al = Al; - scanptr++; - } - return scanptr; -} - -LOCAL(jpeg_scan_info *) -fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al) -/* Support routine: generate interleaved DC scan if possible, else N scans */ -{ - int ci; - - if (ncomps <= MAX_COMPS_IN_SCAN) { - /* Single interleaved DC scan */ - scanptr->comps_in_scan = ncomps; - for (ci = 0; ci < ncomps; ci++) - scanptr->component_index[ci] = ci; - scanptr->Ss = scanptr->Se = 0; - scanptr->Ah = Ah; - scanptr->Al = Al; - scanptr++; - } else { - /* Noninterleaved DC scan for each component */ - scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al); - } - return scanptr; -} - - -/* - * Create a recommended progressive-JPEG script. - * cinfo->num_components and cinfo->jpeg_color_space must be correct. - */ - -GLOBAL(void) -jpeg_simple_progression (j_compress_ptr cinfo) -{ - int ncomps = cinfo->num_components; - int nscans; - jpeg_scan_info * scanptr; - - /* Safety check to ensure start_compress not called yet. */ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - /* Figure space needed for script. Calculation must match code below! */ - if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { - /* Custom script for YCbCr color images. */ - nscans = 10; - } else { - /* All-purpose script for other color spaces. */ - if (ncomps > MAX_COMPS_IN_SCAN) - nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ - else - nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ - } - - /* Allocate space for script. - * We need to put it in the permanent pool in case the application performs - * multiple compressions without changing the settings. To avoid a memory - * leak if jpeg_simple_progression is called repeatedly for the same JPEG - * object, we try to re-use previously allocated space, and we allocate - * enough space to handle YCbCr even if initially asked for grayscale. - */ - if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { - cinfo->script_space_size = MAX(nscans, 10); - cinfo->script_space = (jpeg_scan_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - cinfo->script_space_size * SIZEOF(jpeg_scan_info)); - } - scanptr = cinfo->script_space; - cinfo->scan_info = scanptr; - cinfo->num_scans = nscans; - - if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { - /* Custom script for YCbCr color images. */ - /* Initial DC scan */ - scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); - /* Initial AC scan: get some luma data out in a hurry */ - scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2); - /* Chroma data is too small to be worth expending many scans on */ - scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1); - scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1); - /* Complete spectral selection for luma AC */ - scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2); - /* Refine next bit of luma AC */ - scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1); - /* Finish DC successive approximation */ - scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); - /* Finish AC successive approximation */ - scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0); - scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0); - /* Luma bottom bit comes last since it's usually largest scan */ - scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0); - } else { - /* All-purpose script for other color spaces. */ - /* Successive approximation first pass */ - scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); - scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2); - scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2); - /* Successive approximation second pass */ - scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1); - /* Successive approximation final pass */ - scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); - scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0); - } -} - -#endif /* C_PROGRESSIVE_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jcphuff.c b/Source/3rdParty/wx/src/jpeg/jcphuff.c deleted file mode 100644 index 84e53f403..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcphuff.c +++ /dev/null @@ -1,833 +0,0 @@ -/* - * jcphuff.c - * - * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains Huffman entropy encoding routines for progressive JPEG. - * - * We do not support output suspension in this module, since the library - * currently does not allow multiple-scan files to be written with output - * suspension. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jchuff.h" /* Declarations shared with jchuff.c */ - -#ifdef C_PROGRESSIVE_SUPPORTED - -/* Expanded entropy encoder object for progressive Huffman encoding. */ - -typedef struct { - struct jpeg_entropy_encoder pub; /* public fields */ - - /* Mode flag: TRUE for optimization, FALSE for actual data output */ - wxjpeg_boolean gather_statistics; - - /* Bit-level coding status. - * next_output_byte/free_in_buffer are local copies of cinfo->dest fields. - */ - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - JPEG_INT32 put_buffer; /* current bit-accumulation buffer */ - int put_bits; /* # of bits now in it */ - j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ - - /* Coding status for DC components */ - int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ - - /* Coding status for AC components */ - int ac_tbl_no; /* the table number of the single component */ - unsigned int EOBRUN; /* run length of EOBs */ - unsigned int BE; /* # of buffered correction bits before MCU */ - char * bit_buffer; /* buffer for correction bits (1 per char) */ - /* packing correction bits tightly would save some space but cost time... */ - - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - int next_restart_num; /* next restart number to write (0-7) */ - - /* Pointers to derived tables (these workspaces have image lifespan). - * Since any one scan codes only DC or only AC, we only need one set - * of tables, not one for DC and one for AC. - */ - c_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; - - /* Statistics tables for optimization; again, one set is enough */ - long * count_ptrs[NUM_HUFF_TBLS]; -} phuff_entropy_encoder; - -typedef phuff_entropy_encoder * phuff_entropy_ptr; - -/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit - * buffer can hold. Larger sizes may slightly improve compression, but - * 1000 is already well into the realm of overkill. - * The minimum safe size is 64 bits. - */ - -#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ - -/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. - * We assume that int right shift is unsigned if INT32 right shift is, - * which should be safe. - */ - -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS int ishift_temp; -#define IRIGHT_SHIFT(x,shft) \ - ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ - (ishift_temp >> (shft))) -#else -#define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) -#endif - -/* Forward declarations */ -METHODDEF(wxjpeg_boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo)); -METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); - - -/* - * Initialize for a Huffman-compressed scan using progressive JPEG. - */ - -METHODDEF(void) -start_pass_phuff (j_compress_ptr cinfo, wxjpeg_boolean gather_statistics) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - wxjpeg_boolean is_DC_band; - int ci, tbl; - jpeg_component_info * compptr; - - entropy->cinfo = cinfo; - entropy->gather_statistics = gather_statistics; - - is_DC_band = (cinfo->Ss == 0); - - /* We assume jcmaster.c already validated the scan parameters. */ - - /* Select execution routines */ - if (cinfo->Ah == 0) { - if (is_DC_band) - entropy->pub.encode_mcu = encode_mcu_DC_first; - else - entropy->pub.encode_mcu = encode_mcu_AC_first; - } else { - if (is_DC_band) - entropy->pub.encode_mcu = encode_mcu_DC_refine; - else { - entropy->pub.encode_mcu = encode_mcu_AC_refine; - /* AC refinement needs a correction bit buffer */ - if (entropy->bit_buffer == NULL) - entropy->bit_buffer = (char *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - MAX_CORR_BITS * SIZEOF(char)); - } - } - if (gather_statistics) - entropy->pub.finish_pass = finish_pass_gather_phuff; - else - entropy->pub.finish_pass = finish_pass_phuff; - - /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1 - * for AC coefficients. - */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Initialize DC predictions to 0 */ - entropy->last_dc_val[ci] = 0; - /* Get table index */ - if (is_DC_band) { - if (cinfo->Ah != 0) /* DC refinement needs no table */ - continue; - tbl = compptr->dc_tbl_no; - } else { - entropy->ac_tbl_no = tbl = compptr->ac_tbl_no; - } - if (gather_statistics) { - /* Check for invalid table index */ - /* (make_c_derived_tbl does this in the other path) */ - if (tbl < 0 || tbl >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl); - /* Allocate and zero the statistics tables */ - /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ - if (entropy->count_ptrs[tbl] == NULL) - entropy->count_ptrs[tbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long)); - } else { - /* Compute derived values for Huffman table */ - /* We may do this more than once for a table, but it's not expensive */ - jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl, - & entropy->derived_tbls[tbl]); - } - } - - /* Initialize AC stuff */ - entropy->EOBRUN = 0; - entropy->BE = 0; - - /* Initialize bit buffer to empty */ - entropy->put_buffer = 0; - entropy->put_bits = 0; - - /* Initialize restart stuff */ - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num = 0; -} - - -/* Outputting bytes to the file. - * NB: these must be called only when actually outputting, - * that is, entropy->gather_statistics == FALSE. - */ - -/* Emit a byte */ -#define emit_byte(entropy,val) \ - { *(entropy)->next_output_byte++ = (JOCTET) (val); \ - if (--(entropy)->free_in_buffer == 0) \ - dump_buffer(entropy); } - - -LOCAL(void) -dump_buffer (phuff_entropy_ptr entropy) -/* Empty the output buffer; we do not support suspension in this module. */ -{ - struct jpeg_destination_mgr * dest = entropy->cinfo->dest; - - if (! (*dest->empty_output_buffer) (entropy->cinfo)) - ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND); - /* After a successful buffer dump, must reset buffer pointers */ - entropy->next_output_byte = dest->next_output_byte; - entropy->free_in_buffer = dest->free_in_buffer; -} - - -/* Outputting bits to the file */ - -/* Only the right 24 bits of put_buffer are used; the valid bits are - * left-justified in this part. At most 16 bits can be passed to emit_bits - * in one call, and we never retain more than 7 bits in put_buffer - * between calls, so 24 bits are sufficient. - */ - -INLINE -LOCAL(void) -emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) -/* Emit some bits, unless we are in gather mode */ -{ - /* This routine is heavily used, so it's worth coding tightly. */ - register JPEG_INT32 put_buffer = (JPEG_INT32) code; - register int put_bits = entropy->put_bits; - - /* if size is 0, caller used an invalid Huffman table entry */ - if (size == 0) - ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); - - if (entropy->gather_statistics) - return; /* do nothing if we're only getting stats */ - - put_buffer &= (((JPEG_INT32) 1)<put_buffer; /* and merge with old buffer contents */ - - while (put_bits >= 8) { - int c = (int) ((put_buffer >> 16) & 0xFF); - - emit_byte(entropy, c); - if (c == 0xFF) { /* need to stuff a zero byte? */ - emit_byte(entropy, 0); - } - put_buffer <<= 8; - put_bits -= 8; - } - - entropy->put_buffer = put_buffer; /* update variables */ - entropy->put_bits = put_bits; -} - - -LOCAL(void) -flush_bits (phuff_entropy_ptr entropy) -{ - emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ - entropy->put_buffer = 0; /* and reset bit-buffer to empty */ - entropy->put_bits = 0; -} - - -/* - * Emit (or just count) a Huffman symbol. - */ - -INLINE -LOCAL(void) -emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) -{ - if (entropy->gather_statistics) - entropy->count_ptrs[tbl_no][symbol]++; - else { - c_derived_tbl * tbl = entropy->derived_tbls[tbl_no]; - emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); - } -} - - -/* - * Emit bits from a correction bit buffer. - */ - -LOCAL(void) -emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, - unsigned int nbits) -{ - if (entropy->gather_statistics) - return; /* no real work */ - - while (nbits > 0) { - emit_bits(entropy, (unsigned int) (*bufstart), 1); - bufstart++; - nbits--; - } -} - - -/* - * Emit any pending EOBRUN symbol. - */ - -LOCAL(void) -emit_eobrun (phuff_entropy_ptr entropy) -{ - register int temp, nbits; - - if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ - temp = entropy->EOBRUN; - nbits = 0; - while ((temp >>= 1)) - nbits++; - /* safety check: shouldn't happen given limited correction-bit buffer */ - if (nbits > 14) - ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); - - emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4); - if (nbits) - emit_bits(entropy, entropy->EOBRUN, nbits); - - entropy->EOBRUN = 0; - - /* Emit any buffered correction bits */ - emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE); - entropy->BE = 0; - } -} - - -/* - * Emit a restart marker & resynchronize predictions. - */ - -LOCAL(void) -emit_restart (phuff_entropy_ptr entropy, int restart_num) -{ - int ci; - - emit_eobrun(entropy); - - if (! entropy->gather_statistics) { - flush_bits(entropy); - emit_byte(entropy, 0xFF); - emit_byte(entropy, JPEG_RST0 + restart_num); - } - - if (entropy->cinfo->Ss == 0) { - /* Re-initialize DC predictions to 0 */ - for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++) - entropy->last_dc_val[ci] = 0; - } else { - /* Re-initialize all AC-related fields to 0 */ - entropy->EOBRUN = 0; - entropy->BE = 0; - } -} - - -/* - * MCU encoding for DC initial scan (either spectral selection, - * or first pass of successive approximation). - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - register int temp, temp2; - register int nbits; - int blkn, ci; - int Al = cinfo->Al; - JBLOCKROW block; - jpeg_component_info * compptr; - ISHIFT_TEMPS - - entropy->next_output_byte = cinfo->dest->next_output_byte; - entropy->free_in_buffer = cinfo->dest->free_in_buffer; - - /* Emit restart marker if needed */ - if (cinfo->restart_interval) - if (entropy->restarts_to_go == 0) - emit_restart(entropy, entropy->next_restart_num); - - /* Encode the MCU data blocks */ - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - block = MCU_data[blkn]; - ci = cinfo->MCU_membership[blkn]; - compptr = cinfo->cur_comp_info[ci]; - - /* Compute the DC value after the required point transform by Al. - * This is simply an arithmetic right shift. - */ - temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); - - /* DC differences are figured on the point-transformed values. */ - temp = temp2 - entropy->last_dc_val[ci]; - entropy->last_dc_val[ci] = temp2; - - /* Encode the DC coefficient difference per section G.1.2.1 */ - temp2 = temp; - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* For a negative input, want temp2 = bitwise complement of abs(input) */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); - - /* Count/emit the Huffman-coded symbol for the number of bits */ - emit_symbol(entropy, compptr->dc_tbl_no, nbits); - - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ - emit_bits(entropy, (unsigned int) temp2, nbits); - } - - cinfo->dest->next_output_byte = entropy->next_output_byte; - cinfo->dest->free_in_buffer = entropy->free_in_buffer; - - /* Update restart-interval state too */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num++; - entropy->next_restart_num &= 7; - } - entropy->restarts_to_go--; - } - - return TRUE; -} - - -/* - * MCU encoding for AC initial scan (either spectral selection, - * or first pass of successive approximation). - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - register int temp, temp2; - register int nbits; - register int r, k; - int Se = cinfo->Se; - int Al = cinfo->Al; - JBLOCKROW block; - - entropy->next_output_byte = cinfo->dest->next_output_byte; - entropy->free_in_buffer = cinfo->dest->free_in_buffer; - - /* Emit restart marker if needed */ - if (cinfo->restart_interval) - if (entropy->restarts_to_go == 0) - emit_restart(entropy, entropy->next_restart_num); - - /* Encode the MCU data block */ - block = MCU_data[0]; - - /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ - - r = 0; /* r = run length of zeros */ - - for (k = cinfo->Ss; k <= Se; k++) { - if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { - r++; - continue; - } - /* We must apply the point transform by Al. For AC coefficients this - * is an integer division with rounding towards 0. To do this portably - * in C, we shift after obtaining the absolute value; so the code is - * interwoven with finding the abs value (temp) and output bits (temp2). - */ - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - temp >>= Al; /* apply the point transform */ - /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ - temp2 = ~temp; - } else { - temp >>= Al; /* apply the point transform */ - temp2 = temp; - } - /* Watch out for case that nonzero coef is zero after point transform */ - if (temp == 0) { - r++; - continue; - } - - /* Emit any pending EOBRUN */ - if (entropy->EOBRUN > 0) - emit_eobrun(entropy); - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); - r -= 16; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); - - /* Count/emit Huffman symbol for run length / number of bits */ - emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); - - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - emit_bits(entropy, (unsigned int) temp2, nbits); - - r = 0; /* reset zero run length */ - } - - if (r > 0) { /* If there are trailing zeroes, */ - entropy->EOBRUN++; /* count an EOB */ - if (entropy->EOBRUN == 0x7FFF) - emit_eobrun(entropy); /* force it out to avoid overflow */ - } - - cinfo->dest->next_output_byte = entropy->next_output_byte; - cinfo->dest->free_in_buffer = entropy->free_in_buffer; - - /* Update restart-interval state too */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num++; - entropy->next_restart_num &= 7; - } - entropy->restarts_to_go--; - } - - return TRUE; -} - - -/* - * MCU encoding for DC successive approximation refinement scan. - * Note: we assume such scans can be multi-component, although the spec - * is not very clear on the point. - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - register int temp; - int blkn; - int Al = cinfo->Al; - JBLOCKROW block; - - entropy->next_output_byte = cinfo->dest->next_output_byte; - entropy->free_in_buffer = cinfo->dest->free_in_buffer; - - /* Emit restart marker if needed */ - if (cinfo->restart_interval) - if (entropy->restarts_to_go == 0) - emit_restart(entropy, entropy->next_restart_num); - - /* Encode the MCU data blocks */ - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - block = MCU_data[blkn]; - - /* We simply emit the Al'th bit of the DC coefficient value. */ - temp = (*block)[0]; - emit_bits(entropy, (unsigned int) (temp >> Al), 1); - } - - cinfo->dest->next_output_byte = entropy->next_output_byte; - cinfo->dest->free_in_buffer = entropy->free_in_buffer; - - /* Update restart-interval state too */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num++; - entropy->next_restart_num &= 7; - } - entropy->restarts_to_go--; - } - - return TRUE; -} - - -/* - * MCU encoding for AC successive approximation refinement scan. - */ - -METHODDEF(wxjpeg_boolean) -encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - register int temp; - register int r, k; - int EOB; - char *BR_buffer; - unsigned int BR; - int Se = cinfo->Se; - int Al = cinfo->Al; - JBLOCKROW block; - int absvalues[DCTSIZE2]; - - entropy->next_output_byte = cinfo->dest->next_output_byte; - entropy->free_in_buffer = cinfo->dest->free_in_buffer; - - /* Emit restart marker if needed */ - if (cinfo->restart_interval) - if (entropy->restarts_to_go == 0) - emit_restart(entropy, entropy->next_restart_num); - - /* Encode the MCU data block */ - block = MCU_data[0]; - - /* It is convenient to make a pre-pass to determine the transformed - * coefficients' absolute values and the EOB position. - */ - EOB = 0; - for (k = cinfo->Ss; k <= Se; k++) { - temp = (*block)[jpeg_natural_order[k]]; - /* We must apply the point transform by Al. For AC coefficients this - * is an integer division with rounding towards 0. To do this portably - * in C, we shift after obtaining the absolute value. - */ - if (temp < 0) - temp = -temp; /* temp is abs value of input */ - temp >>= Al; /* apply the point transform */ - absvalues[k] = temp; /* save abs value for main pass */ - if (temp == 1) - EOB = k; /* EOB = index of last newly-nonzero coef */ - } - - /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ - - r = 0; /* r = run length of zeros */ - BR = 0; /* BR = count of buffered bits added now */ - BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ - - for (k = cinfo->Ss; k <= Se; k++) { - if ((temp = absvalues[k]) == 0) { - r++; - continue; - } - - /* Emit any required ZRLs, but not if they can be folded into EOB */ - while (r > 15 && k <= EOB) { - /* emit any pending EOBRUN and the BE correction bits */ - emit_eobrun(entropy); - /* Emit ZRL */ - emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); - r -= 16; - /* Emit buffered correction bits that must be associated with ZRL */ - emit_buffered_bits(entropy, BR_buffer, BR); - BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ - BR = 0; - } - - /* If the coef was previously nonzero, it only needs a correction bit. - * NOTE: a straight translation of the spec's figure G.7 would suggest - * that we also need to test r > 15. But if r > 15, we can only get here - * if k > EOB, which implies that this coefficient is not 1. - */ - if (temp > 1) { - /* The correction bit is the next bit of the absolute value. */ - BR_buffer[BR++] = (char) (temp & 1); - continue; - } - - /* Emit any pending EOBRUN and the BE correction bits */ - emit_eobrun(entropy); - - /* Count/emit Huffman symbol for run length / number of bits */ - emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); - - /* Emit output bit for newly-nonzero coef */ - temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1; - emit_bits(entropy, (unsigned int) temp, 1); - - /* Emit buffered correction bits that must be associated with this code */ - emit_buffered_bits(entropy, BR_buffer, BR); - BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ - BR = 0; - r = 0; /* reset zero run length */ - } - - if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ - entropy->EOBRUN++; /* count an EOB */ - entropy->BE += BR; /* concat my correction bits to older ones */ - /* We force out the EOB if we risk either: - * 1. overflow of the EOB counter; - * 2. overflow of the correction bit buffer during the next MCU. - */ - if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) - emit_eobrun(entropy); - } - - cinfo->dest->next_output_byte = entropy->next_output_byte; - cinfo->dest->free_in_buffer = entropy->free_in_buffer; - - /* Update restart-interval state too */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) { - entropy->restarts_to_go = cinfo->restart_interval; - entropy->next_restart_num++; - entropy->next_restart_num &= 7; - } - entropy->restarts_to_go--; - } - - return TRUE; -} - - -/* - * Finish up at the end of a Huffman-compressed progressive scan. - */ - -METHODDEF(void) -finish_pass_phuff (j_compress_ptr cinfo) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - - entropy->next_output_byte = cinfo->dest->next_output_byte; - entropy->free_in_buffer = cinfo->dest->free_in_buffer; - - /* Flush out any buffered data */ - emit_eobrun(entropy); - flush_bits(entropy); - - cinfo->dest->next_output_byte = entropy->next_output_byte; - cinfo->dest->free_in_buffer = entropy->free_in_buffer; -} - - -/* - * Finish up a statistics-gathering pass and create the new Huffman tables. - */ - -METHODDEF(void) -finish_pass_gather_phuff (j_compress_ptr cinfo) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - wxjpeg_boolean is_DC_band; - int ci, tbl; - jpeg_component_info * compptr; - JHUFF_TBL **htblptr; - wxjpeg_boolean did[NUM_HUFF_TBLS]; - - /* Flush out buffered data (all we care about is counting the EOB symbol) */ - emit_eobrun(entropy); - - is_DC_band = (cinfo->Ss == 0); - - /* It's important not to apply jpeg_gen_optimal_table more than once - * per table, because it clobbers the input frequency counts! - */ - MEMZERO(did, SIZEOF(did)); - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - if (is_DC_band) { - if (cinfo->Ah != 0) /* DC refinement needs no table */ - continue; - tbl = compptr->dc_tbl_no; - } else { - tbl = compptr->ac_tbl_no; - } - if (! did[tbl]) { - if (is_DC_band) - htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; - else - htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; - if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]); - did[tbl] = TRUE; - } - } -} - - -/* - * Module initialization routine for progressive Huffman entropy encoding. - */ - -GLOBAL(void) -jinit_phuff_encoder (j_compress_ptr cinfo) -{ - phuff_entropy_ptr entropy; - int i; - - entropy = (phuff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_encoder)); - cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; - entropy->pub.start_pass = start_pass_phuff; - - /* Mark tables unallocated */ - for (i = 0; i < NUM_HUFF_TBLS; i++) { - entropy->derived_tbls[i] = NULL; - entropy->count_ptrs[i] = NULL; - } - entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ -} - -#endif /* C_PROGRESSIVE_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jcprepct.c b/Source/3rdParty/wx/src/jpeg/jcprepct.c deleted file mode 100644 index d10624205..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcprepct.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * jcprepct.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the compression preprocessing controller. - * This controller manages the color conversion, downsampling, - * and edge expansion steps. - * - * Most of the complexity here is associated with buffering input rows - * as required by the downsampler. See the comments at the head of - * jcsample.c for the downsampler's needs. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* At present, jcsample.c can request context rows only for smoothing. - * In the future, we might also need context rows for CCIR601 sampling - * or other more-complex downsampling procedures. The code to support - * context rows should be compiled only if needed. - */ -#ifdef INPUT_SMOOTHING_SUPPORTED -#define CONTEXT_ROWS_SUPPORTED -#endif - - -/* - * For the simple (no-context-row) case, we just need to buffer one - * row group's worth of pixels for the downsampling step. At the bottom of - * the image, we pad to a full row group by replicating the last pixel row. - * The downsampler's last output row is then replicated if needed to pad - * out to a full iMCU row. - * - * When providing context rows, we must buffer three row groups' worth of - * pixels. Three row groups are physically allocated, but the row pointer - * arrays are made five row groups high, with the extra pointers above and - * below "wrapping around" to point to the last and first real row groups. - * This allows the downsampler to access the proper context rows. - * At the top and bottom of the image, we create dummy context rows by - * copying the first or last real pixel row. This copying could be avoided - * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the - * trouble on the compression side. - */ - - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_c_prep_controller pub; /* public fields */ - - /* Downsampling input buffer. This buffer holds color-converted data - * until we have enough to do a downsample step. - */ - JSAMPARRAY color_buf[MAX_COMPONENTS]; - - JDIMENSION rows_to_go; /* counts rows remaining in source image */ - int next_buf_row; /* index of next row to store in color_buf */ - -#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */ - int this_row_group; /* starting row index of group to process */ - int next_buf_stop; /* downsample when we reach this index */ -#endif -} my_prep_controller; - -typedef my_prep_controller * my_prep_ptr; - - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_prep_ptr prep = (my_prep_ptr) cinfo->prep; - - if (pass_mode != JBUF_PASS_THRU) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - - /* Initialize total-height counter for detecting bottom of image */ - prep->rows_to_go = cinfo->image_height; - /* Mark the conversion buffer empty */ - prep->next_buf_row = 0; -#ifdef CONTEXT_ROWS_SUPPORTED - /* Preset additional state variables for context mode. - * These aren't used in non-context mode, so we needn't test which mode. - */ - prep->this_row_group = 0; - /* Set next_buf_stop to stop after two row groups have been read in. */ - prep->next_buf_stop = 2 * cinfo->max_v_samp_factor; -#endif -} - - -/* - * Expand an image vertically from height input_rows to height output_rows, - * by duplicating the bottom row. - */ - -LOCAL(void) -expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, - int input_rows, int output_rows) -{ - register int row; - - for (row = input_rows; row < output_rows; row++) { - jcopy_sample_rows(image_data, input_rows-1, image_data, row, - 1, num_cols); - } -} - - -/* - * Process some data in the simple no-context case. - * - * Preprocessor output data is counted in "row groups". A row group - * is defined to be v_samp_factor sample rows of each component. - * Downsampling will produce this much data from each max_v_samp_factor - * input rows. - */ - -METHODDEF(void) -pre_process_data (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail) -{ - my_prep_ptr prep = (my_prep_ptr) cinfo->prep; - int numrows, ci; - JDIMENSION inrows; - jpeg_component_info * compptr; - - while (*in_row_ctr < in_rows_avail && - *out_row_group_ctr < out_row_groups_avail) { - /* Do color conversion to fill the conversion buffer. */ - inrows = in_rows_avail - *in_row_ctr; - numrows = cinfo->max_v_samp_factor - prep->next_buf_row; - numrows = (int) MIN((JDIMENSION) numrows, inrows); - (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, - prep->color_buf, - (JDIMENSION) prep->next_buf_row, - numrows); - *in_row_ctr += numrows; - prep->next_buf_row += numrows; - prep->rows_to_go -= numrows; - /* If at bottom of image, pad to fill the conversion buffer. */ - if (prep->rows_to_go == 0 && - prep->next_buf_row < cinfo->max_v_samp_factor) { - for (ci = 0; ci < cinfo->num_components; ci++) { - expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, - prep->next_buf_row, cinfo->max_v_samp_factor); - } - prep->next_buf_row = cinfo->max_v_samp_factor; - } - /* If we've filled the conversion buffer, empty it. */ - if (prep->next_buf_row == cinfo->max_v_samp_factor) { - (*cinfo->downsample->downsample) (cinfo, - prep->color_buf, (JDIMENSION) 0, - output_buf, *out_row_group_ctr); - prep->next_buf_row = 0; - (*out_row_group_ctr)++; - } - /* If at bottom of image, pad the output to a full iMCU height. - * Note we assume the caller is providing a one-iMCU-height output buffer! - */ - if (prep->rows_to_go == 0 && - *out_row_group_ctr < out_row_groups_avail) { - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - expand_bottom_edge(output_buf[ci], - compptr->width_in_blocks * DCTSIZE, - (int) (*out_row_group_ctr * compptr->v_samp_factor), - (int) (out_row_groups_avail * compptr->v_samp_factor)); - } - *out_row_group_ctr = out_row_groups_avail; - break; /* can exit outer loop without test */ - } - } -} - - -#ifdef CONTEXT_ROWS_SUPPORTED - -/* - * Process some data in the context case. - */ - -METHODDEF(void) -pre_process_context (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail) -{ - my_prep_ptr prep = (my_prep_ptr) cinfo->prep; - int numrows, ci; - int buf_height = cinfo->max_v_samp_factor * 3; - JDIMENSION inrows; - - while (*out_row_group_ctr < out_row_groups_avail) { - if (*in_row_ctr < in_rows_avail) { - /* Do color conversion to fill the conversion buffer. */ - inrows = in_rows_avail - *in_row_ctr; - numrows = prep->next_buf_stop - prep->next_buf_row; - numrows = (int) MIN((JDIMENSION) numrows, inrows); - (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, - prep->color_buf, - (JDIMENSION) prep->next_buf_row, - numrows); - /* Pad at top of image, if first time through */ - if (prep->rows_to_go == cinfo->image_height) { - for (ci = 0; ci < cinfo->num_components; ci++) { - int row; - for (row = 1; row <= cinfo->max_v_samp_factor; row++) { - jcopy_sample_rows(prep->color_buf[ci], 0, - prep->color_buf[ci], -row, - 1, cinfo->image_width); - } - } - } - *in_row_ctr += numrows; - prep->next_buf_row += numrows; - prep->rows_to_go -= numrows; - } else { - /* Return for more data, unless we are at the bottom of the image. */ - if (prep->rows_to_go != 0) - break; - /* When at bottom of image, pad to fill the conversion buffer. */ - if (prep->next_buf_row < prep->next_buf_stop) { - for (ci = 0; ci < cinfo->num_components; ci++) { - expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, - prep->next_buf_row, prep->next_buf_stop); - } - prep->next_buf_row = prep->next_buf_stop; - } - } - /* If we've gotten enough data, downsample a row group. */ - if (prep->next_buf_row == prep->next_buf_stop) { - (*cinfo->downsample->downsample) (cinfo, - prep->color_buf, - (JDIMENSION) prep->this_row_group, - output_buf, *out_row_group_ctr); - (*out_row_group_ctr)++; - /* Advance pointers with wraparound as necessary. */ - prep->this_row_group += cinfo->max_v_samp_factor; - if (prep->this_row_group >= buf_height) - prep->this_row_group = 0; - if (prep->next_buf_row >= buf_height) - prep->next_buf_row = 0; - prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor; - } - } -} - - -/* - * Create the wrapped-around downsampling input buffer needed for context mode. - */ - -LOCAL(void) -create_context_buffer (j_compress_ptr cinfo) -{ - my_prep_ptr prep = (my_prep_ptr) cinfo->prep; - int rgroup_height = cinfo->max_v_samp_factor; - int ci, i; - jpeg_component_info * compptr; - JSAMPARRAY true_buffer, fake_buffer; - - /* Grab enough space for fake row pointers for all the components; - * we need five row groups' worth of pointers for each component. - */ - fake_buffer = (JSAMPARRAY) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (cinfo->num_components * 5 * rgroup_height) * - SIZEOF(JSAMPROW)); - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Allocate the actual buffer space (3 row groups) for this component. - * We make the buffer wide enough to allow the downsampler to edge-expand - * horizontally within the buffer, if it so chooses. - */ - true_buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * - cinfo->max_h_samp_factor) / compptr->h_samp_factor), - (JDIMENSION) (3 * rgroup_height)); - /* Copy true buffer row pointers into the middle of the fake row array */ - MEMCOPY(fake_buffer + rgroup_height, true_buffer, - 3 * rgroup_height * SIZEOF(JSAMPROW)); - /* Fill in the above and below wraparound pointers */ - for (i = 0; i < rgroup_height; i++) { - fake_buffer[i] = true_buffer[2 * rgroup_height + i]; - fake_buffer[4 * rgroup_height + i] = true_buffer[i]; - } - prep->color_buf[ci] = fake_buffer + rgroup_height; - fake_buffer += 5 * rgroup_height; /* point to space for next component */ - } -} - -#endif /* CONTEXT_ROWS_SUPPORTED */ - - -/* - * Initialize preprocessing controller. - */ - -GLOBAL(void) -jinit_c_prep_controller (j_compress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_prep_ptr prep; - int ci; - jpeg_component_info * compptr; - - if (need_full_buffer) /* safety check */ - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - - prep = (my_prep_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_prep_controller)); - cinfo->prep = (struct jpeg_c_prep_controller *) prep; - prep->pub.start_pass = start_pass_prep; - - /* Allocate the color conversion buffer. - * We make the buffer wide enough to allow the downsampler to edge-expand - * horizontally within the buffer, if it so chooses. - */ - if (cinfo->downsample->need_context_rows) { - /* Set up to provide context rows */ -#ifdef CONTEXT_ROWS_SUPPORTED - prep->pub.pre_process_data = pre_process_context; - create_context_buffer(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - /* No context, just make it tall enough for one row group */ - prep->pub.pre_process_data = pre_process_data; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * - cinfo->max_h_samp_factor) / compptr->h_samp_factor), - (JDIMENSION) cinfo->max_v_samp_factor); - } - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jcsample.c b/Source/3rdParty/wx/src/jpeg/jcsample.c deleted file mode 100644 index 5cc2999c1..000000000 --- a/Source/3rdParty/wx/src/jpeg/jcsample.c +++ /dev/null @@ -1,519 +0,0 @@ -/* - * jcsample.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains downsampling routines. - * - * Downsampling input data is counted in "row groups". A row group - * is defined to be max_v_samp_factor pixel rows of each component, - * from which the downsampler produces v_samp_factor sample rows. - * A single row group is processed in each call to the downsampler module. - * - * The downsampler is responsible for edge-expansion of its output data - * to fill an integral number of DCT blocks horizontally. The source buffer - * may be modified if it is helpful for this purpose (the source buffer is - * allocated wide enough to correspond to the desired output width). - * The caller (the prep controller) is responsible for vertical padding. - * - * The downsampler may request "context rows" by setting need_context_rows - * during startup. In this case, the input arrays will contain at least - * one row group's worth of pixels above and below the passed-in data; - * the caller will create dummy rows at image top and bottom by replicating - * the first or last real pixel row. - * - * An excellent reference for image resampling is - * Digital Image Warping, George Wolberg, 1990. - * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. - * - * The downsampling algorithm used here is a simple average of the source - * pixels covered by the output pixel. The hi-falutin sampling literature - * refers to this as a "box filter". In general the characteristics of a box - * filter are not very good, but for the specific cases we normally use (1:1 - * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not - * nearly so bad. If you intend to use other sampling ratios, you'd be well - * advised to improve this code. - * - * A simple input-smoothing capability is provided. This is mainly intended - * for cleaning up color-dithered GIF input files (if you find it inadequate, - * we suggest using an external filtering program such as pnmconvol). When - * enabled, each input pixel P is replaced by a weighted sum of itself and its - * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF, - * where SF = (smoothing_factor / 1024). - * Currently, smoothing is only supported for 2h2v sampling factors. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Pointer to routine to downsample a single component */ -typedef JMETHOD(void, downsample1_ptr, - (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); - -/* Private subobject */ - -typedef struct { - struct jpeg_downsampler pub; /* public fields */ - - /* Downsampling method pointers, one per component */ - downsample1_ptr methods[MAX_COMPONENTS]; -} my_downsampler; - -typedef my_downsampler * my_downsample_ptr; - - -/* - * Initialize for a downsampling pass. - */ - -METHODDEF(void) -start_pass_downsample (j_compress_ptr cinfo) -{ - /* no work for now */ -} - - -/* - * Expand a component horizontally from width input_cols to width output_cols, - * by duplicating the rightmost samples. - */ - -LOCAL(void) -expand_right_edge (JSAMPARRAY image_data, int num_rows, - JDIMENSION input_cols, JDIMENSION output_cols) -{ - register JSAMPROW ptr; - register JSAMPLE pixval; - register int count; - int row; - int numcols = (int) (output_cols - input_cols); - - if (numcols > 0) { - for (row = 0; row < num_rows; row++) { - ptr = image_data[row] + input_cols; - pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ - for (count = numcols; count > 0; count--) - *ptr++ = pixval; - } - } -} - - -/* - * Do downsampling for a whole row group (all components). - * - * In this version we simply downsample each component independently. - */ - -METHODDEF(void) -sep_downsample (j_compress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_index, - JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) -{ - my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; - int ci; - jpeg_component_info * compptr; - JSAMPARRAY in_ptr, out_ptr; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - in_ptr = input_buf[ci] + in_row_index; - out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); - (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); - } -} - - -/* - * Downsample pixel values of a single component. - * One row group is processed per call. - * This version handles arbitrary integral sampling ratios, without smoothing. - * Note that this version is not actually used for customary sampling ratios. - */ - -METHODDEF(void) -int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; - JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ - JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; - JSAMPROW inptr, outptr; - JPEG_INT32 outvalue; - - h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; - v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; - numpix = h_expand * v_expand; - numpix2 = numpix/2; - - /* Expand input data enough to let all the output samples be generated - * by the standard loop. Special-casing padded output would be more - * efficient. - */ - expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * h_expand); - - inrow = 0; - for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { - outptr = output_data[outrow]; - for (outcol = 0, outcol_h = 0; outcol < output_cols; - outcol++, outcol_h += h_expand) { - outvalue = 0; - for (v = 0; v < v_expand; v++) { - inptr = input_data[inrow+v] + outcol_h; - for (h = 0; h < h_expand; h++) { - outvalue += (JPEG_INT32) GETJSAMPLE(*inptr++); - } - } - *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); - } - inrow += v_expand; - } -} - - -/* - * Downsample pixel values of a single component. - * This version handles the special case of a full-size component, - * without smoothing. - */ - -METHODDEF(void) -fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - /* Copy the data */ - jcopy_sample_rows(input_data, 0, output_data, 0, - cinfo->max_v_samp_factor, cinfo->image_width); - /* Edge-expand */ - expand_right_edge(output_data, cinfo->max_v_samp_factor, - cinfo->image_width, compptr->width_in_blocks * DCTSIZE); -} - - -/* - * Downsample pixel values of a single component. - * This version handles the common case of 2:1 horizontal and 1:1 vertical, - * without smoothing. - * - * A note about the "bias" calculations: when rounding fractional values to - * integer, we do not want to always round 0.5 up to the next integer. - * If we did that, we'd introduce a noticeable bias towards larger values. - * Instead, this code is arranged so that 0.5 will be rounded up or down at - * alternate pixel locations (a simple ordered dither pattern). - */ - -METHODDEF(void) -h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - int outrow; - JDIMENSION outcol; - JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; - register JSAMPROW inptr, outptr; - register int bias; - - /* Expand input data enough to let all the output samples be generated - * by the standard loop. Special-casing padded output would be more - * efficient. - */ - expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * 2); - - for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { - outptr = output_data[outrow]; - inptr = input_data[outrow]; - bias = 0; /* bias = 0,1,0,1,... for successive samples */ - for (outcol = 0; outcol < output_cols; outcol++) { - *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) - + bias) >> 1); - bias ^= 1; /* 0=>1, 1=>0 */ - inptr += 2; - } - } -} - - -/* - * Downsample pixel values of a single component. - * This version handles the standard case of 2:1 horizontal and 2:1 vertical, - * without smoothing. - */ - -METHODDEF(void) -h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - int inrow, outrow; - JDIMENSION outcol; - JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; - register JSAMPROW inptr0, inptr1, outptr; - register int bias; - - /* Expand input data enough to let all the output samples be generated - * by the standard loop. Special-casing padded output would be more - * efficient. - */ - expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * 2); - - inrow = 0; - for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { - outptr = output_data[outrow]; - inptr0 = input_data[inrow]; - inptr1 = input_data[inrow+1]; - bias = 1; /* bias = 1,2,1,2,... for successive samples */ - for (outcol = 0; outcol < output_cols; outcol++) { - *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) - + bias) >> 2); - bias ^= 3; /* 1=>2, 2=>1 */ - inptr0 += 2; inptr1 += 2; - } - inrow += 2; - } -} - - -#ifdef INPUT_SMOOTHING_SUPPORTED - -/* - * Downsample pixel values of a single component. - * This version handles the standard case of 2:1 horizontal and 2:1 vertical, - * with smoothing. One row of context is required. - */ - -METHODDEF(void) -h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - int inrow, outrow; - JDIMENSION colctr; - JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; - register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; - JPEG_INT32 membersum, neighsum, memberscale, neighscale; - - /* Expand input data enough to let all the output samples be generated - * by the standard loop. Special-casing padded output would be more - * efficient. - */ - expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, - cinfo->image_width, output_cols * 2); - - /* We don't bother to form the individual "smoothed" input pixel values; - * we can directly compute the output which is the average of the four - * smoothed values. Each of the four member pixels contributes a fraction - * (1-8*SF) to its own smoothed image and a fraction SF to each of the three - * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final - * output. The four corner-adjacent neighbor pixels contribute a fraction - * SF to just one smoothed pixel, or SF/4 to the final output; while the - * eight edge-adjacent neighbors contribute SF to each of two smoothed - * pixels, or SF/2 overall. In order to use integer arithmetic, these - * factors are scaled by 2^16 = 65536. - * Also recall that SF = smoothing_factor / 1024. - */ - - memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ - neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ - - inrow = 0; - for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { - outptr = output_data[outrow]; - inptr0 = input_data[inrow]; - inptr1 = input_data[inrow+1]; - above_ptr = input_data[inrow-1]; - below_ptr = input_data[inrow+2]; - - /* Special case for first column: pretend column -1 is same as column 0 */ - membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); - neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); - neighsum += neighsum; - neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); - membersum = membersum * memberscale + neighsum * neighscale; - *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); - inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; - - for (colctr = output_cols - 2; colctr > 0; colctr--) { - /* sum of pixels directly mapped to this output element */ - membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); - /* sum of edge-neighbor pixels */ - neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + - GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); - /* The edge-neighbors count twice as much as corner-neighbors */ - neighsum += neighsum; - /* Add in the corner-neighbors */ - neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + - GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); - /* form final output scaled up by 2^16 */ - membersum = membersum * memberscale + neighsum * neighscale; - /* round, descale and output it */ - *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); - inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; - } - - /* Special case for last column */ - membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); - neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); - neighsum += neighsum; - neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); - membersum = membersum * memberscale + neighsum * neighscale; - *outptr = (JSAMPLE) ((membersum + 32768) >> 16); - - inrow += 2; - } -} - - -/* - * Downsample pixel values of a single component. - * This version handles the special case of a full-size component, - * with smoothing. One row of context is required. - */ - -METHODDEF(void) -fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) -{ - int outrow; - JDIMENSION colctr; - JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; - register JSAMPROW inptr, above_ptr, below_ptr, outptr; - JPEG_INT32 membersum, neighsum, memberscale, neighscale; - int colsum, lastcolsum, nextcolsum; - - /* Expand input data enough to let all the output samples be generated - * by the standard loop. Special-casing padded output would be more - * efficient. - */ - expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, - cinfo->image_width, output_cols); - - /* Each of the eight neighbor pixels contributes a fraction SF to the - * smoothed pixel, while the main pixel contributes (1-8*SF). In order - * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. - * Also recall that SF = smoothing_factor / 1024. - */ - - memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ - neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ - - for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { - outptr = output_data[outrow]; - inptr = input_data[outrow]; - above_ptr = input_data[outrow-1]; - below_ptr = input_data[outrow+1]; - - /* Special case for first column */ - colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + - GETJSAMPLE(*inptr); - membersum = GETJSAMPLE(*inptr++); - nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + - GETJSAMPLE(*inptr); - neighsum = colsum + (colsum - membersum) + nextcolsum; - membersum = membersum * memberscale + neighsum * neighscale; - *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); - lastcolsum = colsum; colsum = nextcolsum; - - for (colctr = output_cols - 2; colctr > 0; colctr--) { - membersum = GETJSAMPLE(*inptr++); - above_ptr++; below_ptr++; - nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + - GETJSAMPLE(*inptr); - neighsum = lastcolsum + (colsum - membersum) + nextcolsum; - membersum = membersum * memberscale + neighsum * neighscale; - *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); - lastcolsum = colsum; colsum = nextcolsum; - } - - /* Special case for last column */ - membersum = GETJSAMPLE(*inptr); - neighsum = lastcolsum + (colsum - membersum) + colsum; - membersum = membersum * memberscale + neighsum * neighscale; - *outptr = (JSAMPLE) ((membersum + 32768) >> 16); - - } -} - -#endif /* INPUT_SMOOTHING_SUPPORTED */ - - -/* - * Module initialization routine for downsampling. - * Note that we must select a routine for each component. - */ - -GLOBAL(void) -jinit_downsampler (j_compress_ptr cinfo) -{ - my_downsample_ptr downsample; - int ci; - jpeg_component_info * compptr; - wxjpeg_boolean smoothok = TRUE; - - downsample = (my_downsample_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_downsampler)); - cinfo->downsample = (struct jpeg_downsampler *) downsample; - downsample->pub.start_pass = start_pass_downsample; - downsample->pub.downsample = sep_downsample; - downsample->pub.need_context_rows = FALSE; - - if (cinfo->CCIR601_sampling) - ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); - - /* Verify we can handle the sampling factors, and set up method pointers */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (compptr->h_samp_factor == cinfo->max_h_samp_factor && - compptr->v_samp_factor == cinfo->max_v_samp_factor) { -#ifdef INPUT_SMOOTHING_SUPPORTED - if (cinfo->smoothing_factor) { - downsample->methods[ci] = fullsize_smooth_downsample; - downsample->pub.need_context_rows = TRUE; - } else -#endif - downsample->methods[ci] = fullsize_downsample; - } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && - compptr->v_samp_factor == cinfo->max_v_samp_factor) { - smoothok = FALSE; - downsample->methods[ci] = h2v1_downsample; - } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && - compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { -#ifdef INPUT_SMOOTHING_SUPPORTED - if (cinfo->smoothing_factor) { - downsample->methods[ci] = h2v2_smooth_downsample; - downsample->pub.need_context_rows = TRUE; - } else -#endif - downsample->methods[ci] = h2v2_downsample; - } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && - (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { - smoothok = FALSE; - downsample->methods[ci] = int_downsample; - } else - ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); - } - -#ifdef INPUT_SMOOTHING_SUPPORTED - if (cinfo->smoothing_factor && !smoothok) - TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); -#endif -} diff --git a/Source/3rdParty/wx/src/jpeg/jctrans.c b/Source/3rdParty/wx/src/jpeg/jctrans.c deleted file mode 100644 index c5bb27f32..000000000 --- a/Source/3rdParty/wx/src/jpeg/jctrans.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * jctrans.c - * - * Copyright (C) 1995-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains library routines for transcoding compression, - * that is, writing raw DCT coefficient arrays to an output JPEG file. - * The routines in jcapimin.c will also be needed by a transcoder. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Forward declarations */ -LOCAL(void) transencode_master_selection - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); -LOCAL(void) transencode_coef_controller - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); - -#if defined(__VISAGECPP__) -/* Visual Age fixups for multiple declarations */ -# define start_pass_coef start_pass_coef2 /* already in jccoeft.c */ -# define compress_output compress_output2 /* already in jccoeft.c */ -#endif - - -/* - * Compression initialization for writing raw-coefficient data. - * Before calling this, all parameters and a data destination must be set up. - * Call jpeg_finish_compress() to actually write the data. - * - * The number of passed virtual arrays must match cinfo->num_components. - * Note that the virtual arrays need not be filled or even realized at - * the time write_coefficients is called; indeed, if the virtual arrays - * were requested from this compression object's memory manager, they - * typically will be realized during this routine and filled afterwards. - */ - -GLOBAL(void) -jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) -{ - if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - /* Mark all tables to be written */ - jpeg_suppress_tables(cinfo, FALSE); - /* (Re)initialize error mgr and destination modules */ - (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); - (*cinfo->dest->init_destination) (cinfo); - /* Perform master selection of active modules */ - transencode_master_selection(cinfo, coef_arrays); - /* Wait for jpeg_finish_compress() call */ - cinfo->next_scanline = 0; /* so jpeg_write_marker works */ - cinfo->global_state = CSTATE_WRCOEFS; -} - - -/* - * Initialize the compression object with default parameters, - * then copy from the source object all parameters needed for lossless - * transcoding. Parameters that can be varied without loss (such as - * scan script and Huffman optimization) are left in their default states. - */ - -GLOBAL(void) -jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo) -{ - JQUANT_TBL ** qtblptr; - jpeg_component_info *incomp, *outcomp; - JQUANT_TBL *c_quant, *slot_quant; - int tblno, ci, coefi; - - /* Safety check to ensure start_compress not called yet. */ - if (dstinfo->global_state != CSTATE_START) - ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state); - /* Copy fundamental image dimensions */ - dstinfo->image_width = srcinfo->image_width; - dstinfo->image_height = srcinfo->image_height; - dstinfo->input_components = srcinfo->num_components; - dstinfo->in_color_space = srcinfo->jpeg_color_space; - /* Initialize all parameters to default values */ - jpeg_set_defaults(dstinfo); - /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. - * Fix it to get the right header markers for the image colorspace. - */ - jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space); - dstinfo->data_precision = srcinfo->data_precision; - dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling; - /* Copy the source's quantization tables. */ - for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { - if (srcinfo->quant_tbl_ptrs[tblno] != NULL) { - qtblptr = & dstinfo->quant_tbl_ptrs[tblno]; - if (*qtblptr == NULL) - *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); - MEMCOPY((*qtblptr)->quantval, - srcinfo->quant_tbl_ptrs[tblno]->quantval, - SIZEOF((*qtblptr)->quantval)); - (*qtblptr)->sent_table = FALSE; - } - } - /* Copy the source's per-component info. - * Note we assume jpeg_set_defaults has allocated the dest comp_info array. - */ - dstinfo->num_components = srcinfo->num_components; - if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS) - ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components, - MAX_COMPONENTS); - for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info; - ci < dstinfo->num_components; ci++, incomp++, outcomp++) { - outcomp->component_id = incomp->component_id; - outcomp->h_samp_factor = incomp->h_samp_factor; - outcomp->v_samp_factor = incomp->v_samp_factor; - outcomp->quant_tbl_no = incomp->quant_tbl_no; - /* Make sure saved quantization table for component matches the qtable - * slot. If not, the input file re-used this qtable slot. - * IJG encoder currently cannot duplicate this. - */ - tblno = outcomp->quant_tbl_no; - if (tblno < 0 || tblno >= NUM_QUANT_TBLS || - srcinfo->quant_tbl_ptrs[tblno] == NULL) - ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno); - slot_quant = srcinfo->quant_tbl_ptrs[tblno]; - c_quant = incomp->quant_table; - if (c_quant != NULL) { - for (coefi = 0; coefi < DCTSIZE2; coefi++) { - if (c_quant->quantval[coefi] != slot_quant->quantval[coefi]) - ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno); - } - } - /* Note: we do not copy the source's Huffman table assignments; - * instead we rely on jpeg_set_colorspace to have made a suitable choice. - */ - } - /* Also copy JFIF version and resolution information, if available. - * Strictly speaking this isn't "critical" info, but it's nearly - * always appropriate to copy it if available. In particular, - * if the application chooses to copy JFIF 1.02 extension markers from - * the source file, we need to copy the version to make sure we don't - * emit a file that has 1.02 extensions but a claimed version of 1.01. - * We will *not*, however, copy version info from mislabeled "2.01" files. - */ - if (srcinfo->saw_JFIF_marker) { - if (srcinfo->JFIF_major_version == 1) { - dstinfo->JFIF_major_version = srcinfo->JFIF_major_version; - dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version; - } - dstinfo->density_unit = srcinfo->density_unit; - dstinfo->X_density = srcinfo->X_density; - dstinfo->Y_density = srcinfo->Y_density; - } -} - - -/* - * Master selection of compression modules for transcoding. - * This substitutes for jcinit.c's initialization of the full compressor. - */ - -LOCAL(void) -transencode_master_selection (j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays) -{ - /* Although we don't actually use input_components for transcoding, - * jcmaster.c's initial_setup will complain if input_components is 0. - */ - cinfo->input_components = 1; - /* Initialize master control (includes parameter checking/processing) */ - jinit_c_master_control(cinfo, TRUE /* transcode only */); - - /* Entropy encoding: either Huffman or arithmetic coding. */ - if (cinfo->arith_code) { - ERREXIT(cinfo, JERR_ARITH_NOTIMPL); - } else { - if (cinfo->progressive_mode) { -#ifdef C_PROGRESSIVE_SUPPORTED - jinit_phuff_encoder(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else - jinit_huff_encoder(cinfo); - } - - /* We need a special coefficient buffer controller. */ - transencode_coef_controller(cinfo, coef_arrays); - - jinit_marker_writer(cinfo); - - /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); - - /* Write the datastream header (SOI, JFIF) immediately. - * Frame and scan headers are postponed till later. - * This lets application insert special markers after the SOI. - */ - (*cinfo->marker->write_file_header) (cinfo); -} - - -/* - * The rest of this file is a special implementation of the coefficient - * buffer controller. This is similar to jccoefct.c, but it handles only - * output from presupplied virtual arrays. Furthermore, we generate any - * dummy padding blocks on-the-fly rather than expecting them to be present - * in the arrays. - */ - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_c_coef_controller pub; /* public fields */ - - JDIMENSION iMCU_row_num; /* iMCU row # within image */ - JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ - - /* Virtual block array for each component. */ - jvirt_barray_ptr * whole_image; - - /* Workspace for constructing dummy blocks at right/bottom edges. */ - JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU]; -} my_coef_controller; - -typedef my_coef_controller * my_coef_ptr; - - -LOCAL(void) -start_iMCU_row (j_compress_ptr cinfo) -/* Reset within-iMCU-row counters for a new row */ -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - /* In an interleaved scan, an MCU row is the same as an iMCU row. - * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. - * But at the bottom of the image, process only what's left. - */ - if (cinfo->comps_in_scan > 1) { - coef->MCU_rows_per_iMCU_row = 1; - } else { - if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; - else - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; - } - - coef->mcu_ctr = 0; - coef->MCU_vert_offset = 0; -} - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - if (pass_mode != JBUF_CRANK_DEST) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - - coef->iMCU_row_num = 0; - start_iMCU_row(cinfo); -} - - -/* - * Process some data. - * We process the equivalent of one fully interleaved MCU row ("iMCU" row) - * per call, ie, v_samp_factor block rows for each component in the scan. - * The data is obtained from the virtual arrays and fed to the entropy coder. - * Returns TRUE if the iMCU row is completed, FALSE if suspended. - * - * NB: input_buf is ignored; it is likely to be a NULL pointer. - */ - -METHODDEF(wxjpeg_boolean) -compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ - JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - int blkn, ci, xindex, yindex, yoffset, blockcnt; - JDIMENSION start_col; - JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; - JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; - JBLOCKROW buffer_ptr; - jpeg_component_info *compptr; - - /* Align the virtual buffers for the components used in this scan. */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - buffer[ci] = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], - coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } - - /* Loop to process one whole iMCU row */ - for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; - yoffset++) { - for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { - /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (coef->iMCU_row_num < last_iMCU_row || - yindex+yoffset < compptr->last_row_height) { - /* Fill in pointers to real blocks in this row */ - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < blockcnt; xindex++) - MCU_buffer[blkn++] = buffer_ptr++; - } else { - /* At bottom of image, need a whole row of dummy blocks */ - xindex = 0; - } - /* Fill in any dummy blocks needed in this row. - * Dummy blocks are filled in the same way as in jccoefct.c: - * all zeroes in the AC entries, DC entries equal to previous - * block's DC value. The init routine has already zeroed the - * AC entries, so we need only set the DC entries correctly. - */ - for (; xindex < compptr->MCU_width; xindex++) { - MCU_buffer[blkn] = coef->dummy_buffer[blkn]; - MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; - blkn++; - } - } - } - /* Try to write the MCU. */ - if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; - } - } - /* Completed an MCU row, but perhaps not an iMCU row */ - coef->mcu_ctr = 0; - } - /* Completed the iMCU row, advance counters for next one */ - coef->iMCU_row_num++; - start_iMCU_row(cinfo); - return TRUE; -} - - -/* - * Initialize coefficient buffer controller. - * - * Each passed coefficient array must be the right size for that - * coefficient: width_in_blocks wide and height_in_blocks high, - * with unitheight at least v_samp_factor. - */ - -LOCAL(void) -transencode_coef_controller (j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays) -{ - my_coef_ptr coef; - JBLOCKROW buffer; - int i; - - coef = (my_coef_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); - cinfo->coef = (struct jpeg_c_coef_controller *) coef; - coef->pub.start_pass = start_pass_coef; - coef->pub.compress_data = compress_output; - - /* Save pointer to virtual arrays */ - coef->whole_image = coef_arrays; - - /* Allocate and pre-zero space for dummy DCT blocks. */ - buffer = (JBLOCKROW) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { - coef->dummy_buffer[i] = buffer + i; - } -} - -#if defined(__VISAGECPP__) -# ifdef start_pass_coef2 -# undef start_pass_coef2 -# endif -# ifdef compress_output2 -# undef compress_output2 -# endif -#endif diff --git a/Source/3rdParty/wx/src/jpeg/jdapimin.c b/Source/3rdParty/wx/src/jpeg/jdapimin.c deleted file mode 100644 index 5c8474f01..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdapimin.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * jdapimin.c - * - * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains application interface code for the decompression half - * of the JPEG library. These are the "minimum" API routines that may be - * needed in either the normal full-decompression case or the - * transcoding-only case. - * - * Most of the routines intended to be called directly by an application - * are in this file or in jdapistd.c. But also see jcomapi.c for routines - * shared by compression and decompression, and jdtrans.c for the transcoding - * case. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * Initialization of a JPEG decompression object. - * The error manager must already be set up (in case memory manager fails). - */ - -GLOBAL(void) -jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) -{ - int i; - - /* Guard against version mismatches between library and caller. */ - cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ - if (version != JPEG_LIB_VERSION) - ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); - if (structsize != SIZEOF(struct jpeg_decompress_struct)) - ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, - (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); - - /* For debugging purposes, we zero the whole master structure. - * But the application has already set the err pointer, and may have set - * client_data, so we have to save and restore those fields. - * Note: if application hasn't set client_data, tools like Purify may - * complain here. - */ - { - struct jpeg_error_mgr * err = cinfo->err; - void * client_data = cinfo->client_data; /* ignore Purify complaint here */ - MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct)); - cinfo->err = err; - cinfo->client_data = client_data; - } - cinfo->is_decompressor = TRUE; - - /* Initialize a memory manager instance for this object */ - jinit_memory_mgr((j_common_ptr) cinfo); - - /* Zero out pointers to permanent structures. */ - cinfo->progress = NULL; - cinfo->src = NULL; - - for (i = 0; i < NUM_QUANT_TBLS; i++) - cinfo->quant_tbl_ptrs[i] = NULL; - - for (i = 0; i < NUM_HUFF_TBLS; i++) { - cinfo->dc_huff_tbl_ptrs[i] = NULL; - cinfo->ac_huff_tbl_ptrs[i] = NULL; - } - - /* Initialize marker processor so application can override methods - * for COM, APPn markers before calling jpeg_read_header. - */ - cinfo->marker_list = NULL; - jinit_marker_reader(cinfo); - - /* And initialize the overall input controller. */ - jinit_input_controller(cinfo); - - /* OK, I'm ready */ - cinfo->global_state = DSTATE_START; -} - - -/* - * Destruction of a JPEG decompression object - */ - -GLOBAL(void) -jpeg_destroy_decompress (j_decompress_ptr cinfo) -{ - jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ -} - - -/* - * Abort processing of a JPEG decompression operation, - * but don't destroy the object itself. - */ - -GLOBAL(void) -jpeg_abort_decompress (j_decompress_ptr cinfo) -{ - jpeg_abort((j_common_ptr) cinfo); /* use common routine */ -} - - -/* - * Set default decompression parameters. - */ - -LOCAL(void) -default_decompress_parms (j_decompress_ptr cinfo) -{ - /* Guess the input colorspace, and set output colorspace accordingly. */ - /* (Wish JPEG committee had provided a real way to specify this...) */ - /* Note application may override our guesses. */ - switch (cinfo->num_components) { - case 1: - cinfo->jpeg_color_space = JCS_GRAYSCALE; - cinfo->out_color_space = JCS_GRAYSCALE; - break; - - case 3: - if (cinfo->saw_JFIF_marker) { - cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ - } else if (cinfo->saw_Adobe_marker) { - switch (cinfo->Adobe_transform) { - case 0: - cinfo->jpeg_color_space = JCS_RGB; - break; - case 1: - cinfo->jpeg_color_space = JCS_YCbCr; - break; - default: - WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); - cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ - break; - } - } else { - /* Saw no special markers, try to guess from the component IDs */ - int cid0 = cinfo->comp_info[0].component_id; - int cid1 = cinfo->comp_info[1].component_id; - int cid2 = cinfo->comp_info[2].component_id; - - if (cid0 == 1 && cid1 == 2 && cid2 == 3) - cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ - else if (cid0 == 82 && cid1 == 71 && cid2 == 66) - cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ - else { - TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); - cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ - } - } - /* Always guess RGB is proper output colorspace. */ - cinfo->out_color_space = JCS_RGB; - break; - - case 4: - if (cinfo->saw_Adobe_marker) { - switch (cinfo->Adobe_transform) { - case 0: - cinfo->jpeg_color_space = JCS_CMYK; - break; - case 2: - cinfo->jpeg_color_space = JCS_YCCK; - break; - default: - WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); - cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ - break; - } - } else { - /* No special markers, assume straight CMYK. */ - cinfo->jpeg_color_space = JCS_CMYK; - } - cinfo->out_color_space = JCS_CMYK; - break; - - default: - cinfo->jpeg_color_space = JCS_UNKNOWN; - cinfo->out_color_space = JCS_UNKNOWN; - break; - } - - /* Set defaults for other decompression parameters. */ - cinfo->scale_num = 1; /* 1:1 scaling */ - cinfo->scale_denom = 1; - cinfo->output_gamma = 1.0; - cinfo->buffered_image = FALSE; - cinfo->raw_data_out = FALSE; - cinfo->dct_method = JDCT_DEFAULT; - cinfo->do_fancy_upsampling = TRUE; - cinfo->do_block_smoothing = TRUE; - cinfo->quantize_colors = FALSE; - /* We set these in case application only sets quantize_colors. */ - cinfo->dither_mode = JDITHER_FS; -#ifdef QUANT_2PASS_SUPPORTED - cinfo->two_pass_quantize = TRUE; -#else - cinfo->two_pass_quantize = FALSE; -#endif - cinfo->desired_number_of_colors = 256; - cinfo->colormap = NULL; - /* Initialize for no mode change in buffered-image mode. */ - cinfo->enable_1pass_quant = FALSE; - cinfo->enable_external_quant = FALSE; - cinfo->enable_2pass_quant = FALSE; -} - - -/* - * Decompression startup: read start of JPEG datastream to see what's there. - * Need only initialize JPEG object and supply a data source before calling. - * - * This routine will read as far as the first SOS marker (ie, actual start of - * compressed data), and will save all tables and parameters in the JPEG - * object. It will also initialize the decompression parameters to default - * values, and finally return JPEG_HEADER_OK. On return, the application may - * adjust the decompression parameters and then call jpeg_start_decompress. - * (Or, if the application only wanted to determine the image parameters, - * the data need not be decompressed. In that case, call jpeg_abort or - * jpeg_destroy to release any temporary space.) - * If an abbreviated (tables only) datastream is presented, the routine will - * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then - * re-use the JPEG object to read the abbreviated image datastream(s). - * It is unnecessary (but OK) to call jpeg_abort in this case. - * The JPEG_SUSPENDED return code only occurs if the data source module - * requests suspension of the decompressor. In this case the application - * should load more source data and then re-call jpeg_read_header to resume - * processing. - * If a non-suspending data source is used and require_image is TRUE, then the - * return code need not be inspected since only JPEG_HEADER_OK is possible. - * - * This routine is now just a front end to jpeg_consume_input, with some - * extra error checking. - */ - -GLOBAL(int) -jpeg_read_header (j_decompress_ptr cinfo, wxjpeg_boolean require_image) -{ - int retcode; - - if (cinfo->global_state != DSTATE_START && - cinfo->global_state != DSTATE_INHEADER) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - retcode = jpeg_consume_input(cinfo); - - switch (retcode) { - case JPEG_REACHED_SOS: - retcode = JPEG_HEADER_OK; - break; - case JPEG_REACHED_EOI: - if (require_image) /* Complain if application wanted an image */ - ERREXIT(cinfo, JERR_NO_IMAGE); - /* Reset to start state; it would be safer to require the application to - * call jpeg_abort, but we can't change it now for compatibility reasons. - * A side effect is to free any temporary memory (there shouldn't be any). - */ - jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */ - retcode = JPEG_HEADER_TABLES_ONLY; - break; - case JPEG_SUSPENDED: - /* no work */ - break; - } - - return retcode; -} - - -/* - * Consume data in advance of what the decompressor requires. - * This can be called at any time once the decompressor object has - * been created and a data source has been set up. - * - * This routine is essentially a state machine that handles a couple - * of critical state-transition actions, namely initial setup and - * transition from header scanning to ready-for-start_decompress. - * All the actual input is done via the input controller's consume_input - * method. - */ - -GLOBAL(int) -jpeg_consume_input (j_decompress_ptr cinfo) -{ - int retcode = JPEG_SUSPENDED; - - /* NB: every possible DSTATE value should be listed in this switch */ - switch (cinfo->global_state) { - case DSTATE_START: - /* Start-of-datastream actions: reset appropriate modules */ - (*cinfo->inputctl->reset_input_controller) (cinfo); - /* Initialize application's data source module */ - (*cinfo->src->init_source) (cinfo); - cinfo->global_state = DSTATE_INHEADER; - /*FALLTHROUGH*/ - case DSTATE_INHEADER: - retcode = (*cinfo->inputctl->consume_input) (cinfo); - if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ - /* Set up default parameters based on header data */ - default_decompress_parms(cinfo); - /* Set global state: ready for start_decompress */ - cinfo->global_state = DSTATE_READY; - } - break; - case DSTATE_READY: - /* Can't advance past first SOS until start_decompress is called */ - retcode = JPEG_REACHED_SOS; - break; - case DSTATE_PRELOAD: - case DSTATE_PRESCAN: - case DSTATE_SCANNING: - case DSTATE_RAW_OK: - case DSTATE_BUFIMAGE: - case DSTATE_BUFPOST: - case DSTATE_STOPPING: - retcode = (*cinfo->inputctl->consume_input) (cinfo); - break; - default: - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - } - return retcode; -} - - -/* - * Have we finished reading the input file? - */ - -GLOBAL(wxjpeg_boolean) -jpeg_input_complete (j_decompress_ptr cinfo) -{ - /* Check for valid jpeg object */ - if (cinfo->global_state < DSTATE_START || - cinfo->global_state > DSTATE_STOPPING) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - return cinfo->inputctl->eoi_reached; -} - - -/* - * Is there more than one scan? - */ - -GLOBAL(wxjpeg_boolean) -jpeg_has_multiple_scans (j_decompress_ptr cinfo) -{ - /* Only valid after jpeg_read_header completes */ - if (cinfo->global_state < DSTATE_READY || - cinfo->global_state > DSTATE_STOPPING) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - return cinfo->inputctl->has_multiple_scans; -} - - -/* - * Finish JPEG decompression. - * - * This will normally just verify the file trailer and release temp storage. - * - * Returns FALSE if suspended. The return value need be inspected only if - * a suspending data source is used. - */ - -GLOBAL(wxjpeg_boolean) -jpeg_finish_decompress (j_decompress_ptr cinfo) -{ - if ((cinfo->global_state == DSTATE_SCANNING || - cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) { - /* Terminate final pass of non-buffered mode */ - if (cinfo->output_scanline < cinfo->output_height) - ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); - (*cinfo->master->finish_output_pass) (cinfo); - cinfo->global_state = DSTATE_STOPPING; - } else if (cinfo->global_state == DSTATE_BUFIMAGE) { - /* Finishing after a buffered-image operation */ - cinfo->global_state = DSTATE_STOPPING; - } else if (cinfo->global_state != DSTATE_STOPPING) { - /* STOPPING = repeat call after a suspension, anything else is error */ - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - } - /* Read until EOI */ - while (! cinfo->inputctl->eoi_reached) { - if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) - return FALSE; /* Suspend, come back later */ - } - /* Do final cleanup */ - (*cinfo->src->term_source) (cinfo); - /* We can use jpeg_abort to release memory and reset global_state */ - jpeg_abort((j_common_ptr) cinfo); - return TRUE; -} diff --git a/Source/3rdParty/wx/src/jpeg/jdapistd.c b/Source/3rdParty/wx/src/jpeg/jdapistd.c deleted file mode 100644 index 9c995b4d8..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdapistd.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * jdapistd.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains application interface code for the decompression half - * of the JPEG library. These are the "standard" API routines that are - * used in the normal full-decompression case. They are not used by a - * transcoding-only application. Note that if an application links in - * jpeg_start_decompress, it will end up linking in the entire decompressor. - * We thus must separate this file from jdapimin.c to avoid linking the - * whole decompression library into a transcoder. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Forward declarations */ -LOCAL(wxjpeg_boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); - - -/* - * Decompression initialization. - * jpeg_read_header must be completed before calling this. - * - * If a multipass operating mode was selected, this will do all but the - * last pass, and thus may take a great deal of time. - * - * Returns FALSE if suspended. The return value need be inspected only if - * a suspending data source is used. - */ - -GLOBAL(wxjpeg_boolean) -jpeg_start_decompress (j_decompress_ptr cinfo) -{ - if (cinfo->global_state == DSTATE_READY) { - /* First call: initialize master control, select active modules */ - jinit_master_decompress(cinfo); - if (cinfo->buffered_image) { - /* No more work here; expecting jpeg_start_output next */ - cinfo->global_state = DSTATE_BUFIMAGE; - return TRUE; - } - cinfo->global_state = DSTATE_PRELOAD; - } - if (cinfo->global_state == DSTATE_PRELOAD) { - /* If file has multiple scans, absorb them all into the coef buffer */ - if (cinfo->inputctl->has_multiple_scans) { -#ifdef D_MULTISCAN_FILES_SUPPORTED - for (;;) { - int retcode; - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - /* Absorb some more input */ - retcode = (*cinfo->inputctl->consume_input) (cinfo); - if (retcode == JPEG_SUSPENDED) - return FALSE; - if (retcode == JPEG_REACHED_EOI) - break; - /* Advance progress counter if appropriate */ - if (cinfo->progress != NULL && - (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { - if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { - /* jdmaster underestimated number of scans; ratchet up one scan */ - cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; - } - } - } -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif /* D_MULTISCAN_FILES_SUPPORTED */ - } - cinfo->output_scan_number = cinfo->input_scan_number; - } else if (cinfo->global_state != DSTATE_PRESCAN) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - /* Perform any dummy output passes, and set up for the final pass */ - return output_pass_setup(cinfo); -} - - -/* - * Set up for an output pass, and perform any dummy pass(es) needed. - * Common subroutine for jpeg_start_decompress and jpeg_start_output. - * Entry: global_state = DSTATE_PRESCAN only if previously suspended. - * Exit: If done, returns TRUE and sets global_state for proper output mode. - * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. - */ - -LOCAL(wxjpeg_boolean) -output_pass_setup (j_decompress_ptr cinfo) -{ - if (cinfo->global_state != DSTATE_PRESCAN) { - /* First call: do pass setup */ - (*cinfo->master->prepare_for_output_pass) (cinfo); - cinfo->output_scanline = 0; - cinfo->global_state = DSTATE_PRESCAN; - } - /* Loop over any required dummy passes */ - while (cinfo->master->is_dummy_pass) { -#ifdef QUANT_2PASS_SUPPORTED - /* Crank through the dummy pass */ - while (cinfo->output_scanline < cinfo->output_height) { - JDIMENSION last_scanline; - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->output_scanline; - cinfo->progress->pass_limit = (long) cinfo->output_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - /* Process some data */ - last_scanline = cinfo->output_scanline; - (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, - &cinfo->output_scanline, (JDIMENSION) 0); - if (cinfo->output_scanline == last_scanline) - return FALSE; /* No progress made, must suspend */ - } - /* Finish up dummy pass, and set up for another one */ - (*cinfo->master->finish_output_pass) (cinfo); - (*cinfo->master->prepare_for_output_pass) (cinfo); - cinfo->output_scanline = 0; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif /* QUANT_2PASS_SUPPORTED */ - } - /* Ready for application to drive output pass through - * jpeg_read_scanlines or jpeg_read_raw_data. - */ - cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; - return TRUE; -} - - -/* - * Read some scanlines of data from the JPEG decompressor. - * - * The return value will be the number of lines actually read. - * This may be less than the number requested in several cases, - * including bottom of image, data source suspension, and operating - * modes that emit multiple scanlines at a time. - * - * Note: we warn about excess calls to jpeg_read_scanlines() since - * this likely signals an application programmer error. However, - * an oversize buffer (max_lines > scanlines remaining) is not an error. - */ - -GLOBAL(JDIMENSION) -jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, - JDIMENSION max_lines) -{ - JDIMENSION row_ctr; - - if (cinfo->global_state != DSTATE_SCANNING) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - if (cinfo->output_scanline >= cinfo->output_height) { - WARNMS(cinfo, JWRN_TOO_MUCH_DATA); - return 0; - } - - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->output_scanline; - cinfo->progress->pass_limit = (long) cinfo->output_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - - /* Process some data */ - row_ctr = 0; - (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); - cinfo->output_scanline += row_ctr; - return row_ctr; -} - - -/* - * Alternate entry point to read raw data. - * Processes exactly one iMCU row per call, unless suspended. - */ - -GLOBAL(JDIMENSION) -jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION max_lines) -{ - JDIMENSION lines_per_iMCU_row; - - if (cinfo->global_state != DSTATE_RAW_OK) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - if (cinfo->output_scanline >= cinfo->output_height) { - WARNMS(cinfo, JWRN_TOO_MUCH_DATA); - return 0; - } - - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->output_scanline; - cinfo->progress->pass_limit = (long) cinfo->output_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - } - - /* Verify that at least one iMCU row can be returned. */ - lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size; - if (max_lines < lines_per_iMCU_row) - ERREXIT(cinfo, JERR_BUFFER_SIZE); - - /* Decompress directly into user's buffer. */ - if (! (*cinfo->coef->decompress_data) (cinfo, data)) - return 0; /* suspension forced, can do nothing more */ - - /* OK, we processed one iMCU row. */ - cinfo->output_scanline += lines_per_iMCU_row; - return lines_per_iMCU_row; -} - - -/* Additional entry points for buffered-image mode. */ - -#ifdef D_MULTISCAN_FILES_SUPPORTED - -/* - * Initialize for an output pass in buffered-image mode. - */ - -GLOBAL(wxjpeg_boolean) -jpeg_start_output (j_decompress_ptr cinfo, int scan_number) -{ - if (cinfo->global_state != DSTATE_BUFIMAGE && - cinfo->global_state != DSTATE_PRESCAN) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - /* Limit scan number to valid range */ - if (scan_number <= 0) - scan_number = 1; - if (cinfo->inputctl->eoi_reached && - scan_number > cinfo->input_scan_number) - scan_number = cinfo->input_scan_number; - cinfo->output_scan_number = scan_number; - /* Perform any dummy output passes, and set up for the real pass */ - return output_pass_setup(cinfo); -} - - -/* - * Finish up after an output pass in buffered-image mode. - * - * Returns FALSE if suspended. The return value need be inspected only if - * a suspending data source is used. - */ - -GLOBAL(wxjpeg_boolean) -jpeg_finish_output (j_decompress_ptr cinfo) -{ - if ((cinfo->global_state == DSTATE_SCANNING || - cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { - /* Terminate this pass. */ - /* We do not require the whole pass to have been completed. */ - (*cinfo->master->finish_output_pass) (cinfo); - cinfo->global_state = DSTATE_BUFPOST; - } else if (cinfo->global_state != DSTATE_BUFPOST) { - /* BUFPOST = repeat call after a suspension, anything else is error */ - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - } - /* Read markers looking for SOS or EOI */ - while (cinfo->input_scan_number <= cinfo->output_scan_number && - ! cinfo->inputctl->eoi_reached) { - if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) - return FALSE; /* Suspend, come back later */ - } - cinfo->global_state = DSTATE_BUFIMAGE; - return TRUE; -} - -#endif /* D_MULTISCAN_FILES_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jdatadst.c b/Source/3rdParty/wx/src/jpeg/jdatadst.c deleted file mode 100644 index 053431fa6..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdatadst.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * jdatadst.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains compression data destination routines for the case of - * emitting JPEG data to a file (or any stdio stream). While these routines - * are sufficient for most applications, some will want to use a different - * destination manager. - * IMPORTANT: we assume that fwrite() will correctly transcribe an array of - * JOCTETs into 8-bit-wide elements on external storage. If char is wider - * than 8 bits on your machine, you may need to do some tweaking. - */ - -/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -#include "jinclude.h" -#include "jpeglib.h" -#include "jerror.h" - - -/* Expanded data destination object for stdio output */ - -typedef struct { - struct jpeg_destination_mgr pub; /* public fields */ - - FILE * outfile; /* target stream */ - JOCTET * buffer; /* start of buffer */ -} my_destination_mgr; - -typedef my_destination_mgr * my_dest_ptr; - -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ - - -/* - * Initialize destination --- called by jpeg_start_compress - * before any data is actually written. - */ - -METHODDEF(void) -init_destination (j_compress_ptr cinfo) -{ - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - - /* Allocate the output buffer --- it will be released when done with image */ - dest->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); - - dest->pub.next_output_byte = dest->buffer; - dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; -} - - -/* - * Empty the output buffer --- called whenever buffer fills up. - * - * In typical applications, this should write the entire output buffer - * (ignoring the current state of next_output_byte & free_in_buffer), - * reset the pointer & count to the start of the buffer, and return TRUE - * indicating that the buffer has been dumped. - * - * In applications that need to be able to suspend compression due to output - * overrun, a FALSE return indicates that the buffer cannot be emptied now. - * In this situation, the compressor will return to its caller (possibly with - * an indication that it has not accepted all the supplied scanlines). The - * application should resume compression after it has made more room in the - * output buffer. Note that there are substantial restrictions on the use of - * suspension --- see the documentation. - * - * When suspending, the compressor will back up to a convenient restart point - * (typically the start of the current MCU). next_output_byte & free_in_buffer - * indicate where the restart point will be if the current call returns FALSE. - * Data beyond this point will be regenerated after resumption, so do not - * write it out when emptying the buffer externally. - */ - -METHODDEF(wxjpeg_boolean) -empty_output_buffer (j_compress_ptr cinfo) -{ - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - - if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != - (size_t) OUTPUT_BUF_SIZE) - ERREXIT(cinfo, JERR_FILE_WRITE); - - dest->pub.next_output_byte = dest->buffer; - dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; - - return TRUE; -} - - -/* - * Terminate destination --- called by jpeg_finish_compress - * after all data has been written. Usually needs to flush buffer. - * - * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding - * application must deal with any cleanup that should happen even - * for error exit. - */ - -METHODDEF(void) -term_destination (j_compress_ptr cinfo) -{ - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; - - /* Write any data remaining in the buffer */ - if (datacount > 0) { - if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount) - ERREXIT(cinfo, JERR_FILE_WRITE); - } - fflush(dest->outfile); - /* Make sure we wrote the output file OK */ - if (ferror(dest->outfile)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * Prepare for output to a stdio stream. - * The caller must have already opened the stream, and is responsible - * for closing it after finishing compression. - */ - -GLOBAL(void) -jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) -{ - my_dest_ptr dest; - - /* The destination object is made permanent so that multiple JPEG images - * can be written to the same file without re-executing jpeg_stdio_dest. - * This makes it dangerous to use this manager and a different destination - * manager serially with the same JPEG object, because their private object - * sizes may be different. Caveat programmer. - */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ - cinfo->dest = (struct jpeg_destination_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_destination_mgr)); - } - - dest = (my_dest_ptr) cinfo->dest; - dest->pub.init_destination = init_destination; - dest->pub.empty_output_buffer = empty_output_buffer; - dest->pub.term_destination = term_destination; - dest->outfile = outfile; -} diff --git a/Source/3rdParty/wx/src/jpeg/jdatasrc.c b/Source/3rdParty/wx/src/jpeg/jdatasrc.c deleted file mode 100644 index 09a43300a..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdatasrc.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * jdatasrc.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains decompression data source routines for the case of - * reading JPEG data from a file (or any stdio stream). While these routines - * are sufficient for most applications, some will want to use a different - * source manager. - * IMPORTANT: we assume that fread() will correctly transcribe an array of - * JOCTETs from 8-bit-wide elements on external storage. If char is wider - * than 8 bits on your machine, you may need to do some tweaking. - */ - -/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -#include "jinclude.h" -#include "jpeglib.h" -#include "jerror.h" - - -/* Expanded data source object for stdio input */ - -typedef struct { - struct jpeg_source_mgr pub; /* public fields */ - - FILE * infile; /* source stream */ - JOCTET * buffer; /* start of buffer */ - wxjpeg_boolean start_of_file; /* have we gotten any data yet? */ -} my_source_mgr; - -typedef my_source_mgr * my_src_ptr; - -#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ - - -/* - * Initialize source --- called by jpeg_read_header - * before any data is actually read. - */ - -METHODDEF(void) -init_source (j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - /* We reset the empty-input-file flag for each image, - * but we don't clear the input buffer. - * This is correct behavior for reading a series of images from one source. - */ - src->start_of_file = TRUE; -} - - -/* - * Fill the input buffer --- called whenever buffer is emptied. - * - * In typical applications, this should read fresh data into the buffer - * (ignoring the current state of next_input_byte & bytes_in_buffer), - * reset the pointer & count to the start of the buffer, and return TRUE - * indicating that the buffer has been reloaded. It is not necessary to - * fill the buffer entirely, only to obtain at least one more byte. - * - * There is no such thing as an EOF return. If the end of the file has been - * reached, the routine has a choice of ERREXIT() or inserting fake data into - * the buffer. In most cases, generating a warning message and inserting a - * fake EOI marker is the best course of action --- this will allow the - * decompressor to output however much of the image is there. However, - * the resulting error message is misleading if the real problem is an empty - * input file, so we handle that case specially. - * - * In applications that need to be able to suspend compression due to input - * not being available yet, a FALSE return indicates that no more data can be - * obtained right now, but more may be forthcoming later. In this situation, - * the decompressor will return to its caller (with an indication of the - * number of scanlines it has read, if any). The application should resume - * decompression after it has loaded more data into the input buffer. Note - * that there are substantial restrictions on the use of suspension --- see - * the documentation. - * - * When suspending, the decompressor will back up to a convenient restart point - * (typically the start of the current MCU). next_input_byte & bytes_in_buffer - * indicate where the restart point will be if the current call returns FALSE. - * Data beyond this point must be rescanned after resumption, so move it to - * the front of the buffer rather than discarding it. - */ - -METHODDEF(wxjpeg_boolean) -fill_input_buffer (j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - size_t nbytes; - - nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); - - if (nbytes <= 0) { - if (src->start_of_file) /* Treat empty input file as fatal error */ - ERREXIT(cinfo, JERR_INPUT_EMPTY); - WARNMS(cinfo, JWRN_JPEG_EOF); - /* Insert a fake EOI marker */ - src->buffer[0] = (JOCTET) 0xFF; - src->buffer[1] = (JOCTET) JPEG_EOI; - nbytes = 2; - } - - src->pub.next_input_byte = src->buffer; - src->pub.bytes_in_buffer = nbytes; - src->start_of_file = FALSE; - - return TRUE; -} - - -/* - * Skip data --- used to skip over a potentially large amount of - * uninteresting data (such as an APPn marker). - * - * Writers of suspendable-input applications must note that skip_input_data - * is not granted the right to give a suspension return. If the skip extends - * beyond the data currently in the buffer, the buffer can be marked empty so - * that the next read will cause a fill_input_buffer call that can suspend. - * Arranging for additional bytes to be discarded before reloading the input - * buffer is the application writer's problem. - */ - -METHODDEF(void) -skip_input_data (j_decompress_ptr cinfo, long num_bytes) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - /* Just a dumb implementation for now. Could use fseek() except - * it doesn't work on pipes. Not clear that being smart is worth - * any trouble anyway --- large skips are infrequent. - */ - if (num_bytes > 0) { - while (num_bytes > (long) src->pub.bytes_in_buffer) { - num_bytes -= (long) src->pub.bytes_in_buffer; - (void) fill_input_buffer(cinfo); - /* note we assume that fill_input_buffer will never return FALSE, - * so suspension need not be handled. - */ - } - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; - } -} - - -/* - * An additional method that can be provided by data source modules is the - * resync_to_restart method for error recovery in the presence of RST markers. - * For the moment, this source module just uses the default resync method - * provided by the JPEG library. That method assumes that no backtracking - * is possible. - */ - - -/* - * Terminate source --- called by jpeg_finish_decompress - * after all data has been read. Often a no-op. - * - * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding - * application must deal with any cleanup that should happen even - * for error exit. - */ - -METHODDEF(void) -term_source (j_decompress_ptr cinfo) -{ - /* no work necessary here */ -} - - -/* - * Prepare for input from a stdio stream. - * The caller must have already opened the stream, and is responsible - * for closing it after finishing decompression. - */ - -GLOBAL(void) -jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) -{ - my_src_ptr src; - - /* The source object and input buffer are made permanent so that a series - * of JPEG images can be read from the same file by calling jpeg_stdio_src - * only before the first one. (If we discarded the buffer at the end of - * one image, we'd likely lose the start of the next one.) - * This makes it unsafe to use this manager and a different source - * manager serially with the same JPEG object. Caveat programmer. - */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_source_mgr)); - src = (my_src_ptr) cinfo->src; - src->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - INPUT_BUF_SIZE * SIZEOF(JOCTET)); - } - - src = (my_src_ptr) cinfo->src; - src->pub.init_source = init_source; - src->pub.fill_input_buffer = fill_input_buffer; - src->pub.skip_input_data = skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ - src->pub.term_source = term_source; - src->infile = infile; - src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ - src->pub.next_input_byte = NULL; /* until buffer loaded */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jdcoefct.c b/Source/3rdParty/wx/src/jpeg/jdcoefct.c deleted file mode 100644 index e5c3636e4..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdcoefct.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * jdcoefct.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the coefficient buffer controller for decompression. - * This controller is the top level of the JPEG decompressor proper. - * The coefficient buffer lies between entropy decoding and inverse-DCT steps. - * - * In buffered-image mode, this controller is the interface between - * input-oriented processing and output-oriented processing. - * Also, the input side (only) is used when reading a file for transcoding. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -/* Block smoothing is only applicable for progressive JPEG, so: */ -#ifndef D_PROGRESSIVE_SUPPORTED -#undef BLOCK_SMOOTHING_SUPPORTED -#endif - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_d_coef_controller pub; /* public fields */ - - /* These variables keep track of the current location of the input side. */ - /* cinfo->input_iMCU_row is also used for this. */ - JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ - - /* The output side's location is represented by cinfo->output_iMCU_row. */ - - /* In single-pass modes, it's sufficient to buffer just one MCU. - * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, - * and let the entropy decoder write into that workspace each time. - * (On 80x86, the workspace is FAR even though it's not really very big; - * this is to keep the module interfaces unchanged when a large coefficient - * buffer is necessary.) - * In multi-pass modes, this array points to the current MCU's blocks - * within the virtual arrays; it is used only by the input side. - */ - JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; - -#ifdef D_MULTISCAN_FILES_SUPPORTED - /* In multi-pass modes, we need a virtual block array for each component. */ - jvirt_barray_ptr whole_image[MAX_COMPONENTS]; -#endif - -#ifdef BLOCK_SMOOTHING_SUPPORTED - /* When doing block smoothing, we latch coefficient Al values here */ - int * coef_bits_latch; -#define SAVED_COEFS 6 /* we save coef_bits[0..5] */ -#endif -} my_coef_controller; - -typedef my_coef_controller * my_coef_ptr; - -/* Forward declarations */ -METHODDEF(int) decompress_onepass - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); -#ifdef D_MULTISCAN_FILES_SUPPORTED -METHODDEF(int) decompress_data - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); -#endif -#ifdef BLOCK_SMOOTHING_SUPPORTED -LOCAL(wxjpeg_boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); -METHODDEF(int) decompress_smooth_data - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); -#endif - - -LOCAL(void) -start_iMCU_row (j_decompress_ptr cinfo) -/* Reset within-iMCU-row counters for a new row (input side) */ -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - /* In an interleaved scan, an MCU row is the same as an iMCU row. - * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. - * But at the bottom of the image, process only what's left. - */ - if (cinfo->comps_in_scan > 1) { - coef->MCU_rows_per_iMCU_row = 1; - } else { - if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; - else - coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; - } - - coef->MCU_ctr = 0; - coef->MCU_vert_offset = 0; -} - - -/* - * Initialize for an input processing pass. - */ - -METHODDEF(void) -#if defined(__VISAGECPP__) -start_input_pass2 (j_decompress_ptr cinfo) -#else -start_input_pass (j_decompress_ptr cinfo) -#endif -{ - cinfo->input_iMCU_row = 0; - start_iMCU_row(cinfo); -} - -/* - * Initialize for an output processing pass. - */ - -METHODDEF(void) -start_output_pass (j_decompress_ptr cinfo) -{ -#ifdef BLOCK_SMOOTHING_SUPPORTED - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - - /* If multipass, check to see whether to use block smoothing on this pass */ - if (coef->pub.coef_arrays != NULL) { - if (cinfo->do_block_smoothing && smoothing_ok(cinfo)) - coef->pub.decompress_data = decompress_smooth_data; - else - coef->pub.decompress_data = decompress_data; - } -#endif - cinfo->output_iMCU_row = 0; -} - - -/* - * Decompress and return some data in the single-pass case. - * Always attempts to emit one fully interleaved MCU row ("iMCU" row). - * Input and output must run in lockstep since we have only a one-MCU buffer. - * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. - * - * NB: output_buf contains a plane for each component in image, - * which we index according to the component's SOF position. - */ - -METHODDEF(int) -decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ - JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - int blkn, ci, xindex, yindex, yoffset, useful_width; - JSAMPARRAY output_ptr; - JDIMENSION start_col, output_col; - jpeg_component_info *compptr; - inverse_DCT_method_ptr inverse_DCT; - - /* Loop to process as much as one whole iMCU row */ - for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; - yoffset++) { - for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; - MCU_col_num++) { - /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ - jzero_far((void FAR *) coef->MCU_buffer[0], - (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); - if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->MCU_ctr = MCU_col_num; - return JPEG_SUSPENDED; - } - /* Determine where data should go in output_buf and do the IDCT thing. - * We skip dummy blocks at the right and bottom edges (but blkn gets - * incremented past them!). Note the inner loop relies on having - * allocated the MCU_buffer[] blocks sequentially. - */ - blkn = 0; /* index of current DCT block within MCU */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Don't bother to IDCT an uninteresting component. */ - if (! compptr->component_needed) { - blkn += compptr->MCU_blocks; - continue; - } - inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; - useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - output_ptr = output_buf[compptr->component_index] + - yoffset * compptr->DCT_scaled_size; - start_col = MCU_col_num * compptr->MCU_sample_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (cinfo->input_iMCU_row < last_iMCU_row || - yoffset+yindex < compptr->last_row_height) { - output_col = start_col; - for (xindex = 0; xindex < useful_width; xindex++) { - (*inverse_DCT) (cinfo, compptr, - (JCOEFPTR) coef->MCU_buffer[blkn+xindex], - output_ptr, output_col); - output_col += compptr->DCT_scaled_size; - } - } - blkn += compptr->MCU_width; - output_ptr += compptr->DCT_scaled_size; - } - } - } - /* Completed an MCU row, but perhaps not an iMCU row */ - coef->MCU_ctr = 0; - } - /* Completed the iMCU row, advance counters for next one */ - cinfo->output_iMCU_row++; - if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { - start_iMCU_row(cinfo); - return JPEG_ROW_COMPLETED; - } - /* Completed the scan */ - (*cinfo->inputctl->finish_input_pass) (cinfo); - return JPEG_SCAN_COMPLETED; -} - - -/* - * Dummy consume-input routine for single-pass operation. - */ - -METHODDEF(int) -dummy_consume_data (j_decompress_ptr cinfo) -{ - return JPEG_SUSPENDED; /* Always indicate nothing was done */ -} - - -#ifdef D_MULTISCAN_FILES_SUPPORTED - -/* - * Consume input data and store it in the full-image coefficient buffer. - * We read as much as one fully interleaved MCU row ("iMCU" row) per call, - * ie, v_samp_factor block rows for each component in the scan. - * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. - */ - -METHODDEF(int) -consume_data (j_decompress_ptr cinfo) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ - int blkn, ci, xindex, yindex, yoffset; - JDIMENSION start_col; - JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; - JBLOCKROW buffer_ptr; - jpeg_component_info *compptr; - - /* Align the virtual buffers for the components used in this scan. */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - buffer[ci] = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], - cinfo->input_iMCU_row * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); - /* Note: entropy decoder expects buffer to be zeroed, - * but this is handled automatically by the memory manager - * because we requested a pre-zeroed array. - */ - } - - /* Loop to process one whole iMCU row */ - for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; - yoffset++) { - for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { - /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < compptr->MCU_width; xindex++) { - coef->MCU_buffer[blkn++] = buffer_ptr++; - } - } - } - /* Try to fetch the MCU. */ - if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->MCU_ctr = MCU_col_num; - return JPEG_SUSPENDED; - } - } - /* Completed an MCU row, but perhaps not an iMCU row */ - coef->MCU_ctr = 0; - } - /* Completed the iMCU row, advance counters for next one */ - if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { - start_iMCU_row(cinfo); - return JPEG_ROW_COMPLETED; - } - /* Completed the scan */ - (*cinfo->inputctl->finish_input_pass) (cinfo); - return JPEG_SCAN_COMPLETED; -} - - -/* - * Decompress and return some data in the multi-pass case. - * Always attempts to emit one fully interleaved MCU row ("iMCU" row). - * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. - * - * NB: output_buf contains a plane for each component in image. - */ - -METHODDEF(int) -decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - JDIMENSION block_num; - int ci, block_row, block_rows; - JBLOCKARRAY buffer; - JBLOCKROW buffer_ptr; - JSAMPARRAY output_ptr; - JDIMENSION output_col; - jpeg_component_info *compptr; - inverse_DCT_method_ptr inverse_DCT; - - /* Force some input to be done if we are getting ahead of the input. */ - while (cinfo->input_scan_number < cinfo->output_scan_number || - (cinfo->input_scan_number == cinfo->output_scan_number && - cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { - if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) - return JPEG_SUSPENDED; - } - - /* OK, output from the virtual arrays. */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Don't bother to IDCT an uninteresting component. */ - if (! compptr->component_needed) - continue; - /* Align the virtual buffer for this component. */ - buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - cinfo->output_iMCU_row * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); - /* Count non-dummy DCT block rows in this iMCU row. */ - if (cinfo->output_iMCU_row < last_iMCU_row) - block_rows = compptr->v_samp_factor; - else { - /* NB: can't use last_row_height here; it is input-side-dependent! */ - block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); - if (block_rows == 0) block_rows = compptr->v_samp_factor; - } - inverse_DCT = cinfo->idct->inverse_DCT[ci]; - output_ptr = output_buf[ci]; - /* Loop over all DCT blocks to be processed. */ - for (block_row = 0; block_row < block_rows; block_row++) { - buffer_ptr = buffer[block_row]; - output_col = 0; - for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { - (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, - output_ptr, output_col); - buffer_ptr++; - output_col += compptr->DCT_scaled_size; - } - output_ptr += compptr->DCT_scaled_size; - } - } - - if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) - return JPEG_ROW_COMPLETED; - return JPEG_SCAN_COMPLETED; -} - -#endif /* D_MULTISCAN_FILES_SUPPORTED */ - - -#ifdef BLOCK_SMOOTHING_SUPPORTED - -/* - * This code applies interblock smoothing as described by section K.8 - * of the JPEG standard: the first 5 AC coefficients are estimated from - * the DC values of a DCT block and its 8 neighboring blocks. - * We apply smoothing only for progressive JPEG decoding, and only if - * the coefficients it can estimate are not yet known to full precision. - */ - -/* Natural-order array positions of the first 5 zigzag-order coefficients */ -#define Q01_POS 1 -#define Q10_POS 8 -#define Q20_POS 16 -#define Q11_POS 9 -#define Q02_POS 2 - -/* - * Determine whether block smoothing is applicable and safe. - * We also latch the current states of the coef_bits[] entries for the - * AC coefficients; otherwise, if the input side of the decompressor - * advances into a new scan, we might think the coefficients are known - * more accurately than they really are. - */ - -LOCAL(wxjpeg_boolean) -smoothing_ok (j_decompress_ptr cinfo) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - wxjpeg_boolean smoothing_useful = FALSE; - int ci, coefi; - jpeg_component_info *compptr; - JQUANT_TBL * qtable; - int * coef_bits; - int * coef_bits_latch; - - if (! cinfo->progressive_mode || cinfo->coef_bits == NULL) - return FALSE; - - /* Allocate latch area if not already done */ - if (coef->coef_bits_latch == NULL) - coef->coef_bits_latch = (int *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * - (SAVED_COEFS * SIZEOF(int))); - coef_bits_latch = coef->coef_bits_latch; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* All components' quantization values must already be latched. */ - if ((qtable = compptr->quant_table) == NULL) - return FALSE; - /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ - if (qtable->quantval[0] == 0 || - qtable->quantval[Q01_POS] == 0 || - qtable->quantval[Q10_POS] == 0 || - qtable->quantval[Q20_POS] == 0 || - qtable->quantval[Q11_POS] == 0 || - qtable->quantval[Q02_POS] == 0) - return FALSE; - /* DC values must be at least partly known for all components. */ - coef_bits = cinfo->coef_bits[ci]; - if (coef_bits[0] < 0) - return FALSE; - /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ - for (coefi = 1; coefi <= 5; coefi++) { - coef_bits_latch[coefi] = coef_bits[coefi]; - if (coef_bits[coefi] != 0) - smoothing_useful = TRUE; - } - coef_bits_latch += SAVED_COEFS; - } - - return smoothing_useful; -} - - -/* - * Variant of decompress_data for use when doing block smoothing. - */ - -METHODDEF(int) -decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) -{ - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; - JDIMENSION block_num, last_block_column; - int ci, block_row, block_rows, access_rows; - JBLOCKARRAY buffer; - JBLOCKROW buffer_ptr, prev_block_row, next_block_row; - JSAMPARRAY output_ptr; - JDIMENSION output_col; - jpeg_component_info *compptr; - inverse_DCT_method_ptr inverse_DCT; - wxjpeg_boolean first_row, last_row; - JBLOCK workspace; - int *coef_bits; - JQUANT_TBL *quanttbl; - JPEG_INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; - int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; - int Al, pred; - - /* Force some input to be done if we are getting ahead of the input. */ - while (cinfo->input_scan_number <= cinfo->output_scan_number && - ! cinfo->inputctl->eoi_reached) { - if (cinfo->input_scan_number == cinfo->output_scan_number) { - /* If input is working on current scan, we ordinarily want it to - * have completed the current row. But if input scan is DC, - * we want it to keep one row ahead so that next block row's DC - * values are up to date. - */ - JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; - if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) - break; - } - if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) - return JPEG_SUSPENDED; - } - - /* OK, output from the virtual arrays. */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Don't bother to IDCT an uninteresting component. */ - if (! compptr->component_needed) - continue; - /* Count non-dummy DCT block rows in this iMCU row. */ - if (cinfo->output_iMCU_row < last_iMCU_row) { - block_rows = compptr->v_samp_factor; - access_rows = block_rows * 2; /* this and next iMCU row */ - last_row = FALSE; - } else { - /* NB: can't use last_row_height here; it is input-side-dependent! */ - block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); - if (block_rows == 0) block_rows = compptr->v_samp_factor; - access_rows = block_rows; /* this iMCU row only */ - last_row = TRUE; - } - /* Align the virtual buffer for this component. */ - if (cinfo->output_iMCU_row > 0) { - access_rows += compptr->v_samp_factor; /* prior iMCU row too */ - buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, - (JDIMENSION) access_rows, FALSE); - buffer += compptr->v_samp_factor; /* point to current iMCU row */ - first_row = FALSE; - } else { - buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); - first_row = TRUE; - } - /* Fetch component-dependent info */ - coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); - quanttbl = compptr->quant_table; - Q00 = quanttbl->quantval[0]; - Q01 = quanttbl->quantval[Q01_POS]; - Q10 = quanttbl->quantval[Q10_POS]; - Q20 = quanttbl->quantval[Q20_POS]; - Q11 = quanttbl->quantval[Q11_POS]; - Q02 = quanttbl->quantval[Q02_POS]; - inverse_DCT = cinfo->idct->inverse_DCT[ci]; - output_ptr = output_buf[ci]; - /* Loop over all DCT blocks to be processed. */ - for (block_row = 0; block_row < block_rows; block_row++) { - buffer_ptr = buffer[block_row]; - if (first_row && block_row == 0) - prev_block_row = buffer_ptr; - else - prev_block_row = buffer[block_row-1]; - if (last_row && block_row == block_rows-1) - next_block_row = buffer_ptr; - else - next_block_row = buffer[block_row+1]; - /* We fetch the surrounding DC values using a sliding-register approach. - * Initialize all nine here so as to do the right thing on narrow pics. - */ - DC1 = DC2 = DC3 = (int) prev_block_row[0][0]; - DC4 = DC5 = DC6 = (int) buffer_ptr[0][0]; - DC7 = DC8 = DC9 = (int) next_block_row[0][0]; - output_col = 0; - last_block_column = compptr->width_in_blocks - 1; - for (block_num = 0; block_num <= last_block_column; block_num++) { - /* Fetch current DCT block into workspace so we can modify it. */ - jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); - /* Update DC values */ - if (block_num < last_block_column) { - DC3 = (int) prev_block_row[1][0]; - DC6 = (int) buffer_ptr[1][0]; - DC9 = (int) next_block_row[1][0]; - } - /* Compute coefficient estimates per K.8. - * An estimate is applied only if coefficient is still zero, - * and is not known to be fully accurate. - */ - /* AC01 */ - if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { - num = 36 * Q00 * (DC4 - DC6); - if (num >= 0) { - pred = (int) (((Q01<<7) + num) / (Q01<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q10<<7) + num) / (Q10<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q20<<7) + num) / (Q20<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q11<<7) + num) / (Q11<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q02<<7) + num) / (Q02<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<DCT_scaled_size; - } - output_ptr += compptr->DCT_scaled_size; - } - } - - if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) - return JPEG_ROW_COMPLETED; - return JPEG_SCAN_COMPLETED; -} - -#endif /* BLOCK_SMOOTHING_SUPPORTED */ - - -/* - * Initialize coefficient buffer controller. - */ - -GLOBAL(void) -jinit_d_coef_controller (j_decompress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_coef_ptr coef; - - coef = (my_coef_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); - cinfo->coef = (struct jpeg_d_coef_controller *) coef; -#if defined(__VISAGECPP__) - coef->pub.start_input_pass2 = start_input_pass2; -#else - coef->pub.start_input_pass = start_input_pass; -#endif - - coef->pub.start_output_pass = start_output_pass; -#ifdef BLOCK_SMOOTHING_SUPPORTED - coef->coef_bits_latch = NULL; -#endif - - /* Create the coefficient buffer. */ - if (need_full_buffer) { -#ifdef D_MULTISCAN_FILES_SUPPORTED - /* Allocate a full-image virtual array for each component, */ - /* padded to a multiple of samp_factor DCT blocks in each direction. */ - /* Note we ask for a pre-zeroed array. */ - int ci, access_rows; - jpeg_component_info *compptr; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - access_rows = compptr->v_samp_factor; -#ifdef BLOCK_SMOOTHING_SUPPORTED - /* If block smoothing could be used, need a bigger window */ - if (cinfo->progressive_mode) - access_rows *= 3; -#endif - coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) access_rows); - } - coef->pub.consume_data = consume_data; - coef->pub.decompress_data = decompress_data; - coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */ -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - /* We only need a single-MCU buffer. */ - JBLOCKROW buffer; - int i; - - buffer = (JBLOCKROW) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { - coef->MCU_buffer[i] = buffer + i; - } - coef->pub.consume_data = dummy_consume_data; - coef->pub.decompress_data = decompress_onepass; - coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ - } -} - diff --git a/Source/3rdParty/wx/src/jpeg/jdcolor.c b/Source/3rdParty/wx/src/jpeg/jdcolor.c deleted file mode 100644 index cca284229..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdcolor.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * jdcolor.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains output colorspace conversion routines. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -#if defined(__VISAGECPP__) -/* Visual Age fixups for multiple declarations */ -# define null_convert null_convert2 /* already in jcmaint.c */ -# define grayscale_convert grayscale_convert2 /* already in jcmaint.c */ -#endif - -/* Private subobject */ - -typedef struct { - struct jpeg_color_deconverter pub; /* public fields */ - - /* Private state for YCC->RGB conversion */ - int * Cr_r_tab; /* => table for Cr to R conversion */ - int * Cb_b_tab; /* => table for Cb to B conversion */ - JPEG_INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - JPEG_INT32 * Cb_g_tab; /* => table for Cb to G conversion */ -} my_color_deconverter; - -typedef my_color_deconverter * my_cconvert_ptr; - - -/**************** YCbCr -> RGB conversion: most common case **************/ - -/* - * YCbCr is defined per CCIR 601-1, except that Cb and Cr are - * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. - * The conversion equations to be implemented are therefore - * R = Y + 1.40200 * Cr - * G = Y - 0.34414 * Cb - 0.71414 * Cr - * B = Y + 1.77200 * Cb - * where Cb and Cr represent the incoming values less CENTERJSAMPLE. - * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) - * - * To avoid floating-point arithmetic, we represent the fractional constants - * as integers scaled up by 2^16 (about 4 digits precision); we have to divide - * the products by 2^16, with appropriate rounding, to get the correct answer. - * Notice that Y, being an integral input, does not contribute any fraction - * so it need not participate in the rounding. - * - * For even more speed, we avoid doing any multiplications in the inner loop - * by precalculating the constants times Cb and Cr for all possible values. - * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); - * for 12-bit samples it is still acceptable. It's not very reasonable for - * 16-bit samples, but if you want lossless storage you shouldn't be changing - * colorspace anyway. - * The Cr=>R and Cb=>B values can be rounded to integers in advance; the - * values for the G calculation are left scaled up, since we must add them - * together before rounding. - */ - -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((JPEG_INT32) ((x) * (1L<RGB colorspace conversion. - */ - -LOCAL(void) -build_ycc_rgb_table (j_decompress_ptr cinfo) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - int i; - JPEG_INT32 x; - SHIFT_TEMPS - - cconvert->Cr_r_tab = (int *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); - cconvert->Cb_b_tab = (int *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); - cconvert->Cr_g_tab = (JPEG_INT32 *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); - cconvert->Cb_g_tab = (JPEG_INT32 *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); - - for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { - /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ - /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ - /* Cr=>R value is nearest int to 1.40200 * x */ - cconvert->Cr_r_tab[i] = (int) - RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); - /* Cb=>B value is nearest int to 1.77200 * x */ - cconvert->Cb_b_tab[i] = (int) - RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); - /* Cr=>G value is scaled-up -0.71414 * x */ - cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x; - /* Cb=>G value is scaled-up -0.34414 * x */ - /* We also add in ONE_HALF so that need not do it in inner loop */ - cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; - } -} - - -/* - * Convert some rows of samples to the output colorspace. - * - * Note that we change from noninterleaved, one-plane-per-component format - * to interleaved-pixel format. The output buffer is therefore three times - * as wide as the input buffer. - * A starting row offset is provided only for the input buffer. The caller - * can easily adjust the passed output_buf value to accommodate any row - * offset required on that side. - */ - -METHODDEF(void) -ycc_rgb_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int y, cb, cr; - register JSAMPROW outptr; - register JSAMPROW inptr0, inptr1, inptr2; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->output_width; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - register int * Crrtab = cconvert->Cr_r_tab; - register int * Cbbtab = cconvert->Cb_b_tab; - register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab; - register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab; - SHIFT_TEMPS - - while (--num_rows >= 0) { - inptr0 = input_buf[0][input_row]; - inptr1 = input_buf[1][input_row]; - inptr2 = input_buf[2][input_row]; - input_row++; - outptr = *output_buf++; - for (col = 0; col < num_cols; col++) { - y = GETJSAMPLE(inptr0[col]); - cb = GETJSAMPLE(inptr1[col]); - cr = GETJSAMPLE(inptr2[col]); - /* Range-limiting is essential due to noise introduced by DCT losses. */ - outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; - outptr[RGB_GREEN] = range_limit[y + - ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], - SCALEBITS))]; - outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; - outptr += RGB_PIXELSIZE; - } - } -} - - -/**************** Cases other than YCbCr -> RGB **************/ - - -/* - * Color conversion for no colorspace change: just copy the data, - * converting from separate-planes to interleaved representation. - */ - -METHODDEF(void) -null_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) -{ - register JSAMPROW inptr, outptr; - register JDIMENSION count; - register int num_components = cinfo->num_components; - JDIMENSION num_cols = cinfo->output_width; - int ci; - - while (--num_rows >= 0) { - for (ci = 0; ci < num_components; ci++) { - inptr = input_buf[ci][input_row]; - outptr = output_buf[0] + ci; - for (count = num_cols; count > 0; count--) { - *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ - outptr += num_components; - } - } - input_row++; - output_buf++; - } -} - - -/* - * Color conversion for grayscale: just copy the data. - * This also works for YCbCr -> grayscale conversion, in which - * we just copy the Y (luminance) component and ignore chrominance. - */ - -METHODDEF(void) -grayscale_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) -{ - jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, - num_rows, cinfo->output_width); -} - - -/* - * Convert grayscale to RGB: just duplicate the graylevel three times. - * This is provided to support applications that don't want to cope - * with grayscale as a separate case. - */ - -METHODDEF(void) -gray_rgb_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) -{ - register JSAMPROW inptr, outptr; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->output_width; - - while (--num_rows >= 0) { - inptr = input_buf[0][input_row++]; - outptr = *output_buf++; - for (col = 0; col < num_cols; col++) { - /* We can dispense with GETJSAMPLE() here */ - outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; - outptr += RGB_PIXELSIZE; - } - } -} - - -/* - * Adobe-style YCCK->CMYK conversion. - * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same - * conversion as above, while passing K (black) unchanged. - * We assume build_ycc_rgb_table has been called. - */ - -METHODDEF(void) -ycck_cmyk_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) -{ - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int y, cb, cr; - register JSAMPROW outptr; - register JSAMPROW inptr0, inptr1, inptr2, inptr3; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->output_width; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - register int * Crrtab = cconvert->Cr_r_tab; - register int * Cbbtab = cconvert->Cb_b_tab; - register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab; - register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab; - SHIFT_TEMPS - - while (--num_rows >= 0) { - inptr0 = input_buf[0][input_row]; - inptr1 = input_buf[1][input_row]; - inptr2 = input_buf[2][input_row]; - inptr3 = input_buf[3][input_row]; - input_row++; - outptr = *output_buf++; - for (col = 0; col < num_cols; col++) { - y = GETJSAMPLE(inptr0[col]); - cb = GETJSAMPLE(inptr1[col]); - cr = GETJSAMPLE(inptr2[col]); - /* Range-limiting is essential due to noise introduced by DCT losses. */ - outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ - outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ - ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], - SCALEBITS)))]; - outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */ - /* K passes through unchanged */ - outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */ - outptr += 4; - } - } -} - - -/* - * Empty method for start_pass. - */ - -METHODDEF(void) -start_pass_dcolor (j_decompress_ptr cinfo) -{ - /* no work needed */ -} - - -/* - * Module initialization routine for output colorspace conversion. - */ - -GLOBAL(void) -jinit_color_deconverter (j_decompress_ptr cinfo) -{ - my_cconvert_ptr cconvert; - int ci; - - cconvert = (my_cconvert_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_deconverter)); - cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; - cconvert->pub.start_pass = start_pass_dcolor; - - /* Make sure num_components agrees with jpeg_color_space */ - switch (cinfo->jpeg_color_space) { - case JCS_GRAYSCALE: - if (cinfo->num_components != 1) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - break; - - case JCS_RGB: - case JCS_YCbCr: - if (cinfo->num_components != 3) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - break; - - case JCS_CMYK: - case JCS_YCCK: - if (cinfo->num_components != 4) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - break; - - default: /* JCS_UNKNOWN can be anything */ - if (cinfo->num_components < 1) - ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - break; - } - - /* Set out_color_components and conversion method based on requested space. - * Also clear the component_needed flags for any unused components, - * so that earlier pipeline stages can avoid useless computation. - */ - - switch (cinfo->out_color_space) { - case JCS_GRAYSCALE: - cinfo->out_color_components = 1; - if (cinfo->jpeg_color_space == JCS_GRAYSCALE || - cinfo->jpeg_color_space == JCS_YCbCr) { - cconvert->pub.color_convert = grayscale_convert; - /* For color->grayscale conversion, only the Y (0) component is needed */ - for (ci = 1; ci < cinfo->num_components; ci++) - cinfo->comp_info[ci].component_needed = FALSE; - } else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_RGB: - cinfo->out_color_components = RGB_PIXELSIZE; - if (cinfo->jpeg_color_space == JCS_YCbCr) { - cconvert->pub.color_convert = ycc_rgb_convert; - build_ycc_rgb_table(cinfo); - } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { - cconvert->pub.color_convert = gray_rgb_convert; - } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { - cconvert->pub.color_convert = null_convert; - } else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - case JCS_CMYK: - cinfo->out_color_components = 4; - if (cinfo->jpeg_color_space == JCS_YCCK) { - cconvert->pub.color_convert = ycck_cmyk_convert; - build_ycc_rgb_table(cinfo); - } else if (cinfo->jpeg_color_space == JCS_CMYK) { - cconvert->pub.color_convert = null_convert; - } else - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - - default: - /* Permit null conversion to same output space */ - if (cinfo->out_color_space == cinfo->jpeg_color_space) { - cinfo->out_color_components = cinfo->num_components; - cconvert->pub.color_convert = null_convert; - } else /* unsupported non-null conversion */ - ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - break; - } - - if (cinfo->quantize_colors) - cinfo->output_components = 1; /* single colormapped output component */ - else - cinfo->output_components = cinfo->out_color_components; -} - -#if defined(__VISAGECPP__) -# ifdef null_convert2 -# undef null_convert2 -# endif -# ifdef grayscale_convert2 -# undef grayscale_convert2 -# endif -#endif diff --git a/Source/3rdParty/wx/src/jpeg/jdct.h b/Source/3rdParty/wx/src/jpeg/jdct.h deleted file mode 100644 index 42180f390..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdct.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * jdct.h - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This include file contains common declarations for the forward and - * inverse DCT modules. These declarations are private to the DCT managers - * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. - * The individual DCT algorithms are kept in separate files to ease - * machine-dependent tuning (e.g., assembly coding). - */ - - -/* - * A forward DCT routine is given a pointer to a work area of type DCTELEM[]; - * the DCT is to be performed in-place in that buffer. Type DCTELEM is int - * for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT - * implementations use an array of type FAST_FLOAT, instead.) - * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). - * The DCT outputs are returned scaled up by a factor of 8; they therefore - * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This - * convention improves accuracy in integer implementations and saves some - * work in floating-point ones. - * Quantization of the output coefficients is done by jcdctmgr.c. - */ - -#if BITS_IN_JSAMPLE == 8 -typedef int DCTELEM; /* 16 or 32 bits is fine */ -#else -typedef JPEG_INT32 DCTELEM; /* must have 32 bits */ -#endif - -typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); -typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); - - -/* - * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer - * to an output sample array. The routine must dequantize the input data as - * well as perform the IDCT; for dequantization, it uses the multiplier table - * pointed to by compptr->dct_table. The output data is to be placed into the - * sample array starting at a specified column. (Any row offset needed will - * be applied to the array pointer before it is passed to the IDCT code.) - * Note that the number of samples emitted by the IDCT routine is - * DCT_scaled_size * DCT_scaled_size. - */ - -/* typedef inverse_DCT_method_ptr is declared in jpegint.h */ - -/* - * Each IDCT routine has its own ideas about the best dct_table element type. - */ - -typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ -#if BITS_IN_JSAMPLE == 8 -typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ -#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ -#else -typedef JPEG_INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ -#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ -#endif -typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ - - -/* - * Each IDCT routine is responsible for range-limiting its results and - * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could - * be quite far out of range if the input data is corrupt, so a bulletproof - * range-limiting step is required. We use a mask-and-table-lookup method - * to do the combined operations quickly. See the comments with - * prepare_range_limit_table (in jdmaster.c) for more info. - */ - -#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) - -#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ - - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_fdct_islow jFDislow -#define jpeg_fdct_ifast jFDifast -#define jpeg_fdct_float jFDfloat -#define jpeg_idct_islow jRDislow -#define jpeg_idct_ifast jRDifast -#define jpeg_idct_float jRDfloat -#define jpeg_idct_4x4 jRD4x4 -#define jpeg_idct_2x2 jRD2x2 -#define jpeg_idct_1x1 jRD1x1 -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - -/* Extern declarations for the forward and inverse DCT routines. */ - -EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); -EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data)); -EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); - -EXTERN(void) jpeg_idct_islow - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN(void) jpeg_idct_ifast - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN(void) jpeg_idct_float - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN(void) jpeg_idct_4x4 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN(void) jpeg_idct_2x2 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN(void) jpeg_idct_1x1 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); - - -/* - * Macros for handling fixed-point arithmetic; these are used by many - * but not all of the DCT/IDCT modules. - * - * All values are expected to be of type INT32. - * Fractional constants are scaled left by CONST_BITS bits. - * CONST_BITS is defined within each module using these macros, - * and may differ from one module to the next. - */ - -#define ONE ((JPEG_INT32) 1) -#define CONST_SCALE (ONE << CONST_BITS) - -/* Convert a positive real constant to an integer scaled by CONST_SCALE. - * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, - * thus causing a lot of useless floating-point operations at run time. - */ - -#define FIX(x) ((JPEG_INT32) ((x) * CONST_SCALE + 0.5)) - -/* Descale and correctly round an INT32 value that's scaled by N bits. - * We assume RIGHT_SHIFT rounds towards minus infinity, so adding - * the fudge factor is correct for either sign of X. - */ - -#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) - -/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. - * This macro is used only when the two inputs will actually be no more than - * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a - * full 32x32 multiply. This provides a useful speedup on many machines. - * Unfortunately there is no way to specify a 16x16->32 multiply portably - * in C, but some C compilers will do the right thing if you provide the - * correct combination of casts. - */ - -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ -#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) -#endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ -#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((JPEG_INT32) (const))) -#endif - -#ifndef MULTIPLY16C16 /* default definition */ -#define MULTIPLY16C16(var,const) ((var) * (const)) -#endif - -/* Same except both inputs are variables. */ - -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ -#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) -#endif - -#ifndef MULTIPLY16V16 /* default definition */ -#define MULTIPLY16V16(var1,var2) ((var1) * (var2)) -#endif diff --git a/Source/3rdParty/wx/src/jpeg/jddctmgr.c b/Source/3rdParty/wx/src/jpeg/jddctmgr.c deleted file mode 100644 index e27cc3d51..000000000 --- a/Source/3rdParty/wx/src/jpeg/jddctmgr.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * jddctmgr.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the inverse-DCT management logic. - * This code selects a particular IDCT implementation to be used, - * and it performs related housekeeping chores. No code in this file - * is executed per IDCT step, only during output pass setup. - * - * Note that the IDCT routines are responsible for performing coefficient - * dequantization as well as the IDCT proper. This module sets up the - * dequantization multiplier table needed by the IDCT routine. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - - -/* - * The decompressor input side (jdinput.c) saves away the appropriate - * quantization table for each component at the start of the first scan - * involving that component. (This is necessary in order to correctly - * decode files that reuse Q-table slots.) - * When we are ready to make an output pass, the saved Q-table is converted - * to a multiplier table that will actually be used by the IDCT routine. - * The multiplier table contents are IDCT-method-dependent. To support - * application changes in IDCT method between scans, we can remake the - * multiplier tables if necessary. - * In buffered-image mode, the first output pass may occur before any data - * has been seen for some components, and thus before their Q-tables have - * been saved away. To handle this case, multiplier tables are preset - * to zeroes; the result of the IDCT will be a neutral gray level. - */ - - -/* Private subobject for this module */ - -typedef struct { - struct jpeg_inverse_dct pub; /* public fields */ - - /* This array contains the IDCT method code that each multiplier table - * is currently set up for, or -1 if it's not yet set up. - * The actual multiplier tables are pointed to by dct_table in the - * per-component comp_info structures. - */ - int cur_method[MAX_COMPONENTS]; -} my_idct_controller; - -typedef my_idct_controller * my_idct_ptr; - - -/* Allocated multiplier tables: big enough for any supported variant */ - -typedef union { - ISLOW_MULT_TYPE islow_array[DCTSIZE2]; -#ifdef DCT_IFAST_SUPPORTED - IFAST_MULT_TYPE ifast_array[DCTSIZE2]; -#endif -#ifdef DCT_FLOAT_SUPPORTED - FLOAT_MULT_TYPE float_array[DCTSIZE2]; -#endif -} multiplier_table; - - -/* The current scaled-IDCT routines require ISLOW-style multiplier tables, - * so be sure to compile that code if either ISLOW or SCALING is requested. - */ -#ifdef DCT_ISLOW_SUPPORTED -#define PROVIDE_ISLOW_TABLES -#else -#ifdef IDCT_SCALING_SUPPORTED -#define PROVIDE_ISLOW_TABLES -#endif -#endif - - -/* - * Prepare for an output pass. - * Here we select the proper IDCT routine for each component and build - * a matching multiplier table. - */ - -METHODDEF(void) -start_pass (j_decompress_ptr cinfo) -{ - my_idct_ptr idct = (my_idct_ptr) cinfo->idct; - int ci, i; - jpeg_component_info *compptr; - int method = 0; - inverse_DCT_method_ptr method_ptr = NULL; - JQUANT_TBL * qtbl; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Select the proper IDCT routine for this component's scaling */ - switch (compptr->DCT_scaled_size) { -#ifdef IDCT_SCALING_SUPPORTED - case 1: - method_ptr = jpeg_idct_1x1; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ - break; - case 2: - method_ptr = jpeg_idct_2x2; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ - break; - case 4: - method_ptr = jpeg_idct_4x4; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ - break; -#endif - case DCTSIZE: - switch (cinfo->dct_method) { -#ifdef DCT_ISLOW_SUPPORTED - case JDCT_ISLOW: - method_ptr = jpeg_idct_islow; - method = JDCT_ISLOW; - break; -#endif -#ifdef DCT_IFAST_SUPPORTED - case JDCT_IFAST: - method_ptr = jpeg_idct_ifast; - method = JDCT_IFAST; - break; -#endif -#ifdef DCT_FLOAT_SUPPORTED - case JDCT_FLOAT: - method_ptr = jpeg_idct_float; - method = JDCT_FLOAT; - break; -#endif - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; - } - break; - default: - ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size); - break; - } - idct->pub.inverse_DCT[ci] = method_ptr; - /* Create multiplier table from quant table. - * However, we can skip this if the component is uninteresting - * or if we already built the table. Also, if no quant table - * has yet been saved for the component, we leave the - * multiplier table all-zero; we'll be reading zeroes from the - * coefficient controller's buffer anyway. - */ - if (! compptr->component_needed || idct->cur_method[ci] == method) - continue; - qtbl = compptr->quant_table; - if (qtbl == NULL) /* happens if no data yet for component */ - continue; - idct->cur_method[ci] = method; - switch (method) { -#ifdef PROVIDE_ISLOW_TABLES - case JDCT_ISLOW: - { - /* For LL&M IDCT method, multipliers are equal to raw quantization - * coefficients, but are stored as ints to ensure access efficiency. - */ - ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table; - for (i = 0; i < DCTSIZE2; i++) { - ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i]; - } - } - break; -#endif -#ifdef DCT_IFAST_SUPPORTED - case JDCT_IFAST: - { - /* For AA&N IDCT method, multipliers are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * For integer operation, the multiplier table is to be scaled by - * IFAST_SCALE_BITS. - */ - IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; -#define CONST_BITS 14 - static const INT16 aanscales[DCTSIZE2] = { - /* precomputed values scaled up by 14 bits */ - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, - 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 - }; - SHIFT_TEMPS - - for (i = 0; i < DCTSIZE2; i++) { - ifmtbl[i] = (IFAST_MULT_TYPE) - DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[i], - (JPEG_INT32) aanscales[i]), - CONST_BITS-IFAST_SCALE_BITS); - } - } - break; -#endif -#ifdef DCT_FLOAT_SUPPORTED - case JDCT_FLOAT: - { - /* For float AA&N IDCT method, multipliers are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - */ - FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; - int row, col; - static const double aanscalefactor[DCTSIZE] = { - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - }; - - i = 0; - for (row = 0; row < DCTSIZE; row++) { - for (col = 0; col < DCTSIZE; col++) { - fmtbl[i] = (FLOAT_MULT_TYPE) - ((double) qtbl->quantval[i] * - aanscalefactor[row] * aanscalefactor[col]); - i++; - } - } - } - break; -#endif - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; - } - } -} - - -/* - * Initialize IDCT manager. - */ - -GLOBAL(void) -jinit_inverse_dct (j_decompress_ptr cinfo) -{ - my_idct_ptr idct; - int ci; - jpeg_component_info *compptr; - - idct = (my_idct_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_idct_controller)); - cinfo->idct = (struct jpeg_inverse_dct *) idct; - idct->pub.start_pass = start_pass; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Allocate and pre-zero a multiplier table for each component */ - compptr->dct_table = - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(multiplier_table)); - MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); - /* Mark multiplier table not yet set up for any method */ - idct->cur_method[ci] = -1; - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jdhuff.c b/Source/3rdParty/wx/src/jpeg/jdhuff.c deleted file mode 100644 index dccbc52b4..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdhuff.c +++ /dev/null @@ -1,651 +0,0 @@ -/* - * jdhuff.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains Huffman entropy decoding routines. - * - * Much of the complexity here has to do with supporting input suspension. - * If the data source module demands suspension, we want to be able to back - * up to the start of the current MCU. To do this, we copy state variables - * into local working storage, and update them back to the permanent - * storage only upon successful completion of an MCU. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdhuff.h" /* Declarations shared with jdphuff.c */ - - -/* - * Expanded entropy decoder object for Huffman decoding. - * - * The savable_state subrecord contains fields that change within an MCU, - * but must not be updated permanently until we complete the MCU. - */ - -typedef struct { - int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ -} savable_state; - -/* This macro is to work around compilers with missing or broken - * structure assignment. You'll need to fix this code if you have - * such a compiler and you change MAX_COMPS_IN_SCAN. - */ - -#ifndef NO_STRUCT_ASSIGN -#define ASSIGN_STATE(dest,src) ((dest) = (src)) -#else -#if MAX_COMPS_IN_SCAN == 4 -#define ASSIGN_STATE(dest,src) \ - ((dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) -#endif -#endif - - -typedef struct { - struct jpeg_entropy_decoder pub; /* public fields */ - - /* These fields are loaded into local variables at start of each MCU. - * In case of suspension, we exit WITHOUT updating them. - */ - bitread_perm_state bitstate; /* Bit buffer at start of MCU */ - savable_state saved; /* Other state at start of MCU */ - - /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - - /* Pointers to derived tables (these workspaces have image lifespan) */ - d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; - d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; - - /* Precalculated info set up by start_pass for use in decode_mcu: */ - - /* Pointers to derived tables to be used for each block within an MCU */ - d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU]; - d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU]; - /* Whether we care about the DC and AC coefficient values for each block */ - wxjpeg_boolean dc_needed[D_MAX_BLOCKS_IN_MCU]; - wxjpeg_boolean ac_needed[D_MAX_BLOCKS_IN_MCU]; -} huff_entropy_decoder; - -typedef huff_entropy_decoder * huff_entropy_ptr; - - -/* - * Initialize for a Huffman-compressed scan. - */ - -METHODDEF(void) -start_pass_huff_decoder (j_decompress_ptr cinfo) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int ci, blkn, dctbl, actbl; - jpeg_component_info * compptr; - - /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. - * This ought to be an error condition, but we make it a warning because - * there are some baseline files out there with all zeroes in these bytes. - */ - if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 || - cinfo->Ah != 0 || cinfo->Al != 0) - WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - dctbl = compptr->dc_tbl_no; - actbl = compptr->ac_tbl_no; - /* Compute derived values for Huffman tables */ - /* We may do this more than once for a table, but it's not expensive */ - jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, - & entropy->dc_derived_tbls[dctbl]); - jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, - & entropy->ac_derived_tbls[actbl]); - /* Initialize DC predictions to 0 */ - entropy->saved.last_dc_val[ci] = 0; - } - - /* Precalculate decoding info for each block in an MCU of this scan */ - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - ci = cinfo->MCU_membership[blkn]; - compptr = cinfo->cur_comp_info[ci]; - /* Precalculate which table to use for each block */ - entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no]; - entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no]; - /* Decide whether we really care about the coefficient values */ - if (compptr->component_needed) { - entropy->dc_needed[blkn] = TRUE; - /* we don't need the ACs if producing a 1/8th-size image */ - entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1); - } else { - entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE; - } - } - - /* Initialize bitread state variables */ - entropy->bitstate.bits_left = 0; - entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ - entropy->pub.insufficient_data = FALSE; - - /* Initialize restart counter */ - entropy->restarts_to_go = cinfo->restart_interval; -} - - -/* - * Compute the derived values for a Huffman table. - * This routine also performs some validation checks on the table. - * - * Note this is also used by jdphuff.c. - */ - -GLOBAL(void) -jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, wxjpeg_boolean isDC, int tblno, - d_derived_tbl ** pdtbl) -{ - JHUFF_TBL *htbl; - d_derived_tbl *dtbl; - int p, i, l, si, numsymbols; - int lookbits, ctr; - char huffsize[257]; - unsigned int huffcode[257]; - unsigned int code; - - /* Note that huffsize[] and huffcode[] are filled in code-length order, - * paralleling the order of the symbols themselves in htbl->huffval[]. - */ - - /* Find the input Huffman table */ - if (tblno < 0 || tblno >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); - htbl = - isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; - if (htbl == NULL) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); - - /* Allocate a workspace if we haven't already done so. */ - if (*pdtbl == NULL) - *pdtbl = (d_derived_tbl *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(d_derived_tbl)); - dtbl = *pdtbl; - dtbl->pub = htbl; /* fill in back link */ - - /* Figure C.1: make table of Huffman code length for each symbol */ - - p = 0; - for (l = 1; l <= 16; l++) { - i = (int) htbl->bits[l]; - if (i < 0 || p + i > 256) /* protect against table overrun */ - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - while (i--) - huffsize[p++] = (char) l; - } - huffsize[p] = 0; - numsymbols = p; - - /* Figure C.2: generate the codes themselves */ - /* We also validate that the counts represent a legal Huffman code tree. */ - - code = 0; - si = huffsize[0]; - p = 0; - while (huffsize[p]) { - while (((int) huffsize[p]) == si) { - huffcode[p++] = code; - code++; - } - /* code is now 1 more than the last code used for codelength si; but - * it must still fit in si bits, since no code is allowed to be all ones. - */ - if (((JPEG_INT32) code) >= (((JPEG_INT32) 1) << si)) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - code <<= 1; - si++; - } - - /* Figure F.15: generate decoding tables for bit-sequential decoding */ - - p = 0; - for (l = 1; l <= 16; l++) { - if (htbl->bits[l]) { - /* valoffset[l] = huffval[] index of 1st symbol of code length l, - * minus the minimum code of length l - */ - dtbl->valoffset[l] = (JPEG_INT32) p - (JPEG_INT32) huffcode[p]; - p += htbl->bits[l]; - dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ - } else { - dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ - } - } - dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */ - - /* Compute lookahead tables to speed up decoding. - * First we set all the table entries to 0, indicating "too long"; - * then we iterate through the Huffman codes that are short enough and - * fill in all the entries that correspond to bit sequences starting - * with that code. - */ - - MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits)); - - p = 0; - for (l = 1; l <= HUFF_LOOKAHEAD; l++) { - for (i = 1; i <= (int) htbl->bits[l]; i++, p++) { - /* l = current code's length, p = its index in huffcode[] & huffval[]. */ - /* Generate left-justified code followed by all possible bit sequences */ - lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); - for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { - dtbl->look_nbits[lookbits] = l; - dtbl->look_sym[lookbits] = htbl->huffval[p]; - lookbits++; - } - } - } - - /* Validate symbols as being reasonable. - * For AC tables, we make no check, but accept all byte values 0..255. - * For DC tables, we require the symbols to be in range 0..15. - * (Tighter bounds could be applied depending on the data depth and mode, - * but this is sufficient to ensure safe decoding.) - */ - if (isDC) { - for (i = 0; i < numsymbols; i++) { - int sym = htbl->huffval[i]; - if (sym < 0 || sym > 15) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - } - } -} - - -/* - * Out-of-line code for bit fetching (shared with jdphuff.c). - * See jdhuff.h for info about usage. - * Note: current values of get_buffer and bits_left are passed as parameters, - * but are returned in the corresponding fields of the state struct. - * - * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width - * of get_buffer to be used. (On machines with wider words, an even larger - * buffer could be used.) However, on some machines 32-bit shifts are - * quite slow and take time proportional to the number of places shifted. - * (This is true with most PC compilers, for instance.) In this case it may - * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the - * average shift distance at the cost of more calls to jpeg_fill_bit_buffer. - */ - -#ifdef SLOW_SHIFT_32 -#define MIN_GET_BITS 15 /* minimum allowable value */ -#else -#define MIN_GET_BITS (BIT_BUF_SIZE-7) -#endif - - -GLOBAL(wxjpeg_boolean) -jpeg_fill_bit_buffer (bitread_working_state * state, - register bit_buf_type get_buffer, register int bits_left, - int nbits) -/* Load up the bit buffer to a depth of at least nbits */ -{ - /* Copy heavily used state fields into locals (hopefully registers) */ - register const JOCTET * next_input_byte = state->next_input_byte; - register size_t bytes_in_buffer = state->bytes_in_buffer; - j_decompress_ptr cinfo = state->cinfo; - - /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */ - /* (It is assumed that no request will be for more than that many bits.) */ - /* We fail to do so only if we hit a marker or are forced to suspend. */ - - if (cinfo->unread_marker == 0) { /* cannot advance past a marker */ - while (bits_left < MIN_GET_BITS) { - register int c; - - /* Attempt to read a byte */ - if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) - return FALSE; - next_input_byte = cinfo->src->next_input_byte; - bytes_in_buffer = cinfo->src->bytes_in_buffer; - } - bytes_in_buffer--; - c = GETJOCTET(*next_input_byte++); - - /* If it's 0xFF, check and discard stuffed zero byte */ - if (c == 0xFF) { - /* Loop here to discard any padding FF's on terminating marker, - * so that we can save a valid unread_marker value. NOTE: we will - * accept multiple FF's followed by a 0 as meaning a single FF data - * byte. This data pattern is not valid according to the standard. - */ - do { - if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) - return FALSE; - next_input_byte = cinfo->src->next_input_byte; - bytes_in_buffer = cinfo->src->bytes_in_buffer; - } - bytes_in_buffer--; - c = GETJOCTET(*next_input_byte++); - } while (c == 0xFF); - - if (c == 0) { - /* Found FF/00, which represents an FF data byte */ - c = 0xFF; - } else { - /* Oops, it's actually a marker indicating end of compressed data. - * Save the marker code for later use. - * Fine point: it might appear that we should save the marker into - * bitread working state, not straight into permanent state. But - * once we have hit a marker, we cannot need to suspend within the - * current MCU, because we will read no more bytes from the data - * source. So it is OK to update permanent state right away. - */ - cinfo->unread_marker = c; - /* See if we need to insert some fake zero bits. */ - goto no_more_bytes; - } - } - - /* OK, load c into get_buffer */ - get_buffer = (get_buffer << 8) | c; - bits_left += 8; - } /* end while */ - } else { - no_more_bytes: - /* We get here if we've read the marker that terminates the compressed - * data segment. There should be enough bits in the buffer register - * to satisfy the request; if so, no problem. - */ - if (nbits > bits_left) { - /* Uh-oh. Report corrupted data to user and stuff zeroes into - * the data stream, so that we can produce some kind of image. - * We use a nonvolatile flag to ensure that only one warning message - * appears per data segment. - */ - if (! cinfo->entropy->insufficient_data) { - WARNMS(cinfo, JWRN_HIT_MARKER); - cinfo->entropy->insufficient_data = TRUE; - } - /* Fill the buffer with zero bits */ - get_buffer <<= MIN_GET_BITS - bits_left; - bits_left = MIN_GET_BITS; - } - } - - /* Unload the local registers */ - state->next_input_byte = next_input_byte; - state->bytes_in_buffer = bytes_in_buffer; - state->get_buffer = get_buffer; - state->bits_left = bits_left; - - return TRUE; -} - - -/* - * Out-of-line code for Huffman code decoding. - * See jdhuff.h for info about usage. - */ - -GLOBAL(int) -jpeg_huff_decode (bitread_working_state * state, - register bit_buf_type get_buffer, register int bits_left, - d_derived_tbl * htbl, int min_bits) -{ - register int l = min_bits; - register JPEG_INT32 code; - - /* HUFF_DECODE has determined that the code is at least min_bits */ - /* bits long, so fetch that many bits in one swoop. */ - - CHECK_BIT_BUFFER(*state, l, return -1); - code = GET_BITS(l); - - /* Collect the rest of the Huffman code one bit at a time. */ - /* This is per Figure F.16 in the JPEG spec. */ - - while (code > htbl->maxcode[l]) { - code <<= 1; - CHECK_BIT_BUFFER(*state, 1, return -1); - code |= GET_BITS(1); - l++; - } - - /* Unload the local registers */ - state->get_buffer = get_buffer; - state->bits_left = bits_left; - - /* With garbage input we may reach the sentinel value l = 17. */ - - if (l > 16) { - WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE); - return 0; /* fake a zero as the safest result */ - } - - return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ]; -} - - -/* - * Figure F.12: extend sign bit. - * On some machines, a shift and add will be faster than a table lookup. - */ - -#ifdef AVOID_TABLES - -#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) - -#else - -#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) - -static const int extend_test[16] = /* entry n is 2**(n-1) */ - { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, - 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; - -static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ - { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, - ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, - ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, - ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; - -#endif /* AVOID_TABLES */ - - -/* - * Check for a restart marker & resynchronize decoder. - * Returns FALSE if must suspend. - */ - -LOCAL(wxjpeg_boolean) -process_restart (j_decompress_ptr cinfo) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int ci; - - /* Throw away any unused bits remaining in bit buffer; */ - /* include any full bytes in next_marker's count of discarded bytes */ - cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; - entropy->bitstate.bits_left = 0; - - /* Advance past the RSTn marker */ - if (! (*cinfo->marker->read_restart_marker) (cinfo)) - return FALSE; - - /* Re-initialize DC predictions to 0 */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) - entropy->saved.last_dc_val[ci] = 0; - - /* Reset restart counter */ - entropy->restarts_to_go = cinfo->restart_interval; - - /* Reset out-of-data flag, unless read_restart_marker left us smack up - * against a marker. In that case we will end up treating the next data - * segment as empty, and we can avoid producing bogus output pixels by - * leaving the flag set. - */ - if (cinfo->unread_marker == 0) - entropy->pub.insufficient_data = FALSE; - - return TRUE; -} - - -/* - * Decode and return one MCU's worth of Huffman-compressed coefficients. - * The coefficients are reordered from zigzag order into natural array order, - * but are not dequantized. - * - * The i'th block of the MCU is stored into the block pointed to by - * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER. - * (Wholesale zeroing is usually a little faster than retail...) - * - * Returns FALSE if data source requested suspension. In that case no - * changes have been made to permanent state. (Exception: some output - * coefficients may already have been assigned. This is harmless for - * this module, since we'll just re-assign them on the next call.) - */ - -METHODDEF(wxjpeg_boolean) -decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int blkn; - BITREAD_STATE_VARS; - savable_state state; - - /* Process restart marker if needed; may have to suspend */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) - return FALSE; - } - - /* If we've run out of data, just leave the MCU set to zeroes. - * This way, we return uniform gray for the remainder of the segment. - */ - if (! entropy->pub.insufficient_data) { - - /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(state, entropy->saved); - - /* Outer loop handles each block in the MCU */ - - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - JBLOCKROW block = MCU_data[blkn]; - d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; - d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; - register int s, k, r; - - /* Decode a single block's worth of coefficients */ - - /* Section F.2.2.1: decode the DC coefficient difference */ - HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); - if (s) { - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - } - - if (entropy->dc_needed[blkn]) { - /* Convert DC difference to actual value, update last_dc_val */ - int ci = cinfo->MCU_membership[blkn]; - s += state.last_dc_val[ci]; - state.last_dc_val[ci] = s; - /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ - (*block)[0] = (JCOEF) s; - } - - if (entropy->ac_needed[blkn]) { - - /* Section F.2.2.2: decode the AC coefficients */ - /* Since zeroes are skipped, output area must be cleared beforehand */ - for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE(s, br_state, actbl, return FALSE, label2); - - r = s >> 4; - s &= 15; - - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - /* Output coefficient in natural (dezigzagged) order. - * Note: the extra entries in jpeg_natural_order[] will save us - * if k >= DCTSIZE2, which could happen if the data is corrupted. - */ - (*block)[jpeg_natural_order[k]] = (JCOEF) s; - } else { - if (r != 15) - break; - k += 15; - } - } - - } else { - - /* Section F.2.2.2: decode the AC coefficients */ - /* In this path we just discard the values */ - for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE(s, br_state, actbl, return FALSE, label3); - - r = s >> 4; - s &= 15; - - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - DROP_BITS(s); - } else { - if (r != 15) - break; - k += 15; - } - } - - } - } - - /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(entropy->saved, state); - } - - /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; - - return TRUE; -} - - -/* - * Module initialization routine for Huffman entropy decoding. - */ - -GLOBAL(void) -jinit_huff_decoder (j_decompress_ptr cinfo) -{ - huff_entropy_ptr entropy; - int i; - - entropy = (huff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_decoder)); - cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; - entropy->pub.start_pass = start_pass_huff_decoder; - entropy->pub.decode_mcu = decode_mcu; - - /* Mark tables unallocated */ - for (i = 0; i < NUM_HUFF_TBLS; i++) { - entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jdhuff.h b/Source/3rdParty/wx/src/jpeg/jdhuff.h deleted file mode 100644 index 9e9e87dae..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdhuff.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * jdhuff.h - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains declarations for Huffman entropy decoding routines - * that are shared between the sequential decoder (jdhuff.c) and the - * progressive decoder (jdphuff.c). No other modules need to see these. - */ - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_d_derived_tbl jMkDDerived -#define jpeg_fill_bit_buffer jFilBitBuf -#define jpeg_huff_decode jHufDecode -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* Derived data constructed for each Huffman table */ - -#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ - -typedef struct { - /* Basic tables: (element [0] of each array is unused) */ - JPEG_INT32 maxcode[18]; /* largest code of length k (-1 if none) */ - /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ - JPEG_INT32 valoffset[17]; /* huffval[] offset for codes of length k */ - /* valoffset[k] = huffval[] index of 1st symbol of code length k, less - * the smallest code of length k; so given a code of length k, the - * corresponding symbol is huffval[code + valoffset[k]] - */ - - /* Link to public Huffman table (needed only in jpeg_huff_decode) */ - JHUFF_TBL *pub; - - /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of - * the input data stream. If the next Huffman code is no more - * than HUFF_LOOKAHEAD bits long, we can obtain its length and - * the corresponding symbol directly from these tables. - */ - int look_nbits[1< 32 bits on your machine, and shifting/masking longs is - * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE - * appropriately should be a win. Unfortunately we can't define the size - * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) - * because not all machines measure sizeof in 8-bit bytes. - */ - -typedef struct { /* Bitreading state saved across MCUs */ - bit_buf_type get_buffer; /* current bit-extraction buffer */ - int bits_left; /* # of unused bits in it */ -} bitread_perm_state; - -typedef struct { /* Bitreading working state within an MCU */ - /* Current data source location */ - /* We need a copy, rather than munging the original, in case of suspension */ - const JOCTET * next_input_byte; /* => next byte to read from source */ - size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ - /* Bit input buffer --- note these values are kept in register variables, - * not in this struct, inside the inner loops. - */ - bit_buf_type get_buffer; /* current bit-extraction buffer */ - int bits_left; /* # of unused bits in it */ - /* Pointer needed by jpeg_fill_bit_buffer. */ - j_decompress_ptr cinfo; /* back link to decompress master record */ -} bitread_working_state; - -/* Macros to declare and load/save bitread local variables. */ -#define BITREAD_STATE_VARS \ - register bit_buf_type get_buffer; \ - register int bits_left; \ - bitread_working_state br_state - -#define BITREAD_LOAD_STATE(cinfop,permstate) \ - br_state.cinfo = cinfop; \ - br_state.next_input_byte = cinfop->src->next_input_byte; \ - br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ - get_buffer = permstate.get_buffer; \ - bits_left = permstate.bits_left; - -#define BITREAD_SAVE_STATE(cinfop,permstate) \ - cinfop->src->next_input_byte = br_state.next_input_byte; \ - cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ - permstate.get_buffer = get_buffer; \ - permstate.bits_left = bits_left - -/* - * These macros provide the in-line portion of bit fetching. - * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer - * before using GET_BITS, PEEK_BITS, or DROP_BITS. - * The variables get_buffer and bits_left are assumed to be locals, - * but the state struct might not be (jpeg_huff_decode needs this). - * CHECK_BIT_BUFFER(state,n,action); - * Ensure there are N bits in get_buffer; if suspend, take action. - * val = GET_BITS(n); - * Fetch next N bits. - * val = PEEK_BITS(n); - * Fetch next N bits without removing them from the buffer. - * DROP_BITS(n); - * Discard next N bits. - * The value N should be a simple variable, not an expression, because it - * is evaluated multiple times. - */ - -#define CHECK_BIT_BUFFER(state,nbits,action) \ - { if (bits_left < (nbits)) { \ - if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ - { action; } \ - get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } - -#define GET_BITS(nbits) \ - (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1)) - -#define PEEK_BITS(nbits) \ - (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1)) - -#define DROP_BITS(nbits) \ - (bits_left -= (nbits)) - -/* Load up the bit buffer to a depth of at least nbits */ -EXTERN(wxjpeg_boolean) jpeg_fill_bit_buffer - JPP((bitread_working_state * state, register bit_buf_type get_buffer, - register int bits_left, int nbits)); - - -/* - * Code for extracting next Huffman-coded symbol from input bit stream. - * Again, this is time-critical and we make the main paths be macros. - * - * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits - * without looping. Usually, more than 95% of the Huffman codes will be 8 - * or fewer bits long. The few overlength codes are handled with a loop, - * which need not be inline code. - * - * Notes about the HUFF_DECODE macro: - * 1. Near the end of the data segment, we may fail to get enough bits - * for a lookahead. In that case, we do it the hard way. - * 2. If the lookahead table contains no entry, the next code must be - * more than HUFF_LOOKAHEAD bits long. - * 3. jpeg_huff_decode returns -1 if forced to suspend. - */ - -#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ -{ register int nb, look; \ - if (bits_left < HUFF_LOOKAHEAD) { \ - if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ - get_buffer = state.get_buffer; bits_left = state.bits_left; \ - if (bits_left < HUFF_LOOKAHEAD) { \ - nb = 1; goto slowlabel; \ - } \ - } \ - look = PEEK_BITS(HUFF_LOOKAHEAD); \ - if ((nb = htbl->look_nbits[look]) != 0) { \ - DROP_BITS(nb); \ - result = htbl->look_sym[look]; \ - } else { \ - nb = HUFF_LOOKAHEAD+1; \ -slowlabel: \ - if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ - { failaction; } \ - get_buffer = state.get_buffer; bits_left = state.bits_left; \ - } \ -} - -/* Out-of-line case for Huffman code fetching */ -EXTERN(int) jpeg_huff_decode - JPP((bitread_working_state * state, register bit_buf_type get_buffer, - register int bits_left, d_derived_tbl * htbl, int min_bits)); diff --git a/Source/3rdParty/wx/src/jpeg/jdinput.c b/Source/3rdParty/wx/src/jpeg/jdinput.c deleted file mode 100644 index c89b75de5..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdinput.c +++ /dev/null @@ -1,385 +0,0 @@ -/* - * jdinput.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains input control logic for the JPEG decompressor. - * These routines are concerned with controlling the decompressor's input - * processing (marker reading and coefficient decoding). The actual input - * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -/* Private state */ - -typedef struct { - struct jpeg_input_controller pub; /* public fields */ - - wxjpeg_boolean inheaders; /* TRUE until first SOS is reached */ -} my_input_controller; - -typedef my_input_controller * my_inputctl_ptr; - - -/* Forward declarations */ -METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); - - -/* - * Routines to calculate various quantities related to the size of the image. - */ - -LOCAL(void) -initial_setup (j_decompress_ptr cinfo) -/* Called once, when first SOS marker is reached */ -{ - int ci; - jpeg_component_info *compptr; - - /* Make sure image isn't bigger than I can handle */ - if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || - (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) - ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); - - /* For now, precision must match compiled-in value... */ - if (cinfo->data_precision != BITS_IN_JSAMPLE) - ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); - - /* Check that number of components won't exceed internal array sizes */ - if (cinfo->num_components > MAX_COMPONENTS) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); - - /* Compute maximum sampling factors; check factor validity */ - cinfo->max_h_samp_factor = 1; - cinfo->max_v_samp_factor = 1; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || - compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) - ERREXIT(cinfo, JERR_BAD_SAMPLING); - cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, - compptr->h_samp_factor); - cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, - compptr->v_samp_factor); - } - - /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE. - * In the full decompressor, this will be overridden by jdmaster.c; - * but in the transcoder, jdmaster.c is not used, so we must do it here. - */ - cinfo->min_DCT_scaled_size = DCTSIZE; - - /* Compute dimensions of components */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - compptr->DCT_scaled_size = DCTSIZE; - /* Size in DCT blocks */ - compptr->width_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); - compptr->height_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) (cinfo->max_v_samp_factor * DCTSIZE)); - /* downsampled_width and downsampled_height will also be overridden by - * jdmaster.c if we are doing full decompression. The transcoder library - * doesn't use these values, but the calling application might. - */ - /* Size in samples */ - compptr->downsampled_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) cinfo->max_h_samp_factor); - compptr->downsampled_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) cinfo->max_v_samp_factor); - /* Mark component needed, until color conversion says otherwise */ - compptr->component_needed = TRUE; - /* Mark no quantization table yet saved for component */ - compptr->quant_table = NULL; - } - - /* Compute number of fully interleaved MCU rows. */ - cinfo->total_iMCU_rows = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); - - /* Decide whether file contains multiple scans */ - if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode) - cinfo->inputctl->has_multiple_scans = TRUE; - else - cinfo->inputctl->has_multiple_scans = FALSE; -} - - -LOCAL(void) -per_scan_setup (j_decompress_ptr cinfo) -/* Do computations that are needed before processing a JPEG scan */ -/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ -{ - int ci, mcublks, tmp; - jpeg_component_info *compptr; - - if (cinfo->comps_in_scan == 1) { - - /* Noninterleaved (single-component) scan */ - compptr = cinfo->cur_comp_info[0]; - - /* Overall image size in MCUs */ - cinfo->MCUs_per_row = compptr->width_in_blocks; - cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - - /* For noninterleaved scan, always one block per MCU */ - compptr->MCU_width = 1; - compptr->MCU_height = 1; - compptr->MCU_blocks = 1; - compptr->MCU_sample_width = compptr->DCT_scaled_size; - compptr->last_col_width = 1; - /* For noninterleaved scans, it is convenient to define last_row_height - * as the number of block rows present in the last iMCU row. - */ - tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); - if (tmp == 0) tmp = compptr->v_samp_factor; - compptr->last_row_height = tmp; - - /* Prepare array describing MCU composition */ - cinfo->blocks_in_MCU = 1; - cinfo->MCU_membership[0] = 0; - - } else { - - /* Interleaved (multi-component) scan */ - if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) - ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, - MAX_COMPS_IN_SCAN); - - /* Overall image size in MCUs */ - cinfo->MCUs_per_row = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width, - (long) (cinfo->max_h_samp_factor*DCTSIZE)); - cinfo->MCU_rows_in_scan = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); - - cinfo->blocks_in_MCU = 0; - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Sampling factors give # of blocks of component in each MCU */ - compptr->MCU_width = compptr->h_samp_factor; - compptr->MCU_height = compptr->v_samp_factor; - compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; - compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size; - /* Figure number of non-dummy blocks in last MCU column & row */ - tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); - if (tmp == 0) tmp = compptr->MCU_width; - compptr->last_col_width = tmp; - tmp = (int) (compptr->height_in_blocks % compptr->MCU_height); - if (tmp == 0) tmp = compptr->MCU_height; - compptr->last_row_height = tmp; - /* Prepare array describing MCU composition */ - mcublks = compptr->MCU_blocks; - if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU) - ERREXIT(cinfo, JERR_BAD_MCU_SIZE); - while (mcublks-- > 0) { - cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; - } - } - - } -} - - -/* - * Save away a copy of the Q-table referenced by each component present - * in the current scan, unless already saved during a prior scan. - * - * In a multiple-scan JPEG file, the encoder could assign different components - * the same Q-table slot number, but change table definitions between scans - * so that each component uses a different Q-table. (The IJG encoder is not - * currently capable of doing this, but other encoders might.) Since we want - * to be able to dequantize all the components at the end of the file, this - * means that we have to save away the table actually used for each component. - * We do this by copying the table at the start of the first scan containing - * the component. - * The JPEG spec prohibits the encoder from changing the contents of a Q-table - * slot between scans of a component using that slot. If the encoder does so - * anyway, this decoder will simply use the Q-table values that were current - * at the start of the first scan for the component. - * - * The decompressor output side looks only at the saved quant tables, - * not at the current Q-table slots. - */ - -LOCAL(void) -latch_quant_tables (j_decompress_ptr cinfo) -{ - int ci, qtblno; - jpeg_component_info *compptr; - JQUANT_TBL * qtbl; - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* No work if we already saved Q-table for this component */ - if (compptr->quant_table != NULL) - continue; - /* Make sure specified quantization table is present */ - qtblno = compptr->quant_tbl_no; - if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || - cinfo->quant_tbl_ptrs[qtblno] == NULL) - ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); - /* OK, save away the quantization table */ - qtbl = (JQUANT_TBL *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(JQUANT_TBL)); - MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); - compptr->quant_table = qtbl; - } -} - - -/* - * Initialize the input modules to read a scan of compressed data. - * The first call to this is done by jdmaster.c after initializing - * the entire decompressor (during jpeg_start_decompress). - * Subsequent calls come from consume_markers, below. - */ - -METHODDEF(void) -start_input_pass (j_decompress_ptr cinfo) -{ - per_scan_setup(cinfo); - latch_quant_tables(cinfo); - (*cinfo->entropy->start_pass) (cinfo); -#if defined(__VISAGECPP__) - (*cinfo->coef->start_input_pass2) (cinfo); -#else - (*cinfo->coef->start_input_pass) (cinfo); -#endif - cinfo->inputctl->consume_input = cinfo->coef->consume_data; -} - - -/* - * Finish up after inputting a compressed-data scan. - * This is called by the coefficient controller after it's read all - * the expected data of the scan. - */ - -METHODDEF(void) -finish_input_pass (j_decompress_ptr cinfo) -{ - cinfo->inputctl->consume_input = consume_markers; -} - - -/* - * Read JPEG markers before, between, or after compressed-data scans. - * Change state as necessary when a new scan is reached. - * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. - * - * The consume_input method pointer points either here or to the - * coefficient controller's consume_data routine, depending on whether - * we are reading a compressed data segment or inter-segment markers. - */ - -METHODDEF(int) -consume_markers (j_decompress_ptr cinfo) -{ - my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; - int val; - - if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */ - return JPEG_REACHED_EOI; - - val = (*cinfo->marker->read_markers) (cinfo); - - switch (val) { - case JPEG_REACHED_SOS: /* Found SOS */ - if (inputctl->inheaders) { /* 1st SOS */ - initial_setup(cinfo); - inputctl->inheaders = FALSE; - /* Note: start_input_pass must be called by jdmaster.c - * before any more input can be consumed. jdapimin.c is - * responsible for enforcing this sequencing. - */ - } else { /* 2nd or later SOS marker */ - if (! inputctl->pub.has_multiple_scans) - ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ - start_input_pass(cinfo); - } - break; - case JPEG_REACHED_EOI: /* Found EOI */ - inputctl->pub.eoi_reached = TRUE; - if (inputctl->inheaders) { /* Tables-only datastream, apparently */ - if (cinfo->marker->saw_SOF) - ERREXIT(cinfo, JERR_SOF_NO_SOS); - } else { - /* Prevent infinite loop in coef ctlr's decompress_data routine - * if user set output_scan_number larger than number of scans. - */ - if (cinfo->output_scan_number > cinfo->input_scan_number) - cinfo->output_scan_number = cinfo->input_scan_number; - } - break; - case JPEG_SUSPENDED: - break; - } - - return val; -} - - -/* - * Reset state to begin a fresh datastream. - */ - -METHODDEF(void) -reset_input_controller (j_decompress_ptr cinfo) -{ - my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; - - inputctl->pub.consume_input = consume_markers; - inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ - inputctl->pub.eoi_reached = FALSE; - inputctl->inheaders = TRUE; - /* Reset other modules */ - (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); - (*cinfo->marker->reset_marker_reader) (cinfo); - /* Reset progression state -- would be cleaner if entropy decoder did this */ - cinfo->coef_bits = NULL; -} - - -/* - * Initialize the input controller module. - * This is called only once, when the decompression object is created. - */ - -GLOBAL(void) -jinit_input_controller (j_decompress_ptr cinfo) -{ - my_inputctl_ptr inputctl; - - /* Create subobject in permanent pool */ - inputctl = (my_inputctl_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_input_controller)); - cinfo->inputctl = (struct jpeg_input_controller *) inputctl; - /* Initialize method pointers */ - inputctl->pub.consume_input = consume_markers; - inputctl->pub.reset_input_controller = reset_input_controller; - inputctl->pub.start_input_pass = start_input_pass; - inputctl->pub.finish_input_pass = finish_input_pass; - /* Initialize state: can't use reset_input_controller since we don't - * want to try to reset other modules yet. - */ - inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ - inputctl->pub.eoi_reached = FALSE; - inputctl->inheaders = TRUE; -} - diff --git a/Source/3rdParty/wx/src/jpeg/jdmainct.c b/Source/3rdParty/wx/src/jpeg/jdmainct.c deleted file mode 100644 index cd55e8ce1..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdmainct.c +++ /dev/null @@ -1,529 +0,0 @@ -/* - * jdmainct.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the main buffer controller for decompression. - * The main buffer lies between the JPEG decompressor proper and the - * post-processor; it holds downsampled data in the JPEG colorspace. - * - * Note that this code is bypassed in raw-data mode, since the application - * supplies the equivalent of the main buffer in that case. - */ - -/* suppress the warnings about using main for the variable names */ -#define main jpegMain - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -/* - * In the current system design, the main buffer need never be a full-image - * buffer; any full-height buffers will be found inside the coefficient or - * postprocessing controllers. Nonetheless, the main controller is not - * trivial. Its responsibility is to provide context rows for upsampling/ - * rescaling, and doing this in an efficient fashion is a bit tricky. - * - * Postprocessor input data is counted in "row groups". A row group - * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) - * sample rows of each component. (We require DCT_scaled_size values to be - * chosen such that these numbers are integers. In practice DCT_scaled_size - * values will likely be powers of two, so we actually have the stronger - * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.) - * Upsampling will typically produce max_v_samp_factor pixel rows from each - * row group (times any additional scale factor that the upsampler is - * applying). - * - * The coefficient controller will deliver data to us one iMCU row at a time; - * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or - * exactly min_DCT_scaled_size row groups. (This amount of data corresponds - * to one row of MCUs when the image is fully interleaved.) Note that the - * number of sample rows varies across components, but the number of row - * groups does not. Some garbage sample rows may be included in the last iMCU - * row at the bottom of the image. - * - * Depending on the vertical scaling algorithm used, the upsampler may need - * access to the sample row(s) above and below its current input row group. - * The upsampler is required to set need_context_rows TRUE at global selection - * time if so. When need_context_rows is FALSE, this controller can simply - * obtain one iMCU row at a time from the coefficient controller and dole it - * out as row groups to the postprocessor. - * - * When need_context_rows is TRUE, this controller guarantees that the buffer - * passed to postprocessing contains at least one row group's worth of samples - * above and below the row group(s) being processed. Note that the context - * rows "above" the first passed row group appear at negative row offsets in - * the passed buffer. At the top and bottom of the image, the required - * context rows are manufactured by duplicating the first or last real sample - * row; this avoids having special cases in the upsampling inner loops. - * - * The amount of context is fixed at one row group just because that's a - * convenient number for this controller to work with. The existing - * upsamplers really only need one sample row of context. An upsampler - * supporting arbitrary output rescaling might wish for more than one row - * group of context when shrinking the image; tough, we don't handle that. - * (This is justified by the assumption that downsizing will be handled mostly - * by adjusting the DCT_scaled_size values, so that the actual scale factor at - * the upsample step needn't be much less than one.) - * - * To provide the desired context, we have to retain the last two row groups - * of one iMCU row while reading in the next iMCU row. (The last row group - * can't be processed until we have another row group for its below-context, - * and so we have to save the next-to-last group too for its above-context.) - * We could do this most simply by copying data around in our buffer, but - * that'd be very slow. We can avoid copying any data by creating a rather - * strange pointer structure. Here's how it works. We allocate a workspace - * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number - * of row groups per iMCU row). We create two sets of redundant pointers to - * the workspace. Labeling the physical row groups 0 to M+1, the synthesized - * pointer lists look like this: - * M+1 M-1 - * master pointer --> 0 master pointer --> 0 - * 1 1 - * ... ... - * M-3 M-3 - * M-2 M - * M-1 M+1 - * M M-2 - * M+1 M-1 - * 0 0 - * We read alternate iMCU rows using each master pointer; thus the last two - * row groups of the previous iMCU row remain un-overwritten in the workspace. - * The pointer lists are set up so that the required context rows appear to - * be adjacent to the proper places when we pass the pointer lists to the - * upsampler. - * - * The above pictures describe the normal state of the pointer lists. - * At top and bottom of the image, we diddle the pointer lists to duplicate - * the first or last sample row as necessary (this is cheaper than copying - * sample rows around). - * - * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that - * situation each iMCU row provides only one row group so the buffering logic - * must be different (eg, we must read two iMCU rows before we can emit the - * first row group). For now, we simply do not support providing context - * rows when min_DCT_scaled_size is 1. That combination seems unlikely to - * be worth providing --- if someone wants a 1/8th-size preview, they probably - * want it quick and dirty, so a context-free upsampler is sufficient. - */ - - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_d_main_controller pub; /* public fields */ - - /* Pointer to allocated workspace (M or M+2 row groups). */ - JSAMPARRAY buffer[MAX_COMPONENTS]; - - wxjpeg_boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ - JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ - - /* Remaining fields are only used in the context case. */ - - /* These are the master pointers to the funny-order pointer lists. */ - JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ - - int whichptr; /* indicates which pointer set is now in use */ - int context_state; /* process_data state machine status */ - JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ - JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ -} my_main_controller; - -typedef my_main_controller * my_main_ptr; - -/* context_state values: */ -#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ -#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ -#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ - - -#if defined(__VISAGECPP__) -/* Visual Age fixups for multiple declarations */ -# define start_pass_main start_pass_main2 /* already in jcmaint.c */ -# define process_data_simple_main process_data_simple_main2 /* already in jcmaint.c */ -#endif - -/* Forward declarations */ -METHODDEF(void) process_data_simple_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); -METHODDEF(void) process_data_context_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); -#ifdef QUANT_2PASS_SUPPORTED -METHODDEF(void) process_data_crank_post - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); -#endif - - -LOCAL(void) -alloc_funny_pointers (j_decompress_ptr cinfo) -/* Allocate space for the funny pointer lists. - * This is done only once, not once per pass. - */ -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - int ci, rgroup; - int M = cinfo->min_DCT_scaled_size; - jpeg_component_info *compptr; - JSAMPARRAY xbuf; - - /* Get top-level space for component array pointers. - * We alloc both arrays with one call to save a few cycles. - */ - main->xbuffer[0] = (JSAMPIMAGE) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); - main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; /* height of a row group of component */ - /* Get space for pointer lists --- M+4 row groups in each list. - * We alloc both pointer lists with one call to save a few cycles. - */ - xbuf = (JSAMPARRAY) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); - xbuf += rgroup; /* want one row group at negative offsets */ - main->xbuffer[0][ci] = xbuf; - xbuf += rgroup * (M + 4); - main->xbuffer[1][ci] = xbuf; - } -} - - -LOCAL(void) -make_funny_pointers (j_decompress_ptr cinfo) -/* Create the funny pointer lists discussed in the comments above. - * The actual workspace is already allocated (in main->buffer), - * and the space for the pointer lists is allocated too. - * This routine just fills in the curiously ordered lists. - * This will be repeated at the beginning of each pass. - */ -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - int ci, i, rgroup; - int M = cinfo->min_DCT_scaled_size; - jpeg_component_info *compptr; - JSAMPARRAY buf, xbuf0, xbuf1; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; /* height of a row group of component */ - xbuf0 = main->xbuffer[0][ci]; - xbuf1 = main->xbuffer[1][ci]; - /* First copy the workspace pointers as-is */ - buf = main->buffer[ci]; - for (i = 0; i < rgroup * (M + 2); i++) { - xbuf0[i] = xbuf1[i] = buf[i]; - } - /* In the second list, put the last four row groups in swapped order */ - for (i = 0; i < rgroup * 2; i++) { - xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i]; - xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i]; - } - /* The wraparound pointers at top and bottom will be filled later - * (see set_wraparound_pointers, below). Initially we want the "above" - * pointers to duplicate the first actual data line. This only needs - * to happen in xbuffer[0]. - */ - for (i = 0; i < rgroup; i++) { - xbuf0[i - rgroup] = xbuf0[0]; - } - } -} - - -LOCAL(void) -set_wraparound_pointers (j_decompress_ptr cinfo) -/* Set up the "wraparound" pointers at top and bottom of the pointer lists. - * This changes the pointer list state from top-of-image to the normal state. - */ -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - int ci, i, rgroup; - int M = cinfo->min_DCT_scaled_size; - jpeg_component_info *compptr; - JSAMPARRAY xbuf0, xbuf1; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; /* height of a row group of component */ - xbuf0 = main->xbuffer[0][ci]; - xbuf1 = main->xbuffer[1][ci]; - for (i = 0; i < rgroup; i++) { - xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; - xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; - xbuf0[rgroup*(M+2) + i] = xbuf0[i]; - xbuf1[rgroup*(M+2) + i] = xbuf1[i]; - } - } -} - - -LOCAL(void) -set_bottom_pointers (j_decompress_ptr cinfo) -/* Change the pointer lists to duplicate the last sample row at the bottom - * of the image. whichptr indicates which xbuffer holds the final iMCU row. - * Also sets rowgroups_avail to indicate number of nondummy row groups in row. - */ -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - int ci, i, rgroup, iMCUheight, rows_left; - jpeg_component_info *compptr; - JSAMPARRAY xbuf; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Count sample rows in one iMCU row and in one row group */ - iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size; - rgroup = iMCUheight / cinfo->min_DCT_scaled_size; - /* Count nondummy sample rows remaining for this component */ - rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); - if (rows_left == 0) rows_left = iMCUheight; - /* Count nondummy row groups. Should get same answer for each component, - * so we need only do it once. - */ - if (ci == 0) { - main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); - } - /* Duplicate the last real sample row rgroup*2 times; this pads out the - * last partial rowgroup and ensures at least one full rowgroup of context. - */ - xbuf = main->xbuffer[main->whichptr][ci]; - for (i = 0; i < rgroup * 2; i++) { - xbuf[rows_left + i] = xbuf[rows_left-1]; - } - } -} - - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - - switch (pass_mode) { - case JBUF_PASS_THRU: - if (cinfo->upsample->need_context_rows) { - main->pub.process_data = process_data_context_main; - make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ - main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ - main->context_state = CTX_PREPARE_FOR_IMCU; - main->iMCU_row_ctr = 0; - } else { - /* Simple case with no context needed */ - main->pub.process_data = process_data_simple_main; - } - main->buffer_full = FALSE; /* Mark buffer empty */ - main->rowgroup_ctr = 0; - break; -#ifdef QUANT_2PASS_SUPPORTED - case JBUF_CRANK_DEST: - /* For last pass of 2-pass quantization, just crank the postprocessor */ - main->pub.process_data = process_data_crank_post; - break; -#endif - default: - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - break; - } -} - - -/* - * Process some data. - * This handles the simple case where no context is required. - */ - -METHODDEF(void) -process_data_simple_main (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - JDIMENSION rowgroups_avail; - - /* Read input data if we haven't filled the main buffer yet */ - if (! main->buffer_full) { - if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer)) - return; /* suspension forced, can do nothing more */ - main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ - } - - /* There are always min_DCT_scaled_size row groups in an iMCU row. */ - rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size; - /* Note: at the bottom of the image, we may pass extra garbage row groups - * to the postprocessor. The postprocessor has to check for bottom - * of image anyway (at row resolution), so no point in us doing it too. - */ - - /* Feed the postprocessor */ - (*cinfo->post->post_process_data) (cinfo, main->buffer, - &main->rowgroup_ctr, rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); - - /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ - if (main->rowgroup_ctr >= rowgroups_avail) { - main->buffer_full = FALSE; - main->rowgroup_ctr = 0; - } -} - - -/* - * Process some data. - * This handles the case where context rows must be provided. - */ - -METHODDEF(void) -process_data_context_main (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_main_ptr main = (my_main_ptr) cinfo->main; - - /* Read input data if we haven't filled the main buffer yet */ - if (! main->buffer_full) { - if (! (*cinfo->coef->decompress_data) (cinfo, - main->xbuffer[main->whichptr])) - return; /* suspension forced, can do nothing more */ - main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ - main->iMCU_row_ctr++; /* count rows received */ - } - - /* Postprocessor typically will not swallow all the input data it is handed - * in one call (due to filling the output buffer first). Must be prepared - * to exit and restart. This switch lets us keep track of how far we got. - * Note that each case falls through to the next on successful completion. - */ - switch (main->context_state) { - case CTX_POSTPONED_ROW: - /* Call postprocessor using previously set pointers for postponed row */ - (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], - &main->rowgroup_ctr, main->rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); - if (main->rowgroup_ctr < main->rowgroups_avail) - return; /* Need to suspend */ - main->context_state = CTX_PREPARE_FOR_IMCU; - if (*out_row_ctr >= out_rows_avail) - return; /* Postprocessor exactly filled output buf */ - /*FALLTHROUGH*/ - case CTX_PREPARE_FOR_IMCU: - /* Prepare to process first M-1 row groups of this iMCU row */ - main->rowgroup_ctr = 0; - main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1); - /* Check for bottom of image: if so, tweak pointers to "duplicate" - * the last sample row, and adjust rowgroups_avail to ignore padding rows. - */ - if (main->iMCU_row_ctr == cinfo->total_iMCU_rows) - set_bottom_pointers(cinfo); - main->context_state = CTX_PROCESS_IMCU; - /*FALLTHROUGH*/ - case CTX_PROCESS_IMCU: - /* Call postprocessor using previously set pointers */ - (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], - &main->rowgroup_ctr, main->rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); - if (main->rowgroup_ctr < main->rowgroups_avail) - return; /* Need to suspend */ - /* After the first iMCU, change wraparound pointers to normal state */ - if (main->iMCU_row_ctr == 1) - set_wraparound_pointers(cinfo); - /* Prepare to load new iMCU row using other xbuffer list */ - main->whichptr ^= 1; /* 0=>1 or 1=>0 */ - main->buffer_full = FALSE; - /* Still need to process last row group of this iMCU row, */ - /* which is saved at index M+1 of the other xbuffer */ - main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1); - main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2); - main->context_state = CTX_POSTPONED_ROW; - } -} - - -/* - * Process some data. - * Final pass of two-pass quantization: just call the postprocessor. - * Source data will be the postprocessor controller's internal buffer. - */ - -#ifdef QUANT_2PASS_SUPPORTED - -METHODDEF(void) -process_data_crank_post (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, - (JDIMENSION *) NULL, (JDIMENSION) 0, - output_buf, out_row_ctr, out_rows_avail); -} - -#endif /* QUANT_2PASS_SUPPORTED */ - - -/* - * Initialize main buffer controller. - */ - -GLOBAL(void) -jinit_d_main_controller (j_decompress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_main_ptr main; - int ci, rgroup, ngroups; - jpeg_component_info *compptr; - - main = (my_main_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); - cinfo->main = (struct jpeg_d_main_controller *) main; - main->pub.start_pass = start_pass_main; - - if (need_full_buffer) /* shouldn't happen */ - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - - /* Allocate the workspace. - * ngroups is the number of row groups we need. - */ - if (cinfo->upsample->need_context_rows) { - if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */ - ERREXIT(cinfo, JERR_NOTIMPL); - alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ - ngroups = cinfo->min_DCT_scaled_size + 2; - } else { - ngroups = cinfo->min_DCT_scaled_size; - } - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; /* height of a row group of component */ - main->buffer[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - compptr->width_in_blocks * compptr->DCT_scaled_size, - (JDIMENSION) (rgroup * ngroups)); - } -} - -#if defined(__VISAGECPP__) -# ifdef start_pass_main2 -# undef start_pass_main2 -# endif -# ifdef process_data_simple_main2 -# undef process_data_simple_main2 -# endif -#endif diff --git a/Source/3rdParty/wx/src/jpeg/jdmarker.c b/Source/3rdParty/wx/src/jpeg/jdmarker.c deleted file mode 100644 index 39bed5422..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdmarker.c +++ /dev/null @@ -1,1360 +0,0 @@ -/* - * jdmarker.c - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains routines to decode JPEG datastream markers. - * Most of the complexity arises from our desire to support input - * suspension: if not all of the data for a marker is available, - * we must exit back to the application. On resumption, we reprocess - * the marker. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -typedef enum { /* JPEG marker codes */ - M_SOF0 = 0xc0, - M_SOF1 = 0xc1, - M_SOF2 = 0xc2, - M_SOF3 = 0xc3, - - M_SOF5 = 0xc5, - M_SOF6 = 0xc6, - M_SOF7 = 0xc7, - - M_JPG = 0xc8, - M_SOF9 = 0xc9, - M_SOF10 = 0xca, - M_SOF11 = 0xcb, - - M_SOF13 = 0xcd, - M_SOF14 = 0xce, - M_SOF15 = 0xcf, - - M_DHT = 0xc4, - - M_DAC = 0xcc, - - M_RST0 = 0xd0, - M_RST1 = 0xd1, - M_RST2 = 0xd2, - M_RST3 = 0xd3, - M_RST4 = 0xd4, - M_RST5 = 0xd5, - M_RST6 = 0xd6, - M_RST7 = 0xd7, - - M_SOI = 0xd8, - M_EOI = 0xd9, - M_SOS = 0xda, - M_DQT = 0xdb, - M_DNL = 0xdc, - M_DRI = 0xdd, - M_DHP = 0xde, - M_EXP = 0xdf, - - M_APP0 = 0xe0, - M_APP1 = 0xe1, - M_APP2 = 0xe2, - M_APP3 = 0xe3, - M_APP4 = 0xe4, - M_APP5 = 0xe5, - M_APP6 = 0xe6, - M_APP7 = 0xe7, - M_APP8 = 0xe8, - M_APP9 = 0xe9, - M_APP10 = 0xea, - M_APP11 = 0xeb, - M_APP12 = 0xec, - M_APP13 = 0xed, - M_APP14 = 0xee, - M_APP15 = 0xef, - - M_JPG0 = 0xf0, - M_JPG13 = 0xfd, - M_COM = 0xfe, - - M_TEM = 0x01, - - M_ERROR = 0x100 -} JPEG_MARKER; - - -/* Private state */ - -typedef struct { - struct jpeg_marker_reader pub; /* public fields */ - - /* Application-overridable marker processing methods */ - jpeg_marker_parser_method process_COM; - jpeg_marker_parser_method process_APPn[16]; - - /* Limit on marker data length to save for each marker type */ - unsigned int length_limit_COM; - unsigned int length_limit_APPn[16]; - - /* Status of COM/APPn marker saving */ - jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */ - unsigned int bytes_read; /* data bytes read so far in marker */ - /* Note: cur_marker is not linked into marker_list until it's all read. */ -} my_marker_reader; - -typedef my_marker_reader * my_marker_ptr; - - -/* - * Macros for fetching data from the data source module. - * - * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect - * the current restart point; we update them only when we have reached a - * suitable place to restart if a suspension occurs. - */ - -/* Declare and initialize local copies of input pointer/count */ -#define INPUT_VARS(cinfo) \ - struct jpeg_source_mgr * datasrc = (cinfo)->src; \ - const JOCTET * next_input_byte = datasrc->next_input_byte; \ - size_t bytes_in_buffer = datasrc->bytes_in_buffer - -/* Unload the local copies --- do this only at a restart boundary */ -#define INPUT_SYNC(cinfo) \ - ( datasrc->next_input_byte = next_input_byte, \ - datasrc->bytes_in_buffer = bytes_in_buffer ) - -/* Reload the local copies --- used only in MAKE_BYTE_AVAIL */ -#define INPUT_RELOAD(cinfo) \ - ( next_input_byte = datasrc->next_input_byte, \ - bytes_in_buffer = datasrc->bytes_in_buffer ) - -/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available. - * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, - * but we must reload the local copies after a successful fill. - */ -#define MAKE_BYTE_AVAIL(cinfo,action) \ - if (bytes_in_buffer == 0) { \ - if (! (*datasrc->fill_input_buffer) (cinfo)) \ - { action; } \ - INPUT_RELOAD(cinfo); \ - } - -/* Read a byte into variable V. - * If must suspend, take the specified action (typically "return FALSE"). - */ -#define INPUT_BYTE(cinfo,V,action) \ - MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V = GETJOCTET(*next_input_byte++); ) - -/* As above, but read two bytes interpreted as an unsigned 16-bit integer. - * V should be declared unsigned int or perhaps INT32. - */ -#define INPUT_2BYTES(cinfo,V,action) \ - MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ - MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V += GETJOCTET(*next_input_byte++); ) - - -/* - * Routines to process JPEG markers. - * - * Entry condition: JPEG marker itself has been read and its code saved - * in cinfo->unread_marker; input restart point is just after the marker. - * - * Exit: if return TRUE, have read and processed any parameters, and have - * updated the restart point to point after the parameters. - * If return FALSE, was forced to suspend before reaching end of - * marker parameters; restart point has not been moved. Same routine - * will be called again after application supplies more input data. - * - * This approach to suspension assumes that all of a marker's parameters - * can fit into a single input bufferload. This should hold for "normal" - * markers. Some COM/APPn markers might have large parameter segments - * that might not fit. If we are simply dropping such a marker, we use - * skip_input_data to get past it, and thereby put the problem on the - * source manager's shoulders. If we are saving the marker's contents - * into memory, we use a slightly different convention: when forced to - * suspend, the marker processor updates the restart point to the end of - * what it's consumed (ie, the end of the buffer) before returning FALSE. - * On resumption, cinfo->unread_marker still contains the marker code, - * but the data source will point to the next chunk of marker data. - * The marker processor must retain internal state to deal with this. - * - * Note that we don't bother to avoid duplicate trace messages if a - * suspension occurs within marker parameters. Other side effects - * require more care. - */ - - -LOCAL(wxjpeg_boolean) -get_soi (j_decompress_ptr cinfo) -/* Process an SOI marker */ -{ - int i; - - TRACEMS(cinfo, 1, JTRC_SOI); - - if (cinfo->marker->saw_SOI) - ERREXIT(cinfo, JERR_SOI_DUPLICATE); - - /* Reset all parameters that are defined to be reset by SOI */ - - for (i = 0; i < NUM_ARITH_TBLS; i++) { - cinfo->arith_dc_L[i] = 0; - cinfo->arith_dc_U[i] = 1; - cinfo->arith_ac_K[i] = 5; - } - cinfo->restart_interval = 0; - - /* Set initial assumptions for colorspace etc */ - - cinfo->jpeg_color_space = JCS_UNKNOWN; - cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */ - - cinfo->saw_JFIF_marker = FALSE; - cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */ - cinfo->JFIF_minor_version = 1; - cinfo->density_unit = 0; - cinfo->X_density = 1; - cinfo->Y_density = 1; - cinfo->saw_Adobe_marker = FALSE; - cinfo->Adobe_transform = 0; - - cinfo->marker->saw_SOI = TRUE; - - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -get_sof (j_decompress_ptr cinfo, wxjpeg_boolean is_prog, wxjpeg_boolean is_arith) -/* Process a SOFn marker */ -{ - JPEG_INT32 length; - int c, ci; - jpeg_component_info * compptr; - INPUT_VARS(cinfo); - - cinfo->progressive_mode = is_prog; - cinfo->arith_code = is_arith; - - INPUT_2BYTES(cinfo, length, return FALSE); - - INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE); - INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE); - INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE); - INPUT_BYTE(cinfo, cinfo->num_components, return FALSE); - - length -= 8; - - TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker, - (int) cinfo->image_width, (int) cinfo->image_height, - cinfo->num_components); - - if (cinfo->marker->saw_SOF) - ERREXIT(cinfo, JERR_SOF_DUPLICATE); - - /* We don't support files in which the image height is initially specified */ - /* as 0 and is later redefined by DNL. As long as we have to check that, */ - /* might as well have a general sanity check. */ - if (cinfo->image_height <= 0 || cinfo->image_width <= 0 - || cinfo->num_components <= 0) - ERREXIT(cinfo, JERR_EMPTY_IMAGE); - - if (length != (cinfo->num_components * 3)) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - if (cinfo->comp_info == NULL) /* do only once, even if suspend */ - cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * SIZEOF(jpeg_component_info)); - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - compptr->component_index = ci; - INPUT_BYTE(cinfo, compptr->component_id, return FALSE); - INPUT_BYTE(cinfo, c, return FALSE); - compptr->h_samp_factor = (c >> 4) & 15; - compptr->v_samp_factor = (c ) & 15; - INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE); - - TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, - compptr->component_id, compptr->h_samp_factor, - compptr->v_samp_factor, compptr->quant_tbl_no); - } - - cinfo->marker->saw_SOF = TRUE; - - INPUT_SYNC(cinfo); - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -get_sos (j_decompress_ptr cinfo) -/* Process a SOS marker */ -{ - JPEG_INT32 length; - int i, ci, n, c, cc; - jpeg_component_info * compptr; - INPUT_VARS(cinfo); - - if (! cinfo->marker->saw_SOF) - ERREXIT(cinfo, JERR_SOS_NO_SOF); - - INPUT_2BYTES(cinfo, length, return FALSE); - - INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */ - - TRACEMS1(cinfo, 1, JTRC_SOS, n); - - if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - cinfo->comps_in_scan = n; - - /* Collect the component-spec parameters */ - - for (i = 0; i < n; i++) { - INPUT_BYTE(cinfo, cc, return FALSE); - INPUT_BYTE(cinfo, c, return FALSE); - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (cc == compptr->component_id) - goto id_found; - } - - ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); - - id_found: - - cinfo->cur_comp_info[i] = compptr; - compptr->dc_tbl_no = (c >> 4) & 15; - compptr->ac_tbl_no = (c ) & 15; - - TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, - compptr->dc_tbl_no, compptr->ac_tbl_no); - } - - /* Collect the additional scan parameters Ss, Se, Ah/Al. */ - INPUT_BYTE(cinfo, c, return FALSE); - cinfo->Ss = c; - INPUT_BYTE(cinfo, c, return FALSE); - cinfo->Se = c; - INPUT_BYTE(cinfo, c, return FALSE); - cinfo->Ah = (c >> 4) & 15; - cinfo->Al = (c ) & 15; - - TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, - cinfo->Ah, cinfo->Al); - - /* Prepare to scan data & restart markers */ - cinfo->marker->next_restart_num = 0; - - /* Count another SOS marker */ - cinfo->input_scan_number++; - - INPUT_SYNC(cinfo); - return TRUE; -} - - -#ifdef D_ARITH_CODING_SUPPORTED - -LOCAL(wxjpeg_boolean) -get_dac (j_decompress_ptr cinfo) -/* Process a DAC marker */ -{ - JPEG_INT32 length; - int index, val; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - - while (length > 0) { - INPUT_BYTE(cinfo, index, return FALSE); - INPUT_BYTE(cinfo, val, return FALSE); - - length -= 2; - - TRACEMS2(cinfo, 1, JTRC_DAC, index, val); - - if (index < 0 || index >= (2*NUM_ARITH_TBLS)) - ERREXIT1(cinfo, JERR_DAC_INDEX, index); - - if (index >= NUM_ARITH_TBLS) { /* define AC table */ - cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; - } else { /* define DC table */ - cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); - cinfo->arith_dc_U[index] = (UINT8) (val >> 4); - if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) - ERREXIT1(cinfo, JERR_DAC_VALUE, val); - } - } - - if (length != 0) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - INPUT_SYNC(cinfo); - return TRUE; -} - -#else /* ! D_ARITH_CODING_SUPPORTED */ - -#define get_dac(cinfo) skip_variable(cinfo) - -#endif /* D_ARITH_CODING_SUPPORTED */ - - -LOCAL(wxjpeg_boolean) -get_dht (j_decompress_ptr cinfo) -/* Process a DHT marker */ -{ - JPEG_INT32 length; - UINT8 bits[17]; - UINT8 huffval[256]; - int i, index, count; - JHUFF_TBL **htblptr; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - - while (length > 16) { - INPUT_BYTE(cinfo, index, return FALSE); - - TRACEMS1(cinfo, 1, JTRC_DHT, index); - - bits[0] = 0; - count = 0; - for (i = 1; i <= 16; i++) { - INPUT_BYTE(cinfo, bits[i], return FALSE); - count += bits[i]; - } - - length -= 1 + 16; - - TRACEMS8(cinfo, 2, JTRC_HUFFBITS, - bits[1], bits[2], bits[3], bits[4], - bits[5], bits[6], bits[7], bits[8]); - TRACEMS8(cinfo, 2, JTRC_HUFFBITS, - bits[9], bits[10], bits[11], bits[12], - bits[13], bits[14], bits[15], bits[16]); - - /* Here we just do minimal validation of the counts to avoid walking - * off the end of our table space. jdhuff.c will check more carefully. - */ - if (count > 256 || ((JPEG_INT32) count) > length) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - - for (i = 0; i < count; i++) - INPUT_BYTE(cinfo, huffval[i], return FALSE); - - length -= count; - - if (index & 0x10) { /* AC table definition */ - index -= 0x10; - htblptr = &cinfo->ac_huff_tbl_ptrs[index]; - } else { /* DC table definition */ - htblptr = &cinfo->dc_huff_tbl_ptrs[index]; - } - - if (index < 0 || index >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_DHT_INDEX, index); - - if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - - MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); - MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); - } - - if (length != 0) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - INPUT_SYNC(cinfo); - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -get_dqt (j_decompress_ptr cinfo) -/* Process a DQT marker */ -{ - JPEG_INT32 length; - int n, i, prec; - unsigned int tmp; - JQUANT_TBL *quant_ptr; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - - while (length > 0) { - INPUT_BYTE(cinfo, n, return FALSE); - prec = n >> 4; - n &= 0x0F; - - TRACEMS2(cinfo, 1, JTRC_DQT, n, prec); - - if (n >= NUM_QUANT_TBLS) - ERREXIT1(cinfo, JERR_DQT_INDEX, n); - - if (cinfo->quant_tbl_ptrs[n] == NULL) - cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); - quant_ptr = cinfo->quant_tbl_ptrs[n]; - - for (i = 0; i < DCTSIZE2; i++) { - if (prec) - INPUT_2BYTES(cinfo, tmp, return FALSE); - else - INPUT_BYTE(cinfo, tmp, return FALSE); - /* We convert the zigzag-order table to natural array order. */ - quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; - } - - if (cinfo->err->trace_level >= 2) { - for (i = 0; i < DCTSIZE2; i += 8) { - TRACEMS8(cinfo, 2, JTRC_QUANTVALS, - quant_ptr->quantval[i], quant_ptr->quantval[i+1], - quant_ptr->quantval[i+2], quant_ptr->quantval[i+3], - quant_ptr->quantval[i+4], quant_ptr->quantval[i+5], - quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]); - } - } - - length -= DCTSIZE2+1; - if (prec) length -= DCTSIZE2; - } - - if (length != 0) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - INPUT_SYNC(cinfo); - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -get_dri (j_decompress_ptr cinfo) -/* Process a DRI marker */ -{ - JPEG_INT32 length; - unsigned int tmp; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - - if (length != 4) - ERREXIT(cinfo, JERR_BAD_LENGTH); - - INPUT_2BYTES(cinfo, tmp, return FALSE); - - TRACEMS1(cinfo, 1, JTRC_DRI, tmp); - - cinfo->restart_interval = tmp; - - INPUT_SYNC(cinfo); - return TRUE; -} - - -/* - * Routines for processing APPn and COM markers. - * These are either saved in memory or discarded, per application request. - * APP0 and APP14 are specially checked to see if they are - * JFIF and Adobe markers, respectively. - */ - -#define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */ -#define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */ -#define APPN_DATA_LEN 14 /* Must be the largest of the above!! */ - - -LOCAL(void) -examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, JPEG_INT32 remaining) -/* Examine first few bytes from an APP0. - * Take appropriate action if it is a JFIF marker. - * datalen is # of bytes at data[], remaining is length of rest of marker data. - */ -{ - JPEG_INT32 totallen = (JPEG_INT32) datalen + remaining; - - if (datalen >= APP0_DATA_LEN && - GETJOCTET(data[0]) == 0x4A && - GETJOCTET(data[1]) == 0x46 && - GETJOCTET(data[2]) == 0x49 && - GETJOCTET(data[3]) == 0x46 && - GETJOCTET(data[4]) == 0) { - /* Found JFIF APP0 marker: save info */ - cinfo->saw_JFIF_marker = TRUE; - cinfo->JFIF_major_version = GETJOCTET(data[5]); - cinfo->JFIF_minor_version = GETJOCTET(data[6]); - cinfo->density_unit = GETJOCTET(data[7]); - cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]); - cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]); - /* Check version. - * Major version must be 1, anything else signals an incompatible change. - * (We used to treat this as an error, but now it's a nonfatal warning, - * because some bozo at Hijaak couldn't read the spec.) - * Minor version should be 0..2, but process anyway if newer. - */ - if (cinfo->JFIF_major_version != 1) - WARNMS2(cinfo, JWRN_JFIF_MAJOR, - cinfo->JFIF_major_version, cinfo->JFIF_minor_version); - /* Generate trace messages */ - TRACEMS5(cinfo, 1, JTRC_JFIF, - cinfo->JFIF_major_version, cinfo->JFIF_minor_version, - cinfo->X_density, cinfo->Y_density, cinfo->density_unit); - /* Validate thumbnail dimensions and issue appropriate messages */ - if (GETJOCTET(data[12]) | GETJOCTET(data[13])) - TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, - GETJOCTET(data[12]), GETJOCTET(data[13])); - totallen -= APP0_DATA_LEN; - if (totallen != - ((JPEG_INT32)GETJOCTET(data[12]) * (JPEG_INT32)GETJOCTET(data[13]) * (JPEG_INT32) 3)) - TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); - } else if (datalen >= 6 && - GETJOCTET(data[0]) == 0x4A && - GETJOCTET(data[1]) == 0x46 && - GETJOCTET(data[2]) == 0x58 && - GETJOCTET(data[3]) == 0x58 && - GETJOCTET(data[4]) == 0) { - /* Found JFIF "JFXX" extension APP0 marker */ - /* The library doesn't actually do anything with these, - * but we try to produce a helpful trace message. - */ - switch (GETJOCTET(data[5])) { - case 0x10: - TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); - break; - case 0x11: - TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); - break; - case 0x13: - TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); - break; - default: - TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, - GETJOCTET(data[5]), (int) totallen); - break; - } - } else { - /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ - TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); - } -} - - -LOCAL(void) -examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, JPEG_INT32 remaining) -/* Examine first few bytes from an APP14. - * Take appropriate action if it is an Adobe marker. - * datalen is # of bytes at data[], remaining is length of rest of marker data. - */ -{ - unsigned int version, flags0, flags1, transform; - - if (datalen >= APP14_DATA_LEN && - GETJOCTET(data[0]) == 0x41 && - GETJOCTET(data[1]) == 0x64 && - GETJOCTET(data[2]) == 0x6F && - GETJOCTET(data[3]) == 0x62 && - GETJOCTET(data[4]) == 0x65) { - /* Found Adobe APP14 marker */ - version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]); - flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]); - flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]); - transform = GETJOCTET(data[11]); - TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); - cinfo->saw_Adobe_marker = TRUE; - cinfo->Adobe_transform = (UINT8) transform; - } else { - /* Start of APP14 does not match "Adobe", or too short */ - TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); - } -} - - -METHODDEF(wxjpeg_boolean) -get_interesting_appn (j_decompress_ptr cinfo) -/* Process an APP0 or APP14 marker without saving it */ -{ - JPEG_INT32 length; - JOCTET b[APPN_DATA_LEN]; - unsigned int i, numtoread; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - - /* get the interesting part of the marker data */ - if (length >= APPN_DATA_LEN) - numtoread = APPN_DATA_LEN; - else if (length > 0) - numtoread = (unsigned int) length; - else - numtoread = 0; - for (i = 0; i < numtoread; i++) - INPUT_BYTE(cinfo, b[i], return FALSE); - length -= numtoread; - - /* process it */ - switch (cinfo->unread_marker) { - case M_APP0: - examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length); - break; - case M_APP14: - examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length); - break; - default: - /* can't get here unless jpeg_save_markers chooses wrong processor */ - ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); - break; - } - - /* skip any remaining data -- could be lots */ - INPUT_SYNC(cinfo); - if (length > 0) - (*cinfo->src->skip_input_data) (cinfo, (long) length); - - return TRUE; -} - - -#ifdef SAVE_MARKERS_SUPPORTED - -METHODDEF(wxjpeg_boolean) -save_marker (j_decompress_ptr cinfo) -/* Save an APPn or COM marker into the marker list */ -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - jpeg_saved_marker_ptr cur_marker = marker->cur_marker; - unsigned int bytes_read, data_length; - JOCTET FAR * data; - JPEG_INT32 length = 0; - INPUT_VARS(cinfo); - - if (cur_marker == NULL) { - /* begin reading a marker */ - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - if (length >= 0) { /* watch out for bogus length word */ - /* figure out how much we want to save */ - unsigned int limit; - if (cinfo->unread_marker == (int) M_COM) - limit = marker->length_limit_COM; - else - limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; - if ((unsigned int) length < limit) - limit = (unsigned int) length; - /* allocate and initialize the marker item */ - cur_marker = (jpeg_saved_marker_ptr) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(struct jpeg_marker_struct) + limit); - cur_marker->next = NULL; - cur_marker->marker = (UINT8) cinfo->unread_marker; - cur_marker->original_length = (unsigned int) length; - cur_marker->data_length = limit; - /* data area is just beyond the jpeg_marker_struct */ - data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1); - marker->cur_marker = cur_marker; - marker->bytes_read = 0; - bytes_read = 0; - data_length = limit; - } else { - /* deal with bogus length word */ - bytes_read = data_length = 0; - data = NULL; - } - } else { - /* resume reading a marker */ - bytes_read = marker->bytes_read; - data_length = cur_marker->data_length; - data = cur_marker->data + bytes_read; - } - - while (bytes_read < data_length) { - INPUT_SYNC(cinfo); /* move the restart point to here */ - marker->bytes_read = bytes_read; - /* If there's not at least one byte in buffer, suspend */ - MAKE_BYTE_AVAIL(cinfo, return FALSE); - /* Copy bytes with reasonable rapidity */ - while (bytes_read < data_length && bytes_in_buffer > 0) { - *data++ = *next_input_byte++; - bytes_in_buffer--; - bytes_read++; - } - } - - /* Done reading what we want to read */ - if (cur_marker != NULL) { /* will be NULL if bogus length word */ - /* Add new marker to end of list */ - if (cinfo->marker_list == NULL) { - cinfo->marker_list = cur_marker; - } else { - jpeg_saved_marker_ptr prev = cinfo->marker_list; - while (prev->next != NULL) - prev = prev->next; - prev->next = cur_marker; - } - /* Reset pointer & calc remaining data length */ - data = cur_marker->data; - length = cur_marker->original_length - data_length; - } - /* Reset to initial state for next marker */ - marker->cur_marker = NULL; - - /* Process the marker if interesting; else just make a generic trace msg */ - switch (cinfo->unread_marker) { - case M_APP0: - examine_app0(cinfo, data, data_length, length); - break; - case M_APP14: - examine_app14(cinfo, data, data_length, length); - break; - default: - TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, - (int) (data_length + length)); - break; - } - - /* skip any remaining data -- could be lots */ - INPUT_SYNC(cinfo); /* do before skip_input_data */ - if (length > 0) - (*cinfo->src->skip_input_data) (cinfo, (long) length); - - return TRUE; -} - -#endif /* SAVE_MARKERS_SUPPORTED */ - - -METHODDEF(wxjpeg_boolean) -skip_variable (j_decompress_ptr cinfo) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - JPEG_INT32 length; - INPUT_VARS(cinfo); - - INPUT_2BYTES(cinfo, length, return FALSE); - length -= 2; - - TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); - - INPUT_SYNC(cinfo); /* do before skip_input_data */ - if (length > 0) - (*cinfo->src->skip_input_data) (cinfo, (long) length); - - return TRUE; -} - - -/* - * Find the next JPEG marker, save it in cinfo->unread_marker. - * Returns FALSE if had to suspend before reaching a marker; - * in that case cinfo->unread_marker is unchanged. - * - * Note that the result might not be a valid marker code, - * but it will never be 0 or FF. - */ - -LOCAL(wxjpeg_boolean) -next_marker (j_decompress_ptr cinfo) -{ - int c; - INPUT_VARS(cinfo); - - for (;;) { - INPUT_BYTE(cinfo, c, return FALSE); - /* Skip any non-FF bytes. - * This may look a bit inefficient, but it will not occur in a valid file. - * We sync after each discarded byte so that a suspending data source - * can discard the byte from its buffer. - */ - while (c != 0xFF) { - cinfo->marker->discarded_bytes++; - INPUT_SYNC(cinfo); - INPUT_BYTE(cinfo, c, return FALSE); - } - /* This loop swallows any duplicate FF bytes. Extra FFs are legal as - * pad bytes, so don't count them in discarded_bytes. We assume there - * will not be so many consecutive FF bytes as to overflow a suspending - * data source's input buffer. - */ - do { - INPUT_BYTE(cinfo, c, return FALSE); - } while (c == 0xFF); - if (c != 0) - break; /* found a valid marker, exit loop */ - /* Reach here if we found a stuffed-zero data sequence (FF/00). - * Discard it and loop back to try again. - */ - cinfo->marker->discarded_bytes += 2; - INPUT_SYNC(cinfo); - } - - if (cinfo->marker->discarded_bytes != 0) { - WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c); - cinfo->marker->discarded_bytes = 0; - } - - cinfo->unread_marker = c; - - INPUT_SYNC(cinfo); - return TRUE; -} - - -LOCAL(wxjpeg_boolean) -first_marker (j_decompress_ptr cinfo) -/* Like next_marker, but used to obtain the initial SOI marker. */ -/* For this marker, we do not allow preceding garbage or fill; otherwise, - * we might well scan an entire input file before realizing it ain't JPEG. - * If an application wants to process non-JFIF files, it must seek to the - * SOI before calling the JPEG library. - */ -{ - int c, c2; - INPUT_VARS(cinfo); - - INPUT_BYTE(cinfo, c, return FALSE); - INPUT_BYTE(cinfo, c2, return FALSE); - if (c != 0xFF || c2 != (int) M_SOI) - ERREXIT2(cinfo, JERR_NO_SOI, c, c2); - - cinfo->unread_marker = c2; - - INPUT_SYNC(cinfo); - return TRUE; -} - - -/* - * Read markers until SOS or EOI. - * - * Returns same codes as are defined for jpeg_consume_input: - * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. - */ - -METHODDEF(int) -read_markers (j_decompress_ptr cinfo) -{ - /* Outer loop repeats once for each marker. */ - for (;;) { - /* Collect the marker proper, unless we already did. */ - /* NB: first_marker() enforces the requirement that SOI appear first. */ - if (cinfo->unread_marker == 0) { - if (! cinfo->marker->saw_SOI) { - if (! first_marker(cinfo)) - return JPEG_SUSPENDED; - } else { - if (! next_marker(cinfo)) - return JPEG_SUSPENDED; - } - } - /* At this point cinfo->unread_marker contains the marker code and the - * input point is just past the marker proper, but before any parameters. - * A suspension will cause us to return with this state still true. - */ - switch (cinfo->unread_marker) { - case M_SOI: - if (! get_soi(cinfo)) - return JPEG_SUSPENDED; - break; - - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - if (! get_sof(cinfo, FALSE, FALSE)) - return JPEG_SUSPENDED; - break; - - case M_SOF2: /* Progressive, Huffman */ - if (! get_sof(cinfo, TRUE, FALSE)) - return JPEG_SUSPENDED; - break; - - case M_SOF9: /* Extended sequential, arithmetic */ - if (! get_sof(cinfo, FALSE, TRUE)) - return JPEG_SUSPENDED; - break; - - case M_SOF10: /* Progressive, arithmetic */ - if (! get_sof(cinfo, TRUE, TRUE)) - return JPEG_SUSPENDED; - break; - - /* Currently unsupported SOFn types */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_JPG: /* Reserved for JPEG extensions */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker); - break; - - case M_SOS: - if (! get_sos(cinfo)) - return JPEG_SUSPENDED; - cinfo->unread_marker = 0; /* processed the marker */ - return JPEG_REACHED_SOS; - - case M_EOI: - TRACEMS(cinfo, 1, JTRC_EOI); - cinfo->unread_marker = 0; /* processed the marker */ - return JPEG_REACHED_EOI; - - case M_DAC: - if (! get_dac(cinfo)) - return JPEG_SUSPENDED; - break; - - case M_DHT: - if (! get_dht(cinfo)) - return JPEG_SUSPENDED; - break; - - case M_DQT: - if (! get_dqt(cinfo)) - return JPEG_SUSPENDED; - break; - - case M_DRI: - if (! get_dri(cinfo)) - return JPEG_SUSPENDED; - break; - - case M_APP0: - case M_APP1: - case M_APP2: - case M_APP3: - case M_APP4: - case M_APP5: - case M_APP6: - case M_APP7: - case M_APP8: - case M_APP9: - case M_APP10: - case M_APP11: - case M_APP12: - case M_APP13: - case M_APP14: - case M_APP15: - if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ - cinfo->unread_marker - (int) M_APP0]) (cinfo)) - return JPEG_SUSPENDED; - break; - - case M_COM: - if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) - return JPEG_SUSPENDED; - break; - - case M_RST0: /* these are all parameterless */ - case M_RST1: - case M_RST2: - case M_RST3: - case M_RST4: - case M_RST5: - case M_RST6: - case M_RST7: - case M_TEM: - TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker); - break; - - case M_DNL: /* Ignore DNL ... perhaps the wrong thing */ - if (! skip_variable(cinfo)) - return JPEG_SUSPENDED; - break; - - default: /* must be DHP, EXP, JPGn, or RESn */ - /* For now, we treat the reserved markers as fatal errors since they are - * likely to be used to signal incompatible JPEG Part 3 extensions. - * Once the JPEG 3 version-number marker is well defined, this code - * ought to change! - */ - ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); - break; - } - /* Successfully processed marker, so reset state variable */ - cinfo->unread_marker = 0; - } /* end loop */ -} - - -/* - * Read a restart marker, which is expected to appear next in the datastream; - * if the marker is not there, take appropriate recovery action. - * Returns FALSE if suspension is required. - * - * This is called by the entropy decoder after it has read an appropriate - * number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder - * has already read a marker from the data source. Under normal conditions - * cinfo->unread_marker will be reset to 0 before returning; if not reset, - * it holds a marker which the decoder will be unable to read past. - */ - -METHODDEF(wxjpeg_boolean) -read_restart_marker (j_decompress_ptr cinfo) -{ - /* Obtain a marker unless we already did. */ - /* Note that next_marker will complain if it skips any data. */ - if (cinfo->unread_marker == 0) { - if (! next_marker(cinfo)) - return FALSE; - } - - if (cinfo->unread_marker == - ((int) M_RST0 + cinfo->marker->next_restart_num)) { - /* Normal case --- swallow the marker and let entropy decoder continue */ - TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num); - cinfo->unread_marker = 0; - } else { - /* Uh-oh, the restart markers have been messed up. */ - /* Let the data source manager determine how to resync. */ - if (! (*cinfo->src->resync_to_restart) (cinfo, - cinfo->marker->next_restart_num)) - return FALSE; - } - - /* Update next-restart state */ - cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7; - - return TRUE; -} - - -/* - * This is the default resync_to_restart method for data source managers - * to use if they don't have any better approach. Some data source managers - * may be able to back up, or may have additional knowledge about the data - * which permits a more intelligent recovery strategy; such managers would - * presumably supply their own resync method. - * - * read_restart_marker calls resync_to_restart if it finds a marker other than - * the restart marker it was expecting. (This code is *not* used unless - * a nonzero restart interval has been declared.) cinfo->unread_marker is - * the marker code actually found (might be anything, except 0 or FF). - * The desired restart marker number (0..7) is passed as a parameter. - * This routine is supposed to apply whatever error recovery strategy seems - * appropriate in order to position the input stream to the next data segment. - * Note that cinfo->unread_marker is treated as a marker appearing before - * the current data-source input point; usually it should be reset to zero - * before returning. - * Returns FALSE if suspension is required. - * - * This implementation is substantially constrained by wanting to treat the - * input as a data stream; this means we can't back up. Therefore, we have - * only the following actions to work with: - * 1. Simply discard the marker and let the entropy decoder resume at next - * byte of file. - * 2. Read forward until we find another marker, discarding intervening - * data. (In theory we could look ahead within the current bufferload, - * without having to discard data if we don't find the desired marker. - * This idea is not implemented here, in part because it makes behavior - * dependent on buffer size and chance buffer-boundary positions.) - * 3. Leave the marker unread (by failing to zero cinfo->unread_marker). - * This will cause the entropy decoder to process an empty data segment, - * inserting dummy zeroes, and then we will reprocess the marker. - * - * #2 is appropriate if we think the desired marker lies ahead, while #3 is - * appropriate if the found marker is a future restart marker (indicating - * that we have missed the desired restart marker, probably because it got - * corrupted). - * We apply #2 or #3 if the found marker is a restart marker no more than - * two counts behind or ahead of the expected one. We also apply #2 if the - * found marker is not a legal JPEG marker code (it's certainly bogus data). - * If the found marker is a restart marker more than 2 counts away, we do #1 - * (too much risk that the marker is erroneous; with luck we will be able to - * resync at some future point). - * For any valid non-restart JPEG marker, we apply #3. This keeps us from - * overrunning the end of a scan. An implementation limited to single-scan - * files might find it better to apply #2 for markers other than EOI, since - * any other marker would have to be bogus data in that case. - */ - -GLOBAL(wxjpeg_boolean) -jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) -{ - int marker = cinfo->unread_marker; - int action = 1; - - /* Always put up a warning. */ - WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); - - /* Outer loop handles repeated decision after scanning forward. */ - for (;;) { - if (marker < (int) M_SOF0) - action = 2; /* invalid marker */ - else if (marker < (int) M_RST0 || marker > (int) M_RST7) - action = 3; /* valid non-restart marker */ - else { - if (marker == ((int) M_RST0 + ((desired+1) & 7)) || - marker == ((int) M_RST0 + ((desired+2) & 7))) - action = 3; /* one of the next two expected restarts */ - else if (marker == ((int) M_RST0 + ((desired-1) & 7)) || - marker == ((int) M_RST0 + ((desired-2) & 7))) - action = 2; /* a prior restart, so advance */ - else - action = 1; /* desired restart or too far away */ - } - TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action); - switch (action) { - case 1: - /* Discard marker and let entropy decoder resume processing. */ - cinfo->unread_marker = 0; - return TRUE; - case 2: - /* Scan to the next marker, and repeat the decision loop. */ - if (! next_marker(cinfo)) - return FALSE; - marker = cinfo->unread_marker; - break; - case 3: - /* Return without advancing past this marker. */ - /* Entropy decoder will be forced to process an empty segment. */ - return TRUE; - } - } /* end loop */ -} - - -/* - * Reset marker processing state to begin a fresh datastream. - */ - -METHODDEF(void) -reset_marker_reader (j_decompress_ptr cinfo) -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - - cinfo->comp_info = NULL; /* until allocated by get_sof */ - cinfo->input_scan_number = 0; /* no SOS seen yet */ - cinfo->unread_marker = 0; /* no pending marker */ - marker->pub.saw_SOI = FALSE; /* set internal state too */ - marker->pub.saw_SOF = FALSE; - marker->pub.discarded_bytes = 0; - marker->cur_marker = NULL; -} - - -/* - * Initialize the marker reader module. - * This is called only once, when the decompression object is created. - */ - -GLOBAL(void) -jinit_marker_reader (j_decompress_ptr cinfo) -{ - my_marker_ptr marker; - int i; - - /* Create subobject in permanent pool */ - marker = (my_marker_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_marker_reader)); - cinfo->marker = (struct jpeg_marker_reader *) marker; - /* Initialize public method pointers */ - marker->pub.reset_marker_reader = reset_marker_reader; - marker->pub.read_markers = read_markers; - marker->pub.read_restart_marker = read_restart_marker; - /* Initialize COM/APPn processing. - * By default, we examine and then discard APP0 and APP14, - * but simply discard COM and all other APPn. - */ - marker->process_COM = skip_variable; - marker->length_limit_COM = 0; - for (i = 0; i < 16; i++) { - marker->process_APPn[i] = skip_variable; - marker->length_limit_APPn[i] = 0; - } - marker->process_APPn[0] = get_interesting_appn; - marker->process_APPn[14] = get_interesting_appn; - /* Reset marker processing state */ - reset_marker_reader(cinfo); -} - - -/* - * Control saving of COM and APPn markers into marker_list. - */ - -#ifdef SAVE_MARKERS_SUPPORTED - -GLOBAL(void) -jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit) -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - long maxlength; - jpeg_marker_parser_method processor; - - /* Length limit mustn't be larger than what we can allocate - * (should only be a concern in a 16-bit environment). - */ - maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct); - if (((long) length_limit) > maxlength) - length_limit = (unsigned int) maxlength; - - /* Choose processor routine to use. - * APP0/APP14 have special requirements. - */ - if (length_limit) { - processor = save_marker; - /* If saving APP0/APP14, save at least enough for our internal use. */ - if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN) - length_limit = APP0_DATA_LEN; - else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN) - length_limit = APP14_DATA_LEN; - } else { - processor = skip_variable; - /* If discarding APP0/APP14, use our regular on-the-fly processor. */ - if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14) - processor = get_interesting_appn; - } - - if (marker_code == (int) M_COM) { - marker->process_COM = processor; - marker->length_limit_COM = length_limit; - } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) { - marker->process_APPn[marker_code - (int) M_APP0] = processor; - marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit; - } else - ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); -} - -#endif /* SAVE_MARKERS_SUPPORTED */ - - -/* - * Install a special processing method for COM or APPn markers. - */ - -GLOBAL(void) -jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, - jpeg_marker_parser_method routine) -{ - my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - - if (marker_code == (int) M_COM) - marker->process_COM = routine; - else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) - marker->process_APPn[marker_code - (int) M_APP0] = routine; - else - ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); -} diff --git a/Source/3rdParty/wx/src/jpeg/jdmaster.c b/Source/3rdParty/wx/src/jpeg/jdmaster.c deleted file mode 100644 index d68747631..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdmaster.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * jdmaster.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains master control logic for the JPEG decompressor. - * These routines are concerned with selecting the modules to be executed - * and with determining the number of passes and the work to be done in each - * pass. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -/* Private state */ - -typedef struct { - struct jpeg_decomp_master pub; /* public fields */ - - int pass_number; /* # of passes completed */ - - wxjpeg_boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ - - /* Saved references to initialized quantizer modules, - * in case we need to switch modes. - */ - struct jpeg_color_quantizer * quantizer_1pass; - struct jpeg_color_quantizer * quantizer_2pass; -} my_decomp_master; - -typedef my_decomp_master * my_master_ptr; - - -/* - * Determine whether merged upsample/color conversion should be used. - * CRUCIAL: this must match the actual capabilities of jdmerge.c! - */ - -LOCAL(wxjpeg_boolean) -use_merged_upsample (j_decompress_ptr cinfo) -{ -#ifdef UPSAMPLE_MERGING_SUPPORTED - /* Merging is the equivalent of plain box-filter upsampling */ - if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) - return FALSE; - /* jdmerge.c only supports YCC=>RGB color conversion */ - if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || - cinfo->out_color_space != JCS_RGB || - cinfo->out_color_components != RGB_PIXELSIZE) - return FALSE; - /* and it only handles 2h1v or 2h2v sampling ratios */ - if (cinfo->comp_info[0].h_samp_factor != 2 || - cinfo->comp_info[1].h_samp_factor != 1 || - cinfo->comp_info[2].h_samp_factor != 1 || - cinfo->comp_info[0].v_samp_factor > 2 || - cinfo->comp_info[1].v_samp_factor != 1 || - cinfo->comp_info[2].v_samp_factor != 1) - return FALSE; - /* furthermore, it doesn't work if we've scaled the IDCTs differently */ - if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || - cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || - cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) - return FALSE; - /* ??? also need to test for upsample-time rescaling, when & if supported */ - return TRUE; /* by golly, it'll work... */ -#else - return FALSE; -#endif -} - - -/* - * Compute output image dimensions and related values. - * NOTE: this is exported for possible use by application. - * Hence it mustn't do anything that can't be done twice. - * Also note that it may be called before the master module is initialized! - */ - -GLOBAL(void) -jpeg_calc_output_dimensions (j_decompress_ptr cinfo) -/* Do computations that are needed before master selection phase */ -{ -#ifdef IDCT_SCALING_SUPPORTED - int ci; - jpeg_component_info *compptr; -#endif - - /* Prevent application from calling me at wrong times */ - if (cinfo->global_state != DSTATE_READY) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - -#ifdef IDCT_SCALING_SUPPORTED - - /* Compute actual output image dimensions and DCT scaling choices. */ - if (cinfo->scale_num * 8 <= cinfo->scale_denom) { - /* Provide 1/8 scaling */ - cinfo->output_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width, 8L); - cinfo->output_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, 8L); - cinfo->min_DCT_scaled_size = 1; - } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) { - /* Provide 1/4 scaling */ - cinfo->output_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width, 4L); - cinfo->output_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, 4L); - cinfo->min_DCT_scaled_size = 2; - } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) { - /* Provide 1/2 scaling */ - cinfo->output_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width, 2L); - cinfo->output_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height, 2L); - cinfo->min_DCT_scaled_size = 4; - } else { - /* Provide 1/1 scaling */ - cinfo->output_width = cinfo->image_width; - cinfo->output_height = cinfo->image_height; - cinfo->min_DCT_scaled_size = DCTSIZE; - } - /* In selecting the actual DCT scaling for each component, we try to - * scale up the chroma components via IDCT scaling rather than upsampling. - * This saves time if the upsampler gets to use 1:1 scaling. - * Note this code assumes that the supported DCT scalings are powers of 2. - */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - int ssize = cinfo->min_DCT_scaled_size; - while (ssize < DCTSIZE && - (compptr->h_samp_factor * ssize * 2 <= - cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) && - (compptr->v_samp_factor * ssize * 2 <= - cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) { - ssize = ssize * 2; - } - compptr->DCT_scaled_size = ssize; - } - - /* Recompute downsampled dimensions of components; - * application needs to know these if using raw downsampled data. - */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Size in samples, after IDCT scaling */ - compptr->downsampled_width = (JDIMENSION) - jdiv_round_up((long) cinfo->image_width * - (long) (compptr->h_samp_factor * compptr->DCT_scaled_size), - (long) (cinfo->max_h_samp_factor * DCTSIZE)); - compptr->downsampled_height = (JDIMENSION) - jdiv_round_up((long) cinfo->image_height * - (long) (compptr->v_samp_factor * compptr->DCT_scaled_size), - (long) (cinfo->max_v_samp_factor * DCTSIZE)); - } - -#else /* !IDCT_SCALING_SUPPORTED */ - - /* Hardwire it to "no scaling" */ - cinfo->output_width = cinfo->image_width; - cinfo->output_height = cinfo->image_height; - /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE, - * and has computed unscaled downsampled_width and downsampled_height. - */ - -#endif /* IDCT_SCALING_SUPPORTED */ - - /* Report number of components in selected colorspace. */ - /* Probably this should be in the color conversion module... */ - switch (cinfo->out_color_space) { - case JCS_GRAYSCALE: - cinfo->out_color_components = 1; - break; - case JCS_RGB: -#if RGB_PIXELSIZE != 3 - cinfo->out_color_components = RGB_PIXELSIZE; - break; -#endif /* else share code with YCbCr */ - case JCS_YCbCr: - cinfo->out_color_components = 3; - break; - case JCS_CMYK: - case JCS_YCCK: - cinfo->out_color_components = 4; - break; - default: /* else must be same colorspace as in file */ - cinfo->out_color_components = cinfo->num_components; - break; - } - cinfo->output_components = (cinfo->quantize_colors ? 1 : - cinfo->out_color_components); - - /* See if upsampler will want to emit more than one row at a time */ - if (use_merged_upsample(cinfo)) - cinfo->rec_outbuf_height = cinfo->max_v_samp_factor; - else - cinfo->rec_outbuf_height = 1; -} - - -/* - * Several decompression processes need to range-limit values to the range - * 0..MAXJSAMPLE; the input value may fall somewhat outside this range - * due to noise introduced by quantization, roundoff error, etc. These - * processes are inner loops and need to be as fast as possible. On most - * machines, particularly CPUs with pipelines or instruction prefetch, - * a (subscript-check-less) C table lookup - * x = sample_range_limit[x]; - * is faster than explicit tests - * if (x < 0) x = 0; - * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; - * These processes all use a common table prepared by the routine below. - * - * For most steps we can mathematically guarantee that the initial value - * of x is within MAXJSAMPLE+1 of the legal range, so a table running from - * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial - * limiting step (just after the IDCT), a wildly out-of-range value is - * possible if the input data is corrupt. To avoid any chance of indexing - * off the end of memory and getting a bad-pointer trap, we perform the - * post-IDCT limiting thus: - * x = range_limit[x & MASK]; - * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit - * samples. Under normal circumstances this is more than enough range and - * a correct output will be generated; with bogus input data the mask will - * cause wraparound, and we will safely generate a bogus-but-in-range output. - * For the post-IDCT step, we want to convert the data from signed to unsigned - * representation by adding CENTERJSAMPLE at the same time that we limit it. - * So the post-IDCT limiting table ends up looking like this: - * CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE, - * MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), - * 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), - * 0,1,...,CENTERJSAMPLE-1 - * Negative inputs select values from the upper half of the table after - * masking. - * - * We can save some space by overlapping the start of the post-IDCT table - * with the simpler range limiting table. The post-IDCT table begins at - * sample_range_limit + CENTERJSAMPLE. - * - * Note that the table is allocated in near data space on PCs; it's small - * enough and used often enough to justify this. - */ - -LOCAL(void) -prepare_range_limit_table (j_decompress_ptr cinfo) -/* Allocate and fill in the sample_range_limit table */ -{ - JSAMPLE * table; - int i; - - table = (JSAMPLE *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); - table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ - cinfo->sample_range_limit = table; - /* First segment of "simple" table: limit[x] = 0 for x < 0 */ - MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); - /* Main part of "simple" table: limit[x] = x */ - for (i = 0; i <= MAXJSAMPLE; i++) - table[i] = (JSAMPLE) i; - table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ - /* End of simple table, rest of first half of post-IDCT table */ - for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) - table[i] = MAXJSAMPLE; - /* Second half of post-IDCT table */ - MEMZERO(table + (2 * (MAXJSAMPLE+1)), - (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); - MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), - cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); -} - - -/* - * Master selection of decompression modules. - * This is done once at jpeg_start_decompress time. We determine - * which modules will be used and give them appropriate initialization calls. - * We also initialize the decompressor input side to begin consuming data. - * - * Since jpeg_read_header has finished, we know what is in the SOF - * and (first) SOS markers. We also have all the application parameter - * settings. - */ - -LOCAL(void) -master_selection (j_decompress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - wxjpeg_boolean use_c_buffer; - long samplesperrow; - JDIMENSION jd_samplesperrow; - - /* Initialize dimensions and other stuff */ - jpeg_calc_output_dimensions(cinfo); - prepare_range_limit_table(cinfo); - - /* Width of an output scanline must be representable as JDIMENSION. */ - samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; - jd_samplesperrow = (JDIMENSION) samplesperrow; - if ((long) jd_samplesperrow != samplesperrow) - ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); - - /* Initialize my private state */ - master->pass_number = 0; - master->using_merged_upsample = use_merged_upsample(cinfo); - - /* Color quantizer selection */ - master->quantizer_1pass = NULL; - master->quantizer_2pass = NULL; - /* No mode changes if not using buffered-image mode. */ - if (! cinfo->quantize_colors || ! cinfo->buffered_image) { - cinfo->enable_1pass_quant = FALSE; - cinfo->enable_external_quant = FALSE; - cinfo->enable_2pass_quant = FALSE; - } - if (cinfo->quantize_colors) { - if (cinfo->raw_data_out) - ERREXIT(cinfo, JERR_NOTIMPL); - /* 2-pass quantizer only works in 3-component color space. */ - if (cinfo->out_color_components != 3) { - cinfo->enable_1pass_quant = TRUE; - cinfo->enable_external_quant = FALSE; - cinfo->enable_2pass_quant = FALSE; - cinfo->colormap = NULL; - } else if (cinfo->colormap != NULL) { - cinfo->enable_external_quant = TRUE; - } else if (cinfo->two_pass_quantize) { - cinfo->enable_2pass_quant = TRUE; - } else { - cinfo->enable_1pass_quant = TRUE; - } - - if (cinfo->enable_1pass_quant) { -#ifdef QUANT_1PASS_SUPPORTED - jinit_1pass_quantizer(cinfo); - master->quantizer_1pass = cinfo->cquantize; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } - - /* We use the 2-pass code to map to external colormaps. */ - if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) { -#ifdef QUANT_2PASS_SUPPORTED - jinit_2pass_quantizer(cinfo); - master->quantizer_2pass = cinfo->cquantize; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } - /* If both quantizers are initialized, the 2-pass one is left active; - * this is necessary for starting with quantization to an external map. - */ - } - - /* Post-processing: in particular, color conversion first */ - if (! cinfo->raw_data_out) { - if (master->using_merged_upsample) { -#ifdef UPSAMPLE_MERGING_SUPPORTED - jinit_merged_upsampler(cinfo); /* does color conversion too */ -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else { - jinit_color_deconverter(cinfo); - jinit_upsampler(cinfo); - } - jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant); - } - /* Inverse DCT */ - jinit_inverse_dct(cinfo); - /* Entropy decoding: either Huffman or arithmetic coding. */ - if (cinfo->arith_code) { - ERREXIT(cinfo, JERR_ARITH_NOTIMPL); - } else { - if (cinfo->progressive_mode) { -#ifdef D_PROGRESSIVE_SUPPORTED - jinit_phuff_decoder(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else - jinit_huff_decoder(cinfo); - } - - /* Initialize principal buffer controllers. */ - use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; - jinit_d_coef_controller(cinfo, use_c_buffer); - - if (! cinfo->raw_data_out) - jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */); - - /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); - - /* Initialize input side of decompressor to consume first scan. */ - (*cinfo->inputctl->start_input_pass) (cinfo); - -#ifdef D_MULTISCAN_FILES_SUPPORTED - /* If jpeg_start_decompress will read the whole file, initialize - * progress monitoring appropriately. The input step is counted - * as one pass. - */ - if (cinfo->progress != NULL && ! cinfo->buffered_image && - cinfo->inputctl->has_multiple_scans) { - int nscans; - /* Estimate number of scans to set pass_limit. */ - if (cinfo->progressive_mode) { - /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ - nscans = 2 + 3 * cinfo->num_components; - } else { - /* For a nonprogressive multiscan file, estimate 1 scan per component. */ - nscans = cinfo->num_components; - } - cinfo->progress->pass_counter = 0L; - cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; - cinfo->progress->completed_passes = 0; - cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2); - /* Count the input pass as done */ - master->pass_number++; - } -#endif /* D_MULTISCAN_FILES_SUPPORTED */ -} - - -/* - * Per-pass setup. - * This is called at the beginning of each output pass. We determine which - * modules will be active during this pass and give them appropriate - * start_pass calls. We also set is_dummy_pass to indicate whether this - * is a "real" output pass or a dummy pass for color quantization. - * (In the latter case, jdapistd.c will crank the pass to completion.) - */ - -METHODDEF(void) -prepare_for_output_pass (j_decompress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - - if (master->pub.is_dummy_pass) { -#ifdef QUANT_2PASS_SUPPORTED - /* Final pass of 2-pass quantization */ - master->pub.is_dummy_pass = FALSE; - (*cinfo->cquantize->start_pass) (cinfo, FALSE); - (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST); - (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif /* QUANT_2PASS_SUPPORTED */ - } else { - if (cinfo->quantize_colors && cinfo->colormap == NULL) { - /* Select new quantization method */ - if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { - cinfo->cquantize = master->quantizer_2pass; - master->pub.is_dummy_pass = TRUE; - } else if (cinfo->enable_1pass_quant) { - cinfo->cquantize = master->quantizer_1pass; - } else { - ERREXIT(cinfo, JERR_MODE_CHANGE); - } - } - (*cinfo->idct->start_pass) (cinfo); - (*cinfo->coef->start_output_pass) (cinfo); - if (! cinfo->raw_data_out) { - if (! master->using_merged_upsample) - (*cinfo->cconvert->start_pass) (cinfo); - (*cinfo->upsample->start_pass) (cinfo); - if (cinfo->quantize_colors) - (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); - (*cinfo->post->start_pass) (cinfo, - (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); - (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); - } - } - - /* Set up progress monitor's pass info if present */ - if (cinfo->progress != NULL) { - cinfo->progress->completed_passes = master->pass_number; - cinfo->progress->total_passes = master->pass_number + - (master->pub.is_dummy_pass ? 2 : 1); - /* In buffered-image mode, we assume one more output pass if EOI not - * yet reached, but no more passes if EOI has been reached. - */ - if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) { - cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1); - } - } -} - - -/* - * Finish up at end of an output pass. - */ - -METHODDEF(void) -finish_output_pass (j_decompress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - - if (cinfo->quantize_colors) - (*cinfo->cquantize->finish_pass) (cinfo); - master->pass_number++; -} - - -#ifdef D_MULTISCAN_FILES_SUPPORTED - -/* - * Switch to a new external colormap between output passes. - */ - -GLOBAL(void) -jpeg_new_colormap (j_decompress_ptr cinfo) -{ - my_master_ptr master = (my_master_ptr) cinfo->master; - - /* Prevent application from calling me at wrong times */ - if (cinfo->global_state != DSTATE_BUFIMAGE) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - - if (cinfo->quantize_colors && cinfo->enable_external_quant && - cinfo->colormap != NULL) { - /* Select 2-pass quantizer for external colormap use */ - cinfo->cquantize = master->quantizer_2pass; - /* Notify quantizer of colormap change */ - (*cinfo->cquantize->new_color_map) (cinfo); - master->pub.is_dummy_pass = FALSE; /* just in case */ - } else - ERREXIT(cinfo, JERR_MODE_CHANGE); -} - -#endif /* D_MULTISCAN_FILES_SUPPORTED */ - - -/* - * Initialize master decompression control and select active modules. - * This is performed at the start of jpeg_start_decompress. - */ - -GLOBAL(void) -jinit_master_decompress (j_decompress_ptr cinfo) -{ - my_master_ptr master; - - master = (my_master_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_decomp_master)); - cinfo->master = (struct jpeg_decomp_master *) master; - master->pub.prepare_for_output_pass = prepare_for_output_pass; - master->pub.finish_output_pass = finish_output_pass; - - master->pub.is_dummy_pass = FALSE; - - master_selection(cinfo); -} - diff --git a/Source/3rdParty/wx/src/jpeg/jdmerge.c b/Source/3rdParty/wx/src/jpeg/jdmerge.c deleted file mode 100644 index 55eab3621..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdmerge.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * jdmerge.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains code for merged upsampling/color conversion. - * - * This file combines functions from jdsample.c and jdcolor.c; - * read those files first to understand what's going on. - * - * When the chroma components are to be upsampled by simple replication - * (ie, box filtering), we can save some work in color conversion by - * calculating all the output pixels corresponding to a pair of chroma - * samples at one time. In the conversion equations - * R = Y + K1 * Cr - * G = Y + K2 * Cb + K3 * Cr - * B = Y + K4 * Cb - * only the Y term varies among the group of pixels corresponding to a pair - * of chroma samples, so the rest of the terms can be calculated just once. - * At typical sampling ratios, this eliminates half or three-quarters of the - * multiplications needed for color conversion. - * - * This file currently provides implementations for the following cases: - * YCbCr => RGB color conversion only. - * Sampling ratios of 2h1v or 2h2v. - * No scaling needed at upsample time. - * Corner-aligned (non-CCIR601) sampling alignment. - * Other special cases could be added, but in most applications these are - * the only common cases. (For uncommon cases we fall back on the more - * general code in jdsample.c and jdcolor.c.) - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -#ifdef UPSAMPLE_MERGING_SUPPORTED - - -/* Private subobject */ - -typedef struct { - struct jpeg_upsampler pub; /* public fields */ - - /* Pointer to routine to do actual upsampling/conversion of one row group */ - JMETHOD(void, upmethod, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf)); - - /* Private state for YCC->RGB conversion */ - int * Cr_r_tab; /* => table for Cr to R conversion */ - int * Cb_b_tab; /* => table for Cb to B conversion */ - JPEG_INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - JPEG_INT32 * Cb_g_tab; /* => table for Cb to G conversion */ - - /* For 2:1 vertical sampling, we produce two output rows at a time. - * We need a "spare" row buffer to hold the second output row if the - * application provides just a one-row buffer; we also use the spare - * to discard the dummy last row if the image height is odd. - */ - JSAMPROW spare_row; - wxjpeg_boolean spare_full; /* T if spare buffer is occupied */ - - JDIMENSION out_row_width; /* samples per output row */ - JDIMENSION rows_to_go; /* counts rows remaining in image */ -} my_upsampler; - -typedef my_upsampler * my_upsample_ptr; - -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((JPEG_INT32) ((x) * (1L<RGB colorspace conversion. - * This is taken directly from jdcolor.c; see that file for more info. - */ - -LOCAL(void) -build_ycc_rgb_table (j_decompress_ptr cinfo) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - int i; - JPEG_INT32 x; - SHIFT_TEMPS - - upsample->Cr_r_tab = (int *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); - upsample->Cb_b_tab = (int *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); - upsample->Cr_g_tab = (JPEG_INT32 *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); - upsample->Cb_g_tab = (JPEG_INT32 *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); - - for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { - /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ - /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ - /* Cr=>R value is nearest int to 1.40200 * x */ - upsample->Cr_r_tab[i] = (int) - RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); - /* Cb=>B value is nearest int to 1.77200 * x */ - upsample->Cb_b_tab[i] = (int) - RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); - /* Cr=>G value is scaled-up -0.71414 * x */ - upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x; - /* Cb=>G value is scaled-up -0.34414 * x */ - /* We also add in ONE_HALF so that need not do it in inner loop */ - upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; - } -} - - -/* - * Initialize for an upsampling pass. - */ - -METHODDEF(void) -start_pass_merged_upsample (j_decompress_ptr cinfo) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - - /* Mark the spare buffer empty */ - upsample->spare_full = FALSE; - /* Initialize total-height counter for detecting bottom of image */ - upsample->rows_to_go = cinfo->output_height; -} - - -/* - * Control routine to do upsampling (and color conversion). - * - * The control routine just handles the row buffering considerations. - */ - -METHODDEF(void) -merged_2v_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -/* 2:1 vertical sampling case: may need a spare row. */ -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - JSAMPROW work_ptrs[2]; - JDIMENSION num_rows; /* number of rows returned to caller */ - - if (upsample->spare_full) { - /* If we have a spare row saved from a previous cycle, just return it. */ - jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, - 1, upsample->out_row_width); - num_rows = 1; - upsample->spare_full = FALSE; - } else { - /* Figure number of rows to return to caller. */ - num_rows = 2; - /* Not more than the distance to the end of the image. */ - if (num_rows > upsample->rows_to_go) - num_rows = upsample->rows_to_go; - /* And not more than what the client can accept: */ - out_rows_avail -= *out_row_ctr; - if (num_rows > out_rows_avail) - num_rows = out_rows_avail; - /* Create output pointer array for upsampler. */ - work_ptrs[0] = output_buf[*out_row_ctr]; - if (num_rows > 1) { - work_ptrs[1] = output_buf[*out_row_ctr + 1]; - } else { - work_ptrs[1] = upsample->spare_row; - upsample->spare_full = TRUE; - } - /* Now do the upsampling. */ - (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs); - } - - /* Adjust counts */ - *out_row_ctr += num_rows; - upsample->rows_to_go -= num_rows; - /* When the buffer is emptied, declare this input row group consumed */ - if (! upsample->spare_full) - (*in_row_group_ctr)++; -} - - -METHODDEF(void) -merged_1v_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -/* 1:1 vertical sampling case: much easier, never need a spare row. */ -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - - /* Just do the upsampling. */ - (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, - output_buf + *out_row_ctr); - /* Adjust counts */ - (*out_row_ctr)++; - (*in_row_group_ctr)++; -} - - -/* - * These are the routines invoked by the control routines to do - * the actual upsampling/conversion. One row group is processed per call. - * - * Note: since we may be writing directly into application-supplied buffers, - * we have to be honest about the output width; we can't assume the buffer - * has been rounded up to an even width. - */ - - -/* - * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. - */ - -METHODDEF(void) -h2v1_merged_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - register int y, cred, cgreen, cblue; - int cb, cr; - register JSAMPROW outptr; - JSAMPROW inptr0, inptr1, inptr2; - JDIMENSION col; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - int * Crrtab = upsample->Cr_r_tab; - int * Cbbtab = upsample->Cb_b_tab; - JPEG_INT32 * Crgtab = upsample->Cr_g_tab; - JPEG_INT32 * Cbgtab = upsample->Cb_g_tab; - SHIFT_TEMPS - - inptr0 = input_buf[0][in_row_group_ctr]; - inptr1 = input_buf[1][in_row_group_ctr]; - inptr2 = input_buf[2][in_row_group_ctr]; - outptr = output_buf[0]; - /* Loop for each pair of output pixels */ - for (col = cinfo->output_width >> 1; col > 0; col--) { - /* Do the chroma part of the calculation */ - cb = GETJSAMPLE(*inptr1++); - cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - /* Fetch 2 Y values and emit 2 pixels */ - y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; - outptr += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; - outptr += RGB_PIXELSIZE; - } - /* If image width is odd, do the last output column separately */ - if (cinfo->output_width & 1) { - cb = GETJSAMPLE(*inptr1); - cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - y = GETJSAMPLE(*inptr0); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; - } -} - -/* - * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. - */ - -METHODDEF(void) -h2v2_merged_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - register int y, cred, cgreen, cblue; - int cb, cr; - register JSAMPROW outptr0, outptr1; - JSAMPROW inptr00, inptr01, inptr1, inptr2; - JDIMENSION col; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - int * Crrtab = upsample->Cr_r_tab; - int * Cbbtab = upsample->Cb_b_tab; - JPEG_INT32 * Crgtab = upsample->Cr_g_tab; - JPEG_INT32 * Cbgtab = upsample->Cb_g_tab; - SHIFT_TEMPS - - inptr00 = input_buf[0][in_row_group_ctr*2]; - inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; - inptr1 = input_buf[1][in_row_group_ctr]; - inptr2 = input_buf[2][in_row_group_ctr]; - outptr0 = output_buf[0]; - outptr1 = output_buf[1]; - /* Loop for each group of output pixels */ - for (col = cinfo->output_width >> 1; col > 0; col--) { - /* Do the chroma part of the calculation */ - cb = GETJSAMPLE(*inptr1++); - cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - /* Fetch 4 Y values and emit 4 pixels */ - y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; - outptr0 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; - outptr0 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; - outptr1 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; - outptr1 += RGB_PIXELSIZE; - } - /* If image width is odd, do the last output column separately */ - if (cinfo->output_width & 1) { - cb = GETJSAMPLE(*inptr1); - cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - y = GETJSAMPLE(*inptr00); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; - y = GETJSAMPLE(*inptr01); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; - } -} - - -/* - * Module initialization routine for merged upsampling/color conversion. - * - * NB: this is called under the conditions determined by use_merged_upsample() - * in jdmaster.c. That routine MUST correspond to the actual capabilities - * of this module; no safety checks are made here. - */ - -GLOBAL(void) -jinit_merged_upsampler (j_decompress_ptr cinfo) -{ - my_upsample_ptr upsample; - - upsample = (my_upsample_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); - cinfo->upsample = (struct jpeg_upsampler *) upsample; - upsample->pub.start_pass = start_pass_merged_upsample; - upsample->pub.need_context_rows = FALSE; - - upsample->out_row_width = cinfo->output_width * cinfo->out_color_components; - - if (cinfo->max_v_samp_factor == 2) { - upsample->pub.upsample = merged_2v_upsample; - upsample->upmethod = h2v2_merged_upsample; - /* Allocate a spare row buffer */ - upsample->spare_row = (JSAMPROW) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); - } else { - upsample->pub.upsample = merged_1v_upsample; - upsample->upmethod = h2v1_merged_upsample; - /* No spare row needed */ - upsample->spare_row = NULL; - } - - build_ycc_rgb_table(cinfo); -} - -#endif /* UPSAMPLE_MERGING_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jdphuff.c b/Source/3rdParty/wx/src/jpeg/jdphuff.c deleted file mode 100644 index 96b4364e4..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdphuff.c +++ /dev/null @@ -1,668 +0,0 @@ -/* - * jdphuff.c - * - * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains Huffman entropy decoding routines for progressive JPEG. - * - * Much of the complexity here has to do with supporting input suspension. - * If the data source module demands suspension, we want to be able to back - * up to the start of the current MCU. To do this, we copy state variables - * into local working storage, and update them back to the permanent - * storage only upon successful completion of an MCU. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdhuff.h" /* Declarations shared with jdhuff.c */ - - -#ifdef D_PROGRESSIVE_SUPPORTED - -/* - * Expanded entropy decoder object for progressive Huffman decoding. - * - * The savable_state subrecord contains fields that change within an MCU, - * but must not be updated permanently until we complete the MCU. - */ - -typedef struct { - unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ - int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ -} savable_state; - -/* This macro is to work around compilers with missing or broken - * structure assignment. You'll need to fix this code if you have - * such a compiler and you change MAX_COMPS_IN_SCAN. - */ - -#ifndef NO_STRUCT_ASSIGN -#define ASSIGN_STATE(dest,src) ((dest) = (src)) -#else -#if MAX_COMPS_IN_SCAN == 4 -#define ASSIGN_STATE(dest,src) \ - ((dest).EOBRUN = (src).EOBRUN, \ - (dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) -#endif -#endif - - -typedef struct { - struct jpeg_entropy_decoder pub; /* public fields */ - - /* These fields are loaded into local variables at start of each MCU. - * In case of suspension, we exit WITHOUT updating them. - */ - bitread_perm_state bitstate; /* Bit buffer at start of MCU */ - savable_state saved; /* Other state at start of MCU */ - - /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - - /* Pointers to derived tables (these workspaces have image lifespan) */ - d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; - - d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */ -} phuff_entropy_decoder; - -typedef phuff_entropy_decoder * phuff_entropy_ptr; - -/* Forward declarations */ -METHODDEF(wxjpeg_boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF(wxjpeg_boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); - - -/* - * Initialize for a Huffman-compressed scan. - */ - -METHODDEF(void) -start_pass_phuff_decoder (j_decompress_ptr cinfo) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - wxjpeg_boolean is_DC_band, bad; - int ci, coefi, tbl; - int *coef_bit_ptr; - jpeg_component_info * compptr; - - is_DC_band = (cinfo->Ss == 0); - - /* Validate scan parameters */ - bad = FALSE; - if (is_DC_band) { - if (cinfo->Se != 0) - bad = TRUE; - } else { - /* need not check Ss/Se < 0 since they came from unsigned bytes */ - if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2) - bad = TRUE; - /* AC scans may have only one component */ - if (cinfo->comps_in_scan != 1) - bad = TRUE; - } - if (cinfo->Ah != 0) { - /* Successive approximation refinement scan: must have Al = Ah-1. */ - if (cinfo->Al != cinfo->Ah-1) - bad = TRUE; - } - if (cinfo->Al > 13) /* need not check for < 0 */ - bad = TRUE; - /* Arguably the maximum Al value should be less than 13 for 8-bit precision, - * but the spec doesn't say so, and we try to be liberal about what we - * accept. Note: large Al values could result in out-of-range DC - * coefficients during early scans, leading to bizarre displays due to - * overflows in the IDCT math. But we won't crash. - */ - if (bad) - ERREXIT4(cinfo, JERR_BAD_PROGRESSION, - cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); - /* Update progression status, and verify that scan order is legal. - * Note that inter-scan inconsistencies are treated as warnings - * not fatal errors ... not clear if this is right way to behave. - */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - int cindex = cinfo->cur_comp_info[ci]->component_index; - coef_bit_ptr = & cinfo->coef_bits[cindex][0]; - if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */ - WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); - for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { - int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; - if (cinfo->Ah != expected) - WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); - coef_bit_ptr[coefi] = cinfo->Al; - } - } - - /* Select MCU decoding routine */ - if (cinfo->Ah == 0) { - if (is_DC_band) - entropy->pub.decode_mcu = decode_mcu_DC_first; - else - entropy->pub.decode_mcu = decode_mcu_AC_first; - } else { - if (is_DC_band) - entropy->pub.decode_mcu = decode_mcu_DC_refine; - else - entropy->pub.decode_mcu = decode_mcu_AC_refine; - } - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Make sure requested tables are present, and compute derived tables. - * We may build same derived table more than once, but it's not expensive. - */ - if (is_DC_band) { - if (cinfo->Ah == 0) { /* DC refinement needs no table */ - tbl = compptr->dc_tbl_no; - jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, - & entropy->derived_tbls[tbl]); - } - } else { - tbl = compptr->ac_tbl_no; - jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, - & entropy->derived_tbls[tbl]); - /* remember the single active table */ - entropy->ac_derived_tbl = entropy->derived_tbls[tbl]; - } - /* Initialize DC predictions to 0 */ - entropy->saved.last_dc_val[ci] = 0; - } - - /* Initialize bitread state variables */ - entropy->bitstate.bits_left = 0; - entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ - entropy->pub.insufficient_data = FALSE; - - /* Initialize private state variables */ - entropy->saved.EOBRUN = 0; - - /* Initialize restart counter */ - entropy->restarts_to_go = cinfo->restart_interval; -} - - -/* - * Figure F.12: extend sign bit. - * On some machines, a shift and add will be faster than a table lookup. - */ - -#ifdef AVOID_TABLES - -#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) - -#else - -#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) - -static const int extend_test[16] = /* entry n is 2**(n-1) */ - { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, - 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; - -static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ - { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, - ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, - ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, - ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; - -#endif /* AVOID_TABLES */ - - -/* - * Check for a restart marker & resynchronize decoder. - * Returns FALSE if must suspend. - */ - -LOCAL(wxjpeg_boolean) -process_restart (j_decompress_ptr cinfo) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int ci; - - /* Throw away any unused bits remaining in bit buffer; */ - /* include any full bytes in next_marker's count of discarded bytes */ - cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; - entropy->bitstate.bits_left = 0; - - /* Advance past the RSTn marker */ - if (! (*cinfo->marker->read_restart_marker) (cinfo)) - return FALSE; - - /* Re-initialize DC predictions to 0 */ - for (ci = 0; ci < cinfo->comps_in_scan; ci++) - entropy->saved.last_dc_val[ci] = 0; - /* Re-init EOB run count, too */ - entropy->saved.EOBRUN = 0; - - /* Reset restart counter */ - entropy->restarts_to_go = cinfo->restart_interval; - - /* Reset out-of-data flag, unless read_restart_marker left us smack up - * against a marker. In that case we will end up treating the next data - * segment as empty, and we can avoid producing bogus output pixels by - * leaving the flag set. - */ - if (cinfo->unread_marker == 0) - entropy->pub.insufficient_data = FALSE; - - return TRUE; -} - - -/* - * Huffman MCU decoding. - * Each of these routines decodes and returns one MCU's worth of - * Huffman-compressed coefficients. - * The coefficients are reordered from zigzag order into natural array order, - * but are not dequantized. - * - * The i'th block of the MCU is stored into the block pointed to by - * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. - * - * We return FALSE if data source requested suspension. In that case no - * changes have been made to permanent state. (Exception: some output - * coefficients may already have been assigned. This is harmless for - * spectral selection, since we'll just re-assign them on the next call. - * Successive approximation AC refinement has to be more careful, however.) - */ - -/* - * MCU decoding for DC initial scan (either spectral selection, - * or first pass of successive approximation). - */ - -METHODDEF(wxjpeg_boolean) -decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int Al = cinfo->Al; - register int s, r; - int blkn, ci; - JBLOCKROW block; - BITREAD_STATE_VARS; - savable_state state; - d_derived_tbl * tbl; - jpeg_component_info * compptr; - - /* Process restart marker if needed; may have to suspend */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) - return FALSE; - } - - /* If we've run out of data, just leave the MCU set to zeroes. - * This way, we return uniform gray for the remainder of the segment. - */ - if (! entropy->pub.insufficient_data) { - - /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(state, entropy->saved); - - /* Outer loop handles each block in the MCU */ - - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - block = MCU_data[blkn]; - ci = cinfo->MCU_membership[blkn]; - compptr = cinfo->cur_comp_info[ci]; - tbl = entropy->derived_tbls[compptr->dc_tbl_no]; - - /* Decode a single block's worth of coefficients */ - - /* Section F.2.2.1: decode the DC coefficient difference */ - HUFF_DECODE(s, br_state, tbl, return FALSE, label1); - if (s) { - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - } - - /* Convert DC difference to actual value, update last_dc_val */ - s += state.last_dc_val[ci]; - state.last_dc_val[ci] = s; - /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ - (*block)[0] = (JCOEF) (s << Al); - } - - /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(entropy->saved, state); - } - - /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; - - return TRUE; -} - - -/* - * MCU decoding for AC initial scan (either spectral selection, - * or first pass of successive approximation). - */ - -METHODDEF(wxjpeg_boolean) -decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int Se = cinfo->Se; - int Al = cinfo->Al; - register int s, k, r; - unsigned int EOBRUN; - JBLOCKROW block; - BITREAD_STATE_VARS; - d_derived_tbl * tbl; - - /* Process restart marker if needed; may have to suspend */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) - return FALSE; - } - - /* If we've run out of data, just leave the MCU set to zeroes. - * This way, we return uniform gray for the remainder of the segment. - */ - if (! entropy->pub.insufficient_data) { - - /* Load up working state. - * We can avoid loading/saving bitread state if in an EOB run. - */ - EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ - - /* There is always only one block per MCU */ - - if (EOBRUN > 0) /* if it's a band of zeroes... */ - EOBRUN--; /* ...process it now (we do nothing) */ - else { - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - block = MCU_data[0]; - tbl = entropy->ac_derived_tbl; - - for (k = cinfo->Ss; k <= Se; k++) { - HUFF_DECODE(s, br_state, tbl, return FALSE, label2); - r = s >> 4; - s &= 15; - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - /* Scale and output coefficient in natural (dezigzagged) order */ - (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al); - } else { - if (r == 15) { /* ZRL */ - k += 15; /* skip 15 zeroes in band */ - } else { /* EOBr, run length is 2^r + appended bits */ - EOBRUN = 1 << r; - if (r) { /* EOBr, r > 0 */ - CHECK_BIT_BUFFER(br_state, r, return FALSE); - r = GET_BITS(r); - EOBRUN += r; - } - EOBRUN--; /* this band is processed at this moment */ - break; /* force end-of-band */ - } - } - } - - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - } - - /* Completed MCU, so update state */ - entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ - } - - /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; - - return TRUE; -} - - -/* - * MCU decoding for DC successive approximation refinement scan. - * Note: we assume such scans can be multi-component, although the spec - * is not very clear on the point. - */ - -METHODDEF(wxjpeg_boolean) -decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ - int blkn; - JBLOCKROW block; - BITREAD_STATE_VARS; - - /* Process restart marker if needed; may have to suspend */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) - return FALSE; - } - - /* Not worth the cycles to check insufficient_data here, - * since we will not change the data anyway if we read zeroes. - */ - - /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - - /* Outer loop handles each block in the MCU */ - - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - block = MCU_data[blkn]; - - /* Encoded data is simply the next bit of the two's-complement DC value */ - CHECK_BIT_BUFFER(br_state, 1, return FALSE); - if (GET_BITS(1)) - (*block)[0] |= p1; - /* Note: since we use |=, repeating the assignment later is safe */ - } - - /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - - /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; - - return TRUE; -} - - -/* - * MCU decoding for AC successive approximation refinement scan. - */ - -METHODDEF(wxjpeg_boolean) -decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int Se = cinfo->Se; - int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ - int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ - register int s, k, r; - unsigned int EOBRUN; - JBLOCKROW block; - JCOEFPTR thiscoef; - BITREAD_STATE_VARS; - d_derived_tbl * tbl; - int num_newnz; - int newnz_pos[DCTSIZE2]; - - /* Process restart marker if needed; may have to suspend */ - if (cinfo->restart_interval) { - if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) - return FALSE; - } - - /* If we've run out of data, don't modify the MCU. - */ - if (! entropy->pub.insufficient_data) { - - /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ - - /* There is always only one block per MCU */ - block = MCU_data[0]; - tbl = entropy->ac_derived_tbl; - - /* If we are forced to suspend, we must undo the assignments to any newly - * nonzero coefficients in the block, because otherwise we'd get confused - * next time about which coefficients were already nonzero. - * But we need not undo addition of bits to already-nonzero coefficients; - * instead, we can test the current bit to see if we already did it. - */ - num_newnz = 0; - - /* initialize coefficient loop counter to start of band */ - k = cinfo->Ss; - - if (EOBRUN == 0) { - for (; k <= Se; k++) { - HUFF_DECODE(s, br_state, tbl, goto undoit, label3); - r = s >> 4; - s &= 15; - if (s) { - if (s != 1) /* size of new coef should always be 1 */ - WARNMS(cinfo, JWRN_HUFF_BAD_CODE); - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) - s = p1; /* newly nonzero coef is positive */ - else - s = m1; /* newly nonzero coef is negative */ - } else { - if (r != 15) { - EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ - if (r) { - CHECK_BIT_BUFFER(br_state, r, goto undoit); - r = GET_BITS(r); - EOBRUN += r; - } - break; /* rest of block is handled by EOB logic */ - } - /* note s = 0 for processing ZRL */ - } - /* Advance over already-nonzero coefs and r still-zero coefs, - * appending correction bits to the nonzeroes. A correction bit is 1 - * if the absolute value of the coefficient must be increased. - */ - do { - thiscoef = *block + jpeg_natural_order[k]; - if (*thiscoef != 0) { - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) { - if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ - if (*thiscoef >= 0) - *thiscoef += p1; - else - *thiscoef += m1; - } - } - } else { - if (--r < 0) - break; /* reached target zero coefficient */ - } - k++; - } while (k <= Se); - if (s) { - int pos = jpeg_natural_order[k]; - /* Output newly nonzero coefficient */ - (*block)[pos] = (JCOEF) s; - /* Remember its position in case we have to suspend */ - newnz_pos[num_newnz++] = pos; - } - } - } - - if (EOBRUN > 0) { - /* Scan any remaining coefficient positions after the end-of-band - * (the last newly nonzero coefficient, if any). Append a correction - * bit to each already-nonzero coefficient. A correction bit is 1 - * if the absolute value of the coefficient must be increased. - */ - for (; k <= Se; k++) { - thiscoef = *block + jpeg_natural_order[k]; - if (*thiscoef != 0) { - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) { - if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ - if (*thiscoef >= 0) - *thiscoef += p1; - else - *thiscoef += m1; - } - } - } - } - /* Count one block completed in EOB run */ - EOBRUN--; - } - - /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ - } - - /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; - - return TRUE; - -undoit: - /* Re-zero any output coefficients that we made newly nonzero */ - while (num_newnz > 0) - (*block)[newnz_pos[--num_newnz]] = 0; - - return FALSE; -} - - -/* - * Module initialization routine for progressive Huffman entropy decoding. - */ - -GLOBAL(void) -jinit_phuff_decoder (j_decompress_ptr cinfo) -{ - phuff_entropy_ptr entropy; - int *coef_bit_ptr; - int ci, i; - - entropy = (phuff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_decoder)); - cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; - entropy->pub.start_pass = start_pass_phuff_decoder; - - /* Mark derived tables unallocated */ - for (i = 0; i < NUM_HUFF_TBLS; i++) { - entropy->derived_tbls[i] = NULL; - } - - /* Create progression status table */ - cinfo->coef_bits = (int (*)[DCTSIZE2]) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components*DCTSIZE2*SIZEOF(int)); - coef_bit_ptr = & cinfo->coef_bits[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) - for (i = 0; i < DCTSIZE2; i++) - *coef_bit_ptr++ = -1; -} - -#endif /* D_PROGRESSIVE_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jdpostct.c b/Source/3rdParty/wx/src/jpeg/jdpostct.c deleted file mode 100644 index e6bcd4a9c..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdpostct.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * jdpostct.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the decompression postprocessing controller. - * This controller manages the upsampling, color conversion, and color - * quantization/reduction steps; specifically, it controls the buffering - * between upsample/color conversion and color quantization/reduction. - * - * If no color quantization/reduction is required, then this module has no - * work to do, and it just hands off to the upsample/color conversion code. - * An integrated upsample/convert/quantize process would replace this module - * entirely. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Private buffer controller object */ - -typedef struct { - struct jpeg_d_post_controller pub; /* public fields */ - - /* Color quantization source buffer: this holds output data from - * the upsample/color conversion step to be passed to the quantizer. - * For two-pass color quantization, we need a full-image buffer; - * for one-pass operation, a strip buffer is sufficient. - */ - jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */ - JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */ - JDIMENSION strip_height; /* buffer size in rows */ - /* for two-pass mode only: */ - JDIMENSION starting_row; /* row # of first row in current strip */ - JDIMENSION next_row; /* index of next row to fill/empty in strip */ -} my_post_controller; - -typedef my_post_controller * my_post_ptr; - - -/* Forward declarations */ -METHODDEF(void) post_process_1pass - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); -#ifdef QUANT_2PASS_SUPPORTED -METHODDEF(void) post_process_prepass - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); -METHODDEF(void) post_process_2pass - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); -#endif - - -/* - * Initialize for a processing pass. - */ - -METHODDEF(void) -start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) -{ - my_post_ptr post = (my_post_ptr) cinfo->post; - - switch (pass_mode) { - case JBUF_PASS_THRU: - if (cinfo->quantize_colors) { - /* Single-pass processing with color quantization. */ - post->pub.post_process_data = post_process_1pass; - /* We could be doing buffered-image output before starting a 2-pass - * color quantization; in that case, jinit_d_post_controller did not - * allocate a strip buffer. Use the virtual-array buffer as workspace. - */ - if (post->buffer == NULL) { - post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - (JDIMENSION) 0, post->strip_height, TRUE); - } - } else { - /* For single-pass processing without color quantization, - * I have no work to do; just call the upsampler directly. - */ - post->pub.post_process_data = cinfo->upsample->upsample; - } - break; -#ifdef QUANT_2PASS_SUPPORTED - case JBUF_SAVE_AND_PASS: - /* First pass of 2-pass quantization */ - if (post->whole_image == NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - post->pub.post_process_data = post_process_prepass; - break; - case JBUF_CRANK_DEST: - /* Second pass of 2-pass quantization */ - if (post->whole_image == NULL) - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - post->pub.post_process_data = post_process_2pass; - break; -#endif /* QUANT_2PASS_SUPPORTED */ - default: - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - break; - } - post->starting_row = post->next_row = 0; -} - - -/* - * Process some data in the one-pass (strip buffer) case. - * This is used for color precision reduction as well as one-pass quantization. - */ - -METHODDEF(void) -post_process_1pass (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_post_ptr post = (my_post_ptr) cinfo->post; - JDIMENSION num_rows, max_rows; - - /* Fill the buffer, but not more than what we can dump out in one go. */ - /* Note we rely on the upsampler to detect bottom of image. */ - max_rows = out_rows_avail - *out_row_ctr; - if (max_rows > post->strip_height) - max_rows = post->strip_height; - num_rows = 0; - (*cinfo->upsample->upsample) (cinfo, - input_buf, in_row_group_ctr, in_row_groups_avail, - post->buffer, &num_rows, max_rows); - /* Quantize and emit data. */ - (*cinfo->cquantize->color_quantize) (cinfo, - post->buffer, output_buf + *out_row_ctr, (int) num_rows); - *out_row_ctr += num_rows; -} - - -#ifdef QUANT_2PASS_SUPPORTED - -/* - * Process some data in the first pass of 2-pass quantization. - */ - -METHODDEF(void) -post_process_prepass (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_post_ptr post = (my_post_ptr) cinfo->post; - JDIMENSION old_next_row, num_rows; - - /* Reposition virtual buffer if at start of strip. */ - if (post->next_row == 0) { - post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - post->starting_row, post->strip_height, TRUE); - } - - /* Upsample some data (up to a strip height's worth). */ - old_next_row = post->next_row; - (*cinfo->upsample->upsample) (cinfo, - input_buf, in_row_group_ctr, in_row_groups_avail, - post->buffer, &post->next_row, post->strip_height); - - /* Allow quantizer to scan new data. No data is emitted, */ - /* but we advance out_row_ctr so outer loop can tell when we're done. */ - if (post->next_row > old_next_row) { - num_rows = post->next_row - old_next_row; - (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row, - (JSAMPARRAY) NULL, (int) num_rows); - *out_row_ctr += num_rows; - } - - /* Advance if we filled the strip. */ - if (post->next_row >= post->strip_height) { - post->starting_row += post->strip_height; - post->next_row = 0; - } -} - - -/* - * Process some data in the second pass of 2-pass quantization. - */ - -METHODDEF(void) -post_process_2pass (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_post_ptr post = (my_post_ptr) cinfo->post; - JDIMENSION num_rows, max_rows; - - /* Reposition virtual buffer if at start of strip. */ - if (post->next_row == 0) { - post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - post->starting_row, post->strip_height, FALSE); - } - - /* Determine number of rows to emit. */ - num_rows = post->strip_height - post->next_row; /* available in strip */ - max_rows = out_rows_avail - *out_row_ctr; /* available in output area */ - if (num_rows > max_rows) - num_rows = max_rows; - /* We have to check bottom of image here, can't depend on upsampler. */ - max_rows = cinfo->output_height - post->starting_row; - if (num_rows > max_rows) - num_rows = max_rows; - - /* Quantize and emit data. */ - (*cinfo->cquantize->color_quantize) (cinfo, - post->buffer + post->next_row, output_buf + *out_row_ctr, - (int) num_rows); - *out_row_ctr += num_rows; - - /* Advance if we filled the strip. */ - post->next_row += num_rows; - if (post->next_row >= post->strip_height) { - post->starting_row += post->strip_height; - post->next_row = 0; - } -} - -#endif /* QUANT_2PASS_SUPPORTED */ - - -/* - * Initialize postprocessing controller. - */ - -GLOBAL(void) -jinit_d_post_controller (j_decompress_ptr cinfo, wxjpeg_boolean need_full_buffer) -{ - my_post_ptr post; - - post = (my_post_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_post_controller)); - cinfo->post = (struct jpeg_d_post_controller *) post; - post->pub.start_pass = start_pass_dpost; - post->whole_image = NULL; /* flag for no virtual arrays */ - post->buffer = NULL; /* flag for no strip buffer */ - - /* Create the quantization buffer, if needed */ - if (cinfo->quantize_colors) { - /* The buffer strip height is max_v_samp_factor, which is typically - * an efficient number of rows for upsampling to return. - * (In the presence of output rescaling, we might want to be smarter?) - */ - post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor; - if (need_full_buffer) { - /* Two-pass color quantization: need full-image storage. */ - /* We round up the number of rows to a multiple of the strip height. */ -#ifdef QUANT_2PASS_SUPPORTED - post->whole_image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - cinfo->output_width * cinfo->out_color_components, - (JDIMENSION) jround_up((long) cinfo->output_height, - (long) post->strip_height), - post->strip_height); -#else - ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); -#endif /* QUANT_2PASS_SUPPORTED */ - } else { - /* One-pass color quantization: just make a strip buffer. */ - post->buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->output_width * cinfo->out_color_components, - post->strip_height); - } - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jdsample.c b/Source/3rdParty/wx/src/jpeg/jdsample.c deleted file mode 100644 index 8c8fc1713..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdsample.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - * jdsample.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains upsampling routines. - * - * Upsampling input data is counted in "row groups". A row group - * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) - * sample rows of each component. Upsampling will normally produce - * max_v_samp_factor pixel rows from each row group (but this could vary - * if the upsampler is applying a scale factor of its own). - * - * An excellent reference for image resampling is - * Digital Image Warping, George Wolberg, 1990. - * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Pointer to routine to upsample a single component */ -typedef JMETHOD(void, upsample1_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); - -/* Private subobject */ - -typedef struct { - struct jpeg_upsampler pub; /* public fields */ - - /* Color conversion buffer. When using separate upsampling and color - * conversion steps, this buffer holds one upsampled row group until it - * has been color converted and output. - * Note: we do not allocate any storage for component(s) which are full-size, - * ie do not need rescaling. The corresponding entry of color_buf[] is - * simply set to point to the input data array, thereby avoiding copying. - */ - JSAMPARRAY color_buf[MAX_COMPONENTS]; - - /* Per-component upsampling method pointers */ - upsample1_ptr methods[MAX_COMPONENTS]; - - int next_row_out; /* counts rows emitted from color_buf */ - JDIMENSION rows_to_go; /* counts rows remaining in image */ - - /* Height of an input row group for each component. */ - int rowgroup_height[MAX_COMPONENTS]; - - /* These arrays save pixel expansion factors so that int_expand need not - * recompute them each time. They are unused for other upsampling methods. - */ - UINT8 h_expand[MAX_COMPONENTS]; - UINT8 v_expand[MAX_COMPONENTS]; -} my_upsampler; - -typedef my_upsampler * my_upsample_ptr; - - -/* - * Initialize for an upsampling pass. - */ - -METHODDEF(void) -start_pass_upsample (j_decompress_ptr cinfo) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - - /* Mark the conversion buffer empty */ - upsample->next_row_out = cinfo->max_v_samp_factor; - /* Initialize total-height counter for detecting bottom of image */ - upsample->rows_to_go = cinfo->output_height; -} - - -/* - * Control routine to do upsampling (and color conversion). - * - * In this version we upsample each component independently. - * We upsample one row group into the conversion buffer, then apply - * color conversion a row at a time. - */ - -METHODDEF(void) -sep_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - int ci; - jpeg_component_info * compptr; - JDIMENSION num_rows; - - /* Fill the conversion buffer, if it's empty */ - if (upsample->next_row_out >= cinfo->max_v_samp_factor) { - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Invoke per-component upsample method. Notice we pass a POINTER - * to color_buf[ci], so that fullsize_upsample can change it. - */ - (*upsample->methods[ci]) (cinfo, compptr, - input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]), - upsample->color_buf + ci); - } - upsample->next_row_out = 0; - } - - /* Color-convert and emit rows */ - - /* How many we have in the buffer: */ - num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out); - /* Not more than the distance to the end of the image. Need this test - * in case the image height is not a multiple of max_v_samp_factor: - */ - if (num_rows > upsample->rows_to_go) - num_rows = upsample->rows_to_go; - /* And not more than what the client can accept: */ - out_rows_avail -= *out_row_ctr; - if (num_rows > out_rows_avail) - num_rows = out_rows_avail; - - (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, - (JDIMENSION) upsample->next_row_out, - output_buf + *out_row_ctr, - (int) num_rows); - - /* Adjust counts */ - *out_row_ctr += num_rows; - upsample->rows_to_go -= num_rows; - upsample->next_row_out += num_rows; - /* When the buffer is emptied, declare this input row group consumed */ - if (upsample->next_row_out >= cinfo->max_v_samp_factor) - (*in_row_group_ctr)++; -} - - -/* - * These are the routines invoked by sep_upsample to upsample pixel values - * of a single component. One row group is processed per call. - */ - - -/* - * For full-size components, we just make color_buf[ci] point at the - * input buffer, and thus avoid copying any data. Note that this is - * safe only because sep_upsample doesn't declare the input row group - * "consumed" until we are done color converting and emitting it. - */ - -METHODDEF(void) -fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - *output_data_ptr = input_data; -} - - -/* - * This is a no-op version used for "uninteresting" components. - * These components will not be referenced by color conversion. - */ - -METHODDEF(void) -noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - *output_data_ptr = NULL; /* safety check */ -} - - -/* - * This version handles any integral sampling ratios. - * This is not used for typical JPEG files, so it need not be fast. - * Nor, for that matter, is it particularly accurate: the algorithm is - * simple replication of the input pixel onto the corresponding output - * pixels. The hi-falutin sampling literature refers to this as a - * "box filter". A box filter tends to introduce visible artifacts, - * so if you are actually going to use 3:1 or 4:1 sampling ratios - * you would be well advised to improve this code. - */ - -METHODDEF(void) -int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - JSAMPARRAY output_data = *output_data_ptr; - register JSAMPROW inptr, outptr; - register JSAMPLE invalue; - register int h; - JSAMPROW outend; - int h_expand, v_expand; - int inrow, outrow; - - h_expand = upsample->h_expand[compptr->component_index]; - v_expand = upsample->v_expand[compptr->component_index]; - - inrow = outrow = 0; - while (outrow < cinfo->max_v_samp_factor) { - /* Generate one output row with proper horizontal expansion */ - inptr = input_data[inrow]; - outptr = output_data[outrow]; - outend = outptr + cinfo->output_width; - while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ - for (h = h_expand; h > 0; h--) { - *outptr++ = invalue; - } - } - /* Generate any additional output rows by duplicating the first one */ - if (v_expand > 1) { - jcopy_sample_rows(output_data, outrow, output_data, outrow+1, - v_expand-1, cinfo->output_width); - } - inrow++; - outrow += v_expand; - } -} - - -/* - * Fast processing for the common case of 2:1 horizontal and 1:1 vertical. - * It's still a box filter. - */ - -METHODDEF(void) -h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - JSAMPARRAY output_data = *output_data_ptr; - register JSAMPROW inptr, outptr; - register JSAMPLE invalue; - JSAMPROW outend; - int inrow; - - for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { - inptr = input_data[inrow]; - outptr = output_data[inrow]; - outend = outptr + cinfo->output_width; - while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ - *outptr++ = invalue; - *outptr++ = invalue; - } - } -} - - -/* - * Fast processing for the common case of 2:1 horizontal and 2:1 vertical. - * It's still a box filter. - */ - -METHODDEF(void) -h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - JSAMPARRAY output_data = *output_data_ptr; - register JSAMPROW inptr, outptr; - register JSAMPLE invalue; - JSAMPROW outend; - int inrow, outrow; - - inrow = outrow = 0; - while (outrow < cinfo->max_v_samp_factor) { - inptr = input_data[inrow]; - outptr = output_data[outrow]; - outend = outptr + cinfo->output_width; - while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ - *outptr++ = invalue; - *outptr++ = invalue; - } - jcopy_sample_rows(output_data, outrow, output_data, outrow+1, - 1, cinfo->output_width); - inrow++; - outrow += 2; - } -} - - -/* - * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. - * - * The upsampling algorithm is linear interpolation between pixel centers, - * also known as a "triangle filter". This is a good compromise between - * speed and visual quality. The centers of the output pixels are 1/4 and 3/4 - * of the way between input pixel centers. - * - * A note about the "bias" calculations: when rounding fractional values to - * integer, we do not want to always round 0.5 up to the next integer. - * If we did that, we'd introduce a noticeable bias towards larger values. - * Instead, this code is arranged so that 0.5 will be rounded up or down at - * alternate pixel locations (a simple ordered dither pattern). - */ - -METHODDEF(void) -h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - JSAMPARRAY output_data = *output_data_ptr; - register JSAMPROW inptr, outptr; - register int invalue; - register JDIMENSION colctr; - int inrow; - - for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { - inptr = input_data[inrow]; - outptr = output_data[inrow]; - /* Special case for first column */ - invalue = GETJSAMPLE(*inptr++); - *outptr++ = (JSAMPLE) invalue; - *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2); - - for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { - /* General case: 3/4 * nearer pixel + 1/4 * further pixel */ - invalue = GETJSAMPLE(*inptr++) * 3; - *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2); - *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2); - } - - /* Special case for last column */ - invalue = GETJSAMPLE(*inptr); - *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2); - *outptr++ = (JSAMPLE) invalue; - } -} - - -/* - * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. - * Again a triangle filter; see comments for h2v1 case, above. - * - * It is OK for us to reference the adjacent input rows because we demanded - * context from the main buffer controller (see initialization code). - */ - -METHODDEF(void) -h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) -{ - JSAMPARRAY output_data = *output_data_ptr; - register JSAMPROW inptr0, inptr1, outptr; -#if BITS_IN_JSAMPLE == 8 - register int thiscolsum, lastcolsum, nextcolsum; -#else - register JPEG_INT32 thiscolsum, lastcolsum, nextcolsum; -#endif - register JDIMENSION colctr; - int inrow, outrow, v; - - inrow = outrow = 0; - while (outrow < cinfo->max_v_samp_factor) { - for (v = 0; v < 2; v++) { - /* inptr0 points to nearest input row, inptr1 points to next nearest */ - inptr0 = input_data[inrow]; - if (v == 0) /* next nearest is row above */ - inptr1 = input_data[inrow-1]; - else /* next nearest is row below */ - inptr1 = input_data[inrow+1]; - outptr = output_data[outrow++]; - - /* Special case for first column */ - thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); - nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); - *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4); - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); - lastcolsum = thiscolsum; thiscolsum = nextcolsum; - - for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { - /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ - /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ - nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); - lastcolsum = thiscolsum; thiscolsum = nextcolsum; - } - - /* Special case for last column */ - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4); - } - inrow++; - } -} - - -/* - * Module initialization routine for upsampling. - */ - -GLOBAL(void) -jinit_upsampler (j_decompress_ptr cinfo) -{ - my_upsample_ptr upsample; - int ci; - jpeg_component_info * compptr; - wxjpeg_boolean need_buffer, do_fancy; - int h_in_group, v_in_group, h_out_group, v_out_group; - - upsample = (my_upsample_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); - cinfo->upsample = (struct jpeg_upsampler *) upsample; - upsample->pub.start_pass = start_pass_upsample; - upsample->pub.upsample = sep_upsample; - upsample->pub.need_context_rows = FALSE; /* until we find out differently */ - - if (cinfo->CCIR601_sampling) /* this isn't supported */ - ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); - - /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1, - * so don't ask for it. - */ - do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1; - - /* Verify we can handle the sampling factors, select per-component methods, - * and create storage as needed. - */ - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - /* Compute size of an "input group" after IDCT scaling. This many samples - * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. - */ - h_in_group = (compptr->h_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; - v_in_group = (compptr->v_samp_factor * compptr->DCT_scaled_size) / - cinfo->min_DCT_scaled_size; - h_out_group = cinfo->max_h_samp_factor; - v_out_group = cinfo->max_v_samp_factor; - upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ - need_buffer = TRUE; - if (! compptr->component_needed) { - /* Don't bother to upsample an uninteresting component. */ - upsample->methods[ci] = noop_upsample; - need_buffer = FALSE; - } else if (h_in_group == h_out_group && v_in_group == v_out_group) { - /* Fullsize components can be processed without any work. */ - upsample->methods[ci] = fullsize_upsample; - need_buffer = FALSE; - } else if (h_in_group * 2 == h_out_group && - v_in_group == v_out_group) { - /* Special cases for 2h1v upsampling */ - if (do_fancy && compptr->downsampled_width > 2) - upsample->methods[ci] = h2v1_fancy_upsample; - else - upsample->methods[ci] = h2v1_upsample; - } else if (h_in_group * 2 == h_out_group && - v_in_group * 2 == v_out_group) { - /* Special cases for 2h2v upsampling */ - if (do_fancy && compptr->downsampled_width > 2) { - upsample->methods[ci] = h2v2_fancy_upsample; - upsample->pub.need_context_rows = TRUE; - } else - upsample->methods[ci] = h2v2_upsample; - } else if ((h_out_group % h_in_group) == 0 && - (v_out_group % v_in_group) == 0) { - /* Generic integral-factors upsampling method */ - upsample->methods[ci] = int_upsample; - upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); - upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); - } else - ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); - if (need_buffer) { - upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) jround_up((long) cinfo->output_width, - (long) cinfo->max_h_samp_factor), - (JDIMENSION) cinfo->max_v_samp_factor); - } - } -} diff --git a/Source/3rdParty/wx/src/jpeg/jdtrans.c b/Source/3rdParty/wx/src/jpeg/jdtrans.c deleted file mode 100644 index d22388684..000000000 --- a/Source/3rdParty/wx/src/jpeg/jdtrans.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * jdtrans.c - * - * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains library routines for transcoding decompression, - * that is, reading raw DCT coefficient arrays from an input JPEG file. - * The routines in jdapimin.c will also be needed by a transcoder. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* Forward declarations */ -LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); - - -/* - * Read the coefficient arrays from a JPEG file. - * jpeg_read_header must be completed before calling this. - * - * The entire image is read into a set of virtual coefficient-block arrays, - * one per component. The return value is a pointer to the array of - * virtual-array descriptors. These can be manipulated directly via the - * JPEG memory manager, or handed off to jpeg_write_coefficients(). - * To release the memory occupied by the virtual arrays, call - * jpeg_finish_decompress() when done with the data. - * - * An alternative usage is to simply obtain access to the coefficient arrays - * during a buffered-image-mode decompression operation. This is allowed - * after any jpeg_finish_output() call. The arrays can be accessed until - * jpeg_finish_decompress() is called. (Note that any call to the library - * may reposition the arrays, so don't rely on access_virt_barray() results - * to stay valid across library calls.) - * - * Returns NULL if suspended. This case need be checked only if - * a suspending data source is used. - */ - -GLOBAL(jvirt_barray_ptr *) -jpeg_read_coefficients (j_decompress_ptr cinfo) -{ - if (cinfo->global_state == DSTATE_READY) { - /* First call: initialize active modules */ - transdecode_master_selection(cinfo); - cinfo->global_state = DSTATE_RDCOEFS; - } - if (cinfo->global_state == DSTATE_RDCOEFS) { - /* Absorb whole file into the coef buffer */ - for (;;) { - int retcode; - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - /* Absorb some more input */ - retcode = (*cinfo->inputctl->consume_input) (cinfo); - if (retcode == JPEG_SUSPENDED) - return NULL; - if (retcode == JPEG_REACHED_EOI) - break; - /* Advance progress counter if appropriate */ - if (cinfo->progress != NULL && - (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { - if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { - /* startup underestimated number of scans; ratchet up one scan */ - cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; - } - } - } - /* Set state so that jpeg_finish_decompress does the right thing */ - cinfo->global_state = DSTATE_STOPPING; - } - /* At this point we should be in state DSTATE_STOPPING if being used - * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access - * to the coefficients during a full buffered-image-mode decompression. - */ - if ((cinfo->global_state == DSTATE_STOPPING || - cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { - return cinfo->coef->coef_arrays; - } - /* Oops, improper usage */ - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - return NULL; /* keep compiler happy */ -} - - -/* - * Master selection of decompression modules for transcoding. - * This substitutes for jdmaster.c's initialization of the full decompressor. - */ - -LOCAL(void) -transdecode_master_selection (j_decompress_ptr cinfo) -{ - /* This is effectively a buffered-image operation. */ - cinfo->buffered_image = TRUE; - - /* Entropy decoding: either Huffman or arithmetic coding. */ - if (cinfo->arith_code) { - ERREXIT(cinfo, JERR_ARITH_NOTIMPL); - } else { - if (cinfo->progressive_mode) { -#ifdef D_PROGRESSIVE_SUPPORTED - jinit_phuff_decoder(cinfo); -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } else - jinit_huff_decoder(cinfo); - } - - /* Always get a full-image coefficient buffer. */ - jinit_d_coef_controller(cinfo, TRUE); - - /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); - - /* Initialize input side of decompressor to consume first scan. */ - (*cinfo->inputctl->start_input_pass) (cinfo); - /* Initialize progress monitoring. */ - if (cinfo->progress != NULL) { - int nscans; - /* Estimate number of scans to set pass_limit. */ - if (cinfo->progressive_mode) { - /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ - nscans = 2 + 3 * cinfo->num_components; - } else if (cinfo->inputctl->has_multiple_scans) { - /* For a nonprogressive multiscan file, estimate 1 scan per component. */ - nscans = cinfo->num_components; - } else { - nscans = 1; - } - cinfo->progress->pass_counter = 0L; - cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; - cinfo->progress->completed_passes = 0; - cinfo->progress->total_passes = 1; - } -} - diff --git a/Source/3rdParty/wx/src/jpeg/jerror.c b/Source/3rdParty/wx/src/jpeg/jerror.c deleted file mode 100644 index 660c4a6dd..000000000 --- a/Source/3rdParty/wx/src/jpeg/jerror.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * jerror.c - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains simple error-reporting and trace-message routines. - * These are suitable for Unix-like systems and others where writing to - * stderr is the right thing to do. Many applications will want to replace - * some or all of these routines. - * - * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile, - * you get a Windows-specific hack to display error messages in a dialog box. - * It ain't much, but it beats dropping error messages into the bit bucket, - * which is what happens to output to stderr under most Windows C compilers. - * - * These routines are used by both the compression and decompression code. - */ - -/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -#include "jinclude.h" -#include "jpeglib.h" -#include "jversion.h" -#include "jerror.h" - -#ifdef USE_WINDOWS_MESSAGEBOX -#include -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif - - -/* - * Create the message string table. - * We do this from the master message list in jerror.h by re-reading - * jerror.h with a suitable definition for macro JMESSAGE. - * The message table is made an external symbol just in case any applications - * want to refer to it directly. - */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_message_table jMsgTable -#endif - -#define JMESSAGE(code,string) string , - -const char * const jpeg_std_message_table[] = { -#include "jerror.h" - NULL -}; - - -/* - * Error exit handler: must not return to caller. - * - * Applications may override this if they want to get control back after - * an error. Typically one would longjmp somewhere instead of exiting. - * The setjmp buffer can be made a private field within an expanded error - * handler object. Note that the info needed to generate an error message - * is stored in the error object, so you can generate the message now or - * later, at your convenience. - * You should make sure that the JPEG object is cleaned up (with jpeg_abort - * or jpeg_destroy) at some point. - */ - -METHODDEF(void) -error_exit (j_common_ptr cinfo) -{ - /* Always display the message */ - (*cinfo->err->output_message) (cinfo); - - /* Let the memory manager delete any temp files before we die */ - jpeg_destroy(cinfo); - - exit(EXIT_FAILURE); -} - - -/* - * Actual output of an error or trace message. - * Applications may override this method to send JPEG messages somewhere - * other than stderr. - * - * On Windows, printing to stderr is generally completely useless, - * so we provide optional code to produce an error-dialog popup. - * Most Windows applications will still prefer to override this routine, - * but if they don't, it'll do something at least marginally useful. - * - * NOTE: to use the library in an environment that doesn't support the - * C stdio library, you may have to delete the call to fprintf() entirely, - * not just not use this routine. - */ - -METHODDEF(void) -output_message (j_common_ptr cinfo) -{ - char buffer[JMSG_LENGTH_MAX]; - - /* Create the message */ - (*cinfo->err->format_message) (cinfo, buffer); - -#ifdef USE_WINDOWS_MESSAGEBOX - /* Display it in a message dialog box */ - MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", - MB_OK | MB_ICONERROR); -#else - /* Send it to stderr, adding a newline */ - fprintf(stderr, "%s\n", buffer); -#endif -} - - -/* - * Decide whether to emit a trace or warning message. - * msg_level is one of: - * -1: recoverable corrupt-data warning, may want to abort. - * 0: important advisory messages (always display to user). - * 1: first level of tracing detail. - * 2,3,...: successively more detailed tracing messages. - * An application might override this method if it wanted to abort on warnings - * or change the policy about which messages to display. - */ - -METHODDEF(void) -emit_message (j_common_ptr cinfo, int msg_level) -{ - struct jpeg_error_mgr * err = cinfo->err; - - if (msg_level < 0) { - /* It's a warning message. Since corrupt files may generate many warnings, - * the policy implemented here is to show only the first warning, - * unless trace_level >= 3. - */ - if (err->num_warnings == 0 || err->trace_level >= 3) - (*err->output_message) (cinfo); - /* Always count warnings in num_warnings. */ - err->num_warnings++; - } else { - /* It's a trace message. Show it if trace_level >= msg_level. */ - if (err->trace_level >= msg_level) - (*err->output_message) (cinfo); - } -} - - -/* - * Format a message string for the most recent JPEG error or message. - * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX - * characters. Note that no '\n' character is added to the string. - * Few applications should need to override this method. - */ - -METHODDEF(void) -format_message (j_common_ptr cinfo, char * buffer) -{ - struct jpeg_error_mgr * err = cinfo->err; - int msg_code = err->msg_code; - const char * msgtext = NULL; - const char * msgptr; - char ch; - wxjpeg_boolean isstring; - - /* Look up message string in proper table */ - if (msg_code > 0 && msg_code <= err->last_jpeg_message) { - msgtext = err->jpeg_message_table[msg_code]; - } else if (err->addon_message_table != NULL && - msg_code >= err->first_addon_message && - msg_code <= err->last_addon_message) { - msgtext = err->addon_message_table[msg_code - err->first_addon_message]; - } - - /* Defend against bogus message number */ - if (msgtext == NULL) { - err->msg_parm.i[0] = msg_code; - msgtext = err->jpeg_message_table[0]; - } - - /* Check for string parameter, as indicated by %s in the message text */ - isstring = FALSE; - msgptr = msgtext; - while ((ch = *msgptr++) != '\0') { - if (ch == '%') { - if (*msgptr == 's') isstring = TRUE; - break; - } - } - - /* Format the message into the passed buffer */ - if (isstring) - sprintf(buffer, msgtext, err->msg_parm.s); - else - sprintf(buffer, msgtext, - err->msg_parm.i[0], err->msg_parm.i[1], - err->msg_parm.i[2], err->msg_parm.i[3], - err->msg_parm.i[4], err->msg_parm.i[5], - err->msg_parm.i[6], err->msg_parm.i[7]); -} - - -/* - * Reset error state variables at start of a new image. - * This is called during compression startup to reset trace/error - * processing to default state, without losing any application-specific - * method pointers. An application might possibly want to override - * this method if it has additional error processing state. - */ - -METHODDEF(void) -reset_error_mgr (j_common_ptr cinfo) -{ - cinfo->err->num_warnings = 0; - /* trace_level is not reset since it is an application-supplied parameter */ - cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ -} - - -/* - * Fill in the standard error-handling methods in a jpeg_error_mgr object. - * Typical call is: - * struct jpeg_compress_struct cinfo; - * struct jpeg_error_mgr err; - * - * cinfo.err = jpeg_std_error(&err); - * after which the application may override some of the methods. - */ - -GLOBAL(struct jpeg_error_mgr *) -jpeg_std_error (struct jpeg_error_mgr * err) -{ - err->error_exit = error_exit; - err->emit_message = emit_message; - err->output_message = output_message; - err->format_message = format_message; - err->reset_error_mgr = reset_error_mgr; - - err->trace_level = 0; /* default = no tracing */ - err->num_warnings = 0; /* no warnings emitted yet */ - err->msg_code = 0; /* may be useful as a flag for "no error" */ - - /* Initialize message table pointers */ - err->jpeg_message_table = jpeg_std_message_table; - err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; - - err->addon_message_table = NULL; - err->first_addon_message = 0; /* for safety */ - err->last_addon_message = 0; - - return err; -} diff --git a/Source/3rdParty/wx/src/jpeg/jerror.h b/Source/3rdParty/wx/src/jpeg/jerror.h deleted file mode 100644 index fc2fffeac..000000000 --- a/Source/3rdParty/wx/src/jpeg/jerror.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * jerror.h - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file defines the error and message codes for the JPEG library. - * Edit this file to add new codes, or to translate the message strings to - * some other language. - * A set of error-reporting macros are defined too. Some applications using - * the JPEG library may wish to include this file to get the error codes - * and/or the macros. - */ - -/* - * To define the enum list of message codes, include this file without - * defining macro JMESSAGE. To create a message string table, include it - * again with a suitable JMESSAGE definition (see jerror.c for an example). - */ -#ifndef JMESSAGE -#ifndef JERROR_H -/* First time through, define the enum list */ -#define JMAKE_ENUM_LIST -#else -/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ -#define JMESSAGE(code,string) -#endif /* JERROR_H */ -#endif /* JMESSAGE */ - -#ifdef JMAKE_ENUM_LIST - -typedef enum { - -#define JMESSAGE(code,string) code , - -#endif /* JMAKE_ENUM_LIST */ - -JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ - -/* For maintenance convenience, list is alphabetical by message code name */ -JMESSAGE(JERR_ARITH_NOTIMPL, - "Sorry, there are legal restrictions on arithmetic coding") -JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") -JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") -JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") -JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") -JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") -JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") -JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") -JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") -JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") -JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") -JMESSAGE(JERR_BAD_LIB_VERSION, - "Wrong JPEG library version: library is %d, caller expects %d") -JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") -JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") -JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") -JMESSAGE(JERR_BAD_PROGRESSION, - "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") -JMESSAGE(JERR_BAD_PROG_SCRIPT, - "Invalid progressive parameters at scan script entry %d") -JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") -JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") -JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") -JMESSAGE(JERR_BAD_STRUCT_SIZE, - "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") -JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") -JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") -JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") -JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") -JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") -JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") -JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") -JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") -JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") -JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") -JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") -JMESSAGE(JERR_EMS_READ, "Read from EMS failed") -JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") -JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") -JMESSAGE(JERR_FILE_READ, "Input file read error") -JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") -JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") -JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") -JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") -JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") -JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") -JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") -JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, - "Cannot transcode due to multiple use of quantization table %d") -JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") -JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") -JMESSAGE(JERR_NOTIMPL, "Not implemented yet") -JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") -JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") -JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") -JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") -JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") -JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") -JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") -JMESSAGE(JERR_QUANT_COMPONENTS, - "Cannot quantize more than %d color components") -JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") -JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") -JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") -JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") -JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") -JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") -JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") -JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") -JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") -JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") -JMESSAGE(JERR_TFILE_WRITE, - "Write failed on temporary file --- out of disk space?") -JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") -JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") -JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") -JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") -JMESSAGE(JERR_XMS_READ, "Read from XMS failed") -JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") -JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) -JMESSAGE(JMSG_VERSION, JVERSION) -JMESSAGE(JTRC_16BIT_TABLES, - "Caution: quantization tables are too coarse for baseline JPEG") -JMESSAGE(JTRC_ADOBE, - "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") -JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") -JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") -JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") -JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") -JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") -JMESSAGE(JTRC_DRI, "Define Restart Interval %u") -JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") -JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") -JMESSAGE(JTRC_EOI, "End Of Image") -JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") -JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") -JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, - "Warning: thumbnail image size does not match data length %u") -JMESSAGE(JTRC_JFIF_EXTENSION, - "JFIF extension marker: type 0x%02x, length %u") -JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") -JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") -JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") -JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") -JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") -JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") -JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") -JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") -JMESSAGE(JTRC_RST, "RST%d") -JMESSAGE(JTRC_SMOOTH_NOTIMPL, - "Smoothing not supported with nonstandard sampling ratios") -JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") -JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") -JMESSAGE(JTRC_SOI, "Start of Image") -JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") -JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") -JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") -JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") -JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") -JMESSAGE(JTRC_THUMB_JPEG, - "JFIF extension marker: JPEG-compressed thumbnail image, length %u") -JMESSAGE(JTRC_THUMB_PALETTE, - "JFIF extension marker: palette thumbnail image, length %u") -JMESSAGE(JTRC_THUMB_RGB, - "JFIF extension marker: RGB thumbnail image, length %u") -JMESSAGE(JTRC_UNKNOWN_IDS, - "Unrecognized component IDs %d %d %d, assuming YCbCr") -JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") -JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") -JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") -JMESSAGE(JWRN_BOGUS_PROGRESSION, - "Inconsistent progression sequence for component %d coefficient %d") -JMESSAGE(JWRN_EXTRANEOUS_DATA, - "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") -JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") -JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") -JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") -JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") -JMESSAGE(JWRN_MUST_RESYNC, - "Corrupt JPEG data: found marker 0x%02x instead of RST%d") -JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") -JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") - -#ifdef JMAKE_ENUM_LIST - - JMSG_LASTMSGCODE -} J_MESSAGE_CODE; - -#undef JMAKE_ENUM_LIST -#endif /* JMAKE_ENUM_LIST */ - -/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ -#undef JMESSAGE - - -#ifndef JERROR_H -#define JERROR_H - -/* Macros to simplify using the error and trace message stuff */ -/* The first parameter is either type of cinfo pointer */ - -/* Fatal errors (print message and exit) */ -#define ERREXIT(cinfo,code) \ - ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT1(cinfo,code,p1) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT2(cinfo,code,p1,p2) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT3(cinfo,code,p1,p2,p3) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (cinfo)->err->msg_parm.i[1] = (p2), \ - (cinfo)->err->msg_parm.i[2] = (p3), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (cinfo)->err->msg_parm.i[1] = (p2), \ - (cinfo)->err->msg_parm.i[2] = (p3), \ - (cinfo)->err->msg_parm.i[3] = (p4), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXITS(cinfo,code,str) \ - ((cinfo)->err->msg_code = (code), \ - strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) - -#define MAKESTMT(stuff) do { stuff } while (0) - -/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ -#define WARNMS(cinfo,code) \ - ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) -#define WARNMS1(cinfo,code,p1) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) -#define WARNMS2(cinfo,code,p1,p2) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) - -/* Informational/debugging messages */ -#define TRACEMS(cinfo,lvl,code) \ - ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS1(cinfo,lvl,code,p1) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS2(cinfo,lvl,code,p1,p2) \ - ((cinfo)->err->msg_code = (code), \ - (cinfo)->err->msg_parm.i[0] = (p1), \ - (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - _mp[4] = (p5); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMSS(cinfo,lvl,code,str) \ - ((cinfo)->err->msg_code = (code), \ - strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) - -#endif /* JERROR_H */ diff --git a/Source/3rdParty/wx/src/jpeg/jfdctflt.c b/Source/3rdParty/wx/src/jpeg/jfdctflt.c deleted file mode 100644 index 79d7a0078..000000000 --- a/Source/3rdParty/wx/src/jpeg/jfdctflt.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * jfdctflt.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a floating-point implementation of the - * forward DCT (Discrete Cosine Transform). - * - * This implementation should be more accurate than either of the integer - * DCT implementations. However, it may not give the same results on all - * machines because of differences in roundoff behavior. Speed will depend - * on the hardware's floating point capacity. - * - * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT - * on each column. Direct algorithms are also available, but they are - * much more complex and seem not to be any faster when reduced to code. - * - * This implementation is based on Arai, Agui, and Nakajima's algorithm for - * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in - * Japanese, but the algorithm is described in the Pennebaker & Mitchell - * JPEG textbook (see REFERENCES section in file README). The following code - * is based directly on figure 4-8 in P&M. - * While an 8-point DCT cannot be done in less than 11 multiplies, it is - * possible to arrange the computation so that many of the multiplies are - * simple scalings of the final outputs. These multiplies can then be - * folded into the multiplications or divisions by the JPEG quantization - * table entries. The AA&N method leaves only 5 multiplies and 29 adds - * to be done in the DCT itself. - * The primary disadvantage of this method is that with a fixed-point - * implementation, accuracy is lost due to imprecise representation of the - * scaled quantization values. However, that problem does not arise if - * we use floating point arithmetic. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_FLOAT_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* - * Perform the forward DCT on one block of samples. - */ - -GLOBAL(void) -jpeg_fdct_float (FAST_FLOAT * data) -{ - FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - FAST_FLOAT tmp10, tmp11, tmp12, tmp13; - FAST_FLOAT z1, z2, z3, z4, z5, z11, z13; - FAST_FLOAT *dataptr; - int ctr; - - /* Pass 1: process rows. */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[0] + dataptr[7]; - tmp7 = dataptr[0] - dataptr[7]; - tmp1 = dataptr[1] + dataptr[6]; - tmp6 = dataptr[1] - dataptr[6]; - tmp2 = dataptr[2] + dataptr[5]; - tmp5 = dataptr[2] - dataptr[5]; - tmp3 = dataptr[3] + dataptr[4]; - tmp4 = dataptr[3] - dataptr[4]; - - /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[0] = tmp10 + tmp11; /* phase 3 */ - dataptr[4] = tmp10 - tmp11; - - z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ - dataptr[2] = tmp13 + z1; /* phase 5 */ - dataptr[6] = tmp13 - z1; - - /* Odd part */ - - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ - z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ - z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ - z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ - - z11 = tmp7 + z3; /* phase 5 */ - z13 = tmp7 - z3; - - dataptr[5] = z13 + z2; /* phase 6 */ - dataptr[3] = z13 - z2; - dataptr[1] = z11 + z4; - dataptr[7] = z11 - z4; - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; - tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; - tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; - tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; - tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; - tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; - tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; - tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - - /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ - dataptr[DCTSIZE*4] = tmp10 - tmp11; - - z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ - dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ - dataptr[DCTSIZE*6] = tmp13 - z1; - - /* Odd part */ - - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ - z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ - z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ - z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ - - z11 = tmp7 + z3; /* phase 5 */ - z13 = tmp7 - z3; - - dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ - dataptr[DCTSIZE*3] = z13 - z2; - dataptr[DCTSIZE*1] = z11 + z4; - dataptr[DCTSIZE*7] = z11 - z4; - - dataptr++; /* advance pointer to next column */ - } -} - -#endif /* DCT_FLOAT_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jfdctfst.c b/Source/3rdParty/wx/src/jpeg/jfdctfst.c deleted file mode 100644 index 37900ec90..000000000 --- a/Source/3rdParty/wx/src/jpeg/jfdctfst.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * jfdctfst.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a fast, not so accurate integer implementation of the - * forward DCT (Discrete Cosine Transform). - * - * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT - * on each column. Direct algorithms are also available, but they are - * much more complex and seem not to be any faster when reduced to code. - * - * This implementation is based on Arai, Agui, and Nakajima's algorithm for - * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in - * Japanese, but the algorithm is described in the Pennebaker & Mitchell - * JPEG textbook (see REFERENCES section in file README). The following code - * is based directly on figure 4-8 in P&M. - * While an 8-point DCT cannot be done in less than 11 multiplies, it is - * possible to arrange the computation so that many of the multiplies are - * simple scalings of the final outputs. These multiplies can then be - * folded into the multiplications or divisions by the JPEG quantization - * table entries. The AA&N method leaves only 5 multiplies and 29 adds - * to be done in the DCT itself. - * The primary disadvantage of this method is that with fixed-point math, - * accuracy is lost due to imprecise representation of the scaled - * quantization values. The smaller the quantization table entry, the less - * precise the scaled value, so this implementation does worse with high- - * quality-setting files than with low-quality ones. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_IFAST_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* Scaling decisions are generally the same as in the LL&M algorithm; - * see jfdctint.c for more details. However, we choose to descale - * (right shift) multiplication products as soon as they are formed, - * rather than carrying additional fractional bits into subsequent additions. - * This compromises accuracy slightly, but it lets us save a few shifts. - * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) - * everywhere except in the multiplications proper; this saves a good deal - * of work on 16-bit-int machines. - * - * Again to save a few shifts, the intermediate results between pass 1 and - * pass 2 are not upscaled, but are represented only to integral precision. - * - * A final compromise is to represent the multiplicative constants to only - * 8 fractional bits, rather than 13. This saves some shifting work on some - * machines, and may also reduce the cost of multiplication (since there - * are fewer one-bits in the constants). - */ - -#define CONST_BITS 8 - - -/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus - * causing a lot of useless floating-point operations at run time. - * To get around this we use the following pre-calculated constants. - * If you change CONST_BITS you may want to add appropriate values. - * (With a reasonable C compiler, you can just rely on the FIX() macro...) - */ - -#if CONST_BITS == 8 -#define FIX_0_382683433 ((JPEG_INT32) 98) /* FIX(0.382683433) */ -#define FIX_0_541196100 ((JPEG_INT32) 139) /* FIX(0.541196100) */ -#define FIX_0_707106781 ((JPEG_INT32) 181) /* FIX(0.707106781) */ -#define FIX_1_306562965 ((JPEG_INT32) 334) /* FIX(1.306562965) */ -#else -#define FIX_0_382683433 FIX(0.382683433) -#define FIX_0_541196100 FIX(0.541196100) -#define FIX_0_707106781 FIX(0.707106781) -#define FIX_1_306562965 FIX(1.306562965) -#endif - - -/* We can gain a little more speed, with a further compromise in accuracy, - * by omitting the addition in a descaling shift. This yields an incorrectly - * rounded result half the time... - */ - -#ifndef USE_ACCURATE_ROUNDING -#undef DESCALE -#define DESCALE(x,n) RIGHT_SHIFT(x, n) -#endif - - -/* Multiply a DCTELEM variable by an INT32 constant, and immediately - * descale to yield a DCTELEM result. - */ - -#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) - - -/* - * Perform the forward DCT on one block of samples. - */ - -GLOBAL(void) -jpeg_fdct_ifast (DCTELEM * data) -{ - DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - DCTELEM tmp10, tmp11, tmp12, tmp13; - DCTELEM z1, z2, z3, z4, z5, z11, z13; - DCTELEM *dataptr; - int ctr; - SHIFT_TEMPS - - /* Pass 1: process rows. */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[0] + dataptr[7]; - tmp7 = dataptr[0] - dataptr[7]; - tmp1 = dataptr[1] + dataptr[6]; - tmp6 = dataptr[1] - dataptr[6]; - tmp2 = dataptr[2] + dataptr[5]; - tmp5 = dataptr[2] - dataptr[5]; - tmp3 = dataptr[3] + dataptr[4]; - tmp4 = dataptr[3] - dataptr[4]; - - /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[0] = tmp10 + tmp11; /* phase 3 */ - dataptr[4] = tmp10 - tmp11; - - z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ - dataptr[2] = tmp13 + z1; /* phase 5 */ - dataptr[6] = tmp13 - z1; - - /* Odd part */ - - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ - z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ - z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ - z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ - - z11 = tmp7 + z3; /* phase 5 */ - z13 = tmp7 - z3; - - dataptr[5] = z13 + z2; /* phase 6 */ - dataptr[3] = z13 - z2; - dataptr[1] = z11 + z4; - dataptr[7] = z11 - z4; - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; - tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; - tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; - tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; - tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; - tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; - tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; - tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - - /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ - dataptr[DCTSIZE*4] = tmp10 - tmp11; - - z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ - dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ - dataptr[DCTSIZE*6] = tmp13 - z1; - - /* Odd part */ - - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ - z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ - z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ - z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ - - z11 = tmp7 + z3; /* phase 5 */ - z13 = tmp7 - z3; - - dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ - dataptr[DCTSIZE*3] = z13 - z2; - dataptr[DCTSIZE*1] = z11 + z4; - dataptr[DCTSIZE*7] = z11 - z4; - - dataptr++; /* advance pointer to next column */ - } -} - -#endif /* DCT_IFAST_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jfdctint.c b/Source/3rdParty/wx/src/jpeg/jfdctint.c deleted file mode 100644 index 4543b2e86..000000000 --- a/Source/3rdParty/wx/src/jpeg/jfdctint.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * jfdctint.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a slow-but-accurate integer implementation of the - * forward DCT (Discrete Cosine Transform). - * - * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT - * on each column. Direct algorithms are also available, but they are - * much more complex and seem not to be any faster when reduced to code. - * - * This implementation is based on an algorithm described in - * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT - * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, - * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. - * The primary algorithm described there uses 11 multiplies and 29 adds. - * We use their alternate method with 12 multiplies and 32 adds. - * The advantage of this method is that no data path contains more than one - * multiplication; this allows a very simple and accurate implementation in - * scaled fixed-point arithmetic, with a minimal number of shifts. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_ISLOW_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* - * The poop on this scaling stuff is as follows: - * - * Each 1-D DCT step produces outputs which are a factor of sqrt(N) - * larger than the true DCT outputs. The final outputs are therefore - * a factor of N larger than desired; since N=8 this can be cured by - * a simple right shift at the end of the algorithm. The advantage of - * this arrangement is that we save two multiplications per 1-D DCT, - * because the y0 and y4 outputs need not be divided by sqrt(N). - * In the IJG code, this factor of 8 is removed by the quantization step - * (in jcdctmgr.c), NOT in this module. - * - * We have to do addition and subtraction of the integer inputs, which - * is no problem, and multiplication by fractional constants, which is - * a problem to do in integer arithmetic. We multiply all the constants - * by CONST_SCALE and convert them to integer constants (thus retaining - * CONST_BITS bits of precision in the constants). After doing a - * multiplication we have to divide the product by CONST_SCALE, with proper - * rounding, to produce the correct output. This division can be done - * cheaply as a right shift of CONST_BITS bits. We postpone shifting - * as long as possible so that partial sums can be added together with - * full fractional precision. - * - * The outputs of the first pass are scaled up by PASS1_BITS bits so that - * they are represented to better-than-integral precision. These outputs - * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word - * with the recommended scaling. (For 12-bit sample data, the intermediate - * array is INT32 anyway.) - * - * To avoid overflow of the 32-bit intermediate results in pass 2, we must - * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis - * shows that the values given below are the most effective. - */ - -#if BITS_IN_JSAMPLE == 8 -#define CONST_BITS 13 -#define PASS1_BITS 2 -#else -#define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus - * causing a lot of useless floating-point operations at run time. - * To get around this we use the following pre-calculated constants. - * If you change CONST_BITS you may want to add appropriate values. - * (With a reasonable C compiler, you can just rely on the FIX() macro...) - */ - -#if CONST_BITS == 13 -#define FIX_0_298631336 ((JPEG_INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((JPEG_INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((JPEG_INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((JPEG_INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((JPEG_INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((JPEG_INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((JPEG_INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((JPEG_INT32) 25172) /* FIX(3.072711026) */ -#else -#define FIX_0_298631336 FIX(0.298631336) -#define FIX_0_390180644 FIX(0.390180644) -#define FIX_0_541196100 FIX(0.541196100) -#define FIX_0_765366865 FIX(0.765366865) -#define FIX_0_899976223 FIX(0.899976223) -#define FIX_1_175875602 FIX(1.175875602) -#define FIX_1_501321110 FIX(1.501321110) -#define FIX_1_847759065 FIX(1.847759065) -#define FIX_1_961570560 FIX(1.961570560) -#define FIX_2_053119869 FIX(2.053119869) -#define FIX_2_562915447 FIX(2.562915447) -#define FIX_3_072711026 FIX(3.072711026) -#endif - - -/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. - * For 8-bit samples with the recommended scaling, all the variable - * and constant values involved are no more than 16 bits wide, so a - * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. - * For 12-bit samples, a full 32-bit multiplication will be needed. - */ - -#if BITS_IN_JSAMPLE == 8 -#define MULTIPLY(var,const) MULTIPLY16C16(var,const) -#else -#define MULTIPLY(var,const) ((var) * (const)) -#endif - - -/* - * Perform the forward DCT on one block of samples. - */ - -GLOBAL(void) -jpeg_fdct_islow (DCTELEM * data) -{ - JPEG_INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - JPEG_INT32 tmp10, tmp11, tmp12, tmp13; - JPEG_INT32 z1, z2, z3, z4, z5; - DCTELEM *dataptr; - int ctr; - SHIFT_TEMPS - - /* Pass 1: process rows. */ - /* Note results are scaled up by sqrt(8) compared to a true DCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[0] + dataptr[7]; - tmp7 = dataptr[0] - dataptr[7]; - tmp1 = dataptr[1] + dataptr[6]; - tmp6 = dataptr[1] - dataptr[6]; - tmp2 = dataptr[2] + dataptr[5]; - tmp5 = dataptr[2] - dataptr[5]; - tmp3 = dataptr[3] + dataptr[4]; - tmp4 = dataptr[3] - dataptr[4]; - - /* Even part per LL&M figure 1 --- note that published figure is faulty; - * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". - */ - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); - dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); - - z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); - dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), - CONST_BITS-PASS1_BITS); - dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), - CONST_BITS-PASS1_BITS); - - /* Odd part per figure 8 --- note paper omits factor of sqrt(2). - * cK represents cos(K*pi/16). - * i0..i3 in the paper are tmp4..tmp7 here. - */ - - z1 = tmp4 + tmp7; - z2 = tmp5 + tmp6; - z3 = tmp4 + tmp6; - z4 = tmp5 + tmp7; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - - tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); - dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); - dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); - dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. - * We remove the PASS1_BITS scaling, but leave the results scaled up - * by an overall factor of 8. - */ - - dataptr = data; - for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { - tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; - tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; - tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; - tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; - tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; - tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; - tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; - tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - - /* Even part per LL&M figure 1 --- note that published figure is faulty; - * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". - */ - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); - dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); - - z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); - dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), - CONST_BITS+PASS1_BITS); - dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), - CONST_BITS+PASS1_BITS); - - /* Odd part per figure 8 --- note paper omits factor of sqrt(2). - * cK represents cos(K*pi/16). - * i0..i3 in the paper are tmp4..tmp7 here. - */ - - z1 = tmp4 + tmp7; - z2 = tmp5 + tmp6; - z3 = tmp4 + tmp6; - z4 = tmp5 + tmp7; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - - tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, - CONST_BITS+PASS1_BITS); - dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, - CONST_BITS+PASS1_BITS); - dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, - CONST_BITS+PASS1_BITS); - dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, - CONST_BITS+PASS1_BITS); - - dataptr++; /* advance pointer to next column */ - } -} - -#endif /* DCT_ISLOW_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jidctflt.c b/Source/3rdParty/wx/src/jpeg/jidctflt.c deleted file mode 100644 index a0f22c295..000000000 --- a/Source/3rdParty/wx/src/jpeg/jidctflt.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * jidctflt.c - * - * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a floating-point implementation of the - * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine - * must also perform dequantization of the input coefficients. - * - * This implementation should be more accurate than either of the integer - * IDCT implementations. However, it may not give the same results on all - * machines because of differences in roundoff behavior. Speed will depend - * on the hardware's floating point capacity. - * - * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT - * on each row (or vice versa, but it's more convenient to emit a row at - * a time). Direct algorithms are also available, but they are much more - * complex and seem not to be any faster when reduced to code. - * - * This implementation is based on Arai, Agui, and Nakajima's algorithm for - * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in - * Japanese, but the algorithm is described in the Pennebaker & Mitchell - * JPEG textbook (see REFERENCES section in file README). The following code - * is based directly on figure 4-8 in P&M. - * While an 8-point DCT cannot be done in less than 11 multiplies, it is - * possible to arrange the computation so that many of the multiplies are - * simple scalings of the final outputs. These multiplies can then be - * folded into the multiplications or divisions by the JPEG quantization - * table entries. The AA&N method leaves only 5 multiplies and 29 adds - * to be done in the DCT itself. - * The primary disadvantage of this method is that with a fixed-point - * implementation, accuracy is lost due to imprecise representation of the - * scaled quantization values. However, that problem does not arise if - * we use floating point arithmetic. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_FLOAT_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* Dequantize a coefficient by multiplying it by the multiplier-table - * entry; produce a float result. - */ - -#define DEQUANTIZE(coef,quantval) (((FAST_FLOAT) (coef)) * (quantval)) - - -/* - * Perform dequantization and inverse DCT on one block of coefficients. - */ - -GLOBAL(void) -jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - FAST_FLOAT tmp10, tmp11, tmp12, tmp13; - FAST_FLOAT z5, z10, z11, z12, z13; - JCOEFPTR inptr; - FLOAT_MULT_TYPE * quantptr; - FAST_FLOAT * wsptr; - JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - int ctr; - FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ - SHIFT_TEMPS - - /* Pass 1: process columns from input, store into work array. */ - - inptr = coef_block; - quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table; - wsptr = workspace; - for (ctr = DCTSIZE; ctr > 0; ctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any column in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * column DCT calculations can be simplified this way. - */ - - if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { - /* AC terms all zero */ - FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - - wsptr[DCTSIZE*0] = dcval; - wsptr[DCTSIZE*1] = dcval; - wsptr[DCTSIZE*2] = dcval; - wsptr[DCTSIZE*3] = dcval; - wsptr[DCTSIZE*4] = dcval; - wsptr[DCTSIZE*5] = dcval; - wsptr[DCTSIZE*6] = dcval; - wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - continue; - } - - /* Even part */ - - tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); - tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - - tmp10 = tmp0 + tmp2; /* phase 3 */ - tmp11 = tmp0 - tmp2; - - tmp13 = tmp1 + tmp3; /* phases 5-3 */ - tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */ - - tmp0 = tmp10 + tmp13; /* phase 2 */ - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - /* Odd part */ - - tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - - z13 = tmp6 + tmp5; /* phase 6 */ - z10 = tmp6 - tmp5; - z11 = tmp4 + tmp7; - z12 = tmp4 - tmp7; - - tmp7 = z11 + z13; /* phase 5 */ - tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ - - z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ - tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ - tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ - - tmp6 = tmp12 - tmp7; /* phase 2 */ - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - wsptr[DCTSIZE*0] = tmp0 + tmp7; - wsptr[DCTSIZE*7] = tmp0 - tmp7; - wsptr[DCTSIZE*1] = tmp1 + tmp6; - wsptr[DCTSIZE*6] = tmp1 - tmp6; - wsptr[DCTSIZE*2] = tmp2 + tmp5; - wsptr[DCTSIZE*5] = tmp2 - tmp5; - wsptr[DCTSIZE*4] = tmp3 + tmp4; - wsptr[DCTSIZE*3] = tmp3 - tmp4; - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - } - - /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3. */ - - wsptr = workspace; - for (ctr = 0; ctr < DCTSIZE; ctr++) { - outptr = output_buf[ctr] + output_col; - /* Rows of zeroes can be exploited in the same way as we did with columns. - * However, the column calculation has created many nonzero AC terms, so - * the simplification applies less often (typically 5% to 10% of the time). - * And testing floats for zero is relatively expensive, so we don't bother. - */ - - /* Even part */ - - tmp10 = wsptr[0] + wsptr[4]; - tmp11 = wsptr[0] - wsptr[4]; - - tmp13 = wsptr[2] + wsptr[6]; - tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; - - tmp0 = tmp10 + tmp13; - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - /* Odd part */ - - z13 = wsptr[5] + wsptr[3]; - z10 = wsptr[5] - wsptr[3]; - z11 = wsptr[1] + wsptr[7]; - z12 = wsptr[1] - wsptr[7]; - - tmp7 = z11 + z13; - tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); - - z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ - tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ - tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ - - tmp6 = tmp12 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - /* Final output stage: scale down by a factor of 8 and range-limit */ - - outptr[0] = range_limit[(int) DESCALE((JPEG_INT32) (tmp0 + tmp7), 3) - & RANGE_MASK]; - outptr[7] = range_limit[(int) DESCALE((JPEG_INT32) (tmp0 - tmp7), 3) - & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE((JPEG_INT32) (tmp1 + tmp6), 3) - & RANGE_MASK]; - outptr[6] = range_limit[(int) DESCALE((JPEG_INT32) (tmp1 - tmp6), 3) - & RANGE_MASK]; - outptr[2] = range_limit[(int) DESCALE((JPEG_INT32) (tmp2 + tmp5), 3) - & RANGE_MASK]; - outptr[5] = range_limit[(int) DESCALE((JPEG_INT32) (tmp2 - tmp5), 3) - & RANGE_MASK]; - outptr[4] = range_limit[(int) DESCALE((JPEG_INT32) (tmp3 + tmp4), 3) - & RANGE_MASK]; - outptr[3] = range_limit[(int) DESCALE((JPEG_INT32) (tmp3 - tmp4), 3) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ - } -} - -#endif /* DCT_FLOAT_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jidctfst.c b/Source/3rdParty/wx/src/jpeg/jidctfst.c deleted file mode 100644 index d388b6178..000000000 --- a/Source/3rdParty/wx/src/jpeg/jidctfst.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - * jidctfst.c - * - * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a fast, not so accurate integer implementation of the - * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine - * must also perform dequantization of the input coefficients. - * - * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT - * on each row (or vice versa, but it's more convenient to emit a row at - * a time). Direct algorithms are also available, but they are much more - * complex and seem not to be any faster when reduced to code. - * - * This implementation is based on Arai, Agui, and Nakajima's algorithm for - * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in - * Japanese, but the algorithm is described in the Pennebaker & Mitchell - * JPEG textbook (see REFERENCES section in file README). The following code - * is based directly on figure 4-8 in P&M. - * While an 8-point DCT cannot be done in less than 11 multiplies, it is - * possible to arrange the computation so that many of the multiplies are - * simple scalings of the final outputs. These multiplies can then be - * folded into the multiplications or divisions by the JPEG quantization - * table entries. The AA&N method leaves only 5 multiplies and 29 adds - * to be done in the DCT itself. - * The primary disadvantage of this method is that with fixed-point math, - * accuracy is lost due to imprecise representation of the scaled - * quantization values. The smaller the quantization table entry, the less - * precise the scaled value, so this implementation does worse with high- - * quality-setting files than with low-quality ones. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_IFAST_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* Scaling decisions are generally the same as in the LL&M algorithm; - * see jidctint.c for more details. However, we choose to descale - * (right shift) multiplication products as soon as they are formed, - * rather than carrying additional fractional bits into subsequent additions. - * This compromises accuracy slightly, but it lets us save a few shifts. - * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) - * everywhere except in the multiplications proper; this saves a good deal - * of work on 16-bit-int machines. - * - * The dequantized coefficients are not integers because the AA&N scaling - * factors have been incorporated. We represent them scaled up by PASS1_BITS, - * so that the first and second IDCT rounds have the same input scaling. - * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to - * avoid a descaling shift; this compromises accuracy rather drastically - * for small quantization table entries, but it saves a lot of shifts. - * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway, - * so we use a much larger scaling factor to preserve accuracy. - * - * A final compromise is to represent the multiplicative constants to only - * 8 fractional bits, rather than 13. This saves some shifting work on some - * machines, and may also reduce the cost of multiplication (since there - * are fewer one-bits in the constants). - */ - -#if BITS_IN_JSAMPLE == 8 -#define CONST_BITS 8 -#define PASS1_BITS 2 -#else -#define CONST_BITS 8 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus - * causing a lot of useless floating-point operations at run time. - * To get around this we use the following pre-calculated constants. - * If you change CONST_BITS you may want to add appropriate values. - * (With a reasonable C compiler, you can just rely on the FIX() macro...) - */ - -#if CONST_BITS == 8 -#define FIX_1_082392200 ((JPEG_INT32) 277) /* FIX(1.082392200) */ -#define FIX_1_414213562 ((JPEG_INT32) 362) /* FIX(1.414213562) */ -#define FIX_1_847759065 ((JPEG_INT32) 473) /* FIX(1.847759065) */ -#define FIX_2_613125930 ((JPEG_INT32) 669) /* FIX(2.613125930) */ -#else -#define FIX_1_082392200 FIX(1.082392200) -#define FIX_1_414213562 FIX(1.414213562) -#define FIX_1_847759065 FIX(1.847759065) -#define FIX_2_613125930 FIX(2.613125930) -#endif - - -/* We can gain a little more speed, with a further compromise in accuracy, - * by omitting the addition in a descaling shift. This yields an incorrectly - * rounded result half the time... - */ - -#ifndef USE_ACCURATE_ROUNDING -#undef DESCALE -#define DESCALE(x,n) RIGHT_SHIFT(x, n) -#endif - - -/* Multiply a DCTELEM variable by an INT32 constant, and immediately - * descale to yield a DCTELEM result. - */ - -#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) - - -/* Dequantize a coefficient by multiplying it by the multiplier-table - * entry; produce a DCTELEM result. For 8-bit data a 16x16->16 - * multiplication will do. For 12-bit data, the multiplier table is - * declared INT32, so a 32-bit multiply will be used. - */ - -#if BITS_IN_JSAMPLE == 8 -#define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval)) -#else -#define DEQUANTIZE(coef,quantval) \ - DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS) -#endif - - -/* Like DESCALE, but applies to a DCTELEM and produces an int. - * We assume that int right shift is unsigned if INT32 right shift is. - */ - -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS DCTELEM ishift_temp; -#if BITS_IN_JSAMPLE == 8 -#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ -#else -#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ -#endif -#define IRIGHT_SHIFT(x,shft) \ - ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \ - (ishift_temp >> (shft))) -#else -#define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) -#endif - -#ifdef USE_ACCURATE_ROUNDING -#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n)) -#else -#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n)) -#endif - - -/* - * Perform dequantization and inverse DCT on one block of coefficients. - */ - -GLOBAL(void) -jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - DCTELEM tmp10, tmp11, tmp12, tmp13; - DCTELEM z5, z10, z11, z12, z13; - JCOEFPTR inptr; - IFAST_MULT_TYPE * quantptr; - int * wsptr; - JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - int ctr; - int workspace[DCTSIZE2]; /* buffers data between passes */ - SHIFT_TEMPS /* for DESCALE */ - ISHIFT_TEMPS /* for IDESCALE */ - - /* Pass 1: process columns from input, store into work array. */ - - inptr = coef_block; - quantptr = (IFAST_MULT_TYPE *) compptr->dct_table; - wsptr = workspace; - for (ctr = DCTSIZE; ctr > 0; ctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any column in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * column DCT calculations can be simplified this way. - */ - - if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { - /* AC terms all zero */ - int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - - wsptr[DCTSIZE*0] = dcval; - wsptr[DCTSIZE*1] = dcval; - wsptr[DCTSIZE*2] = dcval; - wsptr[DCTSIZE*3] = dcval; - wsptr[DCTSIZE*4] = dcval; - wsptr[DCTSIZE*5] = dcval; - wsptr[DCTSIZE*6] = dcval; - wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - continue; - } - - /* Even part */ - - tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); - tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - - tmp10 = tmp0 + tmp2; /* phase 3 */ - tmp11 = tmp0 - tmp2; - - tmp13 = tmp1 + tmp3; /* phases 5-3 */ - tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ - - tmp0 = tmp10 + tmp13; /* phase 2 */ - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - /* Odd part */ - - tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - - z13 = tmp6 + tmp5; /* phase 6 */ - z10 = tmp6 - tmp5; - z11 = tmp4 + tmp7; - z12 = tmp4 - tmp7; - - tmp7 = z11 + z13; /* phase 5 */ - tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ - - z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ - - tmp6 = tmp12 - tmp7; /* phase 2 */ - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); - wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); - wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); - wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); - wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5); - wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); - wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); - wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - } - - /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - wsptr = workspace; - for (ctr = 0; ctr < DCTSIZE; ctr++) { - outptr = output_buf[ctr] + output_col; - /* Rows of zeroes can be exploited in the same way as we did with columns. - * However, the column calculation has created many nonzero AC terms, so - * the simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - -#ifndef NO_ZERO_ROW_TEST - if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { - /* AC terms all zero */ - JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - - outptr[0] = dcval; - outptr[1] = dcval; - outptr[2] = dcval; - outptr[3] = dcval; - outptr[4] = dcval; - outptr[5] = dcval; - outptr[6] = dcval; - outptr[7] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ - continue; - } -#endif - - /* Even part */ - - tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); - tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); - - tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); - tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) - - tmp13; - - tmp0 = tmp10 + tmp13; - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - /* Odd part */ - - z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; - z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; - z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; - z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; - - tmp7 = z11 + z13; /* phase 5 */ - tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ - - z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ - - tmp6 = tmp12 - tmp7; /* phase 2 */ - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - /* Final output stage: scale down by a factor of 8 and range-limit */ - - outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) - & RANGE_MASK]; - outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) - & RANGE_MASK]; - outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) - & RANGE_MASK]; - outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) - & RANGE_MASK]; - outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) - & RANGE_MASK]; - outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) - & RANGE_MASK]; - outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) - & RANGE_MASK]; - outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ - } -} - -#endif /* DCT_IFAST_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jidctint.c b/Source/3rdParty/wx/src/jpeg/jidctint.c deleted file mode 100644 index 2783c2302..000000000 --- a/Source/3rdParty/wx/src/jpeg/jidctint.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * jidctint.c - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a slow-but-accurate integer implementation of the - * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine - * must also perform dequantization of the input coefficients. - * - * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT - * on each row (or vice versa, but it's more convenient to emit a row at - * a time). Direct algorithms are also available, but they are much more - * complex and seem not to be any faster when reduced to code. - * - * This implementation is based on an algorithm described in - * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT - * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, - * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. - * The primary algorithm described there uses 11 multiplies and 29 adds. - * We use their alternate method with 12 multiplies and 32 adds. - * The advantage of this method is that no data path contains more than one - * multiplication; this allows a very simple and accurate implementation in - * scaled fixed-point arithmetic, with a minimal number of shifts. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef DCT_ISLOW_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* - * The poop on this scaling stuff is as follows: - * - * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) - * larger than the true IDCT outputs. The final outputs are therefore - * a factor of N larger than desired; since N=8 this can be cured by - * a simple right shift at the end of the algorithm. The advantage of - * this arrangement is that we save two multiplications per 1-D IDCT, - * because the y0 and y4 inputs need not be divided by sqrt(N). - * - * We have to do addition and subtraction of the integer inputs, which - * is no problem, and multiplication by fractional constants, which is - * a problem to do in integer arithmetic. We multiply all the constants - * by CONST_SCALE and convert them to integer constants (thus retaining - * CONST_BITS bits of precision in the constants). After doing a - * multiplication we have to divide the product by CONST_SCALE, with proper - * rounding, to produce the correct output. This division can be done - * cheaply as a right shift of CONST_BITS bits. We postpone shifting - * as long as possible so that partial sums can be added together with - * full fractional precision. - * - * The outputs of the first pass are scaled up by PASS1_BITS bits so that - * they are represented to better-than-integral precision. These outputs - * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word - * with the recommended scaling. (To scale up 12-bit sample data further, an - * intermediate INT32 array would be needed.) - * - * To avoid overflow of the 32-bit intermediate results in pass 2, we must - * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis - * shows that the values given below are the most effective. - */ - -#if BITS_IN_JSAMPLE == 8 -#define CONST_BITS 13 -#define PASS1_BITS 2 -#else -#define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus - * causing a lot of useless floating-point operations at run time. - * To get around this we use the following pre-calculated constants. - * If you change CONST_BITS you may want to add appropriate values. - * (With a reasonable C compiler, you can just rely on the FIX() macro...) - */ - -#if CONST_BITS == 13 -#define FIX_0_298631336 ((JPEG_INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((JPEG_INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((JPEG_INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((JPEG_INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((JPEG_INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((JPEG_INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((JPEG_INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((JPEG_INT32) 25172) /* FIX(3.072711026) */ -#else -#define FIX_0_298631336 FIX(0.298631336) -#define FIX_0_390180644 FIX(0.390180644) -#define FIX_0_541196100 FIX(0.541196100) -#define FIX_0_765366865 FIX(0.765366865) -#define FIX_0_899976223 FIX(0.899976223) -#define FIX_1_175875602 FIX(1.175875602) -#define FIX_1_501321110 FIX(1.501321110) -#define FIX_1_847759065 FIX(1.847759065) -#define FIX_1_961570560 FIX(1.961570560) -#define FIX_2_053119869 FIX(2.053119869) -#define FIX_2_562915447 FIX(2.562915447) -#define FIX_3_072711026 FIX(3.072711026) -#endif - - -/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. - * For 8-bit samples with the recommended scaling, all the variable - * and constant values involved are no more than 16 bits wide, so a - * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. - * For 12-bit samples, a full 32-bit multiplication will be needed. - */ - -#if BITS_IN_JSAMPLE == 8 -#define MULTIPLY(var,const) MULTIPLY16C16(var,const) -#else -#define MULTIPLY(var,const) ((var) * (const)) -#endif - - -/* Dequantize a coefficient by multiplying it by the multiplier-table - * entry; produce an int result. In this module, both inputs and result - * are 16 bits or less, so either int or short multiply will work. - */ - -#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) - - -/* - * Perform dequantization and inverse DCT on one block of coefficients. - */ - -GLOBAL(void) -jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - JPEG_INT32 tmp0, tmp1, tmp2, tmp3; - JPEG_INT32 tmp10, tmp11, tmp12, tmp13; - JPEG_INT32 z1, z2, z3, z4, z5; - JCOEFPTR inptr; - ISLOW_MULT_TYPE * quantptr; - int * wsptr; - JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - int ctr; - int workspace[DCTSIZE2]; /* buffers data between passes */ - SHIFT_TEMPS - - /* Pass 1: process columns from input, store into work array. */ - /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - inptr = coef_block; - quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; - wsptr = workspace; - for (ctr = DCTSIZE; ctr > 0; ctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any column in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * column DCT calculations can be simplified this way. - */ - - if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { - /* AC terms all zero */ - int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - - wsptr[DCTSIZE*0] = dcval; - wsptr[DCTSIZE*1] = dcval; - wsptr[DCTSIZE*2] = dcval; - wsptr[DCTSIZE*3] = dcval; - wsptr[DCTSIZE*4] = dcval; - wsptr[DCTSIZE*5] = dcval; - wsptr[DCTSIZE*6] = dcval; - wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - continue; - } - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - - z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - - z1 = MULTIPLY(z2 + z3, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); - tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); - - z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); - - tmp0 = (z2 + z3) << CONST_BITS; - tmp1 = (z2 - z3) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - - z1 = tmp0 + tmp3; - z2 = tmp1 + tmp2; - z3 = tmp0 + tmp2; - z4 = tmp1 + tmp3; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - - tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); - wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - - inptr++; /* advance pointers to next column */ - quantptr++; - wsptr++; - } - - /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - wsptr = workspace; - for (ctr = 0; ctr < DCTSIZE; ctr++) { - outptr = output_buf[ctr] + output_col; - /* Rows of zeroes can be exploited in the same way as we did with columns. - * However, the column calculation has created many nonzero AC terms, so - * the simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - -#ifndef NO_ZERO_ROW_TEST - if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { - /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - - outptr[0] = dcval; - outptr[1] = dcval; - outptr[2] = dcval; - outptr[3] = dcval; - outptr[4] = dcval; - outptr[5] = dcval; - outptr[6] = dcval; - outptr[7] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ - continue; - } -#endif - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - - z2 = (JPEG_INT32) wsptr[2]; - z3 = (JPEG_INT32) wsptr[6]; - - z1 = MULTIPLY(z2 + z3, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); - tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); - - tmp0 = ((JPEG_INT32) wsptr[0] + (JPEG_INT32) wsptr[4]) << CONST_BITS; - tmp1 = ((JPEG_INT32) wsptr[0] - (JPEG_INT32) wsptr[4]) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - tmp0 = (JPEG_INT32) wsptr[7]; - tmp1 = (JPEG_INT32) wsptr[5]; - tmp2 = (JPEG_INT32) wsptr[3]; - tmp3 = (JPEG_INT32) wsptr[1]; - - z1 = tmp0 + tmp3; - z2 = tmp1 + tmp2; - z3 = tmp0 + tmp2; - z4 = tmp1 + tmp3; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - - tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ - } -} - -#endif /* DCT_ISLOW_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jidctred.c b/Source/3rdParty/wx/src/jpeg/jidctred.c deleted file mode 100644 index efda35aeb..000000000 --- a/Source/3rdParty/wx/src/jpeg/jidctred.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * jidctred.c - * - * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains inverse-DCT routines that produce reduced-size output: - * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block. - * - * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M) - * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step - * with an 8-to-4 step that produces the four averages of two adjacent outputs - * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output). - * These steps were derived by computing the corresponding values at the end - * of the normal LL&M code, then simplifying as much as possible. - * - * 1x1 is trivial: just take the DC coefficient divided by 8. - * - * See jidctint.c for additional comments. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ - -#ifdef IDCT_SCALING_SUPPORTED - - -/* - * This module is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* Scaling is the same as in jidctint.c. */ - -#if BITS_IN_JSAMPLE == 8 -#define CONST_BITS 13 -#define PASS1_BITS 2 -#else -#define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus - * causing a lot of useless floating-point operations at run time. - * To get around this we use the following pre-calculated constants. - * If you change CONST_BITS you may want to add appropriate values. - * (With a reasonable C compiler, you can just rely on the FIX() macro...) - */ - -#if CONST_BITS == 13 -#define FIX_0_211164243 ((JPEG_INT32) 1730) /* FIX(0.211164243) */ -#define FIX_0_509795579 ((JPEG_INT32) 4176) /* FIX(0.509795579) */ -#define FIX_0_601344887 ((JPEG_INT32) 4926) /* FIX(0.601344887) */ -#define FIX_0_720959822 ((JPEG_INT32) 5906) /* FIX(0.720959822) */ -#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_850430095 ((JPEG_INT32) 6967) /* FIX(0.850430095) */ -#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_061594337 ((JPEG_INT32) 8697) /* FIX(1.061594337) */ -#define FIX_1_272758580 ((JPEG_INT32) 10426) /* FIX(1.272758580) */ -#define FIX_1_451774981 ((JPEG_INT32) 11893) /* FIX(1.451774981) */ -#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ -#define FIX_2_172734803 ((JPEG_INT32) 17799) /* FIX(2.172734803) */ -#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_624509785 ((JPEG_INT32) 29692) /* FIX(3.624509785) */ -#else -#define FIX_0_211164243 FIX(0.211164243) -#define FIX_0_509795579 FIX(0.509795579) -#define FIX_0_601344887 FIX(0.601344887) -#define FIX_0_720959822 FIX(0.720959822) -#define FIX_0_765366865 FIX(0.765366865) -#define FIX_0_850430095 FIX(0.850430095) -#define FIX_0_899976223 FIX(0.899976223) -#define FIX_1_061594337 FIX(1.061594337) -#define FIX_1_272758580 FIX(1.272758580) -#define FIX_1_451774981 FIX(1.451774981) -#define FIX_1_847759065 FIX(1.847759065) -#define FIX_2_172734803 FIX(2.172734803) -#define FIX_2_562915447 FIX(2.562915447) -#define FIX_3_624509785 FIX(3.624509785) -#endif - - -/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. - * For 8-bit samples with the recommended scaling, all the variable - * and constant values involved are no more than 16 bits wide, so a - * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. - * For 12-bit samples, a full 32-bit multiplication will be needed. - */ - -#if BITS_IN_JSAMPLE == 8 -#define MULTIPLY(var,const) MULTIPLY16C16(var,const) -#else -#define MULTIPLY(var,const) ((var) * (const)) -#endif - - -/* Dequantize a coefficient by multiplying it by the multiplier-table - * entry; produce an int result. In this module, both inputs and result - * are 16 bits or less, so either int or short multiply will work. - */ - -#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) - - -/* - * Perform dequantization and inverse DCT on one block of coefficients, - * producing a reduced-size 4x4 output block. - */ - -GLOBAL(void) -jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - JPEG_INT32 tmp0, tmp2, tmp10, tmp12; - JPEG_INT32 z1, z2, z3, z4; - JCOEFPTR inptr; - ISLOW_MULT_TYPE * quantptr; - int * wsptr; - JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - int ctr; - int workspace[DCTSIZE*4]; /* buffers data between passes */ - SHIFT_TEMPS - - /* Pass 1: process columns from input, store into work array. */ - - inptr = coef_block; - quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; - wsptr = workspace; - for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { - /* Don't bother to process column 4, because second pass won't use it */ - if (ctr == DCTSIZE-4) - continue; - if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && - inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { - /* AC terms all zero; we need not examine term 4 for 4x4 output */ - int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - - wsptr[DCTSIZE*0] = dcval; - wsptr[DCTSIZE*1] = dcval; - wsptr[DCTSIZE*2] = dcval; - wsptr[DCTSIZE*3] = dcval; - - continue; - } - - /* Even part */ - - tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - tmp0 <<= (CONST_BITS+1); - - z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - - tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865); - - tmp10 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - - /* Odd part */ - - z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - - tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ - + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ - + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ - + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ - - tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ - + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ - + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ - + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ - - /* Final output stage */ - - wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); - wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); - wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); - wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); - } - - /* Pass 2: process 4 rows from work array, store into output array. */ - - wsptr = workspace; - for (ctr = 0; ctr < 4; ctr++) { - outptr = output_buf[ctr] + output_col; - /* It's not clear whether a zero row test is worthwhile here ... */ - -#ifndef NO_ZERO_ROW_TEST - if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { - /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - - outptr[0] = dcval; - outptr[1] = dcval; - outptr[2] = dcval; - outptr[3] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ - continue; - } -#endif - - /* Even part */ - - tmp0 = ((JPEG_INT32) wsptr[0]) << (CONST_BITS+1); - - tmp2 = MULTIPLY((JPEG_INT32) wsptr[2], FIX_1_847759065) - + MULTIPLY((JPEG_INT32) wsptr[6], - FIX_0_765366865); - - tmp10 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - - /* Odd part */ - - z1 = (JPEG_INT32) wsptr[7]; - z2 = (JPEG_INT32) wsptr[5]; - z3 = (JPEG_INT32) wsptr[3]; - z4 = (JPEG_INT32) wsptr[1]; - - tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ - + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ - + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ - + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ - - tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ - + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ - + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ - + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ - - /* Final output stage */ - - outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; - outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; - outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ - } -} - - -/* - * Perform dequantization and inverse DCT on one block of coefficients, - * producing a reduced-size 2x2 output block. - */ - -GLOBAL(void) -jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - JPEG_INT32 tmp0, tmp10, z1; - JCOEFPTR inptr; - ISLOW_MULT_TYPE * quantptr; - int * wsptr; - JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - int ctr; - int workspace[DCTSIZE*2]; /* buffers data between passes */ - SHIFT_TEMPS - - /* Pass 1: process columns from input, store into work array. */ - - inptr = coef_block; - quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; - wsptr = workspace; - for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { - /* Don't bother to process columns 2,4,6 */ - if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6) - continue; - if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { - /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ - int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - - wsptr[DCTSIZE*0] = dcval; - wsptr[DCTSIZE*1] = dcval; - - continue; - } - - /* Even part */ - - z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - tmp10 = z1 << (CONST_BITS+2); - - /* Odd part */ - - z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */ - z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */ - z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */ - z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ - - /* Final output stage */ - - wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); - wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); - } - - /* Pass 2: process 2 rows from work array, store into output array. */ - - wsptr = workspace; - for (ctr = 0; ctr < 2; ctr++) { - outptr = output_buf[ctr] + output_col; - /* It's not clear whether a zero row test is worthwhile here ... */ - -#ifndef NO_ZERO_ROW_TEST - if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { - /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - - outptr[0] = dcval; - outptr[1] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ - continue; - } -#endif - - /* Even part */ - - tmp10 = ((JPEG_INT32) wsptr[0]) << (CONST_BITS+2); - - /* Odd part */ - - tmp0 = MULTIPLY((JPEG_INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ - + MULTIPLY((JPEG_INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ - + MULTIPLY((JPEG_INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ - + MULTIPLY((JPEG_INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ - - /* Final output stage */ - - outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3+2) - & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3+2) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ - } -} - - -/* - * Perform dequantization and inverse DCT on one block of coefficients, - * producing a reduced-size 1x1 output block. - */ - -GLOBAL(void) -jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) -{ - int dcval; - ISLOW_MULT_TYPE * quantptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); - SHIFT_TEMPS - - /* We hardly need an inverse DCT routine for this: just take the - * average pixel value, which is one-eighth of the DC coefficient. - */ - quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; - dcval = DEQUANTIZE(coef_block[0], quantptr[0]); - dcval = (int) DESCALE((JPEG_INT32) dcval, 3); - - output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; -} - -#endif /* IDCT_SCALING_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jinclude.h b/Source/3rdParty/wx/src/jpeg/jinclude.h deleted file mode 100644 index 0a4f15146..000000000 --- a/Source/3rdParty/wx/src/jpeg/jinclude.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * jinclude.h - * - * Copyright (C) 1991-1994, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file exists to provide a single place to fix any problems with - * including the wrong system include files. (Common problems are taken - * care of by the standard jconfig symbols, but on really weird systems - * you may have to edit this file.) - * - * NOTE: this file is NOT intended to be included by applications using the - * JPEG library. Most applications need only include jpeglib.h. - */ - - -/* Include auto-config file to find out which system include files we need. */ - -#include "jconfig.h" /* auto configuration options */ -#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ - -/* - * We need the NULL macro and size_t typedef. - * On an ANSI-conforming system it is sufficient to include . - * Otherwise, we get them from or ; we may have to - * pull in as well. - * Note that the core JPEG library does not require ; - * only the default error handler and data source/destination modules do. - * But we must pull it in because of the references to FILE in jpeglib.h. - * You can remove those references if you want to compile without . - */ - -#ifdef HAVE_STDDEF_H -#include -#endif - -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef NEED_SYS_TYPES_H -#include -#endif - -#include - -/* - * We need memory copying and zeroing functions, plus strncpy(). - * ANSI and System V implementations declare these in . - * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). - * Some systems may declare memset and memcpy in . - * - * NOTE: we assume the size parameters to these functions are of type size_t. - * Change the casts in these macros if not! - */ - -#ifdef NEED_BSD_STRINGS - -#include -#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) -#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) - -#else /* not BSD, assume ANSI/SysV string lib */ - -#include -#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) -#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) - -#endif - -/* - * In ANSI C, and indeed any rational implementation, size_t is also the - * type returned by sizeof(). However, it seems there are some irrational - * implementations out there, in which sizeof() returns an int even though - * size_t is defined as long or unsigned long. To ensure consistent results - * we always use this SIZEOF() macro in place of using sizeof() directly. - */ - -#define SIZEOF(object) ((size_t) sizeof(object)) - -/* - * The modules that use fread() and fwrite() always invoke them through - * these macros. On some systems you may need to twiddle the argument casts. - * CAUTION: argument order is different from underlying functions! - */ - -#define JFREAD(file,buf,sizeofbuf) \ - ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) -#define JFWRITE(file,buf,sizeofbuf) \ - ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) diff --git a/Source/3rdParty/wx/src/jpeg/jmemansi.c b/Source/3rdParty/wx/src/jpeg/jmemansi.c deleted file mode 100644 index 2d93e4962..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemansi.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * jmemansi.c - * - * Copyright (C) 1992-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file provides a simple generic implementation of the system- - * dependent portion of the JPEG memory manager. This implementation - * assumes that you have the ANSI-standard library routine tmpfile(). - * Also, the problem of determining the amount of memory available - * is shoved onto the user. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -#endif - -#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ -#define SEEK_SET 0 /* if not, assume 0 is correct */ -#endif - - -/* - * Memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * Backing store (temporary file) management. - * Backing store objects are only used when the value returned by - * jpeg_mem_available is less than the total space needed. You can dispense - * with these routines if you have plenty of virtual memory; see jmemnobs.c. - */ - - -METHODDEF(void) -read_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (fseek(info->temp_file, file_offset, SEEK_SET)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - if (JFREAD(info->temp_file, buffer_address, byte_count) - != (size_t) byte_count) - ERREXIT(cinfo, JERR_TFILE_READ); -} - - -METHODDEF(void) -write_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (fseek(info->temp_file, file_offset, SEEK_SET)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - if (JFWRITE(info->temp_file, buffer_address, byte_count) - != (size_t) byte_count) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_backing_store (j_common_ptr cinfo, backing_store_ptr info) -{ - fclose(info->temp_file); - /* Since this implementation uses tmpfile() to create the file, - * no explicit file deletion is needed. - */ -} - - -/* - * Initial opening of a backing-store object. - * - * This version uses tmpfile(), which constructs a suitable file name - * behind the scenes. We don't have to use info->temp_name[] at all; - * indeed, we can't even find out the actual name of the temp file. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - if ((info->temp_file = tmpfile()) == NULL) - ERREXITS(cinfo, JERR_TFILE_CREATE, ""); - info->read_backing_store = read_backing_store; - info->write_backing_store = write_backing_store; - info->close_backing_store = close_backing_store; -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemdos.c b/Source/3rdParty/wx/src/jpeg/jmemdos.c deleted file mode 100644 index d64835d57..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemdos.c +++ /dev/null @@ -1,638 +0,0 @@ -/* - * jmemdos.c - * - * Copyright (C) 1992-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file provides an MS-DOS-compatible implementation of the system- - * dependent portion of the JPEG memory manager. Temporary data can be - * stored in extended or expanded memory as well as in regular DOS files. - * - * If you use this file, you must be sure that NEED_FAR_POINTERS is defined - * if you compile in a small-data memory model; it should NOT be defined if - * you use a large-data memory model. This file is not recommended if you - * are using a flat-memory-space 386 environment such as DJGCC or Watcom C. - * Also, this code will NOT work if struct fields are aligned on greater than - * 2-byte boundaries. - * - * Based on code contributed by Ge' Weijers. - */ - -/* - * If you have both extended and expanded memory, you may want to change the - * order in which they are tried in jopen_backing_store. On a 286 machine - * expanded memory is usually faster, since extended memory access involves - * an expensive protected-mode-and-back switch. On 386 and better, extended - * memory is usually faster. As distributed, the code tries extended memory - * first (what? not everyone has a 386? :-). - * - * You can disable use of extended/expanded memory entirely by altering these - * definitions or overriding them from the Makefile (eg, -DEMS_SUPPORTED=0). - */ - -#ifndef XMS_SUPPORTED -#define XMS_SUPPORTED 1 -#endif -#ifndef EMS_SUPPORTED -#define EMS_SUPPORTED 1 -#endif - - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare these */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -extern char * getenv JPP((const char * name)); -#endif - -#ifdef NEED_FAR_POINTERS - -#ifdef __TURBOC__ -/* These definitions work for Borland C (Turbo C) */ -#include /* need farmalloc(), farfree() */ -#define far_malloc(x) farmalloc(x) -#define far_free(x) farfree(x) -#else -/* These definitions work for Microsoft C and compatible compilers */ -#include /* need _fmalloc(), _ffree() */ -#define far_malloc(x) _fmalloc(x) -#define far_free(x) _ffree(x) -#endif - -#else /* not NEED_FAR_POINTERS */ - -#define far_malloc(x) malloc(x) -#define far_free(x) free(x) - -#endif /* NEED_FAR_POINTERS */ - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#define READ_BINARY "rb" -#endif - -#ifndef USE_MSDOS_MEMMGR /* make sure user got configuration right */ - You forgot to define USE_MSDOS_MEMMGR in jconfig.h. /* deliberate syntax error */ -#endif - -#if MAX_ALLOC_CHUNK >= 65535L /* make sure jconfig.h got this right */ - MAX_ALLOC_CHUNK should be less than 64K. /* deliberate syntax error */ -#endif - - -/* - * Declarations for assembly-language support routines (see jmemdosa.asm). - * - * The functions are declared "far" as are all their pointer arguments; - * this ensures the assembly source code will work regardless of the - * compiler memory model. We assume "short" is 16 bits, "long" is 32. - */ - -typedef void far * XMSDRIVER; /* actually a pointer to code */ -typedef struct { /* registers for calling XMS driver */ - unsigned short ax, dx, bx; - void far * ds_si; - } XMScontext; -typedef struct { /* registers for calling EMS driver */ - unsigned short ax, dx, bx; - void far * ds_si; - } EMScontext; - -extern short far jdos_open JPP((short far * handle, char far * filename)); -extern short far jdos_close JPP((short handle)); -extern short far jdos_seek JPP((short handle, long offset)); -extern short far jdos_read JPP((short handle, void far * buffer, - unsigned short count)); -extern short far jdos_write JPP((short handle, void far * buffer, - unsigned short count)); -extern void far jxms_getdriver JPP((XMSDRIVER far *)); -extern void far jxms_calldriver JPP((XMSDRIVER, XMScontext far *)); -extern short far jems_available JPP((void)); -extern void far jems_calldriver JPP((EMScontext far *)); - - -/* - * Selection of a file name for a temporary file. - * This is highly system-dependent, and you may want to customize it. - */ - -static int next_file_num; /* to distinguish among several temp files */ - -LOCAL(void) -select_file_name (char * fname) -{ - const char * env; - char * ptr; - FILE * tfile; - - /* Keep generating file names till we find one that's not in use */ - for (;;) { - /* Get temp directory name from environment TMP or TEMP variable; - * if none, use "." - */ - if ((env = (const char *) getenv("TMP")) == NULL) - if ((env = (const char *) getenv("TEMP")) == NULL) - env = "."; - if (*env == '\0') /* null string means "." */ - env = "."; - ptr = fname; /* copy name to fname */ - while (*env != '\0') - *ptr++ = *env++; - if (ptr[-1] != '\\' && ptr[-1] != '/') - *ptr++ = '\\'; /* append backslash if not in env variable */ - /* Append a suitable file name */ - next_file_num++; /* advance counter */ - sprintf(ptr, "JPG%03d.TMP", next_file_num); - /* Probe to see if file name is already in use */ - if ((tfile = fopen(fname, READ_BINARY)) == NULL) - break; - fclose(tfile); /* oops, it's there; close tfile & try again */ - } -} - - -/* - * Near-memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are allocated in far memory, if possible - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) far_malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - far_free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 300000L /* for total usage about 450K */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * Backing store (temporary file) management. - * Backing store objects are only used when the value returned by - * jpeg_mem_available is less than the total space needed. You can dispense - * with these routines if you have plenty of virtual memory; see jmemnobs.c. - */ - -/* - * For MS-DOS we support three types of backing storage: - * 1. Conventional DOS files. We access these by direct DOS calls rather - * than via the stdio package. This provides a bit better performance, - * but the real reason is that the buffers to be read or written are FAR. - * The stdio library for small-data memory models can't cope with that. - * 2. Extended memory, accessed per the XMS V2.0 specification. - * 3. Expanded memory, accessed per the LIM/EMS 4.0 specification. - * You'll need copies of those specs to make sense of the related code. - * The specs are available by Internet FTP from the SIMTEL archives - * (oak.oakland.edu and its various mirror sites). See files - * pub/msdos/microsoft/xms20.arc and pub/msdos/info/limems41.zip. - */ - - -/* - * Access methods for a DOS file. - */ - - -METHODDEF(void) -read_file_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (jdos_seek(info->handle.file_handle, file_offset)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ - if (byte_count > 65535L) /* safety check */ - ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); - if (jdos_read(info->handle.file_handle, buffer_address, - (unsigned short) byte_count)) - ERREXIT(cinfo, JERR_TFILE_READ); -} - - -METHODDEF(void) -write_file_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (jdos_seek(info->handle.file_handle, file_offset)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ - if (byte_count > 65535L) /* safety check */ - ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); - if (jdos_write(info->handle.file_handle, buffer_address, - (unsigned short) byte_count)) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_file_store (j_common_ptr cinfo, backing_store_ptr info) -{ - jdos_close(info->handle.file_handle); /* close the file */ - remove(info->temp_name); /* delete the file */ -/* If your system doesn't have remove(), try unlink() instead. - * remove() is the ANSI-standard name for this function, but - * unlink() was more common in pre-ANSI systems. - */ - TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name); -} - - -LOCAL(wxjpeg_boolean) -open_file_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - short handle; - - select_file_name(info->temp_name); - if (jdos_open((short far *) & handle, (char far *) info->temp_name)) { - /* might as well exit since jpeg_open_backing_store will fail anyway */ - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - return FALSE; - } - info->handle.file_handle = handle; - info->read_backing_store = read_file_store; - info->write_backing_store = write_file_store; - info->close_backing_store = close_file_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); - return TRUE; /* succeeded */ -} - - -/* - * Access methods for extended memory. - */ - -#if XMS_SUPPORTED - -static XMSDRIVER xms_driver; /* saved address of XMS driver */ - -typedef union { /* either long offset or real-mode pointer */ - long offset; - void far * ptr; - } XMSPTR; - -typedef struct { /* XMS move specification structure */ - long length; - XMSH src_handle; - XMSPTR src; - XMSH dst_handle; - XMSPTR dst; - } XMSspec; - -#define ODD(X) (((X) & 1L) != 0) - - -METHODDEF(void) -read_xms_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - XMScontext ctx; - XMSspec spec; - char endbuffer[2]; - - /* The XMS driver can't cope with an odd length, so handle the last byte - * specially if byte_count is odd. We don't expect this to be common. - */ - - spec.length = byte_count & (~ 1L); - spec.src_handle = info->handle.xms_handle; - spec.src.offset = file_offset; - spec.dst_handle = 0; - spec.dst.ptr = buffer_address; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x0b00; /* EMB move */ - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - ERREXIT(cinfo, JERR_XMS_READ); - - if (ODD(byte_count)) { - read_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0]; - } -} - - -METHODDEF(void) -write_xms_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - XMScontext ctx; - XMSspec spec; - char endbuffer[2]; - - /* The XMS driver can't cope with an odd length, so handle the last byte - * specially if byte_count is odd. We don't expect this to be common. - */ - - spec.length = byte_count & (~ 1L); - spec.src_handle = 0; - spec.src.ptr = buffer_address; - spec.dst_handle = info->handle.xms_handle; - spec.dst.offset = file_offset; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x0b00; /* EMB move */ - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - ERREXIT(cinfo, JERR_XMS_WRITE); - - if (ODD(byte_count)) { - read_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L]; - write_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - } -} - - -METHODDEF(void) -close_xms_store (j_common_ptr cinfo, backing_store_ptr info) -{ - XMScontext ctx; - - ctx.dx = info->handle.xms_handle; - ctx.ax = 0x0a00; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE, info->handle.xms_handle); - /* we ignore any error return from the driver */ -} - - -LOCAL(wxjpeg_boolean) -open_xms_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - XMScontext ctx; - - /* Get address of XMS driver */ - jxms_getdriver((XMSDRIVER far *) & xms_driver); - if (xms_driver == NULL) - return FALSE; /* no driver to be had */ - - /* Get version number, must be >= 2.00 */ - ctx.ax = 0x0000; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax < (unsigned short) 0x0200) - return FALSE; - - /* Try to get space (expressed in kilobytes) */ - ctx.dx = (unsigned short) ((total_bytes_needed + 1023L) >> 10); - ctx.ax = 0x0900; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - return FALSE; - - /* Succeeded, save the handle and away we go */ - info->handle.xms_handle = ctx.dx; - info->read_backing_store = read_xms_store; - info->write_backing_store = write_xms_store; - info->close_backing_store = close_xms_store; - TRACEMS1(cinfo, 1, JTRC_XMS_OPEN, ctx.dx); - return TRUE; /* succeeded */ -} - -#endif /* XMS_SUPPORTED */ - - -/* - * Access methods for expanded memory. - */ - -#if EMS_SUPPORTED - -/* The EMS move specification structure requires word and long fields aligned - * at odd byte boundaries. Some compilers will align struct fields at even - * byte boundaries. While it's usually possible to force byte alignment, - * that causes an overall performance penalty and may pose problems in merging - * JPEG into a larger application. Instead we accept some rather dirty code - * here. Note this code would fail if the hardware did not allow odd-byte - * word & long accesses, but all 80x86 CPUs do. - */ - -typedef void far * EMSPTR; - -typedef union { /* EMS move specification structure */ - long length; /* It's easy to access first 4 bytes */ - char bytes[18]; /* Misaligned fields in here! */ - } EMSspec; - -/* Macros for accessing misaligned fields */ -#define FIELD_AT(spec,offset,type) (*((type *) &(spec.bytes[offset]))) -#define SRC_TYPE(spec) FIELD_AT(spec,4,char) -#define SRC_HANDLE(spec) FIELD_AT(spec,5,EMSH) -#define SRC_OFFSET(spec) FIELD_AT(spec,7,unsigned short) -#define SRC_PAGE(spec) FIELD_AT(spec,9,unsigned short) -#define SRC_PTR(spec) FIELD_AT(spec,7,EMSPTR) -#define DST_TYPE(spec) FIELD_AT(spec,11,char) -#define DST_HANDLE(spec) FIELD_AT(spec,12,EMSH) -#define DST_OFFSET(spec) FIELD_AT(spec,14,unsigned short) -#define DST_PAGE(spec) FIELD_AT(spec,16,unsigned short) -#define DST_PTR(spec) FIELD_AT(spec,14,EMSPTR) - -#define EMSPAGESIZE 16384L /* gospel, see the EMS specs */ - -#define HIBYTE(W) (((W) >> 8) & 0xFF) -#define LOBYTE(W) ((W) & 0xFF) - - -METHODDEF(void) -read_ems_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - EMScontext ctx; - EMSspec spec; - - spec.length = byte_count; - SRC_TYPE(spec) = 1; - SRC_HANDLE(spec) = info->handle.ems_handle; - SRC_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE); - SRC_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE); - DST_TYPE(spec) = 0; - DST_HANDLE(spec) = 0; - DST_PTR(spec) = buffer_address; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x5700; /* move memory region */ - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - ERREXIT(cinfo, JERR_EMS_READ); -} - - -METHODDEF(void) -write_ems_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - EMScontext ctx; - EMSspec spec; - - spec.length = byte_count; - SRC_TYPE(spec) = 0; - SRC_HANDLE(spec) = 0; - SRC_PTR(spec) = buffer_address; - DST_TYPE(spec) = 1; - DST_HANDLE(spec) = info->handle.ems_handle; - DST_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE); - DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE); - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x5700; /* move memory region */ - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - ERREXIT(cinfo, JERR_EMS_WRITE); -} - - -METHODDEF(void) -close_ems_store (j_common_ptr cinfo, backing_store_ptr info) -{ - EMScontext ctx; - - ctx.ax = 0x4500; - ctx.dx = info->handle.ems_handle; - jems_calldriver((EMScontext far *) & ctx); - TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE, info->handle.ems_handle); - /* we ignore any error return from the driver */ -} - - -LOCAL(wxjpeg_boolean) -open_ems_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - EMScontext ctx; - - /* Is EMS driver there? */ - if (! jems_available()) - return FALSE; - - /* Get status, make sure EMS is OK */ - ctx.ax = 0x4000; - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - return FALSE; - - /* Get version, must be >= 4.0 */ - ctx.ax = 0x4600; - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0 || LOBYTE(ctx.ax) < 0x40) - return FALSE; - - /* Try to allocate requested space */ - ctx.ax = 0x4300; - ctx.bx = (unsigned short) ((total_bytes_needed + EMSPAGESIZE-1L) / EMSPAGESIZE); - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - return FALSE; - - /* Succeeded, save the handle and away we go */ - info->handle.ems_handle = ctx.dx; - info->read_backing_store = read_ems_store; - info->write_backing_store = write_ems_store; - info->close_backing_store = close_ems_store; - TRACEMS1(cinfo, 1, JTRC_EMS_OPEN, ctx.dx); - return TRUE; /* succeeded */ -} - -#endif /* EMS_SUPPORTED */ - - -/* - * Initial opening of a backing-store object. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - /* Try extended memory, then expanded memory, then regular file. */ -#if XMS_SUPPORTED - if (open_xms_store(cinfo, info, total_bytes_needed)) - return; -#endif -#if EMS_SUPPORTED - if (open_ems_store(cinfo, info, total_bytes_needed)) - return; -#endif - if (open_file_store(cinfo, info, total_bytes_needed)) - return; - ERREXITS(cinfo, JERR_TFILE_CREATE, ""); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - next_file_num = 0; /* initialize temp file name generator */ - return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* Microsoft C, at least in v6.00A, will not successfully reclaim freed - * blocks of size > 32Kbytes unless we give it a kick in the rear, like so: - */ -#ifdef NEED_FHEAPMIN - _fheapmin(); -#endif -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemmac.c b/Source/3rdParty/wx/src/jpeg/jmemmac.c deleted file mode 100644 index 106f9bea0..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemmac.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * jmemmac.c - * - * Copyright (C) 1992-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * jmemmac.c provides an Apple Macintosh implementation of the system- - * dependent portion of the JPEG memory manager. - * - * If you use jmemmac.c, then you must define USE_MAC_MEMMGR in the - * JPEG_INTERNALS part of jconfig.h. - * - * jmemmac.c uses the Macintosh toolbox routines NewPtr and DisposePtr - * instead of malloc and free. It accurately determines the amount of - * memory available by using CompactMem. Notice that if left to its - * own devices, this code can chew up all available space in the - * application's zone, with the exception of the rather small "slop" - * factor computed in jpeg_mem_available(). The application can ensure - * that more space is left over by reducing max_memory_to_use. - * - * Large images are swapped to disk using temporary files and System 7.0+'s - * temporary folder functionality. - * - * Note that jmemmac.c depends on two features of MacOS that were first - * introduced in System 7: FindFolder and the FSSpec-based calls. - * If your application uses jmemmac.c and is run under System 6 or earlier, - * and the jpeg library decides it needs a temporary file, it will abort, - * printing error messages about requiring System 7. (If no temporary files - * are created, it will run fine.) - * - * If you want to use jmemmac.c in an application that might be used with - * System 6 or earlier, then you should remove dependencies on FindFolder - * and the FSSpec calls. You will need to replace FindFolder with some - * other mechanism for finding a place to put temporary files, and you - * should replace the FSSpec calls with their HFS equivalents: - * - * FSpDelete -> HDelete - * FSpGetFInfo -> HGetFInfo - * FSpCreate -> HCreate - * FSpOpenDF -> HOpen *** Note: not HOpenDF *** - * FSMakeFSSpec -> (fill in spec by hand.) - * - * (Use HOpen instead of HOpenDF. HOpen is just a glue-interface to PBHOpen, - * which is on all HFS macs. HOpenDF is a System 7 addition which avoids the - * ages-old problem of names starting with a period.) - * - * Contributed by Sam Bushell (jsam@iagu.on.net) and - * Dan Gildor (gyld@in-touch.com). - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef USE_MAC_MEMMGR /* make sure user got configuration right */ - You forgot to define USE_MAC_MEMMGR in jconfig.h. /* deliberate syntax error */ -#endif - -#include /* we use the MacOS memory manager */ -#include /* we use the MacOS File stuff */ -#include /* we use the MacOS HFS stuff */ -#include /* for smSystemScript */ -#include /* we use Gestalt to test for specific functionality */ - -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "JPG%03d.TMP" -#endif - -static int next_file_num; /* to distinguish among several temp files */ - - -/* - * Memory allocation and freeing are controlled by the MacOS library - * routines NewPtr() and DisposePtr(), which allocate fixed-address - * storage. Unfortunately, the IJG library isn't smart enough to cope - * with relocatable storage. - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) NewPtr(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - DisposePtr((Ptr) object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: we include FAR keywords in the routine declarations simply for - * consistency with the rest of the IJG code; FAR should expand to empty - * on rational architectures like the Mac. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) NewPtr(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - DisposePtr((Ptr) object); -} - - -/* - * This routine computes the total memory space available for allocation. - */ - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - long limit = cinfo->mem->max_memory_to_use - already_allocated; - long slop, mem; - - /* Don't ask for more than what application has told us we may use */ - if (max_bytes_needed > limit && limit > 0) - max_bytes_needed = limit; - /* Find whether there's a big enough free block in the heap. - * CompactMem tries to create a contiguous block of the requested size, - * and then returns the size of the largest free block (which could be - * much more or much less than we asked for). - * We add some slop to ensure we don't use up all available memory. - */ - slop = max_bytes_needed / 16 + 32768L; - mem = CompactMem(max_bytes_needed + slop) - slop; - if (mem < 0) - mem = 0; /* sigh, couldn't even get the slop */ - /* Don't take more than the application says we can have */ - if (mem > limit && limit > 0) - mem = limit; - return mem; -} - - -/* - * Backing store (temporary file) management. - * Backing store objects are only used when the value returned by - * jpeg_mem_available is less than the total space needed. You can dispense - * with these routines if you have plenty of virtual memory; see jmemnobs.c. - */ - - -METHODDEF(void) -read_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - long bytes = byte_count; - long retVal; - - if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) - ERREXIT(cinfo, JERR_TFILE_SEEK); - - retVal = FSRead ( info->temp_file, &bytes, - (unsigned char *) buffer_address ); - if ( retVal != noErr || bytes != byte_count ) - ERREXIT(cinfo, JERR_TFILE_READ); -} - - -METHODDEF(void) -write_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - long bytes = byte_count; - long retVal; - - if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) - ERREXIT(cinfo, JERR_TFILE_SEEK); - - retVal = FSWrite ( info->temp_file, &bytes, - (unsigned char *) buffer_address ); - if ( retVal != noErr || bytes != byte_count ) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_backing_store (j_common_ptr cinfo, backing_store_ptr info) -{ - FSClose ( info->temp_file ); - FSpDelete ( &(info->tempSpec) ); -} - - -/* - * Initial opening of a backing-store object. - * - * This version uses FindFolder to find the Temporary Items folder, - * and puts the temporary file in there. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - short tmpRef, vRefNum; - long dirID; - FInfo finderInfo; - FSSpec theSpec; - Str255 fName; - OSErr osErr; - long gestaltResponse = 0; - - /* Check that FSSpec calls are available. */ - osErr = Gestalt( gestaltFSAttr, &gestaltResponse ); - if ( ( osErr != noErr ) - || !( gestaltResponse & (1<temp_name, TEMP_FILE_NAME, next_file_num); - strcpy ( (Ptr)fName+1, info->temp_name ); - *fName = strlen (info->temp_name); - osErr = FSMakeFSSpec ( vRefNum, dirID, fName, &theSpec ); - - if ( (osErr = FSpGetFInfo ( &theSpec, &finderInfo ) ) != noErr ) - break; - } - - osErr = FSpCreate ( &theSpec, '????', '????', smSystemScript ); - if ( osErr != noErr ) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - - osErr = FSpOpenDF ( &theSpec, fsRdWrPerm, &(info->temp_file) ); - if ( osErr != noErr ) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - - info->tempSpec = theSpec; - - info->read_backing_store = read_backing_store; - info->write_backing_store = write_backing_store; - info->close_backing_store = close_backing_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - next_file_num = 0; - - /* max_memory_to_use will be initialized to FreeMem()'s result; - * the calling application might later reduce it, for example - * to leave room to invoke multiple JPEG objects. - * Note that FreeMem returns the total number of free bytes; - * it may not be possible to allocate a single block of this size. - */ - return FreeMem(); -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemmgr.c b/Source/3rdParty/wx/src/jpeg/jmemmgr.c deleted file mode 100644 index 173d9ded6..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemmgr.c +++ /dev/null @@ -1,1118 +0,0 @@ -/* - * jmemmgr.c - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the JPEG system-independent memory management - * routines. This code is usable across a wide variety of machines; most - * of the system dependencies have been isolated in a separate file. - * The major functions provided here are: - * * pool-based allocation and freeing of memory; - * * policy decisions about how to divide available memory among the - * virtual arrays; - * * control logic for swapping virtual arrays between main memory and - * backing storage. - * The separate system-dependent file provides the actual backing-storage - * access code, and it contains the policy decision about how much total - * main memory to use. - * This file is system-dependent in the sense that some of its functions - * are unnecessary in some systems. For example, if there is enough virtual - * memory so that backing storage will never be used, much of the virtual - * array control logic could be removed. (Of course, if you have that much - * memory then you shouldn't care about a little bit of unused code...) - */ - -#define JPEG_INTERNALS -#define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef NO_GETENV -#ifndef HAVE_STDLIB_H /* should declare getenv() */ -extern char * getenv JPP((const char * name)); -#endif -#endif - - -/* - * Some important notes: - * The allocation routines provided here must never return NULL. - * They should exit to error_exit if unsuccessful. - * - * It's not a good idea to try to merge the sarray and barray routines, - * even though they are textually almost the same, because samples are - * usually stored as bytes while coefficients are shorts or ints. Thus, - * in machines where byte pointers have a different representation from - * word pointers, the resulting machine code could not be the same. - */ - - -/* - * Many machines require storage alignment: longs must start on 4-byte - * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc() - * always returns pointers that are multiples of the worst-case alignment - * requirement, and we had better do so too. - * There isn't any really portable way to determine the worst-case alignment - * requirement. This module assumes that the alignment requirement is - * multiples of sizeof(ALIGN_TYPE). - * By default, we define ALIGN_TYPE as double. This is necessary on some - * workstations (where doubles really do need 8-byte alignment) and will work - * fine on nearly everything. If your machine has lesser alignment needs, - * you can save a few bytes by making ALIGN_TYPE smaller. - * The only place I know of where this will NOT work is certain Macintosh - * 680x0 compilers that define double as a 10-byte IEEE extended float. - * Doing 10-byte alignment is counterproductive because longwords won't be - * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have - * such a compiler. - */ - -#ifndef ALIGN_TYPE /* so can override from jconfig.h */ -#define ALIGN_TYPE double -#endif - - -/* - * We allocate objects from "pools", where each pool is gotten with a single - * request to jpeg_get_small() or jpeg_get_large(). There is no per-object - * overhead within a pool, except for alignment padding. Each pool has a - * header with a link to the next pool of the same class. - * Small and large pool headers are identical except that the latter's - * link pointer must be FAR on 80x86 machines. - * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE - * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple - * of the alignment requirement of ALIGN_TYPE. - */ - -typedef union small_pool_struct * small_pool_ptr; - -typedef union small_pool_struct { - struct { - small_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ - } hdr; - ALIGN_TYPE dummy; /* included in union to ensure alignment */ -} small_pool_hdr; - -typedef union large_pool_struct FAR * large_pool_ptr; - -typedef union large_pool_struct { - struct { - large_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ - } hdr; - ALIGN_TYPE dummy; /* included in union to ensure alignment */ -} large_pool_hdr; - - -/* - * Here is the full definition of a memory manager object. - */ - -typedef struct { - struct jpeg_memory_mgr pub; /* public fields */ - - /* Each pool identifier (lifetime class) names a linked list of pools. */ - small_pool_ptr small_list[JPOOL_NUMPOOLS]; - large_pool_ptr large_list[JPOOL_NUMPOOLS]; - - /* Since we only have one lifetime class of virtual arrays, only one - * linked list is necessary (for each datatype). Note that the virtual - * array control blocks being linked together are actually stored somewhere - * in the small-pool list. - */ - jvirt_sarray_ptr virt_sarray_list; - jvirt_barray_ptr virt_barray_list; - - /* This counts total space obtained from jpeg_get_small/large */ - long total_space_allocated; - - /* alloc_sarray and alloc_barray set this value for use by virtual - * array routines. - */ - JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */ -} my_memory_mgr; - -typedef my_memory_mgr * my_mem_ptr; - - -/* - * The control blocks for virtual arrays. - * Note that these blocks are allocated in the "small" pool area. - * System-dependent info for the associated backing store (if any) is hidden - * inside the backing_store_info struct. - */ - -struct jvirt_sarray_control { - JSAMPARRAY mem_buffer; /* => the in-memory buffer */ - JDIMENSION rows_in_array; /* total virtual array height */ - JDIMENSION samplesperrow; /* width of array (and of memory buffer) */ - JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */ - JDIMENSION rows_in_mem; /* height of memory buffer */ - JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ - JDIMENSION cur_start_row; /* first logical row # in the buffer */ - JDIMENSION first_undef_row; /* row # of first uninitialized row */ - wxjpeg_boolean pre_zero; /* pre-zero mode requested? */ - wxjpeg_boolean dirty; /* do current buffer contents need written? */ - wxjpeg_boolean b_s_open; /* is backing-store data valid? */ - jvirt_sarray_ptr next; /* link to next virtual sarray control block */ - backing_store_info b_s_info; /* System-dependent control info */ -}; - -struct jvirt_barray_control { - JBLOCKARRAY mem_buffer; /* => the in-memory buffer */ - JDIMENSION rows_in_array; /* total virtual array height */ - JDIMENSION blocksperrow; /* width of array (and of memory buffer) */ - JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */ - JDIMENSION rows_in_mem; /* height of memory buffer */ - JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ - JDIMENSION cur_start_row; /* first logical row # in the buffer */ - JDIMENSION first_undef_row; /* row # of first uninitialized row */ - wxjpeg_boolean pre_zero; /* pre-zero mode requested? */ - wxjpeg_boolean dirty; /* do current buffer contents need written? */ - wxjpeg_boolean b_s_open; /* is backing-store data valid? */ - jvirt_barray_ptr next; /* link to next virtual barray control block */ - backing_store_info b_s_info; /* System-dependent control info */ -}; - - -#ifdef MEM_STATS /* optional extra stuff for statistics */ - -LOCAL(void) -print_mem_stats (j_common_ptr cinfo, int pool_id) -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - small_pool_ptr shdr_ptr; - large_pool_ptr lhdr_ptr; - - /* Since this is only a debugging stub, we can cheat a little by using - * fprintf directly rather than going through the trace message code. - * This is helpful because message parm array can't handle longs. - */ - fprintf(stderr, "Freeing pool %d, total space = %ld\n", - pool_id, mem->total_space_allocated); - - for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; - lhdr_ptr = lhdr_ptr->hdr.next) { - fprintf(stderr, " Large chunk used %ld\n", - (long) lhdr_ptr->hdr.bytes_used); - } - - for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; - shdr_ptr = shdr_ptr->hdr.next) { - fprintf(stderr, " Small chunk used %ld free %ld\n", - (long) shdr_ptr->hdr.bytes_used, - (long) shdr_ptr->hdr.bytes_left); - } -} - -#endif /* MEM_STATS */ - - -LOCAL(void) -out_of_memory (j_common_ptr cinfo, int which) -/* Report an out-of-memory error and stop execution */ -/* If we compiled MEM_STATS support, report alloc requests before dying */ -{ -#ifdef MEM_STATS - cinfo->err->trace_level = 2; /* force self_destruct to report stats */ -#endif - ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which); -} - - -/* - * Allocation of "small" objects. - * - * For these, we use pooled storage. When a new pool must be created, - * we try to get enough space for the current request plus a "slop" factor, - * where the slop will be the amount of leftover space in the new pool. - * The speed vs. space tradeoff is largely determined by the slop values. - * A different slop value is provided for each pool class (lifetime), - * and we also distinguish the first pool of a class from later ones. - * NOTE: the values given work fairly well on both 16- and 32-bit-int - * machines, but may be too small if longs are 64 bits or more. - */ - -static const size_t first_pool_slop[JPOOL_NUMPOOLS] = -{ - 1600, /* first PERMANENT pool */ - 16000 /* first IMAGE pool */ -}; - -static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = -{ - 0, /* additional PERMANENT pools */ - 5000 /* additional IMAGE pools */ -}; - -#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ - - -METHODDEF(void *) -alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) -/* Allocate a "small" object */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - small_pool_ptr hdr_ptr, prev_hdr_ptr; - char * data_ptr; - size_t odd_bytes, min_request, slop; - - /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr))) - out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ - - /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ - odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); - if (odd_bytes > 0) - sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; - - /* See if space is available in any existing pool */ - if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ - prev_hdr_ptr = NULL; - hdr_ptr = mem->small_list[pool_id]; - while (hdr_ptr != NULL) { - if (hdr_ptr->hdr.bytes_left >= sizeofobject) - break; /* found pool with enough space */ - prev_hdr_ptr = hdr_ptr; - hdr_ptr = hdr_ptr->hdr.next; - } - - /* Time to make a new pool? */ - if (hdr_ptr == NULL) { - /* min_request is what we need now, slop is what will be leftover */ - min_request = sizeofobject + SIZEOF(small_pool_hdr); - if (prev_hdr_ptr == NULL) /* first pool in class? */ - slop = first_pool_slop[pool_id]; - else - slop = extra_pool_slop[pool_id]; - /* Don't ask for more than MAX_ALLOC_CHUNK */ - if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request)) - slop = (size_t) (MAX_ALLOC_CHUNK-min_request); - /* Try to get space, if fail reduce slop and try again */ - for (;;) { - hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop); - if (hdr_ptr != NULL) - break; - slop /= 2; - if (slop < MIN_SLOP) /* give up when it gets real small */ - out_of_memory(cinfo, 2); /* jpeg_get_small failed */ - } - mem->total_space_allocated += min_request + slop; - /* Success, initialize the new pool header and add to end of list */ - hdr_ptr->hdr.next = NULL; - hdr_ptr->hdr.bytes_used = 0; - hdr_ptr->hdr.bytes_left = sizeofobject + slop; - if (prev_hdr_ptr == NULL) /* first pool in class? */ - mem->small_list[pool_id] = hdr_ptr; - else - prev_hdr_ptr->hdr.next = hdr_ptr; - } - - /* OK, allocate the object from the current pool */ - data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */ - data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */ - hdr_ptr->hdr.bytes_used += sizeofobject; - hdr_ptr->hdr.bytes_left -= sizeofobject; - - return (void *) data_ptr; -} - - -/* - * Allocation of "large" objects. - * - * The external semantics of these are the same as "small" objects, - * except that FAR pointers are used on 80x86. However the pool - * management heuristics are quite different. We assume that each - * request is large enough that it may as well be passed directly to - * jpeg_get_large; the pool management just links everything together - * so that we can free it all on demand. - * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY - * structures. The routines that create these structures (see below) - * deliberately bunch rows together to ensure a large request size. - */ - -METHODDEF(void FAR *) -alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) -/* Allocate a "large" object */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - large_pool_ptr hdr_ptr; - size_t odd_bytes; - - /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr))) - out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ - - /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ - odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); - if (odd_bytes > 0) - sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; - - /* Always make a new pool */ - if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ - - hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + - SIZEOF(large_pool_hdr)); - if (hdr_ptr == NULL) - out_of_memory(cinfo, 4); /* jpeg_get_large failed */ - mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr); - - /* Success, initialize the new pool header and add to list */ - hdr_ptr->hdr.next = mem->large_list[pool_id]; - /* We maintain space counts in each pool header for statistical purposes, - * even though they are not needed for allocation. - */ - hdr_ptr->hdr.bytes_used = sizeofobject; - hdr_ptr->hdr.bytes_left = 0; - mem->large_list[pool_id] = hdr_ptr; - - return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */ -} - - -/* - * Creation of 2-D sample arrays. - * The pointers are in near heap, the samples themselves in FAR heap. - * - * To minimize allocation overhead and to allow I/O of large contiguous - * blocks, we allocate the sample rows in groups of as many rows as possible - * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request. - * NB: the virtual array control routines, later in this file, know about - * this chunking of rows. The rowsperchunk value is left in the mem manager - * object so that it can be saved away if this sarray is the workspace for - * a virtual array. - */ - -METHODDEF(JSAMPARRAY) -alloc_sarray (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, JDIMENSION numrows) -/* Allocate a 2-D sample array */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - JSAMPARRAY result; - JSAMPROW workspace; - JDIMENSION rowsperchunk, currow, i; - long ltemp; - - /* Calculate max # of rows allowed in one allocation chunk */ - ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) samplesperrow * SIZEOF(JSAMPLE)); - if (ltemp <= 0) - ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); - if (ltemp < (long) numrows) - rowsperchunk = (JDIMENSION) ltemp; - else - rowsperchunk = numrows; - mem->last_rowsperchunk = rowsperchunk; - - /* Get space for row pointers (small object) */ - result = (JSAMPARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JSAMPROW))); - - /* Get the rows themselves (large objects) */ - currow = 0; - while (currow < numrows) { - rowsperchunk = MIN(rowsperchunk, numrows - currow); - workspace = (JSAMPROW) alloc_large(cinfo, pool_id, - (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow - * SIZEOF(JSAMPLE))); - for (i = rowsperchunk; i > 0; i--) { - result[currow++] = workspace; - workspace += samplesperrow; - } - } - - return result; -} - - -/* - * Creation of 2-D coefficient-block arrays. - * This is essentially the same as the code for sample arrays, above. - */ - -METHODDEF(JBLOCKARRAY) -alloc_barray (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, JDIMENSION numrows) -/* Allocate a 2-D coefficient-block array */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - JBLOCKARRAY result; - JBLOCKROW workspace; - JDIMENSION rowsperchunk, currow, i; - long ltemp; - - /* Calculate max # of rows allowed in one allocation chunk */ - ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) blocksperrow * SIZEOF(JBLOCK)); - if (ltemp <= 0) - ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); - if (ltemp < (long) numrows) - rowsperchunk = (JDIMENSION) ltemp; - else - rowsperchunk = numrows; - mem->last_rowsperchunk = rowsperchunk; - - /* Get space for row pointers (small object) */ - result = (JBLOCKARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JBLOCKROW))); - - /* Get the rows themselves (large objects) */ - currow = 0; - while (currow < numrows) { - rowsperchunk = MIN(rowsperchunk, numrows - currow); - workspace = (JBLOCKROW) alloc_large(cinfo, pool_id, - (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow - * SIZEOF(JBLOCK))); - for (i = rowsperchunk; i > 0; i--) { - result[currow++] = workspace; - workspace += blocksperrow; - } - } - - return result; -} - - -/* - * About virtual array management: - * - * The above "normal" array routines are only used to allocate strip buffers - * (as wide as the image, but just a few rows high). Full-image-sized buffers - * are handled as "virtual" arrays. The array is still accessed a strip at a - * time, but the memory manager must save the whole array for repeated - * accesses. The intended implementation is that there is a strip buffer in - * memory (as high as is possible given the desired memory limit), plus a - * backing file that holds the rest of the array. - * - * The request_virt_array routines are told the total size of the image and - * the maximum number of rows that will be accessed at once. The in-memory - * buffer must be at least as large as the maxaccess value. - * - * The request routines create control blocks but not the in-memory buffers. - * That is postponed until realize_virt_arrays is called. At that time the - * total amount of space needed is known (approximately, anyway), so free - * memory can be divided up fairly. - * - * The access_virt_array routines are responsible for making a specific strip - * area accessible (after reading or writing the backing file, if necessary). - * Note that the access routines are told whether the caller intends to modify - * the accessed strip; during a read-only pass this saves having to rewrite - * data to disk. The access routines are also responsible for pre-zeroing - * any newly accessed rows, if pre-zeroing was requested. - * - * In current usage, the access requests are usually for nonoverlapping - * strips; that is, successive access start_row numbers differ by exactly - * num_rows = maxaccess. This means we can get good performance with simple - * buffer dump/reload logic, by making the in-memory buffer be a multiple - * of the access height; then there will never be accesses across bufferload - * boundaries. The code will still work with overlapping access requests, - * but it doesn't handle bufferload overlaps very efficiently. - */ - - -METHODDEF(jvirt_sarray_ptr) -request_virt_sarray (j_common_ptr cinfo, int pool_id, wxjpeg_boolean pre_zero, - JDIMENSION samplesperrow, JDIMENSION numrows, - JDIMENSION maxaccess) -/* Request a virtual 2-D sample array */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - jvirt_sarray_ptr result; - - /* Only IMAGE-lifetime virtual arrays are currently supported */ - if (pool_id != JPOOL_IMAGE) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ - - /* get control block */ - result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_sarray_control)); - - result->mem_buffer = NULL; /* marks array not yet realized */ - result->rows_in_array = numrows; - result->samplesperrow = samplesperrow; - result->maxaccess = maxaccess; - result->pre_zero = pre_zero; - result->b_s_open = FALSE; /* no associated backing-store object */ - result->next = mem->virt_sarray_list; /* add to list of virtual arrays */ - mem->virt_sarray_list = result; - - return result; -} - - -METHODDEF(jvirt_barray_ptr) -request_virt_barray (j_common_ptr cinfo, int pool_id, wxjpeg_boolean pre_zero, - JDIMENSION blocksperrow, JDIMENSION numrows, - JDIMENSION maxaccess) -/* Request a virtual 2-D coefficient-block array */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - jvirt_barray_ptr result; - - /* Only IMAGE-lifetime virtual arrays are currently supported */ - if (pool_id != JPOOL_IMAGE) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ - - /* get control block */ - result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_barray_control)); - - result->mem_buffer = NULL; /* marks array not yet realized */ - result->rows_in_array = numrows; - result->blocksperrow = blocksperrow; - result->maxaccess = maxaccess; - result->pre_zero = pre_zero; - result->b_s_open = FALSE; /* no associated backing-store object */ - result->next = mem->virt_barray_list; /* add to list of virtual arrays */ - mem->virt_barray_list = result; - - return result; -} - - -METHODDEF(void) -realize_virt_arrays (j_common_ptr cinfo) -/* Allocate the in-memory buffers for any unrealized virtual arrays */ -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - long space_per_minheight, maximum_space, avail_mem; - long minheights, max_minheights; - jvirt_sarray_ptr sptr; - jvirt_barray_ptr bptr; - - /* Compute the minimum space needed (maxaccess rows in each buffer) - * and the maximum space needed (full image height in each buffer). - * These may be of use to the system-dependent jpeg_mem_available routine. - */ - space_per_minheight = 0; - maximum_space = 0; - for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { - if (sptr->mem_buffer == NULL) { /* if not realized yet */ - space_per_minheight += (long) sptr->maxaccess * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); - maximum_space += (long) sptr->rows_in_array * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); - } - } - for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { - if (bptr->mem_buffer == NULL) { /* if not realized yet */ - space_per_minheight += (long) bptr->maxaccess * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); - maximum_space += (long) bptr->rows_in_array * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); - } - } - - if (space_per_minheight <= 0) - return; /* no unrealized arrays, no work */ - - /* Determine amount of memory to actually use; this is system-dependent. */ - avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space, - mem->total_space_allocated); - - /* If the maximum space needed is available, make all the buffers full - * height; otherwise parcel it out with the same number of minheights - * in each buffer. - */ - if (avail_mem >= maximum_space) - max_minheights = 1000000000L; - else { - max_minheights = avail_mem / space_per_minheight; - /* If there doesn't seem to be enough space, try to get the minimum - * anyway. This allows a "stub" implementation of jpeg_mem_available(). - */ - if (max_minheights <= 0) - max_minheights = 1; - } - - /* Allocate the in-memory buffers and initialize backing store as needed. */ - - for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { - if (sptr->mem_buffer == NULL) { /* if not realized yet */ - minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L; - if (minheights <= max_minheights) { - /* This buffer fits in memory */ - sptr->rows_in_mem = sptr->rows_in_array; - } else { - /* It doesn't fit in memory, create backing store. */ - sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess); - jpeg_open_backing_store(cinfo, & sptr->b_s_info, - (long) sptr->rows_in_array * - (long) sptr->samplesperrow * - (long) SIZEOF(JSAMPLE)); - sptr->b_s_open = TRUE; - } - sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE, - sptr->samplesperrow, sptr->rows_in_mem); - sptr->rowsperchunk = mem->last_rowsperchunk; - sptr->cur_start_row = 0; - sptr->first_undef_row = 0; - sptr->dirty = FALSE; - } - } - - for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { - if (bptr->mem_buffer == NULL) { /* if not realized yet */ - minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L; - if (minheights <= max_minheights) { - /* This buffer fits in memory */ - bptr->rows_in_mem = bptr->rows_in_array; - } else { - /* It doesn't fit in memory, create backing store. */ - bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess); - jpeg_open_backing_store(cinfo, & bptr->b_s_info, - (long) bptr->rows_in_array * - (long) bptr->blocksperrow * - (long) SIZEOF(JBLOCK)); - bptr->b_s_open = TRUE; - } - bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE, - bptr->blocksperrow, bptr->rows_in_mem); - bptr->rowsperchunk = mem->last_rowsperchunk; - bptr->cur_start_row = 0; - bptr->first_undef_row = 0; - bptr->dirty = FALSE; - } - } -} - - -LOCAL(void) -do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, wxjpeg_boolean writing) -/* Do backing store read or write of a virtual sample array */ -{ - long bytesperrow, file_offset, byte_count, rows, thisrow, i; - - bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE); - file_offset = ptr->cur_start_row * bytesperrow; - /* Loop to read or write each allocation chunk in mem_buffer */ - for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { - /* One chunk, but check for short chunk at end of buffer */ - rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); - /* Transfer no more than is currently defined */ - thisrow = (long) ptr->cur_start_row + i; - rows = MIN(rows, (long) ptr->first_undef_row - thisrow); - /* Transfer no more than fits in file */ - rows = MIN(rows, (long) ptr->rows_in_array - thisrow); - if (rows <= 0) /* this chunk might be past end of file! */ - break; - byte_count = rows * bytesperrow; - if (writing) - (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); - else - (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); - file_offset += byte_count; - } -} - - -LOCAL(void) -do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, wxjpeg_boolean writing) -/* Do backing store read or write of a virtual coefficient-block array */ -{ - long bytesperrow, file_offset, byte_count, rows, thisrow, i; - - bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK); - file_offset = ptr->cur_start_row * bytesperrow; - /* Loop to read or write each allocation chunk in mem_buffer */ - for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { - /* One chunk, but check for short chunk at end of buffer */ - rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); - /* Transfer no more than is currently defined */ - thisrow = (long) ptr->cur_start_row + i; - rows = MIN(rows, (long) ptr->first_undef_row - thisrow); - /* Transfer no more than fits in file */ - rows = MIN(rows, (long) ptr->rows_in_array - thisrow); - if (rows <= 0) /* this chunk might be past end of file! */ - break; - byte_count = rows * bytesperrow; - if (writing) - (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); - else - (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); - file_offset += byte_count; - } -} - - -METHODDEF(JSAMPARRAY) -access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, - JDIMENSION start_row, JDIMENSION num_rows, - wxjpeg_boolean writable) -/* Access the part of a virtual sample array starting at start_row */ -/* and extending for num_rows rows. writable is true if */ -/* caller intends to modify the accessed area. */ -{ - JDIMENSION end_row = start_row + num_rows; - JDIMENSION undef_row; - - /* debugging check */ - if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || - ptr->mem_buffer == NULL) - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - - /* Make the desired part of the virtual array accessible */ - if (start_row < ptr->cur_start_row || - end_row > ptr->cur_start_row+ptr->rows_in_mem) { - if (! ptr->b_s_open) - ERREXIT(cinfo, JERR_VIRTUAL_BUG); - /* Flush old buffer contents if necessary */ - if (ptr->dirty) { - do_sarray_io(cinfo, ptr, TRUE); - ptr->dirty = FALSE; - } - /* Decide what part of virtual array to access. - * Algorithm: if target address > current window, assume forward scan, - * load starting at target address. If target address < current window, - * assume backward scan, load so that target area is top of window. - * Note that when switching from forward write to forward read, will have - * start_row = 0, so the limiting case applies and we load from 0 anyway. - */ - if (start_row > ptr->cur_start_row) { - ptr->cur_start_row = start_row; - } else { - /* use long arithmetic here to avoid overflow & unsigned problems */ - long ltemp; - - ltemp = (long) end_row - (long) ptr->rows_in_mem; - if (ltemp < 0) - ltemp = 0; /* don't fall off front end of file */ - ptr->cur_start_row = (JDIMENSION) ltemp; - } - /* Read in the selected part of the array. - * During the initial write pass, we will do no actual read - * because the selected part is all undefined. - */ - do_sarray_io(cinfo, ptr, FALSE); - } - /* Ensure the accessed part of the array is defined; prezero if needed. - * To improve locality of access, we only prezero the part of the array - * that the caller is about to access, not the entire in-memory array. - */ - if (ptr->first_undef_row < end_row) { - if (ptr->first_undef_row < start_row) { - if (writable) /* writer skipped over a section of array */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - undef_row = start_row; /* but reader is allowed to read ahead */ - } else { - undef_row = ptr->first_undef_row; - } - if (writable) - ptr->first_undef_row = end_row; - if (ptr->pre_zero) { - size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE); - undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ - end_row -= ptr->cur_start_row; - while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); - undef_row++; - } - } else { - if (! writable) /* reader looking at undefined data */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - } - } - /* Flag the buffer dirty if caller will write in it */ - if (writable) - ptr->dirty = TRUE; - /* Return address of proper part of the buffer */ - return ptr->mem_buffer + (start_row - ptr->cur_start_row); -} - - -METHODDEF(JBLOCKARRAY) -access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, - JDIMENSION start_row, JDIMENSION num_rows, - wxjpeg_boolean writable) -/* Access the part of a virtual block array starting at start_row */ -/* and extending for num_rows rows. writable is true if */ -/* caller intends to modify the accessed area. */ -{ - JDIMENSION end_row = start_row + num_rows; - JDIMENSION undef_row; - - /* debugging check */ - if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || - ptr->mem_buffer == NULL) - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - - /* Make the desired part of the virtual array accessible */ - if (start_row < ptr->cur_start_row || - end_row > ptr->cur_start_row+ptr->rows_in_mem) { - if (! ptr->b_s_open) - ERREXIT(cinfo, JERR_VIRTUAL_BUG); - /* Flush old buffer contents if necessary */ - if (ptr->dirty) { - do_barray_io(cinfo, ptr, TRUE); - ptr->dirty = FALSE; - } - /* Decide what part of virtual array to access. - * Algorithm: if target address > current window, assume forward scan, - * load starting at target address. If target address < current window, - * assume backward scan, load so that target area is top of window. - * Note that when switching from forward write to forward read, will have - * start_row = 0, so the limiting case applies and we load from 0 anyway. - */ - if (start_row > ptr->cur_start_row) { - ptr->cur_start_row = start_row; - } else { - /* use long arithmetic here to avoid overflow & unsigned problems */ - long ltemp; - - ltemp = (long) end_row - (long) ptr->rows_in_mem; - if (ltemp < 0) - ltemp = 0; /* don't fall off front end of file */ - ptr->cur_start_row = (JDIMENSION) ltemp; - } - /* Read in the selected part of the array. - * During the initial write pass, we will do no actual read - * because the selected part is all undefined. - */ - do_barray_io(cinfo, ptr, FALSE); - } - /* Ensure the accessed part of the array is defined; prezero if needed. - * To improve locality of access, we only prezero the part of the array - * that the caller is about to access, not the entire in-memory array. - */ - if (ptr->first_undef_row < end_row) { - if (ptr->first_undef_row < start_row) { - if (writable) /* writer skipped over a section of array */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - undef_row = start_row; /* but reader is allowed to read ahead */ - } else { - undef_row = ptr->first_undef_row; - } - if (writable) - ptr->first_undef_row = end_row; - if (ptr->pre_zero) { - size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK); - undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ - end_row -= ptr->cur_start_row; - while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); - undef_row++; - } - } else { - if (! writable) /* reader looking at undefined data */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - } - } - /* Flag the buffer dirty if caller will write in it */ - if (writable) - ptr->dirty = TRUE; - /* Return address of proper part of the buffer */ - return ptr->mem_buffer + (start_row - ptr->cur_start_row); -} - - -/* - * Release all objects belonging to a specified pool. - */ - -METHODDEF(void) -free_pool (j_common_ptr cinfo, int pool_id) -{ - my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - small_pool_ptr shdr_ptr; - large_pool_ptr lhdr_ptr; - size_t space_freed; - - if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ - -#ifdef MEM_STATS - if (cinfo->err->trace_level > 1) - print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */ -#endif - - /* If freeing IMAGE pool, close any virtual arrays first */ - if (pool_id == JPOOL_IMAGE) { - jvirt_sarray_ptr sptr; - jvirt_barray_ptr bptr; - - for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { - if (sptr->b_s_open) { /* there may be no backing store */ - sptr->b_s_open = FALSE; /* prevent recursive close if error */ - (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info); - } - } - mem->virt_sarray_list = NULL; - for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { - if (bptr->b_s_open) { /* there may be no backing store */ - bptr->b_s_open = FALSE; /* prevent recursive close if error */ - (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info); - } - } - mem->virt_barray_list = NULL; - } - - /* Release large objects */ - lhdr_ptr = mem->large_list[pool_id]; - mem->large_list[pool_id] = NULL; - - while (lhdr_ptr != NULL) { - large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next; - space_freed = lhdr_ptr->hdr.bytes_used + - lhdr_ptr->hdr.bytes_left + - SIZEOF(large_pool_hdr); - jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); - mem->total_space_allocated -= space_freed; - lhdr_ptr = next_lhdr_ptr; - } - - /* Release small objects */ - shdr_ptr = mem->small_list[pool_id]; - mem->small_list[pool_id] = NULL; - - while (shdr_ptr != NULL) { - small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next; - space_freed = shdr_ptr->hdr.bytes_used + - shdr_ptr->hdr.bytes_left + - SIZEOF(small_pool_hdr); - jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); - mem->total_space_allocated -= space_freed; - shdr_ptr = next_shdr_ptr; - } -} - - -/* - * Close up shop entirely. - * Note that this cannot be called unless cinfo->mem is non-NULL. - */ - -METHODDEF(void) -self_destruct (j_common_ptr cinfo) -{ - int pool; - - /* Close all backing store, release all memory. - * Releasing pools in reverse order might help avoid fragmentation - * with some (brain-damaged) malloc libraries. - */ - for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { - free_pool(cinfo, pool); - } - - /* Release the memory manager control block too. */ - jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr)); - cinfo->mem = NULL; /* ensures I will be called only once */ - - jpeg_mem_term(cinfo); /* system-dependent cleanup */ -} - - -/* - * Memory manager initialization. - * When this is called, only the error manager pointer is valid in cinfo! - */ - -GLOBAL(void) -jinit_memory_mgr (j_common_ptr cinfo) -{ - my_mem_ptr mem; - long max_to_use; - int pool; - size_t test_mac; - - cinfo->mem = NULL; /* for safety if init fails */ - - /* Check for configuration errors. - * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably - * doesn't reflect any real hardware alignment requirement. - * The test is a little tricky: for X>0, X and X-1 have no one-bits - * in common if and only if X is a power of 2, ie has only one one-bit. - * Some compilers may give an "unreachable code" warning here; ignore it. - */ - if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0) - ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE); - /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be - * a multiple of SIZEOF(ALIGN_TYPE). - * Again, an "unreachable code" warning may be ignored here. - * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK. - */ - test_mac = (size_t) MAX_ALLOC_CHUNK; - if ((long) test_mac != MAX_ALLOC_CHUNK || - (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0) - ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); - - max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */ - - /* Attempt to allocate memory manager's control block */ - mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr)); - - if (mem == NULL) { - jpeg_mem_term(cinfo); /* system-dependent cleanup */ - ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0); - } - - /* OK, fill in the method pointers */ - mem->pub.alloc_small = alloc_small; - mem->pub.alloc_large = alloc_large; - mem->pub.alloc_sarray = alloc_sarray; - mem->pub.alloc_barray = alloc_barray; - mem->pub.request_virt_sarray = request_virt_sarray; - mem->pub.request_virt_barray = request_virt_barray; - mem->pub.realize_virt_arrays = realize_virt_arrays; - mem->pub.access_virt_sarray = access_virt_sarray; - mem->pub.access_virt_barray = access_virt_barray; - mem->pub.free_pool = free_pool; - mem->pub.self_destruct = self_destruct; - - /* Make MAX_ALLOC_CHUNK accessible to other modules */ - mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK; - - /* Initialize working state */ - mem->pub.max_memory_to_use = max_to_use; - - for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { - mem->small_list[pool] = NULL; - mem->large_list[pool] = NULL; - } - mem->virt_sarray_list = NULL; - mem->virt_barray_list = NULL; - - mem->total_space_allocated = SIZEOF(my_memory_mgr); - - /* Declare ourselves open for business */ - cinfo->mem = & mem->pub; - - /* Check for an environment variable JPEGMEM; if found, override the - * default max_memory setting from jpeg_mem_init. Note that the - * surrounding application may again override this value. - * If your system doesn't support getenv(), define NO_GETENV to disable - * this feature. - */ -#ifndef NO_GETENV - { char * memenv; - - if ((memenv = getenv("JPEGMEM")) != NULL) { - char ch = 'x'; - - if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) { - if (ch == 'm' || ch == 'M') - max_to_use *= 1000L; - mem->pub.max_memory_to_use = max_to_use * 1000L; - } - } - } -#endif - -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemname.c b/Source/3rdParty/wx/src/jpeg/jmemname.c deleted file mode 100644 index ed96dee1b..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemname.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * jmemname.c - * - * Copyright (C) 1992-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file provides a generic implementation of the system-dependent - * portion of the JPEG memory manager. This implementation assumes that - * you must explicitly construct a name for each temp file. - * Also, the problem of determining the amount of memory available - * is shoved onto the user. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -#endif - -#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ -#define SEEK_SET 0 /* if not, assume 0 is correct */ -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define RW_BINARY "w+" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define RW_BINARY "w+b", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define RW_BINARY "w+b" -#endif -#endif - - -/* - * Selection of a file name for a temporary file. - * This is system-dependent! - * - * The code as given is suitable for most Unix systems, and it is easily - * modified for most non-Unix systems. Some notes: - * 1. The temp file is created in the directory named by TEMP_DIRECTORY. - * The default value is /usr/tmp, which is the conventional place for - * creating large temp files on Unix. On other systems you'll probably - * want to change the file location. You can do this by editing the - * #define, or (preferred) by defining TEMP_DIRECTORY in jconfig.h. - * - * 2. If you need to change the file name as well as its location, - * you can override the TEMP_FILE_NAME macro. (Note that this is - * actually a printf format string; it must contain %s and %d.) - * Few people should need to do this. - * - * 3. mktemp() is used to ensure that multiple processes running - * simultaneously won't select the same file names. If your system - * doesn't have mktemp(), define NO_MKTEMP to do it the hard way. - * (If you don't have , also define NO_ERRNO_H.) - * - * 4. You probably want to define NEED_SIGNAL_CATCHER so that cjpeg.c/djpeg.c - * will cause the temp files to be removed if you stop the program early. - */ - -#ifndef TEMP_DIRECTORY /* can override from jconfig.h or Makefile */ -#define TEMP_DIRECTORY "/usr/tmp/" /* recommended setting for Unix */ -#endif - -static int next_file_num; /* to distinguish among several temp files */ - -#ifdef NO_MKTEMP - -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "%sJPG%03d.TMP" -#endif - -#ifndef NO_ERRNO_H -#include /* to define ENOENT */ -#endif - -/* ANSI C specifies that errno is a macro, but on older systems it's more - * likely to be a plain int variable. And not all versions of errno.h - * bother to declare it, so we have to in order to be most portable. Thus: - */ -#ifndef errno -extern int errno; -#endif - - -LOCAL(void) -select_file_name (char * fname) -{ - FILE * tfile; - - /* Keep generating file names till we find one that's not in use */ - for (;;) { - next_file_num++; /* advance counter */ - sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); - if ((tfile = fopen(fname, READ_BINARY)) == NULL) { - /* fopen could have failed for a reason other than the file not - * being there; for example, file there but unreadable. - * If isn't available, then we cannot test the cause. - */ -#ifdef ENOENT - if (errno != ENOENT) - continue; -#endif - break; - } - fclose(tfile); /* oops, it's there; close tfile & try again */ - } -} - -#else /* ! NO_MKTEMP */ - -/* Note that mktemp() requires the initial filename to end in six X's */ -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "%sJPG%dXXXXXX" -#endif - -LOCAL(void) -select_file_name (char * fname) -{ - next_file_num++; /* advance counter */ - sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); - mktemp(fname); /* make sure file name is unique */ - /* mktemp replaces the trailing XXXXXX with a unique string of characters */ -} - -#endif /* NO_MKTEMP */ - - -/* - * Memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * Backing store (temporary file) management. - * Backing store objects are only used when the value returned by - * jpeg_mem_available is less than the total space needed. You can dispense - * with these routines if you have plenty of virtual memory; see jmemnobs.c. - */ - - -METHODDEF(void) -read_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (fseek(info->temp_file, file_offset, SEEK_SET)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - if (JFREAD(info->temp_file, buffer_address, byte_count) - != (size_t) byte_count) - ERREXIT(cinfo, JERR_TFILE_READ); -} - - -METHODDEF(void) -write_backing_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (fseek(info->temp_file, file_offset, SEEK_SET)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - if (JFWRITE(info->temp_file, buffer_address, byte_count) - != (size_t) byte_count) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_backing_store (j_common_ptr cinfo, backing_store_ptr info) -{ - fclose(info->temp_file); /* close the file */ - unlink(info->temp_name); /* delete the file */ -/* If your system doesn't have unlink(), use remove() instead. - * remove() is the ANSI-standard name for this function, but if - * your system was ANSI you'd be using jmemansi.c, right? - */ - TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name); -} - - -/* - * Initial opening of a backing-store object. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - select_file_name(info->temp_name); - if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - info->read_backing_store = read_backing_store; - info->write_backing_store = write_backing_store; - info->close_backing_store = close_backing_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - next_file_num = 0; /* initialize temp file name generator */ - return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemnobs.c b/Source/3rdParty/wx/src/jpeg/jmemnobs.c deleted file mode 100644 index eb8c33772..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemnobs.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * jmemnobs.c - * - * Copyright (C) 1992-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file provides a really simple implementation of the system- - * dependent portion of the JPEG memory manager. This implementation - * assumes that no backing-store files are needed: all required space - * can be obtained from malloc(). - * This is very portable in the sense that it'll compile on almost anything, - * but you'd better have lots of main memory (or virtual memory) if you want - * to process big images. - * Note that the max_memory_to_use option is ignored by this implementation. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -#endif - - -/* - * Memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * Here we always say, "we got all you want bud!" - */ - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return max_bytes_needed; -} - - -/* - * Backing store (temporary file) management. - * Since jpeg_mem_available always promised the moon, - * this should never be called and we can just error out. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - ERREXIT(cinfo, JERR_NO_BACKING_STORE); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. Here, there isn't any. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - return 0; /* just set max_memory_to_use to 0 */ -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jmemsys.h b/Source/3rdParty/wx/src/jpeg/jmemsys.h deleted file mode 100644 index 6c3c6d348..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmemsys.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * jmemsys.h - * - * Copyright (C) 1992-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This include file defines the interface between the system-independent - * and system-dependent portions of the JPEG memory manager. No other - * modules need include it. (The system-independent portion is jmemmgr.c; - * there are several different versions of the system-dependent portion.) - * - * This file works as-is for the system-dependent memory managers supplied - * in the IJG distribution. You may need to modify it if you write a - * custom memory manager. If system-dependent changes are needed in - * this file, the best method is to #ifdef them based on a configuration - * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR - * and USE_MAC_MEMMGR. - */ - - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_get_small jGetSmall -#define jpeg_free_small jFreeSmall -#define jpeg_get_large jGetLarge -#define jpeg_free_large jFreeLarge -#define jpeg_mem_available jMemAvail -#define jpeg_open_backing_store jOpenBackStore -#define jpeg_mem_init jMemInit -#define jpeg_mem_term jMemTerm -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* - * These two functions are used to allocate and release small chunks of - * memory. (Typically the total amount requested through jpeg_get_small is - * no more than 20K or so; this will be requested in chunks of a few K each.) - * Behavior should be the same as for the standard library functions malloc - * and free; in particular, jpeg_get_small must return NULL on failure. - * On most systems, these ARE malloc and free. jpeg_free_small is passed the - * size of the object being freed, just in case it's needed. - * On an 80x86 machine using small-data memory model, these manage near heap. - */ - -EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject)); -EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object, - size_t sizeofobject)); - -/* - * These two functions are used to allocate and release large chunks of - * memory (up to the total free space designated by jpeg_mem_available). - * The interface is the same as above, except that on an 80x86 machine, - * far pointers are used. On most other machines these are identical to - * the jpeg_get/free_small routines; but we keep them separate anyway, - * in case a different allocation strategy is desirable for large chunks. - */ - -EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo, - size_t sizeofobject)); -EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, - size_t sizeofobject)); - -/* - * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may - * be requested in a single call to jpeg_get_large (and jpeg_get_small for that - * matter, but that case should never come into play). This macro is needed - * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. - * On those machines, we expect that jconfig.h will provide a proper value. - * On machines with 32-bit flat address spaces, any large constant may be used. - * - * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type - * size_t and will be a multiple of sizeof(align_type). - */ - -#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ -#define MAX_ALLOC_CHUNK 1000000000L -#endif - -/* - * This routine computes the total space still available for allocation by - * jpeg_get_large. If more space than this is needed, backing store will be - * used. NOTE: any memory already allocated must not be counted. - * - * There is a minimum space requirement, corresponding to the minimum - * feasible buffer sizes; jmemmgr.c will request that much space even if - * jpeg_mem_available returns zero. The maximum space needed, enough to hold - * all working storage in memory, is also passed in case it is useful. - * Finally, the total space already allocated is passed. If no better - * method is available, cinfo->mem->max_memory_to_use - already_allocated - * is often a suitable calculation. - * - * It is OK for jpeg_mem_available to underestimate the space available - * (that'll just lead to more backing-store access than is really necessary). - * However, an overestimate will lead to failure. Hence it's wise to subtract - * a slop factor from the true available space. 5% should be enough. - * - * On machines with lots of virtual memory, any large constant may be returned. - * Conversely, zero may be returned to always use the minimum amount of memory. - */ - -EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, - long min_bytes_needed, - long max_bytes_needed, - long already_allocated)); - - -/* - * This structure holds whatever state is needed to access a single - * backing-store object. The read/write/close method pointers are called - * by jmemmgr.c to manipulate the backing-store object; all other fields - * are private to the system-dependent backing store routines. - */ - -#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ - - -#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ - -typedef unsigned short XMSH; /* type of extended-memory handles */ -typedef unsigned short EMSH; /* type of expanded-memory handles */ - -typedef union { - short file_handle; /* DOS file handle if it's a temp file */ - XMSH xms_handle; /* handle if it's a chunk of XMS */ - EMSH ems_handle; /* handle if it's a chunk of EMS */ -} handle_union; - -#endif /* USE_MSDOS_MEMMGR */ - -#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ -#include -#endif /* USE_MAC_MEMMGR */ - - -typedef struct backing_store_struct * backing_store_ptr; - -typedef struct backing_store_struct { - /* Methods for reading/writing/closing this backing-store object */ - JMETHOD(void, read_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); - JMETHOD(void, write_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); - JMETHOD(void, close_backing_store, (j_common_ptr cinfo, - backing_store_ptr info)); - - /* Private fields for system-dependent backing-store management */ -#ifdef USE_MSDOS_MEMMGR - /* For the MS-DOS manager (jmemdos.c), we need: */ - handle_union handle; /* reference to backing-store storage object */ - char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ -#else -#ifdef USE_MAC_MEMMGR - /* For the Mac manager (jmemmac.c), we need: */ - short temp_file; /* file reference number to temp file */ - FSSpec tempSpec; /* the FSSpec for the temp file */ - char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ -#else - /* For a typical implementation with temp files, we need: */ - FILE * temp_file; /* stdio reference to temp file */ - char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ -#endif -#endif -} backing_store_info; - - -/* - * Initial opening of a backing-store object. This must fill in the - * read/write/close pointers in the object. The read/write routines - * may take an error exit if the specified maximum file size is exceeded. - * (If jpeg_mem_available always returns a large value, this routine can - * just take an error exit.) - */ - -EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, - backing_store_ptr info, - long total_bytes_needed)); - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. jpeg_mem_init will be called before anything is - * allocated (and, therefore, nothing in cinfo is of use except the error - * manager pointer). It should return a suitable default value for - * max_memory_to_use; this may subsequently be overridden by the surrounding - * application. (Note that max_memory_to_use is only important if - * jpeg_mem_available chooses to consult it ... no one else will.) - * jpeg_mem_term may assume that all requested memory has been freed and that - * all opened backing-store objects have been closed. - */ - -EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); -EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); diff --git a/Source/3rdParty/wx/src/jpeg/jmorecfg.h b/Source/3rdParty/wx/src/jpeg/jmorecfg.h deleted file mode 100644 index c4a5d33b0..000000000 --- a/Source/3rdParty/wx/src/jpeg/jmorecfg.h +++ /dev/null @@ -1,420 +0,0 @@ -/* - * jmorecfg.h - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains additional configuration options that customize the - * JPEG software for special applications or support machine-dependent - * optimizations. Most users will not need to touch this file. - */ - - -/* - * Define BITS_IN_JSAMPLE as either - * 8 for 8-bit sample values (the usual setting) - * 12 for 12-bit sample values - * Only 8 and 12 are legal data precisions for lossy JPEG according to the - * JPEG standard, and the IJG code does not support anything else! - * We do not support run-time selection of data precision, sorry. - */ - -#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ - - -/* - * Maximum number of components (color channels) allowed in JPEG image. - * To meet the letter of the JPEG spec, set this to 255. However, darn - * few applications need more than 4 channels (maybe 5 for CMYK + alpha - * mask). We recommend 10 as a reasonable compromise; use 4 if you are - * really short on memory. (Each allowed component costs a hundred or so - * bytes of storage, whether actually used in an image or not.) - */ - -#define MAX_COMPONENTS 10 /* maximum number of image components */ - - -/* - * Basic data types. - * You may need to change these if you have a machine with unusual data - * type sizes; for example, "char" not 8 bits, "short" not 16 bits, - * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, - * but it had better be at least 16. - */ - -/* Representation of a single sample (pixel element value). - * We frequently allocate large arrays of these, so it's important to keep - * them small. But if you have memory to burn and access to char or short - * arrays is very slow on your hardware, you might want to change these. - */ - -#if BITS_IN_JSAMPLE == 8 -/* JSAMPLE should be the smallest type that will hold the values 0..255. - * You can use a signed char by having GETJSAMPLE mask it with 0xFF. - */ - -#ifdef HAVE_UNSIGNED_CHAR - -typedef unsigned char JSAMPLE; -#define GETJSAMPLE(value) ((int) (value)) - -#else /* not HAVE_UNSIGNED_CHAR */ - -typedef char JSAMPLE; -#ifdef CHAR_IS_UNSIGNED -#define GETJSAMPLE(value) ((int) (value)) -#else -#define GETJSAMPLE(value) ((int) (value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ - -#endif /* HAVE_UNSIGNED_CHAR */ - -#define MAXJSAMPLE 255 -#define CENTERJSAMPLE 128 - -#endif /* BITS_IN_JSAMPLE == 8 */ - - -#if BITS_IN_JSAMPLE == 12 -/* JSAMPLE should be the smallest type that will hold the values 0..4095. - * On nearly all machines "short" will do nicely. - */ - -typedef short JSAMPLE; -#define GETJSAMPLE(value) ((int) (value)) - -#define MAXJSAMPLE 4095 -#define CENTERJSAMPLE 2048 - -#endif /* BITS_IN_JSAMPLE == 12 */ - - -/* Representation of a DCT frequency coefficient. - * This should be a signed value of at least 16 bits; "short" is usually OK. - * Again, we allocate large arrays of these, but you can change to int - * if you have memory to burn and "short" is really slow. - */ - -typedef short JCOEF; - - -/* Compressed datastreams are represented as arrays of JOCTET. - * These must be EXACTLY 8 bits wide, at least once they are written to - * external storage. Note that when using the stdio data source/destination - * managers, this is also the data type passed to fread/fwrite. - */ - -#ifdef HAVE_UNSIGNED_CHAR - -typedef unsigned char JOCTET; -#define GETJOCTET(value) (value) - -#else /* not HAVE_UNSIGNED_CHAR */ - -typedef char JOCTET; -#ifdef CHAR_IS_UNSIGNED -#define GETJOCTET(value) (value) -#else -#define GETJOCTET(value) ((value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ - -#endif /* HAVE_UNSIGNED_CHAR */ - - -/* These typedefs are used for various table entries and so forth. - * They must be at least as wide as specified; but making them too big - * won't cost a huge amount of memory, so we don't provide special - * extraction code like we did for JSAMPLE. (In other words, these - * typedefs live at a different point on the speed/space tradeoff curve.) - */ - -/* UINT8 must hold at least the values 0..255. */ -#ifndef __WINE_BASETSD_H - -#ifdef HAVE_UNSIGNED_CHAR -typedef unsigned char UINT8; -#else /* not HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED -typedef char UINT8; -#else /* not CHAR_IS_UNSIGNED */ -typedef short UINT8; -#endif /* CHAR_IS_UNSIGNED */ -#endif /* HAVE_UNSIGNED_CHAR */ - -/* UINT16 must hold at least the values 0..65535. */ - -#ifdef HAVE_UNSIGNED_SHORT -typedef unsigned short UINT16; -#else /* not HAVE_UNSIGNED_SHORT */ -typedef unsigned int UINT16; -#endif /* HAVE_UNSIGNED_SHORT */ - -/* INT16 must hold at least the values -32768..32767. */ - -#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ -typedef short INT16; -#endif - -#endif /* __WINE_BASETSD_H */ - -/* INT32 must hold at least signed 32-bit values. */ - -/* - VZ: due to the horrible mess resulting in INT32 being defined in windows.h - for some compilers but not for the other ones, I have globally replace - INT32 with JPEG_INT32 in libjpeg code to avoid the eight level ifdef - which used to be here. The problem is that, of course, now we'll have - conflicts when upgrading to the next libjpeg release -- however - considering their frequency (1 in the last 5 years) it seems that - it is not too high a price to pay for the clean compilation with all - versions of mingw32 and cygwin - */ -typedef long JPEG_INT32; - -/* Datatype used for image dimensions. The JPEG standard only supports - * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore - * "unsigned int" is sufficient on all machines. However, if you need to - * handle larger images and you don't mind deviating from the spec, you - * can change this datatype. - */ - -typedef unsigned int JDIMENSION; - -#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ - - -/* These macros are used in all function definitions and extern declarations. - * You could modify them if you need to change function linkage conventions; - * in particular, you'll need to do that to make the library a Windows DLL. - * Another application is to make all functions global for use with debuggers - * or code profilers that require it. - */ - -#if defined(__VISAGECPP__) -#define JPEG_CALLING_CONV _Optlink -#else /* !Visual Age C++ */ -#define JPEG_CALLING_CONV -#endif - -/* We can't declare a static function as extern "C" as we need to do in C++ - * programs, so suppress static in METHODDEF when using C++. - */ -#if defined(__cplusplus) -#define JPEG_METHOD_LINKAGE -#else /* !__cplusplus */ -#define JPEG_METHOD_LINKAGE static -#endif - -/* a function called through method pointers: */ -#define METHODDEF(type) JPEG_METHOD_LINKAGE type JPEG_CALLING_CONV -/* a function used only in its module: */ -#define LOCAL(type) static type JPEG_CALLING_CONV -/* a function referenced thru EXTERNs: */ -#define GLOBAL(type) type -/* a reference to a GLOBAL function: */ -#define EXTERN(type) extern type JPEG_CALLING_CONV - -/* This macro is used to declare a "method", that is, a function pointer. - * We want to supply prototype parameters if the compiler can cope. - * Note that the arglist parameter must be parenthesized! - * Again, you can customize this if you need special linkage keywords. - */ - -#if defined(__VISAGECPP__) /* need this for /common/imagjpeg.obj but not loclly */ -#ifdef HAVE_PROTOTYPES -#define JMETHOD(type,methodname,arglist) type (_Optlink *methodname) arglist -#else -#define JMETHOD(type,methodname,arglist) type (_Optlink *methodname) () -#endif - -#else - -#ifdef HAVE_PROTOTYPES -#define JMETHOD(type,methodname,arglist) type (*methodname) arglist -#else -#define JMETHOD(type,methodname,arglist) type (*methodname) () -#endif - -#endif - -/* Here is the pseudo-keyword for declaring pointers that must be "far" - * on 80x86 machines. Most of the specialized coding for 80x86 is handled - * by just saying "FAR *" where such a pointer is needed. In a few places - * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. - */ - -#ifdef NEED_FAR_POINTERS -#define FAR far -#else -#ifndef FAR -#define FAR -#endif -#endif - - -/* - * On a few systems, type boolean and/or its values FALSE, TRUE may appear - * in standard header files. Or you may have conflicts with application- - * specific header files that you want to include together with these files. - * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. - */ - -#if 0 -#ifndef HAVE_BOOLEAN -typedef int boolean; -#endif -#endif - -/* - * Notes about boolean above: - * - * The main conflict we see is with the Windows headers of some compilers that - * have a different definition of boolean. Therefore boolean has been replaced - * with wxjpeg_boolean throughout the jpeg sources. The alternative would have - * been to make the definition here the same as the Windows definition. It's - * not enough to just define HAVE_BOOLEAN when using the jpeg library, the - * definition of boolean must match when the jpeg library is compiled too. - * - * System jepg libs won't have this type, of course, so to use test - * HAVE_WXJPEG_BOOLEAN and fall back to boolean when not defined. - */ - -typedef int wxjpeg_boolean; -#define HAVE_WXJPEG_BOOLEAN - -#ifndef FALSE /* in case these macros already exist */ -#define FALSE 0 /* values of boolean */ -#endif -#ifndef TRUE -#define TRUE 1 -#endif - - -/* - * The remaining options affect code selection within the JPEG library, - * but they don't need to be visible to most applications using the library. - * To minimize application namespace pollution, the symbols won't be - * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. - */ - -#ifdef JPEG_INTERNALS -#define JPEG_INTERNAL_OPTIONS -#endif - -#ifdef JPEG_INTERNAL_OPTIONS - - -/* - * These defines indicate whether to include various optional functions. - * Undefining some of these symbols will produce a smaller but less capable - * library. Note that you can leave certain source files out of the - * compilation/linking process if you've #undef'd the corresponding symbols. - * (You may HAVE to do that if your compiler doesn't like null source files.) - */ - -/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ - -/* Capability options common to encoder and decoder: */ - -#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ -#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ -#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ - -/* Encoder capability options: */ - -#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ -#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ -/* Note: if you selected 12-bit data precision, it is dangerous to turn off - * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit - * precision, so jchuff.c normally uses entropy optimization to compute - * usable tables for higher precision. If you don't want to do optimization, - * you'll have to supply different default Huffman tables. - * The exact same statements apply for progressive JPEG: the default tables - * don't work for progressive mode. (This may get fixed, however.) - */ -#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ - -/* Decoder capability options: */ - -#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ -#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ -#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ -#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ -#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ -#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ -#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ -#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ - -/* more capability options later, no doubt */ - - -/* - * Ordering of RGB data in scanlines passed to or from the application. - * If your application wants to deal with data in the order B,G,R, just - * change these macros. You can also deal with formats such as R,G,B,X - * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing - * the offsets will also change the order in which colormap data is organized. - * RESTRICTIONS: - * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. - * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not - * useful if you are using JPEG color spaces other than YCbCr or grayscale. - * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE - * is not 3 (they don't understand about dummy color components!). So you - * can't use color quantization if you change that value. - */ - -#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ -#define RGB_GREEN 1 /* Offset of Green */ -#define RGB_BLUE 2 /* Offset of Blue */ -#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ - - -/* Definitions for speed-related optimizations. */ - - -/* If your compiler supports inline functions, define INLINE - * as the inline keyword; otherwise define it as empty. - */ - -#ifndef INLINE -#ifdef __GNUC__ /* for instance, GNU C knows about inline */ -#define INLINE __inline__ -#endif -#ifndef INLINE -#define INLINE /* default is to define it as empty */ -#endif -#endif - - -/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying - * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER - * as short on such a machine. MULTIPLIER must be at least 16 bits wide. - */ - -#ifndef MULTIPLIER -#define MULTIPLIER int /* type for fastest integer multiply */ -#endif - - -/* FAST_FLOAT should be either float or double, whichever is done faster - * by your compiler. (Note that this type is only used in the floating point - * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) - * Typically, float is faster in ANSI C compilers, while double is faster in - * pre-ANSI compilers (because they insist on converting to double anyway). - * The code below therefore chooses float if we have ANSI-style prototypes. - */ - -#ifndef FAST_FLOAT -#ifdef HAVE_PROTOTYPES -#define FAST_FLOAT float -#else -#define FAST_FLOAT double -#endif -#endif - -#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/Source/3rdParty/wx/src/jpeg/jpeg_CW_Prefix.h b/Source/3rdParty/wx/src/jpeg/jpeg_CW_Prefix.h deleted file mode 100644 index 92afda8c1..000000000 --- a/Source/3rdParty/wx/src/jpeg/jpeg_CW_Prefix.h +++ /dev/null @@ -1,6 +0,0 @@ -// Special configuration file for building jpeg under CodeWarrior - - -//#define HAVE_BOOLEAN - - diff --git a/Source/3rdParty/wx/src/jpeg/jpegint.h b/Source/3rdParty/wx/src/jpeg/jpegint.h deleted file mode 100644 index 7928ae3c5..000000000 --- a/Source/3rdParty/wx/src/jpeg/jpegint.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * jpegint.h - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file provides common declarations for the various JPEG modules. - * These declarations are considered internal to the JPEG library; most - * applications using the library shouldn't need to include this file. - */ - - -/* Declarations for both compression & decompression */ - -typedef enum { /* Operating modes for buffer controllers */ - JBUF_PASS_THRU, /* Plain stripwise operation */ - /* Remaining modes require a full-image buffer to have been created */ - JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ - JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ - JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ -} J_BUF_MODE; - -/* Values of global_state field (jdapi.c has some dependencies on ordering!) */ -#define CSTATE_START 100 /* after create_compress */ -#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ -#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ -#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ -#define DSTATE_START 200 /* after create_decompress */ -#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ -#define DSTATE_READY 202 /* found SOS, ready for start_decompress */ -#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ -#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ -#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ -#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ -#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ -#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ -#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ -#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ - - -/* Declarations for compression modules */ - -/* Master control module */ -struct jpeg_comp_master { - JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); - JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); - - /* State variables made visible to other modules */ - wxjpeg_boolean call_pass_startup; /* True if pass_startup must be called */ - wxjpeg_boolean is_last_pass; /* True during last pass */ -}; - -/* Main buffer control (downsampled-data buffer) */ -struct jpeg_c_main_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail)); -}; - -/* Compression preprocessing (downsampling input buffer control) */ -struct jpeg_c_prep_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, - JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail)); -}; - -/* Coefficient buffer control */ -struct jpeg_c_coef_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(wxjpeg_boolean, compress_data, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf)); -}; - -/* Colorspace conversion */ -struct jpeg_color_converter { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, color_convert, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -}; - -/* Downsampling */ -struct jpeg_downsampler { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, downsample, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_index, - JSAMPIMAGE output_buf, - JDIMENSION out_row_group_index)); - - wxjpeg_boolean need_context_rows; /* TRUE if need rows above & below */ -}; - -/* Forward DCT (also controls coefficient quantization) */ -struct jpeg_forward_dct { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - /* perhaps this should be an array??? */ - JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, - jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks)); -}; - -/* Entropy encoding */ -struct jpeg_entropy_encoder { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, wxjpeg_boolean gather_statistics)); - JMETHOD(wxjpeg_boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); -}; - -/* Marker writing */ -struct jpeg_marker_writer { - JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); - JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); - /* These routines are exported to allow insertion of extra markers */ - /* Probably only COM and APPn markers should be written this way */ - JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, - unsigned int datalen)); - JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); -}; - - -/* Declarations for decompression modules */ - -/* Master control module */ -struct jpeg_decomp_master { - JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); - - /* State variables made visible to other modules */ - wxjpeg_boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ -}; - -/* Input control module */ -struct jpeg_input_controller { - JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); - JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); - - /* State variables made visible to other modules */ - wxjpeg_boolean has_multiple_scans; /* True if file has multiple scans */ - wxjpeg_boolean eoi_reached; /* True when EOI has been consumed */ -}; - -/* Main buffer control (downsampled-data buffer) */ -struct jpeg_d_main_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); -}; - -/* Coefficient buffer control */ -struct jpeg_d_coef_controller { -#if defined(__VISAGECPP__) - /* the start input pass in jdcoeft must have a different name than the - // one in jdtrans under VisualAge or else we get a dup symbol error - */ - JMETHOD(void, start_input_pass2, (j_decompress_ptr cinfo)); -#else - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); -#endif - - JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); - JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, - JSAMPIMAGE output_buf)); - /* Pointer to array of coefficient virtual arrays, or NULL if none */ - jvirt_barray_ptr *coef_arrays; -}; - -/* Decompression postprocessing (color quantization buffer control) */ -struct jpeg_d_post_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, post_process_data, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, - JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); -}; - -/* Marker reading & parsing */ -struct jpeg_marker_reader { - JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); - /* Read markers until SOS or EOI. - * Returns same codes as are defined for jpeg_consume_input: - * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. - */ - JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); - /* Read a restart marker --- exported for use by entropy decoder only */ - jpeg_marker_parser_method read_restart_marker; - - /* State of marker reader --- nominally internal, but applications - * supplying COM or APPn handlers might like to know the state. - */ - wxjpeg_boolean saw_SOI; /* found SOI? */ - wxjpeg_boolean saw_SOF; /* found SOF? */ - int next_restart_num; /* next restart number expected (0-7) */ - unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ -}; - -/* Entropy decoding */ -struct jpeg_entropy_decoder { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(wxjpeg_boolean, decode_mcu, (j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); - - /* This is here to share code between baseline and progressive decoders; */ - /* other modules probably should not use it */ - wxjpeg_boolean insufficient_data; /* set TRUE after emitting warning */ -}; - -/* Inverse DCT (also performs dequantization) */ -typedef JMETHOD(void, inverse_DCT_method_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col)); - -struct jpeg_inverse_dct { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - /* It is useful to allow each component to have a separate IDCT method. */ - inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; -}; - -/* Upsampling (note that upsampler must also call color converter) */ -struct jpeg_upsampler { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, upsample, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, - JDIMENSION *in_row_group_ctr, - JDIMENSION in_row_groups_avail, - JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); - - wxjpeg_boolean need_context_rows; /* TRUE if need rows above & below */ -}; - -/* Colorspace conversion */ -struct jpeg_color_deconverter { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, color_convert, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -}; - -/* Color quantization or color precision reduction */ -struct jpeg_color_quantizer { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, wxjpeg_boolean is_pre_scan)); - JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, - int num_rows)); - JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); -}; - - -/* Miscellaneous useful macros */ - -#undef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#undef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - - -/* We assume that right shift corresponds to signed division by 2 with - * rounding towards minus infinity. This is correct for typical "arithmetic - * shift" instructions that shift in copies of the sign bit. But some - * C compilers implement >> with an unsigned shift. For these machines you - * must define RIGHT_SHIFT_IS_UNSIGNED. - * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. - * It is only applied with constant shift counts. SHIFT_TEMPS must be - * included in the variables of any routine using RIGHT_SHIFT. - */ - -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS JPEG_INT32 shift_temp; -#define RIGHT_SHIFT(x,shft) \ - ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~((JPEG_INT32) 0)) << (32-(shft))) : \ - (shift_temp >> (shft))) -#else -#define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) -#endif - - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_compress_master jICompress -#define jinit_c_master_control jICMaster -#define jinit_c_main_controller jICMainC -#define jinit_c_prep_controller jICPrepC -#define jinit_c_coef_controller jICCoefC -#define jinit_color_converter jICColor -#define jinit_downsampler jIDownsampler -#define jinit_forward_dct jIFDCT -#define jinit_huff_encoder jIHEncoder -#define jinit_phuff_encoder jIPHEncoder -#define jinit_marker_writer jIMWriter -#define jinit_master_decompress jIDMaster -#define jinit_d_main_controller jIDMainC -#define jinit_d_coef_controller jIDCoefC -#define jinit_d_post_controller jIDPostC -#define jinit_input_controller jIInCtlr -#define jinit_marker_reader jIMReader -#define jinit_huff_decoder jIHDecoder -#define jinit_phuff_decoder jIPHDecoder -#define jinit_inverse_dct jIIDCT -#define jinit_upsampler jIUpsampler -#define jinit_color_deconverter jIDColor -#define jinit_1pass_quantizer jI1Quant -#define jinit_2pass_quantizer jI2Quant -#define jinit_merged_upsampler jIMUpsampler -#define jinit_memory_mgr jIMemMgr -#define jdiv_round_up jDivRound -#define jround_up jRound -#define jcopy_sample_rows jCopySamples -#define jcopy_block_row jCopyBlocks -#define jzero_far jZeroFar -#define jpeg_zigzag_order jZIGTable -#define jpeg_natural_order jZAGTable -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* Compression module initialization routines */ -EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, - wxjpeg_boolean transcode_only)); -EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); -/* Decompression module initialization routines */ -EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, - wxjpeg_boolean need_full_buffer)); -EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); -EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); -/* Memory manager initialization */ -EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); - -/* Utility routines in jutils.c */ -EXTERN(long) jdiv_round_up JPP((long a, long b)); -EXTERN(long) jround_up JPP((long a, long b)); -EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, - JSAMPARRAY output_array, int dest_row, - int num_rows, JDIMENSION num_cols)); -EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, - JDIMENSION num_blocks)); -EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); -/* Constant tables in jutils.c */ -#if 0 /* This table is not actually needed in v6a */ -extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ -#endif -extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ - -/* Suppress undefined-structure complaints if necessary. */ - -#ifdef INCOMPLETE_TYPES_BROKEN -#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ -struct jvirt_sarray_control { long dummy; }; -struct jvirt_barray_control { long dummy; }; -#endif -#endif /* INCOMPLETE_TYPES_BROKEN */ diff --git a/Source/3rdParty/wx/src/jpeg/jpeglib.h b/Source/3rdParty/wx/src/jpeg/jpeglib.h deleted file mode 100644 index 8bdfe5174..000000000 --- a/Source/3rdParty/wx/src/jpeg/jpeglib.h +++ /dev/null @@ -1,1096 +0,0 @@ -/* - * jpeglib.h - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file defines the application interface for the JPEG library. - * Most applications using the library need only include this file, - * and perhaps jerror.h if they want to know the exact error codes. - */ - -#ifndef JPEGLIB_H -#define JPEGLIB_H - -/* - * First we include the configuration files that record how this - * installation of the JPEG library is set up. jconfig.h can be - * generated automatically for many systems. jmorecfg.h contains - * manual configuration options that most people need not worry about. - */ - -#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ -#include "../src/jpeg/jconfig.h" /* widely used configuration options */ -#endif -#include "jmorecfg.h" /* seldom changed options */ - - -/* Version ID for the JPEG library. - * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". - */ - -#define JPEG_LIB_VERSION 62 /* Version 6b */ - - -/* Various constants determining the sizes of things. - * All of these are specified by the JPEG standard, so don't change them - * if you want to be compatible. - */ - -#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ -#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ -#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ -#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ -#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ -#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ -#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ -/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; - * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. - * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU - * to handle it. We even let you do this from the jconfig.h file. However, - * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe - * sometimes emits noncompliant files doesn't mean you should too. - */ -#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ -#ifndef D_MAX_BLOCKS_IN_MCU -#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ -#endif - - -/* Data structures for images (arrays of samples and of DCT coefficients). - * On 80x86 machines, the image arrays are too big for near pointers, - * but the pointer arrays can fit in near memory. - */ - -typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ -typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ -typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ - -typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ -typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ -typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ -typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ - -typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ - - -/* Types for JPEG compression parameters and working tables. */ - - -/* DCT coefficient quantization tables. */ - -typedef struct { - /* This array gives the coefficient quantizers in natural array order - * (not the zigzag order in which they are stored in a JPEG DQT marker). - * CAUTION: IJG versions prior to v6a kept this array in zigzag order. - */ - UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ - /* This field is used only during compression. It's initialized FALSE when - * the table is created, and set TRUE when it's been output to the file. - * You could suppress output of a table by setting this to TRUE. - * (See jpeg_suppress_tables for an example.) - */ - wxjpeg_boolean sent_table; /* TRUE when table has been output */ -} JQUANT_TBL; - - -/* Huffman coding tables. */ - -typedef struct { - /* These two fields directly represent the contents of a JPEG DHT marker */ - UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ - /* length k bits; bits[0] is unused */ - UINT8 huffval[256]; /* The symbols, in order of incr code length */ - /* This field is used only during compression. It's initialized FALSE when - * the table is created, and set TRUE when it's been output to the file. - * You could suppress output of a table by setting this to TRUE. - * (See jpeg_suppress_tables for an example.) - */ - wxjpeg_boolean sent_table; /* TRUE when table has been output */ -} JHUFF_TBL; - - -/* Basic info about one component (color channel). */ - -typedef struct { - /* These values are fixed over the whole image. */ - /* For compression, they must be supplied by parameter setup; */ - /* for decompression, they are read from the SOF marker. */ - int component_id; /* identifier for this component (0..255) */ - int component_index; /* its index in SOF or cinfo->comp_info[] */ - int h_samp_factor; /* horizontal sampling factor (1..4) */ - int v_samp_factor; /* vertical sampling factor (1..4) */ - int quant_tbl_no; /* quantization table selector (0..3) */ - /* These values may vary between scans. */ - /* For compression, they must be supplied by parameter setup; */ - /* for decompression, they are read from the SOS marker. */ - /* The decompressor output side may not use these variables. */ - int dc_tbl_no; /* DC entropy table selector (0..3) */ - int ac_tbl_no; /* AC entropy table selector (0..3) */ - - /* Remaining fields should be treated as private by applications. */ - - /* These values are computed during compression or decompression startup: */ - /* Component's size in DCT blocks. - * Any dummy blocks added to complete an MCU are not counted; therefore - * these values do not depend on whether a scan is interleaved or not. - */ - JDIMENSION width_in_blocks; - JDIMENSION height_in_blocks; - /* Size of a DCT block in samples. Always DCTSIZE for compression. - * For decompression this is the size of the output from one DCT block, - * reflecting any scaling we choose to apply during the IDCT step. - * Values of 1,2,4,8 are likely to be supported. Note that different - * components may receive different IDCT scalings. - */ - int DCT_scaled_size; - /* The downsampled dimensions are the component's actual, unpadded number - * of samples at the main buffer (preprocessing/compression interface), thus - * downsampled_width = ceil(image_width * Hi/Hmax) - * and similarly for height. For decompression, IDCT scaling is included, so - * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) - */ - JDIMENSION downsampled_width; /* actual width in samples */ - JDIMENSION downsampled_height; /* actual height in samples */ - /* This flag is used only for decompression. In cases where some of the - * components will be ignored (eg grayscale output from YCbCr image), - * we can skip most computations for the unused components. - */ - wxjpeg_boolean component_needed; /* do we need the value of this component? */ - - /* These values are computed before starting a scan of the component. */ - /* The decompressor output side may not use these variables. */ - int MCU_width; /* number of blocks per MCU, horizontally */ - int MCU_height; /* number of blocks per MCU, vertically */ - int MCU_blocks; /* MCU_width * MCU_height */ - int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */ - int last_col_width; /* # of non-dummy blocks across in last MCU */ - int last_row_height; /* # of non-dummy blocks down in last MCU */ - - /* Saved quantization table for component; NULL if none yet saved. - * See jdinput.c comments about the need for this information. - * This field is currently used only for decompression. - */ - JQUANT_TBL * quant_table; - - /* Private per-component storage for DCT or IDCT subsystem. */ - void * dct_table; -} jpeg_component_info; - - -/* The script for encoding a multiple-scan file is an array of these: */ - -typedef struct { - int comps_in_scan; /* number of components encoded in this scan */ - int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ - int Ss, Se; /* progressive JPEG spectral selection parms */ - int Ah, Al; /* progressive JPEG successive approx. parms */ -} jpeg_scan_info; - -/* The decompressor can save APPn and COM markers in a list of these: */ - -typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; - -struct jpeg_marker_struct { - jpeg_saved_marker_ptr next; /* next in list, or NULL */ - UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ - unsigned int original_length; /* # bytes of data in the file */ - unsigned int data_length; /* # bytes of data saved at data[] */ - JOCTET FAR * data; /* the data contained in the marker */ - /* the marker length word is not counted in data_length or original_length */ -}; - -/* Known color spaces. */ - -typedef enum { - JCS_UNKNOWN, /* error/unspecified */ - JCS_GRAYSCALE, /* monochrome */ - JCS_RGB, /* red/green/blue */ - JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ - JCS_CMYK, /* C/M/Y/K */ - JCS_YCCK /* Y/Cb/Cr/K */ -} J_COLOR_SPACE; - -/* DCT/IDCT algorithm options. */ - -typedef enum { - JDCT_ISLOW, /* slow but accurate integer algorithm */ - JDCT_IFAST, /* faster, less accurate integer method */ - JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ -} J_DCT_METHOD; - -#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ -#define JDCT_DEFAULT JDCT_ISLOW -#endif -#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ -#define JDCT_FASTEST JDCT_IFAST -#endif - -/* Dithering options for decompression. */ - -typedef enum { - JDITHER_NONE, /* no dithering */ - JDITHER_ORDERED, /* simple ordered dither */ - JDITHER_FS /* Floyd-Steinberg error diffusion dither */ -} J_DITHER_MODE; - - -/* Common fields between JPEG compression and decompression master structs. */ - -#define jpeg_common_fields \ - struct jpeg_error_mgr * err; /* Error handler module */\ - struct jpeg_memory_mgr * mem; /* Memory manager module */\ - struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ - void * client_data; /* Available for use by application */\ - wxjpeg_boolean is_decompressor; /* So common code can tell which is which */\ - int global_state /* For checking call sequence validity */ - -/* Routines that are to be used by both halves of the library are declared - * to receive a pointer to this structure. There are no actual instances of - * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. - */ -struct jpeg_common_struct { - jpeg_common_fields; /* Fields common to both master struct types */ - /* Additional fields follow in an actual jpeg_compress_struct or - * jpeg_decompress_struct. All three structs must agree on these - * initial fields! (This would be a lot cleaner in C++.) - */ -}; - -typedef struct jpeg_common_struct * j_common_ptr; -typedef struct jpeg_compress_struct * j_compress_ptr; -typedef struct jpeg_decompress_struct * j_decompress_ptr; - - -/* Master record for a compression instance */ - -struct jpeg_compress_struct { - jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ - - /* Destination for compressed data */ - struct jpeg_destination_mgr * dest; - - /* Description of source image --- these fields must be filled in by - * outer application before starting compression. in_color_space must - * be correct before you can even call jpeg_set_defaults(). - */ - - JDIMENSION image_width; /* input image width */ - JDIMENSION image_height; /* input image height */ - int input_components; /* # of color components in input image */ - J_COLOR_SPACE in_color_space; /* colorspace of input image */ - - double input_gamma; /* image gamma of input image */ - - /* Compression parameters --- these fields must be set before calling - * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to - * initialize everything to reasonable defaults, then changing anything - * the application specifically wants to change. That way you won't get - * burnt when new parameters are added. Also note that there are several - * helper routines to simplify changing parameters. - */ - - int data_precision; /* bits of precision in image data */ - - int num_components; /* # of color components in JPEG image */ - J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ - - jpeg_component_info * comp_info; - /* comp_info[i] describes component that appears i'th in SOF */ - - JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; - /* ptrs to coefficient quantization tables, or NULL if not defined */ - - JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; - JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; - /* ptrs to Huffman coding tables, or NULL if not defined */ - - UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ - UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ - UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ - - int num_scans; /* # of entries in scan_info array */ - const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ - /* The default value of scan_info is NULL, which causes a single-scan - * sequential JPEG file to be emitted. To create a multi-scan file, - * set num_scans and scan_info to point to an array of scan definitions. - */ - - wxjpeg_boolean raw_data_in; /* TRUE=caller supplies downsampled data */ - wxjpeg_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ - wxjpeg_boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ - wxjpeg_boolean CCIR601_sampling; /* TRUE=first samples are cosited */ - int smoothing_factor; /* 1..100, or 0 for no input smoothing */ - J_DCT_METHOD dct_method; /* DCT algorithm selector */ - - /* The restart interval can be specified in absolute MCUs by setting - * restart_interval, or in MCU rows by setting restart_in_rows - * (in which case the correct restart_interval will be figured - * for each scan). - */ - unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ - int restart_in_rows; /* if > 0, MCU rows per restart interval */ - - /* Parameters controlling emission of special markers. */ - - wxjpeg_boolean write_JFIF_header; /* should a JFIF marker be written? */ - UINT8 JFIF_major_version; /* What to write for the JFIF version number */ - UINT8 JFIF_minor_version; - /* These three values are not used by the JPEG code, merely copied */ - /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ - /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ - /* ratio is defined by X_density/Y_density even when density_unit=0. */ - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - wxjpeg_boolean write_Adobe_marker; /* should an Adobe marker be written? */ - - /* State variable: index of next scanline to be written to - * jpeg_write_scanlines(). Application may use this to control its - * processing loop, e.g., "while (next_scanline < image_height)". - */ - - JDIMENSION next_scanline; /* 0 .. image_height-1 */ - - /* Remaining fields are known throughout compressor, but generally - * should not be touched by a surrounding application. - */ - - /* - * These fields are computed during compression startup - */ - wxjpeg_boolean progressive_mode; /* TRUE if scan script uses progressive mode */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ - - JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ - /* The coefficient controller receives data in units of MCU rows as defined - * for fully interleaved scans (whether the JPEG file is interleaved or not). - * There are v_samp_factor * DCTSIZE sample rows of each component in an - * "iMCU" (interleaved MCU) row. - */ - - /* - * These fields are valid during any one scan. - * They describe the components and MCUs actually appearing in the scan. - */ - int comps_in_scan; /* # of JPEG components in this scan */ - jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; - /* *cur_comp_info[i] describes component that appears i'th in SOS */ - - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - - int blocks_in_MCU; /* # of DCT blocks per MCU */ - int MCU_membership[C_MAX_BLOCKS_IN_MCU]; - /* MCU_membership[i] is index in cur_comp_info of component owning */ - /* i'th block in an MCU */ - - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ - - /* - * Links to compression subobjects (methods and private variables of modules) - */ - struct jpeg_comp_master * master; - struct jpeg_c_main_controller * main; - struct jpeg_c_prep_controller * prep; - struct jpeg_c_coef_controller * coef; - struct jpeg_marker_writer * marker; - struct jpeg_color_converter * cconvert; - struct jpeg_downsampler * downsample; - struct jpeg_forward_dct * fdct; - struct jpeg_entropy_encoder * entropy; - jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ - int script_space_size; -}; - - -/* Master record for a decompression instance */ - -struct jpeg_decompress_struct { - jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ - - /* Source of compressed data */ - struct jpeg_source_mgr * src; - - /* Basic description of image --- filled in by jpeg_read_header(). */ - /* Application may inspect these values to decide how to process image. */ - - JDIMENSION image_width; /* nominal image width (from SOF marker) */ - JDIMENSION image_height; /* nominal image height */ - int num_components; /* # of color components in JPEG image */ - J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ - - /* Decompression processing parameters --- these fields must be set before - * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes - * them to default values. - */ - - J_COLOR_SPACE out_color_space; /* colorspace for output */ - - unsigned int scale_num, scale_denom; /* fraction by which to scale image */ - - double output_gamma; /* image gamma wanted in output */ - - wxjpeg_boolean buffered_image; /* TRUE=multiple output passes */ - wxjpeg_boolean raw_data_out; /* TRUE=downsampled data wanted */ - - J_DCT_METHOD dct_method; /* IDCT algorithm selector */ - wxjpeg_boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ - wxjpeg_boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ - - wxjpeg_boolean quantize_colors; /* TRUE=colormapped output wanted */ - /* the following are ignored if not quantize_colors: */ - J_DITHER_MODE dither_mode; /* type of color dithering to use */ - wxjpeg_boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ - int desired_number_of_colors; /* max # colors to use in created colormap */ - /* these are significant only in buffered-image mode: */ - wxjpeg_boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ - wxjpeg_boolean enable_external_quant;/* enable future use of external colormap */ - wxjpeg_boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ - - /* Description of actual output image that will be returned to application. - * These fields are computed by jpeg_start_decompress(). - * You can also use jpeg_calc_output_dimensions() to determine these values - * in advance of calling jpeg_start_decompress(). - */ - - JDIMENSION output_width; /* scaled image width */ - JDIMENSION output_height; /* scaled image height */ - int out_color_components; /* # of color components in out_color_space */ - int output_components; /* # of color components returned */ - /* output_components is 1 (a colormap index) when quantizing colors; - * otherwise it equals out_color_components. - */ - int rec_outbuf_height; /* min recommended height of scanline buffer */ - /* If the buffer passed to jpeg_read_scanlines() is less than this many rows - * high, space and time will be wasted due to unnecessary data copying. - * Usually rec_outbuf_height will be 1 or 2, at most 4. - */ - - /* When quantizing colors, the output colormap is described by these fields. - * The application can supply a colormap by setting colormap non-NULL before - * calling jpeg_start_decompress; otherwise a colormap is created during - * jpeg_start_decompress or jpeg_start_output. - * The map has out_color_components rows and actual_number_of_colors columns. - */ - int actual_number_of_colors; /* number of entries in use */ - JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ - - /* State variables: these variables indicate the progress of decompression. - * The application may examine these but must not modify them. - */ - - /* Row index of next scanline to be read from jpeg_read_scanlines(). - * Application may use this to control its processing loop, e.g., - * "while (output_scanline < output_height)". - */ - JDIMENSION output_scanline; /* 0 .. output_height-1 */ - - /* Current input scan number and number of iMCU rows completed in scan. - * These indicate the progress of the decompressor input side. - */ - int input_scan_number; /* Number of SOS markers seen so far */ - JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ - - /* The "output scan number" is the notional scan being displayed by the - * output side. The decompressor will not allow output scan/row number - * to get ahead of input scan/row, but it can fall arbitrarily far behind. - */ - int output_scan_number; /* Nominal scan number being displayed */ - JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ - - /* Current progression status. coef_bits[c][i] indicates the precision - * with which component c's DCT coefficient i (in zigzag order) is known. - * It is -1 when no data has yet been received, otherwise it is the point - * transform (shift) value for the most recent scan of the coefficient - * (thus, 0 at completion of the progression). - * This pointer is NULL when reading a non-progressive file. - */ - int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ - - /* Internal JPEG parameters --- the application usually need not look at - * these fields. Note that the decompressor output side may not use - * any parameters that can change between scans. - */ - - /* Quantization and Huffman tables are carried forward across input - * datastreams when processing abbreviated JPEG datastreams. - */ - - JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; - /* ptrs to coefficient quantization tables, or NULL if not defined */ - - JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; - JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; - /* ptrs to Huffman coding tables, or NULL if not defined */ - - /* These parameters are never carried across datastreams, since they - * are given in SOF/SOS markers or defined to be reset by SOI. - */ - - int data_precision; /* bits of precision in image data */ - - jpeg_component_info * comp_info; - /* comp_info[i] describes component that appears i'th in SOF */ - - wxjpeg_boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ - wxjpeg_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ - - UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ - UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ - UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ - - unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ - - /* These fields record data obtained from optional markers recognized by - * the JPEG library. - */ - wxjpeg_boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ - /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ - UINT8 JFIF_major_version; /* JFIF version number */ - UINT8 JFIF_minor_version; - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - wxjpeg_boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ - UINT8 Adobe_transform; /* Color transform code from Adobe marker */ - - wxjpeg_boolean CCIR601_sampling; /* TRUE=first samples are cosited */ - - /* Aside from the specific data retained from APPn markers known to the - * library, the uninterpreted contents of any or all APPn and COM markers - * can be saved in a list for examination by the application. - */ - jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ - - /* Remaining fields are known throughout decompressor, but generally - * should not be touched by a surrounding application. - */ - - /* - * These fields are computed during decompression startup - */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ - - int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ - - JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ - /* The coefficient controller's input and output progress is measured in - * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows - * in fully interleaved JPEG scans, but are used whether the scan is - * interleaved or not. We define an iMCU row as v_samp_factor DCT block - * rows of each component. Therefore, the IDCT output contains - * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. - */ - - JSAMPLE * sample_range_limit; /* table for fast range-limiting */ - - /* - * These fields are valid during any one scan. - * They describe the components and MCUs actually appearing in the scan. - * Note that the decompressor output side must not use these fields. - */ - int comps_in_scan; /* # of JPEG components in this scan */ - jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; - /* *cur_comp_info[i] describes component that appears i'th in SOS */ - - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - - int blocks_in_MCU; /* # of DCT blocks per MCU */ - int MCU_membership[D_MAX_BLOCKS_IN_MCU]; - /* MCU_membership[i] is index in cur_comp_info of component owning */ - /* i'th block in an MCU */ - - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ - - /* This field is shared between entropy decoder and marker parser. - * It is either zero or the code of a JPEG marker that has been - * read from the data source, but has not yet been processed. - */ - int unread_marker; - - /* - * Links to decompression subobjects (methods, private variables of modules) - */ - struct jpeg_decomp_master * master; - struct jpeg_d_main_controller * main; - struct jpeg_d_coef_controller * coef; - struct jpeg_d_post_controller * post; - struct jpeg_input_controller * inputctl; - struct jpeg_marker_reader * marker; - struct jpeg_entropy_decoder * entropy; - struct jpeg_inverse_dct * idct; - struct jpeg_upsampler * upsample; - struct jpeg_color_deconverter * cconvert; - struct jpeg_color_quantizer * cquantize; -}; - - -/* "Object" declarations for JPEG modules that may be supplied or called - * directly by the surrounding application. - * As with all objects in the JPEG library, these structs only define the - * publicly visible methods and state variables of a module. Additional - * private fields may exist after the public ones. - */ - - -/* Error handler object */ - -struct jpeg_error_mgr { - /* Error exit handler: does not return to caller */ - JMETHOD(void, error_exit, (j_common_ptr cinfo)); - /* Conditionally emit a trace or warning message */ - JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); - /* Routine that actually outputs a trace or error message */ - JMETHOD(void, output_message, (j_common_ptr cinfo)); - /* Format a message string for the most recent JPEG error or message */ - JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); -#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ - /* Reset error state variables at start of a new image */ - JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); - - /* The message ID code and any parameters are saved here. - * A message can have one string parameter or up to 8 int parameters. - */ - int msg_code; -#define JMSG_STR_PARM_MAX 80 - union { - int i[8]; - char s[JMSG_STR_PARM_MAX]; - } msg_parm; - - /* Standard state variables for error facility */ - - int trace_level; /* max msg_level that will be displayed */ - - /* For recoverable corrupt-data errors, we emit a warning message, - * but keep going unless emit_message chooses to abort. emit_message - * should count warnings in num_warnings. The surrounding application - * can check for bad data by seeing if num_warnings is nonzero at the - * end of processing. - */ - long num_warnings; /* number of corrupt-data warnings */ - - /* These fields point to the table(s) of error message strings. - * An application can change the table pointer to switch to a different - * message list (typically, to change the language in which errors are - * reported). Some applications may wish to add additional error codes - * that will be handled by the JPEG library error mechanism; the second - * table pointer is used for this purpose. - * - * First table includes all errors generated by JPEG library itself. - * Error code 0 is reserved for a "no such error string" message. - */ - const char * const * jpeg_message_table; /* Library errors */ - int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ - /* Second table can be added by application (see cjpeg/djpeg for example). - * It contains strings numbered first_addon_message..last_addon_message. - */ - const char * const * addon_message_table; /* Non-library errors */ - int first_addon_message; /* code for first string in addon table */ - int last_addon_message; /* code for last string in addon table */ -}; - - -/* Progress monitor object */ - -struct jpeg_progress_mgr { - JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); - - long pass_counter; /* work units completed in this pass */ - long pass_limit; /* total number of work units in this pass */ - int completed_passes; /* passes completed so far */ - int total_passes; /* total number of passes expected */ -}; - - -/* Data destination object for compression */ - -struct jpeg_destination_mgr { - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - - JMETHOD(void, init_destination, (j_compress_ptr cinfo)); - JMETHOD(wxjpeg_boolean, empty_output_buffer, (j_compress_ptr cinfo)); - JMETHOD(void, term_destination, (j_compress_ptr cinfo)); -}; - - -/* Data source object for decompression */ - -struct jpeg_source_mgr { - const JOCTET * next_input_byte; /* => next byte to read from buffer */ - size_t bytes_in_buffer; /* # of bytes remaining in buffer */ - - JMETHOD(void, init_source, (j_decompress_ptr cinfo)); - JMETHOD(wxjpeg_boolean, fill_input_buffer, (j_decompress_ptr cinfo)); - JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); - JMETHOD(wxjpeg_boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); - JMETHOD(void, term_source, (j_decompress_ptr cinfo)); -}; - - -/* Memory manager object. - * Allocates "small" objects (a few K total), "large" objects (tens of K), - * and "really big" objects (virtual arrays with backing store if needed). - * The memory manager does not allow individual objects to be freed; rather, - * each created object is assigned to a pool, and whole pools can be freed - * at once. This is faster and more convenient than remembering exactly what - * to free, especially where malloc()/free() are not too speedy. - * NB: alloc routines never return NULL. They exit to error_exit if not - * successful. - */ - -#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ -#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ -#define JPOOL_NUMPOOLS 2 - -typedef struct jvirt_sarray_control * jvirt_sarray_ptr; -typedef struct jvirt_barray_control * jvirt_barray_ptr; - - -struct jpeg_memory_mgr { - /* Method pointers */ - JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, - JDIMENSION numrows)); - JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, - JDIMENSION numrows)); - JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, - int pool_id, - wxjpeg_boolean pre_zero, - JDIMENSION samplesperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, - int pool_id, - wxjpeg_boolean pre_zero, - JDIMENSION blocksperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); - JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, - jvirt_sarray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - wxjpeg_boolean writable)); - JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, - jvirt_barray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - wxjpeg_boolean writable)); - JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); - JMETHOD(void, self_destruct, (j_common_ptr cinfo)); - - /* Limit on memory allocation for this JPEG object. (Note that this is - * merely advisory, not a guaranteed maximum; it only affects the space - * used for virtual-array buffers.) May be changed by outer application - * after creating the JPEG object. - */ - long max_memory_to_use; - - /* Maximum allocation request accepted by alloc_large. */ - long max_alloc_chunk; -}; - - -/* Routine signature for application-supplied marker processing methods. - * Need not pass marker code since it is stored in cinfo->unread_marker. - */ -typedef JMETHOD(wxjpeg_boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); - - -/* Declarations for routines called by application. - * The JPP macro hides prototype parameters from compilers that can't cope. - * Note JPP requires double parentheses. - */ - -#ifdef HAVE_PROTOTYPES -#define JPP(arglist) arglist -#else -#define JPP(arglist) () -#endif - - -/* Short forms of external names for systems with brain-damaged linkers. - * We shorten external names to be unique in the first six letters, which - * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 - * characters, you are out of luck. Get a better compiler.) - */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_error jStdError -#define jpeg_CreateCompress jCreaCompress -#define jpeg_CreateDecompress jCreaDecompress -#define jpeg_destroy_compress jDestCompress -#define jpeg_destroy_decompress jDestDecompress -#define jpeg_stdio_dest jStdDest -#define jpeg_stdio_src jStdSrc -#define jpeg_set_defaults jSetDefaults -#define jpeg_set_colorspace jSetColorspace -#define jpeg_default_colorspace jDefColorspace -#define jpeg_set_quality jSetQuality -#define jpeg_set_linear_quality jSetLQuality -#define jpeg_add_quant_table jAddQuantTable -#define jpeg_quality_scaling jQualityScaling -#define jpeg_simple_progression jSimProgress -#define jpeg_suppress_tables jSuppressTables -#define jpeg_alloc_quant_table jAlcQTable -#define jpeg_alloc_huff_table jAlcHTable -#define jpeg_start_compress jStrtCompress -#define jpeg_write_scanlines jWrtScanlines -#define jpeg_finish_compress jFinCompress -#define jpeg_write_raw_data jWrtRawData -#define jpeg_write_marker jWrtMarker -#define jpeg_write_m_header jWrtMHeader -#define jpeg_write_m_byte jWrtMByte -#define jpeg_write_tables jWrtTables -#define jpeg_read_header jReadHeader -#define jpeg_start_decompress jStrtDecompress -#define jpeg_read_scanlines jReadScanlines -#define jpeg_finish_decompress jFinDecompress -#define jpeg_read_raw_data jReadRawData -#define jpeg_has_multiple_scans jHasMultScn -#define jpeg_start_output jStrtOutput -#define jpeg_finish_output jFinOutput -#define jpeg_input_complete jInComplete -#define jpeg_new_colormap jNewCMap -#define jpeg_consume_input jConsumeInput -#define jpeg_calc_output_dimensions jCalcDimensions -#define jpeg_save_markers jSaveMarkers -#define jpeg_set_marker_processor jSetMarker -#define jpeg_read_coefficients jReadCoefs -#define jpeg_write_coefficients jWrtCoefs -#define jpeg_copy_critical_parameters jCopyCrit -#define jpeg_abort_compress jAbrtCompress -#define jpeg_abort_decompress jAbrtDecompress -#define jpeg_abort jAbort -#define jpeg_destroy jDestroy -#define jpeg_resync_to_restart jResyncRestart -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* Default error-management setup */ -EXTERN(struct jpeg_error_mgr *) jpeg_std_error - JPP((struct jpeg_error_mgr * err)); - -/* Initialization of JPEG compression objects. - * jpeg_create_compress() and jpeg_create_decompress() are the exported - * names that applications should call. These expand to calls on - * jpeg_CreateCompress and jpeg_CreateDecompress with additional information - * passed for version mismatch checking. - * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. - */ -#define jpeg_create_compress(cinfo) \ - jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_compress_struct)) -#define jpeg_create_decompress(cinfo) \ - jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_decompress_struct)) -EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, - int version, size_t structsize)); -EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, - int version, size_t structsize)); -/* Destruction of JPEG compression objects */ -EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); - -/* Standard data source and destination managers: stdio streams. */ -/* Caller is responsible for opening the file before and closing after. */ -EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); -EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); - -/* Default parameter setup for compression */ -EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); -/* Compression parameter setup aids */ -EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, - J_COLOR_SPACE colorspace)); -EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, - wxjpeg_boolean force_baseline)); -EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, - int scale_factor, - wxjpeg_boolean force_baseline)); -EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, - wxjpeg_boolean force_baseline)); -EXTERN(int) jpeg_quality_scaling JPP((int quality)); -EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, - wxjpeg_boolean suppress)); -EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); -EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); - -/* Main entry points for compression */ -EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, - wxjpeg_boolean write_all_tables)); -EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION num_lines)); -EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); - -/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION num_lines)); - -/* Write a special marker. See libjpeg.doc concerning safe usage. */ -EXTERN(void) jpeg_write_marker - JPP((j_compress_ptr cinfo, int marker, - const JOCTET * dataptr, unsigned int datalen)); -/* Same, but piecemeal. */ -EXTERN(void) jpeg_write_m_header - JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); -EXTERN(void) jpeg_write_m_byte - JPP((j_compress_ptr cinfo, int val)); - -/* Alternate compression function: just write an abbreviated table file */ -EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); - -/* Decompression startup: read start of JPEG datastream to see what's there */ -EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, - wxjpeg_boolean require_image)); -/* Return value is one of: */ -#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ -#define JPEG_HEADER_OK 1 /* Found valid image datastream */ -#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ -/* If you pass require_image = TRUE (normal case), you need not check for - * a TABLES_ONLY return code; an abbreviated file will cause an error exit. - * JPEG_SUSPENDED is only possible if you use a data source module that can - * give a suspension return (the stdio source module doesn't). - */ - -/* Main entry points for decompression */ -EXTERN(wxjpeg_boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); -EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION max_lines)); -EXTERN(wxjpeg_boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); - -/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION max_lines)); - -/* Additional entry points for buffered-image mode. */ -EXTERN(wxjpeg_boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); -EXTERN(wxjpeg_boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, - int scan_number)); -EXTERN(wxjpeg_boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); -EXTERN(wxjpeg_boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); -EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); -EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); -/* Return value is one of: */ -/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ -#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ -#define JPEG_REACHED_EOI 2 /* Reached end of image */ -#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ -#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ - -/* Precalculate output dimensions for current decompression parameters. */ -EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); - -/* Control saving of COM and APPn markers into marker_list. */ -EXTERN(void) jpeg_save_markers - JPP((j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit)); - -/* Install a special processing method for COM or APPn markers. */ -EXTERN(void) jpeg_set_marker_processor - JPP((j_decompress_ptr cinfo, int marker_code, - jpeg_marker_parser_method routine)); - -/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ -EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); -EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays)); -EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, - j_compress_ptr dstinfo)); - -/* If you choose to abort compression or decompression before completing - * jpeg_finish_(de)compress, then you need to clean up to release memory, - * temporary files, etc. You can just call jpeg_destroy_(de)compress - * if you're done with the JPEG object, but if you want to clean it up and - * reuse it, call this: - */ -EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); - -/* Generic versions of jpeg_abort and jpeg_destroy that work on either - * flavor of JPEG object. These may be more convenient in some places. - */ -EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); -EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); - -/* Default restart-marker-resync procedure for use by data source modules */ -EXTERN(wxjpeg_boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, - int desired)); - - -/* These marker codes are exported since applications and data source modules - * are likely to want to use them. - */ - -#define JPEG_RST0 0xD0 /* RST0 marker code */ -#define JPEG_EOI 0xD9 /* EOI marker code */ -#define JPEG_APP0 0xE0 /* APP0 marker code */ -#define JPEG_COM 0xFE /* COM marker code */ - - -/* If we have a brain-damaged compiler that emits warnings (or worse, errors) - * for structure definitions that are never filled in, keep it quiet by - * supplying dummy definitions for the various substructures. - */ - -#ifdef INCOMPLETE_TYPES_BROKEN -#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ -struct jvirt_sarray_control { long dummy; }; -struct jvirt_barray_control { long dummy; }; -struct jpeg_comp_master { long dummy; }; -struct jpeg_c_main_controller { long dummy; }; -struct jpeg_c_prep_controller { long dummy; }; -struct jpeg_c_coef_controller { long dummy; }; -struct jpeg_marker_writer { long dummy; }; -struct jpeg_color_converter { long dummy; }; -struct jpeg_downsampler { long dummy; }; -struct jpeg_forward_dct { long dummy; }; -struct jpeg_entropy_encoder { long dummy; }; -struct jpeg_decomp_master { long dummy; }; -struct jpeg_d_main_controller { long dummy; }; -struct jpeg_d_coef_controller { long dummy; }; -struct jpeg_d_post_controller { long dummy; }; -struct jpeg_input_controller { long dummy; }; -struct jpeg_marker_reader { long dummy; }; -struct jpeg_entropy_decoder { long dummy; }; -struct jpeg_inverse_dct { long dummy; }; -struct jpeg_upsampler { long dummy; }; -struct jpeg_color_deconverter { long dummy; }; -struct jpeg_color_quantizer { long dummy; }; -#endif /* JPEG_INTERNALS */ -#endif /* INCOMPLETE_TYPES_BROKEN */ - - -/* - * The JPEG library modules define JPEG_INTERNALS before including this file. - * The internal structure declarations are read only when that is true. - * Applications using the library should not include jpegint.h, but may wish - * to include jerror.h. - */ - -#ifdef JPEG_INTERNALS -#include "jpegint.h" /* fetch private declarations */ -#include "jerror.h" /* fetch error codes too */ -#endif - -#endif /* JPEGLIB_H */ diff --git a/Source/3rdParty/wx/src/jpeg/jpegtran.c b/Source/3rdParty/wx/src/jpeg/jpegtran.c deleted file mode 100644 index c81a62656..000000000 --- a/Source/3rdParty/wx/src/jpeg/jpegtran.c +++ /dev/null @@ -1,504 +0,0 @@ -/* - * jpegtran.c - * - * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a command-line user interface for JPEG transcoding. - * It is very similar to cjpeg.c, but provides lossless transcoding between - * different JPEG file formats. It also provides some lossless and sort-of- - * lossless transformations of JPEG data. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "transupp.h" /* Support routines for jpegtran */ -#include "jversion.h" /* for version message */ - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - - -/* - * Argument-parsing code. - * The switch parser is designed to be useful with DOS-style command line - * syntax, ie, intermixed switches and file names, where only the switches - * to the left of a given file name affect processing of that file. - * The main program in this file doesn't actually use this capability... - */ - - -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ -static JCOPY_OPTION copyoption; /* -copy switch */ -static jpeg_transform_info transformoption; /* image transformation options */ - - -LOCAL(void) -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "usage: %s [switches] ", progname); -#ifdef TWO_FILE_COMMANDLINE - fprintf(stderr, "inputfile outputfile\n"); -#else - fprintf(stderr, "[inputfile]\n"); -#endif - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -copy none Copy no extra markers from source file\n"); - fprintf(stderr, " -copy comments Copy only comment markers (default)\n"); - fprintf(stderr, " -copy all Copy all extra markers\n"); -#ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); -#endif -#ifdef C_PROGRESSIVE_SUPPORTED - fprintf(stderr, " -progressive Create progressive JPEG file\n"); -#endif -#if TRANSFORMS_SUPPORTED - fprintf(stderr, "Switches for modifying the image:\n"); - fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n"); - fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); - fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n"); - fprintf(stderr, " -transpose Transpose image\n"); - fprintf(stderr, " -transverse Transverse transpose image\n"); - fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); -#endif /* TRANSFORMS_SUPPORTED */ - fprintf(stderr, "Switches for advanced users:\n"); - fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); - fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); - fprintf(stderr, " -outfile name Specify name for output file\n"); - fprintf(stderr, " -verbose or -debug Emit debug output\n"); - fprintf(stderr, "Switches for wizards:\n"); -#ifdef C_ARITH_CODING_SUPPORTED - fprintf(stderr, " -arithmetic Use arithmetic coding\n"); -#endif -#ifdef C_MULTISCAN_FILES_SUPPORTED - fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); -#endif - exit(EXIT_FAILURE); -} - - -LOCAL(void) -select_transform (JXFORM_CODE transform) -/* Silly little routine to detect multiple transform options, - * which we can't handle. - */ -{ -#if TRANSFORMS_SUPPORTED - if (transformoption.transform == JXFORM_NONE || - transformoption.transform == transform) { - transformoption.transform = transform; - } else { - fprintf(stderr, "%s: can only do one image transformation at a time\n", - progname); - usage(); - } -#else - fprintf(stderr, "%s: sorry, image transformation was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif -} - - -LOCAL(int) -parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, wxjpeg_boolean for_real) -/* Parse optional switches. - * Returns argv[] index of first file-name argument (== argc if none). - * Any file names with indexes <= last_file_arg_seen are ignored; - * they have presumably been processed in a previous iteration. - * (Pass 0 for last_file_arg_seen on the first or only iteration.) - * for_real is FALSE on the first (dummy) pass; we may skip any expensive - * processing. - */ -{ - int argn; - char * arg; - wxjpeg_boolean simple_progressive; - char * scansarg = NULL; /* saves -scans parm if any */ - - /* Set up default JPEG parameters. */ - simple_progressive = FALSE; - outfilename = NULL; - copyoption = JCOPYOPT_DEFAULT; - transformoption.transform = JXFORM_NONE; - transformoption.trim = FALSE; - transformoption.force_grayscale = FALSE; - cinfo->err->trace_level = 0; - - /* Scan command line options, adjust parameters */ - - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (*arg != '-') { - /* Not a switch, must be a file name argument */ - if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ - } - break; /* else done parsing switches */ - } - arg++; /* advance past switch marker character */ - - if (keymatch(arg, "arithmetic", 1)) { - /* Use arithmetic coding. */ -#ifdef C_ARITH_CODING_SUPPORTED - cinfo->arith_code = TRUE; -#else - fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "copy", 1)) { - /* Select which extra markers to copy. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "none", 1)) { - copyoption = JCOPYOPT_NONE; - } else if (keymatch(argv[argn], "comments", 1)) { - copyoption = JCOPYOPT_COMMENTS; - } else if (keymatch(argv[argn], "all", 1)) { - copyoption = JCOPYOPT_ALL; - } else - usage(); - - } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { - /* Enable debug printouts. */ - /* On first -d, print version identification */ - static wxjpeg_boolean printed_version = FALSE; - - if (! printed_version) { - fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n", - JVERSION, JCOPYRIGHT); - printed_version = TRUE; - } - cinfo->err->trace_level++; - - } else if (keymatch(arg, "flip", 1)) { - /* Mirror left-right or top-bottom. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "horizontal", 1)) - select_transform(JXFORM_FLIP_H); - else if (keymatch(argv[argn], "vertical", 1)) - select_transform(JXFORM_FLIP_V); - else - usage(); - - } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { - /* Force to grayscale. */ -#if TRANSFORMS_SUPPORTED - transformoption.force_grayscale = TRUE; -#else - select_transform(JXFORM_NONE); /* force an error */ -#endif - - } else if (keymatch(arg, "maxmemory", 3)) { - /* Maximum memory in Kb (or Mb with 'm'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (ch == 'm' || ch == 'M') - lval *= 1000L; - cinfo->mem->max_memory_to_use = lval * 1000L; - - } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { - /* Enable entropy parm optimization. */ -#ifdef ENTROPY_OPT_SUPPORTED - cinfo->optimize_coding = TRUE; -#else - fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "outfile", 4)) { - /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ - - } else if (keymatch(arg, "progressive", 1)) { - /* Select simple progressive mode. */ -#ifdef C_PROGRESSIVE_SUPPORTED - simple_progressive = TRUE; - /* We must postpone execution until num_components is known. */ -#else - fprintf(stderr, "%s: sorry, progressive output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "restart", 1)) { - /* Restart interval in MCU rows (or in MCUs with 'b'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (lval < 0 || lval > 65535L) - usage(); - if (ch == 'b' || ch == 'B') { - cinfo->restart_interval = (unsigned int) lval; - cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ - } else { - cinfo->restart_in_rows = (int) lval; - /* restart_interval will be computed during startup */ - } - - } else if (keymatch(arg, "rotate", 2)) { - /* Rotate 90, 180, or 270 degrees (measured clockwise). */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "90", 2)) - select_transform(JXFORM_ROT_90); - else if (keymatch(argv[argn], "180", 3)) - select_transform(JXFORM_ROT_180); - else if (keymatch(argv[argn], "270", 3)) - select_transform(JXFORM_ROT_270); - else - usage(); - - } else if (keymatch(arg, "scans", 1)) { - /* Set scan script. */ -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); - scansarg = argv[argn]; - /* We must postpone reading the file in case -progressive appears. */ -#else - fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "transpose", 1)) { - /* Transpose (across UL-to-LR axis). */ - select_transform(JXFORM_TRANSPOSE); - - } else if (keymatch(arg, "transverse", 6)) { - /* Transverse transpose (across UR-to-LL axis). */ - select_transform(JXFORM_TRANSVERSE); - - } else if (keymatch(arg, "trim", 3)) { - /* Trim off any partial edge MCUs that the transform can't handle. */ - transformoption.trim = TRUE; - - } else { - usage(); /* bogus switch */ - } - } - - /* Post-switch-scanning cleanup */ - - if (for_real) { - -#ifdef C_PROGRESSIVE_SUPPORTED - if (simple_progressive) /* process -progressive; -scans can override */ - jpeg_simple_progression(cinfo); -#endif - -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (scansarg != NULL) /* process -scans if it was present */ - if (! read_scan_script(cinfo, scansarg)) - usage(); -#endif - } - - return argn; /* return index of next arg (file name) */ -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - struct jpeg_decompress_struct srcinfo; - struct jpeg_compress_struct dstinfo; - struct jpeg_error_mgr jsrcerr, jdsterr; -#ifdef PROGRESS_REPORT - struct cdjpeg_progress_mgr progress; -#endif - jvirt_barray_ptr * src_coef_arrays; - jvirt_barray_ptr * dst_coef_arrays; - int file_index; - FILE * input_file; - FILE * output_file; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "jpegtran"; /* in case C library doesn't provide it */ - - /* Initialize the JPEG decompression object with default error handling. */ - srcinfo.err = jpeg_std_error(&jsrcerr); - jpeg_create_decompress(&srcinfo); - /* Initialize the JPEG compression object with default error handling. */ - dstinfo.err = jpeg_std_error(&jdsterr); - jpeg_create_compress(&dstinfo); - - /* Now safe to enable signal catcher. - * Note: we assume only the decompression object will have virtual arrays. - */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &srcinfo); -#endif - - /* Scan command line to find file names. - * It is convenient to use just one switch-parsing routine, but the switch - * values read here are mostly ignored; we will rescan the switches after - * opening the input file. Also note that most of the switches affect the - * destination JPEG object, so we parse into that and then copy over what - * needs to affects the source too. - */ - - file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE); - jsrcerr.trace_level = jdsterr.trace_level; - srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use; - -#ifdef TWO_FILE_COMMANDLINE - /* Must have either -outfile switch or explicit output file name */ - if (outfilename == NULL) { - if (file_index != argc-2) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - outfilename = argv[file_index+1]; - } else { - if (file_index != argc-1) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - } -#else - /* Unix style: expect zero or one file name */ - if (file_index < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } -#endif /* TWO_FILE_COMMANDLINE */ - - /* Open the input file. */ - if (file_index < argc) { - if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ - input_file = read_stdin(); - } - - /* Open the output file. */ - if (outfilename != NULL) { - if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, outfilename); - exit(EXIT_FAILURE); - } - } else { - /* default output file is stdout */ - output_file = write_stdout(); - } - -#ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr) &dstinfo, &progress); -#endif - - /* Specify data source for decompression */ - jpeg_stdio_src(&srcinfo, input_file); - - /* Enable saving of extra markers that we want to copy */ - jcopy_markers_setup(&srcinfo, copyoption); - - /* Read file header */ - (void) jpeg_read_header(&srcinfo, TRUE); - - /* Any space needed by a transform option must be requested before - * jpeg_read_coefficients so that memory allocation will be done right. - */ -#if TRANSFORMS_SUPPORTED - jtransform_request_workspace(&srcinfo, &transformoption); -#endif - - /* Read source file as DCT coefficients */ - src_coef_arrays = jpeg_read_coefficients(&srcinfo); - - /* Initialize destination compression parameters from source values */ - jpeg_copy_critical_parameters(&srcinfo, &dstinfo); - - /* Adjust destination parameters if required by transform options; - * also find out which set of coefficient arrays will hold the output. - */ -#if TRANSFORMS_SUPPORTED - dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); -#else - dst_coef_arrays = src_coef_arrays; -#endif - - /* Adjust default compression parameters by re-parsing the options */ - file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE); - - /* Specify data destination for compression */ - jpeg_stdio_dest(&dstinfo, output_file); - - /* Start compressor (note no image data is actually written here) */ - jpeg_write_coefficients(&dstinfo, dst_coef_arrays); - - /* Copy to the output file any extra markers that we want to preserve */ - jcopy_markers_execute(&srcinfo, &dstinfo, copyoption); - - /* Execute image transformation, if any */ -#if TRANSFORMS_SUPPORTED - jtransform_execute_transformation(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); -#endif - - /* Finish compression and release memory */ - jpeg_finish_compress(&dstinfo); - jpeg_destroy_compress(&dstinfo); - (void) jpeg_finish_decompress(&srcinfo); - jpeg_destroy_decompress(&srcinfo); - - /* Close files, if we opened them */ - if (input_file != stdin) - fclose(input_file); - if (output_file != stdout) - fclose(output_file); - -#ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr) &dstinfo); -#endif - - /* All done. */ - exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/Source/3rdParty/wx/src/jpeg/jquant1.c b/Source/3rdParty/wx/src/jpeg/jquant1.c deleted file mode 100644 index f6d221f5f..000000000 --- a/Source/3rdParty/wx/src/jpeg/jquant1.c +++ /dev/null @@ -1,856 +0,0 @@ -/* - * jquant1.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains 1-pass color quantization (color mapping) routines. - * These routines provide mapping to a fixed color map using equally spaced - * color values. Optional Floyd-Steinberg or ordered dithering is available. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -#ifdef QUANT_1PASS_SUPPORTED - - -/* - * The main purpose of 1-pass quantization is to provide a fast, if not very - * high quality, colormapped output capability. A 2-pass quantizer usually - * gives better visual quality; however, for quantized grayscale output this - * quantizer is perfectly adequate. Dithering is highly recommended with this - * quantizer, though you can turn it off if you really want to. - * - * In 1-pass quantization the colormap must be chosen in advance of seeing the - * image. We use a map consisting of all combinations of Ncolors[i] color - * values for the i'th component. The Ncolors[] values are chosen so that - * their product, the total number of colors, is no more than that requested. - * (In most cases, the product will be somewhat less.) - * - * Since the colormap is orthogonal, the representative value for each color - * component can be determined without considering the other components; - * then these indexes can be combined into a colormap index by a standard - * N-dimensional-array-subscript calculation. Most of the arithmetic involved - * can be precalculated and stored in the lookup table colorindex[]. - * colorindex[i][j] maps pixel value j in component i to the nearest - * representative value (grid plane) for that component; this index is - * multiplied by the array stride for component i, so that the - * index of the colormap entry closest to a given pixel value is just - * sum( colorindex[component-number][pixel-component-value] ) - * Aside from being fast, this scheme allows for variable spacing between - * representative values with no additional lookup cost. - * - * If gamma correction has been applied in color conversion, it might be wise - * to adjust the color grid spacing so that the representative colors are - * equidistant in linear space. At this writing, gamma correction is not - * implemented by jdcolor, so nothing is done here. - */ - - -/* Declarations for ordered dithering. - * - * We use a standard 16x16 ordered dither array. The basic concept of ordered - * dithering is described in many references, for instance Dale Schumacher's - * chapter II.2 of Graphics Gems II (James Arvo, ed. Academic Press, 1991). - * In place of Schumacher's comparisons against a "threshold" value, we add a - * "dither" value to the input pixel and then round the result to the nearest - * output value. The dither value is equivalent to (0.5 - threshold) times - * the distance between output values. For ordered dithering, we assume that - * the output colors are equally spaced; if not, results will probably be - * worse, since the dither may be too much or too little at a given point. - * - * The normal calculation would be to form pixel value + dither, range-limit - * this to 0..MAXJSAMPLE, and then index into the colorindex table as usual. - * We can skip the separate range-limiting step by extending the colorindex - * table in both directions. - */ - -#define ODITHER_SIZE 16 /* dimension of dither matrix */ -/* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */ -#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */ -#define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */ - -typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; -typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE]; - -static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { - /* Bayer's order-4 dither array. Generated by the code given in - * Stephen Hawley's article "Ordered Dithering" in Graphics Gems I. - * The values in this array must range from 0 to ODITHER_CELLS-1. - */ - { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }, - { 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 }, - { 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 }, - { 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 }, - { 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 }, - { 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 }, - { 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 }, - { 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 }, - { 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 }, - { 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 }, - { 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 }, - { 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 }, - { 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 }, - { 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 }, - { 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 }, - { 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 } -}; - - -/* Declarations for Floyd-Steinberg dithering. - * - * Errors are accumulated into the array fserrors[], at a resolution of - * 1/16th of a pixel count. The error at a given pixel is propagated - * to its not-yet-processed neighbors using the standard F-S fractions, - * ... (here) 7/16 - * 3/16 5/16 1/16 - * We work left-to-right on even rows, right-to-left on odd rows. - * - * We can get away with a single array (holding one row's worth of errors) - * by using it to store the current row's errors at pixel columns not yet - * processed, but the next row's errors at columns already processed. We - * need only a few extra variables to hold the errors immediately around the - * current column. (If we are lucky, those variables are in registers, but - * even if not, they're probably cheaper to access than array elements are.) - * - * The fserrors[] array is indexed [component#][position]. - * We provide (#columns + 2) entries per component; the extra entry at each - * end saves us from special-casing the first and last pixels. - * - * Note: on a wide image, we might not have enough room in a PC's near data - * segment to hold the error array; so it is allocated with alloc_large. - */ - -#if BITS_IN_JSAMPLE == 8 -typedef INT16 FSERROR; /* 16 bits should be enough */ -typedef int LOCFSERROR; /* use 'int' for calculation temps */ -#else -typedef JPEG_INT32 FSERROR; /* may need more than 16 bits */ -typedef JPEG_INT32 LOCFSERROR; /* be sure calculation temps are big enough */ -#endif - -typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ - - -/* Private subobject */ - -#define MAX_Q_COMPS 4 /* max components I can handle */ - -typedef struct { - struct jpeg_color_quantizer pub; /* public fields */ - - /* Initially allocated colormap is saved here */ - JSAMPARRAY sv_colormap; /* The color map as a 2-D pixel array */ - int sv_actual; /* number of entries in use */ - - JSAMPARRAY colorindex; /* Precomputed mapping for speed */ - /* colorindex[i][j] = index of color closest to pixel value j in component i, - * premultiplied as described above. Since colormap indexes must fit into - * JSAMPLEs, the entries of this array will too. - */ - wxjpeg_boolean is_padded; /* is the colorindex padded for odither? */ - - int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ - - /* Variables for ordered dithering */ - int row_index; /* cur row's vertical index in dither matrix */ - ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ - - /* Variables for Floyd-Steinberg dithering */ - FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ - wxjpeg_boolean on_odd_row; /* flag to remember which row we are on */ -} my_cquantizer; - -typedef my_cquantizer * my_cquantize_ptr; - - -/* - * Policy-making subroutines for create_colormap and create_colorindex. - * These routines determine the colormap to be used. The rest of the module - * only assumes that the colormap is orthogonal. - * - * * select_ncolors decides how to divvy up the available colors - * among the components. - * * output_value defines the set of representative values for a component. - * * largest_input_value defines the mapping from input values to - * representative values for a component. - * Note that the latter two routines may impose different policies for - * different components, though this is not currently done. - */ - - -LOCAL(int) -select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) -/* Determine allocation of desired colors to components, */ -/* and fill in Ncolors[] array to indicate choice. */ -/* Return value is total number of colors (product of Ncolors[] values). */ -{ - int nc = cinfo->out_color_components; /* number of color components */ - int max_colors = cinfo->desired_number_of_colors; - int total_colors, iroot, i, j; - wxjpeg_boolean changed; - long temp; - static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; - - /* We can allocate at least the nc'th root of max_colors per component. */ - /* Compute floor(nc'th root of max_colors). */ - iroot = 1; - do { - iroot++; - temp = iroot; /* set temp = iroot ** nc */ - for (i = 1; i < nc; i++) - temp *= iroot; - } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */ - iroot--; /* now iroot = floor(root) */ - - /* Must have at least 2 color values per component */ - if (iroot < 2) - ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int) temp); - - /* Initialize to iroot color values for each component */ - total_colors = 1; - for (i = 0; i < nc; i++) { - Ncolors[i] = iroot; - total_colors *= iroot; - } - /* We may be able to increment the count for one or more components without - * exceeding max_colors, though we know not all can be incremented. - * Sometimes, the first component can be incremented more than once! - * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.) - * In RGB colorspace, try to increment G first, then R, then B. - */ - do { - changed = FALSE; - for (i = 0; i < nc; i++) { - j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i); - /* calculate new total_colors if Ncolors[j] is incremented */ - temp = total_colors / Ncolors[j]; - temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */ - if (temp > (long) max_colors) - break; /* won't fit, done with this pass */ - Ncolors[j]++; /* OK, apply the increment */ - total_colors = (int) temp; - changed = TRUE; - } - } while (changed); - - return total_colors; -} - - -LOCAL(int) -output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) -/* Return j'th output value, where j will range from 0 to maxj */ -/* The output values must fall in 0..MAXJSAMPLE in increasing order */ -{ - /* We always provide values 0 and MAXJSAMPLE for each component; - * any additional values are equally spaced between these limits. - * (Forcing the upper and lower values to the limits ensures that - * dithering can't produce a color outside the selected gamut.) - */ - return (int) (((JPEG_INT32) j * MAXJSAMPLE + maxj/2) / maxj); -} - - -LOCAL(int) -largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) -/* Return largest input value that should map to j'th output value */ -/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ -{ - /* Breakpoints are halfway between values returned by output_value */ - return (int) (((JPEG_INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); -} - - -/* - * Create the colormap. - */ - -LOCAL(void) -create_colormap (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - JSAMPARRAY colormap; /* Created colormap */ - int total_colors; /* Number of distinct output colors */ - int i,j,k, nci, blksize, blkdist, ptr, val; - - /* Select number of colors for each component */ - total_colors = select_ncolors(cinfo, cquantize->Ncolors); - - /* Report selected color counts */ - if (cinfo->out_color_components == 3) - TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, - total_colors, cquantize->Ncolors[0], - cquantize->Ncolors[1], cquantize->Ncolors[2]); - else - TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); - - /* Allocate and fill in the colormap. */ - /* The colors are ordered in the map in standard row-major order, */ - /* i.e. rightmost (highest-indexed) color changes most rapidly. */ - - colormap = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components); - - /* blksize is number of adjacent repeated entries for a component */ - /* blkdist is distance between groups of identical entries for a component */ - blkdist = total_colors; - - for (i = 0; i < cinfo->out_color_components; i++) { - /* fill in colormap entries for i'th color component */ - nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ - blksize = blkdist / nci; - for (j = 0; j < nci; j++) { - /* Compute j'th output value (out of nci) for component */ - val = output_value(cinfo, i, j, nci-1); - /* Fill in all colormap entries that have this value of this component */ - for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { - /* fill in blksize entries beginning at ptr */ - for (k = 0; k < blksize; k++) - colormap[i][ptr+k] = (JSAMPLE) val; - } - } - blkdist = blksize; /* blksize of this color is blkdist of next */ - } - - /* Save the colormap in private storage, - * where it will survive color quantization mode changes. - */ - cquantize->sv_colormap = colormap; - cquantize->sv_actual = total_colors; -} - - -/* - * Create the color index table. - */ - -LOCAL(void) -create_colorindex (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - JSAMPROW indexptr; - int i,j,k, nci, blksize, val, pad; - - /* For ordered dither, we pad the color index tables by MAXJSAMPLE in - * each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE). - * This is not necessary in the other dithering modes. However, we - * flag whether it was done in case user changes dithering mode. - */ - if (cinfo->dither_mode == JDITHER_ORDERED) { - pad = MAXJSAMPLE*2; - cquantize->is_padded = TRUE; - } else { - pad = 0; - cquantize->is_padded = FALSE; - } - - cquantize->colorindex = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (MAXJSAMPLE+1 + pad), - (JDIMENSION) cinfo->out_color_components); - - /* blksize is number of adjacent repeated entries for a component */ - blksize = cquantize->sv_actual; - - for (i = 0; i < cinfo->out_color_components; i++) { - /* fill in colorindex entries for i'th color component */ - nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ - blksize = blksize / nci; - - /* adjust colorindex pointers to provide padding at negative indexes. */ - if (pad) - cquantize->colorindex[i] += MAXJSAMPLE; - - /* in loop, val = index of current output value, */ - /* and k = largest j that maps to current val */ - indexptr = cquantize->colorindex[i]; - val = 0; - k = largest_input_value(cinfo, i, 0, nci-1); - for (j = 0; j <= MAXJSAMPLE; j++) { - while (j > k) /* advance val if past boundary */ - k = largest_input_value(cinfo, i, ++val, nci-1); - /* premultiply so that no multiplication needed in main processing */ - indexptr[j] = (JSAMPLE) (val * blksize); - } - /* Pad at both ends if necessary */ - if (pad) - for (j = 1; j <= MAXJSAMPLE; j++) { - indexptr[-j] = indexptr[0]; - indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE]; - } - } -} - - -/* - * Create an ordered-dither array for a component having ncolors - * distinct output values. - */ - -LOCAL(ODITHER_MATRIX_PTR) -make_odither_array (j_decompress_ptr cinfo, int ncolors) -{ - ODITHER_MATRIX_PTR odither; - int j,k; - JPEG_INT32 num,den; - - odither = (ODITHER_MATRIX_PTR) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ODITHER_MATRIX)); - /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). - * Hence the dither value for the matrix cell with fill order f - * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). - * On 16-bit-int machine, be careful to avoid overflow. - */ - den = 2 * ODITHER_CELLS * ((JPEG_INT32) (ncolors - 1)); - for (j = 0; j < ODITHER_SIZE; j++) { - for (k = 0; k < ODITHER_SIZE; k++) { - num = ((JPEG_INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) - * MAXJSAMPLE; - /* Ensure round towards zero despite C's lack of consistency - * about rounding negative values in integer division... - */ - odither[j][k] = (int) (num<0 ? -((-num)/den) : num/den); - } - } - return odither; -} - - -/* - * Create the ordered-dither tables. - * Components having the same number of representative colors may - * share a dither table. - */ - -LOCAL(void) -create_odither_tables (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - ODITHER_MATRIX_PTR odither; - int i, j, nci; - - for (i = 0; i < cinfo->out_color_components; i++) { - nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ - odither = NULL; /* search for matching prior component */ - for (j = 0; j < i; j++) { - if (nci == cquantize->Ncolors[j]) { - odither = cquantize->odither[j]; - break; - } - } - if (odither == NULL) /* need a new table? */ - odither = make_odither_array(cinfo, nci); - cquantize->odither[i] = odither; - } -} - - -/* - * Map some rows of pixels to the output colormapped representation. - */ - -METHODDEF(void) -color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) -/* General case, no dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - JSAMPARRAY colorindex = cquantize->colorindex; - register int pixcode, ci; - register JSAMPROW ptrin, ptrout; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - register int nc = cinfo->out_color_components; - - for (row = 0; row < num_rows; row++) { - ptrin = input_buf[row]; - ptrout = output_buf[row]; - for (col = width; col > 0; col--) { - pixcode = 0; - for (ci = 0; ci < nc; ci++) { - pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]); - } - *ptrout++ = (JSAMPLE) pixcode; - } - } -} - - -METHODDEF(void) -color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) -/* Fast path for out_color_components==3, no dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register int pixcode; - register JSAMPROW ptrin, ptrout; - JSAMPROW colorindex0 = cquantize->colorindex[0]; - JSAMPROW colorindex1 = cquantize->colorindex[1]; - JSAMPROW colorindex2 = cquantize->colorindex[2]; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - ptrin = input_buf[row]; - ptrout = output_buf[row]; - for (col = width; col > 0; col--) { - pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]); - pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]); - pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]); - *ptrout++ = (JSAMPLE) pixcode; - } - } -} - - -METHODDEF(void) -quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) -/* General case, with ordered dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register JSAMPROW input_ptr; - register JSAMPROW output_ptr; - JSAMPROW colorindex_ci; - int * dither; /* points to active row of dither matrix */ - int row_index, col_index; /* current indexes into dither matrix */ - int nc = cinfo->out_color_components; - int ci; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - /* Initialize output values to 0 so can process components separately */ - jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); - row_index = cquantize->row_index; - for (ci = 0; ci < nc; ci++) { - input_ptr = input_buf[row] + ci; - output_ptr = output_buf[row]; - colorindex_ci = cquantize->colorindex[ci]; - dither = cquantize->odither[ci][row_index]; - col_index = 0; - - for (col = width; col > 0; col--) { - /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, - * select output value, accumulate into output code for this pixel. - * Range-limiting need not be done explicitly, as we have extended - * the colorindex table to produce the right answers for out-of-range - * inputs. The maximum dither is +- MAXJSAMPLE; this sets the - * required amount of padding. - */ - *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; - input_ptr += nc; - output_ptr++; - col_index = (col_index + 1) & ODITHER_MASK; - } - } - /* Advance row index for next row */ - row_index = (row_index + 1) & ODITHER_MASK; - cquantize->row_index = row_index; - } -} - - -METHODDEF(void) -quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) -/* Fast path for out_color_components==3, with ordered dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register int pixcode; - register JSAMPROW input_ptr; - register JSAMPROW output_ptr; - JSAMPROW colorindex0 = cquantize->colorindex[0]; - JSAMPROW colorindex1 = cquantize->colorindex[1]; - JSAMPROW colorindex2 = cquantize->colorindex[2]; - int * dither0; /* points to active row of dither matrix */ - int * dither1; - int * dither2; - int row_index, col_index; /* current indexes into dither matrix */ - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - row_index = cquantize->row_index; - input_ptr = input_buf[row]; - output_ptr = output_buf[row]; - dither0 = cquantize->odither[0][row_index]; - dither1 = cquantize->odither[1][row_index]; - dither2 = cquantize->odither[2][row_index]; - col_index = 0; - - for (col = width; col > 0; col--) { - pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + - dither0[col_index]]); - pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + - dither1[col_index]]); - pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + - dither2[col_index]]); - *output_ptr++ = (JSAMPLE) pixcode; - col_index = (col_index + 1) & ODITHER_MASK; - } - row_index = (row_index + 1) & ODITHER_MASK; - cquantize->row_index = row_index; - } -} - - -METHODDEF(void) -quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) -/* General case, with Floyd-Steinberg dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register LOCFSERROR cur; /* current error or pixel value */ - LOCFSERROR belowerr; /* error for pixel below cur */ - LOCFSERROR bpreverr; /* error for below/prev col */ - LOCFSERROR bnexterr; /* error for below/next col */ - LOCFSERROR delta; - register FSERRPTR errorptr; /* => fserrors[] at column before current */ - register JSAMPROW input_ptr; - register JSAMPROW output_ptr; - JSAMPROW colorindex_ci; - JSAMPROW colormap_ci; - int pixcode; - int nc = cinfo->out_color_components; - int dir; /* 1 for left-to-right, -1 for right-to-left */ - int dirnc; /* dir * nc */ - int ci; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - JSAMPLE *range_limit = cinfo->sample_range_limit; - SHIFT_TEMPS - - for (row = 0; row < num_rows; row++) { - /* Initialize output values to 0 so can process components separately */ - jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); - for (ci = 0; ci < nc; ci++) { - input_ptr = input_buf[row] + ci; - output_ptr = output_buf[row]; - if (cquantize->on_odd_row) { - /* work right to left in this row */ - input_ptr += (width-1) * nc; /* so point to rightmost pixel */ - output_ptr += width-1; - dir = -1; - dirnc = -nc; - errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */ - } else { - /* work left to right in this row */ - dir = 1; - dirnc = nc; - errorptr = cquantize->fserrors[ci]; /* => entry before first column */ - } - colorindex_ci = cquantize->colorindex[ci]; - colormap_ci = cquantize->sv_colormap[ci]; - /* Preset error values: no error propagated to first pixel from left */ - cur = 0; - /* and no error propagated to row below yet */ - belowerr = bpreverr = 0; - - for (col = width; col > 0; col--) { - /* cur holds the error propagated from the previous pixel on the - * current line. Add the error propagated from the previous line - * to form the complete error correction term for this pixel, and - * round the error term (which is expressed * 16) to an integer. - * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct - * for either sign of the error value. - * Note: errorptr points to *previous* column's array entry. - */ - cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4); - /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. - * The maximum error is +- MAXJSAMPLE; this sets the required size - * of the range_limit array. - */ - cur += GETJSAMPLE(*input_ptr); - cur = GETJSAMPLE(range_limit[cur]); - /* Select output value, accumulate into output code for this pixel */ - pixcode = GETJSAMPLE(colorindex_ci[cur]); - *output_ptr += (JSAMPLE) pixcode; - /* Compute actual representation error at this pixel */ - /* Note: we can do this even though we don't have the final */ - /* pixel code, because the colormap is orthogonal. */ - cur -= GETJSAMPLE(colormap_ci[pixcode]); - /* Compute error fractions to be propagated to adjacent pixels. - * Add these into the running sums, and simultaneously shift the - * next-line error sums left by 1 column. - */ - bnexterr = cur; - delta = cur * 2; - cur += delta; /* form error * 3 */ - errorptr[0] = (FSERROR) (bpreverr + cur); - cur += delta; /* form error * 5 */ - bpreverr = belowerr + cur; - belowerr = bnexterr; - cur += delta; /* form error * 7 */ - /* At this point cur contains the 7/16 error value to be propagated - * to the next pixel on the current line, and all the errors for the - * next line have been shifted over. We are therefore ready to move on. - */ - input_ptr += dirnc; /* advance input ptr to next column */ - output_ptr += dir; /* advance output ptr to next column */ - errorptr += dir; /* advance errorptr to current column */ - } - /* Post-loop cleanup: we must unload the final error value into the - * final fserrors[] entry. Note we need not unload belowerr because - * it is for the dummy column before or after the actual array. - */ - errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */ - } - cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE); - } -} - - -/* - * Allocate workspace for Floyd-Steinberg errors. - */ - -LOCAL(void) -alloc_fs_workspace (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - size_t arraysize; - int i; - - arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); - for (i = 0; i < cinfo->out_color_components; i++) { - cquantize->fserrors[i] = (FSERRPTR) - (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); - } -} - - -/* - * Initialize for one-pass color quantization. - */ - -METHODDEF(void) -start_pass_1_quant (j_decompress_ptr cinfo, wxjpeg_boolean is_pre_scan) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - size_t arraysize; - int i; - - /* Install my colormap. */ - cinfo->colormap = cquantize->sv_colormap; - cinfo->actual_number_of_colors = cquantize->sv_actual; - - /* Initialize for desired dithering mode. */ - switch (cinfo->dither_mode) { - case JDITHER_NONE: - if (cinfo->out_color_components == 3) - cquantize->pub.color_quantize = color_quantize3; - else - cquantize->pub.color_quantize = color_quantize; - break; - case JDITHER_ORDERED: - if (cinfo->out_color_components == 3) - cquantize->pub.color_quantize = quantize3_ord_dither; - else - cquantize->pub.color_quantize = quantize_ord_dither; - cquantize->row_index = 0; /* initialize state for ordered dither */ - /* If user changed to ordered dither from another mode, - * we must recreate the color index table with padding. - * This will cost extra space, but probably isn't very likely. - */ - if (! cquantize->is_padded) - create_colorindex(cinfo); - /* Create ordered-dither tables if we didn't already. */ - if (cquantize->odither[0] == NULL) - create_odither_tables(cinfo); - break; - case JDITHER_FS: - cquantize->pub.color_quantize = quantize_fs_dither; - cquantize->on_odd_row = FALSE; /* initialize state for F-S dither */ - /* Allocate Floyd-Steinberg workspace if didn't already. */ - if (cquantize->fserrors[0] == NULL) - alloc_fs_workspace(cinfo); - /* Initialize the propagated errors to zero. */ - arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); - for (i = 0; i < cinfo->out_color_components; i++) - jzero_far((void FAR *) cquantize->fserrors[i], arraysize); - break; - default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; - } -} - - -/* - * Finish up at the end of the pass. - */ - -METHODDEF(void) -finish_pass_1_quant (j_decompress_ptr cinfo) -{ - /* no work in 1-pass case */ -} - - -/* - * Switch to a new external colormap between output passes. - * Shouldn't get to this module! - */ - -METHODDEF(void) -new_color_map_1_quant (j_decompress_ptr cinfo) -{ - ERREXIT(cinfo, JERR_MODE_CHANGE); -} - - -/* - * Module initialization routine for 1-pass color quantization. - */ - -GLOBAL(void) -jinit_1pass_quantizer (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize; - - cquantize = (my_cquantize_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); - cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; - cquantize->pub.start_pass = start_pass_1_quant; - cquantize->pub.finish_pass = finish_pass_1_quant; - cquantize->pub.new_color_map = new_color_map_1_quant; - cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */ - cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */ - - /* Make sure my internal arrays won't overflow */ - if (cinfo->out_color_components > MAX_Q_COMPS) - ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS); - /* Make sure colormap indexes can be represented by JSAMPLEs */ - if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1)) - ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1); - - /* Create the colormap and color index table. */ - create_colormap(cinfo); - create_colorindex(cinfo); - - /* Allocate Floyd-Steinberg workspace now if requested. - * We do this now since it is FAR storage and may affect the memory - * manager's space calculations. If the user changes to FS dither - * mode in a later pass, we will allocate the space then, and will - * possibly overrun the max_memory_to_use setting. - */ - if (cinfo->dither_mode == JDITHER_FS) - alloc_fs_workspace(cinfo); -} - -#endif /* QUANT_1PASS_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jquant2.c b/Source/3rdParty/wx/src/jpeg/jquant2.c deleted file mode 100644 index b9c66a325..000000000 --- a/Source/3rdParty/wx/src/jpeg/jquant2.c +++ /dev/null @@ -1,1310 +0,0 @@ -/* - * jquant2.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains 2-pass color quantization (color mapping) routines. - * These routines provide selection of a custom color map for an image, - * followed by mapping of the image to that color map, with optional - * Floyd-Steinberg dithering. - * It is also possible to use just the second pass to map to an arbitrary - * externally-given color map. - * - * Note: ordered dithering is not supported, since there isn't any fast - * way to compute intercolor distances; it's unclear that ordered dither's - * fundamental assumptions even hold with an irregularly spaced color map. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - -#ifdef QUANT_2PASS_SUPPORTED - - -/* - * This module implements the well-known Heckbert paradigm for color - * quantization. Most of the ideas used here can be traced back to - * Heckbert's seminal paper - * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", - * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. - * - * In the first pass over the image, we accumulate a histogram showing the - * usage count of each possible color. To keep the histogram to a reasonable - * size, we reduce the precision of the input; typical practice is to retain - * 5 or 6 bits per color, so that 8 or 4 different input values are counted - * in the same histogram cell. - * - * Next, the color-selection step begins with a box representing the whole - * color space, and repeatedly splits the "largest" remaining box until we - * have as many boxes as desired colors. Then the mean color in each - * remaining box becomes one of the possible output colors. - * - * The second pass over the image maps each input pixel to the closest output - * color (optionally after applying a Floyd-Steinberg dithering correction). - * This mapping is logically trivial, but making it go fast enough requires - * considerable care. - * - * Heckbert-style quantizers vary a good deal in their policies for choosing - * the "largest" box and deciding where to cut it. The particular policies - * used here have proved out well in experimental comparisons, but better ones - * may yet be found. - * - * In earlier versions of the IJG code, this module quantized in YCbCr color - * space, processing the raw upsampled data without a color conversion step. - * This allowed the color conversion math to be done only once per colormap - * entry, not once per pixel. However, that optimization precluded other - * useful optimizations (such as merging color conversion with upsampling) - * and it also interfered with desired capabilities such as quantizing to an - * externally-supplied colormap. We have therefore abandoned that approach. - * The present code works in the post-conversion color space, typically RGB. - * - * To improve the visual quality of the results, we actually work in scaled - * RGB space, giving G distances more weight than R, and R in turn more than - * B. To do everything in integer math, we must use integer scale factors. - * The 2/3/1 scale factors used here correspond loosely to the relative - * weights of the colors in the NTSC grayscale equation. - * If you want to use this code to quantize a non-RGB color space, you'll - * probably need to change these scale factors. - */ - -#define R_SCALE 2 /* scale R distances by this much */ -#define G_SCALE 3 /* scale G distances by this much */ -#define B_SCALE 1 /* and B by this much */ - -/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined - * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B - * and B,G,R orders. If you define some other weird order in jmorecfg.h, - * you'll get compile errors until you extend this logic. In that case - * you'll probably want to tweak the histogram sizes too. - */ - -#if RGB_RED == 0 -#define C0_SCALE R_SCALE -#endif -#if RGB_BLUE == 0 -#define C0_SCALE B_SCALE -#endif -#if RGB_GREEN == 1 -#define C1_SCALE G_SCALE -#endif -#if RGB_RED == 2 -#define C2_SCALE R_SCALE -#endif -#if RGB_BLUE == 2 -#define C2_SCALE B_SCALE -#endif - - -/* - * First we have the histogram data structure and routines for creating it. - * - * The number of bits of precision can be adjusted by changing these symbols. - * We recommend keeping 6 bits for G and 5 each for R and B. - * If you have plenty of memory and cycles, 6 bits all around gives marginally - * better results; if you are short of memory, 5 bits all around will save - * some space but degrade the results. - * To maintain a fully accurate histogram, we'd need to allocate a "long" - * (preferably unsigned long) for each cell. In practice this is overkill; - * we can get by with 16 bits per cell. Few of the cell counts will overflow, - * and clamping those that do overflow to the maximum value will give close- - * enough results. This reduces the recommended histogram size from 256Kb - * to 128Kb, which is a useful savings on PC-class machines. - * (In the second pass the histogram space is re-used for pixel mapping data; - * in that capacity, each cell must be able to store zero to the number of - * desired colors. 16 bits/cell is plenty for that too.) - * Since the JPEG code is intended to run in small memory model on 80x86 - * machines, we can't just allocate the histogram in one chunk. Instead - * of a true 3-D array, we use a row of pointers to 2-D arrays. Each - * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and - * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that - * on 80x86 machines, the pointer row is in near memory but the actual - * arrays are in far memory (same arrangement as we use for image arrays). - */ - -#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ - -/* These will do the right thing for either R,G,B or B,G,R color order, - * but you may not like the results for other color orders. - */ -#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ -#define HIST_C1_BITS 6 /* bits of precision in G histogram */ -#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ - -/* Number of elements along histogram axes. */ -#define HIST_C0_ELEMS (1<cquantize; - register JSAMPROW ptr; - register histptr histp; - register hist3d histogram = cquantize->histogram; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - ptr = input_buf[row]; - for (col = width; col > 0; col--) { - /* get pixel value and index into the histogram */ - histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] - [GETJSAMPLE(ptr[1]) >> C1_SHIFT] - [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; - /* increment, check for overflow and undo increment if so. */ - if (++(*histp) <= 0) - (*histp)--; - ptr += 3; - } - } -} - - -/* - * Next we have the really interesting routines: selection of a colormap - * given the completed histogram. - * These routines work with a list of "boxes", each representing a rectangular - * subset of the input color space (to histogram precision). - */ - -typedef struct { - /* The bounds of the box (inclusive); expressed as histogram indexes */ - int c0min, c0max; - int c1min, c1max; - int c2min, c2max; - /* The volume (actually 2-norm) of the box */ - JPEG_INT32 volume; - /* The number of nonzero histogram cells within this box */ - long colorcount; -} box; - -typedef box * boxptr; - - -LOCAL(boxptr) -find_biggest_color_pop (boxptr boxlist, int numboxes) -/* Find the splittable box with the largest color population */ -/* Returns NULL if no splittable boxes remain */ -{ - register boxptr boxp; - register int i; - register long maxc = 0; - boxptr which = NULL; - - for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { - if (boxp->colorcount > maxc && boxp->volume > 0) { - which = boxp; - maxc = boxp->colorcount; - } - } - return which; -} - - -LOCAL(boxptr) -find_biggest_volume (boxptr boxlist, int numboxes) -/* Find the splittable box with the largest (scaled) volume */ -/* Returns NULL if no splittable boxes remain */ -{ - register boxptr boxp; - register int i; - register JPEG_INT32 maxv = 0; - boxptr which = NULL; - - for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { - if (boxp->volume > maxv) { - which = boxp; - maxv = boxp->volume; - } - } - return which; -} - - -LOCAL(void) -update_box (j_decompress_ptr cinfo, boxptr boxp) -/* Shrink the min/max bounds of a box to enclose only nonzero elements, */ -/* and recompute its volume and population */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - histptr histp; - int c0,c1,c2; - int c0min,c0max,c1min,c1max,c2min,c2max; - JPEG_INT32 dist0,dist1,dist2; - long ccount; - - c0min = boxp->c0min; c0max = boxp->c0max; - c1min = boxp->c1min; c1max = boxp->c1max; - c2min = boxp->c2min; c2max = boxp->c2max; - - if (c0max > c0min) - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0min = c0min = c0; - goto have_c0min; - } - } - have_c0min: - if (c0max > c0min) - for (c0 = c0max; c0 >= c0min; c0--) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0max = c0max = c0; - goto have_c0max; - } - } - have_c0max: - if (c1max > c1min) - for (c1 = c1min; c1 <= c1max; c1++) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1min = c1min = c1; - goto have_c1min; - } - } - have_c1min: - if (c1max > c1min) - for (c1 = c1max; c1 >= c1min; c1--) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1max = c1max = c1; - goto have_c1max; - } - } - have_c1max: - if (c2max > c2min) - for (c2 = c2min; c2 <= c2max; c2++) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2min = c2min = c2; - goto have_c2min; - } - } - have_c2min: - if (c2max > c2min) - for (c2 = c2max; c2 >= c2min; c2--) - for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2max = c2max = c2; - goto have_c2max; - } - } - have_c2max: - - /* Update box volume. - * We use 2-norm rather than real volume here; this biases the method - * against making long narrow boxes, and it has the side benefit that - * a box is splittable iff norm > 0. - * Since the differences are expressed in histogram-cell units, - * we have to shift back to JSAMPLE units to get consistent distances; - * after which, we scale according to the selected distance scale factors. - */ - dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE; - dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; - dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; - boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; - - /* Now scan remaining volume of box and compute population */ - ccount = 0; - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++, histp++) - if (*histp != 0) { - ccount++; - } - } - boxp->colorcount = ccount; -} - - -LOCAL(int) -median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, - int desired_colors) -/* Repeatedly select and split the largest box until we have enough boxes */ -{ - int n,lb; - int c0,c1,c2,cmax; - register boxptr b1,b2; - - while (numboxes < desired_colors) { - /* Select box to split. - * Current algorithm: by population for first half, then by volume. - */ - if (numboxes*2 <= desired_colors) { - b1 = find_biggest_color_pop(boxlist, numboxes); - } else { - b1 = find_biggest_volume(boxlist, numboxes); - } - if (b1 == NULL) /* no splittable boxes left! */ - break; - b2 = &boxlist[numboxes]; /* where new box will go */ - /* Copy the color bounds to the new box. */ - b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; - b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; - /* Choose which axis to split the box on. - * Current algorithm: longest scaled axis. - * See notes in update_box about scaling distances. - */ - c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE; - c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE; - c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE; - /* We want to break any ties in favor of green, then red, blue last. - * This code does the right thing for R,G,B or B,G,R color orders only. - */ -#if RGB_RED == 0 - cmax = c1; n = 1; - if (c0 > cmax) { cmax = c0; n = 0; } - if (c2 > cmax) { n = 2; } -#else - cmax = c1; n = 1; - if (c2 > cmax) { cmax = c2; n = 2; } - if (c0 > cmax) { n = 0; } -#endif - /* Choose split point along selected axis, and update box bounds. - * Current algorithm: split at halfway point. - * (Since the box has been shrunk to minimum volume, - * any split will produce two nonempty subboxes.) - * Note that lb value is max for lower box, so must be < old max. - */ - switch (n) { - case 0: - lb = (b1->c0max + b1->c0min) / 2; - b1->c0max = lb; - b2->c0min = lb+1; - break; - case 1: - lb = (b1->c1max + b1->c1min) / 2; - b1->c1max = lb; - b2->c1min = lb+1; - break; - case 2: - lb = (b1->c2max + b1->c2min) / 2; - b1->c2max = lb; - b2->c2min = lb+1; - break; - } - /* Update stats for boxes */ - update_box(cinfo, b1); - update_box(cinfo, b2); - numboxes++; - } - return numboxes; -} - - -LOCAL(void) -compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) -/* Compute representative color for a box, put it in colormap[icolor] */ -{ - /* Current algorithm: mean weighted by pixels (not colors) */ - /* Note it is important to get the rounding correct! */ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - histptr histp; - int c0,c1,c2; - int c0min,c0max,c1min,c1max,c2min,c2max; - long count; - long total = 0; - long c0total = 0; - long c1total = 0; - long c2total = 0; - - c0min = boxp->c0min; c0max = boxp->c0max; - c1min = boxp->c1min; c1max = boxp->c1max; - c2min = boxp->c2min; c2max = boxp->c2max; - - for (c0 = c0min; c0 <= c0max; c0++) - for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) { - if ((count = *histp++) != 0) { - total += count; - c0total += ((c0 << C0_SHIFT) + ((1<>1)) * count; - c1total += ((c1 << C1_SHIFT) + ((1<>1)) * count; - c2total += ((c2 << C2_SHIFT) + ((1<>1)) * count; - } - } - } - - cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); - cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); - cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); -} - - -LOCAL(void) -select_colors (j_decompress_ptr cinfo, int desired_colors) -/* Master routine for color selection */ -{ - boxptr boxlist; - int numboxes; - int i; - - /* Allocate workspace for box list */ - boxlist = (boxptr) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box)); - /* Initialize one box containing whole space */ - numboxes = 1; - boxlist[0].c0min = 0; - boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT; - boxlist[0].c1min = 0; - boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT; - boxlist[0].c2min = 0; - boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT; - /* Shrink it to actually-used volume and set its statistics */ - update_box(cinfo, & boxlist[0]); - /* Perform median-cut to produce final box list */ - numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors); - /* Compute the representative color for each box, fill colormap */ - for (i = 0; i < numboxes; i++) - compute_color(cinfo, & boxlist[i], i); - cinfo->actual_number_of_colors = numboxes; - TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes); -} - - -/* - * These routines are concerned with the time-critical task of mapping input - * colors to the nearest color in the selected colormap. - * - * We re-use the histogram space as an "inverse color map", essentially a - * cache for the results of nearest-color searches. All colors within a - * histogram cell will be mapped to the same colormap entry, namely the one - * closest to the cell's center. This may not be quite the closest entry to - * the actual input color, but it's almost as good. A zero in the cache - * indicates we haven't found the nearest color for that cell yet; the array - * is cleared to zeroes before starting the mapping pass. When we find the - * nearest color for a cell, its colormap index plus one is recorded in the - * cache for future use. The pass2 scanning routines call fill_inverse_cmap - * when they need to use an unfilled entry in the cache. - * - * Our method of efficiently finding nearest colors is based on the "locally - * sorted search" idea described by Heckbert and on the incremental distance - * calculation described by Spencer W. Thomas in chapter III.1 of Graphics - * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that - * the distances from a given colormap entry to each cell of the histogram can - * be computed quickly using an incremental method: the differences between - * distances to adjacent cells themselves differ by a constant. This allows a - * fairly fast implementation of the "brute force" approach of computing the - * distance from every colormap entry to every histogram cell. Unfortunately, - * it needs a work array to hold the best-distance-so-far for each histogram - * cell (because the inner loop has to be over cells, not colormap entries). - * The work array elements have to be INT32s, so the work array would need - * 256Kb at our recommended precision. This is not feasible in DOS machines. - * - * To get around these problems, we apply Thomas' method to compute the - * nearest colors for only the cells within a small subbox of the histogram. - * The work array need be only as big as the subbox, so the memory usage - * problem is solved. Furthermore, we need not fill subboxes that are never - * referenced in pass2; many images use only part of the color gamut, so a - * fair amount of work is saved. An additional advantage of this - * approach is that we can apply Heckbert's locality criterion to quickly - * eliminate colormap entries that are far away from the subbox; typically - * three-fourths of the colormap entries are rejected by Heckbert's criterion, - * and we need not compute their distances to individual cells in the subbox. - * The speed of this approach is heavily influenced by the subbox size: too - * small means too much overhead, too big loses because Heckbert's criterion - * can't eliminate as many colormap entries. Empirically the best subbox - * size seems to be about 1/512th of the histogram (1/8th in each direction). - * - * Thomas' article also describes a refined method which is asymptotically - * faster than the brute-force method, but it is also far more complex and - * cannot efficiently be applied to small subboxes. It is therefore not - * useful for programs intended to be portable to DOS machines. On machines - * with plenty of memory, filling the whole histogram in one shot with Thomas' - * refined method might be faster than the present code --- but then again, - * it might not be any faster, and it's certainly more complicated. - */ - - -/* log2(histogram cells in update box) for each axis; this can be adjusted */ -#define BOX_C0_LOG (HIST_C0_BITS-3) -#define BOX_C1_LOG (HIST_C1_BITS-3) -#define BOX_C2_LOG (HIST_C2_BITS-3) - -#define BOX_C0_ELEMS (1<actual_number_of_colors; - int maxc0, maxc1, maxc2; - int centerc0, centerc1, centerc2; - int i, x, ncolors; - JPEG_INT32 minmaxdist, min_dist, max_dist, tdist; - JPEG_INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ - - /* Compute true coordinates of update box's upper corner and center. - * Actually we compute the coordinates of the center of the upper-corner - * histogram cell, which are the upper bounds of the volume we care about. - * Note that since ">>" rounds down, the "center" values may be closer to - * min than to max; hence comparisons to them must be "<=", not "<". - */ - maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT)); - centerc0 = (minc0 + maxc0) >> 1; - maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT)); - centerc1 = (minc1 + maxc1) >> 1; - maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT)); - centerc2 = (minc2 + maxc2) >> 1; - - /* For each color in colormap, find: - * 1. its minimum squared-distance to any point in the update box - * (zero if color is within update box); - * 2. its maximum squared-distance to any point in the update box. - * Both of these can be found by considering only the corners of the box. - * We save the minimum distance for each color in mindist[]; - * only the smallest maximum distance is of interest. - */ - minmaxdist = 0x7FFFFFFFL; - - for (i = 0; i < numcolors; i++) { - /* We compute the squared-c0-distance term, then add in the other two. */ - x = GETJSAMPLE(cinfo->colormap[0][i]); - if (x < minc0) { - tdist = (x - minc0) * C0_SCALE; - min_dist = tdist*tdist; - tdist = (x - maxc0) * C0_SCALE; - max_dist = tdist*tdist; - } else if (x > maxc0) { - tdist = (x - maxc0) * C0_SCALE; - min_dist = tdist*tdist; - tdist = (x - minc0) * C0_SCALE; - max_dist = tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - min_dist = 0; - if (x <= centerc0) { - tdist = (x - maxc0) * C0_SCALE; - max_dist = tdist*tdist; - } else { - tdist = (x - minc0) * C0_SCALE; - max_dist = tdist*tdist; - } - } - - x = GETJSAMPLE(cinfo->colormap[1][i]); - if (x < minc1) { - tdist = (x - minc1) * C1_SCALE; - min_dist += tdist*tdist; - tdist = (x - maxc1) * C1_SCALE; - max_dist += tdist*tdist; - } else if (x > maxc1) { - tdist = (x - maxc1) * C1_SCALE; - min_dist += tdist*tdist; - tdist = (x - minc1) * C1_SCALE; - max_dist += tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - if (x <= centerc1) { - tdist = (x - maxc1) * C1_SCALE; - max_dist += tdist*tdist; - } else { - tdist = (x - minc1) * C1_SCALE; - max_dist += tdist*tdist; - } - } - - x = GETJSAMPLE(cinfo->colormap[2][i]); - if (x < minc2) { - tdist = (x - minc2) * C2_SCALE; - min_dist += tdist*tdist; - tdist = (x - maxc2) * C2_SCALE; - max_dist += tdist*tdist; - } else if (x > maxc2) { - tdist = (x - maxc2) * C2_SCALE; - min_dist += tdist*tdist; - tdist = (x - minc2) * C2_SCALE; - max_dist += tdist*tdist; - } else { - /* within cell range so no contribution to min_dist */ - if (x <= centerc2) { - tdist = (x - maxc2) * C2_SCALE; - max_dist += tdist*tdist; - } else { - tdist = (x - minc2) * C2_SCALE; - max_dist += tdist*tdist; - } - } - - mindist[i] = min_dist; /* save away the results */ - if (max_dist < minmaxdist) - minmaxdist = max_dist; - } - - /* Now we know that no cell in the update box is more than minmaxdist - * away from some colormap entry. Therefore, only colors that are - * within minmaxdist of some part of the box need be considered. - */ - ncolors = 0; - for (i = 0; i < numcolors; i++) { - if (mindist[i] <= minmaxdist) - colorlist[ncolors++] = (JSAMPLE) i; - } - return ncolors; -} - - -LOCAL(void) -find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, - int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) -/* Find the closest colormap entry for each cell in the update box, - * given the list of candidate colors prepared by find_nearby_colors. - * Return the indexes of the closest entries in the bestcolor[] array. - * This routine uses Thomas' incremental distance calculation method to - * find the distance from a colormap entry to successive cells in the box. - */ -{ - int ic0, ic1, ic2; - int i, icolor; - register JPEG_INT32 * bptr; /* pointer into bestdist[] array */ - JSAMPLE * cptr; /* pointer into bestcolor[] array */ - JPEG_INT32 dist0, dist1; /* initial distance values */ - register JPEG_INT32 dist2; /* current distance in inner loop */ - JPEG_INT32 xx0, xx1; /* distance increments */ - register JPEG_INT32 xx2; - JPEG_INT32 inc0, inc1, inc2; /* initial values for increments */ - /* This array holds the distance to the nearest-so-far color for each cell */ - JPEG_INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; - - /* Initialize best-distance for each cell of the update box */ - bptr = bestdist; - for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) - *bptr++ = 0x7FFFFFFFL; - - /* For each color selected by find_nearby_colors, - * compute its distance to the center of each cell in the box. - * If that's less than best-so-far, update best distance and color number. - */ - - /* Nominal steps between cell centers ("x" in Thomas article) */ -#define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) -#define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) -#define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) - - for (i = 0; i < numcolors; i++) { - icolor = GETJSAMPLE(colorlist[i]); - /* Compute (square of) distance from minc0/c1/c2 to this color */ - inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE; - dist0 = inc0*inc0; - inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE; - dist0 += inc1*inc1; - inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE; - dist0 += inc2*inc2; - /* Form the initial difference increments */ - inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0; - inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1; - inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2; - /* Now loop over all cells in box, updating distance per Thomas method */ - bptr = bestdist; - cptr = bestcolor; - xx0 = inc0; - for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) { - dist1 = dist0; - xx1 = inc1; - for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { - dist2 = dist1; - xx2 = inc2; - for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { - if (dist2 < *bptr) { - *bptr = dist2; - *cptr = (JSAMPLE) icolor; - } - dist2 += xx2; - xx2 += 2 * STEP_C2 * STEP_C2; - bptr++; - cptr++; - } - dist1 += xx1; - xx1 += 2 * STEP_C1 * STEP_C1; - } - dist0 += xx0; - xx0 += 2 * STEP_C0 * STEP_C0; - } - } -} - - -LOCAL(void) -fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) -/* Fill the inverse-colormap entries in the update box that contains */ -/* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ -/* we can fill as many others as we wish.) */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - int minc0, minc1, minc2; /* lower left corner of update box */ - int ic0, ic1, ic2; - register JSAMPLE * cptr; /* pointer into bestcolor[] array */ - register histptr cachep; /* pointer into main cache array */ - /* This array lists the candidate colormap indexes. */ - JSAMPLE colorlist[MAXNUMCOLORS]; - int numcolors; /* number of candidate colors */ - /* This array holds the actually closest colormap index for each cell. */ - JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; - - /* Convert cell coordinates to update box ID */ - c0 >>= BOX_C0_LOG; - c1 >>= BOX_C1_LOG; - c2 >>= BOX_C2_LOG; - - /* Compute true coordinates of update box's origin corner. - * Actually we compute the coordinates of the center of the corner - * histogram cell, which are the lower bounds of the volume we care about. - */ - minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); - minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); - minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); - - /* Determine which colormap entries are close enough to be candidates - * for the nearest entry to some cell in the update box. - */ - numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist); - - /* Determine the actually nearest colors. */ - find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, - bestcolor); - - /* Save the best color numbers (plus 1) in the main cache array */ - c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ - c1 <<= BOX_C1_LOG; - c2 <<= BOX_C2_LOG; - cptr = bestcolor; - for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) { - for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { - cachep = & histogram[c0+ic0][c1+ic1][c2]; - for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { - *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); - } - } - } -} - - -/* - * Map some rows of pixels to the output colormapped representation. - */ - -METHODDEF(void) -pass2_no_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) -/* This version performs no dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - register JSAMPROW inptr, outptr; - register histptr cachep; - register int c0, c1, c2; - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - - for (row = 0; row < num_rows; row++) { - inptr = input_buf[row]; - outptr = output_buf[row]; - for (col = width; col > 0; col--) { - /* get pixel value and index into the cache */ - c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT; - c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT; - c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT; - cachep = & histogram[c0][c1][c2]; - /* If we have not seen this color before, find nearest colormap entry */ - /* and update the cache */ - if (*cachep == 0) - fill_inverse_cmap(cinfo, c0,c1,c2); - /* Now emit the colormap index for this cell */ - *outptr++ = (JSAMPLE) (*cachep - 1); - } - } -} - - -METHODDEF(void) -pass2_fs_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) -/* This version performs Floyd-Steinberg dithering */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ - LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ - LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ - register FSERRPTR errorptr; /* => fserrors[] at column before current */ - JSAMPROW inptr; /* => current input pixel */ - JSAMPROW outptr; /* => current output pixel */ - histptr cachep; - int dir; /* +1 or -1 depending on direction */ - int dir3; /* 3*dir, for advancing inptr & errorptr */ - int row; - JDIMENSION col; - JDIMENSION width = cinfo->output_width; - JSAMPLE *range_limit = cinfo->sample_range_limit; - int *error_limit = cquantize->error_limiter; - JSAMPROW colormap0 = cinfo->colormap[0]; - JSAMPROW colormap1 = cinfo->colormap[1]; - JSAMPROW colormap2 = cinfo->colormap[2]; - SHIFT_TEMPS - - for (row = 0; row < num_rows; row++) { - inptr = input_buf[row]; - outptr = output_buf[row]; - if (cquantize->on_odd_row) { - /* work right to left in this row */ - inptr += (width-1) * 3; /* so point to rightmost pixel */ - outptr += width-1; - dir = -1; - dir3 = -3; - errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */ - cquantize->on_odd_row = FALSE; /* flip for next time */ - } else { - /* work left to right in this row */ - dir = 1; - dir3 = 3; - errorptr = cquantize->fserrors; /* => entry before first real column */ - cquantize->on_odd_row = TRUE; /* flip for next time */ - } - /* Preset error values: no error propagated to first pixel from left */ - cur0 = cur1 = cur2 = 0; - /* and no error propagated to row below yet */ - belowerr0 = belowerr1 = belowerr2 = 0; - bpreverr0 = bpreverr1 = bpreverr2 = 0; - - for (col = width; col > 0; col--) { - /* curN holds the error propagated from the previous pixel on the - * current line. Add the error propagated from the previous line - * to form the complete error correction term for this pixel, and - * round the error term (which is expressed * 16) to an integer. - * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct - * for either sign of the error value. - * Note: errorptr points to *previous* column's array entry. - */ - cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4); - cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4); - cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4); - /* Limit the error using transfer function set by init_error_limit. - * See comments with init_error_limit for rationale. - */ - cur0 = error_limit[cur0]; - cur1 = error_limit[cur1]; - cur2 = error_limit[cur2]; - /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. - * The maximum error is +- MAXJSAMPLE (or less with error limiting); - * this sets the required size of the range_limit array. - */ - cur0 += GETJSAMPLE(inptr[0]); - cur1 += GETJSAMPLE(inptr[1]); - cur2 += GETJSAMPLE(inptr[2]); - cur0 = GETJSAMPLE(range_limit[cur0]); - cur1 = GETJSAMPLE(range_limit[cur1]); - cur2 = GETJSAMPLE(range_limit[cur2]); - /* Index into the cache with adjusted pixel value */ - cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; - /* If we have not seen this color before, find nearest colormap */ - /* entry and update the cache */ - if (*cachep == 0) - fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); - /* Now emit the colormap index for this cell */ - { register int pixcode = *cachep - 1; - *outptr = (JSAMPLE) pixcode; - /* Compute representation error for this pixel */ - cur0 -= GETJSAMPLE(colormap0[pixcode]); - cur1 -= GETJSAMPLE(colormap1[pixcode]); - cur2 -= GETJSAMPLE(colormap2[pixcode]); - } - /* Compute error fractions to be propagated to adjacent pixels. - * Add these into the running sums, and simultaneously shift the - * next-line error sums left by 1 column. - */ - { register LOCFSERROR bnexterr, delta; - - bnexterr = cur0; /* Process component 0 */ - delta = cur0 * 2; - cur0 += delta; /* form error * 3 */ - errorptr[0] = (FSERROR) (bpreverr0 + cur0); - cur0 += delta; /* form error * 5 */ - bpreverr0 = belowerr0 + cur0; - belowerr0 = bnexterr; - cur0 += delta; /* form error * 7 */ - bnexterr = cur1; /* Process component 1 */ - delta = cur1 * 2; - cur1 += delta; /* form error * 3 */ - errorptr[1] = (FSERROR) (bpreverr1 + cur1); - cur1 += delta; /* form error * 5 */ - bpreverr1 = belowerr1 + cur1; - belowerr1 = bnexterr; - cur1 += delta; /* form error * 7 */ - bnexterr = cur2; /* Process component 2 */ - delta = cur2 * 2; - cur2 += delta; /* form error * 3 */ - errorptr[2] = (FSERROR) (bpreverr2 + cur2); - cur2 += delta; /* form error * 5 */ - bpreverr2 = belowerr2 + cur2; - belowerr2 = bnexterr; - cur2 += delta; /* form error * 7 */ - } - /* At this point curN contains the 7/16 error value to be propagated - * to the next pixel on the current line, and all the errors for the - * next line have been shifted over. We are therefore ready to move on. - */ - inptr += dir3; /* Advance pixel pointers to next column */ - outptr += dir; - errorptr += dir3; /* advance errorptr to current column */ - } - /* Post-loop cleanup: we must unload the final error values into the - * final fserrors[] entry. Note we need not unload belowerrN because - * it is for the dummy column before or after the actual array. - */ - errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */ - errorptr[1] = (FSERROR) bpreverr1; - errorptr[2] = (FSERROR) bpreverr2; - } -} - - -/* - * Initialize the error-limiting transfer function (lookup table). - * The raw F-S error computation can potentially compute error values of up to - * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be - * much less, otherwise obviously wrong pixels will be created. (Typical - * effects include weird fringes at color-area boundaries, isolated bright - * pixels in a dark area, etc.) The standard advice for avoiding this problem - * is to ensure that the "corners" of the color cube are allocated as output - * colors; then repeated errors in the same direction cannot cause cascading - * error buildup. However, that only prevents the error from getting - * completely out of hand; Aaron Giles reports that error limiting improves - * the results even with corner colors allocated. - * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty - * well, but the smoother transfer function used below is even better. Thanks - * to Aaron Giles for this idea. - */ - -LOCAL(void) -init_error_limit (j_decompress_ptr cinfo) -/* Allocate and fill in the error_limiter table */ -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - int * table; - int in, out; - - table = (int *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int)); - table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ - cquantize->error_limiter = table; - -#define STEPSIZE ((MAXJSAMPLE+1)/16) - /* Map errors 1:1 up to +- MAXJSAMPLE/16 */ - out = 0; - for (in = 0; in < STEPSIZE; in++, out++) { - table[in] = out; table[-in] = -out; - } - /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */ - for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) { - table[in] = out; table[-in] = -out; - } - /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */ - for (; in <= MAXJSAMPLE; in++) { - table[in] = out; table[-in] = -out; - } -#undef STEPSIZE -} - - -/* - * Finish up at the end of each pass. - */ - -METHODDEF(void) -finish_pass1 (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - - /* Select the representative colors and fill in cinfo->colormap */ - cinfo->colormap = cquantize->sv_colormap; - select_colors(cinfo, cquantize->desired); - /* Force next pass to zero the color index table */ - cquantize->needs_zeroed = TRUE; -} - - -METHODDEF(void) -finish_pass2 (j_decompress_ptr cinfo) -{ - /* no work */ -} - - -/* - * Initialize for each processing pass. - */ - -METHODDEF(void) -start_pass_2_quant (j_decompress_ptr cinfo, wxjpeg_boolean is_pre_scan) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - hist3d histogram = cquantize->histogram; - int i; - - /* Only F-S dithering or no dithering is supported. */ - /* If user asks for ordered dither, give him F-S. */ - if (cinfo->dither_mode != JDITHER_NONE) - cinfo->dither_mode = JDITHER_FS; - - if (is_pre_scan) { - /* Set up method pointers */ - cquantize->pub.color_quantize = prescan_quantize; - cquantize->pub.finish_pass = finish_pass1; - cquantize->needs_zeroed = TRUE; /* Always zero histogram */ - } else { - /* Set up method pointers */ - if (cinfo->dither_mode == JDITHER_FS) - cquantize->pub.color_quantize = pass2_fs_dither; - else - cquantize->pub.color_quantize = pass2_no_dither; - cquantize->pub.finish_pass = finish_pass2; - - /* Make sure color count is acceptable */ - i = cinfo->actual_number_of_colors; - if (i < 1) - ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1); - if (i > MAXNUMCOLORS) - ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); - - if (cinfo->dither_mode == JDITHER_FS) { - size_t arraysize = (size_t) ((cinfo->output_width + 2) * - (3 * SIZEOF(FSERROR))); - /* Allocate Floyd-Steinberg workspace if we didn't already. */ - if (cquantize->fserrors == NULL) - cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) - ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); - /* Initialize the propagated errors to zero. */ - jzero_far((void FAR *) cquantize->fserrors, arraysize); - /* Make the error-limit table if we didn't already. */ - if (cquantize->error_limiter == NULL) - init_error_limit(cinfo); - cquantize->on_odd_row = FALSE; - } - - } - /* Zero the histogram or inverse color map, if necessary */ - if (cquantize->needs_zeroed) { - for (i = 0; i < HIST_C0_ELEMS; i++) { - jzero_far((void FAR *) histogram[i], - HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); - } - cquantize->needs_zeroed = FALSE; - } -} - - -/* - * Switch to a new external colormap between output passes. - */ - -METHODDEF(void) -new_color_map_2_quant (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - - /* Reset the inverse color map */ - cquantize->needs_zeroed = TRUE; -} - - -/* - * Module initialization routine for 2-pass color quantization. - */ - -GLOBAL(void) -jinit_2pass_quantizer (j_decompress_ptr cinfo) -{ - my_cquantize_ptr cquantize; - int i; - - cquantize = (my_cquantize_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); - cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; - cquantize->pub.start_pass = start_pass_2_quant; - cquantize->pub.new_color_map = new_color_map_2_quant; - cquantize->fserrors = NULL; /* flag optional arrays not allocated */ - cquantize->error_limiter = NULL; - - /* Make sure jdmaster didn't give me a case I can't handle */ - if (cinfo->out_color_components != 3) - ERREXIT(cinfo, JERR_NOTIMPL); - - /* Allocate the histogram/inverse colormap storage */ - cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d)); - for (i = 0; i < HIST_C0_ELEMS; i++) { - cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); - } - cquantize->needs_zeroed = TRUE; /* histogram is garbage now */ - - /* Allocate storage for the completed colormap, if required. - * We do this now since it is FAR storage and may affect - * the memory manager's space calculations. - */ - if (cinfo->enable_2pass_quant) { - /* Make sure color count is acceptable */ - int desired = cinfo->desired_number_of_colors; - /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */ - if (desired < 8) - ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8); - /* Make sure colormap indexes can be represented by JSAMPLEs */ - if (desired > MAXNUMCOLORS) - ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); - cquantize->sv_colormap = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3); - cquantize->desired = desired; - } else - cquantize->sv_colormap = NULL; - - /* Only F-S dithering or no dithering is supported. */ - /* If user asks for ordered dither, give him F-S. */ - if (cinfo->dither_mode != JDITHER_NONE) - cinfo->dither_mode = JDITHER_FS; - - /* Allocate Floyd-Steinberg workspace if necessary. - * This isn't really needed until pass 2, but again it is FAR storage. - * Although we will cope with a later change in dither_mode, - * we do not promise to honor max_memory_to_use if dither_mode changes. - */ - if (cinfo->dither_mode == JDITHER_FS) { - cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR)))); - /* Might as well create the error-limiting table too. */ - init_error_limit(cinfo); - } -} - -#endif /* QUANT_2PASS_SUPPORTED */ diff --git a/Source/3rdParty/wx/src/jpeg/jutils.c b/Source/3rdParty/wx/src/jpeg/jutils.c deleted file mode 100644 index d18a95556..000000000 --- a/Source/3rdParty/wx/src/jpeg/jutils.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * jutils.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains tables and miscellaneous utility routines needed - * for both compression and decompression. - * Note we prefix all global names with "j" to minimize conflicts with - * a surrounding application. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" - - -/* - * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element - * of a DCT block read in natural order (left to right, top to bottom). - */ - -#if 0 /* This table is not actually needed in v6a */ - -const int jpeg_zigzag_order[DCTSIZE2] = { - 0, 1, 5, 6, 14, 15, 27, 28, - 2, 4, 7, 13, 16, 26, 29, 42, - 3, 8, 12, 17, 25, 30, 41, 43, - 9, 11, 18, 24, 31, 40, 44, 53, - 10, 19, 23, 32, 39, 45, 52, 54, - 20, 22, 33, 38, 46, 51, 55, 60, - 21, 34, 37, 47, 50, 56, 59, 61, - 35, 36, 48, 49, 57, 58, 62, 63 -}; - -#endif - -/* - * jpeg_natural_order[i] is the natural-order position of the i'th element - * of zigzag order. - * - * When reading corrupted data, the Huffman decoders could attempt - * to reference an entry beyond the end of this array (if the decoded - * zero run length reaches past the end of the block). To prevent - * wild stores without adding an inner-loop test, we put some extra - * "63"s after the real entries. This will cause the extra coefficient - * to be stored in location 63 of the block, not somewhere random. - * The worst case would be a run-length of 15, which means we need 16 - * fake entries. - */ - -const int jpeg_natural_order[DCTSIZE2+16] = { - 0, 1, 8, 16, 9, 2, 3, 10, - 17, 24, 32, 25, 18, 11, 4, 5, - 12, 19, 26, 33, 40, 48, 41, 34, - 27, 20, 13, 6, 7, 14, 21, 28, - 35, 42, 49, 56, 57, 50, 43, 36, - 29, 22, 15, 23, 30, 37, 44, 51, - 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63, - 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ - 63, 63, 63, 63, 63, 63, 63, 63 -}; - - -/* - * Arithmetic utilities - */ - -GLOBAL(long) -jdiv_round_up (long a, long b) -/* Compute a/b rounded up to next integer, ie, ceil(a/b) */ -/* Assumes a >= 0, b > 0 */ -{ - return (a + b - 1L) / b; -} - - -GLOBAL(long) -jround_up (long a, long b) -/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ -/* Assumes a >= 0, b > 0 */ -{ - a += b - 1L; - return a - (a % b); -} - - -/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays - * and coefficient-block arrays. This won't work on 80x86 because the arrays - * are FAR and we're assuming a small-pointer memory model. However, some - * DOS compilers provide far-pointer versions of memcpy() and memset() even - * in the small-model libraries. These will be used if USE_FMEM is defined. - * Otherwise, the routines below do it the hard way. (The performance cost - * is not all that great, because these routines aren't very heavily used.) - */ - -#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ -#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) -#define FMEMZERO(target,size) MEMZERO(target,size) -#else /* 80x86 case, define if we can */ -#ifdef USE_FMEM -#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) -#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) -#endif -#endif - - -GLOBAL(void) -jcopy_sample_rows (JSAMPARRAY input_array, int source_row, - JSAMPARRAY output_array, int dest_row, - int num_rows, JDIMENSION num_cols) -/* Copy some rows of samples from one place to another. - * num_rows rows are copied from input_array[source_row++] - * to output_array[dest_row++]; these areas may overlap for duplication. - * The source and destination arrays must be at least as wide as num_cols. - */ -{ - register JSAMPROW inptr, outptr; -#ifdef FMEMCOPY - register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); -#else - register JDIMENSION count; -#endif - register int row; - - input_array += source_row; - output_array += dest_row; - - for (row = num_rows; row > 0; row--) { - inptr = *input_array++; - outptr = *output_array++; -#ifdef FMEMCOPY - FMEMCOPY(outptr, inptr, count); -#else - for (count = num_cols; count > 0; count--) - *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ -#endif - } -} - - -GLOBAL(void) -jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, - JDIMENSION num_blocks) -/* Copy a row of coefficient blocks from one place to another. */ -{ -#ifdef FMEMCOPY - FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); -#else - register JCOEFPTR inptr, outptr; - register long count; - - inptr = (JCOEFPTR) input_row; - outptr = (JCOEFPTR) output_row; - for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) { - *outptr++ = *inptr++; - } -#endif -} - - -GLOBAL(void) -jzero_far (void FAR * target, size_t bytestozero) -/* Zero out a chunk of FAR memory. */ -/* This might be sample-array data, block-array data, or alloc_large data. */ -{ -#ifdef FMEMZERO - FMEMZERO(target, bytestozero); -#else - register char FAR * ptr = (char FAR *) target; - register size_t count; - - for (count = bytestozero; count > 0; count--) { - *ptr++ = 0; - } -#endif -} diff --git a/Source/3rdParty/wx/src/jpeg/jversion.h b/Source/3rdParty/wx/src/jpeg/jversion.h deleted file mode 100644 index 6472c58d3..000000000 --- a/Source/3rdParty/wx/src/jpeg/jversion.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jversion.h - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains software version identification. - */ - - -#define JVERSION "6b 27-Mar-1998" - -#define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" diff --git a/Source/3rdParty/wx/src/msw/accel.cpp b/Source/3rdParty/wx/src/msw/accel.cpp deleted file mode 100644 index 465ee8c30..000000000 --- a/Source/3rdParty/wx/src/msw/accel.cpp +++ /dev/null @@ -1,160 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msw/accel.cpp -// Purpose: wxAcceleratorTable -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: accel.cpp 56049 2008-10-03 12:13:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ACCEL - -#ifndef WX_PRECOMP - #include "wx/window.h" -#endif - -#include "wx/accel.h" - -#include "wx/msw/private.h" - -extern WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual); - -IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) - -// ---------------------------------------------------------------------------- -// data defining wxAcceleratorTable -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData -{ - friend class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; -public: - wxAcceleratorRefData(); - virtual ~wxAcceleratorRefData(); - - inline HACCEL GetHACCEL() const { return m_hAccel; } -protected: - HACCEL m_hAccel; - bool m_ok; - - DECLARE_NO_COPY_CLASS(wxAcceleratorRefData) -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxAcceleratorRefData -// ---------------------------------------------------------------------------- - -#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData) - -wxAcceleratorRefData::wxAcceleratorRefData() -{ - m_ok = false; - m_hAccel = 0; -} - -wxAcceleratorRefData::~wxAcceleratorRefData() -{ - if (m_hAccel) - { - DestroyAcceleratorTable((HACCEL) m_hAccel); - } -} - -// ---------------------------------------------------------------------------- -// wxAcceleratorTable -// ---------------------------------------------------------------------------- - -// Load from .rc resource -wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) -{ - m_refData = new wxAcceleratorRefData; - - HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource); - M_ACCELDATA->m_hAccel = hAccel; - M_ACCELDATA->m_ok = hAccel != 0; -} - -// Create from an array -wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) -{ - m_refData = new wxAcceleratorRefData; - - ACCEL* arr = new ACCEL[n]; - for ( int i = 0; i < n; i++ ) - { - int flags = entries[i].GetFlags(); - - BYTE fVirt = 0; - if ( flags & wxACCEL_ALT ) - fVirt |= FALT | FVIRTKEY; - if ( flags & wxACCEL_SHIFT ) - fVirt |= FSHIFT | FVIRTKEY; - if ( flags & wxACCEL_CTRL ) - fVirt |= FCONTROL | FVIRTKEY; - - bool isVirtual; - - WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual); - if (isVirtual) - fVirt |= FVIRTKEY; - - arr[i].fVirt = fVirt; - arr[i].key = key; - arr[i].cmd = (WORD)entries[i].GetCommand(); - } - - M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n); - delete[] arr; - - M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0); -} - -bool wxAcceleratorTable::IsOk() const -{ - return (M_ACCELDATA && (M_ACCELDATA->m_ok)); -} - -void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel) -{ - if (!M_ACCELDATA) - m_refData = new wxAcceleratorRefData; - - M_ACCELDATA->m_hAccel = (HACCEL) hAccel; -} - -WXHACCEL wxAcceleratorTable::GetHACCEL() const -{ - if (!M_ACCELDATA) - return 0; - return (WXHACCEL) M_ACCELDATA->m_hAccel; -} - -bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const -{ - MSG *msg = (MSG *)wxmsg; - return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); -} - -#endif // wxUSE_ACCEL - diff --git a/Source/3rdParty/wx/src/msw/app.cpp b/Source/3rdParty/wx/src/msw/app.cpp deleted file mode 100644 index 266ddc45c..000000000 --- a/Source/3rdParty/wx/src/msw/app.cpp +++ /dev/null @@ -1,809 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/app.cpp -// Purpose: wxApp -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: app.cpp 62085 2009-09-24 15:42:13Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// declarations -// =========================================================================== - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" - #include "wx/dynarray.h" - #include "wx/frame.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/gdicmn.h" - #include "wx/pen.h" - #include "wx/brush.h" - #include "wx/cursor.h" - #include "wx/icon.h" - #include "wx/palette.h" - #include "wx/dc.h" - #include "wx/dialog.h" - #include "wx/msgdlg.h" - #include "wx/intl.h" - #include "wx/wxchar.h" - #include "wx/log.h" - #include "wx/module.h" -#endif - -#include "wx/apptrait.h" -#include "wx/filename.h" -#include "wx/dynlib.h" -#include "wx/evtloop.h" - -#include "wx/msw/private.h" -#include "wx/msw/ole/oleutils.h" - -#if wxUSE_TOOLTIPS - #include "wx/tooltip.h" -#endif // wxUSE_TOOLTIPS - -// OLE is used for drag-and-drop, clipboard, OLE Automation..., but some -// compilers don't support it (missing headers, libs, ...) -#if defined(__GNUWIN32_OLD__) || defined(__SYMANTEC__) || defined(__SALFORDC__) - #undef wxUSE_OLE - - #define wxUSE_OLE 0 -#endif // broken compilers - -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - #include - #include -#endif - -#if wxUSE_OLE - #include -#endif - -#include -#include - -// For MB_TASKMODAL -#ifdef __WXWINCE__ -#include "wx/msw/wince/missing.h" -#endif - -// instead of including which is not part of the core SDK and not -// shipped at all with other compilers, we always define the parts of it we -// need here ourselves -// -// NB: DLLVER_PLATFORM_WINDOWS will be defined if shlwapi.h had been somehow -// included already -#ifndef DLLVER_PLATFORM_WINDOWS - // hopefully we don't need to change packing as DWORDs should be already - // correctly aligned - struct DLLVERSIONINFO - { - DWORD cbSize; - DWORD dwMajorVersion; // Major version - DWORD dwMinorVersion; // Minor version - DWORD dwBuildNumber; // Build number - DWORD dwPlatformID; // DLLVER_PLATFORM_* - }; - - typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *); -#endif // defined(DLLVERSIONINFO) - - -// --------------------------------------------------------------------------- -// global variables -// --------------------------------------------------------------------------- - -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) -extern void wxSetKeyboardHook(bool doIt); -#endif - -// NB: all "NoRedraw" classes must have the same names as the "normal" classes -// with NR suffix - wxWindow::MSWCreate() supposes this -#ifdef __WXWINCE__ -WXDLLIMPEXP_CORE wxChar *wxCanvasClassName; -WXDLLIMPEXP_CORE wxChar *wxCanvasClassNameNR; -#else -WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName = wxT("wxWindowClass"); -WXDLLIMPEXP_CORE const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); -#endif -WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); -WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); -WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); -WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR"); - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM); - -// =========================================================================== -// wxGUIAppTraits implementation -// =========================================================================== - -// private class which we use to pass parameters from BeforeChildWaitLoop() to -// AfterChildWaitLoop() -struct ChildWaitLoopData -{ - ChildWaitLoopData(wxWindowDisabler *wd_, wxWindow *winActive_) - { - wd = wd_; - winActive = winActive_; - } - - wxWindowDisabler *wd; - wxWindow *winActive; -}; - -void *wxGUIAppTraits::BeforeChildWaitLoop() -{ - /* - We use a dirty hack here to disable all application windows (which we - must do because otherwise the calls to wxYield() could lead to some very - unexpected reentrancies in the users code) but to avoid losing - focus/activation entirely when the child process terminates which would - happen if we simply disabled everything using wxWindowDisabler. Indeed, - remember that Windows will never activate a disabled window and when the - last childs window is closed and Windows looks for a window to activate - all our windows are still disabled. There is no way to enable them in - time because we don't know when the childs windows are going to be - closed, so the solution we use here is to keep one special tiny frame - enabled all the time. Then when the child terminates it will get - activated and when we close it below -- after reenabling all the other - windows! -- the previously active window becomes activated again and - everything is ok. - */ - wxBeginBusyCursor(); - - // first disable all existing windows - wxWindowDisabler *wd = new wxWindowDisabler; - - // then create an "invisible" frame: it has minimal size, is positioned - // (hopefully) outside the screen and doesn't appear on the taskbar - wxWindow *winActive = new wxFrame - ( - wxTheApp->GetTopWindow(), - wxID_ANY, - wxEmptyString, - wxPoint(32600, 32600), - wxSize(1, 1), - wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR - ); - winActive->Show(); - - return new ChildWaitLoopData(wd, winActive); -} - -void wxGUIAppTraits::AlwaysYield() -{ - wxYield(); -} - -void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) -{ - wxEndBusyCursor(); - - ChildWaitLoopData * const data = (ChildWaitLoopData *)dataOrig; - - delete data->wd; - - // finally delete the dummy frame and, as wd has been already destroyed and - // the other windows reenabled, the activation is going to return to the - // window which had had it before - data->winActive->Destroy(); - - // also delete the temporary data object itself - delete data; -} - -bool wxGUIAppTraits::DoMessageFromThreadWait() -{ - // we should return false only if the app should exit, i.e. only if - // Dispatch() determines that the main event loop should terminate - wxEventLoop *evtLoop = wxEventLoop::GetActive(); - if ( !evtLoop || !evtLoop->Pending() ) - { - // no events means no quit event - return true; - } - - return evtLoop->Dispatch(); -} - -wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const -{ - OSVERSIONINFO info; - wxZeroMemory(info); - - // on Windows, the toolkit version is the same of the OS version - // as Windows integrates the OS kernel with the GUI toolkit. - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if ( ::GetVersionEx(&info) ) - { - if ( majVer ) - *majVer = info.dwMajorVersion; - if ( minVer ) - *minVer = info.dwMinorVersion; - } - -#if defined(__WXHANDHELD__) || defined(__WXWINCE__) - return wxPORT_WINCE; -#else - return wxPORT_MSW; -#endif -} - -// =========================================================================== -// wxApp implementation -// =========================================================================== - -int wxApp::m_nCmdShow = SW_SHOWNORMAL; - -// --------------------------------------------------------------------------- -// wxWin macros -// --------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) - -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxApp::OnIdle) - EVT_END_SESSION(wxApp::OnEndSession) - EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) -END_EVENT_TABLE() - -// class to ensure that wxAppBase::CleanUp() is called if our Initialize() -// fails -class wxCallBaseCleanup -{ -public: - wxCallBaseCleanup(wxApp *app) : m_app(app) { } - ~wxCallBaseCleanup() { if ( m_app ) m_app->wxAppBase::CleanUp(); } - - void Dismiss() { m_app = NULL; } - -private: - wxApp *m_app; -}; - -//// Initialize -bool wxApp::Initialize(int& argc, wxChar **argv) -{ - if ( !wxAppBase::Initialize(argc, argv) ) - return false; - - // ensure that base cleanup is done if we return too early - wxCallBaseCleanup callBaseCleanup(this); - -#ifdef __WXWINCE__ - wxString tmp = GetAppName(); - tmp += wxT("ClassName"); - wxCanvasClassName = wxStrdup( tmp.c_str() ); - tmp += wxT("NR"); - wxCanvasClassNameNR = wxStrdup( tmp.c_str() ); - HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL ); - if (hWnd) - { - SetForegroundWindow( (HWND)(((DWORD)hWnd)|0x01) ); - return false; - } -#endif - -#if !defined(__WXMICROWIN__) - InitCommonControls(); -#endif // !defined(__WXMICROWIN__) - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - SHInitExtraControls(); -#endif - -#ifndef __WXWINCE__ - // Don't show a message box if a function such as SHGetFileInfo - // fails to find a device. - SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); -#endif - - wxOleInitialize(); - - RegisterWindowClasses(); - - wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100); - -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - wxSetKeyboardHook(true); -#endif - - callBaseCleanup.Dismiss(); - - return true; -} - -// --------------------------------------------------------------------------- -// RegisterWindowClasses -// --------------------------------------------------------------------------- - -// TODO we should only register classes really used by the app. For this it -// would be enough to just delay the class registration until an attempt -// to create a window of this class is made. -bool wxApp::RegisterWindowClasses() -{ - WNDCLASS wndclass; - wxZeroMemory(wndclass); - - // for each class we register one with CS_(V|H)REDRAW style and one - // without for windows created with wxNO_FULL_REDRAW_ON_REPAINT flag - static const long styleNormal = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - static const long styleNoRedraw = CS_DBLCLKS; - - // the fields which are common to all classes - wndclass.lpfnWndProc = (WNDPROC)wxWndProc; - wndclass.hInstance = wxhInstance; - wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW); - - // register the class for all normal windows - wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wndclass.lpszClassName = wxCanvasClassName; - wndclass.style = styleNormal; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(frame)")); - } - - // "no redraw" frame - wndclass.lpszClassName = wxCanvasClassNameNR; - wndclass.style = styleNoRedraw; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(no redraw frame)")); - } - - // Register the MDI frame window class. - wndclass.hbrBackground = (HBRUSH)NULL; // paint MDI frame ourselves - wndclass.lpszClassName = wxMDIFrameClassName; - wndclass.style = styleNormal; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(MDI parent)")); - } - - // "no redraw" MDI frame - wndclass.lpszClassName = wxMDIFrameClassNameNoRedraw; - wndclass.style = styleNoRedraw; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(no redraw MDI parent frame)")); - } - - // Register the MDI child frame window class. - wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndclass.lpszClassName = wxMDIChildFrameClassName; - wndclass.style = styleNormal; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(MDI child)")); - } - - // "no redraw" MDI child frame - wndclass.lpszClassName = wxMDIChildFrameClassNameNoRedraw; - wndclass.style = styleNoRedraw; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError(wxT("RegisterClass(no redraw MDI child)")); - } - - return true; -} - -// --------------------------------------------------------------------------- -// UnregisterWindowClasses -// --------------------------------------------------------------------------- - -bool wxApp::UnregisterWindowClasses() -{ - bool retval = true; - -#ifndef __WXMICROWIN__ - // MDI frame window class. - if ( !::UnregisterClass(wxMDIFrameClassName, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(MDI parent)")); - - retval = false; - } - - // "no redraw" MDI frame - if ( !::UnregisterClass(wxMDIFrameClassNameNoRedraw, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(no redraw MDI parent frame)")); - - retval = false; - } - - // MDI child frame window class. - if ( !::UnregisterClass(wxMDIChildFrameClassName, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(MDI child)")); - - retval = false; - } - - // "no redraw" MDI child frame - if ( !::UnregisterClass(wxMDIChildFrameClassNameNoRedraw, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(no redraw MDI child)")); - - retval = false; - } - - // canvas class name - if ( !::UnregisterClass(wxCanvasClassName, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(canvas)")); - - retval = false; - } - - if ( !::UnregisterClass(wxCanvasClassNameNR, wxhInstance) ) - { - wxLogLastError(wxT("UnregisterClass(no redraw canvas)")); - - retval = false; - } -#endif // __WXMICROWIN__ - - return retval; -} - -void wxApp::CleanUp() -{ - // all objects pending for deletion must be deleted first, otherwise we - // would crash when they use wxWinHandleHash (and UnregisterWindowClasses() - // call wouldn't succeed as long as any windows still exist), so call the - // base class method first and only then do our clean up - wxAppBase::CleanUp(); - -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - wxSetKeyboardHook(false); -#endif - - wxOleUninitialize(); - - // for an EXE the classes are unregistered when it terminates but DLL may - // be loaded several times (load/unload/load) into the same process in - // which case the registration will fail after the first time if we don't - // unregister the classes now - UnregisterWindowClasses(); - - delete wxWinHandleHash; - wxWinHandleHash = NULL; - -#ifdef __WXWINCE__ - free( wxCanvasClassName ); - free( wxCanvasClassNameNR ); -#endif -} - -// ---------------------------------------------------------------------------- -// wxApp ctor/dtor -// ---------------------------------------------------------------------------- - -wxApp::wxApp() -{ - m_printMode = wxPRINT_WINDOWS; -} - -wxApp::~wxApp() -{ -} - -// ---------------------------------------------------------------------------- -// wxApp idle handling -// ---------------------------------------------------------------------------- - -void wxApp::OnIdle(wxIdleEvent& event) -{ - wxAppBase::OnIdle(event); - -#if wxUSE_DC_CACHEING - // automated DC cache management: clear the cached DCs and bitmap - // if it's likely that the app has finished with them, that is, we - // get an idle event and we're not dragging anything. - if (!::GetKeyState(MK_LBUTTON) && !::GetKeyState(MK_MBUTTON) && !::GetKeyState(MK_RBUTTON)) - wxDC::ClearCache(); -#endif // wxUSE_DC_CACHEING -} - -void wxApp::WakeUpIdle() -{ - // Send the top window a dummy message so idle handler processing will - // start up again. Doing it this way ensures that the idle handler - // wakes up in the right thread (see also wxWakeUpMainThread() which does - // the same for the main app thread only) - wxWindow * const topWindow = wxTheApp->GetTopWindow(); - if ( topWindow ) - { - HWND hwndTop = GetHwndOf(topWindow); - - // Do not post WM_NULL if there's already a pending WM_NULL to avoid - // overflowing the message queue. - // - // Notice that due to a limitation of PeekMessage() API (which handles - // 0,0 range specially), we have to check the range from 0-1 instead. - // This still makes it possible to overflow the queue with WM_NULLs by - // interspersing the calles to WakeUpIdle() with windows creation but - // it should be rather hard to do it accidentally. - MSG msg; - if ( !::PeekMessage(&msg, hwndTop, 0, 1, PM_NOREMOVE) || - ::PeekMessage(&msg, hwndTop, 1, 1, PM_NOREMOVE) ) - { - if ( !::PostMessage(hwndTop, WM_NULL, 0, 0) ) - { - // should never happen - wxLogLastError(wxT("PostMessage(WM_NULL)")); - } - } - } -#if wxUSE_THREADS - else - wxWakeUpMainThread(); -#endif // wxUSE_THREADS -} - -// ---------------------------------------------------------------------------- -// other wxApp event hanlders -// ---------------------------------------------------------------------------- - -void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) -{ - if (GetTopWindow()) - GetTopWindow()->Close(true); -} - -// Default behaviour: close the application with prompts. The -// user can veto the close, and therefore the end session. -void wxApp::OnQueryEndSession(wxCloseEvent& event) -{ - if (GetTopWindow()) - { - if (!GetTopWindow()->Close(!event.CanVeto())) - event.Veto(true); - } -} - -// ---------------------------------------------------------------------------- -// miscellaneous -// ---------------------------------------------------------------------------- - -/* static */ -int wxApp::GetComCtl32Version() -{ -#if defined(__WXMICROWIN__) || defined(__WXWINCE__) - return 0; -#else - // cache the result - // - // NB: this is MT-ok as in the worst case we'd compute s_verComCtl32 twice, - // but as its value should be the same both times it doesn't matter - static int s_verComCtl32 = -1; - - if ( s_verComCtl32 == -1 ) - { - // initally assume no comctl32.dll at all - s_verComCtl32 = 0; - - // we're prepared to handle the errors - wxLogNull noLog; - -#if wxUSE_DYNLIB_CLASS - // we don't want to load comctl32.dll, it should be already loaded but, - // depending on the OS version and the presence of the manifest, it can - // be either v5 or v6 and instead of trying to guess it just get the - // handle of the already loaded version - wxLoadedDLL dllComCtl32(_T("comctl32.dll")); - if ( !dllComCtl32.IsLoaded() ) - { - s_verComCtl32 = 0; - return 0; - } - - // if so, then we can check for the version - if ( dllComCtl32.IsLoaded() ) - { - // now check if the function is available during run-time - wxDYNLIB_FUNCTION( DLLGETVERSIONPROC, DllGetVersion, dllComCtl32 ); - if ( pfnDllGetVersion ) - { - DLLVERSIONINFO dvi; - dvi.cbSize = sizeof(dvi); - - HRESULT hr = (*pfnDllGetVersion)(&dvi); - if ( FAILED(hr) ) - { - wxLogApiError(_T("DllGetVersion"), hr); - } - else - { - // this is incompatible with _WIN32_IE values, but - // compatible with the other values returned by - // GetComCtl32Version() - s_verComCtl32 = 100*dvi.dwMajorVersion + - dvi.dwMinorVersion; - } - } - - // if DllGetVersion() is unavailable either during compile or - // run-time, try to guess the version otherwise - if ( !s_verComCtl32 ) - { - // InitCommonControlsEx is unique to 4.70 and later - void *pfn = dllComCtl32.GetSymbol(_T("InitCommonControlsEx")); - if ( !pfn ) - { - // not found, must be 4.00 - s_verComCtl32 = 400; - } - else // 4.70+ - { - // many symbols appeared in comctl32 4.71, could use any of - // them except may be DllInstall() - pfn = dllComCtl32.GetSymbol(_T("InitializeFlatSB")); - if ( !pfn ) - { - // not found, must be 4.70 - s_verComCtl32 = 470; - } - else - { - // found, must be 4.71 or later - s_verComCtl32 = 471; - } - } - } - } -#endif // wxUSE_DYNLIB_CLASS - } - - return s_verComCtl32; -#endif // Microwin/!Microwin -} - -// Yield to incoming messages - -bool wxApp::Yield(bool onlyIfNeeded) -{ - // MT-FIXME - static bool s_inYield = false; - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); -#endif // wxUSE_LOG - - if ( s_inYield ) - { - if ( !onlyIfNeeded ) - { - wxFAIL_MSG( wxT("wxYield called recursively" ) ); - } - - return false; - } - - s_inYield = true; - - // we don't want to process WM_QUIT from here - it should be processed in - // the main event loop in order to stop it - wxEventLoopGuarantor dummyLoopIfNeeded; - MSG msg; - while ( PeekMessage(&msg, (HWND)0, 0, 0, PM_NOREMOVE) && - msg.message != WM_QUIT ) - { -#if wxUSE_THREADS - wxMutexGuiLeaveOrEnter(); -#endif // wxUSE_THREADS - - if ( !wxTheApp->Dispatch() ) - break; - } - - // if there are pending events, we must process them. - ProcessPendingEvents(); - -#if wxUSE_LOG - // let the logs be flashed again - wxLog::Resume(); -#endif // wxUSE_LOG - - s_inYield = false; - - return true; -} - -#if wxUSE_EXCEPTIONS - -// ---------------------------------------------------------------------------- -// exception handling -// ---------------------------------------------------------------------------- - -bool wxApp::OnExceptionInMainLoop() -{ - // ask the user about what to do: use the Win32 API function here as it - // could be dangerous to use any wxWidgets code in this state - switch ( - ::MessageBox - ( - NULL, - _T("An unhandled exception occurred. Press \"Abort\" to \ -terminate the program,\r\n\ -\"Retry\" to exit the program normally and \"Ignore\" to try to continue."), - _T("Unhandled exception"), - MB_ABORTRETRYIGNORE | - MB_ICONERROR| - MB_TASKMODAL - ) - ) - { - case IDABORT: - throw; - - default: - wxFAIL_MSG( _T("unexpected MessageBox() return code") ); - // fall through - - case IDRETRY: - return false; - - case IDIGNORE: - return true; - } -} - -#endif // wxUSE_EXCEPTIONS - -// ---------------------------------------------------------------------------- -// deprecated event loop functions -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 - -void wxApp::DoMessage(WXMSG *pMsg) -{ - wxEventLoop *evtLoop = wxEventLoop::GetActive(); - if ( evtLoop ) - evtLoop->ProcessMessage(pMsg); -} - -bool wxApp::DoMessage() -{ - wxEventLoop *evtLoop = wxEventLoop::GetActive(); - return evtLoop ? evtLoop->Dispatch() : false; -} - -bool wxApp::ProcessMessage(WXMSG* pMsg) -{ - wxEventLoop *evtLoop = wxEventLoop::GetActive(); - return evtLoop && evtLoop->PreProcessMessage(pMsg); -} - -#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/Source/3rdParty/wx/src/msw/basemsw.cpp b/Source/3rdParty/wx/src/msw/basemsw.cpp deleted file mode 100644 index 5c820d4de..000000000 --- a/Source/3rdParty/wx/src/msw/basemsw.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/basemsw.cpp -// Purpose: misc stuff only used in console applications under MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.06.2003 -// RCS-ID: $Id: basemsw.cpp 39831 2006-06-25 23:53:53Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/apptrait.h" -// MBN: this is a workaround for MSVC 5: if it is not #included in -// some wxBase file, wxRecursionGuard methods won't be exported from -// wxBase.dll, and MSVC 5 will give linker errors -#include "wx/recguard.h" - -#include "wx/msw/private.h" - -// ============================================================================ -// wxConsoleAppTraits implementation -// ============================================================================ - -void wxConsoleAppTraits::AlwaysYield() -{ - // we need to use special logic to deal with WM_PAINT: as this pseudo - // message is generated automatically as long as there are invalidated - // windows belonging to this thread, we'd never return if we waited here - // until we have no more of them left. OTOH, this message is always the - // last one in the queue, so we can safely return as soon as we detect it - MSG msg; - while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) - { - if ( msg.message == WM_PAINT ) - break; - } -} - -void *wxConsoleAppTraits::BeforeChildWaitLoop() -{ - // nothing to do here - return NULL; -} - -void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) -{ - // nothing to do here -} - -bool wxConsoleAppTraits::DoMessageFromThreadWait() -{ - // nothing to process here - return true; -} - diff --git a/Source/3rdParty/wx/src/msw/bitmap.cpp b/Source/3rdParty/wx/src/msw/bitmap.cpp deleted file mode 100644 index fec02d9fd..000000000 --- a/Source/3rdParty/wx/src/msw/bitmap.cpp +++ /dev/null @@ -1,1809 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Name: src/msw/bitmap.cpp -// Purpose: wxBitmap -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: bitmap.cpp 56488 2008-10-22 17:01:02Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/bitmap.h" - -#ifndef WX_PRECOMP - #include - - #include "wx/list.h" - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/palette.h" - #include "wx/dcmemory.h" - #include "wx/icon.h" - #include "wx/log.h" - #include "wx/image.h" -#endif - -#include "wx/msw/private.h" - -#if wxUSE_WXDIB - #include "wx/msw/dib.h" -#endif - -#ifdef wxHAVE_RAW_BITMAP - #include "wx/rawbmp.h" -#endif - -// missing from mingw32 header -#ifndef CLR_INVALID - #define CLR_INVALID ((COLORREF)-1) -#endif // no CLR_INVALID - -// ---------------------------------------------------------------------------- -// Bitmap data -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData -{ -public: - wxBitmapRefData(); - wxBitmapRefData(const wxBitmapRefData& data); - virtual ~wxBitmapRefData() { Free(); } - - virtual void Free(); - - // set the mask object to use as the mask, we take ownership of it - void SetMask(wxMask *mask) - { - delete m_bitmapMask; - m_bitmapMask = mask; - } - - // set the HBITMAP to use as the mask - void SetMask(HBITMAP hbmpMask) - { - SetMask(new wxMask((WXHBITMAP)hbmpMask)); - } - - // return the mask - wxMask *GetMask() const { return m_bitmapMask; } - -public: -#if wxUSE_PALETTE - wxPalette m_bitmapPalette; -#endif // wxUSE_PALETTE - - // MSW-specific - // ------------ - -#ifdef __WXDEBUG__ - // this field is solely for error checking: we detect selecting a bitmap - // into more than one DC at once or deleting a bitmap still selected into a - // DC (both are serious programming errors under Windows) - wxDC *m_selectedInto; -#endif // __WXDEBUG__ - -#if wxUSE_WXDIB - // when GetRawData() is called for a DDB we need to convert it to a DIB - // first to be able to provide direct access to it and we cache that DIB - // here and convert it back to DDB when UngetRawData() is called - wxDIB *m_dib; -#endif - - // true if we have alpha transparency info and can be drawn using - // AlphaBlend() - bool m_hasAlpha; - - // true if our HBITMAP is a DIB section, false if it is a DDB - bool m_isDIB; - -private: - // optional mask for transparent drawing - wxMask *m_bitmapMask; - - - // not implemented - wxBitmapRefData& operator=(const wxBitmapRefData&); -}; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) - -IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// helper functions -// ---------------------------------------------------------------------------- - -// decide whether we should create a DIB or a DDB for the given parameters -// -// NB: we always use DIBs under Windows CE as this is much simpler (even if -// also less efficient...) and we obviously can't use them if there is no -// DIB support compiled in at all -#ifdef __WXWINCE__ - static inline bool wxShouldCreateDIB(int, int, int, WXHDC) { return true; } - - #define ALWAYS_USE_DIB -#elif !wxUSE_WXDIB - // no sense in defining wxShouldCreateDIB() as we can't compile code - // executed if it is true, so we have to use #if's anyhow - #define NEVER_USE_DIB -#else // wxUSE_WXDIB && !__WXWINCE__ - static inline bool wxShouldCreateDIB(int w, int h, int d, WXHDC hdc) - { - // here is the logic: - // - // (a) if hdc is specified, the caller explicitly wants DDB - // (b) otherwise, create a DIB if depth >= 24 (we don't support 16bpp - // or less DIBs anyhow) - // (c) finally, create DIBs under Win9x even if the depth hasn't been - // explicitly specified but the current display depth is 24 or - // more and the image is "big", i.e. > 16Mb which is the - // theoretical limit for DDBs under Win9x - // - // consequences (all of which seem to make sense): - // - // (i) by default, DDBs are created (depth == -1 usually) - // (ii) DIBs can be created by explicitly specifying the depth - // (iii) using a DC always forces creating a DDB - return !hdc && - (d >= 24 || - (d == -1 && - wxDIB::GetLineSize(w, wxDisplayDepth())*h > 16*1024*1024)); - } - - #define SOMETIMES_USE_DIB -#endif // different DIB usage scenarious - -// ---------------------------------------------------------------------------- -// wxBitmapRefData -// ---------------------------------------------------------------------------- - -wxBitmapRefData::wxBitmapRefData() -{ -#ifdef __WXDEBUG__ - m_selectedInto = NULL; -#endif - m_bitmapMask = NULL; - - m_hBitmap = (WXHBITMAP) NULL; -#if wxUSE_WXDIB - m_dib = NULL; -#endif - - m_isDIB = - m_hasAlpha = false; -} - -wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) - : wxGDIImageRefData(data) -{ -#ifdef __WXDEBUG__ - m_selectedInto = NULL; -#endif - - // (deep) copy the mask if present - m_bitmapMask = NULL; - if (data.m_bitmapMask) - m_bitmapMask = new wxMask(*data.m_bitmapMask); - - // FIXME: we don't copy m_hBitmap currently but we should, see wxBitmap:: - // CloneRefData() - - wxASSERT_MSG( !data.m_isDIB, - _T("can't copy bitmap locked for raw access!") ); - m_isDIB = false; - - m_hasAlpha = data.m_hasAlpha; -} - -void wxBitmapRefData::Free() -{ - wxASSERT_MSG( !m_selectedInto, - wxT("deleting bitmap still selected into wxMemoryDC") ); - -#if wxUSE_WXDIB - wxASSERT_MSG( !m_dib, _T("forgot to call wxBitmap::UngetRawData()!") ); -#endif - - if ( m_hBitmap) - { - if ( !::DeleteObject((HBITMAP)m_hBitmap) ) - { - wxLogLastError(wxT("DeleteObject(hbitmap)")); - } - } - - delete m_bitmapMask; - m_bitmapMask = NULL; -} - -// ---------------------------------------------------------------------------- -// wxBitmap creation -// ---------------------------------------------------------------------------- - -wxGDIImageRefData *wxBitmap::CreateData() const -{ - return new wxBitmapRefData; -} - -wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *dataOrig) const -{ - const wxBitmapRefData * - data = wx_static_cast(const wxBitmapRefData *, dataOrig); - if ( !data ) - return NULL; - - // FIXME: this method is backwards, it should just create a new - // wxBitmapRefData using its copy ctor but instead it modifies this - // bitmap itself and then returns its m_refData -- which works, of - // course (except in !wxUSE_WXDIB), but is completely illogical - wxBitmap *self = wx_const_cast(wxBitmap *, this); - - wxBitmapRefData *selfdata; -#if wxUSE_WXDIB - // copy the other bitmap - if ( data->m_hBitmap ) - { - wxDIB dib((HBITMAP)(data->m_hBitmap)); - self->CopyFromDIB(dib); - - selfdata = wx_static_cast(wxBitmapRefData *, m_refData); - selfdata->m_hasAlpha = data->m_hasAlpha; - } - else -#endif // wxUSE_WXDIB - { - // copy the bitmap data - selfdata = new wxBitmapRefData(*data); - self->m_refData = selfdata; - } - - // copy also the mask - wxMask * const maskSrc = data->GetMask(); - if ( maskSrc ) - { - selfdata->SetMask(new wxMask(*maskSrc)); - } - - return selfdata; -} - -#ifdef __WIN32__ - -bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) -{ -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - // it may be either HICON or HCURSOR - HICON hicon = (HICON)icon.GetHandle(); - - ICONINFO iconInfo; - if ( !::GetIconInfo(hicon, &iconInfo) ) - { - wxLogLastError(wxT("GetIconInfo")); - - return false; - } - - wxBitmapRefData *refData = new wxBitmapRefData; - m_refData = refData; - - int w = icon.GetWidth(), - h = icon.GetHeight(); - - refData->m_width = w; - refData->m_height = h; - refData->m_depth = wxDisplayDepth(); - - refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor; - -#if wxUSE_WXDIB - // If the icon is 32 bits per pixel then it may have alpha channel data, - // although there are some icons that are 32 bpp but have no alpha... So - // convert to a DIB and manually check the 4th byte for each pixel. - BITMAP bm; - if ( ::GetObject(iconInfo.hbmColor, sizeof(BITMAP), (LPVOID)&bm) - && bm.bmBitsPixel == 32) - { - wxDIB dib(iconInfo.hbmColor); - if (dib.IsOk()) - { - unsigned char* pixels = dib.GetData(); - for (int idx=0; idxm_hasAlpha = true; - break; - } - } - } - } -#endif - if ( !refData->m_hasAlpha ) - { - // the mask returned by GetIconInfo() is inverted compared to the usual - // wxWin convention - refData->SetMask(wxInvertMask(iconInfo.hbmMask, w, h)); - } - - // delete the old one now as we don't need it any more - ::DeleteObject(iconInfo.hbmMask); - - return true; -#else - wxUnusedVar(icon); - return false; -#endif -} - -#endif // Win32 - -bool wxBitmap::CopyFromCursor(const wxCursor& cursor) -{ - UnRef(); - - if ( !cursor.Ok() ) - return false; - - return CopyFromIconOrCursor(cursor); -} - -bool wxBitmap::CopyFromIcon(const wxIcon& icon) -{ - UnRef(); - - if ( !icon.Ok() ) - return false; - - return CopyFromIconOrCursor(icon); -} - -#ifndef NEVER_USE_DIB - -bool wxBitmap::CopyFromDIB(const wxDIB& dib) -{ - wxCHECK_MSG( dib.IsOk(), false, _T("invalid DIB in CopyFromDIB") ); - -#ifdef SOMETIMES_USE_DIB - HBITMAP hbitmap = dib.CreateDDB(); - if ( !hbitmap ) - return false; -#else // ALWAYS_USE_DIB - HBITMAP hbitmap = ((wxDIB &)dib).Detach(); // const_cast -#endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB - - UnRef(); - - wxBitmapRefData *refData = new wxBitmapRefData; - m_refData = refData; - - refData->m_width = dib.GetWidth(); - refData->m_height = dib.GetHeight(); - refData->m_depth = dib.GetDepth(); - - refData->m_hBitmap = (WXHBITMAP)hbitmap; - -#if wxUSE_PALETTE - wxPalette *palette = dib.CreatePalette(); - if ( palette ) - { - refData->m_bitmapPalette = *palette; - } - - delete palette; -#endif // wxUSE_PALETTE - - return true; -} - -#endif // NEVER_USE_DIB - -wxBitmap::~wxBitmap() -{ -} - -wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) -{ -#ifndef __WXMICROWIN__ - wxBitmapRefData *refData = new wxBitmapRefData; - m_refData = refData; - - refData->m_width = width; - refData->m_height = height; - refData->m_depth = depth; - - char *data; - if ( depth == 1 ) - { - // we assume that it is in XBM format which is not quite the same as - // the format CreateBitmap() wants because the order of bytes in the - // line is reversed! - const size_t bytesPerLine = (width + 7) / 8; - const size_t padding = bytesPerLine % 2; - const size_t len = height * ( padding + bytesPerLine ); - data = (char *)malloc(len); - const char *src = bits; - char *dst = data; - - for ( int rows = 0; rows < height; rows++ ) - { - for ( size_t cols = 0; cols < bytesPerLine; cols++ ) - { - unsigned char val = *src++; - unsigned char reversed = 0; - - for ( int bits = 0; bits < 8; bits++) - { - reversed <<= 1; - reversed |= (unsigned char)(val & 0x01); - val >>= 1; - } - *dst++ = ~reversed; - } - - if ( padding ) - *dst++ = 0; - } - } - else - { - // bits should already be in Windows standard format - data = (char *)bits; // const_cast is harmless - } - - HBITMAP hbmp = ::CreateBitmap(width, height, 1, depth, data); - if ( !hbmp ) - { - wxLogLastError(wxT("CreateBitmap")); - } - - if ( data != bits ) - { - free(data); - } - - SetHBITMAP((WXHBITMAP)hbmp); -#endif -} - -wxBitmap::wxBitmap(int w, int h, int d) -{ - (void)Create(w, h, d); -} - -wxBitmap::wxBitmap(int w, int h, const wxDC& dc) -{ - (void)Create(w, h, dc); -} - -wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth) -{ - (void)Create(data, type, width, height, depth); -} - -wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) -{ - LoadFile(filename, (int)type); -} - -bool wxBitmap::Create(int width, int height, int depth) -{ - return DoCreate(width, height, depth, 0); -} - -bool wxBitmap::Create(int width, int height, const wxDC& dc) -{ - wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") ); - - return DoCreate(width, height, -1, dc.GetHDC()); -} - -bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) -{ - UnRef(); - - m_refData = new wxBitmapRefData; - - GetBitmapData()->m_width = w; - GetBitmapData()->m_height = h; - - HBITMAP hbmp wxDUMMY_INITIALIZE(0); - -#ifndef NEVER_USE_DIB - if ( wxShouldCreateDIB(w, h, d, hdc) ) - { - if ( d == -1 ) - { - // create DIBs without alpha channel by default - d = 24; - } - - wxDIB dib(w, h, d); - if ( !dib.IsOk() ) - return false; - - // don't delete the DIB section in dib object dtor - hbmp = dib.Detach(); - - GetBitmapData()->m_isDIB = true; - GetBitmapData()->m_depth = d; - } - else // create a DDB -#endif // NEVER_USE_DIB - { -#ifndef ALWAYS_USE_DIB -#ifndef __WXMICROWIN__ - if ( d > 0 ) - { - hbmp = ::CreateBitmap(w, h, 1, d, NULL); - if ( !hbmp ) - { - wxLogLastError(wxT("CreateBitmap")); - } - - GetBitmapData()->m_depth = d; - } - else // d == 0, create bitmap compatible with the screen -#endif // !__WXMICROWIN__ - { - ScreenHDC dc; - hbmp = ::CreateCompatibleBitmap(dc, w, h); - if ( !hbmp ) - { - wxLogLastError(wxT("CreateCompatibleBitmap")); - } - - GetBitmapData()->m_depth = wxDisplayDepth(); - } -#endif // !ALWAYS_USE_DIB - } - - SetHBITMAP((WXHBITMAP)hbmp); - - return Ok(); -} - -#if wxUSE_IMAGE - -// ---------------------------------------------------------------------------- -// wxImage to/from conversions for Microwin -// ---------------------------------------------------------------------------- - -// Microwin versions are so different from normal ones that it really doesn't -// make sense to use #ifdefs inside the function bodies -#ifdef __WXMICROWIN__ - -bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) -{ - // Set this to 1 to experiment with mask code, - // which currently doesn't work - #define USE_MASKS 0 - - m_refData = new wxBitmapRefData(); - - // Initial attempt at a simple-minded implementation. - // The bitmap will always be created at the screen depth, - // so the 'depth' argument is ignored. - - HDC hScreenDC = ::GetDC(NULL); - int screenDepth = ::GetDeviceCaps(hScreenDC, BITSPIXEL); - - HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, image.GetWidth(), image.GetHeight()); - HBITMAP hMaskBitmap = NULL; - HBITMAP hOldMaskBitmap = NULL; - HDC hMaskDC = NULL; - unsigned char maskR = 0; - unsigned char maskG = 0; - unsigned char maskB = 0; - - // printf("Created bitmap %d\n", (int) hBitmap); - if (hBitmap == NULL) - { - ::ReleaseDC(NULL, hScreenDC); - return false; - } - HDC hMemDC = ::CreateCompatibleDC(hScreenDC); - - HBITMAP hOldBitmap = ::SelectObject(hMemDC, hBitmap); - ::ReleaseDC(NULL, hScreenDC); - - // created an mono-bitmap for the possible mask - bool hasMask = image.HasMask(); - - if ( hasMask ) - { -#if USE_MASKS - // FIXME: we should be able to pass bpp = 1, but - // GdBlit can't handle a different depth -#if 0 - hMaskBitmap = ::CreateBitmap( (WORD)image.GetWidth(), (WORD)image.GetHeight(), 1, 1, NULL ); -#else - hMaskBitmap = ::CreateCompatibleBitmap( hMemDC, (WORD)image.GetWidth(), (WORD)image.GetHeight()); -#endif - maskR = image.GetMaskRed(); - maskG = image.GetMaskGreen(); - maskB = image.GetMaskBlue(); - - if (!hMaskBitmap) - { - hasMask = false; - } - else - { - hScreenDC = ::GetDC(NULL); - hMaskDC = ::CreateCompatibleDC(hScreenDC); - ::ReleaseDC(NULL, hScreenDC); - - hOldMaskBitmap = ::SelectObject( hMaskDC, hMaskBitmap); - } -#else - hasMask = false; -#endif - } - - int i, j; - for (i = 0; i < image.GetWidth(); i++) - { - for (j = 0; j < image.GetHeight(); j++) - { - unsigned char red = image.GetRed(i, j); - unsigned char green = image.GetGreen(i, j); - unsigned char blue = image.GetBlue(i, j); - - ::SetPixel(hMemDC, i, j, PALETTERGB(red, green, blue)); - - if (hasMask) - { - // scan the bitmap for the transparent colour and set the corresponding - // pixels in the mask to BLACK and the rest to WHITE - if (maskR == red && maskG == green && maskB == blue) - ::SetPixel(hMaskDC, i, j, PALETTERGB(0, 0, 0)); - else - ::SetPixel(hMaskDC, i, j, PALETTERGB(255, 255, 255)); - } - } - } - - ::SelectObject(hMemDC, hOldBitmap); - ::DeleteDC(hMemDC); - if (hasMask) - { - ::SelectObject(hMaskDC, hOldMaskBitmap); - ::DeleteDC(hMaskDC); - - ((wxBitmapRefData*)m_refData)->SetMask(hMaskBitmap); - } - - SetWidth(image.GetWidth()); - SetHeight(image.GetHeight()); - SetDepth(screenDepth); - SetHBITMAP( (WXHBITMAP) hBitmap ); - -#if wxUSE_PALETTE - // Copy the palette from the source image - SetPalette(image.GetPalette()); -#endif // wxUSE_PALETTE - - return true; -} - -wxImage wxBitmap::ConvertToImage() const -{ - // Initial attempt at a simple-minded implementation. - // The bitmap will always be created at the screen depth, - // so the 'depth' argument is ignored. - // TODO: transparency (create a mask image) - - if (!Ok()) - { - wxFAIL_MSG( wxT("bitmap is invalid") ); - return wxNullImage; - } - - wxImage image; - - wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); - - // create an wxImage object - int width = GetWidth(); - int height = GetHeight(); - image.Create( width, height ); - unsigned char *data = image.GetData(); - if( !data ) - { - wxFAIL_MSG( wxT("could not allocate data for image") ); - return wxNullImage; - } - - HDC hScreenDC = ::GetDC(NULL); - - HDC hMemDC = ::CreateCompatibleDC(hScreenDC); - ::ReleaseDC(NULL, hScreenDC); - - HBITMAP hBitmap = (HBITMAP) GetHBITMAP(); - - HBITMAP hOldBitmap = ::SelectObject(hMemDC, hBitmap); - - int i, j; - for (i = 0; i < GetWidth(); i++) - { - for (j = 0; j < GetHeight(); j++) - { - COLORREF color = ::GetPixel(hMemDC, i, j); - unsigned char red = GetRValue(color); - unsigned char green = GetGValue(color); - unsigned char blue = GetBValue(color); - - image.SetRGB(i, j, red, green, blue); - } - } - - ::SelectObject(hMemDC, hOldBitmap); - ::DeleteDC(hMemDC); - -#if wxUSE_PALETTE - // Copy the palette from the source image - if (GetPalette()) - image.SetPalette(* GetPalette()); -#endif // wxUSE_PALETTE - - return image; -} - -#endif // __WXMICROWIN__ - -// ---------------------------------------------------------------------------- -// wxImage to/from conversions -// ---------------------------------------------------------------------------- - -bool wxBitmap::CreateFromImage(const wxImage& image, int depth) -{ - return CreateFromImage(image, depth, 0); -} - -bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) -{ - wxCHECK_MSG( dc.Ok(), false, - _T("invalid HDC in wxBitmap::CreateFromImage()") ); - - return CreateFromImage(image, -1, dc.GetHDC()); -} - -#if wxUSE_WXDIB - -bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) -{ - wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ); - - UnRef(); - - // first convert the image to DIB - const int h = image.GetHeight(); - const int w = image.GetWidth(); - - wxDIB dib(image); - if ( !dib.IsOk() ) - return false; - - const bool hasAlpha = image.HasAlpha(); - - if (depth == -1) - depth = dib.GetDepth(); - - // store the bitmap parameters - wxBitmapRefData * const refData = new wxBitmapRefData; - refData->m_width = w; - refData->m_height = h; - refData->m_hasAlpha = hasAlpha; - refData->m_depth = depth; - - m_refData = refData; - - - // next either store DIB as is or create a DDB from it - HBITMAP hbitmap wxDUMMY_INITIALIZE(0); - - // are we going to use DIB? - // - // NB: DDBs don't support alpha so if we have alpha channel we must use DIB - if ( hasAlpha || wxShouldCreateDIB(w, h, depth, hdc) ) - { - // don't delete the DIB section in dib object dtor - hbitmap = dib.Detach(); - - refData->m_isDIB = true; - } -#ifndef ALWAYS_USE_DIB - else // we need to convert DIB to DDB - { - hbitmap = dib.CreateDDB((HDC)hdc); - } -#endif // !ALWAYS_USE_DIB - - // validate this object - SetHBITMAP((WXHBITMAP)hbitmap); - - // finally also set the mask if we have one - if ( image.HasMask() ) - { - const size_t len = 2*((w+15)/16); - BYTE *src = image.GetData(); - BYTE *data = new BYTE[h*len]; - memset(data, 0, h*len); - BYTE r = image.GetMaskRed(), - g = image.GetMaskGreen(), - b = image.GetMaskBlue(); - BYTE *dst = data; - for ( int y = 0; y < h; y++, dst += len ) - { - BYTE *dstLine = dst; - BYTE mask = 0x80; - for ( int x = 0; x < w; x++, src += 3 ) - { - if (src[0] != r || src[1] != g || src[2] != b) - *dstLine |= mask; - - if ( (mask >>= 1) == 0 ) - { - dstLine++; - mask = 0x80; - } - } - } - - hbitmap = ::CreateBitmap(w, h, 1, 1, data); - if ( !hbitmap ) - { - wxLogLastError(_T("CreateBitmap(mask)")); - } - else - { - SetMask(new wxMask((WXHBITMAP)hbitmap)); - } - - delete[] data; - } - - return true; -} - -wxImage wxBitmap::ConvertToImage() const -{ - // convert DDB to DIB - wxDIB dib(*this); - - if ( !dib.IsOk() ) - { - return wxNullImage; - } - - // and then DIB to our wxImage - wxImage image = dib.ConvertToImage(); - if ( !image.Ok() ) - { - return wxNullImage; - } - - // now do the same for the mask, if we have any - HBITMAP hbmpMask = GetMask() ? (HBITMAP) GetMask()->GetMaskBitmap() : NULL; - if ( hbmpMask ) - { - wxDIB dibMask(hbmpMask); - if ( dibMask.IsOk() ) - { - // TODO: use wxRawBitmap to iterate over DIB - - // we hard code the mask colour for now but we could also make an - // effort (and waste time) to choose a colour not present in the - // image already to avoid having to fudge the pixels below -- - // whether it's worth to do it is unclear however - static const int MASK_RED = 1; - static const int MASK_GREEN = 2; - static const int MASK_BLUE = 3; - static const int MASK_BLUE_REPLACEMENT = 2; - - const int h = dibMask.GetHeight(); - const int w = dibMask.GetWidth(); - const int bpp = dibMask.GetDepth(); - const int maskBytesPerPixel = bpp >> 3; - const int maskBytesPerLine = wxDIB::GetLineSize(w, bpp); - unsigned char *data = image.GetData(); - - // remember that DIBs are stored in bottom to top order - unsigned char * - maskLineStart = dibMask.GetData() + ((h - 1) * maskBytesPerLine); - - for ( int y = 0; y < h; y++, maskLineStart -= maskBytesPerLine ) - { - // traverse one mask DIB line - unsigned char *mask = maskLineStart; - for ( int x = 0; x < w; x++, mask += maskBytesPerPixel ) - { - // should this pixel be transparent? - if ( *mask ) - { - // no, check that it isn't transparent by accident - if ( (data[0] == MASK_RED) && - (data[1] == MASK_GREEN) && - (data[2] == MASK_BLUE) ) - { - // we have to fudge the colour a bit to prevent - // this pixel from appearing transparent - data[2] = MASK_BLUE_REPLACEMENT; - } - - data += 3; - } - else // yes, transparent pixel - { - *data++ = MASK_RED; - *data++ = MASK_GREEN; - *data++ = MASK_BLUE; - } - } - } - - image.SetMaskColour(MASK_RED, MASK_GREEN, MASK_BLUE); - } - } - - return image; -} - -#else // !wxUSE_WXDIB - -bool -wxBitmap::CreateFromImage(const wxImage& WXUNUSED(image), - int WXUNUSED(depth), - WXHDC WXUNUSED(hdc)) -{ - return false; -} - -wxImage wxBitmap::ConvertToImage() const -{ - return wxImage(); -} - -#endif // wxUSE_WXDIB/!wxUSE_WXDIB - -#endif // wxUSE_IMAGE - -// ---------------------------------------------------------------------------- -// loading and saving bitmaps -// ---------------------------------------------------------------------------- - -bool wxBitmap::LoadFile(const wxString& filename, long type) -{ - UnRef(); - - wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler); - - if ( handler ) - { - m_refData = new wxBitmapRefData; - - return handler->LoadFile(this, filename, type, -1, -1); - } -#if wxUSE_IMAGE && wxUSE_WXDIB - else // no bitmap handler found - { - wxImage image; - if ( image.LoadFile( filename, type ) && image.Ok() ) - { - *this = wxBitmap(image); - - return true; - } - } -#endif // wxUSE_IMAGE - - return false; -} - -bool wxBitmap::Create(const void* data, long type, int width, int height, int depth) -{ - UnRef(); - - wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler); - - if ( !handler ) - { - wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for type %ld defined."), type); - - return false; - } - - m_refData = new wxBitmapRefData; - - return handler->Create(this, data, type, width, height, depth); -} - -bool wxBitmap::SaveFile(const wxString& filename, - int type, - const wxPalette *palette) -{ - wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler); - - if ( handler ) - { - return handler->SaveFile(this, filename, type, palette); - } -#if wxUSE_IMAGE && wxUSE_WXDIB - else // no bitmap handler found - { - // FIXME what about palette? shouldn't we use it? - wxImage image = ConvertToImage(); - if ( image.Ok() ) - { - return image.SaveFile(filename, type); - } - } -#endif // wxUSE_IMAGE - - return false; -} - -// ---------------------------------------------------------------------------- -// sub bitmap extraction -// ---------------------------------------------------------------------------- -wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect ) const -{ - MemoryHDC dcSrc; - SelectInHDC selectSrc(dcSrc, GetHbitmap()); - return GetSubBitmapOfHDC( rect, (WXHDC)dcSrc ); -} - -wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const -{ - wxCHECK_MSG( Ok() && - (rect.x >= 0) && (rect.y >= 0) && - (rect.x+rect.width <= GetWidth()) && - (rect.y+rect.height <= GetHeight()), - wxNullBitmap, wxT("Invalid bitmap or bitmap region") ); - - wxBitmap ret( rect.width, rect.height, GetDepth() ); - wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); - -#ifndef __WXMICROWIN__ - // handle alpha channel, if any - if (HasAlpha()) - ret.UseAlpha(); - - // copy bitmap data - MemoryHDC dcSrc, - dcDst; - - { - SelectInHDC selectDst(dcDst, GetHbitmapOf(ret)); - - if ( !selectDst ) - { - wxLogLastError(_T("SelectObject(destBitmap)")); - } - - if ( !::BitBlt(dcDst, 0, 0, rect.width, rect.height, - (HDC)hdc, rect.x, rect.y, SRCCOPY) ) - { - wxLogLastError(_T("BitBlt")); - } - } - - // copy mask if there is one - if ( GetMask() ) - { - HBITMAP hbmpMask = ::CreateBitmap(rect.width, rect.height, 1, 1, 0); - - SelectInHDC selectSrc(dcSrc, (HBITMAP) GetMask()->GetMaskBitmap()), - selectDst(dcDst, hbmpMask); - - if ( !::BitBlt(dcDst, 0, 0, rect.width, rect.height, - dcSrc, rect.x, rect.y, SRCCOPY) ) - { - wxLogLastError(_T("BitBlt")); - } - - wxMask *mask = new wxMask((WXHBITMAP) hbmpMask); - ret.SetMask(mask); - } -#endif // !__WXMICROWIN__ - - return ret; -} - -// ---------------------------------------------------------------------------- -// wxBitmap accessors -// ---------------------------------------------------------------------------- - -#if wxUSE_PALETTE -wxPalette* wxBitmap::GetPalette() const -{ - return GetBitmapData() ? &GetBitmapData()->m_bitmapPalette - : (wxPalette *) NULL; -} -#endif - -wxMask *wxBitmap::GetMask() const -{ - return GetBitmapData() ? GetBitmapData()->GetMask() : (wxMask *) NULL; -} - -wxBitmap wxBitmap::GetMaskBitmap() const -{ - wxBitmap bmp; - wxMask *mask = GetMask(); - if ( mask ) - bmp.SetHBITMAP(mask->GetMaskBitmap()); - return bmp; -} - -#ifdef __WXDEBUG__ - -wxDC *wxBitmap::GetSelectedInto() const -{ - return GetBitmapData() ? GetBitmapData()->m_selectedInto : (wxDC *) NULL; -} - -#endif - -#if WXWIN_COMPATIBILITY_2_4 - -int wxBitmap::GetQuality() const -{ - return 0; -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -void wxBitmap::UseAlpha() -{ - if ( GetBitmapData() ) - GetBitmapData()->m_hasAlpha = true; -} - -bool wxBitmap::HasAlpha() const -{ - return GetBitmapData() && GetBitmapData()->m_hasAlpha; -} - -// ---------------------------------------------------------------------------- -// wxBitmap setters -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - -void wxBitmap::SetSelectedInto(wxDC *dc) -{ - if ( GetBitmapData() ) - GetBitmapData()->m_selectedInto = dc; -} - -#endif - -#if wxUSE_PALETTE - -void wxBitmap::SetPalette(const wxPalette& palette) -{ - AllocExclusive(); - - GetBitmapData()->m_bitmapPalette = palette; -} - -#endif // wxUSE_PALETTE - -void wxBitmap::SetMask(wxMask *mask) -{ - AllocExclusive(); - - GetBitmapData()->SetMask(mask); -} - -#if WXWIN_COMPATIBILITY_2_4 - -void wxBitmap::SetQuality(int WXUNUSED(quality)) -{ -} - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// raw bitmap access support -// ---------------------------------------------------------------------------- - -#ifdef wxHAVE_RAW_BITMAP -void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) -{ -#if wxUSE_WXDIB - if ( !Ok() ) - { - // no bitmap, no data (raw or otherwise) - return NULL; - } - - // if we're already a DIB we can access our data directly, but if not we - // need to convert this DDB to a DIB section and use it for raw access and - // then convert it back - HBITMAP hDIB; - if ( !GetBitmapData()->m_isDIB ) - { - wxCHECK_MSG( !GetBitmapData()->m_dib, NULL, - _T("GetRawData() may be called only once") ); - - wxDIB *dib = new wxDIB(*this); - if ( !dib->IsOk() ) - { - delete dib; - - return NULL; - } - - // we'll free it in UngetRawData() - GetBitmapData()->m_dib = dib; - - hDIB = dib->GetHandle(); - } - else // we're a DIB - { - hDIB = GetHbitmap(); - } - - DIBSECTION ds; - if ( ::GetObject(hDIB, sizeof(ds), &ds) != sizeof(DIBSECTION) ) - { - wxFAIL_MSG( _T("failed to get DIBSECTION from a DIB?") ); - - return NULL; - } - - // check that the bitmap is in correct format - if ( ds.dsBm.bmBitsPixel != bpp ) - { - wxFAIL_MSG( _T("incorrect bitmap type in wxBitmap::GetRawData()") ); - - return NULL; - } - - // ok, store the relevant info in wxPixelDataBase - const LONG h = ds.dsBm.bmHeight; - - data.m_width = ds.dsBm.bmWidth; - data.m_height = h; - - // remember that DIBs are stored in top to bottom order! - // (We can't just use ds.dsBm.bmWidthBytes here, because it isn't always a - // multiple of 2, as required by the documentation. So we use the official - // formula, which we already use elsewhere.) - const LONG bytesPerRow = - wxDIB::GetLineSize(ds.dsBm.bmWidth, ds.dsBm.bmBitsPixel); - data.m_stride = -bytesPerRow; - - char *bits = (char *)ds.dsBm.bmBits; - if ( h > 1 ) - { - bits += (h - 1)*bytesPerRow; - } - - return bits; -#else - return NULL; -#endif -} - -void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) -{ -#if wxUSE_WXDIB - if ( !Ok() ) - return; - - if ( !&dataBase ) - { - // invalid data, don't crash -- but don't assert neither as we're - // called automatically from wxPixelDataBase dtor and so there is no - // way to prevent this from happening - return; - } - - // if we're a DDB we need to convert DIB back to DDB now to make the - // changes made via raw bitmap access effective - if ( !GetBitmapData()->m_isDIB ) - { - wxDIB *dib = GetBitmapData()->m_dib; - GetBitmapData()->m_dib = NULL; - - // TODO: convert - - delete dib; - } -#endif // wxUSE_WXDIB -} -#endif // #ifdef wxHAVE_RAW_BITMAP - -// ---------------------------------------------------------------------------- -// wxMask -// ---------------------------------------------------------------------------- - -wxMask::wxMask() -{ - m_maskBitmap = 0; -} - -// Copy constructor -wxMask::wxMask(const wxMask &mask) - : wxObject() -{ - BITMAP bmp; - - HDC srcDC = CreateCompatibleDC(0); - HDC destDC = CreateCompatibleDC(0); - - // GetBitmapDimensionEx won't work if SetBitmapDimensionEx wasn't used - // so we'll use GetObject() API here: - if (::GetObject((HGDIOBJ)mask.m_maskBitmap, sizeof(bmp), &bmp) == 0) - { - wxFAIL_MSG(wxT("Cannot retrieve the dimensions of the wxMask to copy")); - return; - } - - // create our HBITMAP - int w = bmp.bmWidth, h = bmp.bmHeight; - m_maskBitmap = (WXHBITMAP)CreateCompatibleBitmap(srcDC, w, h); - - // copy the mask's HBITMAP into our HBITMAP - SelectObject(srcDC, (HBITMAP) mask.m_maskBitmap); - SelectObject(destDC, (HBITMAP) m_maskBitmap); - - BitBlt(destDC, 0, 0, w, h, srcDC, 0, 0, SRCCOPY); - - SelectObject(srcDC, 0); - DeleteDC(srcDC); - SelectObject(destDC, 0); - DeleteDC(destDC); -} - -// Construct a mask from a bitmap and a colour indicating -// the transparent area -wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour) -{ - m_maskBitmap = 0; - Create(bitmap, colour); -} - -// Construct a mask from a bitmap and a palette index indicating -// the transparent area -wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex) -{ - m_maskBitmap = 0; - Create(bitmap, paletteIndex); -} - -// Construct a mask from a mono bitmap (copies the bitmap). -wxMask::wxMask(const wxBitmap& bitmap) -{ - m_maskBitmap = 0; - Create(bitmap); -} - -wxMask::~wxMask() -{ - if ( m_maskBitmap ) - ::DeleteObject((HBITMAP) m_maskBitmap); -} - -// Create a mask from a mono bitmap (copies the bitmap). -bool wxMask::Create(const wxBitmap& bitmap) -{ -#ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, false, - _T("can't create mask from invalid or not monochrome bitmap") ); - - if ( m_maskBitmap ) - { - ::DeleteObject((HBITMAP) m_maskBitmap); - m_maskBitmap = 0; - } - - m_maskBitmap = (WXHBITMAP) CreateBitmap( - bitmap.GetWidth(), - bitmap.GetHeight(), - 1, 1, 0 - ); - HDC srcDC = CreateCompatibleDC(0); - SelectObject(srcDC, (HBITMAP) bitmap.GetHBITMAP()); - HDC destDC = CreateCompatibleDC(0); - SelectObject(destDC, (HBITMAP) m_maskBitmap); - BitBlt(destDC, 0, 0, bitmap.GetWidth(), bitmap.GetHeight(), srcDC, 0, 0, SRCCOPY); - SelectObject(srcDC, 0); - DeleteDC(srcDC); - SelectObject(destDC, 0); - DeleteDC(destDC); - return true; -#else - wxUnusedVar(bitmap); - return false; -#endif -} - -// Create a mask from a bitmap and a palette index indicating -// the transparent area -bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) -{ - if ( m_maskBitmap ) - { - ::DeleteObject((HBITMAP) m_maskBitmap); - m_maskBitmap = 0; - } - -#if wxUSE_PALETTE - if (bitmap.Ok() && bitmap.GetPalette()->Ok()) - { - unsigned char red, green, blue; - if (bitmap.GetPalette()->GetRGB(paletteIndex, &red, &green, &blue)) - { - wxColour transparentColour(red, green, blue); - return Create(bitmap, transparentColour); - } - } -#endif // wxUSE_PALETTE - - return false; -} - -// Create a mask from a bitmap and a colour indicating -// the transparent area -bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) -{ -#ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok(), false, _T("invalid bitmap in wxMask::Create") ); - - if ( m_maskBitmap ) - { - ::DeleteObject((HBITMAP) m_maskBitmap); - m_maskBitmap = 0; - } - - int width = bitmap.GetWidth(), - height = bitmap.GetHeight(); - - // scan the bitmap for the transparent colour and set the corresponding - // pixels in the mask to BLACK and the rest to WHITE - COLORREF maskColour = wxColourToPalRGB(colour); - m_maskBitmap = (WXHBITMAP)::CreateBitmap(width, height, 1, 1, 0); - - HDC srcDC = ::CreateCompatibleDC(NULL); - HDC destDC = ::CreateCompatibleDC(NULL); - if ( !srcDC || !destDC ) - { - wxLogLastError(wxT("CreateCompatibleDC")); - } - - bool ok = true; - - // SelectObject() will fail - wxASSERT_MSG( !bitmap.GetSelectedInto(), - _T("bitmap can't be selected in another DC") ); - - HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap)); - if ( !hbmpSrcOld ) - { - wxLogLastError(wxT("SelectObject")); - - ok = false; - } - - HGDIOBJ hbmpDstOld = ::SelectObject(destDC, (HBITMAP)m_maskBitmap); - if ( !hbmpDstOld ) - { - wxLogLastError(wxT("SelectObject")); - - ok = false; - } - - if ( ok ) - { - // this will create a monochrome bitmap with 0 points for the pixels - // which have the same value as the background colour and 1 for the - // others - ::SetBkColor(srcDC, maskColour); - ::BitBlt(destDC, 0, 0, width, height, srcDC, 0, 0, NOTSRCCOPY); - } - - ::SelectObject(srcDC, hbmpSrcOld); - ::DeleteDC(srcDC); - ::SelectObject(destDC, hbmpDstOld); - ::DeleteDC(destDC); - - return ok; -#else // __WXMICROWIN__ - wxUnusedVar(bitmap); - wxUnusedVar(colour); - return false; -#endif // __WXMICROWIN__/!__WXMICROWIN__ -} - -// ---------------------------------------------------------------------------- -// wxBitmapHandler -// ---------------------------------------------------------------------------- - -bool wxBitmapHandler::Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth) -{ - wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - - return bitmap && Create(bitmap, data, flags, width, height, depth); -} - -bool wxBitmapHandler::Load(wxGDIImage *image, - const wxString& name, - long flags, - int width, int height) -{ - wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - - return bitmap && LoadFile(bitmap, name, flags, width, height); -} - -bool wxBitmapHandler::Save(wxGDIImage *image, - const wxString& name, - int type) -{ - wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - - return bitmap && SaveFile(bitmap, name, type); -} - -bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), - const void* WXUNUSED(data), - long WXUNUSED(type), - int WXUNUSED(width), - int WXUNUSED(height), - int WXUNUSED(depth)) -{ - return false; -} - -bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), - const wxString& WXUNUSED(name), - long WXUNUSED(type), - int WXUNUSED(desiredWidth), - int WXUNUSED(desiredHeight)) -{ - return false; -} - -bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), - const wxString& WXUNUSED(name), - int WXUNUSED(type), - const wxPalette *WXUNUSED(palette)) -{ - return false; -} - -// ---------------------------------------------------------------------------- -// DIB functions -// ---------------------------------------------------------------------------- - -#ifndef __WXMICROWIN__ -bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, - HPALETTE hPal, LPBITMAPINFO* lpDIBHeader) -{ - unsigned long i, headerSize; - - // Allocate space for a DIB header - headerSize = (sizeof(BITMAPINFOHEADER) + (256 * sizeof(PALETTEENTRY))); - LPBITMAPINFO lpDIBheader = (BITMAPINFO *) malloc(headerSize); - LPPALETTEENTRY lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER)); - - GetPaletteEntries(hPal, 0, 256, lpPe); - - memset(lpDIBheader, 0x00, sizeof(BITMAPINFOHEADER)); - - // Fill in the static parts of the DIB header - lpDIBheader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - lpDIBheader->bmiHeader.biWidth = xSize; - lpDIBheader->bmiHeader.biHeight = ySize; - lpDIBheader->bmiHeader.biPlanes = 1; - - // this value must be 1, 4, 8 or 24 so PixelDepth can only be - lpDIBheader->bmiHeader.biBitCount = (WORD)(bitsPerPixel); - lpDIBheader->bmiHeader.biCompression = BI_RGB; - lpDIBheader->bmiHeader.biSizeImage = (xSize * abs((int)ySize) * bitsPerPixel) >> 3; - lpDIBheader->bmiHeader.biClrUsed = 256; - - - // Initialize the DIB palette - for (i = 0; i < 256; i++) { - lpDIBheader->bmiColors[i].rgbReserved = lpPe[i].peFlags; - lpDIBheader->bmiColors[i].rgbRed = lpPe[i].peRed; - lpDIBheader->bmiColors[i].rgbGreen = lpPe[i].peGreen; - lpDIBheader->bmiColors[i].rgbBlue = lpPe[i].peBlue; - } - - *lpDIBHeader = lpDIBheader; - - return true; -} - -void wxFreeDIB(LPBITMAPINFO lpDIBHeader) -{ - free(lpDIBHeader); -} -#endif - -// ---------------------------------------------------------------------------- -// global helper functions implemented here -// ---------------------------------------------------------------------------- - -// helper of wxBitmapToHICON/HCURSOR -static -HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, - bool iconWanted, - int hotSpotX, - int hotSpotY) -{ - if ( !bmp.Ok() ) - { - // we can't create an icon/cursor form nothing - return 0; - } - - if ( bmp.HasAlpha() ) - { - // Create an empty mask bitmap. - // it doesn't seem to work if we mess with the mask at all. - HBITMAP hMonoBitmap = CreateBitmap(bmp.GetWidth(),bmp.GetHeight(),1,1,NULL); - - ICONINFO iconInfo; - wxZeroMemory(iconInfo); - iconInfo.fIcon = iconWanted; // do we want an icon or a cursor? - if ( !iconWanted ) - { - iconInfo.xHotspot = hotSpotX; - iconInfo.yHotspot = hotSpotY; - } - - iconInfo.hbmMask = hMonoBitmap; - iconInfo.hbmColor = GetHbitmapOf(bmp); - - HICON hicon = ::CreateIconIndirect(&iconInfo); - - ::DeleteObject(hMonoBitmap); - - return hicon; - } - - wxMask* mask = bmp.GetMask(); - - if ( !mask ) - { - // we must have a mask for an icon, so even if it's probably incorrect, - // do create it (grey is the "standard" transparent colour) - mask = new wxMask(bmp, *wxLIGHT_GREY); - } - - ICONINFO iconInfo; - wxZeroMemory(iconInfo); - iconInfo.fIcon = iconWanted; // do we want an icon or a cursor? - if ( !iconWanted ) - { - iconInfo.xHotspot = hotSpotX; - iconInfo.yHotspot = hotSpotY; - } - - iconInfo.hbmMask = wxInvertMask((HBITMAP)mask->GetMaskBitmap()); - iconInfo.hbmColor = GetHbitmapOf(bmp); - - // black out the transparent area to preserve background colour, because - // Windows blits the original bitmap using SRCINVERT (XOR) after applying - // the mask to the dest rect. - { - MemoryHDC dcSrc, dcDst; - SelectInHDC selectMask(dcSrc, (HBITMAP)mask->GetMaskBitmap()), - selectBitmap(dcDst, iconInfo.hbmColor); - - if ( !::BitBlt(dcDst, 0, 0, bmp.GetWidth(), bmp.GetHeight(), - dcSrc, 0, 0, SRCAND) ) - { - wxLogLastError(_T("BitBlt")); - } - } - - HICON hicon = ::CreateIconIndirect(&iconInfo); - - if ( !bmp.GetMask() && !bmp.HasAlpha() ) - { - // we created the mask, now delete it - delete mask; - } - - // delete the inverted mask bitmap we created as well - ::DeleteObject(iconInfo.hbmMask); - - return hicon; -} - -HICON wxBitmapToHICON(const wxBitmap& bmp) -{ - return wxBitmapToIconOrCursor(bmp, true, 0, 0); -} - -HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY) -{ - return (HCURSOR)wxBitmapToIconOrCursor(bmp, false, hotSpotX, hotSpotY); -} - -HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) -{ -#ifndef __WXMICROWIN__ - wxCHECK_MSG( hbmpMask, 0, _T("invalid bitmap in wxInvertMask") ); - - // get width/height from the bitmap if not given - if ( !w || !h ) - { - BITMAP bm; - ::GetObject(hbmpMask, sizeof(BITMAP), (LPVOID)&bm); - w = bm.bmWidth; - h = bm.bmHeight; - } - - HDC hdcSrc = ::CreateCompatibleDC(NULL); - HDC hdcDst = ::CreateCompatibleDC(NULL); - if ( !hdcSrc || !hdcDst ) - { - wxLogLastError(wxT("CreateCompatibleDC")); - } - - HBITMAP hbmpInvMask = ::CreateBitmap(w, h, 1, 1, 0); - if ( !hbmpInvMask ) - { - wxLogLastError(wxT("CreateBitmap")); - } - - HGDIOBJ srcTmp = ::SelectObject(hdcSrc, hbmpMask); - HGDIOBJ dstTmp = ::SelectObject(hdcDst, hbmpInvMask); - if ( !::BitBlt(hdcDst, 0, 0, w, h, - hdcSrc, 0, 0, - NOTSRCCOPY) ) - { - wxLogLastError(wxT("BitBlt")); - } - - // Deselect objects - SelectObject(hdcSrc,srcTmp); - SelectObject(hdcDst,dstTmp); - - ::DeleteDC(hdcSrc); - ::DeleteDC(hdcDst); - - return hbmpInvMask; -#else - return 0; -#endif -} diff --git a/Source/3rdParty/wx/src/msw/bmpbuttn.cpp b/Source/3rdParty/wx/src/msw/bmpbuttn.cpp deleted file mode 100644 index 679765910..000000000 --- a/Source/3rdParty/wx/src/msw/bmpbuttn.cpp +++ /dev/null @@ -1,646 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/bmpbuttn.cpp -// Purpose: wxBitmapButton -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: bmpbuttn.cpp 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BMPBUTTON - -#include "wx/bmpbuttn.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/dcmemory.h" - #include "wx/image.h" -#endif - -#include "wx/msw/private.h" - -#include "wx/msw/uxtheme.h" - -#if wxUSE_UXTHEME - // no need to include tmschema.h - #ifndef BP_PUSHBUTTON - #define BP_PUSHBUTTON 1 - - #define PBS_NORMAL 1 - #define PBS_HOT 2 - #define PBS_PRESSED 3 - #define PBS_DISABLED 4 - #define PBS_DEFAULTED 5 - - #define TMT_CONTENTMARGINS 3602 - #endif -#endif // wxUSE_UXTHEME - -#ifndef ODS_NOFOCUSRECT - #define ODS_NOFOCUSRECT 0x0200 -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -#if wxUSE_EXTENDED_RTTI - -WX_DEFINE_FLAGS( wxBitmapButtonStyle ) - -wxBEGIN_FLAGS( wxBitmapButtonStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxBU_AUTODRAW) - wxFLAGS_MEMBER(wxBU_LEFT) - wxFLAGS_MEMBER(wxBU_RIGHT) - wxFLAGS_MEMBER(wxBU_TOP) - wxFLAGS_MEMBER(wxBU_BOTTOM) -wxEND_FLAGS( wxBitmapButtonStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton,"wx/bmpbuttn.h") - -wxBEGIN_PROPERTIES_TABLE(wxBitmapButton) - wxPROPERTY_FLAGS( WindowStyle , wxBitmapButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxBitmapButton) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_5( wxBitmapButton , wxWindow* , Parent , wxWindowID , Id , wxBitmap , Bitmap , wxPoint , Position , wxSize , Size ) - -#else -IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) -#endif - -BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase) - EVT_SYS_COLOUR_CHANGED(wxBitmapButton::OnSysColourChanged) - EVT_ENTER_WINDOW(wxBitmapButton::OnMouseEnterOrLeave) - EVT_LEAVE_WINDOW(wxBitmapButton::OnMouseEnterOrLeave) -END_EVENT_TABLE() - -/* -TODO PROPERTIES : - -long "style" , wxBU_AUTODRAW -bool "default" , 0 -bitmap "selected" , -bitmap "focus" , -bitmap "disabled" , -*/ - -bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& wxVALIDATOR_PARAM(validator), - const wxString& name) -{ - m_bmpNormal = bitmap; - SetName(name); - -#if wxUSE_VALIDATORS - SetValidator(validator); -#endif // wxUSE_VALIDATORS - - parent->AddChild(this); - - m_windowStyle = style; - - if ( style & wxBU_AUTODRAW ) - { - m_marginX = - m_marginY = 4; - } - - if (id == wxID_ANY) - m_windowId = NewControlId(); - else - m_windowId = id; - - long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ; - - if ( m_windowStyle & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; - -#ifdef __WIN32__ - if(m_windowStyle & wxBU_LEFT) - msStyle |= BS_LEFT; - if(m_windowStyle & wxBU_RIGHT) - msStyle |= BS_RIGHT; - if(m_windowStyle & wxBU_TOP) - msStyle |= BS_TOP; - if(m_windowStyle & wxBU_BOTTOM) - msStyle |= BS_BOTTOM; -#endif - - m_hWnd = (WXHWND) CreateWindowEx( - 0, - wxT("BUTTON"), - wxEmptyString, - msStyle, - 0, 0, 0, 0, - GetWinHwnd(parent), - (HMENU)m_windowId, - wxGetInstance(), - NULL - ); - - // Subclass again for purposes of dialog editing mode - SubclassWin(m_hWnd); - - SetPosition(pos); - SetInitialSize(size); - - return true; -} - -bool wxBitmapButton::SetBackgroundColour(const wxColour& colour) -{ - if ( !wxBitmapButtonBase::SetBackgroundColour(colour) ) - { - // didn't change - return false; - } - - // invalidate the brush, it will be recreated the next time it's needed - m_brushDisabled = wxNullBrush; - - return true; -} - -void wxBitmapButton::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - m_brushDisabled = wxNullBrush; - - if ( !IsEnabled() ) - { - // this change affects our current state - Refresh(); - } - - event.Skip(); -} - -void wxBitmapButton::OnMouseEnterOrLeave(wxMouseEvent& event) -{ - if ( IsEnabled() && m_bmpHover.Ok() ) - Refresh(); - - event.Skip(); -} - -void wxBitmapButton::OnSetBitmap() -{ - // if the focus bitmap is specified but hover one isn't, use the focus - // bitmap for hovering as well if this is consistent with the current - // Windows version look and feel - // - // rationale: this is compatible with the old wxGTK behaviour and also - // makes it much easier to do "the right thing" for all platforms (some of - // them, such as Windows XP, have "hot" buttons while others don't) - if ( !m_bmpHover.Ok() && - m_bmpFocus.Ok() && - wxUxThemeEngine::GetIfActive() ) - { - m_bmpHover = m_bmpFocus; - } - - // this will redraw us - wxBitmapButtonBase::OnSetBitmap(); -} - -#if wxUSE_UXTHEME -static -void MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis) -{ - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; - HDC hdc = lpDIS->hDC; - UINT state = lpDIS->itemState; - RECT rectBtn; - CopyRect(&rectBtn, &lpDIS->rcItem); - - wxUxThemeHandle theme(button, L"BUTTON"); - int iState; - - if ( state & ODS_SELECTED ) - { - iState = PBS_PRESSED; - } - else if ( button->HasCapture() || button->IsMouseInWindow() ) - { - iState = PBS_HOT; - } - else if ( state & ODS_FOCUS ) - { - iState = PBS_DEFAULTED; - } - else if ( state & ODS_DISABLED ) - { - iState = PBS_DISABLED; - } - else - { - iState = PBS_NORMAL; - } - - // draw parent background if needed - if ( wxUxThemeEngine::Get()->IsThemeBackgroundPartiallyTransparent(theme, - BP_PUSHBUTTON, - iState) ) - { - wxUxThemeEngine::Get()->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); - } - - // draw background - wxUxThemeEngine::Get()->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, - &rectBtn, NULL); - - // calculate content area margins - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, - TMT_CONTENTMARGINS, &rectBtn, &margins); - RECT rectClient; - ::CopyRect(&rectClient, &rectBtn); - ::InflateRect(&rectClient, -margins.cxLeftWidth, -margins.cyTopHeight); - - // if focused and !nofocus rect - if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) - { - DrawFocusRect(hdc, &rectClient); - } - - if ( button->UseBgCol() ) - { - COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); - HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); - - // don't overwrite the focus rect - ::InflateRect(&rectClient, -1, -1); - FillRect(hdc, &rectClient, hbrushBackground); - ::DeleteObject(hbrushBackground); - } -} -#endif // wxUSE_UXTHEME - -// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN -#define FOCUS_MARGIN 3 - -bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) -{ -#ifndef __WXWINCE__ - long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE); - if (style & BS_BITMAP) - { - // Let default procedure draw the bitmap, which is defined - // in the Windows resource. - return false; - } -#endif - - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item; - HDC hDC = lpDIS->hDC; - UINT state = lpDIS->itemState; - bool isSelected = (state & ODS_SELECTED) != 0; - bool autoDraw = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0; - - - // choose the bitmap to use depending on the button state - wxBitmap *bitmap; - - if ( isSelected && m_bmpSelected.Ok() ) - bitmap = &m_bmpSelected; - else if ( m_bmpHover.Ok() && IsMouseInWindow() ) - bitmap = &m_bmpHover; - else if ((state & ODS_FOCUS) && m_bmpFocus.Ok()) - bitmap = &m_bmpFocus; - else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok()) - bitmap = &m_bmpDisabled; - else - bitmap = &m_bmpNormal; - - if ( !bitmap->Ok() ) - return false; - - // centre the bitmap in the control area - int x = lpDIS->rcItem.left; - int y = lpDIS->rcItem.top; - int width = lpDIS->rcItem.right - x; - int height = lpDIS->rcItem.bottom - y; - int wBmp = bitmap->GetWidth(); - int hBmp = bitmap->GetHeight(); - -#if wxUSE_UXTHEME - if ( autoDraw && wxUxThemeEngine::GetIfActive() ) - { - MSWDrawXPBackground(this, item); - wxUxThemeHandle theme(this, L"BUTTON"); - - // calculate content area margins - // assuming here that each state is the same size - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, - BP_PUSHBUTTON, PBS_NORMAL, - TMT_CONTENTMARGINS, NULL, - &margins); - int marginX = margins.cxLeftWidth + 1; - int marginY = margins.cyTopHeight + 1; - int x1,y1; - - if ( m_windowStyle & wxBU_LEFT ) - { - x1 = x + marginX; - } - else if ( m_windowStyle & wxBU_RIGHT ) - { - x1 = x + (width - wBmp) - marginX; - } - else - { - x1 = x + (width - wBmp) / 2; - } - - if ( m_windowStyle & wxBU_TOP ) - { - y1 = y + marginY; - } - else if ( m_windowStyle & wxBU_BOTTOM ) - { - y1 = y + (height - hBmp) - marginY; - } - else - { - y1 = y + (height - hBmp) / 2; - } - - // draw the bitmap - wxDCTemp dst((WXHDC)hDC); - dst.DrawBitmap(*bitmap, x1, y1, true); - - return true; - } -#endif // wxUSE_UXTHEME - - int x1,y1; - - if(m_windowStyle & wxBU_LEFT) - x1 = x + (FOCUS_MARGIN+1); - else if(m_windowStyle & wxBU_RIGHT) - x1 = x + (width - wBmp) - (FOCUS_MARGIN+1); - else - x1 = x + (width - wBmp) / 2; - - if(m_windowStyle & wxBU_TOP) - y1 = y + (FOCUS_MARGIN+1); - else if(m_windowStyle & wxBU_BOTTOM) - y1 = y + (height - hBmp) - (FOCUS_MARGIN+1); - else - y1 = y + (height - hBmp) / 2; - - if ( isSelected && autoDraw ) - { - x1++; - y1++; - } - - // draw the face, if auto-drawing - if ( autoDraw ) - { - DrawFace((WXHDC) hDC, - lpDIS->rcItem.left, lpDIS->rcItem.top, - lpDIS->rcItem.right, lpDIS->rcItem.bottom, - isSelected); - } - - // draw the bitmap - wxDCTemp dst((WXHDC)hDC); - dst.DrawBitmap(*bitmap, x1, y1, true); - - // draw focus / disabled state, if auto-drawing - if ( (state & ODS_DISABLED) && autoDraw ) - { - DrawButtonDisable((WXHDC) hDC, - lpDIS->rcItem.left, lpDIS->rcItem.top, - lpDIS->rcItem.right, lpDIS->rcItem.bottom, - true); - } - else if ( (state & ODS_FOCUS) && autoDraw ) - { - DrawButtonFocus((WXHDC) hDC, - lpDIS->rcItem.left, - lpDIS->rcItem.top, - lpDIS->rcItem.right, - lpDIS->rcItem.bottom, - isSelected); - } - - return true; -} - -// GRG Feb/2000, support for bmp buttons with Win95/98 standard LNF - -void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, - int right, int bottom, bool sel ) -{ - HPEN oldp; - HPEN penHiLight; - HPEN penLight; - HPEN penShadow; - HPEN penDkShadow; - HBRUSH brushFace; - - // create needed pens and brush - penHiLight = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DHILIGHT)); - penLight = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DLIGHT)); - penShadow = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DSHADOW)); - penDkShadow = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW)); - brushFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - - // draw the rectangle - RECT rect; - rect.left = left; - rect.right = right; - rect.top = top; - rect.bottom = bottom; - FillRect((HDC) dc, &rect, brushFace); - - // draw the border - oldp = (HPEN) SelectObject( (HDC) dc, sel? penDkShadow : penHiLight); - - wxDrawLine((HDC) dc, left, top, right-1, top); - wxDrawLine((HDC) dc, left, top+1, left, bottom-1); - - SelectObject( (HDC) dc, sel? penShadow : penLight); - wxDrawLine((HDC) dc, left+1, top+1, right-2, top+1); - wxDrawLine((HDC) dc, left+1, top+2, left+1, bottom-2); - - SelectObject( (HDC) dc, sel? penLight : penShadow); - wxDrawLine((HDC) dc, left+1, bottom-2, right-1, bottom-2); - wxDrawLine((HDC) dc, right-2, bottom-3, right-2, top); - - SelectObject( (HDC) dc, sel? penHiLight : penDkShadow); - wxDrawLine((HDC) dc, left, bottom-1, right+2, bottom-1); - wxDrawLine((HDC) dc, right-1, bottom-2, right-1, top-1); - - // delete allocated resources - SelectObject((HDC) dc,oldp); - DeleteObject(penHiLight); - DeleteObject(penLight); - DeleteObject(penShadow); - DeleteObject(penDkShadow); - DeleteObject(brushFace); -} - -void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, - int bottom, bool WXUNUSED(sel) ) -{ - RECT rect; - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; - InflateRect( &rect, - FOCUS_MARGIN, - FOCUS_MARGIN ); - - // GRG: the focus rectangle should not move when the button is pushed! -/* - if ( sel ) - OffsetRect( &rect, 1, 1 ); -*/ - - DrawFocusRect( (HDC) dc, &rect ); -} - -void -wxBitmapButton::DrawButtonDisable( WXHDC dc, - int left, int top, int right, int bottom, - bool with_marg ) -{ - if ( !m_brushDisabled.Ok() ) - { - // draw a bitmap with two black and two background colour pixels - wxBitmap bmp(2, 2); - wxMemoryDC dc; - dc.SelectObject(bmp); - dc.SetPen(*wxBLACK_PEN); - dc.DrawPoint(0, 0); - dc.DrawPoint(1, 1); - dc.SetPen(GetBackgroundColour()); - dc.DrawPoint(0, 1); - dc.DrawPoint(1, 0); - - m_brushDisabled = wxBrush(bmp); - } - - SelectInHDC selectBrush((HDC)dc, GetHbrushOf(m_brushDisabled)); - - // ROP for "dest |= pattern" operation -- as it doesn't have a standard - // name, give it our own - static const DWORD PATTERNPAINT = 0xFA0089UL; - - if ( with_marg ) - { - left += m_marginX; - top += m_marginY; - right -= 2 * m_marginX; - bottom -= 2 * m_marginY; - } - - ::PatBlt( (HDC) dc, left, top, right, bottom, PATTERNPAINT); -} - -void wxBitmapButton::SetDefault() -{ - wxButton::SetDefault(); -} - -wxSize wxBitmapButton::DoGetBestSize() const -{ - if ( m_bmpNormal.Ok() ) - { - int width = m_bmpNormal.GetWidth(), - height = m_bmpNormal.GetHeight(); - int marginH = 0, - marginV = 0; - -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON"); - - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, - BP_PUSHBUTTON, PBS_NORMAL, - TMT_CONTENTMARGINS, NULL, - &margins); - - // XP doesn't draw themed buttons correctly when the client area is - // smaller than 8x8 - enforce this minimum size for small bitmaps - if ( width < 8 ) - width = 8; - if ( height < 8 ) - height = 8; - - // don't add margins for the borderless buttons, they don't need - // them and it just makes them appear larger than needed - if ( !HasFlag(wxBORDER_NONE) ) - { - // we need 2 extra pixels for the focus rectangle, without them - // it's overwritten by the bitmap itself - marginH = margins.cxLeftWidth + margins.cxRightWidth + 2; - marginV = margins.cyTopHeight + margins.cyBottomHeight + 2; - } - } - else -#endif // wxUSE_UXTHEME - { - if ( !HasFlag(wxBORDER_NONE) ) - { - marginH = 2*m_marginX; - marginV = 2*m_marginY; - } - } - - wxSize best(width + marginH, height + marginV); - CacheBestSize(best); - return best; - } - - // no idea what our best size should be, defer to the base class - return wxBitmapButtonBase::DoGetBestSize(); -} - -#endif // wxUSE_BMPBUTTON diff --git a/Source/3rdParty/wx/src/msw/brush.cpp b/Source/3rdParty/wx/src/msw/brush.cpp deleted file mode 100644 index ac03729cb..000000000 --- a/Source/3rdParty/wx/src/msw/brush.cpp +++ /dev/null @@ -1,327 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/brush.cpp -// Purpose: wxBrush -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: brush.cpp 42776 2006-10-30 22:03:53Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/brush.h" - -#ifndef WX_PRECOMP - #include "wx/list.h" - #include "wx/utils.h" - #include "wx/app.h" -#endif // WX_PRECOMP - -#include "wx/msw/private.h" - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBrushRefData: public wxGDIRefData -{ -public: - wxBrushRefData(const wxColour& colour = wxNullColour, int style = wxSOLID); - wxBrushRefData(const wxBitmap& stipple); - wxBrushRefData(const wxBrushRefData& data); - virtual ~wxBrushRefData(); - - bool operator==(const wxBrushRefData& data) const; - - HBRUSH GetHBRUSH(); - void Free(); - - const wxColour& GetColour() const { return m_colour; } - int GetStyle() const { return m_style; } - wxBitmap *GetStipple() { return &m_stipple; } - - void SetColour(const wxColour& colour) { Free(); m_colour = colour; } - void SetStyle(int style) { Free(); m_style = style; } - void SetStipple(const wxBitmap& stipple) { Free(); DoSetStipple(stipple); } - -private: - void DoSetStipple(const wxBitmap& stipple); - - int m_style; - wxBitmap m_stipple; - wxColour m_colour; - HBRUSH m_hBrush; - - // no assignment operator, the objects of this class are shared and never - // assigned after being created once - wxBrushRefData& operator=(const wxBrushRefData&); -}; - -#define M_BRUSHDATA ((wxBrushRefData *)m_refData) - -// ============================================================================ -// wxBrushRefData implementation -// ============================================================================ - -IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) - -// ---------------------------------------------------------------------------- -// wxBrushRefData ctors/dtor -// ---------------------------------------------------------------------------- - -wxBrushRefData::wxBrushRefData(const wxColour& colour, int style) - : m_colour(colour) -{ - m_style = style; - - m_hBrush = NULL; -} - -wxBrushRefData::wxBrushRefData(const wxBitmap& stipple) -{ - DoSetStipple(stipple); - - m_hBrush = NULL; -} - -wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) - : wxGDIRefData(), - m_stipple(data.m_stipple), - m_colour(data.m_colour) -{ - m_style = data.m_style; - - // we can't share HBRUSH, we'd need to create another one ourselves - m_hBrush = NULL; -} - -wxBrushRefData::~wxBrushRefData() -{ - Free(); -} - -// ---------------------------------------------------------------------------- -// wxBrushRefData accesors -// ---------------------------------------------------------------------------- - -bool wxBrushRefData::operator==(const wxBrushRefData& data) const -{ - // don't compare HBRUSHes - return m_style == data.m_style && - m_colour == data.m_colour && - m_stipple.IsSameAs(data.m_stipple); -} - -void wxBrushRefData::DoSetStipple(const wxBitmap& stipple) -{ - m_stipple = stipple; - m_style = stipple.GetMask() ? wxSTIPPLE_MASK_OPAQUE : wxSTIPPLE; -} - -// ---------------------------------------------------------------------------- -// wxBrushRefData resource handling -// ---------------------------------------------------------------------------- - -void wxBrushRefData::Free() -{ - if ( m_hBrush ) - { - ::DeleteObject(m_hBrush); - - m_hBrush = NULL; - } -} - -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - -static int TranslateHatchStyle(int style) -{ - switch ( style ) - { - case wxBDIAGONAL_HATCH: return HS_BDIAGONAL; - case wxCROSSDIAG_HATCH: return HS_DIAGCROSS; - case wxFDIAGONAL_HATCH: return HS_FDIAGONAL; - case wxCROSS_HATCH: return HS_CROSS; - case wxHORIZONTAL_HATCH:return HS_HORIZONTAL; - case wxVERTICAL_HATCH: return HS_VERTICAL; - default: return -1; - } -} - -#endif // !__WXMICROWIN__ && !__WXWINCE__ - -HBRUSH wxBrushRefData::GetHBRUSH() -{ - if ( !m_hBrush ) - { -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - int hatchStyle = TranslateHatchStyle(m_style); - if ( hatchStyle == -1 ) -#endif // !__WXMICROWIN__ && !__WXWINCE__ - { - switch ( m_style ) - { - case wxTRANSPARENT: - m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH); - break; - - case wxSTIPPLE: - m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple)); - break; - - case wxSTIPPLE_MASK_OPAQUE: - m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask() - ->GetMaskBitmap()); - break; - - default: - wxFAIL_MSG( _T("unknown brush style") ); - // fall through - - case wxSOLID: - m_hBrush = ::CreateSolidBrush(m_colour.GetPixel()); - break; - } - } -#ifndef __WXWINCE__ - else // create a hatched brush - { - m_hBrush = ::CreateHatchBrush(hatchStyle, m_colour.GetPixel()); - } -#endif - - if ( !m_hBrush ) - { - wxLogLastError(_T("CreateXXXBrush()")); - } - } - - return m_hBrush; -} - -// ============================================================================ -// wxBrush implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxBrush ctors/dtor -// ---------------------------------------------------------------------------- - -wxBrush::wxBrush() -{ -} - -wxBrush::wxBrush(const wxColour& col, int style) -{ - m_refData = new wxBrushRefData(col, style); -} - -wxBrush::wxBrush(const wxBitmap& stipple) -{ - m_refData = new wxBrushRefData(stipple); -} - -wxBrush::~wxBrush() -{ -} - -// ---------------------------------------------------------------------------- -// wxBrush house keeping stuff -// ---------------------------------------------------------------------------- - -bool wxBrush::operator==(const wxBrush& brush) const -{ - const wxBrushRefData *brushData = (wxBrushRefData *)brush.m_refData; - - // an invalid brush is considered to be only equal to another invalid brush - return m_refData ? (brushData && *M_BRUSHDATA == *brushData) : !brushData; -} - -wxObjectRefData *wxBrush::CreateRefData() const -{ - return new wxBrushRefData; -} - -wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const -{ - return new wxBrushRefData(*(const wxBrushRefData *)data); -} - -// ---------------------------------------------------------------------------- -// wxBrush accessors -// ---------------------------------------------------------------------------- - -wxColour wxBrush::GetColour() const -{ - wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") ); - - return M_BRUSHDATA->GetColour(); -} - -int wxBrush::GetStyle() const -{ - wxCHECK_MSG( Ok(), 0, _T("invalid brush") ); - - return M_BRUSHDATA->GetStyle(); -} - -wxBitmap *wxBrush::GetStipple() const -{ - wxCHECK_MSG( Ok(), NULL, _T("invalid brush") ); - - return M_BRUSHDATA->GetStipple(); -} - -WXHANDLE wxBrush::GetResourceHandle() const -{ - wxCHECK_MSG( Ok(), FALSE, _T("invalid brush") ); - - return (WXHANDLE)M_BRUSHDATA->GetHBRUSH(); -} - -// ---------------------------------------------------------------------------- -// wxBrush setters -// ---------------------------------------------------------------------------- - -void wxBrush::SetColour(const wxColour& col) -{ - AllocExclusive(); - - M_BRUSHDATA->SetColour(col); -} - -void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) -{ - AllocExclusive(); - - M_BRUSHDATA->SetColour(wxColour(r, g, b)); -} - -void wxBrush::SetStyle(int style) -{ - AllocExclusive(); - - M_BRUSHDATA->SetStyle(style); -} - -void wxBrush::SetStipple(const wxBitmap& stipple) -{ - AllocExclusive(); - - M_BRUSHDATA->SetStipple(stipple); -} diff --git a/Source/3rdParty/wx/src/msw/button.cpp b/Source/3rdParty/wx/src/msw/button.cpp deleted file mode 100644 index 635e4b926..000000000 --- a/Source/3rdParty/wx/src/msw/button.cpp +++ /dev/null @@ -1,890 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/button.cpp -// Purpose: wxButton -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: button.cpp 51575 2008-02-06 19:58:30Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BUTTON - -#include "wx/button.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/brush.h" - #include "wx/panel.h" - #include "wx/bmpbuttn.h" - #include "wx/settings.h" - #include "wx/dcscreen.h" - #include "wx/dcclient.h" - #include "wx/toplevel.h" -#endif - -#include "wx/stockitem.h" -#include "wx/tokenzr.h" -#include "wx/msw/private.h" - -#if wxUSE_UXTHEME - #include "wx/msw/uxtheme.h" - - // no need to include tmschema.h - #ifndef BP_PUSHBUTTON - #define BP_PUSHBUTTON 1 - - #define PBS_NORMAL 1 - #define PBS_HOT 2 - #define PBS_PRESSED 3 - #define PBS_DISABLED 4 - #define PBS_DEFAULTED 5 - - #define TMT_CONTENTMARGINS 3602 - #endif -#endif // wxUSE_UXTHEME - -#ifndef WM_THEMECHANGED - #define WM_THEMECHANGED 0x031A -#endif - -#ifndef ODS_NOACCEL - #define ODS_NOACCEL 0x0100 -#endif - -#ifndef ODS_NOFOCUSRECT - #define ODS_NOFOCUSRECT 0x0200 -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -#if wxUSE_EXTENDED_RTTI - -WX_DEFINE_FLAGS( wxButtonStyle ) - -wxBEGIN_FLAGS( wxButtonStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxBU_LEFT) - wxFLAGS_MEMBER(wxBU_RIGHT) - wxFLAGS_MEMBER(wxBU_TOP) - wxFLAGS_MEMBER(wxBU_BOTTOM) - wxFLAGS_MEMBER(wxBU_EXACTFIT) -wxEND_FLAGS( wxButtonStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") - -wxBEGIN_PROPERTIES_TABLE(wxButton) - wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent) - - wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) - - wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style - -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxButton) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) - - -#else -IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) -#endif - -// this macro tries to adjust the default button height to a reasonable value -// using the char height as the base -#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// creation/destruction -// ---------------------------------------------------------------------------- - -bool wxButton::Create(wxWindow *parent, - wxWindowID id, - const wxString& lbl, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - wxString label(lbl); - if (label.empty() && wxIsStockID(id)) - { - // On Windows, some buttons aren't supposed to have - // mnemonics, so strip them out. - - label = wxGetStockLabel(id -#if defined(__WXMSW__) || defined(__WXWINCE__) - , ( id != wxID_OK && - id != wxID_CANCEL && - id != wxID_CLOSE ) -#endif - ); - } - - if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return false; - - WXDWORD exstyle; - WXDWORD msStyle = MSWGetStyle(style, &exstyle); - -#ifdef __WIN32__ - // if the label contains several lines we must explicitly tell the button - // about it or it wouldn't draw it correctly ("\n"s would just appear as - // black boxes) - // - // NB: we do it here and not in MSWGetStyle() because we need the label - // value and m_label is not set yet when MSWGetStyle() is called; - // besides changing BS_MULTILINE during run-time is pointless anyhow - if ( label.find(_T('\n')) != wxString::npos ) - { - msStyle |= BS_MULTILINE; - } -#endif // __WIN32__ - - return MSWCreateControl(_T("BUTTON"), msStyle, pos, size, label, exstyle); -} - -wxButton::~wxButton() -{ - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw && tlw->GetTmpDefaultItem() == this ) - { - UnsetTmpDefault(); - } -} - -// ---------------------------------------------------------------------------- -// flags -// ---------------------------------------------------------------------------- - -WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - // buttons never have an external border, they draw their own one - WXDWORD msStyle = wxControl::MSWGetStyle - ( - (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle - ); - - // we must use WS_CLIPSIBLINGS with the buttons or they would draw over - // each other in any resizeable dialog which has more than one button in - // the bottom - msStyle |= WS_CLIPSIBLINGS; - -#ifdef __WIN32__ - // don't use "else if" here: weird as it is, but you may combine wxBU_LEFT - // and wxBU_RIGHT to get BS_CENTER! - if ( style & wxBU_LEFT ) - msStyle |= BS_LEFT; - if ( style & wxBU_RIGHT ) - msStyle |= BS_RIGHT; - if ( style & wxBU_TOP ) - msStyle |= BS_TOP; - if ( style & wxBU_BOTTOM ) - msStyle |= BS_BOTTOM; -#ifndef __WXWINCE__ - // flat 2d buttons - if ( style & wxNO_BORDER ) - msStyle |= BS_FLAT; -#endif // __WXWINCE__ -#endif // __WIN32__ - - return msStyle; -} - -// ---------------------------------------------------------------------------- -// size management including autosizing -// ---------------------------------------------------------------------------- - -wxSize wxButton::DoGetBestSize() const -{ - wxClientDC dc(wx_const_cast(wxButton *, this)); - dc.SetFont(GetFont()); - - wxCoord wBtn, - hBtn; - dc.GetMultiLineTextExtent(GetLabelText(), &wBtn, &hBtn); - - // add a margin -- the button is wider than just its label - wBtn += 3*GetCharWidth(); - hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hBtn); - - // all buttons have at least the standard size unless the user explicitly - // wants them to be of smaller size and used wxBU_EXACTFIT style when - // creating the button - if ( !HasFlag(wxBU_EXACTFIT) ) - { - wxSize sz = GetDefaultSize(); - if (wBtn > sz.x) - sz.x = wBtn; - if (hBtn > sz.y) - sz.y = hBtn; - - return sz; - } - - wxSize best(wBtn, hBtn); - CacheBestSize(best); - return best; -} - -/* static */ -wxSize wxButtonBase::GetDefaultSize() -{ - static wxSize s_sizeBtn; - - if ( s_sizeBtn.x == 0 ) - { - wxScreenDC dc; - dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - - // the size of a standard button in the dialog units is 50x14, - // translate this to pixels - // NB1: the multipliers come from the Windows convention - // NB2: the extra +1/+2 were needed to get the size be the same as the - // size of the buttons in the standard dialog - I don't know how - // this happens, but on my system this size is 75x23 in pixels and - // 23*8 isn't even divisible by 14... Would be nice to understand - // why these constants are needed though! - s_sizeBtn.x = (50 * (dc.GetCharWidth() + 1))/4; - s_sizeBtn.y = ((14 * dc.GetCharHeight()) + 2)/8; - } - - return s_sizeBtn; -} - -// ---------------------------------------------------------------------------- -// default button handling -// ---------------------------------------------------------------------------- - -/* - "Everything you ever wanted to know about the default buttons" or "Why do we - have to do all this?" - - In MSW the default button should be activated when the user presses Enter - and the current control doesn't process Enter itself somehow. This is - handled by ::DefWindowProc() (or maybe ::DefDialogProc()) using DM_SETDEFID - Another aspect of "defaultness" is that the default button has different - appearance: this is due to BS_DEFPUSHBUTTON style which is completely - separate from DM_SETDEFID stuff (!). Also note that BS_DEFPUSHBUTTON should - be unset if our parent window is not active so it should be unset whenever - we lose activation and set back when we regain it. - - Final complication is that when a button is active, it should be the default - one, i.e. pressing Enter on a button always activates it and not another - one. - - We handle this by maintaining a permanent and a temporary default items in - wxControlContainer (both may be NULL). When a button becomes the current - control (i.e. gets focus) it sets itself as the temporary default which - ensures that it has the right appearance and that Enter will be redirected - to it. When the button loses focus, it unsets the temporary default and so - the default item will be the permanent default -- that is the default button - if any had been set or none otherwise, which is just what we want. - - NB: all this is quite complicated by now and the worst is that normally - it shouldn't be necessary at all as for the normal Windows programs - DefWindowProc() and IsDialogMessage() take care of all this - automatically -- however in wxWidgets programs this doesn't work for - nested hierarchies (i.e. a notebook inside a notebook) for unknown - reason and so we have to reproduce all this code ourselves. It would be - very nice if we could avoid doing it. - */ - -// set this button as the (permanently) default one in its panel -void wxButton::SetDefault() -{ - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - - wxCHECK_RET( tlw, _T("button without top level window?") ); - - // set this one as the default button both for wxWidgets ... - wxWindow *winOldDefault = tlw->SetDefaultItem(this); - - // ... and Windows - SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); - SetDefaultStyle(this, true); -} - -// return the top level parent window if it's not being deleted yet, otherwise -// return NULL -static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) -{ - for ( ;; ) - { - // IsTopLevel() will return false for a wxTLW being deleted, so we also - // need the parent test for this case - wxWindow * const parent = win->GetParent(); - if ( !parent || win->IsTopLevel() ) - { - if ( win->IsBeingDeleted() ) - return NULL; - - break; - } - - win = parent; - } - - wxASSERT_MSG( win, _T("button without top level parent?") ); - - wxTopLevelWindow * const tlw = wxDynamicCast(win, wxTopLevelWindow); - wxASSERT_MSG( tlw, _T("logic error in GetTLWParentIfNotBeingDeleted()") ); - - return tlw; -} - -// set this button as being currently default -void wxButton::SetTmpDefault() -{ - wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent()); - if ( !tlw ) - return; - - wxWindow *winOldDefault = tlw->GetDefaultItem(); - tlw->SetTmpDefaultItem(this); - - SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); - SetDefaultStyle(this, true); -} - -// unset this button as currently default, it may still stay permanent default -void wxButton::UnsetTmpDefault() -{ - wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent()); - if ( !tlw ) - return; - - tlw->SetTmpDefaultItem(NULL); - - wxWindow *winOldDefault = tlw->GetDefaultItem(); - - SetDefaultStyle(this, false); - SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), true); -} - -/* static */ -void -wxButton::SetDefaultStyle(wxButton *btn, bool on) -{ - // we may be called with NULL pointer -- simpler to do the check here than - // in the caller which does wxDynamicCast() - if ( !btn ) - return; - - // first, let DefDlgProc() know about the new default button - if ( on ) - { - // we shouldn't set BS_DEFPUSHBUTTON for any button if we don't have - // focus at all any more - if ( !wxTheApp->IsActive() ) - return; - - wxWindow * const tlw = wxGetTopLevelParent(btn); - wxCHECK_RET( tlw, _T("button without top level window?") ); - - ::SendMessage(GetHwndOf(tlw), DM_SETDEFID, btn->GetId(), 0L); - - // sending DM_SETDEFID also changes the button style to - // BS_DEFPUSHBUTTON so there is nothing more to do - } - - // then also change the style as needed - long style = ::GetWindowLong(GetHwndOf(btn), GWL_STYLE); - if ( !(style & BS_DEFPUSHBUTTON) == on ) - { - // don't do it with the owner drawn buttons because it will - // reset BS_OWNERDRAW style bit too (as BS_OWNERDRAW & - // BS_DEFPUSHBUTTON != 0)! - if ( (style & BS_OWNERDRAW) != BS_OWNERDRAW ) - { - ::SendMessage(GetHwndOf(btn), BM_SETSTYLE, - on ? style | BS_DEFPUSHBUTTON - : style & ~BS_DEFPUSHBUTTON, - 1L /* redraw */); - } - else // owner drawn - { - // redraw the button - it will notice itself that it's - // [not] the default one [any longer] - btn->Refresh(); - } - } - //else: already has correct style -} - -// ---------------------------------------------------------------------------- -// helpers -// ---------------------------------------------------------------------------- - -bool wxButton::SendClickEvent() -{ - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); - event.SetEventObject(this); - - return ProcessCommand(event); -} - -void wxButton::Command(wxCommandEvent & event) -{ - ProcessCommand(event); -} - -// ---------------------------------------------------------------------------- -// event/message handlers -// ---------------------------------------------------------------------------- - -bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) -{ - bool processed = false; - switch ( param ) - { - // NOTE: Apparently older versions (NT 4?) of the common controls send - // BN_DOUBLECLICKED but not a second BN_CLICKED for owner-drawn - // buttons, so in order to send two EVT_BUTTON events we should - // catch both types. Currently (Feb 2003) up-to-date versions of - // win98, win2k and winXP all send two BN_CLICKED messages for - // all button types, so we don't catch BN_DOUBLECLICKED anymore - // in order to not get 3 EVT_BUTTON events. If this is a problem - // then we need to figure out which version of the comctl32 changed - // this behaviour and test for it. - - case 1: // message came from an accelerator - case BN_CLICKED: // normal buttons send this - processed = SendClickEvent(); - break; - } - - return processed; -} - -WXLRESULT wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - // when we receive focus, we want to temporarily become the default button in - // our parent panel so that pressing "Enter" would activate us -- and when - // losing it we should restore the previous default button as well - if ( nMsg == WM_SETFOCUS ) - { - SetTmpDefault(); - - // let the default processing take place too - } - else if ( nMsg == WM_KILLFOCUS ) - { - UnsetTmpDefault(); - } - else if ( nMsg == WM_LBUTTONDBLCLK ) - { - // emulate a click event to force an owner-drawn button to change its - // appearance - without this, it won't do it - (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); - - // and continue with processing the message normally as well - } -#if wxUSE_UXTHEME - else if ( nMsg == WM_THEMECHANGED ) - { - // need to recalculate the best size here - // as the theme size might have changed - InvalidateBestSize(); - } - else if ( wxUxThemeEngine::GetIfActive() ) - { - // we need to Refresh() if mouse has entered or left window - // so we can update the hot tracking state - // must use m_mouseInWindow here instead of IsMouseInWindow() - // since we need to know the first time the mouse enters the window - // and IsMouseInWindow() would return true in this case - if ( ( nMsg == WM_MOUSEMOVE && !m_mouseInWindow ) || - nMsg == WM_MOUSELEAVE ) - { - Refresh(); - } - } -#endif // wxUSE_UXTHEME - - // let the base class do all real processing - return wxControl::MSWWindowProc(nMsg, wParam, lParam); -} - -// ---------------------------------------------------------------------------- -// owner-drawn buttons support -// ---------------------------------------------------------------------------- - -#ifdef __WIN32__ - -// drawing helpers - -static void DrawButtonText(HDC hdc, - RECT *pRect, - const wxString& text, - COLORREF col) -{ - COLORREF colOld = SetTextColor(hdc, col); - int modeOld = SetBkMode(hdc, TRANSPARENT); - - if ( text.find(_T('\n')) != wxString::npos ) - { - // draw multiline label - - // first we need to compute its bounding rect - RECT rc; - ::CopyRect(&rc, pRect); - ::DrawText(hdc, text, text.length(), &rc, DT_CENTER | DT_CALCRECT); - - // now center this rect inside the entire button area - const LONG w = rc.right - rc.left; - const LONG h = rc.bottom - rc.top; - rc.left = (pRect->right - pRect->left)/2 - w/2; - rc.right = rc.left+w; - rc.top = (pRect->bottom - pRect->top)/2 - h/2; - rc.bottom = rc.top+h; - - ::DrawText(hdc, text, text.length(), &rc, DT_CENTER); - } - else // single line label - { - // Note: we must have DT_SINGLELINE for DT_VCENTER to work. - ::DrawText(hdc, text, text.length(), pRect, - DT_SINGLELINE | DT_CENTER | DT_VCENTER); - } - - SetBkMode(hdc, modeOld); - SetTextColor(hdc, colOld); -} - -static void DrawRect(HDC hdc, const RECT& r) -{ - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - wxDrawLine(hdc, r.right, r.top, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom); - wxDrawLine(hdc, r.left, r.bottom, r.left, r.top); -} - -void wxButton::MakeOwnerDrawn() -{ - long style = GetWindowLong(GetHwnd(), GWL_STYLE); - if ( (style & BS_OWNERDRAW) != BS_OWNERDRAW ) - { - // make it so - style |= BS_OWNERDRAW; - SetWindowLong(GetHwnd(), GWL_STYLE, style); - } -} - -bool wxButton::SetBackgroundColour(const wxColour &colour) -{ - if ( !wxControl::SetBackgroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -bool wxButton::SetForegroundColour(const wxColour &colour) -{ - if ( !wxControl::SetForegroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -/* - The button frame looks like this normally: - - WWWWWWWWWWWWWWWWWWB - WHHHHHHHHHHHHHHHHGB W = white (HILIGHT) - WH GB H = light grey (LIGHT) - WH GB G = dark grey (SHADOW) - WH GB B = black (DKSHADOW) - WH GB - WGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB - - When the button is selected, the button becomes like this (the total button - size doesn't change): - - BBBBBBBBBBBBBBBBBBB - BWWWWWWWWWWWWWWWWBB - BWHHHHHHHHHHHHHHGBB - BWH GBB - BWH GBB - BWGGGGGGGGGGGGGGGBB - BBBBBBBBBBBBBBBBBBB - BBBBBBBBBBBBBBBBBBB - - When the button is pushed (while selected) it is like: - - BBBBBBBBBBBBBBBBBBB - BGGGGGGGGGGGGGGGGGB - BG GB - BG GB - BG GB - BG GB - BGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB -*/ - -static void DrawButtonFrame(HDC hdc, const RECT& rectBtn, - bool selected, bool pushed) -{ - RECT r; - CopyRect(&r, &rectBtn); - - HPEN hpenBlack = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW)), - hpenGrey = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)), - hpenLightGr = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)), - hpenWhite = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT)); - - HPEN hpenOld = (HPEN)SelectObject(hdc, hpenBlack); - - r.right--; - r.bottom--; - - if ( pushed ) - { - DrawRect(hdc, r); - - (void)SelectObject(hdc, hpenGrey); - ::InflateRect(&r, -1, -1); - - DrawRect(hdc, r); - } - else // !pushed - { - if ( selected ) - { - DrawRect(hdc, r); - - ::InflateRect(&r, -1, -1); - } - - wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1); - - (void)SelectObject(hdc, hpenWhite); - wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top); - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - - (void)SelectObject(hdc, hpenLightGr); - wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1); - wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1); - - (void)SelectObject(hdc, hpenGrey); - wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1); - wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top); - } - - (void)SelectObject(hdc, hpenOld); - DeleteObject(hpenWhite); - DeleteObject(hpenLightGr); - DeleteObject(hpenGrey); - DeleteObject(hpenBlack); -} - -#if wxUSE_UXTHEME -static -void MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis) -{ - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; - HDC hdc = lpDIS->hDC; - UINT state = lpDIS->itemState; - RECT rectBtn; - CopyRect(&rectBtn, &lpDIS->rcItem); - - wxUxThemeHandle theme(button, L"BUTTON"); - int iState; - - if ( state & ODS_SELECTED ) - { - iState = PBS_PRESSED; - } - else if ( button->HasCapture() || button->IsMouseInWindow() ) - { - iState = PBS_HOT; - } - else if ( state & ODS_FOCUS ) - { - iState = PBS_DEFAULTED; - } - else if ( state & ODS_DISABLED ) - { - iState = PBS_DISABLED; - } - else - { - iState = PBS_NORMAL; - } - - // draw parent background if needed - if ( wxUxThemeEngine::Get()->IsThemeBackgroundPartiallyTransparent(theme, - BP_PUSHBUTTON, - iState) ) - { - wxUxThemeEngine::Get()->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); - } - - // draw background - wxUxThemeEngine::Get()->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, - &rectBtn, NULL); - - // calculate content area margins - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, - TMT_CONTENTMARGINS, &rectBtn, &margins); - RECT rectClient; - ::CopyRect(&rectClient, &rectBtn); - ::InflateRect(&rectClient, -margins.cxLeftWidth, -margins.cyTopHeight); - - // if focused and !nofocus rect - if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) - { - DrawFocusRect(hdc, &rectClient); - } - - if ( button->UseBgCol() ) - { - COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); - HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); - - // don't overwrite the focus rect - ::InflateRect(&rectClient, -1, -1); - FillRect(hdc, &rectClient, hbrushBackground); - ::DeleteObject(hbrushBackground); - } -} -#endif // wxUSE_UXTHEME - -bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) -{ - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; - HDC hdc = lpDIS->hDC; - UINT state = lpDIS->itemState; - RECT rectBtn; - CopyRect(&rectBtn, &lpDIS->rcItem); - -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - MSWDrawXPBackground(this, wxdis); - } - else -#endif // wxUSE_UXTHEME - { - COLORREF colBg = wxColourToRGB(GetBackgroundColour()); - - // first, draw the background - HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); - FillRect(hdc, &rectBtn, hbrushBackground); - ::DeleteObject(hbrushBackground); - - // draw the border for the current state - bool selected = (state & ODS_SELECTED) != 0; - if ( !selected ) - { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw ) - { - selected = tlw->GetDefaultItem() == this; - } - } - bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; - - DrawButtonFrame(hdc, rectBtn, selected, pushed); - - // if focused and !nofocus rect - if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) - { - RECT rectFocus; - CopyRect(&rectFocus, &rectBtn); - - // I don't know where does this constant come from, but this is how - // Windows draws them - InflateRect(&rectFocus, -4, -4); - - DrawFocusRect(hdc, &rectFocus); - } - - if ( pushed ) - { - // the label is shifted by 1 pixel to create "pushed" effect - OffsetRect(&rectBtn, 1, 1); - } - } - - COLORREF colFg = wxColourToRGB(GetForegroundColour()); - if ( state & ODS_DISABLED ) colFg = GetSysColor(COLOR_GRAYTEXT) ; - wxString label = GetLabel(); - if ( state & ODS_NOACCEL ) label = GetLabelText() ; - DrawButtonText(hdc, &rectBtn, label, colFg); - - return true; -} - -#endif // __WIN32__ - -#endif // wxUSE_BUTTON diff --git a/Source/3rdParty/wx/src/msw/caret.cpp b/Source/3rdParty/wx/src/msw/caret.cpp deleted file mode 100644 index 9c43cdf61..000000000 --- a/Source/3rdParty/wx/src/msw/caret.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/caret.cpp -// Purpose: MSW implementation of wxCaret -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.05.99 -// RCS-ID: $Id: caret.cpp 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// declarations -// =========================================================================== - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/window.h" - #include "wx/log.h" -#endif // WX_PRECOMP - -#include "wx/caret.h" - -#if wxUSE_CARET - -#include "wx/msw/private.h" - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -#define CALL_CARET_API(api, args) \ - if ( !api args ) \ - wxLogLastError(_T(#api)) - -// =========================================================================== -// implementation -// =========================================================================== - -// --------------------------------------------------------------------------- -// blink time -// --------------------------------------------------------------------------- - -//static -int wxCaretBase::GetBlinkTime() -{ - int blinkTime = ::GetCaretBlinkTime(); - if ( !blinkTime ) - { - wxLogLastError(wxT("GetCaretBlinkTime")); - } - - return blinkTime; -} - -//static -void wxCaretBase::SetBlinkTime(int milliseconds) -{ - CALL_CARET_API(SetCaretBlinkTime, (milliseconds)); -} - -// --------------------------------------------------------------------------- -// creating/destroying the caret -// --------------------------------------------------------------------------- - -bool wxCaret::MSWCreateCaret() -{ - wxASSERT_MSG( GetWindow(), wxT("caret without window cannot be created") ); - wxASSERT_MSG( IsOk(), wxT("caret of zero size cannot be created") ); - - if ( !m_hasCaret ) - { - CALL_CARET_API(CreateCaret, (GetWinHwnd(GetWindow()), 0, - m_width, m_height)); - - m_hasCaret = true; - } - - return m_hasCaret; -} - -void wxCaret::OnSetFocus() -{ - if ( m_countVisible > 0 ) - { - if ( MSWCreateCaret() ) - { - // the caret was recreated but it doesn't remember its position and - // it's not shown - - DoMove(); - DoShow(); - } - } - //else: caret is invisible, don't waste time creating it -} - -void wxCaret::OnKillFocus() -{ - if ( m_hasCaret ) - { - m_hasCaret = false; - - CALL_CARET_API(DestroyCaret, ()); - } -} - -// --------------------------------------------------------------------------- -// showing/hiding the caret -// --------------------------------------------------------------------------- - -void wxCaret::DoShow() -{ - wxASSERT_MSG( GetWindow(), wxT("caret without window cannot be shown") ); - wxASSERT_MSG( IsOk(), wxT("caret of zero size cannot be shown") ); - - // we might not have created the caret yet if we had got the focus first - // and the caret was shown later - so do it now if we have the focus but - // not the caret - if ( !m_hasCaret && (wxWindow::FindFocus() == GetWindow()) ) - { - if ( MSWCreateCaret() ) - { - DoMove(); - } - } - - if ( m_hasCaret ) - { - CALL_CARET_API(ShowCaret, (GetWinHwnd(GetWindow()))); - } - //else: will be shown when we get the focus -} - -void wxCaret::DoHide() -{ - if ( m_hasCaret ) - { - CALL_CARET_API(HideCaret, (GetWinHwnd(GetWindow()))); - } -} - -// --------------------------------------------------------------------------- -// moving the caret -// --------------------------------------------------------------------------- - -void wxCaret::DoMove() -{ - if ( m_hasCaret ) - { - wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(), - wxT("how did we lose focus?") ); - - // for compatibility with the generic version, the coordinates are - // client ones - wxPoint pt = GetWindow()->GetClientAreaOrigin(); - CALL_CARET_API(SetCaretPos, (m_x + pt.x, m_y + pt.y)); - } - //else: we don't have caret right now, nothing to do (this does happen) -} - - -// --------------------------------------------------------------------------- -// resizing the caret -// --------------------------------------------------------------------------- - -void wxCaret::DoSize() -{ - if ( m_hasCaret ) - { - m_hasCaret = false; - CALL_CARET_API(DestroyCaret, ()); - MSWCreateCaret(); - OnSetFocus(); - } -} - -#endif diff --git a/Source/3rdParty/wx/src/msw/checkbox.cpp b/Source/3rdParty/wx/src/msw/checkbox.cpp deleted file mode 100644 index 550afd740..000000000 --- a/Source/3rdParty/wx/src/msw/checkbox.cpp +++ /dev/null @@ -1,588 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/checkbox.cpp -// Purpose: wxCheckBox -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: checkbox.cpp 40331 2006-07-25 18:47:39Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHECKBOX - -#include "wx/checkbox.h" - -#ifndef WX_PRECOMP - #include "wx/brush.h" - #include "wx/dcscreen.h" - #include "wx/settings.h" -#endif - -#include "wx/msw/uxtheme.h" -#include "wx/msw/private.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifndef BST_UNCHECKED - #define BST_UNCHECKED 0x0000 -#endif - -#ifndef BST_CHECKED - #define BST_CHECKED 0x0001 -#endif - -#ifndef BST_INDETERMINATE - #define BST_INDETERMINATE 0x0002 -#endif - -#ifndef DFCS_HOT - #define DFCS_HOT 0x1000 -#endif - -#ifndef DT_HIDEPREFIX - #define DT_HIDEPREFIX 0x00100000 -#endif - -#ifndef BP_CHECKBOX - #define BP_CHECKBOX 3 -#endif - -// these values are defined in tmschema.h (except the first one) -enum -{ - CBS_INVALID, - CBS_UNCHECKEDNORMAL, - CBS_UNCHECKEDHOT, - CBS_UNCHECKEDPRESSED, - CBS_UNCHECKEDDISABLED, - CBS_CHECKEDNORMAL, - CBS_CHECKEDHOT, - CBS_CHECKEDPRESSED, - CBS_CHECKEDDISABLED, - CBS_MIXEDNORMAL, - CBS_MIXEDHOT, - CBS_MIXEDPRESSED, - CBS_MIXEDDISABLED -}; - -// these are our own -enum -{ - CBS_HOT_OFFSET = 1, - CBS_PRESSED_OFFSET = 2, - CBS_DISABLED_OFFSET = 3 -}; - -// ============================================================================ -// implementation -// ============================================================================ - -#if wxUSE_EXTENDED_RTTI -WX_DEFINE_FLAGS( wxCheckBoxStyle ) - -wxBEGIN_FLAGS( wxCheckBoxStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxNO_BORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - -wxEND_FLAGS( wxCheckBoxStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") - -wxBEGIN_PROPERTIES_TABLE(wxCheckBox) - wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) - - wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxCheckBox) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) -#else -IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) -#endif - - -// ---------------------------------------------------------------------------- -// wxCheckBox creation -// ---------------------------------------------------------------------------- - -void wxCheckBox::Init() -{ - m_state = wxCHK_UNCHECKED; - m_isPressed = - m_isHot = false; -} - -bool wxCheckBox::Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& validator, - const wxString& name) -{ - Init(); - - if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return false; - - long msStyle = WS_TABSTOP; - - if ( style & wxCHK_3STATE ) - { - msStyle |= BS_3STATE; - } - else - { - wxASSERT_MSG( !Is3rdStateAllowedForUser(), - wxT("Using wxCH_ALLOW_3RD_STATE_FOR_USER") - wxT(" style flag for a 2-state checkbox is useless") ); - msStyle |= BS_CHECKBOX; - } - - if ( style & wxALIGN_RIGHT ) - { - msStyle |= BS_LEFTTEXT | BS_RIGHT; - } - - return MSWCreateControl(wxT("BUTTON"), msStyle, pos, size, label, 0); -} - -// ---------------------------------------------------------------------------- -// wxCheckBox geometry -// ---------------------------------------------------------------------------- - -wxSize wxCheckBox::DoGetBestSize() const -{ - static int s_checkSize = 0; - - if ( !s_checkSize ) - { - wxScreenDC dc; - dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - - s_checkSize = dc.GetCharHeight(); - } - - wxString str = wxGetWindowText(GetHWND()); - - int wCheckbox, hCheckbox; - if ( !str.empty() ) - { - GetTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox); - wCheckbox += s_checkSize + GetCharWidth(); - - if ( hCheckbox < s_checkSize ) - hCheckbox = s_checkSize; - } - else - { - wCheckbox = s_checkSize; - hCheckbox = s_checkSize; - } -#ifdef __WXWINCE__ - hCheckbox += 1; -#endif - - wxSize best(wCheckbox, hCheckbox); - CacheBestSize(best); - return best; -} - -// ---------------------------------------------------------------------------- -// wxCheckBox operations -// ---------------------------------------------------------------------------- - -void wxCheckBox::SetValue(bool val) -{ - Set3StateValue(val ? wxCHK_CHECKED : wxCHK_UNCHECKED); -} - -bool wxCheckBox::GetValue() const -{ - return Get3StateValue() != wxCHK_UNCHECKED; -} - -void wxCheckBox::Command(wxCommandEvent& event) -{ - int state = event.GetInt(); - wxCHECK_RET( (state == wxCHK_UNCHECKED) || (state == wxCHK_CHECKED) - || (state == wxCHK_UNDETERMINED), - wxT("event.GetInt() returned an invalid checkbox state") ); - - Set3StateValue((wxCheckBoxState) state); - ProcessCommand(event); -} - -wxCOMPILE_TIME_ASSERT(wxCHK_UNCHECKED == BST_UNCHECKED - && wxCHK_CHECKED == BST_CHECKED - && wxCHK_UNDETERMINED == BST_INDETERMINATE, EnumValuesIncorrect); - -void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) -{ - m_state = state; - if ( !IsOwnerDrawn() ) - ::SendMessage(GetHwnd(), BM_SETCHECK, (WPARAM) state, 0); - else // owner drawn buttons don't react to this message - Refresh(); -} - -wxCheckBoxState wxCheckBox::DoGet3StateValue() const -{ - return m_state; -} - -bool wxCheckBox::MSWCommand(WXUINT cmd, WXWORD WXUNUSED(id)) -{ - if ( cmd != BN_CLICKED && cmd != BN_DBLCLK ) - return false; - - // first update the value so that user event handler gets the new checkbox - // value - - // ownerdrawn buttons don't manage their state themselves unlike usual - // auto checkboxes so do it ourselves in any case - wxCheckBoxState state; - if ( Is3rdStateAllowedForUser() ) - { - state = (wxCheckBoxState)((m_state + 1) % 3); - } - else // 2 state checkbox (at least from users point of view) - { - // note that wxCHK_UNDETERMINED also becomes unchecked when clicked - state = m_state == wxCHK_UNCHECKED ? wxCHK_CHECKED : wxCHK_UNCHECKED; - } - - DoSet3StateValue(state); - - - // generate the event - wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId); - - event.SetInt(state); - event.SetEventObject(this); - ProcessCommand(event); - - return true; -} - -// ---------------------------------------------------------------------------- -// owner drawn checkboxes stuff -// ---------------------------------------------------------------------------- - -bool wxCheckBox::SetForegroundColour(const wxColour& colour) -{ - if ( !wxCheckBoxBase::SetForegroundColour(colour) ) - return false; - - // the only way to change the checkbox foreground colour under Windows XP - // is to owner draw it - if ( wxUxThemeEngine::GetIfActive() ) - MakeOwnerDrawn(colour.Ok()); - - return true; -} - -bool wxCheckBox::IsOwnerDrawn() const -{ - return - (::GetWindowLong(GetHwnd(), GWL_STYLE) & BS_OWNERDRAW) == BS_OWNERDRAW; -} - -void wxCheckBox::MakeOwnerDrawn(bool ownerDrawn) -{ - long style = ::GetWindowLong(GetHwnd(), GWL_STYLE); - - // note that BS_CHECKBOX & BS_OWNERDRAW != 0 so we can't operate on - // them as on independent style bits - if ( ownerDrawn ) - { - style &= ~(BS_CHECKBOX | BS_3STATE); - style |= BS_OWNERDRAW; - - Connect(wxEVT_ENTER_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Connect(wxEVT_LEAVE_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Connect(wxEVT_LEFT_UP, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - } - else // reset to default colour - { - style &= ~BS_OWNERDRAW; - style |= HasFlag(wxCHK_3STATE) ? BS_3STATE : BS_CHECKBOX; - - Disconnect(wxEVT_ENTER_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Disconnect(wxEVT_LEAVE_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - } - - ::SetWindowLong(GetHwnd(), GWL_STYLE, style); - - if ( !ownerDrawn ) - { - // ensure that controls state is consistent with internal state - DoSet3StateValue(m_state); - } -} - -void wxCheckBox::OnMouseEnterOrLeave(wxMouseEvent& event) -{ - m_isHot = event.GetEventType() == wxEVT_ENTER_WINDOW; - if ( !m_isHot ) - m_isPressed = false; - - Refresh(); - - event.Skip(); -} - -void wxCheckBox::OnMouseLeft(wxMouseEvent& event) -{ - // TODO: we should capture the mouse here to be notified about left up - // event but this interferes with BN_CLICKED generation so if we - // want to do this we'd need to generate them ourselves - m_isPressed = event.GetEventType() == wxEVT_LEFT_DOWN; - Refresh(); - - event.Skip(); -} - -void wxCheckBox::OnFocus(wxFocusEvent& event) -{ - Refresh(); - - event.Skip(); -} - -bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) -{ - DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)item; - - if ( !IsOwnerDrawn() || dis->CtlType != ODT_BUTTON ) - return wxCheckBoxBase::MSWOnDraw(item); - - // calculate the rectangles for the check mark itself and the label - HDC hdc = dis->hDC; - RECT& rect = dis->rcItem; - RECT rectCheck, - rectLabel; - rectCheck.top = - rectLabel.top = rect.top; - rectCheck.bottom = - rectLabel.bottom = rect.bottom; - const int checkSize = GetBestSize().y; - const int MARGIN = 3; - - const bool isRightAligned = HasFlag(wxALIGN_RIGHT); - if ( isRightAligned ) - { - rectCheck.right = rect.right; - rectCheck.left = rectCheck.right - checkSize; - - rectLabel.right = rectCheck.left - MARGIN; - rectLabel.left = rect.left; - } - else // normal, left-aligned checkbox - { - rectCheck.left = rect.left; - rectCheck.right = rectCheck.left + checkSize; - - rectLabel.left = rectCheck.right + MARGIN; - rectLabel.right = rect.right; - } - - // show we draw a focus rect? - const bool isFocused = m_isPressed || FindFocus() == this; - - - // draw the checkbox itself: note that this should really, really be in - // wxRendererNative but unfortunately we can't add a new virtual function - // to it without breaking backwards compatibility - - // classic Win32 version -- this can be useful when we move this into - // wxRendererNative -#if defined(__WXWINCE__) || !wxUSE_UXTHEME - UINT state = DFCS_BUTTONCHECK; - if ( !IsEnabled() ) - state |= DFCS_INACTIVE; - switch ( Get3StateValue() ) - { - case wxCHK_CHECKED: - state |= DFCS_CHECKED; - break; - - case wxCHK_UNDETERMINED: - state |= DFCS_PUSHED; - break; - - default: - wxFAIL_MSG( _T("unexpected Get3StateValue() return value") ); - // fall through - - case wxCHK_UNCHECKED: - // no extra styles needed - break; - } - - if ( wxFindWindowAtPoint(wxGetMousePosition()) == this ) - state |= DFCS_HOT; - - if ( !::DrawFrameControl(hdc, &rectCheck, DFC_BUTTON, state) ) - { - wxLogLastError(_T("DrawFrameControl(DFC_BUTTON)")); - } -#else // XP version - wxUxThemeEngine *themeEngine = wxUxThemeEngine::GetIfActive(); - if ( !themeEngine ) - return false; - - wxUxThemeHandle theme(this, L"BUTTON"); - if ( !theme ) - return false; - - int state; - switch ( Get3StateValue() ) - { - case wxCHK_CHECKED: - state = CBS_CHECKEDNORMAL; - break; - - case wxCHK_UNDETERMINED: - state = CBS_MIXEDNORMAL; - break; - - default: - wxFAIL_MSG( _T("unexpected Get3StateValue() return value") ); - // fall through - - case wxCHK_UNCHECKED: - state = CBS_UNCHECKEDNORMAL; - break; - } - - if ( !IsEnabled() ) - state += CBS_DISABLED_OFFSET; - else if ( m_isPressed ) - state += CBS_PRESSED_OFFSET; - else if ( m_isHot ) - state += CBS_HOT_OFFSET; - - HRESULT hr = themeEngine->DrawThemeBackground - ( - theme, - hdc, - BP_CHECKBOX, - state, - &rectCheck, - NULL - ); - if ( FAILED(hr) ) - { - wxLogApiError(_T("DrawThemeBackground(BP_CHECKBOX)"), hr); - } -#endif // 0/1 - - // draw the text - const wxString& label = GetLabel(); - - // first we need to measure it - UINT fmt = DT_NOCLIP; - - // drawing underlying doesn't look well with focus rect (and the native - // control doesn't do it) - if ( isFocused ) - fmt |= DT_HIDEPREFIX; - if ( isRightAligned ) - fmt |= DT_RIGHT; - // TODO: also use DT_HIDEPREFIX if the system is configured so - - // we need to get the label real size first if we have to draw a focus rect - // around it - if ( isFocused ) - { - if ( !::DrawText(hdc, label, label.length(), &rectLabel, - fmt | DT_CALCRECT) ) - { - wxLogLastError(_T("DrawText(DT_CALCRECT)")); - } - } - - if ( !IsEnabled() ) - { - ::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT)); - } - - if ( !::DrawText(hdc, label, label.length(), &rectLabel, fmt) ) - { - wxLogLastError(_T("DrawText()")); - } - - // finally draw the focus - if ( isFocused ) - { - rectLabel.left--; - rectLabel.right++; - if ( !::DrawFocusRect(hdc, &rectLabel) ) - { - wxLogLastError(_T("DrawFocusRect()")); - } - } - - return true; -} - -#endif // wxUSE_CHECKBOX diff --git a/Source/3rdParty/wx/src/msw/checklst.cpp b/Source/3rdParty/wx/src/msw/checklst.cpp deleted file mode 100644 index f01f5884d..000000000 --- a/Source/3rdParty/wx/src/msw/checklst.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/checklst.cpp -// Purpose: implementation of wxCheckListBox class -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.11.97 -// RCS-ID: $Id: checklst.cpp 62511 2009-10-30 14:11:03Z JMS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN - -#include "wx/checklst.h" - -#ifndef WX_PRECOMP - #include "wx/msw/wrapwin.h" - #include "wx/object.h" - #include "wx/colour.h" - #include "wx/font.h" - #include "wx/bitmap.h" - #include "wx/window.h" - #include "wx/listbox.h" - #include "wx/dcmemory.h" - #include "wx/settings.h" - #include "wx/log.h" -#endif - -#include "wx/ownerdrw.h" - -#include - -#include "wx/msw/private.h" - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -// get item (converted to right type) -#define GetItem(n) ((wxCheckListBoxItem *)(GetItem(n))) - -// ============================================================================ -// implementation -// ============================================================================ - - -#if wxUSE_EXTENDED_RTTI -WX_DEFINE_FLAGS( wxCheckListBoxStyle ) - -wxBEGIN_FLAGS( wxCheckListBoxStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxLB_SINGLE) - wxFLAGS_MEMBER(wxLB_MULTIPLE) - wxFLAGS_MEMBER(wxLB_EXTENDED) - wxFLAGS_MEMBER(wxLB_HSCROLL) - wxFLAGS_MEMBER(wxLB_ALWAYS_SB) - wxFLAGS_MEMBER(wxLB_NEEDED_SB) - wxFLAGS_MEMBER(wxLB_SORT) - wxFLAGS_MEMBER(wxLB_OWNERDRAW) - -wxEND_FLAGS( wxCheckListBoxStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h") - -wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) - wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent ) - wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , wxLB_OWNERDRAW /*flags*/ , wxT("Helpstring") , wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxCheckListBox) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) - -#else -IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) -#endif - -// ---------------------------------------------------------------------------- -// declaration and implementation of wxCheckListBoxItem class -// ---------------------------------------------------------------------------- - -class wxCheckListBoxItem : public wxOwnerDrawn -{ -friend class WXDLLIMPEXP_FWD_CORE wxCheckListBox; -public: - // ctor - wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); - - // drawing functions - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); - - // simple accessors and operations - bool IsChecked() const { return m_bChecked; } - - void Check(bool bCheck); - void Toggle() { Check(!IsChecked()); } - - void SendEvent(); - -private: - bool m_bChecked; - wxCheckListBox *m_pParent; - size_t m_nIndex; - - DECLARE_NO_COPY_CLASS(wxCheckListBoxItem) -}; - -wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) - : wxOwnerDrawn(wxEmptyString, true) // checkable -{ - m_bChecked = false; - m_pParent = pParent; - m_nIndex = nIndex; - - // we don't initialize m_nCheckHeight/Width vars because it's - // done in OnMeasure while they are used only in OnDraw and we - // know that there will always be OnMeasure before OnDraw - - // fix appearance for check list boxes: they don't look quite the same as - // menu icons - SetOwnMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - - 2*wxSystemSettings::GetMetric(wxSYS_EDGE_X) + 1); - - SetBackgroundColour(pParent->GetBackgroundColour()); -} - -bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, - wxODAction act, wxODStatus stat) -{ - // first draw the label - if ( IsChecked() ) - stat = (wxOwnerDrawn::wxODStatus)(stat | wxOwnerDrawn::wxODChecked); - - if ( !wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) ) - return false; - - - // now draw the check mark part - size_t nCheckWidth = GetDefaultMarginWidth(), - nCheckHeight = m_pParent->GetItemHeight(); - - int x = rc.GetX(), - y = rc.GetY(); - - HDC hdc = (HDC)dc.GetHDC(); - - // create pens, brushes &c - COLORREF colBg = wxColourToRGB(GetBackgroundColour()); - AutoHPEN hpenBack(colBg), - hpenGray(RGB(0xc0, 0xc0, 0xc0)); - - SelectInHDC selPen(hdc, (HGDIOBJ)hpenBack); - AutoHBRUSH hbrBack(colBg); - SelectInHDC selBrush(hdc, hbrBack); - - // erase the background: it could have been filled with the selected colour - Rectangle(hdc, x, y, x + nCheckWidth + 1, rc.GetBottom() + 1); - - // shift check mark 1 pixel to the right, looks better like this - x++; - - if ( IsChecked() ) - { - // first create a monochrome bitmap in a memory DC - MemoryHDC hdcMem(hdc); - MonoBitmap hbmpCheck(nCheckWidth, nCheckHeight); - SelectInHDC selBmp(hdcMem, hbmpCheck); - - // then draw a check mark into it - RECT rect = { 0, 0, nCheckWidth, nCheckHeight }; - ::DrawFrameControl(hdcMem, &rect, -#ifdef __WXWINCE__ - DFC_BUTTON, DFCS_BUTTONCHECK -#else - DFC_MENU, DFCS_MENUCHECK -#endif - ); - - // finally copy it to screen DC - ::BitBlt(hdc, x, y, nCheckWidth, nCheckHeight, hdcMem, 0, 0, SRCCOPY); - } - - // now we draw the smaller rectangle - y++; - nCheckWidth -= 2; - nCheckHeight -= 2; - - // draw hollow gray rectangle - (void)::SelectObject(hdc, (HGDIOBJ)hpenGray); - - SelectInHDC selBrush2(hdc, ::GetStockObject(NULL_BRUSH)); - Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight); - - if (stat & wxODHasFocus) - { - RECT rect; - wxCopyRectToRECT(rc, rect); - DrawFocusRect(hdc, &rect); - } - - return true; -} - -// change the state of the item and redraw it -void wxCheckListBoxItem::Check(bool check) -{ - m_bChecked = check; - - // index may be changed because new items were added/deleted - if ( m_pParent->GetItemIndex(this) != (int)m_nIndex ) - { - // update it - int index = m_pParent->GetItemIndex(this); - - wxASSERT_MSG( index != wxNOT_FOUND, wxT("what does this item do here?") ); - - m_nIndex = (size_t)index; - } - - HWND hwndListbox = (HWND)m_pParent->GetHWND(); - - RECT rcUpdate; - - if ( ::SendMessage(hwndListbox, LB_GETITEMRECT, - m_nIndex, (LPARAM)&rcUpdate) == LB_ERR ) - { - wxLogDebug(wxT("LB_GETITEMRECT failed")); - } - - ::InvalidateRect(hwndListbox, &rcUpdate, FALSE); -} - -// send an "item checked" event -void wxCheckListBoxItem::SendEvent() -{ - wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, m_pParent->GetId()); - event.SetInt(m_nIndex); - event.SetEventObject(m_pParent); - m_pParent->ProcessCommand(event); -} - -// ---------------------------------------------------------------------------- -// implementation of wxCheckListBox class -// ---------------------------------------------------------------------------- - -// define event table -// ------------------ -BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox) - EVT_KEY_DOWN(wxCheckListBox::OnKeyDown) - EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick) -END_EVENT_TABLE() - -// control creation -// ---------------- - -// def ctor: use Create() to really create the control -wxCheckListBox::wxCheckListBox() -{ -} - -// ctor which creates the associated control -wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - int nStrings, const wxString choices[], - long style, const wxValidator& val, - const wxString& name) -{ - Create(parent, id, pos, size, nStrings, choices, style, val, name); -} - -wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - const wxArrayString& choices, - long style, const wxValidator& val, - const wxString& name) -{ - Create(parent, id, pos, size, choices, style, val, name); -} - -bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, const wxString& name) -{ - return wxListBox::Create(parent, id, pos, size, n, choices, - style | wxLB_OWNERDRAW, validator, name); -} - -bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, const wxString& name) -{ - return wxListBox::Create(parent, id, pos, size, choices, - style | wxLB_OWNERDRAW, validator, name); -} - -// misc overloaded methods -// ----------------------- - -void wxCheckListBox::Delete(unsigned int n) -{ - wxCHECK_RET( IsValid(n), - wxT("invalid index in wxListBox::Delete") ); - - wxListBox::Delete(n); - - // free memory - delete m_aItems[n]; - - m_aItems.RemoveAt(n); -} - -bool wxCheckListBox::SetFont( const wxFont &font ) -{ - unsigned int i; - for ( i = 0; i < m_aItems.GetCount(); i++ ) - m_aItems[i]->SetFont(font); - - wxListBox::SetFont(font); - - return true; -} - -// create/retrieve item -// -------------------- - -// create a check list box item -wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex) -{ - wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex); - return pItem; -} - -// return item size -// ---------------- -bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) -{ - if ( wxListBox::MSWOnMeasure(item) ) { - MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; - - // save item height - m_nItemHeight = pStruct->itemHeight; - - // add place for the check mark - pStruct->itemWidth += wxOwnerDrawn::GetDefaultMarginWidth(); - - return true; - } - - return false; -} - -// check items -// ----------- - -bool wxCheckListBox::IsChecked(unsigned int uiIndex) const -{ - wxCHECK_MSG( IsValid(uiIndex), false, _T("bad wxCheckListBox index") ); - - return GetItem(uiIndex)->IsChecked(); -} - -void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) -{ - wxCHECK_RET( IsValid(uiIndex), _T("bad wxCheckListBox index") ); - - GetItem(uiIndex)->Check(bCheck); -} - -// process events -// -------------- - -void wxCheckListBox::OnKeyDown(wxKeyEvent& event) -{ - // what do we do? - enum - { - None, - Toggle, - Set, - Clear - } oper; - - switch ( event.GetKeyCode() ) - { - case WXK_SPACE: - oper = Toggle; - break; - - case WXK_NUMPAD_ADD: - case '+': - oper = Set; - break; - - case WXK_NUMPAD_SUBTRACT: - case '-': - oper = Clear; - break; - - default: - oper = None; - } - - if ( oper != None ) - { - wxArrayInt selections; - int count = 0; - if ( HasMultipleSelection() ) - { - count = GetSelections(selections); - } - else - { - int sel = GetSelection(); - if (sel != -1) - { - count = 1; - selections.Add(sel); - } - } - - for ( int i = 0; i < count; i++ ) - { - wxCheckListBoxItem *item = GetItem(selections[i]); - if ( !item ) - { - wxFAIL_MSG( _T("no wxCheckListBoxItem?") ); - continue; - } - - switch ( oper ) - { - case Toggle: - item->Toggle(); - break; - - case Set: - case Clear: - item->Check( oper == Set ); - break; - - default: - wxFAIL_MSG( _T("what should this key do?") ); - } - - // we should send an event as this has been done by the user and - // not by the program - item->SendEvent(); - } - } - else // nothing to do - { - event.Skip(); - } -} - -void wxCheckListBox::OnLeftClick(wxMouseEvent& event) -{ - // clicking on the item selects it, clicking on the checkmark toggles - if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) - { - int nItem = HitTest(event.GetX(), event.GetY()); - - if ( nItem != wxNOT_FOUND ) - { - wxCheckListBoxItem *item = GetItem(nItem); - item->Toggle(); - item->SendEvent(); - } - //else: it's not an error, just click outside of client zone - } - else - { - // implement default behaviour: clicking on the item selects it - event.Skip(); - } -} - -int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const -{ - int nItem = (int)::SendMessage - ( - (HWND)GetHWND(), - LB_ITEMFROMPOINT, - 0, - MAKELPARAM(x, y) - ); - - return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem; -} - - -wxSize wxCheckListBox::DoGetBestSize() const -{ - wxSize best = wxListBox::DoGetBestSize(); - best.x += wxOwnerDrawn::GetDefaultMarginWidth(); // add room for the checkbox - CacheBestSize(best); - return best; -} - -#endif diff --git a/Source/3rdParty/wx/src/msw/choice.cpp b/Source/3rdParty/wx/src/msw/choice.cpp deleted file mode 100644 index d154a30e0..000000000 --- a/Source/3rdParty/wx/src/msw/choice.cpp +++ /dev/null @@ -1,802 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/choice.cpp -// Purpose: wxChoice -// Author: Julian Smart -// Modified by: Vadim Zeitlin to derive from wxChoiceBase -// Created: 04/01/98 -// RCS-ID: $Id: choice.cpp 51616 2008-02-09 15:22:15Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHOICE && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) - -#include "wx/choice.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/log.h" - #include "wx/brush.h" - #include "wx/settings.h" -#endif - -#include "wx/msw/private.h" - -#if wxUSE_EXTENDED_RTTI -WX_DEFINE_FLAGS( wxChoiceStyle ) - -wxBEGIN_FLAGS( wxChoiceStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - -wxEND_FLAGS( wxChoiceStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/choice.h") - -wxBEGIN_PROPERTIES_TABLE(wxChoice) - wxEVENT_PROPERTY( Select , wxEVT_COMMAND_CHOICE_SELECTED , wxCommandEvent ) - - wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY_FLAGS( WindowStyle , wxChoiceStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxChoice) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) -#else -IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) -#endif -/* - TODO PROPERTIES - selection (long) - content (list) - item -*/ - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// creation -// ---------------------------------------------------------------------------- - -bool wxChoice::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - // Experience shows that wxChoice vs. wxComboBox distinction confuses - // quite a few people - try to help them - wxASSERT_MSG( !(style & wxCB_DROPDOWN) && - !(style & wxCB_READONLY) && - !(style & wxCB_SIMPLE), - _T("this style flag is ignored by wxChoice, you ") - _T("probably want to use a wxComboBox") ); - - return CreateAndInit(parent, id, pos, size, n, choices, style, - validator, name); -} - -bool wxChoice::CreateAndInit(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - // initialize wxControl - if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return false; - - // now create the real HWND - if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) ) - return false; - - - // choice/combobox normally has "white" (depends on colour scheme, of - // course) background rather than inheriting the parent's background - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - - // initialize the controls contents - for ( int i = 0; i < n; i++ ) - { - Append(choices[i]); - } - - // and now we may finally size the control properly (if needed) - SetInitialSize(size); - - return true; -} - -bool wxChoice::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, - const wxString& name) -{ - wxCArrayString chs(choices); - return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), - style, validator, name); -} - -void wxChoice::SetLabel(const wxString& label) -{ - if ( FindString(label) == wxNOT_FOUND ) - { - // unless we explicitly do this here, CB_GETCURSEL will continue to - // return the index of the previously selected item which will result - // in wrongly replacing the value being set now with the previously - // value if the user simply opens and closes (without selecting - // anything) the combobox popup - SetSelection(-1); - } - - wxChoiceBase::SetLabel(label); -} - -bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg) -{ - MSG *msg = (MSG *) pMsg; - - // if the dropdown list is visible, don't preprocess certain keys - if ( msg->message == WM_KEYDOWN - && (msg->wParam == VK_ESCAPE || msg->wParam == VK_RETURN) ) - { - if (::SendMessage(GetHwndOf(this), CB_GETDROPPEDSTATE, 0, 0)) - { - return false; - } - } - - return wxControl::MSWShouldPreProcessMessage(pMsg); -} - -WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - // we never have an external border - WXDWORD msStyle = wxControl::MSWGetStyle - ( - (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle - ); - - // WS_CLIPSIBLINGS is useful with wxChoice and doesn't seem to result in - // any problems - msStyle |= WS_CLIPSIBLINGS; - - // wxChoice-specific styles - msStyle |= CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL; - if ( style & wxCB_SORT ) - msStyle |= CBS_SORT; - - return msStyle; -} - -wxChoice::~wxChoice() -{ - Free(); -} - -// ---------------------------------------------------------------------------- -// adding/deleting items to/from the list -// ---------------------------------------------------------------------------- - -int wxChoice::DoAppend(const wxString& item) -{ - int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LPARAM)item.c_str()); - if ( n == CB_ERR ) - { - wxLogLastError(wxT("SendMessage(CB_ADDSTRING)")); - } - else // ok - { - // we need to refresh our size in order to have enough space for the - // newly added items - if ( !IsFrozen() ) - UpdateVisibleHeight(); - } - - InvalidateBestSize(); - return n; -} - -int wxChoice::DoInsert(const wxString& item, unsigned int pos) -{ - wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); - wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); - - int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str()); - if ( n == CB_ERR ) - { - wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)")); - } - else // ok - { - if ( !IsFrozen() ) - UpdateVisibleHeight(); - } - - InvalidateBestSize(); - return n; -} - -void wxChoice::Delete(unsigned int n) -{ - wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); - - if ( HasClientObjectData() ) - { - delete GetClientObject(n); - } - - SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); - - if ( !IsFrozen() ) - UpdateVisibleHeight(); - - InvalidateBestSize(); -} - -void wxChoice::Clear() -{ - Free(); - - SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0); - - if ( !IsFrozen() ) - UpdateVisibleHeight(); - - InvalidateBestSize(); -} - -void wxChoice::Free() -{ - if ( HasClientObjectData() ) - { - unsigned int count = GetCount(); - for ( unsigned int n = 0; n < count; n++ ) - { - delete GetClientObject(n); - } - } -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -int wxChoice::GetSelection() const -{ - // if m_lastAcceptedSelection is set, it means that the dropdown is - // currently shown and that we want to use the last "permanent" selection - // instead of whatever is under the mouse pointer currently - // - // otherwise, get the selection from the control - return m_lastAcceptedSelection == wxID_NONE ? GetCurrentSelection() - : m_lastAcceptedSelection; -} - -int wxChoice::GetCurrentSelection() const -{ - return (int)SendMessage(GetHwnd(), CB_GETCURSEL, 0, 0); -} - -void wxChoice::SetSelection(int n) -{ - SendMessage(GetHwnd(), CB_SETCURSEL, n, 0); -} - -// ---------------------------------------------------------------------------- -// string list functions -// ---------------------------------------------------------------------------- - -unsigned int wxChoice::GetCount() const -{ - return (unsigned int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0); -} - -int wxChoice::FindString(const wxString& s, bool bCase) const -{ -#if defined(__WATCOMC__) && defined(__WIN386__) - // For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message. - // wxChoice::Do it the long way instead. - unsigned int count = GetCount(); - for ( unsigned int i = 0; i < count; i++ ) - { - // as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too - if (GetString(i).IsSameAs(s, bCase)) - return i; - } - - return wxNOT_FOUND; -#else // !Watcom - //TODO: Evidently some MSW versions (all?) don't like empty strings - //passed to SendMessage, so we have to do it ourselves in that case - if ( s.empty() ) - { - unsigned int count = GetCount(); - for ( unsigned int i = 0; i < count; i++ ) - { - if (GetString(i).empty()) - return i; - } - - return wxNOT_FOUND; - } - else if (bCase) - { - // back to base class search for not native search type - return wxItemContainerImmutable::FindString( s, bCase ); - } - else - { - int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT, - (WPARAM)-1, (LPARAM)s.c_str()); - - return pos == LB_ERR ? wxNOT_FOUND : pos; - } -#endif // Watcom/!Watcom -} - -void wxChoice::SetString(unsigned int n, const wxString& s) -{ - wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") ); - - // we have to delete and add back the string as there is no way to change a - // string in place - - // we need to preserve the client data - void *data; - if ( m_clientDataItemsType != wxClientData_None ) - { - data = DoGetItemClientData(n); - } - else // no client data - { - data = NULL; - } - - ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); - ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.c_str() ); - - if ( data ) - { - DoSetItemClientData(n, data); - } - //else: it's already NULL by default - - InvalidateBestSize(); -} - -wxString wxChoice::GetString(unsigned int n) const -{ - int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); - - wxString str; - if ( len != CB_ERR && len > 0 ) - { - if ( ::SendMessage - ( - GetHwnd(), - CB_GETLBTEXT, - n, - (LPARAM)(wxChar *)wxStringBuffer(str, len) - ) == CB_ERR ) - { - wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)")); - } - } - - return str; -} - -// ---------------------------------------------------------------------------- -// client data -// ---------------------------------------------------------------------------- - -void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) -{ - if ( ::SendMessage(GetHwnd(), CB_SETITEMDATA, - n, (LPARAM)clientData) == CB_ERR ) - { - wxLogLastError(wxT("CB_SETITEMDATA")); - } -} - -void* wxChoice::DoGetItemClientData(unsigned int n) const -{ - LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0); - if ( rc == CB_ERR ) - { - wxLogLastError(wxT("CB_GETITEMDATA")); - - // unfortunately, there is no way to return an error code to the user - rc = (LPARAM) NULL; - } - - return (void *)rc; -} - -void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) -{ - DoSetItemClientData(n, clientData); -} - -wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const -{ - return (wxClientData *)DoGetItemClientData(n); -} - -// ---------------------------------------------------------------------------- -// wxMSW specific helpers -// ---------------------------------------------------------------------------- - -void wxChoice::UpdateVisibleHeight() -{ - // be careful to not change the width here - DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, GetSize().y, wxSIZE_USE_EXISTING); -} - -void wxChoice::DoMoveWindow(int x, int y, int width, int height) -{ - // here is why this is necessary: if the width is negative, the combobox - // window proc makes the window of the size width*height instead of - // interpreting height in the usual manner (meaning the height of the drop - // down list - usually the height specified in the call to MoveWindow() - // will not change the height of combo box per se) - // - // this behaviour is not documented anywhere, but this is just how it is - // here (NT 4.4) and, anyhow, the check shouldn't hurt - however without - // the check, constraints/sizers using combos may break the height - // constraint will have not at all the same value as expected - if ( width < 0 ) - return; - - wxControl::DoMoveWindow(x, y, width, height); -} - -void wxChoice::DoGetSize(int *w, int *h) const -{ - // this is weird: sometimes, the height returned by Windows is clearly the - // total height of the control including the drop down list -- but only - // sometimes, and normally it isn't... I have no idea about what to do with - // this - wxControl::DoGetSize(w, h); -} - -void wxChoice::DoSetSize(int x, int y, - int width, int height, - int sizeFlags) -{ - int heightOrig = height; - - // the height which we must pass to Windows should be the total height of - // the control including the drop down list while the height given to us - // is, of course, just the height of the permanently visible part of it - if ( height != wxDefaultCoord ) - { - // don't make the drop down list too tall, arbitrarily limit it to 40 - // items max and also don't leave it empty - size_t nItems = GetCount(); - if ( !nItems ) - nItems = 9; - else if ( nItems > 24 ) - nItems = 24; - - // add space for the drop down list - const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); - height += hItem*(nItems + 1); - } - else - { - // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses - // wxGetWindowRect() to determine the current height of the combobox, - // and then again sets the combobox's height to that value. Unfortunately, - // wxGetWindowRect doesn't include the dropdown list's height (at least - // on Win2K), so this would result in a combobox with dropdown height of - // 1 pixel. We have to determine the default height ourselves and call - // wxControl with that value instead. - int w, h; - RECT r; - DoGetSize(&w, &h); - if (::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r) != 0) - { - height = h + r.bottom - r.top; - } - } - - wxControl::DoSetSize(x, y, width, height, sizeFlags); - - // If we're storing a pending size, make sure we store - // the original size for reporting back to the app. - if (m_pendingSize != wxDefaultSize) - m_pendingSize = wxSize(width, heightOrig); - - // This solution works on XP, but causes choice/combobox lists to be - // too short on W2K and earlier. -#if 0 - int widthCurrent, heightCurrent; - DoGetSize(&widthCurrent, &heightCurrent); - - // the height which we must pass to Windows should be the total height of - // the control including the drop down list while the height given to us - // is, of course, just the height of the permanently visible part of it - if ( height != wxDefaultCoord && height != heightCurrent ) - { - // don't make the drop down list too tall, arbitrarily limit it to 40 - // items max and also don't leave it empty - unsigned int nItems = GetCount(); - if ( !nItems ) - nItems = 9; - else if ( nItems > 24 ) - nItems = 24; - - // add space for the drop down list - const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); - height += hItem*(nItems + 1); - } - else // keep the same height as now - { - // normally wxWindow::DoSetSize() checks if we set the same size as the - // window already has and does nothing in this case, but for us the - // check fails as the size we pass to it includes the dropdown while - // the size returned by our GetSize() does not, so test if the size - // didn't really change ourselves here - if ( width == wxDefaultCoord || width == widthCurrent ) - { - // size doesn't change, what about position? - int xCurrent, yCurrent; - DoGetPosition(&xCurrent, &yCurrent); - const bool defMeansUnchanged = !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE); - if ( ((x == wxDefaultCoord && defMeansUnchanged) || x == xCurrent) - && - ((y == wxDefaultCoord && defMeansUnchanged) || y == yCurrent) ) - { - // nothing changes, nothing to do - return; - } - } - - // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses - // wxGetWindowRect() to determine the current height of the combobox, - // and then again sets the combobox's height to that value. Unfortunately, - // wxGetWindowRect doesn't include the dropdown list's height (at least - // on Win2K), so this would result in a combobox with dropdown height of - // 1 pixel. We have to determine the default height ourselves and call - // wxControl with that value instead. - // - // Also notice that sometimes CB_GETDROPPEDCONTROLRECT seems to return - // wildly incorrect values (~32000) which looks like a bug in it, just - // ignore them in this case - RECT r; - if ( ::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r) - && r.bottom < 30000 ) - { - height = heightCurrent + r.bottom - r.top; - } - } - - wxControl::DoSetSize(x, y, width, height, sizeFlags); -#endif -} - -wxSize wxChoice::DoGetBestSize() const -{ - // find the widest string - int wChoice = 0; - const unsigned int nItems = GetCount(); - for ( unsigned int i = 0; i < nItems; i++ ) - { - int wLine; - GetTextExtent(GetString(i), &wLine, NULL); - if ( wLine > wChoice ) - wChoice = wLine; - } - - // give it some reasonable default value if there are no strings in the - // list - if ( wChoice == 0 ) - wChoice = 100; - - // the combobox should be slightly larger than the widest string - wChoice += 5*GetCharWidth(); - - wxSize best(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight())); - CacheBestSize(best); - return best; -} - -WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - switch ( nMsg ) - { - case WM_LBUTTONUP: - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - - // Ok, this is truly weird, but if a panel with a wxChoice - // loses the focus, then you get a *fake* WM_LBUTTONUP message - // with x = 65535 and y = 65535. Filter out this nonsense. - // - // VZ: I'd like to know how to reproduce this please... - if ( x == 65535 && y == 65535 ) - return 0; - } - break; - - // we have to handle both: one for the normal case and the other - // for readonly - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORSTATIC: - { - WXHDC hdc; - WXHWND hwnd; - UnpackCtlColor(wParam, lParam, &hdc, &hwnd); - - WXHBRUSH hbr = MSWControlColor((WXHDC)hdc, hwnd); - if ( hbr ) - return (WXLRESULT)hbr; - //else: fall through to default window proc - } - } - - return wxWindow::MSWWindowProc(nMsg, wParam, lParam); -} - -bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) -{ - /* - The native control provides a great variety in the events it sends in - the different selection scenarios (undoubtedly for greater amusement of - the programmers using it). For the reference, here are the cases when - the final selection is accepted (things are quite interesting when it - is cancelled too): - - A. Selecting with just the arrows without opening the dropdown: - 1. CBN_SELENDOK - 2. CBN_SELCHANGE - - B. Opening dropdown with F4 and selecting with arrows: - 1. CBN_DROPDOWN - 2. many CBN_SELCHANGE while changing selection in the list - 3. CBN_SELENDOK - 4. CBN_CLOSEUP - - C. Selecting with the mouse: - 1. CBN_DROPDOWN - -- no intermediate CBN_SELCHANGEs -- - 2. CBN_SELENDOK - 3. CBN_CLOSEUP - 4. CBN_SELCHANGE - - Admire the different order of messages in all of those cases, it must - surely have taken a lot of effort to Microsoft developers to achieve - such originality. - */ - switch ( param ) - { - case CBN_DROPDOWN: - // we use this value both because we don't want to track selection - // using CB_GETCURSEL while the dropdown is opened and because we - // need to reset the selection back to it if it's eventually - // cancelled by user - m_lastAcceptedSelection = GetCurrentSelection(); - if ( m_lastAcceptedSelection == -1 ) - { - // no current selection so no need to restore it later (this - // happens when opening a combobox containing text not from its - // list of items and we shouldn't erase this text) - m_lastAcceptedSelection = wxID_NONE; - } - break; - - case CBN_CLOSEUP: - // if the selection was accepted by the user, it should have been - // reset to wxID_NONE by CBN_SELENDOK, otherwise the selection was - // cancelled and we must restore the old one - if ( m_lastAcceptedSelection != wxID_NONE ) - { - SetSelection(m_lastAcceptedSelection); - m_lastAcceptedSelection = wxID_NONE; - } - break; - - case CBN_SELENDOK: - // reset it to prevent CBN_CLOSEUP from undoing the selection (it's - // ok to reset it now as GetCurrentSelection() will now return the - // same thing anyhow) - m_lastAcceptedSelection = wxID_NONE; - - { - const int n = GetSelection(); - - wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId); - event.SetInt(n); - event.SetEventObject(this); - - if ( n > -1 ) - { - event.SetString(GetStringSelection()); - InitCommandEventWithItems(event, n); - } - - ProcessCommand(event); - } - break; - - // don't handle CBN_SELENDCANCEL: just leave m_lastAcceptedSelection - // valid and the selection will be undone in CBN_CLOSEUP above - - // don't handle CBN_SELCHANGE neither, we don't want to generate events - // while the dropdown is opened -- but do add it if we ever need this - - default: - return false; - } - - return true; -} - -WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) -{ - if ( !IsEnabled() ) - return MSWControlColorDisabled(hDC); - - return wxChoiceBase::MSWControlColor(hDC, hWnd); -} - -#endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__) diff --git a/Source/3rdParty/wx/src/msw/clipbrd.cpp b/Source/3rdParty/wx/src/msw/clipbrd.cpp deleted file mode 100644 index 8091f2dd6..000000000 --- a/Source/3rdParty/wx/src/msw/clipbrd.cpp +++ /dev/null @@ -1,931 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/clipbrd.cpp -// Purpose: Clipboard functionality -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: clipbrd.cpp 43884 2006-12-09 19:49:40Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// declarations -// =========================================================================== - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CLIPBOARD - -#include "wx/clipbrd.h" - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/event.h" - #include "wx/app.h" - #include "wx/frame.h" - #include "wx/bitmap.h" - #include "wx/utils.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/dataobj.h" -#endif - -#if wxUSE_METAFILE - #include "wx/metafile.h" -#endif - - -#include - -#include "wx/msw/private.h" -#include "wx/msw/ole/oleutils.h" - -#if wxUSE_WXDIB - #include "wx/msw/dib.h" -#endif - -// wxDataObject is tied to OLE/drag and drop implementation, therefore so are -// the functions using wxDataObject in wxClipboard -//#define wxUSE_DATAOBJ wxUSE_DRAG_AND_DROP - -#if wxUSE_OLE && !defined(__WXWINCE__) - // use OLE clipboard - #define wxUSE_OLE_CLIPBOARD 1 -#else // !wxUSE_DATAOBJ - // use Win clipboard API - #define wxUSE_OLE_CLIPBOARD 0 -#endif - -#if wxUSE_OLE_CLIPBOARD - #include -#endif // wxUSE_OLE_CLIPBOARD - -// =========================================================================== -// implementation -// =========================================================================== - -// --------------------------------------------------------------------------- -// old-style clipboard functions using Windows API -// --------------------------------------------------------------------------- - -static bool gs_wxClipboardIsOpen = false; - -bool wxOpenClipboard() -{ - wxCHECK_MSG( !gs_wxClipboardIsOpen, true, wxT("clipboard already opened.") ); - - wxWindow *win = wxTheApp->GetTopWindow(); - if ( win ) - { - gs_wxClipboardIsOpen = ::OpenClipboard((HWND)win->GetHWND()) != 0; - - if ( !gs_wxClipboardIsOpen ) - wxLogSysError(_("Failed to open the clipboard.")); - - return gs_wxClipboardIsOpen; - } - else - { - wxLogDebug(wxT("Can not open clipboard without a main window.")); - - return false; - } -} - -bool wxCloseClipboard() -{ - wxCHECK_MSG( gs_wxClipboardIsOpen, false, wxT("clipboard is not opened") ); - - gs_wxClipboardIsOpen = false; - - if ( ::CloseClipboard() == 0 ) - { - wxLogSysError(_("Failed to close the clipboard.")); - - return false; - } - - return true; -} - -bool wxEmptyClipboard() -{ - if ( ::EmptyClipboard() == 0 ) - { - wxLogSysError(_("Failed to empty the clipboard.")); - - return false; - } - - return true; -} - -bool wxIsClipboardOpened() -{ - return gs_wxClipboardIsOpen; -} - -bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) -{ - wxDataFormat::NativeFormat cf = dataFormat.GetFormatId(); - - if ( ::IsClipboardFormatAvailable(cf) ) - { - // ok from the first try - return true; - } - - // for several standard formats, we can convert from some other ones too - switch ( cf ) - { - // for bitmaps, DIBs will also do - case CF_BITMAP: - return ::IsClipboardFormatAvailable(CF_DIB) != 0; - -#if wxUSE_ENH_METAFILE && !defined(__WXWINCE__) - case CF_METAFILEPICT: - return ::IsClipboardFormatAvailable(CF_ENHMETAFILE) != 0; -#endif // wxUSE_ENH_METAFILE - - default: - return false; - } -} - - -bool wxSetClipboardData(wxDataFormat dataFormat, - const void *data, - int width, int height) -{ - HANDLE handle = 0; // return value of SetClipboardData - - switch (dataFormat) - { - case wxDF_BITMAP: - { - wxBitmap *bitmap = (wxBitmap *)data; - - HDC hdcMem = CreateCompatibleDC((HDC) NULL); - HDC hdcSrc = CreateCompatibleDC((HDC) NULL); - HBITMAP old = (HBITMAP) - ::SelectObject(hdcSrc, (HBITMAP)bitmap->GetHBITMAP()); - HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc, - bitmap->GetWidth(), - bitmap->GetHeight()); - if (!hBitmap) - { - SelectObject(hdcSrc, old); - DeleteDC(hdcMem); - DeleteDC(hdcSrc); - return false; - } - - HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap); - BitBlt(hdcMem, 0, 0, bitmap->GetWidth(), bitmap->GetHeight(), - hdcSrc, 0, 0, SRCCOPY); - - // Select new bitmap out of memory DC - SelectObject(hdcMem, old1); - - // Set the data - handle = ::SetClipboardData(CF_BITMAP, hBitmap); - - // Clean up - SelectObject(hdcSrc, old); - DeleteDC(hdcSrc); - DeleteDC(hdcMem); - break; - } - -#if wxUSE_WXDIB - case wxDF_DIB: - { - wxBitmap *bitmap = (wxBitmap *)data; - - if ( bitmap && bitmap->Ok() ) - { - wxDIB dib(*bitmap); - if ( dib.IsOk() ) - { - handle = ::SetClipboardData(CF_DIB, dib.Detach()); - } - } - break; - } -#endif - - // VZ: I'm told that this code works, but it doesn't seem to work for me - // and, anyhow, I'd be highly surprised if it did. So I leave it here - // but IMNSHO it is completely broken. -#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) && !defined(__WXWINCE__) - case wxDF_METAFILE: - { - wxMetafile *wxMF = (wxMetafile *)data; - HANDLE data = GlobalAlloc(GHND, sizeof(METAFILEPICT) + 1); - METAFILEPICT *mf = (METAFILEPICT *)GlobalLock(data); - - mf->mm = wxMF->GetWindowsMappingMode(); - mf->xExt = width; - mf->yExt = height; - mf->hMF = (HMETAFILE) wxMF->GetHMETAFILE(); - GlobalUnlock(data); - wxMF->SetHMETAFILE((WXHANDLE) NULL); - - handle = SetClipboardData(CF_METAFILEPICT, data); - break; - } -#endif // wxUSE_METAFILE - -#if wxUSE_ENH_METAFILE && !defined(__WXWINCE__) - case wxDF_ENHMETAFILE: - { - wxEnhMetaFile *emf = (wxEnhMetaFile *)data; - wxEnhMetaFile emfCopy = *emf; - - handle = SetClipboardData(CF_ENHMETAFILE, - (void *)emfCopy.GetHENHMETAFILE()); - } - break; -#endif // wxUSE_ENH_METAFILE - - case CF_SYLK: - case CF_DIF: - case CF_TIFF: - case CF_PALETTE: - default: - { - wxLogError(_("Unsupported clipboard format.")); - return false; - } - - case wxDF_OEMTEXT: - dataFormat = wxDF_TEXT; - // fall through - - case wxDF_TEXT: - { - char *s = (char *)data; - - width = strlen(s) + 1; - height = 1; - DWORD l = (width * height); - HANDLE hGlobalMemory = GlobalAlloc(GHND, l); - if ( hGlobalMemory ) - { - LPSTR lpGlobalMemory = (LPSTR)GlobalLock(hGlobalMemory); - - memcpy(lpGlobalMemory, s, l); - - GlobalUnlock(hGlobalMemory); - } - - handle = SetClipboardData(dataFormat, hGlobalMemory); - break; - } - // Only tested with Visual C++ 6.0 so far -#if defined(__VISUALC__) - case wxDF_HTML: - { - char* html = (char *)data; - - // Create temporary buffer for HTML header... - char *buf = new char [400 + strlen(html)]; - if(!buf) return false; - - // Get clipboard id for HTML format... - static int cfid = 0; - if(!cfid) cfid = RegisterClipboardFormat(wxT("HTML Format")); - - // Create a template string for the HTML header... - strcpy(buf, - "Version:0.9\r\n" - "StartHTML:00000000\r\n" - "EndHTML:00000000\r\n" - "StartFragment:00000000\r\n" - "EndFragment:00000000\r\n" - "\r\n" - "\r\n"); - - // Append the HTML... - strcat(buf, html); - strcat(buf, "\r\n"); - // Finish up the HTML format... - strcat(buf, - "\r\n" - "\r\n" - ""); - - // Now go back, calculate all the lengths, and write out the - // necessary header information. Note, wsprintf() truncates the - // string when you overwrite it so you follow up with code to replace - // the 0 appended at the end with a '\r'... - char *ptr = strstr(buf, "StartHTML"); - sprintf(ptr+10, "%08u", strstr(buf, "") - buf); - *(ptr+10+8) = '\r'; - - ptr = strstr(buf, "EndHTML"); - sprintf(ptr+8, "%08u", strlen(buf)); - *(ptr+8+8) = '\r'; - - ptr = strstr(buf, "StartFragment"); - sprintf(ptr+14, "%08u", strstr(buf, " East (-1,0) - | - | - v - South (0,1) - - - [ USER ] - \|||/ - (o o) - ---ooO-(_)-Ooo--- - \endverbatim - * - * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a - * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses - * the first \c dir parameter. The cardinal directions would be: - * - North: 0 (0 degrees) - * - East: 9000 (90 degrees) - * - South: 18000 (180 degrees) - * - West: 27000 (270 degrees) - * - * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions - * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses - * the first three \c dir parameters. The cardinal directions would be: - * - North: 0,-1, 0 - * - East: -1, 0, 0 - * - South: 0, 1, 0 - * - West: 1, 0, 0 - * - * The Z axis represents the height of the effect if supported, otherwise - * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you - * can use any multiple you want, only the direction matters. - * - * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. - * The first two \c dir parameters are used. The \c dir parameters are as - * follows (all values are in hundredths of degrees): - * - Degrees from (1, 0) rotated towards (0, 1). - * - Degrees towards (0, 0, 1) (device needs at least 3 axes). - * - * - * Example of force coming from the south with all encodings (force coming - * from the south means the user will have to pull the stick to counteract): - * \code - * SDL_HapticDirection direction; - * - * // Cartesian directions - * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. - * direction.dir[0] = 0; // X position - * direction.dir[1] = 1; // Y position - * // Assuming the device has 2 axes, we don't need to specify third parameter. - * - * // Polar directions - * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. - * direction.dir[0] = 18000; // Polar only uses first parameter - * - * // Spherical coordinates - * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding - * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. - * \endcode - * - * \sa SDL_HAPTIC_POLAR - * \sa SDL_HAPTIC_CARTESIAN - * \sa SDL_HAPTIC_SPHERICAL - * \sa SDL_HapticEffect - * \sa SDL_HapticNumAxes - */ -typedef struct SDL_HapticDirection -{ - Uint8 type; /**< The type of encoding. */ - Sint32 dir[3]; /**< The encoded direction. */ -} SDL_HapticDirection; - - -/** - * \brief A structure containing a template for a Constant effect. - * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. - * - * A constant effect applies a constant force in the specified direction - * to the joystick. - * - * \sa SDL_HAPTIC_CONSTANT - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticConstant -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ - SDL_HapticDirection direction; /**< Direction of the effect. */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - Uint16 delay; /**< Delay before starting the effect. */ - - /* Trigger */ - Uint16 button; /**< Button that triggers the effect. */ - Uint16 interval; /**< How soon it can be triggered again after button. */ - - /* Constant */ - Sint16 level; /**< Strength of the constant effect. */ - - /* Envelope */ - Uint16 attack_length; /**< Duration of the attack. */ - Uint16 attack_level; /**< Level at the start of the attack. */ - Uint16 fade_length; /**< Duration of the fade. */ - Uint16 fade_level; /**< Level at the end of the fade. */ -} SDL_HapticConstant; - -/** - * \brief A structure containing a template for a Periodic effect. - * - * The struct handles the following effects: - * - ::SDL_HAPTIC_SINE - * - ::SDL_HAPTIC_LEFTRIGHT - * - ::SDL_HAPTIC_TRIANGLE - * - ::SDL_HAPTIC_SAWTOOTHUP - * - ::SDL_HAPTIC_SAWTOOTHDOWN - * - * A periodic effect consists in a wave-shaped effect that repeats itself - * over time. The type determines the shape of the wave and the parameters - * determine the dimensions of the wave. - * - * Phase is given by hundredth of a cycle meaning that giving the phase a value - * of 9000 will displace it 25% of its period. Here are sample values: - * - 0: No phase displacement. - * - 9000: Displaced 25% of its period. - * - 18000: Displaced 50% of its period. - * - 27000: Displaced 75% of its period. - * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. - * - * Examples: - * \verbatim - SDL_HAPTIC_SINE - __ __ __ __ - / \ / \ / \ / - / \__/ \__/ \__/ - - SDL_HAPTIC_SQUARE - __ __ __ __ __ - | | | | | | | | | | - | |__| |__| |__| |__| | - - SDL_HAPTIC_TRIANGLE - /\ /\ /\ /\ /\ - / \ / \ / \ / \ / - / \/ \/ \/ \/ - - SDL_HAPTIC_SAWTOOTHUP - /| /| /| /| /| /| /| - / | / | / | / | / | / | / | - / |/ |/ |/ |/ |/ |/ | - - SDL_HAPTIC_SAWTOOTHDOWN - \ |\ |\ |\ |\ |\ |\ | - \ | \ | \ | \ | \ | \ | \ | - \| \| \| \| \| \| \| - \endverbatim - * - * \sa SDL_HAPTIC_SINE - * \sa SDL_HAPTIC_LEFTRIGHT - * \sa SDL_HAPTIC_TRIANGLE - * \sa SDL_HAPTIC_SAWTOOTHUP - * \sa SDL_HAPTIC_SAWTOOTHDOWN - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticPeriodic -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT, - ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or - ::SDL_HAPTIC_SAWTOOTHDOWN */ - SDL_HapticDirection direction; /**< Direction of the effect. */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - Uint16 delay; /**< Delay before starting the effect. */ - - /* Trigger */ - Uint16 button; /**< Button that triggers the effect. */ - Uint16 interval; /**< How soon it can be triggered again after button. */ - - /* Periodic */ - Uint16 period; /**< Period of the wave. */ - Sint16 magnitude; /**< Peak value. */ - Sint16 offset; /**< Mean value of the wave. */ - Uint16 phase; /**< Horizontal shift given by hundredth of a cycle. */ - - /* Envelope */ - Uint16 attack_length; /**< Duration of the attack. */ - Uint16 attack_level; /**< Level at the start of the attack. */ - Uint16 fade_length; /**< Duration of the fade. */ - Uint16 fade_level; /**< Level at the end of the fade. */ -} SDL_HapticPeriodic; - -/** - * \brief A structure containing a template for a Condition effect. - * - * The struct handles the following effects: - * - ::SDL_HAPTIC_SPRING: Effect based on axes position. - * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. - * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. - * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. - * - * Direction is handled by condition internals instead of a direction member. - * The condition effect specific members have three parameters. The first - * refers to the X axis, the second refers to the Y axis and the third - * refers to the Z axis. The right terms refer to the positive side of the - * axis and the left terms refer to the negative side of the axis. Please - * refer to the ::SDL_HapticDirection diagram for which side is positive and - * which is negative. - * - * \sa SDL_HapticDirection - * \sa SDL_HAPTIC_SPRING - * \sa SDL_HAPTIC_DAMPER - * \sa SDL_HAPTIC_INERTIA - * \sa SDL_HAPTIC_FRICTION - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticCondition -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, - ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ - SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - Uint16 delay; /**< Delay before starting the effect. */ - - /* Trigger */ - Uint16 button; /**< Button that triggers the effect. */ - Uint16 interval; /**< How soon it can be triggered again after button. */ - - /* Condition */ - Uint16 right_sat[3]; /**< Level when joystick is to the positive side. */ - Uint16 left_sat[3]; /**< Level when joystick is to the negative side. */ - Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ - Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ - Uint16 deadband[3]; /**< Size of the dead zone. */ - Sint16 center[3]; /**< Position of the dead zone. */ -} SDL_HapticCondition; - -/** - * \brief A structure containing a template for a Ramp effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. - * - * The ramp effect starts at start strength and ends at end strength. - * It augments in linear fashion. If you use attack and fade with a ramp - * the effects get added to the ramp effect making the effect become - * quadratic instead of linear. - * - * \sa SDL_HAPTIC_RAMP - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticRamp -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_RAMP */ - SDL_HapticDirection direction; /**< Direction of the effect. */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - Uint16 delay; /**< Delay before starting the effect. */ - - /* Trigger */ - Uint16 button; /**< Button that triggers the effect. */ - Uint16 interval; /**< How soon it can be triggered again after button. */ - - /* Ramp */ - Sint16 start; /**< Beginning strength level. */ - Sint16 end; /**< Ending strength level. */ - - /* Envelope */ - Uint16 attack_length; /**< Duration of the attack. */ - Uint16 attack_level; /**< Level at the start of the attack. */ - Uint16 fade_length; /**< Duration of the fade. */ - Uint16 fade_level; /**< Level at the end of the fade. */ -} SDL_HapticRamp; - -/** - * \brief A structure containing a template for a Left/Right effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. - * - * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. - * - * \sa SDL_HAPTIC_LEFTRIGHT - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticLeftRight -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - - /* Rumble */ - Uint16 large_magnitude; /**< Control of the large controller motor. */ - Uint16 small_magnitude; /**< Control of the small controller motor. */ -} SDL_HapticLeftRight; - -/** - * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. - * - * A custom force feedback effect is much like a periodic effect, where the - * application can define its exact shape. You will have to allocate the - * data yourself. Data should consist of channels * samples Uint16 samples. - * - * If channels is one, the effect is rotated using the defined direction. - * Otherwise it uses the samples in data for the different axes. - * - * \sa SDL_HAPTIC_CUSTOM - * \sa SDL_HapticEffect - */ -typedef struct SDL_HapticCustom -{ - /* Header */ - Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ - SDL_HapticDirection direction; /**< Direction of the effect. */ - - /* Replay */ - Uint32 length; /**< Duration of the effect. */ - Uint16 delay; /**< Delay before starting the effect. */ - - /* Trigger */ - Uint16 button; /**< Button that triggers the effect. */ - Uint16 interval; /**< How soon it can be triggered again after button. */ - - /* Custom */ - Uint8 channels; /**< Axes to use, minimum of one. */ - Uint16 period; /**< Sample periods. */ - Uint16 samples; /**< Amount of samples. */ - Uint16 *data; /**< Should contain channels*samples items. */ - - /* Envelope */ - Uint16 attack_length; /**< Duration of the attack. */ - Uint16 attack_level; /**< Level at the start of the attack. */ - Uint16 fade_length; /**< Duration of the fade. */ - Uint16 fade_level; /**< Level at the end of the fade. */ -} SDL_HapticCustom; - -/** - * \brief The generic template for any haptic effect. - * - * All values max at 32767 (0x7FFF). Signed values also can be negative. - * Time values unless specified otherwise are in milliseconds. - * - * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 - * value. Neither delay, interval, attack_length nor fade_length support - * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. - * - * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of - * ::SDL_HAPTIC_INFINITY. - * - * Button triggers may not be supported on all devices, it is advised to not - * use them if possible. Buttons start at index 1 instead of index 0 like - * the joystick. - * - * If both attack_length and fade_level are 0, the envelope is not used, - * otherwise both values are used. - * - * Common parts: - * \code - * // Replay - All effects have this - * Uint32 length; // Duration of effect (ms). - * Uint16 delay; // Delay before starting effect. - * - * // Trigger - All effects have this - * Uint16 button; // Button that triggers effect. - * Uint16 interval; // How soon before effect can be triggered again. - * - * // Envelope - All effects except condition effects have this - * Uint16 attack_length; // Duration of the attack (ms). - * Uint16 attack_level; // Level at the start of the attack. - * Uint16 fade_length; // Duration of the fade out (ms). - * Uint16 fade_level; // Level at the end of the fade. - * \endcode - * - * - * Here we have an example of a constant effect evolution in time: - * \verbatim - Strength - ^ - | - | effect level --> _________________ - | / \ - | / \ - | / \ - | / \ - | attack_level --> | \ - | | | <--- fade_level - | - +--------------------------------------------------> Time - [--] [---] - attack_length fade_length - - [------------------][-----------------------] - delay length - \endverbatim - * - * Note either the attack_level or the fade_level may be above the actual - * effect level. - * - * \sa SDL_HapticConstant - * \sa SDL_HapticPeriodic - * \sa SDL_HapticCondition - * \sa SDL_HapticRamp - * \sa SDL_HapticLeftRight - * \sa SDL_HapticCustom - */ -typedef union SDL_HapticEffect -{ - /* Common for all force feedback effects */ - Uint16 type; /**< Effect type. */ - SDL_HapticConstant constant; /**< Constant effect. */ - SDL_HapticPeriodic periodic; /**< Periodic effect. */ - SDL_HapticCondition condition; /**< Condition effect. */ - SDL_HapticRamp ramp; /**< Ramp effect. */ - SDL_HapticLeftRight leftright; /**< Left/Right effect. */ - SDL_HapticCustom custom; /**< Custom effect. */ -} SDL_HapticEffect; - - -/* Function prototypes */ -/** - * \brief Count the number of haptic devices attached to the system. - * - * \return Number of haptic devices detected on the system. - */ -extern DECLSPEC int SDLCALL SDL_NumHaptics(void); - -/** - * \brief Get the implementation dependent name of a Haptic device. - * - * This can be called before any joysticks are opened. - * If no name can be found, this function returns NULL. - * - * \param device_index Index of the device to get its name. - * \return Name of the device or NULL on error. - * - * \sa SDL_NumHaptics - */ -extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); - -/** - * \brief Opens a Haptic device for usage. - * - * The index passed as an argument refers to the N'th Haptic device on this - * system. - * - * When opening a haptic device, its gain will be set to maximum and - * autocenter will be disabled. To modify these values use - * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). - * - * \param device_index Index of the device to open. - * \return Device identifier or NULL on error. - * - * \sa SDL_HapticIndex - * \sa SDL_HapticOpenFromMouse - * \sa SDL_HapticOpenFromJoystick - * \sa SDL_HapticClose - * \sa SDL_HapticSetGain - * \sa SDL_HapticSetAutocenter - * \sa SDL_HapticPause - * \sa SDL_HapticStopAll - */ -extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); - -/** - * \brief Checks if the haptic device at index has been opened. - * - * \param device_index Index to check to see if it has been opened. - * \return 1 if it has been opened or 0 if it hasn't. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticIndex - */ -extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); - -/** - * \brief Gets the index of a haptic device. - * - * \param haptic Haptic device to get the index of. - * \return The index of the haptic device or -1 on error. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticOpened - */ -extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); - -/** - * \brief Gets whether or not the current mouse has haptic capabilities. - * - * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. - * - * \sa SDL_HapticOpenFromMouse - */ -extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); - -/** - * \brief Tries to open a haptic device from the current mouse. - * - * \return The haptic device identifier or NULL on error. - * - * \sa SDL_MouseIsHaptic - * \sa SDL_HapticOpen - */ -extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); - -/** - * \brief Checks to see if a joystick has haptic features. - * - * \param joystick Joystick to test for haptic capabilities. - * \return 1 if the joystick is haptic, 0 if it isn't - * or -1 if an error ocurred. - * - * \sa SDL_HapticOpenFromJoystick - */ -extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); - -/** - * \brief Opens a Haptic device for usage from a Joystick device. - * - * You must still close the haptic device seperately. It will not be closed - * with the joystick. - * - * When opening from a joystick you should first close the haptic device before - * closing the joystick device. If not, on some implementations the haptic - * device will also get unallocated and you'll be unable to use force feedback - * on that device. - * - * \param joystick Joystick to create a haptic device from. - * \return A valid haptic device identifier on success or NULL on error. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticClose - */ -extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * - joystick); - -/** - * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). - * - * \param haptic Haptic device to close. - */ -extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); - -/** - * \brief Returns the number of effects a haptic device can store. - * - * On some platforms this isn't fully supported, and therefore is an - * approximation. Always check to see if your created effect was actually - * created and do not rely solely on SDL_HapticNumEffects(). - * - * \param haptic The haptic device to query effect max. - * \return The number of effects the haptic device can store or - * -1 on error. - * - * \sa SDL_HapticNumEffectsPlaying - * \sa SDL_HapticQuery - */ -extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); - -/** - * \brief Returns the number of effects a haptic device can play at the same - * time. - * - * This is not supported on all platforms, but will always return a value. - * Added here for the sake of completeness. - * - * \param haptic The haptic device to query maximum playing effects. - * \return The number of effects the haptic device can play at the same time - * or -1 on error. - * - * \sa SDL_HapticNumEffects - * \sa SDL_HapticQuery - */ -extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); - -/** - * \brief Gets the haptic devices supported features in bitwise matter. - * - * Example: - * \code - * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { - * printf("We have constant haptic effect!"); - * } - * \endcode - * - * \param haptic The haptic device to query. - * \return Haptic features in bitwise manner (OR'd). - * - * \sa SDL_HapticNumEffects - * \sa SDL_HapticEffectSupported - */ -extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); - - -/** - * \brief Gets the number of haptic axes the device has. - * - * \sa SDL_HapticDirection - */ -extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); - -/** - * \brief Checks to see if effect is supported by haptic. - * - * \param haptic Haptic device to check on. - * \param effect Effect to check to see if it is supported. - * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. - * - * \sa SDL_HapticQuery - * \sa SDL_HapticNewEffect - */ -extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, - SDL_HapticEffect * - effect); - -/** - * \brief Creates a new haptic effect on the device. - * - * \param haptic Haptic device to create the effect on. - * \param effect Properties of the effect to create. - * \return The id of the effect on success or -1 on error. - * - * \sa SDL_HapticUpdateEffect - * \sa SDL_HapticRunEffect - * \sa SDL_HapticDestroyEffect - */ -extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, - SDL_HapticEffect * effect); - -/** - * \brief Updates the properties of an effect. - * - * Can be used dynamically, although behaviour when dynamically changing - * direction may be strange. Specifically the effect may reupload itself - * and start playing from the start. You cannot change the type either when - * running SDL_HapticUpdateEffect(). - * - * \param haptic Haptic device that has the effect. - * \param effect Effect to update. - * \param data New effect properties to use. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticNewEffect - * \sa SDL_HapticRunEffect - * \sa SDL_HapticDestroyEffect - */ -extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, - int effect, - SDL_HapticEffect * data); - -/** - * \brief Runs the haptic effect on its associated haptic device. - * - * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over - * repeating the envelope (attack and fade) every time. If you only want the - * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length - * parameter. - * - * \param haptic Haptic device to run the effect on. - * \param effect Identifier of the haptic effect to run. - * \param iterations Number of iterations to run the effect. Use - * ::SDL_HAPTIC_INFINITY for infinity. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticStopEffect - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticGetEffectStatus - */ -extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, - int effect, - Uint32 iterations); - -/** - * \brief Stops the haptic effect on its associated haptic device. - * - * \param haptic Haptic device to stop the effect on. - * \param effect Identifier of the effect to stop. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticRunEffect - * \sa SDL_HapticDestroyEffect - */ -extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, - int effect); - -/** - * \brief Destroys a haptic effect on the device. - * - * This will stop the effect if it's running. Effects are automatically - * destroyed when the device is closed. - * - * \param haptic Device to destroy the effect on. - * \param effect Identifier of the effect to destroy. - * - * \sa SDL_HapticNewEffect - */ -extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, - int effect); - -/** - * \brief Gets the status of the current effect on the haptic device. - * - * Device must support the ::SDL_HAPTIC_STATUS feature. - * - * \param haptic Haptic device to query the effect status on. - * \param effect Identifier of the effect to query its status. - * \return 0 if it isn't playing, 1 if it is playing or -1 on error. - * - * \sa SDL_HapticRunEffect - * \sa SDL_HapticStopEffect - */ -extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, - int effect); - -/** - * \brief Sets the global gain of the device. - * - * Device must support the ::SDL_HAPTIC_GAIN feature. - * - * The user may specify the maximum gain by setting the environment variable - * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to - * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the - * maximum. - * - * \param haptic Haptic device to set the gain on. - * \param gain Value to set the gain to, should be between 0 and 100. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticQuery - */ -extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); - -/** - * \brief Sets the global autocenter of the device. - * - * Autocenter should be between 0 and 100. Setting it to 0 will disable - * autocentering. - * - * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. - * - * \param haptic Haptic device to set autocentering on. - * \param autocenter Value to set autocenter to, 0 disables autocentering. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticQuery - */ -extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, - int autocenter); - -/** - * \brief Pauses a haptic device. - * - * Device must support the ::SDL_HAPTIC_PAUSE feature. Call - * SDL_HapticUnpause() to resume playback. - * - * Do not modify the effects nor add new ones while the device is paused. - * That can cause all sorts of weird errors. - * - * \param haptic Haptic device to pause. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticUnpause - */ -extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); - -/** - * \brief Unpauses a haptic device. - * - * Call to unpause after SDL_HapticPause(). - * - * \param haptic Haptic device to pause. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticPause - */ -extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); - -/** - * \brief Stops all the currently playing effects on a haptic device. - * - * \param haptic Haptic device to stop. - * \return 0 on success or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); - -/** - * \brief Checks to see if rumble is supported on a haptic device. - * - * \param haptic Haptic device to check to see if it supports rumble. - * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - */ -extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); - -/** - * \brief Initializes the haptic device for simple rumble playback. - * - * \param haptic Haptic device to initialize for simple rumble playback. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticRumbleSupported - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - */ -extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); - -/** - * \brief Runs simple rumble on a haptic device - * - * \param haptic Haptic device to play rumble effect on. - * \param strength Strength of the rumble to play as a 0-1 float value. - * \param length Length of the rumble to play in milliseconds. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticRumbleSupported - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumbleStop - */ -extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); - -/** - * \brief Stops the simple rumble on a haptic device. - * - * \param haptic Haptic to stop the rumble on. - * \return 0 on success or -1 on error. - * - * \sa SDL_HapticRumbleSupported - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - */ -extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_haptic_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_hints.h b/Source/3rdParty/sdl/include/SDL_hints.h deleted file mode 100644 index b98ce6834..000000000 --- a/Source/3rdParty/sdl/include/SDL_hints.h +++ /dev/null @@ -1,517 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_hints.h - * - * Official documentation for SDL configuration variables - * - * This file contains functions to set and get configuration hints, - * as well as listing each of them alphabetically. - * - * The convention for naming hints is SDL_HINT_X, where "SDL_X" is - * the environment variable that can be used to override the default. - * - * In general these hints are just that - they may or may not be - * supported or applicable on any given platform, but they provide - * a way for an application or user to give the library a hint as - * to how they would like the library to work. - */ - -#ifndef _SDL_hints_h -#define _SDL_hints_h - -#include "SDL_stdinc.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. - * - * SDL can try to accelerate the SDL screen surface by using streaming - * textures with a 3D rendering engine. This variable controls whether and - * how this is done. - * - * This variable can be set to the following values: - * "0" - Disable 3D acceleration - * "1" - Enable 3D acceleration, using the default renderer. - * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) - * - * By default SDL tries to make a best guess for each platform whether - * to use acceleration or not. - */ -#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" - -/** - * \brief A variable specifying which render driver to use. - * - * If the application doesn't pick a specific renderer to use, this variable - * specifies the name of the preferred renderer. If the preferred renderer - * can't be initialized, the normal default renderer is used. - * - * This variable is case insensitive and can be set to the following values: - * "direct3d" - * "opengl" - * "opengles2" - * "opengles" - * "software" - * - * The default varies by platform, but it's the first one in the list that - * is available on the current platform. - */ -#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" - -/** - * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. - * - * This variable can be set to the following values: - * "0" - Disable shaders - * "1" - Enable shaders - * - * By default shaders are used if OpenGL supports them. - */ -#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" - -/** - * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. - * - * This variable can be set to the following values: - * "0" - Thread-safety is not enabled (faster) - * "1" - Thread-safety is enabled - * - * By default the Direct3D device is created with thread-safety disabled. - */ -#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" - -/** - * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. - * - * This variable does not have any effect on the Direct3D 9 based renderer. - * - * This variable can be set to the following values: - * "0" - Disable Debug Layer use - * "1" - Enable Debug Layer use - * - * By default, SDL does not use Direct3D Debug Layer. - */ -#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_HINT_RENDER_DIRECT3D11_DEBUG" - -/** - * \brief A variable controlling the scaling quality - * - * This variable can be set to the following values: - * "0" or "nearest" - Nearest pixel sampling - * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) - * "2" or "best" - Currently this is the same as "linear" - * - * By default nearest pixel sampling is used - */ -#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" - -/** - * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. - * - * This variable can be set to the following values: - * "0" - Disable vsync - * "1" - Enable vsync - * - * By default SDL does not sync screen surface updates with vertical refresh. - */ -#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" - -/** - * \brief A variable controlling whether the screensaver is enabled. - * - * This variable can be set to the following values: - * "0" - Disable screensaver - * "1" - Enable screensaver - * - * By default SDL will disable the screensaver. - */ -#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" - -/** - * \brief A variable controlling whether the X11 VidMode extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XVidMode - * "1" - Enable XVidMode - * - * By default SDL will use XVidMode if it is available. - */ -#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" - -/** - * \brief A variable controlling whether the X11 Xinerama extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable Xinerama - * "1" - Enable Xinerama - * - * By default SDL will use Xinerama if it is available. - */ -#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" - -/** - * \brief A variable controlling whether the X11 XRandR extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XRandR - * "1" - Enable XRandR - * - * By default SDL will not use XRandR because of window manager issues. - */ -#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" - -/** - * \brief A variable controlling whether grabbing input grabs the keyboard - * - * This variable can be set to the following values: - * "0" - Grab will affect only the mouse - * "1" - Grab will affect mouse and keyboard - * - * By default SDL will not grab the keyboard so system shortcuts still work. - */ -#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" - -/** -* \brief A variable controlling whether relative mouse mode is implemented using mouse warping -* -* This variable can be set to the following values: -* "0" - Relative mouse mode uses raw input -* "1" - Relative mouse mode uses mouse warping -* -* By default SDL will use raw input for relative mouse mode -*/ -#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" - -/** - * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. - * - */ -#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" - -/** - * \brief A variable controlling whether the idle timer is disabled on iOS. - * - * When an iOS app does not receive touches for some time, the screen is - * dimmed automatically. For games where the accelerometer is the only input - * this is problematic. This functionality can be disabled by setting this - * hint. - * - * This variable can be set to the following values: - * "0" - Enable idle timer - * "1" - Disable idle timer - */ -#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" - -/** - * \brief A variable controlling which orientations are allowed on iOS. - * - * In some circumstances it is necessary to be able to explicitly control - * which UI orientations are allowed. - * - * This variable is a space delimited list of the following values: - * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" - */ -#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" - -/** - * \brief A variable controlling whether an Android built-in accelerometer should be - * listed as a joystick device, rather than listing actual joysticks only. - * - * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). - */ -#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" - - -/** - * \brief A variable that lets you disable the detection and use of Xinput gamepad devices - * - * The variable can be set to the following values: - * "0" - Disable XInput detection (only uses direct input) - * "1" - Enable XInput detection (the default) - */ -#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" - - -/** - * \brief A variable that lets you manually hint extra gamecontroller db entries - * - * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() - */ -#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" - - -/** - * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. - * - * The variable can be set to the following values: - * "0" - Disable joystick & gamecontroller input events when the - * application is in the background. - * "1" - Enable joystick & gamecontroller input events when the - * application is in the background. - * - * The default value is "0". This hint may be set at any time. - */ -#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" - - -/** - * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. - * This is a debugging aid for developers and not expected to be used by end users. The default is "1" - * - * This variable can be set to the following values: - * "0" - don't allow topmost - * "1" - allow topmost - */ -#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" - - -/** - * \brief A variable that controls the timer resolution, in milliseconds. - * - * The higher resolution the timer, the more frequently the CPU services - * timer interrupts, and the more precise delays are, but this takes up - * power and CPU time. This hint is only used on Windows 7 and earlier. - * - * See this blog post for more information: - * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ - * - * If this variable is set to "0", the system timer resolution is not set. - * - * The default value is "1". This hint may be set at any time. - */ -#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" - - -/** - * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac) - */ -#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" - -/** - * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac - * - * If present, holding ctrl while left clicking will generate a right click - * event when on Mac. - */ -#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" - -/** -* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries -* -* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It -* can use two different sets of binaries, those compiled by the user from source -* or those provided by the Chrome browser. In the later case, these binaries require -* that SDL loads a DLL providing the shader compiler. -* -* This variable can be set to the following values: -* "d3dcompiler_46.dll" - default, best for Vista or later. -* "d3dcompiler_43.dll" - for XP support. -* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. -* -*/ -#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" - -/** -* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). -* -* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has -* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly -* created SDL_Window: -* -* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is -* needed for example when sharing an OpenGL context across multiple windows. -* -* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for -* OpenGL rendering. -* -* This variable can be set to the following values: -* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should -* share a pixel format with. -*/ -#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" - -/* - * \brief A URL to a WinRT app's privacy policy - * - * All network-enabled WinRT apps must make a privacy policy available to its - * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be - * be available in the Windows Settings charm, as accessed from within the app. - * SDL provides code to add a URL-based link there, which can point to the app's - * privacy policy. - * - * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL - * before calling any SDL_Init functions. The contents of the hint should - * be a valid URL. For example, "http://www.example.com". - * - * The default value is "", which will prevent SDL from adding a privacy policy - * link to the Settings charm. This hint should only be set during app init. - * - * The label text of an app's "Privacy Policy" link may be customized via another - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that on Windows Phone, Microsoft does not provide standard UI - * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL - * will not get used on that platform. Network-enabled phone apps should display - * their privacy policy through some other, in-app means. - */ -#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_HINT_WINRT_PRIVACY_POLICY_URL" - -/** \brief Label text for a WinRT app's privacy policy link - * - * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, - * Microsoft mandates that this policy be available via the Windows Settings charm. - * SDL provides code to add a link there, with it's label text being set via the - * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that a privacy policy's contents are not set via this hint. A separate - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the - * policy. - * - * The contents of this hint should be encoded as a UTF8 string. - * - * The default value is "Privacy Policy". This hint should only be set during app - * initialization, preferably before any calls to SDL_Init. - * - * For additional information on linking to a privacy policy, see the documentation for - * SDL_HINT_WINRT_PRIVACY_POLICY_URL. - */ -#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL" - -/** \brief If set to 1, back button press events on Windows Phone 8+ will be marked as handled. - * - * TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use - * For now, more details on why this is needed can be found at the - * beginning of the following web page: - * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx - */ -#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_HINT_WINRT_HANDLE_BACK_BUTTON" - -/** - * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. - * - * This hint only applies to Mac OS X. - * - * The variable can be set to the following values: - * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and - * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" - * button on their titlebars). - * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and - * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" - * button on their titlebars. - * - * The default value is "1". Spaces are disabled regardless of this hint if - * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before - * any windows are created. - */ -#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" - - -/** - * \brief An enumeration of hint priorities - */ -typedef enum -{ - SDL_HINT_DEFAULT, - SDL_HINT_NORMAL, - SDL_HINT_OVERRIDE -} SDL_HintPriority; - - -/** - * \brief Set a hint with a specific priority - * - * The priority controls the behavior when setting a hint that already - * has a value. Hints will replace existing hints of their priority and - * lower. Environment variables are considered to have override priority. - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */ -extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, - const char *value, - SDL_HintPriority priority); - -/** - * \brief Set a hint with normal priority - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */ -extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, - const char *value); - -/** - * \brief Get a hint - * - * \return The string value of a hint variable. - */ -extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); - -/** - * \brief Add a function to watch a particular hint - * - * \param name The hint to watch - * \param callback The function to call when the hint value changes - * \param userdata A pointer to pass to the callback function - */ -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); -extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); - -/** - * \brief Remove a function watching a particular hint - * - * \param name The hint being watched - * \param callback The function being called when the hint value changes - * \param userdata A pointer being passed to the callback function - */ -extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); - -/** - * \brief Clear all hints - * - * This function is called during SDL_Quit() to free stored hints. - */ -extern DECLSPEC void SDLCALL SDL_ClearHints(void); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_hints_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_joystick.h b/Source/3rdParty/sdl/include/SDL_joystick.h deleted file mode 100644 index b0b1c6673..000000000 --- a/Source/3rdParty/sdl/include/SDL_joystick.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_joystick.h - * - * Include file for SDL joystick event handling - * - * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick - * behind a device_index changing as joysticks are plugged and unplugged. - * - * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted - * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. - * - * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of - * the device (a X360 wired controller for example). This identifier is platform dependent. - * - * - */ - -#ifndef _SDL_joystick_h -#define _SDL_joystick_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file SDL_joystick.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system - * for joysticks, and load appropriate drivers. - * - * If you would like to receive joystick updates while the application - * is in the background, you should set the following hint before calling - * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - */ - -/* The joystick structure used to identify an SDL joystick */ -struct _SDL_Joystick; -typedef struct _SDL_Joystick SDL_Joystick; - -/* A structure that encodes the stable unique id for a joystick device */ -typedef struct { - Uint8 data[16]; -} SDL_JoystickGUID; - -typedef Sint32 SDL_JoystickID; - - -/* Function prototypes */ -/** - * Count the number of joysticks attached to the system right now - */ -extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); - -/** - * Get the implementation dependent name of a joystick. - * This can be called before any joysticks are opened. - * If no name can be found, this function returns NULL. - */ -extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); - -/** - * Open a joystick for use. - * The index passed as an argument refers tothe N'th joystick on the system. - * This index is the value which will identify this joystick in future joystick - * events. - * - * \return A joystick identifier, or NULL if an error occurred. - */ -extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); - -/** - * Return the name for this currently opened joystick. - * If no name can be found, this function returns NULL. - */ -extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); - -/** - * Return the GUID for the joystick at this index - */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); - -/** - * Return the GUID for this opened joystick - */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); - -/** - * Return a string representation for this guid. pszGUID must point to at least 33 bytes - * (32 for the string plus a NULL terminator). - */ -extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); - -/** - * convert a string into a joystick formatted guid - */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); - -/** - * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); - -/** - * Get the instance ID of an opened joystick or -1 if the joystick is invalid. - */ -extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick); - -/** - * Get the number of general axis controls on a joystick. - */ -extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick); - -/** - * Get the number of trackballs on a joystick. - * - * Joystick trackballs have only relative motion events associated - * with them and their state cannot be polled. - */ -extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick); - -/** - * Get the number of POV hats on a joystick. - */ -extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick); - -/** - * Get the number of buttons on a joystick. - */ -extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick); - -/** - * Update the current state of the open joysticks. - * - * This is called automatically by the event loop if any joystick - * events are enabled. - */ -extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); - -/** - * Enable/disable joystick event polling. - * - * If joystick events are disabled, you must call SDL_JoystickUpdate() - * yourself and check the state of the joystick when you want joystick - * information. - * - * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. - */ -extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); - -/** - * Get the current state of an axis control on a joystick. - * - * The state is a value ranging from -32768 to 32767. - * - * The axis indices start at index 0. - */ -extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, - int axis); - -/** - * \name Hat positions - */ -/* @{ */ -#define SDL_HAT_CENTERED 0x00 -#define SDL_HAT_UP 0x01 -#define SDL_HAT_RIGHT 0x02 -#define SDL_HAT_DOWN 0x04 -#define SDL_HAT_LEFT 0x08 -#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) -#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) -#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) -#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) -/* @} */ - -/** - * Get the current state of a POV hat on a joystick. - * - * The hat indices start at index 0. - * - * \return The return value is one of the following positions: - * - ::SDL_HAT_CENTERED - * - ::SDL_HAT_UP - * - ::SDL_HAT_RIGHT - * - ::SDL_HAT_DOWN - * - ::SDL_HAT_LEFT - * - ::SDL_HAT_RIGHTUP - * - ::SDL_HAT_RIGHTDOWN - * - ::SDL_HAT_LEFTUP - * - ::SDL_HAT_LEFTDOWN - */ -extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick, - int hat); - -/** - * Get the ball axis change since the last poll. - * - * \return 0, or -1 if you passed it invalid parameters. - * - * The ball indices start at index 0. - */ -extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, - int ball, int *dx, int *dy); - -/** - * Get the current state of a button on a joystick. - * - * The button indices start at index 0. - */ -extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, - int button); - -/** - * Close a joystick previously opened with SDL_JoystickOpen(). - */ -extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_joystick_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_keyboard.h b/Source/3rdParty/sdl/include/SDL_keyboard.h deleted file mode 100644 index 586a26cff..000000000 --- a/Source/3rdParty/sdl/include/SDL_keyboard.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_keyboard.h - * - * Include file for SDL keyboard event handling - */ - -#ifndef _SDL_keyboard_h -#define _SDL_keyboard_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_keycode.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief The SDL keysym structure, used in key events. - * - * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event. - */ -typedef struct SDL_Keysym -{ - SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ - SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ - Uint16 mod; /**< current key modifiers */ - Uint32 unused; -} SDL_Keysym; - -/* Function prototypes */ - -/** - * \brief Get the window which currently has keyboard focus. - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); - -/** - * \brief Get a snapshot of the current state of the keyboard. - * - * \param numkeys if non-NULL, receives the length of the returned array. - * - * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. - * - * \b Example: - * \code - * const Uint8 *state = SDL_GetKeyboardState(NULL); - * if ( state[SDL_SCANCODE_RETURN] ) { - * printf(" is pressed.\n"); - * } - * \endcode - */ -extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); - -/** - * \brief Get the current key modifier state for the keyboard. - */ -extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); - -/** - * \brief Set the current key modifier state for the keyboard. - * - * \note This does not change the keyboard state, only the key modifier flags. - */ -extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); - -/** - * \brief Get the key code corresponding to the given scancode according - * to the current keyboard layout. - * - * See ::SDL_Keycode for details. - * - * \sa SDL_GetKeyName() - */ -extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); - -/** - * \brief Get the scancode corresponding to the given key code according to the - * current keyboard layout. - * - * See ::SDL_Scancode for details. - * - * \sa SDL_GetScancodeName() - */ -extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); - -/** - * \brief Get a human-readable name for a scancode. - * - * \return A pointer to the name for the scancode. - * If the scancode doesn't have a name, this function returns - * an empty string (""). - * - * \sa SDL_Scancode - */ -extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); - -/** - * \brief Get a scancode from a human-readable name - * - * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized - * - * \sa SDL_Scancode - */ -extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); - -/** - * \brief Get a human-readable name for a key. - * - * \return A pointer to a UTF-8 string that stays valid at least until the next - * call to this function. If you need it around any longer, you must - * copy it. If the key doesn't have a name, this function returns an - * empty string (""). - * - * \sa SDL_Key - */ -extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); - -/** - * \brief Get a key code from a human-readable name - * - * \return key code, or SDLK_UNKNOWN if the name wasn't recognized - * - * \sa SDL_Keycode - */ -extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); - -/** - * \brief Start accepting Unicode text input events. - * This function will show the on-screen keyboard if supported. - * - * \sa SDL_StopTextInput() - * \sa SDL_SetTextInputRect() - * \sa SDL_HasScreenKeyboardSupport() - */ -extern DECLSPEC void SDLCALL SDL_StartTextInput(void); - -/** - * \brief Return whether or not Unicode text input events are enabled. - * - * \sa SDL_StartTextInput() - * \sa SDL_StopTextInput() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); - -/** - * \brief Stop receiving any text input events. - * This function will hide the on-screen keyboard if supported. - * - * \sa SDL_StartTextInput() - * \sa SDL_HasScreenKeyboardSupport() - */ -extern DECLSPEC void SDLCALL SDL_StopTextInput(void); - -/** - * \brief Set the rectangle used to type Unicode text inputs. - * This is used as a hint for IME and on-screen keyboard placement. - * - * \sa SDL_StartTextInput() - */ -extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); - -/** - * \brief Returns whether the platform has some screen keyboard support. - * - * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. - * - * \note Not all screen keyboard functions are supported on all platforms. - * - * \sa SDL_IsScreenKeyboardShown() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); - -/** - * \brief Returns whether the screen keyboard is shown for given window. - * - * \param window The window for which screen keyboard should be queried. - * - * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. - * - * \sa SDL_HasScreenKeyboardSupport() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_keyboard_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_keycode.h b/Source/3rdParty/sdl/include/SDL_keycode.h deleted file mode 100644 index d5f5dd0ae..000000000 --- a/Source/3rdParty/sdl/include/SDL_keycode.h +++ /dev/null @@ -1,341 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_keycode.h - * - * Defines constants which identify keyboard keys and modifiers. - */ - -#ifndef _SDL_keycode_h -#define _SDL_keycode_h - -#include "SDL_stdinc.h" -#include "SDL_scancode.h" - -/** - * \brief The SDL virtual key representation. - * - * Values of this type are used to represent keyboard keys using the current - * layout of the keyboard. These values include Unicode values representing - * the unmodified character that would be generated by pressing the key, or - * an SDLK_* constant for those keys that do not generate characters. - */ -typedef Sint32 SDL_Keycode; - -#define SDLK_SCANCODE_MASK (1<<30) -#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - -enum -{ - SDLK_UNKNOWN = 0, - - SDLK_RETURN = '\r', - SDLK_ESCAPE = '\033', - SDLK_BACKSPACE = '\b', - SDLK_TAB = '\t', - SDLK_SPACE = ' ', - SDLK_EXCLAIM = '!', - SDLK_QUOTEDBL = '"', - SDLK_HASH = '#', - SDLK_PERCENT = '%', - SDLK_DOLLAR = '$', - SDLK_AMPERSAND = '&', - SDLK_QUOTE = '\'', - SDLK_LEFTPAREN = '(', - SDLK_RIGHTPAREN = ')', - SDLK_ASTERISK = '*', - SDLK_PLUS = '+', - SDLK_COMMA = ',', - SDLK_MINUS = '-', - SDLK_PERIOD = '.', - SDLK_SLASH = '/', - SDLK_0 = '0', - SDLK_1 = '1', - SDLK_2 = '2', - SDLK_3 = '3', - SDLK_4 = '4', - SDLK_5 = '5', - SDLK_6 = '6', - SDLK_7 = '7', - SDLK_8 = '8', - SDLK_9 = '9', - SDLK_COLON = ':', - SDLK_SEMICOLON = ';', - SDLK_LESS = '<', - SDLK_EQUALS = '=', - SDLK_GREATER = '>', - SDLK_QUESTION = '?', - SDLK_AT = '@', - /* - Skip uppercase letters - */ - SDLK_LEFTBRACKET = '[', - SDLK_BACKSLASH = '\\', - SDLK_RIGHTBRACKET = ']', - SDLK_CARET = '^', - SDLK_UNDERSCORE = '_', - SDLK_BACKQUOTE = '`', - SDLK_a = 'a', - SDLK_b = 'b', - SDLK_c = 'c', - SDLK_d = 'd', - SDLK_e = 'e', - SDLK_f = 'f', - SDLK_g = 'g', - SDLK_h = 'h', - SDLK_i = 'i', - SDLK_j = 'j', - SDLK_k = 'k', - SDLK_l = 'l', - SDLK_m = 'm', - SDLK_n = 'n', - SDLK_o = 'o', - SDLK_p = 'p', - SDLK_q = 'q', - SDLK_r = 'r', - SDLK_s = 's', - SDLK_t = 't', - SDLK_u = 'u', - SDLK_v = 'v', - SDLK_w = 'w', - SDLK_x = 'x', - SDLK_y = 'y', - SDLK_z = 'z', - - SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), - - SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), - SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), - SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), - SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), - SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), - SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), - SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), - SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), - SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), - SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), - SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), - SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), - - SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), - SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), - SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), - SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), - SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), - SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), - SDLK_DELETE = '\177', - SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), - SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), - SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), - SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), - SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), - SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), - - SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), - SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), - SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), - SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), - SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), - SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), - SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), - SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), - SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), - SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), - SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), - SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), - SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), - SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), - SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), - SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), - SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), - - SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), - SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), - SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), - SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), - SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), - SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), - SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), - SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), - SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), - SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), - SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), - SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), - SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), - SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), - SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), - SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), - SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), - SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), - SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), - SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), - SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), - SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), - SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), - SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), - SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), - SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), - SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), - SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), - SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), - SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), - SDLK_KP_EQUALSAS400 = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), - - SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), - SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), - SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), - SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), - SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), - SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), - SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), - SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), - SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), - SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), - SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), - SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), - - SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), - SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), - SDLK_THOUSANDSSEPARATOR = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), - SDLK_DECIMALSEPARATOR = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), - SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), - SDLK_CURRENCYSUBUNIT = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), - SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), - SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), - SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), - SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), - SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), - SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), - SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), - SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), - SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), - SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), - SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), - SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), - SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), - SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), - SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), - SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), - SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), - SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), - SDLK_KP_DBLAMPERSAND = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), - SDLK_KP_VERTICALBAR = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), - SDLK_KP_DBLVERTICALBAR = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), - SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), - SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), - SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), - SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), - SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), - SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), - SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), - SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), - SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), - SDLK_KP_MEMSUBTRACT = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), - SDLK_KP_MEMMULTIPLY = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), - SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), - SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), - SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), - SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), - SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), - SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), - SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), - SDLK_KP_HEXADECIMAL = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), - - SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), - SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), - SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), - SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), - SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), - SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), - SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), - SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), - - SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), - - SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), - SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), - SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), - SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), - SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), - SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), - SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), - SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), - SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), - SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), - SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), - SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), - SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), - SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), - SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), - SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), - SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), - - SDLK_BRIGHTNESSDOWN = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), - SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), - SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), - SDLK_KBDILLUMTOGGLE = - SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), - SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), - SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), - SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), - SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) -}; - -/** - * \brief Enumeration of valid key mods (possibly OR'd together). - */ -typedef enum -{ - KMOD_NONE = 0x0000, - KMOD_LSHIFT = 0x0001, - KMOD_RSHIFT = 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LGUI = 0x0400, - KMOD_RGUI = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} SDL_Keymod; - -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) - -#endif /* _SDL_keycode_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_loadso.h b/Source/3rdParty/sdl/include/SDL_loadso.h deleted file mode 100644 index 0359eae17..000000000 --- a/Source/3rdParty/sdl/include/SDL_loadso.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_loadso.h - * - * System dependent library loading routines - * - * Some things to keep in mind: - * \li These functions only work on C function names. Other languages may - * have name mangling and intrinsic language support that varies from - * compiler to compiler. - * \li Make sure you declare your function pointers with the same calling - * convention as the actual library function. Your code will crash - * mysteriously if you do not do this. - * \li Avoid namespace collisions. If you load a symbol from the library, - * it is not defined whether or not it goes into the global symbol - * namespace for the application. If it does and it conflicts with - * symbols in your code or other shared libraries, you will not get - * the results you expect. :) - */ - -#ifndef _SDL_loadso_h -#define _SDL_loadso_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This function dynamically loads a shared object and returns a pointer - * to the object handle (or NULL if there was an error). - * The 'sofile' parameter is a system dependent name of the object file. - */ -extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); - -/** - * Given an object handle, this function looks up the address of the - * named function in the shared object and returns it. This address - * is no longer valid after calling SDL_UnloadObject(). - */ -extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, - const char *name); - -/** - * Unload a shared object from memory. - */ -extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_loadso_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_log.h b/Source/3rdParty/sdl/include/SDL_log.h deleted file mode 100644 index 5c2bca593..000000000 --- a/Source/3rdParty/sdl/include/SDL_log.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_log.h - * - * Simple log messages with categories and priorities. - * - * By default logs are quiet, but if you're debugging SDL you might want: - * - * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); - * - * Here's where the messages go on different platforms: - * Windows: debug output stream - * Android: log output - * Others: standard error output (stderr) - */ - -#ifndef _SDL_log_h -#define _SDL_log_h - -#include "SDL_stdinc.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \brief The maximum size of a log message - * - * Messages longer than the maximum size will be truncated - */ -#define SDL_MAX_LOG_MESSAGE 4096 - -/** - * \brief The predefined log categories - * - * By default the application category is enabled at the INFO level, - * the assert category is enabled at the WARN level, test is enabled - * at the VERBOSE level and all other categories are enabled at the - * CRITICAL level. - */ -enum -{ - SDL_LOG_CATEGORY_APPLICATION, - SDL_LOG_CATEGORY_ERROR, - SDL_LOG_CATEGORY_ASSERT, - SDL_LOG_CATEGORY_SYSTEM, - SDL_LOG_CATEGORY_AUDIO, - SDL_LOG_CATEGORY_VIDEO, - SDL_LOG_CATEGORY_RENDER, - SDL_LOG_CATEGORY_INPUT, - SDL_LOG_CATEGORY_TEST, - - /* Reserved for future SDL library use */ - SDL_LOG_CATEGORY_RESERVED1, - SDL_LOG_CATEGORY_RESERVED2, - SDL_LOG_CATEGORY_RESERVED3, - SDL_LOG_CATEGORY_RESERVED4, - SDL_LOG_CATEGORY_RESERVED5, - SDL_LOG_CATEGORY_RESERVED6, - SDL_LOG_CATEGORY_RESERVED7, - SDL_LOG_CATEGORY_RESERVED8, - SDL_LOG_CATEGORY_RESERVED9, - SDL_LOG_CATEGORY_RESERVED10, - - /* Beyond this point is reserved for application use, e.g. - enum { - MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, - MYAPP_CATEGORY_AWESOME2, - MYAPP_CATEGORY_AWESOME3, - ... - }; - */ - SDL_LOG_CATEGORY_CUSTOM -}; - -/** - * \brief The predefined log priorities - */ -typedef enum -{ - SDL_LOG_PRIORITY_VERBOSE = 1, - SDL_LOG_PRIORITY_DEBUG, - SDL_LOG_PRIORITY_INFO, - SDL_LOG_PRIORITY_WARN, - SDL_LOG_PRIORITY_ERROR, - SDL_LOG_PRIORITY_CRITICAL, - SDL_NUM_LOG_PRIORITIES -} SDL_LogPriority; - - -/** - * \brief Set the priority of all log categories - */ -extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); - -/** - * \brief Set the priority of a particular log category - */ -extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, - SDL_LogPriority priority); - -/** - * \brief Get the priority of a particular log category - */ -extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); - -/** - * \brief Reset all priorities to default. - * - * \note This is called in SDL_Quit(). - */ -extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); - -/** - * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO - */ -extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE - */ -extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_DEBUG - */ -extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_INFO - */ -extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_WARN - */ -extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_ERROR - */ -extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); - -/** - * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL - */ -extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); - -/** - * \brief Log a message with the specified category and priority. - */ -extern DECLSPEC void SDLCALL SDL_LogMessage(int category, - SDL_LogPriority priority, - const char *fmt, ...); - -/** - * \brief Log a message with the specified category and priority. - */ -extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, - SDL_LogPriority priority, - const char *fmt, va_list ap); - -/** - * \brief The prototype for the log output function - */ -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); - -/** - * \brief Get the current log output function. - */ -extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); - -/** - * \brief This function allows you to replace the default log output - * function with one of your own. - */ -extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_log_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_main.h b/Source/3rdParty/sdl/include/SDL_main.h deleted file mode 100644 index 2e8fae95e..000000000 --- a/Source/3rdParty/sdl/include/SDL_main.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_main_h -#define _SDL_main_h - -#include "SDL_stdinc.h" - -/** - * \file SDL_main.h - * - * Redefine main() on some platforms so that it is called by SDL. - */ - -#ifndef SDL_MAIN_HANDLED -#if defined(__WIN32__) -/* On Windows SDL provides WinMain(), which parses the command line and passes - the arguments to your main function. - - If you provide your own WinMain(), you may define SDL_MAIN_HANDLED - */ -#define SDL_MAIN_AVAILABLE - -#elif defined(__WINRT__) -/* On WinRT, SDL provides a main function that initializes CoreApplication, - creating an instance of IFrameworkView in the process. - - Please note that #include'ing SDL_main.h is not enough to get a main() - function working. In non-XAML apps, the file, - src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled - into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be - called, with a pointer to the Direct3D-hosted XAML control passed in. -*/ -#define SDL_MAIN_NEEDED - -#elif defined(__IPHONEOS__) -/* On iOS SDL provides a main function that creates an application delegate - and starts the iOS application run loop. - - See src/video/uikit/SDL_uikitappdelegate.m for more details. - */ -#define SDL_MAIN_NEEDED - -#elif defined(__ANDROID__) -/* On Android SDL provides a Java class in SDLActivity.java that is the - main activity entry point. - - See README-android.txt for more details on extending that class. - */ -#define SDL_MAIN_NEEDED - -#endif -#endif /* SDL_MAIN_HANDLED */ - -#ifdef __cplusplus -#define C_LINKAGE "C" -#else -#define C_LINKAGE -#endif /* __cplusplus */ - -/** - * \file SDL_main.h - * - * The application's main() function must be called with C linkage, - * and should be declared like this: - * \code - * #ifdef __cplusplus - * extern "C" - * #endif - * int main(int argc, char *argv[]) - * { - * } - * \endcode - */ - -#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) -#define main SDL_main -#endif - -/** - * The prototype for the application's main() function - */ -extern C_LINKAGE int SDL_main(int argc, char *argv[]); - - -#include "begin_code.h" -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This is called by the real SDL main function to let the rest of the - * library know that initialization was done properly. - * - * Calling this yourself without knowing what you're doing can cause - * crashes and hard to diagnose problems with your application. - */ -extern DECLSPEC void SDLCALL SDL_SetMainReady(void); - -#ifdef __WIN32__ - -/** - * This can be called to set the application class at startup - */ -extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, - void *hInst); -extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); - -#endif /* __WIN32__ */ - - -#ifdef __WINRT__ - -/** - * \brief Initializes and launches an SDL/WinRT application. - * - * \param mainFunction The SDL app's C-style main(). - * \param xamlBackgroundPanel An optional, XAML-based, background panel. - * For Non-XAML apps, this value must be set to NULL. For XAML apps, - * pass in a pointer to a SwapChainBackgroundPanel, casted to an - * IInspectable (via reinterpret_cast). - * \ret 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more - * information on the failure. - */ -extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel); - -#endif /* __WINRT__ */ - - -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_main_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_messagebox.h b/Source/3rdParty/sdl/include/SDL_messagebox.h deleted file mode 100644 index 6004da0f5..000000000 --- a/Source/3rdParty/sdl/include/SDL_messagebox.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_messagebox_h -#define _SDL_messagebox_h - -#include "SDL_stdinc.h" -#include "SDL_video.h" /* For SDL_Window */ - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief SDL_MessageBox flags. If supported will display warning icon, etc. - */ -typedef enum -{ - SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ - SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ - SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ -} SDL_MessageBoxFlags; - -/** - * \brief Flags for SDL_MessageBoxButtonData. - */ -typedef enum -{ - SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ - SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ -} SDL_MessageBoxButtonFlags; - -/** - * \brief Individual button data. - */ -typedef struct -{ - Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ - int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ - const char * text; /**< The UTF-8 button text */ -} SDL_MessageBoxButtonData; - -/** - * \brief RGB value used in a message box color scheme - */ -typedef struct -{ - Uint8 r, g, b; -} SDL_MessageBoxColor; - -typedef enum -{ - SDL_MESSAGEBOX_COLOR_BACKGROUND, - SDL_MESSAGEBOX_COLOR_TEXT, - SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, - SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, - SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, - SDL_MESSAGEBOX_COLOR_MAX -} SDL_MessageBoxColorType; - -/** - * \brief A set of colors to use for message box dialogs - */ -typedef struct -{ - SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; -} SDL_MessageBoxColorScheme; - -/** - * \brief MessageBox structure containing title, text, window, etc. - */ -typedef struct -{ - Uint32 flags; /**< ::SDL_MessageBoxFlags */ - SDL_Window *window; /**< Parent window, can be NULL */ - const char *title; /**< UTF-8 title */ - const char *message; /**< UTF-8 message text */ - - int numbuttons; - const SDL_MessageBoxButtonData *buttons; - - const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ -} SDL_MessageBoxData; - -/** - * \brief Create a modal message box. - * - * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. - * \param buttonid The pointer to which user id of hit button should be copied. - * - * \return -1 on error, otherwise 0 and buttonid contains user id of button - * hit or -1 if dialog was closed. - * - * \note This function should be called on the thread that created the parent - * window, or on the main thread if the messagebox has no parent. It will - * block execution of that thread until the user clicks a button or - * closes the messagebox. - */ -extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - -/** - * \brief Create a simple modal message box - * - * \param flags ::SDL_MessageBoxFlags - * \param title UTF-8 title text - * \param message UTF-8 message text - * \param window The parent window, or NULL for no parent - * - * \return 0 on success, -1 on error - * - * \sa SDL_ShowMessageBox - */ -extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_messagebox_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_mouse.h b/Source/3rdParty/sdl/include/SDL_mouse.h deleted file mode 100644 index ebfd18fa7..000000000 --- a/Source/3rdParty/sdl/include/SDL_mouse.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_mouse.h - * - * Include file for SDL mouse event handling. - */ - -#ifndef _SDL_mouse_h -#define _SDL_mouse_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ - -/** - * \brief Cursor types for SDL_CreateSystemCursor. - */ -typedef enum -{ - SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ - SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ - SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ - SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ - SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ - SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ - SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ - SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ - SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ - SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ - SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ - SDL_SYSTEM_CURSOR_HAND, /**< Hand */ - SDL_NUM_SYSTEM_CURSORS -} SDL_SystemCursor; - -/* Function prototypes */ - -/** - * \brief Get the window which currently has mouse focus. - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); - -/** - * \brief Retrieve the current state of the mouse. - * - * The current button state is returned as a button bitmask, which can - * be tested using the SDL_BUTTON(X) macros, and x and y are set to the - * mouse cursor position relative to the focus window for the currently - * selected mouse. You can pass NULL for either x or y. - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); - -/** - * \brief Retrieve the relative state of the mouse. - * - * The current button state is returned as a button bitmask, which can - * be tested using the SDL_BUTTON(X) macros, and x and y are set to the - * mouse deltas since the last call to SDL_GetRelativeMouseState(). - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); - -/** - * \brief Moves the mouse to the given position within the window. - * - * \param window The window to move the mouse into, or NULL for the current mouse focus - * \param x The x coordinate within the window - * \param y The y coordinate within the window - * - * \note This function generates a mouse motion event - */ -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, - int x, int y); - -/** - * \brief Set relative mouse mode. - * - * \param enabled Whether or not to enable relative mode - * - * \return 0 on success, or -1 if relative mode is not supported. - * - * While the mouse is in relative mode, the cursor is hidden, and the - * driver will try to report continuous motion in the current window. - * Only relative motion events will be delivered, the mouse position - * will not change. - * - * \note This function will flush any pending mouse motion. - * - * \sa SDL_GetRelativeMouseMode() - */ -extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); - -/** - * \brief Query whether relative mouse mode is enabled. - * - * \sa SDL_SetRelativeMouseMode() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); - -/** - * \brief Create a cursor, using the specified bitmap data and - * mask (in MSB format). - * - * The cursor width must be a multiple of 8 bits. - * - * The cursor is created in black and white according to the following: - * - * - * - * - * - * - *
data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black - * if not.
- * - * \sa SDL_FreeCursor() - */ -extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, - const Uint8 * mask, - int w, int h, int hot_x, - int hot_y); - -/** - * \brief Create a color cursor. - * - * \sa SDL_FreeCursor() - */ -extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, - int hot_x, - int hot_y); - -/** - * \brief Create a system cursor. - * - * \sa SDL_FreeCursor() - */ -extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); - -/** - * \brief Set the active cursor. - */ -extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); - -/** - * \brief Return the active cursor. - */ -extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); - -/** - * \brief Return the default cursor. - */ -extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); - -/** - * \brief Frees a cursor created with SDL_CreateCursor(). - * - * \sa SDL_CreateCursor() - */ -extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); - -/** - * \brief Toggle whether or not the cursor is shown. - * - * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current - * state. - * - * \return 1 if the cursor is shown, or 0 if the cursor is hidden. - */ -extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); - -/** - * Used as a mask when testing buttons in buttonstate. - * - Button 1: Left mouse button - * - Button 2: Middle mouse button - * - Button 3: Right mouse button - */ -#define SDL_BUTTON(X) (1 << ((X)-1)) -#define SDL_BUTTON_LEFT 1 -#define SDL_BUTTON_MIDDLE 2 -#define SDL_BUTTON_RIGHT 3 -#define SDL_BUTTON_X1 4 -#define SDL_BUTTON_X2 5 -#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) -#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) -#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) -#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) -#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_mouse_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_mutex.h b/Source/3rdParty/sdl/include/SDL_mutex.h deleted file mode 100644 index 3e8b4dbed..000000000 --- a/Source/3rdParty/sdl/include/SDL_mutex.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_mutex_h -#define _SDL_mutex_h - -/** - * \file SDL_mutex.h - * - * Functions to provide thread synchronization primitives. - */ - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Synchronization functions which can time out return this value - * if they time out. - */ -#define SDL_MUTEX_TIMEDOUT 1 - -/** - * This is the timeout value which corresponds to never time out. - */ -#define SDL_MUTEX_MAXWAIT (~(Uint32)0) - - -/** - * \name Mutex functions - */ -/* @{ */ - -/* The SDL mutex structure, defined in SDL_sysmutex.c */ -struct SDL_mutex; -typedef struct SDL_mutex SDL_mutex; - -/** - * Create a mutex, initialized unlocked. - */ -extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); - -/** - * Lock the mutex. - * - * \return 0, or -1 on error. - */ -#define SDL_mutexP(m) SDL_LockMutex(m) -extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); - -/** - * Try to lock the mutex - * - * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); - -/** - * Unlock the mutex. - * - * \return 0, or -1 on error. - * - * \warning It is an error to unlock a mutex that has not been locked by - * the current thread, and doing so results in undefined behavior. - */ -#define SDL_mutexV(m) SDL_UnlockMutex(m) -extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); - -/** - * Destroy a mutex. - */ -extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); - -/* @} *//* Mutex functions */ - - -/** - * \name Semaphore functions - */ -/* @{ */ - -/* The SDL semaphore structure, defined in SDL_syssem.c */ -struct SDL_semaphore; -typedef struct SDL_semaphore SDL_sem; - -/** - * Create a semaphore, initialized with value, returns NULL on failure. - */ -extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); - -/** - * Destroy a semaphore. - */ -extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); - -/** - * This function suspends the calling thread until the semaphore pointed - * to by \c sem has a positive count. It then atomically decreases the - * semaphore count. - */ -extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); - -/** - * Non-blocking variant of SDL_SemWait(). - * - * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would - * block, and -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); - -/** - * Variant of SDL_SemWait() with a timeout in milliseconds. - * - * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not - * succeed in the allotted time, and -1 on error. - * - * \warning On some platforms this function is implemented by looping with a - * delay of 1 ms, and so should be avoided if possible. - */ -extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); - -/** - * Atomically increases the semaphore's count (not blocking). - * - * \return 0, or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); - -/** - * Returns the current count of the semaphore. - */ -extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); - -/* @} *//* Semaphore functions */ - - -/** - * \name Condition variable functions - */ -/* @{ */ - -/* The SDL condition variable structure, defined in SDL_syscond.c */ -struct SDL_cond; -typedef struct SDL_cond SDL_cond; - -/** - * Create a condition variable. - * - * Typical use of condition variables: - * - * Thread A: - * SDL_LockMutex(lock); - * while ( ! condition ) { - * SDL_CondWait(cond, lock); - * } - * SDL_UnlockMutex(lock); - * - * Thread B: - * SDL_LockMutex(lock); - * ... - * condition = true; - * ... - * SDL_CondSignal(cond); - * SDL_UnlockMutex(lock); - * - * There is some discussion whether to signal the condition variable - * with the mutex locked or not. There is some potential performance - * benefit to unlocking first on some platforms, but there are some - * potential race conditions depending on how your code is structured. - * - * In general it's safer to signal the condition variable while the - * mutex is locked. - */ -extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); - -/** - * Destroy a condition variable. - */ -extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); - -/** - * Restart one of the threads that are waiting on the condition variable. - * - * \return 0 or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); - -/** - * Restart all threads that are waiting on the condition variable. - * - * \return 0 or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); - -/** - * Wait on the condition variable, unlocking the provided mutex. - * - * \warning The mutex must be locked before entering this function! - * - * The mutex is re-locked once the condition variable is signaled. - * - * \return 0 when it is signaled, or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); - -/** - * Waits for at most \c ms milliseconds, and returns 0 if the condition - * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not - * signaled in the allotted time, and -1 on error. - * - * \warning On some platforms this function is implemented by looping with a - * delay of 1 ms, and so should be avoided if possible. - */ -extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, - SDL_mutex * mutex, Uint32 ms); - -/* @} *//* Condition variable functions */ - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_mutex_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_name.h b/Source/3rdParty/sdl/include/SDL_name.h deleted file mode 100644 index 719666ff1..000000000 --- a/Source/3rdParty/sdl/include/SDL_name.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDLname_h_ -#define _SDLname_h_ - -#if defined(__STDC__) || defined(__cplusplus) -#define NeedFunctionPrototypes 1 -#endif - -#define SDL_NAME(X) SDL_##X - -#endif /* _SDLname_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_opengl.h b/Source/3rdParty/sdl/include/SDL_opengl.h deleted file mode 100644 index f7ef7f8c2..000000000 --- a/Source/3rdParty/sdl/include/SDL_opengl.h +++ /dev/null @@ -1,11126 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_opengl.h - * - * This is a simple file to encapsulate the OpenGL API headers. - */ - -#ifndef _SDL_opengl_h -#define _SDL_opengl_h - -#include "SDL_config.h" - -#ifndef __IPHONEOS__ - -#ifdef __WIN32__ -//#define WIN32_LEAN_AND_MEAN -#ifndef NOMINMAX -#define NOMINMAX /* Don't defined min() and max() */ -#endif -#include -#endif - -#ifdef __glext_h_ -/* Someone has already included glext.h */ -#define NO_SDL_GLEXT -#endif -#ifndef NO_SDL_GLEXT -#define __glext_h_ /* Don't let gl.h include glext.h */ -#endif -#if defined(__MACOSX__) -#include /* Header File For The OpenGL Library */ -#define __X_GL_H -#else -#include /* Header File For The OpenGL Library */ -#endif -#ifndef NO_SDL_GLEXT -#undef __glext_h_ -#endif - -/** - * \file SDL_opengl.h - * - * This file is included because glext.h is not available on some systems. - * If you don't want this version included, simply define ::NO_SDL_GLEXT. - * - * The latest version is available from: - * http://www.opengl.org/registry/ - */ - -/** - * \def NO_SDL_GLEXT - * - * Define this if you have your own version of glext.h and want to disable the - * version included in SDL_opengl.h. - */ - -#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY) -#ifndef __glext_h_ -#define __glext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2007-2010 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated $Date: 2010-08-03 01:30:25 -0700 (Tue, 03 Aug 2010) $ */ -/* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 64 -/* Function declaration macros - to move into glplatform.h */ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/*************************************************************/ - -#ifndef GL_VERSION_1_2 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED -#define GL_RESCALE_NORMAL 0x803A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#endif - -#ifndef GL_ARB_imaging -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif - -#ifndef GL_ARB_imaging_DEPRECATED -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -#endif - -#ifndef GL_VERSION_1_3 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#endif - -#ifndef GL_VERSION_1_4 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#endif - -#ifndef GL_VERSION_1_5 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#endif - -#ifndef GL_VERSION_1_5_DEPRECATED -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_FOG_COORD_SRC 0x8450 -#define GL_FOG_COORD 0x8451 -#define GL_CURRENT_FOG_COORD 0x8453 -#define GL_FOG_COORD_ARRAY_TYPE 0x8454 -#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORD_ARRAY_POINTER 0x8456 -#define GL_FOG_COORD_ARRAY 0x8457 -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC1_ALPHA 0x8589 -#define GL_SRC2_ALPHA 0x858A -#endif - -#ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_VERSION_2_0_DEPRECATED -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_TEXTURE_COORDS 0x8871 -#endif - -#ifndef GL_VERSION_2_1 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#endif - -#ifndef GL_VERSION_2_1_DEPRECATED -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -#endif - -#ifndef GL_VERSION_3_0 -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_DEPTH_BUFFER 0x8223 -#define GL_STENCIL_BUFFER 0x8224 -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -/* Reuse tokens from ARB_depth_buffer_float */ -/* reuse GL_DEPTH_COMPONENT32F */ -/* reuse GL_DEPTH32F_STENCIL8 */ -/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */ -/* Reuse tokens from ARB_framebuffer_object */ -/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ -/* reuse GL_FRAMEBUFFER_DEFAULT */ -/* reuse GL_FRAMEBUFFER_UNDEFINED */ -/* reuse GL_DEPTH_STENCIL_ATTACHMENT */ -/* reuse GL_INDEX */ -/* reuse GL_MAX_RENDERBUFFER_SIZE */ -/* reuse GL_DEPTH_STENCIL */ -/* reuse GL_UNSIGNED_INT_24_8 */ -/* reuse GL_DEPTH24_STENCIL8 */ -/* reuse GL_TEXTURE_STENCIL_SIZE */ -/* reuse GL_TEXTURE_RED_TYPE */ -/* reuse GL_TEXTURE_GREEN_TYPE */ -/* reuse GL_TEXTURE_BLUE_TYPE */ -/* reuse GL_TEXTURE_ALPHA_TYPE */ -/* reuse GL_TEXTURE_DEPTH_TYPE */ -/* reuse GL_UNSIGNED_NORMALIZED */ -/* reuse GL_FRAMEBUFFER_BINDING */ -/* reuse GL_DRAW_FRAMEBUFFER_BINDING */ -/* reuse GL_RENDERBUFFER_BINDING */ -/* reuse GL_READ_FRAMEBUFFER */ -/* reuse GL_DRAW_FRAMEBUFFER */ -/* reuse GL_READ_FRAMEBUFFER_BINDING */ -/* reuse GL_RENDERBUFFER_SAMPLES */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ -/* reuse GL_FRAMEBUFFER_COMPLETE */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ -/* reuse GL_FRAMEBUFFER_UNSUPPORTED */ -/* reuse GL_MAX_COLOR_ATTACHMENTS */ -/* reuse GL_COLOR_ATTACHMENT0 */ -/* reuse GL_COLOR_ATTACHMENT1 */ -/* reuse GL_COLOR_ATTACHMENT2 */ -/* reuse GL_COLOR_ATTACHMENT3 */ -/* reuse GL_COLOR_ATTACHMENT4 */ -/* reuse GL_COLOR_ATTACHMENT5 */ -/* reuse GL_COLOR_ATTACHMENT6 */ -/* reuse GL_COLOR_ATTACHMENT7 */ -/* reuse GL_COLOR_ATTACHMENT8 */ -/* reuse GL_COLOR_ATTACHMENT9 */ -/* reuse GL_COLOR_ATTACHMENT10 */ -/* reuse GL_COLOR_ATTACHMENT11 */ -/* reuse GL_COLOR_ATTACHMENT12 */ -/* reuse GL_COLOR_ATTACHMENT13 */ -/* reuse GL_COLOR_ATTACHMENT14 */ -/* reuse GL_COLOR_ATTACHMENT15 */ -/* reuse GL_DEPTH_ATTACHMENT */ -/* reuse GL_STENCIL_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER */ -/* reuse GL_RENDERBUFFER */ -/* reuse GL_RENDERBUFFER_WIDTH */ -/* reuse GL_RENDERBUFFER_HEIGHT */ -/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */ -/* reuse GL_STENCIL_INDEX1 */ -/* reuse GL_STENCIL_INDEX4 */ -/* reuse GL_STENCIL_INDEX8 */ -/* reuse GL_STENCIL_INDEX16 */ -/* reuse GL_RENDERBUFFER_RED_SIZE */ -/* reuse GL_RENDERBUFFER_GREEN_SIZE */ -/* reuse GL_RENDERBUFFER_BLUE_SIZE */ -/* reuse GL_RENDERBUFFER_ALPHA_SIZE */ -/* reuse GL_RENDERBUFFER_DEPTH_SIZE */ -/* reuse GL_RENDERBUFFER_STENCIL_SIZE */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ -/* reuse GL_MAX_SAMPLES */ -/* Reuse tokens from ARB_framebuffer_sRGB */ -/* reuse GL_FRAMEBUFFER_SRGB */ -/* Reuse tokens from ARB_half_float_vertex */ -/* reuse GL_HALF_FLOAT */ -/* Reuse tokens from ARB_map_buffer_range */ -/* reuse GL_MAP_READ_BIT */ -/* reuse GL_MAP_WRITE_BIT */ -/* reuse GL_MAP_INVALIDATE_RANGE_BIT */ -/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */ -/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */ -/* reuse GL_MAP_UNSYNCHRONIZED_BIT */ -/* Reuse tokens from ARB_texture_compression_rgtc */ -/* reuse GL_COMPRESSED_RED_RGTC1 */ -/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */ -/* reuse GL_COMPRESSED_RG_RGTC2 */ -/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */ -/* Reuse tokens from ARB_texture_rg */ -/* reuse GL_RG */ -/* reuse GL_RG_INTEGER */ -/* reuse GL_R8 */ -/* reuse GL_R16 */ -/* reuse GL_RG8 */ -/* reuse GL_RG16 */ -/* reuse GL_R16F */ -/* reuse GL_R32F */ -/* reuse GL_RG16F */ -/* reuse GL_RG32F */ -/* reuse GL_R8I */ -/* reuse GL_R8UI */ -/* reuse GL_R16I */ -/* reuse GL_R16UI */ -/* reuse GL_R32I */ -/* reuse GL_R32UI */ -/* reuse GL_RG8I */ -/* reuse GL_RG8UI */ -/* reuse GL_RG16I */ -/* reuse GL_RG16UI */ -/* reuse GL_RG32I */ -/* reuse GL_RG32UI */ -/* Reuse tokens from ARB_vertex_array_object */ -/* reuse GL_VERTEX_ARRAY_BINDING */ -#endif - -#ifndef GL_VERSION_3_0_DEPRECATED -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B -#define GL_ALPHA_INTEGER 0x8D97 -/* Reuse tokens from ARB_framebuffer_object */ -/* reuse GL_TEXTURE_LUMINANCE_TYPE */ -/* reuse GL_TEXTURE_INTENSITY_TYPE */ -#endif - -#ifndef GL_VERSION_3_1 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_RED_SNORM 0x8F90 -#define GL_RG_SNORM 0x8F91 -#define GL_RGB_SNORM 0x8F92 -#define GL_RGBA_SNORM 0x8F93 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -/* Reuse tokens from ARB_copy_buffer */ -/* reuse GL_COPY_READ_BUFFER */ -/* reuse GL_COPY_WRITE_BUFFER */ -/* Reuse tokens from ARB_draw_instanced (none) */ -/* Reuse tokens from ARB_uniform_buffer_object */ -/* reuse GL_UNIFORM_BUFFER */ -/* reuse GL_UNIFORM_BUFFER_BINDING */ -/* reuse GL_UNIFORM_BUFFER_START */ -/* reuse GL_UNIFORM_BUFFER_SIZE */ -/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */ -/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */ -/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */ -/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */ -/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */ -/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */ -/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */ -/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */ -/* reuse GL_ACTIVE_UNIFORM_BLOCKS */ -/* reuse GL_UNIFORM_TYPE */ -/* reuse GL_UNIFORM_SIZE */ -/* reuse GL_UNIFORM_NAME_LENGTH */ -/* reuse GL_UNIFORM_BLOCK_INDEX */ -/* reuse GL_UNIFORM_OFFSET */ -/* reuse GL_UNIFORM_ARRAY_STRIDE */ -/* reuse GL_UNIFORM_MATRIX_STRIDE */ -/* reuse GL_UNIFORM_IS_ROW_MAJOR */ -/* reuse GL_UNIFORM_BLOCK_BINDING */ -/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */ -/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */ -/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */ -/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */ -/* reuse GL_INVALID_INDEX */ -#endif - -#ifndef GL_VERSION_3_2 -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -/* reuse GL_MAX_VARYING_COMPONENTS */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ -/* Reuse tokens from ARB_depth_clamp */ -/* reuse GL_DEPTH_CLAMP */ -/* Reuse tokens from ARB_draw_elements_base_vertex (none) */ -/* Reuse tokens from ARB_fragment_coord_conventions (none) */ -/* Reuse tokens from ARB_provoking_vertex */ -/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ -/* reuse GL_FIRST_VERTEX_CONVENTION */ -/* reuse GL_LAST_VERTEX_CONVENTION */ -/* reuse GL_PROVOKING_VERTEX */ -/* Reuse tokens from ARB_seamless_cube_map */ -/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */ -/* Reuse tokens from ARB_sync */ -/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */ -/* reuse GL_OBJECT_TYPE */ -/* reuse GL_SYNC_CONDITION */ -/* reuse GL_SYNC_STATUS */ -/* reuse GL_SYNC_FLAGS */ -/* reuse GL_SYNC_FENCE */ -/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */ -/* reuse GL_UNSIGNALED */ -/* reuse GL_SIGNALED */ -/* reuse GL_ALREADY_SIGNALED */ -/* reuse GL_TIMEOUT_EXPIRED */ -/* reuse GL_CONDITION_SATISFIED */ -/* reuse GL_WAIT_FAILED */ -/* reuse GL_TIMEOUT_IGNORED */ -/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */ -/* reuse GL_TIMEOUT_IGNORED */ -/* Reuse tokens from ARB_texture_multisample */ -/* reuse GL_SAMPLE_POSITION */ -/* reuse GL_SAMPLE_MASK */ -/* reuse GL_SAMPLE_MASK_VALUE */ -/* reuse GL_MAX_SAMPLE_MASK_WORDS */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE */ -/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */ -/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_TEXTURE_SAMPLES */ -/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */ -/* reuse GL_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */ -/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */ -/* reuse GL_MAX_INTEGER_SAMPLES */ -/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */ -#endif - -#ifndef GL_VERSION_3_3 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -/* Reuse tokens from ARB_blend_func_extended */ -/* reuse GL_SRC1_COLOR */ -/* reuse GL_ONE_MINUS_SRC1_COLOR */ -/* reuse GL_ONE_MINUS_SRC1_ALPHA */ -/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */ -/* Reuse tokens from ARB_explicit_attrib_location (none) */ -/* Reuse tokens from ARB_occlusion_query2 */ -/* reuse GL_ANY_SAMPLES_PASSED */ -/* Reuse tokens from ARB_sampler_objects */ -/* reuse GL_SAMPLER_BINDING */ -/* Reuse tokens from ARB_shader_bit_encoding (none) */ -/* Reuse tokens from ARB_texture_rgb10_a2ui */ -/* reuse GL_RGB10_A2UI */ -/* Reuse tokens from ARB_texture_swizzle */ -/* reuse GL_TEXTURE_SWIZZLE_R */ -/* reuse GL_TEXTURE_SWIZZLE_G */ -/* reuse GL_TEXTURE_SWIZZLE_B */ -/* reuse GL_TEXTURE_SWIZZLE_A */ -/* reuse GL_TEXTURE_SWIZZLE_RGBA */ -/* Reuse tokens from ARB_timer_query */ -/* reuse GL_TIME_ELAPSED */ -/* reuse GL_TIMESTAMP */ -/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */ -/* reuse GL_INT_2_10_10_10_REV */ -#endif - -#ifndef GL_VERSION_4_0 -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -/* Reuse tokens from ARB_texture_query_lod (none) */ -/* Reuse tokens from ARB_draw_buffers_blend (none) */ -/* Reuse tokens from ARB_draw_indirect */ -/* reuse GL_DRAW_INDIRECT_BUFFER */ -/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */ -/* Reuse tokens from ARB_gpu_shader5 */ -/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */ -/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */ -/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */ -/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */ -/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */ -/* reuse GL_MAX_VERTEX_STREAMS */ -/* Reuse tokens from ARB_gpu_shader_fp64 */ -/* reuse GL_DOUBLE_VEC2 */ -/* reuse GL_DOUBLE_VEC3 */ -/* reuse GL_DOUBLE_VEC4 */ -/* reuse GL_DOUBLE_MAT2 */ -/* reuse GL_DOUBLE_MAT3 */ -/* reuse GL_DOUBLE_MAT4 */ -/* reuse GL_DOUBLE_MAT2x3 */ -/* reuse GL_DOUBLE_MAT2x4 */ -/* reuse GL_DOUBLE_MAT3x2 */ -/* reuse GL_DOUBLE_MAT3x4 */ -/* reuse GL_DOUBLE_MAT4x2 */ -/* reuse GL_DOUBLE_MAT4x3 */ -/* Reuse tokens from ARB_shader_subroutine */ -/* reuse GL_ACTIVE_SUBROUTINES */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */ -/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */ -/* reuse GL_MAX_SUBROUTINES */ -/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */ -/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ -/* reuse GL_COMPATIBLE_SUBROUTINES */ -/* Reuse tokens from ARB_tessellation_shader */ -/* reuse GL_PATCHES */ -/* reuse GL_PATCH_VERTICES */ -/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */ -/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */ -/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */ -/* reuse GL_TESS_GEN_MODE */ -/* reuse GL_TESS_GEN_SPACING */ -/* reuse GL_TESS_GEN_VERTEX_ORDER */ -/* reuse GL_TESS_GEN_POINT_MODE */ -/* reuse GL_ISOLINES */ -/* reuse GL_FRACTIONAL_ODD */ -/* reuse GL_FRACTIONAL_EVEN */ -/* reuse GL_MAX_PATCH_VERTICES */ -/* reuse GL_MAX_TESS_GEN_LEVEL */ -/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */ -/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */ -/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_PATCH_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */ -/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */ -/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */ -/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */ -/* reuse GL_TESS_EVALUATION_SHADER */ -/* reuse GL_TESS_CONTROL_SHADER */ -/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */ -/* Reuse tokens from ARB_transform_feedback2 */ -/* reuse GL_TRANSFORM_FEEDBACK */ -/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ -/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ -/* reuse GL_TRANSFORM_FEEDBACK_BINDING */ -/* Reuse tokens from ARB_transform_feedback3 */ -/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */ -/* reuse GL_MAX_VERTEX_STREAMS */ -#endif - -#ifndef GL_VERSION_4_1 -/* Reuse tokens from ARB_ES2_compatibility */ -/* reuse GL_FIXED */ -/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */ -/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */ -/* reuse GL_LOW_FLOAT */ -/* reuse GL_MEDIUM_FLOAT */ -/* reuse GL_HIGH_FLOAT */ -/* reuse GL_LOW_INT */ -/* reuse GL_MEDIUM_INT */ -/* reuse GL_HIGH_INT */ -/* reuse GL_SHADER_COMPILER */ -/* reuse GL_NUM_SHADER_BINARY_FORMATS */ -/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ -/* reuse GL_MAX_VARYING_VECTORS */ -/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */ -/* Reuse tokens from ARB_get_program_binary */ -/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */ -/* reuse GL_PROGRAM_BINARY_LENGTH */ -/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */ -/* reuse GL_PROGRAM_BINARY_FORMATS */ -/* Reuse tokens from ARB_separate_shader_objects */ -/* reuse GL_VERTEX_SHADER_BIT */ -/* reuse GL_FRAGMENT_SHADER_BIT */ -/* reuse GL_GEOMETRY_SHADER_BIT */ -/* reuse GL_TESS_CONTROL_SHADER_BIT */ -/* reuse GL_TESS_EVALUATION_SHADER_BIT */ -/* reuse GL_ALL_SHADER_BITS */ -/* reuse GL_PROGRAM_SEPARABLE */ -/* reuse GL_ACTIVE_PROGRAM */ -/* reuse GL_PROGRAM_PIPELINE_BINDING */ -/* Reuse tokens from ARB_shader_precision (none) */ -/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */ -/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */ -/* reuse GL_MAX_VIEWPORTS */ -/* reuse GL_VIEWPORT_SUBPIXEL_BITS */ -/* reuse GL_VIEWPORT_BOUNDS_RANGE */ -/* reuse GL_LAYER_PROVOKING_VERTEX */ -/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */ -/* reuse GL_UNDEFINED_VERTEX */ -#endif - -#ifndef GL_ARB_multitexture -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -#endif - -#ifndef GL_ARB_multisample -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif - -#ifndef GL_ARB_texture_env_add -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C -#endif - -#ifndef GL_ARB_texture_compression -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 -#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB -#define GL_COMPRESSED_INTENSITY_ARB 0x84EC -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 -#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_CLAMP_TO_BORDER_ARB 0x812D -#endif - -#ifndef GL_ARB_point_parameters -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 -#define GL_VERTEX_BLEND_ARB 0x86A7 -#define GL_CURRENT_WEIGHT_ARB 0x86A8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC -#define GL_WEIGHT_ARRAY_ARB 0x86AD -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850A -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872A -#define GL_MODELVIEW11_ARB 0x872B -#define GL_MODELVIEW12_ARB 0x872C -#define GL_MODELVIEW13_ARB 0x872D -#define GL_MODELVIEW14_ARB 0x872E -#define GL_MODELVIEW15_ARB 0x872F -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873A -#define GL_MODELVIEW27_ARB 0x873B -#define GL_MODELVIEW28_ARB 0x873C -#define GL_MODELVIEW29_ARB 0x873D -#define GL_MODELVIEW30_ARB 0x873E -#define GL_MODELVIEW31_ARB 0x873F -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_MATRIX_PALETTE_ARB 0x8840 -#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 -#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 -#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 -#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 -#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 -#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_COMBINE_ARB 0x8570 -#define GL_COMBINE_RGB_ARB 0x8571 -#define GL_COMBINE_ALPHA_ARB 0x8572 -#define GL_SOURCE0_RGB_ARB 0x8580 -#define GL_SOURCE1_RGB_ARB 0x8581 -#define GL_SOURCE2_RGB_ARB 0x8582 -#define GL_SOURCE0_ALPHA_ARB 0x8588 -#define GL_SOURCE1_ALPHA_ARB 0x8589 -#define GL_SOURCE2_ALPHA_ARB 0x858A -#define GL_OPERAND0_RGB_ARB 0x8590 -#define GL_OPERAND1_RGB_ARB 0x8591 -#define GL_OPERAND2_RGB_ARB 0x8592 -#define GL_OPERAND0_ALPHA_ARB 0x8598 -#define GL_OPERAND1_ALPHA_ARB 0x8599 -#define GL_OPERAND2_ALPHA_ARB 0x859A -#define GL_RGB_SCALE_ARB 0x8573 -#define GL_ADD_SIGNED_ARB 0x8574 -#define GL_INTERPOLATE_ARB 0x8575 -#define GL_SUBTRACT_ARB 0x84E7 -#define GL_CONSTANT_ARB 0x8576 -#define GL_PRIMARY_COLOR_ARB 0x8577 -#define GL_PREVIOUS_ARB 0x8578 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_DOT3_RGB_ARB 0x86AE -#define GL_DOT3_RGBA_ARB 0x86AF -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_DEPTH_COMPONENT16_ARB 0x81A5 -#define GL_DEPTH_COMPONENT24_ARB 0x81A6 -#define GL_DEPTH_COMPONENT32_ARB 0x81A7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B -#endif - -#ifndef GL_ARB_shadow -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF -#endif - -#ifndef GL_ARB_window_pos -#endif - -#ifndef GL_ARB_vertex_program -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF -#endif - -#ifndef GL_ARB_fragment_program -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F -#define GL_READ_ONLY_ARB 0x88B8 -#define GL_WRITE_ONLY_ARB 0x88B9 -#define GL_READ_WRITE_ARB 0x88BA -#define GL_BUFFER_ACCESS_ARB 0x88BB -#define GL_BUFFER_MAPPED_ARB 0x88BC -#define GL_BUFFER_MAP_POINTER_ARB 0x88BD -#define GL_STREAM_DRAW_ARB 0x88E0 -#define GL_STREAM_READ_ARB 0x88E1 -#define GL_STREAM_COPY_ARB 0x88E2 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_STATIC_READ_ARB 0x88E5 -#define GL_STATIC_COPY_ARB 0x88E6 -#define GL_DYNAMIC_DRAW_ARB 0x88E8 -#define GL_DYNAMIC_READ_ARB 0x88E9 -#define GL_DYNAMIC_COPY_ARB 0x88EA -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#define GL_SAMPLES_PASSED_ARB 0x8914 -#endif - -#ifndef GL_ARB_shader_objects -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#endif - -#ifndef GL_ARB_point_sprite -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882A -#define GL_DRAW_BUFFER6_ARB 0x882B -#define GL_DRAW_BUFFER7_ARB 0x882C -#define GL_DRAW_BUFFER8_ARB 0x882D -#define GL_DRAW_BUFFER9_ARB 0x882E -#define GL_DRAW_BUFFER10_ARB 0x882F -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_HALF_FLOAT_ARB 0x140B -#endif - -#ifndef GL_ARB_texture_float -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif - -#ifndef GL_ARB_depth_buffer_float -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#endif - -#ifndef GL_ARB_draw_instanced -#endif - -#ifndef GL_ARB_framebuffer_object -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#endif - -#ifndef GL_ARB_framebuffer_object_DEPRECATED -#define GL_INDEX 0x8222 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#endif - -#ifndef GL_ARB_framebuffer_sRGB -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#endif - -#ifndef GL_ARB_geometry_shader4 -#define GL_LINES_ADJACENCY_ARB 0x000A -#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B -#define GL_TRIANGLES_ADJACENCY_ARB 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D -#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 -#define GL_GEOMETRY_SHADER_ARB 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 -/* reuse GL_MAX_VARYING_COMPONENTS */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ -#endif - -#ifndef GL_ARB_half_float_vertex -#define GL_HALF_FLOAT 0x140B -#endif - -#ifndef GL_ARB_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE -#endif - -#ifndef GL_ARB_map_buffer_range -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#endif - -#ifndef GL_ARB_texture_buffer_object -#define GL_TEXTURE_BUFFER_ARB 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E -#endif - -#ifndef GL_ARB_texture_compression_rgtc -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#endif - -#ifndef GL_ARB_texture_rg -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#endif - -#ifndef GL_ARB_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#endif - -#ifndef GL_ARB_uniform_buffer_object -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#endif - -#ifndef GL_ARB_compatibility -/* ARB_compatibility just defines tokens from core 3.0 */ -#endif - -#ifndef GL_ARB_copy_buffer -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#endif - -#ifndef GL_ARB_shader_texture_lod -#endif - -#ifndef GL_ARB_depth_clamp -#define GL_DEPTH_CLAMP 0x864F -#endif - -#ifndef GL_ARB_draw_elements_base_vertex -#endif - -#ifndef GL_ARB_fragment_coord_conventions -#endif - -#ifndef GL_ARB_provoking_vertex -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_PROVOKING_VERTEX 0x8E4F -#endif - -#ifndef GL_ARB_seamless_cube_map -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#endif - -#ifndef GL_ARB_sync -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#endif - -#ifndef GL_ARB_texture_multisample -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -#endif - -#ifndef GL_ARB_vertex_array_bgra -/* reuse GL_BGRA */ -#endif - -#ifndef GL_ARB_draw_buffers_blend -#endif - -#ifndef GL_ARB_sample_shading -#define GL_SAMPLE_SHADING_ARB 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 -#endif - -#ifndef GL_ARB_texture_cube_map_array -#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#endif - -#ifndef GL_ARB_texture_gather -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F -#endif - -#ifndef GL_ARB_texture_query_lod -#endif - -#ifndef GL_ARB_shading_language_include -#define GL_SHADER_INCLUDE_ARB 0x8DAE -#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 -#define GL_NAMED_STRING_TYPE_ARB 0x8DEA -#endif - -#ifndef GL_ARB_texture_compression_bptc -#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F -#endif - -#ifndef GL_ARB_blend_func_extended -#define GL_SRC1_COLOR 0x88F9 -/* reuse GL_SRC1_ALPHA */ -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#endif - -#ifndef GL_ARB_explicit_attrib_location -#endif - -#ifndef GL_ARB_occlusion_query2 -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#endif - -#ifndef GL_ARB_sampler_objects -#define GL_SAMPLER_BINDING 0x8919 -#endif - -#ifndef GL_ARB_shader_bit_encoding -#endif - -#ifndef GL_ARB_texture_rgb10_a2ui -#define GL_RGB10_A2UI 0x906F -#endif - -#ifndef GL_ARB_texture_swizzle -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#endif - -#ifndef GL_ARB_timer_query -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#endif - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */ -#define GL_INT_2_10_10_10_REV 0x8D9F -#endif - -#ifndef GL_ARB_draw_indirect -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#endif - -#ifndef GL_ARB_gpu_shader5 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -/* reuse GL_MAX_VERTEX_STREAMS */ -#endif - -#ifndef GL_ARB_gpu_shader_fp64 -/* reuse GL_DOUBLE */ -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#endif - -#ifndef GL_ARB_shader_subroutine -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -/* reuse GL_UNIFORM_SIZE */ -/* reuse GL_UNIFORM_NAME_LENGTH */ -#endif - -#ifndef GL_ARB_tessellation_shader -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -/* reuse GL_TRIANGLES */ -/* reuse GL_QUADS */ -#define GL_ISOLINES 0x8E7A -/* reuse GL_EQUAL */ -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -/* reuse GL_CCW */ -/* reuse GL_CW */ -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#endif - -#ifndef GL_ARB_texture_buffer_object_rgb32 -/* reuse GL_RGB32F */ -/* reuse GL_RGB32UI */ -/* reuse GL_RGB32I */ -#endif - -#ifndef GL_ARB_transform_feedback2 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#endif - -#ifndef GL_ARB_transform_feedback3 -#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -#define GL_MAX_VERTEX_STREAMS 0x8E71 -#endif - -#ifndef GL_ARB_ES2_compatibility -#define GL_FIXED 0x140C -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#endif - -#ifndef GL_ARB_get_program_binary -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#endif - -#ifndef GL_ARB_separate_shader_objects -#define GL_VERTEX_SHADER_BIT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT 0x00000002 -#define GL_GEOMETRY_SHADER_BIT 0x00000004 -#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 -#define GL_ALL_SHADER_BITS 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE 0x8258 -#define GL_ACTIVE_PROGRAM 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING 0x825A -#endif - -#ifndef GL_ARB_shader_precision -#endif - -#ifndef GL_ARB_vertex_attrib_64bit -/* reuse GL_RGB32I */ -/* reuse GL_DOUBLE_VEC2 */ -/* reuse GL_DOUBLE_VEC3 */ -/* reuse GL_DOUBLE_VEC4 */ -/* reuse GL_DOUBLE_MAT2 */ -/* reuse GL_DOUBLE_MAT3 */ -/* reuse GL_DOUBLE_MAT4 */ -/* reuse GL_DOUBLE_MAT2x3 */ -/* reuse GL_DOUBLE_MAT2x4 */ -/* reuse GL_DOUBLE_MAT3x2 */ -/* reuse GL_DOUBLE_MAT3x4 */ -/* reuse GL_DOUBLE_MAT4x2 */ -/* reuse GL_DOUBLE_MAT4x3 */ -#endif - -#ifndef GL_ARB_viewport_array -/* reuse GL_SCISSOR_BOX */ -/* reuse GL_VIEWPORT */ -/* reuse GL_DEPTH_RANGE */ -/* reuse GL_SCISSOR_TEST */ -#define GL_MAX_VIEWPORTS 0x825B -#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C -#define GL_VIEWPORT_BOUNDS_RANGE 0x825D -#define GL_LAYER_PROVOKING_VERTEX 0x825E -#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F -#define GL_UNDEFINED_VERTEX 0x8260 -/* reuse GL_FIRST_VERTEX_CONVENTION */ -/* reuse GL_LAST_VERTEX_CONVENTION */ -/* reuse GL_PROVOKING_VERTEX */ -#endif - -#ifndef GL_ARB_cl_event -#define GL_SYNC_CL_EVENT_ARB 0x8240 -#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 -#endif - -#ifndef GL_ARB_debug_output -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 -#define GL_DEBUG_SOURCE_API_ARB 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A -#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B -#define GL_DEBUG_TYPE_ERROR_ARB 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 -#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 -#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 -#endif - -#ifndef GL_ARB_robustness -/* reuse GL_NO_ERROR */ -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 -#endif - -#ifndef GL_ARB_shader_stencil_export -#endif - -#ifndef GL_EXT_abgr -#define GL_ABGR_EXT 0x8000 -#endif - -#ifndef GL_EXT_blend_color -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_POLYGON_OFFSET_EXT 0x8037 -#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 -#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 -#endif - -#ifndef GL_EXT_texture -#define GL_ALPHA4_EXT 0x803B -#define GL_ALPHA8_EXT 0x803C -#define GL_ALPHA12_EXT 0x803D -#define GL_ALPHA16_EXT 0x803E -#define GL_LUMINANCE4_EXT 0x803F -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE12_EXT 0x8041 -#define GL_LUMINANCE16_EXT 0x8042 -#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 -#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 -#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 -#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 -#define GL_INTENSITY_EXT 0x8049 -#define GL_INTENSITY4_EXT 0x804A -#define GL_INTENSITY8_EXT 0x804B -#define GL_INTENSITY12_EXT 0x804C -#define GL_INTENSITY16_EXT 0x804D -#define GL_RGB2_EXT 0x804E -#define GL_RGB4_EXT 0x804F -#define GL_RGB5_EXT 0x8050 -#define GL_RGB8_EXT 0x8051 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB12_EXT 0x8053 -#define GL_RGB16_EXT 0x8054 -#define GL_RGBA2_EXT 0x8055 -#define GL_RGBA4_EXT 0x8056 -#define GL_RGB5_A1_EXT 0x8057 -#define GL_RGBA8_EXT 0x8058 -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGBA12_EXT 0x805A -#define GL_RGBA16_EXT 0x805B -#define GL_TEXTURE_RED_SIZE_EXT 0x805C -#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D -#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E -#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 -#define GL_REPLACE_EXT 0x8062 -#define GL_PROXY_TEXTURE_1D_EXT 0x8063 -#define GL_PROXY_TEXTURE_2D_EXT 0x8064 -#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 -#endif - -#ifndef GL_EXT_texture3D -#define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_FILTER4_SGIS 0x8146 -#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 -#endif - -#ifndef GL_EXT_subtexture -#endif - -#ifndef GL_EXT_copy_texture -#endif - -#ifndef GL_EXT_histogram -#define GL_HISTOGRAM_EXT 0x8024 -#define GL_PROXY_HISTOGRAM_EXT 0x8025 -#define GL_HISTOGRAM_WIDTH_EXT 0x8026 -#define GL_HISTOGRAM_FORMAT_EXT 0x8027 -#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C -#define GL_HISTOGRAM_SINK_EXT 0x802D -#define GL_MINMAX_EXT 0x802E -#define GL_MINMAX_FORMAT_EXT 0x802F -#define GL_MINMAX_SINK_EXT 0x8030 -#define GL_TABLE_TOO_LARGE_EXT 0x8031 -#endif - -#ifndef GL_EXT_convolution -#define GL_CONVOLUTION_1D_EXT 0x8010 -#define GL_CONVOLUTION_2D_EXT 0x8011 -#define GL_SEPARABLE_2D_EXT 0x8012 -#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 -#define GL_REDUCE_EXT 0x8016 -#define GL_CONVOLUTION_FORMAT_EXT 0x8017 -#define GL_CONVOLUTION_WIDTH_EXT 0x8018 -#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 -#endif - -#ifndef GL_SGI_color_matrix -#define GL_COLOR_MATRIX_SGI 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB -#endif - -#ifndef GL_SGI_color_table -#define GL_COLOR_TABLE_SGI 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 -#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 -#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 -#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_PIXEL_TEXTURE_SGIS 0x8353 -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 -#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_PIXEL_TEX_GEN_SGIX 0x8139 -#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B -#endif - -#ifndef GL_SGIS_texture4D -#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 -#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 -#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 -#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 -#define GL_TEXTURE_4D_SGIS 0x8134 -#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 -#define GL_TEXTURE_4DSIZE_SGIS 0x8136 -#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 -#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 -#define GL_TEXTURE_4D_BINDING_SGIS 0x814F -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC -#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD -#endif - -#ifndef GL_EXT_cmyka -#define GL_CMYK_EXT 0x800C -#define GL_CMYKA_EXT 0x800D -#define GL_PACK_CMYK_HINT_EXT 0x800E -#define GL_UNPACK_CMYK_HINT_EXT 0x800F -#endif - -#ifndef GL_EXT_texture_object -#define GL_TEXTURE_PRIORITY_EXT 0x8066 -#define GL_TEXTURE_RESIDENT_EXT 0x8067 -#define GL_TEXTURE_1D_BINDING_EXT 0x8068 -#define GL_TEXTURE_2D_BINDING_EXT 0x8069 -#define GL_TEXTURE_3D_BINDING_EXT 0x806A -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 -#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 -#define GL_LINEAR_DETAIL_SGIS 0x8097 -#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 -#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 -#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A -#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B -#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_LINEAR_SHARPEN_SGIS 0x80AD -#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE -#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF -#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_TEXTURE_MIN_LOD_SGIS 0x813A -#define GL_TEXTURE_MAX_LOD_SGIS 0x813B -#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C -#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D -#endif - -#ifndef GL_SGIS_multisample -#define GL_MULTISAMPLE_SGIS 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F -#define GL_SAMPLE_MASK_SGIS 0x80A0 -#define GL_1PASS_SGIS 0x80A1 -#define GL_2PASS_0_SGIS 0x80A2 -#define GL_2PASS_1_SGIS 0x80A3 -#define GL_4PASS_0_SGIS 0x80A4 -#define GL_4PASS_1_SGIS 0x80A5 -#define GL_4PASS_2_SGIS 0x80A6 -#define GL_4PASS_3_SGIS 0x80A7 -#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 -#define GL_SAMPLES_SGIS 0x80A9 -#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA -#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB -#define GL_SAMPLE_PATTERN_SGIS 0x80AC -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_RESCALE_NORMAL_EXT 0x803A -#endif - -#ifndef GL_EXT_vertex_array -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#endif - -#ifndef GL_EXT_misc_attribute -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 -#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 -#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 -#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 -#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 -#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 -#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 -#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 -#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 -#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D -#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E -#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F -#endif - -#ifndef GL_SGIX_shadow -#define GL_TEXTURE_COMPARE_SGIX 0x819A -#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B -#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C -#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_CLAMP_TO_EDGE_SGIS 0x812F -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_CLAMP_TO_BORDER_SGIS 0x812D -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B -#endif - -#ifndef GL_EXT_blend_logic_op -#endif - -#ifndef GL_SGIX_interlace -#define GL_INTERLACE_SGIX 0x8094 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E -#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F -#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 -#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 -#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 -#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 -#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 -#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 -#endif - -#ifndef GL_SGIS_texture_select -#define GL_DUAL_ALPHA4_SGIS 0x8110 -#define GL_DUAL_ALPHA8_SGIS 0x8111 -#define GL_DUAL_ALPHA12_SGIS 0x8112 -#define GL_DUAL_ALPHA16_SGIS 0x8113 -#define GL_DUAL_LUMINANCE4_SGIS 0x8114 -#define GL_DUAL_LUMINANCE8_SGIS 0x8115 -#define GL_DUAL_LUMINANCE12_SGIS 0x8116 -#define GL_DUAL_LUMINANCE16_SGIS 0x8117 -#define GL_DUAL_INTENSITY4_SGIS 0x8118 -#define GL_DUAL_INTENSITY8_SGIS 0x8119 -#define GL_DUAL_INTENSITY12_SGIS 0x811A -#define GL_DUAL_INTENSITY16_SGIS 0x811B -#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C -#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D -#define GL_QUAD_ALPHA4_SGIS 0x811E -#define GL_QUAD_ALPHA8_SGIS 0x811F -#define GL_QUAD_LUMINANCE4_SGIS 0x8120 -#define GL_QUAD_LUMINANCE8_SGIS 0x8121 -#define GL_QUAD_INTENSITY4_SGIS 0x8122 -#define GL_QUAD_INTENSITY8_SGIS 0x8123 -#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 -#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SPRITE_SGIX 0x8148 -#define GL_SPRITE_MODE_SGIX 0x8149 -#define GL_SPRITE_AXIS_SGIX 0x814A -#define GL_SPRITE_TRANSLATION_SGIX 0x814B -#define GL_SPRITE_AXIAL_SGIX 0x814C -#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D -#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E -#endif - -#ifndef GL_EXT_point_parameters -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_POINT_SIZE_MIN_SGIS 0x8126 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 -#endif - -#ifndef GL_SGIX_instruments -#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 -#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 -#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A -#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B -#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C -#endif - -#ifndef GL_SGIX_framezoom -#define GL_FRAMEZOOM_SGIX 0x818B -#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C -#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#endif - -#ifndef GL_FfdMaskSGIX -#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 -#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 -#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 -#define GL_DEFORMATIONS_MASK_SGIX 0x8196 -#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_REFERENCE_PLANE_SGIX 0x817D -#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E -#endif - -#ifndef GL_SGIX_flush_raster -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 -#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 -#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_FOG_FUNC_SGIS 0x812A -#define GL_FOG_FUNC_POINTS_SGIS 0x812B -#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_FOG_OFFSET_SGIX 0x8198 -#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 -#endif - -#ifndef GL_HP_image_transform -#define GL_IMAGE_SCALE_X_HP 0x8155 -#define GL_IMAGE_SCALE_Y_HP 0x8156 -#define GL_IMAGE_TRANSLATE_X_HP 0x8157 -#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 -#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 -#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A -#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B -#define GL_IMAGE_MAG_FILTER_HP 0x815C -#define GL_IMAGE_MIN_FILTER_HP 0x815D -#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E -#define GL_CUBIC_HP 0x815F -#define GL_AVERAGE_HP 0x8160 -#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 -#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 -#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_IGNORE_BORDER_HP 0x8150 -#define GL_CONSTANT_BORDER_HP 0x8151 -#define GL_REPLICATE_BORDER_HP 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 -#endif - -#ifndef GL_INGR_palette_buffer -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE -#endif - -#ifndef GL_EXT_color_subtable -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_VERTEX_DATA_HINT_PGI 0x1A22A -#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B -#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C -#define GL_MAX_VERTEX_HINT_PGI 0x1A22D -#define GL_COLOR3_BIT_PGI 0x00010000 -#define GL_COLOR4_BIT_PGI 0x00020000 -#define GL_EDGEFLAG_BIT_PGI 0x00040000 -#define GL_INDEX_BIT_PGI 0x00080000 -#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 -#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 -#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 -#define GL_MAT_EMISSION_BIT_PGI 0x00800000 -#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 -#define GL_MAT_SHININESS_BIT_PGI 0x02000000 -#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 -#define GL_NORMAL_BIT_PGI 0x08000000 -#define GL_TEXCOORD1_BIT_PGI 0x10000000 -#define GL_TEXCOORD2_BIT_PGI 0x20000000 -#define GL_TEXCOORD3_BIT_PGI 0x40000000 -#define GL_TEXCOORD4_BIT_PGI 0x80000000 -#define GL_VERTEX23_BIT_PGI 0x00000004 -#define GL_VERTEX4_BIT_PGI 0x00000008 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 -#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD -#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 -#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C -#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E -#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F -#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 -#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 -#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 -#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 -#define GL_CLIP_NEAR_HINT_PGI 0x1A220 -#define GL_CLIP_FAR_HINT_PGI 0x1A221 -#define GL_WIDE_LINE_HINT_PGI 0x1A222 -#define GL_BACK_NORMALS_HINT_PGI 0x1A223 -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_LIST_PRIORITY_SGIX 0x8182 -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_IR_INSTRUMENT1_SGIX 0x817F -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E -#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F -#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SHADOW_AMBIENT_SGIX 0x80BF -#endif - -#ifndef GL_EXT_index_texture -#endif - -#ifndef GL_EXT_index_material -#define GL_INDEX_MATERIAL_EXT 0x81B8 -#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 -#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA -#endif - -#ifndef GL_EXT_index_func -#define GL_INDEX_TEST_EXT 0x81B5 -#define GL_INDEX_TEST_FUNC_EXT 0x81B6 -#define GL_INDEX_TEST_REF_EXT 0x81B7 -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_IUI_V2F_EXT 0x81AD -#define GL_IUI_V3F_EXT 0x81AE -#define GL_IUI_N3F_V2F_EXT 0x81AF -#define GL_IUI_N3F_V3F_EXT 0x81B0 -#define GL_T2F_IUI_V2F_EXT 0x81B1 -#define GL_T2F_IUI_V3F_EXT 0x81B2 -#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 -#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 -#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_CULL_VERTEX_EXT 0x81AA -#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB -#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_YCRCB_422_SGIX 0x81BB -#define GL_YCRCB_444_SGIX 0x81BC -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 -#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 -#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 -#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 -#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 -#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 -#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 -#define GL_LIGHT_ENV_MODE_SGIX 0x8407 -#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 -#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 -#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A -#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B -#define GL_FRAGMENT_LIGHT0_SGIX 0x840C -#define GL_FRAGMENT_LIGHT1_SGIX 0x840D -#define GL_FRAGMENT_LIGHT2_SGIX 0x840E -#define GL_FRAGMENT_LIGHT3_SGIX 0x840F -#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 -#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 -#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 -#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 -#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 -#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 -#endif - -#ifndef GL_WIN_phong_shading -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB -#endif - -#ifndef GL_WIN_specular_fog -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC -#endif - -#ifndef GL_EXT_light_texture -#define GL_FRAGMENT_MATERIAL_EXT 0x8349 -#define GL_FRAGMENT_NORMAL_EXT 0x834A -#define GL_FRAGMENT_COLOR_EXT 0x834C -#define GL_ATTENUATION_EXT 0x834D -#define GL_SHADOW_ATTENUATION_EXT 0x834E -#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F -#define GL_TEXTURE_LIGHT_EXT 0x8350 -#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 -#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 -/* reuse GL_FRAGMENT_DEPTH_EXT */ -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif - -#ifndef GL_SGIX_impact_pixel_texture -#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 -#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 -#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 -#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 -#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 -#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 -#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A -#endif - -#ifndef GL_EXT_bgra -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 -#endif - -#ifndef GL_SGIX_async -#define GL_ASYNC_MARKER_SGIX 0x8329 -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C -#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D -#define GL_ASYNC_READ_PIXELS_SGIX 0x835E -#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F -#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 -#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_ASYNC_HISTOGRAM_SGIX 0x832C -#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D -#endif - -#ifndef GL_INTEL_texture_scissor -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 -#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 -#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 -#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 -#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 -#endif - -#ifndef GL_HP_occlusion_test -#define GL_OCCLUSION_TEST_HP 0x8165 -#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 -#define GL_PIXEL_MAG_FILTER_EXT 0x8331 -#define GL_PIXEL_MIN_FILTER_EXT 0x8332 -#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 -#define GL_CUBIC_EXT 0x8334 -#define GL_AVERAGE_EXT 0x8335 -#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 -#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 -#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif - -#ifndef GL_EXT_secondary_color -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_PERTURB_EXT 0x85AE -#define GL_TEXTURE_NORMAL_EXT 0x85AF -#endif - -#ifndef GL_EXT_multi_draw_arrays -#endif - -#ifndef GL_EXT_fog_coord -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_SCREEN_COORDINATES_REND 0x8490 -#define GL_INVERTED_SCREEN_W_REND 0x8491 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_TANGENT_ARRAY_EXT 0x8439 -#define GL_BINORMAL_ARRAY_EXT 0x843A -#define GL_CURRENT_TANGENT_EXT 0x843B -#define GL_CURRENT_BINORMAL_EXT 0x843C -#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E -#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F -#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 -#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 -#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 -#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 -#define GL_MAP1_TANGENT_EXT 0x8444 -#define GL_MAP2_TANGENT_EXT 0x8445 -#define GL_MAP1_BINORMAL_EXT 0x8446 -#define GL_MAP2_BINORMAL_EXT 0x8447 -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_TRANSFORM_HINT_APPLE 0x85B1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_FOG_SCALE_SGIX 0x81FC -#define GL_FOG_SCALE_VALUE_SGIX 0x81FD -#endif - -#ifndef GL_SUNX_constant_data -#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 -#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 -#endif - -#ifndef GL_SUN_global_alpha -#define GL_GLOBAL_ALPHA_SUN 0x81D9 -#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA -#endif - -#ifndef GL_SUN_triangle_list -#define GL_RESTART_SUN 0x0001 -#define GL_REPLACE_MIDDLE_SUN 0x0002 -#define GL_REPLACE_OLDEST_SUN 0x0003 -#define GL_TRIANGLE_LIST_SUN 0x81D7 -#define GL_REPLACEMENT_CODE_SUN 0x81D8 -#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 -#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 -#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 -#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 -#define GL_R1UI_V3F_SUN 0x85C4 -#define GL_R1UI_C4UB_V3F_SUN 0x85C5 -#define GL_R1UI_C3F_V3F_SUN 0x85C6 -#define GL_R1UI_N3F_V3F_SUN 0x85C7 -#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 -#define GL_R1UI_T2F_V3F_SUN 0x85C9 -#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA -#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB -#endif - -#ifndef GL_SUN_vertex -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB -#endif - -#ifndef GL_INGR_color_clamp -#define GL_RED_MIN_CLAMP_INGR 0x8560 -#define GL_GREEN_MIN_CLAMP_INGR 0x8561 -#define GL_BLUE_MIN_CLAMP_INGR 0x8562 -#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 -#define GL_RED_MAX_CLAMP_INGR 0x8564 -#define GL_GREEN_MAX_CLAMP_INGR 0x8565 -#define GL_BLUE_MAX_CLAMP_INGR 0x8566 -#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INTERLACE_READ_INGR 0x8568 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_422_EXT 0x80CC -#define GL_422_REV_EXT 0x80CD -#define GL_422_AVERAGE_EXT 0x80CE -#define GL_422_REV_AVERAGE_EXT 0x80CF -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif - -#ifndef GL_EXT_texture_cube_map -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_WRAP_BORDER_SUN 0x81D4 -#endif - -#ifndef GL_EXT_texture_env_add -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH -#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 -#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX -#define GL_MODELVIEW1_MATRIX_EXT 0x8506 -#define GL_VERTEX_WEIGHTING_EXT 0x8509 -#define GL_MODELVIEW0_EXT GL_MODELVIEW -#define GL_MODELVIEW1_EXT 0x850A -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F -#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_NV 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E -#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F -#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 -#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 -#endif - -#ifndef GL_NV_register_combiners -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852A -#define GL_CONSTANT_COLOR1_NV 0x852B -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_SPARE0_NV 0x852E -#define GL_SPARE1_NV 0x852F -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#define GL_HALF_BIAS_NEGATE_NV 0x853B -#define GL_SIGNED_IDENTITY_NV 0x853C -#define GL_SIGNED_NEGATE_NV 0x853D -#define GL_SCALE_BY_TWO_NV 0x853E -#define GL_SCALE_BY_FOUR_NV 0x853F -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854A -#define GL_COMBINER_CD_OUTPUT_NV 0x854B -#define GL_COMBINER_SUM_OUTPUT_NV 0x854C -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#define GL_COLOR_SUM_CLAMP_NV 0x854F -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -/* reuse GL_TEXTURE0_ARB */ -/* reuse GL_TEXTURE1_ARB */ -/* reuse GL_ZERO */ -/* reuse GL_NONE */ -/* reuse GL_FOG */ -#endif - -#ifndef GL_NV_fog_distance -#define GL_FOG_DISTANCE_MODE_NV 0x855A -#define GL_EYE_RADIAL_NV 0x855B -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -/* reuse GL_EYE_PLANE */ -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_EMBOSS_LIGHT_NV 0x855D -#define GL_EMBOSS_CONSTANT_NV 0x855E -#define GL_EMBOSS_MAP_NV 0x855F -#endif - -#ifndef GL_NV_blend_square -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858B -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859B -#endif - -#ifndef GL_MESA_resize_buffers -#endif - -#ifndef GL_MESA_window_pos -#endif - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_CULL_VERTEX_IBM 103050 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_VERTEX_ARRAY_LIST_IBM 103070 -#define GL_NORMAL_ARRAY_LIST_IBM 103071 -#define GL_COLOR_ARRAY_LIST_IBM 103072 -#define GL_INDEX_ARRAY_LIST_IBM 103073 -#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 -#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 -#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 -#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 -#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 -#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 -#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 -#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 -#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 -#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 -#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 -#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 -#endif - -#ifndef GL_SGIX_subsample -#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 -#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 -#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 -#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 -#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_YCRCB_SGIX 0x8318 -#define GL_YCRCBA_SGIX 0x8319 -#endif - -#ifndef GL_SGI_depth_pass_instrument -#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 -#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 -#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 -#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_MULTISAMPLE_3DFX 0x86B2 -#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 -#define GL_SAMPLES_3DFX 0x86B4 -#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 -#endif - -#ifndef GL_3DFX_tbuffer -#endif - -#ifndef GL_EXT_multisample -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F -#define GL_SAMPLE_MASK_EXT 0x80A0 -#define GL_1PASS_EXT 0x80A1 -#define GL_2PASS_0_EXT 0x80A2 -#define GL_2PASS_1_EXT 0x80A3 -#define GL_4PASS_0_EXT 0x80A4 -#define GL_4PASS_1_EXT 0x80A5 -#define GL_4PASS_2_EXT 0x80A6 -#define GL_4PASS_3_EXT 0x80A7 -#define GL_SAMPLE_BUFFERS_EXT 0x80A8 -#define GL_SAMPLES_EXT 0x80A9 -#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA -#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB -#define GL_SAMPLE_PATTERN_EXT 0x80AC -#define GL_MULTISAMPLE_BIT_EXT 0x20000000 -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_VERTEX_PRECLIP_SGIX 0x83EE -#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_CONVOLUTION_HINT_SGIX 0x8316 -#endif - -#ifndef GL_SGIX_resample -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F -#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 -#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 -#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 -#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 -#define GL_EYE_POINT_SGIS 0x81F4 -#define GL_OBJECT_POINT_SGIS 0x81F5 -#define GL_EYE_LINE_SGIS 0x81F6 -#define GL_OBJECT_LINE_SGIS 0x81F7 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif - -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -#ifndef GL_IBM_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_IBM 0x8370 -#endif - -#ifndef GL_NV_evaluators -#define GL_EVAL_2D_NV 0x86C0 -#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 -#define GL_MAP_TESSELLATION_NV 0x86C2 -#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 -#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 -#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 -#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 -#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 -#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 -#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 -#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA -#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB -#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC -#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD -#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE -#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF -#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 -#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 -#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 -#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 -#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 -#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 -#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 -#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_DEPTH_STENCIL_NV 0x84F9 -#define GL_UNSIGNED_INT_24_8_NV 0x84FA -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -#endif - -#ifndef GL_NV_texture_compression_vtc -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_TEXTURE_RECTANGLE_NV 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 -#endif - -#ifndef GL_NV_texture_shader -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB -#define GL_DSDT_MAG_INTENSITY_NV 0x86DC -#define GL_SHADER_CONSISTENT_NV 0x86DD -#define GL_TEXTURE_SHADER_NV 0x86DE -#define GL_SHADER_OPERATION_NV 0x86DF -#define GL_CULL_MODES_NV 0x86E0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV -#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV -#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 -#define GL_CONST_EYE_NV 0x86E5 -#define GL_PASS_THROUGH_NV 0x86E6 -#define GL_CULL_FRAGMENT_NV 0x86E7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA -#define GL_DOT_PRODUCT_NV 0x86EC -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 -#define GL_HILO_NV 0x86F4 -#define GL_DSDT_NV 0x86F5 -#define GL_DSDT_MAG_NV 0x86F6 -#define GL_DSDT_MAG_VIB_NV 0x86F7 -#define GL_HILO16_NV 0x86F8 -#define GL_SIGNED_HILO_NV 0x86F9 -#define GL_SIGNED_HILO16_NV 0x86FA -#define GL_SIGNED_RGBA_NV 0x86FB -#define GL_SIGNED_RGBA8_NV 0x86FC -#define GL_SIGNED_RGB_NV 0x86FE -#define GL_SIGNED_RGB8_NV 0x86FF -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870A -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D -#define GL_HI_SCALE_NV 0x870E -#define GL_LO_SCALE_NV 0x870F -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871A -#define GL_TEXTURE_HI_SIZE_NV 0x871B -#define GL_TEXTURE_LO_SIZE_NV 0x871C -#define GL_TEXTURE_DS_SIZE_NV 0x871D -#define GL_TEXTURE_DT_SIZE_NV 0x871E -#define GL_TEXTURE_MAG_SIZE_NV 0x871F -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 -#endif - -#ifndef GL_NV_vertex_program -#define GL_VERTEX_PROGRAM_NV 0x8620 -#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 -#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 -#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 -#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 -#define GL_CURRENT_ATTRIB_NV 0x8626 -#define GL_PROGRAM_LENGTH_NV 0x8627 -#define GL_PROGRAM_STRING_NV 0x8628 -#define GL_MODELVIEW_PROJECTION_NV 0x8629 -#define GL_IDENTITY_NV 0x862A -#define GL_INVERSE_NV 0x862B -#define GL_TRANSPOSE_NV 0x862C -#define GL_INVERSE_TRANSPOSE_NV 0x862D -#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E -#define GL_MAX_TRACK_MATRICES_NV 0x862F -#define GL_MATRIX0_NV 0x8630 -#define GL_MATRIX1_NV 0x8631 -#define GL_MATRIX2_NV 0x8632 -#define GL_MATRIX3_NV 0x8633 -#define GL_MATRIX4_NV 0x8634 -#define GL_MATRIX5_NV 0x8635 -#define GL_MATRIX6_NV 0x8636 -#define GL_MATRIX7_NV 0x8637 -#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 -#define GL_CURRENT_MATRIX_NV 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 -#define GL_PROGRAM_PARAMETER_NV 0x8644 -#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 -#define GL_PROGRAM_TARGET_NV 0x8646 -#define GL_PROGRAM_RESIDENT_NV 0x8647 -#define GL_TRACK_MATRIX_NV 0x8648 -#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 -#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A -#define GL_PROGRAM_ERROR_POSITION_NV 0x864B -#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 -#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 -#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 -#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 -#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 -#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 -#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 -#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 -#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 -#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 -#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A -#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B -#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C -#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D -#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E -#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F -#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 -#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 -#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 -#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 -#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 -#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 -#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 -#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 -#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 -#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 -#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A -#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B -#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C -#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D -#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E -#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F -#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 -#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 -#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 -#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 -#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 -#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 -#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 -#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 -#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 -#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 -#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A -#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B -#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C -#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D -#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E -#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 -#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A -#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SCALEBIAS_HINT_SGIX 0x8322 -#endif - -#ifndef GL_OML_interlace -#define GL_INTERLACE_OML 0x8980 -#define GL_INTERLACE_READ_OML 0x8981 -#endif - -#ifndef GL_OML_subsample -#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 -#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 -#endif - -#ifndef GL_OML_resample -#define GL_PACK_RESAMPLE_OML 0x8984 -#define GL_UNPACK_RESAMPLE_OML 0x8985 -#define GL_RESAMPLE_REPLICATE_OML 0x8986 -#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 -#define GL_RESAMPLE_AVERAGE_OML 0x8988 -#define GL_RESAMPLE_DECIMATE_OML 0x8989 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E -#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_BUMP_ROT_MATRIX_ATI 0x8775 -#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 -#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 -#define GL_BUMP_TEX_UNITS_ATI 0x8778 -#define GL_DUDV_ATI 0x8779 -#define GL_DU8DV8_ATI 0x877A -#define GL_BUMP_ENVMAP_ATI 0x877B -#define GL_BUMP_TARGET_ATI 0x877C -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_REG_6_ATI 0x8927 -#define GL_REG_7_ATI 0x8928 -#define GL_REG_8_ATI 0x8929 -#define GL_REG_9_ATI 0x892A -#define GL_REG_10_ATI 0x892B -#define GL_REG_11_ATI 0x892C -#define GL_REG_12_ATI 0x892D -#define GL_REG_13_ATI 0x892E -#define GL_REG_14_ATI 0x892F -#define GL_REG_15_ATI 0x8930 -#define GL_REG_16_ATI 0x8931 -#define GL_REG_17_ATI 0x8932 -#define GL_REG_18_ATI 0x8933 -#define GL_REG_19_ATI 0x8934 -#define GL_REG_20_ATI 0x8935 -#define GL_REG_21_ATI 0x8936 -#define GL_REG_22_ATI 0x8937 -#define GL_REG_23_ATI 0x8938 -#define GL_REG_24_ATI 0x8939 -#define GL_REG_25_ATI 0x893A -#define GL_REG_26_ATI 0x893B -#define GL_REG_27_ATI 0x893C -#define GL_REG_28_ATI 0x893D -#define GL_REG_29_ATI 0x893E -#define GL_REG_30_ATI 0x893F -#define GL_REG_31_ATI 0x8940 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_CON_8_ATI 0x8949 -#define GL_CON_9_ATI 0x894A -#define GL_CON_10_ATI 0x894B -#define GL_CON_11_ATI 0x894C -#define GL_CON_12_ATI 0x894D -#define GL_CON_13_ATI 0x894E -#define GL_CON_14_ATI 0x894F -#define GL_CON_15_ATI 0x8950 -#define GL_CON_16_ATI 0x8951 -#define GL_CON_17_ATI 0x8952 -#define GL_CON_18_ATI 0x8953 -#define GL_CON_19_ATI 0x8954 -#define GL_CON_20_ATI 0x8955 -#define GL_CON_21_ATI 0x8956 -#define GL_CON_22_ATI 0x8957 -#define GL_CON_23_ATI 0x8958 -#define GL_CON_24_ATI 0x8959 -#define GL_CON_25_ATI 0x895A -#define GL_CON_26_ATI 0x895B -#define GL_CON_27_ATI 0x895C -#define GL_CON_28_ATI 0x895D -#define GL_CON_29_ATI 0x895E -#define GL_CON_30_ATI 0x895F -#define GL_CON_31_ATI 0x8960 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896A -#define GL_CND0_ATI 0x896B -#define GL_DOT2_ADD_ATI 0x896C -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D -#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E -#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F -#define GL_NUM_PASSES_ATI 0x8970 -#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 -#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 -#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 -#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 -#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_SWIZZLE_STRQ_ATI 0x897A -#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_PN_TRIANGLES_ATI 0x87F0 -#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 -#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 -#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 -#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 -#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 -#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 -#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 -#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_STATIC_ATI 0x8760 -#define GL_DYNAMIC_ATI 0x8761 -#define GL_PRESERVE_ATI 0x8762 -#define GL_DISCARD_ATI 0x8763 -#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 -#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 -#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 -#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_VERTEX_SHADER_EXT 0x8780 -#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 -#define GL_OP_INDEX_EXT 0x8782 -#define GL_OP_NEGATE_EXT 0x8783 -#define GL_OP_DOT3_EXT 0x8784 -#define GL_OP_DOT4_EXT 0x8785 -#define GL_OP_MUL_EXT 0x8786 -#define GL_OP_ADD_EXT 0x8787 -#define GL_OP_MADD_EXT 0x8788 -#define GL_OP_FRAC_EXT 0x8789 -#define GL_OP_MAX_EXT 0x878A -#define GL_OP_MIN_EXT 0x878B -#define GL_OP_SET_GE_EXT 0x878C -#define GL_OP_SET_LT_EXT 0x878D -#define GL_OP_CLAMP_EXT 0x878E -#define GL_OP_FLOOR_EXT 0x878F -#define GL_OP_ROUND_EXT 0x8790 -#define GL_OP_EXP_BASE_2_EXT 0x8791 -#define GL_OP_LOG_BASE_2_EXT 0x8792 -#define GL_OP_POWER_EXT 0x8793 -#define GL_OP_RECIP_EXT 0x8794 -#define GL_OP_RECIP_SQRT_EXT 0x8795 -#define GL_OP_SUB_EXT 0x8796 -#define GL_OP_CROSS_PRODUCT_EXT 0x8797 -#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 -#define GL_OP_MOV_EXT 0x8799 -#define GL_OUTPUT_VERTEX_EXT 0x879A -#define GL_OUTPUT_COLOR0_EXT 0x879B -#define GL_OUTPUT_COLOR1_EXT 0x879C -#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D -#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E -#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F -#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 -#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 -#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 -#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 -#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 -#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 -#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 -#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 -#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 -#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 -#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA -#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB -#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC -#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD -#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE -#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF -#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 -#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 -#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 -#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 -#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 -#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 -#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 -#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 -#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 -#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 -#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA -#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB -#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC -#define GL_OUTPUT_FOG_EXT 0x87BD -#define GL_SCALAR_EXT 0x87BE -#define GL_VECTOR_EXT 0x87BF -#define GL_MATRIX_EXT 0x87C0 -#define GL_VARIANT_EXT 0x87C1 -#define GL_INVARIANT_EXT 0x87C2 -#define GL_LOCAL_CONSTANT_EXT 0x87C3 -#define GL_LOCAL_EXT 0x87C4 -#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 -#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 -#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 -#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 -#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE -#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF -#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 -#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 -#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 -#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 -#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 -#define GL_X_EXT 0x87D5 -#define GL_Y_EXT 0x87D6 -#define GL_Z_EXT 0x87D7 -#define GL_W_EXT 0x87D8 -#define GL_NEGATIVE_X_EXT 0x87D9 -#define GL_NEGATIVE_Y_EXT 0x87DA -#define GL_NEGATIVE_Z_EXT 0x87DB -#define GL_NEGATIVE_W_EXT 0x87DC -#define GL_ZERO_EXT 0x87DD -#define GL_ONE_EXT 0x87DE -#define GL_NEGATIVE_ONE_EXT 0x87DF -#define GL_NORMALIZED_RANGE_EXT 0x87E0 -#define GL_FULL_RANGE_EXT 0x87E1 -#define GL_CURRENT_VERTEX_EXT 0x87E2 -#define GL_MVP_MATRIX_EXT 0x87E3 -#define GL_VARIANT_VALUE_EXT 0x87E4 -#define GL_VARIANT_DATATYPE_EXT 0x87E5 -#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 -#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 -#define GL_VARIANT_ARRAY_EXT 0x87E8 -#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 -#define GL_INVARIANT_VALUE_EXT 0x87EA -#define GL_INVARIANT_DATATYPE_EXT 0x87EB -#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC -#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_MAX_VERTEX_STREAMS_ATI 0x876B -#define GL_VERTEX_STREAM0_ATI 0x876C -#define GL_VERTEX_STREAM1_ATI 0x876D -#define GL_VERTEX_STREAM2_ATI 0x876E -#define GL_VERTEX_STREAM3_ATI 0x876F -#define GL_VERTEX_STREAM4_ATI 0x8770 -#define GL_VERTEX_STREAM5_ATI 0x8771 -#define GL_VERTEX_STREAM6_ATI 0x8772 -#define GL_VERTEX_STREAM7_ATI 0x8773 -#define GL_VERTEX_SOURCE_ATI 0x8774 -#endif - -#ifndef GL_ATI_element_array -#define GL_ELEMENT_ARRAY_ATI 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A -#endif - -#ifndef GL_SUN_mesh_array -#define GL_QUAD_MESH_SUN 0x8614 -#define GL_TRIANGLE_MESH_SUN 0x8615 -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SLICE_ACCUM_SUN 0x85CC -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_DEPTH_CLAMP_NV 0x864F -#endif - -#ifndef GL_NV_occlusion_query -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -#endif - -#ifndef GL_NV_point_sprite -#define GL_POINT_SPRITE_NV 0x8861 -#define GL_COORD_REPLACE_NV 0x8862 -#define GL_POINT_SPRITE_R_MODE_NV 0x8863 -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 -#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 -#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 -#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 -#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 -#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A -#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B -#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C -#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D -#define GL_HILO8_NV 0x885E -#define GL_SIGNED_HILO8_NV 0x885F -#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 -#endif - -#ifndef GL_NV_vertex_program1_1 -#endif - -#ifndef GL_EXT_shadow_funcs -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 -#endif - -#ifndef GL_APPLE_element_array -#define GL_ELEMENT_ARRAY_APPLE 0x8A0C -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E -#endif - -#ifndef GL_APPLE_fence -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CLIENT_APPLE 0x85B4 -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_YCBCR_422_APPLE 0x85B9 -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -#ifndef GL_S3_s3tc -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 -#define GL_DRAW_BUFFER0_ATI 0x8825 -#define GL_DRAW_BUFFER1_ATI 0x8826 -#define GL_DRAW_BUFFER2_ATI 0x8827 -#define GL_DRAW_BUFFER3_ATI 0x8828 -#define GL_DRAW_BUFFER4_ATI 0x8829 -#define GL_DRAW_BUFFER5_ATI 0x882A -#define GL_DRAW_BUFFER6_ATI 0x882B -#define GL_DRAW_BUFFER7_ATI 0x882C -#define GL_DRAW_BUFFER8_ATI 0x882D -#define GL_DRAW_BUFFER9_ATI 0x882E -#define GL_DRAW_BUFFER10_ATI 0x882F -#define GL_DRAW_BUFFER11_ATI 0x8830 -#define GL_DRAW_BUFFER12_ATI 0x8831 -#define GL_DRAW_BUFFER13_ATI 0x8832 -#define GL_DRAW_BUFFER14_ATI 0x8833 -#define GL_DRAW_BUFFER15_ATI 0x8834 -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -#endif - -#ifndef GL_ATI_texture_float -#define GL_RGBA_FLOAT32_ATI 0x8814 -#define GL_RGB_FLOAT32_ATI 0x8815 -#define GL_ALPHA_FLOAT32_ATI 0x8816 -#define GL_INTENSITY_FLOAT32_ATI 0x8817 -#define GL_LUMINANCE_FLOAT32_ATI 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 -#define GL_RGBA_FLOAT16_ATI 0x881A -#define GL_RGB_FLOAT16_ATI 0x881B -#define GL_ALPHA_FLOAT16_ATI 0x881C -#define GL_INTENSITY_FLOAT16_ATI 0x881D -#define GL_LUMINANCE_FLOAT16_ATI 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F -#endif - -#ifndef GL_NV_float_buffer -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E -#endif - -#ifndef GL_NV_fragment_program -#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 -#define GL_FRAGMENT_PROGRAM_NV 0x8870 -#define GL_MAX_TEXTURE_COORDS_NV 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 -#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 -#define GL_PROGRAM_ERROR_STRING_NV 0x8874 -#endif - -#ifndef GL_NV_half_float -#define GL_HALF_FLOAT_NV 0x140B -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 -#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 -#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A -#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B -#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C -#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D -#endif - -#ifndef GL_NV_primitive_restart -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F -#endif - -#ifndef GL_NV_vertex_program2 -#endif - -#ifndef GL_ATI_map_object_buffer -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#endif - -#ifndef GL_OES_read_format -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_BLEND_EQUATION_RGB_EXT 0x8009 -#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D -#endif - -#ifndef GL_MESA_pack_invert -#define GL_PACK_INVERT_MESA 0x8758 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF -#endif - -#ifndef GL_NV_fragment_program_option -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 -#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 -#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 -#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 -#endif - -#ifndef GL_NV_vertex_program2_option -/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ -/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ -#endif - -#ifndef GL_NV_vertex_program3 -/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#endif - -#ifndef GL_GREMEDY_string_marker -#endif - -#ifndef GL_EXT_packed_depth_stencil -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif - -#ifndef GL_EXT_stencil_clear_tag -#define GL_STENCIL_TAG_BITS_EXT 0x88F2 -#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 -#endif - -#ifndef GL_EXT_texture_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB8_EXT 0x8C41 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 -#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 -#define GL_SLUMINANCE_EXT 0x8C46 -#define GL_SLUMINANCE8_EXT 0x8C47 -#define GL_COMPRESSED_SRGB_EXT 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 -#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B -#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F -#endif - -#ifndef GL_EXT_framebuffer_blit -#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA -#endif - -#ifndef GL_EXT_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -#ifndef GL_MESAX_texture_stack -#define GL_TEXTURE_1D_STACK_MESAX 0x8759 -#define GL_TEXTURE_2D_STACK_MESAX 0x875A -#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B -#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C -#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D -#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E -#endif - -#ifndef GL_EXT_timer_query -#define GL_TIME_ELAPSED_EXT 0x88BF -#endif - -#ifndef GL_EXT_gpu_program_parameters -#endif - -#ifndef GL_APPLE_flush_buffer_range -#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 -#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 -#endif - -#ifndef GL_NV_gpu_program4 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 -#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 -#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 -#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 -#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 -#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 -#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 -#endif - -#ifndef GL_NV_geometry_program4 -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_GEOMETRY_PROGRAM_NV 0x8C26 -#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 -#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 -#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 -#endif - -#ifndef GL_EXT_geometry_shader4 -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */ -/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */ -/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */ -/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */ -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE -#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -/* reuse GL_LINES_ADJACENCY_EXT */ -/* reuse GL_LINE_STRIP_ADJACENCY_EXT */ -/* reuse GL_TRIANGLES_ADJACENCY_EXT */ -/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ -/* reuse GL_PROGRAM_POINT_SIZE_EXT */ -#endif - -#ifndef GL_NV_vertex_program4 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -#endif - -#ifndef GL_EXT_gpu_shader4 -#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 -#define GL_INT_SAMPLER_1D_EXT 0x8DC9 -#define GL_INT_SAMPLER_2D_EXT 0x8DCA -#define GL_INT_SAMPLER_3D_EXT 0x8DCB -#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#endif - -#ifndef GL_EXT_draw_instanced -#endif - -#ifndef GL_EXT_packed_float -#define GL_R11F_G11F_B10F_EXT 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B -#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C -#endif - -#ifndef GL_EXT_texture_array -#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 -#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D -#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF -#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ -#endif - -#ifndef GL_EXT_texture_buffer_object -#define GL_TEXTURE_BUFFER_EXT 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E -#endif - -#ifndef GL_EXT_texture_compression_latc -#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 -#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 -#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 -#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 -#endif - -#ifndef GL_EXT_texture_compression_rgtc -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE -#endif - -#ifndef GL_EXT_texture_shared_exponent -#define GL_RGB9_E5_EXT 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E -#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F -#endif - -#ifndef GL_NV_depth_buffer_float -#define GL_DEPTH_COMPONENT32F_NV 0x8DAB -#define GL_DEPTH32F_STENCIL8_NV 0x8DAC -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD -#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF -#endif - -#ifndef GL_NV_fragment_program4 -#endif - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB -#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 -#endif - -#ifndef GL_EXT_framebuffer_sRGB -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA -#endif - -#ifndef GL_NV_geometry_shader4 -#endif - -#ifndef GL_NV_parameter_buffer_object -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 -#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 -#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 -#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 -#endif - -#ifndef GL_EXT_draw_buffers2 -#endif - -#ifndef GL_NV_transform_feedback -#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 -#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 -#define GL_TEXTURE_COORD_NV 0x8C79 -#define GL_CLIP_DISTANCE_NV 0x8C7A -#define GL_VERTEX_ID_NV 0x8C7B -#define GL_PRIMITIVE_ID_NV 0x8C7C -#define GL_GENERIC_ATTRIB_NV 0x8C7D -#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 -#define GL_ACTIVE_VARYINGS_NV 0x8C81 -#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 -#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 -#define GL_PRIMITIVES_GENERATED_NV 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 -#define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B -#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C -#define GL_SEPARATE_ATTRIBS_NV 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F -#define GL_LAYER_NV 0x8DAA -#define GL_NEXT_BUFFER_NV -2 -#define GL_SKIP_COMPONENTS4_NV -3 -#define GL_SKIP_COMPONENTS3_NV -4 -#define GL_SKIP_COMPONENTS2_NV -5 -#define GL_SKIP_COMPONENTS1_NV -6 -#endif - -#ifndef GL_EXT_bindable_uniform -#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 -#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 -#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 -#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED -#define GL_UNIFORM_BUFFER_EXT 0x8DEE -#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF -#endif - -#ifndef GL_EXT_texture_integer -#define GL_RGBA32UI_EXT 0x8D70 -#define GL_RGB32UI_EXT 0x8D71 -#define GL_ALPHA32UI_EXT 0x8D72 -#define GL_INTENSITY32UI_EXT 0x8D73 -#define GL_LUMINANCE32UI_EXT 0x8D74 -#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 -#define GL_RGBA16UI_EXT 0x8D76 -#define GL_RGB16UI_EXT 0x8D77 -#define GL_ALPHA16UI_EXT 0x8D78 -#define GL_INTENSITY16UI_EXT 0x8D79 -#define GL_LUMINANCE16UI_EXT 0x8D7A -#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B -#define GL_RGBA8UI_EXT 0x8D7C -#define GL_RGB8UI_EXT 0x8D7D -#define GL_ALPHA8UI_EXT 0x8D7E -#define GL_INTENSITY8UI_EXT 0x8D7F -#define GL_LUMINANCE8UI_EXT 0x8D80 -#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 -#define GL_RGBA32I_EXT 0x8D82 -#define GL_RGB32I_EXT 0x8D83 -#define GL_ALPHA32I_EXT 0x8D84 -#define GL_INTENSITY32I_EXT 0x8D85 -#define GL_LUMINANCE32I_EXT 0x8D86 -#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 -#define GL_RGBA16I_EXT 0x8D88 -#define GL_RGB16I_EXT 0x8D89 -#define GL_ALPHA16I_EXT 0x8D8A -#define GL_INTENSITY16I_EXT 0x8D8B -#define GL_LUMINANCE16I_EXT 0x8D8C -#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D -#define GL_RGBA8I_EXT 0x8D8E -#define GL_RGB8I_EXT 0x8D8F -#define GL_ALPHA8I_EXT 0x8D90 -#define GL_INTENSITY8I_EXT 0x8D91 -#define GL_LUMINANCE8I_EXT 0x8D92 -#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 -#define GL_RED_INTEGER_EXT 0x8D94 -#define GL_GREEN_INTEGER_EXT 0x8D95 -#define GL_BLUE_INTEGER_EXT 0x8D96 -#define GL_ALPHA_INTEGER_EXT 0x8D97 -#define GL_RGB_INTEGER_EXT 0x8D98 -#define GL_RGBA_INTEGER_EXT 0x8D99 -#define GL_BGR_INTEGER_EXT 0x8D9A -#define GL_BGRA_INTEGER_EXT 0x8D9B -#define GL_LUMINANCE_INTEGER_EXT 0x8D9C -#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D -#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E -#endif - -#ifndef GL_GREMEDY_frame_terminator -#endif - -#ifndef GL_NV_conditional_render -#define GL_QUERY_WAIT_NV 0x8E13 -#define GL_QUERY_NO_WAIT_NV 0x8E14 -#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 -#endif - -#ifndef GL_NV_present_video -#define GL_FRAME_NV 0x8E26 -#define GL_FIELDS_NV 0x8E27 -#define GL_CURRENT_TIME_NV 0x8E28 -#define GL_NUM_FILL_STREAMS_NV 0x8E29 -#define GL_PRESENT_TIME_NV 0x8E2A -#define GL_PRESENT_DURATION_NV 0x8E2B -#endif - -#ifndef GL_EXT_transform_feedback -#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F -#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C -#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D -#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 -#define GL_RASTERIZER_DISCARD_EXT 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 -#endif - -#ifndef GL_EXT_direct_state_access -#define GL_PROGRAM_MATRIX_EXT 0x8E2D -#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E -#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F -#endif - -#ifndef GL_EXT_vertex_array_bgra -/* reuse GL_BGRA */ -#endif - -#ifndef GL_EXT_texture_swizzle -#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 -#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 -#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 -#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 -#endif - -#ifndef GL_NV_explicit_multisample -#define GL_SAMPLE_POSITION_NV 0x8E50 -#define GL_SAMPLE_MASK_NV 0x8E51 -#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 -#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 -#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 -#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 -#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 -#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 -#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 -#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 -#endif - -#ifndef GL_NV_transform_feedback2 -#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 -#endif - -#ifndef GL_ATI_meminfo -#define GL_VBO_FREE_MEMORY_ATI 0x87FB -#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC -#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD -#endif - -#ifndef GL_AMD_performance_monitor -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -#endif - -#ifndef GL_AMD_texture_texture4 -#endif - -#ifndef GL_AMD_vertex_shader_tesselator -#define GL_SAMPLER_BUFFER_AMD 0x9001 -#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 -#define GL_TESSELLATION_MODE_AMD 0x9004 -#define GL_TESSELLATION_FACTOR_AMD 0x9005 -#define GL_DISCRETE_AMD 0x9006 -#define GL_CONTINUOUS_AMD 0x9007 -#endif - -#ifndef GL_EXT_provoking_vertex -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D -#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E -#define GL_PROVOKING_VERTEX_EXT 0x8E4F -#endif - -#ifndef GL_EXT_texture_snorm -#define GL_ALPHA_SNORM 0x9010 -#define GL_LUMINANCE_SNORM 0x9011 -#define GL_LUMINANCE_ALPHA_SNORM 0x9012 -#define GL_INTENSITY_SNORM 0x9013 -#define GL_ALPHA8_SNORM 0x9014 -#define GL_LUMINANCE8_SNORM 0x9015 -#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 -#define GL_INTENSITY8_SNORM 0x9017 -#define GL_ALPHA16_SNORM 0x9018 -#define GL_LUMINANCE16_SNORM 0x9019 -#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A -#define GL_INTENSITY16_SNORM 0x901B -/* reuse GL_RED_SNORM */ -/* reuse GL_RG_SNORM */ -/* reuse GL_RGB_SNORM */ -/* reuse GL_RGBA_SNORM */ -/* reuse GL_R8_SNORM */ -/* reuse GL_RG8_SNORM */ -/* reuse GL_RGB8_SNORM */ -/* reuse GL_RGBA8_SNORM */ -/* reuse GL_R16_SNORM */ -/* reuse GL_RG16_SNORM */ -/* reuse GL_RGB16_SNORM */ -/* reuse GL_RGBA16_SNORM */ -/* reuse GL_SIGNED_NORMALIZED */ -#endif - -#ifndef GL_AMD_draw_buffers_blend -#endif - -#ifndef GL_APPLE_texture_range -#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 -#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 -#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC -#define GL_STORAGE_PRIVATE_APPLE 0x85BD -/* reuse GL_STORAGE_CACHED_APPLE */ -/* reuse GL_STORAGE_SHARED_APPLE */ -#endif - -#ifndef GL_APPLE_float_pixels -#define GL_HALF_APPLE 0x140B -#define GL_RGBA_FLOAT32_APPLE 0x8814 -#define GL_RGB_FLOAT32_APPLE 0x8815 -#define GL_ALPHA_FLOAT32_APPLE 0x8816 -#define GL_INTENSITY_FLOAT32_APPLE 0x8817 -#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 -#define GL_RGBA_FLOAT16_APPLE 0x881A -#define GL_RGB_FLOAT16_APPLE 0x881B -#define GL_ALPHA_FLOAT16_APPLE 0x881C -#define GL_INTENSITY_FLOAT16_APPLE 0x881D -#define GL_LUMINANCE_FLOAT16_APPLE 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F -#define GL_COLOR_FLOAT_APPLE 0x8A0F -#endif - -#ifndef GL_APPLE_vertex_program_evaluators -#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 -#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 -#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 -#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 -#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 -#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 -#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 -#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 -#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 -#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 -#endif - -#ifndef GL_APPLE_aux_depth_stencil -#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 -#endif - -#ifndef GL_APPLE_object_purgeable -#define GL_BUFFER_OBJECT_APPLE 0x85B3 -#define GL_RELEASED_APPLE 0x8A19 -#define GL_VOLATILE_APPLE 0x8A1A -#define GL_RETAINED_APPLE 0x8A1B -#define GL_UNDEFINED_APPLE 0x8A1C -#define GL_PURGEABLE_APPLE 0x8A1D -#endif - -#ifndef GL_APPLE_row_bytes -#define GL_PACK_ROW_BYTES_APPLE 0x8A15 -#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 -#endif - -#ifndef GL_APPLE_rgb_422 -#define GL_RGB_422_APPLE 0x8A1F -/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */ -/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */ -#endif - -#ifndef GL_NV_video_capture -#define GL_VIDEO_BUFFER_NV 0x9020 -#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 -#define GL_FIELD_UPPER_NV 0x9022 -#define GL_FIELD_LOWER_NV 0x9023 -#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 -#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 -#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 -#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 -#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 -#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 -#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A -#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B -#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C -#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D -#define GL_PARTIAL_SUCCESS_NV 0x902E -#define GL_SUCCESS_NV 0x902F -#define GL_FAILURE_NV 0x9030 -#define GL_YCBYCR8_422_NV 0x9031 -#define GL_YCBAYCR8A_4224_NV 0x9032 -#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 -#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 -#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 -#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 -#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 -#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 -#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 -#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A -#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B -#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C -#endif - -#ifndef GL_NV_copy_image -#endif - -#ifndef GL_EXT_separate_shader_objects -#define GL_ACTIVE_PROGRAM_EXT 0x8B8D -#endif - -#ifndef GL_NV_parameter_buffer_object2 -#endif - -#ifndef GL_NV_shader_buffer_load -#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D -#define GL_GPU_ADDRESS_NV 0x8F34 -#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 -#endif - -#ifndef GL_NV_vertex_buffer_unified_memory -#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E -#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F -#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 -#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 -#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 -#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 -#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 -#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 -#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 -#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 -#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 -#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 -#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A -#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B -#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C -#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D -#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E -#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F -#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 -#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 -#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 -#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 -#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 -#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 -#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 -#endif - -#ifndef GL_NV_texture_barrier -#endif - -#ifndef GL_AMD_shader_stencil_export -#endif - -#ifndef GL_AMD_seamless_cubemap_per_texture -/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB */ -#endif - -#ifndef GL_AMD_conservative_depth -#endif - -#ifndef GL_EXT_shader_image_load_store -#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 -#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A -#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B -#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C -#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D -#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E -#define GL_IMAGE_1D_EXT 0x904C -#define GL_IMAGE_2D_EXT 0x904D -#define GL_IMAGE_3D_EXT 0x904E -#define GL_IMAGE_2D_RECT_EXT 0x904F -#define GL_IMAGE_CUBE_EXT 0x9050 -#define GL_IMAGE_BUFFER_EXT 0x9051 -#define GL_IMAGE_1D_ARRAY_EXT 0x9052 -#define GL_IMAGE_2D_ARRAY_EXT 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 -#define GL_INT_IMAGE_1D_EXT 0x9057 -#define GL_INT_IMAGE_2D_EXT 0x9058 -#define GL_INT_IMAGE_3D_EXT 0x9059 -#define GL_INT_IMAGE_2D_RECT_EXT 0x905A -#define GL_INT_IMAGE_CUBE_EXT 0x905B -#define GL_INT_IMAGE_BUFFER_EXT 0x905C -#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D -#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C -#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D -#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 -#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 -#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF -#endif - -#ifndef GL_EXT_vertex_attrib_64bit -/* reuse GL_DOUBLE */ -#define GL_DOUBLE_VEC2_EXT 0x8FFC -#define GL_DOUBLE_VEC3_EXT 0x8FFD -#define GL_DOUBLE_VEC4_EXT 0x8FFE -#define GL_DOUBLE_MAT2_EXT 0x8F46 -#define GL_DOUBLE_MAT3_EXT 0x8F47 -#define GL_DOUBLE_MAT4_EXT 0x8F48 -#define GL_DOUBLE_MAT2x3_EXT 0x8F49 -#define GL_DOUBLE_MAT2x4_EXT 0x8F4A -#define GL_DOUBLE_MAT3x2_EXT 0x8F4B -#define GL_DOUBLE_MAT3x4_EXT 0x8F4C -#define GL_DOUBLE_MAT4x2_EXT 0x8F4D -#define GL_DOUBLE_MAT4x3_EXT 0x8F4E -#endif - -#ifndef GL_NV_gpu_program5 -#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C -#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D -#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 -#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 -#endif - -#ifndef GL_NV_gpu_shader5 -#define GL_INT64_NV 0x140E -#define GL_UNSIGNED_INT64_NV 0x140F -#define GL_INT8_NV 0x8FE0 -#define GL_INT8_VEC2_NV 0x8FE1 -#define GL_INT8_VEC3_NV 0x8FE2 -#define GL_INT8_VEC4_NV 0x8FE3 -#define GL_INT16_NV 0x8FE4 -#define GL_INT16_VEC2_NV 0x8FE5 -#define GL_INT16_VEC3_NV 0x8FE6 -#define GL_INT16_VEC4_NV 0x8FE7 -#define GL_INT64_VEC2_NV 0x8FE9 -#define GL_INT64_VEC3_NV 0x8FEA -#define GL_INT64_VEC4_NV 0x8FEB -#define GL_UNSIGNED_INT8_NV 0x8FEC -#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED -#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE -#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF -#define GL_UNSIGNED_INT16_NV 0x8FF0 -#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 -#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 -#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 -#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB -/* reuse GL_PATCHES */ -#endif - -#ifndef GL_NV_shader_buffer_store -#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 -/* reuse GL_READ_WRITE */ -/* reuse GL_WRITE_ONLY */ -#endif - -#ifndef GL_NV_tessellation_program5 -#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 -#define GL_TESS_CONTROL_PROGRAM_NV 0x891E -#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F -#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 -#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 -#endif - -#ifndef GL_NV_vertex_attrib_integer_64bit -/* reuse GL_INT64_NV */ -/* reuse GL_UNSIGNED_INT64_NV */ -#endif - -#ifndef GL_NV_multisample_coverage -#define GL_COVERAGE_SAMPLES_NV 0x80A9 -#define GL_COLOR_SAMPLES_NV 0x8E20 -#endif - -#ifndef GL_AMD_name_gen_delete -#define GL_DATA_BUFFER_AMD 0x9151 -#define GL_PERFORMANCE_MONITOR_AMD 0x9152 -#define GL_QUERY_OBJECT_AMD 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 -#define GL_SAMPLER_OBJECT_AMD 0x9155 -#endif - -#ifndef GL_AMD_debug_output -#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 -#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 -#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 -#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A -#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B -#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C -#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D -#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E -#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F -#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 -#endif - -#ifndef GL_NV_vdpau_interop -#define GL_SURFACE_STATE_NV 0x86EB -#define GL_SURFACE_REGISTERED_NV 0x86FD -#define GL_SURFACE_MAPPED_NV 0x8700 -#define GL_WRITE_DISCARD_NV 0x88BE -#endif - -#ifndef GL_AMD_transform_feedback3_lines_triangles -#endif - - -/*************************************************************/ - -#include -#ifndef GL_VERSION_2_0 -/* GL type for program/shader text */ -typedef char GLchar; -#endif - -#ifndef GL_VERSION_1_5 -/* GL types for handling large vertex buffer objects */ -#if defined(__APPLE__) -typedef long GLintptr; -typedef long GLsizeiptr; -#else -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -#endif -#endif - -#ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ -#if defined(__APPLE__) -typedef long GLintptrARB; -typedef long GLsizeiptrARB; -#else -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif -#endif - -#ifndef GL_ARB_shader_objects -/* GL types for program/shader text and shader object handles */ -typedef char GLcharARB; -#if defined(__APPLE__) -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif -#endif - -/* GL type for "half" precision (s10e5) float data in host memory */ -#ifndef GL_ARB_half_float_pixel -typedef unsigned short GLhalfARB; -#endif - -#ifndef GL_NV_half_float -typedef unsigned short GLhalfNV; -#endif - -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif - -#ifndef GL_EXT_timer_query -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; -#endif - -#ifndef GL_ARB_sync -typedef int64_t GLint64; -typedef uint64_t GLuint64; -typedef struct __GLsync *GLsync; -#endif - -#ifndef GL_ARB_cl_event -/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */ -struct _cl_context; -struct _cl_event; -#endif - -#ifndef GL_ARB_debug_output -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#endif - -#ifndef GL_AMD_debug_output -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#endif - -#ifndef GL_NV_vdpau_interop -typedef GLintptr GLvdpauSurfaceNV; -#endif - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GLAPI void APIENTRY glBlendEquation (GLenum mode); -GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED -#define GL_VERSION_1_2_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table); -GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); -GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params); -GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image); -GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glResetHistogram (GLenum target); -GLAPI void APIENTRY glResetMinmax (GLenum target); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -#endif - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum texture); -GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED -#define GL_VERSION_1_3_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClientActiveTexture (GLenum texture); -GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); -GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s); -GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s); -GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s); -GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); -GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); -GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t); -GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); -GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); -GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v); -GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m); -GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); -GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); -GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -#endif - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED -#define GL_VERSION_1_4_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordf (GLfloat coord); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); -GLAPI void APIENTRY glFogCoordd (GLdouble coord); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord); -GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); -GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v); -GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); -GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v); -GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); -GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v); -GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue); -GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v); -GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); -GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v); -GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); -GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v); -GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); -GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v); -GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); -GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v); -GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2iv (const GLint *v); -GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2sv (const GLshort *v); -GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3iv (const GLint *v); -GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); -#endif - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQuery (GLuint id); -GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQuery (GLenum target); -GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); -GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -GLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GLAPI void APIENTRY glCompileShader (GLuint shader); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum type); -GLAPI void APIENTRY glDeleteProgram (GLuint program); -GLAPI void APIENTRY glDeleteShader (GLuint shader); -GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer); -GLAPI GLboolean APIENTRY glIsProgram (GLuint program); -GLAPI GLboolean APIENTRY glIsShader (GLuint shader); -GLAPI void APIENTRY glLinkProgram (GLuint program); -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -GLAPI void APIENTRY glUseProgram (GLuint program); -GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glValidateProgram (GLuint program); -GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif - -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -/* OpenGL 3.0 also reuses entry points from these extensions: */ -/* ARB_framebuffer_object */ -/* ARB_map_buffer_range */ -/* ARB_vertex_array_object */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); -GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); -GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedback (void); -GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); -GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRender (void); -GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); -#endif - -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -/* OpenGL 3.1 also reuses entry points from these extensions: */ -/* ARB_copy_buffer */ -/* ARB_uniform_buffer_object */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); -#endif - -#ifndef GL_VERSION_3_2 -#define GL_VERSION_3_2 1 -/* OpenGL 3.2 also reuses entry points from these extensions: */ -/* ARB_draw_elements_base_vertex */ -/* ARB_provoking_vertex */ -/* ARB_sync */ -/* ARB_texture_multisample */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -#endif - -#ifndef GL_VERSION_3_3 -#define GL_VERSION_3_3 1 -/* OpenGL 3.3 also reuses entry points from these extensions: */ -/* ARB_blend_func_extended */ -/* ARB_sampler_objects */ -/* ARB_explicit_attrib_location, but it has none */ -/* ARB_occlusion_query2 (no entry points) */ -/* ARB_shader_bit_encoding (no entry points) */ -/* ARB_texture_rgb10_a2ui (no entry points) */ -/* ARB_texture_swizzle (no entry points) */ -/* ARB_timer_query */ -/* ARB_vertex_type_2_10_10_10_rev */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); -#endif - -#ifndef GL_VERSION_4_0 -#define GL_VERSION_4_0 1 -/* OpenGL 4.0 also reuses entry points from these extensions: */ -/* ARB_texture_query_lod (no entry points) */ -/* ARB_draw_indirect */ -/* ARB_gpu_shader5 (no entry points) */ -/* ARB_gpu_shader_fp64 */ -/* ARB_shader_subroutine */ -/* ARB_tessellation_shader */ -/* ARB_texture_buffer_object_rgb32 (no entry points) */ -/* ARB_texture_cube_map_array (no entry points) */ -/* ARB_texture_gather (no entry points) */ -/* ARB_transform_feedback2 */ -/* ARB_transform_feedback3 */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShading (GLclampf value); -GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value); -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif - -#ifndef GL_VERSION_4_1 -#define GL_VERSION_4_1 1 -/* OpenGL 4.1 also reuses entry points from these extensions: */ -/* ARB_ES2_compatibility */ -/* ARB_get_program_binary */ -/* ARB_separate_shader_objects */ -/* ARB_shader_precision (no entry points) */ -/* ARB_vertex_attrib_64bit */ -/* ARB_viewport_array */ -#endif - -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTextureARB (GLenum texture); -GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture); -GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s); -GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s); -GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s); -GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s); -GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); -GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); -GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); -GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); -GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); -GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v); -GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); -GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); -GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v); -GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m); -GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m); -GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m); -GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -#endif - -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLclampf value, GLboolean invert); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); -#endif - -#ifndef GL_ARB_texture_env_add -#define GL_ARB_texture_env_add 1 -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#endif - -#ifndef GL_ARB_texture_compression -#define GL_ARB_texture_compression 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#endif - -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights); -GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights); -GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights); -GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights); -GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights); -GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights); -GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights); -GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights); -GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glVertexBlendARB (GLint count); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); -typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); -typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); -typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); -typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); -typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); -typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_ARB_matrix_palette 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index); -GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices); -GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices); -GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices); -GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); -typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_ARB_texture_env_combine 1 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#define GL_ARB_texture_env_crossbar 1 -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#endif - -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_ARB_shadow_ambient 1 -#endif - -#ifndef GL_ARB_window_pos -#define GL_ARB_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v); -GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v); -GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v); -GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); -#endif - -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index); -GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index); -GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string); -GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program); -GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs); -GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string); -GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer); -GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); -typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); -#endif - -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); -GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); -GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id); -GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQueryARB (GLenum target); -GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj); -GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname); -GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); -GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType); -GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj); -GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); -GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); -GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj); -GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj); -GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj); -GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); -GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); -GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); -GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#define GL_ARB_texture_non_power_of_two 1 -#endif - -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#define GL_ARB_fragment_program_shadow 1 -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -#endif - -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#endif - -#ifndef GL_ARB_depth_buffer_float -#define GL_ARB_depth_buffer_float 1 -#endif - -#ifndef GL_ARB_draw_instanced -#define GL_ARB_draw_instanced 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif - -#ifndef GL_ARB_framebuffer_object -#define GL_ARB_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmap (GLenum target); -GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#endif - -#ifndef GL_ARB_framebuffer_sRGB -#define GL_ARB_framebuffer_sRGB 1 -#endif - -#ifndef GL_ARB_geometry_shader4 -#define GL_ARB_geometry_shader4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value); -GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif - -#ifndef GL_ARB_half_float_vertex -#define GL_ARB_half_float_vertex 1 -#endif - -#ifndef GL_ARB_instanced_arrays -#define GL_ARB_instanced_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); -#endif - -#ifndef GL_ARB_map_buffer_range -#define GL_ARB_map_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -#endif - -#ifndef GL_ARB_texture_buffer_object -#define GL_ARB_texture_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); -#endif - -#ifndef GL_ARB_texture_compression_rgtc -#define GL_ARB_texture_compression_rgtc 1 -#endif - -#ifndef GL_ARB_texture_rg -#define GL_ARB_texture_rg 1 -#endif - -#ifndef GL_ARB_vertex_array_object -#define GL_ARB_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArray (GLuint array); -GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); -#endif - -#ifndef GL_ARB_uniform_buffer_object -#define GL_ARB_uniform_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); -GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif - -#ifndef GL_ARB_compatibility -#define GL_ARB_compatibility 1 -#endif - -#ifndef GL_ARB_copy_buffer -#define GL_ARB_copy_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#endif - -#ifndef GL_ARB_shader_texture_lod -#define GL_ARB_shader_texture_lod 1 -#endif - -#ifndef GL_ARB_depth_clamp -#define GL_ARB_depth_clamp 1 -#endif - -#ifndef GL_ARB_draw_elements_base_vertex -#define GL_ARB_draw_elements_base_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); -#endif - -#ifndef GL_ARB_fragment_coord_conventions -#define GL_ARB_fragment_coord_conventions 1 -#endif - -#ifndef GL_ARB_provoking_vertex -#define GL_ARB_provoking_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProvokingVertex (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); -#endif - -#ifndef GL_ARB_seamless_cube_map -#define GL_ARB_seamless_cube_map 1 -#endif - -#ifndef GL_ARB_sync -#define GL_ARB_sync 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GLAPI GLboolean APIENTRY glIsSync (GLsync sync); -GLAPI void APIENTRY glDeleteSync (GLsync sync); -GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); -typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif - -#ifndef GL_ARB_texture_multisample -#define GL_ARB_texture_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); -#endif - -#ifndef GL_ARB_vertex_array_bgra -#define GL_ARB_vertex_array_bgra 1 -#endif - -#ifndef GL_ARB_draw_buffers_blend -#define GL_ARB_draw_buffers_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif - -#ifndef GL_ARB_sample_shading -#define GL_ARB_sample_shading 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShadingARB (GLclampf value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value); -#endif - -#ifndef GL_ARB_texture_cube_map_array -#define GL_ARB_texture_cube_map_array 1 -#endif - -#ifndef GL_ARB_texture_gather -#define GL_ARB_texture_gather 1 -#endif - -#ifndef GL_ARB_texture_query_lod -#define GL_ARB_texture_query_lod 1 -#endif - -#ifndef GL_ARB_shading_language_include -#define GL_ARB_shading_language_include 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); -GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); -typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif - -#ifndef GL_ARB_texture_compression_bptc -#define GL_ARB_texture_compression_bptc 1 -#endif - -#ifndef GL_ARB_blend_func_extended -#define GL_ARB_blend_func_extended 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); -#endif - -#ifndef GL_ARB_explicit_attrib_location -#define GL_ARB_explicit_attrib_location 1 -#endif - -#ifndef GL_ARB_occlusion_query2 -#define GL_ARB_occlusion_query2 1 -#endif - -#ifndef GL_ARB_sampler_objects -#define GL_ARB_sampler_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); -GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); -GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_texture_rgb10_a2ui -#define GL_ARB_texture_rgb10_a2ui 1 -#endif - -#ifndef GL_ARB_texture_swizzle -#define GL_ARB_texture_swizzle 1 -#endif - -#ifndef GL_ARB_timer_query -#define GL_ARB_timer_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); -GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); -#endif - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -#define GL_ARB_vertex_type_2_10_10_10_rev 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#endif - -#ifndef GL_ARB_draw_indirect -#define GL_ARB_draw_indirect 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect); -GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect); -#endif - -#ifndef GL_ARB_gpu_shader5 -#define GL_ARB_gpu_shader5 1 -#endif - -#ifndef GL_ARB_gpu_shader_fp64 -#define GL_ARB_gpu_shader_fp64 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); -GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); -#endif - -#ifndef GL_ARB_shader_subroutine -#define GL_ARB_shader_subroutine 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); -GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); -GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); -typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -#endif - -#ifndef GL_ARB_tessellation_shader -#define GL_ARB_tessellation_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); -GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); -#endif - -#ifndef GL_ARB_texture_buffer_object_rgb32 -#define GL_ARB_texture_buffer_object_rgb32 1 -#endif - -#ifndef GL_ARB_transform_feedback2 -#define GL_ARB_transform_feedback2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedback (void); -GLAPI void APIENTRY glResumeTransformFeedback (void); -GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); -#endif - -#ifndef GL_ARB_transform_feedback3 -#define GL_ARB_transform_feedback3 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); -GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); -GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); -GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); -typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif - -#ifndef GL_ARB_ES2_compatibility -#define GL_ARB_ES2_compatibility 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI void APIENTRY glDepthRangef (GLclampf n, GLclampf f); -GLAPI void APIENTRY glClearDepthf (GLclampf d); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f); -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLclampf d); -#endif - -#ifndef GL_ARB_get_program_binary -#define GL_ARB_get_program_binary 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); -GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); -#endif - -#ifndef GL_ARB_separate_shader_objects -#define GL_ARB_separate_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); -GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* *strings); -GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); -GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); -GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); -GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); -GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* *strings); -typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); -typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif - -#ifndef GL_ARB_vertex_attrib_64bit -#define GL_ARB_vertex_attrib_64bit 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); -#endif - -#ifndef GL_ARB_viewport_array -#define GL_ARB_viewport_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); -GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); -GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLclampd *v); -GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLclampd n, GLclampd f); -GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f); -typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); -#endif - -#ifndef GL_ARB_cl_event -#define GL_ARB_cl_event 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); -#endif - -#ifndef GL_ARB_debug_output -#define GL_ARB_debug_output 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#endif - -#ifndef GL_ARB_robustness -#define GL_ARB_robustness 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); -GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); -GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); -GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); -GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); -GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); -GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); -GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); -GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); -GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); -GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); -GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); -GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); -typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); -typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); -typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); -typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); -typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); -typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); -typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); -typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); -typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); -typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); -typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#endif - -#ifndef GL_ARB_shader_stencil_export -#define GL_ARB_shader_stencil_export 1 -#endif - -#ifndef GL_EXT_abgr -#define GL_EXT_abgr 1 -#endif - -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_EXT_polygon_offset 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); -#endif - -#ifndef GL_EXT_texture -#define GL_EXT_texture 1 -#endif - -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_SGIS_texture_filter4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights); -GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); -typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif - -#ifndef GL_EXT_subtexture -#define GL_EXT_subtexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_EXT_copy_texture -#define GL_EXT_copy_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_histogram -#define GL_EXT_histogram 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink); -GLAPI void APIENTRY glResetHistogramEXT (GLenum target); -GLAPI void APIENTRY glResetMinmaxEXT (GLenum target); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); -#endif - -#ifndef GL_EXT_convolution -#define GL_EXT_convolution 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params); -GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params); -GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *image); -GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -#endif - -#ifndef GL_SGI_color_matrix -#define GL_SGI_color_matrix 1 -#endif - -#ifndef GL_SGI_color_table -#define GL_SGI_color_table 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, GLvoid *table); -GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_SGIX_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_SGIS_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param); -GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params); -GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params); -GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIS_texture4D -#define GL_SGIS_texture4D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_SGI_texture_color_table 1 -#endif - -#ifndef GL_EXT_cmyka -#define GL_EXT_cmyka 1 -#endif - -#ifndef GL_EXT_texture_object -#define GL_EXT_texture_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences); -GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture); -GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures); -GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures); -GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture); -GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_SGIS_detail_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_SGIS_sharpen_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_EXT_packed_pixels 1 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_SGIS_texture_lod 1 -#endif - -#ifndef GL_SGIS_multisample -#define GL_SGIS_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert); -GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_EXT_rescale_normal 1 -#endif - -#ifndef GL_EXT_vertex_array -#define GL_EXT_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glArrayElementEXT (GLint i); -GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer); -GLAPI void APIENTRY glGetPointervEXT (GLenum pname, GLvoid* *params); -GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); -typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_misc_attribute -#define GL_EXT_misc_attribute 1 -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_SGIX_clipmap 1 -#endif - -#ifndef GL_SGIX_shadow -#define GL_SGIX_shadow 1 -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_SGIS_texture_edge_clamp 1 -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_SGIS_texture_border_clamp 1 -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationEXT (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#endif - -#ifndef GL_EXT_blend_logic_op -#define GL_EXT_blend_logic_op 1 -#endif - -#ifndef GL_SGIX_interlace -#define GL_SGIX_interlace 1 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_SGIX_pixel_tiles 1 -#endif - -#ifndef GL_SGIX_texture_select -#define GL_SGIX_texture_select 1 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SGIX_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param); -GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param); -GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_SGIX_texture_multi_buffer 1 -#endif - -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_SGIS_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIX_instruments -#define GL_SGIX_instruments 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); -GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer); -GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p); -GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker); -GLAPI void APIENTRY glStartInstrumentsSGIX (void); -GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); -typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); -typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); -typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_SGIX_texture_scale_bias 1 -#endif - -#ifndef GL_SGIX_framezoom -#define GL_SGIX_framezoom 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameZoomSGIX (GLint factor); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#define GL_SGIX_tag_sample_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTagSampleBufferSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_SGIX_polynomial_ffd 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -GLAPI void APIENTRY glDeformSGIX (GLbitfield mask); -GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_SGIX_reference_plane 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); -#endif - -#ifndef GL_SGIX_flush_raster -#define GL_SGIX_flush_raster 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushRasterSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_SGIX_depth_texture 1 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_SGIS_fog_function 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points); -GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_SGIX_fog_offset 1 -#endif - -#ifndef GL_HP_image_transform -#define GL_HP_image_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_HP_convolution_border_modes 1 -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_SGIX_texture_add_env 1 -#endif - -#ifndef GL_EXT_color_subtable -#define GL_EXT_color_subtable 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_PGI_vertex_hints 1 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, GLvoid *data); -GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_EXT_clip_volume_hint 1 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_SGIX_list_priority 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params); -GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param); -GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param); -GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_SGIX_ir_instrument1 1 -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_SGIX_calligraphic_fragment 1 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_SGIX_texture_lod_bias 1 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SGIX_shadow_ambient 1 -#endif - -#ifndef GL_EXT_index_texture -#define GL_EXT_index_texture 1 -#endif - -#ifndef GL_EXT_index_material -#define GL_EXT_index_material 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_EXT_index_func -#define GL_EXT_index_func 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_EXT_index_array_formats 1 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_EXT_compiled_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count); -GLAPI void APIENTRY glUnlockArraysEXT (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_EXT_cull_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params); -GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_SGIX_ycrcb 1 -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_SGIX_fragment_lighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode); -GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params); -GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params); -GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param); -GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param); -GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params); -GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params); -GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_IBM_rasterpos_clip 1 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_HP_texture_lighting 1 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_EXT_draw_range_elements 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -#endif - -#ifndef GL_WIN_phong_shading -#define GL_WIN_phong_shading 1 -#endif - -#ifndef GL_WIN_specular_fog -#define GL_WIN_specular_fog 1 -#endif - -#ifndef GL_EXT_light_texture -#define GL_EXT_light_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyTextureEXT (GLenum mode); -GLAPI void APIENTRY glTextureLightEXT (GLenum pname); -GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_SGIX_blend_alpha_minmax 1 -#endif - -#ifndef GL_EXT_bgra -#define GL_EXT_bgra 1 -#endif - -#ifndef GL_SGIX_async -#define GL_SGIX_async 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker); -GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp); -GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp); -GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range); -GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range); -GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); -typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); -typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); -typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_SGIX_async_pixel 1 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_SGIX_async_histogram 1 -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_INTEL_parallel_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); -GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const GLvoid* *pointer); -GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); -GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -#endif - -#ifndef GL_HP_occlusion_test -#define GL_HP_occlusion_test 1 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_EXT_pixel_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#define GL_EXT_pixel_transform_color_table 1 -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_EXT_shared_texture_palette 1 -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_EXT_separate_specular_color 1 -#endif - -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue); -GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue); -GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue); -GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue); -GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v); -GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue); -GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v); -GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue); -GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v); -GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue); -GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v); -GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue); -GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v); -GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_EXT_texture_perturb_normal 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord); -GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord); -GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord); -GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord); -GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_REND_screen_coordinates 1 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_EXT_coordinate_frame 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz); -GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz); -GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz); -GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz); -GLAPI void APIENTRY glTangent3ivEXT (const GLint *v); -GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz); -GLAPI void APIENTRY glTangent3svEXT (const GLshort *v); -GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz); -GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v); -GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz); -GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v); -GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz); -GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v); -GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz); -GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v); -GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz); -GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v); -GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); -typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); -typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); -typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); -typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); -typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); -typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); -typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); -typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); -typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); -typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_APPLE_specular_vector 1 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_APPLE_transform_hint 1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_SGIX_fog_scale 1 -#endif - -#ifndef GL_SUNX_constant_data -#define GL_SUNX_constant_data 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFinishTextureSUNX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); -#endif - -#ifndef GL_SUN_global_alpha -#define GL_SUN_global_alpha 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor); -GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor); -GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor); -GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor); -GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor); -GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor); -GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor); -GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); -#endif - -#ifndef GL_SUN_triangle_list -#define GL_SUN_triangle_list 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code); -GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code); -GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code); -GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code); -GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code); -GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code); -GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const GLvoid* *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); -#endif - -#ifndef GL_SUN_vertex -#define GL_SUN_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_blend_func_separate -#define GL_INGR_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_color_clamp -#define GL_INGR_color_clamp 1 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INGR_interlace_read 1 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_EXT_422_pixels 1 -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_SUN_convolution_border_modes 1 -#endif - -#ifndef GL_EXT_texture_env_add -#define GL_EXT_texture_env_add 1 -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_EXT_vertex_weighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); -GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_NV_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); -GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const GLvoid *pointer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); -#endif - -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param); -GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params); -GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param); -GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); -#endif - -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_NV_texgen_emboss 1 -#endif - -#ifndef GL_NV_blend_square -#define GL_NV_blend_square 1 -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#endif - -#ifndef GL_MESA_resize_buffers -#define GL_MESA_resize_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glResizeBuffersMESA (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); -#endif - -#ifndef GL_MESA_window_pos -#define GL_MESA_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y); -GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y); -GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y); -GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y); -GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v); -GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z); -GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v); -GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v); -GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v); -GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v); -GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_IBM_cull_vertex 1 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#define GL_IBM_multimode_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_IBM_vertex_array_lists 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean* *pointer, GLint ptrstride); -GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -#endif - -#ifndef GL_SGIX_subsample -#define GL_SGIX_subsample 1 -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_SGIX_ycrcba 1 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#define GL_SGIX_ycrcb_subsample 1 -#endif - -#ifndef GL_SGIX_depth_pass_instrument -#define GL_SGIX_depth_pass_instrument 1 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_3DFX_texture_compression_FXT1 1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_3DFX_multisample 1 -#endif - -#ifndef GL_3DFX_tbuffer -#define GL_3DFX_tbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); -#endif - -#ifndef GL_EXT_multisample -#define GL_EXT_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert); -GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_SGIX_vertex_preclip 1 -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_SGIX_convolution_accuracy 1 -#endif - -#ifndef GL_SGIX_resample -#define GL_SGIX_resample 1 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_SGIS_point_line_texgen 1 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_SGIS_texture_color_mask 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif - -#ifndef GL_SGIX_igloo_interface -#define GL_SGIX_igloo_interface 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const GLvoid *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#endif - -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); -GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); -GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence); -GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence); -GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); -GLAPI void APIENTRY glFinishFenceNV (GLuint fence); -GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -#ifndef GL_NV_evaluators -#define GL_NV_evaluators 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); -GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); -GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); -typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_NV_packed_depth_stencil 1 -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_NV_texture_compression_vtc -#define GL_NV_texture_compression_vtc 1 -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_NV_texture_rectangle 1 -#endif - -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_NV_vertex_array_range2 1 -#endif - -#ifndef GL_NV_vertex_program -#define GL_NV_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences); -GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params); -GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs); -GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program); -GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, GLvoid* *pointer); -GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id); -GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); -GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLuint count, const GLdouble *v); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLuint count, const GLfloat *v); -GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); -GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); -GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v); -GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); -typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); -typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); -typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_SGIX_texture_coordinate_clamp 1 -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SGIX_scalebias_hint 1 -#endif - -#ifndef GL_OML_interlace -#define GL_OML_interlace 1 -#endif - -#ifndef GL_OML_subsample -#define GL_OML_subsample 1 -#endif - -#ifndef GL_OML_resample -#define GL_OML_resample 1 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_NV_copy_depth_to_color 1 -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_ATI_envmap_bumpmap 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param); -GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param); -GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range); -GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id); -GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id); -GLAPI void APIENTRY glBeginFragmentShaderATI (void); -GLAPI void APIENTRY glEndFragmentShaderATI (void); -GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle); -GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle); -GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); -typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); -typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_ATI_pn_triangles 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param); -GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_ATI_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const GLvoid *pointer, GLenum usage); -GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); -GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params); -GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); -typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_EXT_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVertexShaderEXT (void); -GLAPI void APIENTRY glEndVertexShaderEXT (void); -GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id); -GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range); -GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id); -GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1); -GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num); -GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num); -GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const GLvoid *addr); -GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const GLvoid *addr); -GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr); -GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr); -GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr); -GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr); -GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr); -GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr); -GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr); -GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr); -GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); -GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id); -GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id); -GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value); -GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value); -GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value); -GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value); -GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value); -GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap); -GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, GLvoid* *data); -GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); -GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data); -GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); -typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); -typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); -typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); -typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); -typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); -typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); -typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); -typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); -typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); -typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); -typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); -typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); -typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); -typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_ATI_vertex_streams 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x); -GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x); -GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x); -GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x); -GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y); -GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords); -GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords); -GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz); -GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords); -GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords); -GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords); -GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream); -GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param); -GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_element_array -#define GL_ATI_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerATI (GLenum type, const GLvoid *pointer); -GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count); -GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif - -#ifndef GL_SUN_mesh_array -#define GL_SUN_mesh_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SUN_slice_accum 1 -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_NV_multisample_filter_hint 1 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#endif - -#ifndef GL_NV_occlusion_query -#define GL_NV_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id); -GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id); -GLAPI void APIENTRY glEndOcclusionQueryNV (void); -GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_NV_texture_shader3 1 -#endif - -#ifndef GL_NV_vertex_program1_1 -#define GL_NV_vertex_program1_1 1 -#endif - -#ifndef GL_EXT_shadow_funcs -#define GL_EXT_shadow_funcs 1 -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_ATI_text_fragment_shader 1 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#endif - -#ifndef GL_APPLE_element_array -#define GL_APPLE_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const GLvoid *pointer); -GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif - -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences); -GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences); -GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence); -GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence); -GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name); -GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); -typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); -typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_APPLE_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array); -GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_APPLE_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer); -GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer); -GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#endif - -#ifndef GL_S3_s3tc -#define GL_S3_s3tc 1 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_ATI_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_ATI_pixel_format_float 1 -/* This is really a WGL extension, but defines some associated GL enums. - * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. - */ -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#endif - -#ifndef GL_ATI_texture_float -#define GL_ATI_texture_float 1 -#endif - -#ifndef GL_NV_float_buffer -#define GL_NV_float_buffer 1 -#endif - -#ifndef GL_NV_fragment_program -#define GL_NV_fragment_program 1 -/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif - -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y); -GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z); -GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s); -GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t); -GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r); -GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s); -GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t); -GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v); -GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog); -GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog); -GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v); -GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight); -GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight); -GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x); -GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y); -GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); -typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); -typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_NV_pixel_data_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer); -GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); -#endif - -#ifndef GL_NV_primitive_restart -#define GL_NV_primitive_restart 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveRestartNV (void); -GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_NV_texture_expand_normal 1 -#endif - -#ifndef GL_NV_vertex_program2 -#define GL_NV_vertex_program2 1 -#endif - -#ifndef GL_ATI_map_object_buffer -#define GL_ATI_map_object_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint buffer); -GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#define GL_ATI_vertex_attrib_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); -#endif - -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_EXT_texture_mirror_clamp 1 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_EXT_blend_equation_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); -#endif - -#ifndef GL_MESA_pack_invert -#define GL_MESA_pack_invert 1 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_MESA_ycbcr_texture 1 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_EXT_pixel_buffer_object 1 -#endif - -#ifndef GL_NV_fragment_program_option -#define GL_NV_fragment_program_option 1 -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_NV_fragment_program2 1 -#endif - -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#endif - -#ifndef GL_NV_vertex_program3 -#define GL_NV_vertex_program3 1 -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); -#endif - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const GLvoid *string); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); -#endif - -#ifndef GL_EXT_packed_depth_stencil -#define GL_EXT_packed_depth_stencil 1 -#endif - -#ifndef GL_EXT_stencil_clear_tag -#define GL_EXT_stencil_clear_tag 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); -#endif - -#ifndef GL_EXT_texture_sRGB -#define GL_EXT_texture_sRGB 1 -#endif - -#ifndef GL_EXT_framebuffer_blit -#define GL_EXT_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -#ifndef GL_EXT_framebuffer_multisample -#define GL_EXT_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_MESAX_texture_stack -#define GL_MESAX_texture_stack 1 -#endif - -#ifndef GL_EXT_timer_query -#define GL_EXT_timer_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64EXT *params); -GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64EXT *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); -#endif - -#ifndef GL_EXT_gpu_program_parameters -#define GL_EXT_gpu_program_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -#endif - -#ifndef GL_APPLE_flush_buffer_range -#define GL_APPLE_flush_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); -#endif - -#ifndef GL_NV_gpu_program4 -#define GL_NV_gpu_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params); -GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -#endif - -#ifndef GL_NV_geometry_program4 -#define GL_NV_geometry_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); -GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif - -#ifndef GL_EXT_geometry_shader4 -#define GL_EXT_geometry_shader4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -#endif - -#ifndef GL_NV_vertex_program4 -#define GL_NV_vertex_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); -#endif - -#ifndef GL_EXT_gpu_shader4 -#define GL_EXT_gpu_shader4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -#endif - -#ifndef GL_EXT_draw_instanced -#define GL_EXT_draw_instanced 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_packed_float -#define GL_EXT_packed_float 1 -#endif - -#ifndef GL_EXT_texture_array -#define GL_EXT_texture_array 1 -#endif - -#ifndef GL_EXT_texture_buffer_object -#define GL_EXT_texture_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); -#endif - -#ifndef GL_EXT_texture_compression_latc -#define GL_EXT_texture_compression_latc 1 -#endif - -#ifndef GL_EXT_texture_compression_rgtc -#define GL_EXT_texture_compression_rgtc 1 -#endif - -#ifndef GL_EXT_texture_shared_exponent -#define GL_EXT_texture_shared_exponent 1 -#endif - -#ifndef GL_NV_depth_buffer_float -#define GL_NV_depth_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); -GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); -typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); -#endif - -#ifndef GL_NV_fragment_program4 -#define GL_NV_fragment_program4 1 -#endif - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_NV_framebuffer_multisample_coverage 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_framebuffer_sRGB -#define GL_EXT_framebuffer_sRGB 1 -#endif - -#ifndef GL_NV_geometry_shader4 -#define GL_NV_geometry_shader4 1 -#endif - -#ifndef GL_NV_parameter_buffer_object -#define GL_NV_parameter_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); -#endif - -#ifndef GL_EXT_draw_buffers2 -#define GL_EXT_draw_buffers2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index); -GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); -#endif - -#ifndef GL_NV_transform_feedback -#define GL_NV_transform_feedback 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); -GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); -GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); -GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); -#endif - -#ifndef GL_EXT_bindable_uniform -#define GL_EXT_bindable_uniform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer); -GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location); -GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); -typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); -typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); -#endif - -#ifndef GL_EXT_texture_integer -#define GL_EXT_texture_integer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha); -GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); -typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); -#endif - -#ifndef GL_GREMEDY_frame_terminator -#define GL_GREMEDY_frame_terminator 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); -#endif - -#ifndef GL_NV_conditional_render -#define GL_NV_conditional_render 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRenderNV (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); -#endif - -#ifndef GL_NV_present_video -#define GL_NV_present_video 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); -GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); -GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params); -GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params); -GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); -typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); -typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); -#endif - -#ifndef GL_EXT_transform_feedback -#define GL_EXT_transform_feedback 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedbackEXT (void); -GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -#endif - -#ifndef GL_EXT_direct_state_access -#define GL_EXT_direct_state_access 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask); -GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask); -GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode); -GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI void APIENTRY glMatrixPopEXT (GLenum mode); -GLAPI void APIENTRY glMatrixPushEXT (GLenum mode); -GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); -GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); -GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture); -GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index); -GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); -GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); -GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); -GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param); -GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); -GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data); -GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, GLvoid* *data); -GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, GLvoid *img); -GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); -GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, GLvoid *img); -GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string); -GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params); -GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params); -GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, GLvoid *string); -GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); -GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params); -GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); -GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params); -GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params); -GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params); -GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); -GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); -GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); -GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); -GLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params); -GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); -GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params); -GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target); -GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target); -GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target); -GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode); -GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode); -GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); -GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); -GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); -typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); -typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); -typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); -typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); -typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); -typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); -typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); -typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); -typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); -typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -#endif - -#ifndef GL_EXT_vertex_array_bgra -#define GL_EXT_vertex_array_bgra 1 -#endif - -#ifndef GL_EXT_texture_swizzle -#define GL_EXT_texture_swizzle 1 -#endif - -#ifndef GL_NV_explicit_multisample -#define GL_NV_explicit_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask); -GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); -typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); -#endif - -#ifndef GL_NV_transform_feedback2 -#define GL_NV_transform_feedback2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedbackNV (void); -GLAPI void APIENTRY glResumeTransformFeedbackNV (void); -GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); -#endif - -#ifndef GL_ATI_meminfo -#define GL_ATI_meminfo 1 -#endif - -#ifndef GL_AMD_performance_monitor -#define GL_AMD_performance_monitor 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); -GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); -GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor); -GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor); -GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); -typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif - -#ifndef GL_AMD_texture_texture4 -#define GL_AMD_texture_texture4 1 -#endif - -#ifndef GL_AMD_vertex_shader_tesselator -#define GL_AMD_vertex_shader_tesselator 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor); -GLAPI void APIENTRY glTessellationModeAMD (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_provoking_vertex -#define GL_EXT_provoking_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_texture_snorm -#define GL_EXT_texture_snorm 1 -#endif - -#ifndef GL_AMD_draw_buffers_blend -#define GL_AMD_draw_buffers_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -#endif - -#ifndef GL_APPLE_texture_range -#define GL_APPLE_texture_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const GLvoid *pointer); -GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, GLvoid* *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_APPLE_float_pixels -#define GL_APPLE_float_pixels 1 -#endif - -#ifndef GL_APPLE_vertex_program_evaluators -#define GL_APPLE_vertex_program_evaluators 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname); -GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname); -GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname); -GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); -typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -#endif - -#ifndef GL_APPLE_aux_depth_stencil -#define GL_APPLE_aux_depth_stencil 1 -#endif - -#ifndef GL_APPLE_object_purgeable -#define GL_APPLE_object_purgeable 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); -GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); -GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); -typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); -#endif - -#ifndef GL_APPLE_row_bytes -#define GL_APPLE_row_bytes 1 -#endif - -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#endif - -#ifndef GL_NV_video_capture -#define GL_NV_video_capture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); -GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); -GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); -GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); -GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); -GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); -GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); -GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); -typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); -typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); -typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); -#endif - -#ifndef GL_NV_copy_image -#define GL_NV_copy_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif - -#ifndef GL_EXT_separate_shader_objects -#define GL_EXT_separate_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program); -GLAPI void APIENTRY glActiveProgramEXT (GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); -typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string); -#endif - -#ifndef GL_NV_parameter_buffer_object2 -#define GL_NV_parameter_buffer_object2 1 -#endif - -#ifndef GL_NV_shader_buffer_load -#define GL_NV_shader_buffer_load 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access); -GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target); -GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target); -GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access); -GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer); -GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer); -GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); -GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); -GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); -GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); -GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); -typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); -typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); -typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); -typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); -typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); -typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); -typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif - -#ifndef GL_NV_vertex_buffer_unified_memory -#define GL_NV_vertex_buffer_unified_memory 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); -GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride); -GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); -GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); -GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); -typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); -typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); -#endif - -#ifndef GL_NV_texture_barrier -#define GL_NV_texture_barrier 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureBarrierNV (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); -#endif - -#ifndef GL_AMD_shader_stencil_export -#define GL_AMD_shader_stencil_export 1 -#endif - -#ifndef GL_AMD_seamless_cubemap_per_texture -#define GL_AMD_seamless_cubemap_per_texture 1 -#endif - -#ifndef GL_AMD_conservative_depth -#define GL_AMD_conservative_depth 1 -#endif - -#ifndef GL_EXT_shader_image_load_store -#define GL_EXT_shader_image_load_store 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); -GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); -typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); -#endif - -#ifndef GL_EXT_vertex_attrib_64bit -#define GL_EXT_vertex_attrib_64bit 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -#endif - -#ifndef GL_NV_gpu_program5 -#define GL_NV_gpu_program5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); -GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); -#endif - -#ifndef GL_NV_gpu_shader5 -#define GL_NV_gpu_shader5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); -GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); -GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); -GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); -GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); -GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif - -#ifndef GL_NV_shader_buffer_store -#define GL_NV_shader_buffer_store 1 -#endif - -#ifndef GL_NV_tessellation_program5 -#define GL_NV_tessellation_program5 1 -#endif - -#ifndef GL_NV_vertex_attrib_integer_64bit -#define GL_NV_vertex_attrib_integer_64bit 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); -GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); -GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); -GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); -GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); -GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); -GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); -#endif - -#ifndef GL_NV_multisample_coverage -#define GL_NV_multisample_coverage 1 -#endif - -#ifndef GL_AMD_name_gen_delete -#define GL_AMD_name_gen_delete 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); -GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); -GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); -typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); -typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); -#endif - -#ifndef GL_AMD_debug_output -#define GL_AMD_debug_output 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); -#endif - -#ifndef GL_NV_vdpau_interop -#define GL_NV_vdpau_interop 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress); -GLAPI void APIENTRY glVDPAUFiniNV (void); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); -GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); -GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress); -typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); -typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); -typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); -#endif - -#ifndef GL_AMD_transform_feedback3_lines_triangles -#define GL_AMD_transform_feedback3_lines_triangles 1 -#endif - - -#ifdef __cplusplus -} -#endif - -#endif -#endif /* NO_SDL_GLEXT */ - -#endif /* !__IPHONEOS__ */ - -#endif /* _SDL_opengl_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_opengles.h b/Source/3rdParty/sdl/include/SDL_opengles.h deleted file mode 100644 index d88e1573f..000000000 --- a/Source/3rdParty/sdl/include/SDL_opengles.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_opengles.h - * - * This is a simple file to encapsulate the OpenGL ES 1.X API headers. - */ - -#ifdef __IPHONEOS__ -#include -#include -#else -#include -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif diff --git a/Source/3rdParty/sdl/include/SDL_opengles2.h b/Source/3rdParty/sdl/include/SDL_opengles2.h deleted file mode 100644 index 2c0547923..000000000 --- a/Source/3rdParty/sdl/include/SDL_opengles2.h +++ /dev/null @@ -1,2790 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_opengles.h - * - * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. - */ -#ifndef _MSC_VER -#ifdef __IPHONEOS__ -#include -#include -#else -#include -#include -#endif - -#else /* _MSC_VER */ - -/* OpenGL ES2 headers for Visual Studio */ - -#ifndef __khrplatform_h_ -#define __khrplatform_h_ - -/* -** Copyright (c) 2008-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Khronos platform-specific types and definitions. -* -* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ -* -* Adopters may modify this file to suit their platform. Adopters are -* encouraged to submit platform specific modifications to the Khronos -* group so that they can be included in future versions of this file. -* Please submit changes by sending them to the public Khronos Bugzilla -* (http://khronos.org/bugzilla) by filing a bug against product -* "Khronos (general)" component "Registry". -* -* A predefined template which fills in some of the bug fields can be -* reached using http://tinyurl.com/khrplatform-h-bugreport, but you -* must create a Bugzilla login first. -* -* -* See the Implementer's Guidelines for information about where this file -* should be located on your system and for more details of its use: -* http://www.khronos.org/registry/implementers_guide.pdf -* -* This file should be included as -* #include -* by Khronos client API header files that use its types and defines. -* -* The types in khrplatform.h should only be used to define API-specific types. -* -* Types defined in khrplatform.h: -* khronos_int8_t signed 8 bit -* khronos_uint8_t unsigned 8 bit -* khronos_int16_t signed 16 bit -* khronos_uint16_t unsigned 16 bit -* khronos_int32_t signed 32 bit -* khronos_uint32_t unsigned 32 bit -* khronos_int64_t signed 64 bit -* khronos_uint64_t unsigned 64 bit -* khronos_intptr_t signed same number of bits as a pointer -* khronos_uintptr_t unsigned same number of bits as a pointer -* khronos_ssize_t signed size -* khronos_usize_t unsigned size -* khronos_float_t signed 32 bit floating point -* khronos_time_ns_t unsigned 64 bit time in nanoseconds -* khronos_utime_nanoseconds_t unsigned time interval or absolute time in -* nanoseconds -* khronos_stime_nanoseconds_t signed time interval in nanoseconds -* khronos_boolean_enum_t enumerated boolean type. This should -* only be used as a base type when a client API's boolean type is -* an enum. Client APIs which use an integer or other type for -* booleans cannot use this as the base type for their boolean. -* -* Tokens defined in khrplatform.h: -* -* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. -* -* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. -* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. -* -* Calling convention macros defined in this file: -* KHRONOS_APICALL -* KHRONOS_APIENTRY -* KHRONOS_APIATTRIBUTES -* -* These may be used in function prototypes as: -* -* KHRONOS_APICALL void KHRONOS_APIENTRY funcname( -* int arg1, -* int arg2) KHRONOS_APIATTRIBUTES; -*/ - -/*------------------------------------------------------------------------- -* Definition of KHRONOS_APICALL -*------------------------------------------------------------------------- -* This precedes the return type of the function in the function prototype. -*/ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) -# define KHRONOS_APICALL __declspec(dllimport) -#elif defined (__SYMBIAN32__) -# define KHRONOS_APICALL IMPORT_C -#else -# define KHRONOS_APICALL -#endif - -/*------------------------------------------------------------------------- -* Definition of KHRONOS_APIENTRY -*------------------------------------------------------------------------- -* This follows the return type of the function and precedes the function -* name in the function prototype. -*/ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) -/* Win32 but not WinCE */ -# define KHRONOS_APIENTRY __stdcall -#else -# define KHRONOS_APIENTRY -#endif - -/*------------------------------------------------------------------------- -* Definition of KHRONOS_APIATTRIBUTES -*------------------------------------------------------------------------- -* This follows the closing parenthesis of the function prototype arguments. -*/ -#if defined (__ARMCC_2__) -#define KHRONOS_APIATTRIBUTES __softfp -#else -#define KHRONOS_APIATTRIBUTES -#endif - -/*------------------------------------------------------------------------- -* basic type definitions -*-----------------------------------------------------------------------*/ -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) - - -/* -* Using -*/ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__VMS ) || defined(__sgi) - -/* -* Using -*/ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) - -/* -* Win32 -*/ -typedef __int32 khronos_int32_t; -typedef unsigned __int32 khronos_uint32_t; -typedef __int64 khronos_int64_t; -typedef unsigned __int64 khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__sun__) || defined(__digital__) - -/* -* Sun or Digital -*/ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#if defined(__arch64__) || defined(_LP64) -typedef long int khronos_int64_t; -typedef unsigned long int khronos_uint64_t; -#else -typedef long long int khronos_int64_t; -typedef unsigned long long int khronos_uint64_t; -#endif /* __arch64__ */ -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif 0 - -/* -* Hypothetical platform with no float or int64 support -*/ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#define KHRONOS_SUPPORT_INT64 0 -#define KHRONOS_SUPPORT_FLOAT 0 - -#else - -/* -* Generic fallback -*/ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#endif - - -/* -* Types that are (so far) the same on all platforms -*/ -typedef signed char khronos_int8_t; -typedef unsigned char khronos_uint8_t; -typedef signed short int khronos_int16_t; -typedef unsigned short int khronos_uint16_t; - -/* -* Types that differ between LLP64 and LP64 architectures - in LLP64, -* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears -* to be the only LLP64 architecture in current use. -*/ -#ifdef _WIN64 -typedef signed long long int khronos_intptr_t; -typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; -#else -typedef signed long int khronos_intptr_t; -typedef unsigned long int khronos_uintptr_t; -typedef signed long int khronos_ssize_t; -typedef unsigned long int khronos_usize_t; -#endif - -#if KHRONOS_SUPPORT_FLOAT -/* -* Float type -*/ -typedef float khronos_float_t; -#endif - -#if KHRONOS_SUPPORT_INT64 -/* Time types -* -* These types can be used to represent a time interval in nanoseconds or -* an absolute Unadjusted System Time. Unadjusted System Time is the number -* of nanoseconds since some arbitrary system event (e.g. since the last -* time the system booted). The Unadjusted System Time is an unsigned -* 64 bit value that wraps back to 0 every 584 years. Time intervals -* may be either signed or unsigned. -*/ -typedef khronos_uint64_t khronos_utime_nanoseconds_t; -typedef khronos_int64_t khronos_stime_nanoseconds_t; -#endif - -/* -* Dummy value used to pad enum types to 32 bits. -*/ -#ifndef KHRONOS_MAX_ENUM -#define KHRONOS_MAX_ENUM 0x7FFFFFFF -#endif - -/* -* Enumerated boolean type -* -* Values other than zero should be considered to be true. Therefore -* comparisons should not be made against KHRONOS_TRUE. -*/ -typedef enum { - KHRONOS_FALSE = 0, - KHRONOS_TRUE = 1, - KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM -} khronos_boolean_enum_t; - -#endif /* __khrplatform_h_ */ - - -#ifndef __gl2platform_h_ -#define __gl2platform_h_ - -/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". - */ - -/*#include */ - -#ifndef GL_APICALL -#define GL_APICALL KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __gl2platform_h_ */ - -#ifndef __gl2_h_ -#define __gl2_h_ - -/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ - -/*#include */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/*------------------------------------------------------------------------- - * Data type definitions - *-----------------------------------------------------------------------*/ - -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; - -/* GL types for handling large vertex buffer objects */ -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; - -/* OpenGL ES core versions */ -#define GL_ES_VERSION_2_0 1 - -/* ClearBufferMask */ -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 - -/* Boolean */ -#define GL_FALSE 0 -#define GL_TRUE 1 - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 - -/* AlphaFunction (not supported in ES20) */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* BlendEquationSeparate */ -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ -#define GL_BLEND_EQUATION_ALPHA 0x883D - -/* BlendSubtract */ -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* Separate Blend Functions */ -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 - -/* Buffer Objects */ -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 - -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 - -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 - -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 - -/* CullFaceMode */ -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* EnableCap */ -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetPName */ -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -/* GL_SCISSOR_TEST */ -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -/* GL_POLYGON_OFFSET_FILL */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ - -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C - -/* PixelFormat */ -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelType */ -/* GL_UNSIGNED_BYTE */ -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 - -/* Shaders */ -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D - -/* StencilFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ -#define GL_TEXTURE 0x1702 - -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C - -/* TextureUnit */ -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 - -/* TextureWrapMode */ -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 - -/* Uniform Types */ -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 - -/* Vertex Arrays */ -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F - -/* Read Format */ -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B - -/* Shader Source */ -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA - -/* Shader Binary */ -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - -/* Shader Precision-Specified Types */ -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 - -/* Framebuffer Object. */ -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 - -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 - -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 - -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 - -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 - -#define GL_NONE 0 - -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD - -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 - -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 - -/*------------------------------------------------------------------------- - * GL core functions. - *-----------------------------------------------------------------------*/ - -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); -GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2_h_ */ - - -#ifndef __gl2ext_h_ -#define __gl2ext_h_ - -/* $Revision: 19436 $ on $Date:: 2012-10-10 10:37:04 -0700 #$ */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -#ifndef GL_APIENTRYP -# define GL_APIENTRYP GL_APIENTRY* -#endif - -/*------------------------------------------------------------------------* - * OES extension tokens - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_ETC1_RGB8_OES 0x8D64 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_DEPTH_COMPONENT24_OES 0x81A6 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#endif - -/* GL_OES_depth_texture */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -/* GLeglImageOES defined in GL_OES_EGL_image already. */ -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_UNSIGNED_INT 0x1405 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_ALPHA8_OES 0x803C -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -/* reuse GL_DEPTH_COMPONENT24_OES */ -/* reuse GL_DEPTH24_STENCIL8_OES */ -/* reuse GL_DEPTH_COMPONENT32_OES */ -#define GL_LUMINANCE4_ALPHA4_OES 0x8043 -#define GL_LUMINANCE8_ALPHA8_OES 0x8045 -#define GL_LUMINANCE8_OES 0x8040 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -/* reuse GL_RGB8_OES */ -/* reuse GL_RGBA8_OES */ -/* reuse GL_RGB10_EXT */ -/* reuse GL_RGB10_A2_EXT */ -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_STENCIL_INDEX1_OES 0x8D46 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_STENCIL_INDEX4_OES 0x8D47 -#endif - -#ifndef GL_OES_surfaceless_context -#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -#endif - -/* GL_OES_texture_float */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_HALF_FLOAT_OES 0x8D61 -#endif - -/* GL_OES_texture_half_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_npot */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -#endif - -/* GL_OES_vertex_half_float */ -/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 -#endif - -/*------------------------------------------------------------------------* - * KHR extension tokens - *------------------------------------------------------------------------*/ - -#ifndef GL_KHR_debug -typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 -#define GL_DEBUG_SOURCE_API 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION 0x824A -#define GL_DEBUG_SOURCE_OTHER 0x824B -#define GL_DEBUG_TYPE_ERROR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 -#define GL_DEBUG_TYPE_OTHER 0x8251 -#define GL_DEBUG_TYPE_MARKER 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D -#define GL_BUFFER 0x82E0 -#define GL_SHADER 0x82E1 -#define GL_PROGRAM 0x82E2 -#define GL_QUERY 0x82E3 -/* PROGRAM_PIPELINE only in GL */ -#define GL_SAMPLER 0x82E6 -/* DISPLAY_LIST only in GL */ -#define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 -#define GL_DEBUG_OUTPUT 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#endif - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif - -/*------------------------------------------------------------------------* - * AMD extension tokens - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#endif - -/* GL_AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_Z400_BINARY_AMD 0x8740 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -#endif - -/* GL_ANGLE_instanced_arrays */ -#ifndef GL_ANGLE_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 -#endif - -/* GL_ANGLE_translated_shader_source */ -#ifndef GL_ANGLE_translated_shader_source -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -#endif - -/*------------------------------------------------------------------------* - * APPLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_APPLE_copy_texture_levels */ -/* No new tokens introduced by this extension. */ - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -#endif - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync - -#ifndef __gl3_h_ -/* These types are defined with reference to - * in the Apple extension spec, but here we use the Khronos - * portable types in khrplatform.h, and assume those types - * are always defined. - * If any other extensions using these types are defined, - * the typedefs must move out of this block and be shared. - */ -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef struct __GLsync *GLsync; -#endif - -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D -#endif - -/*------------------------------------------------------------------------* - * ARM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_program_binary */ -#ifndef GL_ARM_mali_program_binary -#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 -#endif - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 -#endif - -/* GL_ARM_rgba8 */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * EXT extension tokens - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -#endif - -/* GL_EXT_debug_marker */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -#endif - -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -/* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multiview_draw_buffers -#define GL_COLOR_ATTACHMENT_EXT 0x90F0 -#define GL_MULTIVIEW_EXT 0x90F1 -#define GL_DRAW_BUFFER_EXT 0x0C01 -#define GL_READ_BUFFER_EXT 0x0C02 -#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 -#endif - -/* GL_EXT_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_BGRA_EXT 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -/* reuse GL_NO_ERROR */ -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_ACTIVE_PROGRAM_EXT 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -#endif - -/* GL_EXT_shader_framebuffer_fetch */ -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 -#endif - -/* GL_EXT_shader_texture_lod */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -/* reuse GL_RGBA16F_EXT */ -/* reuse GL_RGB16F_EXT */ -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGB10_EXT 0x8052 -#define GL_BGRA8_EXT 0x93A1 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -#define GL_R16F_EXT 0x822D -#define GL_RG16F_EXT 0x822F -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#endif - -/*------------------------------------------------------------------------* - * DMP extension tokens - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_SHADER_BINARY_DMP 0x9250 -#endif - -/*------------------------------------------------------------------------* - * FJ extension tokens - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ -#ifndef GL_FJ_shader_binary_GCCSO -#define GCCSO_SHADER_BINARY_FJ 0x9260 -#endif - -/*------------------------------------------------------------------------* - * IMG extension tokens - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_SGX_BINARY_IMG 0x8C0A -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -#endif - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -#endif - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF -/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_READ_BUFFER_NV 0x0C02 -#endif - -/* GL_NV_read_buffer_front */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_compression_s3tc_update */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_npot_2D_mipmap */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -#endif - -/* GL_QCOM_binning_control */ -#ifndef GL_QCOM_binning_control -#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 -#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 -#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 -#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 -#endif - -/* GL_QCOM_driver_control */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -#endif - -/* GL_QCOM_extended_get2 */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_SHADER_BINARY_VIV 0x8FC4 -#endif - -/*------------------------------------------------------------------------* - * End of extension tokens, start of corresponding extension functions - *------------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------* - * OES extension functions - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_OES_compressed_ETC1_RGB8_texture 1 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_OES_compressed_paletted_texture 1 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_OES_depth24 1 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_OES_depth32 1 -#endif - -/* GL_OES_depth_texture */ -#ifndef GL_OES_depth_texture -#define GL_OES_depth_texture 1 -#endif - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -#endif -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_OES_element_index_uint 1 -#endif - -/* GL_OES_fbo_render_mipmap */ -#ifndef GL_OES_fbo_render_mipmap -#define GL_OES_fbo_render_mipmap 1 -#endif - -/* GL_OES_fragment_precision_high */ -#ifndef GL_OES_fragment_precision_high -#define GL_OES_fragment_precision_high 1 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_OES_get_program_binary 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_OES_mapbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); -GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); -typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_OES_packed_depth_stencil 1 -#endif - -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_OES_required_internalformat 1 -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_OES_rgb8_rgba8 1 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_OES_standard_derivatives 1 -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_OES_stencil1 1 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_OES_stencil4 1 -#endif - -#ifndef GL_OES_surfaceless_context -#define GL_OES_surfaceless_context 1 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_OES_texture_3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif -typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif - -/* GL_OES_texture_float */ -#ifndef GL_OES_texture_float -#define GL_OES_texture_float 1 -#endif - -/* GL_OES_texture_float_linear */ -#ifndef GL_OES_texture_float_linear -#define GL_OES_texture_float_linear 1 -#endif - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_OES_texture_half_float 1 -#endif - -/* GL_OES_texture_half_float_linear */ -#ifndef GL_OES_texture_half_float_linear -#define GL_OES_texture_half_float_linear 1 -#endif - -/* GL_OES_texture_npot */ -#ifndef GL_OES_texture_npot -#define GL_OES_texture_npot 1 -#endif - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_OES_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); -#endif -typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); -typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); -typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); -#endif - -/* GL_OES_vertex_half_float */ -#ifndef GL_OES_vertex_half_float -#define GL_OES_vertex_half_float 1 -#endif - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_OES_vertex_type_10_10_10_2 1 -#endif - -/*------------------------------------------------------------------------* - * KHR extension functions - *------------------------------------------------------------------------*/ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GL_APICALL void GL_APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GL_APICALL void GL_APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); -GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GL_APICALL void GL_APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GL_APICALL void GL_APIENTRY glPopDebugGroup (void); -GL_APICALL void GL_APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glGetPointerv (GLenum pname, void **params); -#endif -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); -typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); -typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params); -#endif - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif - - -/*------------------------------------------------------------------------* - * AMD extension functions - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_AMD_compressed_3DC_texture 1 -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_AMD_compressed_ATC_texture 1 -#endif - -/* AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_AMD_performance_monitor 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_AMD_program_binary_Z400 1 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_ANGLE_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_ANGLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_ANGLE_instanced_arrays -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); -#endif -typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_ANGLE_pack_reverse_row_order 1 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_ANGLE_texture_compression_dxt3 1 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_ANGLE_texture_compression_dxt5 1 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_ANGLE_texture_usage 1 -#endif - -#ifndef GL_ANGLE_translated_shader_source -#define GL_ANGLE_translated_shader_source 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif -typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif - -/*------------------------------------------------------------------------* - * APPLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_APPLE_copy_texture_levels */ -#ifndef GL_APPLE_copy_texture_levels -#define GL_APPLE_copy_texture_levels 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif -typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_APPLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); -#endif - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#endif - -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync -#define GL_APPLE_sync 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif -typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); -typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); -typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_APPLE_texture_format_BGRA8888 1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_APPLE_texture_max_level 1 -#endif - -/*------------------------------------------------------------------------* - * ARM extension functions - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_program_binary */ -#ifndef GL_ARM_mali_program_binary -#define GL_ARM_mali_program_binary 1 -#endif - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_ARM_mali_shader_binary 1 -#endif - -/* GL_ARM_rgba8 */ -#ifndef GL_ARM_rgba8 -#define GL_ARM_rgba8 1 -#endif - -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_EXT_color_buffer_half_float 1 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_EXT_debug_label 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif - -/* GL_EXT_debug_marker */ -#ifndef GL_EXT_debug_marker -#define GL_EXT_debug_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); -#endif -typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#endif - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_EXT_discard_framebuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif -typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif - -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_EXT_map_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_EXT_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -/* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multiview_draw_buffers -#define GL_EXT_multiview_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); -GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); -GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); -#endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); -typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_EXT_occlusion_query_boolean 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); -#endif -typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); -typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); -typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); -typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_EXT_read_format_bgra 1 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -#define GL_EXT_robustness 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); -GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); -GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif -typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); -typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_EXT_separate_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); -GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); -GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); -GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); -GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); -GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif -typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); -typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif - -/* GL_EXT_shader_framebuffer_fetch */ -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_EXT_shader_framebuffer_fetch 1 -#endif - -/* GL_EXT_shader_texture_lod */ -#ifndef GL_EXT_shader_texture_lod -#define GL_EXT_shader_texture_lod 1 -#endif - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_EXT_shadow_samplers 1 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_EXT_sRGB 1 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_EXT_texture_compression_dxt1 1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_EXT_texture_format_BGRA8888 1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_EXT_texture_rg 1 -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_EXT_texture_storage 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_EXT_texture_type_2_10_10_10_REV 1 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_EXT_unpack_subimage 1 -#endif - -/*------------------------------------------------------------------------* - * DMP extension functions - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_DMP_shader_binary 1 -#endif - -/*------------------------------------------------------------------------* - * FJ extension functions - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ -#ifndef GL_FJ_shader_binary_GCCSO -#define GL_FJ_shader_binary_GCCSO 1 -#endif - -/*------------------------------------------------------------------------* - * IMG extension functions - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_IMG_program_binary 1 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_IMG_read_format 1 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_IMG_shader_binary 1 -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_IMG_texture_compression_pvrtc 1 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_IMG_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_NV_coverage_sample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); -GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); -#endif -typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); -typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_NV_depth_nonlinear 1 -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_NV_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); -#endif - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_NV_fbo_color_attachments 1 -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); -GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); -GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); -#endif -typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_NV_read_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); -#endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); -#endif - -/* GL_NV_read_buffer_front */ -#ifndef GL_NV_read_buffer_front -#define GL_NV_read_buffer_front 1 -#endif - -/* GL_NV_read_depth */ -#ifndef GL_NV_read_depth -#define GL_NV_read_depth 1 -#endif - -/* GL_NV_read_depth_stencil */ -#ifndef GL_NV_read_depth_stencil -#define GL_NV_read_depth_stencil 1 -#endif - -/* GL_NV_read_stencil */ -#ifndef GL_NV_read_stencil -#define GL_NV_read_stencil 1 -#endif - -/* GL_NV_texture_compression_s3tc_update */ -#ifndef GL_NV_texture_compression_s3tc_update -#define GL_NV_texture_compression_s3tc_update 1 -#endif - -/* GL_NV_texture_npot_2D_mipmap */ -#ifndef GL_NV_texture_npot_2D_mipmap -#define GL_NV_texture_npot_2D_mipmap 1 -#endif - -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_QCOM_alpha_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); -#endif -typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); -#endif - -/* GL_QCOM_binning_control */ -#ifndef GL_QCOM_binning_control -#define GL_QCOM_binning_control 1 -#endif - -/* GL_QCOM_driver_control */ -#ifndef GL_QCOM_driver_control -#define GL_QCOM_driver_control 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); -GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); -GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); -#endif -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -#endif - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_QCOM_extended_get 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); -GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); -#endif - -/* GL_QCOM_extended_get2 */ -#ifndef GL_QCOM_extended_get2 -#define GL_QCOM_extended_get2 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); -GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); -GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_QCOM_perfmon_global_mode 1 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_QCOM_writeonly_rendering 1 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_QCOM_tiled_rendering 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); -#endif -typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_VIV_shader_binary 1 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2ext_h_ */ - -#endif /* _MSC_VER */ - -#ifndef APIENTRY -#define APIENTRY GL_APIENTRY -#endif diff --git a/Source/3rdParty/sdl/include/SDL_pixels.h b/Source/3rdParty/sdl/include/SDL_pixels.h deleted file mode 100644 index 3131af7b7..000000000 --- a/Source/3rdParty/sdl/include/SDL_pixels.h +++ /dev/null @@ -1,429 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_pixels.h - * - * Header for the enumerated pixel format definitions. - */ - -#ifndef _SDL_pixels_h -#define _SDL_pixels_h - -#include "SDL_stdinc.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \name Transparency definitions - * - * These define alpha as the opacity of a surface. - */ -/* @{ */ -#define SDL_ALPHA_OPAQUE 255 -#define SDL_ALPHA_TRANSPARENT 0 -/* @} */ - -/** Pixel type. */ -enum -{ - SDL_PIXELTYPE_UNKNOWN, - SDL_PIXELTYPE_INDEX1, - SDL_PIXELTYPE_INDEX4, - SDL_PIXELTYPE_INDEX8, - SDL_PIXELTYPE_PACKED8, - SDL_PIXELTYPE_PACKED16, - SDL_PIXELTYPE_PACKED32, - SDL_PIXELTYPE_ARRAYU8, - SDL_PIXELTYPE_ARRAYU16, - SDL_PIXELTYPE_ARRAYU32, - SDL_PIXELTYPE_ARRAYF16, - SDL_PIXELTYPE_ARRAYF32 -}; - -/** Bitmap pixel order, high bit -> low bit. */ -enum -{ - SDL_BITMAPORDER_NONE, - SDL_BITMAPORDER_4321, - SDL_BITMAPORDER_1234 -}; - -/** Packed component order, high bit -> low bit. */ -enum -{ - SDL_PACKEDORDER_NONE, - SDL_PACKEDORDER_XRGB, - SDL_PACKEDORDER_RGBX, - SDL_PACKEDORDER_ARGB, - SDL_PACKEDORDER_RGBA, - SDL_PACKEDORDER_XBGR, - SDL_PACKEDORDER_BGRX, - SDL_PACKEDORDER_ABGR, - SDL_PACKEDORDER_BGRA -}; - -/** Array component order, low byte -> high byte. */ -enum -{ - SDL_ARRAYORDER_NONE, - SDL_ARRAYORDER_RGB, - SDL_ARRAYORDER_RGBA, - SDL_ARRAYORDER_ARGB, - SDL_ARRAYORDER_BGR, - SDL_ARRAYORDER_BGRA, - SDL_ARRAYORDER_ABGR -}; - -/** Packed component layout. */ -enum -{ - SDL_PACKEDLAYOUT_NONE, - SDL_PACKEDLAYOUT_332, - SDL_PACKEDLAYOUT_4444, - SDL_PACKEDLAYOUT_1555, - SDL_PACKEDLAYOUT_5551, - SDL_PACKEDLAYOUT_565, - SDL_PACKEDLAYOUT_8888, - SDL_PACKEDLAYOUT_2101010, - SDL_PACKEDLAYOUT_1010102 -}; - -#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) - -#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ - ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ - ((bits) << 8) | ((bytes) << 0)) - -#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) -#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) -#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) -#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) -#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) -#define SDL_BYTESPERPIXEL(X) \ - (SDL_ISPIXELFORMAT_FOURCC(X) ? \ - ((((X) == SDL_PIXELFORMAT_YUY2) || \ - ((X) == SDL_PIXELFORMAT_UYVY) || \ - ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) - -#define SDL_ISPIXELFORMAT_INDEXED(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) - -#define SDL_ISPIXELFORMAT_ALPHA(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) - -/* The flag is set to 1 because 0x1? is not in the printable ASCII range */ -#define SDL_ISPIXELFORMAT_FOURCC(format) \ - ((format) && (SDL_PIXELFLAG(format) != 1)) - -/* Note: If you modify this list, update SDL_GetPixelFormatName() */ -enum -{ - SDL_PIXELFORMAT_UNKNOWN, - SDL_PIXELFORMAT_INDEX1LSB = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, - 1, 0), - SDL_PIXELFORMAT_INDEX1MSB = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, - 1, 0), - SDL_PIXELFORMAT_INDEX4LSB = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, - 4, 0), - SDL_PIXELFORMAT_INDEX4MSB = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, - 4, 0), - SDL_PIXELFORMAT_INDEX8 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1), - SDL_PIXELFORMAT_RGB332 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, - SDL_PACKEDLAYOUT_332, 8, 1), - SDL_PIXELFORMAT_RGB444 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, - SDL_PACKEDLAYOUT_4444, 12, 2), - SDL_PIXELFORMAT_RGB555 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, - SDL_PACKEDLAYOUT_1555, 15, 2), - SDL_PIXELFORMAT_BGR555 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, - SDL_PACKEDLAYOUT_1555, 15, 2), - SDL_PIXELFORMAT_ARGB4444 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, - SDL_PACKEDLAYOUT_4444, 16, 2), - SDL_PIXELFORMAT_RGBA4444 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, - SDL_PACKEDLAYOUT_4444, 16, 2), - SDL_PIXELFORMAT_ABGR4444 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, - SDL_PACKEDLAYOUT_4444, 16, 2), - SDL_PIXELFORMAT_BGRA4444 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, - SDL_PACKEDLAYOUT_4444, 16, 2), - SDL_PIXELFORMAT_ARGB1555 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, - SDL_PACKEDLAYOUT_1555, 16, 2), - SDL_PIXELFORMAT_RGBA5551 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, - SDL_PACKEDLAYOUT_5551, 16, 2), - SDL_PIXELFORMAT_ABGR1555 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, - SDL_PACKEDLAYOUT_1555, 16, 2), - SDL_PIXELFORMAT_BGRA5551 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, - SDL_PACKEDLAYOUT_5551, 16, 2), - SDL_PIXELFORMAT_RGB565 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, - SDL_PACKEDLAYOUT_565, 16, 2), - SDL_PIXELFORMAT_BGR565 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, - SDL_PACKEDLAYOUT_565, 16, 2), - SDL_PIXELFORMAT_RGB24 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, - 24, 3), - SDL_PIXELFORMAT_BGR24 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, - 24, 3), - SDL_PIXELFORMAT_RGB888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, - SDL_PACKEDLAYOUT_8888, 24, 4), - SDL_PIXELFORMAT_RGBX8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, - SDL_PACKEDLAYOUT_8888, 24, 4), - SDL_PIXELFORMAT_BGR888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, - SDL_PACKEDLAYOUT_8888, 24, 4), - SDL_PIXELFORMAT_BGRX8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, - SDL_PACKEDLAYOUT_8888, 24, 4), - SDL_PIXELFORMAT_ARGB8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, - SDL_PACKEDLAYOUT_8888, 32, 4), - SDL_PIXELFORMAT_RGBA8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, - SDL_PACKEDLAYOUT_8888, 32, 4), - SDL_PIXELFORMAT_ABGR8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, - SDL_PACKEDLAYOUT_8888, 32, 4), - SDL_PIXELFORMAT_BGRA8888 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, - SDL_PACKEDLAYOUT_8888, 32, 4), - SDL_PIXELFORMAT_ARGB2101010 = - SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, - SDL_PACKEDLAYOUT_2101010, 32, 4), - - SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ - SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), - SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ - SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'), - SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ - SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'), - SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ - SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), - SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ - SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') -}; - -typedef struct SDL_Color -{ - Uint8 r; - Uint8 g; - Uint8 b; - Uint8 a; -} SDL_Color; -#define SDL_Colour SDL_Color - -typedef struct SDL_Palette -{ - int ncolors; - SDL_Color *colors; - Uint32 version; - int refcount; -} SDL_Palette; - -/** - * \note Everything in the pixel format structure is read-only. - */ -typedef struct SDL_PixelFormat -{ - Uint32 format; - SDL_Palette *palette; - Uint8 BitsPerPixel; - Uint8 BytesPerPixel; - Uint8 padding[2]; - Uint32 Rmask; - Uint32 Gmask; - Uint32 Bmask; - Uint32 Amask; - Uint8 Rloss; - Uint8 Gloss; - Uint8 Bloss; - Uint8 Aloss; - Uint8 Rshift; - Uint8 Gshift; - Uint8 Bshift; - Uint8 Ashift; - int refcount; - struct SDL_PixelFormat *next; -} SDL_PixelFormat; - -/** - * \brief Get the human readable name of a pixel format - */ -extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); - -/** - * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. - * - * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible. - * - * \sa SDL_MasksToPixelFormatEnum() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, - int *bpp, - Uint32 * Rmask, - Uint32 * Gmask, - Uint32 * Bmask, - Uint32 * Amask); - -/** - * \brief Convert a bpp and RGBA masks to an enumerated pixel format. - * - * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion - * wasn't possible. - * - * \sa SDL_PixelFormatEnumToMasks() - */ -extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, - Uint32 Rmask, - Uint32 Gmask, - Uint32 Bmask, - Uint32 Amask); - -/** - * \brief Create an SDL_PixelFormat structure from a pixel format enum. - */ -extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); - -/** - * \brief Free an SDL_PixelFormat structure. - */ -extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); - -/** - * \brief Create a palette structure with the specified number of color - * entries. - * - * \return A new palette, or NULL if there wasn't enough memory. - * - * \note The palette entries are initialized to white. - * - * \sa SDL_FreePalette() - */ -extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); - -/** - * \brief Set the palette for a pixel format structure. - */ -extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, - SDL_Palette *palette); - -/** - * \brief Set a range of colors in a palette. - * - * \param palette The palette to modify. - * \param colors An array of colors to copy into the palette. - * \param firstcolor The index of the first palette entry to modify. - * \param ncolors The number of entries to modify. - * - * \return 0 on success, or -1 if not all of the colors could be set. - */ -extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, - const SDL_Color * colors, - int firstcolor, int ncolors); - -/** - * \brief Free a palette created with SDL_AllocPalette(). - * - * \sa SDL_AllocPalette() - */ -extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); - -/** - * \brief Maps an RGB triple to an opaque pixel value for a given pixel format. - * - * \sa SDL_MapRGBA - */ -extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, - Uint8 r, Uint8 g, Uint8 b); - -/** - * \brief Maps an RGBA quadruple to a pixel value for a given pixel format. - * - * \sa SDL_MapRGB - */ -extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, - Uint8 r, Uint8 g, Uint8 b, - Uint8 a); - -/** - * \brief Get the RGB components from a pixel of the specified format. - * - * \sa SDL_GetRGBA - */ -extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, - const SDL_PixelFormat * format, - Uint8 * r, Uint8 * g, Uint8 * b); - -/** - * \brief Get the RGBA components from a pixel of the specified format. - * - * \sa SDL_GetRGB - */ -extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, - const SDL_PixelFormat * format, - Uint8 * r, Uint8 * g, Uint8 * b, - Uint8 * a); - -/** - * \brief Calculate a 256 entry gamma ramp for a gamma value. - */ -extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_pixels_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_platform.h b/Source/3rdParty/sdl/include/SDL_platform.h deleted file mode 100644 index c43f4b54a..000000000 --- a/Source/3rdParty/sdl/include/SDL_platform.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_platform.h - * - * Try to get a standard set of platform defines. - */ - -#ifndef _SDL_platform_h -#define _SDL_platform_h - -#if defined(_AIX) -#undef __AIX__ -#define __AIX__ 1 -#endif -#if defined(__HAIKU__) -#undef __HAIKU__ -#define __HAIKU__ 1 -#endif -#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) -#undef __BSDI__ -#define __BSDI__ 1 -#endif -#if defined(_arch_dreamcast) -#undef __DREAMCAST__ -#define __DREAMCAST__ 1 -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#undef __FREEBSD__ -#define __FREEBSD__ 1 -#endif -#if defined(hpux) || defined(__hpux) || defined(__hpux__) -#undef __HPUX__ -#define __HPUX__ 1 -#endif -#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) -#undef __IRIX__ -#define __IRIX__ 1 -#endif -#if defined(linux) || defined(__linux) || defined(__linux__) -#undef __LINUX__ -#define __LINUX__ 1 -#endif -#if defined(ANDROID) || defined(__ANDROID__) -#undef __ANDROID__ -#undef __LINUX__ /* do we need to do this? */ -#define __ANDROID__ 1 -#endif - -#if defined(__APPLE__) -/* lets us know what version of Mac OS X we're compiling on */ -#include "AvailabilityMacros.h" -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -/* if compiling for iPhone */ -#undef __IPHONEOS__ -#define __IPHONEOS__ 1 -#undef __MACOSX__ -#else -/* if not compiling for iPhone */ -#undef __MACOSX__ -#define __MACOSX__ 1 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# error SDL for Mac OS X only supports deploying on 10.5 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ -#endif /* TARGET_OS_IPHONE */ -#endif /* defined(__APPLE__) */ - -#if defined(__NetBSD__) -#undef __NETBSD__ -#define __NETBSD__ 1 -#endif -#if defined(__OpenBSD__) -#undef __OPENBSD__ -#define __OPENBSD__ 1 -#endif -#if defined(__OS2__) -#undef __OS2__ -#define __OS2__ 1 -#endif -#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) -#undef __OSF__ -#define __OSF__ 1 -#endif -#if defined(__QNXNTO__) -#undef __QNXNTO__ -#define __QNXNTO__ 1 -#endif -#if defined(riscos) || defined(__riscos) || defined(__riscos__) -#undef __RISCOS__ -#define __RISCOS__ 1 -#endif -#if defined(__SVR4) -#undef __SOLARIS__ -#define __SOLARIS__ 1 -#endif - -#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) -/* Try to find out if we're compiling for WinRT or non-WinRT */ -/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ -#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ -#include -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#undef __WINDOWS__ -#define __WINDOWS__ 1 -/* See if we're compiling for WinRT: */ -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) -#undef __WINRT__ -#define __WINRT__ 1 -#endif -#else -#undef __WINDOWS__ -#define __WINDOWS__ 1 -#endif /* _MSC_VER < 1700 */ -#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ - -#if defined(__WINDOWS__) -#undef __WIN32__ -#define __WIN32__ 1 -#endif -#if defined(__PSP__) -#undef __PSP__ -#define __PSP__ 1 -#endif - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Gets the name of the platform. - */ -extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_platform_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_power.h b/Source/3rdParty/sdl/include/SDL_power.h deleted file mode 100644 index cf71c9824..000000000 --- a/Source/3rdParty/sdl/include/SDL_power.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_power_h -#define _SDL_power_h - -/** - * \file SDL_power.h - * - * Header for the SDL power management routines. - */ - -#include "SDL_stdinc.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief The basic state for the system's power supply. - */ -typedef enum -{ - SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ - SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ - SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ - SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ - SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ -} SDL_PowerState; - - -/** - * \brief Get the current power supply details. - * - * \param secs Seconds of battery life left. You can pass a NULL here if - * you don't care. Will return -1 if we can't determine a - * value, or we're not running on a battery. - * - * \param pct Percentage of battery life left, between 0 and 100. You can - * pass a NULL here if you don't care. Will return -1 if we - * can't determine a value, or we're not running on a battery. - * - * \return The state of the battery (if any). - */ -extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_power_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_quit.h b/Source/3rdParty/sdl/include/SDL_quit.h deleted file mode 100644 index 8a786445d..000000000 --- a/Source/3rdParty/sdl/include/SDL_quit.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_quit.h - * - * Include file for SDL quit event handling. - */ - -#ifndef _SDL_quit_h -#define _SDL_quit_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -/** - * \file SDL_quit.h - * - * An ::SDL_QUIT event is generated when the user tries to close the application - * window. If it is ignored or filtered out, the window will remain open. - * If it is not ignored or filtered, it is queued normally and the window - * is allowed to close. When the window is closed, screen updates will - * complete, but have no effect. - * - * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) - * and SIGTERM (system termination request), if handlers do not already - * exist, that generate ::SDL_QUIT events as well. There is no way - * to determine the cause of an ::SDL_QUIT event, but setting a signal - * handler in your application will override the default generation of - * quit events for that signal. - * - * \sa SDL_Quit() - */ - -/* There are no functions directly affecting the quit event */ - -#define SDL_QuitRequested() \ - (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) - -#endif /* _SDL_quit_h */ diff --git a/Source/3rdParty/sdl/include/SDL_rect.h b/Source/3rdParty/sdl/include/SDL_rect.h deleted file mode 100644 index 0a95a3344..000000000 --- a/Source/3rdParty/sdl/include/SDL_rect.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_rect.h - * - * Header file for SDL_rect definition and management functions. - */ - -#ifndef _SDL_rect_h -#define _SDL_rect_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_pixels.h" -#include "SDL_rwops.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief The structure that defines a point - * - * \sa SDL_EnclosePoints - */ -typedef struct SDL_Point -{ - int x; - int y; -} SDL_Point; - -/** - * \brief A rectangle, with the origin at the upper left. - * - * \sa SDL_RectEmpty - * \sa SDL_RectEquals - * \sa SDL_HasIntersection - * \sa SDL_IntersectRect - * \sa SDL_UnionRect - * \sa SDL_EnclosePoints - */ -typedef struct SDL_Rect -{ - int x, y; - int w, h; -} SDL_Rect; - -/** - * \brief Returns true if the rectangle has no area. - */ -SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) -{ - return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; -} - -/** - * \brief Returns true if the two rectangles are equal. - */ -SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) -{ - return (a && b && (a->x == b->x) && (a->y == b->y) && - (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; -} - -/** - * \brief Determine whether two rectangles intersect. - * - * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, - const SDL_Rect * B); - -/** - * \brief Calculate the intersection of two rectangles. - * - * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, - const SDL_Rect * B, - SDL_Rect * result); - -/** - * \brief Calculate the union of two rectangles. - */ -extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, - const SDL_Rect * B, - SDL_Rect * result); - -/** - * \brief Calculate a minimal rectangle enclosing a set of points - * - * \return SDL_TRUE if any points were within the clipping rect - */ -extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, - int count, - const SDL_Rect * clip, - SDL_Rect * result); - -/** - * \brief Calculate the intersection of a rectangle and line segment. - * - * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * - rect, int *X1, - int *Y1, int *X2, - int *Y2); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_rect_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_render.h b/Source/3rdParty/sdl/include/SDL_render.h deleted file mode 100644 index 77f706a9b..000000000 --- a/Source/3rdParty/sdl/include/SDL_render.h +++ /dev/null @@ -1,870 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_render.h - * - * Header file for SDL 2D rendering functions. - * - * This API supports the following features: - * * single pixel points - * * single pixel lines - * * filled rectangles - * * texture images - * - * The primitives may be drawn in opaque, blended, or additive modes. - * - * The texture images may be drawn in opaque, blended, or additive modes. - * They can have an additional color tint or alpha modulation applied to - * them, and may also be stretched with linear interpolation. - * - * This API is designed to accelerate simple 2D operations. You may - * want more functionality such as polygons and particle effects and - * in that case you should use SDL's OpenGL/Direct3D support or one - * of the many good 3D engines. - * - * These functions must be called from the main thread. - * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 - */ - -#ifndef _SDL_render_h -#define _SDL_render_h - -#include "SDL_stdinc.h" -#include "SDL_rect.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Flags used when creating a rendering context - */ -typedef enum -{ - SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ - SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware - acceleration */ - SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized - with the refresh rate */ - SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports - rendering to texture */ -} SDL_RendererFlags; - -/** - * \brief Information on the capabilities of a render driver or context. - */ -typedef struct SDL_RendererInfo -{ - const char *name; /**< The name of the renderer */ - Uint32 flags; /**< Supported ::SDL_RendererFlags */ - Uint32 num_texture_formats; /**< The number of available texture formats */ - Uint32 texture_formats[16]; /**< The available texture formats */ - int max_texture_width; /**< The maximimum texture width */ - int max_texture_height; /**< The maximimum texture height */ -} SDL_RendererInfo; - -/** - * \brief The access pattern allowed for a texture. - */ -typedef enum -{ - SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ - SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ - SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ -} SDL_TextureAccess; - -/** - * \brief The texture channel modulation used in SDL_RenderCopy(). - */ -typedef enum -{ - SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ - SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ - SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ -} SDL_TextureModulate; - -/** - * \brief Flip constants for SDL_RenderCopyEx - */ -typedef enum -{ - SDL_FLIP_NONE = 0x00000000, /**< Do not flip */ - SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */ - SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */ -} SDL_RendererFlip; - -/** - * \brief A structure representing rendering state - */ -struct SDL_Renderer; -typedef struct SDL_Renderer SDL_Renderer; - -/** - * \brief An efficient driver-specific representation of pixel data - */ -struct SDL_Texture; -typedef struct SDL_Texture SDL_Texture; - - -/* Function prototypes */ - -/** - * \brief Get the number of 2D rendering drivers available for the current - * display. - * - * A render driver is a set of code that handles rendering and texture - * management on a particular display. Normally there is only one, but - * some drivers may have several available with different capabilities. - * - * \sa SDL_GetRenderDriverInfo() - * \sa SDL_CreateRenderer() - */ -extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); - -/** - * \brief Get information about a specific 2D rendering driver for the current - * display. - * - * \param index The index of the driver to query information about. - * \param info A pointer to an SDL_RendererInfo struct to be filled with - * information on the rendering driver. - * - * \return 0 on success, -1 if the index was out of range. - * - * \sa SDL_CreateRenderer() - */ -extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, - SDL_RendererInfo * info); - -/** - * \brief Create a window and default renderer - * - * \param width The width of the window - * \param height The height of the window - * \param window_flags The flags used to create the window - * \param window A pointer filled with the window, or NULL on error - * \param renderer A pointer filled with the renderer, or NULL on error - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( - int width, int height, Uint32 window_flags, - SDL_Window **window, SDL_Renderer **renderer); - - -/** - * \brief Create a 2D rendering context for a window. - * - * \param window The window where rendering is displayed. - * \param index The index of the rendering driver to initialize, or -1 to - * initialize the first one supporting the requested flags. - * \param flags ::SDL_RendererFlags. - * - * \return A valid rendering context or NULL if there was an error. - * - * \sa SDL_CreateSoftwareRenderer() - * \sa SDL_GetRendererInfo() - * \sa SDL_DestroyRenderer() - */ -extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, - int index, Uint32 flags); - -/** - * \brief Create a 2D software rendering context for a surface. - * - * \param surface The surface where rendering is done. - * - * \return A valid rendering context or NULL if there was an error. - * - * \sa SDL_CreateRenderer() - * \sa SDL_DestroyRenderer() - */ -extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); - -/** - * \brief Get the renderer associated with a window. - */ -extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); - -/** - * \brief Get information about a rendering context. - */ -extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, - SDL_RendererInfo * info); - -/** - * \brief Get the output size of a rendering context. - */ -extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, - int *w, int *h); - -/** - * \brief Create a texture for a rendering context. - * - * \param renderer The renderer. - * \param format The format of the texture. - * \param access One of the enumerated values in ::SDL_TextureAccess. - * \param w The width of the texture in pixels. - * \param h The height of the texture in pixels. - * - * \return The created texture is returned, or 0 if no rendering context was - * active, the format was unsupported, or the width or height were out - * of range. - * - * \sa SDL_QueryTexture() - * \sa SDL_UpdateTexture() - * \sa SDL_DestroyTexture() - */ -extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, - Uint32 format, - int access, int w, - int h); - -/** - * \brief Create a texture from an existing surface. - * - * \param renderer The renderer. - * \param surface The surface containing pixel data used to fill the texture. - * - * \return The created texture is returned, or 0 on error. - * - * \note The surface is not modified or freed by this function. - * - * \sa SDL_QueryTexture() - * \sa SDL_DestroyTexture() - */ -extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); - -/** - * \brief Query the attributes of a texture - * - * \param texture A texture to be queried. - * \param format A pointer filled in with the raw format of the texture. The - * actual format may differ, but pixel transfers will use this - * format. - * \param access A pointer filled in with the actual access to the texture. - * \param w A pointer filled in with the width of the texture in pixels. - * \param h A pointer filled in with the height of the texture in pixels. - * - * \return 0 on success, or -1 if the texture is not valid. - */ -extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, - Uint32 * format, int *access, - int *w, int *h); - -/** - * \brief Set an additional color value used in render copy operations. - * - * \param texture The texture to update. - * \param r The red color value multiplied into copy operations. - * \param g The green color value multiplied into copy operations. - * \param b The blue color value multiplied into copy operations. - * - * \return 0 on success, or -1 if the texture is not valid or color modulation - * is not supported. - * - * \sa SDL_GetTextureColorMod() - */ -extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, - Uint8 r, Uint8 g, Uint8 b); - - -/** - * \brief Get the additional color value used in render copy operations. - * - * \param texture The texture to query. - * \param r A pointer filled in with the current red color value. - * \param g A pointer filled in with the current green color value. - * \param b A pointer filled in with the current blue color value. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \sa SDL_SetTextureColorMod() - */ -extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, - Uint8 * r, Uint8 * g, - Uint8 * b); - -/** - * \brief Set an additional alpha value used in render copy operations. - * - * \param texture The texture to update. - * \param alpha The alpha value multiplied into copy operations. - * - * \return 0 on success, or -1 if the texture is not valid or alpha modulation - * is not supported. - * - * \sa SDL_GetTextureAlphaMod() - */ -extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, - Uint8 alpha); - -/** - * \brief Get the additional alpha value used in render copy operations. - * - * \param texture The texture to query. - * \param alpha A pointer filled in with the current alpha value. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \sa SDL_SetTextureAlphaMod() - */ -extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, - Uint8 * alpha); - -/** - * \brief Set the blend mode used for texture copy operations. - * - * \param texture The texture to update. - * \param blendMode ::SDL_BlendMode to use for texture blending. - * - * \return 0 on success, or -1 if the texture is not valid or the blend mode is - * not supported. - * - * \note If the blend mode is not supported, the closest supported mode is - * chosen. - * - * \sa SDL_GetTextureBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, - SDL_BlendMode blendMode); - -/** - * \brief Get the blend mode used for texture copy operations. - * - * \param texture The texture to query. - * \param blendMode A pointer filled in with the current blend mode. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \sa SDL_SetTextureBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, - SDL_BlendMode *blendMode); - -/** - * \brief Update the given texture rectangle with new pixel data. - * - * \param texture The texture to update - * \param rect A pointer to the rectangle of pixels to update, or NULL to - * update the entire texture. - * \param pixels The raw pixel data. - * \param pitch The number of bytes between rows of pixel data. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \note This is a fairly slow function. - */ -extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, - const SDL_Rect * rect, - const void *pixels, int pitch); - -/** - * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data. - * - * \param texture The texture to update - * \param rect A pointer to the rectangle of pixels to update, or NULL to - * update the entire texture. - * \param Yplane The raw pixel data for the Y plane. - * \param Ypitch The number of bytes between rows of pixel data for the Y plane. - * \param Uplane The raw pixel data for the U plane. - * \param Upitch The number of bytes between rows of pixel data for the U plane. - * \param Vplane The raw pixel data for the V plane. - * \param Vpitch The number of bytes between rows of pixel data for the V plane. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \note You can use SDL_UpdateTexture() as long as your pixel data is - * a contiguous block of Y and U/V planes in the proper order, but - * this function is available if your pixel data is not contiguous. - */ -extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, - const SDL_Rect * rect, - const Uint8 *Yplane, int Ypitch, - const Uint8 *Uplane, int Upitch, - const Uint8 *Vplane, int Vpitch); - -/** - * \brief Lock a portion of the texture for write-only pixel access. - * - * \param texture The texture to lock for access, which was created with - * ::SDL_TEXTUREACCESS_STREAMING. - * \param rect A pointer to the rectangle to lock for access. If the rect - * is NULL, the entire texture will be locked. - * \param pixels This is filled in with a pointer to the locked pixels, - * appropriately offset by the locked area. - * \param pitch This is filled in with the pitch of the locked pixels. - * - * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * - * \sa SDL_UnlockTexture() - */ -extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, - const SDL_Rect * rect, - void **pixels, int *pitch); - -/** - * \brief Unlock a texture, uploading the changes to video memory, if needed. - * - * \sa SDL_LockTexture() - */ -extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); - -/** - * \brief Determines whether a window supports the use of render targets - * - * \param renderer The renderer that will be checked - * - * \return SDL_TRUE if supported, SDL_FALSE if not. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); - -/** - * \brief Set a texture as the current rendering target. - * - * \param renderer The renderer. - * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target - * - * \return 0 on success, or -1 on error - * - * \sa SDL_GetRenderTarget() - */ -extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, - SDL_Texture *texture); - -/** - * \brief Get the current render target or NULL for the default render target. - * - * \return The current render target - * - * \sa SDL_SetRenderTarget() - */ -extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer); - -/** - * \brief Set device independent resolution for rendering - * - * \param renderer The renderer for which resolution should be set. - * \param w The width of the logical resolution - * \param h The height of the logical resolution - * - * This function uses the viewport and scaling functionality to allow a fixed logical - * resolution for rendering, regardless of the actual output resolution. If the actual - * output resolution doesn't have the same aspect ratio the output rendering will be - * centered within the output display. - * - * If the output display is a window, mouse events in the window will be filtered - * and scaled so they seem to arrive within the logical resolution. - * - * \note If this function results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. - * - * \sa SDL_RenderGetLogicalSize() - * \sa SDL_RenderSetScale() - * \sa SDL_RenderSetViewport() - */ -extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); - -/** - * \brief Get device independent resolution for rendering - * - * \param renderer The renderer from which resolution should be queried. - * \param w A pointer filled with the width of the logical resolution - * \param h A pointer filled with the height of the logical resolution - * - * \sa SDL_RenderSetLogicalSize() - */ -extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); - -/** - * \brief Set the drawing area for rendering on the current target. - * - * \param renderer The renderer for which the drawing area should be set. - * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. - * - * The x,y of the viewport rect represents the origin for rendering. - * - * \return 0 on success, or -1 on error - * - * \note If the window associated with the renderer is resized, the viewport is automatically reset. - * - * \sa SDL_RenderGetViewport() - * \sa SDL_RenderSetLogicalSize() - */ -extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, - const SDL_Rect * rect); - -/** - * \brief Get the drawing area for the current target. - * - * \sa SDL_RenderSetViewport() - */ -extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, - SDL_Rect * rect); - -/** - * \brief Set the clip rectangle for the current target. - * - * \param renderer The renderer for which clip rectangle should be set. - * \param rect A pointer to the rectangle to set as the clip rectangle, or - * NULL to disable clipping. - * - * \return 0 on success, or -1 on error - * - * \sa SDL_RenderGetClipRect() - */ -extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, - const SDL_Rect * rect); - -/** - * \brief Get the clip rectangle for the current target. - * - * \param renderer The renderer from which clip rectangle should be queried. - * \param rect A pointer filled in with the current clip rectangle, or - * an empty rectangle if clipping is disabled. - * - * \sa SDL_RenderSetClipRect() - */ -extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, - SDL_Rect * rect); - -/** - * \brief Set the drawing scale for rendering on the current target. - * - * \param renderer The renderer for which the drawing scale should be set. - * \param scaleX The horizontal scaling factor - * \param scaleY The vertical scaling factor - * - * The drawing coordinates are scaled by the x/y scaling factors - * before they are used by the renderer. This allows resolution - * independent drawing with a single coordinate system. - * - * \note If this results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. For best results use integer scaling factors. - * - * \sa SDL_RenderGetScale() - * \sa SDL_RenderSetLogicalSize() - */ -extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, - float scaleX, float scaleY); - -/** - * \brief Get the drawing scale for the current target. - * - * \param renderer The renderer from which drawing scale should be queried. - * \param scaleX A pointer filled in with the horizontal scaling factor - * \param scaleY A pointer filled in with the vertical scaling factor - * - * \sa SDL_RenderSetScale() - */ -extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, - float *scaleX, float *scaleY); - -/** - * \brief Set the color used for drawing operations (Rect, Line and Clear). - * - * \param renderer The renderer for which drawing color should be set. - * \param r The red value used to draw on the rendering target. - * \param g The green value used to draw on the rendering target. - * \param b The blue value used to draw on the rendering target. - * \param a The alpha value used to draw on the rendering target, usually - * ::SDL_ALPHA_OPAQUE (255). - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer, - Uint8 r, Uint8 g, Uint8 b, - Uint8 a); - -/** - * \brief Get the color used for drawing operations (Rect, Line and Clear). - * - * \param renderer The renderer from which drawing color should be queried. - * \param r A pointer to the red value used to draw on the rendering target. - * \param g A pointer to the green value used to draw on the rendering target. - * \param b A pointer to the blue value used to draw on the rendering target. - * \param a A pointer to the alpha value used to draw on the rendering target, - * usually ::SDL_ALPHA_OPAQUE (255). - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer, - Uint8 * r, Uint8 * g, Uint8 * b, - Uint8 * a); - -/** - * \brief Set the blend mode used for drawing operations (Fill and Line). - * - * \param renderer The renderer for which blend mode should be set. - * \param blendMode ::SDL_BlendMode to use for blending. - * - * \return 0 on success, or -1 on error - * - * \note If the blend mode is not supported, the closest supported mode is - * chosen. - * - * \sa SDL_GetRenderDrawBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, - SDL_BlendMode blendMode); - -/** - * \brief Get the blend mode used for drawing operations. - * - * \param renderer The renderer from which blend mode should be queried. - * \param blendMode A pointer filled in with the current blend mode. - * - * \return 0 on success, or -1 on error - * - * \sa SDL_SetRenderDrawBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, - SDL_BlendMode *blendMode); - -/** - * \brief Clear the current rendering target with the drawing color - * - * This function clears the entire rendering target, ignoring the viewport. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); - -/** - * \brief Draw a point on the current rendering target. - * - * \param renderer The renderer which should draw a point. - * \param x The x coordinate of the point. - * \param y The y coordinate of the point. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, - int x, int y); - -/** - * \brief Draw multiple points on the current rendering target. - * - * \param renderer The renderer which should draw multiple points. - * \param points The points to draw - * \param count The number of points to draw - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, - const SDL_Point * points, - int count); - -/** - * \brief Draw a line on the current rendering target. - * - * \param renderer The renderer which should draw a line. - * \param x1 The x coordinate of the start point. - * \param y1 The y coordinate of the start point. - * \param x2 The x coordinate of the end point. - * \param y2 The y coordinate of the end point. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, - int x1, int y1, int x2, int y2); - -/** - * \brief Draw a series of connected lines on the current rendering target. - * - * \param renderer The renderer which should draw multiple lines. - * \param points The points along the lines - * \param count The number of points, drawing count-1 lines - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, - const SDL_Point * points, - int count); - -/** - * \brief Draw a rectangle on the current rendering target. - * - * \param renderer The renderer which should draw a rectangle. - * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, - const SDL_Rect * rect); - -/** - * \brief Draw some number of rectangles on the current rendering target. - * - * \param renderer The renderer which should draw multiple rectangles. - * \param rects A pointer to an array of destination rectangles. - * \param count The number of rectangles. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, - const SDL_Rect * rects, - int count); - -/** - * \brief Fill a rectangle on the current rendering target with the drawing color. - * - * \param renderer The renderer which should fill a rectangle. - * \param rect A pointer to the destination rectangle, or NULL for the entire - * rendering target. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, - const SDL_Rect * rect); - -/** - * \brief Fill some number of rectangles on the current rendering target with the drawing color. - * - * \param renderer The renderer which should fill multiple rectangles. - * \param rects A pointer to an array of destination rectangles. - * \param count The number of rectangles. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, - const SDL_Rect * rects, - int count); - -/** - * \brief Copy a portion of the texture to the current rendering target. - * - * \param renderer The renderer which should copy parts of a texture. - * \param texture The source texture. - * \param srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * \param dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, - SDL_Texture * texture, - const SDL_Rect * srcrect, - const SDL_Rect * dstrect); - -/** - * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center - * - * \param renderer The renderer which should copy parts of a texture. - * \param texture The source texture. - * \param srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * \param dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect - * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) - * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture - * - * \return 0 on success, or -1 on error - */ -extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, - SDL_Texture * texture, - const SDL_Rect * srcrect, - const SDL_Rect * dstrect, - const double angle, - const SDL_Point *center, - const SDL_RendererFlip flip); - -/** - * \brief Read pixels from the current rendering target. - * - * \param renderer The renderer from which pixels should be read. - * \param rect A pointer to the rectangle to read, or NULL for the entire - * render target. - * \param format The desired format of the pixel data, or 0 to use the format - * of the rendering target - * \param pixels A pointer to be filled in with the pixel data - * \param pitch The pitch of the pixels parameter. - * - * \return 0 on success, or -1 if pixel reading is not supported. - * - * \warning This is a very slow operation, and should not be used frequently. - */ -extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, - const SDL_Rect * rect, - Uint32 format, - void *pixels, int pitch); - -/** - * \brief Update the screen with rendering performed. - */ -extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); - -/** - * \brief Destroy the specified texture. - * - * \sa SDL_CreateTexture() - * \sa SDL_CreateTextureFromSurface() - */ -extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); - -/** - * \brief Destroy the rendering context for a window and free associated - * textures. - * - * \sa SDL_CreateRenderer() - */ -extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); - - -/** - * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with - * OpenGL instructions. - * - * \param texture The SDL texture to bind - * \param texw A pointer to a float that will be filled with the texture width - * \param texh A pointer to a float that will be filled with the texture height - * - * \return 0 on success, or -1 if the operation is not supported - */ -extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); - -/** - * \brief Unbind a texture from the current OpenGL/ES/ES2 context. - * - * \param texture The SDL texture to unbind - * - * \return 0 on success, or -1 if the operation is not supported - */ -extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_render_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_revision.h b/Source/3rdParty/sdl/include/SDL_revision.h deleted file mode 100644 index a75dc3309..000000000 --- a/Source/3rdParty/sdl/include/SDL_revision.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SDL_REVISION "hg-8628:b558f99d48f0" -#define SDL_REVISION_NUMBER 8628 diff --git a/Source/3rdParty/sdl/include/SDL_rwops.h b/Source/3rdParty/sdl/include/SDL_rwops.h deleted file mode 100644 index 4bdd7876a..000000000 --- a/Source/3rdParty/sdl/include/SDL_rwops.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_rwops.h - * - * This file provides a general interface for SDL to read and write - * data streams. It can easily be extended to files, memory, etc. - */ - -#ifndef _SDL_rwops_h -#define _SDL_rwops_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* RWops Types */ -#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ -#define SDL_RWOPS_WINFILE 1 /* Win32 file */ -#define SDL_RWOPS_STDFILE 2 /* Stdio file */ -#define SDL_RWOPS_JNIFILE 3 /* Android asset */ -#define SDL_RWOPS_MEMORY 4 /* Memory stream */ -#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ - -/** - * This is the read/write operation structure -- very basic. - */ -typedef struct SDL_RWops -{ - /** - * Return the size of the file in this rwops, or -1 if unknown - */ - Sint64 (SDLCALL * size) (struct SDL_RWops * context); - - /** - * Seek to \c offset relative to \c whence, one of stdio's whence values: - * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * \return the final offset in the data stream, or -1 on error. - */ - Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, - int whence); - - /** - * Read up to \c maxnum objects each of size \c size from the data - * stream to the area pointed at by \c ptr. - * - * \return the number of objects read, or 0 at error or end of file. - */ - size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, - size_t size, size_t maxnum); - - /** - * Write exactly \c num objects each of size \c size from the area - * pointed at by \c ptr to data stream. - * - * \return the number of objects written, or 0 at error or end of file. - */ - size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, - size_t size, size_t num); - - /** - * Close and free an allocated SDL_RWops structure. - * - * \return 0 if successful or -1 on write error when flushing data. - */ - int (SDLCALL * close) (struct SDL_RWops * context); - - Uint32 type; - union - { -#if defined(ANDROID) - struct - { - void *fileNameRef; - void *inputStreamRef; - void *readableByteChannelRef; - void *readMethod; - void *assetFileDescriptorRef; - long position; - long size; - long offset; - int fd; - } androidio; -#elif defined(__WIN32__) - struct - { - SDL_bool append; - void *h; - struct - { - void *data; - size_t size; - size_t left; - } buffer; - } windowsio; -#endif - -#ifdef HAVE_STDIO_H - struct - { - SDL_bool autoclose; - FILE *fp; - } stdio; -#endif - struct - { - Uint8 *base; - Uint8 *here; - Uint8 *stop; - } mem; - struct - { - void *data1; - void *data2; - } unknown; - } hidden; - -} SDL_RWops; - - -/** - * \name RWFrom functions - * - * Functions to create SDL_RWops structures from various data streams. - */ -/* @{ */ - -extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, - const char *mode); - -#ifdef HAVE_STDIO_H -extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, - SDL_bool autoclose); -#else -extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, - SDL_bool autoclose); -#endif - -extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); -extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, - int size); - -/* @} *//* RWFrom functions */ - - -extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); -extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); - -#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ -#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ -#define RW_SEEK_END 2 /**< Seek relative to the end of data */ - -/** - * \name Read/write macros - * - * Macros to easily read and write from an SDL_RWops structure. - */ -/* @{ */ -#define SDL_RWsize(ctx) (ctx)->size(ctx) -#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) -#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) -#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) -#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) -#define SDL_RWclose(ctx) (ctx)->close(ctx) -/* @} *//* Read/write macros */ - - -/** - * \name Read endian functions - * - * Read an item of the specified endianness and return in native format. - */ -/* @{ */ -extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); -extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); -extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); -extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); -extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); -extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); -extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); -/* @} *//* Read endian functions */ - -/** - * \name Write endian functions - * - * Write an item of native format to the specified endianness. - */ -/* @{ */ -extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); -extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); -extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); -extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); -extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); -extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); -extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); -/* @} *//* Write endian functions */ - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_rwops_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_scancode.h b/Source/3rdParty/sdl/include/SDL_scancode.h deleted file mode 100644 index 4b3be28fb..000000000 --- a/Source/3rdParty/sdl/include/SDL_scancode.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_scancode.h - * - * Defines keyboard scancodes. - */ - -#ifndef _SDL_scancode_h -#define _SDL_scancode_h - -#include "SDL_stdinc.h" - -/** - * \brief The SDL keyboard scancode representation. - * - * Values of this type are used to represent keyboard keys, among other places - * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the - * SDL_Event structure. - * - * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf - */ -typedef enum -{ - SDL_SCANCODE_UNKNOWN = 0, - - /** - * \name Usage page 0x07 - * - * These values are from usage page 0x07 (USB keyboard page). - */ - /* @{ */ - - SDL_SCANCODE_A = 4, - SDL_SCANCODE_B = 5, - SDL_SCANCODE_C = 6, - SDL_SCANCODE_D = 7, - SDL_SCANCODE_E = 8, - SDL_SCANCODE_F = 9, - SDL_SCANCODE_G = 10, - SDL_SCANCODE_H = 11, - SDL_SCANCODE_I = 12, - SDL_SCANCODE_J = 13, - SDL_SCANCODE_K = 14, - SDL_SCANCODE_L = 15, - SDL_SCANCODE_M = 16, - SDL_SCANCODE_N = 17, - SDL_SCANCODE_O = 18, - SDL_SCANCODE_P = 19, - SDL_SCANCODE_Q = 20, - SDL_SCANCODE_R = 21, - SDL_SCANCODE_S = 22, - SDL_SCANCODE_T = 23, - SDL_SCANCODE_U = 24, - SDL_SCANCODE_V = 25, - SDL_SCANCODE_W = 26, - SDL_SCANCODE_X = 27, - SDL_SCANCODE_Y = 28, - SDL_SCANCODE_Z = 29, - - SDL_SCANCODE_1 = 30, - SDL_SCANCODE_2 = 31, - SDL_SCANCODE_3 = 32, - SDL_SCANCODE_4 = 33, - SDL_SCANCODE_5 = 34, - SDL_SCANCODE_6 = 35, - SDL_SCANCODE_7 = 36, - SDL_SCANCODE_8 = 37, - SDL_SCANCODE_9 = 38, - SDL_SCANCODE_0 = 39, - - SDL_SCANCODE_RETURN = 40, - SDL_SCANCODE_ESCAPE = 41, - SDL_SCANCODE_BACKSPACE = 42, - SDL_SCANCODE_TAB = 43, - SDL_SCANCODE_SPACE = 44, - - SDL_SCANCODE_MINUS = 45, - SDL_SCANCODE_EQUALS = 46, - SDL_SCANCODE_LEFTBRACKET = 47, - SDL_SCANCODE_RIGHTBRACKET = 48, - SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return - * key on ISO keyboards and at the right end - * of the QWERTY row on ANSI keyboards. - * Produces REVERSE SOLIDUS (backslash) and - * VERTICAL LINE in a US layout, REVERSE - * SOLIDUS and VERTICAL LINE in a UK Mac - * layout, NUMBER SIGN and TILDE in a UK - * Windows layout, DOLLAR SIGN and POUND SIGN - * in a Swiss German layout, NUMBER SIGN and - * APOSTROPHE in a German layout, GRAVE - * ACCENT and POUND SIGN in a French Mac - * layout, and ASTERISK and MICRO SIGN in a - * French Windows layout. - */ - SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code - * instead of 49 for the same key, but all - * OSes I've seen treat the two codes - * identically. So, as an implementor, unless - * your keyboard generates both of those - * codes and your OS treats them differently, - * you should generate SDL_SCANCODE_BACKSLASH - * instead of this code. As a user, you - * should not rely on this code because SDL - * will never generate it with most (all?) - * keyboards. - */ - SDL_SCANCODE_SEMICOLON = 51, - SDL_SCANCODE_APOSTROPHE = 52, - SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI - * and ISO keyboards). Produces GRAVE ACCENT and - * TILDE in a US Windows layout and in US and UK - * Mac layouts on ANSI keyboards, GRAVE ACCENT - * and NOT SIGN in a UK Windows layout, SECTION - * SIGN and PLUS-MINUS SIGN in US and UK Mac - * layouts on ISO keyboards, SECTION SIGN and - * DEGREE SIGN in a Swiss German layout (Mac: - * only on ISO keyboards), CIRCUMFLEX ACCENT and - * DEGREE SIGN in a German layout (Mac: only on - * ISO keyboards), SUPERSCRIPT TWO and TILDE in a - * French Windows layout, COMMERCIAL AT and - * NUMBER SIGN in a French Mac layout on ISO - * keyboards, and LESS-THAN SIGN and GREATER-THAN - * SIGN in a Swiss German, German, or French Mac - * layout on ANSI keyboards. - */ - SDL_SCANCODE_COMMA = 54, - SDL_SCANCODE_PERIOD = 55, - SDL_SCANCODE_SLASH = 56, - - SDL_SCANCODE_CAPSLOCK = 57, - - SDL_SCANCODE_F1 = 58, - SDL_SCANCODE_F2 = 59, - SDL_SCANCODE_F3 = 60, - SDL_SCANCODE_F4 = 61, - SDL_SCANCODE_F5 = 62, - SDL_SCANCODE_F6 = 63, - SDL_SCANCODE_F7 = 64, - SDL_SCANCODE_F8 = 65, - SDL_SCANCODE_F9 = 66, - SDL_SCANCODE_F10 = 67, - SDL_SCANCODE_F11 = 68, - SDL_SCANCODE_F12 = 69, - - SDL_SCANCODE_PRINTSCREEN = 70, - SDL_SCANCODE_SCROLLLOCK = 71, - SDL_SCANCODE_PAUSE = 72, - SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but - does send code 73, not 117) */ - SDL_SCANCODE_HOME = 74, - SDL_SCANCODE_PAGEUP = 75, - SDL_SCANCODE_DELETE = 76, - SDL_SCANCODE_END = 77, - SDL_SCANCODE_PAGEDOWN = 78, - SDL_SCANCODE_RIGHT = 79, - SDL_SCANCODE_LEFT = 80, - SDL_SCANCODE_DOWN = 81, - SDL_SCANCODE_UP = 82, - - SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards - */ - SDL_SCANCODE_KP_DIVIDE = 84, - SDL_SCANCODE_KP_MULTIPLY = 85, - SDL_SCANCODE_KP_MINUS = 86, - SDL_SCANCODE_KP_PLUS = 87, - SDL_SCANCODE_KP_ENTER = 88, - SDL_SCANCODE_KP_1 = 89, - SDL_SCANCODE_KP_2 = 90, - SDL_SCANCODE_KP_3 = 91, - SDL_SCANCODE_KP_4 = 92, - SDL_SCANCODE_KP_5 = 93, - SDL_SCANCODE_KP_6 = 94, - SDL_SCANCODE_KP_7 = 95, - SDL_SCANCODE_KP_8 = 96, - SDL_SCANCODE_KP_9 = 97, - SDL_SCANCODE_KP_0 = 98, - SDL_SCANCODE_KP_PERIOD = 99, - - SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO - * keyboards have over ANSI ones, - * located between left shift and Y. - * Produces GRAVE ACCENT and TILDE in a - * US or UK Mac layout, REVERSE SOLIDUS - * (backslash) and VERTICAL LINE in a - * US or UK Windows layout, and - * LESS-THAN SIGN and GREATER-THAN SIGN - * in a Swiss German, German, or French - * layout. */ - SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ - SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, - * not a physical key - but some Mac keyboards - * do have a power key. */ - SDL_SCANCODE_KP_EQUALS = 103, - SDL_SCANCODE_F13 = 104, - SDL_SCANCODE_F14 = 105, - SDL_SCANCODE_F15 = 106, - SDL_SCANCODE_F16 = 107, - SDL_SCANCODE_F17 = 108, - SDL_SCANCODE_F18 = 109, - SDL_SCANCODE_F19 = 110, - SDL_SCANCODE_F20 = 111, - SDL_SCANCODE_F21 = 112, - SDL_SCANCODE_F22 = 113, - SDL_SCANCODE_F23 = 114, - SDL_SCANCODE_F24 = 115, - SDL_SCANCODE_EXECUTE = 116, - SDL_SCANCODE_HELP = 117, - SDL_SCANCODE_MENU = 118, - SDL_SCANCODE_SELECT = 119, - SDL_SCANCODE_STOP = 120, - SDL_SCANCODE_AGAIN = 121, /**< redo */ - SDL_SCANCODE_UNDO = 122, - SDL_SCANCODE_CUT = 123, - SDL_SCANCODE_COPY = 124, - SDL_SCANCODE_PASTE = 125, - SDL_SCANCODE_FIND = 126, - SDL_SCANCODE_MUTE = 127, - SDL_SCANCODE_VOLUMEUP = 128, - SDL_SCANCODE_VOLUMEDOWN = 129, -/* not sure whether there's a reason to enable these */ -/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ -/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ -/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ - SDL_SCANCODE_KP_COMMA = 133, - SDL_SCANCODE_KP_EQUALSAS400 = 134, - - SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see - footnotes in USB doc */ - SDL_SCANCODE_INTERNATIONAL2 = 136, - SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ - SDL_SCANCODE_INTERNATIONAL4 = 138, - SDL_SCANCODE_INTERNATIONAL5 = 139, - SDL_SCANCODE_INTERNATIONAL6 = 140, - SDL_SCANCODE_INTERNATIONAL7 = 141, - SDL_SCANCODE_INTERNATIONAL8 = 142, - SDL_SCANCODE_INTERNATIONAL9 = 143, - SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ - SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ - SDL_SCANCODE_LANG3 = 146, /**< Katakana */ - SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ - SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ - SDL_SCANCODE_LANG6 = 149, /**< reserved */ - SDL_SCANCODE_LANG7 = 150, /**< reserved */ - SDL_SCANCODE_LANG8 = 151, /**< reserved */ - SDL_SCANCODE_LANG9 = 152, /**< reserved */ - - SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ - SDL_SCANCODE_SYSREQ = 154, - SDL_SCANCODE_CANCEL = 155, - SDL_SCANCODE_CLEAR = 156, - SDL_SCANCODE_PRIOR = 157, - SDL_SCANCODE_RETURN2 = 158, - SDL_SCANCODE_SEPARATOR = 159, - SDL_SCANCODE_OUT = 160, - SDL_SCANCODE_OPER = 161, - SDL_SCANCODE_CLEARAGAIN = 162, - SDL_SCANCODE_CRSEL = 163, - SDL_SCANCODE_EXSEL = 164, - - SDL_SCANCODE_KP_00 = 176, - SDL_SCANCODE_KP_000 = 177, - SDL_SCANCODE_THOUSANDSSEPARATOR = 178, - SDL_SCANCODE_DECIMALSEPARATOR = 179, - SDL_SCANCODE_CURRENCYUNIT = 180, - SDL_SCANCODE_CURRENCYSUBUNIT = 181, - SDL_SCANCODE_KP_LEFTPAREN = 182, - SDL_SCANCODE_KP_RIGHTPAREN = 183, - SDL_SCANCODE_KP_LEFTBRACE = 184, - SDL_SCANCODE_KP_RIGHTBRACE = 185, - SDL_SCANCODE_KP_TAB = 186, - SDL_SCANCODE_KP_BACKSPACE = 187, - SDL_SCANCODE_KP_A = 188, - SDL_SCANCODE_KP_B = 189, - SDL_SCANCODE_KP_C = 190, - SDL_SCANCODE_KP_D = 191, - SDL_SCANCODE_KP_E = 192, - SDL_SCANCODE_KP_F = 193, - SDL_SCANCODE_KP_XOR = 194, - SDL_SCANCODE_KP_POWER = 195, - SDL_SCANCODE_KP_PERCENT = 196, - SDL_SCANCODE_KP_LESS = 197, - SDL_SCANCODE_KP_GREATER = 198, - SDL_SCANCODE_KP_AMPERSAND = 199, - SDL_SCANCODE_KP_DBLAMPERSAND = 200, - SDL_SCANCODE_KP_VERTICALBAR = 201, - SDL_SCANCODE_KP_DBLVERTICALBAR = 202, - SDL_SCANCODE_KP_COLON = 203, - SDL_SCANCODE_KP_HASH = 204, - SDL_SCANCODE_KP_SPACE = 205, - SDL_SCANCODE_KP_AT = 206, - SDL_SCANCODE_KP_EXCLAM = 207, - SDL_SCANCODE_KP_MEMSTORE = 208, - SDL_SCANCODE_KP_MEMRECALL = 209, - SDL_SCANCODE_KP_MEMCLEAR = 210, - SDL_SCANCODE_KP_MEMADD = 211, - SDL_SCANCODE_KP_MEMSUBTRACT = 212, - SDL_SCANCODE_KP_MEMMULTIPLY = 213, - SDL_SCANCODE_KP_MEMDIVIDE = 214, - SDL_SCANCODE_KP_PLUSMINUS = 215, - SDL_SCANCODE_KP_CLEAR = 216, - SDL_SCANCODE_KP_CLEARENTRY = 217, - SDL_SCANCODE_KP_BINARY = 218, - SDL_SCANCODE_KP_OCTAL = 219, - SDL_SCANCODE_KP_DECIMAL = 220, - SDL_SCANCODE_KP_HEXADECIMAL = 221, - - SDL_SCANCODE_LCTRL = 224, - SDL_SCANCODE_LSHIFT = 225, - SDL_SCANCODE_LALT = 226, /**< alt, option */ - SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ - SDL_SCANCODE_RCTRL = 228, - SDL_SCANCODE_RSHIFT = 229, - SDL_SCANCODE_RALT = 230, /**< alt gr, option */ - SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ - - SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered - * by any of the above, but since there's a - * special KMOD_MODE for it I'm adding it here - */ - - /* @} *//* Usage page 0x07 */ - - /** - * \name Usage page 0x0C - * - * These values are mapped from usage page 0x0C (USB consumer page). - */ - /* @{ */ - - SDL_SCANCODE_AUDIONEXT = 258, - SDL_SCANCODE_AUDIOPREV = 259, - SDL_SCANCODE_AUDIOSTOP = 260, - SDL_SCANCODE_AUDIOPLAY = 261, - SDL_SCANCODE_AUDIOMUTE = 262, - SDL_SCANCODE_MEDIASELECT = 263, - SDL_SCANCODE_WWW = 264, - SDL_SCANCODE_MAIL = 265, - SDL_SCANCODE_CALCULATOR = 266, - SDL_SCANCODE_COMPUTER = 267, - SDL_SCANCODE_AC_SEARCH = 268, - SDL_SCANCODE_AC_HOME = 269, - SDL_SCANCODE_AC_BACK = 270, - SDL_SCANCODE_AC_FORWARD = 271, - SDL_SCANCODE_AC_STOP = 272, - SDL_SCANCODE_AC_REFRESH = 273, - SDL_SCANCODE_AC_BOOKMARKS = 274, - - /* @} *//* Usage page 0x0C */ - - /** - * \name Walther keys - * - * These are values that Christian Walther added (for mac keyboard?). - */ - /* @{ */ - - SDL_SCANCODE_BRIGHTNESSDOWN = 275, - SDL_SCANCODE_BRIGHTNESSUP = 276, - SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display - switch, video mode switch */ - SDL_SCANCODE_KBDILLUMTOGGLE = 278, - SDL_SCANCODE_KBDILLUMDOWN = 279, - SDL_SCANCODE_KBDILLUMUP = 280, - SDL_SCANCODE_EJECT = 281, - SDL_SCANCODE_SLEEP = 282, - - SDL_SCANCODE_APP1 = 283, - SDL_SCANCODE_APP2 = 284, - - /* @} *//* Walther keys */ - - /* Add any other keys here. */ - - SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes - for array bounds */ -} SDL_Scancode; - -#endif /* _SDL_scancode_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_shape.h b/Source/3rdParty/sdl/include/SDL_shape.h deleted file mode 100644 index 53029306e..000000000 --- a/Source/3rdParty/sdl/include/SDL_shape.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_shape_h -#define _SDL_shape_h - -#include "SDL_stdinc.h" -#include "SDL_pixels.h" -#include "SDL_rect.h" -#include "SDL_surface.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** \file SDL_shape.h - * - * Header file for the shaped window API. - */ - -#define SDL_NONSHAPEABLE_WINDOW -1 -#define SDL_INVALID_SHAPE_ARGUMENT -2 -#define SDL_WINDOW_LACKS_SHAPE -3 - -/** - * \brief Create a window that can be shaped with the specified position, dimensions, and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window. - * \param h The height of the window. - * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: - * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE, - * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, - * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. - * - * \return The window created, or NULL if window creation failed. - * - * \sa SDL_DestroyWindow() - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); - -/** - * \brief Return whether the given window is a shaped window. - * - * \param window The window to query for being shaped. - * - * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. - * \sa SDL_CreateShapedWindow - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); - -/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ -typedef enum { - /** \brief The default mode, a binarized alpha cutoff of 1. */ - ShapeModeDefault, - /** \brief A binarized alpha cutoff with a given integer value. */ - ShapeModeBinarizeAlpha, - /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ - ShapeModeReverseBinarizeAlpha, - /** \brief A color key is applied. */ - ShapeModeColorKey -} WindowShapeMode; - -#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) - -/** \brief A union containing parameters for shaped windows. */ -typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ - Uint8 binarizationCutoff; - SDL_Color colorKey; -} SDL_WindowShapeParams; - -/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ -typedef struct SDL_WindowShapeMode { - /** \brief The mode of these window-shape parameters. */ - WindowShapeMode mode; - /** \brief Window-shape parameters. */ - SDL_WindowShapeParams parameters; -} SDL_WindowShapeMode; - -/** - * \brief Set the shape and parameters of a shaped window. - * - * \param window The shaped window whose parameters should be set. - * \param shape A surface encoding the desired shape for the window. - * \param shape_mode The parameters to set for the shaped window. - * - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW - * if the SDL_Window* given does not reference a valid shaped window. - * - * \sa SDL_WindowShapeMode - * \sa SDL_GetShapedWindowMode. - */ -extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); - -/** - * \brief Get the shape parameters of a shaped window. - * - * \param window The shaped window whose parameters should be retrieved. - * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape. - * - * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode - * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if - * the SDL_Window* given is a shapeable window currently lacking a shape. - * - * \sa SDL_WindowShapeMode - * \sa SDL_SetWindowShape - */ -extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_shape_h */ diff --git a/Source/3rdParty/sdl/include/SDL_stdinc.h b/Source/3rdParty/sdl/include/SDL_stdinc.h deleted file mode 100644 index 31b343d30..000000000 --- a/Source/3rdParty/sdl/include/SDL_stdinc.h +++ /dev/null @@ -1,405 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_stdinc.h - * - * This is a general header that includes C language support. - */ - -#ifndef _SDL_stdinc_h -#define _SDL_stdinc_h - -#include "SDL_config.h" - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#if defined(STDC_HEADERS) -# include -# include -# include -#else -# if defined(HAVE_STDLIB_H) -# include -# elif defined(HAVE_MALLOC_H) -# include -# endif -# if defined(HAVE_STDDEF_H) -# include -# endif -# if defined(HAVE_STDARG_H) -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#if defined(HAVE_INTTYPES_H) -# include -#elif defined(HAVE_STDINT_H) -# include -#endif -#ifdef HAVE_CTYPE_H -# include -#endif -#ifdef HAVE_MATH_H -# if defined(__WINRT__) -/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on - WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx - for more information. -*/ -# define _USE_MATH_DEFINES -# endif -# include -#endif -#ifdef HAVE_FLOAT_H -# include -#endif -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -# include -#endif - -/** - * The number of elements in an array. - */ -#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) -#define SDL_TABLESIZE(table) SDL_arraysize(table) - -/** - * \name Cast operators - * - * Use proper C++ casts when compiled as C++ to be compatible with the option - * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). - */ -/* @{ */ -#ifdef __cplusplus -#define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) -#define SDL_static_cast(type, expression) static_cast(expression) -#define SDL_const_cast(type, expression) const_cast(expression) -#else -#define SDL_reinterpret_cast(type, expression) ((type)(expression)) -#define SDL_static_cast(type, expression) ((type)(expression)) -#define SDL_const_cast(type, expression) ((type)(expression)) -#endif -/* @} *//* Cast operators */ - -/* Define a four character code as a Uint32 */ -#define SDL_FOURCC(A, B, C, D) \ - ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) - -/** - * \name Basic data types - */ -/* @{ */ - -typedef enum -{ - SDL_FALSE = 0, - SDL_TRUE = 1 -} SDL_bool; - -/** - * \brief A signed 8-bit integer type. - */ -typedef int8_t Sint8; -/** - * \brief An unsigned 8-bit integer type. - */ -typedef uint8_t Uint8; -/** - * \brief A signed 16-bit integer type. - */ -typedef int16_t Sint16; -/** - * \brief An unsigned 16-bit integer type. - */ -typedef uint16_t Uint16; -/** - * \brief A signed 32-bit integer type. - */ -typedef int32_t Sint32; -/** - * \brief An unsigned 32-bit integer type. - */ -typedef uint32_t Uint32; - -/** - * \brief A signed 64-bit integer type. - */ -typedef int64_t Sint64; -/** - * \brief An unsigned 64-bit integer type. - */ -typedef uint64_t Uint64; - -/* @} *//* Basic data types */ - - -#define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] -/** \cond */ -#ifndef DOXYGEN_SHOULD_IGNORE_THIS -SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); -SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); -SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); -SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); -SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); -SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); -SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); -SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); -#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ -/** \endcond */ - -/* Check to make sure enums are the size of ints, for structure packing. - For both Watcom C/C++ and Borland C/C++ the compiler option that makes - enums having the size of an int must be enabled. - This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). -*/ - -/** \cond */ -#ifndef DOXYGEN_SHOULD_IGNORE_THIS -#if !defined(__ANDROID__) - /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ -typedef enum -{ - DUMMY_ENUM_VALUE -} SDL_DUMMY_ENUM; - -SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); -#endif -#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ -/** \endcond */ - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif -#ifdef HAVE_ALLOCA -#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) -#define SDL_stack_free(data) -#else -#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) -#define SDL_stack_free(data) SDL_free(data) -#endif - -extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); -extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); -extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); -extern DECLSPEC void SDLCALL SDL_free(void *mem); - -extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); -extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); - -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); - -extern DECLSPEC int SDLCALL SDL_abs(int x); - -/* !!! FIXME: these have side effects. You probably shouldn't use them. */ -/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ -#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) -#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) - -extern DECLSPEC int SDLCALL SDL_isdigit(int x); -extern DECLSPEC int SDLCALL SDL_isspace(int x); -extern DECLSPEC int SDLCALL SDL_toupper(int x); -extern DECLSPEC int SDLCALL SDL_tolower(int x); - -extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); - -#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) -#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) - -/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ -SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) -{ -#if defined(__GNUC__) && defined(i386) - int u0, u1, u2; - __asm__ __volatile__ ( - "cld \n\t" - "rep ; stosl \n\t" - : "=&D" (u0), "=&a" (u1), "=&c" (u2) - : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords)) - : "memory" - ); -#else - size_t _n = (dwords + 3) / 4; - Uint32 *_p = SDL_static_cast(Uint32 *, dst); - Uint32 _val = (val); - if (dwords == 0) - return; - switch (dwords % 4) - { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; - } while ( --_n ); - } -#endif -} - - -extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); - -SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords) -{ - return SDL_memcpy(dst, src, dwords * 4); -} - -extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len); -extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); - -extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); -extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); -extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); - -extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); -extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); -extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); -extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); -extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); -extern DECLSPEC char *SDLCALL SDL_strrev(char *str); -extern DECLSPEC char *SDLCALL SDL_strupr(char *str); -extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); -extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); -extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); -extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); - -extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); -extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); -extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); -extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); -extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); -extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); - -extern DECLSPEC int SDLCALL SDL_atoi(const char *str); -extern DECLSPEC double SDLCALL SDL_atof(const char *str); -extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); -extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); -extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); -extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); -extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); - -extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); -extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); -extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); -extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); - -extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); -extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); -extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); -extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); - -#ifndef HAVE_M_PI -#ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 /* pi */ -#endif -#endif - -extern DECLSPEC double SDLCALL SDL_acos(double x); -extern DECLSPEC double SDLCALL SDL_asin(double x); -extern DECLSPEC double SDLCALL SDL_atan(double x); -extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); -extern DECLSPEC double SDLCALL SDL_ceil(double x); -extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); -extern DECLSPEC double SDLCALL SDL_cos(double x); -extern DECLSPEC float SDLCALL SDL_cosf(float x); -extern DECLSPEC double SDLCALL SDL_fabs(double x); -extern DECLSPEC double SDLCALL SDL_floor(double x); -extern DECLSPEC double SDLCALL SDL_log(double x); -extern DECLSPEC double SDLCALL SDL_pow(double x, double y); -extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); -extern DECLSPEC double SDLCALL SDL_sin(double x); -extern DECLSPEC float SDLCALL SDL_sinf(float x); -extern DECLSPEC double SDLCALL SDL_sqrt(double x); - -/* The SDL implementation of iconv() returns these error codes */ -#define SDL_ICONV_ERROR (size_t)-1 -#define SDL_ICONV_E2BIG (size_t)-2 -#define SDL_ICONV_EILSEQ (size_t)-3 -#define SDL_ICONV_EINVAL (size_t)-4 - -/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ -typedef struct _SDL_iconv_t *SDL_iconv_t; -extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, - const char *fromcode); -extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); -extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, - size_t * inbytesleft, char **outbuf, - size_t * outbytesleft); -/** - * This function converts a string between encodings in one pass, returning a - * string that must be freed with SDL_free() or NULL on error. - */ -extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, - const char *fromcode, - const char *inbuf, - size_t inbytesleft); -#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_stdinc_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_surface.h b/Source/3rdParty/sdl/include/SDL_surface.h deleted file mode 100644 index aa8d82174..000000000 --- a/Source/3rdParty/sdl/include/SDL_surface.h +++ /dev/null @@ -1,503 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_surface.h - * - * Header file for ::SDL_Surface definition and management functions. - */ - -#ifndef _SDL_surface_h -#define _SDL_surface_h - -#include "SDL_stdinc.h" -#include "SDL_pixels.h" -#include "SDL_rect.h" -#include "SDL_blendmode.h" -#include "SDL_rwops.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \name Surface flags - * - * These are the currently supported flags for the ::SDL_Surface. - * - * \internal - * Used internally (read-only). - */ -/* @{ */ -#define SDL_SWSURFACE 0 /**< Just here for compatibility */ -#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ -#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ -#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ -/* @} *//* Surface flags */ - -/** - * Evaluates to true if the surface needs to be locked before access. - */ -#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) - -/** - * \brief A collection of pixels used in software blitting. - * - * \note This structure should be treated as read-only, except for \c pixels, - * which, if not NULL, contains the raw pixel data for the surface. - */ -typedef struct SDL_Surface -{ - Uint32 flags; /**< Read-only */ - SDL_PixelFormat *format; /**< Read-only */ - int w, h; /**< Read-only */ - int pitch; /**< Read-only */ - void *pixels; /**< Read-write */ - - /** Application data associated with the surface */ - void *userdata; /**< Read-write */ - - /** information needed for surfaces requiring locks */ - int locked; /**< Read-only */ - void *lock_data; /**< Read-only */ - - /** clipping information */ - SDL_Rect clip_rect; /**< Read-only */ - - /** info for fast blit mapping to other surfaces */ - struct SDL_BlitMap *map; /**< Private */ - - /** Reference count -- used when freeing surface */ - int refcount; /**< Read-mostly */ -} SDL_Surface; - -/** - * \brief The type of function used for surface blitting functions. - */ -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, - struct SDL_Surface * dst, SDL_Rect * dstrect); - -/** - * Allocate and free an RGB surface. - * - * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. - * If the depth is greater than 8 bits, the pixel format is set using the - * flags '[RGB]mask'. - * - * If the function runs out of memory, it will return NULL. - * - * \param flags The \c flags are obsolete and should be set to 0. - * \param width The width in pixels of the surface to create. - * \param height The height in pixels of the surface to create. - * \param depth The depth in bits of the surface to create. - * \param Rmask The red mask of the surface to create. - * \param Gmask The green mask of the surface to create. - * \param Bmask The blue mask of the surface to create. - * \param Amask The alpha mask of the surface to create. - */ -extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface - (Uint32 flags, int width, int height, int depth, - Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); -extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, - int width, - int height, - int depth, - int pitch, - Uint32 Rmask, - Uint32 Gmask, - Uint32 Bmask, - Uint32 Amask); -extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); - -/** - * \brief Set the palette used by a surface. - * - * \return 0, or -1 if the surface format doesn't use a palette. - * - * \note A single palette can be shared with many surfaces. - */ -extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, - SDL_Palette * palette); - -/** - * \brief Sets up a surface for directly accessing the pixels. - * - * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write - * to and read from \c surface->pixels, using the pixel format stored in - * \c surface->format. Once you are done accessing the surface, you should - * use SDL_UnlockSurface() to release it. - * - * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates - * to 0, then you can read and write to the surface at any time, and the - * pixel format of the surface will not change. - * - * No operating system or library calls should be made between lock/unlock - * pairs, as critical system locks may be held during this time. - * - * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. - * - * \sa SDL_UnlockSurface() - */ -extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); -/** \sa SDL_LockSurface() */ -extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); - -/** - * Load a surface from a seekable SDL data stream (memory or file). - * - * If \c freesrc is non-zero, the stream will be closed after being read. - * - * The new surface should be freed with SDL_FreeSurface(). - * - * \return the new surface, or NULL if there was an error. - */ -extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, - int freesrc); - -/** - * Load a surface from a file. - * - * Convenience macro. - */ -#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) - -/** - * Save a surface to a seekable SDL data stream (memory or file). - * - * If \c freedst is non-zero, the stream will be closed after being written. - * - * \return 0 if successful or -1 if there was an error. - */ -extern DECLSPEC int SDLCALL SDL_SaveBMP_RW - (SDL_Surface * surface, SDL_RWops * dst, int freedst); - -/** - * Save a surface to a file. - * - * Convenience macro. - */ -#define SDL_SaveBMP(surface, file) \ - SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) - -/** - * \brief Sets the RLE acceleration hint for a surface. - * - * \return 0 on success, or -1 if the surface is not valid - * - * \note If RLE is enabled, colorkey and alpha blending blits are much faster, - * but the surface must be locked before directly accessing the pixels. - */ -extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, - int flag); - -/** - * \brief Sets the color key (transparent pixel) in a blittable surface. - * - * \param surface The surface to update - * \param flag Non-zero to enable colorkey and 0 to disable colorkey - * \param key The transparent pixel in the native surface format - * - * \return 0 on success, or -1 if the surface is not valid - * - * You can pass SDL_RLEACCEL to enable RLE accelerated blits. - */ -extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, - int flag, Uint32 key); - -/** - * \brief Gets the color key (transparent pixel) in a blittable surface. - * - * \param surface The surface to update - * \param key A pointer filled in with the transparent pixel in the native - * surface format - * - * \return 0 on success, or -1 if the surface is not valid or colorkey is not - * enabled. - */ -extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, - Uint32 * key); - -/** - * \brief Set an additional color value used in blit operations. - * - * \param surface The surface to update. - * \param r The red color value multiplied into blit operations. - * \param g The green color value multiplied into blit operations. - * \param b The blue color value multiplied into blit operations. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_GetSurfaceColorMod() - */ -extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, - Uint8 r, Uint8 g, Uint8 b); - - -/** - * \brief Get the additional color value used in blit operations. - * - * \param surface The surface to query. - * \param r A pointer filled in with the current red color value. - * \param g A pointer filled in with the current green color value. - * \param b A pointer filled in with the current blue color value. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_SetSurfaceColorMod() - */ -extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, - Uint8 * r, Uint8 * g, - Uint8 * b); - -/** - * \brief Set an additional alpha value used in blit operations. - * - * \param surface The surface to update. - * \param alpha The alpha value multiplied into blit operations. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_GetSurfaceAlphaMod() - */ -extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, - Uint8 alpha); - -/** - * \brief Get the additional alpha value used in blit operations. - * - * \param surface The surface to query. - * \param alpha A pointer filled in with the current alpha value. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_SetSurfaceAlphaMod() - */ -extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, - Uint8 * alpha); - -/** - * \brief Set the blend mode used for blit operations. - * - * \param surface The surface to update. - * \param blendMode ::SDL_BlendMode to use for blit blending. - * - * \return 0 on success, or -1 if the parameters are not valid. - * - * \sa SDL_GetSurfaceBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, - SDL_BlendMode blendMode); - -/** - * \brief Get the blend mode used for blit operations. - * - * \param surface The surface to query. - * \param blendMode A pointer filled in with the current blend mode. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_SetSurfaceBlendMode() - */ -extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, - SDL_BlendMode *blendMode); - -/** - * Sets the clipping rectangle for the destination surface in a blit. - * - * If the clip rectangle is NULL, clipping will be disabled. - * - * If the clip rectangle doesn't intersect the surface, the function will - * return SDL_FALSE and blits will be completely clipped. Otherwise the - * function returns SDL_TRUE and blits to the surface will be clipped to - * the intersection of the surface area and the clipping rectangle. - * - * Note that blits are automatically clipped to the edges of the source - * and destination surfaces. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, - const SDL_Rect * rect); - -/** - * Gets the clipping rectangle for the destination surface in a blit. - * - * \c rect must be a pointer to a valid rectangle which will be filled - * with the correct values. - */ -extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, - SDL_Rect * rect); - -/** - * Creates a new surface of the specified format, and then copies and maps - * the given surface to it so the blit of the converted surface will be as - * fast as possible. If this function fails, it returns NULL. - * - * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those - * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and - * SDL will try to RLE accelerate colorkey and alpha blits in the resulting - * surface. - */ -extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface - (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags); -extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat - (SDL_Surface * src, Uint32 pixel_format, Uint32 flags); - -/** - * \brief Copy a block of pixels of one format to another format - * - * \return 0 on success, or -1 if there was an error - */ -extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, - Uint32 src_format, - const void * src, int src_pitch, - Uint32 dst_format, - void * dst, int dst_pitch); - -/** - * Performs a fast fill of the given rectangle with \c color. - * - * If \c rect is NULL, the whole surface will be filled with \c color. - * - * The color should be a pixel of the format used by the surface, and - * can be generated by the SDL_MapRGB() function. - * - * \return 0 on success, or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_FillRect - (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color); -extern DECLSPEC int SDLCALL SDL_FillRects - (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); - -/** - * Performs a fast blit from the source surface to the destination surface. - * - * This assumes that the source and destination rectangles are - * the same size. If either \c srcrect or \c dstrect are NULL, the entire - * surface (\c src or \c dst) is copied. The final blit rectangles are saved - * in \c srcrect and \c dstrect after all clipping is performed. - * - * \return If the blit is successful, it returns 0, otherwise it returns -1. - * - * The blit function should not be called on a locked surface. - * - * The blit semantics for surfaces with and without blending and colorkey - * are defined as follows: - * \verbatim - RGBA->RGB: - Source surface blend mode set to SDL_BLENDMODE_BLEND: - alpha-blend (using the source alpha-channel and per-surface alpha) - SDL_SRCCOLORKEY ignored. - Source surface blend mode set to SDL_BLENDMODE_NONE: - copy RGB. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source color key, ignoring alpha in the - comparison. - - RGB->RGBA: - Source surface blend mode set to SDL_BLENDMODE_BLEND: - alpha-blend (using the source per-surface alpha) - Source surface blend mode set to SDL_BLENDMODE_NONE: - copy RGB, set destination alpha to source per-surface alpha value. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source color key. - - RGBA->RGBA: - Source surface blend mode set to SDL_BLENDMODE_BLEND: - alpha-blend (using the source alpha-channel and per-surface alpha) - SDL_SRCCOLORKEY ignored. - Source surface blend mode set to SDL_BLENDMODE_NONE: - copy all of RGBA to the destination. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source color key, ignoring alpha in the - comparison. - - RGB->RGB: - Source surface blend mode set to SDL_BLENDMODE_BLEND: - alpha-blend (using the source per-surface alpha) - Source surface blend mode set to SDL_BLENDMODE_NONE: - copy RGB. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source color key. - \endverbatim - * - * You should call SDL_BlitSurface() unless you know exactly how SDL - * blitting works internally and how to use the other blit functions. - */ -#define SDL_BlitSurface SDL_UpperBlit - -/** - * This is the public blit function, SDL_BlitSurface(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlit() - */ -extern DECLSPEC int SDLCALL SDL_UpperBlit - (SDL_Surface * src, const SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); - -/** - * This is a semi-private blit function and it performs low-level surface - * blitting only. - */ -extern DECLSPEC int SDLCALL SDL_LowerBlit - (SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); - -/** - * \brief Perform a fast, low quality, stretch blit between two surfaces of the - * same pixel format. - * - * \note This function uses a static buffer, and is not thread-safe. - */ -extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, - const SDL_Rect * srcrect, - SDL_Surface * dst, - const SDL_Rect * dstrect); - -#define SDL_BlitScaled SDL_UpperBlitScaled - -/** - * This is the public scaled blit function, SDL_BlitScaled(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() - */ -extern DECLSPEC int SDLCALL SDL_UpperBlitScaled - (SDL_Surface * src, const SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); - -/** - * This is a semi-private blit function and it performs low-level surface - * scaled blitting only. - */ -extern DECLSPEC int SDLCALL SDL_LowerBlitScaled - (SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_surface_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_system.h b/Source/3rdParty/sdl/include/SDL_system.h deleted file mode 100644 index fd929f7f9..000000000 --- a/Source/3rdParty/sdl/include/SDL_system.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_system.h - * - * Include file for platform specific SDL API functions - */ - -#ifndef _SDL_system_h -#define _SDL_system_h - -#include "SDL_stdinc.h" -#include "SDL_keyboard.h" -#include "SDL_render.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - - -/* Platform specific functions for Windows */ -#ifdef __WIN32__ - -/* Returns the D3D9 adapter index that matches the specified display index. - This adapter index can be passed to IDirect3D9::CreateDevice and controls - on which monitor a full screen application will appear. -*/ -extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); - -/* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. - Once you are done using the device, you should release it to avoid a resource leak. - */ -typedef struct IDirect3DDevice9 IDirect3DDevice9; -extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); - -/* Returns the DXGI Adapter and Output indices for the specified display index. - These can be passed to EnumAdapters and EnumOutputs respectively to get the objects - required to create a DX10 or DX11 device and swap chain. - */ -extern DECLSPEC void SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); - -#endif /* __WIN32__ */ - - -/* Platform specific functions for iOS */ -#if defined(__IPHONEOS__) && __IPHONEOS__ - -extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); -extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); - -#endif /* __IPHONEOS__ */ - - -/* Platform specific functions for Android */ -#if defined(__ANDROID__) && __ANDROID__ - -/* Get the JNI environment for the current thread - This returns JNIEnv*, but the prototype is void* so we don't need jni.h - */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); - -/* Get the SDL Activity object for the application - This returns jobject, but the prototype is void* so we don't need jni.h - The jobject returned by SDL_AndroidGetActivity is a local reference. - It is the caller's responsibility to properly release it - (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) - */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); - -/* See the official Android developer guide for more information: - http://developer.android.com/guide/topics/data/data-storage.html -*/ -#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 -#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 - -/* Get the path used for internal storage for this application. - This path is unique to your application and cannot be written to - by other applications. - */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); - -/* Get the current state of external storage, a bitmask of these values: - SDL_ANDROID_EXTERNAL_STORAGE_READ - SDL_ANDROID_EXTERNAL_STORAGE_WRITE - If external storage is currently unavailable, this will return 0. -*/ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); - -/* Get the path used for external storage for this application. - This path is unique to your application, but is public and can be - written to by other applications. - */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); - -#endif /* __ANDROID__ */ - -/* Platform specific functions for WinRT */ -#if defined(__WINRT__) && __WINRT__ - -/** - * \brief WinRT / Windows Phone path types - */ -typedef enum -{ - /** \brief The installed app's root directory. - Files here are likely to be read-only. */ - SDL_WINRT_PATH_INSTALLED_LOCATION, - - /** \brief The app's local data store. Files may be written here */ - SDL_WINRT_PATH_LOCAL_FOLDER, - - /** \brief The app's roaming data store. Unsupported on Windows Phone. - Files written here may be copied to other machines via a network - connection. - */ - SDL_WINRT_PATH_ROAMING_FOLDER, - - /** \brief The app's temporary data store. Unsupported on Windows Phone. - Files written here may be deleted at any time. */ - SDL_WINRT_PATH_TEMP_FOLDER -} SDL_WinRT_Path; - - -/** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - */ -extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); - -/** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - */ -extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); - -#endif /* __WINRT__ */ - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_system_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_syswm.h b/Source/3rdParty/sdl/include/SDL_syswm.h deleted file mode 100644 index 42ec271e3..000000000 --- a/Source/3rdParty/sdl/include/SDL_syswm.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_syswm.h - * - * Include file for SDL custom system window manager hooks. - */ - -#ifndef _SDL_syswm_h -#define _SDL_syswm_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_video.h" -#include "SDL_version.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file SDL_syswm.h - * - * Your application has access to a special type of event ::SDL_SYSWMEVENT, - * which contains window-manager specific information and arrives whenever - * an unhandled window event occurs. This event is ignored by default, but - * you can enable it with SDL_EventState(). - */ -#ifdef SDL_PROTOTYPES_ONLY -struct SDL_SysWMinfo; -#else - -#if defined(SDL_VIDEO_DRIVER_WINDOWS) -//#define WIN32_LEAN_AND_MEAN -#include -#endif - -#if defined(SDL_VIDEO_DRIVER_WINRT) -#include -#endif - -/* This is the structure for custom window manager events */ -#if defined(SDL_VIDEO_DRIVER_X11) -#if defined(__APPLE__) && defined(__MACH__) -/* conflicts with Quickdraw.h */ -#define Cursor X11Cursor -#endif - -#include -#include - -#if defined(__APPLE__) && defined(__MACH__) -/* matches the re-define above */ -#undef Cursor -#endif - -#endif /* defined(SDL_VIDEO_DRIVER_X11) */ - -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) -#include -#endif - -#if defined(SDL_VIDEO_DRIVER_COCOA) -#ifdef __OBJC__ -#include -#else -typedef struct _NSWindow NSWindow; -#endif -#endif - -#if defined(SDL_VIDEO_DRIVER_UIKIT) -#ifdef __OBJC__ -#include -#else -typedef struct _UIWindow UIWindow; -typedef struct _UIViewController UIViewController; -#endif -#endif - -#if defined(SDL_VIDEO_DRIVER_MIR) -#include -#endif - - -/** - * These are the various supported windowing subsystems - */ -typedef enum -{ - SDL_SYSWM_UNKNOWN, - SDL_SYSWM_WINDOWS, - SDL_SYSWM_X11, - SDL_SYSWM_DIRECTFB, - SDL_SYSWM_COCOA, - SDL_SYSWM_UIKIT, - SDL_SYSWM_WAYLAND, - SDL_SYSWM_MIR, - SDL_SYSWM_WINRT, -} SDL_SYSWM_TYPE; - -/** - * The custom event structure. - */ -struct SDL_SysWMmsg -{ - SDL_version version; - SDL_SYSWM_TYPE subsystem; - union - { -#if defined(SDL_VIDEO_DRIVER_WINDOWS) - struct { - HWND hwnd; /**< The window for the message */ - UINT msg; /**< The type of message */ - WPARAM wParam; /**< WORD message parameter */ - LPARAM lParam; /**< LONG message parameter */ - } win; -#endif -#if defined(SDL_VIDEO_DRIVER_X11) - struct { - XEvent event; - } x11; -#endif -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) - struct { - DFBEvent event; - } dfb; -#endif -#if defined(SDL_VIDEO_DRIVER_COCOA) - struct - { - /* No Cocoa window events yet */ - } cocoa; -#endif -#if defined(SDL_VIDEO_DRIVER_UIKIT) - struct - { - /* No UIKit window events yet */ - } uikit; -#endif - /* Can't have an empty union */ - int dummy; - } msg; -}; - -/** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - */ -struct SDL_SysWMinfo -{ - SDL_version version; - SDL_SYSWM_TYPE subsystem; - union - { -#if defined(SDL_VIDEO_DRIVER_WINDOWS) - struct - { - HWND window; /**< The window handle */ - } win; -#endif -#if defined(SDL_VIDEO_DRIVER_WINRT) - struct - { - IInspectable * window; /**< The WinRT CoreWindow */ - } winrt; -#endif -#if defined(SDL_VIDEO_DRIVER_X11) - struct - { - Display *display; /**< The X11 display */ - Window window; /**< The X11 window */ - } x11; -#endif -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) - struct - { - IDirectFB *dfb; /**< The directfb main interface */ - IDirectFBWindow *window; /**< The directfb window handle */ - IDirectFBSurface *surface; /**< The directfb client surface */ - } dfb; -#endif -#if defined(SDL_VIDEO_DRIVER_COCOA) - struct - { - NSWindow *window; /* The Cocoa window */ - } cocoa; -#endif -#if defined(SDL_VIDEO_DRIVER_UIKIT) - struct - { - UIWindow *window; /* The UIKit window */ - } uikit; -#endif -#if defined(SDL_VIDEO_DRIVER_WAYLAND) - struct - { - struct wl_display *display; /**< Wayland display */ - struct wl_surface *surface; /**< Wayland surface */ - struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */ - } wl; -#endif -#if defined(SDL_VIDEO_DRIVER_MIR) - struct - { - MirConnection *connection; /**< Mir display server connection */ - MirSurface *surface; /**< Mir surface */ - } mir; -#endif - - /* Can't have an empty union */ - int dummy; - } info; -}; - -#endif /* SDL_PROTOTYPES_ONLY */ - -typedef struct SDL_SysWMinfo SDL_SysWMinfo; - -/* Function prototypes */ -/** - * \brief This function allows access to driver-dependent window information. - * - * \param window The window about which information is being requested - * \param info This structure must be initialized with the SDL version, and is - * then filled in with information about the given window. - * - * \return SDL_TRUE if the function is implemented and the version member of - * the \c info struct is valid, SDL_FALSE otherwise. - * - * You typically use this function like this: - * \code - * SDL_SysWMinfo info; - * SDL_VERSION(&info.version); - * if ( SDL_GetWindowWMInfo(window, &info) ) { ... } - * \endcode - */ -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, - SDL_SysWMinfo * info); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_syswm_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test.h b/Source/3rdParty/sdl/include/SDL_test.h deleted file mode 100644 index ae649a420..000000000 --- a/Source/3rdParty/sdl/include/SDL_test.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -#ifndef _SDL_test_h -#define _SDL_test_h - -#include "SDL.h" -#include "SDL_test_common.h" -#include "SDL_test_font.h" -#include "SDL_test_random.h" -#include "SDL_test_fuzzer.h" -#include "SDL_test_crc32.h" -#include "SDL_test_md5.h" -#include "SDL_test_log.h" -#include "SDL_test_assert.h" -#include "SDL_test_harness.h" -#include "SDL_test_images.h" -#include "SDL_test_compare.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Global definitions */ - -/* - * Note: Maximum size of SDLTest log message is less than SDLs limit - * to ensure we can fit additional information such as the timestamp. - */ -#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_assert.h b/Source/3rdParty/sdl/include/SDL_test_assert.h deleted file mode 100644 index 79c84d606..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_assert.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_assert.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - * - * Assert API for test code and test cases - * - */ - -#ifndef _SDL_test_assert_h -#define _SDL_test_assert_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Fails the assert. - */ -#define ASSERT_FAIL 0 - -/** - * \brief Passes the assert. - */ -#define ASSERT_PASS 1 - -/** - * \brief Assert that logs and break execution flow on failures. - * - * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). - * \param assertDescription Message to log with the assert describing it. - */ -void SDLTest_Assert(int assertCondition, const char *assertDescription, ...); - -/** - * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. - * - * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). - * \param assertDescription Message to log with the assert describing it. - * - * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. - */ -int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...); - -/** - * \brief Explicitely pass without checking an assertion condition. Updates assertion counter. - * - * \param assertDescription Message to log with the assert describing it. - */ -void SDLTest_AssertPass(const char *assertDescription, ...); - -/** - * \brief Resets the assert summary counters to zero. - */ -void SDLTest_ResetAssertSummary(); - -/** - * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. - */ -void SDLTest_LogAssertSummary(); - - -/** - * \brief Converts the current assert summary state to a test result. - * - * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT - */ -int SDLTest_AssertSummaryToTestResult(); - -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_assert_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_common.h b/Source/3rdParty/sdl/include/SDL_test_common.h deleted file mode 100644 index 45c9edafd..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_common.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_common.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* Ported from original test\common.h file. */ - -#ifndef _SDL_test_common_h -#define _SDL_test_common_h - -#include "SDL.h" - -#if defined(__PSP__) -#define DEFAULT_WINDOW_WIDTH 480 -#define DEFAULT_WINDOW_HEIGHT 272 -#else -#define DEFAULT_WINDOW_WIDTH 640 -#define DEFAULT_WINDOW_HEIGHT 480 -#endif - -#define VERBOSE_VIDEO 0x00000001 -#define VERBOSE_MODES 0x00000002 -#define VERBOSE_RENDER 0x00000004 -#define VERBOSE_EVENT 0x00000008 -#define VERBOSE_AUDIO 0x00000010 - -typedef struct -{ - /* SDL init flags */ - char **argv; - Uint32 flags; - Uint32 verbose; - - /* Video info */ - const char *videodriver; - int display; - const char *window_title; - const char *window_icon; - Uint32 window_flags; - int window_x; - int window_y; - int window_w; - int window_h; - int window_minW; - int window_minH; - int window_maxW; - int window_maxH; - int logical_w; - int logical_h; - float scale; - int depth; - int refresh_rate; - int num_windows; - SDL_Window **windows; - - /* Renderer info */ - const char *renderdriver; - Uint32 render_flags; - SDL_bool skip_renderer; - SDL_Renderer **renderers; - SDL_Texture **targets; - - /* Audio info */ - const char *audiodriver; - SDL_AudioSpec audiospec; - - /* GL settings */ - int gl_red_size; - int gl_green_size; - int gl_blue_size; - int gl_alpha_size; - int gl_buffer_size; - int gl_depth_size; - int gl_stencil_size; - int gl_double_buffer; - int gl_accum_red_size; - int gl_accum_green_size; - int gl_accum_blue_size; - int gl_accum_alpha_size; - int gl_stereo; - int gl_multisamplebuffers; - int gl_multisamplesamples; - int gl_retained_backing; - int gl_accelerated; - int gl_major_version; - int gl_minor_version; - int gl_debug; - int gl_profile_mask; -} SDLTest_CommonState; - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Function prototypes */ - -/** - * \brief Parse command line parameters and create common state. - * - * \param argv Array of command line parameters - * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) - * - * \returns Returns a newly allocated common state object. - */ -SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); - -/** - * \brief Process one common argument. - * - * \param state The common state describing the test window to create. - * \param index The index of the argument to process in argv[]. - * - * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. - */ -int SDLTest_CommonArg(SDLTest_CommonState * state, int index); - -/** - * \brief Returns common usage information - * - * \param state The common state describing the test window to create. - * - * \returns String with usage information - */ -const char *SDLTest_CommonUsage(SDLTest_CommonState * state); - -/** - * \brief Open test window. - * - * \param state The common state describing the test window to create. - * - * \returns True if initialization succeeded, false otherwise - */ -SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); - -/** - * \brief Common event handler for test windows. - * - * \param state The common state used to create test window. - * \param event The event to handle. - * \param done Flag indicating we are done. - * - */ -void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); - -/** - * \brief Close test window. - * - * \param state The common state used to create test window. - * - */ -void SDLTest_CommonQuit(SDLTest_CommonState * state); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_common_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_compare.h b/Source/3rdParty/sdl/include/SDL_test_compare.h deleted file mode 100644 index f1353a8d2..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_compare.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_compare.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - - Defines comparison functions (i.e. for surfaces). - -*/ - -#ifndef _SDL_test_compare_h -#define _SDL_test_compare_h - -#include "SDL.h" - -#include "SDL_test_images.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Compares a surface and with reference image data for equality - * - * \param surface Surface used in comparison - * \param referenceSurface Test Surface used in comparison - * \param allowable_error Allowable difference (squared) in blending accuracy. - * - * \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. - */ -int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_compare_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_crc32.h b/Source/3rdParty/sdl/include/SDL_test_crc32.h deleted file mode 100644 index a180fe3bb..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_crc32.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_crc32.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - - Implements CRC32 calculations (default output is Perl String::CRC32 compatible). - -*/ - -#ifndef _SDL_test_crc32_h -#define _SDL_test_crc32_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - - -/* ------------ Definitions --------- */ - -/* Definition shared by all CRC routines */ - -#ifndef CrcUint32 - #define CrcUint32 unsigned int -#endif -#ifndef CrcUint8 - #define CrcUint8 unsigned char -#endif - -#ifdef ORIGINAL_METHOD - #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ -#else - #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ -#endif - -/** - * Data structure for CRC32 (checksum) computation - */ - typedef struct { - CrcUint32 crc32_table[256]; /* CRC table */ - } SDLTest_Crc32Context; - -/* ---------- Function Prototypes ------------- */ - -/** - * /brief Initialize the CRC context - * - * Note: The function initializes the crc table required for all crc calculations. - * - * /param crcContext pointer to context variable - * - * /returns 0 for OK, -1 on error - * - */ - int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); - - -/** - * /brief calculate a crc32 from a data block - * - * /param crcContext pointer to context variable - * /param inBuf input buffer to checksum - * /param inLen length of input buffer - * /param crc32 pointer to Uint32 to store the final CRC into - * - * /returns 0 for OK, -1 on error - * - */ -int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); - -/* Same routine broken down into three steps */ -int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); -int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); -int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); - - -/** - * /brief clean up CRC context - * - * /param crcContext pointer to context variable - * - * /returns 0 for OK, -1 on error - * -*/ - -int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_crc32_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_font.h b/Source/3rdParty/sdl/include/SDL_test_font.h deleted file mode 100644 index 8d51d4a9b..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_font.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_font.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -#ifndef _SDL_test_font_h -#define _SDL_test_font_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Function prototypes */ - -#define FONT_CHARACTER_SIZE 8 - -/** - * \brief Draw a string in the currently set font. - * - * \param renderer The renderer to draw on. - * \param x The X coordinate of the upper left corner of the character. - * \param y The Y coordinate of the upper left corner of the character. - * \param c The character to draw. - * - * \returns Returns 0 on success, -1 on failure. - */ -int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); - -/** - * \brief Draw a string in the currently set font. - * - * \param renderer The renderer to draw on. - * \param x The X coordinate of the upper left corner of the string. - * \param y The Y coordinate of the upper left corner of the string. - * \param s The string to draw. - * - * \returns Returns 0 on success, -1 on failure. - */ -int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_font_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_fuzzer.h b/Source/3rdParty/sdl/include/SDL_test_fuzzer.h deleted file mode 100644 index 640180397..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_fuzzer.h +++ /dev/null @@ -1,384 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_fuzzer.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - - Data generators for fuzzing test data in a reproducible way. - -*/ - -#ifndef _SDL_test_fuzzer_h -#define _SDL_test_fuzzer_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - - -/* - Based on GSOC code by Markus Kauppila -*/ - - -/** - * \file - * Note: The fuzzer implementation uses a static instance of random context - * internally which makes it thread-UNsafe. - */ - -/** - * Initializes the fuzzer for a test - * - * /param execKey Execution "Key" that initializes the random number generator uniquely for the test. - * - */ -void SDLTest_FuzzerInit(Uint64 execKey); - - -/** - * Returns a random Uint8 - * - * \returns Generated integer - */ -Uint8 SDLTest_RandomUint8(); - -/** - * Returns a random Sint8 - * - * \returns Generated signed integer - */ -Sint8 SDLTest_RandomSint8(); - - -/** - * Returns a random Uint16 - * - * \returns Generated integer - */ -Uint16 SDLTest_RandomUint16(); - -/** - * Returns a random Sint16 - * - * \returns Generated signed integer - */ -Sint16 SDLTest_RandomSint16(); - - -/** - * Returns a random integer - * - * \returns Generated integer - */ -Sint32 SDLTest_RandomSint32(); - - -/** - * Returns a random positive integer - * - * \returns Generated integer - */ -Uint32 SDLTest_RandomUint32(); - -/** - * Returns random Uint64. - * - * \returns Generated integer - */ -Uint64 SDLTest_RandomUint64(); - - -/** - * Returns random Sint64. - * - * \returns Generated signed integer - */ -Sint64 SDLTest_RandomSint64(); - -/** - * \returns random float in range [0.0 - 1.0[ - */ -float SDLTest_RandomUnitFloat(); - -/** - * \returns random double in range [0.0 - 1.0[ - */ -double SDLTest_RandomUnitDouble(); - -/** - * \returns random float. - * - */ -float SDLTest_RandomFloat(); - -/** - * \returns random double. - * - */ -double SDLTest_RandomDouble(); - -/** - * Returns a random boundary value for Uint8 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set) - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or 0 with error set - */ -Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Uint16 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set) - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or 0 with error set - */ -Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Uint32 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set) - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or 0 with error set - */ -Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Uint64 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set) - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or 0 with error set - */ -Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Sint8 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 - * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or SINT8_MIN with error set - */ -Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); - - -/** - * Returns a random boundary value for Sint16 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100 - * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or SINT16_MIN with error set - */ -Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Sint32 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100 - * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value) - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or SINT32_MIN with error set - */ -Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); - -/** - * Returns a random boundary value for Sint64 within the given boundaries. - * Boundaries are inclusive, see the usage examples below. If validDomain - * is true, the function will only return valid boundaries, otherwise non-valid - * boundaries are also possible. - * If boundary1 > boundary2, the values are swapped - * - * Usage examples: - * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 - * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set - * - * \param boundary1 Lower boundary limit - * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid (=within the bounds) or not? - * - * \returns Random boundary value for the given range and domain or SINT64_MIN with error set - */ -Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); - - -/** - * Returns integer in range [min, max] (inclusive). - * Min and max values can be negative values. - * If Max in smaller tham min, then the values are swapped. - * Min and max are the same value, that value will be returned. - * - * \param min Minimum inclusive value of returned random number - * \param max Maximum inclusive value of returned random number - * - * \returns Generated random integer in range - */ -Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); - - -/** - * Generates random null-terminated string. The minimum length for - * the string is 1 character, maximum length for the string is 255 - * characters and it can contain ASCII characters from 32 to 126. - * - * Note: Returned string needs to be deallocated. - * - * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. - */ -char * SDLTest_RandomAsciiString(); - - -/** - * Generates random null-terminated string. The maximum length for - * the string is defined by the maxLength parameter. - * String can contain ASCII characters from 32 to 126. - * - * Note: Returned string needs to be deallocated. - * - * \param maxLength The maximum length of the generated string. - * - * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated. - */ -char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); - - -/** - * Generates random null-terminated string. The length for - * the string is defined by the size parameter. - * String can contain ASCII characters from 32 to 126. - * - * Note: Returned string needs to be deallocated. - * - * \param size The length of the generated string - * - * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated. - */ -char * SDLTest_RandomAsciiStringOfSize(int size); - -/** - * Returns the invocation count for the fuzzer since last ...FuzzerInit. - */ -int SDLTest_GetFuzzerInvocationCount(); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_fuzzer_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_harness.h b/Source/3rdParty/sdl/include/SDL_test_harness.h deleted file mode 100644 index 2c1e2ade8..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_harness.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_harness.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - Defines types for test case definitions and the test execution harness API. - - Based on original GSOC code by Markus Kauppila -*/ - -#ifndef _SDL_test_harness_h -#define _SDL_test_harness_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - - -/* ! Definitions for test case structures */ -#define TEST_ENABLED 1 -#define TEST_DISABLED 0 - -/* ! Definition of all the possible test return values of the test case method */ -#define TEST_ABORTED -1 -#define TEST_STARTED 0 -#define TEST_COMPLETED 1 -#define TEST_SKIPPED 2 - -/* ! Definition of all the possible test results for the harness */ -#define TEST_RESULT_PASSED 0 -#define TEST_RESULT_FAILED 1 -#define TEST_RESULT_NO_ASSERT 2 -#define TEST_RESULT_SKIPPED 3 -#define TEST_RESULT_SETUP_FAILURE 4 - -/* !< Function pointer to a test case setup function (run before every test) */ -typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); - -/* !< Function pointer to a test case function */ -typedef int (*SDLTest_TestCaseFp)(void *arg); - -/* !< Function pointer to a test case teardown function (run after every test) */ -typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); - -/** - * Holds information about a single test case. - */ -typedef struct SDLTest_TestCaseReference { - /* !< Func2Stress */ - SDLTest_TestCaseFp testCase; - /* !< Short name (or function name) "Func2Stress" */ - char *name; - /* !< Long name or full description "This test pushes func2() to the limit." */ - char *description; - /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ - int enabled; -} SDLTest_TestCaseReference; - -/** - * Holds information about a test suite (multiple test cases). - */ -typedef struct SDLTest_TestSuiteReference { - /* !< "PlatformSuite" */ - char *name; - /* !< The function that is run before each test. NULL skips. */ - SDLTest_TestCaseSetUpFp testSetUp; - /* !< The test cases that are run as part of the suite. Last item should be NULL. */ - const SDLTest_TestCaseReference **testCases; - /* !< The function that is run after each test. NULL skips. */ - SDLTest_TestCaseTearDownFp testTearDown; -} SDLTest_TestSuiteReference; - - -/** - * \brief Execute a test suite using the given run seed and execution key. - * - * \param testSuites Suites containing the test case. - * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. - * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. - * \param filter Filter specification. NULL disables. Case sensitive. - * \param testIterations Number of iterations to run each test case. - * - * \returns Test run result; 0 when all tests passed, 1 if any tests failed. - */ -int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_harness_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_images.h b/Source/3rdParty/sdl/include/SDL_test_images.h deleted file mode 100644 index 056279961..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_images.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_images.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - - Defines some images for tests. - -*/ - -#ifndef _SDL_test_images_h -#define _SDL_test_images_h - -#include "SDL.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - *Type for test images. - */ -typedef struct SDLTest_SurfaceImage_s { - int width; - int height; - unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ - const char *pixel_data; -} SDLTest_SurfaceImage_t; - -/* Test images */ -SDL_Surface *SDLTest_ImageBlit(); -SDL_Surface *SDLTest_ImageBlitColor(); -SDL_Surface *SDLTest_ImageBlitAlpha(); -SDL_Surface *SDLTest_ImageBlitBlendAdd(); -SDL_Surface *SDLTest_ImageBlitBlend(); -SDL_Surface *SDLTest_ImageBlitBlendMod(); -SDL_Surface *SDLTest_ImageBlitBlendNone(); -SDL_Surface *SDLTest_ImageBlitBlendAll(); -SDL_Surface *SDLTest_ImageFace(); -SDL_Surface *SDLTest_ImagePrimitives(); -SDL_Surface *SDLTest_ImagePrimitivesBlend(); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_images_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_log.h b/Source/3rdParty/sdl/include/SDL_test_log.h deleted file mode 100644 index 76ce10583..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_log.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_log.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - * - * Wrapper to log in the TEST category - * - */ - -#ifndef _SDL_test_log_h -#define _SDL_test_log_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Prints given message with a timestamp in the TEST category and INFO priority. - * - * \param fmt Message to be logged - */ -void SDLTest_Log(const char *fmt, ...); - -/** - * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. - * - * \param fmt Message to be logged - */ -void SDLTest_LogError(const char *fmt, ...); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_log_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_md5.h b/Source/3rdParty/sdl/include/SDL_test_md5.h deleted file mode 100644 index 029e164bf..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_md5.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_md5.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - *********************************************************************** - ** Header file for implementation of MD5 ** - ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** - ** Revised (for MD5): RLR 4/27/91 ** - ** -- G modified to have y&~z instead of y&z ** - ** -- FF, GG, HH modified to add in last register done ** - ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** - ** -- distinct additive constant for each step ** - ** -- round 4 added, working mod 7 ** - *********************************************************************** -*/ - -/* - *********************************************************************** - ** Message-digest routines: ** - ** To form the message digest for a message M ** - ** (1) Initialize a context buffer mdContext using MD5Init ** - ** (2) Call MD5Update on mdContext and M ** - ** (3) Call MD5Final on mdContext ** - ** The message digest is now in mdContext->digest[0...15] ** - *********************************************************************** -*/ - -#ifndef _SDL_test_md5_h -#define _SDL_test_md5_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* ------------ Definitions --------- */ - -/* typedef a 32-bit type */ - typedef unsigned long int MD5UINT4; - -/* Data structure for MD5 (Message-Digest) computation */ - typedef struct { - MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ - MD5UINT4 buf[4]; /* scratch buffer */ - unsigned char in[64]; /* input buffer */ - unsigned char digest[16]; /* actual digest after Md5Final call */ - } SDLTest_Md5Context; - -/* ---------- Function Prototypes ------------- */ - -/** - * /brief initialize the context - * - * /param mdContext pointer to context variable - * - * Note: The function initializes the message-digest context - * mdContext. Call before each new use of the context - - * all fields are set to zero. - */ - void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); - - -/** - * /brief update digest from variable length data - * - * /param mdContext pointer to context variable - * /param inBuf pointer to data array/string - * /param inLen length of data array/string - * - * Note: The function updates the message-digest context to account - * for the presence of each of the characters inBuf[0..inLen-1] - * in the message whose digest is being computed. -*/ - - void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, - unsigned int inLen); - - -/* - * /brief complete digest computation - * - * /param mdContext pointer to context variable - * - * Note: The function terminates the message-digest computation and - * ends with the desired message digest in mdContext.digest[0..15]. - * Always call before using the digest[] variable. -*/ - - void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_md5_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_test_random.h b/Source/3rdParty/sdl/include/SDL_test_random.h deleted file mode 100644 index 6c5660d80..000000000 --- a/Source/3rdParty/sdl/include/SDL_test_random.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_test_random.h - * - * Include file for SDL test framework. - * - * This code is a part of the SDL2_test library, not the main SDL library. - */ - -/* - - A "32-bit Multiply with carry random number generator. Very fast. - Includes a list of recommended multipliers. - - multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. - period: (a*2^31)-1 - -*/ - -#ifndef _SDL_test_random_h -#define _SDL_test_random_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* --- Definitions */ - -/* - * Macros that return a random number in a specific format. - */ -#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) - -/* - * Context structure for the random number generator state. - */ - typedef struct { - unsigned int a; - unsigned int x; - unsigned int c; - unsigned int ah; - unsigned int al; - } SDLTest_RandomContext; - - -/* --- Function prototypes */ - -/** - * \brief Initialize random number generator with two integers. - * - * Note: The random sequence of numbers returned by ...Random() is the - * same for the same two integers and has a period of 2^31. - * - * \param rndContext pointer to context structure - * \param xi integer that defines the random sequence - * \param ci integer that defines the random sequence - * - */ - void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, - unsigned int ci); - -/** - * \brief Initialize random number generator based on current system time. - * - * \param rndContext pointer to context structure - * - */ - void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); - - -/** - * \brief Initialize random number generator based on current system time. - * - * Note: ...RandomInit() or ...RandomInitTime() must have been called - * before using this function. - * - * \param rndContext pointer to context structure - * - * \returns A random number (32bit unsigned integer) - * - */ - unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_test_random_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_thread.h b/Source/3rdParty/sdl/include/SDL_thread.h deleted file mode 100644 index 4e48cc34c..000000000 --- a/Source/3rdParty/sdl/include/SDL_thread.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_thread_h -#define _SDL_thread_h - -/** - * \file SDL_thread.h - * - * Header for the SDL thread management routines. - */ - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -/* Thread synchronization primitives */ -#include "SDL_atomic.h" -#include "SDL_mutex.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* The SDL thread structure, defined in SDL_thread.c */ -struct SDL_Thread; -typedef struct SDL_Thread SDL_Thread; - -/* The SDL thread ID */ -typedef unsigned long SDL_threadID; - -/* Thread local storage ID, 0 is the invalid ID */ -typedef unsigned int SDL_TLSID; - -/** - * The SDL thread priority. - * - * \note On many systems you require special privileges to set high priority. - */ -typedef enum { - SDL_THREAD_PRIORITY_LOW, - SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH -} SDL_ThreadPriority; - -/** - * The function passed to SDL_CreateThread(). - * It is passed a void* user context parameter and returns an int. - */ -typedef int (SDLCALL * SDL_ThreadFunction) (void *data); - -#if defined(__WIN32__) && !defined(HAVE_LIBC) -/** - * \file SDL_thread.h - * - * We compile SDL into a DLL. This means, that it's the DLL which - * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will - * be initialized for those threads, and not the RTL of the calling - * application! - * - * To solve this, we make a little hack here. - * - * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's - * the application, then the RTL of the application will be used. - * - * So, in short: - * Always use the _beginthread() and _endthread() of the calling runtime - * library! - */ -#define SDL_PASSED_BEGINTHREAD_ENDTHREAD -#include /* This has _beginthread() and _endthread() defined! */ - -typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall * - func) (void - *), - void *arg, unsigned, - unsigned *threadID); -typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); - -/** - * Create a thread. - */ -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); - -/** - * Create a thread. - */ -#if defined(SDL_CreateThread) && SDL_DYNAMIC_API -#undef SDL_CreateThread -#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) -#else -#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) -#endif - -#else - -/** - * Create a thread. - * - * Thread naming is a little complicated: Most systems have very small - * limits for the string length (Haiku has 32 bytes, Linux currently has 16, - * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll - * have to see what happens with your system's debugger. The name should be - * UTF-8 (but using the naming limits of C identifiers is a better bet). - * There are no requirements for thread naming conventions, so long as the - * string is null-terminated UTF-8, but these guidelines are helpful in - * choosing a name: - * - * http://stackoverflow.com/questions/149932/naming-conventions-for-threads - * - * If a system imposes requirements, SDL will try to munge the string for - * it (truncate, etc), but the original string contents will be available - * from SDL_GetThreadName(). - */ -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); - -#endif - -/** - * Get the thread name, as it was specified in SDL_CreateThread(). - * This function returns a pointer to a UTF-8 string that names the - * specified thread, or NULL if it doesn't have a name. This is internal - * memory, not to be free()'d by the caller, and remains valid until the - * specified thread is cleaned up by SDL_WaitThread(). - */ -extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); - -/** - * Get the thread identifier for the current thread. - */ -extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); - -/** - * Get the thread identifier for the specified thread. - * - * Equivalent to SDL_ThreadID() if the specified thread is NULL. - */ -extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); - -/** - * Set the priority for the current thread - */ -extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); - -/** - * Wait for a thread to finish. Threads that haven't been detached will - * remain (as a "zombie") until this function cleans them up. Not doing so - * is a resource leak. - * - * Once a thread has been cleaned up through this function, the SDL_Thread - * that references it becomes invalid and should not be referenced again. - * As such, only one thread may call SDL_WaitThread() on another. - * - * The return code for the thread function is placed in the area - * pointed to by \c status, if \c status is not NULL. - * - * You may not wait on a thread that has been used in a call to - * SDL_DetachThread(). Use either that function or this one, but not - * both, or behavior is undefined. - * - * It is safe to pass NULL to this function; it is a no-op. - */ -extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); - -/** - * A thread may be "detached" to signify that it should not remain until - * another thread has called SDL_WaitThread() on it. Detaching a thread - * is useful for long-running threads that nothing needs to synchronize - * with or further manage. When a detached thread is done, it simply - * goes away. - * - * There is no way to recover the return code of a detached thread. If you - * need this, don't detach the thread and instead use SDL_WaitThread(). - * - * Once a thread is detached, you should usually assume the SDL_Thread isn't - * safe to reference again, as it will become invalid immediately upon - * the detached thread's exit, instead of remaining until someone has called - * SDL_WaitThread() to finally clean it up. As such, don't detach the same - * thread more than once. - * - * If a thread has already exited when passed to SDL_DetachThread(), it will - * stop waiting for a call to SDL_WaitThread() and clean up immediately. - * It is not safe to detach a thread that might be used with SDL_WaitThread(). - * - * You may not call SDL_WaitThread() on a thread that has been detached. - * Use either that function or this one, but not both, or behavior is - * undefined. - * - * It is safe to pass NULL to this function; it is a no-op. - */ -extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); - -/** - * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific. - * - * \return The newly created thread local storage identifier, or 0 on error - * - * \code - * static SDL_SpinLock tls_lock; - * static SDL_TLSID thread_local_storage; - * - * void SetMyThreadData(void *value) - * { - * if (!thread_local_storage) { - * SDL_AtomicLock(&tls_lock); - * if (!thread_local_storage) { - * thread_local_storage = SDL_TLSCreate(); - * } - * SDL_AtomicUnLock(&tls_lock); - * } - * SDL_TLSSet(thread_local_storage, value); - * } - * - * void *GetMyThreadData(void) - * { - * return SDL_TLSGet(thread_local_storage); - * } - * \endcode - * - * \sa SDL_TLSGet() - * \sa SDL_TLSSet() - */ -extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void); - -/** - * \brief Get the value associated with a thread local storage ID for the current thread. - * - * \param id The thread local storage ID - * - * \return The value associated with the ID for the current thread, or NULL if no value has been set. - * - * \sa SDL_TLSCreate() - * \sa SDL_TLSSet() - */ -extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); - -/** - * \brief Set the value associated with a thread local storage ID for the current thread. - * - * \param id The thread local storage ID - * \param value The value to associate with the ID for the current thread - * \param destructor A function called when the thread exits, to free the value. - * - * \return 0 on success, -1 on error - * - * \sa SDL_TLSCreate() - * \sa SDL_TLSGet() - */ -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_thread_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_timer.h b/Source/3rdParty/sdl/include/SDL_timer.h deleted file mode 100644 index a48e0466e..000000000 --- a/Source/3rdParty/sdl/include/SDL_timer.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_timer_h -#define _SDL_timer_h - -/** - * \file SDL_timer.h - * - * Header for the SDL time management routines. - */ - -#include "SDL_stdinc.h" -#include "SDL_error.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Get the number of milliseconds since the SDL library initialization. - * - * \note This value wraps if the program runs for more than ~49 days. - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); - -/** - * \brief Compare SDL ticks values, and return true if A has passed B - * - * e.g. if you want to wait 100 ms, you could do this: - * Uint32 timeout = SDL_GetTicks() + 100; - * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { - * ... do work until timeout has elapsed - * } - */ -#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) - -/** - * \brief Get the current value of the high resolution counter - */ -extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); - -/** - * \brief Get the count per second of the high resolution counter - */ -extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); - -/** - * \brief Wait a specified number of milliseconds before returning. - */ -extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); - -/** - * Function prototype for the timer callback function. - * - * The callback function is passed the current timer interval and returns - * the next timer interval. If the returned value is the same as the one - * passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. - */ -typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); - -/** - * Definition of the timer ID type. - */ -typedef int SDL_TimerID; - -/** - * \brief Add a new timer to the pool of timers already running. - * - * \return A timer ID, or NULL when an error occurs. - */ -extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, - SDL_TimerCallback callback, - void *param); - -/** - * \brief Remove a timer knowing its ID. - * - * \return A boolean value indicating success or failure. - * - * \warning It is not safe to remove a timer multiple times. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_timer_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_touch.h b/Source/3rdParty/sdl/include/SDL_touch.h deleted file mode 100644 index 017deb28b..000000000 --- a/Source/3rdParty/sdl/include/SDL_touch.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_touch.h - * - * Include file for SDL touch event handling. - */ - -#ifndef _SDL_touch_h -#define _SDL_touch_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -typedef Sint64 SDL_TouchID; -typedef Sint64 SDL_FingerID; - -typedef struct SDL_Finger -{ - SDL_FingerID id; - float x; - float y; - float pressure; -} SDL_Finger; - -/* Used as the device ID for mouse events simulated with touch input */ -#define SDL_TOUCH_MOUSEID ((Uint32)-1) - - -/* Function prototypes */ - -/** - * \brief Get the number of registered touch devices. - */ -extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); - -/** - * \brief Get the touch ID with the given index, or 0 if the index is invalid. - */ -extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); - -/** - * \brief Get the number of active fingers for a given touch device. - */ -extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); - -/** - * \brief Get the finger object of the given touch, with the given index. - */ -extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_touch_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_types.h b/Source/3rdParty/sdl/include/SDL_types.h deleted file mode 100644 index cd3ba33cd..000000000 --- a/Source/3rdParty/sdl/include/SDL_types.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_types.h - * - * \deprecated - */ - -/* DEPRECATED */ -#include "SDL_stdinc.h" diff --git a/Source/3rdParty/sdl/include/SDL_version.h b/Source/3rdParty/sdl/include/SDL_version.h deleted file mode 100644 index d02898bbb..000000000 --- a/Source/3rdParty/sdl/include/SDL_version.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_version.h - * - * This header defines the current SDL version. - */ - -#ifndef _SDL_version_h -#define _SDL_version_h - -#include "SDL_stdinc.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Information the version of SDL in use. - * - * Represents the library's version as three levels: major revision - * (increments with massive changes, additions, and enhancements), - * minor revision (increments with backwards-compatible changes to the - * major revision), and patchlevel (increments with fixes to the minor - * revision). - * - * \sa SDL_VERSION - * \sa SDL_GetVersion - */ -typedef struct SDL_version -{ - Uint8 major; /**< major version */ - Uint8 minor; /**< minor version */ - Uint8 patch; /**< update version */ -} SDL_version; - -/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL -*/ -#define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 3 - -/** - * \brief Macro to determine SDL version program was compiled against. - * - * This macro fills in a SDL_version structure with the version of the - * library you compiled against. This is determined by what header the - * compiler uses. Note that if you dynamically linked the library, you might - * have a slightly newer or older version at runtime. That version can be - * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), - * is not a macro. - * - * \param x A pointer to a SDL_version struct to initialize. - * - * \sa SDL_version - * \sa SDL_GetVersion - */ -#define SDL_VERSION(x) \ -{ \ - (x)->major = SDL_MAJOR_VERSION; \ - (x)->minor = SDL_MINOR_VERSION; \ - (x)->patch = SDL_PATCHLEVEL; \ -} - -/** - * This macro turns the version numbers into a numeric value: - * \verbatim - (1,2,3) -> (1203) - \endverbatim - * - * This assumes that there will never be more than 100 patchlevels. - */ -#define SDL_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) - -/** - * This is the version number macro for the current SDL version. - */ -#define SDL_COMPILEDVERSION \ - SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) - -/** - * This macro will evaluate to true if compiled with SDL at least X.Y.Z. - */ -#define SDL_VERSION_ATLEAST(X, Y, Z) \ - (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) - -/** - * \brief Get the version of SDL that is linked against your program. - * - * If you are linking to SDL dynamically, then it is possible that the - * current version will be different than the version you compiled against. - * This function returns the current version, while SDL_VERSION() is a - * macro that tells you what version you compiled with. - * - * \code - * SDL_version compiled; - * SDL_version linked; - * - * SDL_VERSION(&compiled); - * SDL_GetVersion(&linked); - * printf("We compiled against SDL version %d.%d.%d ...\n", - * compiled.major, compiled.minor, compiled.patch); - * printf("But we linked against SDL version %d.%d.%d.\n", - * linked.major, linked.minor, linked.patch); - * \endcode - * - * This function may be called safely at any time, even before SDL_Init(). - * - * \sa SDL_VERSION - */ -extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); - -/** - * \brief Get the code revision of SDL that is linked against your program. - * - * Returns an arbitrary string (a hash value) uniquely identifying the - * exact revision of the SDL library in use, and is only useful in comparing - * against other revisions. It is NOT an incrementing number. - */ -extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); - -/** - * \brief Get the revision number of SDL that is linked against your program. - * - * Returns a number uniquely identifying the exact revision of the SDL - * library in use. It is an incrementing number based on commits to - * hg.libsdl.org. - */ -extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_version_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/SDL_video.h b/Source/3rdParty/sdl/include/SDL_video.h deleted file mode 100644 index 49ea37ad0..000000000 --- a/Source/3rdParty/sdl/include/SDL_video.h +++ /dev/null @@ -1,979 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_video.h - * - * Header file for SDL video functions. - */ - -#ifndef _SDL_video_h -#define _SDL_video_h - -#include "SDL_stdinc.h" -#include "SDL_pixels.h" -#include "SDL_rect.h" -#include "SDL_surface.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief The structure that defines a display mode - * - * \sa SDL_GetNumDisplayModes() - * \sa SDL_GetDisplayMode() - * \sa SDL_GetDesktopDisplayMode() - * \sa SDL_GetCurrentDisplayMode() - * \sa SDL_GetClosestDisplayMode() - * \sa SDL_SetWindowDisplayMode() - * \sa SDL_GetWindowDisplayMode() - */ -typedef struct -{ - Uint32 format; /**< pixel format */ - int w; /**< width */ - int h; /**< height */ - int refresh_rate; /**< refresh rate (or zero for unspecified) */ - void *driverdata; /**< driver-specific data, initialize to 0 */ -} SDL_DisplayMode; - -/** - * \brief The type used to identify a window - * - * \sa SDL_CreateWindow() - * \sa SDL_CreateWindowFrom() - * \sa SDL_DestroyWindow() - * \sa SDL_GetWindowData() - * \sa SDL_GetWindowFlags() - * \sa SDL_GetWindowGrab() - * \sa SDL_GetWindowPosition() - * \sa SDL_GetWindowSize() - * \sa SDL_GetWindowTitle() - * \sa SDL_HideWindow() - * \sa SDL_MaximizeWindow() - * \sa SDL_MinimizeWindow() - * \sa SDL_RaiseWindow() - * \sa SDL_RestoreWindow() - * \sa SDL_SetWindowData() - * \sa SDL_SetWindowFullscreen() - * \sa SDL_SetWindowGrab() - * \sa SDL_SetWindowIcon() - * \sa SDL_SetWindowPosition() - * \sa SDL_SetWindowSize() - * \sa SDL_SetWindowBordered() - * \sa SDL_SetWindowTitle() - * \sa SDL_ShowWindow() - */ -typedef struct SDL_Window SDL_Window; - -/** - * \brief The flags on a window - * - * \sa SDL_GetWindowFlags() - */ -typedef enum -{ - SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ - SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ - SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ - SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ - SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ - SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ - SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ - SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ - SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ - SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ - SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ - SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), - SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */ -} SDL_WindowFlags; - -/** - * \brief Used to indicate that you don't care what the window position is. - */ -#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 -#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) -#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) -#define SDL_WINDOWPOS_ISUNDEFINED(X) \ - (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) - -/** - * \brief Used to indicate that the window position should be centered. - */ -#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000 -#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) -#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) -#define SDL_WINDOWPOS_ISCENTERED(X) \ - (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) - -/** - * \brief Event subtype for window events - */ -typedef enum -{ - SDL_WINDOWEVENT_NONE, /**< Never used */ - SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ - SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ - SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be - redrawn */ - SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 - */ - SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ - SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ - SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ - SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ - SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size - and position */ - SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ - SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ - SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ - SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ - SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the - window be closed */ -} SDL_WindowEventID; - -/** - * \brief An opaque handle to an OpenGL context. - */ -typedef void *SDL_GLContext; - -/** - * \brief OpenGL configuration attributes - */ -typedef enum -{ - SDL_GL_RED_SIZE, - SDL_GL_GREEN_SIZE, - SDL_GL_BLUE_SIZE, - SDL_GL_ALPHA_SIZE, - SDL_GL_BUFFER_SIZE, - SDL_GL_DOUBLEBUFFER, - SDL_GL_DEPTH_SIZE, - SDL_GL_STENCIL_SIZE, - SDL_GL_ACCUM_RED_SIZE, - SDL_GL_ACCUM_GREEN_SIZE, - SDL_GL_ACCUM_BLUE_SIZE, - SDL_GL_ACCUM_ALPHA_SIZE, - SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES, - SDL_GL_ACCELERATED_VISUAL, - SDL_GL_RETAINED_BACKING, - SDL_GL_CONTEXT_MAJOR_VERSION, - SDL_GL_CONTEXT_MINOR_VERSION, - SDL_GL_CONTEXT_EGL, - SDL_GL_CONTEXT_FLAGS, - SDL_GL_CONTEXT_PROFILE_MASK, - SDL_GL_SHARE_WITH_CURRENT_CONTEXT, - SDL_GL_FRAMEBUFFER_SRGB_CAPABLE -} SDL_GLattr; - -typedef enum -{ - SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, - SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, - SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ -} SDL_GLprofile; - -typedef enum -{ - SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, - SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, - SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, - SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 -} SDL_GLcontextFlag; - - -/* Function prototypes */ - -/** - * \brief Get the number of video drivers compiled into SDL - * - * \sa SDL_GetVideoDriver() - */ -extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); - -/** - * \brief Get the name of a built in video driver. - * - * \note The video drivers are presented in the order in which they are - * normally checked during initialization. - * - * \sa SDL_GetNumVideoDrivers() - */ -extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); - -/** - * \brief Initialize the video subsystem, optionally specifying a video driver. - * - * \param driver_name Initialize a specific driver by name, or NULL for the - * default video driver. - * - * \return 0 on success, -1 on error - * - * This function initializes the video subsystem; setting up a connection - * to the window manager, etc, and determines the available display modes - * and pixel formats, but does not initialize a window or graphics mode. - * - * \sa SDL_VideoQuit() - */ -extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); - -/** - * \brief Shuts down the video subsystem. - * - * This function closes all windows, and restores the original video mode. - * - * \sa SDL_VideoInit() - */ -extern DECLSPEC void SDLCALL SDL_VideoQuit(void); - -/** - * \brief Returns the name of the currently initialized video driver. - * - * \return The name of the current video driver or NULL if no driver - * has been initialized - * - * \sa SDL_GetNumVideoDrivers() - * \sa SDL_GetVideoDriver() - */ -extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); - -/** - * \brief Returns the number of available video displays. - * - * \sa SDL_GetDisplayBounds() - */ -extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); - -/** - * \brief Get the name of a display in UTF-8 encoding - * - * \return The name of a display, or NULL for an invalid display index. - * - * \sa SDL_GetNumVideoDisplays() - */ -extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); - -/** - * \brief Get the desktop area represented by a display, with the primary - * display located at 0,0 - * - * \return 0 on success, or -1 if the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - */ -extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); - -/** - * \brief Returns the number of available display modes. - * - * \sa SDL_GetDisplayMode() - */ -extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); - -/** - * \brief Fill in information about a specific display mode. - * - * \note The display modes are sorted in this priority: - * \li bits per pixel -> more colors to fewer colors - * \li width -> largest to smallest - * \li height -> largest to smallest - * \li refresh rate -> highest to lowest - * - * \sa SDL_GetNumDisplayModes() - */ -extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, - SDL_DisplayMode * mode); - -/** - * \brief Fill in information about the desktop display mode. - */ -extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); - -/** - * \brief Fill in information about the current display mode. - */ -extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); - - -/** - * \brief Get the closest match to the requested display mode. - * - * \param displayIndex The index of display from which mode should be queried. - * \param mode The desired display mode - * \param closest A pointer to a display mode to be filled in with the closest - * match of the available display modes. - * - * \return The passed in value \c closest, or NULL if no matching video mode - * was available. - * - * The available display modes are scanned, and \c closest is filled in with the - * closest mode matching the requested mode and returned. The mode format and - * refresh_rate default to the desktop mode if they are 0. The modes are - * scanned with size being first priority, format being second priority, and - * finally checking the refresh_rate. If all the available modes are too - * small, then NULL is returned. - * - * \sa SDL_GetNumDisplayModes() - * \sa SDL_GetDisplayMode() - */ -extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); - -/** - * \brief Get the display index associated with a window. - * - * \return the display index of the display containing the center of the - * window, or -1 on error. - */ -extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); - -/** - * \brief Set the display mode used when a fullscreen window is visible. - * - * By default the window's dimensions and the desktop format and refresh rate - * are used. - * - * \param window The window for which the display mode should be set. - * \param mode The mode to use, or NULL for the default mode. - * - * \return 0 on success, or -1 if setting the display mode failed. - * - * \sa SDL_GetWindowDisplayMode() - * \sa SDL_SetWindowFullscreen() - */ -extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, - const SDL_DisplayMode - * mode); - -/** - * \brief Fill in information about the display mode used when a fullscreen - * window is visible. - * - * \sa SDL_SetWindowDisplayMode() - * \sa SDL_SetWindowFullscreen() - */ -extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, - SDL_DisplayMode * mode); - -/** - * \brief Get the pixel format associated with the window. - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); - -/** - * \brief Create a window with the specified position, dimensions, and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window. - * \param h The height of the window. - * \param flags The flags for the window, a mask of any of the following: - * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, - * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, - * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, - * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_ALLOW_HIGHDPI. - * - * \return The id of the window created, or zero if window creation failed. - * - * \sa SDL_DestroyWindow() - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, - int x, int y, int w, - int h, Uint32 flags); - -/** - * \brief Create an SDL window from an existing native window. - * - * \param data A pointer to driver-dependent window creation data - * - * \return The id of the window created, or zero if window creation failed. - * - * \sa SDL_DestroyWindow() - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); - -/** - * \brief Get the numeric ID of a window, for logging purposes. - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); - -/** - * \brief Get a window from a stored ID, or NULL if it doesn't exist. - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); - -/** - * \brief Get the window flags. - */ -extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); - -/** - * \brief Set the title of a window, in UTF-8 format. - * - * \sa SDL_GetWindowTitle() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, - const char *title); - -/** - * \brief Get the title of a window, in UTF-8 format. - * - * \sa SDL_SetWindowTitle() - */ -extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); - -/** - * \brief Set the icon for a window. - * - * \param window The window for which the icon should be set. - * \param icon The icon for the window. - */ -extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, - SDL_Surface * icon); - -/** - * \brief Associate an arbitrary named pointer with a window. - * - * \param window The window to associate with the pointer. - * \param name The name of the pointer. - * \param userdata The associated pointer. - * - * \return The previous value associated with 'name' - * - * \note The name is case-sensitive. - * - * \sa SDL_GetWindowData() - */ -extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, - const char *name, - void *userdata); - -/** - * \brief Retrieve the data pointer associated with a window. - * - * \param window The window to query. - * \param name The name of the pointer. - * - * \return The value associated with 'name' - * - * \sa SDL_SetWindowData() - */ -extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, - const char *name); - -/** - * \brief Set the position of a window. - * - * \param window The window to reposition. - * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or - ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or - ::SDL_WINDOWPOS_UNDEFINED. - * - * \note The window coordinate origin is the upper left of the display. - * - * \sa SDL_GetWindowPosition() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, - int x, int y); - -/** - * \brief Get the position of a window. - * - * \param window The window to query. - * \param x Pointer to variable for storing the x position, may be NULL - * \param y Pointer to variable for storing the y position, may be NULL - * - * \sa SDL_SetWindowPosition() - */ -extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, - int *x, int *y); - -/** - * \brief Set the size of a window's client area. - * - * \param window The window to resize. - * \param w The width of the window, must be >0 - * \param h The height of the window, must be >0 - * - * \note You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. - * - * \sa SDL_GetWindowSize() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, - int h); - -/** - * \brief Get the size of a window's client area. - * - * \param window The window to query. - * \param w Pointer to variable for storing the width, may be NULL - * \param h Pointer to variable for storing the height, may be NULL - * - * \sa SDL_SetWindowSize() - */ -extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, - int *h); - -/** - * \brief Set the minimum size of a window's client area. - * - * \param window The window to set a new minimum size. - * \param min_w The minimum width of the window, must be >0 - * \param min_h The minimum height of the window, must be >0 - * - * \note You can't change the minimum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * \sa SDL_GetWindowMinimumSize() - * \sa SDL_SetWindowMaximumSize() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, - int min_w, int min_h); - -/** - * \brief Get the minimum size of a window's client area. - * - * \param window The window to query. - * \param w Pointer to variable for storing the minimum width, may be NULL - * \param h Pointer to variable for storing the minimum height, may be NULL - * - * \sa SDL_GetWindowMaximumSize() - * \sa SDL_SetWindowMinimumSize() - */ -extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, - int *w, int *h); - -/** - * \brief Set the maximum size of a window's client area. - * - * \param window The window to set a new maximum size. - * \param max_w The maximum width of the window, must be >0 - * \param max_h The maximum height of the window, must be >0 - * - * \note You can't change the maximum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * \sa SDL_GetWindowMaximumSize() - * \sa SDL_SetWindowMinimumSize() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, - int max_w, int max_h); - -/** - * \brief Get the maximum size of a window's client area. - * - * \param window The window to query. - * \param w Pointer to variable for storing the maximum width, may be NULL - * \param h Pointer to variable for storing the maximum height, may be NULL - * - * \sa SDL_GetWindowMinimumSize() - * \sa SDL_SetWindowMaximumSize() - */ -extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, - int *w, int *h); - -/** - * \brief Set the border state of a window. - * - * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and - * add or remove the border from the actual window. This is a no-op if the - * window's border already matches the requested state. - * - * \param window The window of which to change the border state. - * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. - * - * \note You can't change the border state of a fullscreen window. - * - * \sa SDL_GetWindowFlags() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, - SDL_bool bordered); - -/** - * \brief Show a window. - * - * \sa SDL_HideWindow() - */ -extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); - -/** - * \brief Hide a window. - * - * \sa SDL_ShowWindow() - */ -extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); - -/** - * \brief Raise a window above other windows and set the input focus. - */ -extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); - -/** - * \brief Make a window as large as possible. - * - * \sa SDL_RestoreWindow() - */ -extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); - -/** - * \brief Minimize a window to an iconic representation. - * - * \sa SDL_RestoreWindow() - */ -extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); - -/** - * \brief Restore the size and position of a minimized or maximized window. - * - * \sa SDL_MaximizeWindow() - * \sa SDL_MinimizeWindow() - */ -extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); - -/** - * \brief Set a window's fullscreen state. - * - * \return 0 on success, or -1 if setting the display mode failed. - * - * \sa SDL_SetWindowDisplayMode() - * \sa SDL_GetWindowDisplayMode() - */ -extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, - Uint32 flags); - -/** - * \brief Get the SDL surface associated with the window. - * - * \return The window's framebuffer surface, or NULL on error. - * - * A new surface will be created with the optimal format for the window, - * if necessary. This surface will be freed when the window is destroyed. - * - * \note You may not combine this with 3D or the rendering API on this window. - * - * \sa SDL_UpdateWindowSurface() - * \sa SDL_UpdateWindowSurfaceRects() - */ -extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); - -/** - * \brief Copy the window surface to the screen. - * - * \return 0 on success, or -1 on error. - * - * \sa SDL_GetWindowSurface() - * \sa SDL_UpdateWindowSurfaceRects() - */ -extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); - -/** - * \brief Copy a number of rectangles on the window surface to the screen. - * - * \return 0 on success, or -1 on error. - * - * \sa SDL_GetWindowSurface() - * \sa SDL_UpdateWindowSurfaceRect() - */ -extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, - const SDL_Rect * rects, - int numrects); - -/** - * \brief Set a window's input grab mode. - * - * \param window The window for which the input grab mode should be set. - * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. - * - * \sa SDL_GetWindowGrab() - */ -extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, - SDL_bool grabbed); - -/** - * \brief Get a window's input grab mode. - * - * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. - * - * \sa SDL_SetWindowGrab() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); - -/** - * \brief Set the brightness (gamma correction) for a window. - * - * \return 0 on success, or -1 if setting the brightness isn't supported. - * - * \sa SDL_GetWindowBrightness() - * \sa SDL_SetWindowGammaRamp() - */ -extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); - -/** - * \brief Get the brightness (gamma correction) for a window. - * - * \return The last brightness value passed to SDL_SetWindowBrightness() - * - * \sa SDL_SetWindowBrightness() - */ -extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); - -/** - * \brief Set the gamma ramp for a window. - * - * \param window The window for which the gamma ramp should be set. - * \param red The translation table for the red channel, or NULL. - * \param green The translation table for the green channel, or NULL. - * \param blue The translation table for the blue channel, or NULL. - * - * \return 0 on success, or -1 if gamma ramps are unsupported. - * - * Set the gamma translation table for the red, green, and blue channels - * of the video hardware. Each table is an array of 256 16-bit quantities, - * representing a mapping between the input and output for that channel. - * The input is the index into the array, and the output is the 16-bit - * gamma value at that index, scaled to the output color precision. - * - * \sa SDL_GetWindowGammaRamp() - */ -extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, - const Uint16 * red, - const Uint16 * green, - const Uint16 * blue); - -/** - * \brief Get the gamma ramp for a window. - * - * \param window The window from which the gamma ramp should be queried. - * \param red A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the red channel, or NULL. - * \param green A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the green channel, or NULL. - * \param blue A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the blue channel, or NULL. - * - * \return 0 on success, or -1 if gamma ramps are unsupported. - * - * \sa SDL_SetWindowGammaRamp() - */ -extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, - Uint16 * red, - Uint16 * green, - Uint16 * blue); - -/** - * \brief Destroy a window. - */ -extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); - - -/** - * \brief Returns whether the screensaver is currently enabled (default on). - * - * \sa SDL_EnableScreenSaver() - * \sa SDL_DisableScreenSaver() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); - -/** - * \brief Allow the screen to be blanked by a screensaver - * - * \sa SDL_IsScreenSaverEnabled() - * \sa SDL_DisableScreenSaver() - */ -extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); - -/** - * \brief Prevent the screen from being blanked by a screensaver - * - * \sa SDL_IsScreenSaverEnabled() - * \sa SDL_EnableScreenSaver() - */ -extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); - - -/** - * \name OpenGL support functions - */ -/* @{ */ - -/** - * \brief Dynamically load an OpenGL library. - * - * \param path The platform dependent OpenGL library name, or NULL to open the - * default OpenGL library. - * - * \return 0 on success, or -1 if the library couldn't be loaded. - * - * This should be done after initializing the video driver, but before - * creating any OpenGL windows. If no OpenGL library is loaded, the default - * library will be loaded upon creation of the first OpenGL window. - * - * \note If you do this, you need to retrieve all of the GL functions used in - * your program from the dynamic library using SDL_GL_GetProcAddress(). - * - * \sa SDL_GL_GetProcAddress() - * \sa SDL_GL_UnloadLibrary() - */ -extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); - -/** - * \brief Get the address of an OpenGL function. - */ -extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); - -/** - * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). - * - * \sa SDL_GL_LoadLibrary() - */ -extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); - -/** - * \brief Return true if an OpenGL extension is supported for the current - * context. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char - *extension); - -/** - * \brief Reset all previously set OpenGL context attributes to their default values - */ -extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); - -/** - * \brief Set an OpenGL window attribute before window creation. - */ -extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); - -/** - * \brief Get the actual value for an attribute from the current context. - */ -extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); - -/** - * \brief Create an OpenGL context for use with an OpenGL window, and make it - * current. - * - * \sa SDL_GL_DeleteContext() - */ -extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * - window); - -/** - * \brief Set up an OpenGL context for rendering into an OpenGL window. - * - * \note The context must have been created with a compatible window. - */ -extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, - SDL_GLContext context); - -/** - * \brief Get the currently active OpenGL window. - */ -extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); - -/** - * \brief Get the currently active OpenGL context. - */ -extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); - -/** - * \brief Get the size of a window's underlying drawable (for use with glViewport). - * - * \param window Window from which the drawable size should be queried - * \param w Pointer to variable for storing the width, may be NULL - * \param h Pointer to variable for storing the height, may be NULL - * - * This may differ from SDL_GetWindowSize if we're rendering to a high-DPI - * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a - * platform with high-DPI support (Apple calls this "Retina"), and not disabled - * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. - * - * \sa SDL_GetWindowSize() - * \sa SDL_CreateWindow() - */ -extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, - int *h); - -/** - * \brief Set the swap interval for the current OpenGL context. - * - * \param interval 0 for immediate updates, 1 for updates synchronized with the - * vertical retrace. If the system supports it, you may - * specify -1 to allow late swaps to happen immediately - * instead of waiting for the next retrace. - * - * \return 0 on success, or -1 if setting the swap interval is not supported. - * - * \sa SDL_GL_GetSwapInterval() - */ -extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); - -/** - * \brief Get the swap interval for the current OpenGL context. - * - * \return 0 if there is no vertical retrace synchronization, 1 if the buffer - * swap is synchronized with the vertical retrace, and -1 if late - * swaps happen immediately instead of waiting for the next retrace. - * If the system can't determine the swap interval, or there isn't a - * valid current context, this will return 0 as a safe default. - * - * \sa SDL_GL_SetSwapInterval() - */ -extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); - -/** - * \brief Swap the OpenGL buffers for a window, if double-buffering is - * supported. - */ -extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); - -/** - * \brief Delete an OpenGL context. - * - * \sa SDL_GL_CreateContext() - */ -extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); - -/* @} *//* OpenGL support functions */ - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_video_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/include/begin_code.h b/Source/3rdParty/sdl/include/begin_code.h deleted file mode 100644 index f37ee3696..000000000 --- a/Source/3rdParty/sdl/include/begin_code.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file begin_code.h - * - * This file sets things up for C dynamic library function definitions, - * static inlined functions, and structures aligned at 4-byte alignment. - * If you don't like ugly C preprocessor code, don't look at this file. :) - */ - -/* This shouldn't be nested -- included it around code only. */ -#ifdef _begin_code_h -#error Nested inclusion of begin_code.h -#endif -#define _begin_code_h - -#ifndef SDL_DEPRECATED -# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ -# define SDL_DEPRECATED __attribute__((deprecated)) -# else -# define SDL_DEPRECATED -# endif -#endif - -/* Some compilers use a special export keyword */ -#ifndef DECLSPEC -# if defined(__WIN32__) || defined(__WINRT__) -# ifdef __BORLANDC__ -# ifdef BUILD_SDL -# define DECLSPEC -# else -# define DECLSPEC __declspec(dllimport) -# endif -# else -# define DECLSPEC __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && __GNUC__ >= 4 -# define DECLSPEC __attribute__ ((visibility("default"))) -# elif defined(__GNUC__) && __GNUC__ >= 2 -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif -# endif -#endif - -/* By default SDL uses the C calling convention */ -#ifndef SDLCALL -#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) -#define SDLCALL __cdecl -#else -#define SDLCALL -#endif -#endif /* SDLCALL */ - -/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ -#ifdef __SYMBIAN32__ -#undef DECLSPEC -#define DECLSPEC -#endif /* __SYMBIAN32__ */ - -/* Force structure packing at 4 byte alignment. - This is necessary if the header is included in code which has structure - packing set to an alternate value, say for loading structures from disk. - The packing is reset to the previous value in close_code.h - */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) -#ifdef _MSC_VER -#pragma warning(disable: 4103) -#endif -#ifdef __BORLANDC__ -#pragma nopackwarning -#endif -#ifdef _M_X64 -/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ -#pragma pack(push,8) -#else -#pragma pack(push,4) -#endif -#endif /* Compiler needs structure packing set */ - -#ifndef SDL_INLINE -#if defined(__GNUC__) -#define SDL_INLINE __inline__ -#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ - defined(__DMC__) || defined(__SC__) || \ - defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) -#define SDL_INLINE __inline -#ifndef __inline__ -#define __inline__ __inline -#endif -#else -#define SDL_INLINE inline -#ifndef __inline__ -#define __inline__ inline -#endif -#endif -#endif /* SDL_INLINE not defined */ - -#ifndef SDL_FORCE_INLINE -#if defined(_MSC_VER) -#define SDL_FORCE_INLINE __forceinline -#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) -#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ -#else -#define SDL_FORCE_INLINE static SDL_INLINE -#endif -#endif /* SDL_FORCE_INLINE not defined */ - -/* Apparently this is needed by several Windows compilers */ -#if !defined(__MACH__) -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif /* NULL */ -#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/Source/3rdParty/sdl/include/close_code.h b/Source/3rdParty/sdl/include/close_code.h deleted file mode 100644 index 9826f1478..000000000 --- a/Source/3rdParty/sdl/include/close_code.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file close_code.h - * - * This file reverses the effects of begin_code.h and should be included - * after you finish any function and structure declarations in your headers - */ - -#undef _begin_code_h - -/* Reset structure packing at previous byte alignment */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) -#ifdef __BORLANDC__ -#pragma nopackwarning -#endif -#pragma pack(pop) -#endif /* Compiler needs structure packing set */ diff --git a/Source/3rdParty/sdl/include/doxyfile b/Source/3rdParty/sdl/include/doxyfile deleted file mode 100644 index 495dbc19b..000000000 --- a/Source/3rdParty/sdl/include/doxyfile +++ /dev/null @@ -1,1555 +0,0 @@ -# Doxyfile 1.5.9 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = SDL - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 2.0.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = YES - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = "defined=\"\def\"" \ - "discussion=\"\par Discussion:\n\"" - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = YES - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = ./doxygen_warn.txt - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl \ - *.h.in \ - *.h.default - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = ../doxy \ - ../test \ - ../Xcode \ - ../VisualC \ - ../VisualCE \ - ../Xcode-iOS - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = SDL_ \ - SDL - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = YES - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "SDL 2.0 Doxygen" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.libsdl.sdl20 - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = ./sdl20.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -#
Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 1 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = ALL - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \ - DECLSPEC= \ - SDLCALL= \ - _WIN32=1 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = ./SDL.tag - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = c:\Perl\bin\perl.exe - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 2 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/Source/3rdParty/sdl/sdl2.vcproj b/Source/3rdParty/sdl/sdl2.vcproj deleted file mode 100644 index fbcb3b9d5..000000000 --- a/Source/3rdParty/sdl/sdl2.vcproj +++ /dev/null @@ -1,1157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/3rdParty/sdl/sdl2.vcxproj b/Source/3rdParty/sdl/sdl2.vcxproj deleted file mode 100644 index 4e91ce922..000000000 --- a/Source/3rdParty/sdl/sdl2.vcxproj +++ /dev/null @@ -1,307 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - SDL2 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} - SDL - - - StaticLibrary - - - - - - - - - - - include;$(Root)Source/3rdParty/directx/include;%(AdditionalIncludeDirectories) - Level3 - HAVE_LIBC;%(PreprocessorDefinitions) - - - version.lib;imm32.lib;winmm.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/3rdParty/sdl/sdl2.vcxproj.filters b/Source/3rdParty/sdl/sdl2.vcxproj.filters deleted file mode 100644 index 0fecf85ad..000000000 --- a/Source/3rdParty/sdl/sdl2.vcxproj.filters +++ /dev/null @@ -1,377 +0,0 @@ - - - - - {80dab642-b512-42eb-b781-c1d3c091fdb1} - - - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/3rdParty/sdl/src/SDL.c b/Source/3rdParty/sdl/src/SDL.c deleted file mode 100644 index a203c9715..000000000 --- a/Source/3rdParty/sdl/src/SDL.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -#if defined(__WIN32__) -#include "core/windows/SDL_windows.h" -#endif - -/* Initialization code for SDL */ - -#include "SDL.h" -#include "SDL_bits.h" -#include "SDL_revision.h" -#include "SDL_assert_c.h" -#include "events/SDL_events_c.h" -#include "haptic/SDL_haptic_c.h" -#include "joystick/SDL_joystick_c.h" - -/* Initialization/Cleanup routines */ -#if !SDL_TIMERS_DISABLED -extern int SDL_TimerInit(void); -extern void SDL_TimerQuit(void); -extern void SDL_TicksInit(void); -extern void SDL_TicksQuit(void); -#endif -#if SDL_VIDEO_DRIVER_WINDOWS -extern int SDL_HelperWindowCreate(void); -extern int SDL_HelperWindowDestroy(void); -#endif - - -/* The initialized subsystems */ -#ifdef SDL_MAIN_NEEDED -static SDL_bool SDL_MainIsReady = SDL_FALSE; -#else -static SDL_bool SDL_MainIsReady = SDL_TRUE; -#endif -static SDL_bool SDL_bInMainQuit = SDL_FALSE; -static Uint8 SDL_SubsystemRefCount[ 32 ]; - -/* Private helper to increment a subsystem's ref counter. */ -static void -SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem) -{ - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - ++SDL_SubsystemRefCount[subsystem_index]; -} - -/* Private helper to decrement a subsystem's ref counter. */ -static void -SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) -{ - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] > 0) { - --SDL_SubsystemRefCount[subsystem_index]; - } -} - -/* Private helper to check if a system needs init. */ -static SDL_bool -SDL_PrivateShouldInitSubsystem(Uint32 subsystem) -{ - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0); -} - -/* Private helper to check if a system needs to be quit. */ -static SDL_bool -SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] == 0) { - return SDL_FALSE; - } - - /* If we're in SDL_Quit, we shut down every subsystem, even if refcount - * isn't zero. - */ - return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit; -} - -void -SDL_SetMainReady(void) -{ - SDL_MainIsReady = SDL_TRUE; -} - -int -SDL_InitSubSystem(Uint32 flags) -{ - if (!SDL_MainIsReady) { - SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); - return -1; - } - - /* Clear the error message */ - SDL_ClearError(); - -#if SDL_VIDEO_DRIVER_WINDOWS - if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { - if (SDL_HelperWindowCreate() < 0) { - return -1; - } - } -#endif - -#if !SDL_TIMERS_DISABLED - SDL_TicksInit(); -#endif - - if ((flags & SDL_INIT_GAMECONTROLLER)) { - /* game controller implies joystick */ - flags |= SDL_INIT_JOYSTICK; - } - - if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) { - /* video or joystick implies events */ - flags |= SDL_INIT_EVENTS; - } - - /* Initialize the event subsystem */ - if ((flags & SDL_INIT_EVENTS)) { -#if !SDL_EVENTS_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) { - if (SDL_StartEventLoop() < 0) { - return (-1); - } - SDL_QuitInit(); - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_EVENTS); -#else - return SDL_SetError("SDL not built with events support"); -#endif - } - - /* Initialize the timer subsystem */ - if ((flags & SDL_INIT_TIMER)){ -#if !SDL_TIMERS_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { - if (SDL_TimerInit() < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER); -#else - return SDL_SetError("SDL not built with timer support"); -#endif - } - - /* Initialize the video subsystem */ - if ((flags & SDL_INIT_VIDEO)){ -#if !SDL_VIDEO_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) { - if (SDL_VideoInit(NULL) < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO); -#else - return SDL_SetError("SDL not built with video support"); -#endif - } - - /* Initialize the audio subsystem */ - if ((flags & SDL_INIT_AUDIO)){ -#if !SDL_AUDIO_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) { - if (SDL_AudioInit(NULL) < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO); -#else - return SDL_SetError("SDL not built with audio support"); -#endif - } - - /* Initialize the joystick subsystem */ - if ((flags & SDL_INIT_JOYSTICK)){ -#if !SDL_JOYSTICK_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) { - if (SDL_JoystickInit() < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK); -#else - return SDL_SetError("SDL not built with joystick support"); -#endif - } - - if ((flags & SDL_INIT_GAMECONTROLLER)){ -#if !SDL_JOYSTICK_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) { - if (SDL_GameControllerInit() < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER); -#else - return SDL_SetError("SDL not built with joystick support"); -#endif - } - - /* Initialize the haptic subsystem */ - if ((flags & SDL_INIT_HAPTIC)){ -#if !SDL_HAPTIC_DISABLED - if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) { - if (SDL_HapticInit() < 0) { - return (-1); - } - } - SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC); -#else - return SDL_SetError("SDL not built with haptic (force feedback) support"); -#endif - } - - return (0); -} - -int -SDL_Init(Uint32 flags) -{ - return SDL_InitSubSystem(flags); -} - -void -SDL_QuitSubSystem(Uint32 flags) -{ - /* Shut down requested initialized subsystems */ -#if !SDL_JOYSTICK_DISABLED - if ((flags & SDL_INIT_GAMECONTROLLER)) { - /* game controller implies joystick */ - flags |= SDL_INIT_JOYSTICK; - - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) { - SDL_GameControllerQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER); - } - - if ((flags & SDL_INIT_JOYSTICK)) { - /* joystick implies events */ - flags |= SDL_INIT_EVENTS; - - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) { - SDL_JoystickQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK); - } -#endif - -#if !SDL_HAPTIC_DISABLED - if ((flags & SDL_INIT_HAPTIC)) { - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) { - SDL_HapticQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC); - } -#endif - -#if !SDL_AUDIO_DISABLED - if ((flags & SDL_INIT_AUDIO)) { - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { - SDL_AudioQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO); - } -#endif - -#if !SDL_VIDEO_DISABLED - if ((flags & SDL_INIT_VIDEO)) { - /* video implies events */ - flags |= SDL_INIT_EVENTS; - - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) { - SDL_VideoQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO); - } -#endif - -#if !SDL_TIMERS_DISABLED - if ((flags & SDL_INIT_TIMER)) { - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { - SDL_TimerQuit(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER); - } -#endif - -#if !SDL_EVENTS_DISABLED - if ((flags & SDL_INIT_EVENTS)) { - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) { - SDL_QuitQuit(); - SDL_StopEventLoop(); - } - SDL_PrivateSubsystemRefCountDecr(SDL_INIT_EVENTS); - } -#endif -} - -Uint32 -SDL_WasInit(Uint32 flags) -{ - int i; - int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount); - Uint32 initialized = 0; - - if (!flags) { - flags = SDL_INIT_EVERYTHING; - } - - num_subsystems = SDL_min(num_subsystems, SDL_MostSignificantBitIndex32(flags) + 1); - - /* Iterate over each bit in flags, and check the matching subsystem. */ - for (i = 0; i < num_subsystems; ++i) { - if ((flags & 1) && SDL_SubsystemRefCount[i] > 0) { - initialized |= (1 << i); - } - - flags >>= 1; - } - - return initialized; -} - -void -SDL_Quit(void) -{ - SDL_bInMainQuit = SDL_TRUE; - - /* Quit all subsystems */ -#if SDL_VIDEO_DRIVER_WINDOWS - SDL_HelperWindowDestroy(); -#endif - SDL_QuitSubSystem(SDL_INIT_EVERYTHING); - -#if !SDL_TIMERS_DISABLED - SDL_TicksQuit(); -#endif - - SDL_ClearHints(); - SDL_AssertionsQuit(); - SDL_LogResetPriorities(); - - /* Now that every subsystem has been quit, we reset the subsystem refcount - * and the list of initialized subsystems. - */ - SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) ); - - SDL_bInMainQuit = SDL_FALSE; -} - -/* Get the library version number */ -void -SDL_GetVersion(SDL_version * ver) -{ - SDL_VERSION(ver); -} - -/* Get the library source revision */ -const char * -SDL_GetRevision(void) -{ - return SDL_REVISION; -} - -/* Get the library source revision number */ -int -SDL_GetRevisionNumber(void) -{ - return SDL_REVISION_NUMBER; -} - -/* Get the name of the platform */ -const char * -SDL_GetPlatform() -{ -#if __AIX__ - return "AIX"; -#elif __ANDROID__ - return "Android"; -#elif __BSDI__ - return "BSDI"; -#elif __DREAMCAST__ - return "Dreamcast"; -#elif __FREEBSD__ - return "FreeBSD"; -#elif __HAIKU__ - return "Haiku"; -#elif __HPUX__ - return "HP-UX"; -#elif __IRIX__ - return "Irix"; -#elif __LINUX__ - return "Linux"; -#elif __MINT__ - return "Atari MiNT"; -#elif __MACOS__ - return "MacOS Classic"; -#elif __MACOSX__ - return "Mac OS X"; -#elif __NETBSD__ - return "NetBSD"; -#elif __OPENBSD__ - return "OpenBSD"; -#elif __OS2__ - return "OS/2"; -#elif __OSF__ - return "OSF/1"; -#elif __QNXNTO__ - return "QNX Neutrino"; -#elif __RISCOS__ - return "RISC OS"; -#elif __SOLARIS__ - return "Solaris"; -#elif __WIN32__ - return "Windows"; -#elif __IPHONEOS__ - return "iOS"; -#elif __PSP__ - return "PlayStation Portable"; -#else - return "Unknown (see SDL_platform.h)"; -#endif -} - -#if defined(__WIN32__) - -#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) -/* Need to include DllMain() on Watcom C for some reason.. */ - -/*BOOL APIENTRY -_DllMainCRTStartup(HANDLE hModule, - DWORD ul_reason_for_call, LPVOID lpReserved) -{ - switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -}*/ -#endif /* building DLL with Watcom C */ - -#endif /* __WIN32__ */ - -/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_assert.c b/Source/3rdParty/sdl/src/SDL_assert.c deleted file mode 100644 index 98e758447..000000000 --- a/Source/3rdParty/sdl/src/SDL_assert.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -#if defined(__WIN32__) -#include "core/windows/SDL_windows.h" -#endif - -#include "SDL.h" -#include "SDL_atomic.h" -#include "SDL_messagebox.h" -#include "SDL_video.h" -#include "SDL_assert.h" -#include "SDL_assert_c.h" -#include "video/SDL_sysvideo.h" - -#ifdef __WIN32__ -#ifndef WS_OVERLAPPEDWINDOW -#define WS_OVERLAPPEDWINDOW 0 -#endif -#else /* fprintf, _exit(), etc. */ -#include -#include -#if ! defined(__WINRT__) -#include -#endif -#endif - -static SDL_assert_state -SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); - -/* - * We keep all triggered assertions in a singly-linked list so we can - * generate a report later. - */ -static SDL_assert_data *triggered_assertions = NULL; - -static SDL_mutex *assertion_mutex = NULL; -static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion; -static void *assertion_userdata = NULL; - -#ifdef __GNUC__ -static void -debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2))); -#endif - -static void -debug_print(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - SDL_LogMessageV(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_WARN, fmt, ap); - va_end(ap); -} - - -static void SDL_AddAssertionToReport(SDL_assert_data *data) -{ - /* (data) is always a static struct defined with the assert macros, so - we don't have to worry about copying or allocating them. */ - data->trigger_count++; - if (data->trigger_count == 1) { /* not yet added? */ - data->next = triggered_assertions; - triggered_assertions = data; - } -} - - -static void SDL_GenerateAssertionReport(void) -{ - const SDL_assert_data *item = triggered_assertions; - - /* only do this if the app hasn't assigned an assertion handler. */ - if ((item != NULL) && (assertion_handler != SDL_PromptAssertion)) { - debug_print("\n\nSDL assertion report.\n"); - debug_print("All SDL assertions between last init/quit:\n\n"); - - while (item != NULL) { - debug_print( - "'%s'\n" - " * %s (%s:%d)\n" - " * triggered %u time%s.\n" - " * always ignore: %s.\n", - item->condition, item->function, item->filename, - item->linenum, item->trigger_count, - (item->trigger_count == 1) ? "" : "s", - item->always_ignore ? "yes" : "no"); - item = item->next; - } - debug_print("\n"); - - SDL_ResetAssertionReport(); - } -} - -static void SDL_ExitProcess(int exitcode) -{ -#ifdef __WIN32__ - ExitProcess(exitcode); -#else - _exit(exitcode); -#endif -} - -static void SDL_AbortAssertion(void) -{ - SDL_Quit(); - SDL_ExitProcess(42); -} - - -static SDL_assert_state -SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) -{ -#ifdef __WIN32__ - #define ENDLINE "\r\n" -#else - #define ENDLINE "\n" -#endif - - const char *envr; - SDL_assert_state state = SDL_ASSERTION_ABORT; - SDL_Window *window; - SDL_MessageBoxData messagebox; - SDL_MessageBoxButtonData buttons[] = { - { 0, SDL_ASSERTION_RETRY, "Retry" }, - { 0, SDL_ASSERTION_BREAK, "Break" }, - { 0, SDL_ASSERTION_ABORT, "Abort" }, - { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, - SDL_ASSERTION_IGNORE, "Ignore" }, - { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, - SDL_ASSERTION_ALWAYS_IGNORE, "Always Ignore" } - }; - char *message; - int selected; - - (void) userdata; /* unused in default handler. */ - - message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (!message) { - /* Uh oh, we're in real trouble now... */ - return SDL_ASSERTION_ABORT; - } - SDL_snprintf(message, SDL_MAX_LOG_MESSAGE, - "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE - " '%s'", - data->function, data->filename, data->linenum, - data->trigger_count, (data->trigger_count == 1) ? "time" : "times", - data->condition); - - debug_print("\n\n%s\n\n", message); - - /* let env. variable override, so unit tests won't block in a GUI. */ - envr = SDL_getenv("SDL_ASSERT"); - if (envr != NULL) { - SDL_stack_free(message); - - if (SDL_strcmp(envr, "abort") == 0) { - return SDL_ASSERTION_ABORT; - } else if (SDL_strcmp(envr, "break") == 0) { - return SDL_ASSERTION_BREAK; - } else if (SDL_strcmp(envr, "retry") == 0) { - return SDL_ASSERTION_RETRY; - } else if (SDL_strcmp(envr, "ignore") == 0) { - return SDL_ASSERTION_IGNORE; - } else if (SDL_strcmp(envr, "always_ignore") == 0) { - return SDL_ASSERTION_ALWAYS_IGNORE; - } else { - return SDL_ASSERTION_ABORT; /* oh well. */ - } - } - - /* Leave fullscreen mode, if possible (scary!) */ - window = SDL_GetFocusWindow(); - if (window) { - if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { - SDL_MinimizeWindow(window); - } else { - /* !!! FIXME: ungrab the input if we're not fullscreen? */ - /* No need to mess with the window */ - window = NULL; - } - } - - /* Show a messagebox if we can, otherwise fall back to stdio */ - SDL_zero(messagebox); - messagebox.flags = SDL_MESSAGEBOX_WARNING; - messagebox.window = window; - messagebox.title = "Assertion Failed"; - messagebox.message = message; - messagebox.numbuttons = SDL_arraysize(buttons); - messagebox.buttons = buttons; - - if (SDL_ShowMessageBox(&messagebox, &selected) == 0) { - if (selected == -1) { - state = SDL_ASSERTION_IGNORE; - } else { - state = (SDL_assert_state)selected; - } - } -#ifdef HAVE_STDIO_H - else - { - /* this is a little hacky. */ - for ( ; ; ) { - char buf[32]; - fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : "); - fflush(stderr); - if (fgets(buf, sizeof (buf), stdin) == NULL) { - break; - } - - if (SDL_strcmp(buf, "a") == 0) { - state = SDL_ASSERTION_ABORT; - break; - } else if (SDL_strcmp(buf, "b") == 0) { - state = SDL_ASSERTION_BREAK; - break; - } else if (SDL_strcmp(buf, "r") == 0) { - state = SDL_ASSERTION_RETRY; - break; - } else if (SDL_strcmp(buf, "i") == 0) { - state = SDL_ASSERTION_IGNORE; - break; - } else if (SDL_strcmp(buf, "A") == 0) { - state = SDL_ASSERTION_ALWAYS_IGNORE; - break; - } - } - } -#endif /* HAVE_STDIO_H */ - - /* Re-enter fullscreen mode */ - if (window) { - SDL_RestoreWindow(window); - } - - SDL_stack_free(message); - - return state; -} - - -SDL_assert_state -SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, - int line) -{ - static int assertion_running = 0; - static SDL_SpinLock spinlock = 0; - SDL_assert_state state = SDL_ASSERTION_IGNORE; - - SDL_AtomicLock(&spinlock); - if (assertion_mutex == NULL) { /* never called SDL_Init()? */ - assertion_mutex = SDL_CreateMutex(); - if (assertion_mutex == NULL) { - SDL_AtomicUnlock(&spinlock); - return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ - } - } - SDL_AtomicUnlock(&spinlock); - - if (SDL_LockMutex(assertion_mutex) < 0) { - return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ - } - - /* doing this because Visual C is upset over assigning in the macro. */ - if (data->trigger_count == 0) { - data->function = func; - data->filename = file; - data->linenum = line; - } - - SDL_AddAssertionToReport(data); - - assertion_running++; - if (assertion_running > 1) { /* assert during assert! Abort. */ - if (assertion_running == 2) { - SDL_AbortAssertion(); - } else if (assertion_running == 3) { /* Abort asserted! */ - SDL_ExitProcess(42); - } else { - while (1) { /* do nothing but spin; what else can you do?! */ } - } - } - - if (!data->always_ignore) { - state = assertion_handler(data, assertion_userdata); - } - - switch (state) - { - case SDL_ASSERTION_ABORT: - SDL_AbortAssertion(); - return SDL_ASSERTION_IGNORE; /* shouldn't return, but oh well. */ - - case SDL_ASSERTION_ALWAYS_IGNORE: - state = SDL_ASSERTION_IGNORE; - data->always_ignore = 1; - break; - - case SDL_ASSERTION_IGNORE: - case SDL_ASSERTION_RETRY: - case SDL_ASSERTION_BREAK: - break; /* macro handles these. */ - } - - assertion_running--; - SDL_UnlockMutex(assertion_mutex); - - return state; -} - - -void SDL_AssertionsQuit(void) -{ - SDL_GenerateAssertionReport(); - if (assertion_mutex != NULL) { - SDL_DestroyMutex(assertion_mutex); - assertion_mutex = NULL; - } -} - -void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) -{ - if (handler != NULL) { - assertion_handler = handler; - assertion_userdata = userdata; - } else { - assertion_handler = SDL_PromptAssertion; - assertion_userdata = NULL; - } -} - -const SDL_assert_data *SDL_GetAssertionReport(void) -{ - return triggered_assertions; -} - -void SDL_ResetAssertionReport(void) -{ - SDL_assert_data *next = NULL; - SDL_assert_data *item; - for (item = triggered_assertions; item != NULL; item = next) { - next = (SDL_assert_data *) item->next; - item->always_ignore = SDL_FALSE; - item->trigger_count = 0; - item->next = NULL; - } - - triggered_assertions = NULL; -} - -SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void) -{ - return SDL_PromptAssertion; -} - -SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata) -{ - if (userdata != NULL) { - *userdata = assertion_userdata; - } - return assertion_handler; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_assert_c.h b/Source/3rdParty/sdl/src/SDL_assert_c.h deleted file mode 100644 index f94b24c29..000000000 --- a/Source/3rdParty/sdl/src/SDL_assert_c.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -extern void SDL_AssertionsQuit(void); - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_error.c b/Source/3rdParty/sdl/src/SDL_error.c deleted file mode 100644 index ecbf4507b..000000000 --- a/Source/3rdParty/sdl/src/SDL_error.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -/* Simple error handling in SDL */ - -#include "SDL_log.h" -#include "SDL_error.h" -#include "SDL_error_c.h" - - -/* Routine to get the thread-specific error variable */ -#if SDL_THREADS_DISABLED -/* The default (non-thread-safe) global error variable */ -static SDL_error SDL_global_error; -#define SDL_GetErrBuf() (&SDL_global_error) -#else -extern SDL_error *SDL_GetErrBuf(void); -#endif /* SDL_THREADS_DISABLED */ - -#define SDL_ERRBUFIZE 1024 - -/* Private functions */ - -static const char * -SDL_LookupString(const char *key) -{ - /* FIXME: Add code to lookup key in language string hash-table */ - return key; -} - -/* Public functions */ - -int -SDL_SetError(const char *fmt, ...) -{ - va_list ap; - SDL_error *error; - - /* Ignore call if invalid format pointer was passed */ - if (fmt == NULL) return -1; - - /* Copy in the key, mark error as valid */ - error = SDL_GetErrBuf(); - error->error = 1; - SDL_strlcpy((char *) error->key, fmt, sizeof(error->key)); - - va_start(ap, fmt); - error->argc = 0; - while (*fmt) { - if (*fmt++ == '%') { - while (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) { - ++fmt; - } - switch (*fmt++) { - case 0: /* Malformed format string.. */ - --fmt; - break; - case 'c': - case 'i': - case 'd': - case 'u': - case 'o': - case 'x': - case 'X': - error->args[error->argc++].value_i = va_arg(ap, int); - break; - case 'f': - error->args[error->argc++].value_f = va_arg(ap, double); - break; - case 'p': - error->args[error->argc++].value_ptr = va_arg(ap, void *); - break; - case 's': - { - int i = error->argc; - const char *str = va_arg(ap, const char *); - if (str == NULL) - str = "(null)"; - SDL_strlcpy((char *) error->args[i].buf, str, - ERR_MAX_STRLEN); - error->argc++; - } - break; - default: - break; - } - if (error->argc >= ERR_MAX_ARGS) { - break; - } - } - } - va_end(ap); - - /* If we are in debug mode, print out an error message */ - SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); - - return -1; -} - -/* This function has a bit more overhead than most error functions - so that it supports internationalization and thread-safe errors. -*/ -static char * -SDL_GetErrorMsg(char *errstr, unsigned int maxlen) -{ - SDL_error *error; - - /* Clear the error string */ - *errstr = '\0'; - --maxlen; - - /* Get the thread-safe error, and print it out */ - error = SDL_GetErrBuf(); - if (error->error) { - const char *fmt; - char *msg = errstr; - int len; - int argi; - - fmt = SDL_LookupString(error->key); - argi = 0; - while (*fmt && (maxlen > 0)) { - if (*fmt == '%') { - char tmp[32], *spot = tmp; - *spot++ = *fmt++; - while ((*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) - && spot < (tmp + SDL_arraysize(tmp) - 2)) { - *spot++ = *fmt++; - } - *spot++ = *fmt++; - *spot++ = '\0'; - switch (spot[-2]) { - case '%': - *msg++ = '%'; - maxlen -= 1; - break; - case 'c': - case 'i': - case 'd': - case 'u': - case 'o': - case 'x': - case 'X': - len = - SDL_snprintf(msg, maxlen, tmp, - error->args[argi++].value_i); - msg += len; - maxlen -= len; - break; - case 'f': - len = - SDL_snprintf(msg, maxlen, tmp, - error->args[argi++].value_f); - msg += len; - maxlen -= len; - break; - case 'p': - len = - SDL_snprintf(msg, maxlen, tmp, - error->args[argi++].value_ptr); - msg += len; - maxlen -= len; - break; - case 's': - len = - SDL_snprintf(msg, maxlen, tmp, - SDL_LookupString(error->args[argi++]. - buf)); - msg += len; - maxlen -= len; - break; - } - } else { - *msg++ = *fmt++; - maxlen -= 1; - } - } - *msg = 0; /* NULL terminate the string */ - } - return (errstr); -} - -/* Available for backwards compatibility */ -const char * -SDL_GetError(void) -{ - static char errmsg[SDL_ERRBUFIZE]; - - return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); -} - -void -SDL_ClearError(void) -{ - SDL_error *error; - - error = SDL_GetErrBuf(); - error->error = 0; -} - -/* Very common errors go here */ -int -SDL_Error(SDL_errorcode code) -{ - switch (code) { - case SDL_ENOMEM: - return SDL_SetError("Out of memory"); - case SDL_EFREAD: - return SDL_SetError("Error reading from datastream"); - case SDL_EFWRITE: - return SDL_SetError("Error writing to datastream"); - case SDL_EFSEEK: - return SDL_SetError("Error seeking in datastream"); - case SDL_UNSUPPORTED: - return SDL_SetError("That operation is not supported"); - default: - return SDL_SetError("Unknown SDL error"); - } -} - -#ifdef TEST_ERROR -int -main(int argc, char *argv[]) -{ - char buffer[BUFSIZ + 1]; - - SDL_SetError("Hi there!"); - printf("Error 1: %s\n", SDL_GetError()); - SDL_ClearError(); - SDL_memset(buffer, '1', BUFSIZ); - buffer[BUFSIZ] = 0; - SDL_SetError("This is the error: %s (%f)", buffer, 1.0); - printf("Error 2: %s\n", SDL_GetError()); - exit(0); -} -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_error_c.h b/Source/3rdParty/sdl/src/SDL_error_c.h deleted file mode 100644 index 98c20c492..000000000 --- a/Source/3rdParty/sdl/src/SDL_error_c.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -/* This file defines a structure that carries language-independent - error messages -*/ - -#ifndef _SDL_error_c_h -#define _SDL_error_c_h - -#define ERR_MAX_STRLEN 128 -#define ERR_MAX_ARGS 5 - -typedef struct SDL_error -{ - /* This is a numeric value corresponding to the current error */ - int error; - - /* This is a key used to index into a language hashtable containing - internationalized versions of the SDL error messages. If the key - is not in the hashtable, or no hashtable is available, the key is - used directly as an error message format string. - */ - char key[ERR_MAX_STRLEN]; - - /* These are the arguments for the error functions */ - int argc; - union - { - void *value_ptr; -#if 0 /* What is a character anyway? (UNICODE issues) */ - unsigned char value_c; -#endif - int value_i; - double value_f; - char buf[ERR_MAX_STRLEN]; - } args[ERR_MAX_ARGS]; -} SDL_error; - -/* Defined in SDL_thread.c */ -extern SDL_error *SDL_GetErrBuf(void); - -#endif /* _SDL_error_c_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_hints.c b/Source/3rdParty/sdl/src/SDL_hints.c deleted file mode 100644 index 365459ec7..000000000 --- a/Source/3rdParty/sdl/src/SDL_hints.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -#include "SDL_hints.h" -#include "SDL_error.h" - - -/* Assuming there aren't many hints set and they aren't being queried in - critical performance paths, we'll just use linked lists here. - */ -typedef struct SDL_HintWatch { - SDL_HintCallback callback; - void *userdata; - struct SDL_HintWatch *next; -} SDL_HintWatch; - -typedef struct SDL_Hint { - char *name; - char *value; - SDL_HintPriority priority; - SDL_HintWatch *callbacks; - struct SDL_Hint *next; -} SDL_Hint; - -static SDL_Hint *SDL_hints; - -SDL_bool -SDL_SetHintWithPriority(const char *name, const char *value, - SDL_HintPriority priority) -{ - const char *env; - SDL_Hint *hint; - SDL_HintWatch *entry; - - if (!name || !value) { - return SDL_FALSE; - } - - env = SDL_getenv(name); - if (env && priority < SDL_HINT_OVERRIDE) { - return SDL_FALSE; - } - - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - if (priority < hint->priority) { - return SDL_FALSE; - } - if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) { - for (entry = hint->callbacks; entry; ) { - /* Save the next entry in case this one is deleted */ - SDL_HintWatch *next = entry->next; - entry->callback(entry->userdata, name, hint->value, value); - entry = next; - } - SDL_free(hint->value); - hint->value = value ? SDL_strdup(value) : NULL; - } - hint->priority = priority; - return SDL_TRUE; - } - } - - /* Couldn't find the hint, add a new one */ - hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); - if (!hint) { - return SDL_FALSE; - } - hint->name = SDL_strdup(name); - hint->value = value ? SDL_strdup(value) : NULL; - hint->priority = priority; - hint->callbacks = NULL; - hint->next = SDL_hints; - SDL_hints = hint; - return SDL_TRUE; -} - -SDL_bool -SDL_SetHint(const char *name, const char *value) -{ - return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL); -} - -const char * -SDL_GetHint(const char *name) -{ - const char *env; - SDL_Hint *hint; - - env = SDL_getenv(name); - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - if (!env || hint->priority == SDL_HINT_OVERRIDE) { - return hint->value; - } - break; - } - } - return env; -} - -void -SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) -{ - SDL_Hint *hint; - SDL_HintWatch *entry; - const char *value; - - if (!name || !*name) { - SDL_InvalidParamError("name"); - return; - } - if (!callback) { - SDL_InvalidParamError("callback"); - return; - } - - SDL_DelHintCallback(name, callback, userdata); - - entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry)); - entry->callback = callback; - entry->userdata = userdata; - - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - break; - } - } - if (!hint) { - /* Need to add a hint entry for this watcher */ - hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); - if (!hint) { - return; - } - hint->name = SDL_strdup(name); - hint->value = NULL; - hint->priority = SDL_HINT_DEFAULT; - hint->callbacks = NULL; - hint->next = SDL_hints; - SDL_hints = hint; - } - - /* Add it to the callbacks for this hint */ - entry->next = hint->callbacks; - hint->callbacks = entry; - - /* Now call it with the current value */ - value = SDL_GetHint(name); - callback(userdata, name, value, value); -} - -void -SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata) -{ - SDL_Hint *hint; - SDL_HintWatch *entry, *prev; - - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - prev = NULL; - for (entry = hint->callbacks; entry; entry = entry->next) { - if (callback == entry->callback && userdata == entry->userdata) { - if (prev) { - prev->next = entry->next; - } else { - hint->callbacks = entry->next; - } - SDL_free(entry); - break; - } - prev = entry; - } - return; - } - } -} - -void SDL_ClearHints(void) -{ - SDL_Hint *hint; - SDL_HintWatch *entry; - - while (SDL_hints) { - hint = SDL_hints; - SDL_hints = hint->next; - - SDL_free(hint->name); - SDL_free(hint->value); - for (entry = hint->callbacks; entry; ) { - SDL_HintWatch *freeable = entry; - entry = entry->next; - SDL_free(freeable); - } - SDL_free(hint); - } -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_internal.h b/Source/3rdParty/sdl/src/SDL_internal.h deleted file mode 100644 index cb66abd8e..000000000 --- a/Source/3rdParty/sdl/src/SDL_internal.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef _SDL_internal_h -#define _SDL_internal_h - -#include "dynapi/SDL_dynapi.h" - -#if SDL_DYNAMIC_API -#include "dynapi/SDL_dynapi_overrides.h" -/* force DECLSPEC and SDLCALL off...it's all internal symbols now. - These will have actual #defines during SDL_dynapi.c only */ -#define DECLSPEC -#define SDLCALL -#endif - -#include "SDL_config.h" - -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/SDL_log.c b/Source/3rdParty/sdl/src/SDL_log.c deleted file mode 100644 index 39aa3e4bf..000000000 --- a/Source/3rdParty/sdl/src/SDL_log.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "./SDL_internal.h" - -#if defined(__WIN32__) || defined(__WINRT__) -#include "core/windows/SDL_windows.h" -#endif - -/* Simple log messages in SDL */ - -#include "SDL_log.h" - -#if HAVE_STDIO_H -#include -#endif - -#if defined(__ANDROID__) -#include -#endif - -#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL -#define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN -#define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO -#define DEFAULT_TEST_PRIORITY SDL_LOG_PRIORITY_VERBOSE - -/* Forward definition of error function */ -extern int SDL_SetError(const char *fmt, ...); - -typedef struct SDL_LogLevel -{ - int category; - SDL_LogPriority priority; - struct SDL_LogLevel *next; -} SDL_LogLevel; - -/* The default log output function */ -static void SDL_LogOutput(void *userdata, - int category, SDL_LogPriority priority, - const char *message); - -static SDL_LogLevel *SDL_loglevels; -static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; -static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; -static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; -static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY; -static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput; -static void *SDL_log_userdata = NULL; - -static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { - NULL, - "VERBOSE", - "DEBUG", - "INFO", - "WARN", - "ERROR", - "CRITICAL" -}; - -#ifdef __ANDROID__ -static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = { - "APP", - "ERROR", - "SYSTEM", - "AUDIO", - "VIDEO", - "RENDER", - "INPUT" -}; - -static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { - ANDROID_LOG_UNKNOWN, - ANDROID_LOG_VERBOSE, - ANDROID_LOG_DEBUG, - ANDROID_LOG_INFO, - ANDROID_LOG_WARN, - ANDROID_LOG_ERROR, - ANDROID_LOG_FATAL -}; -#endif /* __ANDROID__ */ - - -void -SDL_LogSetAllPriority(SDL_LogPriority priority) -{ - SDL_LogLevel *entry; - - for (entry = SDL_loglevels; entry; entry = entry->next) { - entry->priority = priority; - } - SDL_default_priority = priority; - SDL_assert_priority = priority; - SDL_application_priority = priority; -} - -void -SDL_LogSetPriority(int category, SDL_LogPriority priority) -{ - SDL_LogLevel *entry; - - for (entry = SDL_loglevels; entry; entry = entry->next) { - if (entry->category == category) { - entry->priority = priority; - return; - } - } - - /* Create a new entry */ - entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry)); - if (entry) { - entry->category = category; - entry->priority = priority; - entry->next = SDL_loglevels; - SDL_loglevels = entry; - } -} - -SDL_LogPriority -SDL_LogGetPriority(int category) -{ - SDL_LogLevel *entry; - - for (entry = SDL_loglevels; entry; entry = entry->next) { - if (entry->category == category) { - return entry->priority; - } - } - - if (category == SDL_LOG_CATEGORY_TEST) { - return SDL_test_priority; - } else if (category == SDL_LOG_CATEGORY_APPLICATION) { - return SDL_application_priority; - } else if (category == SDL_LOG_CATEGORY_ASSERT) { - return SDL_assert_priority; - } else { - return SDL_default_priority; - } -} - -void -SDL_LogResetPriorities(void) -{ - SDL_LogLevel *entry; - - while (SDL_loglevels) { - entry = SDL_loglevels; - SDL_loglevels = entry->next; - SDL_free(entry); - } - - SDL_default_priority = DEFAULT_PRIORITY; - SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; - SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; - SDL_test_priority = DEFAULT_TEST_PRIORITY; -} - -void -SDL_Log(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); - va_end(ap); -} - -void -SDL_LogVerbose(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap); - va_end(ap); -} - -void -SDL_LogDebug(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap); - va_end(ap); -} - -void -SDL_LogInfo(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap); - va_end(ap); -} - -void -SDL_LogWarn(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap); - va_end(ap); -} - -void -SDL_LogError(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap); - va_end(ap); -} - -void -SDL_LogCritical(int category, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap); - va_end(ap); -} - -void -SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - SDL_LogMessageV(category, priority, fmt, ap); - va_end(ap); -} - -#ifdef __ANDROID__ -static const char * -GetCategoryPrefix(int category) -{ - if (category < SDL_LOG_CATEGORY_RESERVED1) { - return SDL_category_prefixes[category]; - } - if (category < SDL_LOG_CATEGORY_CUSTOM) { - return "RESERVED"; - } - return "CUSTOM"; -} -#endif /* __ANDROID__ */ - -void -SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap) -{ - char *message; - size_t len; - - /* Nothing to do if we don't have an output function */ - if (!SDL_log_function) { - return; - } - - /* Make sure we don't exceed array bounds */ - if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) { - return; - } - - /* See if we want to do anything with this message */ - if (priority < SDL_LogGetPriority(category)) { - return; - } - - message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (!message) { - return; - } - - SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap); - - /* Chop off final endline. */ - len = SDL_strlen(message); - if ((len > 0) && (message[len-1] == '\n')) { - message[--len] = '\0'; - if ((len > 0) && (message[len-1] == '\r')) { /* catch "\r\n", too. */ - message[--len] = '\0'; - } - } - - SDL_log_function(SDL_log_userdata, category, priority, message); - SDL_stack_free(message); -} - -#if defined(__WIN32__) -/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */ -static int consoleAttached = 0; - -/* Handle to stderr output of console. */ -static HANDLE stderrHandle = NULL; -#endif - -static void -SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, - const char *message) -{ -#if defined(__WIN32__) || defined(__WINRT__) - /* Way too many allocations here, urgh */ - /* Note: One can't call SDL_SetError here, since that function itself logs. */ - { - char *output; - size_t length; - LPTSTR tstr; - -#ifndef __WINRT__ - BOOL attachResult; - DWORD attachError; - unsigned long charsWritten; - - /* Maybe attach console and get stderr handle */ - if (consoleAttached == 0) { - attachResult = AttachConsole(ATTACH_PARENT_PROCESS); - if (!attachResult) { - attachError = GetLastError(); - if (attachError == ERROR_INVALID_HANDLE) { - OutputDebugString(TEXT("Parent process has no console\r\n")); - consoleAttached = -1; - } else if (attachError == ERROR_GEN_FAILURE) { - OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); - consoleAttached = -1; - } else if (attachError == ERROR_ACCESS_DENIED) { - /* Already attached */ - consoleAttached = 1; - } else { - OutputDebugString(TEXT("Error attaching console\r\n")); - consoleAttached = -1; - } - } else { - /* Newly attached */ - consoleAttached = 1; - } - - if (consoleAttached == 1) { - stderrHandle = GetStdHandle(STD_ERROR_HANDLE); - } - } -#endif /* ifndef __WINRT__ */ - - length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; - output = SDL_stack_alloc(char, length); - SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message); - tstr = WIN_UTF8ToString(output); - - /* Output to debugger */ - OutputDebugString(tstr); - -#ifndef __WINRT__ - /* Screen output to stderr, if console was attached. */ - if (consoleAttached == 1) { - if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) { - OutputDebugString(TEXT("Error calling WriteConsole\r\n")); - } - if (charsWritten == ERROR_NOT_ENOUGH_MEMORY) { - OutputDebugString(TEXT("Insufficient heap memory to write message\r\n")); - } - } -#endif /* ifndef __WINRT__ */ - - SDL_free(tstr); - SDL_stack_free(output); - } -#elif defined(__ANDROID__) - { - char tag[32]; - - SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); - __android_log_write(SDL_android_priority[priority], tag, message); - } -#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) - /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now. - */ - extern void SDL_NSLog(const char *text); - { - char *text; - - text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (text) { - SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message); - SDL_NSLog(text); - SDL_stack_free(text); - return; - } - } -#elif defined(__PSP__) - { - FILE* pFile; - pFile = fopen ("SDL_Log.txt", "a"); - fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); - fclose (pFile); - } -#endif -#if HAVE_STDIO_H - fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); -#endif -} - -void -SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata) -{ - if (callback) { - *callback = SDL_log_function; - } - if (userdata) { - *userdata = SDL_log_userdata; - } -} - -void -SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata) -{ - SDL_log_function = callback; - SDL_log_userdata = userdata; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/atomic/SDL_atomic.c b/Source/3rdParty/sdl/src/atomic/SDL_atomic.c deleted file mode 100644 index be3f4002b..000000000 --- a/Source/3rdParty/sdl/src/atomic/SDL_atomic.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#include "SDL_atomic.h" - -#if defined(_MSC_VER) && (_MSC_VER >= 1500) -#include -#define HAVE_MSC_ATOMICS 1 -#endif - -#if defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */ -#include -#endif - -/* - If any of the operations are not provided then we must emulate some - of them. That means we need a nice implementation of spin locks - that avoids the "one big lock" problem. We use a vector of spin - locks and pick which one to use based on the address of the operand - of the function. - - To generate the index of the lock we first shift by 3 bits to get - rid on the zero bits that result from 32 and 64 bit allignment of - data. We then mask off all but 5 bits and use those 5 bits as an - index into the table. - - Picking the lock this way insures that accesses to the same data at - the same time will go to the same lock. OTOH, accesses to different - data have only a 1/32 chance of hitting the same lock. That should - pretty much eliminate the chances of several atomic operations on - different data from waiting on the same "big lock". If it isn't - then the table of locks can be expanded to a new size so long as - the new size is a power of two. - - Contributed by Bob Pendleton, bob@pendleton.com -*/ - -#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) -#define EMULATE_CAS 1 -#endif - -#if EMULATE_CAS -static SDL_SpinLock locks[32]; - -static SDL_INLINE void -enterLock(void *a) -{ - uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f); - - SDL_AtomicLock(&locks[index]); -} - -static SDL_INLINE void -leaveLock(void *a) -{ - uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f); - - SDL_AtomicUnlock(&locks[index]); -} -#endif - - -SDL_bool -SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) -{ -#ifdef HAVE_MSC_ATOMICS - return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); -#elif defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); -#elif defined(HAVE_GCC_ATOMICS) - return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); -#elif EMULATE_CAS - SDL_bool retval = SDL_FALSE; - - enterLock(a); - if (a->value == oldval) { - a->value = newval; - retval = SDL_TRUE; - } - leaveLock(a); - - return retval; -#else - #error Please define your platform. -#endif -} - -SDL_bool -SDL_AtomicCASPtr(void **a, void *oldval, void *newval) -{ -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) - return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); -#elif defined(__MACOSX__) && defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); -#elif defined(__MACOSX__) && !defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); -#elif defined(HAVE_GCC_ATOMICS) - return __sync_bool_compare_and_swap(a, oldval, newval); -#elif EMULATE_CAS - SDL_bool retval = SDL_FALSE; - - enterLock(a); - if (*a == oldval) { - *a = newval; - retval = SDL_TRUE; - } - leaveLock(a); - - return retval; -#else - #error Please define your platform. -#endif -} - -int -SDL_AtomicSet(SDL_atomic_t *a, int v) -{ -#ifdef HAVE_MSC_ATOMICS - return _InterlockedExchange((long*)&a->value, v); -#elif defined(HAVE_GCC_ATOMICS) - return __sync_lock_test_and_set(&a->value, v); -#else - int value; - do { - value = a->value; - } while (!SDL_AtomicCAS(a, value, v)); - return value; -#endif -} - -void* -SDL_AtomicSetPtr(void **a, void *v) -{ -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (void *) _InterlockedExchange((long *)a, (long) v); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) - return _InterlockedExchangePointer(a, v); -#elif defined(HAVE_GCC_ATOMICS) - return __sync_lock_test_and_set(a, v); -#else - void *value; - do { - value = *a; - } while (!SDL_AtomicCASPtr(a, value, v)); - return value; -#endif -} - -int -SDL_AtomicAdd(SDL_atomic_t *a, int v) -{ -#ifdef HAVE_MSC_ATOMICS - return _InterlockedExchangeAdd((long*)&a->value, v); -#elif defined(HAVE_GCC_ATOMICS) - return __sync_fetch_and_add(&a->value, v); -#else - int value; - do { - value = a->value; - } while (!SDL_AtomicCAS(a, value, (value + v))); - return value; -#endif -} - -int -SDL_AtomicGet(SDL_atomic_t *a) -{ - int value; - do { - value = a->value; - } while (!SDL_AtomicCAS(a, value, value)); - return value; -} - -void * -SDL_AtomicGetPtr(void **a) -{ - void *value; - do { - value = *a; - } while (!SDL_AtomicCASPtr(a, value, value)); - return value; -} - -#ifdef __thumb__ -#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) -__asm__( -" .align 2\n" -" .globl _SDL_MemoryBarrierRelease\n" -" .globl _SDL_MemoryBarrierAcquire\n" -"_SDL_MemoryBarrierRelease:\n" -"_SDL_MemoryBarrierAcquire:\n" -" mov r0, #0\n" -" mcr p15, 0, r0, c7, c10, 5\n" -" bx lr\n" -); -#endif -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/atomic/SDL_spinlock.c b/Source/3rdParty/sdl/src/atomic/SDL_spinlock.c deleted file mode 100644 index 2d8446dc5..000000000 --- a/Source/3rdParty/sdl/src/atomic/SDL_spinlock.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#if defined(__WIN32__) || defined(__WINRT__) -#include "../core/windows/SDL_windows.h" -#endif - -#include "SDL_atomic.h" -#include "SDL_mutex.h" -#include "SDL_timer.h" - - -/* This function is where all the magic happens... */ -SDL_bool -SDL_AtomicTryLock(SDL_SpinLock *lock) -{ -#if SDL_ATOMIC_DISABLED - /* Terrible terrible damage */ - static SDL_mutex *_spinlock_mutex; - - if (!_spinlock_mutex) { - /* Race condition on first lock... */ - _spinlock_mutex = SDL_CreateMutex(); - } - SDL_LockMutex(_spinlock_mutex); - if (*lock == 0) { - *lock = 1; - SDL_UnlockMutex(_spinlock_mutex); - return SDL_TRUE; - } else { - SDL_UnlockMutex(_spinlock_mutex); - return SDL_FALSE; - } - -#elif defined(_MSC_VER) - SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); - return (InterlockedExchange((long*)lock, 1) == 0); - -#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET - return (__sync_lock_test_and_set(lock, 1) == 0); - -#elif defined(__GNUC__) && defined(__arm__) && \ - (defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \ - defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \ - defined(__ARM_ARCH_5TEJ__)) - int result; - __asm__ __volatile__ ( - "swp %0, %1, [%2]\n" - : "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory"); - return (result == 0); - -#elif defined(__GNUC__) && defined(__arm__) - int result; - __asm__ __volatile__ ( - "ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]" - : "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory"); - return (result == 0); - -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - int result; - __asm__ __volatile__( - "lock ; xchgl %0, (%1)\n" - : "=r" (result) : "r" (lock), "0" (1) : "cc", "memory"); - return (result == 0); - -#elif defined(__MACOSX__) || defined(__IPHONEOS__) - /* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */ - return OSAtomicCompareAndSwap32Barrier(0, 1, lock); - -#elif HAVE_PTHREAD_SPINLOCK - /* pthread instructions */ - return (pthread_spin_trylock(lock) == 0); - -#else -#error Please implement for your platform. - return SDL_FALSE; -#endif -} - -void -SDL_AtomicLock(SDL_SpinLock *lock) -{ - /* FIXME: Should we have an eventual timeout? */ - while (!SDL_AtomicTryLock(lock)) { - SDL_Delay(0); - } -} - -void -SDL_AtomicUnlock(SDL_SpinLock *lock) -{ -#if defined(_MSC_VER) - _ReadWriteBarrier(); - *lock = 0; - -#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET - __sync_lock_release(lock); - -#elif HAVE_PTHREAD_SPINLOCK - pthread_spin_unlock(lock); - -#else - *lock = 0; -#endif -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audio.c b/Source/3rdParty/sdl/src/audio/SDL_audio.c deleted file mode 100644 index 40cb53923..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audio.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Allow access to a raw mixing buffer */ - -#include "SDL.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" -#include "SDL_audiomem.h" -#include "SDL_sysaudio.h" - -#define _THIS SDL_AudioDevice *_this - -static SDL_AudioDriver current_audio; -static SDL_AudioDevice *open_devices[16]; - -/* !!! FIXME: These are wordy and unlocalized... */ -#define DEFAULT_OUTPUT_DEVNAME "System audio output device" -#define DEFAULT_INPUT_DEVNAME "System audio capture device" - - -/* - * Not all of these will be compiled and linked in, but it's convenient - * to have a complete list here and saves yet-another block of #ifdefs... - * Please see bootstrap[], below, for the actual #ifdef mess. - */ -extern AudioBootStrap BSD_AUDIO_bootstrap; -extern AudioBootStrap DSP_bootstrap; -extern AudioBootStrap ALSA_bootstrap; -extern AudioBootStrap PULSEAUDIO_bootstrap; -extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; -extern AudioBootStrap NAS_bootstrap; -extern AudioBootStrap XAUDIO2_bootstrap; -extern AudioBootStrap DSOUND_bootstrap; -extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; -extern AudioBootStrap HAIKUAUDIO_bootstrap; -extern AudioBootStrap COREAUDIO_bootstrap; -extern AudioBootStrap SNDMGR_bootstrap; -extern AudioBootStrap DISKAUD_bootstrap; -extern AudioBootStrap DUMMYAUD_bootstrap; -extern AudioBootStrap DCAUD_bootstrap; -extern AudioBootStrap DART_bootstrap; -extern AudioBootStrap NDSAUD_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; -extern AudioBootStrap ANDROIDAUD_bootstrap; -extern AudioBootStrap PSPAUD_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; - -/* Available audio drivers */ -static const AudioBootStrap *const bootstrap[] = { -#if SDL_AUDIO_DRIVER_PULSEAUDIO - &PULSEAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ALSA - &ALSA_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_SNDIO - &SNDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_BSD - &BSD_AUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_OSS - &DSP_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_QSA - &QSAAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_SUNAUDIO - &SUNAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ARTS - &ARTS_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ESD - &ESD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_NAS - &NAS_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_XAUDIO2 - &XAUDIO2_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DSOUND - &DSOUND_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_WINMM - &WINMM_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_PAUDIO - &PAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_HAIKU - &HAIKUAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_COREAUDIO - &COREAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DISK - &DISKAUD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DUMMY - &DUMMYAUD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_FUSIONSOUND - &FUSIONSOUND_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ANDROID - &ANDROIDAUD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_PSP - &PSPAUD_bootstrap, -#endif - NULL -}; - -static SDL_AudioDevice * -get_audio_device(SDL_AudioDeviceID id) -{ - id--; - if ((id >= SDL_arraysize(open_devices)) || (open_devices[id] == NULL)) { - SDL_SetError("Invalid audio device ID"); - return NULL; - } - - return open_devices[id]; -} - - -/* stubs for audio drivers that don't need a specific entry point... */ -static void -SDL_AudioDetectDevices_Default(int iscapture, SDL_AddAudioDevice addfn) -{ /* no-op. */ -} - -static void -SDL_AudioThreadInit_Default(_THIS) -{ /* no-op. */ -} - -static void -SDL_AudioWaitDevice_Default(_THIS) -{ /* no-op. */ -} - -static void -SDL_AudioPlayDevice_Default(_THIS) -{ /* no-op. */ -} - -static Uint8 * -SDL_AudioGetDeviceBuf_Default(_THIS) -{ - return NULL; -} - -static void -SDL_AudioWaitDone_Default(_THIS) -{ /* no-op. */ -} - -static void -SDL_AudioCloseDevice_Default(_THIS) -{ /* no-op. */ -} - -static void -SDL_AudioDeinitialize_Default(void) -{ /* no-op. */ -} - -static int -SDL_AudioOpenDevice_Default(_THIS, const char *devname, int iscapture) -{ - return -1; -} - -static void -SDL_AudioLockDevice_Default(SDL_AudioDevice * device) -{ - if (device->thread && (SDL_ThreadID() == device->threadid)) { - return; - } - SDL_LockMutex(device->mixer_lock); -} - -static void -SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device) -{ - if (device->thread && (SDL_ThreadID() == device->threadid)) { - return; - } - SDL_UnlockMutex(device->mixer_lock); -} - - -static void -finalize_audio_entry_points(void) -{ - /* - * Fill in stub functions for unused driver entry points. This lets us - * blindly call them without having to check for validity first. - */ - -#define FILL_STUB(x) \ - if (current_audio.impl.x == NULL) { \ - current_audio.impl.x = SDL_Audio##x##_Default; \ - } - FILL_STUB(DetectDevices); - FILL_STUB(OpenDevice); - FILL_STUB(ThreadInit); - FILL_STUB(WaitDevice); - FILL_STUB(PlayDevice); - FILL_STUB(GetDeviceBuf); - FILL_STUB(WaitDone); - FILL_STUB(CloseDevice); - FILL_STUB(LockDevice); - FILL_STUB(UnlockDevice); - FILL_STUB(Deinitialize); -#undef FILL_STUB -} - -/* Streaming functions (for when the input and output buffer sizes are different) */ -/* Write [length] bytes from buf into the streamer */ -static void -SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length) -{ - int i; - - for (i = 0; i < length; ++i) { - stream->buffer[stream->write_pos] = buf[i]; - ++stream->write_pos; - } -} - -/* Read [length] bytes out of the streamer into buf */ -static void -SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length) -{ - int i; - - for (i = 0; i < length; ++i) { - buf[i] = stream->buffer[stream->read_pos]; - ++stream->read_pos; - } -} - -static int -SDL_StreamLength(SDL_AudioStreamer * stream) -{ - return (stream->write_pos - stream->read_pos) % stream->max_len; -} - -/* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ -#if 0 -static int -SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) -{ - /* First try to allocate the buffer */ - stream->buffer = (Uint8 *) SDL_malloc(max_len); - if (stream->buffer == NULL) { - return -1; - } - - stream->max_len = max_len; - stream->read_pos = 0; - stream->write_pos = 0; - - /* Zero out the buffer */ - SDL_memset(stream->buffer, silence, max_len); - - return 0; -} -#endif - -/* Deinitialize the stream simply by freeing the buffer */ -static void -SDL_StreamDeinit(SDL_AudioStreamer * stream) -{ - SDL_free(stream->buffer); -} - -#if defined(ANDROID) -#include -#endif - -/* The general mixing thread function */ -int SDLCALL -SDL_RunAudio(void *devicep) -{ - SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; - Uint8 *stream; - int stream_len; - void *udata; - void (SDLCALL * fill) (void *userdata, Uint8 * stream, int len); - Uint32 delay; - /* For streaming when the buffer sizes don't match up */ - Uint8 *istream; - int istream_len = 0; - - /* The audio mixing is always a high priority thread */ - SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); - - /* Perform any thread setup */ - device->threadid = SDL_ThreadID(); - current_audio.impl.ThreadInit(device); - - /* Set up the mixing function */ - fill = device->spec.callback; - udata = device->spec.userdata; - - /* By default do not stream */ - device->use_streamer = 0; - - if (device->convert.needed) { -#if 0 /* !!! FIXME: I took len_div out of the structure. Use rate_incr instead? */ - /* If the result of the conversion alters the length, i.e. resampling is being used, use the streamer */ - if (device->convert.len_mult != 1 || device->convert.len_div != 1) { - /* The streamer's maximum length should be twice whichever is larger: spec.size or len_cvt */ - stream_max_len = 2 * device->spec.size; - if (device->convert.len_mult > device->convert.len_div) { - stream_max_len *= device->convert.len_mult; - stream_max_len /= device->convert.len_div; - } - if (SDL_StreamInit(&device->streamer, stream_max_len, silence) < - 0) - return -1; - device->use_streamer = 1; - - /* istream_len should be the length of what we grab from the callback and feed to conversion, - so that we get close to spec_size. I.e. we want device.spec_size = istream_len * u / d - */ - istream_len = - device->spec.size * device->convert.len_div / - device->convert.len_mult; - } -#endif - stream_len = device->convert.len; - } else { - stream_len = device->spec.size; - } - - /* Calculate the delay while paused */ - delay = ((device->spec.samples * 1000) / device->spec.freq); - - /* Determine if the streamer is necessary here */ - if (device->use_streamer == 1) { - /* This code is almost the same as the old code. The difference is, instead of reading - directly from the callback into "stream", then converting and sending the audio off, - we go: callback -> "istream" -> (conversion) -> streamer -> stream -> device. - However, reading and writing with streamer are done separately: - - We only call the callback and write to the streamer when the streamer does not - contain enough samples to output to the device. - - We only read from the streamer and tell the device to play when the streamer - does have enough samples to output. - This allows us to perform resampling in the conversion step, where the output of the - resampling process can be any number. We will have to see what a good size for the - stream's maximum length is, but I suspect 2*max(len_cvt, stream_len) is a good figure. - */ - while (device->enabled) { - - if (device->paused) { - SDL_Delay(delay); - continue; - } - - /* Only read in audio if the streamer doesn't have enough already (if it does not have enough samples to output) */ - if (SDL_StreamLength(&device->streamer) < stream_len) { - /* Set up istream */ - if (device->convert.needed) { - if (device->convert.buf) { - istream = device->convert.buf; - } else { - continue; - } - } else { -/* FIXME: Ryan, this is probably wrong. I imagine we don't want to get - * a device buffer both here and below in the stream output. - */ - istream = current_audio.impl.GetDeviceBuf(device); - if (istream == NULL) { - istream = device->fake_stream; - } - } - - /* Read from the callback into the _input_ stream */ - SDL_LockMutex(device->mixer_lock); - (*fill) (udata, istream, istream_len); - SDL_UnlockMutex(device->mixer_lock); - - /* Convert the audio if necessary and write to the streamer */ - if (device->convert.needed) { - SDL_ConvertAudio(&device->convert); - if (istream == NULL) { - istream = device->fake_stream; - } - /* SDL_memcpy(istream, device->convert.buf, device->convert.len_cvt); */ - SDL_StreamWrite(&device->streamer, device->convert.buf, - device->convert.len_cvt); - } else { - SDL_StreamWrite(&device->streamer, istream, istream_len); - } - } - - /* Only output audio if the streamer has enough to output */ - if (SDL_StreamLength(&device->streamer) >= stream_len) { - /* Set up the output stream */ - if (device->convert.needed) { - if (device->convert.buf) { - stream = device->convert.buf; - } else { - continue; - } - } else { - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } - } - - /* Now read from the streamer */ - SDL_StreamRead(&device->streamer, stream, stream_len); - - /* Ready current buffer for play and change current buffer */ - if (stream != device->fake_stream) { - current_audio.impl.PlayDevice(device); - /* Wait for an audio buffer to become available */ - current_audio.impl.WaitDevice(device); - } else { - SDL_Delay(delay); - } - } - - } - } else { - /* Otherwise, do not use the streamer. This is the old code. */ - const int silence = (int) device->spec.silence; - - /* Loop, filling the audio buffers */ - while (device->enabled) { - - /* Fill the current buffer with sound */ - if (device->convert.needed) { - if (device->convert.buf) { - stream = device->convert.buf; - } else { - continue; - } - } else { - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } - } - - SDL_LockMutex(device->mixer_lock); - if (device->paused) { - SDL_memset(stream, silence, stream_len); - } else { - (*fill) (udata, stream, stream_len); - } - SDL_UnlockMutex(device->mixer_lock); - - /* Convert the audio if necessary */ - if (device->convert.needed) { - SDL_ConvertAudio(&device->convert); - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } - SDL_memcpy(stream, device->convert.buf, - device->convert.len_cvt); - } - - /* Ready current buffer for play and change current buffer */ - if (stream != device->fake_stream) { - current_audio.impl.PlayDevice(device); - /* Wait for an audio buffer to become available */ - current_audio.impl.WaitDevice(device); - } else { - SDL_Delay(delay); - } - } - } - - /* Wait for the audio to drain.. */ - current_audio.impl.WaitDone(device); - - /* If necessary, deinit the streamer */ - if (device->use_streamer == 1) - SDL_StreamDeinit(&device->streamer); - - return (0); -} - - -static SDL_AudioFormat -SDL_ParseAudioFormat(const char *string) -{ -#define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) return AUDIO_##x - CHECK_FMT_STRING(U8); - CHECK_FMT_STRING(S8); - CHECK_FMT_STRING(U16LSB); - CHECK_FMT_STRING(S16LSB); - CHECK_FMT_STRING(U16MSB); - CHECK_FMT_STRING(S16MSB); - CHECK_FMT_STRING(U16SYS); - CHECK_FMT_STRING(S16SYS); - CHECK_FMT_STRING(U16); - CHECK_FMT_STRING(S16); - CHECK_FMT_STRING(S32LSB); - CHECK_FMT_STRING(S32MSB); - CHECK_FMT_STRING(S32SYS); - CHECK_FMT_STRING(S32); - CHECK_FMT_STRING(F32LSB); - CHECK_FMT_STRING(F32MSB); - CHECK_FMT_STRING(F32SYS); - CHECK_FMT_STRING(F32); -#undef CHECK_FMT_STRING - return 0; -} - -int -SDL_GetNumAudioDrivers(void) -{ - return (SDL_arraysize(bootstrap) - 1); -} - -const char * -SDL_GetAudioDriver(int index) -{ - if (index >= 0 && index < SDL_GetNumAudioDrivers()) { - return (bootstrap[index]->name); - } - return (NULL); -} - -int -SDL_AudioInit(const char *driver_name) -{ - int i = 0; - int initialized = 0; - int tried_to_init = 0; - - if (SDL_WasInit(SDL_INIT_AUDIO)) { - SDL_AudioQuit(); /* shutdown driver if already running. */ - } - - SDL_memset(¤t_audio, '\0', sizeof(current_audio)); - SDL_memset(open_devices, '\0', sizeof(open_devices)); - - /* Select the proper audio driver */ - if (driver_name == NULL) { - driver_name = SDL_getenv("SDL_AUDIODRIVER"); - } - - for (i = 0; (!initialized) && (bootstrap[i]); ++i) { - /* make sure we should even try this driver before doing so... */ - const AudioBootStrap *backend = bootstrap[i]; - if ((driver_name && (SDL_strncasecmp(backend->name, driver_name, SDL_strlen(driver_name)) != 0)) || - (!driver_name && backend->demand_only)) { - continue; - } - - tried_to_init = 1; - SDL_memset(¤t_audio, 0, sizeof(current_audio)); - current_audio.name = backend->name; - current_audio.desc = backend->desc; - initialized = backend->init(¤t_audio.impl); - } - - if (!initialized) { - /* specific drivers will set the error message if they fail... */ - if (!tried_to_init) { - if (driver_name) { - SDL_SetError("Audio target '%s' not available", driver_name); - } else { - SDL_SetError("No available audio device"); - } - } - - SDL_memset(¤t_audio, 0, sizeof(current_audio)); - return (-1); /* No driver was available, so fail. */ - } - - finalize_audio_entry_points(); - - return (0); -} - -/* - * Get the current audio driver name - */ -const char * -SDL_GetCurrentAudioDriver() -{ - return current_audio.name; -} - -static void -free_device_list(char ***devices, int *devCount) -{ - int i = *devCount; - if ((i > 0) && (*devices != NULL)) { - while (i--) { - SDL_free((*devices)[i]); - } - } - - SDL_free(*devices); - - *devices = NULL; - *devCount = 0; -} - -static -void SDL_AddCaptureAudioDevice(const char *_name) -{ - char *name = NULL; - void *ptr = SDL_realloc(current_audio.inputDevices, - (current_audio.inputDeviceCount+1) * sizeof(char*)); - if (ptr == NULL) { - return; /* oh well. */ - } - - current_audio.inputDevices = (char **) ptr; - name = SDL_strdup(_name); /* if this returns NULL, that's okay. */ - current_audio.inputDevices[current_audio.inputDeviceCount++] = name; -} - -static -void SDL_AddOutputAudioDevice(const char *_name) -{ - char *name = NULL; - void *ptr = SDL_realloc(current_audio.outputDevices, - (current_audio.outputDeviceCount+1) * sizeof(char*)); - if (ptr == NULL) { - return; /* oh well. */ - } - - current_audio.outputDevices = (char **) ptr; - name = SDL_strdup(_name); /* if this returns NULL, that's okay. */ - current_audio.outputDevices[current_audio.outputDeviceCount++] = name; -} - - -int -SDL_GetNumAudioDevices(int iscapture) -{ - int retval = 0; - - if (!SDL_WasInit(SDL_INIT_AUDIO)) { - return -1; - } - - if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) { - return 0; - } - - if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) { - return 1; - } - - if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { - return 1; - } - - if (iscapture) { - free_device_list(¤t_audio.inputDevices, - ¤t_audio.inputDeviceCount); - current_audio.impl.DetectDevices(iscapture, SDL_AddCaptureAudioDevice); - retval = current_audio.inputDeviceCount; - } else { - free_device_list(¤t_audio.outputDevices, - ¤t_audio.outputDeviceCount); - current_audio.impl.DetectDevices(iscapture, SDL_AddOutputAudioDevice); - retval = current_audio.outputDeviceCount; - } - - return retval; -} - - -const char * -SDL_GetAudioDeviceName(int index, int iscapture) -{ - if (!SDL_WasInit(SDL_INIT_AUDIO)) { - SDL_SetError("Audio subsystem is not initialized"); - return NULL; - } - - if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) { - SDL_SetError("No capture support"); - return NULL; - } - - if (index < 0) { - goto no_such_device; - } - - if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) { - if (index > 0) { - goto no_such_device; - } - return DEFAULT_INPUT_DEVNAME; - } - - if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { - if (index > 0) { - goto no_such_device; - } - return DEFAULT_OUTPUT_DEVNAME; - } - - if (iscapture) { - if (index >= current_audio.inputDeviceCount) { - goto no_such_device; - } - return current_audio.inputDevices[index]; - } else { - if (index >= current_audio.outputDeviceCount) { - goto no_such_device; - } - return current_audio.outputDevices[index]; - } - -no_such_device: - SDL_SetError("No such device"); - return NULL; -} - - -static void -close_audio_device(SDL_AudioDevice * device) -{ - device->enabled = 0; - if (device->thread != NULL) { - SDL_WaitThread(device->thread, NULL); - } - if (device->mixer_lock != NULL) { - SDL_DestroyMutex(device->mixer_lock); - } - SDL_FreeAudioMem(device->fake_stream); - if (device->convert.needed) { - SDL_FreeAudioMem(device->convert.buf); - } - if (device->opened) { - current_audio.impl.CloseDevice(device); - device->opened = 0; - } - SDL_FreeAudioMem(device); -} - - -/* - * Sanity check desired AudioSpec for SDL_OpenAudio() in (orig). - * Fills in a sanitized copy in (prepared). - * Returns non-zero if okay, zero on fatal parameters in (orig). - */ -static int -prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared) -{ - SDL_memcpy(prepared, orig, sizeof(SDL_AudioSpec)); - - if (orig->callback == NULL) { - SDL_SetError("SDL_OpenAudio() passed a NULL callback"); - return 0; - } - - if (orig->freq == 0) { - const char *env = SDL_getenv("SDL_AUDIO_FREQUENCY"); - if ((!env) || ((prepared->freq = SDL_atoi(env)) == 0)) { - prepared->freq = 22050; /* a reasonable default */ - } - } - - if (orig->format == 0) { - const char *env = SDL_getenv("SDL_AUDIO_FORMAT"); - if ((!env) || ((prepared->format = SDL_ParseAudioFormat(env)) == 0)) { - prepared->format = AUDIO_S16; /* a reasonable default */ - } - } - - switch (orig->channels) { - case 0:{ - const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); - if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { - prepared->channels = 2; /* a reasonable default */ - } - break; - } - case 1: /* Mono */ - case 2: /* Stereo */ - case 4: /* surround */ - case 6: /* surround with center and lfe */ - break; - default: - SDL_SetError("Unsupported number of audio channels."); - return 0; - } - - if (orig->samples == 0) { - const char *env = SDL_getenv("SDL_AUDIO_SAMPLES"); - if ((!env) || ((prepared->samples = (Uint16) SDL_atoi(env)) == 0)) { - /* Pick a default of ~46 ms at desired frequency */ - /* !!! FIXME: remove this when the non-Po2 resampling is in. */ - const int samples = (prepared->freq / 1000) * 46; - int power2 = 1; - while (power2 < samples) { - power2 *= 2; - } - prepared->samples = power2; - } - } - - /* Calculate the silence and size of the audio specification */ - SDL_CalculateAudioSpec(prepared); - - return 1; -} - - -static SDL_AudioDeviceID -open_audio_device(const char *devname, int iscapture, - const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, - int allowed_changes, int min_id) -{ - SDL_AudioDeviceID id = 0; - SDL_AudioSpec _obtained; - SDL_AudioDevice *device; - SDL_bool build_cvt; - int i = 0; - - if (!SDL_WasInit(SDL_INIT_AUDIO)) { - SDL_SetError("Audio subsystem is not initialized"); - return 0; - } - - if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) { - SDL_SetError("No capture support"); - return 0; - } - - if (!obtained) { - obtained = &_obtained; - } - if (!prepare_audiospec(desired, obtained)) { - return 0; - } - - /* If app doesn't care about a specific device, let the user override. */ - if (devname == NULL) { - devname = SDL_getenv("SDL_AUDIO_DEVICE_NAME"); - } - - /* - * Catch device names at the high level for the simple case... - * This lets us have a basic "device enumeration" for systems that - * don't have multiple devices, but makes sure the device name is - * always NULL when it hits the low level. - * - * Also make sure that the simple case prevents multiple simultaneous - * opens of the default system device. - */ - - if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) { - if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) { - SDL_SetError("No such device"); - return 0; - } - devname = NULL; - - for (i = 0; i < SDL_arraysize(open_devices); i++) { - if ((open_devices[i]) && (open_devices[i]->iscapture)) { - SDL_SetError("Audio device already open"); - return 0; - } - } - } - - if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { - if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) { - SDL_SetError("No such device"); - return 0; - } - devname = NULL; - - for (i = 0; i < SDL_arraysize(open_devices); i++) { - if ((open_devices[i]) && (!open_devices[i]->iscapture)) { - SDL_SetError("Audio device already open"); - return 0; - } - } - } - - device = (SDL_AudioDevice *) SDL_AllocAudioMem(sizeof(SDL_AudioDevice)); - if (device == NULL) { - SDL_OutOfMemory(); - return 0; - } - SDL_memset(device, '\0', sizeof(SDL_AudioDevice)); - device->spec = *obtained; - device->enabled = 1; - device->paused = 1; - device->iscapture = iscapture; - - /* Create a semaphore for locking the sound buffers */ - if (!current_audio.impl.SkipMixerLock) { - device->mixer_lock = SDL_CreateMutex(); - if (device->mixer_lock == NULL) { - close_audio_device(device); - SDL_SetError("Couldn't create mixer lock"); - return 0; - } - } - - /* force a device detection if we haven't done one yet. */ - if ( ((iscapture) && (current_audio.inputDevices == NULL)) || - ((!iscapture) && (current_audio.outputDevices == NULL)) ) - SDL_GetNumAudioDevices(iscapture); - - if (current_audio.impl.OpenDevice(device, devname, iscapture) < 0) { - close_audio_device(device); - return 0; - } - device->opened = 1; - - /* Allocate a fake audio memory buffer */ - device->fake_stream = (Uint8 *)SDL_AllocAudioMem(device->spec.size); - if (device->fake_stream == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - - /* See if we need to do any conversion */ - build_cvt = SDL_FALSE; - if (obtained->freq != device->spec.freq) { - if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) { - obtained->freq = device->spec.freq; - } else { - build_cvt = SDL_TRUE; - } - } - if (obtained->format != device->spec.format) { - if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) { - obtained->format = device->spec.format; - } else { - build_cvt = SDL_TRUE; - } - } - if (obtained->channels != device->spec.channels) { - if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) { - obtained->channels = device->spec.channels; - } else { - build_cvt = SDL_TRUE; - } - } - - /* If the audio driver changes the buffer size, accept it. - This needs to be done after the format is modified above, - otherwise it might not have the correct buffer size. - */ - if (device->spec.samples != obtained->samples) { - obtained->samples = device->spec.samples; - SDL_CalculateAudioSpec(obtained); - } - - if (build_cvt) { - /* Build an audio conversion block */ - if (SDL_BuildAudioCVT(&device->convert, - obtained->format, obtained->channels, - obtained->freq, - device->spec.format, device->spec.channels, - device->spec.freq) < 0) { - close_audio_device(device); - return 0; - } - if (device->convert.needed) { - device->convert.len = (int) (((double) device->spec.size) / - device->convert.len_ratio); - - device->convert.buf = - (Uint8 *) SDL_AllocAudioMem(device->convert.len * - device->convert.len_mult); - if (device->convert.buf == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - } - } - - /* Find an available device ID and store the structure... */ - for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { - if (open_devices[id] == NULL) { - open_devices[id] = device; - break; - } - } - - if (id == SDL_arraysize(open_devices)) { - SDL_SetError("Too many open audio devices"); - close_audio_device(device); - return 0; - } - - /* Start the audio thread if necessary */ - if (!current_audio.impl.ProvidesOwnCallbackThread) { - /* Start the audio thread */ - char name[64]; - SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) (id + 1)); -/* !!! FIXME: this is nasty. */ -#if defined(__WIN32__) && !defined(HAVE_LIBC) -#undef SDL_CreateThread -#if SDL_DYNAMIC_API - device->thread = SDL_CreateThread_REAL(SDL_RunAudio, name, device, NULL, NULL); -#else - device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL); -#endif -#else - device->thread = SDL_CreateThread(SDL_RunAudio, name, device); -#endif - if (device->thread == NULL) { - SDL_CloseAudioDevice(id + 1); - SDL_SetError("Couldn't create audio thread"); - return 0; - } - } - - return id + 1; -} - - -int -SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) -{ - SDL_AudioDeviceID id = 0; - - /* Start up the audio driver, if necessary. This is legacy behaviour! */ - if (!SDL_WasInit(SDL_INIT_AUDIO)) { - if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { - return (-1); - } - } - - /* SDL_OpenAudio() is legacy and can only act on Device ID #1. */ - if (open_devices[0] != NULL) { - SDL_SetError("Audio device is already opened"); - return (-1); - } - - if (obtained) { - id = open_audio_device(NULL, 0, desired, obtained, - SDL_AUDIO_ALLOW_ANY_CHANGE, 1); - } else { - id = open_audio_device(NULL, 0, desired, desired, 0, 1); - } - - SDL_assert((id == 0) || (id == 1)); - return ((id == 0) ? -1 : 0); -} - -SDL_AudioDeviceID -SDL_OpenAudioDevice(const char *device, int iscapture, - const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, - int allowed_changes) -{ - return open_audio_device(device, iscapture, desired, obtained, - allowed_changes, 2); -} - -SDL_AudioStatus -SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid) -{ - SDL_AudioDevice *device = get_audio_device(devid); - SDL_AudioStatus status = SDL_AUDIO_STOPPED; - if (device && device->enabled) { - if (device->paused) { - status = SDL_AUDIO_PAUSED; - } else { - status = SDL_AUDIO_PLAYING; - } - } - return (status); -} - - -SDL_AudioStatus -SDL_GetAudioStatus(void) -{ - return SDL_GetAudioDeviceStatus(1); -} - -void -SDL_PauseAudioDevice(SDL_AudioDeviceID devid, int pause_on) -{ - SDL_AudioDevice *device = get_audio_device(devid); - if (device) { - current_audio.impl.LockDevice(device); - device->paused = pause_on; - current_audio.impl.UnlockDevice(device); - } -} - -void -SDL_PauseAudio(int pause_on) -{ - SDL_PauseAudioDevice(1, pause_on); -} - - -void -SDL_LockAudioDevice(SDL_AudioDeviceID devid) -{ - /* Obtain a lock on the mixing buffers */ - SDL_AudioDevice *device = get_audio_device(devid); - if (device) { - current_audio.impl.LockDevice(device); - } -} - -void -SDL_LockAudio(void) -{ - SDL_LockAudioDevice(1); -} - -void -SDL_UnlockAudioDevice(SDL_AudioDeviceID devid) -{ - /* Obtain a lock on the mixing buffers */ - SDL_AudioDevice *device = get_audio_device(devid); - if (device) { - current_audio.impl.UnlockDevice(device); - } -} - -void -SDL_UnlockAudio(void) -{ - SDL_UnlockAudioDevice(1); -} - -void -SDL_CloseAudioDevice(SDL_AudioDeviceID devid) -{ - SDL_AudioDevice *device = get_audio_device(devid); - if (device) { - close_audio_device(device); - open_devices[devid - 1] = NULL; - } -} - -void -SDL_CloseAudio(void) -{ - SDL_CloseAudioDevice(1); -} - -void -SDL_AudioQuit(void) -{ - SDL_AudioDeviceID i; - - if (!current_audio.name) { /* not initialized?! */ - return; - } - - for (i = 0; i < SDL_arraysize(open_devices); i++) { - if (open_devices[i] != NULL) { - SDL_CloseAudioDevice(i+1); - } - } - - /* Free the driver data */ - current_audio.impl.Deinitialize(); - free_device_list(¤t_audio.outputDevices, - ¤t_audio.outputDeviceCount); - free_device_list(¤t_audio.inputDevices, - ¤t_audio.inputDeviceCount); - SDL_memset(¤t_audio, '\0', sizeof(current_audio)); - SDL_memset(open_devices, '\0', sizeof(open_devices)); -} - -#define NUM_FORMATS 10 -static int format_idx; -static int format_idx_sub; -static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = { - {AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, - AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB}, - {AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, - AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB}, - {AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S32LSB, - AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S32MSB, - AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, - AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_S32MSB, - AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S16LSB, - AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S16MSB, - AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S16LSB, - AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8}, - {AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_S16MSB, - AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8}, -}; - -SDL_AudioFormat -SDL_FirstAudioFormat(SDL_AudioFormat format) -{ - for (format_idx = 0; format_idx < NUM_FORMATS; ++format_idx) { - if (format_list[format_idx][0] == format) { - break; - } - } - format_idx_sub = 0; - return (SDL_NextAudioFormat()); -} - -SDL_AudioFormat -SDL_NextAudioFormat(void) -{ - if ((format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS)) { - return (0); - } - return (format_list[format_idx][format_idx_sub++]); -} - -void -SDL_CalculateAudioSpec(SDL_AudioSpec * spec) -{ - switch (spec->format) { - case AUDIO_U8: - spec->silence = 0x80; - break; - default: - spec->silence = 0x00; - break; - } - spec->size = SDL_AUDIO_BITSIZE(spec->format) / 8; - spec->size *= spec->channels; - spec->size *= spec->samples; -} - - -/* - * Moved here from SDL_mixer.c, since it relies on internals of an opened - * audio device (and is deprecated, by the way!). - */ -void -SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume) -{ - /* Mix the user-level audio format */ - SDL_AudioDevice *device = get_audio_device(1); - if (device != NULL) { - SDL_AudioFormat format; - if (device->convert.needed) { - format = device->convert.src_format; - } else { - format = device->spec.format; - } - SDL_MixAudioFormat(dst, src, format, len, volume); - } -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audio_c.h b/Source/3rdParty/sdl/src/audio/SDL_audio_c.h deleted file mode 100644 index 2ea4e148c..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audio_c.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ - -/* Functions to get a list of "close" audio formats */ -extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format); -extern SDL_AudioFormat SDL_NextAudioFormat(void); - -/* Function to calculate the size and silence for a SDL_AudioSpec */ -extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec); - -/* The actual mixing thread function */ -extern int SDLCALL SDL_RunAudio(void *audiop); - -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat src_fmt; - SDL_AudioFormat dst_fmt; - SDL_AudioFilter filter; -} SDL_AudioTypeFilters; -extern const SDL_AudioTypeFilters sdl_audio_type_filters[]; - -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat fmt; - int channels; - int upsample; - int multiple; - SDL_AudioFilter filter; -} SDL_AudioRateFilters; -extern const SDL_AudioRateFilters sdl_audio_rate_filters[]; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audiocvt.c b/Source/3rdParty/sdl/src/audio/SDL_audiocvt.c deleted file mode 100644 index 518735bfc..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audiocvt.c +++ /dev/null @@ -1,1121 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Functions for audio drivers to perform runtime conversion of audio format */ - -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#include "SDL_assert.h" - -/* #define DEBUG_CONVERT */ - -/* Effectively mix right and left channels into a single channel */ -static void SDLCALL -SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - Sint32 sample; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to mono\n"); -#endif - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Uint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst; - - src = (Sint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Sint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[0] << 8) | src[1]) + - (Uint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[1] << 8) | src[0]) + - (Uint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[0] << 8) | src[1]) + - (Sint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[1] << 8) | src[0]) + - (Sint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) cvt->buf; - Uint32 *dst = (Uint32 *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapBE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapBE32(src[1]))); - *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2))); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapLE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapLE32(src[1]))); - *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2))); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) cvt->buf; - float *dst = (float *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatBE(src[0]); - const float src2 = SDL_SwapFloatBE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatBE(halved); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatLE(src[0]); - const float src2 = SDL_SwapFloatLE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatLE(halved); - } - } - } - break; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Discard top 4 channels */ -static void SDLCALL -SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting down from 6 channels to stereo\n"); -#endif - -#define strip_chans_6_to_2(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - src += 6; \ - dst += 2; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_2(Uint8); - break; - case 16: - strip_chans_6_to_2(Uint16); - break; - case 32: - strip_chans_6_to_2(Uint32); - break; - } - -#undef strip_chans_6_to_2 - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Discard top 2 channels of 6 */ -static void SDLCALL -SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting 6 down to quad\n"); -#endif - -#define strip_chans_6_to_4(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - dst[2] = src[2]; \ - dst[3] = src[3]; \ - src += 6; \ - dst += 4; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_4(Uint8); - break; - case 16: - strip_chans_6_to_4(Uint16); - break; - case 32: - strip_chans_6_to_4(Uint32); - break; - } - -#undef strip_chans_6_to_4 - - cvt->len_cvt /= 6; - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Duplicate a mono channel to both stereo channels */ -static void SDLCALL -SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to stereo\n"); -#endif - -#define dup_chans_1_to_2(type) \ - { \ - const type *src = (const type *) (cvt->buf + cvt->len_cvt); \ - type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \ - for (i = cvt->len_cvt / sizeof(type); i; --i) { \ - src -= 1; \ - dst -= 2; \ - dst[0] = dst[1] = *src; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - dup_chans_1_to_2(Uint8); - break; - case 16: - dup_chans_1_to_2(Uint16); - break; - case 32: - dup_chans_1_to_2(Uint32); - break; - } - -#undef dup_chans_1_to_2 - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Duplicate a stereo channel to a pseudo-5.1 stream */ -static void SDLCALL -SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to surround\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3); - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3; - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - Sint32 lf, rf, ce; - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = SDL_SwapBE32((Uint32) lf); - dst[1] = SDL_SwapBE32((Uint32) rf); - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapBE32((Uint32) ce); - dst[5] = SDL_SwapBE32((Uint32) ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapLE32((Uint32) ce); - dst[5] = SDL_SwapLE32((Uint32) ce); - } - } - } - break; - - case AUDIO_F32: - { - float lf, rf, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatBE(ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatLE(ce); - } - } - } - break; - - } - cvt->len_cvt *= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Duplicate a stereo channel to a pseudo-4.0 stream */ -static void SDLCALL -SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to quad\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2); - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2; - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2); - Sint32 lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - float lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - } - } - } - break; - } - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -int -SDL_ConvertAudio(SDL_AudioCVT * cvt) -{ - /* !!! FIXME: (cvt) should be const; stack-copy it here. */ - /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */ - - /* Make sure there's data to convert */ - if (cvt->buf == NULL) { - SDL_SetError("No buffer allocated for conversion"); - return (-1); - } - /* Return okay if no conversion is necessary */ - cvt->len_cvt = cvt->len; - if (cvt->filters[0] == NULL) { - return (0); - } - - /* Set up the conversion and go! */ - cvt->filter_index = 0; - cvt->filters[0] (cvt, cvt->src_format); - return (0); -} - - -static SDL_AudioFilter -SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - - -/* - * Find a converter between two data types. We try to select a hand-tuned - * asm/vectorized/optimized function first, and then fallback to an - * autogenerated function that is customized to convert between two - * specific data types. - */ -static int -SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) -{ - if (src_fmt != dst_fmt) { - const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); - const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); - SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt); - - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) { - const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i]; - if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these formats"); - return -1; - } - } - - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_bitsize < dst_bitsize) { - const int mult = (dst_bitsize / src_bitsize); - cvt->len_mult *= mult; - cvt->len_ratio *= mult; - } else if (src_bitsize > dst_bitsize) { - cvt->len_ratio /= (src_bitsize / dst_bitsize); - } - - return 1; /* added a converter. */ - } - - return 0; /* no conversion necessary. */ -} - - -static SDL_AudioFilter -SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - -static int -SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate) -{ - int retval = 0; - - /* If we only built with the arbitrary resamplers, ignore multiples. */ -#if !LESS_RESAMPLERS - int lo, hi; - int div; - - SDL_assert(src_rate != 0); - SDL_assert(dst_rate != 0); - SDL_assert(src_rate != dst_rate); - - if (src_rate < dst_rate) { - lo = src_rate; - hi = dst_rate; - } else { - lo = dst_rate; - hi = src_rate; - } - - /* zero means "not a supported multiple" ... we only do 2x and 4x. */ - if ((hi % lo) != 0) - return 0; /* not a multiple. */ - - div = hi / lo; - retval = ((div == 2) || (div == 4)) ? div : 0; -#endif - - return retval; -} - -static int -SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - if (src_rate != dst_rate) { - SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels, - src_rate, dst_rate); - - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - const int upsample = (src_rate < dst_rate) ? 1 : 0; - const int multiple = - SDL_FindFrequencyMultiple(src_rate, dst_rate); - - for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) { - const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i]; - if ((filt->fmt == cvt->dst_format) && - (filt->channels == dst_channels) && - (filt->upsample == upsample) && - (filt->multiple == multiple)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these rates"); - return -1; - } - } - - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_rate < dst_rate) { - const double mult = ((double) dst_rate) / ((double) src_rate); - cvt->len_mult *= (int) SDL_ceil(mult); - cvt->len_ratio *= mult; - } else { - cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); - } - - return 1; /* added a converter. */ - } - - return 0; /* no conversion necessary. */ -} - - -/* Creates a set of audio filters to convert from one format to another. - Returns -1 if the format conversion is not supported, 0 if there's - no conversion needed, or 1 if the audio filter is set up. -*/ - -int -SDL_BuildAudioCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, - SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) -{ - /* - * !!! FIXME: reorder filters based on which grow/shrink the buffer. - * !!! FIXME: ideally, we should do everything that shrinks the buffer - * !!! FIXME: first, so we don't have to process as many bytes in a given - * !!! FIXME: filter and abuse the CPU cache less. This might not be as - * !!! FIXME: good in practice as it sounds in theory, though. - */ - - /* Sanity check target pointer */ - if (cvt == NULL) { - return SDL_InvalidParamError("cvt"); - } - - /* there are no unsigned types over 16 bits, so catch this up front. */ - if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) { - return SDL_SetError("Invalid source format"); - } - if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) { - return SDL_SetError("Invalid destination format"); - } - - /* prevent possible divisions by zero, etc. */ - if ((src_channels == 0) || (dst_channels == 0)) { - return SDL_SetError("Source or destination channels is zero"); - } - if ((src_rate == 0) || (dst_rate == 0)) { - return SDL_SetError("Source or destination rate is zero"); - } -#ifdef DEBUG_CONVERT - printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", - src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); -#endif - - /* Start off with no conversion necessary */ - SDL_zerop(cvt); - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->needed = 0; - cvt->filter_index = 0; - cvt->filters[0] = NULL; - cvt->len_mult = 1; - cvt->len_ratio = 1.0; - cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); - - /* Convert data types, if necessary. Updates (cvt). */ - if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) { - return -1; /* shouldn't happen, but just in case... */ - } - - /* Channel conversion */ - if (src_channels != dst_channels) { - if ((src_channels == 1) && (dst_channels > 1)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels = 2; - cvt->len_ratio *= 2; - } - if ((src_channels == 2) && (dst_channels == 6)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround; - src_channels = 6; - cvt->len_mult *= 3; - cvt->len_ratio *= 3; - } - if ((src_channels == 2) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround_4; - src_channels = 4; - cvt->len_mult *= 2; - cvt->len_ratio *= 2; - } - while ((src_channels * 2) <= dst_channels) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels *= 2; - cvt->len_ratio *= 2; - } - if ((src_channels == 6) && (dst_channels <= 2)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip; - src_channels = 2; - cvt->len_ratio /= 3; - } - if ((src_channels == 6) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip_2; - src_channels = 4; - cvt->len_ratio /= 2; - } - /* This assumes that 4 channel audio is in the format: - Left {front/back} + Right {front/back} - so converting to L/R stereo works properly. - */ - while (((src_channels % 2) == 0) && - ((src_channels / 2) >= dst_channels)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertMono; - src_channels /= 2; - cvt->len_ratio /= 2; - } - if (src_channels != dst_channels) { - /* Uh oh.. */ ; - } - } - - /* Do rate conversion, if necessary. Updates (cvt). */ - if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) == - -1) { - return -1; /* shouldn't happen, but just in case... */ - } - - /* Set up the filter information */ - if (cvt->filter_index != 0) { - cvt->needed = 1; - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->len = 0; - cvt->buf = NULL; - cvt->filters[cvt->filter_index] = NULL; - } - return (cvt->needed); -} - - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audiodev.c b/Source/3rdParty/sdl/src/audio/SDL_audiodev.c deleted file mode 100644 index e9af62119..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audiodev.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Get the name of the audio device we use for output */ - -#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO - -#include -#include -#include -#include /* For close() */ - -#include "SDL_stdinc.h" -#include "SDL_audiodev_c.h" - -#ifndef _PATH_DEV_DSP -#if defined(__NETBSD__) || defined(__OPENBSD__) -#define _PATH_DEV_DSP "/dev/audio" -#else -#define _PATH_DEV_DSP "/dev/dsp" -#endif -#endif -#ifndef _PATH_DEV_DSP24 -#define _PATH_DEV_DSP24 "/dev/sound/dsp" -#endif -#ifndef _PATH_DEV_AUDIO -#define _PATH_DEV_AUDIO "/dev/audio" -#endif - -static SDL_INLINE void -test_device(const char *fname, int flags, int (*test) (int fd), - SDL_AddAudioDevice addfn) -{ - struct stat sb; - if ((stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode))) { - const int audio_fd = open(fname, flags, 0); - if (audio_fd >= 0) { - if (test(audio_fd)) { - addfn(fname); - } - close(audio_fd); - } - } -} - -static int -test_stub(int fd) -{ - return 1; -} - -void -SDL_EnumUnixAudioDevices(int iscapture, int classic, int (*test)(int fd), - SDL_AddAudioDevice addfn) -{ - const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); - const char *audiodev; - char audiopath[1024]; - - if (test == NULL) - test = test_stub; - - /* Figure out what our audio device is */ - if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) && - ((audiodev = SDL_getenv("AUDIODEV")) == NULL)) { - if (classic) { - audiodev = _PATH_DEV_AUDIO; - } else { - struct stat sb; - - /* Added support for /dev/sound/\* in Linux 2.4 */ - if (((stat("/dev/sound", &sb) == 0) && S_ISDIR(sb.st_mode)) - && ((stat(_PATH_DEV_DSP24, &sb) == 0) - && S_ISCHR(sb.st_mode))) { - audiodev = _PATH_DEV_DSP24; - } else { - audiodev = _PATH_DEV_DSP; - } - } - } - test_device(audiodev, flags, test, addfn); - - if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) { - int instance = 0; - while (instance++ <= 64) { - SDL_snprintf(audiopath, SDL_arraysize(audiopath), - "%s%d", audiodev, instance); - test_device(audiopath, flags, test, addfn); - } - } -} - -#endif /* Audio driver selection */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audiodev_c.h b/Source/3rdParty/sdl/src/audio/SDL_audiodev_c.h deleted file mode 100644 index 1ad0dc101..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audiodev_c.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL.h" -#include "../SDL_internal.h" -#include "SDL_sysaudio.h" - -/* Open the audio device for playback, and don't block if busy */ -/* #define USE_BLOCKING_WRITES */ - -#ifdef USE_BLOCKING_WRITES -#define OPEN_FLAGS_OUTPUT O_WRONLY -#define OPEN_FLAGS_INPUT O_RDONLY -#else -#define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK) -#define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK) -#endif - -void SDL_EnumUnixAudioDevices(int iscapture, int classic, - int (*test) (int fd), SDL_AddAudioDevice addfn); - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audiomem.h b/Source/3rdParty/sdl/src/audio/SDL_audiomem.h deleted file mode 100644 index 3711ac945..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audiomem.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#define SDL_AllocAudioMem SDL_malloc -#define SDL_FreeAudioMem SDL_free -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_audiotypecvt.c b/Source/3rdParty/sdl/src/audio/SDL_audiotypecvt.c deleted file mode 100644 index 18e227736..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_audiotypecvt.c +++ /dev/null @@ -1,16015 +0,0 @@ -/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../SDL_internal.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 -#endif - - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 -#endif - -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 -#endif - -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif - - -/* *INDENT-OFF* */ - -#define DIVBY127 0.0078740157480315f -#define DIVBY32767 3.05185094759972e-05f -#define DIVBY2147483647 4.6566128752458e-10f - -#if !NO_CONVERTERS - -static void SDLCALL -SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n"); -#endif - - src = (const Uint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Sint8 val = ((*src) ^ 0x80); - *dst = ((Sint8) val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n"); -#endif - - src = (const Uint8 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Uint8 val = ((((Sint8) *src)) ^ 0x80); - *dst = val; - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapLE16(*src); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapBE16(*src); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatLE(*src); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatBE(*src); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -#endif /* !NO_CONVERTERS */ - - -const SDL_AudioTypeFilters sdl_audio_type_filters[] = -{ -#if !NO_CONVERTERS - { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 }, - { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB }, - { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB }, - { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB }, - { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB }, - { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB }, - { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB }, - { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB }, - { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB }, - { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 }, - { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB }, - { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB }, - { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB }, - { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB }, - { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB }, - { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB }, - { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB }, - { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB }, - { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 }, - { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 }, - { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB }, - { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB }, - { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB }, - { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB }, - { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB }, - { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB }, - { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB }, - { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 }, - { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 }, - { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB }, - { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB }, - { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB }, - { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB }, - { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB }, - { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB }, - { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB }, - { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 }, - { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 }, - { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB }, - { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB }, - { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB }, - { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB }, - { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB }, - { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB }, - { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB }, - { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 }, - { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 }, - { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB }, - { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB }, - { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB }, - { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB }, - { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB }, - { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB }, - { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB }, - { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 }, - { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 }, - { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB }, - { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB }, - { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB }, - { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB }, - { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB }, - { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB }, - { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB }, - { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 }, - { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 }, - { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB }, - { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB }, - { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB }, - { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB }, - { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB }, - { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB }, - { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB }, - { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 }, - { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 }, - { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB }, - { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB }, - { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB }, - { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB }, - { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB }, - { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB }, - { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB }, - { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 }, - { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 }, - { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB }, - { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB }, - { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB }, - { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB }, - { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB }, - { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB }, - { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB }, -#endif /* !NO_CONVERTERS */ - { 0, 0, NULL } -}; - - -#if !NO_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = sample0; - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst++; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = sample1; - dst[0] = sample0; - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst += 2; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst += 4; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst += 6; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample7 = src[7]; - Uint8 sample6 = src[6]; - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample7 = sample7; - Uint8 last_sample6 = sample6; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = sample7; - dst[6] = sample6; - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 sample6 = src[6]; - Uint8 sample7 = src[7]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - Uint8 last_sample6 = sample6; - Uint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst[6] = sample6; - dst[7] = sample7; - dst += 8; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint8) sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst++; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst += 2; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst += 4; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst += 6; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample7 = sample7; - Sint8 last_sample6 = sample6; - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint8) sample7); - dst[6] = ((Sint8) sample6); - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - Sint8 last_sample6 = sample6; - Sint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst[6] = ((Sint8) sample6); - dst[7] = ((Sint8) sample7); - dst += 8; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapLE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapLE16(sample7); - dst[6] = SDL_SwapLE16(sample6); - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst[6] = SDL_SwapLE16(sample6); - dst[7] = SDL_SwapLE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapBE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapBE16(sample7); - dst[6] = SDL_SwapBE16(sample6); - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst[6] = SDL_SwapBE16(sample6); - dst[7] = SDL_SwapBE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatLE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatLE(src[7]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatLE(sample7); - dst[6] = SDL_SwapFloatLE(sample6); - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample7 = SDL_SwapFloatLE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst[6] = SDL_SwapFloatLE(sample6); - dst[7] = SDL_SwapFloatLE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatBE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatBE(src[7]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatBE(sample7); - dst[6] = SDL_SwapFloatBE(sample6); - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample7 = SDL_SwapFloatBE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst[6] = SDL_SwapFloatBE(sample6); - dst[7] = SDL_SwapFloatBE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -#if !LESS_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 2; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[3] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[7] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[11] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 12; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 24; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[15] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 32; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 2; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[3] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[7] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[11] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 12; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 24; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[15] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 32; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - - -const SDL_AudioRateFilters sdl_audio_rate_filters[] = -{ -#if !NO_RESAMPLERS - { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c }, - { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c }, - { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c }, - { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c }, - { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c }, - { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c }, - { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c }, - { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c }, - { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c }, - { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c }, - { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c }, - { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c }, - { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c }, - { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c }, - { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c }, - { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c }, - { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c }, - { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c }, - { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c }, - { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c }, - { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c }, - { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c }, - { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c }, - { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c }, - { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c }, - { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c }, - { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c }, - { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c }, - { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c }, - { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c }, - { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c }, - { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c }, - { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c }, - { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c }, - { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c }, - { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c }, - { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c }, - { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c }, - { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c }, - { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c }, - { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c }, - { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c }, - { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c }, - { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c }, - { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c }, - { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c }, - { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c }, - { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c }, - { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c }, - { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c }, - { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c }, - { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c }, - { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c }, - { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c }, - { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c }, - { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c }, - { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c }, - { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c }, - { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c }, - { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c }, - { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c }, - { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c }, - { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c }, - { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c }, - { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c }, - { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c }, - { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c }, - { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c }, - { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c }, - { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c }, - { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c }, - { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c }, - { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c }, - { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c }, - { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c }, - { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c }, - { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c }, - { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c }, - { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c }, - { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c }, - { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c }, - { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c }, - { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c }, - { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c }, - { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c }, - { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c }, - { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c }, - { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c }, - { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c }, - { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c }, - { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c }, - { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c }, - { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c }, - { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c }, - { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c }, - { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c }, - { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c }, - { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c }, - { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c }, - { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c }, -#if !LESS_RESAMPLERS - { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 }, - { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 }, - { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 }, - { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 }, - { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 }, - { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 }, - { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 }, - { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 }, - { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 }, - { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 }, - { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 }, - { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 }, - { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 }, - { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 }, - { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 }, - { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 }, - { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 }, - { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 }, - { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 }, - { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 }, - { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 }, - { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 }, - { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 }, - { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 }, - { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 }, - { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 }, - { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 }, - { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 }, - { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 }, - { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 }, - { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 }, - { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 }, - { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 }, - { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 }, - { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 }, - { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 }, - { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 }, - { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 }, - { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 }, - { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 }, - { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 }, - { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 }, - { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 }, - { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 }, - { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 }, - { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 }, - { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 }, - { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 }, - { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 }, - { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 }, - { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 }, - { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 }, - { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 }, - { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 }, - { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 }, - { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 }, -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - { 0, 0, 0, 0, NULL } -}; - -/* 390 converters generated. */ - -/* *INDENT-ON* */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_mixer.c b/Source/3rdParty/sdl/src/audio/SDL_mixer.c deleted file mode 100644 index 42a1c6873..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_mixer.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* This provides the default mixing callback for the SDL audio routines */ - -#include "SDL_cpuinfo.h" -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "SDL_sysaudio.h" - -/* This table is used to add two sound values together and pin - * the value to avoid overflow. (used with permission from ARDI) - * Changed to use 0xFE instead of 0xFF for better sound quality. - */ -static const Uint8 mix8[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, - 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, - 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, - 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, - 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, - 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, - 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, - 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, - 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, - 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, - 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, - 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, - 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, - 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, - 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, - 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, - 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, - 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, - 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE -}; - -/* The volume ranges from 0 - 128 */ -#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) -#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) - - -void -SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, - Uint32 len, int volume) -{ - if (volume == 0) { - return; - } - - switch (format) { - - case AUDIO_U8: - { -#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES) - SDL_MixAudio_m68k_U8((char *) dst, (char *) src, - (unsigned long) len, (long) volume, - (char *) mix8); -#else - Uint8 src_sample; - - while (len--) { - src_sample = *src; - ADJUST_VOLUME_U8(src_sample, volume); - *dst = mix8[*dst + src_sample]; - ++dst; - ++src; - } -#endif - } - break; - - case AUDIO_S8: - { - Sint8 *dst8, *src8; - Sint8 src_sample; - int dst_sample; - const int max_audioval = ((1 << (8 - 1)) - 1); - const int min_audioval = -(1 << (8 - 1)); - - src8 = (Sint8 *) src; - dst8 = (Sint8 *) dst; - while (len--) { - src_sample = *src8; - ADJUST_VOLUME(src_sample, volume); - dst_sample = *dst8 + src_sample; - if (dst_sample > max_audioval) { - *dst8 = max_audioval; - } else if (dst_sample < min_audioval) { - *dst8 = min_audioval; - } else { - *dst8 = dst_sample; - } - ++dst8; - ++src8; - } - } - break; - - case AUDIO_S16LSB: - { - Sint16 src1, src2; - int dst_sample; - const int max_audioval = ((1 << (16 - 1)) - 1); - const int min_audioval = -(1 << (16 - 1)); - - len /= 2; - while (len--) { - src1 = ((src[1]) << 8 | src[0]); - ADJUST_VOLUME(src1, volume); - src2 = ((dst[1]) << 8 | dst[0]); - src += 2; - dst_sample = src1 + src2; - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - dst[0] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[1] = dst_sample & 0xFF; - dst += 2; - } - } - break; - - case AUDIO_S16MSB: - { -#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES) - SDL_MixAudio_m68k_S16MSB((short *) dst, (short *) src, - (unsigned long) len, (long) volume); -#else - Sint16 src1, src2; - int dst_sample; - const int max_audioval = ((1 << (16 - 1)) - 1); - const int min_audioval = -(1 << (16 - 1)); - - len /= 2; - while (len--) { - src1 = ((src[0]) << 8 | src[1]); - ADJUST_VOLUME(src1, volume); - src2 = ((dst[0]) << 8 | dst[1]); - src += 2; - dst_sample = src1 + src2; - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - dst[1] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[0] = dst_sample & 0xFF; - dst += 2; - } -#endif - } - break; - - case AUDIO_S32LSB: - { - const Uint32 *src32 = (Uint32 *) src; - Uint32 *dst32 = (Uint32 *) dst; - Sint64 src1, src2; - Sint64 dst_sample; - const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); - const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); - - len /= 4; - while (len--) { - src1 = (Sint64) ((Sint32) SDL_SwapLE32(*src32)); - src32++; - ADJUST_VOLUME(src1, volume); - src2 = (Sint64) ((Sint32) SDL_SwapLE32(*dst32)); - dst_sample = src1 + src2; - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - *(dst32++) = SDL_SwapLE32((Uint32) ((Sint32) dst_sample)); - } - } - break; - - case AUDIO_S32MSB: - { - const Uint32 *src32 = (Uint32 *) src; - Uint32 *dst32 = (Uint32 *) dst; - Sint64 src1, src2; - Sint64 dst_sample; - const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); - const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); - - len /= 4; - while (len--) { - src1 = (Sint64) ((Sint32) SDL_SwapBE32(*src32)); - src32++; - ADJUST_VOLUME(src1, volume); - src2 = (Sint64) ((Sint32) SDL_SwapBE32(*dst32)); - dst_sample = src1 + src2; - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - *(dst32++) = SDL_SwapBE32((Uint32) ((Sint32) dst_sample)); - } - } - break; - - case AUDIO_F32LSB: - { - const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME); - const float fvolume = (float) volume; - const float *src32 = (float *) src; - float *dst32 = (float *) dst; - float src1, src2; - double dst_sample; - /* !!! FIXME: are these right? */ - const double max_audioval = 3.402823466e+38F; - const double min_audioval = -3.402823466e+38F; - - len /= 4; - while (len--) { - src1 = ((SDL_SwapFloatLE(*src32) * fvolume) * fmaxvolume); - src2 = SDL_SwapFloatLE(*dst32); - src32++; - - dst_sample = ((double) src1) + ((double) src2); - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - *(dst32++) = SDL_SwapFloatLE((float) dst_sample); - } - } - break; - - case AUDIO_F32MSB: - { - const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME); - const float fvolume = (float) volume; - const float *src32 = (float *) src; - float *dst32 = (float *) dst; - float src1, src2; - double dst_sample; - /* !!! FIXME: are these right? */ - const double max_audioval = 3.402823466e+38F; - const double min_audioval = -3.402823466e+38F; - - len /= 4; - while (len--) { - src1 = ((SDL_SwapFloatBE(*src32) * fvolume) * fmaxvolume); - src2 = SDL_SwapFloatBE(*dst32); - src32++; - - dst_sample = ((double) src1) + ((double) src2); - if (dst_sample > max_audioval) { - dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; - } - *(dst32++) = SDL_SwapFloatBE((float) dst_sample); - } - } - break; - - default: /* If this happens... FIXME! */ - SDL_SetError("SDL_MixAudio(): unknown audio format"); - return; - } -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_sysaudio.h b/Source/3rdParty/sdl/src/audio/SDL_sysaudio.h deleted file mode 100644 index 9fe31c807..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_sysaudio.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#ifndef _SDL_sysaudio_h -#define _SDL_sysaudio_h - -#include "SDL_mutex.h" -#include "SDL_thread.h" - -/* The SDL audio driver */ -typedef struct SDL_AudioDevice SDL_AudioDevice; -#define _THIS SDL_AudioDevice *_this - -/* Used by audio targets during DetectDevices() */ -typedef void (*SDL_AddAudioDevice)(const char *name); - -typedef struct SDL_AudioDriverImpl -{ - void (*DetectDevices) (int iscapture, SDL_AddAudioDevice addfn); - int (*OpenDevice) (_THIS, const char *devname, int iscapture); - void (*ThreadInit) (_THIS); /* Called by audio thread at start */ - void (*WaitDevice) (_THIS); - void (*PlayDevice) (_THIS); - Uint8 *(*GetDeviceBuf) (_THIS); - void (*WaitDone) (_THIS); - void (*CloseDevice) (_THIS); - void (*LockDevice) (_THIS); - void (*UnlockDevice) (_THIS); - void (*Deinitialize) (void); - - /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */ - - /* Some flags to push duplicate code into the core and reduce #ifdefs. */ - int ProvidesOwnCallbackThread; - int SkipMixerLock; /* !!! FIXME: do we need this anymore? */ - int HasCaptureSupport; - int OnlyHasDefaultOutputDevice; - int OnlyHasDefaultInputDevice; -} SDL_AudioDriverImpl; - - -typedef struct SDL_AudioDriver -{ - /* * * */ - /* The name of this audio driver */ - const char *name; - - /* * * */ - /* The description of this audio driver */ - const char *desc; - - SDL_AudioDriverImpl impl; - - char **outputDevices; - int outputDeviceCount; - - char **inputDevices; - int inputDeviceCount; -} SDL_AudioDriver; - - -/* Streamer */ -typedef struct -{ - Uint8 *buffer; - int max_len; /* the maximum length in bytes */ - int read_pos, write_pos; /* the position of the write and read heads in bytes */ -} SDL_AudioStreamer; - - -/* Define the SDL audio driver structure */ -struct SDL_AudioDevice -{ - /* * * */ - /* Data common to all devices */ - - /* The current audio specification (shared with audio thread) */ - SDL_AudioSpec spec; - - /* An audio conversion block for audio format emulation */ - SDL_AudioCVT convert; - - /* The streamer, if sample rate conversion necessitates it */ - int use_streamer; - SDL_AudioStreamer streamer; - - /* Current state flags */ - int iscapture; - int enabled; - int paused; - int opened; - - /* Fake audio buffer for when the audio hardware is busy */ - Uint8 *fake_stream; - - /* A semaphore for locking the mixing buffers */ - SDL_mutex *mixer_lock; - - /* A thread to feed the audio device */ - SDL_Thread *thread; - SDL_threadID threadid; - - /* * * */ - /* Data private to this driver */ - struct SDL_PrivateAudioData *hidden; -}; -#undef _THIS - -typedef struct AudioBootStrap -{ - const char *name; - const char *desc; - int (*init) (SDL_AudioDriverImpl * impl); - int demand_only; /* 1==request explicitly, or it won't be available. */ -} AudioBootStrap; - -#endif /* _SDL_sysaudio_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_wave.c b/Source/3rdParty/sdl/src/audio/SDL_wave.c deleted file mode 100644 index 903264ca9..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_wave.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Microsoft WAVE file loading routines */ - -#include "SDL_audio.h" -#include "SDL_wave.h" - - -static int ReadChunk(SDL_RWops * src, Chunk * chunk); - -struct MS_ADPCM_decodestate -{ - Uint8 hPredictor; - Uint16 iDelta; - Sint16 iSamp1; - Sint16 iSamp2; -}; -static struct MS_ADPCM_decoder -{ - WaveFMT wavefmt; - Uint16 wSamplesPerBlock; - Uint16 wNumCoef; - Sint16 aCoeff[7][2]; - /* * * */ - struct MS_ADPCM_decodestate state[2]; -} MS_ADPCM_state; - -static int -InitMS_ADPCM(WaveFMT * format) -{ - Uint8 *rogue_feel; - int i; - - /* Set the rogue pointer to the MS_ADPCM specific data */ - MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); - MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); - MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); - MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); - MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); - MS_ADPCM_state.wavefmt.bitspersample = - SDL_SwapLE16(format->bitspersample); - rogue_feel = (Uint8 *) format + sizeof(*format); - if (sizeof(*format) == 16) { - /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */ - rogue_feel += sizeof(Uint16); - } - MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - if (MS_ADPCM_state.wNumCoef != 7) { - SDL_SetError("Unknown set of MS_ADPCM coefficients"); - return (-1); - } - for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) { - MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - } - return (0); -} - -static Sint32 -MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state, - Uint8 nybble, Sint16 * coeff) -{ - const Sint32 max_audioval = ((1 << (16 - 1)) - 1); - const Sint32 min_audioval = -(1 << (16 - 1)); - const Sint32 adaptive[] = { - 230, 230, 230, 230, 307, 409, 512, 614, - 768, 614, 512, 409, 307, 230, 230, 230 - }; - Sint32 new_sample, delta; - - new_sample = ((state->iSamp1 * coeff[0]) + - (state->iSamp2 * coeff[1])) / 256; - if (nybble & 0x08) { - new_sample += state->iDelta * (nybble - 0x10); - } else { - new_sample += state->iDelta * nybble; - } - if (new_sample < min_audioval) { - new_sample = min_audioval; - } else if (new_sample > max_audioval) { - new_sample = max_audioval; - } - delta = ((Sint32) state->iDelta * adaptive[nybble]) / 256; - if (delta < 16) { - delta = 16; - } - state->iDelta = (Uint16) delta; - state->iSamp2 = state->iSamp1; - state->iSamp1 = (Sint16) new_sample; - return (new_sample); -} - -static int -MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) -{ - struct MS_ADPCM_decodestate *state[2]; - Uint8 *freeable, *encoded, *decoded; - Sint32 encoded_len, samplesleft; - Sint8 nybble, stereo; - Sint16 *coeff[2]; - Sint32 new_sample; - - /* Allocate the proper sized output buffer */ - encoded_len = *audio_len; - encoded = *audio_buf; - freeable = *audio_buf; - *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) * - MS_ADPCM_state.wSamplesPerBlock * - MS_ADPCM_state.wavefmt.channels * sizeof(Sint16); - *audio_buf = (Uint8 *) SDL_malloc(*audio_len); - if (*audio_buf == NULL) { - return SDL_OutOfMemory(); - } - decoded = *audio_buf; - - /* Get ready... Go! */ - stereo = (MS_ADPCM_state.wavefmt.channels == 2); - state[0] = &MS_ADPCM_state.state[0]; - state[1] = &MS_ADPCM_state.state[stereo]; - while (encoded_len >= MS_ADPCM_state.wavefmt.blockalign) { - /* Grab the initial information for this block */ - state[0]->hPredictor = *encoded++; - if (stereo) { - state[1]->hPredictor = *encoded++; - } - state[0]->iDelta = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iDelta = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor]; - coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor]; - - /* Store the two initial samples we start with */ - decoded[0] = state[0]->iSamp2 & 0xFF; - decoded[1] = state[0]->iSamp2 >> 8; - decoded += 2; - if (stereo) { - decoded[0] = state[1]->iSamp2 & 0xFF; - decoded[1] = state[1]->iSamp2 >> 8; - decoded += 2; - } - decoded[0] = state[0]->iSamp1 & 0xFF; - decoded[1] = state[0]->iSamp1 >> 8; - decoded += 2; - if (stereo) { - decoded[0] = state[1]->iSamp1 & 0xFF; - decoded[1] = state[1]->iSamp1 >> 8; - decoded += 2; - } - - /* Decode and store the other samples in this block */ - samplesleft = (MS_ADPCM_state.wSamplesPerBlock - 2) * - MS_ADPCM_state.wavefmt.channels; - while (samplesleft > 0) { - nybble = (*encoded) >> 4; - new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2; - - nybble = (*encoded) & 0x0F; - new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2; - - ++encoded; - samplesleft -= 2; - } - encoded_len -= MS_ADPCM_state.wavefmt.blockalign; - } - SDL_free(freeable); - return (0); -} - -struct IMA_ADPCM_decodestate -{ - Sint32 sample; - Sint8 index; -}; -static struct IMA_ADPCM_decoder -{ - WaveFMT wavefmt; - Uint16 wSamplesPerBlock; - /* * * */ - struct IMA_ADPCM_decodestate state[2]; -} IMA_ADPCM_state; - -static int -InitIMA_ADPCM(WaveFMT * format) -{ - Uint8 *rogue_feel; - - /* Set the rogue pointer to the IMA_ADPCM specific data */ - IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); - IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); - IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); - IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); - IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); - IMA_ADPCM_state.wavefmt.bitspersample = - SDL_SwapLE16(format->bitspersample); - rogue_feel = (Uint8 *) format + sizeof(*format); - if (sizeof(*format) == 16) { - /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */ - rogue_feel += sizeof(Uint16); - } - IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); - return (0); -} - -static Sint32 -IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble) -{ - const Sint32 max_audioval = ((1 << (16 - 1)) - 1); - const Sint32 min_audioval = -(1 << (16 - 1)); - const int index_table[16] = { - -1, -1, -1, -1, - 2, 4, 6, 8, - -1, -1, -1, -1, - 2, 4, 6, 8 - }; - const Sint32 step_table[89] = { - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, - 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, - 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, - 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, - 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, - 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, - 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, - 22385, 24623, 27086, 29794, 32767 - }; - Sint32 delta, step; - - /* Compute difference and new sample value */ - if (state->index > 88) { - state->index = 88; - } else if (state->index < 0) { - state->index = 0; - } - step = step_table[state->index]; - delta = step >> 3; - if (nybble & 0x04) - delta += step; - if (nybble & 0x02) - delta += (step >> 1); - if (nybble & 0x01) - delta += (step >> 2); - if (nybble & 0x08) - delta = -delta; - state->sample += delta; - - /* Update index value */ - state->index += index_table[nybble]; - - /* Clamp output sample */ - if (state->sample > max_audioval) { - state->sample = max_audioval; - } else if (state->sample < min_audioval) { - state->sample = min_audioval; - } - return (state->sample); -} - -/* Fill the decode buffer with a channel block of data (8 samples) */ -static void -Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded, - int channel, int numchannels, - struct IMA_ADPCM_decodestate *state) -{ - int i; - Sint8 nybble; - Sint32 new_sample; - - decoded += (channel * 2); - for (i = 0; i < 4; ++i) { - nybble = (*encoded) & 0x0F; - new_sample = IMA_ADPCM_nibble(state, nybble); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2 * numchannels; - - nybble = (*encoded) >> 4; - new_sample = IMA_ADPCM_nibble(state, nybble); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2 * numchannels; - - ++encoded; - } -} - -static int -IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) -{ - struct IMA_ADPCM_decodestate *state; - Uint8 *freeable, *encoded, *decoded; - Sint32 encoded_len, samplesleft; - unsigned int c, channels; - - /* Check to make sure we have enough variables in the state array */ - channels = IMA_ADPCM_state.wavefmt.channels; - if (channels > SDL_arraysize(IMA_ADPCM_state.state)) { - SDL_SetError("IMA ADPCM decoder can only handle %d channels", - SDL_arraysize(IMA_ADPCM_state.state)); - return (-1); - } - state = IMA_ADPCM_state.state; - - /* Allocate the proper sized output buffer */ - encoded_len = *audio_len; - encoded = *audio_buf; - freeable = *audio_buf; - *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) * - IMA_ADPCM_state.wSamplesPerBlock * - IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16); - *audio_buf = (Uint8 *) SDL_malloc(*audio_len); - if (*audio_buf == NULL) { - return SDL_OutOfMemory(); - } - decoded = *audio_buf; - - /* Get ready... Go! */ - while (encoded_len >= IMA_ADPCM_state.wavefmt.blockalign) { - /* Grab the initial information for this block */ - for (c = 0; c < channels; ++c) { - /* Fill the state information for this block */ - state[c].sample = ((encoded[1] << 8) | encoded[0]); - encoded += 2; - if (state[c].sample & 0x8000) { - state[c].sample -= 0x10000; - } - state[c].index = *encoded++; - /* Reserved byte in buffer header, should be 0 */ - if (*encoded++ != 0) { - /* Uh oh, corrupt data? Buggy code? */ ; - } - - /* Store the initial sample we start with */ - decoded[0] = (Uint8) (state[c].sample & 0xFF); - decoded[1] = (Uint8) (state[c].sample >> 8); - decoded += 2; - } - - /* Decode and store the other samples in this block */ - samplesleft = (IMA_ADPCM_state.wSamplesPerBlock - 1) * channels; - while (samplesleft > 0) { - for (c = 0; c < channels; ++c) { - Fill_IMA_ADPCM_block(decoded, encoded, - c, channels, &state[c]); - encoded += 4; - samplesleft -= 8; - } - decoded += (channels * 8 * 2); - } - encoded_len -= IMA_ADPCM_state.wavefmt.blockalign; - } - SDL_free(freeable); - return (0); -} - -SDL_AudioSpec * -SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, - SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len) -{ - int was_error; - Chunk chunk; - int lenread; - int IEEE_float_encoded, MS_ADPCM_encoded, IMA_ADPCM_encoded; - int samplesize; - - /* WAV magic header */ - Uint32 RIFFchunk; - Uint32 wavelen = 0; - Uint32 WAVEmagic; - Uint32 headerDiff = 0; - - /* FMT chunk */ - WaveFMT *format = NULL; - - SDL_zero(chunk); - - /* Make sure we are passed a valid data source */ - was_error = 0; - if (src == NULL) { - was_error = 1; - goto done; - } - - /* Check the magic header */ - RIFFchunk = SDL_ReadLE32(src); - wavelen = SDL_ReadLE32(src); - if (wavelen == WAVE) { /* The RIFFchunk has already been read */ - WAVEmagic = wavelen; - wavelen = RIFFchunk; - RIFFchunk = RIFF; - } else { - WAVEmagic = SDL_ReadLE32(src); - } - if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) { - SDL_SetError("Unrecognized file type (not WAVE)"); - was_error = 1; - goto done; - } - headerDiff += sizeof(Uint32); /* for WAVE */ - - /* Read the audio data format chunk */ - chunk.data = NULL; - do { - SDL_free(chunk.data); - chunk.data = NULL; - lenread = ReadChunk(src, &chunk); - if (lenread < 0) { - was_error = 1; - goto done; - } - /* 2 Uint32's for chunk header+len, plus the lenread */ - headerDiff += lenread + 2 * sizeof(Uint32); - } while ((chunk.magic == FACT) || (chunk.magic == LIST)); - - /* Decode the audio data format */ - format = (WaveFMT *) chunk.data; - if (chunk.magic != FMT) { - SDL_SetError("Complex WAVE files not supported"); - was_error = 1; - goto done; - } - IEEE_float_encoded = MS_ADPCM_encoded = IMA_ADPCM_encoded = 0; - switch (SDL_SwapLE16(format->encoding)) { - case PCM_CODE: - /* We can understand this */ - break; - case IEEE_FLOAT_CODE: - IEEE_float_encoded = 1; - /* We can understand this */ - break; - case MS_ADPCM_CODE: - /* Try to understand this */ - if (InitMS_ADPCM(format) < 0) { - was_error = 1; - goto done; - } - MS_ADPCM_encoded = 1; - break; - case IMA_ADPCM_CODE: - /* Try to understand this */ - if (InitIMA_ADPCM(format) < 0) { - was_error = 1; - goto done; - } - IMA_ADPCM_encoded = 1; - break; - case MP3_CODE: - SDL_SetError("MPEG Layer 3 data not supported", - SDL_SwapLE16(format->encoding)); - was_error = 1; - goto done; - default: - SDL_SetError("Unknown WAVE data format: 0x%.4x", - SDL_SwapLE16(format->encoding)); - was_error = 1; - goto done; - } - SDL_memset(spec, 0, (sizeof *spec)); - spec->freq = SDL_SwapLE32(format->frequency); - - if (IEEE_float_encoded) { - if ((SDL_SwapLE16(format->bitspersample)) != 32) { - was_error = 1; - } else { - spec->format = AUDIO_F32; - } - } else { - switch (SDL_SwapLE16(format->bitspersample)) { - case 4: - if (MS_ADPCM_encoded || IMA_ADPCM_encoded) { - spec->format = AUDIO_S16; - } else { - was_error = 1; - } - break; - case 8: - spec->format = AUDIO_U8; - break; - case 16: - spec->format = AUDIO_S16; - break; - case 32: - spec->format = AUDIO_S32; - break; - default: - was_error = 1; - break; - } - } - - if (was_error) { - SDL_SetError("Unknown %d-bit PCM data format", - SDL_SwapLE16(format->bitspersample)); - goto done; - } - spec->channels = (Uint8) SDL_SwapLE16(format->channels); - spec->samples = 4096; /* Good default buffer size */ - - /* Read the audio data chunk */ - *audio_buf = NULL; - do { - SDL_free(*audio_buf); - *audio_buf = NULL; - lenread = ReadChunk(src, &chunk); - if (lenread < 0) { - was_error = 1; - goto done; - } - *audio_len = lenread; - *audio_buf = chunk.data; - if (chunk.magic != DATA) - headerDiff += lenread + 2 * sizeof(Uint32); - } while (chunk.magic != DATA); - headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */ - - if (MS_ADPCM_encoded) { - if (MS_ADPCM_decode(audio_buf, audio_len) < 0) { - was_error = 1; - goto done; - } - } - if (IMA_ADPCM_encoded) { - if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) { - was_error = 1; - goto done; - } - } - - /* Don't return a buffer that isn't a multiple of samplesize */ - samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels; - *audio_len &= ~(samplesize - 1); - - done: - SDL_free(format); - if (src) { - if (freesrc) { - SDL_RWclose(src); - } else { - /* seek to the end of the file (given by the RIFF chunk) */ - SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR); - } - } - if (was_error) { - spec = NULL; - } - return (spec); -} - -/* Since the WAV memory is allocated in the shared library, it must also - be freed here. (Necessary under Win32, VC++) - */ -void -SDL_FreeWAV(Uint8 * audio_buf) -{ - SDL_free(audio_buf); -} - -static int -ReadChunk(SDL_RWops * src, Chunk * chunk) -{ - chunk->magic = SDL_ReadLE32(src); - chunk->length = SDL_ReadLE32(src); - chunk->data = (Uint8 *) SDL_malloc(chunk->length); - if (chunk->data == NULL) { - return SDL_OutOfMemory(); - } - if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) { - SDL_free(chunk->data); - chunk->data = NULL; - return SDL_Error(SDL_EFREAD); - } - return (chunk->length); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/SDL_wave.h b/Source/3rdParty/sdl/src/audio/SDL_wave.h deleted file mode 100644 index c53ad590a..000000000 --- a/Source/3rdParty/sdl/src/audio/SDL_wave.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* WAVE files are little-endian */ - -/*******************************************/ -/* Define values for Microsoft WAVE format */ -/*******************************************/ -#define RIFF 0x46464952 /* "RIFF" */ -#define WAVE 0x45564157 /* "WAVE" */ -#define FACT 0x74636166 /* "fact" */ -#define LIST 0x5453494c /* "LIST" */ -#define FMT 0x20746D66 /* "fmt " */ -#define DATA 0x61746164 /* "data" */ -#define PCM_CODE 0x0001 -#define MS_ADPCM_CODE 0x0002 -#define IEEE_FLOAT_CODE 0x0003 -#define IMA_ADPCM_CODE 0x0011 -#define MP3_CODE 0x0055 -#define WAVE_MONO 1 -#define WAVE_STEREO 2 - -/* Normally, these three chunks come consecutively in a WAVE file */ -typedef struct WaveFMT -{ -/* Not saved in the chunk we read: - Uint32 FMTchunk; - Uint32 fmtlen; -*/ - Uint16 encoding; - Uint16 channels; /* 1 = mono, 2 = stereo */ - Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ - Uint32 byterate; /* Average bytes per second */ - Uint16 blockalign; /* Bytes per sample block */ - Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */ -} WaveFMT; - -/* The general chunk found in the WAVE file */ -typedef struct Chunk -{ - Uint32 magic; - Uint32 length; - Uint8 *data; -} Chunk; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.c b/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.c deleted file mode 100644 index 1f3def3f6..000000000 --- a/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.c +++ /dev/null @@ -1,685 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ALSA - -/* Allow access to a raw mixing buffer */ - -#include -#include /* For kill() */ -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_alsa_audio.h" - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC -#include "SDL_loadso.h" -#endif - -static int (*ALSA_snd_pcm_open) - (snd_pcm_t **, const char *, snd_pcm_stream_t, int); -static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm); -static snd_pcm_sframes_t(*ALSA_snd_pcm_writei) - (snd_pcm_t *, const void *, snd_pcm_uframes_t); -static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int); -static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *); -static int (*ALSA_snd_pcm_drain) (snd_pcm_t *); -static const char *(*ALSA_snd_strerror) (int); -static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void); -static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void); -static void (*ALSA_snd_pcm_hw_params_copy) - (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_hw_params_set_access) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t); -static int (*ALSA_snd_pcm_hw_params_set_format) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t); -static int (*ALSA_snd_pcm_hw_params_set_channels) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int); -static int (*ALSA_snd_pcm_hw_params_get_channels) - (const snd_pcm_hw_params_t *, unsigned int *); -static int (*ALSA_snd_pcm_hw_params_set_rate_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_set_period_size_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); -static int (*ALSA_snd_pcm_hw_params_get_period_size) - (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); -static int (*ALSA_snd_pcm_hw_params_set_periods_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_get_periods) - (const snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near) - (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *); -static int (*ALSA_snd_pcm_hw_params_get_buffer_size) - (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *); -static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *, - snd_pcm_sw_params_t *); -static int (*ALSA_snd_pcm_sw_params_set_start_threshold) - (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); -static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *); -static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int); -static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int); -static int (*ALSA_snd_pcm_sw_params_set_avail_min) - (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC -#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof -#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof - -static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC; -static void *alsa_handle = NULL; - -static int -load_alsa_sym(const char *fn, void **addr) -{ - *addr = SDL_LoadFunction(alsa_handle, fn); - if (*addr == NULL) { - /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ - return 0; - } - - return 1; -} - -/* cast funcs to char* first, to please GCC's strict aliasing rules. */ -#define SDL_ALSA_SYM(x) \ - if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1 -#else -#define SDL_ALSA_SYM(x) ALSA_##x = x -#endif - -static int -load_alsa_syms(void) -{ - SDL_ALSA_SYM(snd_pcm_open); - SDL_ALSA_SYM(snd_pcm_close); - SDL_ALSA_SYM(snd_pcm_writei); - SDL_ALSA_SYM(snd_pcm_recover); - SDL_ALSA_SYM(snd_pcm_prepare); - SDL_ALSA_SYM(snd_pcm_drain); - SDL_ALSA_SYM(snd_strerror); - SDL_ALSA_SYM(snd_pcm_hw_params_sizeof); - SDL_ALSA_SYM(snd_pcm_sw_params_sizeof); - SDL_ALSA_SYM(snd_pcm_hw_params_copy); - SDL_ALSA_SYM(snd_pcm_hw_params_any); - SDL_ALSA_SYM(snd_pcm_hw_params_set_access); - SDL_ALSA_SYM(snd_pcm_hw_params_set_format); - SDL_ALSA_SYM(snd_pcm_hw_params_set_channels); - SDL_ALSA_SYM(snd_pcm_hw_params_get_channels); - SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near); - SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size); - SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_periods); - SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size); - SDL_ALSA_SYM(snd_pcm_hw_params); - SDL_ALSA_SYM(snd_pcm_sw_params_current); - SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold); - SDL_ALSA_SYM(snd_pcm_sw_params); - SDL_ALSA_SYM(snd_pcm_nonblock); - SDL_ALSA_SYM(snd_pcm_wait); - SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min); - return 0; -} - -#undef SDL_ALSA_SYM - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC - -static void -UnloadALSALibrary(void) -{ - if (alsa_handle != NULL) { - SDL_UnloadObject(alsa_handle); - alsa_handle = NULL; - } -} - -static int -LoadALSALibrary(void) -{ - int retval = 0; - if (alsa_handle == NULL) { - alsa_handle = SDL_LoadObject(alsa_library); - if (alsa_handle == NULL) { - retval = -1; - /* Don't call SDL_SetError(): SDL_LoadObject already did. */ - } else { - retval = load_alsa_syms(); - if (retval < 0) { - UnloadALSALibrary(); - } - } - } - return retval; -} - -#else - -static void -UnloadALSALibrary(void) -{ -} - -static int -LoadALSALibrary(void) -{ - load_alsa_syms(); - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ - -static const char * -get_audio_device(int channels) -{ - const char *device; - - device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ - if (device == NULL) { - switch (channels) { - case 6: - device = "plug:surround51"; - break; - case 4: - device = "plug:surround40"; - break; - default: - device = "default"; - break; - } - } - return device; -} - - -/* This function waits until it is possible to write a full sound buffer */ -static void -ALSA_WaitDevice(_THIS) -{ - /* We're in blocking mode, so there's nothing to do here */ -} - - -/* !!! FIXME: is there a channel swizzler in alsalib instead? */ -/* - * http://bugzilla.libsdl.org/show_bug.cgi?id=110 - * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE - * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR" - */ -#define SWIZ6(T) \ - T *ptr = (T *) this->hidden->mixbuf; \ - Uint32 i; \ - for (i = 0; i < this->spec.samples; i++, ptr += 6) { \ - T tmp; \ - tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \ - tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ - } - -static SDL_INLINE void -swizzle_alsa_channels_6_64bit(_THIS) -{ - SWIZ6(Uint64); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_32bit(_THIS) -{ - SWIZ6(Uint32); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_16bit(_THIS) -{ - SWIZ6(Uint16); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_8bit(_THIS) -{ - SWIZ6(Uint8); -} - -#undef SWIZ6 - - -/* - * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle - * channels from Windows/Mac order to the format alsalib will want. - */ -static SDL_INLINE void -swizzle_alsa_channels(_THIS) -{ - if (this->spec.channels == 6) { - const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */ - if (fmtsize == 16) - swizzle_alsa_channels_6_16bit(this); - else if (fmtsize == 8) - swizzle_alsa_channels_6_8bit(this); - else if (fmtsize == 32) - swizzle_alsa_channels_6_32bit(this); - else if (fmtsize == 64) - swizzle_alsa_channels_6_64bit(this); - } - - /* !!! FIXME: update this for 7.1 if needed, later. */ -} - - -static void -ALSA_PlayDevice(_THIS) -{ - int status; - const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf; - const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) * - this->spec.channels; - snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples); - - swizzle_alsa_channels(this); - - while ( frames_left > 0 && this->enabled ) { - /* !!! FIXME: This works, but needs more testing before going live */ - /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ - status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, - sample_buf, frames_left); - - if (status < 0) { - if (status == -EAGAIN) { - /* Apparently snd_pcm_recover() doesn't handle this case - - does it assume snd_pcm_wait() above? */ - SDL_Delay(1); - continue; - } - status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); - if (status < 0) { - /* Hmm, not much we can do - abort */ - fprintf(stderr, "ALSA write failed (unrecoverable): %s\n", - ALSA_snd_strerror(status)); - this->enabled = 0; - return; - } - continue; - } - sample_buf += status * frame_size; - frames_left -= status; - } -} - -static Uint8 * -ALSA_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -ALSA_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->pcm_handle) { - ALSA_snd_pcm_drain(this->hidden->pcm_handle); - ALSA_snd_pcm_close(this->hidden->pcm_handle); - this->hidden->pcm_handle = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -ALSA_finalize_hardware(_THIS, snd_pcm_hw_params_t *hwparams, int override) -{ - int status; - snd_pcm_uframes_t bufsize; - - /* "set" the hardware with the desired parameters */ - status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams); - if ( status < 0 ) { - return(-1); - } - - /* Get samples for the actual buffer size */ - status = ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize); - if ( status < 0 ) { - return(-1); - } - if ( !override && bufsize != this->spec.samples * 2 ) { - return(-1); - } - - /* !!! FIXME: Is this safe to do? */ - this->spec.samples = bufsize / 2; - - /* This is useful for debugging */ - if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) { - snd_pcm_uframes_t persize = 0; - unsigned int periods = 0; - - ALSA_snd_pcm_hw_params_get_period_size(hwparams, &persize, NULL); - ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL); - - fprintf(stderr, - "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", - persize, periods, bufsize); - } - - return(0); -} - -static int -ALSA_set_period_size(_THIS, snd_pcm_hw_params_t *params, int override) -{ - const char *env; - int status; - snd_pcm_hw_params_t *hwparams; - snd_pcm_uframes_t frames; - unsigned int periods; - - /* Copy the hardware parameters for this setup */ - snd_pcm_hw_params_alloca(&hwparams); - ALSA_snd_pcm_hw_params_copy(hwparams, params); - - if ( !override ) { - env = SDL_getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE"); - if ( env ) { - override = SDL_atoi(env); - if ( override == 0 ) { - return(-1); - } - } - } - - frames = this->spec.samples; - status = ALSA_snd_pcm_hw_params_set_period_size_near( - this->hidden->pcm_handle, hwparams, &frames, NULL); - if ( status < 0 ) { - return(-1); - } - - periods = 2; - status = ALSA_snd_pcm_hw_params_set_periods_near( - this->hidden->pcm_handle, hwparams, &periods, NULL); - if ( status < 0 ) { - return(-1); - } - - return ALSA_finalize_hardware(this, hwparams, override); -} - -static int -ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params, int override) -{ - const char *env; - int status; - snd_pcm_hw_params_t *hwparams; - snd_pcm_uframes_t frames; - - /* Copy the hardware parameters for this setup */ - snd_pcm_hw_params_alloca(&hwparams); - ALSA_snd_pcm_hw_params_copy(hwparams, params); - - if ( !override ) { - env = SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE"); - if ( env ) { - override = SDL_atoi(env); - if ( override == 0 ) { - return(-1); - } - } - } - - frames = this->spec.samples * 2; - status = ALSA_snd_pcm_hw_params_set_buffer_size_near( - this->hidden->pcm_handle, hwparams, &frames); - if ( status < 0 ) { - return(-1); - } - - return ALSA_finalize_hardware(this, hwparams, override); -} - -static int -ALSA_OpenDevice(_THIS, const char *devname, int iscapture) -{ - int status = 0; - snd_pcm_t *pcm_handle = NULL; - snd_pcm_hw_params_t *hwparams = NULL; - snd_pcm_sw_params_t *swparams = NULL; - snd_pcm_format_t format = 0; - SDL_AudioFormat test_format = 0; - unsigned int rate = 0; - unsigned int channels = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Open the audio device */ - /* Name of device should depend on # channels in spec */ - status = ALSA_snd_pcm_open(&pcm_handle, - get_audio_device(this->spec.channels), - SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); - - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't open audio device: %s", - ALSA_snd_strerror(status)); - } - - this->hidden->pcm_handle = pcm_handle; - - /* Figure out what the hardware is capable of */ - snd_pcm_hw_params_alloca(&hwparams); - status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't get hardware config: %s", - ALSA_snd_strerror(status)); - } - - /* SDL only uses interleaved sample output */ - status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams, - SND_PCM_ACCESS_RW_INTERLEAVED); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set interleaved access: %s", - ALSA_snd_strerror(status)); - } - - /* Try for a closest match on audio format */ - status = -1; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - test_format && (status < 0);) { - status = 0; /* if we can't support a format, it'll become -1. */ - switch (test_format) { - case AUDIO_U8: - format = SND_PCM_FORMAT_U8; - break; - case AUDIO_S8: - format = SND_PCM_FORMAT_S8; - break; - case AUDIO_S16LSB: - format = SND_PCM_FORMAT_S16_LE; - break; - case AUDIO_S16MSB: - format = SND_PCM_FORMAT_S16_BE; - break; - case AUDIO_U16LSB: - format = SND_PCM_FORMAT_U16_LE; - break; - case AUDIO_U16MSB: - format = SND_PCM_FORMAT_U16_BE; - break; - case AUDIO_S32LSB: - format = SND_PCM_FORMAT_S32_LE; - break; - case AUDIO_S32MSB: - format = SND_PCM_FORMAT_S32_BE; - break; - case AUDIO_F32LSB: - format = SND_PCM_FORMAT_FLOAT_LE; - break; - case AUDIO_F32MSB: - format = SND_PCM_FORMAT_FLOAT_BE; - break; - default: - status = -1; - break; - } - if (status >= 0) { - status = ALSA_snd_pcm_hw_params_set_format(pcm_handle, - hwparams, format); - } - if (status < 0) { - test_format = SDL_NextAudioFormat(); - } - } - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - /* Set the number of channels */ - status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams, - this->spec.channels); - channels = this->spec.channels; - if (status < 0) { - status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set audio channels"); - } - this->spec.channels = channels; - } - - /* Set the audio rate */ - rate = this->spec.freq; - status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, - &rate, NULL); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set audio frequency: %s", - ALSA_snd_strerror(status)); - } - this->spec.freq = rate; - - /* Set the buffer size, in samples */ - if ( ALSA_set_period_size(this, hwparams, 0) < 0 && - ALSA_set_buffer_size(this, hwparams, 0) < 0 ) { - /* Failed to set desired buffer size, do the best you can... */ - if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status)); - } - } - /* Set the software parameters */ - snd_pcm_sw_params_alloca(&swparams); - status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't get software config: %s", - ALSA_snd_strerror(status)); - } - status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set minimum available samples: %s", - ALSA_snd_strerror(status)); - } - status = - ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set start threshold: %s", - ALSA_snd_strerror(status)); - } - status = ALSA_snd_pcm_sw_params(pcm_handle, swparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set software audio parameters: %s", - ALSA_snd_strerror(status)); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - ALSA_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); - - /* Switch to blocking mode for playback */ - ALSA_snd_pcm_nonblock(pcm_handle, 0); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -ALSA_Deinitialize(void) -{ - UnloadALSALibrary(); -} - -static int -ALSA_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadALSALibrary() < 0) { - return 0; - } - - /* Set the function pointers */ - impl->OpenDevice = ALSA_OpenDevice; - impl->WaitDevice = ALSA_WaitDevice; - impl->GetDeviceBuf = ALSA_GetDeviceBuf; - impl->PlayDevice = ALSA_PlayDevice; - impl->CloseDevice = ALSA_CloseDevice; - impl->Deinitialize = ALSA_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */ - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap ALSA_bootstrap = { - "alsa", "ALSA PCM audio", ALSA_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_ALSA */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.h b/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.h deleted file mode 100644 index 45353883d..000000000 --- a/Source/3rdParty/sdl/src/audio/alsa/SDL_alsa_audio.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_ALSA_audio_h -#define _SDL_ALSA_audio_h - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The audio device handle */ - snd_pcm_t *pcm_handle; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; -}; - -#endif /* _SDL_ALSA_audio_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.c b/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.c deleted file mode 100644 index 0c85b83cb..000000000 --- a/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ANDROID - -/* Output audio to Android */ - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_androidaudio.h" - -#include "../../core/android/SDL_android.h" - -#include - -static void * audioDevice; - -static int -AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - SDL_AudioFormat test_format; - - if (iscapture) { - /* TODO: implement capture */ - return SDL_SetError("Capture not supported on Android"); - } - - if (audioDevice != NULL) { - return SDL_SetError("Only one audio device at a time please!"); - } - - audioDevice = this; - - test_format = SDL_FirstAudioFormat(this->spec.format); - while (test_format != 0) { /* no "UNKNOWN" constant */ - if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) { - this->spec.format = test_format; - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (test_format == 0) { - /* Didn't find a compatible format :( */ - return SDL_SetError("No compatible audio format!"); - } - - if (this->spec.channels > 1) { - this->spec.channels = 2; - } else { - this->spec.channels = 1; - } - - if (this->spec.freq < 8000) { - this->spec.freq = 8000; - } - if (this->spec.freq > 48000) { - this->spec.freq = 48000; - } - - /* TODO: pass in/return a (Java) device ID, also whether we're opening for input or output */ - this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples); - SDL_CalculateAudioSpec(&this->spec); - - if (this->spec.samples == 0) { - /* Init failed? */ - return SDL_SetError("Java-side initialization failed!"); - } - - return 0; -} - -static void -AndroidAUD_PlayDevice(_THIS) -{ - Android_JNI_WriteAudioBuffer(); -} - -static Uint8 * -AndroidAUD_GetDeviceBuf(_THIS) -{ - return Android_JNI_GetAudioBuffer(); -} - -static void -AndroidAUD_CloseDevice(_THIS) -{ - /* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread - so it's safe to terminate the Java side buffer and AudioTrack - */ - Android_JNI_CloseAudioDevice(); - - if (audioDevice == this) { - audioDevice = NULL; - } -} - -static int -AndroidAUD_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = AndroidAUD_OpenDevice; - impl->PlayDevice = AndroidAUD_PlayDevice; - impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf; - impl->CloseDevice = AndroidAUD_CloseDevice; - - /* and the capabilities */ - impl->HasCaptureSupport = 0; /* TODO */ - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultInputDevice = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap ANDROIDAUD_bootstrap = { - "android", "SDL Android audio driver", AndroidAUD_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_ANDROID */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.h b/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.h deleted file mode 100644 index ab49f000f..000000000 --- a/Source/3rdParty/sdl/src/audio/android/SDL_androidaudio.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_androidaudio_h -#define _SDL_androidaudio_h - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ -}; - -static void AndroidAUD_CloseDevice(_THIS); - -#endif /* _SDL_androidaudio_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.c b/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.c deleted file mode 100644 index 72fba70cc..000000000 --- a/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ARTS - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_artsaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC - -static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; -static void *arts_handle = NULL; - -/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */ -static int (*SDL_NAME(arts_init)) (void); -static void (*SDL_NAME(arts_free)) (void); -static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits, - int channels, - const char *name); -static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s, - arts_parameter_t param, int value); -static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s, - arts_parameter_t param); -static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer, - int count); -static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s); -static int (*SDL_NAME(arts_suspend))(void); -static int (*SDL_NAME(arts_suspended)) (void); -static const char *(*SDL_NAME(arts_error_text)) (int errorcode); - -#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} arts_functions[] = { -/* *INDENT-OFF* */ - SDL_ARTS_SYM(arts_init), - SDL_ARTS_SYM(arts_free), - SDL_ARTS_SYM(arts_play_stream), - SDL_ARTS_SYM(arts_stream_set), - SDL_ARTS_SYM(arts_stream_get), - SDL_ARTS_SYM(arts_write), - SDL_ARTS_SYM(arts_close_stream), - SDL_ARTS_SYM(arts_suspend), - SDL_ARTS_SYM(arts_suspended), - SDL_ARTS_SYM(arts_error_text), -/* *INDENT-ON* */ -}; - -#undef SDL_ARTS_SYM - -static void -UnloadARTSLibrary() -{ - if (arts_handle != NULL) { - SDL_UnloadObject(arts_handle); - arts_handle = NULL; - } -} - -static int -LoadARTSLibrary(void) -{ - int i, retval = -1; - - if (arts_handle == NULL) { - arts_handle = SDL_LoadObject(arts_library); - if (arts_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(arts_functions); ++i) { - *arts_functions[i].func = - SDL_LoadFunction(arts_handle, arts_functions[i].name); - if (!*arts_functions[i].func) { - retval = -1; - UnloadARTSLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadARTSLibrary() -{ - return; -} - -static int -LoadARTSLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -ARTS_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - this->enabled = 0; - } - } - } - - /* Use timer for general audio synchronization */ - ticks = - ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ARTS_PlayDevice(_THIS) -{ - /* Write the audio data */ - int written = SDL_NAME(arts_write) (this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixlen); - - /* If timer synchronization is enabled, set the next write frame */ - if (this->hidden->frame_ticks) { - this->hidden->next_frame += this->hidden->frame_ticks; - } - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - this->enabled = 0; - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static void -ARTS_WaitDone(_THIS) -{ - /* !!! FIXME: camp here until buffer drains... SDL_Delay(???); */ -} - - -static Uint8 * -ARTS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -ARTS_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->stream) { - SDL_NAME(arts_close_stream) (this->hidden->stream); - this->hidden->stream = 0; - } - SDL_NAME(arts_free) (); - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -ARTS_Suspend(void) -{ - const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */ - while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) { - if ( SDL_NAME(arts_suspend)() ) { - break; - } - } - return SDL_NAME(arts_suspended)(); -} - -static int -ARTS_OpenDevice(_THIS, const char *devname, int iscapture) -{ - int rc = 0; - int bits = 0, frag_spec = 0; - SDL_AudioFormat test_format = 0, format = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - bits = 8; - format = 1; - break; - case AUDIO_S16LSB: - bits = 16; - format = 1; - break; - default: - format = 0; - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); - } - } - if (format == 0) { - ARTS_CloseDevice(this); - return SDL_SetError("Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - if ((rc = SDL_NAME(arts_init) ()) != 0) { - ARTS_CloseDevice(this); - return SDL_SetError("Unable to initialize ARTS: %s", - SDL_NAME(arts_error_text) (rc)); - } - - if (!ARTS_Suspend()) { - ARTS_CloseDevice(this); - return SDL_SetError("ARTS can not open audio device"); - } - - this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq, - bits, - this->spec.channels, - "SDL"); - - /* Play nothing so we have at least one write (server bug workaround). */ - SDL_NAME(arts_write) (this->hidden->stream, "", 0); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Determine the power of two of the fragment size */ - for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec); - if ((0x01 << frag_spec) != this->spec.size) { - ARTS_CloseDevice(this); - return SDL_SetError("Fragment size must be a power of two"); - } - frag_spec |= 0x00020000; /* two fragments, for low latency */ - -#ifdef ARTS_P_PACKET_SETTINGS - SDL_NAME(arts_stream_set) (this->hidden->stream, - ARTS_P_PACKET_SETTINGS, frag_spec); -#else - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE, - frag_spec & 0xffff); - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT, - frag_spec >> 16); -#endif - this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream, - ARTS_P_PACKET_SIZE); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - ARTS_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -ARTS_Deinitialize(void) -{ - UnloadARTSLibrary(); -} - - -static int -ARTS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadARTSLibrary() < 0) { - return 0; - } else { - if (SDL_NAME(arts_init) () != 0) { - UnloadARTSLibrary(); - SDL_SetError("ARTS: arts_init failed (no audio server?)"); - return 0; - } - - /* Play a stream so aRts doesn't crash */ - if (ARTS_Suspend()) { - arts_stream_t stream; - stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL"); - SDL_NAME(arts_write) (stream, "", 0); - SDL_NAME(arts_close_stream) (stream); - } - - SDL_NAME(arts_free) (); - } - - /* Set the function pointers */ - impl->OpenDevice = ARTS_OpenDevice; - impl->PlayDevice = ARTS_PlayDevice; - impl->WaitDevice = ARTS_WaitDevice; - impl->GetDeviceBuf = ARTS_GetDeviceBuf; - impl->CloseDevice = ARTS_CloseDevice; - impl->WaitDone = ARTS_WaitDone; - impl->Deinitialize = ARTS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap ARTS_bootstrap = { - "arts", "Analog RealTime Synthesizer", ARTS_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_ARTS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.h b/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.h deleted file mode 100644 index fb7706fcf..000000000 --- a/Source/3rdParty/sdl/src/audio/arts/SDL_artsaudio.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_artscaudio_h -#define _SDL_artscaudio_h - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The stream descriptor for the audio device */ - arts_stream_t stream; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer, in addition to select() */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* _SDL_artscaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.c b/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.c deleted file mode 100644 index f415fe040..000000000 --- a/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.c +++ /dev/null @@ -1,361 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_BSD - -/* - * Driver for native OpenBSD/NetBSD audio(4). - * vedge@vedge.com.ar. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "../SDL_audiodev_c.h" -#include "SDL_bsdaudio.h" - -/* Use timer for synchronization */ -/* #define USE_TIMER_SYNC */ - -/* #define DEBUG_AUDIO */ -/* #define DEBUG_AUDIO_STREAM */ - - -static void -BSDAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) -{ - SDL_EnumUnixAudioDevices(iscapture, 0, NULL, addfn); -} - - -static void -BSDAUDIO_Status(_THIS) -{ -#ifdef DEBUG_AUDIO - /* *INDENT-OFF* */ - audio_info_t info; - - if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { - fprintf(stderr, "AUDIO_GETINFO failed.\n"); - return; - } - fprintf(stderr, "\n" - "[play/record info]\n" - "buffer size : %d bytes\n" - "sample rate : %i Hz\n" - "channels : %i\n" - "precision : %i-bit\n" - "encoding : 0x%x\n" - "seek : %i\n" - "sample count : %i\n" - "EOF count : %i\n" - "paused : %s\n" - "error occured : %s\n" - "waiting : %s\n" - "active : %s\n" - "", - info.play.buffer_size, - info.play.sample_rate, - info.play.channels, - info.play.precision, - info.play.encoding, - info.play.seek, - info.play.samples, - info.play.eof, - info.play.pause ? "yes" : "no", - info.play.error ? "yes" : "no", - info.play.waiting ? "yes" : "no", - info.play.active ? "yes" : "no"); - - fprintf(stderr, "\n" - "[audio info]\n" - "monitor_gain : %i\n" - "hw block size : %d bytes\n" - "hi watermark : %i\n" - "lo watermark : %i\n" - "audio mode : %s\n" - "", - info.monitor_gain, - info.blocksize, - info.hiwat, info.lowat, - (info.mode == AUMODE_PLAY) ? "PLAY" - : (info.mode = AUMODE_RECORD) ? "RECORD" - : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?")); - /* *INDENT-ON* */ -#endif /* DEBUG_AUDIO */ -} - - -/* This function waits until it is possible to write a full sound buffer */ -static void -BSDAUDIO_WaitDevice(_THIS) -{ -#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ - /* See if we need to use timed audio synchronization */ - if (this->hidden->frame_ticks) { - /* Use timer for general audio synchronization */ - Sint32 ticks; - - ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } - } else { - /* Use select() for audio synchronization */ - fd_set fdset; - struct timeval timeout; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - timeout.tv_sec = 10; - timeout.tv_usec = 0; -#ifdef DEBUG_AUDIO - fprintf(stderr, "Waiting for audio to get ready\n"); -#endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) - <= 0) { - const char *message = - "Audio timeout - buggy audio driver? (disabled)"; - /* In general we should never print to the screen, - but in this case we have no other way of letting - the user know what happened. - */ - fprintf(stderr, "SDL: %s\n", message); - this->enabled = 0; - /* Don't try to close - may hang */ - this->hidden->audio_fd = -1; -#ifdef DEBUG_AUDIO - fprintf(stderr, "Done disabling audio\n"); -#endif - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Ready!\n"); -#endif - } -#endif /* !USE_BLOCKING_WRITES */ -} - -static void -BSDAUDIO_PlayDevice(_THIS) -{ - int written, p = 0; - - /* Write the audio data, checking for EAGAIN on broken audio drivers */ - do { - written = write(this->hidden->audio_fd, - &this->hidden->mixbuf[p], this->hidden->mixlen - p); - - if (written > 0) - p += written; - if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) { - /* Non recoverable error has occurred. It should be reported!!! */ - perror("audio"); - break; - } - - if (p < written - || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while (p < written); - - /* If timer synchronization is enabled, set the next write frame */ - if (this->hidden->frame_ticks) { - this->hidden->next_frame += this->hidden->frame_ticks; - } - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - this->enabled = 0; - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static Uint8 * -BSDAUDIO_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -BSDAUDIO_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) -{ - const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); - SDL_AudioFormat format = 0; - audio_info_t info; - - /* We don't care what the devname is...we'll try to open anything. */ - /* ...but default to first name in the list... */ - if (devname == NULL) { - devname = SDL_GetAudioDeviceName(0, iscapture); - if (devname == NULL) { - return SDL_SetError("No such audio device"); - } - } - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Open the audio device */ - this->hidden->audio_fd = open(devname, flags, 0); - if (this->hidden->audio_fd < 0) { - return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); - } - - AUDIO_INITINFO(&info); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Set to play mode */ - info.mode = AUMODE_PLAY; - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) { - BSDAUDIO_CloseDevice(this); - return SDL_SetError("Couldn't put device into play mode"); - } - - AUDIO_INITINFO(&info); - for (format = SDL_FirstAudioFormat(this->spec.format); - format; format = SDL_NextAudioFormat()) { - switch (format) { - case AUDIO_U8: - info.play.encoding = AUDIO_ENCODING_ULINEAR; - info.play.precision = 8; - break; - case AUDIO_S8: - info.play.encoding = AUDIO_ENCODING_SLINEAR; - info.play.precision = 8; - break; - case AUDIO_S16LSB: - info.play.encoding = AUDIO_ENCODING_SLINEAR_LE; - info.play.precision = 16; - break; - case AUDIO_S16MSB: - info.play.encoding = AUDIO_ENCODING_SLINEAR_BE; - info.play.precision = 16; - break; - case AUDIO_U16LSB: - info.play.encoding = AUDIO_ENCODING_ULINEAR_LE; - info.play.precision = 16; - break; - case AUDIO_U16MSB: - info.play.encoding = AUDIO_ENCODING_ULINEAR_BE; - info.play.precision = 16; - break; - default: - continue; - } - - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) { - break; - } - } - - if (!format) { - BSDAUDIO_CloseDevice(this); - return SDL_SetError("No supported encoding for 0x%x", this->spec.format); - } - - this->spec.format = format; - - AUDIO_INITINFO(&info); - info.play.channels = this->spec.channels; - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == -1) { - this->spec.channels = 1; - } - AUDIO_INITINFO(&info); - info.play.sample_rate = this->spec.freq; - info.blocksize = this->spec.size; - info.hiwat = 5; - info.lowat = 3; - (void) ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info); - (void) ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info); - this->spec.freq = info.play.sample_rate; - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - BSDAUDIO_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - BSDAUDIO_Status(this); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static int -BSDAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->DetectDevices = BSDAUDIO_DetectDevices; - impl->OpenDevice = BSDAUDIO_OpenDevice; - impl->PlayDevice = BSDAUDIO_PlayDevice; - impl->WaitDevice = BSDAUDIO_WaitDevice; - impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf; - impl->CloseDevice = BSDAUDIO_CloseDevice; - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap BSD_AUDIO_bootstrap = { - "bsd", "BSD audio", BSDAUDIO_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_BSD */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.h b/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.h deleted file mode 100644 index 625bdb549..000000000 --- a/Source/3rdParty/sdl/src/audio/bsd/SDL_bsdaudio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_bsdaudio_h -#define _SDL_bsdaudio_h - -#include "../SDL_sysaudio.h" - -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - int audio_fd; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer, in addition to select() */ - float frame_ticks; - float next_frame; -}; - -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* _SDL_bsdaudio_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.c b/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.c deleted file mode 100644 index 950110289..000000000 --- a/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.c +++ /dev/null @@ -1,559 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_coreaudio.h" -#include "SDL_assert.h" - -#define DEBUG_COREAUDIO 0 - -static void COREAUDIO_CloseDevice(_THIS); - -#define CHECK_RESULT(msg) \ - if (result != noErr) { \ - COREAUDIO_CloseDevice(this); \ - SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \ - return 0; \ - } - -#if MACOSX_COREAUDIO -typedef void (*addDevFn)(const char *name, AudioDeviceID devId, void *data); - -static void -addToDevList(const char *name, AudioDeviceID devId, void *data) -{ - SDL_AddAudioDevice addfn = (SDL_AddAudioDevice) data; - addfn(name); -} - -typedef struct -{ - const char *findname; - AudioDeviceID devId; - int found; -} FindDevIdData; - -static void -findDevId(const char *name, AudioDeviceID devId, void *_data) -{ - FindDevIdData *data = (FindDevIdData *) _data; - if (!data->found) { - if (SDL_strcmp(name, data->findname) == 0) { - data->found = 1; - data->devId = devId; - } - } -} - -static void -build_device_list(int iscapture, addDevFn addfn, void *addfndata) -{ - OSStatus result = noErr; - UInt32 size = 0; - AudioDeviceID *devs = NULL; - UInt32 i = 0; - UInt32 max = 0; - - AudioObjectPropertyAddress addr = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; - - result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &addr, - 0, NULL, &size); - if (result != kAudioHardwareNoError) - return; - - devs = (AudioDeviceID *) alloca(size); - if (devs == NULL) - return; - - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, devs); - if (result != kAudioHardwareNoError) - return; - - max = size / sizeof (AudioDeviceID); - for (i = 0; i < max; i++) { - CFStringRef cfstr = NULL; - char *ptr = NULL; - AudioDeviceID dev = devs[i]; - AudioBufferList *buflist = NULL; - int usable = 0; - CFIndex len = 0; - - addr.mScope = iscapture ? kAudioDevicePropertyScopeInput : - kAudioDevicePropertyScopeOutput; - addr.mSelector = kAudioDevicePropertyStreamConfiguration; - - result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); - if (result != noErr) - continue; - - buflist = (AudioBufferList *) SDL_malloc(size); - if (buflist == NULL) - continue; - - result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, - &size, buflist); - - if (result == noErr) { - UInt32 j; - for (j = 0; j < buflist->mNumberBuffers; j++) { - if (buflist->mBuffers[j].mNumberChannels > 0) { - usable = 1; - break; - } - } - } - - SDL_free(buflist); - - if (!usable) - continue; - - addr.mSelector = kAudioObjectPropertyName; - size = sizeof (CFStringRef); - result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, &cfstr); - if (result != kAudioHardwareNoError) - continue; - - len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), - kCFStringEncodingUTF8); - - ptr = (char *) SDL_malloc(len + 1); - usable = ((ptr != NULL) && - (CFStringGetCString - (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); - - CFRelease(cfstr); - - if (usable) { - len = strlen(ptr); - /* Some devices have whitespace at the end...trim it. */ - while ((len > 0) && (ptr[len - 1] == ' ')) { - len--; - } - usable = (len > 0); - } - - if (usable) { - ptr[len] = '\0'; - -#if DEBUG_COREAUDIO - printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", - ((iscapture) ? "capture" : "output"), - (int) *devCount, ptr, (int) dev); -#endif - addfn(ptr, dev, addfndata); - } - SDL_free(ptr); /* addfn() would have copied the string. */ - } -} - -static void -COREAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) -{ - build_device_list(iscapture, addToDevList, addfn); -} - -static int -find_device_by_name(_THIS, const char *devname, int iscapture) -{ - AudioDeviceID devid = 0; - OSStatus result = noErr; - UInt32 size = 0; - UInt32 alive = 0; - pid_t pid = 0; - - AudioObjectPropertyAddress addr = { - 0, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; - - if (devname == NULL) { - size = sizeof (AudioDeviceID); - addr.mSelector = - ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : - kAudioHardwarePropertyDefaultOutputDevice); - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, &devid); - CHECK_RESULT("AudioHardwareGetProperty (default device)"); - } else { - FindDevIdData data; - SDL_zero(data); - data.findname = devname; - build_device_list(iscapture, findDevId, &data); - if (!data.found) { - SDL_SetError("CoreAudio: No such audio device."); - return 0; - } - devid = data.devId; - } - - addr.mSelector = kAudioDevicePropertyDeviceIsAlive; - addr.mScope = iscapture ? kAudioDevicePropertyScopeInput : - kAudioDevicePropertyScopeOutput; - - size = sizeof (alive); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); - CHECK_RESULT - ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); - - if (!alive) { - SDL_SetError("CoreAudio: requested device exists, but isn't alive."); - return 0; - } - - addr.mSelector = kAudioDevicePropertyHogMode; - size = sizeof (pid); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); - - /* some devices don't support this property, so errors are fine here. */ - if ((result == noErr) && (pid != -1)) { - SDL_SetError("CoreAudio: requested device is being hogged."); - return 0; - } - - this->hidden->deviceID = devid; - return 1; -} -#endif - -/* The CoreAudio callback */ -static OSStatus -outputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon; - AudioBuffer *abuf; - UInt32 remaining, len; - void *ptr; - UInt32 i; - - /* Only do anything if audio is enabled and not paused */ - if (!this->enabled || this->paused) { - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize); - } - return 0; - } - - /* No SDL conversion should be needed here, ever, since we accept - any input format in OpenAudio, and leave the conversion to CoreAudio. - */ - /* - SDL_assert(!this->convert.needed); - SDL_assert(this->spec.channels == ioData->mNumberChannels); - */ - - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - remaining = abuf->mDataByteSize; - ptr = abuf->mData; - while (remaining > 0) { - if (this->hidden->bufferOffset >= this->hidden->bufferSize) { - /* Generate the data */ - SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, - this->hidden->buffer, this->hidden->bufferSize); - SDL_UnlockMutex(this->mixer_lock); - this->hidden->bufferOffset = 0; - } - - len = this->hidden->bufferSize - this->hidden->bufferOffset; - if (len > remaining) - len = remaining; - SDL_memcpy(ptr, (char *)this->hidden->buffer + - this->hidden->bufferOffset, len); - ptr = (char *)ptr + len; - remaining -= len; - this->hidden->bufferOffset += len; - } - } - - return 0; -} - -static OSStatus -inputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - /* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */ - /* !!! FIXME: write me! */ - return noErr; -} - - -static void -COREAUDIO_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - if (this->hidden->audioUnitOpened) { - OSStatus result = noErr; - AURenderCallbackStruct callback; - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const int iscapture = this->iscapture; - const AudioUnitElement bus = - ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = - ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - - /* stop processing the audio unit */ - result = AudioOutputUnitStop(this->hidden->audioUnit); - - /* Remove the input callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, - sizeof(callback)); - - #if MACOSX_COREAUDIO - CloseComponent(this->hidden->audioUnit); - #else - AudioComponentInstanceDispose(this->hidden->audioUnit); - #endif - - this->hidden->audioUnitOpened = 0; - } - SDL_free(this->hidden->buffer); - SDL_free(this->hidden); - this->hidden = NULL; - } -} - - -static int -prepare_audiounit(_THIS, const char *devname, int iscapture, - const AudioStreamBasicDescription * strdesc) -{ - OSStatus result = noErr; - AURenderCallbackStruct callback; -#if MACOSX_COREAUDIO - ComponentDescription desc; - Component comp = NULL; -#else - AudioComponentDescription desc; - AudioComponent comp = NULL; -#endif - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - -#if MACOSX_COREAUDIO - if (!find_device_by_name(this, devname, iscapture)) { - SDL_SetError("Couldn't find requested CoreAudio device"); - return 0; - } -#endif - - SDL_zero(desc); - desc.componentType = kAudioUnitType_Output; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - -#if MACOSX_COREAUDIO - desc.componentSubType = kAudioUnitSubType_DefaultOutput; - comp = FindNextComponent(NULL, &desc); -#else - desc.componentSubType = kAudioUnitSubType_RemoteIO; - comp = AudioComponentFindNext(NULL, &desc); -#endif - - if (comp == NULL) { - SDL_SetError("Couldn't find requested CoreAudio component"); - return 0; - } - - /* Open & initialize the audio unit */ -#if MACOSX_COREAUDIO - result = OpenAComponent(comp, &this->hidden->audioUnit); - CHECK_RESULT("OpenAComponent"); -#else - /* - AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6 - We can't use OpenAComponent on iPhone because it is not present - */ - result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit); - CHECK_RESULT("AudioComponentInstanceNew"); -#endif - - this->hidden->audioUnitOpened = 1; - -#if MACOSX_COREAUDIO - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioOutputUnitProperty_CurrentDevice, - kAudioUnitScope_Global, 0, - &this->hidden->deviceID, - sizeof(AudioDeviceID)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)"); -#endif - - /* Set the data format of the audio unit. */ - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_StreamFormat, - scope, bus, strdesc, sizeof(*strdesc)); - CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)"); - - /* Set the audio callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - callback.inputProc = ((iscapture) ? inputCallback : outputCallback); - callback.inputProcRefCon = this; - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)"); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate a sample buffer */ - this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size; - this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); - - result = AudioUnitInitialize(this->hidden->audioUnit); - CHECK_RESULT("AudioUnitInitialize"); - - /* Finally, start processing of the audio unit */ - result = AudioOutputUnitStart(this->hidden->audioUnit); - CHECK_RESULT("AudioOutputUnitStart"); - - /* We're running! */ - return 1; -} - - -static int -COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) -{ - AudioStreamBasicDescription strdesc; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Setup a AudioStreamBasicDescription with the requested format */ - SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription)); - strdesc.mFormatID = kAudioFormatLinearPCM; - strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; - strdesc.mChannelsPerFrame = this->spec.channels; - strdesc.mSampleRate = this->spec.freq; - strdesc.mFramesPerPacket = 1; - - while ((!valid_datatype) && (test_format)) { - this->spec.format = test_format; - /* Just a list of valid SDL formats, so people don't pass junk here. */ - switch (test_format) { - case AUDIO_U8: - case AUDIO_S8: - case AUDIO_U16LSB: - case AUDIO_S16LSB: - case AUDIO_U16MSB: - case AUDIO_S16MSB: - case AUDIO_S32LSB: - case AUDIO_S32MSB: - case AUDIO_F32LSB: - case AUDIO_F32MSB: - valid_datatype = 1; - strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); - if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (SDL_AUDIO_ISSIGNED(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; - break; - } - } - - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - COREAUDIO_CloseDevice(this); - return SDL_SetError("Unsupported audio format"); - } - - strdesc.mBytesPerFrame = - strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; - strdesc.mBytesPerPacket = - strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; - - if (!prepare_audiounit(this, devname, iscapture, &strdesc)) { - COREAUDIO_CloseDevice(this); - return -1; /* prepare_audiounit() will call SDL_SetError()... */ - } - - return 0; /* good to go. */ -} - -static int -COREAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = COREAUDIO_OpenDevice; - impl->CloseDevice = COREAUDIO_CloseDevice; - -#if MACOSX_COREAUDIO - impl->DetectDevices = COREAUDIO_DetectDevices; -#else - impl->OnlyHasDefaultOutputDevice = 1; - - /* Set category to ambient sound so that other music continues playing. - You can change this at runtime in your own code if you need different - behavior. If this is common, we can add an SDL hint for this. - */ - AudioSessionInitialize(NULL, NULL, NULL, nil); - UInt32 category = kAudioSessionCategory_AmbientSound; - AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &category); -#endif - - impl->ProvidesOwnCallbackThread = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "CoreAudio", COREAUDIO_Init, 0 -}; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.h b/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.h deleted file mode 100644 index 41e8cea2b..000000000 --- a/Source/3rdParty/sdl/src/audio/coreaudio/SDL_coreaudio.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_coreaudio_h -#define _SDL_coreaudio_h - -#include "../SDL_sysaudio.h" - -#if !defined(__IPHONEOS__) -#define MACOSX_COREAUDIO 1 -#endif - -#if MACOSX_COREAUDIO -#include -#include -#else -#include -#endif - -#include - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - AudioUnit audioUnit; - int audioUnitOpened; - void *buffer; - UInt32 bufferOffset; - UInt32 bufferSize; -#if MACOSX_COREAUDIO - AudioDeviceID deviceID; -#endif -}; - -#endif /* _SDL_coreaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.c b/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.c deleted file mode 100644 index 067683ccc..000000000 --- a/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.c +++ /dev/null @@ -1,550 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_DSOUND - -/* Allow access to a raw mixing buffer */ - -#include "SDL_timer.h" -#include "SDL_loadso.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_directsound.h" - -#ifndef WAVE_FORMAT_IEEE_FLOAT -#define WAVE_FORMAT_IEEE_FLOAT 0x0003 -#endif - -/* DirectX function pointers for audio */ -static void* DSoundDLL = NULL; -typedef HRESULT(WINAPI*fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN); -typedef HRESULT(WINAPI*fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID); -typedef HRESULT(WINAPI*fnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW,LPVOID); -static fnDirectSoundCreate8 pDirectSoundCreate8 = NULL; -static fnDirectSoundEnumerateW pDirectSoundEnumerateW = NULL; -static fnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL; - -static void -DSOUND_Unload(void) -{ - pDirectSoundCreate8 = NULL; - pDirectSoundEnumerateW = NULL; - pDirectSoundCaptureEnumerateW = NULL; - - if (DSoundDLL != NULL) { - SDL_UnloadObject(DSoundDLL); - DSoundDLL = NULL; - } -} - - -static int -DSOUND_Load(void) -{ - int loaded = 0; - - DSOUND_Unload(); - - DSoundDLL = SDL_LoadObject("DSOUND.DLL"); - if (DSoundDLL == NULL) { - SDL_SetError("DirectSound: failed to load DSOUND.DLL"); - } else { - /* Now make sure we have DirectX 8 or better... */ - #define DSOUNDLOAD(f) { \ - p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \ - if (!p##f) loaded = 0; \ - } - loaded = 1; /* will reset if necessary. */ - DSOUNDLOAD(DirectSoundCreate8); - DSOUNDLOAD(DirectSoundEnumerateW); - DSOUNDLOAD(DirectSoundCaptureEnumerateW); - #undef DSOUNDLOAD - - if (!loaded) { - SDL_SetError("DirectSound: System doesn't appear to have DX8."); - } - } - - if (!loaded) { - DSOUND_Unload(); - } - - return loaded; -} - -static int -SetDSerror(const char *function, int code) -{ - static const char *error; - static char errbuf[1024]; - - errbuf[0] = 0; - switch (code) { - case E_NOINTERFACE: - error = "Unsupported interface -- Is DirectX 8.0 or later installed?"; - break; - case DSERR_ALLOCATED: - error = "Audio device in use"; - break; - case DSERR_BADFORMAT: - error = "Unsupported audio format"; - break; - case DSERR_BUFFERLOST: - error = "Mixing buffer was lost"; - break; - case DSERR_CONTROLUNAVAIL: - error = "Control requested is not available"; - break; - case DSERR_INVALIDCALL: - error = "Invalid call for the current state"; - break; - case DSERR_INVALIDPARAM: - error = "Invalid parameter"; - break; - case DSERR_NODRIVER: - error = "No audio device found"; - break; - case DSERR_OUTOFMEMORY: - error = "Out of memory"; - break; - case DSERR_PRIOLEVELNEEDED: - error = "Caller doesn't have priority"; - break; - case DSERR_UNSUPPORTED: - error = "Function not supported"; - break; - default: - SDL_snprintf(errbuf, SDL_arraysize(errbuf), - "%s: Unknown DirectSound error: 0x%x", function, code); - break; - } - if (!errbuf[0]) { - SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, - error); - } - return SDL_SetError("%s", errbuf); -} - - -static BOOL CALLBACK -FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID data) -{ - SDL_AddAudioDevice addfn = (SDL_AddAudioDevice) data; - if (guid != NULL) { /* skip default device */ - char *str = WIN_StringToUTF8(desc); - if (str != NULL) { - addfn(str); - SDL_free(str); /* addfn() makes a copy of this string. */ - } - } - return TRUE; /* keep enumerating. */ -} - -static void -DSOUND_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) -{ - if (iscapture) { - pDirectSoundCaptureEnumerateW(FindAllDevs, addfn); - } else { - pDirectSoundEnumerateW(FindAllDevs, addfn); - } -} - - -static void -DSOUND_WaitDevice(_THIS) -{ - DWORD status = 0; - DWORD cursor = 0; - DWORD junk = 0; - HRESULT result = DS_OK; - - /* Semi-busy wait, since we have no way of getting play notification - on a primary mixing buffer located in hardware (DirectX 5.0) - */ - result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, - &junk, &cursor); - if (result != DS_OK) { - if (result == DSERR_BUFFERLOST) { - IDirectSoundBuffer_Restore(this->hidden->mixbuf); - } -#ifdef DEBUG_SOUND - SetDSerror("DirectSound GetCurrentPosition", result); -#endif - return; - } - - while ((cursor / this->hidden->mixlen) == this->hidden->lastchunk) { - /* FIXME: find out how much time is left and sleep that long */ - SDL_Delay(1); - - /* Try to restore a lost sound buffer */ - IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); - if ((status & DSBSTATUS_BUFFERLOST)) { - IDirectSoundBuffer_Restore(this->hidden->mixbuf); - IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); - if ((status & DSBSTATUS_BUFFERLOST)) { - break; - } - } - if (!(status & DSBSTATUS_PLAYING)) { - result = IDirectSoundBuffer_Play(this->hidden->mixbuf, 0, 0, - DSBPLAY_LOOPING); - if (result == DS_OK) { - continue; - } -#ifdef DEBUG_SOUND - SetDSerror("DirectSound Play", result); -#endif - return; - } - - /* Find out where we are playing */ - result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, - &junk, &cursor); - if (result != DS_OK) { - SetDSerror("DirectSound GetCurrentPosition", result); - return; - } - } -} - -static void -DSOUND_PlayDevice(_THIS) -{ - /* Unlock the buffer, allowing it to play */ - if (this->hidden->locked_buf) { - IDirectSoundBuffer_Unlock(this->hidden->mixbuf, - this->hidden->locked_buf, - this->hidden->mixlen, NULL, 0); - } - -} - -static Uint8 * -DSOUND_GetDeviceBuf(_THIS) -{ - DWORD cursor = 0; - DWORD junk = 0; - HRESULT result = DS_OK; - DWORD rawlen = 0; - - /* Figure out which blocks to fill next */ - this->hidden->locked_buf = NULL; - result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, - &junk, &cursor); - if (result == DSERR_BUFFERLOST) { - IDirectSoundBuffer_Restore(this->hidden->mixbuf); - result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, - &junk, &cursor); - } - if (result != DS_OK) { - SetDSerror("DirectSound GetCurrentPosition", result); - return (NULL); - } - cursor /= this->hidden->mixlen; -#ifdef DEBUG_SOUND - /* Detect audio dropouts */ - { - DWORD spot = cursor; - if (spot < this->hidden->lastchunk) { - spot += this->hidden->num_buffers; - } - if (spot > this->hidden->lastchunk + 1) { - fprintf(stderr, "Audio dropout, missed %d fragments\n", - (spot - (this->hidden->lastchunk + 1))); - } - } -#endif - this->hidden->lastchunk = cursor; - cursor = (cursor + 1) % this->hidden->num_buffers; - cursor *= this->hidden->mixlen; - - /* Lock the audio buffer */ - result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, - this->hidden->mixlen, - (LPVOID *) & this->hidden->locked_buf, - &rawlen, NULL, &junk, 0); - if (result == DSERR_BUFFERLOST) { - IDirectSoundBuffer_Restore(this->hidden->mixbuf); - result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, - this->hidden->mixlen, - (LPVOID *) & this-> - hidden->locked_buf, &rawlen, NULL, - &junk, 0); - } - if (result != DS_OK) { - SetDSerror("DirectSound Lock", result); - return (NULL); - } - return (this->hidden->locked_buf); -} - -static void -DSOUND_WaitDone(_THIS) -{ - Uint8 *stream = DSOUND_GetDeviceBuf(this); - - /* Wait for the playing chunk to finish */ - if (stream != NULL) { - SDL_memset(stream, this->spec.silence, this->hidden->mixlen); - DSOUND_PlayDevice(this); - } - DSOUND_WaitDevice(this); - - /* Stop the looping sound buffer */ - IDirectSoundBuffer_Stop(this->hidden->mixbuf); -} - -static void -DSOUND_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - if (this->hidden->sound != NULL) { - if (this->hidden->mixbuf != NULL) { - /* Clean up the audio buffer */ - IDirectSoundBuffer_Release(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - } - IDirectSound_Release(this->hidden->sound); - this->hidden->sound = NULL; - } - - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -/* This function tries to create a secondary audio buffer, and returns the - number of audio chunks available in the created buffer. -*/ -static int -CreateSecondary(_THIS, HWND focus) -{ - LPDIRECTSOUND sndObj = this->hidden->sound; - LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf; - Uint32 chunksize = this->spec.size; - const int numchunks = 8; - HRESULT result = DS_OK; - DSBUFFERDESC format; - LPVOID pvAudioPtr1, pvAudioPtr2; - DWORD dwAudioBytes1, dwAudioBytes2; - WAVEFORMATEX wfmt; - - SDL_zero(wfmt); - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } else { - wfmt.wFormatTag = WAVE_FORMAT_PCM; - } - - wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - wfmt.nChannels = this->spec.channels; - wfmt.nSamplesPerSec = this->spec.freq; - wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8); - wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign; - - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - - /* Try to set primary mixing privileges */ - if (focus) { - result = IDirectSound_SetCooperativeLevel(sndObj, - focus, DSSCL_PRIORITY); - } else { - result = IDirectSound_SetCooperativeLevel(sndObj, - GetDesktopWindow(), - DSSCL_NORMAL); - } - if (result != DS_OK) { - return SetDSerror("DirectSound SetCooperativeLevel", result); - } - - /* Try to create the secondary buffer */ - SDL_zero(format); - format.dwSize = sizeof(format); - format.dwFlags = DSBCAPS_GETCURRENTPOSITION2; - if (!focus) { - format.dwFlags |= DSBCAPS_GLOBALFOCUS; - } else { - format.dwFlags |= DSBCAPS_STICKYFOCUS; - } - format.dwBufferBytes = numchunks * chunksize; - if ((format.dwBufferBytes < DSBSIZE_MIN) || - (format.dwBufferBytes > DSBSIZE_MAX)) { - return SDL_SetError("Sound buffer size must be between %d and %d", - DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks); - } - format.dwReserved = 0; - format.lpwfxFormat = &wfmt; - result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL); - if (result != DS_OK) { - return SetDSerror("DirectSound CreateSoundBuffer", result); - } - IDirectSoundBuffer_SetFormat(*sndbuf, &wfmt); - - /* Silence the initial audio buffer */ - result = IDirectSoundBuffer_Lock(*sndbuf, 0, format.dwBufferBytes, - (LPVOID *) & pvAudioPtr1, &dwAudioBytes1, - (LPVOID *) & pvAudioPtr2, &dwAudioBytes2, - DSBLOCK_ENTIREBUFFER); - if (result == DS_OK) { - SDL_memset(pvAudioPtr1, this->spec.silence, dwAudioBytes1); - IDirectSoundBuffer_Unlock(*sndbuf, - (LPVOID) pvAudioPtr1, dwAudioBytes1, - (LPVOID) pvAudioPtr2, dwAudioBytes2); - } - - /* We're ready to go */ - return (numchunks); -} - -typedef struct FindDevGUIDData -{ - const char *devname; - GUID guid; - int found; -} FindDevGUIDData; - -static BOOL CALLBACK -FindDevGUID(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID _data) -{ - if (guid != NULL) { /* skip the default device. */ - FindDevGUIDData *data = (FindDevGUIDData *) _data; - char *str = WIN_StringToUTF8(desc); - const int match = (SDL_strcmp(str, data->devname) == 0); - SDL_free(str); - if (match) { - data->found = 1; - SDL_memcpy(&data->guid, guid, sizeof (data->guid)); - return FALSE; /* found it! stop enumerating. */ - } - } - return TRUE; /* keep enumerating. */ -} - -static int -DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) -{ - HRESULT result; - SDL_bool valid_format = SDL_FALSE; - SDL_bool tried_format = SDL_FALSE; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - FindDevGUIDData devguid; - LPGUID guid = NULL; - - if (devname != NULL) { - devguid.found = 0; - devguid.devname = devname; - if (iscapture) - pDirectSoundCaptureEnumerateW(FindDevGUID, &devguid); - else - pDirectSoundEnumerateW(FindDevGUID, &devguid); - - if (!devguid.found) { - return SDL_SetError("DirectSound: Requested device not found"); - } - guid = &devguid.guid; - } - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Open the audio device */ - result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL); - if (result != DS_OK) { - DSOUND_CloseDevice(this); - return SetDSerror("DirectSoundCreate", result); - } - - while ((!valid_format) && (test_format)) { - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16: - case AUDIO_S32: - case AUDIO_F32: - tried_format = SDL_TRUE; - this->spec.format = test_format; - this->hidden->num_buffers = CreateSecondary(this, NULL); - if (this->hidden->num_buffers > 0) { - valid_format = SDL_TRUE; - } - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (!valid_format) { - DSOUND_CloseDevice(this); - if (tried_format) { - return -1; /* CreateSecondary() should have called SDL_SetError(). */ - } - return SDL_SetError("DirectSound: Unsupported audio format"); - } - - /* The buffer will auto-start playing in DSOUND_WaitDevice() */ - this->hidden->mixlen = this->spec.size; - - return 0; /* good to go. */ -} - - -static void -DSOUND_Deinitialize(void) -{ - DSOUND_Unload(); -} - - -static int -DSOUND_Init(SDL_AudioDriverImpl * impl) -{ - if (!DSOUND_Load()) { - return 0; - } - - /* Set the function pointers */ - impl->DetectDevices = DSOUND_DetectDevices; - impl->OpenDevice = DSOUND_OpenDevice; - impl->PlayDevice = DSOUND_PlayDevice; - impl->WaitDevice = DSOUND_WaitDevice; - impl->WaitDone = DSOUND_WaitDone; - impl->GetDeviceBuf = DSOUND_GetDeviceBuf; - impl->CloseDevice = DSOUND_CloseDevice; - impl->Deinitialize = DSOUND_Deinitialize; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap DSOUND_bootstrap = { - "directsound", "DirectSound", DSOUND_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_DSOUND */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.h b/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.h deleted file mode 100644 index b873391fb..000000000 --- a/Source/3rdParty/sdl/src/audio/directsound/SDL_directsound.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_directsound_h -#define _SDL_directsound_h - -#include "directx.h" - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -/* The DirectSound objects */ -struct SDL_PrivateAudioData -{ - LPDIRECTSOUND sound; - LPDIRECTSOUNDBUFFER mixbuf; - int num_buffers; - int mixlen; - DWORD lastchunk; - Uint8 *locked_buf; -}; - -#endif /* _SDL_directsound_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/directsound/directx.h b/Source/3rdParty/sdl/src/audio/directsound/directx.h deleted file mode 100644 index 472a0ee0e..000000000 --- a/Source/3rdParty/sdl/src/audio/directsound/directx.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _directx_h -#define _directx_h - -/* Include all of the DirectX 8.0 headers and adds any necessary tweaks */ - -#include "../../core/windows/SDL_windows.h" -#include -#ifndef WIN32 -#define WIN32 -#endif -#undef WINNT - -/* Far pointers don't exist in 32-bit code */ -#ifndef FAR -#define FAR -#endif - -/* Error codes not yet included in Win32 API header files */ -#ifndef MAKE_HRESULT -#define MAKE_HRESULT(sev,fac,code) \ - ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) -#endif - -#ifndef S_OK -#define S_OK (HRESULT)0x00000000L -#endif - -#ifndef SUCCEEDED -#define SUCCEEDED(x) ((HRESULT)(x) >= 0) -#endif -#ifndef FAILED -#define FAILED(x) ((HRESULT)(x)<0) -#endif - -#ifndef E_FAIL -#define E_FAIL (HRESULT)0x80000008L -#endif -#ifndef E_NOINTERFACE -#define E_NOINTERFACE (HRESULT)0x80004002L -#endif -#ifndef E_OUTOFMEMORY -#define E_OUTOFMEMORY (HRESULT)0x8007000EL -#endif -#ifndef E_INVALIDARG -#define E_INVALIDARG (HRESULT)0x80070057L -#endif -#ifndef E_NOTIMPL -#define E_NOTIMPL (HRESULT)0x80004001L -#endif -#ifndef REGDB_E_CLASSNOTREG -#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L -#endif - -/* Severity codes */ -#ifndef SEVERITY_ERROR -#define SEVERITY_ERROR 1 -#endif - -/* Error facility codes */ -#ifndef FACILITY_WIN32 -#define FACILITY_WIN32 7 -#endif - -#ifndef FIELD_OFFSET -#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) -#endif - -/* DirectX headers (if it isn't included, I haven't tested it yet) - */ -/* We need these defines to mark what version of DirectX API we use */ -#define DIRECTDRAW_VERSION 0x0700 -#define DIRECTSOUND_VERSION 0x0800 -#define DIRECTINPUT_VERSION 0x0500 - -#include -#include -#include - -#endif /* _directx_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.c b/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.c deleted file mode 100644 index cc4e3efc6..000000000 --- a/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_DISK - -/* Output raw audio data to a file. */ - -#if HAVE_STDIO_H -#include -#endif - -#include "SDL_rwops.h" -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_diskaudio.h" - -/* environment variables and defaults. */ -#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" -#define DISKDEFAULT_OUTFILE "sdlaudio.raw" -#define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY" -#define DISKDEFAULT_WRITEDELAY 150 - -static const char * -DISKAUD_GetOutputFilename(const char *devname) -{ - if (devname == NULL) { - devname = SDL_getenv(DISKENVR_OUTFILE); - if (devname == NULL) { - devname = DISKDEFAULT_OUTFILE; - } - } - return devname; -} - -/* This function waits until it is possible to write a full sound buffer */ -static void -DISKAUD_WaitDevice(_THIS) -{ - SDL_Delay(this->hidden->write_delay); -} - -static void -DISKAUD_PlayDevice(_THIS) -{ - size_t written; - - /* Write the audio data */ - written = SDL_RWwrite(this->hidden->output, - this->hidden->mixbuf, 1, this->hidden->mixlen); - - /* If we couldn't write, assume fatal error for now */ - if (written != this->hidden->mixlen) { - this->enabled = 0; - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static Uint8 * -DISKAUD_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -DISKAUD_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->output != NULL) { - SDL_RWclose(this->hidden->output); - this->hidden->output = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - const char *envr = SDL_getenv(DISKENVR_WRITEDELAY); - const char *fname = DISKAUD_GetOutputFilename(devname); - - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, sizeof(*this->hidden)); - - this->hidden->mixlen = this->spec.size; - this->hidden->write_delay = - (envr) ? SDL_atoi(envr) : DISKDEFAULT_WRITEDELAY; - - /* Open the audio device */ - this->hidden->output = SDL_RWFromFile(fname, "wb"); - if (this->hidden->output == NULL) { - DISKAUD_CloseDevice(this); - return -1; - } - - /* Allocate mixing buffer */ - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - DISKAUD_CloseDevice(this); - return -1; - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - -#if HAVE_STDIO_H - fprintf(stderr, - "WARNING: You are using the SDL disk writer audio driver!\n" - " Writing to file [%s].\n", fname); -#endif - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static int -DISKAUD_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = DISKAUD_OpenDevice; - impl->WaitDevice = DISKAUD_WaitDevice; - impl->PlayDevice = DISKAUD_PlayDevice; - impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; - impl->CloseDevice = DISKAUD_CloseDevice; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap DISKAUD_bootstrap = { - "disk", "direct-to-disk audio", DISKAUD_Init, 1 -}; - -#endif /* SDL_AUDIO_DRIVER_DISK */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.h b/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.h deleted file mode 100644 index 9c5a7afaf..000000000 --- a/Source/3rdParty/sdl/src/audio/disk/SDL_diskaudio.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_diskaudio_h -#define _SDL_diskaudio_h - -#include "SDL_rwops.h" -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - SDL_RWops *output; - Uint8 *mixbuf; - Uint32 mixlen; - Uint32 write_delay; -}; - -#endif /* _SDL_diskaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.c b/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.c deleted file mode 100644 index eea5a5f86..000000000 --- a/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_OSS - -/* Allow access to a raw mixing buffer */ - -#include /* For perror() */ -#include /* For strerror() */ -#include -#include -#include -#include -#include -#include -#include - -#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H -/* This is installed on some systems */ -#include -#else -/* This is recommended by OSS */ -#include -#endif - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "../SDL_audiodev_c.h" -#include "SDL_dspaudio.h" - - -static void -DSP_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) -{ - SDL_EnumUnixAudioDevices(iscapture, 0, NULL, addfn); -} - - -static void -DSP_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - - -static int -DSP_OpenDevice(_THIS, const char *devname, int iscapture) -{ - const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); - int format; - int value; - int frag_spec; - SDL_AudioFormat test_format; - - /* We don't care what the devname is...we'll try to open anything. */ - /* ...but default to first name in the list... */ - if (devname == NULL) { - devname = SDL_GetAudioDeviceName(0, iscapture); - if (devname == NULL) { - return SDL_SetError("No such audio device"); - } - } - - /* Make sure fragment size stays a power of 2, or OSS fails. */ - /* I don't know which of these are actually legal values, though... */ - if (this->spec.channels > 8) - this->spec.channels = 8; - else if (this->spec.channels > 4) - this->spec.channels = 4; - else if (this->spec.channels > 2) - this->spec.channels = 2; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Open the audio device */ - this->hidden->audio_fd = open(devname, flags, 0); - if (this->hidden->audio_fd < 0) { - DSP_CloseDevice(this); - return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); - } - this->hidden->mixbuf = NULL; - - /* Make the file descriptor use blocking writes with fcntl() */ - { - long ctlflags; - ctlflags = fcntl(this->hidden->audio_fd, F_GETFL); - ctlflags &= ~O_NONBLOCK; - if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) { - DSP_CloseDevice(this); - return SDL_SetError("Couldn't set audio blocking mode"); - } - } - - /* Get a list of supported hardware formats */ - if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) { - perror("SNDCTL_DSP_GETFMTS"); - DSP_CloseDevice(this); - return SDL_SetError("Couldn't get audio format list"); - } - - /* Try for a closest match on audio format */ - format = 0; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - if (value & AFMT_U8) { - format = AFMT_U8; - } - break; - case AUDIO_S16LSB: - if (value & AFMT_S16_LE) { - format = AFMT_S16_LE; - } - break; - case AUDIO_S16MSB: - if (value & AFMT_S16_BE) { - format = AFMT_S16_BE; - } - break; -#if 0 -/* - * These formats are not used by any real life systems so they are not - * needed here. - */ - case AUDIO_S8: - if (value & AFMT_S8) { - format = AFMT_S8; - } - break; - case AUDIO_U16LSB: - if (value & AFMT_U16_LE) { - format = AFMT_U16_LE; - } - break; - case AUDIO_U16MSB: - if (value & AFMT_U16_BE) { - format = AFMT_U16_BE; - } - break; -#endif - default: - format = 0; - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); - } - } - if (format == 0) { - DSP_CloseDevice(this); - return SDL_SetError("Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - /* Set the audio format */ - value = format; - if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || - (value != format)) { - perror("SNDCTL_DSP_SETFMT"); - DSP_CloseDevice(this); - return SDL_SetError("Couldn't set audio format"); - } - - /* Set the number of channels of output */ - value = this->spec.channels; - if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) { - perror("SNDCTL_DSP_CHANNELS"); - DSP_CloseDevice(this); - return SDL_SetError("Cannot set the number of channels"); - } - this->spec.channels = value; - - /* Set the DSP frequency */ - value = this->spec.freq; - if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) { - perror("SNDCTL_DSP_SPEED"); - DSP_CloseDevice(this); - return SDL_SetError("Couldn't set audio frequency"); - } - this->spec.freq = value; - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Determine the power of two of the fragment size */ - for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec); - if ((0x01U << frag_spec) != this->spec.size) { - DSP_CloseDevice(this); - return SDL_SetError("Fragment size must be a power of two"); - } - frag_spec |= 0x00020000; /* two fragments, for low latency */ - - /* Set the audio buffering parameters */ -#ifdef DEBUG_AUDIO - fprintf(stderr, "Requesting %d fragments of size %d\n", - (frag_spec >> 16), 1 << (frag_spec & 0xFFFF)); -#endif - if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) { - perror("SNDCTL_DSP_SETFRAGMENT"); - } -#ifdef DEBUG_AUDIO - { - audio_buf_info info; - ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETOSPACE, &info); - fprintf(stderr, "fragments = %d\n", info.fragments); - fprintf(stderr, "fragstotal = %d\n", info.fragstotal); - fprintf(stderr, "fragsize = %d\n", info.fragsize); - fprintf(stderr, "bytes = %d\n", info.bytes); - } -#endif - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - DSP_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -DSP_PlayDevice(_THIS) -{ - const Uint8 *mixbuf = this->hidden->mixbuf; - const int mixlen = this->hidden->mixlen; - if (write(this->hidden->audio_fd, mixbuf, mixlen) == -1) { - perror("Audio write"); - this->enabled = 0; - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen); -#endif -} - -static Uint8 * -DSP_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static int -DSP_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->DetectDevices = DSP_DetectDevices; - impl->OpenDevice = DSP_OpenDevice; - impl->PlayDevice = DSP_PlayDevice; - impl->GetDeviceBuf = DSP_GetDeviceBuf; - impl->CloseDevice = DSP_CloseDevice; - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap DSP_bootstrap = { - "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_OSS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.h b/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.h deleted file mode 100644 index 5cbb563b9..000000000 --- a/Source/3rdParty/sdl/src/audio/dsp/SDL_dspaudio.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_dspaudio_h -#define _SDL_dspaudio_h - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - int audio_fd; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* _SDL_dspaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.c b/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.c deleted file mode 100644 index 671e222cf..000000000 --- a/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -/* Output audio to nowhere... */ - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_dummyaudio.h" - -static int -DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - return 0; /* always succeeds. */ -} - -static int -DUMMYAUD_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = DUMMYAUD_OpenDevice; - impl->OnlyHasDefaultOutputDevice = 1; - return 1; /* this audio target is available. */ -} - -AudioBootStrap DUMMYAUD_bootstrap = { - "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1 -}; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.h b/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.h deleted file mode 100644 index 185401113..000000000 --- a/Source/3rdParty/sdl/src/audio/dummy/SDL_dummyaudio.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_dummyaudio_h -#define _SDL_dummyaudio_h - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - Uint8 *mixbuf; - Uint32 mixlen; - Uint32 write_delay; - Uint32 initial_calls; -}; - -#endif /* _SDL_dummyaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.c b/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.c deleted file mode 100644 index e675272dc..000000000 --- a/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ESD - -/* Allow access to an ESD network stream mixing buffer */ - -#include -#include -#include -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_esdaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC - -static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; -static void *esd_handle = NULL; - -static int (*SDL_NAME(esd_open_sound)) (const char *host); -static int (*SDL_NAME(esd_close)) (int esd); -static int (*SDL_NAME(esd_play_stream)) (esd_format_t format, int rate, - const char *host, const char *name); - -#define SDL_ESD_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} const esd_functions[] = { - SDL_ESD_SYM(esd_open_sound), - SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream), -}; - -#undef SDL_ESD_SYM - -static void -UnloadESDLibrary() -{ - if (esd_handle != NULL) { - SDL_UnloadObject(esd_handle); - esd_handle = NULL; - } -} - -static int -LoadESDLibrary(void) -{ - int i, retval = -1; - - if (esd_handle == NULL) { - esd_handle = SDL_LoadObject(esd_library); - if (esd_handle) { - retval = 0; - for (i = 0; i < SDL_arraysize(esd_functions); ++i) { - *esd_functions[i].func = - SDL_LoadFunction(esd_handle, esd_functions[i].name); - if (!*esd_functions[i].func) { - retval = -1; - UnloadESDLibrary(); - break; - } - } - } - } - return retval; -} - -#else - -static void -UnloadESDLibrary() -{ - return; -} - -static int -LoadESDLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */ - - -/* This function waits until it is possible to write a full sound buffer */ -static void -ESD_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - this->enabled = 0; - } - } - } - - /* Use timer for general audio synchronization */ - ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ESD_PlayDevice(_THIS) -{ - int written = 0; - - /* Write the audio data, checking for EAGAIN on broken audio drivers */ - do { - written = write(this->hidden->audio_fd, - this->hidden->mixbuf, this->hidden->mixlen); - if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while ((written < 0) && - ((errno == 0) || (errno == EAGAIN) || (errno == EINTR))); - - /* Set the next write frame */ - this->hidden->next_frame += this->hidden->frame_ticks; - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - this->enabled = 0; - } -} - -static Uint8 * -ESD_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -ESD_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - SDL_NAME(esd_close) (this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -/* Try to get the name of the program */ -static char * -get_progname(void) -{ - char *progname = NULL; -#ifdef __LINUX__ - FILE *fp; - static char temp[BUFSIZ]; - - SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); - fp = fopen(temp, "r"); - if (fp != NULL) { - if (fgets(temp, sizeof(temp) - 1, fp)) { - progname = SDL_strrchr(temp, '/'); - if (progname == NULL) { - progname = temp; - } else { - progname = progname + 1; - } - } - fclose(fp); - } -#endif - return (progname); -} - - -static int -ESD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - esd_format_t format = (ESD_STREAM | ESD_PLAY); - SDL_AudioFormat test_format = 0; - int found = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - this->hidden->audio_fd = -1; - - /* Convert audio spec to the ESD audio format */ - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !found && test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - found = 1; - switch (test_format) { - case AUDIO_U8: - format |= ESD_BITS8; - break; - case AUDIO_S16SYS: - format |= ESD_BITS16; - break; - default: - found = 0; - break; - } - } - - if (!found) { - ESD_CloseDevice(this); - return SDL_SetError("Couldn't find any hardware audio formats"); - } - - if (this->spec.channels == 1) { - format |= ESD_MONO; - } else { - format |= ESD_STEREO; - } -#if 0 - this->spec.samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */ -#endif - - /* Open a connection to the ESD audio server */ - this->hidden->audio_fd = - SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL, - get_progname()); - - if (this->hidden->audio_fd < 0) { - ESD_CloseDevice(this); - return SDL_SetError("Couldn't open ESD connection"); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - this->hidden->frame_ticks = - (float) (this->spec.samples * 1000) / this->spec.freq; - this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks; - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - ESD_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -ESD_Deinitialize(void) -{ - UnloadESDLibrary(); -} - -static int -ESD_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadESDLibrary() < 0) { - return 0; - } else { - int connection = 0; - - /* Don't start ESD if it's not running */ - SDL_setenv("ESD_NO_SPAWN", "1", 0); - - connection = SDL_NAME(esd_open_sound) (NULL); - if (connection < 0) { - UnloadESDLibrary(); - SDL_SetError("ESD: esd_open_sound failed (no audio server?)"); - return 0; - } - SDL_NAME(esd_close) (connection); - } - - /* Set the function pointers */ - impl->OpenDevice = ESD_OpenDevice; - impl->PlayDevice = ESD_PlayDevice; - impl->WaitDevice = ESD_WaitDevice; - impl->GetDeviceBuf = ESD_GetDeviceBuf; - impl->CloseDevice = ESD_CloseDevice; - impl->Deinitialize = ESD_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap ESD_bootstrap = { - "esd", "Enlightened Sound Daemon", ESD_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_ESD */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.h b/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.h deleted file mode 100644 index e0d5d4cdf..000000000 --- a/Source/3rdParty/sdl/src/audio/esd/SDL_esdaudio.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_esdaudio_h -#define _SDL_esdaudio_h - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - int audio_fd; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* _SDL_esdaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.c b/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.c deleted file mode 100644 index b8367715f..000000000 --- a/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_FUSIONSOUND - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_fsaudio.h" - -#include - -/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */ - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1) -typedef DFBResult DirectResult; -#endif - -/* Buffers to use - more than 2 gives a lot of latency */ -#define FUSION_BUFFERS (2) - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC - -static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC; -static void *fs_handle = NULL; - -static DirectResult (*SDL_NAME(FusionSoundInit)) (int *argc, char *(*argv[])); -static DirectResult (*SDL_NAME(FusionSoundCreate)) (IFusionSound ** - ret_interface); - -#define SDL_FS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} fs_functions[] = { -/* *INDENT-OFF* */ - SDL_FS_SYM(FusionSoundInit), - SDL_FS_SYM(FusionSoundCreate), -/* *INDENT-ON* */ -}; - -#undef SDL_FS_SYM - -static void -UnloadFusionSoundLibrary() -{ - if (fs_handle != NULL) { - SDL_UnloadObject(fs_handle); - fs_handle = NULL; - } -} - -static int -LoadFusionSoundLibrary(void) -{ - int i, retval = -1; - - if (fs_handle == NULL) { - fs_handle = SDL_LoadObject(fs_library); - if (fs_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(fs_functions); ++i) { - *fs_functions[i].func = - SDL_LoadFunction(fs_handle, fs_functions[i].name); - if (!*fs_functions[i].func) { - retval = -1; - UnloadFusionSoundLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadFusionSoundLibrary() -{ - return; -} - -static int -LoadFusionSoundLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -SDL_FS_WaitDevice(_THIS) -{ - this->hidden->stream->Wait(this->hidden->stream, - this->hidden->mixsamples); -} - -static void -SDL_FS_PlayDevice(_THIS) -{ - DirectResult ret; - - ret = this->hidden->stream->Write(this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixsamples); - /* If we couldn't write, assume fatal error for now */ - if (ret) { - this->enabled = 0; - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - -static void -SDL_FS_WaitDone(_THIS) -{ - this->hidden->stream->Wait(this->hidden->stream, - this->hidden->mixsamples * FUSION_BUFFERS); -} - - -static Uint8 * -SDL_FS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -SDL_FS_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->stream) { - this->hidden->stream->Release(this->hidden->stream); - this->hidden->stream = NULL; - } - if (this->hidden->fs) { - this->hidden->fs->Release(this->hidden->fs); - this->hidden->fs = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - - -static int -SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) -{ - int bytes; - SDL_AudioFormat test_format = 0, format = 0; - FSSampleFormat fs_format; - FSStreamDescription desc; - DirectResult ret; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - fs_format = FSSF_U8; - bytes = 1; - format = 1; - break; - case AUDIO_S16SYS: - fs_format = FSSF_S16; - bytes = 2; - format = 1; - break; - case AUDIO_S32SYS: - fs_format = FSSF_S32; - bytes = 4; - format = 1; - break; - case AUDIO_F32SYS: - fs_format = FSSF_FLOAT; - bytes = 4; - format = 1; - break; - default: - format = 0; - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); - } - } - - if (format == 0) { - SDL_FS_CloseDevice(this); - return SDL_SetError("Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - /* Retrieve the main sound interface. */ - ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); - if (ret) { - SDL_FS_CloseDevice(this); - return SDL_SetError("Unable to initialize FusionSound: %d", ret); - } - - this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels; - - /* Fill stream description. */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_PREBUFFER; - desc.samplerate = this->spec.freq; - desc.buffersize = this->spec.size * FUSION_BUFFERS; - desc.channels = this->spec.channels; - desc.prebuffer = 10; - desc.sampleformat = fs_format; - - ret = - this->hidden->fs->CreateStream(this->hidden->fs, &desc, - &this->hidden->stream); - if (ret) { - SDL_FS_CloseDevice(this); - return SDL_SetError("Unable to create FusionSoundStream: %d", ret); - } - - /* See what we got */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT; - ret = this->hidden->stream->GetDescription(this->hidden->stream, &desc); - - this->spec.freq = desc.samplerate; - this->spec.size = - desc.buffersize / FUSION_BUFFERS * bytes * desc.channels; - this->spec.channels = desc.channels; - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - SDL_FS_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -SDL_FS_Deinitialize(void) -{ - UnloadFusionSoundLibrary(); -} - - -static int -SDL_FS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadFusionSoundLibrary() < 0) { - return 0; - } else { - DirectResult ret; - - ret = SDL_NAME(FusionSoundInit) (NULL, NULL); - if (ret) { - UnloadFusionSoundLibrary(); - SDL_SetError - ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)", - ret); - return 0; - } - } - - /* Set the function pointers */ - impl->OpenDevice = SDL_FS_OpenDevice; - impl->PlayDevice = SDL_FS_PlayDevice; - impl->WaitDevice = SDL_FS_WaitDevice; - impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; - impl->CloseDevice = SDL_FS_CloseDevice; - impl->WaitDone = SDL_FS_WaitDone; - impl->Deinitialize = SDL_FS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap FUSIONSOUND_bootstrap = { - "fusionsound", "FusionSound", SDL_FS_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.h b/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.h deleted file mode 100644 index 1f9d6bd27..000000000 --- a/Source/3rdParty/sdl/src/audio/fusionsound/SDL_fsaudio.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_fsaudio_h -#define _SDL_fsaudio_h - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* Interface */ - IFusionSound *fs; - - /* The stream interface for the audio device */ - IFusionSoundStream *stream; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - int mixsamples; - -}; - -#endif /* _SDL_fsaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.cc b/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.cc deleted file mode 100644 index dddb77922..000000000 --- a/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_HAIKU - -/* Allow access to the audio stream on Haiku */ - -#include -#include - -#include "../../main/haiku/SDL_BeApp.h" - -extern "C" -{ - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_haikuaudio.h" - -} - - -/* !!! FIXME: have the callback call the higher level to avoid code dupe. */ -/* The Haiku callback for handling the audio buffer */ -static void -FillSound(void *device, void *stream, size_t len, - const media_raw_audio_format & format) -{ - SDL_AudioDevice *audio = (SDL_AudioDevice *) device; - - /* Only do soemthing if audio is enabled */ - if (!audio->enabled) - return; - - if (!audio->paused) { - if (audio->convert.needed) { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) audio->convert.buf, - audio->convert.len); - SDL_UnlockMutex(audio->mixer_lock); - SDL_ConvertAudio(&audio->convert); - SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt); - } else { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) stream, len); - SDL_UnlockMutex(audio->mixer_lock); - } - } -} - -static void -HAIKUAUDIO_CloseDevice(_THIS) -{ - if (_this->hidden != NULL) { - if (_this->hidden->audio_obj) { - _this->hidden->audio_obj->Stop(); - delete _this->hidden->audio_obj; - _this->hidden->audio_obj = NULL; - } - - delete _this->hidden; - _this->hidden = NULL; - } -} - - -static const int sig_list[] = { - SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGWINCH, 0 -}; - -static inline void -MaskSignals(sigset_t * omask) -{ - sigset_t mask; - int i; - - sigemptyset(&mask); - for (i = 0; sig_list[i]; ++i) { - sigaddset(&mask, sig_list[i]); - } - sigprocmask(SIG_BLOCK, &mask, omask); -} - -static inline void -UnmaskSignals(sigset_t * omask) -{ - sigprocmask(SIG_SETMASK, omask, NULL); -} - - -static int -HAIKUAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) -{ - int valid_datatype = 0; - media_raw_audio_format format; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format); - - /* Initialize all variables that we clean on shutdown */ - _this->hidden = new SDL_PrivateAudioData; - if (_this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(_this->hidden, 0, (sizeof *_this->hidden)); - - /* Parse the audio format and fill the Be raw audio format */ - SDL_memset(&format, '\0', sizeof(media_raw_audio_format)); - format.byte_order = B_MEDIA_LITTLE_ENDIAN; - format.frame_rate = (float) _this->spec.freq; - format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */ - while ((!valid_datatype) && (test_format)) { - valid_datatype = 1; - _this->spec.format = test_format; - switch (test_format) { - case AUDIO_S8: - format.format = media_raw_audio_format::B_AUDIO_CHAR; - break; - - case AUDIO_U8: - format.format = media_raw_audio_format::B_AUDIO_UCHAR; - break; - - case AUDIO_S16LSB: - format.format = media_raw_audio_format::B_AUDIO_SHORT; - break; - - case AUDIO_S16MSB: - format.format = media_raw_audio_format::B_AUDIO_SHORT; - format.byte_order = B_MEDIA_BIG_ENDIAN; - break; - - case AUDIO_S32LSB: - format.format = media_raw_audio_format::B_AUDIO_INT; - break; - - case AUDIO_S32MSB: - format.format = media_raw_audio_format::B_AUDIO_INT; - format.byte_order = B_MEDIA_BIG_ENDIAN; - break; - - case AUDIO_F32LSB: - format.format = media_raw_audio_format::B_AUDIO_FLOAT; - break; - - case AUDIO_F32MSB: - format.format = media_raw_audio_format::B_AUDIO_FLOAT; - format.byte_order = B_MEDIA_BIG_ENDIAN; - break; - - default: - valid_datatype = 0; - test_format = SDL_NextAudioFormat(); - break; - } - } - - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - HAIKUAUDIO_CloseDevice(_this); - return SDL_SetError("Unsupported audio format"); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&_this->spec); - - format.buffer_size = _this->spec.size; - - /* Subscribe to the audio stream (creates a new thread) */ - sigset_t omask; - MaskSignals(&omask); - _this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio", - FillSound, NULL, _this); - UnmaskSignals(&omask); - - if (_this->hidden->audio_obj->Start() == B_NO_ERROR) { - _this->hidden->audio_obj->SetHasData(true); - } else { - HAIKUAUDIO_CloseDevice(_this); - return SDL_SetError("Unable to start Be audio"); - } - - /* We're running! */ - return 0; -} - -static void -HAIKUAUDIO_Deinitialize(void) -{ - SDL_QuitBeApp(); -} - -static int -HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - /* Initialize the Be Application, if it's not already started */ - if (SDL_InitBeApp() < 0) { - return 0; - } - - /* Set the function pointers */ - impl->OpenDevice = HAIKUAUDIO_OpenDevice; - impl->CloseDevice = HAIKUAUDIO_CloseDevice; - impl->Deinitialize = HAIKUAUDIO_Deinitialize; - impl->ProvidesOwnCallbackThread = 1; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; /* this audio target is available. */ -} - -extern "C" -{ - extern AudioBootStrap HAIKUAUDIO_bootstrap; -} -AudioBootStrap HAIKUAUDIO_bootstrap = { - "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_HAIKU */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.h b/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.h deleted file mode 100644 index c6c019e9c..000000000 --- a/Source/3rdParty/sdl/src/audio/haiku/SDL_haikuaudio.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_beaudio_h -#define _SDL_beaudio_h - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *_this - -struct SDL_PrivateAudioData -{ - BSoundPlayer *audio_obj; -}; - -#endif /* _SDL_beaudio_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.c b/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.c deleted file mode 100644 index a41a480f2..000000000 --- a/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.c +++ /dev/null @@ -1,397 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_NAS - -/* Allow access to a raw mixing buffer */ - -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "SDL_loadso.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_nasaudio.h" - -static struct SDL_PrivateAudioData *this2 = NULL; - - -static void (*NAS_AuCloseServer) (AuServer *); -static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *); -static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *); -static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *); -static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *); -static void (*NAS_AuSetElements) - (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *); -static void (*NAS_AuWriteElement) - (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *); -static AuServer *(*NAS_AuOpenServer) - (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **); -static AuEventHandlerRec *(*NAS_AuRegisterEventHandler) - (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer); - - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC; -static void *nas_handle = NULL; - -static int -load_nas_sym(const char *fn, void **addr) -{ - *addr = SDL_LoadFunction(nas_handle, fn); - if (*addr == NULL) { - return 0; - } - return 1; -} - -/* cast funcs to char* first, to please GCC's strict aliasing rules. */ -#define SDL_NAS_SYM(x) \ - if (!load_nas_sym(#x, (void **) (char *) &NAS_##x)) return -1 -#else -#define SDL_NAS_SYM(x) NAS_##x = x -#endif - -static int -load_nas_syms(void) -{ - SDL_NAS_SYM(AuCloseServer); - SDL_NAS_SYM(AuNextEvent); - SDL_NAS_SYM(AuDispatchEvent); - SDL_NAS_SYM(AuCreateFlow); - SDL_NAS_SYM(AuStartFlow); - SDL_NAS_SYM(AuSetElements); - SDL_NAS_SYM(AuWriteElement); - SDL_NAS_SYM(AuOpenServer); - SDL_NAS_SYM(AuRegisterEventHandler); - return 0; -} - -#undef SDL_NAS_SYM - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static void -UnloadNASLibrary(void) -{ - if (nas_handle != NULL) { - SDL_UnloadObject(nas_handle); - nas_handle = NULL; - } -} - -static int -LoadNASLibrary(void) -{ - int retval = 0; - if (nas_handle == NULL) { - nas_handle = SDL_LoadObject(nas_library); - if (nas_handle == NULL) { - /* Copy error string so we can use it in a new SDL_SetError(). */ - const char *origerr = SDL_GetError(); - const size_t len = SDL_strlen(origerr) + 1; - char *err = (char *) alloca(len); - SDL_strlcpy(err, origerr, len); - retval = -1; - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s\n", - nas_library, err); - } else { - retval = load_nas_syms(); - if (retval < 0) { - UnloadNASLibrary(); - } - } - } - return retval; -} - -#else - -static void -UnloadNASLibrary(void) -{ -} - -static int -LoadNASLibrary(void) -{ - load_nas_syms(); - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -NAS_WaitDevice(_THIS) -{ - while (this->hidden->buf_free < this->hidden->mixlen) { - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } -} - -static void -NAS_PlayDevice(_THIS) -{ - while (this->hidden->mixlen > this->hidden->buf_free) { - /* - * We think the buffer is full? Yikes! Ask the server for events, - * in the hope that some of them is LowWater events telling us more - * of the buffer is free now than what we think. - */ - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } - this->hidden->buf_free -= this->hidden->mixlen; - - /* Write the audio data */ - NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0, - this->hidden->mixlen, this->hidden->mixbuf, AuFalse, - NULL); - - this->hidden->written += this->hidden->mixlen; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - -static Uint8 * -NAS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -NAS_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->aud) { - NAS_AuCloseServer(this->hidden->aud); - this->hidden->aud = 0; - } - SDL_free(this->hidden); - this2 = this->hidden = NULL; - } -} - -static unsigned char -sdlformat_to_auformat(unsigned int fmt) -{ - switch (fmt) { - case AUDIO_U8: - return AuFormatLinearUnsigned8; - case AUDIO_S8: - return AuFormatLinearSigned8; - case AUDIO_U16LSB: - return AuFormatLinearUnsigned16LSB; - case AUDIO_U16MSB: - return AuFormatLinearUnsigned16MSB; - case AUDIO_S16LSB: - return AuFormatLinearSigned16LSB; - case AUDIO_S16MSB: - return AuFormatLinearSigned16MSB; - } - return AuNone; -} - -static AuBool -event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) -{ - switch (ev->type) { - case AuEventTypeElementNotify: - { - AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; - - switch (event->kind) { - case AuElementNotifyKindLowWater: - if (this2->buf_free >= 0) { - this2->really += event->num_bytes; - gettimeofday(&this2->last_tv, 0); - this2->buf_free += event->num_bytes; - } else { - this2->buf_free = event->num_bytes; - } - break; - case AuElementNotifyKindState: - switch (event->cur_state) { - case AuStatePause: - if (event->reason != AuReasonUser) { - if (this2->buf_free >= 0) { - this2->really += event->num_bytes; - gettimeofday(&this2->last_tv, 0); - this2->buf_free += event->num_bytes; - } else { - this2->buf_free = event->num_bytes; - } - } - break; - } - } - } - } - return AuTrue; -} - -static AuDeviceID -find_device(_THIS, int nch) -{ - /* These "Au" things are all macros, not functions... */ - int i; - for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) { - if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) == - AuComponentKindPhysicalOutput) && - AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) { - return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i)); - } - } - return AuNone; -} - -static int -NAS_OpenDevice(_THIS, const char *devname, int iscapture) -{ - AuElement elms[3]; - int buffer_size; - SDL_AudioFormat test_format, format; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Try for a closest match on audio format */ - format = 0; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { - format = sdlformat_to_auformat(test_format); - if (format == AuNone) { - test_format = SDL_NextAudioFormat(); - } - } - if (format == 0) { - NAS_CloseDevice(this); - return SDL_SetError("NAS: Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (this->hidden->aud == 0) { - NAS_CloseDevice(this); - return SDL_SetError("NAS: Couldn't open connection to NAS server"); - } - - this->hidden->dev = find_device(this, this->spec.channels); - if ((this->hidden->dev == AuNone) - || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) { - NAS_CloseDevice(this); - return SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); - } - - buffer_size = this->spec.freq; - if (buffer_size < 4096) - buffer_size = 4096; - - if (buffer_size > 32768) - buffer_size = 32768; /* So that the buffer won't get unmanageably big. */ - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - this2 = this->hidden; - - AuMakeElementImportClient(elms, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size / 4, 0, NULL); - AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, - AuUnlimitedSamples, 0, NULL); - NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms, - NULL); - NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, - this->hidden->flow, event_handler, - (AuPointer) NULL); - - NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - NAS_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -NAS_Deinitialize(void) -{ - UnloadNASLibrary(); -} - -static int -NAS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadNASLibrary() < 0) { - return 0; - } else { - AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (aud == NULL) { - SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); - return 0; - } - NAS_AuCloseServer(aud); - } - - /* Set the function pointers */ - impl->OpenDevice = NAS_OpenDevice; - impl->PlayDevice = NAS_PlayDevice; - impl->WaitDevice = NAS_WaitDevice; - impl->GetDeviceBuf = NAS_GetDeviceBuf; - impl->CloseDevice = NAS_CloseDevice; - impl->Deinitialize = NAS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: is this true? */ - - return 1; /* this audio target is available. */ -} - -AudioBootStrap NAS_bootstrap = { - "nas", "Network Audio System", NAS_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_NAS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.h b/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.h deleted file mode 100644 index e1ee6a521..000000000 --- a/Source/3rdParty/sdl/src/audio/nas/SDL_nasaudio.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_nasaudio_h -#define _SDL_nasaudio_h - -#ifdef __sgi -#include -#else -#include